/* =====================================================================
   Ozon Multistore Monitor — «тёмное стекло»
   Верхняя навигация, стеклянные панели, колонки периодов.
   Dark is the default; [data-theme="light"] is the restrained variant.
   ===================================================================== */

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14;
  --mesh-a: rgba(76, 110, 245, .26); --mesh-b: rgba(94, 234, 212, .10);
  --surface: rgba(255, 255, 255, .04); --surface-2: rgba(255, 255, 255, .06); --surface-3: rgba(255, 255, 255, .10);
  --solid: #0e1424; --row-hover: rgba(255, 255, 255, .04);
  --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .16); --line-card: rgba(255, 255, 255, .08);
  --ink: #e6eaf2; --ink-2: #b3bccd; --ink-3: #8a94ab; --ink-4: #5c667c;
  --accent: #8ab4ff; --accent-hover: #b9d1ff; --accent-ink: #070b14;
  --accent-soft: rgba(138, 180, 255, .14); --accent-line: rgba(138, 180, 255, .32);
  --crit: #fb7185; --crit-soft: rgba(251, 113, 133, .10); --crit-line: rgba(251, 113, 133, .28);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .08); --warn-line: rgba(251, 191, 36, .24);
  --ok: #5eead4; --ok-soft: rgba(94, 234, 212, .10); --ok-line: rgba(94, 234, 212, .26);
  --up: #5eead4; --up-soft: rgba(94, 234, 212, .10); --down: #fb7185; --down-soft: rgba(251, 113, 133, .10);
  --info: #8ab4ff; --info-soft: rgba(138, 180, 255, .12); --info-line: rgba(138, 180, 255, .3);
  --s1: #8ab4ff; --s2: #fb923c; --s3: #5eead4; --s4: #fbbf24; --s5: #c4b5fd;
  --grad: linear-gradient(90deg, #6d8dff, #5eead4);
  --spark-fill: rgba(138, 180, 255, .18);
  --glass-shadow: 0 20px 50px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
  --ring: 0 0 0 3px rgba(138, 180, 255, .22); --focus: #b9d1ff;
  --tip-bg: #1a2236; --tip-ink: #f1f5f9; --scroll-thumb: #2a3448;
  --blur: 14px; --r-xl: 14px; --r-lg: 10px; --r-md: 6px; --main-x: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f7;
  --mesh-a: rgba(76, 110, 245, .16); --mesh-b: rgba(20, 184, 166, .10);
  --surface: rgba(255, 255, 255, .72); --surface-2: rgba(255, 255, 255, .9); --surface-3: rgba(15, 23, 42, .06);
  --solid: #ffffff; --row-hover: rgba(15, 23, 42, .035);
  --line: rgba(15, 23, 42, .08); --line-strong: rgba(15, 23, 42, .16); --line-card: rgba(15, 23, 42, .08);
  --ink: #0f172a; --ink-2: #3f4a5f; --ink-3: #64708a; --ink-4: #98a2b8;
  --accent: #2f5fe0; --accent-hover: #1f47b8; --accent-ink: #ffffff;
  --accent-soft: rgba(47, 95, 224, .1); --accent-line: rgba(47, 95, 224, .28);
  --crit: #d12f4d; --crit-soft: rgba(209, 47, 77, .08); --crit-line: rgba(209, 47, 77, .26);
  --warn: #a66200; --warn-soft: rgba(245, 158, 11, .12); --warn-line: rgba(245, 158, 11, .32);
  --ok: #0f8a78; --ok-soft: rgba(15, 138, 120, .1); --ok-line: rgba(15, 138, 120, .28);
  --up: #0f8a78; --up-soft: rgba(15, 138, 120, .1); --down: #d12f4d; --down-soft: rgba(209, 47, 77, .08);
  --info: #2f5fe0; --info-soft: rgba(47, 95, 224, .1); --info-line: rgba(47, 95, 224, .28);
  --s1: #3b6ef0; --s2: #f97316; --s3: #10b3a0; --s4: #f59e0b; --s5: #8b7cf6;
  --grad: linear-gradient(90deg, #3b6ef0, #10b3a0);
  --spark-fill: rgba(59, 110, 240, .14);
  --glass-shadow: 0 20px 40px -28px rgba(15, 23, 42, .35), inset 0 1px 0 rgba(255, 255, 255, .8);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .18);
  --ring: 0 0 0 3px rgba(47, 95, 224, .18); --focus: #2f5fe0;
  --tip-bg: #0f172a; --tip-ink: #f8fafc; --scroll-thumb: #c3cad8;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Onest", "Noto Sans TC", system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; min-height: 100vh; position: relative; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 520px at 18% -8%, var(--mesh-a), transparent 60%), radial-gradient(720px 520px at 96% 18%, var(--mesh-b), transparent 60%), radial-gradient(600px 400px at 60% 110%, var(--mesh-a), transparent 60%), var(--bg); }
:root[lang="zh-Hant"] body { font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Onest", sans-serif; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-md); }
a { color: var(--accent); }
a.link-sm { font-size: 12px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
a.link-sm:hover { text-decoration: underline; text-underline-offset: 3px; }
a.link-sm svg { width: 14px; height: 14px; flex: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* utilities */
.c-crit { color: var(--crit); } .c-warn { color: var(--warn); } .c-ok { color: var(--ok); } .c-up { color: var(--up); } .c-down { color: var(--down); } .c-muted { color: var(--ink-3); }
.fw5 { font-weight: 500; } .fw6 { font-weight: 600; }
.inline { display: inline; }
.i-s1 { background: var(--s1); } .i-s2 { background: var(--s2); } .i-s3 { background: var(--s3); } .i-s4 { background: var(--s4); } .i-s5 { background: var(--s5); } .i-ink3 { background: var(--ink-3); }

/* ---------- glass primitive ---------- */
.g, .card, .kpi, .pcol, .al, .flow .step { background: var(--surface); border: 1px solid var(--line-card); border-radius: var(--r-xl); box-shadow: var(--glass-shadow); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }

/* ---------- top navigation ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topnav { position: sticky; top: 0; z-index: 40; height: 60px; display: flex; align-items: center; gap: 16px; padding: 0 var(--main-x);
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; white-space: nowrap; }
.mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #6d8dff, #5eead4); box-shadow: 0 6px 16px rgba(109, 141, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .35); }
.nav { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 9px; color: var(--ink-3); text-decoration: none; font-weight: 500; white-space: nowrap; font-size: 12.5px;
  transition: background-color .15s var(--ease), color .15s var(--ease); }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.active { background: var(--surface-3); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.nav a .k { display: none; }
.nav .key-tag { font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); }
.tools { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.ibtn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); color: var(--ink-3);
  transition: background-color .15s var(--ease), color .15s var(--ease); }
.ibtn:hover { background: var(--surface-2); color: var(--ink); }
.ibtn svg { width: 16px; height: 16px; }

/* pills */
.pill { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 5px; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line-strong); }
.pill.crit { background: var(--crit-soft); color: var(--crit); border-color: var(--crit-line); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.pill.info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }

/* alert code chip */
.code { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; }
.code.crit { background: var(--crit-soft); color: var(--crit); border-color: var(--crit-line); }
.code.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.code.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.art { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--ink-2); }

/* tooltip */
.tip { position: fixed; z-index: 60; pointer-events: none; padding: 6px 10px; border-radius: var(--r-md); background: var(--tip-bg); color: var(--tip-ink); font-size: 12px; font-weight: 500; white-space: nowrap; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-4px); transition: opacity .12s var(--ease), transform .12s var(--ease); display: flex; align-items: center; gap: 8px; }
.tip.show { opacity: 1; transform: none; }

/* ---------- main ---------- */
.main { padding: 18px var(--main-x) 40px; display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 1680px; width: 100%; margin: 0 auto; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.pagehead h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.pagehead .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }
#view { display: flex; flex-direction: column; gap: 16px; }
.foot { color: var(--ink-4); font-size: 11.5px; padding-top: 8px; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 7px; height: 26px; padding: 0 11px; color: var(--ink-3); font-weight: 500; font-size: 12.5px; white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg button:hover { color: var(--ink); }
.segbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.segbar .hint { font-size: 12px; color: var(--ink-3); }
.seg button .cnt { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.seg button[aria-pressed="true"] .cnt { color: var(--ink-2, var(--ink)); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }

.ctl { height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 0 10px; font-size: 12.5px; color: var(--ink); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.ctl:hover { border-color: var(--line-strong); }
.ctl:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select.ctl { appearance: none; -webkit-appearance: none; padding-right: 26px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a94ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
select.ctl option { background: var(--solid); color: var(--ink); }
input[type="search"].ctl { min-width: 220px; }

/* buttons */
.btn { height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 0 12px; font-weight: 500; font-size: 12.5px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease); }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn .bi { display: inline-grid; place-items: center; width: 14px; height: 14px; } .btn .bi svg { width: 14px; height: 14px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.cta { background: var(--surface-3); color: var(--ink); border-color: var(--line-strong); font-weight: 600; }
.btn.cta:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn.danger { color: var(--crit); }
.btn.danger:hover { background: var(--crit-soft); border-color: var(--crit-line); }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }

/* ---------- cards ---------- */
.card { min-width: 0; overflow: hidden; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-h h2 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.card-h .hint { color: var(--ink-3); font-size: 12px; flex: 1; min-width: 0; }
.card-h .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input.hz { width: 64px; height: 28px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); padding: 0 6px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-size: 12.5px; } input.hz.on { border-color: var(--accent); color: var(--ink); font-weight: 600; } input.hz:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); } input.hz::placeholder { color: var(--ink-3); }
.hin { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); } .hin input { width: 72px; text-align: right; font-variant-numeric: tabular-nums; } .hin.on { color: var(--ink); } .hin.on input { border-color: var(--accent); }
.card-b { padding: 16px; }
.card-b + .card-b, .card-b.bt { border-top: 1px solid var(--line); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: clamp(18px, 1.2vw, 26px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.kpi .meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-height: 18px; }
.kpi.crit .value { color: var(--crit); } .kpi.warn .value { color: var(--warn); } .kpi.ok .value { color: var(--ok); }
.kpi.crit { border-color: var(--crit-line); }
.kpi.wide { grid-column: span 2; }
.kpi .area { width: 100%; height: 64px; display: block; margin-top: 4px; }
.kpi .area .fill { fill: url(#kpiGrad); } .kpi .area .line { fill: none; stroke: var(--s1); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

/* ---------- period columns (B) ---------- */
.pcols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pcol { overflow: hidden; display: flex; flex-direction: column; }
.pcol .ph { padding: 11px 16px; font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.pcol .ph span { color: var(--ink-3); font-weight: 500; font-size: 12px; }
.pcol.p1 .ph { background: rgba(109, 141, 255, .18); } .pcol.p2 .ph { background: rgba(94, 234, 212, .14); } .pcol.p3 .ph { background: rgba(196, 181, 253, .16); } .pcol.p4 .ph { background: rgba(251, 146, 60, .14); }
.pcol .pr { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); }
.pcol .pr .k { color: var(--ink-3); font-size: 12.5px; }
.pcol .pr .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pcol .pr .s { color: var(--ink-3); font-weight: 500; font-size: 11.5px; margin-left: 5px; }
.pcol .pr.big .v { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.pcol .pr.big { padding-top: 12px; padding-bottom: 10px; }
/* строки «ключ — значение» вне колонок периодов (страница «Деньги в товаре») */
.pcol-flat { padding: 4px 0; }
.pcol-flat .pr { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--line); }
.pcol-flat .pr:first-child { border-top: 0; }
.pcol-flat .pr .k { color: var(--ink-3); font-size: 12.5px; }
.pcol-flat .pr .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pcol-flat .pr .s { color: var(--ink-3); font-weight: 500; font-size: 11.5px; margin-left: 5px; }
.card-b .h3 { margin: 0; font-size: 13px; font-weight: 600; }

/* deltas, tags, chips */
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; height: 18px; border-radius: 5px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; border: 1px solid transparent; }
.delta.up { background: var(--up-soft); color: var(--up); border-color: var(--ok-line); } .delta.down { background: var(--down-soft); color: var(--down); border-color: var(--crit-line); } .delta.flat { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; height: 22px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tag.crit { background: var(--crit-soft); color: var(--crit); border-color: var(--crit-line); } .tag.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); } .tag.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); } .tag.info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.chip.fbo { color: var(--s1); border-color: var(--info-line); background: var(--info-soft); } .chip.fbs { color: var(--s2); border-color: var(--warn-line); background: var(--warn-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.crit { background: var(--crit); } .dot.warn { background: var(--warn); } .dot.ok { background: var(--ok); }

/* ---------- tables ---------- */
.tw { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; vertical-align: middle; white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; z-index: 10; user-select: none; }
th.sortable { cursor: pointer; transition: color .15s var(--ease); }
th.sortable:hover { color: var(--ink); }
th.sortable::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 5px; vertical-align: middle; border: 4px solid transparent; border-top-color: var(--line-strong); }
th.sorted-asc::after { border-top-color: transparent; border-bottom-color: var(--accent); margin-bottom: 4px; }
th.sorted-desc::after { border-top-color: var(--accent); }
th:first-child, td:first-child { padding-left: 16px; } th:last-child, td:last-child { padding-right: 16px; }
td { border-bottom: 1px solid var(--line); font-size: 13px; transition: background-color .15s var(--ease); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; background: var(--surface-2); font-weight: 600; color: var(--ink-2); }
tbody tr:hover td { background: var(--row-hover); }
td.num, th.num { font-size: 12.5px; }
td.day, th.day { padding-left: 6px; padding-right: 6px; min-width: 44px; } th.day { letter-spacing: 0; text-transform: none; }
td.r, th.r { text-align: right; }
td.wrap { white-space: normal; min-width: 220px; }
td.pad0 { padding: 0; }
tr.oz-items > td, tbody tr.oz-items:hover > td { background: var(--surface-2); }
tr.oz-items table.inner th { font-size: 11px; }
tr.oz-items table.inner td { font-size: 12.5px; }
td .sub { color: var(--ink-3); font-size: 12px; display: block; margin-top: 1px; }
td b { font-weight: 600; }
a.store-link { cursor: pointer; color: inherit; text-decoration: none; font-weight: 600; border-bottom: 1px dotted transparent; transition: border-color .15s var(--ease), color .15s var(--ease); }
a.store-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.rowlink { cursor: pointer; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

/* bars, stacks, legend, sparkline */
.bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--grad); vertical-align: middle; }
.barw { display: inline-flex; align-items: center; gap: 10px; }
.barw .bar-track { width: 110px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; flex: none; }
.bar-track .bar { display: block; height: 100%; border-radius: 3px; }
.bar.s2 { background: var(--s2); } .bar.s3 { background: var(--s3); } .bar.s4 { background: var(--s4); } .bar.crit { background: var(--crit); } .bar.warn { background: var(--warn); } .bar.ok { background: var(--ok); }
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; }
.stack.w180 { width: 180px; } .stack.tall { height: 14px; border-radius: 6px; }
.stack span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.legend.pad { padding: 12px 16px 0; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.spark { width: 120px; height: 30px; display: block; }
.spark path.area { fill: var(--spark-fill); } .spark path.line { fill: none; stroke: var(--s1); stroke-width: 1.75; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark circle { fill: var(--s1); stroke: var(--solid); stroke-width: 2; }
.spark.down path.line { stroke: var(--down); } .spark.down circle { fill: var(--down); } .spark.down path.area { fill: var(--down-soft); }

/* layout grids */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ov { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
/* разбивка выручки (прибыль): цветная метка, сумма, доля */
.brk { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 16px; margin-top: 14px; }
.brk .it { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brk .l { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; }
.brk .l i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; flex: none; }
.brk .v { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.brk .p { font-size: 12px; color: var(--ink-3); }
/* дельта + тег порога в одной ячейке */
.dl { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* flow (other pages) */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.flow .step { flex: 1 1 150px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; position: relative; text-decoration: none; color: inherit; cursor: pointer; transition: transform .18s var(--ease), border-color .18s var(--ease); }
.flow .step:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.flow .step .q { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.flow .step .v { font-size: 22px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.flow .step .v small { font-size: 12px; color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.flow .step .m { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.flow .arrow { align-self: center; color: var(--ink-4); display: inline-grid; place-items: center; } .flow .arrow svg { width: 16px; height: 16px; }

/* ---------- notification hub ---------- */
.tabbar { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; border: 0; background: transparent; color: var(--ink-3); font-weight: 500; font-size: 13px; white-space: nowrap; border-radius: 0; transition: color .15s var(--ease); }
.tabbar button::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); opacity: 0; transform: scaleX(.6); transition: opacity .18s var(--ease), transform .18s var(--ease); }
.tabbar button:hover { color: var(--ink); }
.tabbar button[aria-selected="true"] { color: var(--ink); }
.tabbar button[aria-selected="true"]::after { opacity: 1; transform: scaleX(1); }

.alist { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.al { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; padding: 12px 14px; border-radius: var(--r-lg); transition: transform .18s var(--ease), border-color .18s var(--ease); }
.al.crit { background: var(--crit-soft); border-color: var(--crit-line); } .al.warn { background: var(--warn-soft); border-color: var(--warn-line); } .al.ok { background: var(--ok-soft); border-color: var(--ok-line); }
.al:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.al .t { font-weight: 600; font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.al .t .n { color: var(--ink-3); font-weight: 500; }
.al .d { grid-column: 1; color: var(--ink-2); font-size: 12.5px; overflow-wrap: anywhere; }
.al .arts { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 10px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--ink-2); }
.al .arts .more { color: var(--ink-3); }
.al .w { color: var(--ink-3); font-size: 12px; text-align: right; white-space: nowrap; }
.al .act { grid-column: 1; margin-top: 2px; display: inline-flex; align-items: center; gap: 4px; align-self: start; justify-self: start; font-size: 12.5px; font-weight: 500; color: var(--accent); text-decoration: none; cursor: pointer; }
.al .act svg { width: 14px; height: 14px; transition: transform .15s var(--ease); }
.al .act:hover { text-decoration: underline; text-underline-offset: 3px; } .al .act:hover svg { transform: translateX(2px); }
.al.ok .act { color: var(--ink-3); }
.sevbar { display: flex; gap: 6px; flex-wrap: wrap; }

/* misc */
.h6 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; margin: 0 0 8px; }
.note { color: var(--ink-3); font-size: 12px; margin: 0; }
.note.mt2 { margin-top: 10px; } .note.mt1 { margin-top: 6px; }
.stat-list { display: flex; flex-direction: column; gap: 8px; }
.stat-list .row { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; }
.stat-list .row span:first-child { color: var(--ink-2); }
.stat-list .row.total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 600; }
.sync { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.dot.live { box-shadow: 0 0 0 0 rgba(94, 234, 212, .5); animation: pulse 2.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, .45); } 70% { box-shadow: 0 0 0 6px rgba(94, 234, 212, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); } }
.banner { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); border-radius: var(--r-xl); padding: 11px 16px; font-size: 13px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; backdrop-filter: blur(var(--blur)); }
.banner.crit { background: var(--crit-soft); color: var(--crit); border-color: var(--crit-line); }
.banner.info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.banner a { color: inherit; font-weight: 600; }
.empty-state { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-xl); padding: 48px 24px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state h2 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 600; }
.empty-state p { margin: 0 0 8px; max-width: 460px; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { display: flex; flex-direction: column; gap: 16px; }
.skeleton .sk { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-3) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-xl); border: 1px solid var(--line); }
.sk.sk-kpi { height: 110px; } .sk.sk-lg { height: 320px; } .sk.sk-md { height: 220px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 50; background: var(--tip-bg); color: var(--tip-ink); padding: 10px 14px; border-radius: var(--r-lg); font-size: 13px; box-shadow: var(--shadow-lg); animation: toast-in .2s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- settings ---------- */
.form { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px 16px; align-items: center; }
.form label { color: var(--ink-2); font-size: 13px; }
.form input[type="text"], .form input[type="password"], .form input[type="number"] { width: 100%; height: 34px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 0 11px; font-size: 13px; color: var(--ink); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.form input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.form input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.form .full { grid-column: 1 / -1; }
.form .row-actions { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form h3 { margin: 0 0 14px; font-size: 13.5px; font-weight: 600; }
.test-res { font-size: 12.5px; } .test-res.ok { color: var(--ok); } .test-res.bad { color: var(--crit); }
input.cost, input.days, .th-grid input { height: 30px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
input.cost { width: 104px; } input.days { width: 80px; } .th-grid input { width: 90px; }
input.cost.changed, input.days.changed { border-color: var(--accent); background: var(--accent-soft); }
input.cost.set { border-color: var(--ok-line); background: var(--ok-soft); }
td.cellc .sub { display: block; font-size: 11px; margin-top: 2px; text-align: right; } td.cellc .sub.ok { color: var(--ok); }
/* история себестоимости: цепочка «базовая → дата → дата», выбранная дата подсвечена */
table.costs td.wrap { min-width: 260px; }
.hist { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.hist .hs { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 3px 8px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); line-height: 1.15; }
.hist .hs i { font-style: normal; font-size: 10.5px; color: var(--ink-3); } .hist .hs b { font-size: 12px; font-variant-numeric: tabular-nums; }
.hist .hs.cur { border-color: var(--accent-line); background: var(--accent-soft); } .hist .hs.cur i { color: var(--accent); }
.hist .ha { color: var(--ink-4); font-size: 11px; }
.dlab { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); } .dlab input[type="date"] { width: 150px; padding: 0 8px; }
/* группа артикула в себестоимости */
tr.grp td { background: var(--surface-2); border-top: 1px solid var(--line-strong); padding-top: 10px; padding-bottom: 10px; }
tr.grp .sub { display: inline; margin-left: 10px; }
tr.fillrow td { background: var(--accent-soft); border-top: 0; }
.fill { display: inline-flex; align-items: center; gap: 6px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
input.cost:focus, input.days:focus, .th-grid input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 24px; }
.th-grid label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.log-list { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--ink-2); max-height: 320px; overflow: auto; padding: 10px 16px; display: flex; flex-direction: column; gap: 4px; }
.log-list .bad { color: var(--crit); }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
details.help { font-size: 13px; color: var(--ink-2); }
details.help summary { cursor: pointer; color: var(--accent); font-weight: 500; }
details.help ol { margin: 8px 0 0; padding-left: 20px; }
.muted { color: var(--ink-3); }

/* ---------- шапка страницы: экспорт, сравнение, период, произвольные даты ---------- */
.phtools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.phtools .btns { display: inline-flex; gap: 6px; }
/* кнопка «Период…» с иконкой календаря; поповер-календарь абсолютный, шапку не раздвигает */
.phtools { position: relative; }
.seg button.pcbtn { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.seg button.pcbtn .bi { display: inline-grid; place-items: center; width: 13px; height: 13px; } .seg button.pcbtn .bi svg { width: 13px; height: 13px; }
.seg button.pcbtn[aria-expanded="true"] { color: var(--ink); }
.pcustom { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: 560px; max-width: calc(100vw - 2 * var(--main-x)); padding: 14px 16px 12px;
  background: var(--solid); border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: modal-in .16s var(--ease); }
.dp-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.dp-in { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); font-size: 12.5px; color: var(--ink-3); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.dp-in:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.dp-in input { width: 84px; border: 0; background: transparent; padding: 0; font: inherit; font-variant-numeric: tabular-nums; color: var(--ink); outline: none; }
.dp-in input.bad { color: var(--crit); }
.dp-dash { color: var(--ink-4); }
.dp-nav { margin-left: auto; display: inline-flex; gap: 6px; }
.dp-nav .ibtn { width: 30px; height: 30px; } .dp-nav .ibtn[disabled] { opacity: .4; cursor: default; }
.dp-months { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.dp-mh { font-size: 13px; font-weight: 600; letter-spacing: -.01em; text-align: center; margin-bottom: 8px; color: var(--ink); }
.dp-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.dp-w { text-align: center; font-size: 11px; color: var(--ink-4); text-transform: lowercase; padding-bottom: 4px; }
.dp-e { height: 32px; }
.dp-d { height: 32px; border: 0; background: transparent; border-radius: var(--r-md); font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); cursor: pointer; position: relative; transition: background-color .12s var(--ease), color .12s var(--ease); }
.dp-d:hover { background: var(--surface-3); color: var(--ink); }
.dp-d:focus-visible { outline: none; box-shadow: var(--ring); z-index: 1; }
.dp-d[disabled] { color: var(--ink-4); opacity: .45; cursor: default; background: transparent; }
.dp-d.today::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.dp-d.in { background: var(--accent-soft); color: var(--ink); border-radius: 0; }
.dp-d.sel { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.dp-d.sel.today::after { background: var(--accent-ink); }
.dp-d.sel.s:not(.e) { border-radius: var(--r-md) 0 0 var(--r-md); } .dp-d.sel.e:not(.s) { border-radius: 0 var(--r-md) var(--r-md) 0; }
.dp-d.sel:hover { background: var(--accent-hover); }
.dp-f { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.dp-q { display: flex; gap: 6px; flex-wrap: wrap; }
.dp-q .chip { cursor: pointer; height: 26px; padding: 0 9px; font-size: 12px; font-family: inherit; transition: border-color .15s var(--ease), color .15s var(--ease), background-color .15s var(--ease); }
.dp-q .chip:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.dp-hint { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.ctl.sm { height: 28px; font-size: 12px; min-width: 150px; }

/* ---------- матрица сравнения магазинов ---------- */
table.matrix[data-n] { table-layout: fixed; }
table.matrix col.cm { width: 150px; } table.matrix col.ct { width: 110px; }
table.matrix th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 6px 8px; font-size: 10.5px; letter-spacing: .06em; }
table.matrix td { vertical-align: middle; padding: 4px 8px; font-size: 12px; line-height: 1.3; overflow: hidden; }
table.matrix td:first-child { white-space: normal; color: var(--ink-2); }
table.matrix td.num { font-size: 12px; }
table.matrix td .sub { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 1px; font-size: 11px; }
table.matrix .delta { height: 16px; padding: 0 4px; font-size: 10.5px; gap: 2px; }
table.matrix td .sh { color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
table.matrix.mx-inline td .sub { display: inline-flex; margin: 0 0 0 6px; vertical-align: middle; }
table.matrix.mx-inline td b { vertical-align: middle; }
table.matrix td.best { background: var(--ok-soft); box-shadow: inset 3px 0 0 var(--ok); }
table.matrix td.worst { background: var(--crit-soft); box-shadow: inset 3px 0 0 var(--crit); }
table.matrix td.tot { border-left: 1px solid var(--line-strong); font-weight: 600; background: var(--surface-2); }
table.matrix td.tot .sub { justify-content: flex-end; font-weight: 400; }
table.matrix tr.sec td { background: var(--surface-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; padding-top: 4px; padding-bottom: 4px; }
table.matrix .sdot { width: 7px; height: 7px; margin-right: 5px; }
.sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.sdot.lg { width: 12px; height: 12px; margin-right: 10px; }
.legend i.lg-best { background: var(--ok); } .legend i.lg-worst { background: var(--crit); }

/* ---------- график с наложением магазинов ---------- */
.lc { position: relative; width: 100%; min-height: 240px; }
.lc svg { display: block; width: 100%; height: 240px; overflow: visible; }
.lc .grid { stroke: var(--line); }
.lc text { fill: var(--ink-3); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
.lc .yl { text-anchor: end; } .lc .xl { text-anchor: middle; }
.lc .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc .cursor { stroke: var(--line-strong); stroke-dasharray: 3 3; }
.lc-tip { position: absolute; top: 8px; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink); padding: 8px 10px; border-radius: var(--r-md); font-size: 12px; box-shadow: var(--shadow-lg); z-index: 5; white-space: nowrap; display: flex; flex-direction: column; gap: 3px; min-width: 160px; }
.lc-tip .r { display: flex; justify-content: space-between; gap: 16px; }
.lc-tip i, .lc-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.lc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.lc-legend i { border-radius: 2px; width: 10px; height: 10px; }

/* ---------- выплаты Ozon на обзоре: график + таблица ---------- */
.pay { display: block; }
.pay-chart { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.pay table tfoot td { border-top: 1px solid var(--line-strong); font-weight: 600; }
.pay td .sub { display: block; }
.lc-tip .r.tot { border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 3px; padding-top: 3px; font-weight: 600; }
.lc .today { stroke: var(--line-strong); stroke-dasharray: 4 3; } .lc text.tl { fill: var(--ink-4); font-size: 10px; }
.pay-up { border-top: 1px solid var(--line); }
.pay-up h3 { margin: 0; padding: 12px 16px 0; font-size: 13px; font-weight: 600; }
.pay-up table.pay-dates { max-width: 520px; }
.pay-up tfoot td { border-top: 1px solid var(--line-strong); font-weight: 600; }

/* ---------- карточка магазина ---------- */
.shead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 4px 2px; }
.shead h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; }
.shead .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }
.shead .rank { text-align: right; font-size: 13px; color: var(--ink-2); }
.shead .rank b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin-right: 4px; }
.shead .rank .sub { display: block; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; color: inherit; background: var(--surface-2); transition: border-color .15s var(--ease), transform .15s var(--ease); }
.tile:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.tile .sub { color: var(--ink-3); font-size: 12px; }

/* ---------- статусы уведомлений ---------- */
.al-ctl { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.al.resolved { opacity: .72; }
.chip.st-ack { color: var(--info); border-color: var(--info-line); background: var(--info-soft); }
.chip.st-work { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.chip.st-resolved, .chip.st-muted { color: var(--ink-3); }
.al-ctl .btn.mute { margin-left: auto; color: var(--ink-3); }
td .btn.mute { color: var(--ink-3); } td .btn.mute:hover { color: var(--ink); }
#issueHiddenBtn { gap: 6px; } #issueHiddenBtn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.al-ctl .btn.mute:hover { color: var(--ink); }
.chip.st-new { color: var(--crit); border-color: var(--crit-line); background: var(--crit-soft); font-weight: 600; }
.note.pad { padding: 12px 16px 0; } .note.pad.pb { padding-bottom: 14px; }

/* ---------- финансы: раскладка начислений ---------- */
.fg-revenue { background: #0f8a78; } .fg-partners { background: #2dd4bf; } .fg-bonus { background: #86efac; } .fg-commission { background: #3b82f6; } .fg-delivery { background: #fcd34d; }
.fg-partner_services { background: #c4b5fd; } .fg-compensation { background: #94a3b8; } .fg-loans { background: #cbd5e1; } .fg-ads { background: #ec4899; } .fg-other_fees { background: #6d5ce0; }
.fg-fbo { background: #fb923c; } .fg-ozon_delivery { background: #a8b3c7; } .fg-other { background: #8b5cf6; }
.fin3 { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2.2fr) minmax(160px, .8fr); gap: 0 28px; }
.fin3 .fb + .fb { border-left: 1px solid var(--line); padding-left: 28px; }
.fb .fh { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.fb .fv { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.fb .fv2 { display: flex; align-items: baseline; gap: 8px 14px; flex-wrap: wrap; }
.fb .fv2 .sub { color: var(--ink-3); font-size: 12px; }
.fb .stack.tall { margin-bottom: 12px; }
.fcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 24px; }
.fi { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 52px; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.fi i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.fi .l { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi .v { font-weight: 600; white-space: nowrap; }
.fi .p { color: var(--ink-3); font-size: 11.5px; text-align: right; }
.fi.zero { opacity: .45; }
.fdot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
tr.fsales td { background: var(--ok-soft); }
.i-ink4 { background: var(--ink-4); }
.econ { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); max-width: 720px; }
.el { display: grid; grid-template-columns: minmax(0, 1fr) auto 70px; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.el .l { color: var(--ink-2); } .el .l .sub { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }
.el .v { font-weight: 600; white-space: nowrap; } .el .p { color: var(--ink-3); font-size: 11.5px; text-align: right; }
.el.net { border-bottom: 0; border-top: 1px solid var(--line-strong); margin-top: 2px; padding-top: 10px; }
.el.net .l { color: var(--ink); font-weight: 600; } .el.net .v { font-size: 18px; }
tr.ftotal td { border-top: 1px solid var(--line-strong); font-weight: 600; }
@media (max-width: 1100px) { .fin3 { grid-template-columns: 1fr; } .fin3 .fb + .fb { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .pcols { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ov { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .grid3 { grid-template-columns: 1fr 1fr; } .topnav { flex-wrap: wrap; height: auto; padding: 8px var(--main-x); } .nav { order: 3; width: 100%; margin: 0; } }
@media (max-width: 900px) {
  :root { --main-x: 14px; }
  .phtools { justify-content: flex-start; }
  .pcustom { right: auto; left: 0; }
  .dp-d, .dp-e { height: 40px; }
  .dp-hint { margin-left: 0; flex-basis: 100%; }
  .shead { flex-direction: column; align-items: flex-start; } .shead .rank { text-align: left; }
  .grid2, .grid3, .pcols { grid-template-columns: 1fr; }
  .kpi.wide { grid-column: auto; }
  .pagehead { flex-direction: column; align-items: flex-start; }
  .kpi .value { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* модальное окно Excel: выгрузка отчёта, шаблон и загрузка себестоимости / горизонта */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal-bd { position: absolute; inset: 0; background: rgba(2, 6, 16, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-dlg { position: relative; width: 560px; max-width: 100%; max-height: calc(100vh - 40px); overflow: auto; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 22px 24px 24px; animation: modal-in .18s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.modal-h h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.modal-h .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; }
.mstep { padding: 16px 0 0; }
.mstep + .mstep { margin-top: 14px; border-top: 1px solid var(--line); }
.mstep h3 { margin: 0; font-size: 14px; font-weight: 600; }
.mstep .sub { color: var(--ink-3); font-size: 12.5px; margin: 2px 0 10px; }
.mstep .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drop { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-2); flex: 0 0 auto; }
.drop .ic svg { width: 18px; height: 18px; }
.drop b { display: block; font-size: 13px; font-weight: 600; }
.drop .sub { display: block; color: var(--ink-3); font-size: 12px; margin: 2px 0 0; }
.drop.has b { color: var(--accent); }
.mres { margin-top: 12px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.mres.bad { color: var(--crit); }
.modal-f { display: flex; gap: 8px; margin-top: 18px; align-items: center; }
.modal-f .sp { flex: 1; }

/* FBS заявки: форма загрузки внутри карточки, неактивные (перекрытые) заявки приглушены */
.fbs-up { padding: 6px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.fbs-up .sub { color: var(--ink-3); font-size: 12.5px; }
.fbs-up .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
tr.dim td { opacity: .55; }

/* =====================================================================
   Печать вкладки (кнопка PDF / Ctrl+P): html.print — светлая бумажная вёрстка без стекла, навигации и контролов.
   Класс ставит app.js (beforeprint), поэтому те же стили видны и на экране при отладке.
   ===================================================================== */
.phead { display: none; }
/* специфичность выше, чем у :root[data-theme="dark"], иначе тёмные токены перебивают печатные */
html.print, html.print[data-theme] { color-scheme: light;
  --bg: #ffffff; --mesh-a: transparent; --mesh-b: transparent;
  --surface: #ffffff; --surface-2: #f6f8fb; --surface-3: #eef1f6; --solid: #ffffff; --row-hover: transparent;
  --line: #e2e6ee; --line-strong: #c9d1dd; --line-card: #d9dfe8;
  --ink: #0f172a; --ink-2: #3f4a5f; --ink-3: #64708a; --ink-4: #98a2b8;
  --accent: #2f5fe0; --accent-hover: #1f47b8; --accent-ink: #ffffff; --accent-soft: rgba(47, 95, 224, .1); --accent-line: rgba(47, 95, 224, .28);
  --crit: #d12f4d; --crit-soft: rgba(209, 47, 77, .08); --crit-line: rgba(209, 47, 77, .26);
  --warn: #a66200; --warn-soft: rgba(245, 158, 11, .12); --warn-line: rgba(245, 158, 11, .32);
  --ok: #0f8a78; --ok-soft: rgba(15, 138, 120, .1); --ok-line: rgba(15, 138, 120, .28);
  --up: #0f8a78; --up-soft: rgba(15, 138, 120, .1); --down: #d12f4d; --down-soft: rgba(209, 47, 77, .08);
  --info: #2f5fe0; --info-soft: rgba(47, 95, 224, .1); --info-line: rgba(47, 95, 224, .28);
  --s1: #3b6ef0; --s2: #f97316; --s3: #10b3a0; --s4: #f59e0b; --s5: #8b7cf6; --grad: linear-gradient(90deg, #3b6ef0, #10b3a0); --spark-fill: rgba(59, 110, 240, .14);
  --glass-shadow: none; --shadow-sm: none; --shadow-lg: none; --ring: none; --focus: #2f5fe0; --tip-bg: #0f172a; --tip-ink: #f8fafc; --scroll-thumb: #c3cad8; --blur: 0px; --main-x: 0px; }
html.print body { background: #fff; font-size: 11px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
html.print body::before, html.print .topnav, html.print .phtools, html.print #banner, html.print .foot, html.print .toast, html.print .modal, html.print .tip, html.print .lc-tip { display: none !important; }
html.print .main { max-width: none; padding: 0; gap: 10px; }
html.print .pagehead { display: none; }
html.print .phead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); margin-bottom: 4px; }
html.print .phead .l b { display: block; font-size: 17px; letter-spacing: -.02em; } html.print .phead .l span { color: var(--ink-3); font-size: 11px; }
html.print .phead .r { color: var(--ink-3); font-size: 11px; text-align: right; white-space: nowrap; }
html.print .g, html.print .card, html.print .kpi, html.print .pcol, html.print .al, html.print .tile { box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; background: #fff; border-color: var(--line-card); }
html.print .card, html.print .kpi, html.print .pcol, html.print .al, html.print .fin3 { break-inside: avoid; page-break-inside: avoid; }
html.print .card { overflow: visible; } html.print .tw { overflow: visible; }
html.print .card-h { padding: 9px 12px; } html.print .card-b { padding: 10px 12px; }
html.print .card-h .tools, html.print .seg, html.print .segbar, html.print .al-ctl, html.print .link-sm, html.print .btn, html.print .ibtn, html.print input, html.print select, html.print .fbs-up, html.print .drop { display: none !important; }
html.print .tabbar { padding: 0 8px; } html.print .tabbar button { display: inline-flex; height: 30px; font-size: 11px; }
html.print th { position: static; font-size: 9.5px; padding: 5px 7px; } html.print td { padding: 4px 7px; font-size: 10.5px; } html.print td.num, html.print th.num { font-size: 10.5px; }
html.print thead { display: table-header-group; } html.print tr { break-inside: avoid; page-break-inside: avoid; }
html.print .kpis { gap: 8px; } html.print .kpi { padding: 10px 12px; gap: 3px; } html.print .kpi .value { font-size: 17px; }
html.print .pcols { gap: 8px; } html.print .ov { gap: 10px; }
html.print .lc svg { width: 100% !important; height: auto !important; } html.print .lc { min-height: 0; }
html.print .al { padding: 7px 10px; }
html.print .pay-chart { padding: 10px 12px 8px; }
html.print .pcustom { display: none !important; }
@media print {
  @page { size: A4 landscape; margin: 10mm 10mm 12mm; }
  html, body { width: auto; height: auto; }
  .main { max-width: none !important; }
}
