:root {
  --paper: #E9EDEF;
  --card: #F6F8F9;
  --ink: #0F1E33;
  --muted: #4A5A6E;
  --line: #B9C4CD;
  --grid: rgba(15, 30, 51, .06);
  --signal: #F2B705;
  --on-signal: #0F1E33;
  --route: #2552C9;
  --ok: #2E7D4F;
  --warn: #9A6200;
  --alarm: #B42F25;
  --t1: #14317F; --t2: #2552C9; --t3: #4C78DE; --t4: #86A5E8; --t5: #B8CAF0; --t6: #D3DAE2;
  --display: "Archivo", system-ui, sans-serif;
  --body: "Archivo", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1724; --card: #13202F; --ink: #E6ECF1; --muted: #9AA9BA; --line: #2D3D51;
    --grid: rgba(230, 236, 241, .05); --route: #8DB0FF; --ok: #5FBF85; --warn: #E0A43A; --alarm: #FF7A6E;
    --t1: #B8CAF0; --t2: #86A5E8; --t3: #5A84E0; --t4: #3A62BF; --t5: #2A4785; --t6: #2D3D51;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D1724; --card: #13202F; --ink: #E6ECF1; --muted: #9AA9BA; --line: #2D3D51;
  --grid: rgba(230, 236, 241, .05); --route: #8DB0FF; --ok: #5FBF85; --warn: #E0A43A; --alarm: #FF7A6E;
  --t1: #B8CAF0; --t2: #86A5E8; --t3: #5A84E0; --t4: #3A62BF; --t5: #2A4785; --t6: #2D3D51;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--body); font-variation-settings: "wdth" 100;
}
a { color: var(--route); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--route); outline-offset: 2px; }
code, .num { font-family: var(--mono); font-size: .92em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--signal); color: var(--on-signal); padding: 8px 12px; z-index: 10; }
.skip:focus { top: 12px; }

h1, h2, h3 { font-family: var(--display); line-height: 1.05; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(2.3rem, 6.4vw, 4.6rem); font-weight: 820; font-variation-settings: "wdth" 125; max-width: 15ch; letter-spacing: -.025em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); font-weight: 780; font-variation-settings: "wdth" 118; }
h3 { font-size: 1.15rem; font-weight: 750; font-variation-settings: "wdth" 112; }
.eyebrow { font: 500 .78rem/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 14px; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 60ch; margin: 18px 0 0; }
.note, .help { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--radius); border: 2px solid transparent; font: 700 .95rem/1 var(--body);
  font-variation-settings: "wdth" 108; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-signal { background: var(--signal); color: var(--on-signal); }
.btn-signal:hover { background: #FFC524; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-line:hover { border-color: var(--ink); }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 1.05rem; }

.top, main > section, .foot { width: min(1120px, 100% - 32px); margin-inline: auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 1.05rem/1 var(--display); font-variation-settings: "wdth" 115; }
.brand b { font-weight: 850; }
.brand svg circle { fill: var(--ink); }
.brand svg circle:nth-child(2) { fill: var(--signal); }
.brand svg path { stroke: var(--ink); stroke-width: 1.6; fill: none; }
.top nav { display: flex; align-items: center; gap: 22px; }
.top nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; }
.top nav a:not(.btn):hover { text-decoration: underline; }
@media (max-width: 640px) { .top nav a:not(.btn) { display: none; } .top .btn { min-height: 40px; padding: 0 12px; font-size: .85rem; } }

/* Hero: survey sheet */
.hero {
  position: relative; padding: clamp(36px, 7vw, 84px) clamp(16px, 4vw, 48px) 40px; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 10px; background-color: var(--card);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
.search { display: flex; gap: 10px; margin-top: 32px; max-width: 680px; }
.search input {
  flex: 1; min-width: 0; min-height: 56px; padding: 0 18px; font: 500 1.15rem var(--mono);
  color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius);
}
.search input::placeholder { color: var(--muted); opacity: .7; }
.search .btn { min-height: 56px; padding: 0 24px; font-size: 1.05rem; }
@media (max-width: 480px) { .search { flex-direction: column; } }

/* Signature: the log-rank ladder */
.ladder { margin: 44px 0 0; max-width: 900px; }
.ladder-scale { position: relative; container-type: inline-size; height: 18px; border: 2px solid var(--ink); border-radius: 3px; background:
  repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 10%); }
.ladder-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); transition: width .9s cubic-bezier(.2, .7, .2, 1); }
.ladder-marker { position: absolute; top: -10px; bottom: -10px; left: 0; width: 4px; margin-left: -2px; background: var(--signal); box-shadow: 0 0 0 2px var(--ink); transition: left .9s cubic-bezier(.2, .7, .2, 1); }
.ladder-marker span {
  /* Shift by --a% of its own width: left-aligned at 0, right-aligned at 100, so it never leaves the scale. */
  position: absolute; bottom: calc(100% + 6px); left: 2px; transform: translateX(calc(var(--a, 50) * -1%));
  transition: transform .9s cubic-bezier(.2, .7, .2, 1);
  white-space: nowrap; max-width: 100cqw; overflow: hidden; text-overflow: ellipsis;
  background: var(--ink); color: var(--paper); font: 600 .78rem/1 var(--mono); padding: 5px 7px; border-radius: 3px;
}
.ladder-ticks { position: relative; list-style: none; margin: 0; padding: 0; height: 44px; }
.ladder-ticks li { position: absolute; top: 6px; transform: translateX(-50%); text-align: center; font-family: var(--mono); line-height: 1.25; }
.ladder-ticks li:nth-child(1) { left: 0; transform: none; text-align: left; }
.ladder-ticks li:nth-child(2) { left: 25%; }
.ladder-ticks li:nth-child(3) { left: 50%; }
.ladder-ticks li:nth-child(4) { left: 75%; }
.ladder-ticks li:nth-child(5) { left: 100%; transform: translateX(-100%); text-align: right; }
.ladder-ticks b { display: block; font-size: .85rem; }
.ladder-ticks span { display: block; font-size: .72rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) { .ladder-ticks li:nth-child(2n) span { display: none; } }
.ladder figcaption { color: var(--muted); font-size: .88rem; max-width: 70ch; margin-top: 8px; }

.status:not(:empty) { margin-top: 22px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); }
.status[data-kind="error"] { border-color: var(--alarm); border-left-width: 5px; }
.status[data-kind="busy"]::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%; background: var(--signal); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .25; } }
.status[data-kind="ok"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; padding: 0; border: 0; }

/* Report */
.report { padding: 48px 0 8px; outline: none; }
.r-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 18px; }
.r-head h2 { font-family: var(--mono); font-weight: 500; font-variation-settings: normal; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 20px; margin: 0; }
.stats div { padding: 20px 0; border-bottom: 1px solid var(--line); }
.stats dt { font-size: .82rem; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 500 1.6rem/1.1 var(--mono); }
.stats dd small { display: block; font: 400 .78rem var(--body); color: var(--muted); margin-top: 4px; }
.stats .lead { grid-column: span 2; }
.stats .lead dd { font-family: var(--display); font-weight: 850; font-size: 3rem; font-variation-settings: "wdth" 125; white-space: nowrap; }

.panel { margin-top: 28px; padding: 22px clamp(16px, 3vw, 28px); background: var(--card); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.panel-sub { color: var(--muted); font-size: .92rem; margin: 6px 0 16px; max-width: 70ch; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.split .panel { margin-top: 28px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.tiers { display: flex; height: 26px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.tiers span { min-width: 2px; }
.tier-0 { background: var(--t1); } .tier-1 { background: var(--t2); } .tier-2 { background: var(--t3); }
.tier-3 { background: var(--t4); } .tier-4 { background: var(--t5); } .tier-5 { background: var(--t6); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; padding: 0; margin: 12px 0 0; font-size: .88rem; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.legend .num { color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 28px; margin-top: 26px; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-grid h4 { margin: 0 0 10px; font-size: .78rem; font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bars li { display: grid; grid-template-columns: 5.5em 1fr 4.5em; align-items: center; gap: 8px; font-size: .88rem; }
.bars .bar { height: 10px; background: var(--paper); border-radius: 2px; overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: var(--t2); }
.bars .num { text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.chip { font: 500 .78rem/1 var(--mono); padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.risk { display: inline-block; font: 700 .85rem/1 var(--body); text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px; border-radius: 4px; color: var(--paper); }
.risk-low { background: var(--ok); } .risk-medium { background: var(--warn); } .risk-high { background: var(--alarm); }
.kv { display: grid; grid-template-columns: auto auto; justify-content: start; gap: 6px 18px; margin: 12px 0 0; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font: 500 .74rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px 8px 0; border-bottom: 1px solid var(--line); }
td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--grid); vertical-align: middle; }
td.dom { font-family: var(--mono); overflow-wrap: anywhere; }
td.dom a { color: var(--ink); text-decoration: none; }
td.dom a:hover { color: var(--route); text-decoration: underline; }
th.r, td.r { text-align: right; font-family: var(--mono); }
.auth { display: inline-flex; align-items: center; gap: 8px; }
.auth i { width: 44px; height: 6px; background: var(--paper); border-radius: 3px; overflow: hidden; position: relative; }
.auth i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w, 0); background: var(--ink); }

.changes { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 12px; }
@media (max-width: 860px) { .changes { grid-template-columns: 1fr; } }
.delta { font: 500 1.5rem var(--mono); }
.delta.up { color: var(--ok); } .delta.down { color: var(--alarm); }

.gap-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.gap-form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; flex: 1; }
.gap-form label { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); flex: 1 1 180px; }
.gap-form input { min-height: 44px; padding: 0 12px; font: 500 .95rem var(--mono); color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); }
.gap-form input:focus { border-color: var(--ink); }
#r-gap table { margin-top: 18px; }

.upsell { margin-top: 28px; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 22px clamp(16px, 3vw, 28px); border: 2px dashed var(--ink); border-radius: 10px; }
.upsell p { margin: 0; max-width: 70ch; }

/* Suite */
.suite { padding: clamp(56px, 9vw, 110px) 0 0; }
.suite-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 40px; border-top: 2px solid var(--ink); }
.suite-grid article { padding: 22px 22px 26px 0; border-bottom: 1px solid var(--line); }
.suite-grid article:not(:nth-child(3n)) { border-right: 1px solid var(--line); margin-right: 22px; }
@media (max-width: 900px) {
  .suite-grid { grid-template-columns: 1fr 1fr; }
  .suite-grid article:not(:nth-child(3n)) { border-right: 0; margin-right: 0; }
  .suite-grid article:nth-child(odd) { border-right: 1px solid var(--line); margin-right: 22px; }
}
@media (max-width: 600px) { .suite-grid { grid-template-columns: 1fr; } .suite-grid article:nth-child(odd) { border-right: 0; margin-right: 0; } }
.suite-grid ul { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; font-size: .93rem; }
.suite-grid li { padding-left: 16px; position: relative; }
.suite-grid li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 1.5px var(--ink); }
.suite-cta { margin: 36px 0 0; }

.data { padding: clamp(56px, 9vw, 100px) 0 0; }
.data-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 22px; }
.data-cols p { margin: 0; color: var(--muted); }
@media (max-width: 860px) { .data-cols { grid-template-columns: 1fr; } }

.foot { margin-top: 80px; padding: 22px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
