/* RetaliQ Asset Protection — layout, tokens (light + dark), components, charts */
:root {
  color-scheme: light;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f9fc; --hover: #f0f4fa;
  --ink: #0b1f3a; --ink-2: #44546a; --muted: #6b7a90;
  --line: #e3e8ef; --grid: #e9edf2; --axis: #c3cbd6;
  --brand: #0a1f3a; --brand-2: #0f2d52; --brand-ink: #dfe8f3; --brand-mut: #93a7bf;
  --accent: #1f6feb; --accent-soft: #e8f0fe; --accent-ink: #1550b8;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --deemph: #c3cbd6; --deemph-2: #dfe4ea;
  --seq-100: #cde2fb; --seq-200: #9ec5f4; --seq-300: #6da7ec; --seq-400: #3987e5; --seq-500: #256abf; --seq-600: #184f95; --seq-700: #0d366b;
  --div-worse: #e34948; --div-better: #2a78d6; --div-mid: #f0efec;
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --crit: #d03b3b; --good-text: #006300; --crit-text: #b42323; --warn-text: #8a5a00;
  --shadow: 0 1px 2px rgba(11, 31, 58, .06), 0 1px 1px rgba(11, 31, 58, .03);
  --rad: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0b1220; --surface: #111a2b; --surface-2: #0f1727; --hover: #18243a;
    --ink: #e8eef6; --ink-2: #b9c5d5; --muted: #8796ab;
    --line: #23324b; --grid: #1c2840; --axis: #3a4b66;
    --brand: #070e1a; --brand-2: #0c1628;
    --accent: #4c8dff; --accent-soft: #162a4d; --accent-ink: #8fb6ff;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
    --deemph: #3e4f69; --deemph-2: #2a3850;
    --seq-100: #104281; --seq-200: #184f95; --seq-300: #1c5cab; --seq-400: #2a78d6; --seq-500: #5598e7; --seq-600: #86b6ef; --seq-700: #b7d3f6;
    --div-worse: #e66767; --div-better: #3987e5; --div-mid: #383835;
    --good-text: #3ec43e; --crit-text: #ff8b8b; --warn-text: #f5c560;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220; --surface: #111a2b; --surface-2: #0f1727; --hover: #18243a;
  --ink: #e8eef6; --ink-2: #b9c5d5; --muted: #8796ab;
  --line: #23324b; --grid: #1c2840; --axis: #3a4b66;
  --brand: #070e1a; --brand-2: #0c1628;
  --accent: #4c8dff; --accent-soft: #162a4d; --accent-ink: #8fb6ff;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
  --deemph: #3e4f69; --deemph-2: #2a3850;
  --seq-100: #104281; --seq-200: #184f95; --seq-300: #1c5cab; --seq-400: #2a78d6; --seq-500: #5598e7; --seq-600: #86b6ef; --seq-700: #b7d3f6;
  --div-worse: #e66767; --div-better: #3987e5; --div-mid: #383835;
  --good-text: #3ec43e; --crit-text: #ff8b8b; --warn-text: #f5c560;
  --shadow: none;
}

/* text colour on top of each step of the sequential ramp (the ramp flips in dark mode) */
:root { --seqt-1: #0b0b0b; --seqt-2: #0b0b0b; --seqt-3: #0b0b0b; --seqt-4: #ffffff; --seqt-5: #ffffff; --seqt-6: #ffffff; --seqt-7: #ffffff; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) { --seqt-1: #ffffff; --seqt-2: #ffffff; --seqt-3: #ffffff; --seqt-4: #ffffff; --seqt-5: #0b0b0b; --seqt-6: #0b0b0b; --seqt-7: #0b0b0b; } }
:root[data-theme="dark"] { --seqt-1: #ffffff; --seqt-2: #ffffff; --seqt-3: #ffffff; --seqt-4: #ffffff; --seqt-5: #0b0b0b; --seqt-6: #0b0b0b; --seqt-7: #0b0b0b; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, td.r, th.r { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
header.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 16px; background: var(--brand); color: var(--brand-ink); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; flex-shrink: 0; }
.brand img { height: 26px; width: auto; display: block; }
.brand .prod { font-weight: 700; font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; border-left: 1px solid rgba(255, 255, 255, .16); padding-left: 12px; white-space: nowrap; }
.tenant { color: var(--brand-mut); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
header .sp { flex: 1; }
.ctl { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ctl label { display: flex; align-items: center; gap: 6px; color: var(--brand-mut); font-size: 12px; font-weight: 600; white-space: nowrap; }
.ctl select, .ctl button { background: rgba(255, 255, 255, .07); color: #fff; border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; padding: 5px 8px; font-size: 13px; font-weight: 600; }
.ctl select option { color: #111; }
.ctl button:hover, .ctl select:hover { border-color: rgba(255, 255, 255, .35); }
.menu-btn, .menu-btn.btn { display: none; }
.ribbon { background: var(--brand-2); color: var(--brand-mut); font-size: 12px; padding: 5px 16px; border-top: 1px solid rgba(255, 255, 255, .06); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ribbon b { color: var(--brand-ink); font-weight: 600; }
.ribbon .mchips { display: flex; gap: 6px; flex-wrap: wrap; }
.ribbon .mchip { color: var(--brand-ink); border-color: rgba(255, 255, 255, .2); background: transparent; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 82px); }
nav.side { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
nav.side a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 13.5px; }
nav.side a svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.side a:hover { background: var(--hover); color: var(--ink); }
nav.side a.on { background: var(--accent-soft); color: var(--accent-ink); }
nav.side .sep { height: 1px; background: var(--line); margin: 10px 6px; }
nav.side .who { margin: 16px 6px 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--muted); }
nav.side .who b { display: block; color: var(--ink); font-size: 12.5px; }
main { padding: 20px 24px 60px; min-width: 0; }
.page { max-width: 1360px; margin: 0 auto; }
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.phead h1 { font-size: 22px; font-weight: 750; }
.phead .sub { color: var(--muted); margin-top: 4px; font-size: 13px; }
.phead .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); gap: 10px; text-align: center; }
.loading .bar { width: 180px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; position: relative; }
.loading .bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); animation: ld 1s ease-in-out infinite alternate; }
@keyframes ld { from { transform: translateX(-10%); } to { transform: translateX(160%); } }

/* ---------- grid ---------- */
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span2 { grid-column: span 2; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad); box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; }
.card > .ch { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px 6px; flex-wrap: wrap; }
.card > .ch > div:first-child { flex: 1 1 260px; min-width: 0; }
.card > .ch h2 { font-size: 15px; font-weight: 700; }
.card > .ch .cs { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.card > .ch .ca { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.card > .cb { padding: 8px 16px 14px; min-width: 0; flex: 1; }
.card > .cf { padding: 8px 16px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.card.flat { box-shadow: none; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 6px 11px; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pri:hover { filter: brightness(1.06); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-ink); }
.btn.ghost:hover { background: var(--accent-soft); }
.tog { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tog button { border: 0; background: transparent; padding: 3px 9px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tog button.on { background: var(--accent-soft); color: var(--accent-ink); }
.lnk { background: none; border: 0; padding: 0; color: var(--accent-ink); font-weight: 600; cursor: pointer; text-align: left; }
.lnk:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.note { color: var(--muted); font-size: 12px; margin-top: 8px; }
.note b { color: var(--ink-2); }
p { margin: 0 0 8px; }

/* ---------- stat tiles & question tiles ---------- */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.kpi .d { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.kpi .spk { margin-top: 6px; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; min-width: 0; cursor: pointer; text-decoration: none; color: inherit; transition: border-color .15s; }
.q:hover { border-color: var(--accent); }
.q .qn { font-size: 12px; font-weight: 700; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .06em; }
.q .qt { font-size: 14px; font-weight: 650; color: var(--ink-2); }
.q .qv { font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; margin-top: 2px; }
.q .qv small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.q .qd { font-size: 12.5px; color: var(--ink-2); }
.q .qx { margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--accent-ink); font-weight: 600; }
.delta-good { color: var(--good-text); }
.delta-bad { color: var(--crit-text); }

/* ---------- chips: maturity, sources, status ---------- */
.mchip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; cursor: pointer; text-decoration: none; }
.mchip .ic { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.mchip.available .ic { background: var(--ink-2); }
.mchip.pilot .ic { background: linear-gradient(90deg, var(--ink-2) 50%, transparent 50%); border: 1.5px solid var(--ink-2); }
.mchip.built .ic { border: 1.5px solid var(--ink-2); }
.mchip.roadmap .ic { border: 1.5px dashed var(--ink-2); }
.mchip.roadmap { border-style: dashed; }
.srcs { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.pill svg { width: 12px; height: 12px; flex-shrink: 0; }
.pill.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }
.pill.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn-text); }
.pill.serious { background: color-mix(in srgb, var(--serious) 20%, transparent); color: var(--crit-text); }
.pill.crit { background: color-mix(in srgb, var(--crit) 15%, transparent); color: var(--crit-text); }
.pill.neutral { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
.pill.info { background: var(--accent-soft); color: var(--accent-ink); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin: 1px 2px 1px 0; white-space: nowrap; }

/* ---------- tables ---------- */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.t th.sort { cursor: pointer; user-select: none; }
table.t th.sort:hover { color: var(--ink); }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--hover); }
table.t td.r, table.t th.r { text-align: right; }
table.t td .s2 { color: var(--muted); font-size: 12px; }
table.t.compact td { padding: 5px 8px; }
.tmore { margin-top: 8px; }

/* ---------- breadcrumb & tabs ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 13px; font-weight: 600; }
.crumb button { border: 0; background: var(--surface-2); color: var(--muted); border-radius: 50%; width: 20px; height: 20px; line-height: 18px; padding: 0; font-size: 14px; }
.crumb button:hover { color: var(--crit-text); }
.crumbs .root { font-weight: 700; color: var(--accent-ink); background: none; border: 0; padding: 4px 2px; cursor: pointer; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 6px 4px; }

/* ---------- advisor ---------- */
.adv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.advc { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--rad); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); min-width: 0; }
.advc .k { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); }
.advc h3 { font-size: 15px; font-weight: 700; line-height: 1.3; }
.advc p { color: var(--ink-2); font-size: 13px; margin: 0; }
.advc .why { font-size: 12.5px; color: var(--muted); }
.advc .acts { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.advhead { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.advhead h2 { font-size: 16px; }
.advhead .av { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; }
.brief { margin: 0; padding-left: 18px; }
.brief li { margin-bottom: 8px; color: var(--ink-2); }
.brief li b { color: var(--ink); }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; min-width: 0; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .lbl-ink { fill: var(--ink); font-weight: 600; }
.chart .lbl-ink2 { fill: var(--ink-2); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .ref { stroke: var(--ink-2); stroke-width: 1; }
.chart .band { fill: var(--deemph-2); opacity: .55; }
.chart .evt { fill: var(--surface-2); }
.chart .evt-l { fill: var(--muted); font-size: 10.5px; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; pointer-events: none; }
.f-s1 { fill: var(--s1); } .f-s2 { fill: var(--s2); } .f-s3 { fill: var(--s3); } .f-s4 { fill: var(--s4); } .f-s7 { fill: var(--s7); }
.f-ink { fill: var(--ink-2); } .f-s5 { fill: var(--s5); } .f-s6 { fill: var(--s6); } .f-s8 { fill: var(--s8); }
.f-de { fill: var(--deemph); } .f-crit { fill: var(--crit); } .f-serious { fill: var(--serious); } .f-good { fill: var(--good); } .f-warn { fill: var(--warn); }
.st-s1 { stroke: var(--s1); } .st-s2 { stroke: var(--s2); } .st-s3 { stroke: var(--s3); } .st-de { stroke: var(--deemph); } .st-ink { stroke: var(--ink-2); }
.ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dot { stroke: var(--surface); stroke-width: 2; }
.dot.sel { stroke: var(--ink); stroke-width: 2.5; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin: 2px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; }
.legend i.dot { border-radius: 50%; }
.legend i.band { background: var(--deemph-2); }

/* bar list (ranked horizontal bars, HTML) */
.bl { display: flex; flex-direction: column; gap: 2px; }
.blr { display: grid; grid-template-columns: minmax(120px, var(--lw, 220px)) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 4px 6px; border-radius: 8px; min-height: 30px; }
.blr.click { cursor: pointer; }
.blr.click:hover, .blr.click:focus-visible { background: var(--hover); }
.blr .bn { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.blr .bn small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.blr .bt { position: relative; height: 14px; }
.blr .bf { position: absolute; left: 0; top: 0; height: 14px; border-radius: 0 4px 4px 0; background: var(--s1); min-width: 2px; }
.blr .bf.de { background: var(--deemph); }
.blr .bf.crit { background: var(--crit); }
.blr .bv { font-size: 13px; font-weight: 650; color: var(--ink); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 64px; }
.blr .bv small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.bl .cut { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--accent-ink); margin: 4px 6px; }
.bl .cut::before, .bl .cut::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: .5; }

/* meters */
.mt { display: flex; flex-direction: column; gap: 10px; }
.mtr { display: grid; grid-template-columns: minmax(110px, 1.1fr) minmax(0, 1.6fr) auto; gap: 10px; align-items: center; }
.mtr .mn { font-size: 13px; color: var(--ink-2); font-weight: 600; min-width: 0; }
.mtr .mn small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.mtr .mk { position: relative; height: 8px; border-radius: 4px; background: var(--seq-100); }
.mtr .mk .mf { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--s1); }
.mtr .mk .mf.warn { background: var(--warn); }
.mtr .mk .mf.crit { background: var(--crit); }
.mtr .mk .tick { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--ink-2); border-radius: 1px; }
.mtr .mv { font-size: 13px; font-weight: 650; text-align: right; min-width: 70px; font-variant-numeric: tabular-nums; }
.mtr .mv small { color: var(--muted); font-weight: 500; }

/* diverging rows (indicator vs peers) */
.dv { display: flex; flex-direction: column; gap: 2px; }
.dvr { display: grid; grid-template-columns: minmax(160px, 1.3fr) minmax(0, 1.6fr) minmax(92px, auto); gap: 10px; align-items: center; padding: 5px 6px; border-radius: 8px; }
.dvr.flag { background: color-mix(in srgb, var(--crit) 6%, transparent); }
.dvr .dn { font-size: 13px; font-weight: 600; min-width: 0; }
.dvr .dn small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.dvr .dt { position: relative; height: 16px; }
.dvr .dt .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--axis); }
.dvr .dt .db { position: absolute; top: 2px; height: 12px; }
.dvr .dt .db.w { left: 50%; background: var(--div-worse); border-radius: 0 4px 4px 0; }
.dvr .dt .db.b { right: 50%; background: var(--div-better); border-radius: 4px 0 0 4px; }
.dvr .dx { font-size: 13px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.dvr .dx small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.dvh { display: grid; grid-template-columns: minmax(160px, 1.3fr) minmax(0, 1.6fr) minmax(92px, auto); gap: 10px; font-size: 11px; color: var(--muted); padding: 0 6px 4px; }
.dvh .ax { display: flex; justify-content: space-between; }

/* segmented bar */
.seg { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.seg i { display: block; height: 100%; }
.seg.tall { height: 22px; border-radius: 4px; }
.seg.tall i { display: flex; align-items: center; padding-left: 6px; font-style: normal; font-size: 11.5px; font-weight: 700; color: #fff; }

/* heatmap */
.hm { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 12px; table-layout: fixed; }
.hm th { font-weight: 600; color: var(--muted); font-size: 11.5px; padding: 3px 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm th.rh { text-align: left; color: var(--ink-2); width: 200px; }
.hm td { height: 34px; text-align: center; border-radius: 4px; font-weight: 650; font-size: 11.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.hm td.z { background: var(--surface-2); color: var(--muted); cursor: default; font-weight: 500; }
.hm td:hover:not(.z) { outline: 2px solid var(--ink); outline-offset: -1px; }
.hm td.tot { background: transparent; color: var(--ink); cursor: default; }
.scale { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.scale .ramp { display: flex; height: 8px; width: 160px; border-radius: 4px; overflow: hidden; }
.scale .ramp i { flex: 1; }

/* tooltip */
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 6px 22px rgba(0, 0, 0, .14); max-width: 300px; opacity: 0; transition: opacity .08s; }
.tip.on { opacity: 1; }
.tip .tt { font-weight: 700; margin-bottom: 4px; }
.tip .tr { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .tr .k { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tip .tr .k i { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
.tip .tr .v { font-weight: 700; font-variant-numeric: tabular-nums; }

/* modal, toast */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 12, 24, .45); z-index: 90; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; border: 1px solid var(--line); width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal .mh { padding: 16px 18px 8px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.modal .mh h2 { font-size: 17px; }
.modal .mb { padding: 6px 18px 12px; }
.modal .mft { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.modal label.f { display: grid; gap: 4px; margin-bottom: 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.modal select, .modal input, .modal textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 9px; font-size: 13.5px; width: 100%; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; z-index: 120; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }

/* store header */
.sthead { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.sthead h1 { font-size: 22px; }
.sthead .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sthead .flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.evid { display: flex; flex-direction: column; gap: 8px; }
.evid a, .evid .e { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: inherit; }
.evid a:hover { border-color: var(--accent); }
.evid .e b, .evid a b { display: block; font-size: 13px; }
.evid .e span, .evid a span { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); font-size: 13px; padding: 12px 0; }

/* roadmap / modules */
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mod { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.mod h3 { font-size: 14.5px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.mod p { color: var(--ink-2); font-size: 13px; margin: 0; }
.mod .feeds { font-size: 12px; color: var(--muted); }
.mod.roadmap { border-style: dashed; }
.legendm { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.legendm > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); font-size: 12.5px; color: var(--ink-2); }
.legendm > div .mchip { margin-bottom: 6px; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: 12px/1.5 var(--mono); overflow-x: auto; color: var(--ink-2); margin: 0; }

/* report (printable) */
.report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rad); padding: 28px 32px; max-width: 900px; margin: 0 auto; }
.report h1 { font-size: 22px; }
.report h2 { font-size: 15px; margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.report .rk { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.report .rk div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.report .rk b { display: block; font-size: 20px; }
.report .rk span { font-size: 12px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adv { grid-template-columns: 1fr; }
  .g21, .g12 { grid-template-columns: 1fr; }
  .tenant { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  nav.side { position: fixed; left: 0; top: 56px; z-index: 50; width: 240px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
  nav.side.open { transform: none; }
  .menu-btn, .menu-btn.btn { display: inline-flex; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .ctl label span.cl { display: none; }
  .legendm { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  main { padding: 14px 16px 40px; }
  .g4 { grid-template-columns: 1fr; }
  .ctl label { display: none; }
  .ctl label.keep { display: flex; }
  .brand .prod { display: none; }
  .blr { grid-template-columns: minmax(96px, 1fr) minmax(0, 1fr) auto; }
  .dvr, .dvh { grid-template-columns: minmax(110px, 1fr) minmax(0, 1fr) auto; }
  .mtr { grid-template-columns: minmax(96px, 1fr) minmax(0, 1fr) auto; }
  .report { padding: 18px; }
  .report .rk { grid-template-columns: 1fr 1fr; }
  .legendm { grid-template-columns: 1fr; }
  .ribbon span:not(.mchips):nth-of-type(n+2), .ribbon .mchips { display: none; }
}
@media print {
  header.top, .ribbon, nav.side, .noprint, .phead .acts { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  body { background: #fff; }
  .report { border: 0; padding: 0; max-width: none; }
}
