/* В Golos Text нет узбекского «ʻ» (U+02BB): браузер брал его из другого шрифта, и в жирном наклонном слогане входа
   «Oʻzingizniki» знак налезал на «z» (Windows, владелец 15.11.2026). uz-apostrophe.woff2 — тот же знак «‘» из
   Golos Text (OFL), назначенный на U+02BB; стоит в --font сразу после Golos Text. */
@font-face { font-family: "UZ Apostrophe"; src: url(/static/fonts/uz-apostrophe.woff2) format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+02BB; }
/* Склад — визуальный язык погрузочной площадки:
   графит (навигация), бетон (фон), жёлтый погрузчика (главные действия),
   зелёный — приход, кирпичный — расход. */
:root {
  --ink: #15171a;
  --ink-2: #202327;
  --ink-3: #2e3237;
  --ink-text: #c6c9ce;
  --bg: #eff0f2;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --border: #dde0e4;
  --border-strong: #c7cbd0;
  --text: #16181b;
  --muted: #62686f;
  --accent: #d0181f;
  --accent-hover: #b0131a;
  --accent-ink: #ffffff;
  --accent-soft: #fdeeee;
  --accent-line: #efb3b5;
  --primary: #1f5fbf;
  --primary-ink: #ffffff;
  --primary-soft: #e6eefa;
  --in: #1e8c6e;
  --in-soft: #e2f3ec;
  --out: #c8621b;
  --out-soft: #fbecdd;
  --ok: #1e8c6e;
  --ok-soft: #e2f3ec;
  --warn: #a8660a;
  --warn-soft: #fff1d6;
  --danger: #c4302b;
  --danger-soft: #fbe6e4;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(21, 23, 26, .04), 0 2px 6px rgba(21, 23, 26, .06);
  --font: "Golos Text", "UZ Apostrophe", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Unbounded", "Golos Text", "UZ Apostrophe", Arial, sans-serif;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body { -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.25; font-weight: 700; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
:focus-visible { outline: 3px solid rgba(21, 23, 26, .35); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mono { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.icon { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------ каркас */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 268px; flex-shrink: 0; background: var(--ink); color: var(--ink-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; stroke: var(--accent-ink); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: .01em; }
.brand-sub { display: block; font-family: var(--font); font-weight: 400; font-size: .75rem; color: var(--ink-text); letter-spacing: 0; }

.quick { display: grid; gap: 8px; padding: 4px 16px 14px; border-bottom: 1px solid var(--ink-3); }
.quick .btn { justify-content: center; padding: 11px 12px; font-size: .95rem; }
.quick .btn.out { background: transparent; color: #fff; border-color: var(--ink-3); }
.quick .btn.out:hover { background: var(--ink-2); }

/* прокручивается только список разделов: логотип, быстрые кнопки и блок «имя · язык · выйти» всегда на месте */
.sidebar nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }
.sidebar > .brand, .sidebar > .quick, .sidebar-user { flex-shrink: 0; }
.sidebar nav a {
  position: relative; display: flex; align-items: center; gap: 12px; color: var(--ink-text);
  padding: 9px 12px; border-radius: var(--radius-sm); margin: 1px 0; font-size: .95rem;
}
.sidebar nav a .icon { opacity: .8; }
.sidebar nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--ink-3); color: #fff; font-weight: 600; }
.sidebar nav a.active .icon { opacity: 1; color: var(--accent); }
.sidebar nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-group { font-size: .78rem; color: #8995a1; padding: 14px 12px 4px; }
/* группы меню сворачиваются; группа без пунктов (у роли нет прав) не показывается */
.nav-sec { border-top: 1px solid var(--ink-2); margin-top: 6px; padding-top: 2px; }
.nav-sec:not(:has(a)) { display: none; }
.nav-sec > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none;
  font-size: .8rem; font-weight: 600; color: #9aa6b2; padding: 10px 12px 6px; border-radius: var(--radius-sm); user-select: none; }
.nav-sec > summary::-webkit-details-marker { display: none; }
.nav-sec > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; opacity: .8; }
.nav-sec[open] > summary::after { transform: rotate(45deg); }
.nav-sec > summary:hover { color: #fff; }
.nav-sec:not([open]) > summary { padding-bottom: 10px; }
.nav-foot { border-top: 1px solid var(--ink-2); margin-top: 6px; padding-top: 6px; }
.nav-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: .76rem; font-weight: 700; text-align: center; line-height: 1.5; }
.sidebar-user { border-top: 1px solid var(--ink-3); padding: 12px 14px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.sidebar-user .who { display: flex; gap: 10px; align-items: center; color: #fff; min-width: 0; flex: 1; }
.sidebar-user .who-text { min-width: 0; }
.sidebar-user .who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user form { margin: 0; }
.sidebar-user .who:hover { text-decoration: none; }
.sidebar-user .who small { display: block; color: #8995a1; font-size: .75rem; }
.sidebar-user .who b { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.sidebar .btn.ghost { color: var(--ink-text); border-color: var(--ink-3); }
.sidebar .btn.ghost:hover { background: var(--ink-2); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 10px 12px; padding: 16px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
}
/* заголовок не рвётся на две строки: если кнопкам не хватает места, они целиком уходят строкой ниже, вправо */
.topbar h1 { font-size: 1.35rem; margin: 0; flex: 1 0 auto; letter-spacing: -.01em; white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; justify-content: flex-end; }
/* «📤 В Telegram» в отгрузке: выбор «кому» и кнопка — одной строкой, как обычная кнопка */
.topbar-actions form.tg-send { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.topbar-actions form.tg-send select { width: auto; max-width: 230px; min-height: 0; padding: 8px 10px; font-size: .9rem; }
.more-menu form.tg-send { display: flex; flex-direction: column; align-items: stretch; padding: 4px 0; }
.more-menu form.tg-send select { max-width: none; width: calc(100% - 24px); margin: 0 12px; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--text); }
/* на широком мониторе страница занимает всю ширину до поиска и колокольчика в шапке (раньше — 1480px, справа пусто) */
.content { padding: 24px 28px 48px; max-width: 2400px; width: 100%; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; height: auto; max-height: none; width: min(300px, 86vw);
    transform: translateX(-105%); z-index: 30; transition: transform .2s; box-shadow: none;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
  .sidebar.open { transform: none; }
  body.menu-open { overflow: hidden; }
  .sidebar.open { box-shadow: 0 0 60px rgba(0,0,0,.45); }
  .sidebar.open ~ .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(29,39,49,.4); z-index: 25; }
  .menu-btn { display: block; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ------------------------------------------------ блоки */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; }
.kpi .label { color: var(--muted); font-size: .88rem; }
.kpi .value { font-size: 1.7rem; font-weight: 700; margin: 6px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.kpi .sub { font-size: .84rem; color: var(--muted); }
.kpi.accent { border-top: 4px solid var(--in); }
.kpi.green { border-top: 4px solid var(--out); }
.kpi.profit { border-top: 4px solid var(--accent); }
.kpi.orange { border-top: 4px solid var(--warn); }
.kpi.red { border-top: 4px solid var(--danger); }
/* карточка без цветной полосы сверху: +3px отступа, чтобы текст стоял вровень с соседними (у них рамка 4px, а не 1px) */
.kpi:not(.accent, .green, .profit, .orange, .red) { padding-top: 21px; }
.delta { font-size: .8rem; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: .93rem; font-weight: 500; cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.success { background: var(--in); border-color: var(--in); color: #fff; font-weight: 700; }
.btn.success:hover { filter: brightness(1.08); }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: .84rem; }
.btn.lg { padding: 13px 22px; font-size: 1.02rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; margin: 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.st-draft { background: var(--warn-soft); color: var(--warn); border-color: #f0d49c; }
.st-posted { background: var(--ok-soft); color: var(--ok); border-color: #b5ddcd; }
.st-cancelled { background: var(--danger-soft); color: var(--danger); border-color: #f1c1bd; }
.badge.online { background: var(--ok-soft); color: var(--ok); border-color: #b5ddcd; }
.badge.offline { color: var(--muted); }
.badge.role { background: var(--primary-soft); color: var(--primary); border-color: #c4d6f2; }
.badge.in { background: var(--in-soft); color: var(--in); border-color: #b5ddcd; }
.badge.out { background: var(--out-soft); color: var(--out); border-color: #efc6bb; }
span.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c2c8c0; margin-right: 6px; }
span.dot.on { background: #22b37a; box-shadow: 0 0 0 3px #d4f2e5; }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); color: #126b53; border-color: #b5ddcd; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: #f1c1bd; }
.flash.warn { background: var(--warn-soft); color: #7d4c06; border-color: #f0d49c; }

/* ------------------------------------------------ таблицы */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .84rem; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
/* числовые колонки: заголовок по правому краю, как и сами числа (иначе table.t th перебивает .num) */
table th.num, table.t th.num { text-align: right; }
table th.center, table td.center { text-align: center; }
table.t tr:hover td { background: #fafbf8; }
table.t tr.row-link { cursor: pointer; }
table.t tfoot td { font-weight: 700; background: var(--surface-2); }
table.t tr.diff-minus td { background: var(--danger-soft); }
table.t tr.diff-plus td { background: var(--warn-soft); }
table.t tr.flash-row td { animation: flashrow 1.2s ease-out; }
@keyframes flashrow { from { background: #fff1b8; } to { background: transparent; } }
table.t input.cell { width: 110px; padding: 7px 9px; text-align: right; }
table.t input.cell.price { width: 130px; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px !important; }

/* ------------------------------------------------ формы */
label { display: block; font-size: .86rem; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  font: inherit; font-size: .97rem; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(21, 23, 26, .10); border-color: var(--ink); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--in); }
textarea { min-height: 70px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: 0; }
.field small { display: block; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: .95rem; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
details.more { margin-top: 16px; border-top: 1px dashed var(--border-strong); padding-top: 12px; }
details.more > summary { cursor: pointer; color: var(--primary); font-size: .92rem; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; font-weight: 700; }
details.more[open] > summary::before { content: "− "; }
details.more .form-grid { margin-top: 14px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { margin: 0; }
.filters.bulk { align-items: center; }     /* панель действий над таблицей: подпись, поле и кнопки на одной линии */
.filters input, .filters select { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 240px; }

/* ------------------------------------------------ шаги документа */
.steps { display: flex; gap: 0; margin: 0 0 18px; padding: 0; list-style: none; counter-reset: step; overflow-x: auto; }
.steps li { counter-increment: step; flex: 1; min-width: 120px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--muted); font-size: .92rem; position: relative; }
.steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--border-strong); background: var(--surface); flex-shrink: 0; }
.steps li:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--border-strong); margin-left: 6px; }
.steps li.done { color: var(--text); }
.steps li.done::before { content: "✓"; background: var(--in); border-color: var(--in); color: #fff; }
.steps li.done::after { background: var(--in); }
.steps li.now { color: var(--text); font-weight: 700; }
.steps li.now::before { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------ сканер */
.scan-box { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; background: var(--accent-soft); border: 2px dashed var(--accent-line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.scan-box input.scan { font-size: 1.3rem; padding: 14px 16px; flex: 1; min-width: 240px; font-family: ui-monospace, Menlo, Consolas, monospace; border-width: 2px; }
.scan-box input.qty { width: 96px; font-size: 1.15rem; text-align: center; }
.scan-box .hint { width: 100%; font-size: .86rem; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--accent-line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg label { margin: 0; padding: 11px 14px; cursor: pointer; color: var(--text); font-size: .92rem; display: flex; align-items: center; gap: 4px; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; font-weight: 600; }
.search-wrap { position: relative; flex: 1; min-width: 240px; }
.suggest { position: absolute; z-index: 30; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(29,39,49,.16); max-height: 320px; overflow-y: auto; }
.suggest div { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: .92rem; }
.suggest div:hover, .suggest div.sel { background: var(--accent-soft); }
.suggest small { color: var(--muted); }

.toast { position: fixed; right: 20px; top: 80px; z-index: 100; padding: 13px 18px; border-radius: var(--radius-sm); color: #fff; background: var(--ink); box-shadow: 0 12px 32px rgba(0,0,0,.25); max-width: 440px; font-size: .95rem; }
.toast.ok { background: var(--in); }
.toast.warn { background: var(--warn); }
.toast.error { background: var(--danger); }

dialog { border: 0; border-radius: var(--radius); padding: 0; box-shadow: 0 24px 64px rgba(0,0,0,.3); width: min(540px, 94vw); }
dialog::backdrop { background: rgba(29,39,49,.55); }
dialog .dlg-body { padding: 22px; }
dialog h3 { margin-top: 0; }

/* ------------------------------------------------ дашборд */
.hero { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.hero-trucks { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 22px 24px; position: relative; overflow: hidden; }
.hero-trucks::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 14px, var(--ink) 14px 28px); }
.hero-trucks .label { color: var(--ink-text); font-size: .9rem; }
.hero-trucks .big { font-family: var(--font-display); font-size: 3.2rem; font-weight: 700; line-height: 1; margin: 12px 0 8px; }
.hero-trucks .split { display: flex; gap: 22px; color: var(--ink-text); font-size: .92rem; padding-bottom: 8px; }
.hero-trucks .split b { color: #fff; font-size: 1.1rem; }
@media (max-width: 1100px) { .hero { grid-template-columns: 1fr; } }

.chart { width: 100%; height: 220px; }
.chart .bar-in { fill: var(--in); opacity: .85; }
.chart .bar-out { fill: var(--out); opacity: .85; }
.chart text { font-size: 10px; fill: var(--muted); }
.legend { display: flex; gap: 16px; font-size: .84rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .93rem; }
.list-plain li:last-child { border-bottom: 0; }
.daynav { display: flex; gap: 6px; align-items: center; }
.daynav input { width: auto; padding: 7px 10px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { display: flex; flex-direction: column; gap: 10px; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .icon { width: 30px; height: 30px; }
.tile b { font-size: 1.08rem; }
.tile span { color: var(--muted); font-size: .9rem; }
.tile.main { background: var(--accent); border-color: var(--accent); }
.tile.main span { color: #4a3d0a; }

/* ------------------------------------------------ вход */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); background: var(--surface); }
.login-side { background: var(--ink); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-side::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 16px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 18px, var(--ink) 18px 36px); }
.login-side .brand { padding: 0; }
.login-title { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.6rem); font-weight: 700; line-height: 1.15; margin: 40px 0 18px; max-width: 20ch; }
.login-lead { color: var(--ink-text); font-size: 1.05rem; line-height: 1.55; max-width: 44ch; }
.login-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 36px 0 30px; max-width: 560px; }
.login-facts div { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--ink-text); font-size: .9rem; line-height: 1.4; }
.login-facts b { display: block; color: #fff; font-size: 1rem; margin-bottom: 2px; }
.login-form-wrap { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.login-card { background: #fff; border-radius: var(--radius); padding: 34px; width: min(400px, 100%); border: 1px solid var(--border); box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.login-card .field { margin-bottom: 16px; }
@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-side { padding: 28px 22px 40px; }
  .login-title { margin-top: 24px; font-size: 1.9rem; }
  .login-facts { display: none; }
}

/* ------------------------------------------------ прочее */
.changes { font-size: .84rem; margin: 0; padding: 0; list-style: none; }
.changes li { padding: 1px 0; }
.changes .old { color: var(--danger); text-decoration: line-through; }
.changes .new { color: var(--ok); }
.barcode-preview svg { max-width: 260px; height: auto; display: block; }
.doc-header-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 22px; }
.doc-header-view div small { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 2px; }
.totals { display: flex; gap: 26px; justify-content: flex-end; flex-wrap: wrap; font-size: 1rem; margin-top: 14px; }
.totals b { font-size: 1.2rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 14px 0 4px; margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.sticky-actions:not(:has(*)) { display: none; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; padding: 12px; font-size: .92rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; border-bottom: 3px solid transparent; color: var(--muted); }
.tabs a.active { color: var(--text); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.partner-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 2px; }
.partner-chips:empty { display: none; }
.chip { border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: .84rem; cursor: pointer; }
.chip:hover { filter: brightness(.97); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table .grp td { background: var(--surface-2); font-weight: 700; text-align: left; }
.help h2 { margin-top: 1.4em; }
.help ol, .help ul { padding-left: 1.3em; line-height: 1.65; }
.help li { margin: 4px 0; }
.help p { line-height: 1.6; max-width: 80ch; }
.help .note { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ------------------------------------------------ телефон */
@media (max-width: 700px) {
  .hide-sm { display: none !important; }
  .topbar { flex-wrap: wrap; }
  .topbar h1 { font-size: 1.1rem; white-space: normal; flex: 1 1 0%; }   /* на телефоне заголовок переносится, */
  .topbar-actions { margin-left: 0; justify-content: flex-start; }     /* а кнопки — строкой ниже, слева */
  .topbar-actions .btn { padding: 7px 10px; font-size: .84rem; }
  table.t th, table.t td { padding: 8px 7px; }
  table.t input.cell { width: 72px; padding: 6px; }
  table.t input.cell.price { width: 90px; }
  .totals { gap: 6px 16px; font-size: .92rem; }
  .totals b { font-size: 1.05rem; }
  .scan-box input.scan { min-width: 0; font-size: 1.1rem; }
  .filters input, .filters select { min-width: 0; flex: 1 1 140px; }
  .filters input[type=search] { min-width: 0; }
  .card { padding: 16px; }
  .steps { overflow: visible; }
  .steps li { min-width: 0; padding: 8px 4px; font-size: .84rem; flex: 1 1 0; gap: 6px; }
  .steps li:last-child { flex: 0 0 auto; }
  .steps li.now { flex: 0 0 auto; }
  .steps li.now + li:last-child { flex: 0 0 auto; }
  .steps li:not(:last-child)::after { min-width: 10px; margin-left: 0; }
  .steps li span { display: none; }
  .steps li.now span { display: inline; white-space: nowrap; }
}
@media print { .sidebar, .topbar, .sticky-actions { display: none !important; } }

/* ---------- касса ---------- */
.btn.out { background: var(--out); color: #fff; border-color: var(--out); }
.btn.out:hover { filter: brightness(.95); }
.cash-now { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 18px; }
.cash-box { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cash-box .label { color: var(--ink-text); font-size: .9rem; }
.cash-box .big { font-size: 2.1rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cash-box .big.neg { color: #ff9b85; }
.cash-box .sub { color: var(--ink-text); font-size: .85rem; }
.cash-box.usd { border-left: 6px solid var(--in); }
.cash-box.total { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-top: 4px solid var(--accent); }
.cash-box.total .label, .cash-box.total .sub { color: var(--muted); }
.cash-box .btn { margin-top: 4px; }
.cash-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
td.in { color: var(--in); } td.out { color: var(--out); }
.cash-sum tr.total td { border-top: 2px solid var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
label.chip { display: inline-flex; align-items: center; padding: 9px 14px; font-size: .92rem; margin: 0; }
label.chip input { display: none; }
label.chip:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.close-diff { margin-top: 8px; font-weight: 700; font-size: 1.05rem; }
.close-diff.ok { color: var(--in); } .close-diff.warn { color: #9a6400; } .close-diff.bad { color: var(--danger); }
.bar-row { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.bar-row .bar { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--out); border-radius: 99px; }
@media (max-width: 700px) { .bar-row { grid-template-columns: 1fr auto; } .bar-row .bar { display: none; } .cash-actions .btn { flex: 1 1 100%; justify-content: center; } }
.seg label:has(input:checked) small { color: #cfd6dd; }
.quick-periods { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.quick-periods .chip { padding: 8px 12px; }
.mini-bars { display: flex; flex-direction: column; gap: 3px; min-width: 120px; }
.mini-bars i { display: block; height: 6px; border-radius: 99px; }
tr.total-row td { border-top: 2px solid var(--text); font-weight: 700; }
td.neg { color: var(--danger); }
/* на телефоне карточки в сетке всегда в одну колонку (span 2 создавал лишнюю колонку и страница уменьшалась) */
@media (max-width: 700px) { .grid > * { grid-column: auto !important; } }
@media (max-width: 1100px) and (min-width: 701px) { .grid.cols-3 > [style*="span 2"] { grid-column: 1 / -1 !important; } }
.grid > * { min-width: 0; }
@media (max-width: 900px) { .card:not(:has(.sticky-actions)) { overflow-x: auto; } }
/* шины */
.tire-box { background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px; }
/* размер шины — как литеры на боковине: светлые буквы на резине */
b.size { display: inline-block; font-family: var(--font-display); font-size: .78rem; font-weight: 600; letter-spacing: .03em; line-height: 1.5;
  background: var(--ink); color: #f6f3e7; padding: 2px 9px 1px; border-radius: 6px; white-space: nowrap; vertical-align: 1px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 -2px 0 rgba(0, 0, 0, .25); }
b.size:empty { display: none; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.tags .badge { font-size: .72rem; }
.unit-codes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.unit-codes .mono { font-size: .74rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.badge.q-pending { background: var(--warn-soft); color: #7d4c06; border-color: #f0d49c; }
.badge.q-approved { background: var(--in-soft); color: var(--in); border-color: #b5ddcd; }
.badge.q-blocked { background: var(--danger-soft); color: var(--danger); border-color: #f1c1bd; }
.unit-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.big-code { font-size: 1.5rem; font-weight: 700; }
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.photos figcaption { font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.photo-form { display: grid; gap: 8px; }
.reserve-form { display: inline-flex; gap: 6px; align-items: center; } .reserve-form select { width: auto; }
.howto { margin: 0 0 14px; padding-left: 20px; line-height: 1.6; }
.pa-cell { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.pa-log { list-style: none; padding: 0; margin: 12px 0 0; max-height: 340px; overflow: auto; }
.pa-log li { padding: 6px 10px; border-left: 4px solid var(--in); margin-bottom: 4px; background: var(--bg); border-radius: 0 6px 6px 0; }
.pa-log li.cell { border-color: var(--accent); font-weight: 700; }
.pa-log li.error { border-color: var(--danger); color: var(--danger); }
.pa-log li.warn { border-color: var(--warn); }
.lost-box { margin-top: 16px; }
.lost-box summary { cursor: pointer; }
.neg-text { color: var(--danger); }
.filters input[type=checkbox] { min-width: 0; width: auto; }
.filters label.check { white-space: nowrap; align-self: center; }   /* галочка — по центру строки, а не по низу полей */
/* ---------- кабинет клиента ---------- */
body.client { background: var(--bg); }
.c-top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--ink); color: #fff; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.c-brand { color: #fff; font-family: var(--font-display); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.c-brand:hover { text-decoration: none; }
.c-brand .brand-mark { width: 28px; height: 28px; font-size: 18px; color: var(--accent-ink); }
.c-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.c-nav a { color: var(--ink-text); padding: 8px 12px; border-radius: 8px; }
.c-nav a.active, .c-nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.c-nav b { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 7px; font-size: .78rem; }
.c-nav b:empty { display: none; }
.c-top .btn.ghost { color: var(--ink-text); border-color: var(--ink-3); }
.c-main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.c-login { max-width: 420px; margin: 60px auto; }
.c-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.c-item { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.c-size { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--text); }
.c-name { font-weight: 600; }
.c-price { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; }
.c-price small { font-family: var(--font); font-size: .78rem; color: var(--muted); font-weight: 400; }
.c-stock { color: var(--in); }
.c-buy { display: flex; gap: 8px; margin-top: auto; }
.c-buy input { width: 76px; min-width: 0; }
.c-buy .btn { flex: 1; justify-content: center; }
.c-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; margin-right: 4px; }
@media (max-width: 700px) { .c-top { gap: 8px; padding: 10px 12px; } .c-top form { width: 100%; } .c-nav a { padding: 6px 8px; } }
.client-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.access-box { background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 14px; font-size: 1.1rem; display: grid; gap: 6px; margin: 10px 0; }
@media (max-width: 700px) {
  /* шапка кабинета на телефоне: логотип · тема · язык → меню → выход */
  .c-top { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "brand theme lang" "nav nav nav" "out out out";
    align-items: center; gap: 8px 10px; }
  .c-brand { grid-area: brand; font-size: 1rem; }
  .c-top .theme-switch { grid-area: theme; }
  .c-top .lang-switch { grid-area: lang; }
  .c-nav { grid-area: nav; flex: none; flex-wrap: nowrap; justify-content: space-between; }
  .c-nav a { flex: 1; text-align: center; font-size: .95rem; }
  .c-top form { grid-area: out; width: auto; justify-self: end; }
  .c-top form .btn { padding: 4px 10px; font-size: .78rem; }
}
.c-opt { font-size: .86rem; color: var(--muted); } .c-opt b { color: var(--in); }
.lang-switch { display: inline-flex; border: 1px solid var(--ink-3); border-radius: 8px; overflow: hidden; }
.lang-switch a { padding: 3px 7px; font-size: .74rem; color: var(--ink-text); }
.lang-switch a.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.lang-switch a:hover { text-decoration: none; }
.lang-switch.light { border-color: var(--border); }
.lang-switch.light a { color: var(--muted); }
.lang-switch.light a.on { color: #fff; }
.c-map { height: 280px; border-radius: 10px; border: 1px solid var(--border); margin: 8px 0 4px; z-index: 0; }
.map-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.delivery-box { background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.doc-header-view .full-row { grid-column: 1 / -1; }

/* ============================================================ версия 13: приход шин, телефон */
[hidden] { display: none !important; }
.warn-text { color: var(--warn); }

/* --- приход: шина → количество → цена → DOT */
.add-bar { display: grid; grid-template-columns: minmax(240px, 1fr) 110px 160px auto; gap: 10px 12px; align-items: end;
  background: var(--accent-soft); border: 1px solid #ecd58a; border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.add-bar label { color: #5e4f1c; font-weight: 600; }
.add-bar .add-f input, .add-bar input.scan { font-size: 1.08rem; padding: 12px; }
.add-bar input.scan { border-width: 2px; border-color: #d9b23a; }
.add-bar input.scan.preset { border-color: #2f9e5b; background: #eefaf2; }
.add-bar .add-f input { text-align: right; font-variant-numeric: tabular-nums; }
.add-bar .add-f input::placeholder { text-align: right; }
.add-main { min-width: 0; }
.add-go { display: flex; gap: 8px; }
.add-go .btn { padding: 13px 18px; font-size: 1rem; }
.add-opts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.add-opts .check { margin: 0; color: var(--text); font-weight: 400; font-size: .92rem; }
.add-bar .hint { grid-column: 1 / -1; margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.5; max-width: 110ch; }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border: 2px solid var(--in);
  border-radius: var(--radius-sm); padding: 7px 8px 7px 12px; min-height: 49px; }
.picked-name { min-width: 0; line-height: 1.5; }
.suggest .suggest-new { color: var(--primary); font-weight: 600; background: var(--surface-2); }
.suggest div { line-height: 1.5; }
.recon-only { display: none; }
#doc-editor.recon .recon-only { display: inline-flex; }
.col-doc { display: none; }
#doc-editor.recon th.col-doc, #doc-editor.recon td.col-doc { display: table-cell; }
#doc-editor.recon span.col-doc { display: inline; }
.l-title { font-weight: 600; }
.l-sub { display: block; margin-top: 2px; }
td.l-diff { font-weight: 600; color: var(--muted); }
td.l-diff.neg { color: var(--danger); }
td.l-diff.pos { color: var(--warn); }
.line-warn { display: grid; gap: 4px; background: var(--warn-soft); border-left: 4px solid var(--warn); color: #6b4406;
  padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 14px 0 0; font-size: .92rem; }
p.line-warn { margin-bottom: 0; }
@media (max-width: 1100px) {
  .add-bar { grid-template-columns: 1fr 1.3fr; }
  .add-main, .add-go { grid-column: 1 / -1; }
  .add-go .btn.primary { flex: 1; justify-content: center; }
}

/* --- нижняя панель на телефоне */
.tabbar { display: none; }
@media (max-width: 900px) {
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--ink); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -1px 0 rgba(0, 0, 0, .2); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 7px; min-height: 56px;
    color: var(--ink-text); font: inherit; font-size: .72rem; background: none; border: 0; cursor: pointer; text-decoration: none; }
  .tabbar .icon { width: 22px; height: 22px; }
  .tabbar a.active { color: #fff; font-weight: 600; }
  .tabbar a.active .icon { color: var(--accent); }
  .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .sticky-actions { bottom: calc(56px + env(safe-area-inset-bottom)); }
  .toast { top: 12px; left: 12px; right: 12px; max-width: none; }
  .quick { display: none; }   /* эти кнопки есть на главной и в нижней панели */
}
@media print { .tabbar { display: none !important; } }

/* --- телефон: строки документа карточками, без прокрутки вбок */
@media (max-width: 700px) {
  .add-bar { padding: 12px; gap: 8px; }
  .add-bar .add-f input { padding: 11px 8px; font-size: 1rem; }
  .sticky-actions .btn.lg { flex: 1; justify-content: center; }
  table.lines, table.lines tbody { display: block; width: 100%; }
  table.lines thead { display: none; }
  table.lines tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); position: relative; }
  table.lines tr.l-empty { display: block; }
  table.lines td { display: block; padding: 0; border: 0; text-align: left; background: transparent !important; white-space: normal; }
  table.lines td.l-n { display: none; }
  table.lines td.l-name { grid-column: 1 / -1; padding-right: 44px; }
  table.lines td.l-del { position: absolute; top: 8px; right: 0; }
  table.lines td[data-label]::before { content: attr(data-label); display: block; font-size: .74rem; color: var(--muted); margin-bottom: 3px; white-space: nowrap; }
  table.lines td.l-sum { grid-column: 1 / -1; text-align: right; font-weight: 700; }
  table.lines td.l-sum::before { display: inline; margin-right: 8px; font-weight: 400; }
  table.lines input.cell, table.lines input.cell.price { width: 100%; text-align: left; padding: 9px 10px; font-size: 1rem; }
  table.lines td.col-doc { display: none; }
  #doc-editor.recon table.lines td.col-doc { display: block; }
  table.lines td.l-static { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
  table.lines td.l-static::before { margin-bottom: 9px; }
  table.lines tr.diff-minus { box-shadow: inset 4px 0 0 var(--danger); padding-left: 12px; }
  table.lines tr.diff-plus { box-shadow: inset 4px 0 0 var(--warn); padding-left: 12px; }
  .totals { justify-content: flex-start; }
  .doc-header-view { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
}

/* --- главная сотрудника */
.todo { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 20px; padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
a.chip { text-decoration: none; }
@media (max-width: 700px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; gap: 6px; }
  .tile.main { grid-column: 1 / -1; padding: 18px 16px; }
  .tile b { font-size: 1rem; }
  .tile span { font-size: .82rem; }
  .tile .icon { width: 26px; height: 26px; }
}

@media (max-width: 700px) {
  .scan-box { padding: 12px; gap: 8px; }
  .scan-box input.scan { flex: 1 1 100%; }
  .scan-box input.qty { width: 84px; }
  .scan-box .search-wrap { flex: 1 1 100%; min-width: 0; }
}

@media (max-width: 700px) { .card-head { flex-wrap: wrap; } }

/* --- телефон: списки документов в две строки, фильтры компактно */
@media (max-width: 700px) {
  table.doclist, table.doclist tbody { display: block; width: 100%; }
  table.doclist thead, table.doclist tfoot { display: none; }
  table.doclist tr { display: grid; grid-template-columns: auto 1fr auto; gap: 3px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: baseline; }
  table.doclist tr.l-empty { display: block; }
  table.doclist td { display: block; padding: 0; border: 0; background: transparent !important; text-align: left; }
  table.doclist td.d-who { grid-column: 1 / 3; grid-row: 1; font-weight: 600; font-size: 1rem; }
  table.doclist td.d-st { grid-column: 3; grid-row: 1; text-align: right; }
  table.doclist td.d-num { grid-column: 1; grid-row: 2; font-size: .86rem; }
  table.doclist td.d-date { grid-column: 2; grid-row: 2; font-size: .86rem; color: var(--muted); }
  table.doclist td.d-sum { grid-column: 3; grid-row: 2; text-align: right; font-weight: 700; }
  table.doclist td.d-car { grid-column: 1 / 3; grid-row: 3; font-size: .84rem; color: var(--muted); }
  table.doclist td.d-car br { display: none; }
  table.doclist td.d-car small { margin-left: 8px; }
  table.doclist td.d-cnt, table.doclist td.d-act { display: none; }
  .filters { gap: 8px; }
  .filters > label { flex: 1 1 130px; display: flex; align-items: center; gap: 6px; }
  .filters > label input { flex: 1; min-width: 0; padding: 9px 8px; }
  .quick-periods { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .quick-periods::-webkit-scrollbar { display: none; }
  .quick-periods .chip { flex: 0 0 auto; }
}

/* --- отгрузка: шина → количество; цена ставится сама */
.add-bar.sell { grid-template-columns: minmax(240px, 1fr) 120px auto; }
.qty-chips { display: inline-flex; gap: 6px; }
.qty-chips .chip { padding: 8px 14px; font-size: .92rem; background: #fff; }
.add-info { font-size: .95rem; }
.free-ok { color: var(--in); font-weight: 600; }
.free-no { color: var(--danger); font-weight: 600; }
.suggest .suggest-none { color: var(--muted); cursor: default; background: var(--surface-2); }
@media (max-width: 1100px) {
  .add-bar.sell { grid-template-columns: 110px 1fr; }
  .add-bar.sell .add-main { grid-column: 1 / -1; }
  .add-bar.sell .add-go { grid-column: auto; }
}

/* на телефоне панель действий прилипает к низу, только когда в ней главная кнопка (провести / отгрузить) */
@media (max-width: 900px) {
  .sticky-actions:not(:has(.btn.success)) { position: static; }
  .reserve-form { flex-wrap: wrap; }
}

/* --- точка доставки на карте (кабинет клиента и отгрузка) */
.map-tools .btn { flex: 0 0 auto; }
[data-map-picker] [data-map-info] { display: block; margin-top: 4px; }
.leaflet-container { font: inherit; }
@media (max-width: 700px) { .c-map { height: 240px; } }

/* --- уведомления: колокольчик, список «Требует внимания», сигнал о новом заказе клиента */
.bell-wrap { position: relative; }
.bell { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; }
.bell:hover { background: var(--surface-2); }
.bell.has { border-color: var(--accent); background: var(--accent-soft); }
.bell.ring .icon { animation: bellring .9s ease-in-out 3; transform-origin: 50% 10%; }
@keyframes bellring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(16deg); } 40% { transform: rotate(-14deg); } 60% { transform: rotate(9deg); } 80% { transform: rotate(-6deg); } }
.bell-count { position: absolute; top: -5px; right: -6px; min-width: 20px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 10px); width: min(400px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 18px 48px rgba(29, 39, 49, .22); z-index: 40; padding: 6px 0; }
.bell-panel h3 { margin: 0; padding: 12px 16px 8px; font-size: 1rem; }
.bell-panel h4 { margin: 0; padding: 10px 16px 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.bell-panel a.n-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 16px; color: var(--text); border-top: 1px solid var(--border); }
.bell-panel a.n-row:hover { background: var(--surface-2); text-decoration: none; }
.bell-panel .n-title { font-weight: 600; }
.bell-panel .n-sub { grid-column: 1 / -1; font-size: .84rem; color: var(--muted); }
.bell-panel .n-num { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bell-panel a.n-row.new { box-shadow: inset 4px 0 0 var(--accent); }
.bell-panel .n-empty { padding: 6px 16px 14px; color: var(--muted); }
.bell-panel .n-foot { padding: 10px 16px 12px; border-top: 1px solid var(--border); font-size: .84rem; color: var(--muted); display: grid; gap: 8px; }
.order-alert { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; border-left: 6px solid var(--accent); }
.order-alert .oa-text { flex: 1 1 260px; min-width: 0; }
.order-alert .oa-text b { display: block; font-size: 1.05rem; }
.order-alert .oa-text span { color: var(--ink-text); font-size: .92rem; }
.order-alert .btn.ghost { color: #fff; border-color: var(--ink-3); }
.tabbar a { position: relative; }
.tabbar .nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 18px; padding: 0 5px; font-size: .68rem; line-height: 18px; background: var(--danger); color: #fff; }
@media (max-width: 900px) {
  .bell { width: 38px; height: 38px; }
  .bell-panel { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
}
@media print { .bell-wrap, .order-alert { display: none !important; } }

/* --- AI-помощник: разговор */
.chat { display: flex; flex-direction: column; gap: 12px; max-width: 900px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 240px; max-height: calc(100vh - 330px); overflow-y: auto; padding: 4px 2px; }
.chat-empty { display: grid; gap: 8px; margin: auto 0; padding: 12px 0; }
.chat-empty b { font-size: 1.1rem; }
.chat-examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chat-examples .chip { padding: 9px 14px; font-size: .92rem; text-align: left; }
.chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-msg p { margin: 0 0 .5em; } .chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul { margin: .2em 0 .5em; padding-left: 1.2em; } .chat-msg li { margin: 2px 0; }
.chat-msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.bot.err { background: var(--warn-soft); border-color: #f0d49c; }
.chat-msg .table-wrap { margin: 6px 0; } .chat-msg table.t { font-size: .88rem; background: var(--surface); }
.chat-src { margin-top: 8px; font-size: .78rem; color: var(--muted); }
.chat-msg.wait { color: var(--muted); }
.dots i { display: inline-block; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%; background: currentColor; animation: chatdot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes chatdot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 46px; resize: none; font-size: 1.02rem; line-height: 1.4; }
.chat-form .btn { padding: 13px 20px; }
.chat-note { margin: 0; }
@media (max-width: 700px) {
  .chat-log { max-height: calc(100vh - 380px); min-height: 200px; }
  .chat-msg { max-width: 96%; }
  .chat-form .btn { padding: 13px 14px; }
}

/* --- телефон: показатели в две колонки, дашборд — главное на одном экране */
@media (max-width: 700px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.kpis + .grid.kpis { margin-top: 10px !important; }
  .kpi { padding: 11px 12px; }
  .kpi:not(.accent, .green, .profit, .orange, .red) { padding-top: 14px; }
  .kpi .label { font-size: .78rem; line-height: 1.25; }
  .kpi .value { font-size: 1.14rem; margin: 4px 0 2px; }
  .kpi .sub { font-size: .74rem; line-height: 1.3; }
  .kpi .delta { font-size: .72rem; }
  .hero { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
  .hero-trucks { grid-column: 1 / -1; padding: 12px 16px 18px; display: grid; grid-template-columns: auto 1fr; gap: 0 16px; align-items: center; }
  .hero-trucks .label { grid-column: 1 / -1; font-size: .8rem; }
  .hero-trucks .big { font-size: 2.2rem; margin: 2px 0 0; }
  .hero-trucks .split { flex-direction: column; gap: 2px; padding: 0; font-size: .84rem; }
  .hero-trucks::after { height: 6px; }
}

.past-addresses { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.past-addresses:empty { display: none; }

/* --- общий поиск вверху страницы */
.gsearch { position: relative; margin: 0; flex: 0 1 340px; min-width: 0; }
.gsearch-btn { display: none; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }
.gsearch-box { position: relative; }
.gsearch-box input { padding: 9px 12px; font-size: .93rem; background: var(--surface-2); }
.gsearch-box input:focus { background: #fff; }
.gsearch-res { top: calc(100% + 6px); max-height: min(70vh, 520px); min-width: 340px; right: 0; left: auto; width: max(100%, 380px); }
.gsearch-res h4 { margin: 0; padding: 8px 12px 4px; font-size: .76rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.gsearch-res a { display: block; padding: 9px 12px; color: var(--text); border-bottom: 1px solid var(--border); line-height: 1.45; }
.gsearch-res a:hover, .gsearch-res a.sel { background: var(--accent-soft); text-decoration: none; }
.gsearch-res a small { display: block; color: var(--muted); }
.gsearch-res a.more { color: var(--primary); font-size: .88rem; }
.gsearch-res .none { padding: 12px; color: var(--muted); }
@media (max-width: 1100px) { .gsearch { flex-basis: 240px; } }
@media (max-width: 900px) {
  .gsearch { flex: 0 0 auto; position: static; }
  .gsearch-btn { display: grid; }
  .gsearch-box { display: none; position: absolute; left: 0; right: 0; top: 100%; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 10px 24px rgba(29, 39, 49, .12); z-index: 6; }
  .gsearch.open .gsearch-box { display: block; }
  .gsearch-box input { font-size: 1rem; padding: 11px 12px; }
  .gsearch-res { position: static; width: auto; min-width: 0; margin-top: 8px; max-height: 60vh; box-shadow: none; }
  .topbar { position: sticky; }
}
@media print { .gsearch { display: none !important; } }

/* --- файлы задачи */
.task-files { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.task-files li { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.task-files img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; display: block; }
.task-files .tf-icon { width: 64px; text-align: center; font-size: 1.8rem; }
.task-files .tf-name { flex: 1; min-width: 0; display: grid; overflow-wrap: anywhere; }

/* --- ручной выбор шины в предпросмотре инвойса */
select.inv-pick { display: block; width: 100%; max-width: 420px; margin-top: 6px; font-size: .88rem; padding: 6px 8px; }
.expense-form h4 { margin: 18px 0 8px; }
.exp-paid select { width: auto; padding: 4px 6px; font-size: .85rem; }

/* --- кабинет клиента: подключение Telegram */
.tg-card { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; border-left: 4px solid var(--primary); }
.tg-card > div { display: grid; gap: 2px; flex: 1 1 280px; min-width: 0; }
.tg-card form { margin: 0; }

/* --- карантин (брак новых шин) */
.q-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; min-width: 0; }
.q-act > summary { list-style: none; cursor: pointer; }
.q-act > summary::-webkit-details-marker { display: none; }
.q-act[open] { flex-basis: 100%; }
.q-form { display: grid; gap: 8px; margin-top: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); max-width: 340px; }
.q-form label { display: grid; gap: 4px; font-size: 13px; }
.q-form input, .q-form select { width: 100%; }
.q-send { margin-top: 12px; }
.q-send .q-form { max-width: none; }

/* --- фото моделей шин */
.p-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); float: left; margin: 0 8px 0 0; }
.c-photo { display: block; margin: -4px -4px 8px; }
.c-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
.c-gallery { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; scroll-snap-type: x mandatory; }
.c-gallery a { flex: 0 0 auto; scroll-snap-align: start; }
.c-gallery img { height: 220px; max-width: 80vw; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
@media (max-width: 640px) { .c-gallery img { height: 180px; } }
.q-title { margin: 4px 0 10px; }
.q-item { display: grid; gap: 8px; }
.q-head { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; align-items: baseline; }
.q-qty { white-space: nowrap; }

/* --- кабинет клиента: «Установите на телефон» (PWA) */
.app-install { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; border-left: 4px solid var(--accent); }
.app-install img { border-radius: 10px; flex: 0 0 auto; }
.app-install .ai-text { display: grid; gap: 2px; flex: 1 1 220px; min-width: 0; }
.app-install .ios-share { display: inline-block; padding: 0 4px; border: 1px solid var(--border); border-radius: 4px; }
@media (display-mode: standalone) { .app-install { display: none !important; } }

/* --- график «Приход и продажи за 30 дней»: HTML-столбики (подписи не сжимаются на телефоне) */
.chart-sum { margin: 0 0 12px; font-size: .92rem; color: var(--muted); min-height: 1.4em; line-height: 1.5; }
.chart-sum b { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-sum i, .k-in, .k-out { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.k-in { background: var(--in); } .k-out { background: var(--out); }
.bchart { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.bchart-y { position: relative; height: 200px; min-width: 48px; font-size: .75rem; color: var(--muted); }
.bchart-y span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bchart-plot { position: relative; min-width: 0; }
.bchart-grid { position: absolute; left: 0; right: 0; top: 0; height: 200px; pointer-events: none; }
.bchart-grid i { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.bchart-grid i:nth-child(1) { top: 0; } .bchart-grid i:nth-child(2) { top: 50%; } .bchart-grid i:nth-child(3) { top: 100%; border-top-style: solid; }
.bchart-cols { position: relative; display: flex; gap: 2px; height: 200px; align-items: stretch; }
.bcol { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; gap: 1px; padding: 0;
  border: 0; border-radius: 4px 4px 0 0; background: none; cursor: pointer; }
.bcol:hover, .bcol.on { background: var(--surface-2); }
.bcol.on { outline: 2px solid var(--accent); outline-offset: -2px; }
.bcol i { flex: 0 1 12px; min-width: 2px; border-radius: 2px 2px 0 0; }
.bcol .b-in { background: var(--in); opacity: .9; } .bcol .b-out { background: var(--out); opacity: .9; }
.bchart-x { display: flex; gap: 2px; margin-top: 6px; font-size: .75rem; color: var(--muted); }
.bchart-x span { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; white-space: nowrap; overflow: visible; }
.bchart-x span:first-child { justify-content: flex-start; } .bchart-x span:last-child { justify-content: flex-end; }
.chart-hint { margin: 8px 0 0; }

/* --- панель разработчика: очистка данных склада */
.wipe-card { border-left: 4px solid var(--danger); }
.wipe-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.wipe-form label { display: grid; gap: 4px; flex: 1 1 260px; }

/* Страница сбоя (error500.html) и журнал сбоев в панели разработчика */
.error-card { width: min(460px, 100%); }
.error-card p { margin: 10px 0 0; }
.error-code { font-family: var(--mono, ui-monospace, monospace); font-size: 1.7rem; font-weight: 700; letter-spacing: .12em; padding: 12px 16px; background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); text-align: center; user-select: all; }
a.kpi { display: block; color: inherit; text-decoration: none; }
a.kpi:hover { border-color: var(--accent); }
pre.trace { margin: 8px 0 0; padding: 10px 12px; background: #1d2731; color: #e6edf3; border-radius: var(--radius-sm); font-size: .78rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; }
td details > summary { cursor: pointer; }
table.errlog td { vertical-align: top; }

/* Меню на телефоне: строки под палец (не меньше 46px), заголовки групп — 42px */
@media (max-width: 900px) {
  .sidebar nav a { min-height: 46px; padding: 11px 12px; font-size: 1rem; }
  .nav-sec > summary, .nav-sec:not([open]) > summary { min-height: 42px; padding: 10px 12px; font-size: .84rem; }
}

/* Приход: сверка с накладной в два шага; длинная подсказка спрятана под «Как вносить?» */
.recon-steps { grid-column: 1 / -1; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: #fff; border: 1px solid #ecd58a; border-radius: var(--radius-sm); padding: 10px 12px; }
#doc-editor.recon .recon-steps { display: flex; }
.steps-seg label { flex-direction: column; align-items: flex-start; gap: 0; padding: 7px 14px; line-height: 1.3; }
.steps-seg label b { font-size: .74rem; font-weight: 600; opacity: .75; text-transform: uppercase; letter-spacing: .04em; }
.step-text { margin: 0; flex: 1 1 260px; font-size: .9rem; color: var(--text); line-height: 1.45; }
#add-bar[data-step="doc"] [data-step="fact"], #add-bar[data-step="fact"] [data-step="doc"] { display: none; }
#add-bar[data-step="doc"] { background: #eef4fb; border-color: #b9cfe8; }
#add-bar[data-step="doc"] .recon-steps { border-color: #b9cfe8; }
.hint-more { grid-column: 1 / -1; }
.hint-more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--muted); padding: 4px 0; list-style: none; user-select: none; }
.hint-more > summary::-webkit-details-marker { display: none; }
.hint-more > summary::before { content: "?"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; font-size: .72rem; }
.hint-more[open] > summary { margin-bottom: 6px; }
@media (max-width: 700px) { .steps-seg { width: 100%; } .steps-seg label { flex: 1; } .recon-steps .btn { width: 100%; justify-content: center; } }

/* Кнопка «Фильтры» (только телефон): в списках остатков и шин сначала поле размера, остальные фильтры — по нажатию */
.f-toggle { display: none; }
.f-count { margin-left: 6px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .76rem; line-height: 1.6; text-align: center; }
/* «Ещё» в шапке страницы (только телефон): второстепенные кнопки прячутся в список */
.more-wrap { position: relative; }
.more-menu { position: fixed; left: 16px; right: 16px; z-index: 40; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(29,39,49,.22); padding: 6px; }
.more-menu[hidden] { display: none; }
.more-menu form { display: block; margin: 0; }
.more-menu .btn, .topbar-actions .more-menu .btn { width: 100%; justify-content: flex-start; border-color: transparent; background: transparent; padding: 12px; font-size: .95rem; box-shadow: none; }
.more-menu .btn:hover { background: var(--surface-2); }
.more-menu .btn.danger { color: var(--danger); }
.more-menu > :not(:first-child) .btn.danger, .more-menu > .btn.danger:not(:first-child) { border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

@media (max-width: 700px) {
  .filters.fold { align-items: stretch; }
  .filters.fold > input[type=search] { flex: 1 1 100%; font-size: 1.02rem; padding: 12px; }
  .filters.fold > .f-toggle { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 0; justify-content: center; }
  .filters.fold > .f-toggle[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
  .filters.fold > button:not(.f-toggle) { flex: 1 1 0; justify-content: center; order: 2; }
  .filters.fold > .f-toggle { order: 1; }
  .filters.fold > select, .filters.fold > label.check { display: none; order: 3; }
  .filters.fold.open > select { display: block; flex: 1 1 calc(50% - 5px); }
  .filters.fold.open > label.check { display: flex; flex: 1 1 100%; }

  /* списки остатков и шин — карточками: размер и главное число сверху, название, затем подписи с цифрами */
  table.cardlist, table.cardlist tbody { display: block; width: 100%; }
  table.cardlist thead { display: none; }
  table.cardlist tr { display: grid; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: center; }
  table.cardlist tr.l-empty { display: block; }
  table.cardlist td { display: block; padding: 0; border: 0; background: transparent !important; text-align: left; white-space: normal; min-width: 0; }
  table.cardlist td[data-label]::before { content: attr(data-label) " "; font-size: .78rem; font-weight: 400; color: var(--muted); }
  table.cardlist td.k-none { visibility: hidden; }
  table.cardlist td.k-name { grid-column: 1 / -1; font-size: .96rem; line-height: 1.35; }
  table.cardlist b.size { font-size: .86rem; }

  table.stocklist tr { grid-template-columns: auto auto 1fr; }
  table.stocklist td.k-size { grid-column: 1 / 3; grid-row: 1; }
  table.stocklist td.k-free { grid-column: 3; grid-row: 1; text-align: right; font-size: 1.15rem; }
  table.stocklist td.k-name { grid-row: 2; }
  table.stocklist td.k-qty { grid-column: 1; grid-row: 3; font-size: .9rem; }
  table.stocklist td.k-res { grid-column: 2; grid-row: 3; font-size: .9rem; }
  table.stocklist td.k-price { grid-column: 3; grid-row: 3; text-align: right; font-size: .9rem; font-weight: 600; }

  table.prodlist tr { grid-template-columns: auto 1fr auto; }
  table.prodlist td.k-pick { grid-column: 1; grid-row: 1 / 3; align-self: start; padding-top: 2px; }
  table.prodlist td.k-pick input { width: 22px; height: 22px; }
  table.prodlist td.k-size { grid-column: 2; grid-row: 1; }
  table.prodlist td.k-size br { display: none; }
  table.prodlist td.k-size small { margin-left: 6px; }
  table.prodlist td.k-qty { grid-column: 3; grid-row: 1; text-align: right; font-weight: 700; font-size: 1.05rem; }
  table.prodlist td.k-qty::before { display: none; }
  table.prodlist td.k-name { grid-column: 2 / -1; grid-row: 2; }
  table.prodlist td.k-buy { grid-column: 2; grid-row: 3; font-size: .9rem; }
  table.prodlist td.k-price { grid-column: 3; grid-row: 3; text-align: right; font-size: .9rem; font-weight: 600; }
  table.prodlist tr:not(:has(td.k-buy)) td.k-price { grid-column: 2 / -1; }
  table.prodlist .tags .badge { font-size: .7rem; }

  .topbar-actions { align-items: center; }
}

/* Приход на телефоне: подписи полей короче и в одну строку, полю количества — больше места */
@media (max-width: 700px) {
  .add-bar:not(.sell) { grid-template-columns: 1fr 1.2fr .8fr; }
  .add-bar .add-f label { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.prodlist td.k-buy, table.prodlist td.k-price { white-space: nowrap; }
}

/* Накладная из Excel: выбор «сверять / принять как есть» и предпросмотр строк (на телефоне — карточками) */
.seg-col { display: grid; gap: 10px; margin: 14px 0 4px; }
.seg-col label.check { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; white-space: normal; font-weight: 400; }
.seg-col label.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg-col label.check input { width: 18px; height: 18px; min-width: 0; margin: 3px 0 0; padding: 0; flex: 0 0 auto; }
.seg-col label.check span { flex: 1; min-width: 0; }
@media (max-width: 700px) {
  table.invlist tr { grid-template-columns: auto auto 1fr; }
  table.invlist td.k-line { display: none; }
  table.invlist td.k-name { grid-row: 1; }
  table.invlist td.k-what { grid-column: 1 / -1; grid-row: 2; font-size: .92rem; }
  table.invlist td.k-qty { grid-column: 1; grid-row: 3; font-weight: 700; }
  table.invlist td.k-price { grid-column: 2; grid-row: 3; font-size: .9rem; }
  table.invlist td.k-sum { grid-column: 3; grid-row: 3; text-align: right; font-size: .9rem; font-weight: 600; }
  table.invlist td.k-dot { grid-column: 1 / -1; grid-row: 4; font-size: .86rem; }
  table.invlist td.k-dot:empty { display: none; }
}

/* шаги документа в черновике — ссылки на всю ширину шага */
.steps li a { color: inherit; text-decoration: underline dotted; text-underline-offset: 4px; }
.steps li a::before { content: ""; position: absolute; inset: 0; }
.steps li a:hover { color: var(--accent); }
#edit-head, #doc-editor, #doc-actions { scroll-margin-top: 140px; }

/* напоминание «курс сегодня не введён» */
.rate-note { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.rate-note-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rate-note-actions form { display: flex; gap: 8px; align-items: center; }
.rate-note-actions input[name=rate], .rate-note-actions input[name=rate_transfer] { width: 140px; }
.rate-two { align-items: flex-end !important; flex-wrap: wrap; }
.rate-two label { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.rate-two label small { color: var(--muted); font-size: .78rem; }
.rate-mode-card { margin: 0; }
.rate-mode { display: grid; gap: 10px; margin: 8px 0; }
.rate-opt { display: flex; align-items: flex-start; gap: 10px; margin: 0; font-weight: 400; cursor: pointer; }
.rate-opt input { margin-top: 3px; width: auto; flex: none; }

/* --- кассы и расчётные счета (14.11.2026) */
.acc-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.acc-tab { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; min-width: 150px; }
.acc-tab.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.acc-tab .acc-name { font-weight: 600; }
.acc-tab .acc-sum { font-size: .85rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 720px) { .acc-tab { min-width: calc(50% - 5px); flex: 1 1 calc(50% - 5px); } }

/* --- доп. расходы прихода, изменение цены */
.price-change { font-size: .78rem; white-space: nowrap; color: var(--muted); }
.price-change.up.alert { color: var(--danger); font-weight: 600; }
.price-change.down.alert { color: var(--in); font-weight: 600; }
.expenses-card { margin-top: 16px; }
.expense-form .field input + input, .expense-form .field select + input { margin-top: 6px; }
.price-confirm { display: inline-flex; margin-right: 12px; background: var(--warn-soft); padding: 6px 10px; border-radius: var(--radius-sm); }
.badge.tr-transit { background: var(--primary-soft); color: var(--primary); }
.badge.tr-arrived { background: var(--warn-soft); color: var(--warn); }
.badge.tr-received { background: var(--ok-soft); color: var(--ok); }
.badge.tr-cancelled { background: var(--surface-2); color: var(--muted); }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }

/* --- заказы по размеру */
.badge.os-new, .badge.os-revised { background: var(--warn-soft); color: var(--warn); }
.badge.os-proposed { background: var(--primary-soft); color: var(--primary); }
.badge.os-approved, .badge.os-picking, .badge.os-shipping { background: var(--accent-soft); color: var(--accent-ink); }
.badge.os-shipped { background: var(--ok-soft); color: var(--ok); }
.badge.os-rejected, .badge.os-cancelled { background: var(--surface-2); color: var(--muted); }
.order-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; flex-wrap: wrap; }
.order-steps li { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .85rem; color: var(--muted); }
.order-steps li.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.order-steps li.now { background: var(--ink); color: #fff; border-color: transparent; }
.pick-line { border-top: 1px solid var(--border); padding: 12px 0; }
.pick-req { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pick-opts { display: grid; gap: 6px; }
.pick-opt { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.pick-opt.wish { border-color: var(--primary); }
.pick-opt.none { opacity: .6; }
.pick-opt .po-free { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.pick-opt .po-price { font-weight: 600; white-space: nowrap; }
.pick-qty { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
/* ещё варианты для покупателя (менеджер) и выбор варианта (кабинет) */
.alt-pick { margin-top: 8px; }
.alt-rows { display: grid; gap: 6px; margin-top: 8px; }
.alt-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 6px 10px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.alt-row.none { opacity: .6; }
.var-opts { display: grid; gap: 6px; margin-top: 6px; }
.var-opt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.var-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.var-opt .vo-sum { font-weight: 600; white-space: nowrap; text-align: right; }
@media (max-width: 640px) {
  .alt-row { grid-template-columns: 1fr auto; }
  .var-opt { grid-template-columns: auto 1fr; }
  .var-opt .vo-sum { grid-column: 2; text-align: left; }
}
.req-line { display: grid; grid-template-columns: 1.3fr .6fr 1fr .8fr; gap: 8px; margin-bottom: 8px; }
.order-log { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.order-log li { border-left: 3px solid var(--border); padding-left: 10px; }
.order-log li.by-client { border-left-color: var(--primary); }
.size-cat { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.size-cat button { text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; }
.size-cat button .size { font-size: 1.05rem; }
@media (max-width: 720px) {
  .req-line { grid-template-columns: 1fr 1fr; }
  .pick-opt { grid-template-columns: auto 1fr; }
  .pick-opt .po-free, .pick-opt .po-price { grid-column: 2; }
}
.workers-card { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 12px 16px; }
.cur-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; vertical-align: middle; }
.cur-switch a { padding: 6px 12px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .85rem; }
.cur-switch a.on { background: var(--ink); color: #fff; }
@media print { .cur-switch { display: none; } }

/* --- фото: просмотр во весь экран, перетаскивание */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 14, 18, .92); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 86vh; object-fit: contain; border-radius: 6px; background: #fff; }
.lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 999px; width: 46px; height: 46px; font-size: 1.6rem; cursor: pointer; }
.lightbox .lb-close { top: 14px; right: 14px; font-size: 1.1rem; }
.lightbox .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count { position: absolute; bottom: 14px; color: #fff; font-size: .9rem; }
.drop-on { outline: 3px dashed var(--primary); outline-offset: -6px; }
.photo-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- доска задач */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; align-items: start; margin-top: 14px; }
.kb-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 140px; }
.kb-col h3 { margin: 4px 4px 10px; font-size: 1rem; }
.kb-list { display: grid; gap: 8px; min-height: 40px; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px; cursor: grab; display: grid; gap: 6px; }
.kb-card.pr-high { border-left-color: var(--danger); }
.kb-card.pr-low { border-left-color: var(--in); }
.kb-card.late { box-shadow: 0 0 0 1px var(--danger-soft); }
.kb-card.dragging { opacity: .5; }
.kb-title { font-weight: 600; color: var(--text); text-decoration: none; }
.kb-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .82rem; }
.kb-move { display: flex; gap: 6px; justify-content: flex-end; }
.task-new summary { cursor: pointer; }
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }
.money-card .card-head { gap: 12px; flex-wrap: wrap; }
.money-card .kpis { margin-top: 6px; }
.transit-money .list-plain li { gap: 10px; flex-wrap: wrap; }

/* --- выбор контрагента: список снизу при наборе */
.combo { position: relative; width: 100%; }
.combo-select { display: none !important; }
.combo-input { width: 100%; }
.combo-list { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow: auto; }
.combo-list li { padding: 8px 12px; cursor: pointer; }
.combo-list li.act, .combo-list li:hover { background: var(--primary-soft); }
.combo-list li.on { font-weight: 600; }
.contract-row { display: flex; gap: 6px; align-items: center; }
.contract-row select { flex: 1; min-width: 0; }
.contract-balances { margin-bottom: 16px; }
.contract-balances .list-plain li { gap: 12px; }

/* Принять заказ одной страницей: поиск шины → строка заказа */
.order-new { max-width: 1000px; }
.ord-search { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ord-search #ord-q { flex: 1 1 280px; font-size: 1.1rem; padding: 12px 14px; }
.ord-qty { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ord-results { display: grid; gap: 6px; margin: 10px 0; }
.ord-results:empty { display: none; }
.ord-opt { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; color: var(--text); cursor: pointer; width: 100%; }
.ord-opt:hover, .ord-opt:focus-visible { border-color: var(--primary); background: var(--accent-soft); }
.ord-opt.none { opacity: .65; }
.ord-opt.only-size { grid-template-columns: 1fr auto; border-style: dashed; }
.ord-opt .ord-add { font-weight: 600; white-space: nowrap; color: var(--ink); }
.ord-opt .po-price { font-weight: 600; white-space: nowrap; }
@media (max-width: 700px) {
  .ord-opt { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .ord-opt > span:first-child { grid-column: 1 / -1; }
  .ord-opt .po-price { grid-column: 1; }
  .ord-opt .ord-add { grid-row: 2 / 4; grid-column: 2; align-self: center; }
}
.qty-chips .chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.ord-lines input { width: 100%; max-width: 110px; }

/* Переписка бота (/chats) */
.chat { display: flex; flex-direction: column; gap: 8px; max-width: 820px; }
.chat-day { align-self: center; font-size: .8rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 12px; margin: 8px 0; }
.msg { max-width: 78%; padding: 8px 12px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); overflow-wrap: anywhere; }
.msg.in { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--accent-soft); border-color: var(--accent-line); border-bottom-right-radius: 4px; }
.msg-from { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; font-size: .95rem; }
.msg-time { font-size: .72rem; color: var(--muted); text-align: right; margin-top: 2px; }
.msg img, .msg video { display: block; max-width: 100%; max-height: 420px; border-radius: 8px; margin-bottom: 4px; }
.msg audio { max-width: 100%; }
.msg-file { display: inline-block; margin-bottom: 4px; }
.tg-link { width: 100%; max-width: 330px; font-size: .8rem; }
@media (max-width: 700px) { .msg { max-width: 92%; } }


/* Фирменный стиль (JONMAX, 15.11.2026): логотип в меню и на входе — вариант для тёмного фона */
.brand-logo { flex-direction: column; align-items: flex-start; gap: 2px; padding: 18px 20px 14px; }
.brand-logo img { display: block; width: 210px; height: auto; }
.brand-logo .brand-sub { font-family: var(--font-display); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-text); padding-left: 4px; }
.login-logo img { width: 300px; }
.login-logo .brand-sub { font-size: .9rem; }
.login-brands { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 10px; }
.login-brands span { border: 1px solid var(--ink-3); border-radius: 999px; padding: 6px 14px; font-weight: 700; letter-spacing: .06em; font-size: .85rem; color: #fff; font-style: italic; }
.login-values { color: var(--ink-text); font-size: .9rem; margin: 6px 0 0; }
.brand-preview { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; display: inline-block; margin-bottom: 8px; }
@media (max-width: 860px) { .login-logo img { width: 230px; } .login-brands { margin-top: 14px; } }
.c-brand img { display: block; height: 40px; width: auto; }
.c-login-logo { text-align: center; margin: 4px 0 6px; }
.c-login-logo img { width: min(240px, 80%); height: auto; }
.c-slogan { text-align: center; font-weight: 700; font-style: italic; color: var(--accent); margin: 0 0 12px; }
.login-motto div { border-left: 0; padding-left: 0; display: flex; align-items: center; gap: 12px; }
.login-motto b { margin: 0; font-size: 1.05rem; }
.motto-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.motto-ic svg { width: 24px; height: 24px; stroke: #fff; }
@media (max-width: 860px) {
  .login-facts.login-motto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 22px 0 8px; }
  .login-motto div { flex-direction: column; align-items: flex-start; gap: 6px; }
  .login-motto b { font-size: .86rem; }
  .motto-ic { width: 36px; height: 36px; border-radius: 10px; }
  .motto-ic svg { width: 20px; height: 20px; }
}

/* ------------------------------------------------ вход в стиле JONMAX (макет 15.11.2026) */
.lp { position: relative; min-height: 100vh; min-height: 100dvh; background: #0f1113; color: #fff; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); align-items: center; padding: 48px 64px 72px; gap: 32px; }
/* фото склада (владелец, ChatGPT): на всю ширину, сдвинуто влево, чтобы шина стояла между текстом и карточкой;
   слева затемнение — текст читается поверх стеллажей */
.lp-photo { position: absolute; top: 0; bottom: 0; left: -12%; width: 112%; pointer-events: none;
  background: linear-gradient(90deg, rgba(15, 17, 19, .96) 0, rgba(15, 17, 19, .82) 30%, rgba(15, 17, 19, .25) 52%, rgba(15, 17, 19, 0) 62%),
    linear-gradient(0deg, rgba(15, 17, 19, .55) 0, rgba(15, 17, 19, 0) 25%),
    url(/static/brand/login-bg.webp) center / cover no-repeat; }
.lp-left, .lp-right { position: relative; z-index: 1; }
.lp-logo { display: block; width: clamp(300px, 26vw, 420px); height: auto; margin: 0 0 36px -10px; }
.lp-slogan { font-family: var(--font); font-weight: 800; font-style: italic; font-size: clamp(2rem, 3.4vw, 3.1rem); line-height: 1.08;
  letter-spacing: -.01em; margin: 0 0 18px; }
.lp-slogan span { display: block; }
.lp-slogan em { color: var(--accent); font-style: italic; }
.lp-lead { color: #c9ccd1; font-size: 1.08rem; line-height: 1.55; max-width: 34ch; margin: 0 0 40px; }
.lp-values { display: flex; gap: 0; max-width: 520px; }
.lp-values div { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 0 14px;
  border-left: 1px solid rgba(255, 255, 255, .14); }
.lp-values div:first-child { border-left: 0; }
.lp-values b { font-size: 1rem; font-weight: 700; }
/* свои бренды компании (Фирменный стиль → «Свои бренды»), владелец 15.11.2026 */
.lp-brands { margin-top: 34px; max-width: 680px; }
.lp-brands-label { display: block; color: #9a9ea5; font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 12px; }
.lp-brands ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.lp-brands li { font-weight: 800; font-style: italic; font-size: .96rem; letter-spacing: .04em; color: #fff; padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .16); border-left: 3px solid var(--accent); border-radius: 8px; background: rgba(30, 33, 37, .7); }
.lp-ic { width: 52px; height: 52px; border-radius: 12px; background: #1e2125; border: 1px solid rgba(255, 255, 255, .08); display: grid; place-items: center; }
.lp-ic svg { width: 26px; height: 26px; stroke: var(--accent); }
.lp-right { display: flex; justify-content: flex-end; }
.lp-card { width: min(440px, 100%); background: rgba(22, 24, 27, .82); border: 1px solid rgba(255, 255, 255, .16); border-radius: 22px; padding: 34px 34px 26px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.lp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lp-card h2 { margin: 0; font-size: 1.7rem; font-weight: 800; color: #fff; }
.lp-sub { color: #aeb2b8; margin: 6px 0 22px; }
.lp-lang { display: inline-flex; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: 3px; }
.lp-lang a { color: #d5d8dc; font-size: .82rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; }
.lp-lang a.on { background: var(--accent); color: #fff; }
.lp-lang a:hover { text-decoration: none; }
.lp-field { position: relative; display: flex; align-items: center; margin: 0 0 16px; }
.lp-field > svg { position: absolute; left: 16px; width: 20px; height: 20px; stroke: #aeb2b8; pointer-events: none; }
.lp-field input { width: 100%; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .22); border-radius: 12px; color: #fff;
  font-size: 1rem; padding: 15px 48px 15px 50px; }
.lp-field input::placeholder { color: #9a9ea5; }
.lp-field input:focus { outline: 3px solid rgba(208, 24, 31, .25); border-color: var(--accent); }
.lp-eye { position: absolute; right: 8px; background: none; border: 0; padding: 8px; cursor: pointer; border-radius: 8px; }
.lp-eye svg { width: 20px; height: 20px; stroke: #aeb2b8; }
.lp-eye.on svg { stroke: #fff; }
.lp-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--accent); color: #fff; border: 0;
  border-radius: 12px; padding: 15px; font: inherit; font-size: 1.08rem; font-weight: 700; cursor: pointer; margin-top: 6px; }
.lp-btn:hover { background: var(--accent-hover); }
.lp-btn svg { width: 22px; height: 22px; stroke: #fff; }
.lp-help { display: flex; align-items: center; gap: 8px; color: #9a9ea5; font-size: .88rem; border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 22px; padding-top: 16px; }
.lp-help svg { width: 18px; height: 18px; stroke: #9a9ea5; flex-shrink: 0; }
.lp .flash.error { margin-bottom: 14px; }
.lp-stripe { position: absolute; left: 0; right: 0; bottom: 0; height: 18px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 22px, #0f1113 22px 44px); }
@media (max-width: 1100px) { .lp { padding: 40px 36px 64px; } }
@media (max-width: 860px) {
  .lp { grid-template-columns: 1fr; padding: 24px 18px 48px; gap: 22px; align-items: start; }
  .lp-photo { left: 0; right: 0; width: auto; height: 470px; bottom: auto;
    background: linear-gradient(180deg, rgba(15, 17, 19, .55) 0, rgba(15, 17, 19, .78) 55%, #0f1113 100%),
      url(/static/brand/login-bg-m.webp) 60% center / cover no-repeat; }
  .lp-logo { width: 260px; margin: 0 0 18px -8px; }
  .lp-slogan { font-size: 1.9rem; }
  .lp-lead { margin-bottom: 22px; font-size: 1rem; }
  .lp-values div { padding: 0 6px; }
  .lp-ic { width: 42px; height: 42px; } .lp-ic svg { width: 22px; height: 22px; }
  .lp-values b { font-size: .88rem; }
  .lp-brands { margin-top: 22px; }
  .lp-brands ul { gap: 8px; }
  .lp-brands li { font-size: .88rem; padding: 6px 10px; }
  .lp-right { justify-content: stretch; }
  .lp-card { padding: 26px 20px 20px; }
}

/* Долги (15.11.2026): вкладки покупатели / поставщики, виды «+10 / ТОП / +10 ТОП», обещания оплатить */
a.kpi { color: inherit; text-decoration: none; display: block; }
a.kpi:hover { border-color: var(--accent-line); }
.debt-tabs a small { margin-left: 6px; font-weight: 400; }
.debtlist .days { font-size: .82rem; color: var(--muted); }
.debtlist .days.old { color: var(--danger); font-weight: 600; }
.debtlist b.debt { color: var(--danger); }
.debtlist b.debt-out { color: var(--warn); }
/* платил за последние 10 дней — синим, как в Excel владельца (заливка CCCCFF, курсив) */
.debtlist tr.fresh td { background: #e3e3ff; }
.debtlist tr.fresh td.k-pay, .debtlist tr.fresh td.k-buy, .debtlist tr.fresh td.k-n { color: #1f3fa0; font-style: italic; }
@media (max-width: 700px) { table.debtlist tr.fresh { background: #e3e3ff; } }
.debtlist .prom { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); font-size: .84rem; font-weight: 600; white-space: nowrap; }
.debtlist .prom.today { background: #fff3d6; color: #8a5a00; }
.debtlist .prom.late { background: #ffe1df; color: var(--danger); }
.danger-text { color: var(--danger); }
.prom-form { margin-top: 4px; }
.prom-form > summary { list-style: none; display: inline-flex; }
.prom-form > summary::-webkit-details-marker { display: none; }
.prom-form form { display: grid; gap: 6px; margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); min-width: 220px; }
.prom-form label { display: grid; gap: 2px; font-size: .82rem; color: var(--muted); margin: 0; }
.debtlist td.k-act { white-space: nowrap; }
.debtlist td.k-act form.inline { display: inline; }
@media (max-width: 700px) {
  table.debtlist tr { grid-template-columns: 1fr auto; }
  table.debtlist td.k-n { display: none; }
  table.debtlist td.k-name { grid-column: 1; grid-row: 1; }
  table.debtlist td.k-debt { grid-column: 2; grid-row: 1; text-align: right; font-size: 1.1rem; }
  table.debtlist td.k-pay { grid-column: 1; grid-row: 2; font-size: .88rem; }
  table.debtlist td.k-buy { grid-column: 2; grid-row: 2; font-size: .88rem; text-align: right; }
  table.debtlist td.k-prom { grid-column: 1 / -1; }
  table.debtlist td.k-act { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
  table.debtlist tr.total-row { grid-template-columns: 1fr auto; }
  table.debtlist tr.total-row td:empty { display: none; }
}

/* Закрытия кассы: недостача/излишек ждут решения директора (15.11.2026) */
.closelist tr.pending td { background: #fff4e5; }
.decide-form { display: grid; gap: 6px; margin-top: 8px; min-width: 240px; }
.decide-form label.check { margin: 0; display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  font-weight: 600; color: var(--text); }
.decide-form label.check input { width: auto; margin: 0; flex: 0 0 auto; }

/* вход покупателя — как вход сотрудников, но с логотипом компании (15.11.2026) */
.lp-logo-company { width: clamp(240px, 22vw, 340px); margin-left: 0; }
@media (max-width: 860px) { .lp-logo-company { width: 220px; } }

/* ------------------------------------------------ тёмная тема кабинета покупателя (15.11.2026)
   html[data-theme="dark"] ставит только client/base.html: выбор ☀/🌙 в шапке (localStorage «c-theme»),
   без выбора — тема телефона (prefers-color-scheme). Сайт сотрудников не меняется. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1113;
  --surface: #181b1f;
  --surface-2: #20242a;
  --border: #2c3138;
  --border-strong: #3b4149;
  --text: #eceef1;
  --muted: #9aa2ab;
  --accent-soft: #3a1517;
  --accent-line: #6e2a2d;
  --primary: #79aaf2;
  --primary-soft: #182740;
  --in: #3cbf97;
  --in-soft: #11291f;
  --out: #e58a4a;
  --out-soft: #2f1f12;
  --ok: #3cbf97;
  --ok-soft: #11291f;
  --warn: #e0a64a;
  --warn-soft: #2e2410;
  --danger: #f06a63;
  --danger-soft: #341a1a;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3);
}
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea,
html[data-theme="dark"] .seg, html[data-theme="dark"] .suggest, html[data-theme="dark"] .qty-chips .chip,
html[data-theme="dark"] .picked { background: var(--surface-2); color: var(--text); }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus {
  border-color: var(--muted); outline-color: rgba(255, 255, 255, .12); }
html[data-theme="dark"] table.t tr:hover td { background: #1c2025; }
html[data-theme="dark"] .flash.ok { color: #7fe0c0; border-color: #1f4a3a; }
html[data-theme="dark"] .flash.error { border-color: #5a2a28; }
html[data-theme="dark"] .flash.warn { color: #f0c27a; border-color: #5a4518; }
html[data-theme="dark"] .badge.online, html[data-theme="dark"] .badge.in { border-color: #1f4a3a; }
html[data-theme="dark"] .badge.out { border-color: #5a3a20; }
html[data-theme="dark"] .badge.role { border-color: #26406a; }
html[data-theme="dark"] .card-head h3, html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3 { color: var(--text); }
.theme-switch { background: none; border: 1px solid var(--ink-3); color: var(--ink-text); border-radius: 999px; width: 38px; height: 34px;
  display: inline-grid; place-items: center; cursor: pointer; font-size: 1.05rem; padding: 0; }
.theme-switch:hover { background: var(--ink-2); color: #fff; }

/* акт сверки: расшифровка документа по нажатию (17.11.2026) */
details.st-lines > summary { cursor: pointer; list-style: none; color: var(--primary); }
details.st-lines > summary::-webkit-details-marker { display: none; }
details.st-lines > summary::after { content: " ▾"; color: var(--muted); font-size: .8em; }
details.st-lines[open] > summary::after { content: " ▴"; }
table.st-items { width: 100%; margin: 6px 0 4px; font-size: .86rem; border-collapse: collapse; }
table.st-items td { padding: 3px 8px 3px 0; border: 0; border-top: 1px dashed var(--border); }
@media (max-width: 640px) { table.st-items td:nth-child(3) { display: none; } }

/* рассылка: как сообщение увидит покупатель (17.11.2026) */
.bc-preview { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 10px; background: var(--surface-2, #f6f7f9); }
.bc-text { white-space: pre-wrap; font: inherit; font-size: .9rem; max-width: 520px; margin: 4px 0 0; }

/* Долги: под вкладками — что в списке и как отсортировано */
.view-hint { margin: -4px 0 12px; font-size: .95rem; }
/* Касса: выбор вида расхода / прихода */
.field label .cat-edit { float: right; font-weight: 400; }
.cat-filter { margin-bottom: 8px; max-width: 280px; }
.chips .chip-new { border-style: dashed; }
.new-cat { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.new-cat[hidden] { display: none; }

/* вход в два шага: QR-код, ключ, коды восстановления (профиль) */
.mfa-steps { margin: 0 0 12px 18px; line-height: 1.6; }
.mfa-setup { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.mfa-qr svg { display: block; width: 220px; height: 220px; background: #fff; border-radius: 8px; }
.mfa-key { font-size: 1rem; letter-spacing: .06em; word-break: break-all; }
.mfa-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.mfa-codes code { padding: 8px; text-align: center; font-size: 1rem; border: 1px dashed var(--line, #ccc); border-radius: 6px; }
