/* Layout: sticky top bar with date controls and tabs; a centred 1320px column of KPI cards, chart cards and tables. */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --fg: #0f1729;
  --muted: #5f6b7d;
  --faint: #8a94a6;
  --ink: #0f1729;
  --ink-fg: #ffffff;
  --good: #0f8a4f;
  --bad: #d92d20;
  --warn: #b54708;
  --c-revenue: #1f2a44;
  --c-spend: #e2445c;
  --c-meta: #1d6cf2;
  --c-google: #16a34a;
  --c-swatch: #d98a04;
  --c-sessions: #5b5bd6;
  --c-paid: #7c3aed;
  --c-organic: #0d9488;
  --c-email: #0ea5e9;
  --c-direct: #a3acb9;
  --c-ig: #c2307a;
  --c-prev: #9aa3b2;
  --c-avg: #ea580c;
  --c-profit: #0f766e;
  --c-year-1: #c3c9d4;
  --c-year-2: #8b95a7;
  --c-year-3: #4f6fd8;
  --c-year-4: #1f2a44;
  --grid: #eceef2;
  --shadow: 0 1px 2px rgba(15, 23, 41, 0.05);
  --pop-shadow: 0 12px 32px rgba(15, 23, 41, 0.16), 0 2px 6px rgba(15, 23, 41, 0.08);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17; --panel: #121826; --panel-2: #0f1520; --line: #222b3a; --line-strong: #2f3a4d;
    --fg: #eef1f6; --muted: #9aa5b8; --faint: #6f7a8e; --ink: #eef1f6; --ink-fg: #0b0f17;
    --good: #3ccf8e; --bad: #ff6b5f; --warn: #f5a524;
    --c-revenue: #dfe6f3; --c-spend: #ff6f86; --c-meta: #5a95ff; --c-google: #3fc574; --c-swatch: #f2b33d;
    --c-sessions: #8f8ff0; --c-paid: #a78bfa; --c-organic: #2cc3b3; --c-email: #45bdf0; --c-direct: #5d6779;
    --c-ig: #e3609f; --c-prev: #66708a; --c-avg: #fb923c; --c-profit: #2dd4bf; --c-year-1: #3a4456; --c-year-2: #66708a; --c-year-3: #6d8ff0; --c-year-4: #e8edf6; --grid: #1c2432;
    --shadow: none; --pop-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--c-meta); outline-offset: 2px; }
.num, td.num, .kpi-value, .mono { font-variant-numeric: tabular-nums; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in, .tabs-in, .main { max-width: 1320px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.topbar-in { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding-block: 12px 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: var(--ink-fg); font-size: 14px; font-weight: 700; }
.brand-name { font-size: 16px; }
.brand-sub { color: var(--muted); font-weight: 500; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; }
.pill:hover { border-color: var(--faint); }
.pill svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.pill[aria-expanded="true"] { border-color: var(--fg); }
.freshness { color: var(--muted); font-size: 12px; }
.logout { margin: 0; }
.link { background: none; border: 0; padding: 4px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.tabs { border-top: 0; }
.tabs-in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs [role="tab"] { appearance: none; border: 0; background: none; padding: 10px 12px 11px; color: var(--muted); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs [role="tab"]:hover { color: var(--fg); }
.tabs [role="tab"][aria-selected="true"] { color: var(--fg); border-bottom-color: var(--fg); }

/* Popovers */
.picker { position: relative; }
.popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(720px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--pop-shadow); }
.popover.narrow { width: min(380px, calc(100vw - 32px)); }
.pop-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.pop-body.column { display: block; padding: 14px 16px 6px; }
.presets { list-style: none; margin: 0; padding: 8px; border-right: 1px solid var(--line); max-height: 420px; overflow: auto; }
.presets button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; }
.presets button:hover { background: var(--panel-2); }
.presets button[aria-selected="true"] { background: var(--ink); color: var(--ink-fg); }
.pop-main { padding: 14px 16px; min-width: 0; }
.date-inputs { display: flex; align-items: end; gap: 8px; color: var(--muted); }
.date-inputs label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); flex: 1; }
.date-inputs input { height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--fg); width: 100%; }
.calendars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 14px; }
.calendars.single { grid-template-columns: minmax(0, 1fr); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 600; }
.cal-nav { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; color: var(--muted); }
.cal-nav[hidden] { display: inline-block; visibility: hidden; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px 0; text-align: center; }
.cal-dow { font-size: 11px; color: var(--faint); padding: 4px 0; }
.cal-day { height: 32px; border: 0; background: none; cursor: pointer; font-variant-numeric: tabular-nums; border-radius: 0; }
.cal-day:hover:not(:disabled) { background: var(--panel-2); }
.cal-day.in { background: color-mix(in srgb, var(--c-meta) 14%, transparent); }
.cal-day.edge { background: var(--ink); color: var(--ink-fg); border-radius: 6px; }
.cal-day.today { text-decoration: underline; text-underline-offset: 3px; }
.cal-day:disabled { color: var(--line-strong); cursor: default; }
.cal-day.nodata:not(:disabled) { color: var(--faint); }
.pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.pop-foot > div { display: flex; gap: 8px; }
.pop-note { margin: 0; font-size: 12px; color: var(--muted); }
.btn { height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; font-weight: 500; }
.btn.primary { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.compare-options { border: 0; margin: 0; padding: 0; display: grid; gap: 2px; }
.compare-options legend { font-weight: 600; margin-bottom: 6px; }
.compare-options label { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.compare-options label:hover { background: var(--panel-2); }
.custom-compare { margin-top: 8px; }
@media (max-width: 640px) {
  .pop-body { grid-template-columns: 1fr; }
  .presets { border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px; max-height: none; }
  .presets li { flex: none; }
  .presets button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; }
  .calendars { grid-template-columns: 1fr; }
  .calendars .cal:nth-child(2) { display: none; }
  .popover { position: fixed; left: 16px; right: 16px; top: 120px; width: auto; max-height: calc(100vh - 140px); overflow: auto; }
}

/* Main */
.main { padding-block: 20px 48px; display: grid; gap: 16px; }
.tab { display: grid; gap: 16px; }
.tab[hidden] { display: none; }
.banner { padding: 10px 14px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--panel)); font-size: 13px; }
.banner.error { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: color-mix(in srgb, var(--bad) 8%, var(--panel)); }
.summary { margin: 0; font-size: 16px; line-height: 1.6; max-width: 90ch; color: var(--muted); }
.summary b { color: var(--fg); font-weight: 600; }
.summary .up { color: var(--good); font-weight: 600; }
.summary .down { color: var(--bad); font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpi { padding: 12px; } .kpi-value { font-size: 22px; } }
.kpi { display: grid; grid-template-rows: auto auto auto 1fr; gap: 6px; min-width: 0; padding: 14px 16px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi-label { font-weight: 500; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.info { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--faint); font-size: 10px; font-weight: 600; cursor: help; background: none; padding: 0; line-height: 1; }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.delta { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.delta.good { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.delta.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, transparent); }
.kpi-prev { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.spark { align-self: end; height: 36px; }
.spark svg { display: block; overflow: visible; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 16px; }
.card { position: relative; display: grid; gap: 10px; align-content: start; min-width: 0; padding: 16px 18px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.card h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.note { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); max-width: 95ch; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; vertical-align: 3px; }
.legend i.dash { height: 0; width: 14px; border-top: 2px dashed var(--c-prev); border-radius: 0; background: none !important; vertical-align: 3px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.chips button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 13px; }
.chips button[aria-pressed="true"] { background: var(--panel); color: var(--fg); box-shadow: var(--shadow); font-weight: 500; }
.search { height: 32px; width: 220px; max-width: 100%; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); font-size: 13px; }

.chart { position: relative; min-height: 260px; }
.chart.short { min-height: 210px; }
.chart svg { display: block; overflow: visible; }
.axis-label { fill: var(--faint); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 8px; align-content: start; min-height: 120px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr) 92px; gap: 10px; align-items: center; padding: 3px 4px; border-radius: 6px; font-size: 13px; }
.bar-row:hover { background: var(--panel-2); }
.bar-label { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.bar-label small { display: block; color: var(--muted); font-size: 12px; }
.bar-track { display: flex; height: 12px; border-radius: 4px; background: color-mix(in srgb, var(--fg) 4%, transparent); overflow: hidden; }
.bar-track span { height: 100%; flex: none; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.bar-value small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
@media (max-width: 560px) { .bar-row { grid-template-columns: minmax(0, 1fr) 92px; } .bar-label { grid-column: 1 / -1; } }

.funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.step { position: relative; padding: 14px 16px; display: grid; gap: 4px; border-right: 1px solid var(--line); background: var(--panel-2); }
.step:last-child { border-right: 0; }
.step-label { font-size: 12.5px; color: var(--muted); }
.step-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.step-rate { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.step-rate span { color: var(--muted); }
.step-bar { height: 4px; border-radius: 2px; background: var(--c-sessions); margin-top: 4px; }
@media (max-width: 720px) { .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); } .step:nth-child(2) { border-right: 0; } .step:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }

.flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.flags li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-variant-numeric: tabular-nums; }
.flags .tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.flags .muted { color: var(--muted); }

.table { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; white-space: nowrap; border-bottom: 1px solid var(--line); padding: 0; }
.table th button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 8px 10px; cursor: pointer; text-align: inherit; }
.table th button:focus-visible { outline: 2px solid var(--c-meta); outline-offset: -2px; }
.table th[aria-sort="ascending"] button::after { content: " ↑"; }
.table th[aria-sort="descending"] button::after { content: " ↓"; }
.table th.num, .table td.num { text-align: right; }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--panel-2); }
.table td.wrap { min-width: 180px; overflow-wrap: anywhere; }
.table td .cell-bar { display: block; height: 3px; border-radius: 2px; margin-top: 5px; margin-left: auto; background: var(--faint); opacity: 0.45; }
.grid .table { max-height: 400px; }
.table .muted { color: var(--muted); }
.table td.up { color: var(--good); }
.table td.down { color: var(--bad); }
.table a { color: inherit; }
.table .status { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--muted); }
.table .status.on { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.table .empty { padding: 24px; text-align: center; color: var(--muted); }
@media (max-width: 720px) { .table .hide-narrow { display: none; } }

.empty-state { text-align: left; }
.empty-state p { margin: 0; color: var(--muted); max-width: 70ch; }

.about { margin-top: 12px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.about h2 { margin: 0; font-size: 15px; }
.about dl { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 6px 20px; margin: 0; font-size: 13px; }
.about dt { font-weight: 500; }
.about dd { margin: 0; color: var(--muted); max-width: 95ch; }
@media (max-width: 640px) { .about dl { grid-template-columns: 1fr; } .about dd { margin-bottom: 8px; } }

.tooltip { position: fixed; z-index: 50; pointer-events: none; min-width: 170px; max-width: 300px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--pop-shadow); font-size: 12.5px; }
.tooltip .tt-head { color: var(--muted); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.tooltip .tt-row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.tooltip .tt-sub { color: var(--muted); }

.skeleton { position: relative; overflow: hidden; background: color-mix(in srgb, var(--fg) 5%, transparent); border-radius: 6px; color: transparent !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--panel) 60%, transparent), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }
.loading .chart, .loading .bars { opacity: 0.55; transition: opacity 0.2s; }

/* v2 additions */
.grid.two-one { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 900px) { .grid.two-one { grid-template-columns: 1fr; } }
.pace { display: grid; gap: 6px; padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.pace:last-of-type { border-bottom: 0; }
.pace-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pace-label { color: var(--muted); font-weight: 500; }
.pace-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pace-value small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.pace-bar { position: relative; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--fg) 7%, transparent); }
.pace-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--c-revenue); }
.pace-bar i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--fg); opacity: 0.6; }
.pace-sub { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pace-sub b { color: var(--fg); font-weight: 600; }
.pace-sub .up { color: var(--good); }
.pace-sub .down { color: var(--warn); }
.target-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.target-form[hidden] { display: none; }
.target-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.target-form input { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--fg); }
.target-form > div { display: flex; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.4; margin-top: 2px; }
.table.tall { max-height: 640px; }
.table th .th { display: block; padding: 8px 10px; }
.table .status.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.table .group-row td { background: var(--panel); }
.table .source-row td { background: var(--panel-2); font-size: 12.5px; color: var(--muted); }
.table .source-row td:first-child { padding-left: 34px; }
.disclose { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.disclose::before { content: "▸"; color: var(--faint); font-size: 11px; width: 10px; transition: transform 0.15s; }
.disclose[aria-expanded="true"]::before { transform: rotate(90deg); }
.disclose i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.summary { color: var(--muted); }
.summary .up { color: var(--good); font-weight: 600; }
.summary .down { color: var(--bad); font-weight: 600; }
.table td.nowrap { white-space: nowrap; }

/* analysis */
.legend i.ring { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--warn); background: none !important; vertical-align: -1px; }
.chart-sub { margin: -6px 0 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card h2 .info { margin-left: 4px; vertical-align: 1px; }
.empty-note { margin: 0; padding: 18px 0; color: var(--muted); font-size: 13px; }
.empty-note.pad { padding: 24px; text-align: center; }
.kpi-prev { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.sig { font-size: 11.5px; color: var(--faint); }
.sig.clear { color: var(--fg); font-weight: 500; }
.sig.warn { color: var(--warn); }
.delta[data-tip] { cursor: help; }

.fc-bar { position: relative; height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--fg) 6%, transparent); margin: 2px 0; }
.fc-done { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--c-revenue); }
.fc-range { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: color-mix(in srgb, var(--c-revenue) 28%, transparent); }
.fc-mid { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--c-revenue); }
.fc-target { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--c-spend); cursor: help; }

.bridge { display: grid; gap: 4px; align-content: start; }
.bridge-row { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr) 84px; gap: 12px; align-items: center; padding: 5px 4px; border-radius: 6px; font-size: 13px; }
.bridge-row:hover { background: var(--panel-2); }
.bridge-label { min-width: 0; line-height: 1.3; }
.bridge-label small { display: block; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bridge-label .info { margin-left: 5px; vertical-align: 0; }
.bridge-track { position: relative; height: 16px; }
.bridge-track span { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--c-prev); }
.bridge-row.pos .bridge-track span { background: var(--good); }
.bridge-row.neg .bridge-track span { background: var(--bad); }
.bridge-row.total .bridge-track span { background: color-mix(in srgb, var(--c-revenue) 45%, transparent); }
.bridge-row.end .bridge-track span { background: var(--c-revenue); }
.bridge-row.total { font-weight: 600; }
.bridge-row.total .bridge-label small { font-weight: 400; }
.bridge-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.bridge-value.pos { color: var(--good); }
.bridge-value.neg { color: var(--bad); }
@media (max-width: 560px) { .bridge-row { grid-template-columns: minmax(0, 1fr) 84px; } .bridge-track { grid-column: 1 / -1; grid-row: 2; } }

.verdict { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; cursor: help; background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--muted); }
.verdict.v-below { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, transparent); font-weight: 500; }
.verdict.v-above { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); font-weight: 500; }
.verdict.v-few { background: none; color: var(--faint); }
.table td span.up { color: var(--good); }
.table td span.down { color: var(--bad); }
.table td span[data-tip] { cursor: help; }
.flags .tag { cursor: help; }
.flags .tag.low { color: var(--c-meta); background: color-mix(in srgb, var(--c-meta) 12%, transparent); }
.step-rate .up { color: var(--good); }
.step-rate .down { color: var(--bad); }
.step-rate .muted { color: var(--muted); }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }

/* v4: selectable KPIs, thumbnails, image preview, CSV buttons */
.kpi.pickable { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.kpi.pickable:hover { border-color: var(--line-strong); }
.kpi.picked { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.chart.tall { min-height: 300px; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.btn.small:hover { color: var(--fg); border-color: var(--faint); }
.table td .thumb { display: block; width: 46px; height: 46px; border-radius: 6px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); }
.table td .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.table td .thumb.none, .table td .thumb.broken { background: repeating-linear-gradient(45deg, var(--panel-2), var(--panel-2) 4px, var(--line) 4px, var(--line) 5px); }
.table td .thumb.broken img { display: none; }
.tooltip.img { padding: 4px; min-width: 0; max-width: none; }
.tooltip .tt-img { display: block; width: 272px; height: 272px; object-fit: contain; border-radius: 6px; background: var(--panel-2); }
.card.grow { display: flex; flex-direction: column; }
.card.grow > .chart.fill { flex: 1 1 auto; min-height: 300px; display: flex; align-items: center; }

/* v5: behaviour, forecast, ad formats */
.legend i.light { opacity: 0.32; }
.steps-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .steps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .steps-grid { grid-template-columns: 1fr; } }
.step-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 12px 8px; background: var(--panel-2); min-width: 0; }
.step-card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.step-card .bars { min-height: 0; gap: 4px; }
.step-card .bar-row { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 76px; }
.step-card.weak { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad) 5%, var(--panel-2)); }
.step-flag { font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 999px; }
.step-flag.down { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, transparent); }
.step-flag.up { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.table tr.clickable { cursor: pointer; }
.table tr.sel td { background: color-mix(in srgb, var(--c-sessions) 9%, var(--panel)); }
.table tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--c-sessions); }
.fmt-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--muted); cursor: help; }
.verdict.used { margin-left: 8px; font-size: 11px; }
.warn-text { color: var(--warn); }
.forecast-head { align-items: flex-start; }
.forecast-head .summary { flex: 1 1 520px; }
.fc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.fc-card { display: grid; gap: 6px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.fc-card.now { border-color: var(--line-strong); }
.fc-month { font-weight: 600; font-size: 13px; }
.fc-month span { font-weight: 400; color: var(--muted); }
.fc-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fc-value small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.fc-ly { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--c-prev); cursor: help; }
