/* Opendoor 2031 Valuation Model. Editorial light by default, dark on toggle. */

:root {
  color-scheme: light;
  --canvas: #FBF9F5;
  --canvas-alt: #F4F0E8;
  --surface: #FFFFFF;
  --surface-2: #F7F4EE;
  --ink: #141413;
  --ink-2: #55534E;
  --ink-3: #807D75;
  --rule: #E4DFD5;
  --rule-strong: #CFC9BC;
  --emerald: #12805C;
  --emerald-ink: #0B5D44;
  --emerald-wash: #E4F1EB;
  --amber: #C97A10;
  --amber-ink: #8A5200;
  --amber-wash: #FAEEDA;
  --slate: #3C6FC0;
  --slate-ink: #264F94;
  --slate-wash: #E6EDF8;
  --plum: #B8457A;
  --red: #B93A32;
  --red-ink: #9A2B25;
  --red-wash: #F8E6E3;
  --tier-0: #8E2A25;
  --tier-1: #C4533C;
  --tier-2: #C98A2B;
  --tier-3: #64748B;
  --tier-4: #2E9B74;
  --tier-5: #12805C;
  --tier-6: #0A5A41;
  --shadow: 0 1px 2px rgba(20, 20, 19, 0.04), 0 8px 24px -12px rgba(20, 20, 19, 0.12);
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --nav-h: 56px;
  --wrap: 1180px;
  --gutter: 32px;
  --radius: 10px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0D0F12;
  --canvas-alt: #111418;
  --surface: #14171C;
  --surface-2: #1A1E25;
  --ink: #ECEAE4;
  --ink-2: #A9ABAF;
  --ink-3: #7C8087;
  --rule: #23272F;
  --rule-strong: #343A44;
  --emerald: #2BAA82;
  --emerald-ink: #5FD0A8;
  --emerald-wash: #12281F;
  --amber: #D48A25;
  --amber-ink: #EDB25A;
  --amber-wash: #2A2010;
  --slate: #5B8FE0;
  --slate-ink: #9DBDF0;
  --slate-wash: #152137;
  --plum: #D8659A;
  --red: #E0655C;
  --red-ink: #F08C84;
  --red-wash: #2C1614;
  --tier-0: #E5564E;
  --tier-1: #D98A72;
  --tier-2: #D9A441;
  --tier-3: #8794A8;
  --tier-4: #1F8F6C;
  --tier-5: #2BAA82;
  --tier-6: #5FD0A8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 20px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.num, .tick, table td, table th { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "zero" 0; }
.num { letter-spacing: -0.01em; }

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--canvas); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.i { width: 16px; height: 16px; flex: none; }

/* ---------------------------------------------------------------- nav */

.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.nav-row { display: flex; align-items: center; gap: 16px; height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: var(--serif); font-size: 17px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.brand-short { display: none; }
.pill {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 11.5px; line-height: 1; padding: 6px 9px; border-radius: 999px;
  border: 1px solid var(--rule-strong); color: var(--ink-2); background: var(--surface);
}
.pill-dot { margin: 0 6px; color: var(--ink-3); }
i { font-style: normal; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  font-size: 13.5px; color: var(--ink-2); text-decoration: none; padding: 7px 10px; border-radius: 7px; white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a.current { color: var(--ink); background: var(--surface-2); }
.nav-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
.credit-badge {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 8px;
  background: var(--ink); color: var(--canvas); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.credit-badge .i { width: 13px; height: 13px; }
.credit-badge:hover { opacity: 0.88; }
.nav-strip { display: none; }
.nav-progress { height: 2px; margin-top: -2px; position: relative; }
.nav-progress i { display: block; height: 2px; width: 0; background: var(--emerald); }

.share-banner { background: var(--amber-wash); border-bottom: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); color: var(--ink); font-size: 14px; }
.share-banner-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- type */

.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.eyebrow a { color: var(--ink-2); }
.display {
  font-family: var(--serif); font-weight: 400; font-size: clamp(2.5rem, 6.1vw, 4.9rem); line-height: 1.02; letter-spacing: -0.025em;
  margin-top: 18px; max-width: 16ch; text-wrap: balance;
}
.display em { font-style: italic; color: var(--emerald-ink); }
h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.9rem, 3.6vw, 3rem); line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }
h3 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.35rem, 2.1vw, 1.7rem); line-height: 1.18; letter-spacing: -0.012em; text-wrap: balance; }
h4 { font-family: var(--sans); font-weight: 600; font-size: 14px; letter-spacing: 0; }
.lede { font-size: clamp(1.02rem, 1.35vw, 1.2rem); line-height: 1.55; color: var(--ink-2); max-width: 62ch; margin-top: 18px; text-wrap: pretty; }
.prose p { color: var(--ink-2); max-width: 58ch; text-wrap: pretty; }
.prose p + p { margin-top: 14px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose .num { color: var(--ink); font-weight: 500; font-size: 0.94em; }
.fineprint { font-size: 12.5px; line-height: 1.5; color: var(--ink-3); margin-top: 12px; max-width: 78ch; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  font-size: 14.5px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.9; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn .i { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- hero */

.hero { padding: clamp(48px, 8vw, 104px) 0 clamp(40px, 6vw, 72px); border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.82fr); gap: clamp(32px, 5vw, 72px); align-items: end; }
.hero-copy { min-width: 0; }
.hero-aside { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px 16px; min-width: 0; }
.hero-aside h2 { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: 0; line-height: 1.4; }
.hero-aside .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.glance { margin-top: 12px; }
.glance a { display: grid; grid-template-columns: minmax(0, 1fr) 44px 92px; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule); text-decoration: none; font-size: 14px; }
.glance a:hover .g-name { text-decoration: underline; text-underline-offset: 3px; }
.glance .g-name { display: flex; align-items: center; gap: 9px; font-weight: 500; min-width: 0; white-space: nowrap; }
.glance .g-p { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); text-align: right; }
.glance .g-px { font-family: var(--mono); font-size: 14px; font-weight: 600; text-align: right; white-space: nowrap; }
.glance-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border-top: 1px solid var(--ink); padding-top: 11px; font-size: 13px; color: var(--ink-2); }
.glance-foot b { font-family: var(--mono); font-size: 15px; color: var(--emerald-ink); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.kpis { display: grid; grid-template-columns: 1.25fr 0.8fr 1.7fr 1fr 1fr; margin-top: clamp(36px, 5vw, 60px); border-top: 1px solid var(--ink); }
.kpi { padding: 18px 20px 4px 0; min-width: 0; }
.kpi + .kpi { padding-left: 20px; border-left: 1px solid var(--rule); }
.kpi dt { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.kpi dd { margin-top: 8px; }
.kpi-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(1.3rem, 2.2vw, 1.75rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; white-space: nowrap; }
.kpi.lead .kpi-value { font-size: clamp(1.9rem, 3.6vw, 2.8rem); color: var(--emerald-ink); }
.kpi-sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.4; }
.kpi-trio { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.kpi-value.kpi-trio { font-size: clamp(1.05rem, 1.55vw, 1.32rem); }
.kpi-trio span { display: flex; flex-direction: column; }
.kpi-trio small { font-family: var(--sans); font-size: 11.5px; color: var(--ink-3); letter-spacing: 0; font-weight: 400; margin-bottom: 3px; }

/* ---------------------------------------------------------------- acts and chapters */

.act { padding: clamp(56px, 8vw, 112px) 0; }
.act.alt { background: var(--canvas-alt); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.act-head { max-width: 860px; }
.act-head h2 { margin-top: 14px; }

.chapter { display: grid; grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr); gap: clamp(28px, 5vw, 72px); align-items: start; padding-top: clamp(40px, 6vw, 80px); margin-top: clamp(40px, 6vw, 80px); border-top: 1px solid var(--rule); }
.chapter-text { position: sticky; top: calc(var(--nav-h) + 28px); }
.chapter-no { font-size: 12px; color: var(--emerald-ink); letter-spacing: 0.08em; margin-bottom: 12px; }
.chapter h3 { margin-bottom: 16px; }
.chapter-figure { min-width: 0; }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.panel-title { color: var(--ink); }
.panel-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.45; }
.figure-title { font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.figure-note { font-size: 12.5px; color: var(--ink-3); margin-top: 14px; line-height: 1.5; }

/* mix bars */
.mix-row { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; }
.mix-row + .mix-row { margin-top: 12px; }
.mix-label { font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.mix-label strong { display: block; color: var(--ink); font-weight: 600; }
.segbar { display: flex; height: 28px; gap: 2px; }
.seg { display: flex; align-items: center; flex: var(--g1, 1) 1 0; min-width: 0; height: 100%; border-radius: 4px; overflow: hidden; transition: flex-grow 1.2s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .chapter-figure:not(.in) .segbar.animate .seg { flex-grow: var(--g0, 1); }
.seg span { font-family: var(--mono); font-size: 12px; font-weight: 500; padding-left: 8px; color: #fff; white-space: nowrap; }
.seg.c-1p { background: var(--slate); }
.seg.c-2p { background: var(--amber); }
.seg.c-3p { background: var(--emerald); }
:root[data-theme="dark"] .seg span { color: #0D0F12; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin: 14px 0 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw.line { width: 16px; height: 2px; border-radius: 1px; background: var(--ink); }
.sw.c-1p { background: var(--slate); } .sw.c-2p { background: var(--amber); } .sw.c-3p { background: var(--emerald); }

.stat-pairs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 22px; border-top: 1px solid var(--rule); }
.stat-pair { padding: 16px 16px 0 0; min-width: 0; }
.stat-pair + .stat-pair { padding-left: 16px; border-left: 1px solid var(--rule); }
.stat-pair .k { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.stat-pair .v { font-family: var(--mono); font-size: 1.05rem; font-weight: 500; margin-top: 6px; letter-spacing: -0.02em; white-space: nowrap; }
.stat-pair .v .from { display: block; color: var(--ink-3); font-weight: 400; font-size: 0.86em; margin-bottom: 2px; }
.stat-pair .d { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

.hbar-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
.hbar-row + .hbar-row { margin-top: 10px; }
.hbar-label { font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.hbar-track { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hbar { height: 18px; width: var(--w1, 0%); flex: none; border-radius: 0 4px 4px 0; background: var(--slate); min-width: 2px; transition: width 1.2s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s; }
.js .chapter-figure:not(.in) .hbar { width: 0%; }
.hbar.good { background: var(--emerald); }
.hbar-value { font-family: var(--mono); font-size: 13px; font-weight: 500; white-space: nowrap; }

/* engines */
.engine-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.engine { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; min-width: 0; }
.engine-top { display: flex; align-items: baseline; gap: 10px; }
.engine-no { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.engine-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.engine-what { font-size: 13px; color: var(--ink-2); line-height: 1.45; margin-top: 8px; min-height: 4.3em; }
.engine-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 12px; }
.engine-value { font-family: var(--mono); font-size: 1.35rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.engine-value small { display: block; font-family: var(--sans); font-size: 11.5px; color: var(--ink-3); font-weight: 400; letter-spacing: 0; margin-top: 6px; }
.e-core { color: var(--emerald); } .e-buyer { color: var(--amber); } .e-title { color: var(--slate); } .e-mortgage { color: var(--plum); }
.sw.e-core, .sw.e-buyer, .sw.e-title, .sw.e-mortgage { background: currentColor; }
.stack-bar { display: flex; height: 12px; gap: 2px; margin-top: 4px; }
.stack-bar i { display: block; height: 100%; border-radius: 3px; background: currentColor; min-width: 2px; }

/* risk */
.prob-bar { display: flex; height: 28px; gap: 2px; }
.prob-bar i { display: flex; align-items: center; border-radius: 4px; min-width: 2px; overflow: hidden; }
.prob-bar span { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: #fff; padding-left: 6px; white-space: nowrap; }
:root[data-theme="dark"] .prob-bar span { color: #0D0F12; }
.prob-bracket { display: flex; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.prob-bracket div { border-top: 2px solid var(--ink); padding-top: 6px; }
.prob-bracket .rest { border-top-color: var(--rule-strong); color: var(--ink-3); padding-left: 10px; }
.risk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.risk-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; min-width: 0; }
.risk-card h4 { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.risk-price { font-family: var(--mono); font-size: 1.5rem; font-weight: 500; letter-spacing: -0.03em; margin-top: 10px; line-height: 1; }
.risk-card dl { margin-top: 12px; display: grid; gap: 5px; }
.risk-card dl div { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.risk-card dt { color: var(--ink-2); }
.risk-card dd { font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.risk-card .mini { margin-top: 12px; color: var(--red); max-width: 100%; height: auto; }
.risk-card .mini-cap { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.pressure { margin-top: 22px; border-top: 1px solid var(--rule); }
.pressure li { display: grid; grid-template-columns: 108px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.pressure .amt { font-family: var(--mono); font-weight: 500; color: var(--ink); white-space: nowrap; }
.pressure strong { color: var(--ink); font-weight: 600; }

.tier-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--tier, var(--ink-3)); }

/* ---------------------------------------------------------------- ladder */

.ladder-block { margin-top: clamp(28px, 4vw, 48px); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ladder-head, .ladder-row {
  display: grid; align-items: center; column-gap: 14px;
  grid-template-columns: minmax(128px, 1.1fr) 78px minmax(160px, 2.2fr) 92px 78px 72px 76px 48px 70px 66px;
  padding: 0 20px;
}
.ladder-head { font-size: 11.5px; color: var(--ink-3); border-bottom: 1px solid var(--rule); height: 44px; }
.ladder-head > div { white-space: nowrap; }
.ladder-head .r, .ladder-row .r { text-align: right; }
.ladder-row { min-height: 58px; border-bottom: 1px solid var(--rule); cursor: pointer; position: relative; transition: background-color 0.15s ease; }
.ladder-row:hover { background: var(--surface-2); }
.ladder-row[aria-checked="true"] { background: var(--emerald-wash); }
.ladder-row[aria-checked="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--emerald); }
.lr-name { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; min-width: 0; }
.lr-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-weight { display: flex; align-items: center; gap: 3px; }
.lr-weight input {
  width: 54px; height: 32px; padding: 0 6px; text-align: right; border-radius: 6px; border: 1px solid var(--rule-strong); background: var(--surface);
  font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.lr-weight input::-webkit-outer-spin-button, .lr-weight input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lr-weight input.changed { border-color: var(--amber); background: var(--amber-wash); }
.lr-weight span { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.lr-track, .lh-track { position: relative; height: 100%; min-height: 44px; }
.lr-track .tickline, .lh-track .tickline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule); }
.lr-track .refline, .lh-track .refline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink-3); }
.lh-track .ticklabel { position: absolute; bottom: 6px; transform: translateX(-50%); font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.lh-track .reflabel { position: absolute; top: 5px; transform: translateX(-50%); font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); white-space: nowrap; background: var(--surface); padding: 0 4px; }
.lr-track .span { position: absolute; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--tier); opacity: 0.45; transition: left 0.35s ease, width 0.35s ease; }
.lr-track .dot { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--tier); box-shadow: 0 0 0 2px var(--surface); transition: left 0.35s ease; }
.ladder-row[aria-checked="true"] .lr-track .dot { box-shadow: 0 0 0 2px var(--emerald-wash); }
.lr-price { font-family: var(--mono); font-weight: 600; font-size: 15px; text-align: right; white-space: nowrap; }
.lr-cell { font-family: var(--mono); font-size: 13px; text-align: right; color: var(--ink-2); white-space: nowrap; }
.lr-edited { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-left: 6px; vertical-align: middle; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11.5px; font-weight: 500; line-height: 1; padding: 5px 7px; border-radius: 6px; white-space: nowrap; }
.badge::before { font-family: var(--sans); font-weight: 700; font-size: 10px; }
.badge.ok { background: var(--emerald-wash); color: var(--emerald-ink); } .badge.ok::before { content: "✓"; }
.badge.warn { background: var(--amber-wash); color: var(--amber-ink); } .badge.warn::before { content: "!"; }
.badge.bad { background: var(--red-wash); color: var(--red-ink); } .badge.bad::before { content: "✕"; }
.badge.plain::before { content: none; }

.weights-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 14px 20px; background: var(--surface-2); font-size: 13.5px; color: var(--ink-2); }
.weights-bar .sum { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.weights-bar .sum b { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.weights-bar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ev-block { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: stretch; }
.ev-tiles { display: grid; grid-template-columns: 1.3fr 1fr 1fr; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.ev-tile { padding: 20px; min-width: 0; }
.ev-tile + .ev-tile { border-left: 1px solid var(--rule); }
.ev-tile .k { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.ev-tile .v { font-family: var(--mono); font-weight: 500; font-size: clamp(1.25rem, 2vw, 1.6rem); letter-spacing: -0.03em; margin-top: 8px; line-height: 1.05; white-space: nowrap; }
.ev-tile.lead .v { font-size: clamp(1.8rem, 3.2vw, 2.5rem); color: var(--emerald-ink); }
.ev-tile .d { font-size: 12px; color: var(--ink-3); margin-top: 7px; line-height: 1.4; }
.ev-tile .delta { font-family: var(--mono); color: var(--amber-ink); }
.ev-share { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.ev-share .k { font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; }
.ev-share .legend { margin-bottom: 0; }
.ev-share .legend b { font-family: var(--mono); font-weight: 500; color: var(--ink); }

.case-card { margin-top: 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.case-main { padding: 26px; min-width: 0; }
.case-side { padding: 26px; border-left: 1px solid var(--rule); min-width: 0; }
.case-kicker { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.case-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.case-title h3 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
.case-title .num { font-size: clamp(1.4rem, 2.2vw, 1.8rem); font-weight: 500; letter-spacing: -0.03em; }
.case-thesis { margin-top: 14px; color: var(--ink-2); font-size: 15px; line-height: 1.6; text-wrap: pretty; }
.case-pair { display: grid; gap: 14px; margin-top: 20px; }
.case-pair h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
.case-pair p { font-size: 14px; color: var(--ink); margin-top: 5px; line-height: 1.55; text-wrap: pretty; }
.case-pair .must { border-left: 2px solid var(--emerald); padding-left: 14px; }
.case-pair .fals { border-left: 2px solid var(--red); padding-left: 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); margin-top: 18px; }
.metric { padding: 11px 12px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); min-width: 0; }
.metric .k { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.metric .v { font-family: var(--mono); font-size: 14px; font-weight: 500; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.truths { margin-top: 20px; display: grid; gap: 8px; }
.truths h4 { margin-bottom: 4px; }
.truth { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.truth .badge { margin-top: 1px; min-width: 22px; justify-content: center; padding: 5px 6px; }
.truth b { color: var(--ink); font-weight: 600; }
.case-cta { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- sandbox */

.livebar { position: sticky; top: var(--nav-h); z-index: 30; margin-top: clamp(24px, 4vw, 40px); background: color-mix(in srgb, var(--canvas) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.livebar-row { display: flex; align-items: center; gap: 14px; min-height: 58px; padding-top: 8px; padding-bottom: 8px; }
.case-pills { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; padding: 2px; }
.case-pills::-webkit-scrollbar { display: none; }
.case-pill { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid transparent; background: transparent; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; flex: none; }
.case-pill:hover { color: var(--ink); background: var(--surface-2); }
.case-pill.edited::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.case-select { display: none; height: 36px; max-width: 46vw; padding: 0 28px 0 10px; border-radius: 8px; border: 1px solid var(--rule-strong); background: var(--surface); font-size: 14px; font-weight: 600; }
.case-pill[aria-pressed="true"] { background: var(--surface); border-color: var(--rule-strong); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.live-read { display: flex; align-items: center; gap: 12px; flex: none; }
.live-price { font-family: var(--mono); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 999px; background: var(--amber-wash); color: var(--amber-ink); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.chip.quiet { background: var(--surface-2); color: var(--ink-3); }
.chip.quiet::before { background: var(--ink-3); }
.live-actions { display: flex; gap: 8px; flex: none; }

.bench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 20px; margin-top: 24px; align-items: start; }
.bench-out { display: grid; gap: 20px; position: sticky; top: calc(var(--nav-h) + 78px); min-width: 0; }
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 9px; }
.tab { min-height: 38px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; font-size: 13px; font-weight: 500; color: var(--ink-2); line-height: 1.2; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--rule); }
.tab .count { display: inline-block; margin-left: 5px; font-family: var(--mono); font-size: 10.5px; color: var(--amber-ink); background: var(--amber-wash); border-radius: 999px; padding: 1px 6px; }
.group-blurb { font-size: 13.5px; color: var(--ink-2); margin: 16px 0 6px; line-height: 1.5; }
.lever { padding: 14px 0; border-top: 1px solid var(--rule); }
.lever:first-of-type { border-top: 0; }
.lever-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lever-label { font-size: 14px; font-weight: 500; line-height: 1.35; }
.lever-hint { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink-3); margin-top: 3px; line-height: 1.4; }
.lever-input { display: flex; align-items: center; gap: 5px; flex: none; }
.lever-input input {
  width: 92px; height: 34px; padding: 0 8px; text-align: right; border-radius: 7px; border: 1px solid var(--rule-strong); background: var(--surface);
  font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.lever-input input::-webkit-outer-spin-button, .lever-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lever-input .unit { font-family: var(--mono); font-size: 12px; color: var(--ink-3); min-width: 18px; }
.lever.changed .lever-input input { border-color: var(--amber); background: var(--amber-wash); }
.lever-slider { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.lever-was { font-size: 12px; color: var(--amber-ink); margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.lever-was button { border: 0; background: none; padding: 0; font-size: 12px; color: var(--amber-ink); text-decoration: underline; text-underline-offset: 2px; }
.derived { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; margin: 4px 0 2px; border-radius: 8px; background: var(--emerald-wash); font-size: 13.5px; color: var(--emerald-ink); }
.derived b { font-family: var(--mono); font-weight: 600; }
.show-all { margin-top: 14px; width: 100%; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--emerald) var(--fill, 50%), var(--rule-strong) var(--fill, 50%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--rule-strong); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--emerald); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--emerald); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--emerald); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }

.readout-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.readout-top .k { font-size: 12.5px; color: var(--ink-2); }
.readout-price { font-family: var(--mono); font-weight: 500; font-size: clamp(2.2rem, 4vw, 3.1rem); letter-spacing: -0.04em; line-height: 1; margin-top: 8px; color: var(--emerald-ink); white-space: nowrap; }
.readout-delta { font-size: 13px; color: var(--ink-2); text-align: right; line-height: 1.5; }
.readout-delta .num { font-weight: 500; color: var(--ink); }
.readout-delta .up { color: var(--emerald-ink); } .readout-delta .dn { color: var(--red-ink); }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule); margin-top: 18px; }
.readout-grid .metric { border: 0; padding: 14px 10px 0 0; }
.readout-grid .metric + .metric { padding-left: 12px; border-left: 1px solid var(--rule); }
.notice { margin-top: 14px; font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 8px; background: var(--amber-wash); color: var(--amber-ink); }
.notice.bad { background: var(--red-wash); color: var(--red-ink); }

.chart-host { min-width: 0; }
.chart { display: block; max-width: 100%; overflow: visible; }
.chart .grid, .mini .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis, .mini .axis { stroke: var(--rule-strong); stroke-width: 1; }
.chart .tick, .mini .tick { font-size: 11px; fill: var(--ink-3); }
.mini .tick { font-size: 9.5px; }
.mini .mini-value { font-family: var(--mono); font-size: 10px; fill: var(--ink-2); }
.chart .ni-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ni-dot { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.chart .end-label { font-family: var(--sans); font-size: 11px; fill: var(--ink-3); }
.chart .end-value { font-family: var(--mono); font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.chart .hit { fill: transparent; }
.chart .hover-band { fill: var(--ink); opacity: 0.045; }

.tip { position: fixed; z-index: 80; pointer-events: none; min-width: 190px; max-width: 280px; padding: 10px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: var(--shadow); font-size: 12.5px; }
.tip-title { font-family: var(--mono); font-weight: 600; margin-bottom: 6px; }
.tip-row { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; color: var(--ink-2); }
.tip-row.rule { border-top: 1px solid var(--rule); margin-top: 4px; padding-top: 6px; }
.tip-row.strong .tip-value, .tip-row.strong .tip-label { font-weight: 600; color: var(--ink); }
.tip-label { display: inline-flex; align-items: center; gap: 7px; }
.tip-label i { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.tip-value { color: var(--ink); font-weight: 500; white-space: nowrap; }

.table-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; margin-top: 12px; }
.table-foot .fineprint { margin-top: 0; }
.table-foot .actions { display: flex; gap: 8px; flex: none; }
.subsection { margin-top: clamp(48px, 7vw, 88px); }
.sub-head { margin-bottom: 20px; }
.sub-head p { color: var(--ink-2); margin-top: 8px; font-size: 15px; }
.stat-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--ink); margin-bottom: 20px; }
.stat-strip .metric { border: 0; padding: 14px 12px 0 0; }
.stat-strip .metric + .metric { padding-left: 14px; border-left: 1px solid var(--rule); }
.stat-strip .metric .v { font-size: 16px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.panel.table-scroll { padding: 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
.pnl th, .pnl td { padding: 9px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
.pnl thead th { position: sticky; top: 0; font-weight: 600; color: var(--ink-2); font-size: 12px; background: var(--surface); border-bottom: 1px solid var(--ink); }
.pnl th:first-child, .pnl td:first-child { text-align: left; font-family: var(--sans); position: sticky; left: 0; background: var(--surface); z-index: 1; white-space: normal; min-width: 190px; max-width: 300px; }
.pnl tbody th { font-weight: 400; color: var(--ink-2); }
.pnl tr.section th { font-family: var(--sans); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); font-weight: 600; padding-top: 20px; background: var(--surface); text-align: left; }
.pnl tr.strong th, .pnl tr.strong td { font-weight: 600; color: var(--ink); background: var(--surface-2); }
.pnl tr.strong th:first-child { background: var(--surface-2); }
.pnl td.neg { color: var(--red-ink); }
.pnl td.terminal, .pnl th.terminal { background: color-mix(in srgb, var(--emerald-wash) 60%, var(--surface)); }
.pnl tr.strong td.terminal { background: var(--emerald-wash); }
.pnl tr:last-child th, .pnl tr:last-child td { border-bottom: 0; }
.pnl .rownote { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; margin-top: 2px; line-height: 1.35; }

.two-up { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.tor { display: grid; grid-template-columns: minmax(0, 168px) 66px minmax(0, 1fr) minmax(0, 1fr) 66px; align-items: stretch; column-gap: 6px; row-gap: 0; margin-top: 16px; }
.tor > div { min-height: 30px; display: flex; align-items: center; }
.tor .t-label { font-size: 13px; color: var(--ink-2); line-height: 1.2; padding-right: 6px; }
.tor .t-lo, .tor .t-hi { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.tor .t-lo { justify-content: flex-end; }
.tor .t-neg { justify-content: flex-end; border-right: 1px solid var(--rule-strong); }
.tor .t-neg i { display: block; height: 14px; background: var(--red); border-radius: 4px 0 0 4px; min-width: 1px; transition: width 0.3s ease; }
.tor .t-pos i { display: block; height: 14px; background: var(--emerald); border-radius: 0 4px 4px 0; min-width: 1px; transition: width 0.3s ease; }
.tor .t-row:hover { background: var(--surface-2); }
.tor-key { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 14px; }

.matrix { font-size: 12.5px; table-layout: fixed; min-width: 420px; }
.matrix th, .matrix td { padding: 0; text-align: center; height: 36px; border: 2px solid var(--surface); }
.matrix thead th, .matrix tbody th { font-weight: 500; color: var(--ink-2); font-size: 11.5px; }
.matrix tbody th { text-align: right; padding-right: 8px; width: 64px; white-space: nowrap; }
.matrix .corner { text-align: right; padding-right: 8px; font-family: var(--sans); font-size: 10.5px; color: var(--ink-3); font-weight: 400; line-height: 1.2; }
.matrix td button { width: 100%; height: 100%; border: 0; border-radius: 4px; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink); background: color-mix(in srgb, var(--emerald) var(--heat, 0%), var(--surface-2)); transition: outline-color 0.15s; }
.matrix td button:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.matrix td.here button { outline: 2px solid var(--ink); outline-offset: -2px; font-weight: 600; }
.capped { color: var(--amber-ink); }

/* ---------------------------------------------------------------- export */

.export-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-top: clamp(28px, 4vw, 44px); }
.export-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; grid-column: span 2; }
.export-card.wide { grid-column: span 3; }
.export-card.feature { grid-column: span 6; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; padding: 28px; }
.export-card h3 { font-size: 1.3rem; }
.export-card h4 { font-size: 15px; }
.export-card p { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.export-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.export-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.pack-list { display: grid; gap: 7px; font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.pack-list li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; }
.pack-list li::before { content: "✓"; color: var(--emerald-ink); font-weight: 700; font-size: 12px; margin-top: 2px; }
.preview { background: var(--surface-2); border: 1px solid var(--rule); border-radius: 8px; padding: 14px; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto; margin: 0; }
.x-preview { font-family: var(--sans); font-size: 14px; color: var(--ink); max-height: none; }
.count { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.drawer { width: min(820px, calc(100vw - 24px)); max-height: min(86vh, 900px); padding: 0; border: 1px solid var(--rule-strong); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45); }
.drawer[open] { display: flex; flex-direction: column; }
.drawer::backdrop { background: rgba(13, 15, 18, 0.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 22px 14px; border-bottom: 1px solid var(--rule); }
.drawer-head .fineprint { margin-top: 4px; }
.drawer-body { flex: 1 1 auto; overflow: auto; margin: 0; padding: 18px 22px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); background: var(--surface-2); }
.drawer-foot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--rule); flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--canvas); font-size: 14px; font-weight: 500; padding: 11px 16px; border-radius: 10px; box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.5); max-width: calc(100vw - 32px); text-align: center; animation: toast-in 0.2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------------------------------------------------------- notes and footer */

.notes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); }
.notes h3 { margin-bottom: 18px; }
.log-entry { border-top: 1px solid var(--ink); padding-top: 14px; }
.log-entry + .log-entry { margin-top: 26px; }
.log-meta { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.log-entry h4 { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; margin-top: 6px; line-height: 1.3; }
.log-entry ul { margin-top: 10px; display: grid; gap: 8px; }
.log-entry li, .method li { position: relative; padding-left: 16px; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.log-entry li::before, .method li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 6px; height: 1px; background: var(--ink-3); }
.method { display: grid; gap: 10px; border-top: 1px solid var(--ink); padding-top: 14px; }
.method .num { color: var(--ink); font-size: 0.93em; }
.method li.parity-row::before { content: none; }
.parity { display: inline-flex; margin-top: 16px; white-space: normal; line-height: 1.45; padding: 8px 10px; align-items: flex-start; }

.footer { border-top: 1px solid var(--rule); padding: 36px 0 56px; background: var(--canvas-alt); }
.footer-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(24px, 5vw, 64px); align-items: start; }
.footer-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.footer-credit { font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.disclaimer { font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }
.noscript, .load-error { margin: 24px auto; max-width: 720px; padding: 16px 20px; border-radius: 10px; background: var(--amber-wash); color: var(--amber-ink); font-size: 14px; }

/* ---------------------------------------------------------------- scroll reveal */

.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .seg, .hbar, .lr-track .dot, .lr-track .span, .tor i { transition: none !important; }
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .ladder-head, .ladder-row { grid-template-columns: minmax(120px, 1fr) 78px minmax(140px, 2fr) 92px 78px 72px 48px 70px; }
  .col-ni, .col-shares { display: none; }
  .nav-links a { padding: 7px 8px; font-size: 13px; }
}

@media (max-width: 1020px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero-aside { max-width: 520px; }
  .brand-full { display: none; }
  .brand-short { display: inline; }
  .chapter { grid-template-columns: minmax(0, 1fr); }
  .chapter-text { position: static; }
  .bench { grid-template-columns: minmax(0, 1fr); }
  .bench-out { position: static; order: -1; }
  .case-card { grid-template-columns: minmax(0, 1fr); }
  .case-side { border-left: 0; border-top: 1px solid var(--rule); }
  .ev-block { grid-template-columns: minmax(0, 1fr); }
  .two-up { grid-template-columns: minmax(0, 1fr); }
  .export-card, .export-card.wide { grid-column: span 3; }
  .export-card.feature { grid-template-columns: minmax(0, 1fr); }
  .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 6px; }
  .stat-strip .metric:nth-child(4) { padding-left: 0; border-left: 0; }
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi { grid-column: span 2; }
  .kpi:nth-child(1) { grid-column: span 3; }
  .kpi:nth-child(2) { grid-column: span 3; }
  .kpi:nth-child(3) { grid-column: span 6; padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .kpi:nth-child(4) { grid-column: span 3; padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .kpi:nth-child(5) { grid-column: span 3; border-top: 1px solid var(--rule); }
  .kpi { padding-bottom: 16px; }
}

@media (max-width: 860px) {
  :root { --gutter: 20px; --nav-h: 52px; }
  .nav-links { display: none; }
  .nav-tools { margin-left: auto; }
  .nav-strip { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 8px calc(var(--gutter) - 8px); border-bottom: 1px solid var(--rule); background: var(--canvas); }
  .nav-strip::-webkit-scrollbar { display: none; }
  .nav-strip a { flex: none; font-size: 13.5px; color: var(--ink-2); text-decoration: none; padding: 7px 9px; border-radius: 7px; white-space: nowrap; }
  .ladder-head { display: none; }
  .ladder-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name price weight" "track track track"; row-gap: 0; padding: 12px 16px 6px; column-gap: 12px; }
  .lr-name { grid-area: name; } .lr-price { grid-area: price; } .lr-weight { grid-area: weight; } .lr-track { grid-area: track; min-height: 30px; }
  .ladder-row .lr-cell, .ladder-row .lr-util { display: none; }
  .weights-bar { padding: 14px 16px; }
  .ev-tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ev-tile.lead { grid-column: span 2; border-bottom: 1px solid var(--rule); }
  .ev-tile.lead + .ev-tile { border-left: 0; }
  .notes, .footer-row { grid-template-columns: minmax(0, 1fr); }
  .risk-grid { grid-template-columns: minmax(0, 1fr); }
  .case-pills { display: none; }
  .case-select { display: block; flex: 0 1 auto; min-width: 0; }
  .livebar-row { gap: 10px; min-height: 54px; }
  .live-read { flex: 1 1 auto; gap: 8px; min-width: 0; }
  .live-price { font-size: 16px; }
  .bench-out { top: auto; }
}

@media (max-width: 620px) {
  .pill-date { display: none; }
  .credit-badge { padding: 0 10px; font-size: 12.5px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .engine-grid { grid-template-columns: minmax(0, 1fr); }
  .engine-what { min-height: 0; }
  .stat-pairs { grid-template-columns: minmax(0, 1fr); }
  .stat-pair, .stat-pair + .stat-pair { padding: 12px 0; border-left: 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: baseline; }
  .stat-pair .v { margin-top: 0; text-align: right; }
  .stat-pair .d { grid-column: 1 / -1; }
  .mix-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .hbar-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pressure li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 4px; }
  .readout-grid .metric:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip .metric:nth-child(odd) { padding-left: 0; border-left: 0; }
  .stat-strip .metric:nth-child(4) { padding-left: 14px; border-left: 1px solid var(--rule); }
  .export-card, .export-card.wide, .export-card.feature { grid-column: span 6; }
  .export-card.feature { padding: 22px; }
  .panel { padding: 18px 16px; }
  .case-main, .case-side { padding: 20px 16px; }
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tor { grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr) 62px; }
  .tor .t-label { grid-column: 1 / -1; min-height: 0; padding-top: 10px; font-size: 12.5px; }
  .tor > div { min-height: 24px; }
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi, .kpi:nth-child(n) { grid-column: span 1; padding: 14px 0 14px 0; border-left: 0; border-top: 1px solid var(--rule); }
  .kpi:nth-child(1), .kpi:nth-child(3), .kpi:nth-child(5) { grid-column: span 2; }
  .kpi:nth-child(1) { border-top: 0; order: 1; }
  .kpi:nth-child(2) { order: 2; }
  .kpi:nth-child(4) { order: 3; padding-left: 14px; border-left: 1px solid var(--rule); }
  .kpi:nth-child(3) { order: 4; }
  .kpi:nth-child(5) { order: 5; }
  .live-actions .btn span { display: none; }
  .live-actions .btn { padding: 0 10px; }
  #live-chip.quiet { display: none; }
  .pnl th, .pnl td { padding: 8px 10px; }
  .pnl th:first-child, .pnl td:first-child { min-width: 150px; max-width: 170px; }
  .lever-input input { width: 84px; }
  .matrix { min-width: 0; }
  .matrix th, .matrix td { height: 34px; border-width: 1px; }
  .matrix tbody th { width: 40px; padding-right: 4px; font-size: 10.5px; }
  .matrix thead th { font-size: 10.5px; }
  .matrix .corner { font-size: 9px; padding-right: 4px; }
  .matrix td button { font-size: 10.5px; letter-spacing: -0.03em; }
  .readout-delta { text-align: left; }
}

@media print {
  .nav, .livebar, .toast, .hero-actions, .share-banner { display: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  body { background: #fff; }
}

/* ================================================================ views: Model | Kaz Receipts */

:root[data-view="receipts"] #view-model,
:root:not([data-view="receipts"]) #view-receipts { display: none; }
:root[data-view="receipts"] .nav-links,
:root[data-view="receipts"] .nav-strip > a,
:root[data-view="receipts"] .share-banner { display: none; }
:root[data-view="receipts"] .nav-tools { margin-left: auto; }

/* Header: brand, view switch, section links, then version, theme and credit. The switch sits
   right after the brand so it never moves when the section links come and go. */
.brand { flex: none; }
.brand-full { display: none; }
.brand-short { display: inline; }
.nav-tools { flex: none; }
.view-nav { display: flex; flex: none; }
.view-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--rule); flex: none; }
.view-switch .view-tab {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 6px;
  font-size: 13px; font-weight: 500; line-height: 1; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.view-switch .view-tab:hover { color: var(--ink); }
:root:not([data-view="receipts"]) .view-tab[data-view-tab="model"],
:root[data-view="receipts"] .view-tab[data-view-tab="receipts"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--rule); }
.view-count { font-family: var(--mono); font-size: 10.5px; font-weight: 500; line-height: 1; padding: 3px 6px; border-radius: 999px; background: var(--emerald-wash); color: var(--emerald-ink); font-variant-numeric: tabular-nums; }
.nav-strip .view-switch { display: none; }
.no-receipts .view-nav, .no-receipts .nav-strip .view-switch { display: none !important; }

/* ---------------------------------------------------------------- source tiers
   Fill level carries the tier as well as colour: full, half, empty. */

.t0 { --tc: var(--ink-2); --tw: var(--surface-2); --tl: var(--ink-3); }
.t1 { --tc: var(--emerald-ink); --tw: var(--emerald-wash); --tl: var(--emerald); }
.t2 { --tc: var(--slate-ink); --tw: var(--slate-wash); --tl: var(--slate); }
.t3 { --tc: var(--amber-ink); --tw: var(--amber-wash); --tl: var(--amber); }
.tier-mark { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; border: 1.5px solid var(--tl, var(--ink-3)); }
.t1 .tier-mark, .tier-mark.t1 { background: var(--tl); }
.t2 .tier-mark, .tier-mark.t2 { background: linear-gradient(90deg, var(--tl) 50%, transparent 50%); }
.tier-badge { display: inline-flex; align-items: baseline; gap: 7px; max-width: 100%; font-family: var(--mono); font-size: 11.5px; line-height: 1.3; padding: 4px 9px 4px 8px; border-radius: 6px; background: var(--tw); color: var(--tc); }
.tier-badge .tier-mark { align-self: center; }
.tier-badge b { font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
.tier-badge span { min-width: 0; padding-left: 14px; text-indent: -14px; }
.tier-badge span::before { content: "·"; margin-right: 7px; opacity: 0.6; }

/* ---------------------------------------------------------------- receipts view */

.receipts { padding: clamp(40px, 6vw, 84px) 0 clamp(56px, 8vw, 112px); animation: view-in 0.3s ease both; }
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }
.rc-head { max-width: 880px; }
.rc-display { font-size: clamp(2.2rem, 5.2vw, 4.1rem); max-width: 17ch; margin-top: 16px; }
.rc-head .lede { max-width: 68ch; }

.rc-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: clamp(28px, 4vw, 44px); border-top: 1px solid var(--ink); }
.rc-tier { padding: 16px 24px 4px 0; min-width: 0; }
.rc-tier + .rc-tier { padding-left: 24px; border-left: 1px solid var(--rule); }
.rc-tier p { font-size: 13px; line-height: 1.5; color: var(--ink-2); margin-top: 10px; text-wrap: pretty; }
.rc-tier .rc-tier-n { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); margin-top: 8px; }

.rc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: start; margin-top: clamp(32px, 5vw, 56px); }
.rc-main { min-width: 0; }
.rc-filters { position: sticky; top: calc(var(--nav-h) + 24px); display: grid; gap: 22px; max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; scrollbar-width: thin; padding: 3px; margin: -3px; }

.rc-search { position: relative; display: block; }
.rc-search .i { position: absolute; left: 11px; top: 50%; margin-top: -8px; color: var(--ink-3); pointer-events: none; }
.rc-search input { width: 100%; height: 40px; padding: 0 10px 0 34px; border-radius: 9px; border: 1px solid var(--rule-strong); background: var(--surface); font-size: 13.5px; -webkit-appearance: none; appearance: none; }
.rc-search input::placeholder { color: var(--ink-3); opacity: 1; }
.rc-search input:focus-visible { outline-offset: 0; border-radius: 9px; }
.rc-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; cursor: pointer; background: var(--ink-3); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat; }

.rc-group { min-width: 0; }
.rc-group-k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.rc-pills { display: grid; gap: 2px; }
.rc-tiers .rc-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.fpill {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 5px 10px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; font-size: 13.5px; line-height: 1.25; color: var(--ink-2); text-align: left;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.fpill > span:first-of-type { flex: 1 1 auto; min-width: 0; }
.fpill .fpill-n { flex: none; font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.fpill:hover { color: var(--ink); background: var(--surface-2); }
.fpill[aria-pressed="true"] { background: var(--emerald-wash); border-color: color-mix(in srgb, var(--emerald) 40%, transparent); color: var(--emerald-ink); font-weight: 600; }
.fpill[aria-pressed="true"] .fpill-n { color: var(--emerald-ink); }
.fpill.none:not([aria-pressed="true"]) { opacity: 0.42; }

.rc-status { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 22px; margin-bottom: 14px; }
.rc-count { font-size: 13px; color: var(--ink-2); min-width: 0; }
.rc-count b { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.rc-clear { flex: none; border: 0; background: none; padding: 0; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.rc-clear:hover { color: var(--ink); text-decoration-color: currentColor; }

.rc-list { display: grid; gap: 18px; }
.receipt { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 28px 20px; min-width: 0; scroll-margin-top: calc(var(--nav-h) + 24px); outline: none; }
.rc-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-height: 30px; }
.rc-topic { border: 0; background: none; padding: 0; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.rc-topic:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.rc-date { font-family: var(--mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.rc-copy { margin-left: auto; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--ink-3); transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease; }
.rc-copy:hover { color: var(--ink); border-color: var(--rule-strong); background: var(--surface-2); }
.rc-copy .i { width: 15px; height: 15px; }

.rc-headline, .rc-quote blockquote p, .rc-quote figcaption, .rc-source span { overflow-wrap: anywhere; }
.rc-headline { font-family: var(--sans); font-weight: 600; font-size: 1.06rem; line-height: 1.38; letter-spacing: -0.006em; margin-top: 14px; max-width: 62ch; text-wrap: balance; }
.rc-quote { margin-top: 14px; padding: 2px 0 2px 20px; border-left: 2px solid var(--tl); }
.receipt.t3 .rc-quote { border-left-style: dashed; }
.rc-quote blockquote { margin: 0; }
.rc-quote blockquote p { font-family: var(--serif); font-size: clamp(1.14rem, 1.55vw, 1.34rem); line-height: 1.48; letter-spacing: -0.006em; color: var(--ink); max-width: 64ch; text-wrap: pretty; }
.rc-quote blockquote p::before { content: "\201C"; margin-left: -0.44em; }
.rc-quote blockquote p::after { content: "\201D"; }
.rc-note { font-family: var(--sans); font-size: 0.6em; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; vertical-align: 0.14em; }
.rc-quote figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 12px; font-size: 13px; line-height: 1.45; color: var(--ink-3); }
.rc-quote figcaption b { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.receipts mark { background: var(--amber-wash); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 45%, transparent); }

.rc-audit { margin: 18px 0 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.rc-audit > div { display: grid; grid-template-columns: 138px minmax(0, 1fr); gap: 14px; padding: 12px 14px; }
.rc-audit > div + div { border-top: 1px solid var(--rule); }
.rc-audit dt { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.7; color: var(--ink-3); }
.rc-audit dt::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--ink-3); transform: translateY(-1px); }
.rc-audit .rc-cav dt { color: var(--amber-ink); }
.rc-audit .rc-cav dt::before { background: var(--amber); }
.rc-audit dd { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; overflow-wrap: anywhere; min-width: 0; }

.rc-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-top: 16px; }
.rc-source { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
a.rc-source:hover { color: var(--ink); }
.rc-source .i { width: 14px; height: 14px; color: var(--ink-3); }
.rc-test { display: flex; align-items: center; gap: 12px; margin-left: auto; min-width: 0; }
.rc-target { display: inline-flex; align-items: center; gap: 7px; min-width: 0; font-size: 12.5px; line-height: 1.35; color: var(--ink-3); }
.rc-target b { font-weight: 600; color: var(--ink-2); }
.rc-target .num { color: var(--ink-2); }
.rc-test .btn { flex: none; }

.rc-empty { display: grid; justify-items: start; gap: 12px; padding: 28px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); font-size: 14px; color: var(--ink-2); }
.rc-empty strong { color: var(--ink); font-weight: 600; }
.rc-foot { margin-top: 18px; }

.receipt.flash { animation: receipt-flash 3s ease-out both; }
@keyframes receipt-flash {
  0%, 50% { border-color: var(--emerald); box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 20%, transparent), var(--shadow); }
  100% { border-color: var(--rule); box-shadow: 0 0 0 3px transparent, var(--shadow); }
}

/* ---------------------------------------------------------------- receipts inside the model view */

.xref { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 18px; font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.receipt-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--emerald-ink); text-decoration: none; white-space: nowrap; }
.receipt-link .i { width: 14px; height: 14px; transition: transform 0.15s ease; }
.receipt-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.receipt-link:hover .i { transform: translateX(2px); }
.xref-topics { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
.xref-topics a { color: var(--ink-2); white-space: nowrap; }
.xref-topics a:hover { color: var(--ink); }
.xref-topics .num { font-size: 11px; color: var(--ink-3); }

.lever { position: relative; }
.lever-text { min-width: 0; }
.lever-text .lever-label { display: block; }
.lever-receipt { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; line-height: 1.3; color: var(--ink-3); text-decoration: none; }
.lever-receipt span { margin-left: 3px; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.lever-receipt:hover { color: var(--ink); }
.lever-receipt:hover span { text-decoration-color: currentColor; }
.from-receipt { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--emerald-wash); color: var(--emerald-ink); font-size: 13px; line-height: 1.45; }
.from-receipt b { font-weight: 600; }
.from-receipt a { font-weight: 500; white-space: nowrap; }

/* "Test in Sandbox" lands here: two soft beats on the target lever, then it settles. */
.lever.pulse::before { content: ""; position: absolute; inset: 3px -12px; border-radius: 9px; background: var(--emerald-wash); box-shadow: 0 0 0 1.5px var(--emerald); pointer-events: none; opacity: 0; animation: lever-pulse 3.2s ease-out 0.2s both; }
.lever.pulse > * { position: relative; }
@keyframes lever-pulse { 0% { opacity: 0; } 10% { opacity: 1; } 34% { opacity: 0.4; } 50% { opacity: 1; } 78% { opacity: 0.9; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .receipts { animation: none; }
  .receipt.flash { animation: none; border-color: var(--emerald); box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 20%, transparent), var(--shadow); }
  .lever.pulse::before { animation: none; opacity: 1; }
  .receipt-link .i { transition: none; }
}

/* ---------------------------------------------------------------- responsive: views and receipts */

@media (max-width: 1020px) {
  /* The filter column becomes a search field, a topic row that sticks under the nav, and a tier row. */
  .rc-layout { display: block; }
  .rc-filters { display: contents; }
  .rc-group-k { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rc-search input { height: 42px; }
  .rc-pills, .rc-tiers .rc-pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--gutter); }
  .rc-pills::-webkit-scrollbar { display: none; }
  .fpill { width: auto; flex: none; min-height: 34px; padding: 0 12px; border-radius: 999px; border-color: var(--rule-strong); white-space: nowrap; }
  .fpill > span:first-of-type { flex: none; }
  .rc-group { margin: 0 calc(var(--gutter) * -1); }
  .rc-topics { position: sticky; top: var(--nav-h); z-index: 20; margin-top: 12px; padding: 8px 0; background: color-mix(in srgb, var(--canvas) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .rc-tiers { margin-top: 10px; }
  .rc-status { margin-top: 16px; }
  .receipt { scroll-margin-top: calc(var(--nav-h) + 64px); }
}

/* With the switch and five section links in one row, the model view sheds detail as the window narrows. */
@media (min-width: 721px) {
  :root:not([data-view="receipts"]) .nav .pill-date { display: none; }
}
@media (min-width: 721px) and (max-width: 860px) {
  .nav .pill-date { display: none; }
}
@media (min-width: 861px) and (max-width: 1180px) {
  :root:not([data-view="receipts"]) .nav .pill { display: none; }
}
@media (min-width: 861px) and (max-width: 1090px) {
  .nav-links .nl-x { display: none; }
}
@media (min-width: 861px) and (max-width: 960px) {
  /* Icon only, with the handle still there for screen readers. */
  :root:not([data-view="receipts"]) .credit-handle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :root:not([data-view="receipts"]) .credit-badge { gap: 0; }
}

@media (max-width: 860px) {
  .nav-strip { align-items: center; }
  .rc-search input { font-size: 16px; }
  /* Tablets keep the switch in the sticky header; with no section links left, the strip has nothing to show. */
  :root[data-view="receipts"] .nav-strip { display: none; }
}

/* Phones: the header has no room, so the switch leads the strip under it. */
@media (max-width: 720px) {
  .view-nav { display: none; }
  .nav-strip .view-switch { display: inline-flex; margin: 0 10px 0 8px; }
  :root[data-view="receipts"] .nav-strip { display: flex; }
}

@media (max-width: 620px) {
  .rc-legend { grid-template-columns: minmax(0, 1fr); }
  .rc-tier, .rc-tier + .rc-tier { padding: 14px 0; border-left: 0; }
  .rc-tier + .rc-tier { border-top: 1px solid var(--rule); }
  .receipt { padding: 18px 16px 16px; }
  .rc-quote { padding-left: 14px; }
  .rc-audit > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .rc-actions { flex-direction: column; align-items: stretch; }
  .nav-row { gap: 12px; }
  .nav-tools { gap: 6px; }
  .rc-test { flex-direction: column; align-items: stretch; gap: 10px; margin-left: 0; }
  .rc-test .btn { width: 100%; min-height: 40px; }
}

/* Small phones: the brand never collides with the tools. The version goes first, then the name. */
@media (max-width: 389px) {
  .nav .pill { display: none; }
}
@media (max-width: 345px) {
  .brand-name { display: none; }
}

@media print {
  .view-nav, .rc-filters, .rc-copy, .rc-test, .xref, .lever-receipt { display: none !important; }
  .receipt { break-inside: avoid; box-shadow: none; }
}
