/* MOS Ads — основа дизайна (концепт 03.10.2026; копия docs/mockup/concepts/ds.css + тёмная тема по настройке системы).
   Характер: «финансовая книга». Цифры главные, цвет — только по смыслу (статус с иконкой или сегмент), рамки — только у кликабельного. */
@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  /* поверхности и чернила */
  --paper: #f4f6f8; --surface: #ffffff; --surface-2: #eef1f4; --rule: #dde3e9; --rule-strong: #c5ced8;
  --ink: #14202b; --ink-2: #4a5868; --ink-3: #6b7886;
  /* акцент — действия, навигация, фокус */
  --accent: #0d6e78; --accent-ink: #ffffff; --accent-soft: #e2f0f1; --focus: #0d6e78;
  /* статусы — всегда вместе с иконкой и подписью */
  --good: #0ca30c; --good-text: #006300; --good-soft: #e6f4e6;
  --warn: #fab219; --warn-text: #7a5200; --warn-soft: #fdf3dc;
  --crit: #d03b3b; --crit-text: #b02a2a; --crit-soft: #fbe7e7;
  /* сегменты (категориальная палитра, фиксированный порядок) */
  --seg-a: #2a78d6; --seg-b: #eb6834; --seg-c: #1baf7a; --seg-new: #eda100; --seg-nostock: #e87ba4; --seg-stale: #008300;
  /* графики */
  --series: #2a78d6; --series-2: #eb6834; --grid: #e1e5ea; --axis: #c5ced8;
  /* шкалы */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 6px; --r-md: 10px;
  --fs-meta: 13px; --fs-table: 14px; --fs-body: 16px; --fs-h3: 18px; --fs-h2: 20px; --fs-h1: 26px; --fs-figure: 30px; --fs-hero: 40px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1418; --surface: #161d23; --surface-2: #1d262e; --rule: #26313b; --rule-strong: #364350;
  --ink: #e8eef3; --ink-2: #a7b4c2; --ink-3: #8592a0;
  --accent: #3fb7c4; --accent-ink: #0b1a1d; --accent-soft: #15333a; --focus: #3fb7c4;
  --good-text: #3fcf55; --good-soft: #142b18; --warn-text: #f5c35a; --warn-soft: #2e2512; --crit-text: #f08a8a; --crit-soft: #3a1b1b;
  --seg-a: #3987e5; --seg-b: #d95926; --seg-c: #199e70; --seg-new: #c98500; --seg-nostock: #d55181; --seg-stale: #2aa52a;
  --series: #3987e5; --series-2: #d95926; --grid: #24303a; --axis: #364350;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0f1418; --surface: #161d23; --surface-2: #1d262e; --rule: #26313b; --rule-strong: #364350;
    --ink: #e8eef3; --ink-2: #a7b4c2; --ink-3: #8592a0;
    --accent: #3fb7c4; --accent-ink: #0b1a1d; --accent-soft: #15333a; --focus: #3fb7c4;
    --good-text: #3fcf55; --good-soft: #142b18; --warn-text: #f5c35a; --warn-soft: #2e2512; --crit-text: #f08a8a; --crit-soft: #3a1b1b;
    --seg-a: #3987e5; --seg-b: #d95926; --seg-c: #199e70; --seg-new: #c98500; --seg-nostock: #d55181; --seg-stale: #2aa52a;
    --series: #3987e5; --series-2: #d95926; --grid: #24303a; --axis: #364350;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--fs-body)/1.5 "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; } @media (hover: hover) and (pointer: fine) { a:hover { text-decoration: underline; } }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num, table td.n, table th.n { font-variant-numeric: tabular-nums; }
.meta { font-size: var(--fs-meta); color: var(--ink-2); }
.muted { color: var(--ink-3); }
h1 { font-size: var(--fs-h1); line-height: 1.2; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); line-height: 1.3; font-weight: 600; margin: 0; }
h3 { font-size: var(--fs-h3); line-height: 1.35; font-weight: 600; margin: 0; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- каркас: меню слева, шапка сверху ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.rail { background: var(--surface); border-right: 1px solid var(--rule); padding: var(--s4) var(--s3); position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: 17px; padding: 6px 10px var(--s5); }
.logo i { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); display: inline-flex; align-items: center; justify-content: center; color: var(--paper); font-style: normal; font-size: 13px; }
.nav-sec { font-size: var(--fs-meta); font-weight: 600; color: var(--ink-3); padding: var(--s4) 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink); font-size: 15px; }
@media (hover: hover) and (pointer: fine) { .nav a:hover { background: var(--surface-2); text-decoration: none; } }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a .badge { margin-left: auto; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--s3); height: 60px; padding: 0 var(--s6);
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: var(--s2); height: 38px; padding: 0 var(--s3); border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink-3); font-size: 15px; }
.search kbd { margin-left: auto; font: 500 12px/1 "Golos Text", sans-serif; border: 1px solid var(--rule-strong); border-radius: 4px; padding: 3px 6px; color: var(--ink-2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-meta); color: var(--ink-2); }
.fresh .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.fresh.late .dot { background: var(--warn); }
.client { display: flex; align-items: center; gap: var(--s2); padding: 5px 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); font-size: 14px; }
.client b { font-weight: 600; }
.page { padding: var(--s5) var(--s6) var(--s7); max-width: 1400px; }

/* ---------- управляющие элементы ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--rule-strong);
  background: var(--surface); color: var(--ink); font: 500 14px/1 "Golos Text", sans-serif; cursor: pointer; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--surface-2); } }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); padding: 0 8px; }
.btn[disabled] { color: var(--ink-3); background: var(--surface-2); border-color: var(--rule); cursor: not-allowed; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.seg-ctl { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--r-sm); }
.seg-ctl button { border: 0; background: transparent; color: var(--ink-2); font: 500 13px/1 "Golos Text", sans-serif; padding: 7px 11px; border-radius: 4px; cursor: pointer; }
.seg-ctl button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--rule); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 11px; border-radius: 15px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; }
.chip button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.chip.add { background: transparent; border: 1px dashed var(--rule-strong); color: var(--ink-2); padding: 0 11px; }

/* бейджи статуса: иконка + подпись, цвет — третий канал */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; padding: 2px 8px 2px 6px; border-radius: 5px; white-space: nowrap; }
.status .ic { width: 15px; height: 15px; }
.status.crit { background: var(--crit-soft); color: var(--crit-text); }
.status.warn { background: var(--warn-soft); color: var(--warn-text); }
.status.good { background: var(--good-soft); color: var(--good-text); }
.badge { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--crit); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
/* сегмент: цветная точка + буква/название, без заливки */
.seg { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.seg::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

/* ---------- блоки ---------- */
.section { margin-top: var(--s6); }
.section-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); }
.section-head .meta { margin-left: 0; }
.section-head .right { margin-left: auto; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); }
.hr { height: 1px; background: var(--rule); border: 0; margin: 0; }

/* строка показателей «как в книге»: цифры через тонкие вертикальные линии, без карточек */
.ledger { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); }
.fig { padding: var(--s4) var(--s5); border-left: 1px solid var(--rule); min-width: 0; }
.fig:first-child { border-left: 0; }
.fig .label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.fig .label .info { width: 15px; height: 15px; color: var(--ink-3); }
.fig .value { font-size: var(--fs-figure); font-weight: 600; line-height: 1.15; margin-top: 6px; letter-spacing: -0.01em; white-space: nowrap; }
.fig .value small { font-size: 0.55em; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.fig .cmp { font-size: var(--fs-meta); color: var(--ink-2); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--good-text); } .delta.bad { color: var(--crit-text); } .delta.flat { color: var(--ink-2); }
.fig svg.spark { display: block; width: 100%; height: 34px; margin-top: var(--s3); }
.target { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- таблица ---------- */
.tbl-wrap { overflow: auto; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); }
table.t { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-table); }
table.t th { position: sticky; top: 0; z-index: 2; background: var(--surface); text-align: left; font-weight: 500; color: var(--ink-2); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t th.n, table.t td.n { text-align: right; }
table.t td:first-child, table.t th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--rule); }
table.t th:first-child { z-index: 3; }
@media (hover: hover) and (pointer: fine) { table.t tbody tr:hover td { background: var(--surface-2); } }
.cell-name { display: flex; gap: 10px; align-items: center; max-width: 340px; }
.cell-name img, .thumb { width: 32px; height: 42px; object-fit: cover; border-radius: 4px; background: var(--surface-2); flex: none; }
.cell-name .t1 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-name .t2 { font-size: 12px; color: var(--ink-3); }
.bad-cell { color: var(--crit-text); font-weight: 600; }

/* ---------- состояния ---------- */
.state { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--surface); }
.state .ic { width: 22px; height: 22px; margin-top: 1px; }
.state.late { background: var(--warn-soft); border-color: transparent; color: var(--warn-text); }
.state.error { background: var(--crit-soft); border-color: transparent; color: var(--crit-text); }
.state p { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--rule) 50%, var(--surface-2) 75%); background-size: 200% 100%; border-radius: 4px; height: 12px; }

/* ---------- графики ---------- */
.chart-title { font-size: 14px; font-weight: 600; display: flex; gap: var(--s2); align-items: baseline; }
.chart-title .meta { font-weight: 400; }
svg.chart text { font: 11px "Golos Text", sans-serif; fill: var(--ink-3); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- телефон ---------- */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { padding: 0 var(--s4); height: 56px; }
  .topbar .search span.txt { display: none; }
  .topbar .search { flex: 0 0 40px; padding: 0; justify-content: center; } .topbar .search kbd { display: none; }
  .client, .top-right .theme { display: none; }
  .page { padding: var(--s4) var(--s4) 96px; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fig { border-left: 0; border-top: 1px solid var(--rule); padding: var(--s3) var(--s4); }
  .fig:nth-child(-n+2) { border-top: 0; } .fig:nth-child(even) { border-left: 1px solid var(--rule); }
  .fig .value { font-size: 24px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--rule); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-3); font-size: 11px; position: relative; min-height: 44px; justify-content: center; }
  .bottom-nav a.on { color: var(--accent); font-weight: 600; }
  .bottom-nav .badge { position: absolute; top: -2px; left: 54%; height: 17px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.ic.r90 { transform: rotate(-90deg); }
