/* BTIG owner dashboard, on the Portfolio Insight kit: one stylesheet, no framework, no inline styles.
   Palette: deep ink with a calm blue as the primary accent and a warm brass as the second.
   Glass is reserved for surfaces that float (bar, KPI tiles, sign-in, menus, tooltips); chart panels are
   near-solid so numbers never sit on a moving blur. Colour tokens are oklch, defined once per theme. */

@font-face { font-family: "Inter"; src: url("/static/fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/InterVariable-Italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/geist-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --ink: oklch(0.155 0.025 255);
  --ink-2: oklch(0.19 0.028 255);
  --panel: oklch(0.205 0.026 255 / 0.82);
  --glass: oklch(0.24 0.03 255 / 0.46);
  --glass-edge: oklch(0.95 0.02 250 / 0.12);
  --glass-hi: oklch(1 0 0 / 0.07);
  --text: oklch(0.96 0.008 250);
  --text-2: oklch(0.78 0.02 250);
  --text-3: oklch(0.62 0.02 252);
  --rule: oklch(0.95 0.02 250 / 0.08);
  --blue: oklch(0.70 0.13 250);
  --blue-2: oklch(0.58 0.14 255);
  --brass: oklch(0.80 0.11 80);
  --sea: oklch(0.76 0.11 170);
  --coral: oklch(0.70 0.15 30);
  --plum: oklch(0.68 0.10 320);
  --good: oklch(0.78 0.13 155);
  --bad: oklch(0.72 0.15 28);
  --shadow: 0 1px 0 var(--glass-hi) inset, 0 20px 50px -24px oklch(0 0 0 / 0.65);
  --radius: 18px;
  --orb-1: oklch(0.45 0.14 255 / 0.55);
  --orb-2: oklch(0.55 0.10 80 / 0.28);
  --orb-3: oklch(0.45 0.10 190 / 0.30);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --ink: oklch(0.975 0.006 250);
  --ink-2: oklch(0.955 0.01 250);
  --panel: oklch(1 0 0 / 0.86);
  --glass: oklch(1 0 0 / 0.55);
  --glass-edge: oklch(0.3 0.03 255 / 0.10);
  --glass-hi: oklch(1 0 0 / 0.8);
  --text: oklch(0.22 0.03 258);
  --text-2: oklch(0.40 0.03 258);
  --text-3: oklch(0.54 0.025 258);
  --rule: oklch(0.3 0.03 258 / 0.09);
  --blue: oklch(0.52 0.15 255);
  --blue-2: oklch(0.44 0.15 258);
  --brass: oklch(0.62 0.12 75);
  --sea: oklch(0.56 0.10 175);
  --coral: oklch(0.58 0.17 30);
  --plum: oklch(0.52 0.12 320);
  --good: oklch(0.55 0.14 155);
  --bad: oklch(0.56 0.18 28);
  --shadow: 0 1px 0 var(--glass-hi) inset, 0 18px 40px -26px oklch(0.25 0.05 255 / 0.35);
  --orb-1: oklch(0.80 0.08 250 / 0.55);
  --orb-2: oklch(0.88 0.07 85 / 0.55);
  --orb-3: oklch(0.86 0.06 185 / 0.45);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--ink); color: var(--text);
  font: 400 14px/1.5 "Inter", system-ui, sans-serif; font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }

/* Backdrop: three slow, low-contrast light fields and a fine grain, behind everything. */
.backdrop { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; background:
  radial-gradient(1200px 700px at 85% -10%, var(--ink-2), transparent 70%), var(--ink); }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 1; }
.o1 { width: 52vmax; height: 52vmax; left: -14vmax; top: -18vmax; background: var(--orb-1); animation: drift1 38s ease-in-out infinite alternate; }
.o2 { width: 34vmax; height: 34vmax; right: -8vmax; top: 18vh; background: var(--orb-2); animation: drift2 46s ease-in-out infinite alternate; }
.o3 { width: 40vmax; height: 40vmax; left: 30vw; bottom: -26vmax; background: var(--orb-3); animation: drift3 52s ease-in-out infinite alternate; }
.grain { position: absolute; inset: -50%; opacity: .05; background-image:
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
@keyframes drift1 { to { transform: translate(6vmax, 5vmax) scale(1.06); } }
@keyframes drift2 { to { transform: translate(-5vmax, 4vmax) scale(.94); } }
@keyframes drift3 { to { transform: translate(-6vmax, -3vmax) scale(1.05); } }

/* Glass, with a solid fallback where blur is unsupported or transparency is reduced. */
.glass {
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--panel); } }
@media (prefers-reduced-transparency: reduce) { .glass { background: var(--panel); backdrop-filter: none; -webkit-backdrop-filter: none; } }
@media (prefers-reduced-motion: reduce) { .orb { animation: none; } * { scroll-behavior: auto !important; } }

/* Mark: a quiet geometric monogram, not a logo. */
.mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--blue), var(--blue-2)); box-shadow: 0 8px 24px -10px var(--blue); }
.mark span { width: 18px; height: 18px; border: 2px solid oklch(1 0 0 / .9); border-radius: 5px; transform: rotate(45deg); }
.mark.sm { width: 32px; height: 32px; border-radius: 9px; }
.mark.sm span { width: 12px; height: 12px; border-width: 1.6px; border-radius: 3px; }

/* Sign in */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); border-radius: 24px; padding: 36px 32px 28px; }
.auth-card .mark { margin-bottom: 22px; }
.eyebrow { color: var(--text-3); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.auth-card h1 { font-size: 30px; font-weight: 650; letter-spacing: -.02em; margin: 4px 0 24px; }
.lede { color: var(--text-2); margin-bottom: 14px; }
form label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; }
form input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px; font: inherit; color: var(--text);
  background: oklch(from var(--ink) l c h / .55); border: 1px solid var(--glass-edge); outline: none; transition: border-color .2s, box-shadow .2s; }
form input:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 4px oklch(from var(--blue) l c h / .18); }
.form-error { min-height: 1.4em; color: var(--bad); font-size: 13px; margin: -2px 0 10px; }
.primary { width: 100%; padding: 12px 16px; border: 0; border-radius: 12px; cursor: pointer; font-weight: 600; color: white;
  background: linear-gradient(180deg, var(--blue), var(--blue-2)); box-shadow: 0 10px 26px -12px var(--blue); transition: transform .15s, filter .15s; }
.primary:hover { filter: brightness(1.06); } .primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .6; cursor: progress; }
.fine { color: var(--text-3); font-size: 12px; margin-top: 18px; }

/* Top bar */
.bar { position: sticky; top: 12px; z-index: 10; margin: 12px auto 0; width: min(1440px, calc(100% - 24px)); border-radius: 16px;
  display: flex; align-items: center; gap: 20px; padding: 10px 14px 10px 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-weight: 650; letter-spacing: -.01em; }
.brand span { display: block; color: var(--text-3); font-size: 12px; margin-top: -2px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tabs a { text-decoration: none; padding: 7px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; transition: background .2s, color .2s; }
.tabs a:hover { color: var(--text); background: var(--glass-hi); }
.tabs a.on { color: var(--text); background: oklch(from var(--blue) l c h / .16); }
.meta { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill { font-size: 12px; color: var(--text-2); padding: 6px 10px; border-radius: 999px; border: 1px solid var(--glass-edge); white-space: nowrap; }
.icon { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--glass-edge); background: transparent; cursor: pointer; display: grid; place-items: center; }
.icon svg { width: 16px; height: 16px; fill: var(--text-2); }
.icon .sun { display: none; } :root[data-theme="light"] .icon .sun { display: block; } :root[data-theme="light"] .icon .moon { display: none; }
.who { position: relative; }
#who { border: 1px solid var(--glass-edge); background: transparent; border-radius: 10px; padding: 7px 12px; cursor: pointer; font-weight: 500; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); border-radius: 12px; padding: 6px; min-width: 220px; }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--glass-hi); outline: none; }

/* Page */
.page { width: min(1440px, calc(100% - 24px)); margin: 22px auto 48px; display: grid; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; scroll-margin-top: 90px; }
.kpi { border-radius: var(--radius); padding: 16px 16px 10px; position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 158px; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, transparent, var(--kpi-accent, var(--blue)), transparent); opacity: .85; }
.kpi .label { color: var(--text-2); font-size: 12.5px; font-weight: 500; display: flex; justify-content: space-between; gap: 8px; }
.kpi .value { font-size: clamp(22px, 2.1vw, 30px); font-weight: 650; letter-spacing: -.025em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .ctx { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.kpi .delta { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap; align-self: flex-start; }
.delta.up { color: var(--good); background: oklch(from var(--good) l c h / .12); }
.delta.down { color: var(--bad); background: oklch(from var(--bad) l c h / .12); }
.delta.flat { color: var(--text-2); background: var(--glass-hi); }
.kpi .spark { height: 44px; margin: auto -6px 0; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; scroll-margin-top: 90px; }
.card { background: var(--panel); border: 1px solid var(--glass-edge); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 10px; min-width: 0;
  container-type: inline-size; }
.card > header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.card h2 { font-size: 15px; font-weight: 620; letter-spacing: -.01em; }
.card .sub { color: var(--text-3); font-size: 12.5px; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.chart { height: 320px; width: 100%; }
.chart.tall { height: 380px; }

.table-wrap { overflow-x: auto; margin: 4px -4px 6px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { color: var(--text-3); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td.num, th.num { text-align: right; font-family: "Geist Mono", ui-monospace, monospace; font-size: 13px; }
td.muted { color: var(--text-3); }
tr:hover td { background: var(--glass-hi); }
td.share { width: 120px; padding-right: 0; }
.share i { display: block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, oklch(from var(--coral) l c h / .35), var(--coral)); }
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: oklch(from var(--coral) l c h / .14); color: var(--coral); font-weight: 600; }

.notes { color: var(--text-3); font-size: 12px; padding: 4px 6px; }
.notes ul { margin: 0 0 6px; padding-left: 18px; }
.noscript { padding: 24px; }

/* Echarts tooltip gets the glass treatment through its className. */
.ec-tip { border-radius: 12px !important; border: 1px solid var(--glass-edge) !important; color: var(--text) !important;
  background: var(--glass) !important; -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--shadow) !important; font: 500 12.5px/1.5 "Inter", system-ui, sans-serif !important; padding: 10px 12px !important; }
.ec-tip:empty { display: none !important; }
.ec-tip b { font-weight: 650; } .ec-tip .k { color: var(--text-3); }
.ec-tip .row { display: flex; justify-content: space-between; gap: 18px; font-variant-numeric: tabular-nums; }
.ec-tip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* Layout breakpoints */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .span-4, .span-5, .span-7, .span-8 { grid-column: span 6; } }
@media (max-width: 900px) {
  .tabs { display: none; } .pill { display: none; }
  .span-4, .span-5, .span-7, .span-8, .span-12 { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) { .hide-sm { display: none; } th, td { padding: 9px 6px; } td.num, th.num { font-size: 12px; } td.share { width: 56px; } }
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr; } .bar { top: 8px; } .brand span { display: none; } .chart.tall { height: 340px; } }
@media print { .backdrop, .bar, .menu { display: none !important; } .card, .kpi { break-inside: avoid; box-shadow: none; } }

/* Explain overlay: full screen, glass panel over a deep scrim; opened from a KPI tile. */
.kpi.can-explain { cursor: pointer; transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s; }
.kpi.can-explain:hover, .kpi.can-explain:focus-visible { transform: translateY(-2px); border-color: oklch(from var(--kpi-accent, var(--blue)) l c h / .45); outline: none;
  box-shadow: var(--shadow), 0 0 0 1px oklch(from var(--kpi-accent, var(--blue)) l c h / .25), 0 18px 40px -18px oklch(from var(--kpi-accent, var(--blue)) l c h / .55); }
.kpi .how { position: absolute; right: 12px; bottom: 10px; font-size: 11px; color: var(--text-3); opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; pointer-events: none; }
.kpi.can-explain:hover .how, .kpi.can-explain:focus-visible .how { opacity: 1; transform: none; }
.explain { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; }
.explain-scrim { position: absolute; inset: 0; background: oklch(from var(--ink) l c h / .62); -webkit-backdrop-filter: blur(8px) saturate(120%); backdrop-filter: blur(8px) saturate(120%); animation: fade .25s ease both; }
.explain-panel { position: relative; width: min(1180px, 100%); max-height: calc(100dvh - 36px); overflow: auto; border-radius: 26px; padding: 26px 28px 22px;
  background: oklch(from var(--panel) l c h / .9); animation: rise .38s cubic-bezier(.2,.8,.2,1) both; overscroll-behavior: contain; }
.explain-panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; border-radius: 26px 26px 0 0; background: linear-gradient(90deg, transparent, var(--x-accent, var(--blue)), transparent); }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .explain-scrim, .explain-panel { animation: none; } }
.explain-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.explain-head h2 { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.x-lede { color: var(--text-2); margin-top: 6px; max-width: 70ch; }
.x-close { flex: none; } .x-close svg { fill: none; color: var(--text-2); }
.equation { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 22px 0 18px; }
.eq-term { min-width: 130px; flex: 1 1 140px; border-radius: 16px; padding: 12px 14px; border: 1px solid var(--glass-edge); background: oklch(from var(--ink) l c h / .35); }
.eq-term .k { color: var(--text-3); font-size: 12px; } .eq-term .v { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.eq-term .n { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.eq-term.result { background: linear-gradient(160deg, oklch(from var(--x-accent, var(--blue)) l c h / .28), oklch(from var(--x-accent, var(--blue)) l c h / .08)); border-color: oklch(from var(--x-accent, var(--blue)) l c h / .45); }
.eq-term.result .v { font-size: 28px; }
.eq-op { display: grid; place-items: center; font-size: 22px; color: var(--text-3); font-weight: 300; padding: 0 2px; }
.x-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.x-card { border-radius: 18px; padding: 14px 14px 6px; border: 1px solid var(--glass-edge); background: oklch(from var(--ink) l c h / .28); min-width: 0; }
.x-card h3, .x-rules h3 { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin: 0 0 4px; }
.x-chart { height: 340px; }
.x-rules { margin-top: 16px; padding: 14px 16px 6px; border-radius: 16px; border: 1px dashed var(--glass-edge); }
.x-rules ul { margin: 6px 0 8px; padding-left: 18px; color: var(--text-2); font-size: 13px; } .x-rules li { margin-bottom: 4px; }
body.locked { overflow: hidden; }
@media (max-width: 900px) { .x-grid { grid-template-columns: 1fr; } .explain-panel { padding: 20px 16px; border-radius: 20px; } .eq-term { min-width: 110px; } .x-chart { height: 300px; } }

/* ===================== BTIG owner dashboard additions ===================== */
/* Top bar: three tabs, long labels on desktop, short on phone. */
.tabs .sm { display: none; }
.pill { cursor: pointer; background: transparent; display: inline-flex; align-items: center; gap: 6px; }
.pill .pill-sm { display: none; }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sea); }
.pill.old { color: var(--brass); border-color: oklch(from var(--brass) l c h / .5); }
.pill.old .pill-dot { background: var(--brass); }
.rp-toggle { font-size: 11px; font-weight: 700; color: var(--text-2); letter-spacing: .04em; }
.rp-toggle[aria-pressed="true"] { color: var(--ink); background: var(--brass); border-color: var(--brass); }
#theme-2 { display: none; }
.rp-banner { width: min(1440px, calc(100% - 24px)); margin: 10px auto 0; padding: 7px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  color: var(--brass); background: oklch(from var(--brass) l c h / .1); border: 1px solid oklch(from var(--brass) l c h / .35); }
.rp-banner.inline { width: auto; margin: 8px 0 0; display: inline-block; }
.page-foot { width: min(1440px, calc(100% - 24px)); margin: 0 auto 32px; }
#view:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-3); } .small { font-size: 12px; } .mono, .mono-t td { font-family: "Geist Mono", ui-monospace, monospace; }
.wrap { white-space: normal; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note { color: var(--text-2); font-size: 12.5px; margin: 6px 0; }
h3 { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
ul.plain { margin: 4px 0 8px; padding-left: 18px; color: var(--text-2); font-size: 13px; } ul.plain li { margin-bottom: 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart.short { height: 150px; }
.span-6 { grid-column: span 6; } .span-3 { grid-column: span 3; }
.multi { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }

/* Scope bar (Level 2) */
.scope { width: min(1440px, calc(100% - 24px)); margin: 12px auto 0; border-radius: 14px; padding: 8px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; font-weight: 550; }
.crumbs li + li::before { content: "\203A"; color: var(--text-3); margin-right: 6px; }
.crumbs a { color: var(--text-2); text-decoration: none; } .crumbs a:hover { color: var(--text); text-decoration: underline; }
.seg { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.seg button, .fchip { border: 1px solid var(--glass-edge); background: transparent; border-radius: 999px; padding: 6px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); min-height: 32px; }
.seg button.on, .fchip.on { color: var(--text); background: oklch(from var(--blue) l c h / .2); border-color: oklch(from var(--blue) l c h / .5); }
.seg button:focus-visible, .fchip:focus-visible, .how-btn:focus-visible, .ev-btn:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.seg.small { margin: 4px 0 8px; }
.seg-l { color: var(--text-3); font-size: 12px; margin-right: 4px; }
.per { display: inline-flex; align-items: center; gap: 4px; }
select { font: inherit; font-size: 12.5px; color: var(--text); background: var(--ink-2); border: 1px solid var(--glass-edge); border-radius: 10px; padding: 6px 10px; min-height: 32px; }
.basis-def { flex-basis: 100%; color: var(--text-3); font-size: 12px; }

/* Cards */
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.how-btn { flex: none; border: 1px solid var(--glass-edge); background: transparent; border-radius: 8px; padding: 4px 8px; font-size: 11.5px; color: var(--text-3); cursor: pointer; }
.how-btn:hover { color: var(--text); border-color: var(--blue); }
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.card-chips:empty { display: none; }
.chart[role="img"] { cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--glass-edge); color: var(--text-2); }
.basis-chip { color: var(--text-2); }
.muted-chip { font-weight: 500; }
.urg-red { color: var(--bad); background: oklch(from var(--bad) l c h / .14); border-color: oklch(from var(--bad) l c h / .45); }
.urg-amber { color: var(--brass); background: oklch(from var(--brass) l c h / .14); border-color: oklch(from var(--brass) l c h / .45); }
.urg-none { color: var(--text-3); font-weight: 500; }
.prelim-chip { display: inline-block; margin: 6px 0; font-weight: 500; white-space: normal; }
.pc { color: var(--plum); border: 1px solid oklch(from var(--plum) l c h / .45); }
.rp-chip { color: var(--brass); }

/* Values by status (section 4): glyph and word first, colour second. */
.val { font-variant-numeric: tabular-nums; }
.val .mk { color: var(--text-3); font-size: .72em; margin-left: 2px; vertical-align: super; line-height: 0; }
.st-stale { color: var(--text-2); } .st-stale .age { color: var(--text-3); font-size: .85em; }
.st-estimated .num { text-decoration: underline dotted; text-underline-offset: 3px; }
.st-disputed .split, .split { color: var(--brass); font-weight: 700; }
.opview { color: var(--text-3); font-size: .8em; }
.st-missing .miss { color: var(--text-2); font-style: italic; } .st-missing .needs { color: var(--text-2); font-size: .85em; }
.tag { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 999px; font-weight: 600; vertical-align: 1px; }
.tag.prelim { background: oklch(from var(--plum) l c h / .16); color: var(--plum); }
.tag.disp { background: oklch(from var(--brass) l c h / .16); color: var(--brass); }
.tag.basis { background: var(--glass-hi); color: var(--text-2); }
.tag.edited { background: oklch(from var(--blue) l c h / .16); color: var(--blue); }
.asof { color: var(--text-3); font-size: .85em; }
.rp-mask { border: 1px dashed oklch(from var(--brass) l c h / .6); background: oklch(from var(--brass) l c h / .08); color: var(--brass); border-radius: 8px; padding: 2px 7px; font-size: 12px; cursor: pointer; min-height: 28px; }
.rp-glyph { font-weight: 800; letter-spacing: .04em; color: var(--brass); }
.disp-note { color: var(--brass); }

/* Level 1 */
.answer { border-radius: var(--radius); padding: 16px 18px; cursor: pointer; }
.answer:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.answer-line { font-size: clamp(16px, 1.6vw, 20px); font-weight: 620; letter-spacing: -.01em; }
.answer-sub { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.dec-table td { vertical-align: top; }
.dec-table tbody tr { cursor: pointer; }
.dec-table tbody tr:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.dec-table .rank { font-weight: 700; color: var(--text-2); }
.dec-table .dtitle { display: block; font-weight: 600; max-width: 42ch; }
.dec-table .dl { display: block; color: var(--text-3); font-size: 12px; margin-top: 4px; }
.dec-table .chip { margin-top: 1px; }
.eyebrow-s { display: block; color: var(--text-3); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
td.hide-md { max-width: 280px; }
.dec-cards { display: none; list-style: none; margin: 0; padding: 0; }
.dcard { border-radius: 14px; border: 1px solid var(--glass-edge); padding: 10px 12px; margin-bottom: 10px; min-height: 44px; cursor: pointer; background: oklch(from var(--ink) l c h / .25); }
.dcard:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.urg-row-red.dcard { border-left: 3px solid var(--bad); } .urg-row-amber.dcard { border-left: 3px solid var(--brass); }
.dcard .l1 { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; } .dcard .rank { font-weight: 750; }
.dcard .dl { color: var(--text-2); font-size: 12.5px; }
.dcard .dtitle { font-weight: 620; font-size: 15px; line-height: 1.3; }
.dcard .l3 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 4px; font-size: 14px; }
.dcard .l3 .k { display: block; color: var(--text-3); font-size: 11px; }
.dcard .owner { color: var(--text-2); } .dcard .action { color: var(--text-2); margin-top: 2px; }
.moved { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; }
.mchip { flex: none; width: 250px; scroll-snap-align: start; border-radius: 14px; border: 1px solid var(--glass-edge); padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; background: oklch(from var(--ink) l c h / .25); min-height: 44px; }
.mchip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mk-kind { align-self: flex-start; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 1px 7px; border-radius: 999px; background: var(--glass-hi); color: var(--text-2); }
.k-worse .mk-kind, .k-lapsed .mk-kind { color: var(--coral); } .k-better .mk-kind, .k-closed .mk-kind { color: var(--sea); } .k-new .mk-kind { color: var(--blue); }
.mwhen { color: var(--text-3); font-size: 11.5px; } .mtitle { font-size: 13px; line-height: 1.35; }

/* Level 2 */
.ptiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.ptile { border-radius: var(--radius); padding: 12px 14px; cursor: pointer; min-height: 44px; }
.ptile:focus-visible, .kpi[role="button"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ptile .label { font-weight: 650; } .ptile .value { font-size: 19px; font-weight: 650; margin-top: 4px; }
.ptile .ctx, .phead .ctx { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.ptile .counts { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--text-3); font-size: 11px; margin-top: 6px; }
.missing-list { margin: 4px 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); }
.phead { border-radius: var(--radius); padding: 16px 18px; display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; }
.phead h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 2px 0 4px; }
.phead-links h3 { margin-top: 0; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.on-row th, .on-row td { background: oklch(from var(--blue) l c h / .08); }
.total-row td { font-weight: 650; border-top: 1px solid var(--text-3); }
.rule-row td { color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding-top: 14px; }
.ghost-row td { opacity: .6; }
.etree { list-style: none; margin: 8px 0; padding: 0; }
.etree li { padding: 4px 0; } .etree .tier-1 { padding-left: 14px; } .etree .tier-2 { padding-left: 28px; } .etree .tier-3 { padding-left: 42px; }
.eline { display: inline-block; min-height: 32px; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.eline:focus-visible { outline: 2px solid var(--blue); }
.mrow { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 6px 0; }
.mcell { display: flex; flex-direction: column; font-size: 14px; } .mcell .k { color: var(--text-3); font-size: 11.5px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* Level 3 */
.thesis { border-radius: var(--radius); padding: 20px 22px; }
.thesis h1 { font-size: clamp(18px, 2vw, 24px); font-weight: 650; letter-spacing: -.015em; margin: 4px 0 8px; max-width: 70ch; }
.thesis .ctx { color: var(--text-2); margin: 8px 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 10px 0; font-size: 13px; }
.facts dt { color: var(--text-3); } .facts dd { margin: 0; color: var(--text); }
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0; }
.mini { border-radius: 14px; border: 1px solid var(--glass-edge); padding: 10px 12px; background: oklch(from var(--ink) l c h / .25); }
.mini .k { color: var(--text-3); font-size: 12px; } .mini .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; } .mini .n { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.scenario { border: 1px dashed var(--text-3); background-image: repeating-linear-gradient(135deg, transparent 0 10px, oklch(from var(--text-3) l c h / .05) 10px 11px); }
.scen-head { color: var(--brass); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.scen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.scen-field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.scen-field label { font-size: 13px; color: var(--text); }
.scen-field input[type="number"] { width: 120px; font: inherit; color: var(--text); background: var(--ink-2); border: 1px solid var(--glass-edge); border-radius: 8px; padding: 6px 8px; text-align: right; font-family: "Geist Mono", monospace; min-height: 32px; }
.scen-field input[type="checkbox"] { width: 20px; height: 20px; justify-self: end; }
.scen-field .small { grid-column: 1 / -1; }
.linkish { border: 0; background: none; color: var(--blue); cursor: pointer; text-decoration: underline; font-size: 12px; padding: 0; justify-self: start; }
.scen-sentence { font-weight: 600; margin: 8px 0; }
details.x-rules summary { cursor: pointer; font-weight: 600; color: var(--text-2); font-size: 13.5px; }

/* Explain dialog extensions: sheets, compact equation strips, evidence */
.x-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.x-chips:empty { display: none; }
.x-eqs .equation { margin: 14px 0 6px; }
.equation.second { margin-top: 4px; }
.eq-rule { width: 1px; background: var(--glass-edge); padding: 0; margin: 0 4px; }
.eq-term.urg-red { border-color: oklch(from var(--bad) l c h / .5); } .eq-term.urg-red .v { color: var(--bad); }
.eq-term.urg-amber { border-color: oklch(from var(--brass) l c h / .5); } .eq-term.urg-amber .v { color: var(--brass); }
.equation.compact { gap: 6px; margin: 10px 0 4px; }
.equation.compact .eq-term { min-width: 0; flex: 1 1 90px; padding: 8px 10px; border-radius: 12px; }
.equation.compact .eq-term .v { font-size: 16px; } .equation.compact .eq-term.result .v { font-size: 18px; } .equation.compact .eq-op { font-size: 16px; }
.x-body:empty { display: none; }
.x-grid.one { grid-template-columns: 1fr; }
.evidence { margin: 6px 0 8px; }
.evidence h3 { margin-top: 6px; }
.ev-btn { display: block; width: 100%; text-align: left; border: 1px solid var(--glass-edge); background: oklch(from var(--ink) l c h / .3); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer; min-height: 44px; font-size: 13px; }
.ev-btn:hover { border-color: var(--blue); } .ev-label { font-weight: 600; } .ev-loc { color: var(--text-2); }
.flags { color: var(--brass); font-size: 13px; padding-left: 18px; }
.ev-here { border: 1px solid oklch(from var(--blue) l c h / .4); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
.ev-here h3 { margin-top: 0; }
.st-chip.st-stale { color: var(--brass); }

/* Responsive */
@media (max-width: 1280px) { .ptiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } .span-6, .span-3 { grid-column: span 6; } }
@media (max-width: 1100px) { .tabs .lg { display: none; } .tabs .sm { display: inline; } .hide-md { display: none; } }
@media (max-width: 900px) {
  .tabs { display: flex; margin-left: 4px; } .pill { display: inline-flex; }
  .span-6, .span-3 { grid-column: 1 / -1; } .multi > * { grid-column: 1 / -1; }
  .phead { grid-template-columns: 1fr; } .scen-grid, .two { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .only-wide { display: none; } .dec-cards { display: block; }
  .ptiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .bar { min-height: 56px; gap: 6px; padding: 8px; top: 6px; margin-top: 6px; width: calc(100% - 12px); }
  .brand-text { display: none; } .mark.sm { width: 28px; height: 28px; }
  .tabs { gap: 2px; margin-left: 0; } .tabs a { padding: 7px 8px; font-size: 13px; }
  .meta { gap: 4px; } .icon { width: 32px; height: 32px; }
  .pill { padding: 5px 7px; font-size: 11px; } .pill .pill-lg { display: none; } .pill .pill-sm { display: inline; }
  #theme { display: none; } #theme-2 { display: block; }
  #who { padding: 6px 8px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page { width: calc(100% - 12px); margin-top: 10px; gap: 12px; }
  .scope, .rp-banner { width: calc(100% - 12px); }
  .card { padding: 14px 12px 8px; }
  .answer { padding: 12px 14px; } .answer-line { font-size: 15.5px; }
  .fchip { padding: 5px 9px; font-size: 12px; }
  .explain { padding: 0; }
  .explain-panel { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; padding: 14px 14px 18px; }
  .explain-head h2 { font-size: 19px; } .x-close { width: 44px; height: 44px; }
  .x-lede { font-size: 13px; }
  .facts { grid-template-columns: 1fr; gap: 0; } .facts dt { margin-top: 6px; }
  .mchip { width: 220px; }
}
@media print {
  .rp-val { visibility: hidden; position: relative; } .rp-val::after { content: "RP"; visibility: visible; position: absolute; left: 0; }
  .rp-mask { border: 0; } .scope, .filters, .how-btn, #rp-banner { display: none !important; }
}

/* Evidence: primary record first, blueprint reference beside it */
.ev-btn { display: grid; gap: 2px; }
.ev-prim { color: var(--text); font-size: 12.5px; font-family: "Geist Mono", ui-monospace, monospace; }
.ev-btn .ev-loc { font-size: 12px; color: var(--text-3); }
.dhist-list { list-style: none; margin: 4px 0 8px; padding: 0; border-left: 2px solid var(--plum); }
.dhist-list li { padding: 4px 0 6px 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; }
.dh-date { font-weight: 650; font-variant-numeric: tabular-nums; } .dh-what { color: var(--text-2); } .dh-cond { color: var(--brass); font-size: 12px; }
/* 390 px: the top bar wraps; the three tabs take a full second row */
@media (max-width: 600px) {
  .bar { flex-wrap: wrap; row-gap: 6px; }
  .brand { order: 1; } .meta { order: 2; margin-left: auto; min-width: 0; }
  .tabs { order: 3; flex-basis: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .tabs a { text-align: center; min-height: 40px; display: grid; place-items: center; }
  .icon, #who { min-width: 40px; min-height: 40px; }
}

.answer-top { margin-top: 6px; font-size: 13.5px; color: var(--text-2); }
