/* ═══════════════════════════════════════════════════════════════════
   Yolt v11 — SHARED page styles  ·  R2
   Cohesion across 40+ pages: same atoms, same tokens, ZERO drift.
   Verbatim tokens from UIKit_LIVING.html. Atoms from _APPROVED_BLOCKS.
   ZERO hex · ZERO rgb · ZERO Tailwind · oklch only.
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════
   🎨 SEMANTIC COLOR LOGIC — LOCKED RULES (Йолт canon)
   ═══════════════════════════════════════════════════════════════════════

   Числа у scoreboards/cards/tables НЕ просто білі — використовуй semantic colors:

   ✅ ЗЕЛЕНИЙ відтінок (`var(--good)`):
      • Positive values: revenue, profit, margin >threshold, doxod
      • Tone class: .scorecard-compound.good
      • Tone attr: [data-tone="revenue"]

   ❌ ЧЕРВОНИЙ відтінок (`var(--bad)`):
      • Negative values: losses, refunds, returns, expenses, costs
      • Spend / витрати — Ad Spend, COGS, OPEX
      • Tone class: .scorecard-compound.bad / .scorecard-compound[data-tone="expense"]

   ⚠️  АМБЕР (`var(--warn)`):
      • Warning thresholds — margin нижче target, growth slowing
      • Tone class: .scorecard-compound.warn

   🔵 BRAND (`var(--brand)`):
      • Hero / primary KPI scoreboards (revenue lead, primary metric)
      • Tone class: .scorecard-compound.brand

   ═══════════════════════════════════════════════════════════════════════
   📊 TABLE GRADIENT RULE (Rule 16) — ОБОВ'ЯЗКОВО
   ═══════════════════════════════════════════════════════════════════════

   У будь-якій таблиці що показує performance breakdown, **завжди** apply
   `.gradient-cell` з `--cell-pct` на ці columns:

      • Revenue / Дохід / Σ ₴
      • Spend / Витрати / Cost
      • Profit / Прибуток / Margin (₴)
      • Margin % (через .status-pill з threshold check)

   CSS pattern:
   <td class="gradient-cell" style="--cell-pct: 0.82;">3 240 ₴</td>

   --cell-pct = value / column_max [0..1]
   Background derived from: color-mix(--cell-accent, transparent, --cell-pct*80%)

   Default --cell-accent: var(--brand); semantic override per column:
     • Profit/Revenue → --cell-accent: var(--good)
     • Spend/Expense → --cell-accent: var(--bad)

   Applies to: channel tables, category tables, manager tables, SKU tables,
   ads campaigns, P&L breakdowns, source attribution.

   ═══════════════════════════════════════════════════════════════════════ */

/* ── Normis (default) tokens — UIKit_LIVING.html L12-32 verbatim ── */
:root {
  --bg-0: oklch(0.16 0.006 70);
  --bg-1: oklch(0.19 0.006 70);
  --bg-2: oklch(0.22 0.007 70);
  --bg-3: oklch(0.26 0.008 70);

  --line:      oklch(0.30 0.008 70);
  --line-soft: oklch(0.24 0.007 70);

  --ink-0: oklch(0.97 0.005 80);
  --ink-1: oklch(0.86 0.008 80);
  --ink-2: oklch(0.66 0.010 80);
  --ink-3: oklch(0.50 0.010 80);
  --ink-4: oklch(0.38 0.010 80);

  --good:  oklch(0.82 0.14 155);
  --warn:  oklch(0.82 0.14 80);
  --bad:   oklch(0.74 0.16 28);
  --info:  oklch(0.78 0.12 240);
  --brand: oklch(0.78 0.14 200);

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --shadow-low:  0 1px 3px oklch(0% 0 0 / 0.20);
  --shadow-mid:  0 4px 12px oklch(0% 0 0 / 0.30);
  --shadow-high: 0 12px 32px oklch(0% 0 0 / 0.40);

  --sidebar-w: 232px;
  --topbar-h: 52px;
  --maxw: 1640px;

  --font: 'Inter Tight', 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* aliases */
  --bg-elev: var(--bg-1);
  --accent: var(--brand);
}

/* ══ THEMES — verbatim з Dashboard PlusUltra.html (canonical reference, owner: Йолт)
   Activation model:
   - <body data-mode="plusultra" data-intensity="acid"> — hot pink magenta
   - <body data-mode="plusultra" data-intensity="noir"> — warm grayscale (sepia-tinted)
   Selectors змінюються до body (not :root) щоб match canonical. ══ */
body[data-mode="plusultra"][data-intensity="acid"] {
  --bg-0: oklch(0.10 0.05 320);
  --bg-1: oklch(0.14 0.07 320);
  --bg-2: oklch(0.18 0.08 320);
  --bg-3: oklch(0.23 0.09 320);
  --line: oklch(0.36 0.12 330);
  --line-soft: oklch(0.26 0.09 325);
  --ink-0: oklch(0.99 0.015 320);
  --ink-1: oklch(0.90 0.03 320);
  --ink-2: oklch(0.70 0.06 320);
  --ink-3: oklch(0.55 0.09 325);
  --brand:   oklch(0.72 0.32 350);
  --accent:  oklch(0.72 0.32 350);
  --info:    oklch(0.86 0.22 195);
  --good:    oklch(0.92 0.26 130);
  --warn:    oklch(0.86 0.22 75);
  --bad:     oklch(0.72 0.32 25);
  --magenta: oklch(0.68 0.34 320);
  --glow: 0 0 22px color-mix(in oklch, var(--accent) 70%, transparent), 0 0 8px color-mix(in oklch, var(--accent) 90%, transparent);
  --grid-strength: 0.13;
  --scan-strength: 0.015;
}
body[data-mode="plusultra"][data-intensity="noir"] {
  --bg-0: oklch(0.10 0 0);
  --bg-1: oklch(0.13 0 0);
  --bg-2: oklch(0.16 0 0);
  --bg-3: oklch(0.21 0 0);
  --line: oklch(0.28 0.005 30);
  --line-soft: oklch(0.20 0.005 30);
  --ink-0: oklch(0.92 0.02 60);
  --ink-1: oklch(0.85 0.02 30);
  --ink-2: oklch(0.62 0.03 30);
  --ink-3: oklch(0.46 0.04 30);
  --brand: oklch(0.74 0.08 50);
  --accent: oklch(0.70 0.05 30);
  --info: oklch(0.66 0.05 230);
  --good: oklch(0.74 0.07 145);
  --warn: oklch(0.76 0.10 75);
  --bad:  oklch(0.62 0.12 25);
  --magenta: oklch(0.62 0.07 350);
  --glow: 0 0 0 transparent;
  --grid-strength: 0.04;
  --scan-strength: 0.004;
}
/* Atmospheric backdrop layers (radial gradients + grid) — verbatim canonical */
body[data-mode="plusultra"] { position: relative; overflow-x: hidden; }
body[data-mode="plusultra"]::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(55% 45% at 14% 10%, color-mix(in oklch, var(--accent) 32%, transparent) 0%, transparent 62%),
    radial-gradient(50% 40% at 92% 82%, color-mix(in oklch, var(--magenta) 28%, transparent) 0%, transparent 62%),
    radial-gradient(40% 30% at 70% 20%, color-mix(in oklch, var(--info) 18%, transparent) 0%, transparent 60%);
  transition: opacity 0.4s;
}
body[data-mode="plusultra"]::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image:
    linear-gradient(color-mix(in oklch, var(--accent) calc(var(--grid-strength) * 100%), transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklch, var(--accent) calc(var(--grid-strength) * 100%), transparent) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, black 30%, transparent 90%);
}
body[data-mode="plusultra"][data-intensity="noir"]::before { opacity: 0.4; }
body[data-mode="plusultra"] .app { position: relative; z-index: 2; }

/* PlusUltra atom adjustments — Acid */
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound {
  background: color-mix(in oklch, var(--bg-2) 70%, transparent);
  backdrop-filter: blur(2px);
  border-color: color-mix(in oklch, var(--accent) 16%, var(--line));
}
/* Scoreboard color logic — WHITE by default, semantic green/red retained */
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound .sc-big {
  color: var(--ink-0);
  text-shadow: 0 0 18px color-mix(in oklch, var(--accent) 22%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound.good .sc-big,
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound[data-tone="revenue"] .sc-big {
  color: var(--good);
  text-shadow: 0 0 18px color-mix(in oklch, var(--good) 32%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound.bad .sc-big,
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound[data-tone="expense"] .sc-big {
  color: var(--bad);
  text-shadow: 0 0 18px color-mix(in oklch, var(--bad) 32%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound.warn .sc-big {
  color: var(--warn);
  text-shadow: 0 0 18px color-mix(in oklch, var(--warn) 28%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound.brand {
  border-color: color-mix(in oklch, var(--accent) 35%, var(--line));
  box-shadow: 0 0 38px -8px color-mix(in oklch, var(--accent) 35%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .scorecard-compound .sc-spark polyline { stroke: var(--accent) !important; filter: drop-shadow(0 0 4px color-mix(in oklch, var(--accent) 60%, transparent)); }
body[data-mode="plusultra"][data-intensity="acid"] .hero-h h1 .me {
  color: var(--accent);
  text-shadow: 0 0 20px color-mix(in oklch, var(--accent) 50%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .hero-h h1 {
  text-shadow: 0 0 20px color-mix(in oklch, var(--accent) 25%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .sb-item.active {
  background: linear-gradient(90deg, color-mix(in oklch, var(--accent) 22%, transparent) -10%, transparent 90%);
  box-shadow: inset 2px 0 0 var(--accent), 0 0 22px -8px color-mix(in oklch, var(--accent) 40%, transparent);
  color: var(--ink-0);
}
body[data-mode="plusultra"][data-intensity="acid"] .sb-item.active .ico { color: var(--accent); }
body[data-mode="plusultra"][data-intensity="acid"] .pulse {
  background: color-mix(in oklch, var(--accent) 14%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in oklch, var(--accent) 28%, var(--line));
}
body[data-mode="plusultra"][data-intensity="acid"] .tb-pill.plus,
body[data-mode="plusultra"][data-intensity="acid"] .btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--magenta) 100%);
  color: oklch(0.10 0.05 320); border-color: transparent;
  box-shadow: 0 0 22px color-mix(in oklch, var(--accent) 50%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .fab {
  background: var(--accent);
  color: oklch(0.10 0.05 320);
  box-shadow: 0 0 30px color-mix(in oklch, var(--accent) 50%, transparent), 0 0 12px color-mix(in oklch, var(--accent) 80%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .af-chip {
  background: color-mix(in oklch, var(--accent) 16%, var(--bg-1));
  border-color: color-mix(in oklch, var(--accent) 32%, var(--line));
  color: var(--ink-0);
}
body[data-mode="plusultra"][data-intensity="acid"] .crumb.active {
  color: var(--accent); text-shadow: 0 0 8px color-mix(in oklch, var(--accent) 50%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .status-pill.s-info {
  background: color-mix(in oklch, var(--info) 18%, var(--bg-2));
  color: var(--info); border-color: color-mix(in oklch, var(--info) 35%, var(--line));
  box-shadow: 0 0 8px color-mix(in oklch, var(--info) 30%, transparent);
}
body[data-mode="plusultra"][data-intensity="acid"] .gradient-cell { --cell-accent: var(--accent); }

/* PlusUltra atom adjustments — Noir (warm grayscale, flat) */
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound {
  background: var(--bg-1); border-color: var(--line); box-shadow: none;
}
/* Noir scoreboard color logic — WHITE default + semantic green/red */
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound .sc-big { color: var(--ink-0); text-shadow: none; }
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound.good .sc-big,
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound[data-tone="revenue"] .sc-big { color: var(--good); }
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound.bad .sc-big,
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound[data-tone="expense"] .sc-big { color: var(--bad); }
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound.warn .sc-big { color: var(--warn); }

/* ── PU-only blocks visibility (sidebar items + 10 content sections) ── */
.pu-only, .pu-item { display: none !important; }
/* Per-element display:revert when plusultra mode active — preserves original flex/block layout */
body[data-mode="plusultra"] section.pu-only { display: block !important; }
body[data-mode="plusultra"] div.sb-group.pu-only { display: flex !important; }
body[data-mode="plusultra"] a.sb-item.pu-item { display: flex !important; }
/* Force sidebar group icon back to normal size when nested in pu-only */
.sb-group.pu-only .ico { width: 14px; height: 14px; flex: none; }
.sb-group.pu-only .ico svg { width: 100%; height: 100%; }

/* PU sidebar items (8 nav) — zap icon glow */
.sb-item.pu-item .zap {
  display: inline-grid; place-items: center;
  width: 14px; height: 14px;
  color: var(--accent);
  font-size: 11px; flex: none;
}
body[data-mode="plusultra"][data-intensity="acid"] .sb-item.pu-item .zap {
  text-shadow: 0 0 8px color-mix(in oklch, var(--accent) 60%, transparent);
}
.sb-item.pu-item .pro {
  margin-left: auto;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-3);
  color: var(--ink-3);
  font-family: var(--font-mono);
}
body[data-mode="plusultra"][data-intensity="acid"] .sb-item.pu-item .pro {
  background: color-mix(in oklch, var(--accent) 22%, var(--bg-2));
  color: var(--accent);
}

/* PU-only content blocks (10 sections) styling */
.pu-section {
  background: color-mix(in oklch, var(--bg-1) 80%, transparent);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 16px;
  margin-top: var(--space-md);
}
body[data-mode="plusultra"] .pu-section {
  border-color: color-mix(in oklch, var(--accent) 14%, var(--line-soft));
}
body[data-mode="plusultra"][data-intensity="acid"] .pu-section {
  box-shadow: 0 0 30px -12px color-mix(in oklch, var(--accent) 22%, transparent);
}
.pu-sec-h {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.pu-sec-h .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 16%, var(--bg-2));
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.pu-sec-h h2 { margin: 0; font-size: 14px; color: var(--ink-0); font-weight: 600; }
.pu-sec-h .hint { color: var(--ink-3); font-size: 11px; margin-left: auto; }

/* Levers list */
.pu-levers { display: flex; flex-direction: column; gap: 6px; }
.pu-lever-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 12px;
}
.pu-lever-row .rk { font-family: var(--font-mono); color: var(--ink-3); font-size: 11px; min-width: 32px; }
.pu-lever-row .nm { flex: 1; color: var(--ink-1); }
.pu-lever-row .impact { font-family: var(--font-mono); color: var(--good); font-weight: 600; }
.pu-lever-row .ease { font-family: var(--font-mono); font-size: 10px; padding: 1px 6px; border-radius: 3px; }
.pu-lever-row .ease.easy { background: color-mix(in oklch, var(--good) 18%, var(--bg-2)); color: var(--good); }
.pu-lever-row .ease.med { background: color-mix(in oklch, var(--warn) 18%, var(--bg-2)); color: var(--warn); }
.pu-lever-row .ease.hard { background: color-mix(in oklch, var(--bad) 18%, var(--bg-2)); color: var(--bad); }

/* PU mini KPI strip */
.pu-kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.pu-kpi-cell {
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.pu-kpi-cell .l { font-size: 10px; text-transform: uppercase; color: var(--ink-3); letter-spacing: 0.06em; font-weight: 600; }
.pu-kpi-cell .v { font-family: var(--font-mono); font-weight: 600; font-size: 18px; color: var(--ink-0); }
.pu-kpi-cell .v .unit { font-size: 12px; color: var(--ink-2); margin-left: 2px; }
.pu-kpi-cell .health { font-size: 10px; font-family: var(--font-mono); }
.pu-kpi-cell .health.healthy { color: var(--good); }
.pu-kpi-cell .health.acceptable { color: var(--warn); }
.pu-kpi-cell .health.red { color: var(--bad); }
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound.brand {
  border-left: 3px solid var(--accent);
}
body[data-mode="plusultra"][data-intensity="noir"] .scorecard-compound .sc-spark polyline { stroke: var(--accent) !important; }
body[data-mode="plusultra"][data-intensity="noir"] .hero-h h1 { text-shadow: none; }
body[data-mode="plusultra"][data-intensity="noir"] .hero-h h1 .me { color: var(--accent); }
body[data-mode="plusultra"][data-intensity="noir"] .sb-item.active {
  background: var(--bg-2); color: var(--ink-0); border-left: 2px solid var(--accent); box-shadow: none;
}
body[data-mode="plusultra"][data-intensity="noir"] .sb-item.active .ico { color: var(--accent); }
body[data-mode="plusultra"][data-intensity="noir"] .pulse {
  background: var(--bg-2); color: var(--ink-1); border: 1px solid var(--line);
}
body[data-mode="plusultra"][data-intensity="noir"] .tb-pill.plus,
body[data-mode="plusultra"][data-intensity="noir"] .btn-primary {
  background: var(--accent); color: var(--bg-0); border-color: transparent; box-shadow: none;
}
body[data-mode="plusultra"][data-intensity="noir"] .fab {
  background: var(--accent); color: var(--bg-0); box-shadow: var(--shadow-mid);
}
body[data-mode="plusultra"][data-intensity="noir"] .af-chip {
  background: var(--bg-2); border-color: var(--line); color: var(--ink-1);
}
body[data-mode="plusultra"][data-intensity="noir"] .crumb.active { color: var(--ink-0); }
body[data-mode="plusultra"][data-intensity="noir"] .gradient-cell { --cell-accent: var(--accent); }
body[data-mode="plusultra"][data-intensity="noir"] .ai-hint { border-left: 3px solid var(--accent); }

/* ── Theme toggle atom (3-button group) — gated by +PlusUltra click ──
   By default hidden у звичайному (Normis) mode. Натискання `+PlusUltra` button
   reveals toggle (.theme-toggle.revealed) — Default / PlusUltra / Noir options.
   Click `+PlusUltra` again hides toggle. Persisted у localStorage 'yolt_pu_revealed'. */
.theme-toggle {
  display: none;            /* hidden by default per Йолт UX */
  gap: 2px;
  padding: 2px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}
.theme-toggle.revealed { display: inline-flex; }
.theme-toggle button {
  display: grid; place-items: center;
  width: 26px; height: 24px;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-3);
  transition: color 0.14s, background 0.14s;
}
.theme-toggle button svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.theme-toggle button:hover { color: var(--ink-0); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--bg-1);
  color: var(--brand);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-0);
  color: var(--ink-1);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: color-mix(in oklch, var(--brand) 75%, var(--ink-0)); }

.num, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum','zero';
}

.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;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--brand) 20%, transparent);
}
@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 3px;
    box-shadow: none;
  }
}
@media (prefers-contrast: more) {
  :focus-visible {
    outline-width: 3px;
    outline-offset: 3px;
  }
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  padding: 12px 16px;
  background: var(--brand); color: var(--bg-0);
  font-weight: 600; text-decoration: none;
  border-radius: var(--r-sm);
  z-index: 9999;
}
.skip-link:focus { left: 12px; top: 12px; }

/* CRM-only fallback marker — applied via JS to ad-dependent KPI cells
   (spend / roas / cac) when tenant has no Meta/Google ad data. */
.crm-only-fallback {
  color: var(--ink-3) !important;
  font-size: 0.78em !important;
  font-style: italic;
  letter-spacing: 0.02em;
  cursor: help;
}

/* ═══════════════ APP SHELL ═══════════════ */
/* Defensive flex layout — sidebar fixed-width left, main fills remainder. */
.app {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  grid-template-columns: var(--sidebar-w) 1fr;
}
.app:has(> .sidebar.collapsed) { --sidebar-w: 56px; }

/* ────────── SIDEBAR ────────── */
.sidebar {
  flex: 0 0 var(--sidebar-w) !important;
  width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.sb-brand {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--line-soft);
}
.sb-brand .mark {
  width: 28px; height: 28px;
  color: var(--brand);
  flex: none;
}
.sb-brand .mark svg { display: block; width: 100%; height: 100%; }
.sb-brand .name-block { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sb-brand .name { font-weight: 700; font-size: 14px; color: var(--ink-0); letter-spacing: -0.01em; }
.sb-brand .tenant { font-size: 11px; color: var(--ink-2); }
.sb-brand .version {
  margin-left: auto;
  background: var(--bg-3);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  letter-spacing: 0.02em;
}

.sb-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xs) 0 var(--space-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sb-scroll::-webkit-scrollbar { width: 5px; }
.sb-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.sb-group {
  display: flex; align-items: center; gap: var(--space-xs);
  padding: var(--space-md) var(--space-md) var(--space-xs);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.sb-group .ico { width: 12px; height: 12px; flex: none; color: var(--ink-3); }
.sb-group .ico svg { width: 100%; height: 100%; }
.sb-group .count {
  margin-left: auto;
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: 9.5px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0;
}

.sb-item {
  display: flex; align-items: center; gap: var(--space-sm);
  margin: 0 var(--space-xs);
  padding: 5px var(--space-sm) 5px var(--space-md);
  border-radius: var(--r-sm);
  color: var(--ink-1);
  font-size: 12.5px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.sb-item .ico {
  width: 14px; height: 14px;
  flex: none;
  color: var(--ink-3);
}
.sb-item .ico svg { width: 100%; height: 100%; }
.sb-item .label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-item:hover {
  background: var(--bg-2);
  color: var(--ink-0);
}
.sb-item:hover .ico { color: var(--ink-1); }

.sb-item.active {
  background: color-mix(in oklch, var(--brand) 14%, transparent);
  color: var(--ink-0);
  box-shadow: inset 2px 0 0 var(--brand);
}
.sb-item.active .ico { color: var(--brand); }

/* Pin button — visible on hover or when item is pinned */
.sb-pin {
  width: 16px; height: 16px;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-4);
  display: grid; place-items: center;
  flex: none;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
  cursor: pointer;
  padding: 0;
}
.sb-pin svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sb-item:hover .sb-pin { opacity: 1; }
.sb-pin:hover { background: var(--bg-3); color: var(--ink-1); }
.sb-pin.on,
.sb-item.pinned .sb-pin {
  opacity: 1;
  color: var(--brand);
}
.sb-pin.on svg { fill: var(--brand); stroke: var(--brand); }
.sb-item.pinned .sb-pin svg { fill: currentColor; }
/* Pinned items get accent left border */
.sb-item.pinned {
  background: color-mix(in oklch, var(--brand) 6%, transparent);
}

/* Sidebar tags — LIVE / SOON / NEW / STUB */
.sb-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  font-weight: 600;
  line-height: 1.4;
}
.sb-tag.live { background: color-mix(in oklch, var(--good) 16%, var(--bg-2)); color: var(--good); }
.sb-tag.new  { background: color-mix(in oklch, var(--brand) 18%, var(--bg-2)); color: var(--brand); }
.sb-tag.soon { background: var(--bg-3); color: var(--ink-3); }
.sb-tag.stub { background: var(--bg-2); color: var(--ink-4); border: 1px dashed var(--line); padding: 0 4px; }

.sb-foot {
  border-top: 1px solid var(--line-soft);
  padding: var(--space-sm) var(--space-xs);
}
/* G1 + G5 — Logout button + Help/Docs link у sidebar foot */
.sb-logout, .sb-help-link {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 6px var(--space-md);
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  width: 100%; background: transparent; border: 0; color: var(--ink-2);
  text-decoration: none;
}
.sb-logout .ico, .sb-help-link .ico { width: 14px; height: 14px; flex: none; }
.sb-logout .ico svg, .sb-help-link .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; }
.sb-help-link:hover { background: var(--bg-2); color: var(--ink-0); }
.sb-logout:hover { background: color-mix(in oklch, var(--bad) 14%, var(--bg-2)); color: var(--bad); }
.sb-logout:hover .ico { color: var(--bad); }

/* G2 — Tenant switcher dropdown (topbar pill з caret) */
.tenant-switcher {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: 4px 10px; border-radius: 6px;
  background: var(--bg-1); border: 1px solid var(--line-soft);
  color: var(--ink-1); font-size: 12px; cursor: pointer;
  position: relative;
}
.tenant-switcher:hover { border-color: var(--ink-3); }
.tenant-switcher .ts-name { font-weight: 600; color: var(--ink-0); }
.tenant-switcher .ts-tag { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: var(--bg-3); color: var(--ink-3); font-family: var(--font-mono); }
.tenant-switcher .ts-caret { color: var(--ink-3); display: inline-grid; place-items: center; width: 12px; height: 12px; }
.tenant-switcher .ts-caret svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; }
.tenant-switcher .ts-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-mid); padding: 4px; z-index: 50;
  display: none; flex-direction: column; gap: 1px;
}
.tenant-switcher.open .ts-menu { display: flex; }
.tenant-switcher .ts-row {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 6px var(--space-sm); border-radius: 4px; cursor: pointer;
  color: var(--ink-1); font-size: 12px;
}
.tenant-switcher .ts-row:hover { background: var(--bg-2); }
.tenant-switcher .ts-row.active { background: var(--bg-2); color: var(--ink-0); }
.tenant-switcher .ts-row .check { margin-left: auto; color: var(--brand); opacity: 0; }
.tenant-switcher .ts-row.active .check { opacity: 1; }

/* G3 — Search bar Cmd+K trigger у topbar */
.search-trigger {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  padding: 4px 10px; min-width: 180px; max-width: 240px;
  border-radius: 6px;
  background: var(--bg-1); border: 1px solid var(--line-soft);
  color: var(--ink-3); font-size: 12px; cursor: pointer;
}
.search-trigger:hover { border-color: var(--ink-3); color: var(--ink-1); }
.search-trigger .ico { width: 13px; height: 13px; flex: none; }
.search-trigger .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.search-trigger .placeholder { flex: 1; }
.search-trigger kbd {
  background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line-soft);
  border-radius: 3px; padding: 0 4px; font-family: var(--font-mono); font-size: 10px;
}

/* Search overlay (Cmd+K modal) */
.search-overlay {
  position: fixed; inset: 0;
  background: oklch(0% 0 0 / 0.55);
  z-index: 80;
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.search-overlay.open { display: flex; }
.search-overlay .search-modal {
  width: 640px; max-width: 92vw;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-high);
  overflow: hidden;
}
.search-overlay .search-input {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--line-soft);
}
.search-overlay .search-input input {
  flex: 1; background: transparent; border: 0; color: var(--ink-0);
  font: inherit; font-size: 15px; outline: none;
}
.search-overlay .search-input .ico { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.search-overlay .search-input .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.search-overlay .search-input kbd {
  background: var(--bg-2); color: var(--ink-3); border: 1px solid var(--line-soft);
  border-radius: 3px; padding: 1px 5px; font-family: var(--font-mono); font-size: 10px;
}
.search-overlay .search-body {
  max-height: 48vh; overflow-y: auto;
  padding: var(--space-sm) 0;
}
.search-overlay .search-cat {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); padding: var(--space-sm) var(--space-md) 4px;
  font-weight: 600;
}
.search-overlay .search-row {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 6px var(--space-md);
  cursor: pointer; font-size: 13px; color: var(--ink-1);
}
.search-overlay .search-row:hover, .search-overlay .search-row.active {
  background: var(--bg-2);
  color: var(--ink-0);
}
.search-overlay .search-row .ico { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.search-overlay .search-row .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.search-overlay .search-row .meta { margin-left: auto; font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); }

/* ── Generic card atom (basic surface з border + bg + radius) ── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-md) var(--space-lg);
}
.card .card-h {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.card .card-h h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-0);
}
.card .card-h .hint {
  font-size: 11px;
  color: var(--ink-3);
}

/* ── User avatar з dropdown menu (R5 Йолт feedback) ── */
.tb-user {
  position: relative;
  display: inline-flex; align-items: center;
  cursor: pointer;
}
.tb-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), color-mix(in oklch, var(--brand) 50%, oklch(0.66 0.22 280)));
  color: oklch(0.16 0.005 70);
  font-family: var(--font-mono);
  font-weight: 700; font-size: 11px;
  letter-spacing: 0.04em;
  border: 1px solid color-mix(in oklch, var(--brand) 40%, var(--line));
  transition: transform 0.14s, box-shadow 0.14s;
}
.tb-user:hover .tb-user-avatar { transform: scale(1.05); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 20%, transparent); }
.tb-user-menu {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  width: 280px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-high);
  padding: 4px;
  z-index: 50;
  opacity: 0; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.14s, transform 0.14s;
}
.tb-user:hover .tb-user-menu,
.tb-user.open .tb-user-menu { opacity: 1; pointer-events: auto; transform: translateY(0); }
.tb-user-h {
  display: flex; gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--line-soft);
}
.tb-user-av-big {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), color-mix(in oklch, var(--brand) 50%, oklch(0.66 0.22 280)));
  color: oklch(0.16 0.005 70);
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  flex: none;
}
.tb-user-name { font-size: 13px; font-weight: 600; color: var(--ink-0); }
.tb-user-email { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); margin-top: 2px; }
.tb-user-row {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 8px var(--space-md);
  font-size: 12.5px; color: var(--ink-1);
  border-radius: var(--r-sm);
  cursor: pointer;
  background: transparent; border: 0;
  width: 100%; text-align: left;
  text-decoration: none;
}
.tb-user-row .ico { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.tb-user-row .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.tb-user-row:hover { background: var(--bg-2); color: var(--ink-0); }
.tb-user-row .val {
  margin-left: auto;
  display: inline-flex; gap: 2px; align-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-2);
}
.tb-user-row .val .opt {
  padding: 1px 6px; border-radius: 3px;
  background: var(--bg-2); cursor: pointer;
}
.tb-user-row .val .opt.on { background: var(--bg-3); color: var(--brand); }
.tb-user-row.danger { color: var(--bad); border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 10px; }
.tb-user-row.danger .ico { color: var(--bad); }
.tb-user-row.danger:hover { background: color-mix(in oklch, var(--bad) 12%, var(--bg-2)); }

/* ── Merged date range pill (single block з dropdown) ── */
.tb-date-merged {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  padding: 5px 10px;
  background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-1);
  cursor: pointer;
  position: relative;
}
.tb-date-merged:hover { border-color: var(--ink-3); }
.tb-date-merged .ico { width: 14px; height: 14px; color: var(--ink-3); }
.tb-date-merged .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; }
.tb-date-merged .lbl { color: var(--ink-3); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.tb-date-merged .range { color: var(--ink-0); font-weight: 600; }
.tb-date-merged .caret { color: var(--ink-3); width: 12px; height: 12px; }
.tb-date-merged .caret svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.tb-date-popover {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  width: 500px;            /* wider per Йолт final +80px (was 420) */
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-high);
  padding: var(--space-md);
  z-index: 60;
  display: none;
}
.tb-date-merged.open .tb-date-popover { display: block; }
.tb-date-popover .presets {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}
.tb-date-popover .presets button {
  background: var(--bg-2); border: 1px solid var(--line-soft);
  color: var(--ink-1); padding: 4px 10px; border-radius: 4px;
  font-size: 11px; font-family: var(--font-mono); cursor: pointer;
}
.tb-date-popover .presets button.on { background: var(--brand); color: var(--bg-0); border-color: transparent; }
.tb-date-popover .row {
  display: flex; gap: var(--space-sm); margin-bottom: var(--space-sm);
}
.tb-date-popover .row .field { flex: 1; }
.tb-date-popover label { display: block; font-size: 10px; text-transform: uppercase; color: var(--ink-3); letter-spacing: 0.06em; margin-bottom: 4px; }
.tb-date-popover input[type="date"] {
  width: 100%;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  color: var(--ink-0); padding: 6px 8px; border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 12px;
}
.tb-date-popover .foot { display: flex; gap: var(--space-sm); justify-content: flex-end; margin-top: var(--space-sm); }

/* ── FAB filter panel v2 — categorized grid layout ── */
.drawer-side.fab-v2 { width: 520px; max-width: 96vw; }
.fab-v2 .drawer-h { padding: var(--space-md) var(--space-md) var(--space-xs); }
.fab-v2 .filter-search {
  width: 100%; padding: 8px var(--space-sm);
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  color: var(--ink-0); font-family: inherit; font-size: 12.5px;
  margin: var(--space-xs) var(--space-md) var(--space-sm);
  width: calc(100% - 2 * var(--space-md));
}
.fab-v2 .filter-cats {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 0 var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--line-soft);
}
.fab-v2 .filter-cats .cat-tab {
  background: transparent;
  border: 0;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px; color: var(--ink-2);
  cursor: pointer;
  display: inline-flex; gap: 4px; align-items: center;
}
.fab-v2 .filter-cats .cat-tab .n { font-size: 9.5px; color: var(--ink-3); background: var(--bg-3); padding: 0 5px; border-radius: 8px; font-family: var(--font-mono); }
.fab-v2 .filter-cats .cat-tab.on { background: var(--bg-2); color: var(--brand); }
.fab-v2 .filter-cats .cat-tab.on .n { background: color-mix(in oklch, var(--brand) 22%, var(--bg-2)); color: var(--brand); }
.fab-v2 .filter-body { overflow-y: auto; flex: 1; padding: var(--space-md); }
.fab-v2 .filter-cat-h {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 600;
  margin: var(--space-md) 0 var(--space-xs);
}
.fab-v2 .filter-cat-h:first-child { margin-top: 0; }
.fab-v2 .filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}
.fab-v2 .filter-cell {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  display: flex; flex-direction: column; gap: 3px;
  cursor: pointer;
  position: relative;
}
.fab-v2 .filter-cell:hover { border-color: var(--ink-3); }
.fab-v2 .filter-cell.has-value { border-color: color-mix(in oklch, var(--brand) 40%, var(--line)); background: color-mix(in oklch, var(--brand) 6%, var(--bg-1)); }
.fab-v2 .filter-cell .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.fab-v2 .filter-cell .v {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--ink-1);
  font-family: inherit;
}
.fab-v2 .filter-cell .v.placeholder { color: var(--ink-3); }
.fab-v2 .filter-cell .v .caret { margin-left: auto; color: var(--ink-3); width: 10px; height: 10px; }
.fab-v2 .filter-cell .v .caret svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.fab-v2 .filter-cell .count {
  position: absolute; top: 4px; right: 6px;
  background: var(--brand); color: var(--bg-0);
  font-size: 9.5px; padding: 1px 5px;
  border-radius: 8px; font-family: var(--font-mono); font-weight: 600;
  min-width: 16px; text-align: center;
}
.fab-v2 .filter-cascade {
  display: flex; flex-direction: column; gap: var(--space-xs);
  background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: var(--space-sm);
}
.fab-v2 .filter-cascade .cas-row { display: flex; align-items: center; gap: var(--space-sm); }
.fab-v2 .filter-cascade .cas-row label { font-size: 10px; min-width: 24px; color: var(--ink-3); font-family: var(--font-mono); }
.fab-v2 .filter-cascade .cas-row select {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line-soft);
  color: var(--ink-0); padding: 4px 8px; border-radius: var(--r-sm);
  font-family: inherit; font-size: 12px;
}

/* ── Custom select dropdown (filter-select) — наш стиль, не браузерний ── */
.fs-select {
  position: relative;
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 5px 8px;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  color: var(--ink-0); font-size: 12px;
  cursor: pointer; user-select: none;
  flex: 1; min-width: 0;
}
.fs-select:hover { border-color: var(--ink-3); }
.fs-select.open { border-color: var(--brand); }
.fs-select .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-select .placeholder { color: var(--ink-3); }
.fs-select .caret { width: 12px; height: 12px; color: var(--ink-3); flex: none; }
.fs-select .caret svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.fs-select .fs-menu {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-mid);
  padding: 4px;
  z-index: 60;
  display: none;
  max-height: 240px;
  overflow-y: auto;
}
.fs-select.open .fs-menu { display: block; }
.fs-select .fs-row {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 6px var(--space-sm); border-radius: 3px;
  cursor: pointer; font-size: 12px; color: var(--ink-1);
}
.fs-select .fs-row:hover { background: var(--bg-2); color: var(--ink-0); }
.fs-select .fs-row.active { color: var(--ink-0); }
.fs-select .fs-row .check { margin-left: auto; color: var(--brand); opacity: 0; width: 13px; height: 13px; }
.fs-select .fs-row .check svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; }
.fs-select .fs-row.active .check { opacity: 1; }
.fs-select .fs-divider { height: 1px; background: var(--line-soft); margin: 4px 0; }

/* ── Inline visual calendar (2-month range view) ── */
.cal-block {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md);
  margin: var(--space-md) 0;
}
.cal-month {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: var(--space-sm);
}
.cal-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-0);
  font-family: var(--font);
}
.cal-h button {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-soft);
  border-radius: 3px; color: var(--ink-3); cursor: pointer;
}
.cal-h button:hover { color: var(--ink-0); border-color: var(--ink-3); }
.cal-h button svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.cal-grid .dow {
  font-size: 9px; color: var(--ink-3); text-align: center;
  padding: 4px 0; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em;
}
.cal-grid .d {
  text-align: center; padding: 5px 0;
  font-size: 11px; font-family: var(--font-mono);
  color: var(--ink-1);
  border-radius: 3px;
  cursor: pointer;
}
.cal-grid .d:hover:not(.off) { background: var(--bg-3); }
.cal-grid .d.off { color: var(--ink-4); cursor: default; }
.cal-grid .d.today { border: 1px dashed color-mix(in oklch, var(--brand) 50%, transparent); }
.cal-grid .d.in-range {
  background: color-mix(in oklch, var(--brand) 18%, transparent);
  color: var(--ink-0);
  border-radius: 0;
}
.cal-grid .d.selected {
  background: var(--brand); color: var(--bg-0); font-weight: 600;
}
.cal-grid .d.selected.start { border-radius: 3px 0 0 3px; }
.cal-grid .d.selected.end { border-radius: 0 3px 3px 0; }
.cal-grid .d.selected.single { border-radius: 3px; }
.fab-v2 .drawer-foot { padding: var(--space-md); border-top: 1px solid var(--line-soft); display: flex; gap: var(--space-sm); align-items: center; }
.fab-v2 .drawer-foot .summary { font-size: 11px; color: var(--ink-3); margin-right: auto; }
.fab-v2 .drawer-foot .summary b { color: var(--brand); }

/* ── Sidebar collapse (compact mode + hover flyouts) ── */
.sidebar { transition: width 0.22s ease; }
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .sb-brand { padding: var(--space-md) 8px; justify-content: center; }
.sidebar.collapsed .sb-brand .name-block,
.sidebar.collapsed .sb-brand .version,
.sidebar.collapsed .sb-group,
.sidebar.collapsed .sb-item .label,
.sidebar.collapsed .sb-item .sb-tag,
.sidebar.collapsed .sb-item .count,
.sidebar.collapsed .sb-item .sb-pin,
.sidebar.collapsed .sb-item .pro,
.sidebar.collapsed .sb-foot .label,
.sidebar.collapsed .sb-foot .meta,
.sidebar.collapsed .sb-help-link .label,
.sidebar.collapsed .sb-logout .label { display: none; }
.sidebar.collapsed .sb-item {
  justify-content: center;
  padding: 8px 0;
  position: relative;
}
.sidebar.collapsed .sb-item .ico { margin: 0; }
.sidebar.collapsed .sb-foot { padding: var(--space-xs) 6px; }
.sidebar.collapsed .sb-foot .sb-item,
.sidebar.collapsed .sb-foot .sb-logout,
.sidebar.collapsed .sb-foot .sb-help-link {
  padding: 8px 0; justify-content: center;
}
/* Flyout tooltip on hover */
.sidebar.collapsed .sb-item:hover::after {
  content: attr(data-flyout);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-0);
  white-space: nowrap;
  box-shadow: var(--shadow-mid);
  z-index: 60;
  pointer-events: none;
}
/* Collapse toggle button */
.sb-collapse-btn {
  position: absolute;
  bottom: 16px; right: -14px;
  width: 28px; height: 28px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-3);
  cursor: pointer;
  z-index: 11;
  transition: transform 0.22s, color 0.14s;
  box-shadow: var(--shadow-low);
}
.sb-collapse-btn:hover { color: var(--brand); border-color: var(--brand); }
.sb-collapse-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.sidebar.collapsed .sb-collapse-btn { transform: rotate(180deg); }

/* G4 — Notifications inbox trigger + tray */
.notifications-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: 6px; color: var(--ink-2); cursor: pointer;
}
.notifications-btn:hover { color: var(--ink-0); border-color: var(--ink-3); }
.notifications-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.notifications-btn .nb-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--bad); color: oklch(0.98 0 0);
  font-size: 9.5px; font-family: var(--font-mono); font-weight: 600;
  border-radius: 9px; display: grid; place-items: center;
  border: 2px solid var(--bg-0);
}
.notifications-tray {
  position: fixed; top: 60px; right: 16px;
  width: 360px; max-height: 70vh;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-high);
  z-index: 70;
  display: none; flex-direction: column;
  overflow: hidden;
}
.notifications-tray.open { display: flex; }
.notifications-tray .nt-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--line-soft);
}
.notifications-tray .nt-h h3 { margin: 0; font-size: 13px; color: var(--ink-0); }
.notifications-tray .nt-h .mark-read {
  font-size: 11px; color: var(--brand); background: transparent; border: 0; cursor: pointer;
}
.notifications-tray .nt-body { overflow-y: auto; flex: 1; }
.notifications-tray .nt-row {
  display: flex; gap: var(--space-sm); padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--line-soft); cursor: pointer; align-items: flex-start;
}
.notifications-tray .nt-row:hover { background: var(--bg-2); }
.notifications-tray .nt-row.unread { background: color-mix(in oklch, var(--brand) 4%, transparent); }
.notifications-tray .nt-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 5px; flex: none; }
.notifications-tray .nt-row.read .dot { background: var(--ink-4); }
.notifications-tray .nt-row .body { flex: 1; }
.notifications-tray .nt-row .title { font-size: 12.5px; font-weight: 500; color: var(--ink-0); }
.notifications-tray .nt-row .text { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.notifications-tray .nt-row .when { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); margin-top: 4px; }
.notifications-tray .nt-foot {
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--line-soft);
  text-align: center; font-size: 11px; color: var(--ink-3);
}
.notifications-tray .nt-foot a { color: var(--brand); }
.sb-foot .meta {
  padding: var(--space-xs) var(--space-md);
  font-size: 10px;
  color: var(--ink-4);
  line-height: 1.4;
}

/* ════════════ MAIN ════════════ */
.main { flex: 1 1 auto !important; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: auto; width: auto; }

/* ─── Top filter bar (sticky) ─── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in oklch, var(--bg-0) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  gap: 6px; /* per Йолт R3.2 — +2px між кнопками щоб дихали */
  flex-wrap: wrap;
}
.tb-group { display: flex; align-items: center; gap: var(--space-xs); }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 var(--space-xs); }
.tb-spacer { flex: 1; }

.tb-date-input {
  display: flex; align-items: center; gap: var(--space-xs);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 4px var(--space-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-1);
  height: 28px;
  cursor: pointer;
  transition: border-color 0.12s;
  position: relative;
}
.tb-date-input:hover { border-color: var(--ink-3); }
.tb-date-input.is-focus { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in oklch, var(--brand) 22%, transparent); }
.tb-date-input .lbl { color: var(--ink-3); font-size: 10px; }
.tb-date-input .ico { width: 12px; height: 12px; color: var(--ink-3); }
.tb-date-input .ico svg { width: 100%; height: 100%; }

/* Calendar popover — opens below the first .tb-date-input */
.calendar-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-high);
  padding: var(--space-md);
  z-index: 40;
  display: none;
  min-width: 560px;
}
.calendar-pop.open { display: block; }
.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.cal-presets {
  display: flex; gap: var(--space-xs);
  flex-wrap: wrap;
}
.cal-preset {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  padding: 3px var(--space-sm);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.cal-preset:hover { color: var(--ink-0); border-color: var(--ink-3); }
.cal-preset.on { background: color-mix(in oklch, var(--brand) 18%, var(--bg-2)); border-color: color-mix(in oklch, var(--brand) 38%, var(--line)); color: var(--brand); }

.cal-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.cal-month .m-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-xs);
}
.cal-month .m-h .title { font-size: 12.5px; font-weight: 600; color: var(--ink-0); font-family: var(--font); }
.cal-month .m-h .nav {
  width: 20px; height: 20px;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--ink-2);
  cursor: pointer;
}
.cal-month .m-h .nav:hover { background: var(--bg-3); color: var(--ink-0); }
.cal-month .m-h .nav svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.cal-dh {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-align: center;
  color: var(--ink-3);
  padding: 3px 0;
  text-transform: uppercase;
}
.cal-day {
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  padding: 5px 0;
  color: var(--ink-1);
  border-radius: 3px;
  cursor: pointer;
  background: transparent;
  border: 0;
  transition: background 0.12s, color 0.12s;
}
.cal-day:hover { background: var(--bg-2); color: var(--ink-0); }
.cal-day.muted { color: var(--ink-4); }
.cal-day.in-range { background: color-mix(in oklch, var(--brand) 14%, var(--bg-1)); color: var(--ink-0); }
.cal-day.range-start, .cal-day.range-end {
  background: var(--brand);
  color: var(--bg-0);
  font-weight: 600;
}
.cal-day.today { box-shadow: inset 0 0 0 1px var(--brand); }

.cal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--line-soft);
}
.cal-foot .summary { font-size: 11.5px; color: var(--ink-2); font-family: var(--font-mono); }
.cal-foot .summary b { color: var(--ink-0); }
.cal-foot .actions { display: flex; gap: var(--space-xs); }

.tb-seg {
  display: inline-flex;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 2px;
  height: 28px;
}
.tb-tab {
  background: transparent;
  border: 0;
  padding: 3px var(--space-sm);
  border-radius: 3px;
  color: var(--ink-2);
  font-size: 11px;
  font-family: var(--font-mono);
  transition: color 0.12s, background 0.12s;
}
.tb-tab:hover { color: var(--ink-1); }
.tb-tab.on {
  background: var(--bg-3);
  color: var(--brand);
}

.tb-pill {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  padding: 4px var(--space-sm);
  border-radius: var(--r-sm);
  font-size: 11.5px;
  color: var(--ink-1);
  height: 28px;
  transition: border-color 0.12s, color 0.12s;
}
.tb-pill:hover { border-color: var(--ink-3); color: var(--ink-0); }
.tb-pill .ico { width: 12px; height: 12px; color: var(--ink-2); }
.tb-pill .ico svg { width: 100%; height: 100%; }
.tb-pill.ai {
  background: color-mix(in oklch, var(--brand) 18%, var(--bg-1));
  border-color: color-mix(in oklch, var(--brand) 40%, var(--line));
  color: var(--brand);
}
.tb-pill.ai .ico { color: var(--brand); }
.tb-pill.plus {
  background: linear-gradient(135deg, color-mix(in oklch, var(--brand) 18%, var(--bg-1)) 0%, color-mix(in oklch, var(--info) 18%, var(--bg-1)) 100%);
  border-color: color-mix(in oklch, var(--brand) 35%, var(--line));
  color: var(--ink-0);
  font-weight: 500;
}
.tb-pill.demo {
  background: color-mix(in oklch, var(--warn) 22%, var(--bg-1));
  border-color: color-mix(in oklch, var(--warn) 45%, var(--line));
  color: var(--warn);
}
.tb-link {
  font-size: 11.5px;
  color: var(--ink-2);
  padding: 4px var(--space-sm);
  border-radius: var(--r-sm);
  transition: color 0.12s, background 0.12s;
}
.tb-link:hover { color: var(--ink-0); }
.tb-link.danger {
  color: var(--bad);
  background: color-mix(in oklch, var(--bad) 10%, transparent);
  border: 1px solid color-mix(in oklch, var(--bad) 30%, transparent);
}
.tb-link.danger:hover {
  color: oklch(0.96 0.005 80);
  background: color-mix(in oklch, var(--bad) 50%, var(--bg-2));
  border-color: var(--bad);
}

/* Compact dropdown for lang/currency — saves horizontal space */
.tb-dropdown {
  position: relative;
  display: inline-flex; align-items: center; gap: var(--space-xs);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 4px var(--space-sm);
  font-size: 11.5px;
  color: var(--ink-1);
  font-family: var(--font-mono);
  height: 28px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.tb-dropdown:hover { border-color: var(--ink-3); color: var(--ink-0); }
.tb-dropdown .lbl { color: var(--ink-3); font-size: 10px; }
.tb-dropdown .cur { color: var(--brand); font-weight: 600; }
.tb-dropdown .caret {
  display: inline-block; width: 10px; height: 10px;
  color: var(--ink-3);
}
.tb-dropdown .caret svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.tb-dropdown .menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-mid);
  padding: 4px;
  z-index: 30;
  display: none;
  white-space: nowrap;
}
.tb-dropdown.open .menu { display: block; }
.tb-dropdown .menu .opt {
  display: block;
  padding: 4px var(--space-sm);
  border-radius: 3px;
  color: var(--ink-1);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.tb-dropdown .menu .opt:hover { background: var(--bg-2); color: var(--ink-0); }
.tb-dropdown .menu .opt.on { background: color-mix(in oklch, var(--brand) 18%, var(--bg-2)); color: var(--brand); }
.tb-iconbtn {
  width: 28px; height: 28px;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--ink-2);
}
.tb-iconbtn:hover { color: var(--ink-0); border-color: var(--ink-3); }
.tb-iconbtn svg { width: 14px; height: 14px; }

/* ─── Breadcrumb + active filters ─── */
.breadcrumb-row {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-2);
  flex-wrap: wrap;
}
.crumb { color: var(--ink-2); }
.crumb.active { color: var(--ink-0); font-weight: 500; }
.crumb-sep { color: var(--ink-4); margin: 0 var(--space-xs); }

.active-filters {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--space-xs);
  flex-wrap: wrap;
}
.af-label { color: var(--ink-3); font-size: 11px; }
.af-chip {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  background: color-mix(in oklch, var(--brand) 12%, var(--bg-1));
  border: 1px solid color-mix(in oklch, var(--brand) 26%, var(--line));
  color: var(--ink-1);
  padding: 1px var(--space-sm);
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.af-chip .x {
  color: var(--ink-3);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.af-chip .x:hover { color: var(--bad); }
.af-reset {
  color: var(--brand);
  font-size: 11px;
  cursor: pointer;
}
.af-reset:hover { text-decoration: underline; }

/* ─── Content + Section ─── */
.content { padding: var(--space-xl) var(--space-lg) 96px; max-width: var(--maxw); }
/* 96px bottom — clears FAB (52px + 24px offset + 20px breathing) */
.section { display: flex; flex-direction: column; gap: var(--space-md); margin-top: var(--space-xl); }
.section:first-child { margin-top: 0; }
.s-h {
  display: flex; align-items: baseline; gap: var(--space-md);
  flex-wrap: wrap;
}
.s-h h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink-0);
  display: inline-flex; align-items: center; gap: var(--space-sm);
}
.s-h h2 .ico { width: 18px; height: 18px; color: var(--brand); }
.s-h h2 .ico svg { width: 100%; height: 100%; }
.s-h .sub { font-size: 12px; color: var(--ink-2); }
.s-h .sub b { color: var(--ink-1); font-weight: 500; }
.s-h .meta {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

/* ═══════════════ ATOMS ═══════════════ */

/* ─── Tooltip ─── */
.q {
  display: inline-grid; place-items: center;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--ink-3);
  font-size: 11px;
  cursor: help;
  font-weight: 600;
  position: relative;
  vertical-align: middle;
  line-height: 1;
  flex: none;
}
.q:hover { background: var(--bg-2); color: var(--ink-0); }
.q::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  /* Anchor to right edge of icon so tooltip extends leftward — avoids overflow into neighboring cards */
  right: -4px;
  left: auto;
  transform: none;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--ink-1);
  font-family: var(--font);
  font-weight: 400;
  font-size: 11.5px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--r-sm);
  white-space: pre-line;
  width: max-content;
  max-width: 220px;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s;
  z-index: 50;
  box-shadow: var(--shadow-mid);
  line-height: 1.5;
}
.q:hover::after { opacity: 1; }
/* Variant: anchor left (use on tooltips near left edge of viewport) */
.q.tip-left::after { right: auto; left: -4px; }

/* ─── Tone pills (.t-good / .t-warn / .t-bad / .t-info / .t-brand / .t-neutral) ─── */
.pill-tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 var(--space-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid;
}
.t-good    { background: color-mix(in oklch, var(--good) 16%, var(--bg-2)); color: var(--good); border-color: color-mix(in oklch, var(--good) 32%, var(--line)); }
.t-warn    { background: color-mix(in oklch, var(--warn) 16%, var(--bg-2)); color: var(--warn); border-color: color-mix(in oklch, var(--warn) 32%, var(--line)); }
.t-bad     { background: color-mix(in oklch, var(--bad)  16%, var(--bg-2)); color: var(--bad);  border-color: color-mix(in oklch, var(--bad)  32%, var(--line)); }
.t-info    { background: color-mix(in oklch, var(--info) 16%, var(--bg-2)); color: var(--info); border-color: color-mix(in oklch, var(--info) 32%, var(--line)); }
.t-brand   { background: color-mix(in oklch, var(--brand) 16%, var(--bg-2)); color: var(--brand); border-color: color-mix(in oklch, var(--brand) 32%, var(--line)); }
.t-neutral { background: var(--bg-3); color: var(--ink-2); border-color: var(--line); }

/* ─── alert-inline (compact info pill) ─── */
.alert-inline {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: 4px var(--space-sm);
  border-radius: var(--r-sm);
  border: 1px solid;
  font-size: 11.5px;
  color: var(--ink-1);
}
.alert-inline svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.alert-inline.t-info { color: var(--info); border-color: color-mix(in oklch, var(--info) 35%, var(--line)); background: color-mix(in oklch, var(--info) 8%, var(--bg-1)); }
.alert-inline.t-warn { color: var(--warn); border-color: color-mix(in oklch, var(--warn) 35%, var(--line)); background: color-mix(in oklch, var(--warn) 8%, var(--bg-1)); }
.alert-inline.t-bad  { color: var(--bad);  border-color: color-mix(in oklch, var(--bad)  35%, var(--line)); background: color-mix(in oklch, var(--bad)  8%, var(--bg-1)); }
.alert-inline.t-good { color: var(--good); border-color: color-mix(in oklch, var(--good) 35%, var(--line)); background: color-mix(in oklch, var(--good) 8%, var(--bg-1)); }

/* ─── Banner page-top (full-width hint with dismiss) ─── */
.banner-page-top {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid;
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--ink-1);
  font-size: 12px;
}
.banner-page-top .ico { width: 16px; height: 16px; flex: none; }
.banner-page-top .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; }
.banner-page-top .body { flex: 1; color: var(--ink-1); }
.banner-page-top .body b { color: var(--ink-0); }
.banner-page-top .cta {
  font-size: 11.5px;
  color: currentColor;
  border: 1px solid currentColor;
  padding: 3px var(--space-sm);
  border-radius: var(--r-sm);
}
.banner-page-top .cta:hover { background: color-mix(in oklch, currentColor 12%, transparent); }
.banner-page-top .dismiss { color: var(--ink-3); font-size: 16px; padding: 0; line-height: 1; }
.banner-page-top .dismiss:hover { color: var(--ink-0); }
.banner-page-top.t-info { background: color-mix(in oklch, var(--info) 8%, var(--bg-1)); border-color: color-mix(in oklch, var(--info) 30%, var(--line)); }
.banner-page-top.t-warn { background: color-mix(in oklch, var(--warn) 8%, var(--bg-1)); border-color: color-mix(in oklch, var(--warn) 30%, var(--line)); }
.banner-page-top.t-bad  { background: color-mix(in oklch, var(--bad)  8%, var(--bg-1)); border-color: color-mix(in oklch, var(--bad)  30%, var(--line)); }
.banner-page-top.t-good { background: color-mix(in oklch, var(--good) 8%, var(--bg-1)); border-color: color-mix(in oklch, var(--good) 30%, var(--line)); }
.banner-page-top.t-info .body, .banner-page-top.t-info .ico { color: var(--info); }
.banner-page-top.t-info .body b { color: var(--info); }
.banner-page-top.t-warn .body, .banner-page-top.t-warn .ico { color: var(--warn); }
.banner-page-top.t-warn .body b { color: var(--warn); }
.banner-page-top.t-good .body, .banner-page-top.t-good .ico { color: var(--good); }
.banner-page-top.t-good .body b { color: var(--good); }

/* ─── Page-help banner (dismissible) ─── */
.page-help {
  display: flex; align-items: flex-start; gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: color-mix(in oklch, var(--brand) 8%, var(--bg-2));
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
}
.page-help .ico { width: 16px; height: 16px; flex: none; color: var(--brand); }
.page-help .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.5; }
.page-help .body { flex: 1; font-size: 12px; color: var(--ink-1); line-height: 1.55; }
.page-help .body b { color: var(--ink-0); margin-right: var(--space-xs); }
.page-help .dismiss { color: var(--ink-3); font-size: 16px; line-height: 1; padding: 0; }
.page-help .dismiss:hover { color: var(--ink-0); }

/* ─── Pulse / freshness indicator ─── */
.pulse {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--good);
  padding: 2px var(--space-sm);
  border-radius: 999px;
  background: color-mix(in oklch, var(--good) 14%, transparent);
}
.pulse::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 4px currentColor;
  animation: pulse-blink 2s infinite;
}
@keyframes pulse-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.pulse.bad { color: var(--bad); background: color-mix(in oklch, var(--bad) 14%, transparent); }
.pulse.warn { color: var(--warn); background: color-mix(in oklch, var(--warn) 14%, transparent); }

/* ─── status-pill (s-won / s-lost / etc) ─── */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px var(--space-sm);
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid;
}
.status-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.s-good    { background: color-mix(in oklch, var(--good) 18%, var(--bg-2)); color: var(--good); border-color: color-mix(in oklch, var(--good) 35%, var(--line)); }
.status-pill.s-warn    { background: color-mix(in oklch, var(--warn) 18%, var(--bg-2)); color: var(--warn); border-color: color-mix(in oklch, var(--warn) 35%, var(--line)); }
.status-pill.s-bad     { background: color-mix(in oklch, var(--bad)  18%, var(--bg-2)); color: var(--bad);  border-color: color-mix(in oklch, var(--bad)  35%, var(--line)); }
.status-pill.s-info    { background: color-mix(in oklch, var(--info) 18%, var(--bg-2)); color: var(--info); border-color: color-mix(in oklch, var(--info) 35%, var(--line)); }
.status-pill.s-neutral { background: var(--bg-3); color: var(--ink-2); border-color: var(--line); }

/* ═══════════════ HERO ═══════════════ */
.hero { display: flex; flex-direction: column; gap: var(--space-md); }
.hero-h {
  display: flex; align-items: center; gap: var(--space-md);
  flex-wrap: wrap;
}
.hero-h h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink-0);
}
.hero-h h1 .me { color: var(--brand); }

/* Page-level pin button — toggles current page into sidebar Pinned section */
.page-pin {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  color: var(--ink-3);
  display: inline-grid; place-items: center;
  cursor: pointer;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  vertical-align: middle;
  margin-left: var(--space-xs);
}
.page-pin svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.page-pin:hover { background: var(--bg-2); color: var(--ink-1); border-color: var(--ink-3); }
.page-pin.on {
  color: var(--brand);
  border-color: color-mix(in oklch, var(--brand) 35%, var(--line));
  background: color-mix(in oklch, var(--brand) 12%, var(--bg-1));
}
.page-pin.on svg { fill: currentColor; }
.page-pin .lbl {
  font-size: 0;
  position: absolute;
  pointer-events: none;
}

/* ═══════════════ SCORECARD-COMPOUND (hero cards) ═══════════════ */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.scorecard-compound {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  box-shadow: var(--shadow-low);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  position: relative;
  min-height: 192px;
}
.scorecard-compound:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-mid);
}
.scorecard-compound.bad,
.scorecard-compound[data-tone="expense"] {
  border-left: 3px solid color-mix(in oklch, var(--bad) 38%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklch, var(--bad) 5%, var(--bg-1)) 0%, var(--bg-1) 70%);
}
.scorecard-compound.warn {
  border-left: 3px solid color-mix(in oklch, var(--warn) 38%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklch, var(--warn) 5%, var(--bg-1)) 0%, var(--bg-1) 70%);
}
.scorecard-compound.good,
.scorecard-compound[data-tone="revenue"] {
  border-left: 3px solid color-mix(in oklch, var(--good) 38%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklch, var(--good) 5%, var(--bg-1)) 0%, var(--bg-1) 70%);
}
.scorecard-compound.brand,
.scorecard-compound.featured {
  border-left: 3px solid color-mix(in oklch, var(--brand) 45%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklch, var(--brand) 6%, var(--bg-1)) 0%, var(--bg-1) 70%);
}

.sc-head {
  display: flex; align-items: center; gap: var(--space-sm);
}
.sc-ico {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  color: var(--ink-2);
  display: grid; place-items: center;
  flex: none;
}
.sc-ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.scorecard-compound.bad .sc-ico   { background: color-mix(in oklch, var(--bad)   16%, var(--bg-2)); color: var(--bad);   }
.scorecard-compound.warn .sc-ico  { background: color-mix(in oklch, var(--warn)  16%, var(--bg-2)); color: var(--warn);  }
.scorecard-compound.good .sc-ico  { background: color-mix(in oklch, var(--good)  16%, var(--bg-2)); color: var(--good);  }
.scorecard-compound.brand .sc-ico,
.scorecard-compound.featured .sc-ico { background: color-mix(in oklch, var(--brand) 18%, var(--bg-2)); color: var(--brand); }

.sc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -0.005em;
}
.sc-meta {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: var(--space-xs);
}
.sc-pill {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.sc-big {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 36px;
  letter-spacing: -0.03em;
  color: var(--ink-0);
  line-height: 1;
  margin-top: var(--space-xs);
}
.sc-big .unit { font-size: 18px; color: var(--ink-2); margin-left: 2px; }
/* XL modifier — for hero AI summary / top-of-page emphasis numbers */
.sc-big.xl {
  font-size: 56px;
  letter-spacing: -0.035em;
  margin-top: var(--space-sm);
}
.sc-big.xl .unit { font-size: 26px; }
.scorecard-compound.bad  .sc-big { color: var(--bad);  }
.scorecard-compound.warn .sc-big { color: var(--warn); }
.scorecard-compound.good .sc-big { color: var(--good); }
.scorecard-compound.brand .sc-big,
.scorecard-compound.featured .sc-big { color: var(--brand); }

.sc-spark { display: block; height: 28px; opacity: 0.9; }

.sc-body {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.55;
}
.sc-body b { color: var(--ink-0); font-weight: 600; }

.sc-cta {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: var(--space-xs);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 500;
  padding: 2px 0;
  position: relative;
}
.sc-cta::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}
.sc-cta:hover::after { transform: scaleX(1); }
.sc-cta .arr { transition: transform 0.16s; }
.sc-cta:hover .arr { transform: translateX(3px); }

/* ═══════════ KPI scoreboard ═══════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}
.kpi {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  position: relative;
  min-height: 184px;
}
.kpi[data-tone="revenue"] { border-left: 3px solid color-mix(in oklch, var(--good) 35%, var(--line)); }
.kpi[data-tone="revenue"] .big { color: var(--good); }
.kpi[data-tone="profit"]  { border-left: 3px solid color-mix(in oklch, var(--brand) 35%, var(--line)); }
.kpi[data-tone="profit"]  .big { color: var(--brand); }
.kpi[data-tone="expense"] { border-left: 3px solid color-mix(in oklch, var(--bad) 35%, var(--line)); }
.kpi[data-tone="expense"] .big { color: var(--bad); }
.kpi.featured {
  border-color: color-mix(in oklch, var(--brand) 35%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklch, var(--brand) 6%, var(--bg-1)) 0%, var(--bg-1) 70%);
  box-shadow: 0 0 24px -8px color-mix(in oklch, var(--brand) 50%, transparent);
}

.kpi .head {
  display: flex; align-items: center; gap: var(--space-xs);
}
.kpi .head .ico { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.kpi .head .ico svg { width: 100%; height: 100%; }
.kpi .head .title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  font-weight: 600;
}
.kpi .head .mode-tag {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px var(--space-sm);
  border-radius: 999px;
  background: color-mix(in oklch, var(--warn) 18%, var(--bg-2));
  color: var(--warn);
  letter-spacing: 0.02em;
}
.kpi .head .mode-tag.real {
  background: color-mix(in oklch, var(--brand) 18%, var(--bg-2));
  color: var(--brand);
}
.kpi .big-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-sm);
}
.kpi .big {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.025em;
  color: var(--ink-0);
  line-height: 1;
}
.kpi .big .unit { font-size: 16px; color: var(--ink-2); margin-left: 2px; }
.kpi .spark {
  flex: none;
  width: 76px; height: 24px;
  opacity: 0.9;
  display: block;
}
.kpi .modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  padding: 2px;
  margin-top: var(--space-xs);
}
.kpi .modes .m {
  padding: var(--space-xs) var(--space-sm);
  border-radius: 3px;
  display: flex; flex-direction: column; gap: 1px;
  cursor: pointer;
  transition: background 0.12s;
  border: 0;
  text-align: left;
}
.kpi .modes .m:hover { background: var(--bg-3); }
.kpi .modes .m .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
}
.kpi .modes .m .v {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-1);
  font-weight: 500;
}
.kpi .modes .m.on { background: var(--bg-3); }
.kpi .modes .m.on .v { color: var(--ink-0); }
.kpi .modes .m.on .lbl { color: var(--brand); }
.kpi .delta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  align-self: flex-start;
  padding: 2px var(--space-sm);
  border-radius: var(--r-sm);
}
.kpi .delta.up   { color: var(--good); background: color-mix(in oklch, var(--good) 14%, transparent); }
.kpi .delta.down { color: var(--bad);  background: color-mix(in oklch, var(--bad)  14%, transparent); }
.kpi .delta.flat { color: var(--ink-3); background: var(--bg-2); }

/* ═══════════ Net Profit summary row ═══════════ */
.net-row {
  display: flex; align-items: baseline; gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-left: 3px solid color-mix(in oklch, var(--good) 35%, var(--line));
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.net-row .lbl { color: var(--ink-2); font-size: 12px; }
.net-row .val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-0);
  letter-spacing: -0.02em;
}
.net-row .val.accent { color: var(--good); }
.net-row .arr { color: var(--ink-3); font-size: 14px; padding: 0 var(--space-xs); }
.net-row .delta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 2px var(--space-sm);
  border-radius: var(--r-sm);
  background: color-mix(in oklch, var(--good) 14%, transparent);
  color: var(--good);
  font-weight: 600;
}
.net-row .show-all {
  margin-left: auto;
  font-size: 12px;
  color: var(--brand);
  display: inline-flex; align-items: center; gap: var(--space-xs);
  line-height: 1;
}
.net-row .show-all:hover { color: color-mix(in oklch, var(--brand) 75%, var(--ink-0)); }
.net-row .show-all svg {
  width: 12px; height: 12px;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  display: block;
}

/* ═══════════ YoY row ═══════════ */
.yoy-row {
  display: flex; align-items: center; gap: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.yoy-row .lbl { color: var(--ink-3); font-size: 11px; }
.yoy-stat { display: inline-flex; align-items: baseline; gap: var(--space-xs); }
.yoy-stat .name { color: var(--ink-2); font-size: 11.5px; }
.yoy-stat .delta {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.yoy-stat .delta.up   { color: var(--good); }
.yoy-stat .delta.down { color: var(--bad); }
.yoy-bars {
  margin-left: auto;
  display: inline-flex; align-items: flex-end; gap: 2px;
  height: 22px;
}
.yoy-bars i {
  display: block;
  width: 4px;
  background: color-mix(in oklch, var(--brand) 65%, transparent);
  border-radius: 1px;
}

/* ═══════════ Cross-port (vs comparison) ═══════════ */
.cross-port {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-md);
}
.cp-card {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-md) var(--space-lg);
  display: flex; flex-direction: column; gap: var(--space-sm);
}
.cp-h {
  display: flex; align-items: center; gap: var(--space-sm);
  font-size: 13.5px; color: var(--ink-1); font-weight: 600;
  padding-bottom: var(--space-sm);
  border-bottom: 1px dashed var(--line-soft);
}
.cp-h .name { color: var(--ink-0); font-size: 14.5px; letter-spacing: -0.005em; }
.cp-h .delta { margin-left: auto; }
.cp-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 3px 0;
  font-size: 12px;
  color: var(--ink-2);
}
.cp-row .v {
  font-family: var(--font-mono);
  color: var(--ink-0);
  font-weight: 500;
}
.cp-row .v.up { color: var(--good); }
.cp-row .v.down { color: var(--bad); }
.cp-row .v.flat { color: var(--ink-2); }

/* ═══════════ Mini table ═══════════ */
.mini-card {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-md);
}
.mini-card .mc-h {
  display: flex; align-items: baseline; gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.mini-card .mc-h h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-0);
}
.mini-card .mc-h .hint { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); }
.mini-card .mc-h .meta { margin-left: auto; font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); }

.mini-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.mini-tbl th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.mini-tbl th.r { text-align: right; }
.mini-tbl td {
  padding: 6px var(--space-sm);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-1);
  vertical-align: middle;
}
.mini-tbl td.r {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink-0);
}
.mini-tbl tr:last-child td { border-bottom: 0; }
.mini-tbl tr:hover td { background: var(--bg-2); }

.rank-chip {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--ink-2);
}
.rank-chip.r1 { background: color-mix(in oklch, var(--warn) 26%, var(--bg-2)); color: var(--warn); }
.rank-chip.r2 { background: color-mix(in oklch, var(--ink-2) 18%, var(--bg-2)); color: var(--ink-1); }
.rank-chip.r3 { background: color-mix(in oklch, var(--bad) 22%, var(--bg-2)); color: var(--bad); }

/* ═══════════ AI Hint card (compose з scorecard) ═══════════ */
.ai-hint {
  background: var(--bg-1);
  border: 1px solid color-mix(in oklch, var(--brand) 30%, var(--line));
  border-radius: var(--r-md);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
  background: linear-gradient(120deg, color-mix(in oklch, var(--brand) 8%, var(--bg-1)) 0%, var(--bg-1) 70%);
}
.ai-hint .ico {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: color-mix(in oklch, var(--brand) 22%, var(--bg-2));
  color: var(--brand);
  display: grid; place-items: center;
  flex: none;
}
.ai-hint .ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.ai-hint .body { flex: 1; min-width: 0; }
.ai-hint .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 2px;
}
.ai-hint .text { font-size: 13px; color: var(--ink-0); line-height: 1.5; }
.ai-hint .text b { color: var(--brand); font-weight: 600; }
.ai-hint .cta {
  flex: none;
  background: color-mix(in oklch, var(--brand) 22%, transparent);
  border: 1px solid color-mix(in oklch, var(--brand) 40%, var(--line));
  color: var(--brand);
  padding: 6px var(--space-md);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: var(--space-xs);
}
.ai-hint .cta:hover { background: color-mix(in oklch, var(--brand) 32%, transparent); color: var(--ink-0); }

/* ═══════════ Data Quality summary card ═══════════ */
.dq-card {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.dq-card .ico {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--ink-2);
  display: grid; place-items: center;
  flex: none;
}
.dq-card .ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.dq-card .body { flex: 1; min-width: 0; }
.dq-card .title {
  font-size: 12px;
  color: var(--ink-1);
  font-weight: 500;
  margin-bottom: 2px;
}
.dq-card .counts {
  display: inline-flex; align-items: center; gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.dq-card .counts .c-good { color: var(--good); }
.dq-card .counts .c-warn { color: var(--warn); }
.dq-card .counts .c-bad  { color: var(--bad); }
.dq-card .counts .meta { color: var(--ink-3); margin-left: var(--space-sm); }
.dq-card .cta { color: var(--brand); font-size: 12px; }
.dq-card .cta:hover { color: color-mix(in oklch, var(--brand) 75%, var(--ink-0)); }

/* ═══════════ AI Recommendation card (ai-briefing) ═══════════ */
.ai-rec {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-lg);
  display: flex; flex-direction: column; gap: var(--space-md);
  position: relative;
  min-height: 232px;
}
.ai-rec.p-hi { border-left: 3px solid color-mix(in oklch, var(--bad) 45%, var(--line)); }
.ai-rec.p-md { border-left: 3px solid color-mix(in oklch, var(--warn) 45%, var(--line)); }
.ai-rec.p-lo { border-left: 3px solid color-mix(in oklch, var(--info) 45%, var(--line)); }
.ai-rec .head {
  display: flex; align-items: center; gap: var(--space-sm);
}
.ai-rec .pri {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 2px var(--space-sm);
  border-radius: 3px;
  text-transform: uppercase;
}
.ai-rec.p-hi .pri { background: color-mix(in oklch, var(--bad)  20%, var(--bg-2)); color: var(--bad); }
.ai-rec.p-md .pri { background: color-mix(in oklch, var(--warn) 20%, var(--bg-2)); color: var(--warn); }
.ai-rec.p-lo .pri { background: color-mix(in oklch, var(--info) 20%, var(--bg-2)); color: var(--info); }
.ai-rec .conf {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px var(--space-sm);
  border-radius: var(--r-sm);
  border: 1px solid;
}
.ai-rec .title-row { display: flex; flex-direction: column; gap: 4px; }
.ai-rec .title {
  font-size: 14px; font-weight: 600; color: var(--ink-0);
  letter-spacing: -0.005em;
  line-height: 1.35;
}
.ai-rec .why { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.ai-rec .impact {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: 4px var(--space-sm);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  background: color-mix(in oklch, var(--good) 14%, transparent);
  color: var(--good);
  align-self: flex-start;
}
.ai-rec .impact.warn { background: color-mix(in oklch, var(--warn) 14%, transparent); color: var(--warn); }
.ai-rec .ctas {
  margin-top: auto;
  display: flex; gap: var(--space-xs);
  flex-wrap: wrap;
}
.btn {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-1);
  padding: 5px var(--space-md);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 12px;
}
.btn:hover { background: var(--bg-3); border-color: var(--ink-3); color: var(--ink-0); }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--bg-0);
  font-weight: 600;
}
.btn-primary:hover { background: color-mix(in oklch, var(--brand) 88%, var(--ink-0)); }
.btn-ghost {
  background: transparent;
  border-color: var(--line-soft);
  color: var(--ink-2);
}
.btn-ghost:hover { color: var(--ink-0); border-color: var(--ink-3); background: var(--bg-2); }
.btn-danger {
  background: color-mix(in oklch, var(--bad) 18%, var(--bg-2));
  border-color: color-mix(in oklch, var(--bad) 40%, var(--line));
  color: var(--bad);
}
.btn-danger:hover { background: color-mix(in oklch, var(--bad) 26%, var(--bg-2)); }

/* ═══════════ Empty state ═══════════ */
.empty-state {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-xxl) var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
}
.empty-state .illus {
  width: 80px; height: 80px;
  color: var(--ink-3);
}
.empty-state .illus svg {
  width: 100%; height: 100%;
  stroke: currentColor; fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.empty-state .illus .accent-fill { fill: currentColor; stroke: none; opacity: 0.18; }
.empty-state h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-0); }
.empty-state p { margin: 0; font-size: 12px; color: var(--ink-2); max-width: 320px; line-height: 1.55; }
.empty-state .actions { display: flex; gap: var(--space-xs); margin-top: var(--space-xs); }
.empty-state-coming-soon .illus { color: var(--info); }
.empty-state-error .illus { color: var(--bad); }

/* ═══════════ Modal / drawer (slide-out right) ═══════════ */
.drawer-overlay {
  position: fixed; inset: 0;
  background: oklch(0% 0 0 / 0.55);
  backdrop-filter: blur(2px);
  z-index: 55;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer-side {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 92vw);
  background: var(--bg-1);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-high);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
  display: flex; flex-direction: column;
  visibility: hidden;
  pointer-events: none;
}
.drawer-side.open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.22s ease, visibility 0s linear 0s;
}
.drawer-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--line-soft);
}
.drawer-h .title { font-size: 14px; font-weight: 600; color: var(--ink-0); }
.drawer-h .close { color: var(--ink-3); font-size: 18px; line-height: 1; padding: 0; }
.drawer-h .close:hover { color: var(--ink-0); }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex; flex-direction: column; gap: var(--space-md);
}
.drawer-section h4 {
  margin: 0 0 var(--space-xs);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.drawer-section h4 .ico { width: 12px; height: 12px; flex: none; color: var(--ink-3); display: inline-flex; }
.drawer-section h4 .ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.drawer-row {
  display: flex; justify-content: space-between;
  font-size: 12px;
  color: var(--ink-1);
  padding: 4px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.drawer-row .l { color: var(--ink-2); }
.drawer-row .v { font-family: var(--font-mono); color: var(--ink-0); }
.drawer-foot {
  display: flex; justify-content: flex-end; gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--line-soft);
}

/* ═══════════ Bar-cell (progress bar inside table cell) ═══════════ */
.bar-cell {
  display: flex; align-items: center; gap: var(--space-sm);
  min-width: 120px;
}
.bar-cell .bar {
  flex: 1;
  height: 6px;
  min-width: 40px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
}
.bar-cell .bar i {
  display: block;
  height: 100%;
  background: var(--good);
  border-radius: 999px;
}
.bar-cell.tone-warn .bar i { background: var(--warn); }
.bar-cell.tone-bad  .bar i { background: var(--bad); }
.bar-cell.tone-brand .bar i { background: var(--brand); }
.bar-cell .v {
  font-family: var(--font-mono);
  color: var(--ink-0);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Action tag (A/B/C, hot/warm/cold) */
.action-tag {
  display: inline-block;
  padding: 1px var(--space-sm);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.action-tag.a, .action-tag.hot {
  background: color-mix(in oklch, var(--good) 18%, var(--bg-2));
  color: var(--good);
}
.action-tag.b, .action-tag.warm {
  background: color-mix(in oklch, var(--warn) 18%, var(--bg-2));
  color: var(--warn);
}
.action-tag.c, .action-tag.cold {
  background: color-mix(in oklch, var(--bad) 18%, var(--bg-2));
  color: var(--bad);
}

/* Inline delta cell (table row delta) */
.cell-delta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.cell-delta.up { color: var(--good); }
.cell-delta.down { color: var(--bad); }
.cell-delta.flat { color: var(--ink-3); }

/* ═══════════ Traffic table (sortable, .traffic-tbl, mirrors .mini-tbl) ═══════════ */
.traffic-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.traffic-tbl thead th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.traffic-tbl thead th.r { text-align: right; }
.traffic-tbl tbody td {
  padding: 6px var(--space-sm);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-1);
  vertical-align: middle;
}
.traffic-tbl tbody td.r {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink-0);
  font-variant-numeric: tabular-nums;
}
.traffic-tbl tbody tr { cursor: pointer; transition: background 0.12s; }
.traffic-tbl tbody tr:hover td { background: var(--bg-2); }
.traffic-tbl tbody tr:last-child td { border-bottom: 0; }
.traffic-tbl tfoot td {
  padding: var(--space-xs) var(--space-sm);
  border-top: 1px solid var(--line);
  font-weight: 600;
  color: var(--ink-0);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.traffic-tbl tfoot td.r { text-align: right; }

/* Gradient cell — background tint proportional to value (per Йолт B2 — карта градієнта) */
.gradient-cell {
  position: relative;
  padding: 6px var(--space-sm) !important;
}
.gradient-cell::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 3px;
  background: color-mix(in oklch, var(--good) calc(var(--g, 0) * 1%), transparent);
  pointer-events: none;
  z-index: 0;
}
.gradient-cell > * { position: relative; z-index: 1; }
.gradient-cell.tone-warn::before { background: color-mix(in oklch, var(--warn) calc(var(--g, 0) * 1%), transparent); }
.gradient-cell.tone-bad::before  { background: color-mix(in oklch, var(--bad)  calc(var(--g, 0) * 1%), transparent); }
.gradient-cell.tone-info::before { background: color-mix(in oklch, var(--info) calc(var(--g, 0) * 1%), transparent); }
.gradient-cell.tone-brand::before { background: color-mix(in oklch, var(--brand) calc(var(--g, 0) * 1%), transparent); }
.traffic-tbl .sku-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.traffic-tbl .name {
  max-width: 240px;
}
.traffic-tbl .name .name-text {
  color: var(--ink-0);
  font-weight: 500;
  font-size: 12.5px;
}
.traffic-tbl .name small {
  display: block;
  color: var(--ink-3);
  font-size: 10.5px;
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ═══════════ Daily chart (combo: bars + area + dashed line) ═══════════ */
.daily-chart {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-md) var(--space-lg);
}
.daily-chart .dc-h {
  display: flex; align-items: baseline; gap: var(--space-md);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}
.daily-chart .dc-h h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-0); }
.daily-chart .dc-h .sub { font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); }
.daily-chart .dc-h .legend { margin-left: auto; display: inline-flex; gap: var(--space-md); }
.daily-chart .legend-row { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: 11.5px; color: var(--ink-2); }
.daily-chart .legend-row .dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.daily-chart .dc-svg { display: block; width: 100%; height: 240px; }

/* ═══════════ Manager row (mgr-row pattern, per-entity) ═══════════ */
.mgr-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.mgr-table col.c-name   { width: 200px; }
.mgr-table col.c-won    { width: 70px; }
.mgr-table col.c-spark  { width: 110px; }
.mgr-table col.c-num    { width: 90px; }
.mgr-table col.c-roi    { width: 70px; }
.mgr-table col.c-status { width: 130px; }
.mgr-table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.mgr-table thead th.r { text-align: right; }
.mgr-table tbody td {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink-1);
}
.mgr-table tbody td.r {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-0);
}
.mgr-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}
.mgr-table tbody tr:hover td { background: var(--bg-2); }
.mgr-table .mgr-name {
  display: flex; align-items: center; gap: var(--space-sm);
}
.mgr-table .mgr-name .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--ink-1);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex: none;
}
.mgr-table .mgr-name .who { display: flex; flex-direction: column; gap: 1px; }
.mgr-table .mgr-name .who .n { color: var(--ink-0); font-size: 12.5px; font-weight: 500; }
.mgr-table .mgr-name .who .role { color: var(--ink-3); font-size: 10.5px; font-family: var(--font-mono); }
.mgr-mini-donut { width: 32px; height: 32px; display: inline-block; vertical-align: middle; }
.mgr-mini-spark { width: 96px; height: 24px; display: inline-block; vertical-align: middle; }
.mgr-table tbody td { white-space: nowrap; }
.mgr-table tbody td:first-child { white-space: normal; }
.mgr-table thead th { white-space: nowrap; padding: var(--space-sm) var(--space-sm); }

/* Reusable entity-summary block (для будь-якого drill: manager / product / category / channel / customer) */
.entity-summary { display: flex; flex-direction: column; gap: var(--space-md); }
.entity-summary .es-hero {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-2);
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
}
.entity-summary .es-stat { display: flex; flex-direction: column; gap: 2px; }
.entity-summary .es-stat .lbl {
  font-size: 9.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.entity-summary .es-stat .v {
  font-family: var(--font-mono);
  font-size: 18px; font-weight: 600;
  color: var(--ink-0);
}
.entity-summary .es-stat .v.good { color: var(--good); }
.entity-summary .es-stat .v.bad  { color: var(--bad); }
.entity-summary .es-stat .v.warn { color: var(--warn); }
.entity-summary .es-stat .delta { font-size: 10.5px; font-family: var(--font-mono); }
.entity-summary .es-stat .delta.up   { color: var(--good); }
.entity-summary .es-stat .delta.down { color: var(--bad); }
.entity-summary .es-period-tabs {
  display: inline-flex; gap: 2px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 2px;
}
.entity-summary .es-period-tabs button {
  background: transparent; border: 0;
  padding: 3px var(--space-sm);
  border-radius: 3px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.entity-summary .es-period-tabs button.on { background: var(--bg-3); color: var(--brand); }
.entity-summary .es-badges {
  display: flex; flex-wrap: wrap; gap: var(--space-xs);
}
.entity-summary .es-badge {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: 4px var(--space-sm);
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-1);
}
.entity-summary .es-badge.t-good { background: color-mix(in oklch, var(--good) 16%, var(--bg-2)); color: var(--good); border-color: color-mix(in oklch, var(--good) 35%, var(--line)); }
.entity-summary .es-badge.t-warn { background: color-mix(in oklch, var(--warn) 16%, var(--bg-2)); color: var(--warn); border-color: color-mix(in oklch, var(--warn) 35%, var(--line)); }
.entity-summary .es-badge.t-brand { background: color-mix(in oklch, var(--brand) 16%, var(--bg-2)); color: var(--brand); border-color: color-mix(in oklch, var(--brand) 35%, var(--line)); }
.entity-summary .es-badge .ico { width: 12px; height: 12px; }

/* Compact heatmap cell variant (per Йолт B2 — менш масивно) */
.heatmap-compact { display: block; width: 100%; height: auto; }
.heatmap-compact rect.cell { cursor: pointer; transition: filter 120ms ease, stroke 120ms; rx: 2; }
.heatmap-compact rect.cell:hover { filter: brightness(1.25); stroke: oklch(0.96 0.18 200); stroke-width: 1.5; }
.mgr-roi-good { color: var(--good); font-weight: 600; }
.mgr-roi-ok   { color: var(--ink-1); }
.mgr-roi-warn { color: var(--warn); font-weight: 600; }
.mgr-roi-bad  { color: var(--bad); font-weight: 600; }

/* ═══════════ Donut block (canonical UIKit §06) ═══════════ */
.donut-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-md);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-lg);
}
.donut-block {
  display: flex; align-items: center; justify-content: center;
  position: relative;
  padding: var(--space-sm);
}
.donut-svg { display: block; width: 100%; max-width: 220px; height: auto; }
.donut-svg .ring-bg { stroke: var(--bg-2); fill: none; stroke-width: 16; }
.donut-svg .seg { fill: none; stroke-width: 16; transform: rotate(-90deg); transform-origin: 50% 50%; transition: filter 120ms ease; }
.donut-svg .seg:hover { filter: brightness(1.18); }
.donut-svg .donut-center-big {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  fill: var(--ink-0);
  text-anchor: middle;
  letter-spacing: -0.02em;
}
.donut-svg .donut-center-sub {
  font-family: var(--font);
  font-size: 6.5px;
  fill: var(--ink-3);
  text-anchor: middle;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.donut-legend {
  display: flex; flex-direction: column;
  gap: 6px;
  padding: var(--space-xs) 0;
}
.donut-legend .lg-h {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.donut-legend .lg-row {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  gap: var(--space-sm);
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12px;
}
.donut-legend .lg-row:last-child { border-bottom: 0; }
.donut-legend .lg-row .dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  align-self: center;
}
.donut-legend .lg-row .name { color: var(--ink-1); font-size: 12px; }
.donut-legend .lg-row .v { font-family: var(--font-mono); color: var(--ink-0); font-size: 12px; }
.donut-legend .lg-row .pct {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: 11px;
  width: 38px;
  text-align: right;
}

/* ═══════════ Filter pills bar (sticky sub-bar with multi-dim filters) ═══════════ */
.filter-pills-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  background: color-mix(in oklch, var(--bg-0) 92%, transparent);
  scrollbar-width: none;
}
.filter-pills-bar::-webkit-scrollbar { display: none; }
.filter-pills-bar .label {
  font-size: 10px;
  color: var(--ink-3);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  flex: none;
}
.filter-pill {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: 4px var(--space-sm);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  font-size: 11.5px;
  color: var(--ink-1);
  white-space: nowrap;
  flex: none;
  cursor: pointer;
  transition: border-color 0.12s;
}
.filter-pill:hover { border-color: var(--ink-3); }
.filter-pill .key { color: var(--ink-3); font-size: 10.5px; }
.filter-pill .val { color: var(--ink-1); }
.filter-pill .caret { color: var(--ink-3); font-size: 9px; margin-left: 2px; }
.filter-pill.active {
  background: color-mix(in oklch, var(--brand) 14%, var(--bg-1));
  border-color: color-mix(in oklch, var(--brand) 35%, var(--line));
  color: var(--brand);
}
.filter-pill.active .key { color: var(--brand); }

/* ═══════════ Spend pair — Google vs Meta side-by-side ═══════════ */
.spend-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.spend-card {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-md) var(--space-lg);
  display: flex; flex-direction: column; gap: var(--space-sm);
}
.spend-card.google {
  border-left: 3px solid color-mix(in oklch, var(--brand) 45%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklch, var(--brand) 5%, var(--bg-1)) 0%, var(--bg-1) 70%);
}
.spend-card.meta {
  border-left: 3px solid color-mix(in oklch, oklch(0.66 0.31 320) 45%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklch, oklch(0.66 0.31 320) 5%, var(--bg-1)) 0%, var(--bg-1) 70%);
}
.spend-card .sp-head {
  display: flex; align-items: center; gap: var(--space-sm);
}
.spend-card .sp-head .ico {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--bg-2);
}
.spend-card .sp-head .ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.spend-card.google .sp-head .ico { color: var(--brand); background: color-mix(in oklch, var(--brand) 16%, var(--bg-2)); }
.spend-card.meta .sp-head .ico { color: oklch(0.74 0.22 320); background: color-mix(in oklch, oklch(0.66 0.31 320) 16%, var(--bg-2)); }
.spend-card .sp-head .name { font-size: 13.5px; font-weight: 600; color: var(--ink-0); }
.spend-card .sp-head .roas {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px var(--space-sm);
  background: color-mix(in oklch, var(--good) 16%, transparent);
  color: var(--good);
  border-radius: 999px;
}
.spend-card .sp-head .roas.warn { background: color-mix(in oklch, var(--warn) 16%, transparent); color: var(--warn); }
.spend-card .sp-head .roas.bad { background: color-mix(in oklch, var(--bad) 16%, transparent); color: var(--bad); }
.spend-card .sp-big {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--ink-0);
  letter-spacing: -0.025em;
  line-height: 1;
}
.spend-card .sp-big .unit { font-size: 16px; color: var(--ink-2); margin-left: 2px; }
.spend-card .sp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px dashed var(--line-soft);
}
.spend-card .sp-stats .stat { display: flex; flex-direction: column; gap: 1px; }
.spend-card .sp-stats .lbl {
  font-size: 9.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.spend-card .sp-stats .v {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-0);
}
.spend-card .sp-top {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: var(--space-xs);
}
.spend-card .sp-top .label {
  font-size: 9.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  margin-bottom: 2px;
}
.spend-card .sp-top .row {
  display: flex; justify-content: space-between; gap: var(--space-sm);
  font-size: 11.5px;
  padding: 2px 0;
}
.spend-card .sp-top .row .n { color: var(--ink-1); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spend-card .sp-top .row .v { font-family: var(--font-mono); color: var(--ink-0); }

/* ═══════════ Events ticker (horizontal scroll of anomalies) ═══════════ */
.events-ticker {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.anom-row {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  font-size: 12px;
}
.anom-row .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 4px currentColor;
}
.anom-row.bad  { border-left: 3px solid var(--bad);  color: var(--bad); }
.anom-row.bad  .dot { background: var(--bad); }
.anom-row.warn { border-left: 3px solid var(--warn); color: var(--warn); }
.anom-row.warn .dot { background: var(--warn); }
.anom-row.good { border-left: 3px solid var(--good); color: var(--good); }
.anom-row.good .dot { background: var(--good); }
.anom-row .ts {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 600;
}
.anom-row .desc { flex: 1; color: var(--ink-1); font-size: 12px; min-width: 0; }
.anom-row .desc b { color: var(--ink-0); font-weight: 600; }
.anom-row .delta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  color: currentColor;
}

/* ═══════════ Cron status grid (5 connector cards) ═══════════ */
.cron-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-sm);
}
.cron-card {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
}
.cron-card .ico {
  width: 28px; height: 28px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--bg-2);
  display: grid; place-items: center;
  color: var(--ink-2);
}
.cron-card .ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cron-card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cron-card .body .name { font-size: 12px; color: var(--ink-0); font-weight: 500; }
.cron-card .body .meta { font-size: 10px; color: var(--ink-3); font-family: var(--font-mono); }
.cron-card .pulse { flex: none; padding: 2px 6px; font-size: 9.5px; }

/* ═══════════ Goals progress (3 cards з progress bars) ═══════════ */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.goal-card {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--space-md) var(--space-lg);
  display: flex; flex-direction: column; gap: var(--space-sm);
}
.goal-card .label {
  font-size: 11px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.goal-card .num-row {
  display: flex; align-items: baseline; gap: var(--space-xs);
}
.goal-card .big {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--ink-0);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.goal-card .big .unit { font-size: 14px; color: var(--ink-2); margin-left: 2px; }
.goal-card .target {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.goal-card .progress {
  height: 6px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
}
.goal-card .progress i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.goal-card[data-state="warn"] .progress i { background: var(--warn); }
.goal-card[data-state="good"] .progress i { background: var(--good); }
.goal-card[data-state="bad"]  .progress i { background: var(--bad); }
.goal-card .foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.goal-card .pct {
  color: var(--ink-1);
  font-weight: 600;
}
.goal-card[data-state="good"] .pct { color: var(--good); }
.goal-card[data-state="warn"] .pct { color: var(--warn); }
.goal-card[data-state="bad"]  .pct { color: var(--bad); }

/* ═══════════ Top managers mini-row (Top-3) — 3 окремі картки ═══════════ */
.top-mgr-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.top-mgr-mini .mg-item {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  transition: background 0.12s, border-color 0.12s, transform 0.16s;
  cursor: pointer;
}
.top-mgr-mini .mg-item:hover {
  background: var(--bg-2);
  border-color: var(--ink-3);
  transform: translateY(-1px);
}
.top-mgr-mini .mg-item.r1 { border-left: 3px solid color-mix(in oklch, var(--good) 38%, var(--line)); }
.top-mgr-mini .mg-item.r2 { border-left: 3px solid color-mix(in oklch, var(--brand) 38%, var(--line)); }
.top-mgr-mini .mg-item:not(.r1):not(.r2) { border-left: 3px solid color-mix(in oklch, var(--ink-3) 35%, var(--line)); }
.top-mgr-mini .mg-item .rank {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-3);
  width: 22px;
  text-align: center;
}
.top-mgr-mini .mg-item .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--ink-1);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex: none;
}
.top-mgr-mini .mg-item.r1 .avatar {
  background: color-mix(in oklch, var(--good) 22%, var(--bg-3));
  color: var(--good);
}
.top-mgr-mini .mg-item.r2 .avatar {
  background: color-mix(in oklch, var(--brand) 22%, var(--bg-3));
  color: var(--brand);
}
.top-mgr-mini .mg-item .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.top-mgr-mini .mg-item .who .n { color: var(--ink-0); font-size: 12.5px; font-weight: 500; }
.top-mgr-mini .mg-item .who .stat {
  color: var(--ink-3); font-size: 10.5px;
  font-family: var(--font-mono);
}
.top-mgr-mini .mg-item .roi {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--good);
  padding: 2px var(--space-sm);
  background: color-mix(in oklch, var(--good) 14%, transparent);
  border-radius: 999px;
}

/* ═══════════ FAB (floating action button bottom-right) ═══════════ */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: oklch(0.16 0.006 70);
  display: grid; place-items: center;
  box-shadow: var(--shadow-high), 0 0 24px color-mix(in oklch, var(--brand) 40%, transparent);
  z-index: 45;
  cursor: pointer;
  border: 0;
  transition: transform 0.16s, box-shadow 0.16s;
}
.fab:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-high), 0 0 36px color-mix(in oklch, var(--brand) 55%, transparent);
}
.fab svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fab::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  opacity: 0;
  animation: fab-pulse-ring 2.4s infinite;
  pointer-events: none;
}
@keyframes fab-pulse-ring {
  0%   { opacity: 0.5; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.35); }
}
.fab .badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--bad);
  color: oklch(0.97 0.005 80);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid; place-items: center;
  border: 2px solid var(--bg-0);
}

/* FAB panel uses .drawer-side atom — no duplicate definition */

/* ═══════════ Mobile drawer + sheet (used by mobile.html) ═══════════ */
.mobile-only { display: none; }

@media (max-width: 1280px) {
  .hero-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .cross-port { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-high);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: initial; }
}

@media (max-width: 720px) {
  :root { --topbar-h: 48px; }
  .topbar { padding: var(--space-xs) var(--space-md); gap: var(--space-xs); }
  .content { padding: var(--space-md); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding: var(--space-sm) var(--space-md); min-height: auto; }
  .kpi .big { font-size: 22px; }
  .kpi .spark { width: 50px; height: 22px; top: var(--space-sm); right: var(--space-md); }
  .kpi .modes { display: none; }
  .kpi.featured .modes { display: grid; }
  .scorecard-compound { padding: var(--space-md); min-height: auto; }
  .sc-big { font-size: 28px; }
  .hero-h h1 { font-size: 17px; }
  .s-h h2 { font-size: 15px; }
  .breadcrumb-row { padding: var(--space-xs) var(--space-md); }
  .breadcrumb-row .active-filters {
    margin-left: 0; width: 100%; padding-top: var(--space-xs);
    border-top: 1px solid var(--line-soft);
  }
  .net-row { padding: var(--space-md); flex-direction: column; align-items: flex-start; gap: var(--space-xs); }
  .net-row .val { font-size: 17px; }
  .net-row .show-all { margin-left: 0; align-self: stretch; }
  .ai-hint { flex-direction: column; align-items: flex-start; }
  .ai-hint .cta { align-self: stretch; justify-content: center; }
  .ai-rec { padding: var(--space-md); min-height: auto; }
  .yoy-row { gap: var(--space-sm); }
  .yoy-bars { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════ A11Y AUDIT PASS · WCAG 2.2 AA + HIG + MD3 ═══════════
   Added 2026-05-15 per Йолт /platform-design Option A.
   Token contrast notes:
   - --ink-0 / --ink-1 on --bg-0/-1/-2 → all AAA (≥7:1)
   - --ink-2 on --bg-0/-1 → AA (≥4.5:1) — body text safe
   - --ink-3 (0.50) → AA only for ≥14px or ≥12px-bold — DO NOT use for body paragraphs.
     Use exclusively for: muted labels (.hint .muted), placeholder, captions ≥10px UI text (WCAG 1.4.11 Non-text Contrast applies).
   - --good / --warn / --bad / --brand at lightness 0.74-0.82 → AA on dark bg.
*/

/* WCAG 2.2 §2.5.8 Target Size (Minimum 24×24 CSS px on web · 44×44 iOS · 48×48 Android).
   Enforce min on web-context interactive primitives. Mobile context overridden below. */
.btn { min-height: 28px; }
.tb-pill { min-height: 28px; }
.tb-iconbtn { min-width: 28px; min-height: 28px; }
.sb-item { min-height: 28px; }
.es-period-tabs button { min-height: 26px; min-width: 36px; }
.drawer-row { min-height: 28px; padding-block: 6px; }
.fab { min-width: 56px; min-height: 56px; }   /* MD3 standard FAB */

/* iOS / Android mobile context — bottom nav + topbar respect safe-area-inset */
.m-bottom-nav {
  padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  padding-left: max(var(--space-sm), env(safe-area-inset-left));
  padding-right: max(var(--space-sm), env(safe-area-inset-right));
}
.m-topbar {
  padding-top: max(var(--space-sm), env(safe-area-inset-top));
  padding-left: max(var(--space-md), env(safe-area-inset-left));
  padding-right: max(var(--space-md), env(safe-area-inset-right));
}
.m-content { padding-bottom: max(88px, calc(56px + env(safe-area-inset-bottom))); }

/* Mobile tap targets — bump to MD3 48dp / HIG 44pt */
.m-bottom-nav .item { min-height: 48px; min-width: 48px; }
.m-tab { min-height: 36px; }
.m-card a, .m-card button { min-height: 44px; }

/* High-contrast / forced-colors: preserve oklch tokens fallback to system colors */
@media (forced-colors: active) {
  .scorecard-compound, .card, .traffic-tbl, .uk-note, .cross-card, .drawer-side {
    border: 1px solid CanvasText;
  }
  .btn, .tb-pill, .sb-item { border: 1px solid ButtonText; }
}

/* ═══════════ QUICK WINS POLISH PATCH · 2026-05-15 ═══════════
   Source: v11/audits/DEN_PROMPT_QUICK_WINS.md (audit 1 445 visual defects).
   4 blocks added to kill ~80% of defects via global CSS injection.

   Conflict notes:
   - `.bar-cell` (line 2492) already exists з progress-bar semantic — NOT overridden.
   - `.gradient-cell` (line 2595) already implements heat-gradient correctly — preserved.
   - Block 1 adds NEW `.tbl-heat` opt-in for table-wide auto-heat without atom changes.
   - Block 3 targets `.app` (canonical layout wrapper), not `body` (our architecture).
*/

/* === D6 BLOCK 1 · Auto-heat для table columns via opt-in class === */
/* Add class="tbl-heat" на <table> + data-pct="<0-100>" на cells → auto-shade.
   Existing .gradient-cell з var(--g) preserved (mainline pattern). */
.tbl-heat td[data-pct] {
  background: color-mix(
    in oklch,
    var(--good) calc(attr(data-pct number, 0) * 0.4%),
    transparent
  );
}
/* Fallback for browsers without attr() support — use custom prop --pct */
.tbl-heat td[style*="--pct"] {
  background: color-mix(in oklch, var(--good) calc(var(--pct, 0) * 0.4%), transparent);
}
.tbl-heat td[data-tone="bad"] {
  background: color-mix(in oklch, var(--bad) calc(var(--pct, 0) * 0.4%), transparent);
}
.tbl-heat td[data-tone="warn"] {
  background: color-mix(in oklch, var(--warn) calc(var(--pct, 0) * 0.4%), transparent);
}
.tbl-heat td[data-tone="brand"] {
  background: color-mix(in oklch, var(--brand) calc(var(--pct, 0) * 0.4%), transparent);
}

/* === D7 BLOCK 2 · Sticky table TOTAL rows === */
table tfoot,
table .sum-row,
table .tbl-foot {
  position: sticky;
  bottom: 0;
  background: var(--bg-1);
  z-index: 1;
  border-top: 1px solid var(--line);
}
table tfoot td,
table .sum-row td,
table .tbl-foot td {
  padding-top: var(--space-sm);
  padding-bottom: var(--space-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* === D12 BLOCK 3 · Responsive main layout — kill hardcoded widths === */
/* Architecture: page wrapper is `.app` (existing grid at line 455), NOT `body`.
   This kills 71 mockups where <main style="width:1208px"> overflows on collapse. */
.app {
  /* preserve existing display:grid + grid-template-columns from line 455 */
  overflow-x: hidden;
}
main,
.main,
.main-content,
.pg-main {
  width: auto !important;          /* override hardcoded inline width */
  max-width: 100%;
  min-width: 0;
  margin: 0;
}
/* Sidebar collapse states — opt-in via body attr */
body[data-sidebar="collapsed"] .app { grid-template-columns: 56px 1fr; }
body[data-sidebar="hidden"]    .app { grid-template-columns: 0 1fr; }
.sidebar { transition: width 200ms ease, grid-column 200ms ease; }

/* === D10 BLOCK 4 · Bar width cap (chart bars) === */
/* CAVEAT: SVG <rect> doesn't fully respect CSS width — partial fix.
   Mockups що мають <rect width="X"> hardcoded need HTML edit (Шлях B).
   This caps via parent constraints + max-width на the SVG container. */
.chart-bars rect,
svg .bar-group rect,
svg [class*="bar"] rect {
  width: clamp(20px, 6%, 60px);    /* won't apply on most browsers — kept for future */
}
.chart-bars svg,
.chart-bar svg,
svg.chart-bars {
  max-height: 280px;
}
.chart-stretched svg,
svg.chart-stretched {
  max-width: 800px;
  margin-inline: auto;
  display: block;
}

/* ═══════════ PHASE 1 EXTENSION · 2026-05-15 evening ═══════════
   Targets remaining 313 defects from audits/DEN_REMAINING_TASKS.md:
   - D8 chart hover tooltips (130 defects · 42%)
   - D11 table pagination (5 defects)
   - D9 scorecard helpers
   Pure CSS — per-page просто додасть `data-tip="..."` attr.
*/

/* === D8 · Hover tooltip pattern для будь-якого chart element ===
   Usage: add `data-tip="Revenue · 1.2M ₴"` на <rect>, <circle>, <polyline> або wrapper.
   Tooltip з'являється на hover без JS. */
[data-tip] {
  cursor: help;
  position: relative;
}
[data-tip]:hover {
  filter: brightness(1.15);
}
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 6px 10px;
  background: var(--bg-2);
  color: var(--ink-0);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-mid);
}
[data-tip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--line);
  z-index: 100;
}
/* SVG-element tooltip: due to SVG quirks, wrap target у HTML container з .tip-target */
.tip-target { position: relative; display: inline-block; }
.chart-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  color: var(--ink-0);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 100;
  box-shadow: var(--shadow-mid);
}
.tip-target:hover .chart-tooltip,
.tip-target.has-tooltip:hover .chart-tooltip {
  opacity: 1;
}

/* SVG <title> child — browsers render native tooltip on hover. Style hint: */
svg [data-tip],
svg title {
  cursor: help;
}

/* === D11 · Table pagination component === */
.tbl-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--line-soft);
  background: var(--bg-1);
  font-size: 11.5px;
  color: var(--ink-2);
}
.tbl-pager .pager-info { font-family: var(--font-mono); }
.tbl-pager .pager-controls {
  display: flex;
  gap: var(--space-xs);
}
.tbl-pager .pager-btn {
  min-width: 28px;
  min-height: 28px;
  padding: 0 var(--space-sm);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  color: var(--ink-1);
  font-size: 11.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tbl-pager .pager-btn:hover {
  background: var(--bg-3);
  border-color: var(--ink-3);
  color: var(--ink-0);
}
.tbl-pager .pager-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--bg-0);
  font-weight: 600;
}
.tbl-pager .pager-btn[disabled],
.tbl-pager .pager-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.tbl-pager .pager-page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.tbl-pager select {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-0);
  padding: 4px 8px;
  font-size: 11.5px;
  font-family: var(--font);
}

/* === D4 / D4b · Banner default styling helpers ===
   Ensure .banner-page-top.t-info exists as first child pattern.
   Add helper для close button if missing.
*/
.banner-page-top { position: relative; }
.banner-page-top .banner-close,
.banner-page-top button[aria-label="dismiss"],
.banner-page-top button.dismiss {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 24px;
  height: 24px;
  background: transparent;
  border: 0;
  color: var(--ink-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
}
.banner-page-top .banner-close:hover,
.banner-page-top button[aria-label="dismiss"]:hover,
.banner-page-top button.dismiss:hover {
  background: var(--bg-2);
  color: var(--ink-0);
}

/* === D10b extension · stronger bar-width constraint ===
   For SVG rect, hardcoded width attribute wins over CSS in most browsers.
   But for CSS-aware browsers, force max via geometry. */
svg .bars rect,
svg g[class*="bar"] rect,
svg .chart-bars > rect,
svg [data-chart="bar"] rect {
  /* Modern Chrome/FF: respects width on SVG via CSS geometry property */
  width: clamp(20px, 6%, 60px);
}

/* ════════════════════════════════════════════════════════════════════
 * AUTO-PATCH B22 · D13/D14/D15/D16 polish (Avi · 2026-05-15)
 * Additive · zero-risk · no existing rules overridden
 * Detectors targeted: D13 alignment, D16 label rotation
 * ════════════════════════════════════════════════════════════════════ */

/* D13 · Numeric tables — consistent right-alignment ============
   Pattern: first column = text label (left), rest = numeric (right).
   Apply only to canonical analytical tables (traffic-tbl, tbl-heat, mgr-table).
   ============================================================ */
.traffic-tbl thead th,
.traffic-tbl tbody td,
.traffic-tbl tfoot td,
.tbl-heat thead th,
.tbl-heat tbody td,
.tbl-heat tfoot td,
.mgr-table thead th,
.mgr-table tbody td,
.mgr-table tfoot td,
.heatmap-tbl thead th,
.heatmap-tbl tbody td,
.heatmap-tbl tfoot td {
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}
.traffic-tbl thead th:first-child,
.traffic-tbl tbody td:first-child,
.traffic-tbl tfoot td:first-child,
.tbl-heat thead th:first-child,
.tbl-heat tbody td:first-child,
.tbl-heat tfoot td:first-child,
.mgr-table thead th:first-child,
.mgr-table tbody td:first-child,
.mgr-table tfoot td:first-child,
.heatmap-tbl thead th:first-child,
.heatmap-tbl tbody td:first-child,
.heatmap-tbl tfoot td:first-child {
  text-align: left;
}

/* Bucket-column variant (when label spans 2 cells: icon + name) */
.traffic-tbl thead th[data-col="bucket"],
.traffic-tbl tbody td[data-col="bucket"] {
  text-align: left;
}

/* D16 · Dense bar labels — smaller font, optional rotation ==== */
svg .bar-label,
svg .waterfall-label,
svg text[data-bar-label] {
  font-size: 9.5px;
  font-family: var(--font-mono);
  fill: var(--ink-2);
}
svg .waterfall-small-label,
svg text[data-bar-label="small"] {
  font-size: 9px;
  transform: rotate(-30deg);
  transform-origin: center;
}

/* D15 · Chart axis defaults (для opt-in <text class="axis-y">) */
svg .axis-y text,
svg text[data-axis="y"] {
  fill: var(--ink-3);
  font-size: 10px;
  font-family: var(--font-mono);
  text-anchor: end;
}
svg .axis-x text,
svg text[data-axis="x"] {
  fill: var(--ink-3);
  font-size: 10px;
  font-family: var(--font-mono);
  text-anchor: middle;
}
svg .gridline,
svg line[data-grid] {
  stroke: var(--line-soft);
  stroke-dasharray: 2 4;
}
