/*
  Retention Atlas - all visual styling.

  Colour tokens first (light, then dark under prefers-color-scheme); every
  component reads the tokens, never raw colours. The data-viz colours come
  from a validated palette:
    --lv0..--lv3   ordinal blue ramp for maturity / availability
                   (darkest = most complete on light, lightest on dark)
    --lv-none      "not offered" - a neutral grey, not a ramp step
    --central / --decentral / --nocomm   communication model (categorical)
    --good / --warn / --crit             status; always paired with an
                                         icon or label, never colour alone
  Type: Archivo (display, set wide), Hanken Grotesk (body), IBM Plex Mono
  (labels and figures).
*/

:root {
  color-scheme: light;
  --ground: #f2f4f7; --surface: #ffffff; --surface-2: #eceff4; --surface-3: #e2e7ee;
  --ink: #0d1624; --ink-2: #465264; --ink-3: #7a8495; --line: #dde2e9; --line-2: #c9d0da;
  --accent: #1c5cab; --accent-ink: #184f95; --accent-soft: #e1ecfa;
  --good: #0ca30c; --good-soft: #e1f5e3; --warn: #d28f00; --warn-soft: #fbefd2; --crit: #d03b3b; --crit-soft: #fde5e5;
  --idle: #d4d9e0;
  --lv0: #86b6ef; --lv1: #5598e7; --lv2: #256abf; --lv3: #104281; --lv-none: #d4d9e0;
  --central: #2a78d6; --decentral: #eb6834; --nocomm: #898781;
  --shadow: 0 1px 2px rgba(13, 22, 36, .05), 0 8px 24px -12px rgba(13, 22, 36, .14);
  --f-display: "Archivo", "Hanken Grotesk", system-ui, sans-serif;
  --f-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #0a1019; --surface: #111925; --surface-2: #18212f; --surface-3: #212c3c;
    --ink: #eef2f7; --ink-2: #aeb8c6; --ink-3: #7c8799; --line: #232e3e; --line-2: #334154;
    --accent: #6da7ec; --accent-ink: #9ec5f4; --accent-soft: #15263d;
    --good: #2bb24a; --good-soft: #12301b; --warn: #e0a21c; --warn-soft: #352a0f; --crit: #e66767; --crit-soft: #3a1b1b;
    --idle: #2c3747;
    --lv0: #184f95; --lv1: #2a78d6; --lv2: #6da7ec; --lv3: #b7d3f6; --lv-none: #2c3747;
    --central: #3987e5; --decentral: #d95926; --nocomm: #7d7c76;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--f-display); font-stretch: 112%; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
code { font-family: var(--f-mono); font-size: .92em; }
.num { font-family: var(--f-display); font-stretch: 108%; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--ink-3); }
.eyebrow { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0; }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar__in { max-width: 1320px; margin: 0 auto; padding-inline: 24px; height: 60px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-stretch: 118%; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand small { display: block; font-family: var(--f-mono); font-weight: 400; font-stretch: 100%; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); line-height: 1; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.spacer { flex: 1; }
.search-btn { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px 7px 12px; color: var(--ink-3); font-size: 14px; min-width: 230px; }
.search-btn kbd { margin-left: auto; font-family: var(--f-mono); font-size: 11px; border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; color: var(--ink-3); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-2); }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.mobile-nav { display: none; gap: 4px; overflow-x: auto; padding: 0 16px 10px; }
.mobile-nav a { padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); white-space: nowrap; }
.mobile-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 24px; padding-block: 22px 56px; }
.footer { max-width: 1320px; margin: 0 auto; padding-inline: 24px; padding-block: 18px 32px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.footer a { color: var(--accent); }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-3); margin-bottom: 18px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.crumbs__here { color: var(--ink); }
.view { animation: viewIn .45s cubic-bezier(.2, .7, .2, 1); }
@keyframes viewIn { from { opacity: .001; transform: translateY(10px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes pop { from { transform: scale(.3); opacity: .001; } }
@keyframes rise { from { transform: translateY(8px); opacity: .001; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(100%); } }

/* ---------- generic ---------- */
.section { margin-top: 44px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.sec-head h2 { font-size: 22px; font-weight: 700; }
.sec-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 62ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; min-width: 0; }
.panel h3 { font-size: 15.5px; font-weight: 650; }
.panel-sub { color: var(--ink-3); font-size: 13px; margin: 3px 0 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-map { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; font-size: 13.5px; }
.link-arrow::after { content: "→"; transition: transform .2s; }
a:hover .link-arrow::after, a.link-arrow:hover::after { transform: translateX(3px); }
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 9px 15px; font-weight: 600; font-size: 14px; border: 1px solid var(--line-2); background: var(--surface); white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.btn--danger:hover { background: var(--crit-soft); border-color: var(--crit); }
.btn--ghost { background: transparent; }
.btn--small { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.crit { background: var(--crit-soft); color: var(--crit); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none; }
.bar-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); transform-origin: left; animation: grow .9s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 50ms); }
.chart-box { position: relative; width: 100%; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.tabs a { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 170px; }
.tabs a:hover { border-color: var(--line-2); }
.tabs a small { font-size: 12px; color: var(--ink-3); }
.tabs a b { font-weight: 650; font-size: 14px; }
.tabs a[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); }
.tabs a[aria-current="page"] small { color: var(--accent-ink); }
.page-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: end; margin-bottom: 8px; }
.page-head h1 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 750; line-height: 1.08; margin: 8px 0 10px; }
.lede { margin: 0; color: var(--ink-2); font-size: 16px; max-width: 60ch; }

/* ---------- ordinal cells (maturity / availability) ---------- */
.lv0 { background: var(--lv0); } .lv1 { background: var(--lv1); } .lv2 { background: var(--lv2); } .lv3 { background: var(--lv3); }
.lv-none { background: var(--lv-none); }
.lv-other { background: repeating-linear-gradient(135deg, var(--line-2) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--line-2); }
.lv-empty, .lv-absent { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.lv-absent { opacity: .5; }

/* ---------- overview ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 28px; align-items: stretch; }
.hero__copy { padding: 10px 0; }
.hero h1 { font-size: clamp(28px, 3.6vw, 44px); line-height: 1.08; font-weight: 750; margin: 10px 0 14px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: 17px; max-width: 56ch; margin-bottom: 22px; }
.hero__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pulse { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; box-shadow: var(--shadow); }
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-fg { transition: stroke-dashoffset 1.2s cubic-bezier(.2, .7, .2, 1); }
.ring__label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring__label .num { font-size: 38px; font-weight: 750; line-height: 1; }
.ring__label small { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.pulse__rows { display: grid; gap: 14px; }
.pulse__row { display: grid; gap: 6px; }
.pulse__top { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; }
.pulse__top span:last-child { color: var(--ink-2); }
.pulse__row:hover .pulse__top span:first-child { color: var(--accent); }
.pulse__foot { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 12px; margin: 0; }

/* Subgrid: each card spans 5 shared rows (title, count, units, gap line, link), so the rows line up across cards even when a title wraps. */
.play-card { display: grid; grid-template-rows: subgrid; grid-row: span 5; row-gap: 14px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; transition: border-color .2s, transform .2s, box-shadow .2s; position: relative; }
.play-card > .link-arrow { justify-self: start; align-self: end; }
.play-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.play-card h3 { font-size: 16px; font-weight: 700; padding-right: 90px; }
.play-card__flag { position: absolute; top: 14px; right: 14px; }
.play-card__big { display: flex; align-items: baseline; gap: 8px; }
.play-card__big .num { font-size: 34px; font-weight: 750; line-height: 1; }
.play-card__big span:last-child { font-size: 13px; color: var(--ink-2); }
.play-card__gap { font-size: 13px; color: var(--ink-2); margin: 0; min-height: 2.9em; }
.play-card__gap strong { color: var(--warn); }
.units { display: grid; grid-template-columns: repeat(var(--n, 21), 1fr); gap: 3px; }
.units--big { grid-template-columns: repeat(var(--n, 21), minmax(0, 28px)); gap: 5px; }
.unit { aspect-ratio: 1; border-radius: 3px; background: var(--idle); animation: pop .5s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i, 0) * 22ms); }
.units--big .unit { border-radius: 5px; }
.unit.full { background: var(--good); }
.unit.tool { background: var(--warn); }
.unit.process { background: transparent; box-shadow: inset 0 0 0 2px var(--warn); }

.carto { width: 100%; height: auto; display: block; }
.tile { cursor: pointer; }
.tile rect { transition: transform .2s, stroke .2s; transform-box: fill-box; transform-origin: center; stroke: transparent; stroke-width: 2.5; }
.tile:hover rect, .tile:focus rect { stroke: var(--ink); transform: scale(1.06); }
.tile:focus { outline: none; }
.tile__in { animation: pop .55s cubic-bezier(.2, .9, .3, 1.25) both; animation-delay: calc(var(--i, 0) * 30ms); transform-box: fill-box; transform-origin: center; }
.carto__code { font-family: var(--f-display); font-stretch: 110%; font-weight: 700; font-size: 15px; }
.carto__value { font-family: var(--f-mono); font-size: 10.5px; }
.carto__region { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; fill: var(--ink-3); }
.grad { height: 10px; border-radius: 99px; margin-top: 6px; }
.grad__labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); font-family: var(--f-mono); margin-top: 4px; }
.region-row { display: grid; grid-template-columns: 120px 1fr 44px; gap: 12px; align-items: center; font-size: 13.5px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.region-row:last-child { border-bottom: 0; }
.region-row .num { text-align: right; font-weight: 650; }
.region-row__n { color: var(--ink-3); font-size: 12px; }
.rank-list { display: grid; gap: 2px; margin-top: 8px; }
.rank-list a { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; font-size: 13.5px; }
.rank-list a:hover { background: var(--surface-2); }
.rank-list__n { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); }
.rank-list__sep { border-top: 1px dashed var(--line); margin: 4px 0; }

.insight { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; transition: border-color .2s, transform .2s; animation: rise .5s both; animation-delay: calc(var(--i, 0) * 70ms); }
.insight:hover { border-color: var(--accent); transform: translateY(-2px); }
.insight h3 { font-size: 16px; font-weight: 700; line-height: 1.25; }
.insight p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.insight .link-arrow { margin-top: auto; }
.mini-markets { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-markets span { font-family: var(--f-mono); font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); }

.lens-card { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; transition: border-color .2s, transform .2s; }
.lens-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lens-card .xl { font-size: 40px; font-weight: 750; line-height: 1; }
.lens-card p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.lens-card .link-arrow { margin-top: auto; }
.lens-mini { display: grid; gap: 7px; margin-top: 4px; }
.lens-mini__row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 34px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.lens-mini__row .mono { text-align: right; font-size: 11.5px; }
.stack { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--surface-3); }
.stack i { display: block; height: 100%; transform-origin: left; animation: grow .9s cubic-bezier(.2, .7, .2, 1) both; }

/* ---------- play page ---------- */
.funnel { display: grid; gap: 10px; }
.funnel__row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 50px; gap: 14px; align-items: center; }
.funnel__label { font-size: 13.5px; font-weight: 600; }
.funnel__label small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }
.funnel__bar { height: 34px; border-radius: 8px; background: var(--surface-2); position: relative; overflow: hidden; }
.funnel__bar i { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: var(--accent); transform-origin: left; animation: grow 1s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 120ms); display: flex; align-items: center; padding-left: 10px; color: var(--surface); font-family: var(--f-display); font-style: normal; font-weight: 700; font-size: 15px; }
.funnel__row--goal .funnel__bar i { background: var(--good); }
.funnel__drop { font-family: var(--f-mono); font-size: 12px; color: var(--crit); text-align: right; }
.heat-wrap { overflow-x: auto; margin-inline: -4px; padding-inline: 4px; }
table.heat { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 760px; font-size: 13px; }
table.heat th { font-weight: 600; font-size: 11.5px; color: var(--ink-3); text-align: center; padding: 4px 2px 8px; vertical-align: bottom; line-height: 1.2; }
table.heat .l { text-align: left; }
table.heat td.l { padding-right: 10px; white-space: nowrap; }
table.heat tbody tr { cursor: pointer; }
table.heat tbody tr:hover td.l { color: var(--accent); }
table.heat td.c { height: 30px; border-radius: 5px; min-width: 46px; animation: pop .4s both; animation-delay: calc(var(--i, 0) * 8ms); }
table.heat tfoot td { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); text-align: center; padding-top: 6px; }
table.heat tfoot td.l { text-align: left; font-family: var(--f-body); }
table.heat--dots { min-width: 560px; }
table.heat--dots td { text-align: center; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); animation: pop .35s both; animation-delay: calc(var(--i, 0) * 6ms); }
.dot--on { background: var(--accent); box-shadow: none; }
.comm-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.comm-pill--empty { color: var(--ink-3); }
.gap-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gap-list a { font-size: 13px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.gap-list a:hover { border-color: var(--accent); color: var(--accent); }
.gap-list__title { width: 100%; margin: 6px 0 0; }
.gap-list__title b { color: var(--ink); }

/* ---------- markets table ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters__legend { margin-left: auto; }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
table.mk { width: 100%; border-collapse: collapse; min-width: 820px; font-size: 14px; }
table.mk th { font-weight: 600; font-size: 12px; color: var(--ink-3); text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.mk th button { background: none; border: 0; padding: 0; font-weight: 600; color: inherit; }
table.mk th button:hover { color: var(--accent); }
table.mk th button[aria-sort]::after { content: " ↓"; }
table.mk td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
table.mk tr:last-child td { border-bottom: 0; }
table.mk tbody tr { cursor: pointer; transition: background .15s; }
table.mk tbody tr:hover { background: var(--surface-2); }
.cellbar { display: grid; grid-template-columns: 1fr 36px; gap: 8px; align-items: center; min-width: 110px; }
.cellbar .mono { font-size: 12px; text-align: right; color: var(--ink-2); }
.pips { display: flex; gap: 4px; }
.pips i { width: 14px; height: 14px; border-radius: 4px; background: var(--idle); }
.pips i.full { background: var(--good); }
.pips i.tool { background: var(--warn); }
.pips i.process { background: transparent; box-shadow: inset 0 0 0 2px var(--warn); }

/* ---------- market page ---------- */
.m-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; }
.m-head h1 { font-size: clamp(34px, 5vw, 58px); font-weight: 800; font-stretch: 120%; line-height: 1; margin: 6px 0 12px; }
.m-head__meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.m-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.edit-banner { margin-top: 18px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; }
.edit-banner a { color: var(--accent); font-weight: 600; }
.m-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr); }
.m-summary__ring { display: flex; gap: 20px; align-items: center; }
.m-summary__compare { font-size: 13.5px; color: var(--ink-2); display: grid; gap: 6px; }
.m-summary__compare b { color: var(--ink); }
.m-summary__compare .up { color: var(--good); font-weight: 600; }
.m-summary__compare .down { color: var(--crit); font-weight: 600; }
.m-summary__bullets { display: grid; gap: 14px; }
.bullet { display: grid; gap: 6px; }
.bullet__top { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; }
.bullet__track { position: relative; height: 12px; border-radius: 99px; background: var(--surface-3); }
.bullet__track i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); transform-origin: left; animation: grow .9s cubic-bezier(.2, .7, .2, 1) both; }
.bullet__track b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; }
.findings ul { margin: 12px 0 0; padding: 0; display: grid; gap: 10px; list-style: none; }
.findings li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-size: 14px; }
.findings .chip { padding: 2px 7px; }

.mplay { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; transition: border-color .2s, box-shadow .2s; cursor: pointer; }
.mplay:hover { border-color: var(--line-2); }
.mplay.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mplay__select { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: none; border: 0; padding: 0; text-align: left; }
.mplay__select h3 { font-size: 15px; font-weight: 700; }
.mplay__row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--ink-2); gap: 8px; min-height: 24px; }
.mstrip { display: grid; grid-template-columns: repeat(var(--n, 7), 1fr); gap: 3px; }
.mstrip i { height: 16px; border-radius: 3px; }

.flow__head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.flow { list-style: none; margin: 0; padding: 0 0 6px; display: flex; overflow-x: auto; }
.flow__step { flex: 1 0 150px; display: flex; align-items: stretch; animation: rise .45s both; animation-delay: calc(var(--i, 0) * 70ms); }
.flow--editing .flow__step { flex-basis: 230px; }
.flow__box { flex: 1; background: var(--surface-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--c, var(--line-2)); min-width: 0; }
.flow__box--edit { border-top-color: var(--accent); }
.flow__number { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); }
.flow__label { font-size: 13.5px; line-height: 1.25; }
.flow__value { font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.flow__value--empty { color: var(--ink-3); font-style: italic; }
.flow__same { font-size: 11px; color: var(--ink-3); margin-top: auto; }
.flow__arrow { align-self: center; width: 18px; flex: none; text-align: center; color: var(--ink-3); }
.flow__empty { color: var(--ink-3); font-size: 13.5px; padding: 8px 0; }
.flow__fields { display: grid; gap: 6px; }
.flow__hint { margin: 0; font-size: 11px; color: var(--ink-3); }
.flow__controls { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.flow__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.cerebro { display: grid; grid-template-columns: 200px 1fr; gap: 26px; align-items: center; }
.core { border-radius: 16px; padding: 18px; text-align: center; background: var(--surface-2); border: 2px solid var(--line-2); display: grid; gap: 4px; justify-items: center; }
.core--on { border-color: var(--good); background: var(--good-soft); }
.core .num { font-size: 22px; font-weight: 750; }
.branches { display: grid; gap: 14px; border-left: 2px solid var(--line-2); padding-left: 22px; }
.branch h4, .enab-cat h4 { margin: 0 0 8px; font-size: 12px; font-family: var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.nodes { display: flex; flex-wrap: wrap; gap: 8px; }
.node { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; border: 1.5px solid var(--line-2); color: var(--ink-3); animation: pop .4s both; animation-delay: calc(var(--i, 0) * 60ms); }
.node--on { border-color: var(--good); color: var(--ink); background: var(--good-soft); }
.enab-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.enab { border-radius: 10px; padding: 10px 12px; background: var(--surface-2); display: grid; gap: 4px; margin-bottom: 8px; border-left: 4px solid var(--c, var(--line-2)); }
.enab b { font-size: 13px; }
.enab span { font-size: 12px; color: var(--ink-2); }
.enab--edit { border-left-color: var(--accent); }

/* ---------- edit controls ---------- */
.edit-input, .edit-select { width: 100%; font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; }
.edit-input:focus, .edit-select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; }
.check:has(input:checked) { border-color: var(--good); background: var(--good-soft); }
.check input { accent-color: var(--good); width: 15px; height: 15px; margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; }
.switch__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 32px; height: 18px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); transition: transform .2s; }
.switch__input:checked + .switch__track { background: var(--good); }
.switch__input:checked + .switch__track::after { transform: translateX(14px); }
.switch__input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
body.is-editing .view *, body.is-editing #main * { animation: none !important; }

/* ---------- overlays ---------- */
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12.5px; padding: 8px 10px; border-radius: 8px; max-width: 280px; line-height: 1.4; opacity: 0; transition: opacity .12s; }
.tip b { display: block; font-size: 13px; }
.tip.is-on { opacity: 1; }
.peek { position: fixed; inset: 0; z-index: 50; }
.peek__scrim { position: absolute; inset: 0; background: rgba(5, 10, 18, .35); animation: fade .2s both; }
.peek__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -20px 0 60px -20px rgba(0, 0, 0, .35); padding: 22px; overflow-y: auto; animation: slideIn .32s cubic-bezier(.2, .7, .2, 1) both; display: flex; flex-direction: column; gap: 18px; }
.peek__panel h2 { font-size: 30px; font-weight: 800; font-stretch: 120%; }
.peek__close { position: absolute; top: 14px; right: 14px; border: 0; background: var(--surface-2); border-radius: 8px; width: 32px; height: 32px; font-size: 18px; }
.peek__summary { display: flex; gap: 18px; align-items: center; }
.peek__bars { display: grid; gap: 10px; flex: 1; }
.peek__bars .bullet__top { font-size: 12.5px; }
.peek__plays { display: grid; gap: 8px; }
.peek__plays div { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; gap: 8px; }
.search { position: fixed; inset: 0; z-index: 70; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 0; }
.search__scrim { position: absolute; inset: 0; background: rgba(5, 10, 18, .45); animation: fade .15s both; }
.search__box { position: relative; width: min(600px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); overflow: hidden; animation: rise .2s both; }
.search__box input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 16px 18px; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.search__list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.search__list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; font-size: 14px; }
.search__list a:hover { background: var(--surface-2); }
.search__list a small { color: var(--ink-3); font-size: 12px; }
.search__list a.is-selected { background: var(--accent-soft); color: var(--accent-ink); }
.search__group { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px 4px; }

/* ---------- settings ---------- */
.icon-btn[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.btn--danger-solid { background: var(--crit); border-color: var(--crit); color: #fff; }
.set-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 22px; }
.set-nav { position: sticky; top: 80px; display: grid; gap: 2px; }
.set-nav button { text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.set-nav button:hover { background: var(--surface); color: var(--ink); }
.set-content { display: grid; gap: 16px; min-width: 0; }
.set-section { scroll-margin-top: 80px; display: grid; gap: 16px; }
.set-section h2 { font-size: 20px; font-weight: 700; margin-top: 4px; }
.set-section h3 { font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.set-section .panel-sub { margin-bottom: 0; max-width: 70ch; }
.set-section__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.set-empty { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.set-edits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; }
.set-row__main { display: flex; align-items: center; gap: 10px; flex: 1 1 200px; min-width: 0; flex-wrap: wrap; }
.set-row__title { font-weight: 600; font-size: 14px; }
a.set-row__title:hover { color: var(--accent); }
.set-row__meta { font-size: 12.5px; color: var(--ink-3); }
.set-row__stat { display: grid; grid-template-columns: 110px 40px; gap: 8px; align-items: center; }
.set-row__stat .mono { font-size: 12px; color: var(--ink-2); text-align: right; }
.set-groups { display: grid; gap: 14px; }
.set-group h4, .set-cat h4 { margin: 0 0 4px; font-size: 12px; font-family: var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.set-note { font-size: 13.5px; color: var(--ink-2); background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; }
.set-note a { color: var(--accent); font-weight: 600; }
.set-flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: none; }
.set-step { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; border-left: 4px solid var(--accent); }
.set-step__n { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.set-step__main { display: grid; gap: 5px; min-width: 0; }
.set-step__kind { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.set-step__kind .chip { background: var(--surface); }
.set-options { display: flex; gap: 4px; flex-wrap: wrap; }
.set-options span { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--ink-2); }
.set-step__actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.set-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.set-cat { background: var(--surface-2); border-radius: 12px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.set-cat__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-area { background: var(--surface); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; justify-items: start; }
.set-area__top { display: grid; gap: 2px; }
.set-area__top b { font-size: 13.5px; }
.set-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.set-form .edit-input, .set-form .edit-select { width: auto; flex: 1 1 200px; }
.set-form--compact { flex-wrap: nowrap; }
.set-form--compact .edit-input { flex: 1 1 0; min-width: 0; }
.form-error { margin: 0; color: var(--crit); font-size: 13px; }
.confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; background: var(--crit-soft); border-radius: 10px; padding: 6px 10px; }
.set-scale { display: grid; grid-template-columns: 12px 120px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.set-scale:last-child { border-bottom: 0; }
.set-scale span { color: var(--ink-2); font-size: 12.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-map, .hero, .page-head, .m-summary { grid-template-columns: 1fr; }
  .enab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-btn { min-width: 0; }
  .search-btn__label { display: none; }
  .set-layout { grid-template-columns: 1fr; }
  .set-nav { position: static; display: flex; overflow-x: auto; }
  .set-nav button { white-space: nowrap; }
}
@media (max-width: 760px) {
  .topbar__in, .wrap, .footer { padding-inline: 16px; }
  .topbar__in { gap: 10px; }
  .nav { display: none; }
  .mobile-nav { display: flex; }
  .brand small { display: none; }
  .g2, .g3, .g4, .enab-grid { grid-template-columns: 1fr; }
  .pulse { grid-template-columns: 1fr; justify-items: center; }
  .pulse__rows { width: 100%; }
  .cerebro { grid-template-columns: 1fr; }
  .branches { border-left: 0; padding-left: 0; }
  .funnel__row { grid-template-columns: 1fr 50px; }
  .funnel__label { grid-column: 1 / -1; }
  .m-head { grid-template-columns: 1fr; }
  .filters__legend { margin-left: 0; }
  .units--big { grid-template-columns: repeat(var(--n, 21), minmax(0, 1fr)); gap: 3px; }
  .set-edits { grid-template-columns: 1fr; }
  .set-step { grid-template-columns: 28px minmax(0, 1fr); }
  .set-step > .set-row__meta, .set-step__actions { grid-column: 2; justify-content: flex-start; }
  .set-scale { grid-template-columns: 12px 1fr; }
  .set-scale span { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
