/* Оформление панели «Цех» (светлая) и «Графит» (тёмная). Только вид: классы и разметку задают шаблоны.
   Шрифты — локально, core/panel/static/fonts (Golos Text, Unbounded — SIL OFL 1.1, лицензии рядом); внешних запросов
   нет (CSP Caddy: style-src 'self', font-src по default-src 'self').
   Тема: <html data-theme="light | dark | auto"> — из cookie theme (шаблон base.html, /static/theme.js);
   auto — как в системе (prefers-color-scheme). Контраст текста ≥ 4.5:1 в обеих темах (tests/test_panel_design.py).
   Решение владельца 07.10: предупреждение — #835E1E (было #86601F: 4,40 на мягкой патине); текст цвета ЯМ на белом —
   --ym-ink #957025 (сам #A27A28 — только графика); логотип — плашкой, метки площадок — подложка + рамка. */

@font-face { font-family: "Golos Text"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-latin-400-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: "Golos Text"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-cyrillic-500-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Golos Text"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-latin-500-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: "Golos Text"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("fonts/golos-text-latin-600-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-weight: 500; font-style: normal; font-display: swap;
  src: url("fonts/unbounded-cyrillic-500-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-weight: 500; font-style: normal; font-display: swap;
  src: url("fonts/unbounded-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Unbounded"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("fonts/unbounded-latin-500-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-weight: 700; font-style: normal; font-display: swap;
  src: url("fonts/unbounded-cyrillic-700-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-weight: 700; font-style: normal; font-display: swap;
  src: url("fonts/unbounded-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Unbounded"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("fonts/unbounded-latin-700-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 {
  color-scheme: light;
  --ground: #F4F1EA; --surface: #FFFFFF; --surface-2: #FAF8F4; --ink: #23262B; --muted: #5E6268; --line: #E3DED4;
  --head: #23262B; --head-ink: #F2EFE8; --head-dim: #AEB1AB; --head-on: #E8C7AB; --head-on-ink: #23262B;
  --head-bad: #E39A8E; --logo: #9C5833; --logo-ink: #F2EFE8;
  --accent: #2F5F5C; --accent-soft: #D7E6E2; --accent-ink: #24504C;
  --on-accent: #FFFFFF; --on-accent-dim: #D7E6E2; --on-accent-warn: #F2E4C9; --on-accent-bad: #F3DED8;
  --bad: #A24A3C; --h-bad: #F3DED8; --warn: #835E1E; --h-warn: #F2E4C9; --info: #3D5E79; --h-info: #DCE5EE;
  --wb: #7B5A90; --wb-bg: #EFE8EF; --oz: #3F6489; --oz-bg: #E5EAF0; --ym: #A27A28; --ym-bg: #F3ECDB; --ym-ink: #957025;
  /* прежние имена (шаблоны, core/panel/svg.py) → новая палитра */
  --paper: var(--ground); --panel: var(--surface); --panel-2: var(--surface-2); --zebra: var(--surface);
  --ink-2: var(--muted); --ink-3: var(--muted); --mid: var(--warn); --ok: var(--accent-ink); --h-ok: var(--accent-soft);
  --up: var(--accent-ink); --down: var(--bad); --spark: var(--muted);
  --text: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --mono: var(--text);  /* цифры — Golos Text с tabular-nums (моноширинного шрифта в «Цехе» нет) */
  --r-card: 16px; --r-ctl: 10px;
}
/* ---------------------------------------------------------------- палитра «Графит» (тёмная) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #191B1F; --surface: #23262B; --surface-2: #1E2025; --ink: #ECE9E2; --muted: #A6A9A3; --line: #34383E;
  --head: #111316; --logo: #C07A50; --logo-ink: #111316;
  --accent: #2F5F5C; --accent-soft: #283D3F; --accent-ink: #9CCBC4;
  --on-accent: #FFFFFF; --on-accent-dim: #D7E6E2; --on-accent-warn: #F2E4C9; --on-accent-bad: #F3DED8;
  --bad: #E39A8E; --h-bad: #3A2624; --warn: #DDB56C; --h-warn: #38301F; --info: #93B5CF; --h-info: #22303B;
  --wb: #B79BC9; --wb-bg: #2B2732; --oz: #8DAFD3; --oz-bg: #222B34; --ym: #D9B66A; --ym-bg: #312D1F; --ym-ink: #D9B66A;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --ground: #191B1F; --surface: #23262B; --surface-2: #1E2025; --ink: #ECE9E2; --muted: #A6A9A3; --line: #34383E;
    --head: #111316; --logo: #C07A50; --logo-ink: #111316;
    --accent: #2F5F5C; --accent-soft: #283D3F; --accent-ink: #9CCBC4;
    --on-accent: #FFFFFF; --on-accent-dim: #D7E6E2; --on-accent-warn: #F2E4C9; --on-accent-bad: #F3DED8;
    --bad: #E39A8E; --h-bad: #3A2624; --warn: #DDB56C; --h-warn: #38301F; --info: #93B5CF; --h-info: #22303B;
    --wb: #B79BC9; --wb-bg: #2B2732; --oz: #8DAFD3; --oz-bg: #222B34; --ym: #D9B66A; --ym-bg: #312D1F; --ym-ink: #D9B66A;
  }
}

/* ---------------------------------------------------------------- основа */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.5 var(--text);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 2px; }
main { max-width: 1300px; margin: 0 auto; padding: 24px 16px 72px; }
h1 { font: 500 20px/1.25 var(--display); margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font: 500 14px/1.3 var(--display); margin: 28px 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.num, td, .v { font-family: var(--text); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* ---------------------------------------------------------------- шапка: тёмная на всю ширину, пункты — «пилюли» */
header { background: var(--head); color: var(--head-ink); padding: 10px 16px; display: flex; flex-wrap: wrap;
  gap: 8px 16px; align-items: center; }
header .brand { font: 700 14px/1 var(--display); letter-spacing: .01em; background: var(--logo); color: var(--logo-ink);
  padding: 8px 12px; border-radius: 10px; text-decoration: none; }
header nav { display: flex; flex-wrap: wrap; gap: 4px; font-size: 14px; }
header nav a, header nav .off { color: var(--head-dim); text-decoration: none; padding: 7px 13px; border-radius: 999px;
  line-height: 1.3; white-space: nowrap; }
header nav a:hover { color: var(--head-ink); background: color-mix(in srgb, var(--head-ink) 10%, transparent); }
header nav a.on { background: var(--head-on); color: var(--head-on-ink); font-weight: 500; }
header nav .off { cursor: default; border: 1px dashed color-mix(in srgb, var(--head-dim) 45%, transparent); }
header .when { margin-left: auto; color: var(--head-dim); font-size: 12px; }
header .when .late { color: var(--head-bad); font-weight: 500; }
header .logout { margin: 0; color: var(--head-dim); font-size: 12px; display: flex; gap: 8px; align-items: center; }
header .logout button, header .theme button { font: inherit; font-size: 12px; color: var(--head-ink); background: none;
  border: 1px solid color-mix(in srgb, var(--head-dim) 50%, transparent); border-radius: 999px; padding: 5px 11px;
  cursor: pointer; min-height: 0; }
header .logout button:hover, header .theme button:hover { border-color: var(--head-ink); }
header .theme { display: flex; gap: 0; }
header .theme button { border-radius: 0; margin-left: -1px; padding: 5px 9px; color: var(--head-dim); }
header .theme button:first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
header .theme button:last-child { border-radius: 0 999px 999px 0; }
header .theme button[aria-pressed="true"] { background: var(--head-on); color: var(--head-on-ink); border-color: var(--head-on);
  position: relative; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.tabs a, .tabs span { font-size: 13px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--muted); text-decoration: none; }
.tabs a:hover { color: var(--ink); border-color: var(--muted); }
.tabs a.on { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.tabs .off { border-style: dashed; }

/* ---------------------------------------------------------------- тревоги: карточки на цветном фоне, без левой полосы */
.alerts { margin: 0 0 18px; display: grid; gap: 8px; }
.alerts h2 { font: 500 14px/1.3 var(--display); color: var(--ink); margin: 0 0 2px; display: flex; flex-wrap: wrap;
  gap: 4px 10px; align-items: baseline; }
.alerts h2 .calc { margin-left: auto; font: 400 12px var(--text); color: var(--muted); }
.alerts h2 .calc.warn { color: var(--warn); }
.al { display: flex; gap: 11px; align-items: baseline; padding: 12px 16px; border-radius: var(--r-card); font-size: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.al.bad { background: var(--h-bad); border-color: transparent; }
.al.warn { background: var(--h-warn); border-color: transparent; color: var(--ink); }
.al.calm { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.al .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.al.bad .dot { background: var(--bad); } .al.warn .dot { background: var(--warn); } .al.calm .dot { background: var(--accent-ink); }
.al b { font-weight: 600; }
.al .num { font-weight: 600; }
.al .why { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }
.al .names { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.al .go { color: var(--ink); font-size: 12px; margin-left: 8px; white-space: nowrap; }

/* ---------------------------------------------------------------- карточки с числами */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; margin: 0 0 18px; }
.cards .c { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; }
.cards .l { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cards .v { font: 500 18px/1.2 var(--display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.cards .s { font-size: 12px; color: var(--muted); margin-top: 6px; }
.cards .d { font-size: 12px; margin-top: 3px; }
.cards .hero { background: var(--accent-soft); border-color: transparent; } .cards .hero .v { font-size: 22px; }
.cards .v.big { font-size: 34px; line-height: 1; }

/* площадки: карточка на подложке своего цвета, спарклайн — цветом площадки */
.mps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 0 0 18px; }
.mp { border-radius: var(--r-card); padding: 14px 16px; color: var(--ink); display: grid; gap: 4px; }
.mp.wb { background: var(--wb-bg); } .mp.ozon { background: var(--oz-bg); } .mp.ym { background: var(--ym-bg); }
.mp .t { font-size: 13px; font-weight: 500; display: flex; align-items: center; }
.mp .v { font: 500 22px/1.15 var(--display); letter-spacing: -.02em; }
.mp .s { font-size: 12.5px; color: var(--muted); }
.mp .v .s { font: 400 12.5px var(--text); letter-spacing: 0; }
.mp .spark { width: 168px; max-width: 100%; height: 42px; margin-top: 4px; }
.mp.wb .spark { color: var(--wb); } .mp.ozon .spark { color: var(--oz); } .mp.ym .spark { color: var(--ym); }

/* строка-сводка; блок денег — плашка цвета патины с белым текстом */
.money { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; margin: 0 0 18px; padding: 13px 16px;
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); font-size: 13.5px; }
.money .v { font: 500 15px var(--display); letter-spacing: -.01em; }
.money.patina { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.money.patina a { color: var(--on-accent); }
.money.patina .dim, .money.patina .muted { color: var(--on-accent-dim); }
.money.patina .warn { color: var(--on-accent-warn); }
.money.patina .down, .money.patina .neg, .money.patina .bad { color: var(--on-accent-bad); }
.money.patina .up { color: var(--on-accent); }

/* метка площадки: подложка + рамка цвета площадки, текст — основной (контраст) */
.mk { display: inline-block; font: 600 10px/1 var(--text); padding: 3px 5px; border-radius: 5px; color: var(--ink);
  border: 1px solid var(--line); background: var(--surface-2); margin-right: 7px; vertical-align: 1px; }
.mk.ozon { background: var(--oz-bg); border-color: var(--oz); } .mk.wb { background: var(--wb-bg); border-color: var(--wb); }
.mk.ym { background: var(--ym-bg); border-color: var(--ym); }
.mk.total { background: var(--surface-2); border-color: var(--muted); }

/* ---------------------------------------------------------------- общие блоки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px;
  margin-bottom: 12px; }
.card:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lines { white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; margin: 0;
  overflow-wrap: anywhere; }
.warn { color: var(--warn); }
.note { background: var(--h-warn); color: var(--ink); border-radius: var(--r-ctl); padding: 9px 13px; margin: 8px 0; font-size: 13px; }
.muted, .dim { color: var(--muted); }
.up { color: var(--up); } .down, .neg, .bad { color: var(--bad); }
.al.bad { color: var(--ink); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card.scroll { padding: 0; }

/* ---------------------------------------------------------------- таблицы: белый фон, тонкие линии, прокрутка вбок */
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums;
  background: var(--surface); }
th { font-weight: 500; font-size: 11.5px; color: var(--muted); text-align: right; padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
tbody:last-child > tr:last-child > td { border-bottom: none; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 150px; position: sticky; left: 0;
  background: var(--surface); z-index: 1; font-size: 13px; }
th:first-child { z-index: 3; font-size: 11.5px; }
tr.total td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--muted); }
tr.child td { color: var(--muted); font-size: 12px; background: var(--surface-2); }
tr.child td:first-child { padding-left: 28px; }
tr.child.hidden { display: none; }
td.svc, th.svc { color: var(--muted); }
td.hi-warn { background: var(--h-warn) !important; } td.hi-ok { background: var(--h-ok) !important; }
td.hi-bad { background: var(--h-bad) !important; }
tr.sect td { font-weight: 600; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); }
tr.sect.s-in td { color: var(--accent-ink); background: var(--accent-soft); }
tr.sect.s-out td, tr.sect.s-inv td { color: var(--warn); background: var(--h-warn); }
tr.sect.s-op td { color: var(--info); background: var(--h-info); }
tr.sect.s-fin td { color: var(--ink); background: var(--wb-bg); }
tr.key td { font-weight: 600; font-size: 13.5px; background: var(--surface-2) !important; border-top: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted); }
tr.pct td { color: var(--muted); font-size: 11.5px; } tr.adj td { color: var(--muted); font-style: italic; }
tr.bal td { font-weight: 500; background: var(--surface-2); }
tr.check td { color: var(--muted); } td.hi-bad b { color: var(--bad); }
tr.acc-ok td { background: var(--h-ok) !important; } tr.acc-bad td { background: var(--h-bad) !important; }
tr.noart td { background: var(--h-warn) !important; }
.card.noart { background: var(--h-warn); border-color: transparent; }
td.verdict { white-space: normal; text-align: left; min-width: 240px; }
td.amt { font-weight: 500; }
td.neg { color: var(--bad); }
td .sh { display: inline-block; min-width: 38px; margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 400; text-align: right; }
td.fc, th.fc { background: var(--h-warn) !important; }
th .lb { font-size: 10px; margin: 0 0 0 4px; }

/* ---------------------------------------------------------------- поля и кнопки */
button, input, select, textarea { font: inherit; font-size: 13px; padding: 7px 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); border-radius: var(--r-ctl); }
input, select, textarea { border-color: color-mix(in srgb, var(--muted) 60%, var(--line)); }  /* граница поля различима */
::placeholder { color: var(--muted); opacity: 1; }
input[type=checkbox], input[type=radio] { padding: 0; width: 18px; height: 18px; vertical-align: -3px; accent-color: var(--accent); }
select, textarea { padding: 7px 10px; }
button { cursor: pointer; }
button.toggle { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 5px 0 0; font-size: 10px; }
button.act { cursor: pointer; color: var(--ink); }
button.act:hover, .btn:hover { border-color: var(--muted); }
button.act.main { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 500; }
button.act:disabled { opacity: .55; cursor: default; }
.btn, .bar button { font-size: 13px; padding: 7px 13px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 999px; text-decoration: none; cursor: pointer; white-space: nowrap; display: inline-block; }
.btn[aria-pressed="true"], .bar button[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.btn.mkt.ozon[aria-pressed="true"] { background: var(--oz-bg); border-color: var(--oz); color: var(--ink); font-weight: 600; }
.btn.mkt.wb[aria-pressed="true"] { background: var(--wb-bg); border-color: var(--wb); color: var(--ink); font-weight: 600; }
.btn.mkt.ym[aria-pressed="true"] { background: var(--ym-bg); border-color: var(--ym); color: var(--ink); font-weight: 600; }
.periods { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; font-size: 13px; }
.periods form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 12px; }
.bar form.dates { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.bar .sepv { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }
.bar .more { margin-left: auto; font-size: 13px; color: var(--muted); }

.spark { color: var(--spark); vertical-align: middle; }
.waterfall { color: var(--ink); max-width: 720px; width: 100%; height: auto; display: block; }
.maint { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; }

/* ---------------------------------------------------------------- юнит-экономика */
td.m-bad, .sw.m-bad { background: var(--h-bad); color: var(--bad); }
td.m-warn, .sw.m-warn { background: var(--h-warn); color: var(--ink); }
td.m-ok, .sw.m-ok { background: var(--h-ok); color: var(--ok); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend i { font-style: normal; display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid var(--line); }
.lb { display: inline-block; font: 500 11.5px/1.3 var(--text); padding: 2px 8px; margin: 1px 4px 1px 0;
  border-radius: 999px; background: var(--h-warn); color: var(--ink); white-space: nowrap; }
.lb.bad { background: var(--h-bad); color: var(--bad); }
.lb.okl { background: var(--h-ok); color: var(--ok); }
.lb.off { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.lb .mk { font-size: 9px; padding: 2px 3px; margin-right: 4px; }
.calm { font: 400 12px var(--text); color: var(--muted); }
.al.calm { font-size: 14px; color: var(--ink); }
.ue table { min-width: 0; }
.ue td.att { white-space: normal; text-align: left; min-width: 180px; }
.ue th.att { text-align: left; }
.ue .att-in { display: none; }
.ue thead th { cursor: pointer; }
.ue th.sorted { color: var(--ink); font-weight: 600; }
.ue th.sorted::after { content: " ↓"; font-size: 9px; } .ue th.sorted.asc::after { content: " ↑"; }
.ue tr.grp { cursor: pointer; }
.ue tr.grp:hover td { background: var(--surface-2); }
.ue .tri { display: inline-block; width: 13px; color: var(--muted); font-size: 9px; }
.ue tr.det > td { background: var(--surface-2) !important; white-space: normal; padding: 12px 14px; position: static; }
.det-in { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.det-in .blk { min-width: 200px; } .det-in .blk.wide { flex: 1 1 320px; }
.det-in h3 { font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 0 4px; }
table.mini { width: auto; font-size: 12px; background: transparent; }
table.mini td, table.mini th { padding: 3px 10px 3px 0; border-bottom: 1px solid var(--line); background: transparent !important;
  position: static; min-width: 0; font-size: 12px; }
table.mini th { font-size: 11px; }
table.mini td:first-child { white-space: nowrap; }
table.mini tr.tot td { font-weight: 600; border-top: 1px solid var(--muted); }

/* ---------------------------------------------------------------- раздел «Деньги» */
.mhead { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: flex-start; margin-bottom: 14px; }
.mhead .sub { margin-bottom: 0; }
.gsync { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px;
  color: var(--muted); max-width: 640px; justify-content: flex-end; text-align: right; }
.gsync form { margin: 0; }
.gsync .bad { color: var(--bad); }
.flash { background: var(--h-ok); color: var(--ink); border-radius: var(--r-ctl); padding: 10px 14px; margin: 0 0 12px; font-size: 13.5px; }
.flash.err { background: var(--h-bad); color: var(--ink); }
.jr td { white-space: normal; vertical-align: top; }
.jr td.n, .jr th.n { white-space: nowrap; }
.jr th:first-child, .jr td:first-child { min-width: 86px; white-space: nowrap; font-size: 12px; }
.jr td.txt { text-align: left; min-width: 220px; max-width: 460px; }
.jr th.txt { text-align: left; }
.jr td.txt .p { color: var(--muted); font-size: 12px; display: block; overflow-wrap: anywhere; }
.rowf { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; margin: 0; }
.rowf input[type=text] { width: 230px; } .rowf input, .rowf button { padding: 4px 8px; font-size: 12px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.fgrid label { display: block; font-size: 12px; color: var(--muted); }
.fgrid input, .fgrid select { width: 100%; margin-top: 3px; }
details.card > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
details.card[open] > summary { margin-bottom: 10px; color: var(--ink); }
.un { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 6px 18px; }
.un .amt { font: 500 20px/1.2 var(--display); letter-spacing: -.02em; }
.un .who { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.un .p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; margin: 2px 0 6px; }
.un .rowf { justify-content: flex-start; } .un .rowf input[type=text] { width: 300px; font-size: 13px; padding: 7px 10px; }
.un .rowf button, .un .rowf input[type=month] { font-size: 13px; padding: 7px 10px; }
.ck { list-style: none; padding: 0; margin: 0; } .ck li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.ck li:last-child { border-bottom: none; }
.ck .st { font: 600 11px var(--text); padding: 3px 8px; border-radius: 999px; margin-right: 8px; }
.ck .st.ok { background: var(--h-ok); color: var(--ok); } .ck .st.no { background: var(--h-bad); color: var(--bad); }
.ck .d { color: var(--muted); font-size: 12px; margin: 3px 0 0 44px; overflow-wrap: anywhere; }
.splitrow > td { background: var(--surface-2) !important; text-align: left; position: static; white-space: normal; padding: 12px 14px; }
.splitrow .pr { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; align-items: center; }
.splitrow .pr input[name=part_article] { width: 300px; } .splitrow .pr input[name=part_amount] { width: 130px; text-align: right; }
.splitrow .pr input[name=part_note] { width: 220px; } .splitrow .pr button { padding: 4px 9px; }
.splitrow .ft { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.splitrow .rem.ok { color: var(--ok); } .splitrow .rem.no { color: var(--bad); }
.took { color: var(--muted); font-size: 11.5px; margin-top: 18px; }
.fine { font-size: 12.5px; color: var(--muted); max-width: 90ch; line-height: 1.6; margin: 10px 0 0; }

/* ---------------------------------------------------------------- вход */
body.login main { max-width: 380px; margin: 12vh auto 0; padding: 0 16px 40px; }
body.login .brand { display: inline-block; font: 700 15px/1 var(--display); background: var(--logo); color: var(--logo-ink);
  padding: 10px 14px; border-radius: 12px; margin: 0 0 14px; }
body.login form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px; }
body.login h1 { margin: 0 0 14px; font-size: 18px; }
body.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 0; }
body.login input { width: 100%; font-size: 16px; min-height: 44px; margin-top: 4px; }
body.login button { margin-top: 18px; width: 100%; font-size: 15px; font-weight: 600; min-height: 46px; border: 0;
  background: var(--accent); color: var(--on-accent); }
body.login .err { color: var(--ink); background: var(--h-bad); border-radius: var(--r-ctl); padding: 9px 12px; font-size: 14px; margin: 0 0 8px; }

/* ---------------------------------------------------------------- телефон: меню переносится, колонки — в столбик, цели нажатия ≥ 44px */
@media (max-width: 640px) {
  main { padding: 16px 10px 56px; }
  header { padding: 10px; gap: 8px 10px; }
  header nav { order: 3; width: 100%; }
  header nav a, header nav .off { padding: 12px 14px; min-height: 44px; display: inline-flex; align-items: center; }
  header .when { margin-left: 0; order: 4; width: 100%; }
  header .theme { margin-left: auto; }
  header .logout button, header .theme button { min-height: 44px; min-width: 44px; padding: 5px 12px; }
  .tabs a, .tabs span { min-height: 44px; display: inline-flex; align-items: center; padding: 6px 15px; }
  button, input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea, .btn, .bar button {
    min-height: 44px; font-size: 16px; }  /* 16px — iOS не увеличивает страницу при вводе */
  .btn, .bar button { display: inline-flex; align-items: center; }
  button.toggle { min-width: 44px; padding: 0; font-size: 12px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: inline-flex; gap: 10px; align-items: center; min-height: 44px; }
  th, td { padding: 8px 9px; }
  .cards { grid-template-columns: 1fr 1fr; } .cards .v { font-size: 16px; } .cards .hero .v { font-size: 18px; }
  .cards .v.big { font-size: 26px; }
  .mps, .fgrid, .un { grid-template-columns: 1fr; }
  .money { flex-direction: column; gap: 6px; }
  .ue td.att, .ue th.att { display: none; } .ue .att-in { display: block; margin-top: 3px; }
  .ue th:first-child, .ue td:first-child { min-width: 0; } .ue td, .ue th { padding: 8px 6px; }
  .bar .more { margin-left: 0; } .det-in .blk, .det-in .blk.wide { min-width: 0; flex: 1 1 100%; }
  table.mini td:first-child { white-space: normal; }
  .al { display: grid; grid-template-columns: 9px 1fr; column-gap: 11px; align-items: baseline; }
  .al .why { grid-column: 2; margin-left: 0; text-align: left; }
  .al .go { display: inline-block; margin: 4px 0 0 8px; padding: 6px 0; }
  .mhead { flex-direction: column; }
  .gsync { margin-left: 0; justify-content: flex-start; text-align: left; }
  .rowf { justify-content: flex-start; }
  .rowf input[type=text], .un .rowf input[type=text], .splitrow .pr input { width: 100% !important; }
  .rowf input, .rowf button { font-size: 16px; padding: 7px 10px; }
  td .rowf { flex-wrap: nowrap; } td .rowf input[type=text] { width: 190px !important; }  /* строка таблицы не растёт в высоту */
  .jr td.txt { min-width: 180px; }
  th:first-child, td:first-child { min-width: 120px; }
}
@media (max-width: 380px) { .cards { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: no-preference) { header nav a, .tabs a, .btn, button { transition: background-color .12s, border-color .12s; } }
