/* Поставки FBO — интерфейс.
   Образ — складская бирка: белые «этикетки» на сером полу склада, графитовые цифры узким шрифтом,
   жёлтая разметочная лента отмечает, где ты сейчас. Яркие цвета — только у статусов запаса. */

:root {
  color-scheme: light;
  --bg: #eceff2;            /* пол склада */
  --surface: #ffffff;       /* этикетка */
  --surface-2: #f5f7f9;
  --surface-3: #e3e7eb;
  --ink: #15181d;           /* графит */
  --ink-2: #46505b;
  --muted: #6f7984;
  --line: #dee2e7;
  --line-strong: #c4cbd2;
  --accent: #15181d;        /* основное действие — графитом */
  --accent-ink: #ffffff;
  --accent-hover: #2b313a;
  --accent-wash: #fff3c4;   /* выбранное — светлой лентой */
  --tape: #ffd23f;          /* разметочная лента */
  --tape-ink: #15181d;
  --link: #2c49b8;
  --focus: #15181d;
  --halo: rgba(255, 196, 0, .55);
  --seg-on: #ffffff;

  --st-red: #d0392b;
  --st-amber: #e39a0b;
  --st-green: #2e8a57;
  --st-over: #6a58d1;
  --st-idle: #a5adb6;
  --st-red-wash: #fcebe8;
  --st-amber-wash: #fdf2d6;
  --st-green-wash: #e4f2e9;
  --st-over-wash: #eeebfa;
  --track: #e4e8ec;

  --up: #2e8a57;
  --down: #c2402f;
  --series: #3552c9;
  --series-wash: rgba(53, 82, 201, .12);
  --c-bought: #3552c9;
  --c-returned: #ee7a3c;
  --c-cancelled: #8e44ad;
  --c-transit: #cfd5db;
  --c-fbo: #3552c9;
  --c-fbs: #17a673;
  --grid: #e8ebee;
  --ship-missed: #b4560f;   /* упущенная скидка */
  --ship-net: #2d47b5;      /* «Чистыми» */

  --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-data: "IBM Plex Sans Condensed", "Golos Text", "Arial Narrow", system-ui, sans-serif;
  --r-sm: 7px;
  --r-md: 12px;
  --side-w: 220px;
  --shadow-panel: 0 18px 48px rgba(16, 24, 32, .18), 0 2px 6px rgba(16, 24, 32, .06);
  --shadow-pop: 0 10px 30px rgba(16, 24, 32, .14), 0 1px 3px rgba(16, 24, 32, .08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1114;
    --surface: #161a1f;
    --surface-2: #1d2228;
    --surface-3: #262c33;
    --ink: #e9edf1;
    --ink-2: #b8c1cb;
    --muted: #88929d;
    --line: #283038;
    --line-strong: #38414b;
    --accent: #e9edf1;
    --accent-ink: #0e1114;
    --accent-hover: #ffffff;
    --accent-wash: #3a3317;
    --link: #8ea6ff;
    --focus: #e9edf1;
    --halo: rgba(255, 210, 63, .45);
    --seg-on: #343c45;
    --st-red: #e8604f;
    --st-amber: #f0ae2e;
    --st-green: #4cb27a;
    --st-over: #9a8cf0;
    --st-idle: #6c757e;
    --st-red-wash: #3b2320;
    --st-amber-wash: #3a2f14;
    --st-green-wash: #18301f;
    --st-over-wash: #2a2645;
    --track: #262c33;
    --up: #5cc488;
    --down: #ef7b67;
    --series: #6f8bff;
    --series-wash: rgba(111, 139, 255, .18);
    --c-bought: #6f8bff;
    --c-returned: #f08a50;
    --c-cancelled: #b57ad6;
    --c-transit: #424a53;
    --c-fbo: #6f8bff;
    --c-fbs: #2fbf88;
    --grid: #232930;
    --ship-missed: #f0a35a;
    --ship-net: #8ea6ff;
    --shadow-panel: 0 18px 48px rgba(0, 0, 0, .55);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-underline-offset: 2px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--tape); color: var(--tape-ink); }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- каркас: боковое меню и рабочая часть ---------- */
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 35; width: var(--side-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain;
}
.side-top { display: flex; flex-direction: column; gap: 14px; padding: 18px 14px 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 16px; letter-spacing: -.01em; line-height: 1.15; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: 0; margin-top: 1px; }
.brand-mark {
  flex: none; width: 32px; height: 32px; border-radius: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%2315181d'/%3E%3Crect x='13' y='0' width='6' height='15' fill='%23ffd23f'/%3E%3Crect x='7' y='19' width='18' height='7' rx='1.5' fill='%23fff'/%3E%3Crect x='9.5' y='21.2' width='1.4' height='2.6' fill='%2315181d'/%3E%3Crect x='12' y='21.2' width='.8' height='2.6' fill='%2315181d'/%3E%3Crect x='13.9' y='21.2' width='1.8' height='2.6' fill='%2315181d'/%3E%3Crect x='16.8' y='21.2' width='.8' height='2.6' fill='%2315181d'/%3E%3Crect x='18.7' y='21.2' width='1.4' height='2.6' fill='%2315181d'/%3E%3Crect x='21.1' y='21.2' width='1.4' height='2.6' fill='%2315181d'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark { background-color: #2b323b; border-radius: 8px; box-shadow: inset 0 0 0 1px #3a424c;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='13' y='0' width='6' height='15' fill='%23ffd23f'/%3E%3Crect x='7' y='19' width='18' height='7' rx='1.5' fill='%23e9edf1'/%3E%3Crect x='9.5' y='21.2' width='1.4' height='2.6' fill='%232b323b'/%3E%3Crect x='12' y='21.2' width='.8' height='2.6' fill='%232b323b'/%3E%3Crect x='13.9' y='21.2' width='1.8' height='2.6' fill='%232b323b'/%3E%3Crect x='16.8' y='21.2' width='.8' height='2.6' fill='%232b323b'/%3E%3Crect x='18.7' y='21.2' width='1.4' height='2.6' fill='%232b323b'/%3E%3Crect x='21.1' y='21.2' width='1.4' height='2.6' fill='%232b323b'/%3E%3C/svg%3E"); }
}
.nav { display: flex; flex-direction: column; gap: 16px; padding: 10px 10px 18px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 12px; color: var(--muted); padding: 0 10px 5px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-wash); color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 4px;
  border-radius: 0 3px 3px 0; background: var(--tape);
}
.side-foot { padding: 12px 14px 16px; border-top: 1px solid var(--line); }
.freshness { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.freshness .when { display: flex; align-items: baseline; flex: 1 1 100%; }
.freshness .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--st-green); display: inline-block; margin-right: 7px; transform: translateY(-1px); }
.freshness .dot.warn { background: var(--st-amber); }
.freshness .dot.err { background: var(--st-red); }
.freshness .dot.run { background: var(--series); animation: pulse 1.2s ease-in-out infinite; }
.freshness .t-short { display: none; }
.freshness .btn { width: 100%; justify-content: center; }
@keyframes pulse { 50% { opacity: .35; } }

/* Тёмное меню: графитовая колонка, как стеллаж; лента та же */
html[data-side="dark"] .side { background: #15181d; border-right-color: #15181d; color: #e9edf1; }
html[data-side="dark"] .side .brand { color: #fff; }
html[data-side="dark"] .side .brand small, html[data-side="dark"] .side .nav-label { color: #8a949f; }
html[data-side="dark"] .side .brand-mark { background-color: #2b323b; border-radius: 8px; box-shadow: inset 0 0 0 1px #3a424c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='13' y='0' width='6' height='15' fill='%23ffd23f'/%3E%3Crect x='7' y='19' width='18' height='7' rx='1.5' fill='%23e9edf1'/%3E%3Crect x='9.5' y='21.2' width='1.4' height='2.6' fill='%232b323b'/%3E%3Crect x='12' y='21.2' width='.8' height='2.6' fill='%232b323b'/%3E%3Crect x='13.9' y='21.2' width='1.8' height='2.6' fill='%232b323b'/%3E%3Crect x='16.8' y='21.2' width='.8' height='2.6' fill='%232b323b'/%3E%3Crect x='18.7' y='21.2' width='1.4' height='2.6' fill='%232b323b'/%3E%3Crect x='21.1' y='21.2' width='1.4' height='2.6' fill='%232b323b'/%3E%3C/svg%3E"); }
html[data-side="dark"] .nav a { color: #c3cbd4; }
html[data-side="dark"] .nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
html[data-side="dark"] .nav a[aria-current="page"] { background: rgba(255, 210, 63, .14); color: #fff; }
html[data-side="dark"] .nav a.locked { color: #6f7984; }
html[data-side="dark"] .side-foot { border-top-color: rgba(255, 255, 255, .08); }
html[data-side="dark"] .side .freshness { color: #8a949f; }
html[data-side="dark"] .side .btn { background: transparent; border-color: rgba(255, 255, 255, .2); color: #e9edf1; }
html[data-side="dark"] .side .btn:hover { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .35); }
html[data-side="dark"] .side .acct-btn { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: #fff; }
html[data-side="dark"] .side .acct-btn:hover, html[data-side="dark"] .side .acct-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); }
html[data-side="dark"] .side .acct-sub { color: #8a949f; }
@media (prefers-color-scheme: dark) { html[data-side="dark"] .side { background: #0a0c0f; border-right-color: #1d2228; } }
.look-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 16px; }
.look-row .muted { font-size: 13px; }

.work { margin-left: var(--side-w); min-width: 0; }
.top { display: none; }
.side-backdrop { display: none; }

.demo-banner {
  position: relative; background: var(--ink); color: var(--surface);
  padding: 9px 26px 9px 48px; font-size: 13px; line-height: 1.45;
}
.demo-banner::before { content: ""; position: absolute; left: 26px; top: 13px; width: 10px; height: 10px; border-radius: 2px; background: var(--tape); }
.demo-banner b { color: inherit; }
.demo-banner a { color: inherit; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 13px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { background: var(--surface); border-color: var(--line-strong); }
.btn.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: 13px; border-radius: 7px; }
.input, select.input {
  min-height: 34px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  min-width: 0; transition: border-color .12s, box-shadow .12s;
}
.input:hover { border-color: var(--muted); }
.input:focus, .qty-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--halo); }
.input::placeholder { color: var(--muted); opacity: .85; }
.input.search {
  width: 260px; padding-left: 32px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.6' fill='none' stroke='%236f7984' stroke-width='1.6'/%3E%3Cpath d='M10.4 10.4 14 14' stroke='%236f7984' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 10px 50% no-repeat;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 15px; height: 15px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.seg button {
  border: 0; border-radius: 7px; background: transparent; padding: 5px 11px; cursor: pointer;
  color: var(--ink-2); font-weight: 500; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 32, .14), 0 0 0 1px rgba(16, 24, 32, .05); }
.seg button .count { font-family: var(--font-data); color: var(--muted); margin-left: 6px; }

/* ---------- страница ---------- */
main { padding: 26px 26px 64px; max-width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin-bottom: 16px; }
.page-head h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -.025em; font-weight: 700; }
.lede { margin: 8px 0 0; color: var(--ink-2); max-width: 82ch; line-height: 1.5; }
.lede b { color: var(--ink); font-weight: 600; }
.lede .bad { color: var(--st-red); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 16px 0 12px; }
.toolbar .spacer { flex: 1; }
.params { color: var(--muted); font-size: 12.5px; margin-top: 6px; max-width: 120ch; line-height: 1.5; }
.params a { white-space: nowrap; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* ---------- сводка плана: бирка поставки ---------- */
.manifest {
  display: grid; grid-template-columns: minmax(150px, 1.25fr) repeat(3, minmax(110px, 1fr)) minmax(190px, 1.4fr);
  margin: 14px 0 0; max-width: 1080px;
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: var(--r-md); overflow: hidden;
}
.mf-cell { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; padding: 12px 16px 14px; border-left: 1px solid var(--line); min-width: 0; }
.mf-cell:first-child { border-left: 0; }
.mf-k { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.mf-v { font: 600 30px/1 var(--font-data); color: var(--ink); letter-spacing: -.01em; }
.mf-v small { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 4px; letter-spacing: 0; }
.mf-main .mf-v { font-size: 40px; }
.mf-cell.bad .mf-v { color: var(--st-red); }
.mf-cell.bad { background: linear-gradient(var(--st-red-wash), var(--st-red-wash)) 0 100% / 100% 4px no-repeat; }
.mf-dest { position: relative; justify-content: flex-start; gap: 3px; background: var(--surface-2); }
.mf-dest .mf-k:first-child { color: var(--ink); font-weight: 600; font-size: 13px; }
.mf-d { font-size: 15px; font-weight: 600; color: var(--ink); }
.mf-code {
  position: absolute; right: 14px; top: 13px; width: 56px; height: 16px; opacity: .5;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 3px, var(--ink) 3px 4px, transparent 4px 7px, var(--ink) 7px 10px, transparent 10px 11px);
}
.mf-notes { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; max-width: 110ch; color: var(--ink-2); }
.mf-notes li { position: relative; padding-left: 16px; }
.mf-notes li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 2px; background: var(--muted); }
@media (max-width: 1180px) {
  .manifest { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mf-dest { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
}
@media (max-width: 640px) {
  .manifest { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mf-main { grid-column: 1 / -1; }
  .mf-cell { padding: 10px 12px 12px; }
  .mf-cell:nth-child(2) { border-left: 0; }
  .mf-cell:nth-child(n+2) { border-top: 1px solid var(--line); }
  .mf-main .mf-v { font-size: 34px; }
  .mf-v { font-size: 24px; }
  .mf-dest { flex-direction: column; }
}

/* ---------- матрица товар × кластер ---------- */
.matrix-wrap {
  overflow: auto; max-height: calc(100vh - 250px); min-height: 280px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
table.matrix { border-collapse: separate; border-spacing: 0; font-family: var(--font-data); }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.matrix thead th {
  position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom-color: var(--line-strong);
  text-align: left; vertical-align: bottom; padding: 8px 10px; font-weight: 500;
  min-width: 118px; max-width: 150px;
}
.matrix thead th.prod { left: 0; z-index: 4; min-width: 260px; max-width: 300px; }
.matrix thead th.total { min-width: 96px; }
.cl-head { cursor: pointer; }
.cl-head:hover { background: var(--accent-wash); }
.cl-name { font-family: var(--font-ui); font-weight: 600; font-size: 13px; line-height: 1.25; color: var(--ink); display: block; }
.cl-meta { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; }
.cl-ship { display: block; margin-top: 4px; font-size: 13px; color: var(--ink); white-space: nowrap; }
.cl-ship b { font-weight: 600; }
.delta-up { color: var(--up); }
.delta-down { color: var(--down); }

.matrix tbody th {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  text-align: left; font-weight: 400; padding: 8px 10px; min-width: 260px; max-width: 300px;
}
.prod-art { font-weight: 600; font-size: 14px; color: var(--ink); }
.prod-size { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.prod-name { display: block; font-family: var(--font-ui); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 270px; }
.prod-meta { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.prod-meta .short { color: var(--st-red); }
.pair-tag { font-family: var(--font-ui); font-size: 11px; color: var(--muted); margin-left: 6px; }

td.cell { padding: 6px 9px 7px; vertical-align: top; cursor: pointer; min-width: 118px; position: relative; }
td.cell:hover { background: var(--surface-2); }
td.cell.blank { cursor: default; background: repeating-linear-gradient(0deg, transparent, transparent); }
td.cell.blank:hover { background: transparent; }
.ship { font-size: 18px; font-weight: 600; line-height: 1.1; color: var(--ink); display: flex; align-items: baseline; gap: 5px; }
.ship.zero { color: var(--line-strong); font-weight: 500; }
.ship .edited { font-size: 11px; font-weight: 500; color: var(--focus); }
.ship .cut { font-size: 11px; font-weight: 500; color: var(--muted); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.cell-sub .warn { color: var(--st-red); font-weight: 600; }

/* Шкала запаса: сколько дней хватит. Метка — день приёмки поставки. */
.gauge { position: relative; height: 6px; border-radius: 3px; background: var(--track); margin-top: 6px; }
.gauge i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.gauge i.transit { opacity: .35; }
.gauge b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; border-radius: 1px; }
.st-red i, .st-red .sw { background: var(--st-red); }
.st-yellow i, .st-yellow .sw { background: var(--st-amber); }
.st-green i, .st-green .sw { background: var(--st-green); }
.st-over i, .st-over .sw { background: var(--st-over); }
.st-idle i, .st-idle .sw { background: var(--st-idle); }

td.total { padding: 6px 10px; vertical-align: top; min-width: 96px; background: var(--surface-2); }
td.total .ship { font-size: 16px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-size: 12px; margin: 10px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 6px; border-radius: 3px; display: inline-block; }
.legend .tick { width: 2px; height: 12px; background: var(--ink); opacity: .55; display: inline-block; border-radius: 1px; }

/* ---------- поставка в кластер ---------- */
.ship-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 4px 0 12px; }
.ship-head .whs { color: var(--muted); font-size: 13px; max-width: 80ch; }
table.list { width: 100%; border-collapse: collapse; font-family: var(--font-data); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.list th, .list td { padding: 10px 11px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.list th { position: sticky; top: 0; background: var(--surface); font: 500 12px/1.3 var(--font-ui); color: var(--muted); z-index: 1;
  border-bottom: 1px solid var(--line-strong); vertical-align: bottom; }
.list tbody tr:last-child td { border-bottom: 0; }
.list th:first-child, .list td:first-child { text-align: left; }
.list td.prod { white-space: normal; min-width: 220px; }
.list tbody tr:hover { background: var(--surface-2); }
.list tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
.list .qty-input { width: 76px; text-align: right; padding: 5px 8px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); font-family: var(--font-data); font-size: 15px; font-weight: 600; color: var(--ink); }
.list .qty-input:hover { background: var(--surface); border-color: var(--muted); }
.list .qty-input.changed { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus) inset; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-size: 12px; color: var(--ink-2); }
.status-pill .sw { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.list-wrap { overflow: auto; max-height: calc(100vh - 280px); }

/* ---------- продажи ---------- */
.bullets { padding: 14px 16px 10px; }
.bullet-row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 150px; align-items: center; gap: 12px; padding: 5px 0; border-radius: 6px; }
.bullet-row:hover, .bullet-row:focus-visible { background: var(--surface-2); }
.bullet-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bullet-track { position: relative; height: 22px; }
.bullet-bar { position: absolute; left: 0; top: 4px; height: 14px; background: var(--series); border-radius: 0 4px 4px 0; }
.bullet-prev { position: absolute; top: 0; width: 2px; height: 22px; background: var(--ink); opacity: .7; border-radius: 1px; }
.bullet-val { font-family: var(--font-data); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bullet-val .d { display: inline-block; min-width: 58px; }
.chart-legend { display: flex; gap: 18px; padding: 0 16px 12px; font-size: 12px; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .bar { width: 14px; height: 10px; background: var(--series); border-radius: 0 3px 3px 0; display: inline-block; }
.chart-legend .tick { width: 2px; height: 14px; background: var(--ink); opacity: .7; display: inline-block; }

table.grid { border-collapse: separate; border-spacing: 0; font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.grid thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-family: var(--font-ui); font-weight: 500; font-size: 12px; color: var(--muted); vertical-align: bottom; max-width: 120px; white-space: normal; line-height: 1.3; border-bottom: 1px solid var(--line-strong); }
.grid thead th.sortable { cursor: pointer; }
.grid tbody th { position: sticky; left: 0; background: var(--surface); text-align: left; font-weight: 400; z-index: 1; min-width: 220px; }
.grid thead th:first-child { left: 0; z-index: 3; text-align: left; }
.grid td .d { display: block; font-size: 11px; }
.grid tbody tr:hover th, .grid tbody tr:hover td { background: var(--surface-2); }
.grid td.tot { background: var(--surface-2); font-weight: 600; }
.grid.wide { width: 100%; }
.grid th.left { text-align: left; }
.drawer .list th, .drawer .list td { padding: 7px 6px; }
.drawer .list td:first-child { white-space: normal; }

/* ---------- товары и настройки ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px 22px; padding: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.field .input { width: 100%; }
.example { margin: 0 18px 18px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); max-width: 90ch; }
.section-title { font-size: 16px; margin: 26px 0 8px; }
.section-note { color: var(--muted); margin: 0 0 10px; max-width: 80ch; }
.log { white-space: pre-wrap; font-family: var(--font-data); font-size: 13px; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; margin: 8px 0 0; max-height: 320px; overflow: auto; }
details.run { border-bottom: 1px solid var(--line); padding: 10px 14px; }
details.run summary { cursor: pointer; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 5px; font: 500 12px/1.6 var(--font-ui); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--st-green-wash); border-color: transparent; }
.badge.partial { background: var(--st-amber-wash); border-color: transparent; }
.badge.error { background: var(--st-red-wash); border-color: transparent; }
.badge.unknown { background: var(--st-red-wash); border-color: transparent; }

/* ---------- боковая карточка ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(14, 18, 24, .32); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(660px, 100vw); background: var(--surface); box-shadow: var(--shadow-panel);
  overflow: auto; padding: 22px 24px 40px; border-left: 1px solid var(--line);
  animation: slide-in .18s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } .freshness .dot.run { animation: none; } }
.drawer h2 { font-size: 20px; margin: 0 90px 4px 0; line-height: 1.25; letter-spacing: -.015em; }
.drawer .close { position: absolute; top: 12px; right: 12px; }
.drawer h3 { font-size: 14px; margin: 22px 0 8px; }
.calc { margin: 0; padding: 0; list-style: none; }
.calc li { padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.calc li b { color: var(--ink); font-family: var(--font-data); font-size: 15px; }
.calc li.result { color: var(--ink); }
.calc li.result b { font-size: 18px; }
.qty-edit { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.qty-edit .input { width: 100px; font-family: var(--font-data); font-size: 16px; font-weight: 600; }
.tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--ink); color: var(--surface); padding: 6px 9px; border-radius: 6px;
  font-size: 12px; line-height: 1.35; max-width: 260px; box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.tip strong { font-family: var(--font-data); font-size: 14px; }
.svg-chart { width: 100%; height: auto; display: block; }
.svg-chart text { font-family: var(--font-data); fill: var(--muted); font-size: 11px; }
.svg-chart .val { fill: var(--ink); font-size: 12px; font-weight: 600; }
.svg-chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.svg-chart .base { stroke: var(--line-strong); stroke-width: 1; }
.svg-chart .col { fill: var(--series); pointer-events: none; }
.svg-chart text { pointer-events: none; }
.svg-chart .seg { pointer-events: none; }
.svg-chart .col-hit:hover { fill: var(--series-wash); }
.sw-box { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tip-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.tip-row i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.grid tfoot th, .grid tfoot td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line-strong); }
.chart-scroll { overflow-x: auto; }
.chart-scroll .svg-chart { min-width: 640px; }
.chart-legend { flex-wrap: wrap; row-gap: 6px; }
.chart-legend span { white-space: nowrap; }
.drawer .list th { position: static; }
.drawer .list { font-size: 13px; }
.drawer .list th, .drawer .list td { padding: 6px 5px; }
.svg-chart .col-hit { fill: transparent; cursor: default; }
.svg-chart .col-hit:hover + .col, .svg-chart .col-hit:focus + .col { filter: brightness(1.15); }

.toast {
  position: fixed; left: calc(50% + var(--side-w) / 2); bottom: 24px; transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px);
}
.toast::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tape); }
.toast.err::before { background: #fff; }
.toast.err { background: var(--st-red); color: #fff; }
.loading { opacity: .55; transition: opacity .15s; pointer-events: none; }

@media (max-width: 1180px) {
  .work { margin-left: 0; }
  .top {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
    height: 52px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .top .brand-mark { width: 26px; height: 26px; border-radius: 7px; }
  .top-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; min-width: 0; }
  .top-cab { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
  .menu-btn { padding-left: 10px; }
  .menu-btn::before { content: ""; width: 16px; height: 12px; background: linear-gradient(currentColor 0 0) 0 0 / 100% 2px no-repeat,
    linear-gradient(currentColor 0 0) 0 50% / 100% 2px no-repeat, linear-gradient(currentColor 0 0) 0 100% / 100% 2px no-repeat; }
  .side { transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-panel); }
  body.side-open .side { transform: none; }
  body.side-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 34; background: rgba(14, 18, 24, .38); }
  body.side-open { overflow: hidden; }
  .toast { left: 50%; }
  .demo-banner { padding: 9px 16px 9px 36px; }
  .demo-banner::before { left: 16px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media (max-width: 860px) {
  main { padding: 18px 14px 50px; }
  .page-head h1 { font-size: 22px; }
  .input.search { width: 100%; }
  .bullet-row { grid-template-columns: 110px 1fr 112px; gap: 8px; }
  .matrix-wrap { max-height: none; }
  .matrix thead th.prod, .matrix tbody th { min-width: 170px; max-width: 190px; }
  .prod-name { max-width: 160px; }
}

/* ---------- план по артикулам ---------- */
.art-sec { margin: 6px 0 26px; }
details.art-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
details.art-sec summary { cursor: pointer; }
.sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.sec-head h2 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
table.list.art td { vertical-align: top; }
table.list.art td.prod { min-width: 200px; }
table.list.art td.chips { text-align: left; white-space: normal; min-width: 320px; }
table.list.art td.why { text-align: left; white-space: normal; color: var(--ink-2); font-family: var(--font-ui); font-size: 13px; min-width: 220px; }
table.list.art td.tot { font-weight: 600; font-size: 15px; }
table.list.art .d { display: block; font-size: 11px; }
table.list.art .short { color: var(--st-red); }
.art-group + .art-group tr:first-child td { border-top: 1px solid var(--line-strong); }
.art-head td { background: var(--surface-2); }
.art-head .prod-name { display: inline; margin-left: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; margin: 2px 5px 2px 0;
  padding: 4px 9px 4px 12px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface);
  box-shadow: inset 4px 0 0 var(--st-idle);
  font: 13px/1.3 var(--font-data); color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip b { color: var(--ink); font-size: 14.5px; font-weight: 600; }
.chip:hover { background: var(--surface-2); border-color: var(--muted); }
.chip .sw { display: none; }
.chip.st-red { box-shadow: inset 4px 0 0 var(--st-red); }
.chip.st-yellow { box-shadow: inset 4px 0 0 var(--st-amber); }
.chip.st-green { box-shadow: inset 4px 0 0 var(--st-green); }
.chip.st-over { box-shadow: inset 4px 0 0 var(--st-over); }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); font: 500 11px/1.65 var(--font-ui); }
.mode-box { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); }
.mode-box .seg { align-self: flex-start; flex-wrap: wrap; }
.chip.st-red .sw { background: var(--st-red); }
.chip.st-yellow .sw { background: var(--st-amber); }
.chip.st-green .sw { background: var(--st-green); }
.chip.st-over .sw { background: var(--st-over); }
.panel.art-wrap { overflow-x: auto; }
.list th.left { text-align: left; }
@media (max-width: 860px) {
  table.list.art thead { display: none; }
  table.list.art, table.list.art tbody, table.list.art tr, table.list.art td { display: block; width: 100%; }
  table.list.art tr { padding: 8px 12px; border-bottom: 1px solid var(--line); }
  table.list.art td { border: 0; padding: 2px 0; text-align: left; min-width: 0 !important; white-space: normal; }
  table.list.art td.num { display: inline-block; width: auto; margin-right: 14px; font-size: 13px; }
  table.list.art td.num::before { content: attr(data-label) " "; color: var(--muted); font-family: var(--font-ui); }
  table.list.art td.empty-cell { display: none; }
  table.list.art .prod-name { max-width: 100%; }
}

/* ---------- период поставки ---------- */
.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 4px; }
.period-label { font-weight: 600; }
.period-own { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.period-own .input { width: 70px; text-align: right; }
.period-own .input.on { border-color: var(--ink); background: var(--accent-wash); }
.period-hint { font-size: 13px; }

/* ---------- коробки ---------- */
.chip .bx { font-size: 12px; color: var(--muted); padding-left: 6px; border-left: 1px solid var(--line); }
.chip .bx.part { color: var(--st-red); }
.box-note { display: block; font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; min-height: 1em; }

/* ---------- окно поверх страницы ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14, 18, 24, .42); z-index: 50; }
.modal {
  position: fixed; z-index: 51; left: 50%; top: 5vh; transform: translateX(-50%);
  width: min(720px, calc(100vw - 24px)); max-height: 90vh; overflow: auto;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-panel); padding: 22px 24px 18px;
}
.modal h2 { font-size: 20px; margin: 0 90px 10px 0; letter-spacing: -.015em; }
.modal h3 { font-size: 14px; margin: 16px 0 8px; }
.modal .close { position: absolute; top: 12px; right: 12px; }
.modal-foot { position: sticky; bottom: -18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  margin: 16px -24px -18px; padding: 14px 24px; background: var(--surface); border-top: 1px solid var(--line); }
.modal-foot .muted { font-size: 13px; max-width: 46ch; }
.demo-note { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--ink-2); padding: 9px 14px; border-radius: var(--r-sm);
  border: 1px dashed var(--line-strong); margin: 0 0 14px; font-size: 13px; }
.demo-note::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 2px; background: var(--tape); }
.panel.demo-note { border: 1px dashed var(--line-strong); }
.kind-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind-card { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); cursor: pointer; }
.kind-card input { grid-row: span 2; margin-top: 3px; }
.kind-card span { color: var(--muted); font-size: 13px; }
.kind-card.on { border-color: var(--ink); background: var(--accent-wash); }
.point-search { display: flex; gap: 8px; }
.point-search .input { flex: 1; }
.points { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.point { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.point:hover { border-color: var(--ink); }
.point span { color: var(--muted); font-size: 12px; }
.picked-point { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--accent-wash); border-radius: var(--r-sm); }
table.list.oz-pick td:first-child, table.list.oz-pick th:first-child { width: 32px; }
.list th.left, .list td.left { text-align: left; }
.boxes-text { width: 100%; font-family: var(--font-data); resize: vertical; }

/* ---------- заявки Ozon ---------- */
.oz-batch { margin-bottom: 18px; }
.oz-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.oz-head .spacer { flex: 1; }
table.list.oz-table td { vertical-align: top; }
table.list.oz-table td.wrap { white-space: normal; min-width: 200px; max-width: 360px; }
.oz-st { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-weight: 500; }
.oz-st .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--st-idle); }
.oz-st.wait .sw { background: var(--focus); animation: pulse 1.2s ease-in-out infinite; }
.oz-st.ok .sw { background: var(--st-amber); }
.oz-st.done .sw { background: var(--st-green); }
.oz-st.bad { color: var(--st-red); }
.oz-st.bad .sw { background: var(--st-red); }
@media (prefers-reduced-motion: reduce) { .oz-st.wait .sw { animation: none; } }
.oz-msg { font-family: var(--font-ui); font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.oz-rej { font-family: var(--font-ui); font-size: 12px; color: var(--st-red); margin-top: 3px; }
.oz-items > td { background: var(--surface-2); padding: 6px 12px 10px; }
.oz-items table.list { max-width: 560px; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font: inherit; }
.order-no { font-weight: 600; color: var(--ink); }
table.list.oz-table select.input { max-width: 240px; }

@media (max-width: 860px) {
  .kind-cards { grid-template-columns: 1fr; }
  .modal { top: 0; max-height: 100vh; width: 100vw; border-radius: 0; }
  .period-hint { display: none; }
}
.sec-head .spacer { flex: 1; }
.sec-head .btn { align-self: center; }
@media (max-width: 860px) {
  table.list.oz-table thead { display: none; }
  table.list.oz-table, table.list.oz-table tbody, table.list.oz-table tr, table.list.oz-table td { display: block; width: 100%; }
  table.list.oz-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.list.oz-table td { border: 0; padding: 3px 0; white-space: normal; max-width: none !important; }
  table.list.oz-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; font-family: var(--font-ui); }
  table.list.oz-table td.oz-act { text-align: left; padding-top: 6px; }
  table.list.oz-table select.input { max-width: 100%; width: 100%; }
  .oz-items table.list tr { padding: 0; }
}
@media (max-width: 860px) {
  .toolbar .seg, .period-bar .seg { max-width: 100%; overflow-x: auto; }
  .sec-head .spacer { display: none; }
}
.kind-cards.three { grid-template-columns: repeat(3, 1fr); }
.oz-cls { display: block; font-family: var(--font-ui); font-size: 12px; color: var(--muted); white-space: normal; max-width: 260px; }
@media (max-width: 860px) { .kind-cards.three { grid-template-columns: 1fr; } }

/* ---------- локализация ---------- */
.rules-note { background: var(--surface-2); border: 0; box-shadow: inset 3px 0 0 var(--ink); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 11px 16px; color: var(--ink-2); max-width: 110ch; margin: 6px 0 16px; font-size: 13px; line-height: 1.5; }
.rules-note b { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: var(--r-md); overflow: hidden; }
.tile { padding: 14px 18px 16px; border-left: 1px solid var(--line); }
.tile:first-child { border-left: 0; }
.tile-k { color: var(--muted); font-size: 12.5px; }
.tile-v { font: 600 30px/1.1 var(--font-data); color: var(--ink); margin: 6px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile-v.low { color: var(--st-red); }
.tile-v.ok { color: var(--st-green); font-size: 22px; }
.tile-s { color: var(--ink-2); font-size: 13px; }
.loc-chart { padding: 12px 16px 8px; }
.chart-title { font-size: 14px; margin: 0 0 6px; }
.svg-chart .target { stroke: var(--ink); stroke-width: 1; opacity: .55; }
.svg-chart .target-l { fill: var(--ink-2); font-size: 12px; }
.meter { display: inline-block; position: relative; width: 90px; height: 6px; border-radius: 3px; background: var(--track); vertical-align: middle; margin-right: 8px; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--series); }
.meter b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; border-radius: 1px; }
.meter-v { font-family: var(--font-data); }
.meter-v.low { color: var(--st-red); }
table.list.loc td { vertical-align: top; }
table.list.loc td.wrap { white-space: normal; min-width: 160px; max-width: 320px; }
table.list.loc td.why { white-space: normal; min-width: 200px; max-width: 320px; font-family: var(--font-ui); font-size: 13px; color: var(--ink-2); }
table.list.loc .d { display: block; font-size: 11px; }
table.list.loc .short { color: var(--st-red); }
table.list.loc tr.need td { background: var(--accent-wash); }
@media (max-width: 860px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile:nth-child(odd) { border-left: 0; }
  .tile:nth-child(n+3) { border-top: 1px solid var(--line); }
  .tile-v { font-size: 24px; }
}
@media (max-width: 860px) {
  table.list.loc th:first-child, table.list.loc td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  table.list.loc thead th:first-child { background: var(--surface-2); z-index: 2; }
}

/* ---------- остатки FBS ---------- */
.warn-note { box-shadow: inset 3px 0 0 var(--st-red); background: var(--st-red-wash); }
.auto-panel { padding: 12px 14px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 10px; }
.auto-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.auto-row .spacer { flex: 1; }
.auto-row .confirm { display: inline-flex; align-items: center; gap: 6px; color: var(--st-red); font-weight: 500; }
.auto-status { color: var(--ink-2); font-size: 13px; }
.auto-status .bad, table.list.fbs td.bad { color: var(--st-red); }
.auto-keys { font-size: 13px; color: var(--ink-2); background: var(--st-amber-wash); padding: 8px 10px; border-radius: var(--r-sm); }
table.list.fbs td { vertical-align: top; }
table.list.fbs .d { display: block; font-size: 11px; }
table.list.fbs tr.norule td { color: var(--ink-2); }
table.list.fbs .qty-input { width: 80px; }
.ev { font-family: var(--font-ui); font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.ev-ok { background: var(--st-green-wash); border-color: transparent; }
.ev-dry { background: var(--accent-wash); border-color: transparent; }
.ev-limit { background: var(--st-amber-wash); border-color: transparent; }
.ev-error { background: var(--st-red-wash); border-color: transparent; }
@media (max-width: 860px) {
  .auto-row .seg { width: 100%; display: flex; }
  .auto-row .seg button { flex: 1; padding-left: 6px; padding-right: 6px; }
  .auto-row .confirm { flex-wrap: wrap; }
}

/* ---------- свой склад ---------- */
.list td.wrap { white-space: normal; min-width: 220px; }
.list td .d { display: block; font-size: 11px; font-weight: 400; }
.page-head .head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.inv-mat { padding: 14px 16px 12px; margin: 0 0 14px; }
.inv-head { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; align-items: flex-start; }
.inv-head h2 { font-size: 17px; margin: 0 0 2px; }
.inv-verdict { text-align: right; font-size: 14px; }
.inv-verdict .muted { font-size: 13px; }
.inv-verdict b { font-size: 15px; }
.inv-stock { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: flex-end; margin: 14px 0 6px; padding: 10px 12px;
  background: var(--surface-2); border-radius: var(--r-sm); }
.inv-strip { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-end; }
.inv-f { display: inline-flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }
.inv-f .qty-input, .inv-op .qty-input { width: 86px; text-align: right; padding: 5px 7px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); font-family: var(--font-data); font-size: 15px; font-weight: 600; color: var(--ink); }
.inv-f select.input { min-width: 120px; }
.inv-hint { font-size: 12px; color: var(--muted); padding-bottom: 7px; }
.inv-facts { margin: 6px 0 8px; color: var(--ink-2); font-size: 13px; }
.inv-facts .bad, .inv-calc .bad, .inv-danger .bad { color: var(--st-red); }
.inv-table { max-height: none; }
.inv-table table.list td { vertical-align: top; }
.inv-size { font-family: var(--font-data); font-size: 15px; }
.inv-table td.bad { color: var(--st-red); font-weight: 600; }
.inv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.inv-actions .spacer { flex: 1; }
.inv-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; margin: 6px 0 4px; }
.inv-form .field.wide { grid-column: 1 / -1; }
.inv-op { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin: 8px 0; }
.inv-calc { color: var(--ink-2); margin: 10px 0 0; }
.inv-empty div { margin-top: 12px; }
.inv-unlinked { padding: 10px 14px; margin-top: 18px; }
.inv-unlinked summary { cursor: pointer; }
.list tr.undone td { color: var(--muted); text-decoration: line-through; }
.list tr.undone td:last-child { text-decoration: none; }
.warn-t { color: var(--st-amber); }
.ok-t { color: var(--st-green); }
.sw.st-red { background: var(--st-red); } .sw.st-yellow { background: var(--st-amber); }
.sw.st-green { background: var(--st-green); } .sw.st-idle { background: var(--st-idle); }
@media (max-width: 860px) {
  .inv-verdict { text-align: left; }
  .inv-form { grid-template-columns: 1fr 1fr; }
  .page-head .head-actions { margin-left: 0; }
}
.inv-auto { margin: 8px 0 4px; font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; }
.inv-auto .sw-auto { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--st-green); transform: translateY(-1px); }
.bad-t { color: var(--st-red); }
.inv-now { align-self: center; font-weight: 600; font-size: 13px; color: var(--ink); margin-right: 4px; }
.inv-recount { margin-left: auto; }
@media (max-width: 860px) { .inv-recount { margin-left: 0; } }

/* ---------- остатки по складам ---------- */
table.list.wh tr.clickable { cursor: pointer; }
table.list.wh tr.gone td { color: var(--muted); }
.list tr.clickable { cursor: pointer; }
.wh-bar { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); vertical-align: middle; overflow: hidden; }
.wh-bar i { display: block; height: 100%; background: var(--accent); opacity: .75; }
.wh-found { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.wh-hist { max-height: 62vh; }
.wh-hist td.up { color: var(--st-green); font-weight: 600; }
.wh-hist td.down { color: var(--st-red); }
.period-own select.input { width: auto; min-width: 118px; }
.wh-hist table.list td:first-child, .wh-hist table.list th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.wh-hist table.list thead th:first-child { background: var(--surface-2); z-index: 3; }

/* ---------- акции ---------- */
.promo-set .pm-name { font: 700 13px/1 var(--font-data); letter-spacing: .04em; min-width: 42px; }
.promo-more { border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.promo-more > summary { cursor: pointer; font-weight: 600; font-size: 13px; list-style-position: inside; }
.promo-more > summary .muted { font-weight: 400; }
.promo-more[open] > summary { margin-bottom: 4px; }
.promo-more .section-note { margin: 0; font-size: 12.5px; }
.pflag { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.pflag input { width: 15px; height: 15px; accent-color: var(--accent); }
.seg .count.bad { color: var(--st-red); font-weight: 600; }

.promo-list { display: flex; flex-direction: column; gap: 10px; }
.pa { overflow: hidden; }
.pa.open { border-color: var(--line-strong); box-shadow: inset 0 3px 0 var(--ink); }
.pa-head {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; background: none;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.pa-head:hover { background: var(--surface-2); }
.pa-head:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.pa-mk { flex: none; min-width: 46px; text-align: center; font: 700 11.5px/1 var(--font-data); letter-spacing: .05em; padding: 5px 7px; border-radius: 4px; color: #fff; }
.pa-mk.mk-wb { background: var(--st-over); }
.pa-mk.mk-oz { background: var(--link); }
.pa-title { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.pa-title > b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pa-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12.5px; color: var(--muted); }
.pa-dates { font-family: var(--font-data); color: var(--ink-2); margin-right: 2px; }
.pa-counts { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.pa-counts i { font-style: normal; color: var(--muted); margin: 0 7px; }
.pa-counts b { font-weight: 600; }
.go { color: var(--st-green); }
.stop { color: var(--st-red); }
.pa-caret { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.pa-head[aria-expanded="true"] .pa-caret { transform: rotate(225deg) translate(-2px, -2px); }
.pa-desc { margin: 0; padding: 0 16px 10px 74px; color: var(--muted); font-size: 13px; max-width: 120ch; }
.pa-note { padding: 4px 16px 16px 74px; color: var(--ink-2); max-width: 110ch; }
.pa-wrap { border-top: 1px solid var(--line); max-height: 540px; }
table.list.promo-t td { vertical-align: top; }
table.list.promo-t th.prod, table.list.promo-t td.prod { text-align: left; }
.promo-set { margin-top: 14px; }
table.list.promo-t .d, table.list.promo-c .d { display: block; font-size: 11.5px; margin-top: 2px; }
table.list.promo-t .d.down { color: var(--st-red); }
table.list.promo-t td.bad, table.list.promo-c td.bad { color: var(--st-red); }
table.list.promo-t tr.in td { background: var(--surface-2); }
table.list.promo-t th.ck, table.list.promo-t td.ck { width: 34px; padding-right: 0; text-align: center; }
table.list.promo-t td.ck input, table.list.promo-t th.ck input { width: 16px; height: 16px; accent-color: var(--accent); }
table.list.promo-t td .badge + .d { margin-top: 4px; }
.pst {
  display: inline-block; padding: 2px 9px 2px 11px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line);
  font: 500 12.5px/1.5 var(--font-ui); color: var(--ink); white-space: nowrap; box-shadow: inset 4px 0 0 var(--st-idle);
}
.pst.st-green { box-shadow: inset 4px 0 0 var(--st-green); }
.pst.st-yellow { box-shadow: inset 4px 0 0 var(--st-amber); }
.pst.st-red { box-shadow: inset 4px 0 0 var(--st-red); }
.pa-adv { display: block; font-size: 11.5px; font-weight: 600; margin-top: 4px; }
.pa-adv.go { color: var(--st-green); }
.pa-adv.stop { color: var(--st-red); }
.pa-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.pa-bar .spacer { flex: 1; }
.pa-bar .confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--st-red); font-weight: 500; }
.pa-foot { margin: 0; padding: 8px 16px 12px; font-size: 12.5px; max-width: none; }
table.list.promo-c tr.nocost td:first-child { box-shadow: inset 3px 0 0 var(--st-amber); }
table.list.promo-c .qty-input { width: 92px; }
table.list.promo-c .qty-input::placeholder { color: var(--muted); font-weight: 500; }
.list tr.err td { color: var(--st-red); }
@media (max-width: 860px) {
  .pa-head { flex-wrap: wrap; gap: 8px 10px; padding: 12px; }
  .pa-title { flex-basis: calc(100% - 80px); }
  .pa-counts { order: 3; width: 100%; white-space: normal; padding-left: 0; }
  .pa-desc, .pa-note { padding-left: 12px; padding-right: 12px; }
  .pa-bar { padding: 10px 12px; }
  .pa-bar .spacer { display: none; }
  .promo-set .auto-row .seg { display: flex; width: 100%; }
  .promo-set .auto-row .seg button { flex: 1; white-space: normal; line-height: 1.25; padding-left: 6px; padding-right: 6px; }
  .promo-set .auto-row .period-label { width: 100%; }
  /* таблица товаров акции на телефоне — карточками */
  .pa-wrap { max-height: none; }
  table.list.promo-t thead { display: none; }
  table.list.promo-t, table.list.promo-t tbody { display: block; }
  table.list.promo-t tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px 12px 12px 44px; border-bottom: 1px solid var(--line); }
  table.list.promo-t td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; }
  table.list.promo-t td.ck { position: absolute; left: 12px; top: 13px; width: auto; }
  table.list.promo-t td.prod { grid-column: 1 / -1; min-width: 0; }
  table.list.promo-t td[data-l]::before { content: attr(data-l); display: block; font: 400 11.5px/1.3 var(--font-ui); color: var(--muted); margin-bottom: 2px; }
  table.list.promo-t .c-price { order: 1; } table.list.promo-t .c-promo { order: 2; }
  table.list.promo-t .c-pnow { order: 3; } table.list.promo-t .c-pro { order: 4; }
  table.list.promo-t .c-part { order: 5; } table.list.promo-t .c-st { order: 6; }
  table.list.promo-t .prod-name { max-width: none; }
  table.list.promo-t tr.in { background: var(--surface-2); }
  table.list.promo-t tr.in td { background: none; }
}

/* ---------- скидка за отгрузку FBS ---------- */
.ship-wait-head { margin: 0 0 10px; color: var(--ink-2); line-height: 1.6; }
.ship-wait-head b { color: var(--ink); }
#ship-wait .list-wrap { border: 1px solid var(--line); border-radius: var(--r-sm); }
table.list.ship-t td { vertical-align: top; }
table.list.ship-t td.prod { min-width: 200px; }
table.list.ship-t .d { display: block; font-size: 11.5px; margin-top: 3px; }
table.list.ship-t td.num, table.list.ship-t td.left.num { font-family: var(--font-data); white-space: nowrap; }
table.list.ship-t .bad { color: var(--st-red); }

/* ---------- автобронь слота Ozon ---------- */
.oz-st.catch .sw { background: var(--tape); box-shadow: 0 0 0 2px rgba(255, 210, 63, .28); animation: pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .oz-st.catch .sw { animation: none; } }
.catch-panel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 11px 14px; margin-bottom: 14px;
  box-shadow: inset 4px 0 0 var(--tape); border-radius: var(--r-md); }
.catch-panel .muted { font-size: 13px; }
.catch-cond { font-family: var(--font-data); font-size: 13.5px; color: var(--ink); white-space: normal; }
.catch-found { color: var(--st-green); font-weight: 600; }
.catch-events { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.catch-ev { padding: 9px 12px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--ink); }
.catch-ev b { font-weight: 600; margin-right: 6px; }
.catch-ev.ok { background: var(--st-green-wash); }
.catch-ev.warn { background: var(--st-amber-wash); }
.catch-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 26px; font-size: 13.5px;
  border-bottom: 1px solid var(--line); }
.catch-banner > span { flex: 1; min-width: 200px; }
.catch-banner.ok { background: var(--st-green-wash); }
.catch-banner.warn { background: var(--st-amber-wash); }
.catch-modal { width: min(680px, calc(100vw - 24px)); }
.catch-modal .cm-what { margin: -2px 0 6px; color: var(--ink-2); font-size: 13.5px; }
.catch-modal .section-note { font-size: 13px; }
.cm-sec { padding: 4px 0 6px; border-top: 1px solid var(--line); margin-top: 8px; }
.cm-sec h3 { margin: 12px 0 8px; }
.cm-dates { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.cm-dates label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.cm-dates .input { width: 160px; }
.cm-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.chip-t { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 4px 11px;
  font: 500 13px/1.4 var(--font-ui); cursor: pointer; }
.chip-t:hover { border-color: var(--ink); color: var(--ink); }
.chip-t[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip-t.wd { min-width: 42px; text-align: center; }
.cm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.cm-row:first-child { margin-top: 0; }
.cm-k { color: var(--ink-2); font-size: 13px; min-width: 90px; }
.cm-time { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.cm-time .input { width: 96px; }
.catch-modal .hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.cm-radio, .cm-check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.cm-radio input, .cm-check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.cm-whs { padding: 2px 0 4px 24px; }
.cm-whs.off { opacity: .55; }
.cm-notify { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.cm-hint { font-size: 12.5px; }
.cm-sum { margin-top: 14px; padding: 11px 14px; background: var(--surface-2); box-shadow: inset 3px 0 0 var(--tape); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.cm-sum:empty { display: none; }
.cm-sum b { color: var(--ink); }
.catch-modal .modal-foot .spacer { flex: 1; }
.catch-modal .modal-foot .bad { color: var(--st-red); font-size: 13px; }
.catch-modal .kind-card b { font-weight: 600; }
@media (max-width: 860px) {
  .catch-banner { padding: 9px 16px; }
  .cm-dates .input { width: 100%; }
  .cm-dates label { flex: 1 1 140px; }
  .catch-modal .modal-foot .spacer { display: none; }
}
table.list.oz-table td.oz-act { white-space: normal; }
.oz-btns { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.oz-btns .btn { white-space: nowrap; }
@media (max-width: 860px) { .oz-btns { flex-direction: row; flex-wrap: wrap; align-items: center; } }
table.list.oz-table td { white-space: normal; }
table.list.oz-table td .btn, table.list.oz-table .oz-st { white-space: nowrap; }
.catch-cond { max-width: 230px; }
table.list.oz-table .linkish, .order-no { white-space: nowrap; }

/* ---------- режим работы: «Только следить» / «Управлять» ---------- */
:root { --watch: #2558c9; --watch-wash: #e9f0fe; --watch-line: #c5d5f8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --watch: #8fb0ff; --watch-wash: #18233a; --watch-line: #2d3d60; } }
.mode-pill { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "ic t t" "ic s sw"; align-items: center;
  gap: 1px 8px; width: 100%; padding: 9px 9px 9px 10px; border-radius: 10px; border: 1px solid;
  text-align: left; cursor: pointer; font: inherit; line-height: 1.25; transition: background .15s, border-color .15s; }
.mode-pill .mp-ic { grid-area: ic; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.mode-pill .mp-t { grid-area: t; font-weight: 650; font-size: 14px; white-space: nowrap; }
.mode-pill .mp-s { grid-area: s; font-size: 11px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-pill .mp-sw { grid-area: sw; position: relative; width: 30px; height: 18px; border-radius: 9px; background: var(--line-strong); }
.mode-pill .mp-sw i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left .15s; }
.mode-pill.act .mp-sw { background: var(--tape); }
.mode-pill.act .mp-sw i { left: 14px; background: #15181d; }
.mode-pill.watch { background: var(--watch-wash); border-color: var(--watch-line); color: var(--ink); }
.mode-pill.watch .mp-ic { background: var(--watch); color: #fff; }
.mode-pill.act { background: var(--accent-wash); border-color: #efce5c; color: var(--ink); }
.mode-pill.act .mp-ic { background: var(--tape); color: #15181d; }
.mode-pill:hover { border-color: var(--ink-2); }
html[data-side="dark"] .side .mode-pill.watch { background: rgba(143, 176, 255, .13); border-color: rgba(143, 176, 255, .35); color: #eef2ff; }
html[data-side="dark"] .side .mode-pill.watch .mp-ic { background: #8fb0ff; color: #0e1424; }
html[data-side="dark"] .side .mode-pill.act { background: rgba(255, 210, 63, .14); border-color: rgba(255, 210, 63, .5); color: #fff; }
html[data-side="dark"] .side .mode-pill .mp-sw { background: rgba(255, 255, 255, .22); }
html[data-side="dark"] .side .mode-pill.act .mp-sw { background: var(--tape); }
html[data-side="dark"] .side .mode-pill:hover { border-color: rgba(255, 255, 255, .55); }
/* несколько кабинетов на одном компьютере: переключатель над режимом работы */
.cab-switch { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.cab-switch select { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 600 14px/1.25 var(--font-ui); cursor: pointer; }
html[data-side="dark"] .side .cab-switch { color: rgba(255, 255, 255, .6); }
html[data-side="dark"] .side .cab-switch select { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .25); color: #fff; }
html[data-side="dark"] .side .cab-switch select option { color: #15181d; background: #fff; }
@media (prefers-reduced-motion: reduce) { .mode-pill .mp-sw i { transition: none; } }
.mode-chip { display: none; }
@media (max-width: 1180px) {
  .mode-chip { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: 999px;
    border: 1px solid; font: 600 12.5px/1 var(--font-ui); cursor: pointer; white-space: nowrap; }
  .mode-chip.hidden { display: none; }
  .mode-chip svg { width: 15px; height: 15px; }
  .mode-chip.watch { background: var(--watch-wash); border-color: var(--watch-line); color: var(--watch); }
  .mode-chip.act { background: var(--accent-wash); border-color: #efce5c; color: var(--ink); }
}
.mode-modal h3 { margin-top: 18px; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.mode-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; padding: 14px; text-align: left;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.mode-card .mc-ic { grid-row: 1; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); }
.mode-card .mc-t { display: flex; align-items: center; gap: 8px; }
.mode-card .mc-t b { font-size: 15.5px; }
.mode-card .mc-t em { font-style: normal; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.mode-card .mc-d { grid-column: 1 / -1; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.mode-card:hover { border-color: var(--ink-2); }
.mode-card.watch.on { border-color: var(--watch); background: var(--watch-wash); box-shadow: 0 0 0 3px var(--watch-line); }
.mode-card.watch.on .mc-ic { background: var(--watch); color: #fff; }
.mode-card.act.on { border-color: #d9ad16; background: var(--accent-wash); box-shadow: 0 0 0 3px rgba(255, 210, 63, .45); }
.mode-card.act.on .mc-ic { background: var(--tape); color: #15181d; }
.md-list { margin: 0; padding-left: 18px; color: var(--ink-2); line-height: 1.6; }
.md-list b { color: var(--ink); }
table.list.md-table td { padding: 7px 10px; vertical-align: top; }
table.list.md-table td:first-child { width: 34%; font-weight: 600; white-space: nowrap; }
table.list.md-table td a { color: var(--ink); text-decoration: none; border-bottom: 1px dashed var(--line-strong); }
.md-tg { margin-top: 12px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--st-green-wash); font-size: 13px; }
.md-tg.off { background: var(--st-amber-wash); }
.mode-modal .hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.mode-modal .modal-foot .spacer { flex: 1; }
.mode-modal .modal-foot .bad { color: var(--st-red); font-size: 13px; }
@media (max-width: 860px) { .mode-cards { grid-template-columns: 1fr; } table.list.md-table td:first-child { white-space: normal; } }
.watch-note { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 10px 14px; max-width: 110ch;
  background: var(--watch-wash); border: 1px solid var(--watch-line); border-radius: var(--r-sm); color: var(--ink); font-size: 13.5px; line-height: 1.5; }
.watch-note .mp-ic { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--watch); color: #fff; }
.watch-note .mp-ic svg { width: 15px; height: 15px; }
.watch-note .linkish { color: var(--watch); white-space: nowrap; }
/* ---------- проверка подключения ---------- */
.ck-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; }
.ck-head .muted { font-size: 13px; }
.ck-h { margin: 22px 0 8px; font-size: 17px; }
.ck-sum { margin: 0 0 6px; padding: 10px 14px; border-radius: var(--r-sm); font-size: 14px; line-height: 1.5; max-width: 110ch; }
.ck-sum.ok { background: var(--st-green-wash); }
.ck-sum.warn { background: var(--st-amber-wash); }
.ck-sum.bad { background: var(--st-red-wash); color: var(--ink); }
table.list.ck-table td { vertical-align: top; padding-top: 9px; padding-bottom: 9px; }
table.list.ck-table td.ck-st { width: 34px; padding-right: 0; }
table.list.ck-table td.ck-name { width: 32%; }
.ck-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font: 700 13px/1 var(--font-ui);
  color: #fff; background: var(--line-strong); }
.ck-wrap { overflow-x: auto; }
.ck-mark.ck-ok { background: var(--st-green); }
.ck-mark.ck-warn { background: var(--st-amber); color: #15181d; }
.ck-mark.ck-error { background: var(--st-red); }
.ck-mark.ck-run { background: var(--series); animation: pulse 1.2s ease-in-out infinite; }
.ck-mark.ck-empty, .ck-mark.ck-skip, .ck-mark.ck-off, .ck-mark.ck-wait { background: var(--surface-3); color: var(--ink-2); }
.ck-why { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.ck-fields { display: block; margin-top: 4px; color: var(--st-red); font-size: 12.5px; overflow-wrap: anywhere; }
.ck-fields.unk { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .ck-mark.ck-run { animation: none; } }
@media (max-width: 640px) {      /* на телефоне строка — значок и название, под ними результат */
  table.list.ck-table, table.list.ck-table tbody { display: block; }
  table.list.ck-table tr { display: grid; grid-template-columns: 30px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
  table.list.ck-table td { display: block; border: 0; white-space: normal; padding-top: 7px; padding-bottom: 5px; }
  table.list.ck-table td.ck-name { width: auto; }
  table.list.ck-table td:nth-child(3) { grid-column: 2; padding-top: 0; padding-bottom: 9px; }
}

/* замок «Только чтение» (READ_ONLY): переключателя нет, «Управлять» закрыто */
.mode-pill.locked { grid-template-columns: auto 1fr; grid-template-areas: "ic t" "ic s"; }
.mode-card:disabled { opacity: .55; cursor: not-allowed; }
.mode-card:disabled:hover { border-color: var(--line-strong); }
.lock-note { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 6px; padding: 10px 14px;
  background: var(--watch-wash); border: 1px solid var(--watch-line); border-radius: var(--r-sm); font-size: 13.5px; line-height: 1.5; }
.lock-note .mp-ic { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--watch); color: #fff; }
.lock-note .mp-ic svg { width: 15px; height: 15px; }
.lock-note code { font-size: 12.5px; overflow-wrap: anywhere; }
.watch-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--watch); font-size: 13px; }
.watch-inline svg { width: 15px; height: 15px; flex: none; }
.kind-card.locked { opacity: .55; cursor: not-allowed; }

/* ---------- уведомления в Telegram ---------- */
.tg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.tg-card { padding: 16px 18px; }
.tg-card h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 0 0 10px; }
.tg-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--surface); font: 600 13px/1 var(--font-data); }
.tg-grid .tg-wide { grid-column: 1 / -1; }
.tg-how ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.tg-how li + li { margin-top: 6px; }
.tg-steps { margin: 0; padding-left: 20px; line-height: 1.6; color: var(--ink-2); }
.tg-steps li + li { margin-top: 6px; }
.tg-card code, .tg-link code { font: 500 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-3);
  padding: 1px 6px; border-radius: 5px; color: var(--ink); }
.tg-chats { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tg-chats li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.tg-chats li.off { background: var(--st-red-wash); border-color: transparent; }
.tg-ava { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #2aabee; color: #fff; font-weight: 700; }
.tg-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tg-who small { color: var(--muted); font-size: 12px; }
.tg-link { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 4px 0 12px; padding: 12px 14px;
  border-radius: var(--r-sm); background: var(--watch-wash); border: 1px solid var(--watch-line); font-size: 13.5px; }
.tg-link .btn.primary { background: #2aabee; border-color: #2aabee; color: #fff; }
.tg-link .btn.primary:hover { background: #1f97d4; border-color: #1f97d4; }
.tg-link .tg-code { font-size: 14px; user-select: all; }
.tg-link .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--series); margin-right: 7px; animation: pulse 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .tg-link .dot { animation: none; } }
.tg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-card .hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.tg-master { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tg-master input, .tg-kt input { width: 16px; height: 16px; accent-color: var(--accent); }
.tg-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.tg-kinds.off { opacity: .5; }
.tg-kind { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tg-kt { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.tg-kind p { margin: 4px 0 0 24px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.tg-x { margin: 6px 0 0 24px; font-size: 13px; }
.tg-x .input.num { width: 64px; }
.tg-x select.input, .tg-quiet select.input { width: auto; padding-right: 26px; }
.tg-sample { margin: 6px 0 0 24px; font-size: 13px; }
.tg-sample summary { cursor: pointer; color: var(--link); }
.tg-quiet { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-top: 12px; font-size: 13.5px; }
.tg-quiet .muted { font-size: 12.5px; }
.tg-bubble { margin-top: 6px; padding: 9px 12px; max-width: 520px; border-radius: 4px 14px 14px 14px; background: #eef5fc; color: #15181d;
  font: 13.5px/1.45 -apple-system, "Segoe UI", Roboto, var(--font-ui); border: 1px solid #dbe8f5; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg-bubble { background: #1f2c3a; color: #e9edf1; border-color: #2b3c4f; } }
.tg-log { padding: 6px 16px; }
.tg-msg { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tg-msg:last-child { border-bottom: 0; }
.tg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 1100px) { .tg-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .tg-grid { grid-template-columns: 1fr; }
  .tg-kinds { grid-template-columns: 1fr; }
  .tg-card { padding: 14px; }
}
/* остатки FBS: что проставить сейчас */
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: var(--st-red); color: #fff; font: 600 12px/1 var(--font-data); vertical-align: 2px; }
.panel.lows { margin-bottom: 8px; }
.panel.lows table.list td { vertical-align: top; }
.panel.lows table.list .d { display: block; font-size: 11px; }
.panel.lows table.list td.bad { color: var(--st-red); }
.panel.lows table.list tr.zero td.bad { font-weight: 600; }
.panel.lows .pa-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 12.5px; }
.all-row .hint { flex-basis: 100%; color: var(--muted); font-size: 12.5px; margin-top: -4px; }
.all-row .pflag { display: inline-flex; align-items: center; gap: 6px; }
.auto-tg { font-size: 13px; color: var(--ink-2); }
.auto-panel .seg { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 860px) { .auto-panel .seg button { flex: 1 1 auto; } }

/* ---------- скидка за отгрузку: сводка, как в таблице владельца ---------- */
.panel.ship-wrap { overflow-x: auto; }
table.grid.ship-sum tbody th { min-width: 150px; }
table.grid.ship-sum tbody th .d { display: block; font-size: 11px; }
table.grid.ship-sum thead th { max-width: 110px; }
.ship-sum td.ship-missed, .ship-rows td.ship-missed { color: var(--ship-missed); }
.ship-sum td.ship-sur, .ship-rows td.ship-sur { color: var(--st-red); }
.ship-sum td.ship-share { color: var(--st-green); font-weight: 600; }
.ship-sum td.ship-net { color: var(--ship-net); }
.ship-sum tr.ship-today th, .ship-sum tr.ship-today td { font-weight: 600; }
.ship-sum tr.ship-today th { box-shadow: inset 3px 0 0 var(--accent); }
.ship-sum tr.ship-now th, .ship-sum tr.ship-now td { background: var(--st-amber-wash); }
.ship-sum tr.ship-future th, .ship-sum tr.ship-future td { color: var(--muted); font-style: italic; }
.ship-sum tr.ship-weekend th, .ship-sum tr.ship-weekend td { background: var(--surface-2); }
.ship-days-wrap { max-height: 560px; overflow: auto; }
.cab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.ship-set { margin-bottom: 14px; }
.ship-set-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 0 18px 18px; }
.ship-formula { margin-top: 8px; }
.chip-day { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 8px; background: var(--accent-wash); font-size: 13px; white-space: nowrap; }
.chip-day .linkish { text-decoration: none; color: var(--ink-2); }
.ship-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; margin: 12px 0; }
table.list.ship-rows tr.muted td { color: var(--muted); }
table.list.ship-rows td.tot { font-weight: 600; }
.ship-exact { margin-top: 26px; }
.ship-exact .loc-chart { margin: 0 0 8px; }
@media (max-width: 640px) {
  table.grid.ship-sum tbody th { min-width: 108px; }
  .ship-set .form-grid { grid-template-columns: 1fr; padding: 14px; }
  .ship-set-foot { padding: 0 14px 14px; }
}

/* ---------- команда: сотрудники, график, зарплата, банк ---------- */
.team-set, .team-add { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 16px; margin-bottom: 14px; }
.team-add .input:not(.num) { min-width: 160px; }
.team-add #po-note, .team-add #bs-what, .team-add #bs-who { flex: 1 1 200px; }
table.list.team-t td { vertical-align: middle; }
table.list.team-t .input { min-width: 0; width: 100%; }
table.list.team-t td:first-child .input { min-width: 120px; }
table.list.team-t td.hint-cell { white-space: normal; min-width: 180px; color: var(--muted); font-family: var(--font-ui); font-size: 13px; }
table.list.team-t tr.muted .input { color: var(--muted); }
table.list.team-t tr.team-me td { font-weight: 600; }
table.list.team-t td.left { text-align: left; }
.member-note { margin-bottom: 12px; color: var(--ink-2, inherit); }
table.list.sd-view tr.sd-today td { font-weight: 700; }
table.list.sd-view tr.sd-future td { color: var(--muted); }
.sd-month { min-width: 130px; text-align: center; }
.sd-replan { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.panel.sd-wrap { overflow: auto; max-height: calc(100vh - 230px); }
table.grid.sd-t tbody th { min-width: 84px; }
table.grid.sd-t thead th .d { display: block; font-size: 11px; font-weight: 400; }
table.grid.sd-t td.sd-cell { text-align: center; white-space: nowrap; min-width: 92px; }
table.grid.sd-t td.sd-cell.on { background: var(--st-green-wash); }
.sd-tick { display: inline-flex; vertical-align: middle; margin-right: 4px; cursor: pointer; }
.sd-tick input { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.sd-pct { width: 40px; padding: 3px 4px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; text-align: right; }
.sd-pct:focus { outline: 2px solid var(--focus); outline-offset: 0; }
.sd-pctsign { font-size: 12px; color: var(--muted); margin-left: 1px; }
.sd-pay { display: block; font-size: 11px; color: var(--st-green); min-height: 13px; }
table.grid.sd-t td.sd-bad { color: var(--st-red); font-weight: 600; background: var(--st-red-wash); }
table.grid.sd-t td.sd-mark { white-space: nowrap; color: var(--muted); }
table.grid.sd-t tr.sd-today th, table.grid.sd-t tr.sd-today td { font-weight: 600; }
table.grid.sd-t tr.sd-today th { box-shadow: inset 3px 0 0 var(--accent); }
table.grid.sd-t tr.sd-future th, table.grid.sd-t tr.sd-future td:not(.sd-cell) { color: var(--muted); font-style: italic; }
table.grid.sd-t tr.sd-weekend th { background: var(--surface-2); }
table.grid.sd-t tfoot th, table.grid.sd-t tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 600;
  border-top: 1px solid var(--line-strong); }
table.grid.sd-t tfoot th .d { display: block; font-size: 11px; font-weight: 400; }
.pay-mf { margin-bottom: 14px; }
table.list.pay-t td.tot { font-weight: 600; }
.pay-days { margin-top: 26px; }
@media (max-width: 640px) {
  .team-set, .team-add { padding: 12px; }
  .team-add > * { flex: 1 1 100%; }
  .team-add .period-own { display: flex; align-items: center; gap: 8px; }
  .team-add .period-own .input { flex: 1; }
  table.grid.sd-t tbody th { min-width: 64px; }
}

/* ---------- остатки FBS: прогноз и история ---------- */
.stk-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.stk-tabs a { padding: 8px 12px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.stk-tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.stk-tabs a:hover { color: var(--ink); }
.stk-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.stk-sum .pst b { font-weight: 700; }
table.list.stk-t td { vertical-align: middle; }
table.list.stk-t td.tot { font-weight: 600; }
table.list.stk-t .d { display: block; font-size: 11px; }
.stk-spark rect { fill: var(--series); }
.stk-spark rect.zero { fill: var(--st-red); }
.panel.stk-hwrap { overflow: auto; max-height: calc(100vh - 230px); }
table.grid.stk-h tbody th { min-width: 200px; max-width: 260px; white-space: normal; }
table.grid.stk-h .stk-name { display: block; font-size: 11px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid.stk-h td { padding: 7px 8px; }
table.grid.stk-h td.stk-zero { background: var(--st-red-wash); color: var(--st-red); font-weight: 600; }
@media (max-width: 640px) {
  table.grid.stk-h tbody th { min-width: 130px; }
  table.grid.stk-h .stk-name { max-width: 120px; }
}

/* ---------- заказы по товарам ---------- */
.gd-mf { margin-bottom: 14px; }
.gd-chart { margin-bottom: 14px; }
.gd-chart-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 12px 16px 6px; }
table.list.gd-t tbody tr { cursor: pointer; }
table.list.gd-t tbody tr.gd-on { background: var(--accent-wash); }
table.list.gd-t td.tot { font-weight: 600; }
table.list.gd-t .d { display: block; font-size: 11px; }
table.list.gd-t td.gd-warn { color: var(--ship-missed); }
.gd-spark rect { fill: var(--series); }
.gd-up { color: var(--up); font-weight: 600; white-space: nowrap; }
.gd-down { color: var(--down); font-weight: 600; white-space: nowrap; }
.gd-abc { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 5px; font-weight: 700; font-size: 12px; text-align: center; }
.gd-abc.gd-A { background: var(--st-green-wash); color: var(--st-green); }
.gd-abc.gd-B { background: var(--st-amber-wash); color: var(--ship-missed); }
.gd-abc.gd-C { background: var(--surface-3); color: var(--muted); }
