/* Итогом — общие токены и базовые компоненты */

:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-2: #f0f2ee;
  --surface-3: #e7eae5;
  --ink: #0f1512;
  --ink-2: #48514c;
  --muted: #636c67;
  --line: #e2e5e0;
  --line-strong: #cdd2cc;

  --brand: #0a7a52;
  --brand-hover: #086946;
  --brand-ink: #ffffff;
  --brand-soft: #e1f2e9;
  --brand-soft-ink: #075c3e;
  --focus: #2a78d6;

  /* данные: слот 1 эталонной палитры + приглушённый серый для расходов */
  --series-1: #2a78d6;
  --bar-muted: #aeb5af;
  --grid: #eceee9;
  --axis: #c3c9c2;

  /* статусы — только со значком и подписью */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-text: #006300;
  --warning-text: #7a5000;
  --serious-text: #a2431c;
  --critical-text: #b02828;
  --good-soft: #e5f4e5;
  --warning-soft: #fdf2d8;
  --serious-soft: #fcebe2;
  --critical-soft: #fbe6e6;

  --wb: #8b2ad1;
  --ozon: #1f63e0;
  --ym: #d99a00;

  --shadow-sm: 0 1px 2px rgba(15, 21, 18, .06);
  --shadow-md: 0 10px 28px -12px rgba(15, 21, 18, .16), 0 2px 6px rgba(15, 21, 18, .05);
  --shadow-lg: 0 30px 70px -24px rgba(15, 21, 18, .28), 0 4px 14px rgba(15, 21, 18, .06);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0e0d;
    --surface: #141917;
    --surface-2: #1a201e;
    --surface-3: #222926;
    --ink: #eef2ef;
    --ink-2: #b4bdb8;
    --muted: #87918c;
    --line: #242b28;
    --line-strong: #343c38;
    --brand: #2fbf86;
    --brand-hover: #47cf98;
    --brand-ink: #03130c;
    --brand-soft: #0f2a1f;
    --brand-soft-ink: #74dcb1;
    --focus: #5598e7;
    --series-1: #3987e5;
    --bar-muted: #5d6762;
    --grid: #202724;
    --axis: #3a433f;
    --good-text: #3fcb3f;
    --warning-text: #f5c35a;
    --serious-text: #f3a07e;
    --critical-text: #f07c7c;
    --good-soft: #122a17;
    --warning-soft: #2d2410;
    --serious-soft: #2f1c13;
    --critical-soft: #301616;
    --wb: #b86cf0;
    --ozon: #5d93f5;
    --ym: #ffc533;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .75), 0 4px 14px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e0d;
  --surface: #141917;
  --surface-2: #1a201e;
  --surface-3: #222926;
  --ink: #eef2ef;
  --ink-2: #b4bdb8;
  --muted: #87918c;
  --line: #242b28;
  --line-strong: #343c38;
  --brand: #2fbf86;
  --brand-hover: #47cf98;
  --brand-ink: #03130c;
  --brand-soft: #0f2a1f;
  --brand-soft-ink: #74dcb1;
  --focus: #5598e7;
  --series-1: #3987e5;
  --bar-muted: #5d6762;
  --grid: #202724;
  --axis: #3a433f;
  --good-text: #3fcb3f;
  --warning-text: #f5c35a;
  --serious-text: #f3a07e;
  --critical-text: #f07c7c;
  --good-soft: #122a17;
  --warning-soft: #2d2410;
  --serious-soft: #2f1c13;
  --critical-soft: #301616;
  --wb: #b86cf0;
  --ozon: #5d93f5;
  --ym: #ffc533;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .75), 0 4px 14px rgba(0, 0, 0, .35);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.num { font-variant-numeric: tabular-nums; }

/* Значки */
.ic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic-sm { width: 15px; height: 15px; }
.ic-xs { width: 12px; height: 12px; }
.ic-lg { width: 22px; height: 22px; }

/* Логотип */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 19px; letter-spacing: -0.03em;
  text-decoration: none; color: var(--ink);
}
.logo-mark { width: 30px; height: 30px; }
.logo-mark rect { fill: var(--brand); }
.logo-mark path { stroke: var(--brand-ink); }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 11px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; border-radius: 13px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; }

/* Площадки */
.mp {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.mp::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mp-wb::before { background: var(--wb); }
.mp-ozon::before { background: var(--ozon); }
.mp-ym::before { background: var(--ym); }

/* Статус: цвет всегда вместе со значком и текстом */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.status .ic { width: 14px; height: 14px; stroke-width: 2.1; }
.status-good { background: var(--good-soft); color: var(--good-text); }
.status-warning { background: var(--warning-soft); color: var(--warning-text); }
.status-serious { background: var(--serious-soft); color: var(--serious-text); }
.status-critical { background: var(--critical-soft); color: var(--critical-text); }
.status-neutral { background: var(--surface-2); color: var(--ink-2); }

.delta-good { color: var(--good-text); }
.delta-bad { color: var(--critical-text); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* Переключатель темы */
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
