/* iSklad — слой оформления. Подключается после app.css и переопределяет типографику и ключевые компоненты.
   Шрифты лежат локально (static/fonts): приложение работает без интернета, кириллица и цифры — из одной гарнитуры. */
@font-face { font-family:"Onest"; font-style:normal; font-weight:100 900; font-display:swap;
  src:url("/static/fonts/onest-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:"Onest"; font-style:normal; font-weight:100 900; font-display:swap;
  src:url("/static/fonts/onest-latin-wght-normal.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:"Unbounded"; font-style:normal; font-weight:200 900; font-display:swap;
  src:url("/static/fonts/unbounded-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:"Unbounded"; font-style:normal; font-weight:200 900; font-display:swap;
  src:url("/static/fonts/unbounded-latin-wght-normal.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  /* По умолчанию — системный шрифт: на Маке это San Francisco, одна гарнитура и для кириллицы, и для латиницы, и для цифр. */
  /* По умолчанию — как в самом первом оформлении: цифры и латиница Avenir Next, кириллица — системный San Francisco. */
  /* Avenir Next на Маке (в нём есть кириллица); там, где его нет (Windows, Linux), — встроенный Onest, чтобы вид не разваливался. */
  --ui:"Avenir Next","Onest",-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;
  --display:"Unbounded","Onest",-apple-system,"Segoe UI",sans-serif;
  --bg:#eceff4; --card:#ffffff; --card-2:#f5f7fa; --line:#d9dee7; --line-2:#e8ebf1;
  --fg:#141b2d; --muted:#616c84;
  --ink:#10172a; --ink-2:#1a2440; --ink-line:#243052; --ink-fg:#9fabc8;
  --action:#2143d6; --action-h:#1a36b3; --action-soft:#e6ebfd;
  --radius:12px; --radius-s:9px;
  --shadow:0 1px 0 rgba(16,23,42,.04), 0 10px 28px -18px rgba(16,23,42,.22);
}
:root[data-theme="dark"] { --bg:#0b1020; --card:#131a2e; --card-2:#182039; --line:#26304d; --line-2:#1e2742; --fg:#e8ecf6; --muted:#8a96b4;
  --action:#6381ff; --action-h:#7d96ff; --action-soft:#1c2750; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#0b1020; --card:#131a2e; --card-2:#182039; --line:#26304d; --line-2:#1e2742;
  --fg:#e8ecf6; --muted:#8a96b4; --action:#6381ff; --action-h:#7d96ff; --action-soft:#1c2750; } }

:root[data-font="onest"] { --ui:"Onest",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; }
body { font-family:var(--ui); font-size:15px; line-height:1.5; font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1,"calt" 1; letter-spacing:-.003em; }
:root[data-font="system"] { --ui:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; }
:root:not([data-font="onest"]) body { letter-spacing:0; }
:root[data-font="system"] h1 { letter-spacing:-.02em; font-weight:700; }
/* У Avenir Next нет промежуточных начертаний: 650 превращается в жирное 700. Возвращаем насыщенность первого оформления. */
:root:not([data-font]) h1 { font-weight:600; letter-spacing:-.012em; }
:root:not([data-font]) h2, :root:not([data-font]) .tile-value, :root:not([data-font]) .ledger-list dd, :root:not([data-font]) .rank-val,
:root:not([data-font]) .tabs a.active, :root:not([data-font]) .nav-link.active, :root:not([data-font]) .btn, :root:not([data-font]) .avatar { font-weight:600; }
:root:not([data-font]) table.grid td a, :root:not([data-font]) button.mini, :root:not([data-font]) ul.rank a { font-weight:500; }
:root:not([data-font]) .badge, :root:not([data-font]) table.grid th { font-weight:500; }
button, input, select, textarea { font-family:inherit; font-feature-settings:inherit; }
h1 { font-size:28px; font-weight:700; letter-spacing:-.022em; line-height:1.15; margin-bottom:22px; }
h2 { font-size:17px; font-weight:650; letter-spacing:-.012em; }
.muted, .hint, .note { letter-spacing:0; }
.h-sub { font-size:18px; font-weight:400; letter-spacing:-.01em; }

/* ---------- боковое меню ---------- */
.sidebar { width:236px; background:var(--ink); background-image:linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0) 180px); }
.brand { font-family:var(--display); font-size:17px; font-weight:650; letter-spacing:-.01em; padding:24px 22px 4px; gap:11px; }
.brand-mark { width:12px; height:20px; border-radius:3px; box-shadow:5px 5px 0 -1px rgba(242,168,29,.32); }
.company { padding-left:45px; font-size:12.5px; }
.nav-link { font-size:14.5px; font-weight:500; padding:9px 12px; border-radius:10px; letter-spacing:0; }
.nav-link.active { font-weight:600; background:var(--ink-2); box-shadow:inset 0 0 0 1px rgba(255,255,255,.04); }
.nav-link svg { width:18px; height:18px; stroke-width:1.6; }
.avatar { background:var(--ink-line); font-weight:650; }
.content { padding:34px 40px 56px; max-width:1500px; }

/* ---------- кнопки и поля ---------- */
.btn { border-radius:10px; font-weight:600; font-size:14.5px; padding:10px 18px; letter-spacing:-.003em; box-shadow:0 1px 0 rgba(255,255,255,.16) inset, 0 8px 18px -12px var(--action); }
.btn.ghost, .page-actions .btn + .btn { box-shadow:none; background:var(--card); }
button.mini { border-radius:8px; font-weight:550; padding:6px 12px; }
input, select { border-radius:var(--radius-s); padding:9px 12px; }
label { font-size:12.5px; font-weight:500; letter-spacing:.002em; }
label.check { font-weight:400; font-size:14px; }
.filters input, .filters select { padding:8px 12px; background:var(--card); }
.filters-info { font-size:12.5px; }

/* ---------- плитки: одна полоса с волосяными разделителями, а не россыпь карточек ---------- */
.cards { gap:1px; background:var(--line-2); border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow); margin-bottom:24px; }
.tile { flex:1 1 160px; min-width:0; border:0; border-radius:0; padding:15px 20px 16px; box-shadow:none; background:var(--card); }
.tile::before { display:none; }
a.tile:hover { transform:none; background:var(--card-2); }
a.tile.wait { box-shadow:inset 3px 0 0 var(--amber); }
.tile-label { font-size:12.5px; font-weight:500; }
.tile-value { font-size:20px; font-weight:650; letter-spacing:-.018em; margin-top:1px; }
.tile-value.small { font-size:15.5px; font-weight:600; letter-spacing:-.008em; }
.tile-sub { font-size:12px; }

/* ---------- таблицы ---------- */
table.grid { border-radius:var(--radius); box-shadow:var(--shadow); font-size:14.5px; }
table.grid th { font-size:12px; font-weight:600; letter-spacing:.01em; color:var(--muted); background:var(--card); border-bottom:1px solid var(--line); padding-top:11px; padding-bottom:10px; white-space:nowrap; }
table.grid td { border-bottom-color:var(--line-2); }
table.grid tbody tr:hover { background:var(--card-2); }
table.grid td a { font-weight:550; }
table.grid tfoot td { background:var(--card); border-top:1px solid var(--line); }
.badge { font-size:11.5px; font-weight:600; padding:2px 9px 2px 8px; letter-spacing:.003em; border-radius:20px; }
.badge.posted::before, .badge.draft::before, .badge.order-waiting::before, .badge.order-partial::before, .badge.order-overdue::before {
  content:""; display:inline-block; width:6px; height:6px; border-radius:50%; background:currentColor; margin-right:6px; vertical-align:1px; }
.badge.posted { background:transparent; color:var(--ok); border:1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.badge.draft { background:var(--action-soft); }
.tabs a { font-size:14.5px; font-weight:500; padding:9px 14px 10px; }
.tabs a.active { font-weight:650; }
.panel { border-radius:var(--radius); box-shadow:var(--shadow); }
.notice { border-radius:10px; font-size:14px; }
.toast { border-radius:12px; font-weight:500; }
.crumbs { font-size:12.5px; font-weight:500; margin-bottom:8px; }

/* ---------- Главная ---------- */
.dash-head { display:flex; align-items:baseline; justify-content:space-between; gap:20px; flex-wrap:wrap; margin-bottom:20px; }
.dash-head h1 { margin:0; }
.dash-meta { display:flex; gap:14px; align-items:baseline; color:var(--muted); font-size:14px; }
.dash-meta a { color:var(--fg); font-weight:600; text-decoration:none; padding:3px 10px; border:1px solid var(--line); border-radius:20px; background:var(--card); }
.dash-meta a:hover { border-color:var(--action); color:var(--action); }
.ledger { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(300px,1fr); background:var(--card); border:1px solid var(--line); border-radius:16px;
  box-shadow:var(--shadow); overflow:hidden; margin-bottom:22px; }
.ledger-money { padding:26px 30px 28px; position:relative; }
.ledger-money::before { content:""; position:absolute; left:0; top:28px; bottom:28px; width:4px; border-radius:0 4px 4px 0; background:var(--amber); }
.ledger-title { font-size:12.5px; font-weight:600; color:var(--muted); margin-bottom:14px; }
.money-row { display:flex; gap:44px; flex-wrap:wrap; }
.money { text-decoration:none; color:inherit; display:block; }
.money:hover { text-decoration:none; } .money:hover .money-label { color:var(--action); }
.money-value { font-family:var(--display); font-size:34px; font-weight:600; letter-spacing:-.035em; line-height:1.1; font-feature-settings:"tnum" 1; white-space:nowrap; }
.money-value span { font-family:var(--ui); font-size:18px; font-weight:600; letter-spacing:-.01em; color:var(--muted); }
.money-value.neg { color:var(--err); } .money-value.neg span { color:var(--err); opacity:.75; }
.money-label { margin-top:7px; font-size:13.5px; color:var(--muted); transition:color .15s; }
.ledger-list { margin:0; border-left:1px solid var(--line-2); background:var(--card-2); display:flex; flex-direction:column; }
.ledger-list a { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:0 24px; flex:1; min-height:50px; text-decoration:none; color:inherit;
  border-bottom:1px solid var(--line-2); transition:background-color .15s; }
.ledger-list a:last-child { border-bottom:0; }
.ledger-list a:hover { background:var(--card); text-decoration:none; }
.ledger-list dt { font-size:14px; color:var(--muted); display:flex; align-items:center; gap:8px; }
.ledger-list dd { margin:0; font-size:17px; font-weight:650; letter-spacing:-.015em; white-space:nowrap; }
.dash-grid { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(300px,1fr); gap:22px; align-items:stretch; }
.dash-grid .panel { margin:0; padding:20px 24px 22px; }
.panel-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:12px; }
.panel-head h2 { margin:0; }
.panel-head a { font-size:13px; font-weight:600; }
.legend { font-size:12.5px; color:var(--muted); display:flex; align-items:center; gap:6px; }
.legend i { width:10px; height:10px; border-radius:3px; display:inline-block; margin-left:8px; }
.lg-rev, .bar-rev { background:color-mix(in srgb, var(--action) 20%, var(--card)); fill:color-mix(in srgb, var(--action) 20%, var(--card)); }
.lg-net, .bar-net { background:var(--action); fill:var(--action); }
.lg-loss, .bar-loss { background:var(--err); fill:var(--err); }
svg.chart { width:100%; height:auto; display:block; overflow:visible; }
svg.chart .axis { stroke:var(--line); } svg.chart .grid-line { stroke:var(--line-2); stroke-dasharray:3 4; }
svg.chart .tick { font:500 10.5px var(--ui); fill:var(--muted); text-anchor:end; }
svg.chart .month { font:500 11.5px var(--ui); fill:var(--muted); text-anchor:middle; }
svg.chart a:hover .bar-rev { fill:color-mix(in srgb, var(--action) 28%, var(--card)); }
svg.chart a:hover .month { fill:var(--fg); }
ul.rank { list-style:none; margin:0; padding:0; display:grid; gap:14px; }
ul.rank li { display:grid; grid-template-columns:1fr auto; gap:3px 12px; align-items:baseline; }
ul.rank a { font-weight:600; }
.rank-val { font-weight:650; letter-spacing:-.01em; }
.rank-bar { grid-column:1 / -1; height:6px; border-radius:3px; background:var(--line-2); overflow:hidden; }
.rank-bar i { display:block; height:100%; border-radius:3px; background:var(--amber); }
.rank-sub { grid-column:1 / -1; font-size:12.5px; color:var(--muted); }

/* ---------- вход ---------- */
.auth-brand { font-family:var(--display); font-size:34px; font-weight:650; letter-spacing:-.02em; }
.auth-lead { font-size:20px; font-weight:500; letter-spacing:-.012em; line-height:1.35; }
.card { border-radius:16px; }
.card h1 { font-size:22px; text-align:left; }

@media (max-width:1000px) { .ledger, .dash-grid { grid-template-columns:1fr; } .ledger-list { border-left:0; border-top:1px solid var(--line-2); } .content { padding:24px 20px 44px; } }

.bulk-row input { width:150px; }
.bulk-row .btn { padding:9px 16px; }

/* числа не переносятся, название товара не сжимается в столбик */
table.grid td.r, table.grid th.r { white-space:nowrap; }
table.grid td:first-child:has(a[href^="/products/"]) { min-width:190px; }   /* только колонка с названием товара */
table.grid.edit td:first-child, table.history td:first-child, table.pnl td:first-child { min-width:0; }
td.cover .sub { white-space:normal; max-width:230px; margin-left:auto; line-height:1.3; }
td .small { display:block; }

tr.reorder-gap td, tr.reorder-late td, table.lines tr.below-cost td { background:color-mix(in srgb, var(--err-soft) 50%, var(--card)); }
tr.reorder-gap td:first-child, tr.reorder-late td:first-child { box-shadow:inset 3px 0 0 var(--err); }

/* ---------- пользователи и права ---------- */
.who a.who-name { color:#fff; text-decoration:none; } .who a.who-name:hover { text-decoration:underline; }
.perm-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:14px; }
.perm-grid label { margin:0; }
.perm-checks { display:grid; grid-template-columns:repeat(auto-fill, minmax(320px, 1fr)); gap:10px 24px; }
.perm-checks label.check { margin:0; }
#perm-block[hidden] { display:none; }

form.no-cost .c-cost, form.no-cost .c-margin, form.no-cost .c-profit, form.no-cost #row-profit, form.no-cost .pi-cost, form.no-cost .pi-margin { display:none; }

/* ---------- возможности (модули) ---------- */
.features { display:grid; grid-template-columns:repeat(auto-fill, minmax(380px, 1fr)); gap:12px; margin-bottom:20px; }
.feature { display:flex; gap:14px; align-items:flex-start; margin:0; padding:16px 18px; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); cursor:pointer;
  transition:border-color .15s, box-shadow .15s; color:var(--fg); font-size:14px; font-weight:400; }
.feature:hover { border-color:var(--muted); }
.feature.on { border-color:color-mix(in srgb, var(--action) 45%, var(--line)); box-shadow:inset 3px 0 0 var(--action); }
.feature input { margin-top:3px; flex:none; }
.feature-body { display:grid; gap:4px; }
.feature-body b { font-size:15px; font-weight:600; }
.feature-body .muted { font-size:13px; line-height:1.45; }
.feature-lock { font-size:12.5px; color:#8a5a00; }
:root[data-theme="dark"] .feature-lock { color:var(--amber); }
/* поля выключенных возможностей: элементы остаются в разметке (на них опираются скрипты форм), но не видны */
.no-mc .mc-only, .no-mw .mw-only, .no-lc .lc-only, .no-so .so-only, .no-cs .cs-only, .no-fn .fn-only { display:none !important; }

/* ---------- выгрузка и печать ---------- */
a.xls { font-size:12.5px; font-weight:600; padding:5px 12px 5px 10px; border:1px solid var(--line); border-radius:8px; background:var(--card); color:var(--ok); text-decoration:none; white-space:nowrap; }
a.xls::before { content:"↓ "; }
a.xls:hover { border-color:var(--ok); text-decoration:none; }
.tabs { align-items:center; } .tabs-right { margin-left:auto; padding-bottom:6px; }
.page-actions a:not(.btn) { font-size:14px; font-weight:600; margin-left:14px; }
textarea { width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:var(--radius-s); background:var(--card); color:var(--fg); font:inherit; resize:vertical; }

.narrow-wide { max-width:900px; }
ol.steps { margin:0 0 18px; padding-left:20px; display:grid; gap:8px; }
ol.steps .xls { margin-left:6px; }
input[type=file] { padding:7px 10px; background:var(--card); }
.btn[disabled] { opacity:.45; cursor:not-allowed; box-shadow:none; }

/* магазины на Главной (карточки точек описаны в pos.css — дублируем основу, чтобы Главная не зависела от него) */
.shops { margin-bottom:22px; }
.store-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:12px; margin-bottom:22px; }
.store-card { display:grid; gap:6px; padding:18px 20px; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); text-decoration:none; color:var(--fg);
  box-shadow:inset 3px 0 0 var(--amber); transition:border-color .15s, transform .15s; }
.store-card:hover { border-color:var(--action); text-decoration:none; transform:translateY(-1px); }
.store-card b { font-size:15px; font-weight:600; }
.shop-revenue { font-family:var(--display); font-size:26px; font-weight:600; letter-spacing:-.03em; line-height:1.1; }
.shop-revenue small { font-family:var(--ui); font-size:15px; color:var(--muted); font-weight:600; }
tr.click { cursor:pointer; }

.return-total { align-self:center; font-size:15px; color:var(--muted); } .return-total b { font-size:20px; color:var(--fg); margin-left:6px; }

.quick-edit { display:grid; gap:8px; margin-top:6px; } .quick-chips { display:flex; gap:6px; flex-wrap:wrap; }
.quick-chips .chip { display:inline-flex; align-items:center; gap:6px; padding:4px 6px 4px 12px; font-size:13px; background:var(--card-2); }
.quick-chips .chip button { border:0; background:transparent; color:var(--muted); cursor:pointer; font-size:16px; line-height:1; padding:0 4px; }

.hours { display:flex; gap:6px; align-items:flex-end; padding:18px 18px 12px; }
.hour { flex:1; display:grid; justify-items:center; gap:3px; font-size:12px; color:var(--muted); }
.hour-bar { width:100%; height:120px; display:flex; align-items:flex-end; background:var(--card-2); border-radius:6px; overflow:hidden; }
.hour-bar i { display:block; width:100%; background:var(--action); border-radius:6px 6px 0 0; min-height:0; }
.hour b { color:var(--fg); font-weight:600; } .hour small { min-height:14px; }

label[hidden] { display:none !important; }
table.lines td.c-stock .sub { font-size:11.5px; color:var(--muted); white-space:nowrap; }
.pick-item small { color:var(--muted); font-size:12px; }

/* ---------- аналитика ---------- */
table.matrix { max-width:860px; } table.matrix td { padding:14px; }
.m-AX, .m-AY { background:color-mix(in srgb, var(--ok) 12%, var(--card)); } .m-CZ, .m-C { background:color-mix(in srgb, var(--err) 8%, var(--card)); }
.badge.abc-A { background:var(--ok-soft); color:var(--ok); font-weight:700; } .badge.abc-B { background:var(--action-soft); color:var(--action); font-weight:700; } .badge.abc-C { color:var(--muted); font-weight:700; }
.badge.inv-dead { background:var(--err-soft); color:var(--err); border-color:var(--err-line); font-weight:600; }
.badge.inv-excess { background:color-mix(in srgb, var(--amber) 22%, var(--card)); color:#8a5a00; font-weight:600; } :root[data-theme="dark"] .badge.inv-excess { color:var(--amber); }
.badge.inv-new { background:var(--action-soft); color:var(--action); } .badge.inv-ok { color:var(--muted); }
tr.inv-dead td:first-child { box-shadow:inset 3px 0 0 var(--err); }

/* ---------- серийные номера ---------- */
.sn-modal { position:fixed; inset:0; z-index:80; display:grid; place-items:center; background:rgba(10,14,28,.55); backdrop-filter:blur(3px); }
.sn-modal[hidden] { display:none; }
.sn-dialog { width:min(520px, 94vw); max-height:86vh; display:flex; flex-direction:column; gap:10px; background:var(--card); border-radius:18px; padding:24px 26px 20px; box-shadow:0 40px 80px -30px rgba(0,0,0,.6); }
.sn-dialog h2 { margin:0; } .sn-dialog p { margin:0; font-size:13px; line-height:1.45; }
.sn-dialog #sn-input { margin:0; font-size:17px; padding:12px 14px; }
.sn-list { flex:1; min-height:120px; max-height:44vh; overflow:auto; border:1px solid var(--line); border-radius:12px; }
.sn-row { display:flex; align-items:center; gap:10px; margin:0; padding:9px 14px; border-bottom:1px solid var(--line-2); font-size:15px; font-weight:400; color:var(--fg); cursor:pointer; }
.sn-row:last-child { border-bottom:0; } .sn-row small { color:var(--muted); } .sn-row input { width:17px; height:17px; margin:0; }
.sn-row button { margin-left:auto; border:0; background:transparent; font-size:19px; color:var(--muted); cursor:pointer; } .sn-row button:hover { color:var(--err); }
.sn-empty { padding:24px; text-align:center; }
.sn-foot { display:flex; align-items:center; gap:10px; } .sn-foot span { margin-right:auto; font-size:14px; color:var(--muted); } .sn-foot span.neg { color:var(--err); }
.sn-btn { margin-left:6px; padding:6px 10px; border-radius:8px; border:1px solid var(--line); background:var(--card-2); color:var(--fg); font:600 12.5px var(--ui); cursor:pointer; white-space:nowrap; }
.sn-btn.empty { border-color:var(--amber); background:color-mix(in srgb, var(--amber) 16%, var(--card)); }
input.sn-qty { width:56px !important; background:var(--card-2) !important; color:var(--muted); }
.sn-line { display:block; font-size:12px; color:var(--muted); margin-top:2px; word-break:break-all; }

.sn-checks { display:grid; gap:4px; justify-items:end; } .sn-checks label.check { margin:0; font-size:13.5px; }

/* ---------- все движения денег ---------- */
a.tile-link { text-decoration:none; color:inherit; transition:border-color .15s, transform .15s; }
a.tile-link:hover { border-color:var(--action); transform:translateY(-1px); text-decoration:none; }
a.tile-link .tile-sub { color:var(--action); }
tr.feed-pay td:first-child { box-shadow:inset 3px 0 0 var(--action); }
tr.feed-shift td:first-child { box-shadow:inset 3px 0 0 var(--amber); }
table.grid td .sub { font-size:12px; color:var(--muted); font-weight:400; }

/* ---------- ширина экрана: ноутбук, планшет, телефон ---------- */
.table-scroll { max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; border-radius:var(--radius); }
.table-scroll > table.grid { margin:0; }
.table-scroll + .muted.note, .table-scroll + p { margin-top:12px; }
.page-head { flex-wrap:wrap; row-gap:12px; }
.page-actions { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.filters { flex-wrap:wrap; }
@media (max-width:1280px) {
  .content { padding:28px 26px 48px; }
  .sidebar { width:210px; }
}
@media (max-width:820px) {
  .sidebar { position:sticky; top:0; z-index:30; width:100%; }
  .sidebar .brand-sub, .side-foot .who-name, .marker { display:none; }
  .sidebar nav { flex-wrap:nowrap !important; overflow-x:auto; gap:2px; padding:4px 10px 8px; scrollbar-width:none; }
  .sidebar nav::-webkit-scrollbar { display:none; }
  .sidebar nav a { white-space:nowrap; padding:8px 12px; }
  .side-foot { display:flex; align-items:center; justify-content:space-between; padding:6px 14px; }
  .content { padding:18px 14px 40px; }
  h1 { font-size:24px; }
  .cards { grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); }
  .page-actions .btn { padding:9px 14px; font-size:14px; }
  .row { flex-wrap:wrap; } .row > label { flex:1 1 100%; min-width:0; }
  .filters > * { flex:1 1 140px; }
}
/* тёмная тема: белый текст на синей кнопке читался плохо (контраст 3,4) */
:root[data-theme="dark"] { --action:#3d5cf0; --action-h:#4f6cf5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --action:#3d5cf0; --action-h:#4f6cf5; } }
:root[data-theme="dark"] a:not(.btn):not(.nav-link), :root[data-theme="dark"] .link-like { color:#8ea6ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a:not(.btn):not(.nav-link) { color:#8ea6ff; } }
/* зелёные суммы и «Excel» — чуть темнее, чтобы читались на белом */
:root:not([data-theme="dark"]) .pos, :root:not([data-theme="dark"]) a.xls { color:#137a4b; }

/* черновик и первые шаги */
.draft-bar { gap:10px; } .draft-bar span { margin-right:auto; }
.onboard { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px 22px 16px; margin-bottom:22px; box-shadow:inset 3px 0 0 var(--action); }
.onboard-head { display:flex; align-items:center; justify-content:space-between; } .onboard-head h2 { margin:0; font-size:17px; }
.link-btn { border:0; background:none; color:var(--muted); font:500 13px var(--ui); cursor:pointer; } .link-btn:hover { color:var(--fg); }
.onboard-bar { height:6px; border-radius:6px; background:var(--card-2); margin:12px 0 10px; overflow:hidden; } .onboard-bar i { display:block; height:100%; background:var(--action); border-radius:6px; }
.onboard ol { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:6px 24px; }
.onboard li { display:flex; gap:10px; align-items:center; font-size:14px; padding:4px 0; }
.onboard li span { width:22px; height:22px; flex:none; border-radius:50%; display:grid; place-items:center; font-size:12px; font-weight:700; background:var(--card-2); color:var(--muted); }
.onboard li.done { color:var(--muted); } .onboard li.done span { background:var(--ok-soft); color:var(--ok); }

/* телефон: в меню только значки, у открытого раздела — значок и название */
@media (max-width:820px) {
  .sidebar nav { flex-wrap:wrap !important; justify-content:flex-start; overflow-x:visible; padding:4px 8px 8px; gap:2px; }
  .sidebar nav a.nav-link { padding:9px 9px; gap:6px; flex:0 0 auto; }
  .sidebar nav a.nav-link span:not(.marker) { display:none; }
  .sidebar nav a.nav-link.active span:not(.marker) { display:inline; }
  .sidebar nav a.nav-link svg { width:21px; height:21px; }
}
@media (max-width:420px) { .sidebar nav a.nav-link { padding:8px 7px; } .sidebar .brand { padding-top:10px; padding-bottom:6px; } }

/* ---------- фото ---------- */
.photo-strip { display:flex; flex-wrap:wrap; gap:12px; margin:8px 0 18px; }
.photo { position:relative; margin:0; width:132px; }
.photo img { width:132px; height:132px; object-fit:cover; border-radius:12px; border:1px solid var(--line); display:block; background:var(--card-2); }
.photo.main img { box-shadow:0 0 0 3px var(--amber); }
.photo figcaption { font-size:12px; color:var(--muted); margin-top:4px; }
.photo-actions { position:absolute; top:6px; right:6px; display:flex; gap:4px; opacity:.0; transition:opacity .15s; }
.photo:hover .photo-actions, .photo:focus-within .photo-actions { opacity:1; }
@media (hover:none) { .photo-actions { opacity:1; } }
.photo-actions .mini { padding:3px 8px; background:rgba(255,255,255,.92); }
.photo-add label { width:132px; height:132px; border:1.5px dashed var(--line); border-radius:12px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; cursor:pointer; color:var(--muted); margin:0; font-weight:500; }
.photo-add label:hover { border-color:var(--action); color:var(--action); }
.photo-add input { display:none; } .photo-add span { font-size:28px; line-height:1; }
.photo-strip.small .photo, .photo-strip.small .photo img, .photo-strip.small .photo-add label { width:92px; height:92px; }
.photo-strip.small .photo { height:auto; }
.photo-lines { display:grid; gap:14px; }
.photo-line { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:14px 16px 2px; }
.photo-line-name { font-weight:600; margin-bottom:4px; }
.badge.neg-badge { color:var(--err); border-color:var(--err-line); background:var(--err-soft); }
td.with-thumb { display:flex; align-items:center; gap:10px; }
img.thumb, span.thumb { width:36px; height:36px; border-radius:8px; object-fit:cover; flex:none; border:1px solid var(--line); background:var(--card-2); }

/* ---------- тёмные темы ----------
   «Тёмная» — чёрная, как тёмный режим iPhone и приложение iSklad: чёрный фон, графитовые карточки, системный синий.
   «Синяя» — прежняя тёмно-синяя: data-theme="dark" + data-tone="navy" (правила для тёмной темы действуют и в ней). */
:root[data-theme="dark"] {
  --bg:#000000; --card:#1c1c1e; --card-2:#2c2c2e; --line:#38383a; --line-2:#2c2c2e;
  --fg:#ffffff; --muted:#8e8e93;
  --ink:#1c1c1e; --ink-2:#2c2c2e; --ink-line:#38383a; --ink-fg:#98989f;
  --action:#0a84ff; --action-h:#409cff; --action-soft:#0b2a4a;
  --ok:#30d158; --ok-soft:#0e2e19; --err:#ff453a; --err-soft:#3b1513; --err-line:#5e2320;
  --shadow:0 1px 2px rgba(0,0,0,.5), 0 10px 28px -14px rgba(0,0,0,.85);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg:#000000; --card:#1c1c1e; --card-2:#2c2c2e; --line:#38383a; --line-2:#2c2c2e;
  --fg:#ffffff; --muted:#8e8e93;
  --ink:#1c1c1e; --ink-2:#2c2c2e; --ink-line:#38383a; --ink-fg:#98989f;
  --action:#0a84ff; --action-h:#409cff; --action-soft:#0b2a4a;
  --ok:#30d158; --ok-soft:#0e2e19; --err:#ff453a; --err-soft:#3b1513; --err-line:#5e2320;
  --shadow:0 1px 2px rgba(0,0,0,.5), 0 10px 28px -14px rgba(0,0,0,.85);
} }
:root[data-theme="dark"] a:not(.btn):not(.nav-link), :root[data-theme="dark"] .link-like { color:#409cff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a:not(.btn):not(.nav-link) { color:#409cff; } }
:root[data-theme="dark"] .seg button.on { background:#636366; color:#fff; box-shadow:0 1px 3px rgba(0,0,0,.4); }

:root[data-theme="dark"][data-tone="navy"] {
  --bg:#0b1020; --card:#131a2e; --card-2:#182039; --line:#26304d; --line-2:#1e2742;
  --fg:#e8ecf6; --muted:#8a96b4;
  --ink:#10172a; --ink-2:#1a2440; --ink-line:#243052; --ink-fg:#9fabc8;
  --action:#3d5cf0; --action-h:#4f6cf5; --action-soft:#1c2750;
  --ok:#46c08c; --ok-soft:#13302a; --err:#ff7a6e; --err-soft:#3a1b1d; --err-line:#5a2a2c;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.7);
}
:root[data-theme="dark"][data-tone="navy"] a:not(.btn):not(.nav-link), :root[data-theme="dark"][data-tone="navy"] .link-like { color:#8ea6ff; }
:root[data-theme="dark"][data-tone="navy"] .seg button.on { background:var(--card); color:var(--fg); box-shadow:0 1px 3px rgba(0,0,0,.18); }
/* касса: кнопка «QR» в чёрной теме — графитовая, без синевы */
:root[data-theme="dark"]:not([data-tone="navy"]) .pay.qr { background:#2c2c2e; }

/* ---------- карточка товара: вид кнопками и состав комплекта (телефон и компьютер) ---------- */
.kind-field { margin:2px 0 16px; }
.kind-lbl { display:block; margin-bottom:6px; font-size:12.5px; font-weight:500; color:var(--muted); }
.kind-seg { display:flex; gap:8px; }
.ref-form label.kind-opt { position:relative; flex:1 1 0; min-width:0; max-width:240px; margin:0; cursor:pointer; color:var(--fg); }
.kind-opt input { position:absolute; opacity:0; pointer-events:none; }
.kind-opt span { display:flex; flex-direction:column; gap:2px; height:100%; padding:10px 14px; border:1.5px solid var(--line); border-radius:12px; background:var(--card);
  transition:border-color .15s, background .15s; }
.kind-opt b { font:600 15px var(--ui); color:var(--fg); }
.kind-opt small { font-size:12px; line-height:1.3; color:var(--muted); }
.kind-opt input:checked + span { border-color:var(--action); background:var(--action-soft); }
.kind-opt input:focus-visible + span { box-shadow:0 0 0 3px var(--action-soft); }

.panel.kit-panel { padding:14px 16px; margin-bottom:0; }
.kit-pick { position:relative; }
.kit-search { display:flex; align-items:center; gap:8px; height:50px; padding:0 6px 0 14px; border:1.5px solid var(--line); border-radius:12px; background:var(--card); }
.kit-search:focus-within { border-color:var(--action); box-shadow:0 0 0 4px var(--action-soft); }
.kit-search > svg { width:18px; height:18px; flex:none; fill:none; stroke:var(--muted); stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.kit-panel .kit-search input { flex:1; min-width:0; height:44px; margin:0; padding:0; border:0; border-radius:0; background:transparent; box-shadow:none; font-size:16px; color:var(--fg); outline:none; }
.kit-results { position:absolute; left:0; right:0; top:calc(100% + 4px); z-index:30; max-height:320px; overflow:auto; background:var(--card);
  border:1px solid var(--line); border-radius:12px; box-shadow:0 16px 40px -12px rgba(20,29,51,.4); }
.kit-res { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 14px; cursor:pointer; border-bottom:1px solid var(--line-2); }
.kit-res:last-child { border-bottom:0; }
.kit-res.act, .kit-res:hover { background:var(--action-soft); }
.kit-res-nm { min-width:0; font-weight:500; color:var(--fg); overflow:hidden; text-overflow:ellipsis; }
.kit-res-nm small { display:block; font-size:12px; font-weight:400; color:var(--muted); }
.kit-res-st { flex:none; font-size:13px; color:var(--muted); white-space:nowrap; }
.kit-res-empty { padding:12px 14px; font-size:13.5px; line-height:1.45; color:var(--muted); }
.kit-rows { margin-top:8px; }
.kit-empty { padding:14px 2px 4px; font-size:14px; line-height:1.45; color:var(--muted); }
.kit-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto auto; align-items:center; gap:12px; padding:11px 2px; border-top:1px solid var(--line-2); border-radius:8px; }
.kit-row:first-child { border-top:0; }
.kit-row.kit-flash { animation:kitFlash 1.1s ease 1; }
@keyframes kitFlash { from { background:var(--action-soft); } to { background:transparent; } }
.kit-nm { font-size:15px; font-weight:600; line-height:1.3; color:var(--fg); }
.kit-sub { display:flex; flex-wrap:wrap; gap:0 10px; margin-top:2px; font-size:12.5px; color:var(--muted); }
.kit-sub .neg { color:var(--err); }
.kit-qty { display:flex; align-items:center; height:40px; border:1px solid var(--line); border-radius:10px; background:var(--card-2); }
.kit-qty button { width:36px; height:38px; padding:0; border:0; background:transparent; color:var(--action); font:600 20px/1 var(--ui); cursor:pointer; }
.kit-panel .kit-qty input { width:56px; height:38px; margin:0; padding:0 4px; border:0; border-radius:0; background:transparent; box-shadow:none;
  text-align:center; font:600 16px var(--ui); color:var(--fg); }
.kit-sum { min-width:86px; text-align:right; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; color:var(--fg); }
.kit-del { width:36px; height:36px; padding:0; border:1px solid var(--line); border-radius:10px; background:var(--card); color:var(--muted); font-size:19px; line-height:1; cursor:pointer; }
.kit-del:hover { color:var(--err); border-color:var(--err); }
.kit-foot { display:flex; flex-wrap:wrap; gap:6px 22px; margin-top:6px; padding:12px 2px 2px; border-top:1px solid var(--line); font-size:13.5px; color:var(--muted); }
.kit-foot[hidden] { display:none; }
.kit-foot b { margin-left:4px; font-weight:650; color:var(--fg); }
.ref-form .hint.kit-hint { margin:8px 2px 22px; }
@media (max-width: 820px) {
  .kit-row { grid-template-columns:auto minmax(0,1fr) auto; grid-template-areas:"mid mid mid" "qty sum del"; gap:8px 10px; }
  .kit-mid { grid-area:mid; } .kit-qty { grid-area:qty; } .kit-sum { grid-area:sum; } .kit-del { grid-area:del; }
  .kind-opt span { padding:9px 10px; }
  .kind-opt b { font-size:14.5px; }
  .kind-opt small { font-size:11.5px; }
}

/* ---------- категории деревом: путь «А1 › 5 › З» в строках и подсказках, выбор категории с поиском ---------- */
.m-cat { margin-top:1px; font-size:12px; line-height:1.3; color:var(--link, var(--action)); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pick-item .pi-cat { display:block; margin-top:1px; color:var(--action); font-size:12px; font-weight:400; }
.kit-res-nm small { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cat-find { display:flex; align-items:center; gap:8px; height:42px; margin:0 0 8px; padding:0 12px; border:1px solid var(--line); border-radius:11px; background:var(--card-2); }
.cat-find svg { width:17px; height:17px; flex:none; fill:none; stroke:var(--muted); stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.cat-find input { flex:1; min-width:0; height:38px; margin:0; padding:0; border:0; background:transparent; box-shadow:none; font-size:16px; color:var(--fg); outline:none; }
.cat-crumbs { display:flex; flex-wrap:wrap; align-items:center; gap:2px 6px; padding:6px 4px 8px; font-size:13.5px; color:var(--muted); }
.cat-crumbs a { color:var(--action); text-decoration:none; }
.cat-crumbs b { color:var(--fg); font-weight:600; }
.cat-crumbs i { font-style:normal; color:var(--muted); }
.cat-none { padding:14px 6px; font-size:14px; color:var(--muted); }
.dk-menu.dk-cat-menu { width:340px; }
.dk-menu.dk-cat-menu .cat-find { margin:4px 4px 6px; }

/* ---------- страница «Категории товаров»: дерево ---------- */
.cat-page { max-width:860px; }
.cat-dhead h1 { margin:0 0 4px; }
.cat-dhead .dk-sub { margin:0 0 16px; }
.panel.cat-add { display:flex; flex-wrap:wrap; gap:12px 14px; align-items:flex-end; padding:16px; margin-bottom:14px; }
.cat-add label { margin:0; }
.cat-add .cat-add-name { flex:2 1 260px; }
.cat-add .cat-add-parent { flex:1 1 220px; }
.cat-add .hint { flex-basis:100%; margin:0; }
.cat-tree-find { margin:0 0 12px; background:var(--card); }
.panel.cat-tree { padding:6px; margin-bottom:22px; }
.cat-row { display:flex; align-items:center; gap:4px; padding:2px 4px 2px calc(4px + var(--d, 0) * 22px); border-radius:11px; text-decoration:none; color:inherit; }
.cat-row + .cat-row { border-top:1px solid var(--line-2); }
.cat-row[hidden] { display:none; }
.cat-row.cat-hl { background:var(--action-soft); }
.cat-tog, .cat-tog-sp { flex:none; width:32px; height:32px; }
.cat-tog { display:grid; place-items:center; padding:0; border:0; border-radius:8px; background:none; color:var(--muted); cursor:pointer; }
.cat-tog:hover { background:var(--card-2); }
.cat-tog svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; transition:transform .15s; }
.cat-row.open > .cat-tog svg { transform:rotate(90deg); }
.cat-main { display:flex; align-items:center; gap:10px; flex:1; min-width:0; padding:9px 4px; color:var(--fg); text-decoration:none; }
.cat-ic { flex:none; display:grid; place-items:center; width:34px; height:34px; border-radius:10px; background:var(--action-soft); color:var(--action); }
.cat-ic svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.cat-tx { min-width:0; display:flex; flex-direction:column; }
.cat-tx b { font-size:15px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cat-tx small { font-size:12.5px; color:var(--muted); }
.cat-full { display:none; }
.cat-tree.searching .cat-row { padding-left:4px; }
.cat-tree.searching .cat-nm { display:none; }
.cat-tree.searching .cat-full { display:block; }
.cat-tree.searching .cat-tog { visibility:hidden; }
.cat-btn { flex:none; display:grid; place-items:center; width:36px; height:36px; padding:0; border:1px solid var(--line); border-radius:10px; background:var(--card); color:var(--action); cursor:pointer; }
.cat-btn svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.cat-btn:hover { border-color:var(--action); }
.cat-empty { margin:0; padding:16px 10px; font-size:14px; color:var(--muted); }
.cat-nocat { border-top:1px solid var(--line-2); }
.cat-nocat .cat-ic { background:var(--card-2); color:var(--muted); }
.cat-dlg-back { position:fixed; inset:0; z-index:900; display:flex; align-items:center; justify-content:center; padding:20px; background:rgba(10,14,26,.45); }
.cat-dlg-back[hidden] { display:none; }
.cat-dlg { width:min(460px, 100%); max-height:calc(100vh - 40px); overflow:auto; padding:20px; border-radius:20px; background:var(--card); box-shadow:0 24px 60px rgba(0,0,0,.3); }
.cat-dlg h3 { margin:0 0 14px; font-size:18px; }
.cat-dlg label { margin:0 0 12px; }
.cat-dlg .hint { margin:0 0 14px; }
.cat-dlg-acts { display:flex; gap:10px; }
.cat-dlg-del { margin-top:12px; padding-top:12px; border-top:1px solid var(--line-2); }
.cat-dlg-del[hidden] { display:none; }
.cat-dlg-del .btn { width:100%; }
@media (max-width: 820px) {
  .cat-page { max-width:none; }
  .cat-row { padding-left:calc(2px + var(--d, 0) * 16px); }
  .cat-tog, .cat-tog-sp { width:28px; }
  .cat-btn { width:38px; height:38px; }
  .cat-dlg-back { align-items:flex-end; padding:0; }
  .cat-dlg { width:100%; border-radius:22px 22px 0 0; padding:20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .cat-dlg-acts .btn { flex:1; }
}
/* подбор товара в накладной на телефоне: название с категорией — во всю ширину, остаток и цена — строкой ниже
   (раньше пять колонок не помещались и название сжималось в ноль) */
@media (max-width: 820px) {
  .pick-item { display:flex; flex-wrap:wrap; align-items:baseline; gap:3px 14px; padding:10px 14px; }
  .pick-item > .pi-name { flex:1 0 100%; white-space:normal; font-size:15px; }
  .pick-item > span:not(.pi-name) { text-align:left; font-size:13px; }
  .pick-item > span:empty { display:none; }
  .pick-item .pi-cat { font-size:12.5px; }
}
.prices .pr-cat { display:block; margin-top:1px; font-size:12px; color:var(--muted); }
.cat-row .cat-main, a.cat-row.cat-nocat { color:var(--fg) !important; }      /* в тёмной теме ссылки голубые — у дерева текст обычный */
