/* ==========================================================================
   Вид «Дрим» — слой компонентов кабинета (03.10.2026).
   Рахман выбрал вариант «Дрим» из четырёх («дрим победил») и попросил собрать его сразу в боевом
   кабинете: синяя ткань, оригинальный логотип, шрифты и сетка по-взрослому, Дримчек в разных местах и
   в рабочих моментах (упаковывает приход, платит, записывает).
   Токены (цвета, шрифты, радиусы) живут в platform.css — здесь только var(). Файл подключён ПОСЛЕДНИМ:
   правило того же веса перекрывает platform.css и cabinet.css. Паспорт вида — ../DESIGN.md.
   Сетка: шаг 4 px; отступы 8 / 12 / 16 / 24 / 32; радиусы 10 / 14 / 18 / 22; кегли 12 / 13 / 14 / 15 / 18 / 26–32.
   ========================================================================== */

/* ---------------------------------------------------------------- база --- */
body { font-size: 14.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { letter-spacing: -0.005em; }
.mono, .num { letter-spacing: 0; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* ------------------------------------------------- рельс: синяя ткань --- */
.rail {
  background-color: var(--rail-bg);
  background-image: var(--rail-tint), var(--fabric);
  background-size: cover, cover;
  background-position: 0 0, 35% 0;
  border-right: 0;
}
.brand { flex-direction: column; align-items: flex-start; gap: 8px; padding: 26px 22px 18px; border-bottom: 0; }
.brand-logo { display: block; width: 156px; height: auto; filter: drop-shadow(0 6px 14px oklch(8% .06 258 / .45)); }
.brand-sub { font-size: 12px; letter-spacing: .02em; color: var(--rail-ink-3); padding-left: 4px; }

.nav { padding: 4px 12px 18px; }
.nav::-webkit-scrollbar-thumb { background: var(--rail-line); }
.nav-group { margin: 16px 0 4px; }
.nav-group-title { padding: 0 14px 8px; font: 600 11px/1 var(--font-ui); letter-spacing: .09em; color: var(--rail-ink-3); }
.nav-item {
  min-height: 46px; padding: 0 14px; gap: 12px; margin: 2px 0;
  border-radius: 999px; color: var(--rail-ink-2);
}
.nav-item svg { width: 20px; height: 20px; opacity: .85; }
.nav-item span { font-size: 14.5px; font-weight: 500; }
@media (hover: hover) { .nav-item:hover { background: oklch(100% 0 0 / .09); color: var(--rail-ink); } }
.nav-item.is-active {
  background: var(--rail-active-bg); color: var(--rail-active-ink); font-weight: 600; box-shadow: 0 8px 18px -12px oklch(8% .06 258 / .7);
}
.nav-item.is-active span { font-weight: 600; }
.nav-item.is-active svg { color: var(--dream); opacity: 1; }
.nav-item:focus-visible { outline: 2px solid var(--rail-ink); outline-offset: 1px; }
.nav-soon { opacity: .7; }
.nav-soon .nav-item { min-height: 40px; }
.nav-soon .nav-item span { font-size: 13.5px; }
/* счётчик дел у пункта меню: «8» у накладных */
.nav-n {
  margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px;
  display: inline-grid; place-items: center; font: 700 12px/1 var(--font-ui); font-style: normal;
  background: var(--accent); color: var(--accent-ink);
}
.nav-n[hidden] { display: none !important; }

.rail-foot { border-top: 1px solid var(--rail-line); padding: 14px 22px 18px; font-size: 12px; color: var(--rail-ink-3); }
.rail-foot .live .txt { color: var(--rail-ink-2); }
#foot-who { color: var(--rail-ink-2); font-size: 12.5px; }

/* Планшет и узкое окно (621–1180): таблица «Нужно сделать» шире экрана — кнопка действия прилипает к правому
   краю и не уезжает при прокрутке (до 03.10 на 800–900 px «Разобрать строки» пряталась за краем). */
@media (min-width: 621px) and (max-width: 1180px) {
  .work-tbl td.go {
    position: sticky; right: 0; z-index: 1; background: var(--surface);
    box-shadow: -16px 0 16px -14px oklch(20% .08 258 / .3);
  }
  .work-row.is-risk td.go { background: color-mix(in oklab, var(--risk-soft) 60%, var(--surface)); }
}
@media (max-width: 900px) { .inv-bar #reload { display: none; } }   /* список обновляется сам; кнопка «на всякий случай» переносилась одна */
@media (min-width: 761px) and (max-width: 1024px) {
  #foot-who { display: none; }          /* в сжатом рельсе имя ломалось в три строки */
}
@media (max-width: 1024px) {
  .brand { align-items: center; padding: 20px 0 14px; }
  .brand-logo { width: 56px; }
  .brand-sub { display: none; }
  .nav-item { padding: 0; justify-content: center; }
  /* сжатый рельс: счётчик дел маленьким кружком на значке */
  .nav-item .nav-n { position: absolute; top: 2px; right: 6px; margin: 0; min-width: 18px; height: 18px; padding: 0 4px; font-size: 10.5px; }
}
@media (max-width: 760px) {
  /* на телефоне рельс — выезжающее меню «Ещё»: подписи снова видны */
  .rail { width: 288px; --rail: 288px; box-shadow: 0 0 80px -20px oklch(5% .05 258 / .7); }
  .rail .brand { align-items: flex-start; padding: 24px 22px 14px; }
  .rail .brand-logo { width: 140px; }
  .rail .brand-sub { display: block; }
  .rail .nav-item { padding: 0 14px; justify-content: flex-start; }
  .rail .nav-item .nav-n { position: static; margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; font-size: 12px; }
  body.nav-open::after { background: var(--scrim); }
  /* закрытое меню не ловит Tab: пункты за краем экрана не получают фокус */
  .rail { visibility: hidden; transition: transform var(--mid) var(--ease), visibility 0s linear var(--mid); }
  body.nav-open .rail { visibility: visible; transition: transform var(--mid) var(--ease), visibility 0s; }
}

/* --------------------------------------------------------- верх экрана --- */
.topbar {
  height: var(--topbar); padding: 0 28px; gap: 10px;
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  border-bottom: 1px solid transparent;
}
.crumbs { font-size: 13px; color: var(--ink-3); }
.crumbs b { font: 600 14px/1.2 var(--font-ui); color: var(--ink); }
.pill {
  height: 40px; padding: 0 14px; gap: 8px; border-radius: 999px;
  font-size: 14px; color: var(--ink-2); background: var(--surface); border-color: var(--line);
}
.pill svg { width: 16px; height: 16px; }
.pill b { font-weight: 600; }
#theme-btn { width: 40px; padding: 0; justify-content: center; }
#theme-btn svg { width: 18px; height: 18px; opacity: .85; }
.menu { border-radius: var(--r-l); padding: 6px; }
.menu-item { min-height: 40px; border-radius: 10px; font-size: 14px; }
.top-logo { display: none; height: 34px; width: auto; }

.screen { padding: 24px 28px 64px; }

/* ------------------------------------------- полоса раздела: ткань и Дримчек --- */
.screen-head.hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px 16px;
  min-height: 148px; margin: 0 0 24px; padding: 26px 30px 24px;
  border-radius: var(--r-xl);
  background: var(--band-tint), var(--fabric) 50% 40% / cover no-repeat, var(--navy);
  color: var(--band-ink);
}
.screen-head.hero::after {               /* овал логотипа подкладкой под Дримчеком */
  content: ""; position: absolute; z-index: -1; right: -40px; bottom: -70px; width: 360px; height: 210px;
  border-radius: 50%; border: 2px solid oklch(100% 0 0 / .14); transform: rotate(-8deg); pointer-events: none;
}
.hero-t { min-width: 0; align-self: center; }
.screen-head.hero .screen-kicker {
  margin: 0 0 8px; color: var(--band-ink-2);
  font: 600 12px/1.2 var(--font-ui); letter-spacing: .08em; text-transform: uppercase;
}
.screen-head.hero h1 {
  font: 600 clamp(24px, 2.4vw, 32px)/1.12 var(--font-display); letter-spacing: var(--display-track);
  color: var(--band-ink); text-wrap: balance;
}
.screen-head.hero .hero-say { display: block; margin-top: 10px; max-width: 62ch; font-size: 15px; line-height: 1.45; color: var(--band-ink-2); }
.screen-head.hero .hero-say:empty { display: none; }
.hero-say b { color: var(--band-ink); font-weight: 600; }
.hero-dc[src$="sleep.webp"] { margin-bottom: -16px; }
.hero-dc {
  width: 156px; height: 156px; margin: -34px 6px -38px 0; position: relative; z-index: 1;
  filter: drop-shadow(0 16px 18px oklch(8% .06 258 / .45));
  animation: dc-bob 3.6s ease-in-out infinite;
}

/* ------------------------------------------------- карточки и заголовки --- */
.card { border-radius: var(--r-l); border-color: var(--line); box-shadow: var(--shadow-1); }
.card-head h3 { font: 600 15px/1.3 var(--font-ui); }
.sec-t { font: 600 18px/1.25 var(--font-display); letter-spacing: var(--display-track); gap: 10px; }
.sec-n { font: 700 12.5px/1 var(--font-ui); padding: 5px 9px; border: 0; background: var(--bg-deep); color: var(--ink-2); }
#work-sec .sec-n { background: var(--accent); color: var(--accent-ink); }
.inv-sec { margin-top: 24px; }
.inv-sec .card { margin-top: 12px; }
.label { font-weight: 600; letter-spacing: .06em; }
.screen-kicker { color: var(--accent-strong); font-weight: 600; }

/* метрики и суммы — «надутые» цифры Unbounded (у него нет табличных цифр, поэтому только одиночные числа) */
.card .metric .v, .rv-kpi .v, .ms-v, .hero-value, .sum-lead .sum-t b, .jobs-t b {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em;
}
.card .metric .v { font-size: 20px; }
.ms-v { font-size: 18px; }
.money-strip { background: var(--accent-soft); border-color: transparent; box-shadow: none; padding: 16px 20px; border-radius: var(--r-l); }
.ms-k { color: var(--ink-2); }

/* ------------------------------------------------------------- кнопки --- */
.btn {
  height: 40px; padding: 0 16px; gap: 8px; border-radius: 13px;
  font: 600 14px/1 var(--font-ui); letter-spacing: 0;
}
.btn svg, .btn .i { width: 17px; height: 17px; }
.btn.sm { height: 34px; padding: 0 12px; border-radius: 11px; font-size: 13px; gap: 6px; }
.btn.sm svg, .btn.sm .i { width: 15px; height: 15px; }
.btn.primary { border-color: var(--accent); box-shadow: 0 3px 0 var(--accent-edge); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-edge); }
.btn.primary[disabled] { box-shadow: none; }
.btn.primary.is-busy::after { border-color: var(--accent-ink); border-top-color: transparent; }
.btn-pay { color: var(--surface); }
@media (pointer: coarse) {
  .btn { min-height: 46px; }
  .btn.sm { min-height: 40px; }
}
/* главная кнопка карточки и окна — крупная, под палец */
.card-actions .btn { height: 48px; min-width: 240px; font-size: 15px; border-radius: 15px; max-width: 100%; }
/* «Следующая накладная: <поставщик> →» с длинным именем переносится, а не вылезает за край (ревью oracle) */
.card-actions .btn-next { height: auto; min-height: 48px; padding: 10px 16px; white-space: normal; line-height: 1.25; text-align: center; }
.sheet-foot .btn.primary { height: 46px; }

/* --------------------------------------------- чипы, бейджи, вкладки --- */
.chip { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500; }
@media (pointer: coarse) { .chip { height: 38px; } }
.badge { padding: 3px 10px; border-radius: 999px; border-color: transparent; font-size: 12px; font-weight: 600; }
.badge.acc { color: var(--accent-strong); }
/* текст-ссылки и охра на светлых плашках: 4,5:1 и выше (ревью oracle 03.10.2026) */
.link { color: var(--accent-strong); }
.ms-v.warn, .warn-txt { color: var(--warn-strong); }
.pick.tag.is-on, #sheet-body .picks.tags .tag.is-on, .pickbox.on { color: var(--accent-ink); }
.check .box svg { color: var(--surface); }

.subtabs {
  display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 18px; max-width: 100%;
  border-radius: 999px; background: var(--bg-deep); overflow-x: auto; scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab { padding: 9px 18px; border: 0; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.subtab.is-on { background: var(--surface); color: var(--ink); border: 0; box-shadow: 0 1px 3px oklch(22% .08 258 / .14); }
html[data-theme="dark"] .subtab.is-on { background: var(--surface-2); box-shadow: none; }

.seg { border-radius: 14px; padding: 4px; border-color: var(--line); background: var(--bg-deep); }
.seg button { border-radius: 10px; font-weight: 600; padding: 8px 14px; }
.seg button.is-on { background: var(--surface); box-shadow: 0 1px 3px oklch(22% .08 258 / .14); }
html[data-theme="dark"] .seg button.is-on { background: var(--surface-2); box-shadow: none; }

/* ------------------------------------------------- поиск, поля, списки --- */
.toolbar { padding: 14px 16px; gap: 10px; }
.toolbar select, .toolbar input[type="search"], .toolbar .dates input[type="date"] {
  height: 40px; border-radius: 12px; font-size: 14px; border-color: var(--line); background-color: var(--surface);
}
.toolbar input[type="search"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667394' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .toolbar input[type="search"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3aecb' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .inv-bar select, html[data-theme="dark"] #sheet-body select:not(.part-inline), html[data-theme="dark"] .step-point select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3aecb' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9.5l6 5.5 6-5.5'/%3E%3C/svg%3E");
}

#sheet-body input:not([type=checkbox]), #sheet-body select, #sheet-body textarea {
  padding: 11px 12px; border-radius: 12px; font-size: 15px; border-color: var(--line);
}
#sheet-body label { font-size: 13.5px; }
.gate-card input { border-radius: 12px; }

table.tbl { font-size: 14px; }
table.tbl th, .tbl-wrap thead th {
  padding: 11px 14px; background: var(--surface-2);
  font: 600 12.5px/1.2 var(--font-ui); letter-spacing: 0; text-transform: none; color: var(--ink-3);
}
table.tbl td { padding: 12px 14px; }
table.tbl td.num, table.tbl td.money { letter-spacing: 0; font-weight: 500; }
.tbl th.is-sorted { color: var(--accent-strong); }
.work-row.is-risk td { background: color-mix(in oklab, var(--risk-soft) 60%, transparent); }

/* ------------------------------------------------- журналы: сетка года --- */
table.tbl.jgrid td, table.tbl.jgrid th { padding: 8px 6px; }
table.tbl.jgrid td.j-name, table.tbl.jgrid th.j-name { padding-left: 16px; }
.jcell { padding: 7px 2px; border-radius: 999px; font-weight: 600; font-size: 12.5px; }
.j-name b { font-weight: 600; }
.j-legend .dot { border-radius: 50%; }

/* ----------------------------------------------------------- ревизия --- */
.rv-kpi { border: 0; border-radius: var(--r-l); background: var(--surface-2); }
.rv-kpi .v { font-size: 18px; }
.rv-kpi .k { letter-spacing: .03em; font-weight: 600; }

/* ---------------------------------------------- окно справа и лист снизу --- */
@media (min-width: 641px) {
  .modal { width: min(800px, 100%); }
  .modal-body { padding: 24px 28px 24px; }
  .sheet-foot { margin: 18px -28px -24px; padding: 14px 28px; }
}
#sheet-body h2 { font: 600 20px/1.25 var(--font-display); letter-spacing: var(--display-track); }
#sheet-body .card-head h2 { font-size: 20px; line-height: 1.25; }
#sheet-body .screen-kicker { margin-bottom: 6px; }
.step { margin-top: 16px; padding: 16px 18px; border: 0; border-radius: var(--r-l); }
.step-t { font: 600 16px/1.3 var(--font-ui); }
.step-w { font-size: 14px; color: var(--ink-2); }
.step-muted, .step-wait { background: var(--surface-2); }
.step-go { background: var(--accent-soft); }
.step.has-dc { position: relative; }
.step.has-dc > .step-t, .step.has-dc > .step-w { padding-right: 78px; }
.step-dc {
  position: absolute; right: 6px; top: 4px; width: 76px; height: 76px; pointer-events: none;
  animation: dc-bob 3.6s ease-in-out infinite;
}
.step.step-wait .step-dc, .step.step-go .step-dc { animation-name: dc-work; animation-duration: 1.6s; }

/* путь документа (signature): пройденное — синим Дримчека, текущее — кольцом */
.path-step { padding: 6px 14px 6px 7px; font-size: 13px; border-color: var(--line); background: var(--surface); }
.path-step i { width: 20px; height: 20px; border-width: 2px; }
.path-step i svg { width: 11px; height: 11px; }
.path-step.is-done { color: var(--ink-2); background: var(--surface); border-color: var(--line); }
.path-step.is-done i { background: var(--dream); border-color: var(--dream); color: var(--surface); }
.path-step.is-done + .path-step::before, .path-step.is-done + .path-step.is-done::before { background: var(--dream); height: 2px; }
.path-step.is-now { color: var(--ink); background: var(--accent-soft); border-color: var(--accent-line); font-weight: 600; }
.path-step.is-now i { border-color: var(--dream); }
.path-step.is-now i::after { background: var(--dream); }

.ctab { font-size: 14px; font-weight: 600; padding: 10px 14px; }
.ctab.is-on { border-bottom: 3px solid var(--dream); }
.item .name { font-size: 15px; }

/* заголовок окна с Дримчеком рядом */
.dc-h { display: flex; align-items: center; gap: 10px; }
.sh-dc { width: 54px; height: 54px; flex: none; margin: -12px 0 -10px -8px; animation: dc-pop .5s var(--ease) both; }

/* «Добавить накладную»: два пути, у каждого свой Дримчек */
.add-way { border-radius: var(--r-l); padding: 18px 18px 20px; }
.add-ways .drop { border-color: var(--accent-line); background: var(--accent-soft); }
.add-ways .add-way::before {
  content: ""; display: block; width: 76px; height: 76px; margin: -8px 0 2px -6px;
  background: url("img/dreamchek/read.webp") center / contain no-repeat;
}
.add-ways .add-hand::before { background-image: url("img/dreamchek/write.webp"); }
.up-done { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: center; border-radius: var(--r-l); }
.up-done > * { grid-column: 2; }
.up-dc { grid-column: 1; grid-row: 1 / span 3; width: 72px; height: 72px; animation: dc-work 1.6s ease-in-out infinite; }

/* накладная в пути на склад: Дримчек упаковывает приход */
.store-wait {
  display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 6px;
  border: 0; border-radius: var(--r-l); background: var(--accent-soft); color: var(--ink); font-weight: 600;
}
.store-wait::before, .store-wait.is-stuck::before {
  content: ""; display: block; flex: none; width: 64px; height: 64px; margin: 0; padding: 0;
  border: 0; border-radius: 0; vertical-align: auto;
  background: url("img/dreamchek/pack.webp") center / contain no-repeat;
  animation: dc-work 1.1s ease-in-out infinite;
}
.store-wait.is-stuck { background: var(--risk-soft); color: var(--risk); }
.store-wait.is-stuck::before { background-image: url("img/dreamchek/sad.webp"); animation: none; }

/* пустые места и ожидание — тоже с ним */
#screen > .empty, #inv-pane > .empty, #rv-pane > .empty, #list-empty, .rv-list .empty {
  border: 0; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-1); padding: 28px 20px 32px;
}
#screen > .empty::before, #inv-pane > .empty::before, #rv-pane > .empty::before, #list-empty::before, .rv-list .empty::before {
  content: ""; display: block; width: 116px; height: 116px; margin: 0 auto 8px;
  background: url("img/dreamchek/empty.webp") center / contain no-repeat;
}
.empty.dc-loading::before { background-image: url("img/dreamchek/loading.webp") !important; animation: dc-bob 2.4s ease-in-out infinite; }
.empty.dc-sad::before { background-image: url("img/dreamchek/sad.webp") !important; }
.empty.dc-sleep::before { background-image: url("img/dreamchek/sleep.webp") !important; }
.empty b { font-size: 15px; }
/* «Считаю» в ревизии и акте сверки: вместо крутилки Дримчек с лупой */
.sv-spin { gap: 14px; padding: 10px 16px 10px 10px; border: 0; border-radius: var(--r-l); background: var(--accent-soft); }
.sv-spin > .spinner { display: none; }
.sv-spin::before {
  content: ""; flex: none; width: 64px; height: 64px;
  background: url("img/dreamchek/search.webp") center / contain no-repeat; animation: dc-work 1.4s ease-in-out infinite;
}
.work-empty { position: relative; min-height: 100px; padding: 24px 18px 24px 108px; font-size: 14.5px; line-height: 1.45; }
.work-empty::before {
  content: ""; position: absolute; left: 18px; top: 50%; width: 76px; height: 76px; transform: translateY(-50%);
  background: url("img/dreamchek/done.webp") center / contain no-repeat;
}
.work-empty[hidden] { display: none !important; }

/* -------------------------------------------- уведомления с Дримчеком --- */
.toasts { right: 24px; bottom: 24px; }
.toast {
  gap: 12px; padding: 12px 18px 12px 12px; border-radius: 18px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  box-shadow: var(--shadow-pop); font-size: 14px; line-height: 1.4; max-width: min(440px, calc(100vw - 28px));
}
.toast.risk { border-color: color-mix(in oklab, var(--risk) 50%, var(--line)); background: var(--surface); }
.toast-dc { width: 60px; height: 60px; flex: none; margin: -20px -2px -16px -4px; animation: dc-pop .55s var(--ease) both; }

/* ------------------------- вопрос «точно?»: своё окно вместо серого окна браузера --- */
.ask {
  position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 20px;
  background: var(--scrim); animation: ask-in var(--mid) var(--ease) both;
}
.ask-card {
  width: min(440px, 100%); margin-top: 60px; display: grid; justify-items: center; gap: 8px; text-align: center;
  padding: 0 24px 22px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-pop);
  animation: ask-up var(--slow) var(--ease) both;
}
.ask-dc {
  width: 132px; height: 132px; margin: -68px 0 -2px; pointer-events: none;
  filter: drop-shadow(0 12px 14px oklch(10% .06 258 / .3)); animation: dc-pop .45s var(--ease) both;
}
.ask-t { font: 600 18px/1.35 var(--font-ui); color: var(--ink); text-wrap: balance; }
.ask-w { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); white-space: pre-line; max-height: 46vh; overflow-y: auto; }
.ask-w:empty { display: none; }
.ask-in {
  width: 100%; height: 48px; margin-top: 4px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: 400 16px var(--font-ui); text-align: center;
}
.ask-in:focus { outline: 2px solid color-mix(in oklab, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
.ask-acts { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.ask-acts .btn { height: auto; min-height: 48px; padding: 10px 14px; font-size: 15px; line-height: 1.2; white-space: normal; }
.ask-acts .ask-no { border: 1px solid var(--line); }
.ask-danger {
  background: var(--risk); border-color: var(--risk); color: var(--surface);
  box-shadow: 0 3px 0 color-mix(in oklab, var(--risk) 70%, black);
}
.ask-danger:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in oklab, var(--risk) 70%, black); }
@media (hover: hover) and (pointer: fine) { .ask-danger:hover { background: color-mix(in oklab, var(--risk) 88%, black); } }
@keyframes ask-in { from { opacity: 0; } }
@keyframes ask-up { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@media (max-width: 760px) {
  /* на телефоне вопрос снизу, под большим пальцем, как лист */
  .ask { align-items: end; padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .ask-card { width: 100%; padding: 0 18px 18px; }
  .ask-t { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { .ask, .ask-card, .ask-dc { animation: none; } }

/* ---------------------------------------------- вход: ткань и Дримчек --- */
.gate, .gate.gate-tg { background: var(--band-tint), var(--fabric) 50% 50% / cover no-repeat, var(--navy); }
.gate-stage { grid-template-columns: 300px minmax(0, 420px); gap: 48px; }
.gate-card, .gate-tg .gate-card {
  background: var(--surface); border: 0; border-radius: var(--r-xl);
  padding: 30px 30px 26px; box-shadow: 0 40px 90px -40px oklch(5% .05 258 / .85);
}
.gate-tg .gate-card { width: auto; max-width: 420px; }
.gate-mark {
  width: 152px; height: 54px; margin: 0 0 18px; font-size: 0; color: transparent;
  background: url("img/logo-oval.webp") left center / contain no-repeat;
}
.gate-tg .gate-card h1, .gate-card h1 { font: 600 26px/1.15 var(--font-display); letter-spacing: var(--display-track); margin: 4px 0 10px; }
.gate-note { font-size: 14px; color: var(--ink-3); }
.gate-tg .gate-card .btn { height: 50px; border-radius: 15px; font-size: 15.5px; }
.mascot { width: 300px; filter: drop-shadow(0 26px 30px oklch(5% .05 258 / .5)); }
.tg-qr-code { border-radius: 14px; }
.gate-alt { color: var(--accent-strong); }

/* ----------------------------------------------------- движение Дримчека --- */
@keyframes dc-bob  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes dc-work { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-3px) rotate(3deg); } }
@keyframes dc-pop  { from { opacity: 0; transform: translateY(10px) scale(.82); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .hero-dc, .step-dc, .store-wait::before, .sv-spin::before, .toast-dc, .sh-dc, .up-dc, .empty.dc-loading::before { animation: none !important; }
}

/* ------------------------------------- телефон: нижняя панель разделов --- */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --topbar: 58px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .top-logo { display: block; }
  .crumbs { display: none !important; }
  .burger { display: none !important; }
  .pill { height: 38px; padding: 0 12px; font-size: 13.5px; }
  #theme-btn { width: 38px; }
  .screen { padding: 14px 14px calc(104px + env(safe-area-inset-bottom, 0px)); }

  .screen-head.hero {
    margin: -14px -14px 18px; padding: 20px 16px 20px; min-height: 0; gap: 4px 6px;
    border-radius: 0 0 var(--r-xl) var(--r-xl);
  }
  .screen-head.hero::after { right: -70px; bottom: -86px; width: 260px; height: 170px; }
  .screen-head.hero h1 { font-size: 23px; }
  .screen-head.hero .hero-say { font-size: 14px; margin-top: 6px; }
  .screen-head.hero .screen-kicker { font-size: 11px; margin-bottom: 6px; }
  .hero-dc { width: 108px; height: 108px; margin: -16px -4px -26px 0; }

  .tabbar {
    position: fixed; z-index: 80; left: 0; right: 0; bottom: 0;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--tab-bg);
    box-shadow: 0 -1px 0 var(--line), 0 -14px 30px -22px oklch(18% .08 258 / .45);
  }
  .tab {
    display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 58px; padding: 4px 0;
    border: 0; background: none; color: var(--ink-3); cursor: pointer; touch-action: manipulation;
    font: 600 11.5px/1.1 var(--font-ui); -webkit-tap-highlight-color: transparent;
  }
  .tab-ic { position: relative; display: grid; place-items: center; width: 60px; height: 32px; border-radius: 999px; transition: background-color var(--mid) var(--ease); }
  .tab-ic svg { width: 23px; height: 23px; }
  .tab.is-on { color: var(--ink); }
  .tab.is-on .tab-ic { background: var(--accent-soft); }
  .tab.is-on .tab-ic svg { color: var(--dream); }
  .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 16px; }
  .tab:active .tab-ic { transform: scale(.94); }
  .tab .nav-n {
    position: absolute; top: -4px; left: calc(50% + 6px); margin: 0; min-width: 19px; height: 19px; padding: 0 5px;
    font-size: 11px; box-shadow: 0 0 0 2px var(--tab-bg);
  }
  .toasts { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .toast { max-width: none; }

  .gate.gate-tg { align-content: start; padding: 5dvh 16px 28px; }
  .gate-stage { grid-template-columns: 1fr; gap: 0; justify-items: center; }
  .mascot { width: 184px; margin-bottom: -30px; z-index: 1; }
  .gate-tg .gate-card { width: min(420px, 100%); padding: 34px 22px 22px; border-radius: var(--r-xl); }
  .gate-tg .gate-card h1 { font-size: 23px; }

  .toolbar input[type="search"], #sheet-body input:not([type=checkbox]), #sheet-body select, #sheet-body textarea,
  #sheet-body .item-num input.qty { font-size: 16px; }   /* iPhone не увеличивает страницу при вводе */
  .card-actions .btn { min-width: 0; }
  .sheet-foot .btn.primary { min-width: 0; }
  /* таблицы на телефоне плотнее (как было в platform.css: правило dream.css того же веса его перекрывало) */
  table.tbl { font-size: 13.5px; }
  table.tbl th, table.tbl td { padding: 10px 10px; }
  /* журналы: название журнала стоит на месте, месяцы прокручиваются под ним */
  table.tbl.jgrid th.j-name, table.tbl.jgrid td.j-name {
    position: sticky; left: 0; z-index: 2; min-width: 148px; max-width: 148px; padding-left: 12px;
    background: var(--surface); box-shadow: 14px 0 14px -14px oklch(20% .08 258 / .3);
  }
  table.tbl.jgrid th.j-name { background: var(--surface-2); z-index: 4; }
  /* ревизия: описание итога переносится, а суммы недостачи и излишка видны целиком */
  .rv-list .rv-head { min-width: 0; max-width: none; font-size: 12.5px; }
  .rv-list th, .rv-list td { padding-left: 8px; padding-right: 8px; }
  .rv-list .badge { white-space: normal; }
  /* доступы: «Изменить» прилипает к правому краю, не уезжает за прокрутку */
  #users-body td:last-child {
    position: sticky; right: 0; z-index: 1; background: var(--surface);
    box-shadow: -16px 0 16px -14px oklch(20% .08 258 / .3);
  }
  .modal { border-radius: var(--r-xl) var(--r-xl) 0 0; }
  #sheet-body h2, #sheet-body .card-head h2 { font-size: 18px; }
  .step-dc { width: 64px; height: 64px; }
  .step.has-dc > .step-t, .step.has-dc > .step-w { padding-right: 62px; }
  /* главная кнопка карточки прижата к низу листа: фон сплошной, без размытия — размытие под ней
     в части браузеров рисовалось цветной полосой, а размывать там нечего */
  #sheet-body.is-card > .card-actions {
    background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none;
    border-top-color: var(--line-soft); box-shadow: 0 -12px 24px -20px oklch(20% .08 258 / .45);
  }
}
@media (max-width: 640px) {
  /* Прежнее правило листа ставило в угол ВСЕ кнопки шапки любой карточки (задумано для «Закрыть»):
     в журналах «Фамилии для журналов» и «Обновить» ложились друг на друга. Кнопки ряда — в поток. */
  .card-head .right .btn { position: static; }
}
@media (max-width: 620px) {
  .inv-bar .dates select { width: 128px; max-width: 128px; }
  .inv-bar #f-search::placeholder { font-size: 14px; }   /* подсказка влезает, а набор остаётся 16 px */
}
@media (max-width: 480px) {
  .hide-xs { display: none; }
  .subtab { padding: 9px 14px; }
  /* путь документа в одну строку и на узком телефоне; длинный последний шаг («Платить не надо»)
     прокручивается, а не режется */
  .path { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .path::-webkit-scrollbar { display: none; }
  .path-step { font-size: 11.5px; padding: 4px 7px 4px 3px; gap: 3px; }
  .path-step i { width: 16px; height: 16px; }
  .path-step + .path-step { margin-left: 6px; }
  .path-step + .path-step::before { left: -7px; width: 6px; }
}
@media (max-width: 380px) {
  .rv-list td:first-child b { font-size: 13px; }
  .rv-list .badge { font-size: 11.5px; padding: 3px 8px; }
  .path-step { font-size: 11px; padding: 4px 6px 4px 3px; gap: 3px; }
  .path-step i { width: 14px; height: 14px; }
  .path-step + .path-step { margin-left: 5px; }
  .path-step + .path-step::before { left: -6px; width: 5px; }
  .hero-dc { width: 92px; height: 92px; }
  .screen-head.hero h1 { font-size: 21px; }
  .tab { font-size: 10.5px; }
  .tab-ic { width: 52px; }
}

/* ==========================================================================
   Окна на весь экран и айфон (21.10.2026).
   Рахман 19.10: накладная, оплата и правка товаров открывались панелью на полэкрана поверх затемнённого
   списка — «хочу на весь экран». Лера 18.10 (iPhone): в ручном вводе «Продуктовый магазин» половина
   экрана белая и всё скачет. Окно занимает весь экран, на телефоне — ровно видимую область над
   клавиатурой (`fitViewport` в cabinet.js пишет --vv-h и --vv-top), страница под окном не прокручивается
   (`html.sheet-open`), шапка окна с «Закрыть» всегда на виду.
   ========================================================================== */
html.sheet-open, html.sheet-open body { overflow: hidden; }
.overlay {
  top: var(--vv-top, 0px); bottom: auto; height: var(--vv-h, 100%);
  padding: 0; place-items: stretch; background: oklch(18% .015 var(--h) / .32);
}
.modal {
  width: 100%; max-width: none; height: 100%; max-height: none;
  border: 0; border-radius: 0; box-shadow: none;
  /* окно не листается вбок: черты шапки и низа нарисованы на ±100vmax и раздували ширину втрое — окно оплаты
     и карточка двигались пальцем и тачпадом в сторону (Рахман 21.10 16:1x: «почему можно двигать?») */
  overflow-x: hidden; overscroll-behavior-x: none;
  transform: translateY(14px); opacity: .6;
  transition: transform var(--slow) var(--ease-drawer), opacity var(--mid) var(--ease);
}
.overlay.is-open .modal { transform: none; opacity: 1; }
/* содержимое — колонкой по центру: на широком экране строки не растягиваются в нечитаемую ленту */
#sheet-body { width: 100%; max-width: 1120px; margin: 0 auto; min-height: 100%; }
/* шапка окна прилипает к верху: «Закрыть» и «Ещё» видны, сколько ни листай */
#sheet-body > .card-head {
  position: sticky; top: 0; z-index: 6;
  background: var(--surface);
  /* фон и черта шапки — на всю ширину окна, хотя содержимое стоит колонкой по центру. Рисуются выступом
     border-image: он за рамку не раздувает ширину окна (прежние черты на ±100vmax делали окно втрое шире экрана) */
  border-image: linear-gradient(to top, var(--line-soft) 1px, var(--surface) 1px) fill 0 / / 0 100vmax;
}
#sheet-body .sheet-foot { border-image: linear-gradient(to bottom, var(--line) 1px, var(--surface) 1px) fill 0 / / 0 100vmax; }
.ask { top: var(--vv-top, 0px); bottom: auto; height: var(--vv-h, 100%); }
@media (min-width: 641px) {
  .modal-body { padding: 0 32px 28px; }
  #sheet-body > .card-head { margin: 0 -32px 4px; padding: 22px 32px 16px; }
  .sheet-foot { margin: 18px -32px -28px; padding: 14px 32px; }
}
@media (max-width: 640px) {
  .modal { border-radius: 0; }
  .modal-body { padding: 0 16px 16px; }
  #sheet-body > .card-head { margin: 0 -16px 4px; padding: 12px 16px 10px; }
  #sheet-body .card-head.has-acts .head-acts { top: 10px; right: 12px; }
}
/* телефон: шапка без размытия (Safari пересчитывал размытие на каждом кадре прокрутки — подтормаживало) */
@media (max-width: 760px) {
  .topbar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal { transform: none; opacity: 1; transition: none; }
}
/* под пальцем всё нажимаемое не меньше 44 px (проход телефоном 21.10.2026: переключатели формы 32–36 px,
   вкладки раздела 39 px, галочки 16 px, «куда строка» 24 px) */
@media (pointer: coarse) {
  .subtab, .seg button { min-height: 44px; }
  .seg.seg-sm button { min-height: 40px; }
  #sheet-body input[type=checkbox], .check input[type=checkbox] { width: 22px; height: 22px; }
  #sheet-body select.part-inline { min-height: 36px; }
  #sheet-body .item-num input.qty { min-height: 42px; }
}
/* любая ссылка-кнопка в окне получает невидимый запас под палец (было только у строк товара) */
@media (max-width: 760px) {
  #sheet-body .link { position: relative; }
  #sheet-body .link::after { content: ""; position: absolute; left: -8px; right: -8px; top: -12px; bottom: -12px; }
}
/* Дримчек в липкой шапке окна не вылезает за верх экрана */
#sheet-body > .card-head .sh-dc { margin-top: -6px; }
/* шапка накладной: «‹ 3 из 8 ›» и «К списку» (на весь экран выход должен читаться, проверка ролями 21.10.2026) */
.qnav { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; }
.qnav-t { font-size: 13px; color: var(--ink-3); padding: 0 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qnav-b { min-width: 36px; justify-content: center; padding: 0 8px; }
.qnav-b .i { width: 16px; height: 16px; transform: rotate(90deg); }
.qnav-b:last-child .i { transform: rotate(-90deg); }
.btn-close > svg.i { display: none; }
.btn-close span .i { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; }
@media (max-width: 640px) {
  .qnav { display: none; }
  .btn-close > svg.i { display: inline-block; }
}
/* окна без липкой шапки (оплата, подтверждения) не прилипают к верху экрана: отступ у листа, а липкая шапка
   уходит вверх отрицательным полем (проверка дизайнером 21.10.2026: заголовок оплаты на 360 px касался края) */
@media (min-width: 641px) { .modal-body { padding-top: 22px; } #sheet-body > .card-head { margin-top: -22px; } }
@media (max-width: 640px) { .modal-body { padding-top: 14px; } #sheet-body > .card-head { margin-top: -14px; } }
/* подсвеченная строка товара: текст не упирается в край подложки */
.item.is-todo, .item.is-part { padding-left: 12px; padding-right: 12px; border-radius: 12px; }
/* сумма в шапке накладной — отдельным заметным числом, не хвостом серой подписи */
.head-sum { color: var(--ink); font-weight: 600; white-space: nowrap; }
/* колонка окна уже: между названием товара и числами меньше пустоты, глаз не теряет строку */
#sheet-body { max-width: 980px; }
/* телефон: «Документы | Справочники» и «От поставщика | Продуктовый магазин» — во всю ширину равными половинами */
@media (max-width: 640px) {
  .subtabs, #mn-who { display: flex; width: 100%; }
  .subtabs .subtab, #mn-who button { flex: 1 1 0; justify-content: center; text-align: center; }
}
