/* ==========================================================================
   Стройка. Светлая тема — тёплая бумага, тёмная — синька.
   Цифры моноширинные, всё остальное — обычный человеческий текст.
   ========================================================================== */

:root {
  --font-ui: 'Golos Text', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  --r: 10px;
  --r-sm: 7px;
  --tap: 46px;                 /* минимальная зона нажатия */
  --wrap: 940px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 10px 24px -18px rgba(0,0,0,.4);
}

html[data-theme="paper"] {
  --bg:        #EFEAE0;
  --surface:   #FBF9F5;
  --surface-2: #F1ECE1;
  --ink:       #1A1712;
  --ink-soft:  #5D5648;
  --ink-faint: #918978;
  --line:      #DCD4C3;
  --line-soft: #E8E2D5;
  --accent:      #BE441A;
  --accent-ink:  #FFF8F3;
  --accent-wash: rgba(190,68,26,.08);
  --good:      #2F6B47;
  --good-wash: rgba(47,107,71,.10);
  --bad:       #A32B20;
  --bad-wash:  rgba(163,43,32,.09);
  --grid:      rgba(26,23,18,.035);
  color-scheme: light;
}

html[data-theme="blueprint"] {
  --bg:        #0C141D;
  --surface:   #131F2B;
  --surface-2: #182734;
  --ink:       #E3EAF0;
  --ink-soft:  #94A9B9;
  --ink-faint: #6A7F90;
  --line:      #293B4D;
  --line-soft: #1E2E3D;
  --accent:      #F58A4F;
  --accent-ink:  #17110C;
  --accent-wash: rgba(245,138,79,.13);
  --good:      #5FB588;
  --good-wash: rgba(95,181,136,.14);
  --bad:       #E8705E;
  --bad-wash:  rgba(232,112,94,.14);
  --grid:      rgba(150,200,240,.04);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 88px 88px, 88px 88px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

.muted { color: var(--ink-faint); }
.is-good { color: var(--good); }
.is-bad  { color: var(--bad); }
.is-accent { color: var(--accent); }
.spacer { margin-right: auto; }

.lbl {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.lead { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 16px; max-width: 62ch; }
.hint { font-size: 13px; color: var(--ink-faint); margin-top: 7px; }
.fineprint { font-size: 12.5px; color: var(--ink-faint); margin-top: 22px; line-height: 1.6; }

/* ==============================  Шапка  ============================== */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 14px;
}
.topbar__id { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }

.mark {
  font-family: var(--font-mono);
  font-weight: 600; font-size: 13px;
  letter-spacing: .26em;
  color: var(--accent);
  white-space: nowrap;
}
.topbar__title {
  flex: 1; min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 6px 8px;
  font-size: 16px; font-weight: 500;
  outline: none;
}
.topbar__title:hover { background: var(--surface-2); }
.topbar__title:focus { border-color: var(--accent); background: var(--surface); }

.topbar__tools { display: flex; align-items: center; gap: 8px; }

/* ==============================  Кнопки  ============================== */

.btn {
  --bg-btn: var(--surface);
  --fg-btn: var(--ink);
  --br-btn: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--br-btn);
  background: var(--bg-btn);
  color: var(--fg-btn);
  border-radius: var(--r-sm);
  font-size: 14.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .12s var(--ease), background .16s var(--ease), border-color .16s var(--ease), filter .16s var(--ease);
}
.btn:hover { border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }

.btn--primary { --bg-btn: var(--accent); --fg-btn: var(--accent-ink); --br-btn: var(--accent); }
.btn--primary:hover { filter: brightness(1.08); border-color: var(--accent); }

.btn--quiet { --bg-btn: transparent; --fg-btn: var(--ink-soft); --br-btn: var(--line); }
.btn--quiet:hover { --fg-btn: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-wash); }

.btn--lg { min-height: var(--tap); padding: 12px 22px; font-size: 15.5px; }
.btn--sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.btn--block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.btn--add { padding-left: 14px; padding-right: 16px; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-sm);
  cursor: pointer; font-size: 15px;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--ink-faint); }
.icon-btn--sm { width: 32px; height: 32px; font-size: 13px; }

.link {
  background: none; border: 0; padding: 0;
  color: var(--accent); font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.link:hover { text-decoration-color: var(--accent); }
.link--sm { font-size: 13px; margin-top: 8px; display: inline-block; }

/* Плавающая кнопка — под большой палец на телефоне */
.fab { display: none; }

/* ==============================  Поля  ============================== */

.field {
  width: 100%;
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field:hover { border-color: var(--ink-faint); }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.field--lg { min-height: var(--tap); font-size: 16.5px; padding: 12px 14px; }
.field--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.field.is-error { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-wash); }
textarea.field { resize: vertical; min-height: 72px; }
select.field { cursor: pointer; }

.field-row { margin-bottom: 18px; }
.field-row:last-child { margin-bottom: 0; }

.money-input { position: relative; }
.money-input .field { padding-right: 42px; }
.money-input__cur {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); font-family: var(--font-mono); pointer-events: none;
}

.qty-box { margin-top: 10px; padding: 13px; background: var(--surface-2); border-radius: var(--r-sm); }
.qty-box__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qty-lbl { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 5px; }
.qty-pair { display: grid; grid-template-columns: 1fr 84px; gap: 7px; }

/* Сегменты — вместо выпадающих списков там, где вариантов мало */
.seg {
  display: inline-flex; flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  flex: 1;
  min-height: 38px;
  padding: 8px 14px;
  background: transparent; border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); color: var(--ink); }
.seg button.is-on { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.seg--lg { display: flex; width: 100%; }
.seg--lg button { min-height: var(--tap); font-size: 15px; }

/* ==============================  Вкладки  ============================== */

.tabs {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 6px 18px 0;
  display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  min-height: 42px;
  padding: 9px 16px;
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  font-size: 15px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.sheet {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 22px 18px 40px;
  border-top: 1px solid var(--line);
  margin-top: -1px;
}

/* ==============================  Главный экран  ============================== */

.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 26px 24px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  animation: rise .45s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero__label { font-size: 13.5px; color: var(--ink-soft); font-weight: 500; }
.hero__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(34px, 7vw, 52px);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.08;
  margin-top: 6px;
}
.hero__value--sm { font-size: clamp(26px, 5vw, 36px); font-family: var(--font-ui); letter-spacing: -.02em; }
.hero__sub { color: var(--ink-soft); font-size: 14.5px; margin-top: 5px; }
.hero__intro { color: var(--ink-soft); margin-top: 12px; max-width: 52ch; font-size: 15px; }
.hero--tight .hero__value { color: var(--bad); }

.hero__bar {
  position: relative;
  height: 10px;
  margin: 20px 0 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
}
.hero__bar-paid, .hero__bar-owed { position: absolute; inset: 0 auto 0 0; transition: width .6s var(--ease); }
.hero__bar-paid { background: var(--accent); z-index: 2; }
.hero__bar-owed {
  background: repeating-linear-gradient(115deg,
    color-mix(in srgb, var(--accent) 34%, transparent) 0 5px, transparent 5px 10px);
  z-index: 1;
}

.hero__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fact {
  display: block; text-align: left;
  min-height: var(--tap);
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.fact:hover { border-color: var(--accent); background: var(--accent-wash); }
.fact__label { display: block; font-size: 13px; color: var(--ink-soft); }
.fact__value {
  display: block; margin-top: 2px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 18px; font-weight: 500;
}

.verdict {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 16px; padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  background: var(--surface-2);
}
.verdict--good { background: var(--good-wash); color: var(--good); }
.verdict--bad  { background: var(--bad-wash);  color: var(--bad); }
.verdict__icon { font-weight: 700; line-height: 1.4; }
.verdict .link { color: inherit; }

/* Онбординг */
.hero--start { background: linear-gradient(160deg, var(--surface), var(--surface-2)); }
.steps { display: grid; gap: 12px; }
.step {
  display: flex; gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.step__num {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-mono); font-size: 14px; font-weight: 600;
}
.step__body strong { display: block; font-size: 15.5px; font-weight: 600; }
.step__body p { color: var(--ink-soft); font-size: 14px; margin: 4px 0 12px; }
.step__body p:last-child { margin-bottom: 0; }

/* ==============================  Блоки и списки  ============================== */

.block { margin-bottom: 32px; animation: rise .4s var(--ease) both; }
.block__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.block__title { font-size: 17px; }

.list { display: grid; gap: 8px; }

.row {
  display: flex; align-items: center; gap: 13px;
  width: 100%; text-align: left;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color .16s var(--ease), transform .12s var(--ease), background .16s var(--ease);
}
.row:hover { border-color: var(--ink-faint); }
.row:active { transform: scale(.995); }
.row.is-done { background: var(--surface-2); }
.row.is-done .row__name { color: var(--ink-soft); }

.row__main { flex: 1; min-width: 0; }
.row__name { font-size: 15.5px; font-weight: 500; overflow-wrap: anywhere; }
.row__note { font-size: 13px; color: var(--ink-faint); margin-top: 3px; }
.row__money { text-align: right; flex: none; }
.row__sum {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 15px; font-weight: 500; white-space: nowrap;
}

.check {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--accent-ink);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease);
}
.check:hover { border-color: var(--accent); }
.check:active { transform: scale(.9); }
.check.is-on { background: var(--good); border-color: var(--good); }

/* Строка-полоска (комнаты на главной) */
.row--bar { display: block; }
.row__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.track {
  position: relative;
  height: 8px; margin-top: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  overflow: hidden;
}
.track--sm { margin: 12px 0 6px; }
.track__paid, .track__owed { position: absolute; inset: 0 auto 0 0; transition: width .5s var(--ease); }
.track__paid { background: var(--accent); z-index: 2; border-radius: 5px; }
.track__paid.is-over { background: var(--bad); }
.track__owed {
  background: repeating-linear-gradient(115deg,
    color-mix(in srgb, var(--accent) 30%, transparent) 0 4px, transparent 4px 8px);
  z-index: 1;
}

/* Итоги под списком */
.summary {
  display: flex; flex-wrap: wrap; gap: 10px 28px;
  margin-top: 14px; padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--r);
}
.summary div { display: flex; flex-direction: column; gap: 2px; }
.summary span { font-size: 13px; color: var(--ink-soft); }
.summary b {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 16px; font-weight: 600;
}

/* Расчёт остатка */
.maths { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.maths__row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14.5px;
}
.maths__row:last-child { border-bottom: 0; }
.maths__row b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.maths__row--sum { background: var(--surface-2); font-weight: 500; }
.maths__row--final { background: var(--surface-2); font-size: 16px; font-weight: 600; }
.maths__row--final b { font-size: 18px; font-weight: 600; }
.maths__row--final.is-good b { color: var(--good); }
.maths__row--final.is-bad  b { color: var(--bad); }

/* ==============================  Карточки  ============================== */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 14px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 17px;
  transition: border-color .16s var(--ease);
}
.card:hover { border-color: var(--ink-faint); }
.card--muted { border-style: dashed; }
.card--wide { padding: 20px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card__name { font-size: 16.5px; }
.card__note { font-size: 13px; color: var(--ink-faint); margin-top: 4px; }
.card__figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 4px; }
.card__figs span { display: block; font-size: 12.5px; color: var(--ink-soft); }
.card__figs b {
  display: block; margin-top: 2px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 16.5px; font-weight: 500;
}
.card__foot { display: flex; gap: 8px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line-soft); }

/* ==============================  Пустые состояния  ============================== */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 34px 24px;
  text-align: center;
  background: var(--surface);
}
.empty--sm { padding: 18px; font-size: 14px; color: var(--ink-faint); }
.empty__icon {
  width: 44px; height: 44px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 19px;
}
.empty strong { display: block; font-size: 16.5px; font-weight: 600; }
.empty p { color: var(--ink-soft); font-size: 14.5px; margin: 6px auto 16px; max-width: 42ch; }

/* ==============================  Фильтры  ============================== */

.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .field { width: auto; min-width: 140px; }
.filters__search { flex: 1; min-width: 190px; }

/* ==============================  Модалка  ============================== */

.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: safe center; padding: 16px; overflow-y: auto; }
.modal__backdrop { position: fixed; inset: 0; background: rgba(12,10,6,.5); backdrop-filter: blur(3px); animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal__panel {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 30px 70px -28px rgba(0,0,0,.65);
  animation: pop .24s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }

.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal__head h2 { font-size: 17px; }
.modal__body { padding: 20px 18px; overflow-y: auto; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r) var(--r);
}

.more { margin-top: 4px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.more summary {
  cursor: pointer; list-style: none;
  color: var(--accent); font-size: 14px; font-weight: 500;
  padding: 4px 0;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '＋ '; }
.more[open] summary::before { content: '− '; }
.more__body { padding-top: 16px; }

.preview {
  display: flex; flex-wrap: wrap; gap: 6px 22px;
  margin-top: 16px;
  font-size: 14px; color: var(--ink-soft);
}
.preview:empty { display: none; }
.preview b { color: var(--ink); font-family: var(--font-mono); }

.warn {
  margin-top: 14px; padding: 13px 15px;
  background: var(--bad-wash);
  border-radius: var(--r-sm);
  font-size: 14px; color: var(--bad);
}

/* ==============================  Бэкапы  ============================== */

.dropzone {
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 22px 18px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14.5px;
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.dropzone span { display: block; font-size: 13px; color: var(--ink-faint); margin-top: 5px; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-wash); }

.backups { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.backup {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.backup__when { font-family: var(--font-mono); font-size: 13.5px; }
.backup__what { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

/* ==============================  Вход, тост, подвал  ============================== */

.gate { position: fixed; inset: 0; display: grid; place-items: safe center; overflow-y: auto; padding: 20px; }
.gate__card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.gate__mark { font-family: var(--font-mono); font-weight: 600; letter-spacing: .26em; color: var(--accent); font-size: 13px; }
.gate__h { font-size: 22px; margin-top: 10px; }
.gate__hint { font-size: 14.5px; color: var(--ink-soft); margin: 8px 0 20px; }
.gate__card .field { margin-bottom: 12px; }
.gate__error { min-height: 20px; margin-top: 10px; font-size: 13.5px; color: var(--bad); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 120;
  background: var(--ink); color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  box-shadow: 0 14px 30px -14px rgba(0,0,0,.6);
  animation: toast-in .24s var(--ease);
  max-width: calc(100vw - 32px);
}
.toast--bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.colophon {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 18px 32px;
  font-size: 12.5px; color: var(--ink-faint);
  display: flex; gap: 8px;
}
.colophon__sep { opacity: .5; }

/* ==============================  Телефон  ============================== */

@media (max-width: 720px) {
  .topbar__inner { padding: 10px 14px; gap: 10px; }
  .mark { display: none; }
  .topbar__title { font-size: 16px; padding-left: 0; }
  .btn__text { display: none; }
  .btn--add { width: 42px; padding: 0; font-size: 20px; }

  .tabs { padding: 4px 14px 0; }
  .sheet { padding: 18px 14px 96px; }
  .colophon { padding: 0 14px 26px; }

  .hero { padding: 20px 18px 18px; border-radius: var(--r); }
  .hero__facts { grid-template-columns: 1fr 1fr; gap: 8px; }
  .fact { padding: 10px 12px; }

  .cards { grid-template-columns: 1fr; }
  .qty-box__grid { grid-template-columns: 1fr; gap: 11px; }
  .filters .field, .filters__search { min-width: 0; width: 100%; }
  .seg { width: 100%; }

  .row { padding: 12px 13px; gap: 11px; }
  .summary { gap: 10px 20px; }

  /* Главное действие — всегда под большим пальцем */
  .fab {
    display: grid; place-items: center;
    position: fixed;
    right: 16px; bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 60;
    width: 58px; height: 58px;
    border: 0; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink);
    font-size: 28px; line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--accent) 70%, transparent);
    transition: transform .14s var(--ease);
  }
  .fab:active { transform: scale(.93); }

  .modal { padding: 0; place-items: end center; }
  .modal__panel {
    width: 100%;
    max-height: 94vh;
    border-radius: var(--r) var(--r) 0 0;
    animation: sheet-up .28s var(--ease);
  }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
  .modal__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal__foot .btn { flex: 1; }
  .modal__foot .spacer { flex: 1 0 100%; order: 3; margin-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
