/* MAG Hub — design tokens, shell, components, chart kit.
   Brand gold lives in the chrome only; data marks use the validated series palette
   so a brand colour never impersonates a series. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-600.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --hover: rgba(11, 11, 11, .045);
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --hairline: rgba(11, 11, 11, .10);

  --focus: #2a78d6;
  --brand: #FAC70C;
  --brand-ink: #0b0b0b;
  --brand-text: #8a6d00;          /* gold as text on a light surface: 4.8:1 */
  --rail: #0b0b0b;
  --rail-ink: #f3f2ee;
  --rail-muted: #9a988f;
  --rail-hover: rgba(255, 255, 255, .07);

  /* series: fixed slot per division, validated for colour-vision deficiency in both themes */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  /* Group-level marks are neutral ink, so "the group" never looks like one of its companies. */
  --accent: #2f2e2b;
  --accent-track: #dedcd5;
  --deemph: #898781;
  /* ordered stages / age buckets: one hue, stepped; the heaviest step is the oldest bucket */
  --ord-1: #86b6ef; --ord-2: #3987e5; --ord-3: #1c5cab; --ord-4: #0d366b;
  /* status: reserved meaning, always shown with a glyph and a label */
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-text: #006300;
  --bad-text: #b42318;
  --warn-text: #7a5200;
  --good-tint: rgba(12, 163, 12, .10);
  --bad-tint: rgba(208, 59, 59, .10);
  --warn-tint: rgba(250, 178, 25, .16);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-card: 10px;
  --r-input: 7px;
  --rail-w: 232px;
  --topbar-h: 60px;
  --tabs-h: 58px;
  --content-max: 1360px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --z-rail: 20; --z-topbar: 10; --z-tabs: 20; --z-menu: 30; --z-tip: 60;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #242422; --hover: rgba(255, 255, 255, .06);
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781; --grid: #2c2c2a; --axis: #383835; --hairline: rgba(255, 255, 255, .10);
    --brand-text: #FAC70C; --rail: #141413;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --accent: #e8e6df; --accent-track: #3a3a37; --deemph: #6b6a63;
    --ord-1: #184f95; --ord-2: #2a78d6; --ord-3: #6da7ec; --ord-4: #b7d3f6;
    --good-text: #0ca30c; --bad-text: #f07b72; --warn-text: #fab219;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #242422; --hover: rgba(255, 255, 255, .06);
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781; --grid: #2c2c2a; --axis: #383835; --hairline: rgba(255, 255, 255, .10);
  --brand-text: #FAC70C; --rail: #141413;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --accent: #e8e6df; --accent-track: #3a3a37; --deemph: #6b6a63;
  --ord-1: #184f95; --ord-2: #2a78d6; --ord-3: #6da7ec; --ord-4: #b7d3f6;
  --good-text: #0ca30c; --bad-text: #f07b72; --warn-text: #fab219;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; overflow-x: hidden; background: var(--page); color: var(--ink); font: 400 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--ink-2); }

/* ---------- shell ---------- */
.app { min-height: 100dvh; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100dvh; background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; padding: 16px 12px; z-index: var(--z-rail); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 600; font-size: 12px; letter-spacing: .02em; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand-name span { color: var(--rail-muted); font-weight: 400; }
.nav-group { margin: 14px 8px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--rail-muted); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--rail-ink); font-weight: 500; font-size: 13.5px; position: relative; }
.nav-item:hover { background: var(--rail-hover); }
.nav-item[aria-current="page"] { background: var(--rail-hover); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin: 0 4px; }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); }
.rail-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .10); font-size: 12px; color: var(--rail-muted); display: grid; gap: 8px; }
.rail-user { display: flex; align-items: center; gap: 8px; color: var(--rail-ink); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .12); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.rail-foot button { background: none; border: 0; padding: 0; color: var(--rail-muted); cursor: pointer; text-align: left; }
.rail-foot button:hover { color: var(--rail-ink); }

.main { min-width: 0; max-width: 100vw; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: var(--z-topbar); min-height: var(--topbar-h); display: flex; align-items: center; gap: 16px; padding: 10px 28px; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--hairline); }
.topbar h1 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.topbar-sub { font-size: 12.5px; color: var(--ink-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 22px 28px 64px; display: grid; gap: 18px; }
.tabs { display: none; }

/* freshness chip: status is never colour alone — dot + words */
.fresh { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); padding: 5px 10px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--surface); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.good { background: var(--good); } .dot.warning { background: var(--warning); } .dot.serious { background: var(--serious); } .dot.critical { background: var(--critical); }

/* ---------- controls ---------- */
.seg-ctl { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--hairline); }
.seg-ctl button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg-ctl button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--hairline); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: var(--r-input); border: 1px solid transparent; background: var(--brand); color: var(--brand-ink); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--hairline); font-weight: 500; }
.btn.danger { background: none; color: var(--bad-text); border-color: var(--hairline); font-weight: 500; }
.btn-ghost { border: 1px solid var(--hairline); background: var(--surface); border-radius: 6px; padding: 5px 10px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-ghost.sm { padding: 3px 9px; font-size: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.input, select.input { width: 100%; padding: 9px 11px; border-radius: var(--r-input); border: 1px solid var(--axis); background: var(--surface); color: var(--ink); font: inherit; }
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.form-error { color: var(--bad-text); font-size: 13px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-row .field { flex: 1 1 160px; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 16px 18px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-title { font-size: 14px; font-weight: 600; }
.card-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.card-foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); font-size: 12.5px; color: var(--ink-2); }
.card-body { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .wide, .grid-3 > .wide { grid-column: 1 / -1; }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 8px 0 -6px; display: flex; align-items: baseline; gap: 10px; }
.section-title a { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }

/* hero: exactly one per view */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: end; }
.hero-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.hero-value { font-size: clamp(40px, 6vw, 60px); font-weight: 600; letter-spacing: -.03em; line-height: 1.05; margin: 4px 0 8px; }
.hero-line { font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.hero-line strong { color: var(--ink); font-weight: 600; }
.hero-side { display: grid; gap: 10px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; }
.tile { position: relative; display: block; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 14px 16px 12px; min-width: 0; }
a.tile:hover { border-color: var(--axis); }
.tile-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tile-hint { flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--axis); font-size: 10px; display: inline-grid; place-items: center; color: var(--muted); cursor: help; font-style: normal; }
.tile-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 4px; line-height: 1.15; }
.tile-foot { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12.5px; min-height: 18px; }
.tile-sub { color: var(--ink-2); }
.tile-spark { position: absolute; right: 12px; top: 12px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; white-space: nowrap; }
.delta-arrow { font-size: 8px; }
.delta.good { color: var(--good-text); } .delta.bad { color: var(--bad-text); } .delta.flat { color: var(--ink-2); }

/* company cards */
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.co { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 14px 16px; }
.co:hover { border-color: var(--axis); }
.co-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.co-head .nav-dot { margin: 0; }
.co-head .pill { margin-left: auto; }
.co-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.co-value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.co-meta { font-size: 12.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--hairline); color: var(--ink-2); white-space: nowrap; }
.pill.good { color: var(--good-text); background: var(--good-tint); border-color: transparent; }
.pill.warning { color: var(--warn-text); background: var(--warn-tint); border-color: transparent; }
.pill.critical, .pill.serious { color: var(--bad-text); background: var(--bad-tint); border-color: transparent; }

/* insights */
.insights { display: grid; gap: 8px; }
.insight { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); }
.insight-glyph { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; margin-top: 1px; }
.insight-glyph.critical { background: var(--critical); } .insight-glyph.serious { background: var(--serious); color: #0b0b0b; }
.insight-glyph.warning { background: var(--warning); color: #0b0b0b; } .insight-glyph.info { background: var(--muted); }
.insight-title { font-weight: 600; font-size: 14px; }
.insight-body { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.insight-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 7px; font-size: 12px; color: var(--ink-2); align-items: center; }
.insight-impact { font-weight: 600; font-size: 14px; white-space: nowrap; text-align: right; }
.insight-impact small { display: block; font-weight: 400; font-size: 11.5px; color: var(--ink-2); }
.insight details { margin-top: 8px; }
.insight summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--axis); }
.link:hover { text-decoration-color: currentColor; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-2); padding: 7px 10px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr:hover { background: var(--hover); }
table.data tr:last-child td { border-bottom: 0; }

/* launchpad */
.launch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.launch { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); }
.launch:hover { border-color: var(--axis); background: var(--surface-2); }
.launch-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 600; font-size: 12px; background: var(--surface-2); border: 1px solid var(--hairline); }
.launch-name { font-weight: 600; font-size: 13.5px; }
.launch-desc { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launch-arrow { color: var(--muted); font-size: 13px; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: #0b0b0b; color: #f3f2ee; }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.login-card .brand { padding: 0 0 6px; }
.login-card h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.login-card p { color: #9a988f; font-size: 13.5px; }
.login-card .field label { color: #c3c2b7; }
.login-card .input { background: #1a1a19; border-color: #383835; color: #fff; }

.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); font-size: 13.5px; }
.notice { padding: 10px 14px; border-radius: var(--r-card); background: var(--warn-tint); color: var(--ink); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: var(--z-tip); }
.toast { background: var(--ink); color: var(--page); padding: 9px 14px; border-radius: 8px; font-size: 13px; }
.deflist { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 8px 18px; font-size: 13px; }
.deflist dt { font-weight: 600; } .deflist dd { margin: 0; color: var(--ink-2); }

/* ---------- chart kit ---------- */
.viz-host { width: 100%; min-width: 0; }
.viz-svg { display: block; overflow: visible; }
.viz-grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz-axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.viz-tick { fill: var(--muted); font: 400 11px var(--font); font-variant-numeric: tabular-nums; }
.viz-prev { fill: var(--deemph); }
/* Projected bars are hollow: a tint of the series colour with its outline. Fading alone made a
   projection in neutral ink look like last year's grey. */
.viz-soft { fill-opacity: .14; stroke-width: 1.5; }
.viz-gap { fill: var(--surface); }
.viz-whisker { stroke: var(--ink-2); stroke-width: 1; }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-dot { stroke: var(--surface); stroke-width: 2; }
.viz-cross { stroke: var(--axis); stroke-width: 1; }
.viz-hit { fill: transparent; cursor: default; outline: none; }
.viz-hit:hover, .viz-hit:focus-visible { fill: var(--hover); }
.viz-hit.plain:hover, .viz-hit.plain:focus-visible { fill: transparent; }
.viz-hit.plain:focus-visible { stroke: var(--focus); stroke-width: 1; }
.viz-spark-line { fill: none; stroke: var(--deemph); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.viz-empty { color: var(--ink-2); font-size: 13px; padding: 18px 0; }

.viz-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 10px; font-size: 12px; color: var(--ink-2); }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.viz-swatch.line { height: 2px; width: 14px; border-radius: 1px; }
.viz-swatch.soft { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--swatch, currentColor); }

.viz-tip { position: fixed; z-index: var(--z-tip); pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--hairline); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; max-width: 300px; box-shadow: 0 6px 24px rgba(0, 0, 0, .14); }
.viz-tip-title { font-weight: 600; margin-bottom: 5px; }
.viz-tip-row { display: grid; grid-template-columns: 14px auto minmax(0, 1fr); gap: 7px; align-items: center; padding: 1px 0; }
.viz-key { width: 12px; height: 3px; border-radius: 2px; }
.viz-key.soft { background: transparent !important; box-shadow: inset 0 0 0 1px var(--swatch, currentColor); } .viz-key.none { background: none; }
.viz-tip-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.viz-tip-label { color: var(--ink-2); }
.viz-tip-foot { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--hairline); color: var(--ink-2); }

.viz-hbars { display: grid; gap: 2px; }
.viz-hbar { display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 6px; border-radius: 6px; }
.viz-hbar:hover, .viz-hbar:focus-visible { background: var(--hover); }
.viz-hbar-label { min-width: 0; display: grid; }
.viz-hbar-name { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.viz-hbar-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.viz-hbar-sub { font-size: 11.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-hbar-track { height: 10px; }
.viz-hbar-fill { height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.viz-hbar-val { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }

.viz-seg { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin: 4px 0 12px; }
.viz-seg-part { min-width: 3px; flex-basis: 0; }
.viz-seg-list { display: grid; gap: 5px; font-size: 13px; }
.viz-seg-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 44px; gap: 9px; align-items: center; }
.viz-seg-val { font-weight: 500; font-variant-numeric: tabular-nums; }
.viz-seg-pct { color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }

.viz-meter-track { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--meter, var(--accent)) 20%, var(--surface)); overflow: hidden; }
.viz-meter-fill { height: 100%; background: var(--meter, var(--accent)); border-radius: 4px; }
.viz-meter-cap { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }

.viz-funnel { display: grid; gap: 8px; }
.viz-funnel-row { display: grid; grid-template-columns: minmax(96px, 26%) minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.viz-funnel-label { font-size: 13px; font-weight: 500; }
.viz-funnel-track { height: 14px; }
.viz-funnel-fill { height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.viz-funnel-val { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.viz-funnel-note { grid-column: 2 / -1; font-size: 12px; color: var(--ink-2); margin-top: -2px; }

/* ---------- small screens ---------- */
@media (max-width: 1080px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  /* On a phone the title sits on its own line and the controls wrap beneath it; the bar scrolls
     away with the page rather than taking a fifth of the screen. */
  .topbar { position: static; flex-wrap: wrap; gap: 8px 12px; padding: 12px 16px 10px; backdrop-filter: none; background: var(--page); }
  .topbar > div:first-child { flex: 1 1 100%; min-width: 0; }
  .topbar-right { margin-left: 0; width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .seg-ctl { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg-ctl::-webkit-scrollbar { display: none; }
  .seg-ctl button { padding: 6px 10px; }
  .content { padding: 16px 16px calc(var(--tabs-h) + 32px); gap: 14px; }
  .grid-2, .grid-3, .hero { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-spark { display: none; }
  .tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--rail); z-index: var(--z-tabs); }
  .tab { display: grid; place-items: center; align-content: center; gap: 3px; font-size: 10.5px; color: var(--rail-muted); font-weight: 500; }
  .tab svg { width: 19px; height: 19px; }
  .tab[aria-current="page"] { color: var(--brand); }
  .insight { grid-template-columns: auto minmax(0, 1fr); }
  .insight-impact { grid-column: 2; text-align: left; }
  .deflist { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .deflist dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: no-preference) {
  .tile, .co, .launch, .btn-ghost { transition: border-color 120ms var(--ease), background 120ms var(--ease); }
}
@media print {
  .rail, .tabs, .topbar-right { display: none; }
  .app { grid-template-columns: 1fr; }
}
