/* Crash Report Desk.
   Color carries one meaning each: orange = needs human review, green = passed or done, ink = everything else.
   Anything that looks pressable is a real button. Status marks are square badges, never empty circles. */
:root {
  color-scheme: light;
  --page: #f3f3ef;
  --panel: #fff;
  --ink: #1d2125;
  --ink-2: #4a5158;
  --ink-3: #646c74;
  --line: #dcdfd8;
  --line-soft: #eceee8;
  --tint: #eef0ea;
  --cone: #e4570e;
  --cone-ink: #a63c04;
  --cone-wash: #fcebdf;
  --cone-edge: #f1b48f;
  --go: #1e8a57;
  --go-ink: #16683f;
  --go-wash: #e3f2e9;
  --go-edge: #a8d6bb;
  --sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cond: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .75, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 17px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, dd, dt, figure, pre { margin: 0; padding: 0; }
ul, ol { list-style: none; }
p, li, dd { text-wrap: pretty; }
a { color: inherit; text-underline-offset: .2em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.app { width: min(880px, 100% - 40px); margin-inline: auto; }
.nw { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; z-index: 60; left: 12px; top: 12px; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; transform: translateY(-160%); }
.skip:focus { transform: none; }
.site-header { position: relative; background: var(--page); }

/* Intro */
.intro { padding: 52px 0 28px; }
.intro h1 { font: 600 clamp(42px, 6vw, 66px)/.98 var(--cond); letter-spacing: -.02em; }
.lede { max-width: 34em; margin-top: 16px; color: var(--ink-2); font-size: 20px; line-height: 1.45; }
.source-line { max-width: 44em; margin-top: 14px; color: var(--ink-3); font-size: 15px; }
.source-line a { color: var(--ink-2); font-weight: 600; text-underline-offset: 3px; white-space: nowrap; }

/* Tabs */
.tabs-bar { position: sticky; top: 0; z-index: 30; border-block: 1px solid var(--line); background: var(--page); }
.tabs { display: flex; gap: 30px; }
.tab { display: inline-flex; align-items: center; min-height: 54px; margin-bottom: -1px; padding: 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-2); font-size: 16px; font-weight: 500; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected='true'] { border-bottom-color: var(--ink); color: var(--ink); font-weight: 600; }

.panel { padding: 28px 0 72px; }

/* Summary: the result and the one thing to do next */
.summary { padding: 22px 22px 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.summary:focus { outline: none; }
.summary.enter { animation: rise .45s var(--ease) both; }
.summary-period { color: var(--ink-2); font-size: 15px; }
.summary-title { margin-top: 4px; font: 600 clamp(32px, 4.4vw, 44px)/1.02 var(--cond); letter-spacing: -.015em; }
.split { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.split li { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 15px; font-weight: 500; }
.split strong { font-weight: 700; }
.split-needs { background: var(--cone-wash); color: var(--cone-ink); }
.split-passed { background: var(--go-wash); color: var(--go-ink); }
.summary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 18px; }
.progress { display: flex; align-items: center; gap: 12px; margin-top: 16px; color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.progress-bar { position: relative; flex: 1 1 auto; max-width: 260px; height: 8px; overflow: hidden; border-radius: 999px; background: var(--tint); }
.progress-bar span { position: absolute; inset: 0; border-radius: inherit; background: var(--go); transform: scaleX(var(--progress, 0)); transform-origin: left; transition: transform .45s var(--ease); }
.summary-error { margin-top: 4px; }
.done { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; margin-top: 18px; padding: 16px 18px; border: 1px solid var(--go-edge); border-radius: 14px; background: var(--go-wash); animation: rise .5s var(--ease); }
.done h3 { color: var(--go-ink); font: 600 26px/1.1 var(--cond); }
.done p { margin-top: 4px; }
.done-mark { position: relative; width: 40px; height: 40px; border-radius: 50%; background: var(--go); animation: pop .6s var(--ease); }
.done-mark::after { position: absolute; top: 9px; left: 15px; width: 9px; height: 17px; border: solid #fff; border-width: 0 3.5px 3.5px 0; content: ''; transform: rotate(45deg); }
.summary-text { margin-top: 14px; padding: 12px 14px; overflow-x: auto; border-radius: 10px; background: var(--panel); font: 14px/1.5 var(--sans); white-space: pre-wrap; }
@keyframes pop { 0% { transform: scale(.3); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Lanes and reports */
.lanes { margin-top: 28px; }
.lane + .lane { margin-top: 32px; }
.lane-head { display: flex; align-items: center; gap: 10px; margin-inline: -10px; padding: 4px 10px; border-radius: 10px; }
.lane-head h2 { font: 600 24px/1.1 var(--cond); }
.lane-head.flash { animation: lane-flash 1.2s ease-out; }
@keyframes lane-flash { from { background: #e2e5dd; } to { background: transparent; } }
.lane-count { padding: 2px 10px; border-radius: 999px; background: #e7e9e3; color: var(--ink-2); font-size: 14px; font-weight: 600; }
[data-lane='needs'] .lane-count { background: var(--cone-wash); color: var(--cone-ink); }
[data-lane='cleared'] .lane-count { background: var(--go-wash); color: var(--go-ink); }
.lane-note { margin-top: 4px; color: var(--ink-3); font-size: 15px; }
.lane-list { display: grid; gap: 10px; margin-top: 12px; }
.lane-more { margin-top: 6px; }

.item { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); transition: border-color .3s, box-shadow .3s; }
.item[data-state='needs'] { border-color: var(--cone-edge); box-shadow: inset 4px 0 0 var(--cone); }
.item.enter { animation: rise .45s var(--ease) both; }
.item.flash-good { animation: flash-good 1.1s ease-out; }
@keyframes flash-good { from { background: var(--go-wash); } to { background: var(--panel); } }

.item-toggle { display: grid; grid-template-columns: 40px minmax(0, 1fr) 18px; align-items: start; gap: 14px; width: 100%; padding: 15px 16px; border: 0; background: none; text-align: start; cursor: pointer; }
.item-toggle:hover { background: #fafaf7; }
.item-toggle:focus-visible { outline-offset: -3px; border-radius: 16px; }
.kind { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: var(--tint); color: var(--ink-2); }
.kind svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.item-body { display: grid; min-width: 0; gap: 1px; }
.item-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.item-title { font-size: 17px; font-weight: 600; line-height: 1.3; }
.item-source { display: flex; flex-wrap: wrap; gap: 0 14px; color: var(--ink-3); font-size: 14px; }
.item-line { margin-top: 5px; color: var(--ink-2); font-size: 16px; line-height: 1.4; }
.item[data-state='needs'] .item-line { color: var(--cone-ink); font-weight: 500; }
.chevron { width: 18px; height: 18px; margin-top: 11px; color: var(--ink-3); transition: transform .25s var(--ease); }
.chevron::before { display: block; width: 8px; height: 8px; margin: 3px auto 0; border: solid currentColor; border-width: 0 2px 2px 0; content: ''; transform: rotate(45deg); }
.item-toggle[aria-expanded='true'] .chevron { transform: rotate(180deg); }

.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: #ecede8; color: var(--ink-2); font-size: 13px; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.chip[data-chip='five_day'] { background: #e8eaee; color: #3e4650; }

.item-act { padding: 0 16px 16px 70px; }
.act { min-height: 46px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 12px; background: var(--ink); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; transition: background-color .2s, transform .1s; }
.act:hover { background: #363c42; }
.act:active { transform: translateY(1px); }
.act--big { min-height: 54px; padding: 0 24px; font-size: 17px; }
.act--quiet { border-color: #b9bfb6; background: var(--panel); color: var(--ink); }
.act--quiet:hover { border-color: var(--ink-2); background: #fafaf7; }
.decide { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.decide-label { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.decide-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.decision { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.decision-tag { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; background: #e8eaee; color: #3e4650; font-size: 14px; font-weight: 600; }
.decision-tag[data-decision='follow'] { background: var(--cone-wash); color: var(--cone-ink); }
.decision-tag[data-decision='close'] { background: var(--go-wash); color: var(--go-ink); }
.text-button { min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink-2); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.text-button:hover { color: var(--ink); }

.item-details { padding: 2px 16px 18px 70px; animation: rise .3s var(--ease); }
.item-details h3 { margin-top: 16px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.item-details h3:first-child { margin-top: 0; }
.checks { display: grid; gap: 8px; margin-top: 8px; }
.checks li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; }
.badge { position: relative; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px; }
.badge--good { background: var(--go); }
.badge--good::after { position: absolute; top: 3px; left: 7px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; content: ''; transform: rotate(45deg); }
.badge--bad { background: var(--cone); }
.badge--bad::after { position: absolute; inset: 0; color: #fff; content: '!'; font-size: 14px; font-weight: 700; line-height: 20px; text-align: center; }
.check-label { font-size: 15px; font-weight: 600; line-height: 1.35; }
.check-detail { display: block; color: var(--ink-2); font-size: 14px; font-weight: 400; }
.facts { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 6px 14px; margin-top: 8px; font-size: 15px; }
.facts dt { color: var(--ink-3); }
.narrative { margin-top: 8px; padding: 12px 14px; border-radius: 10px; background: #f6f6f2; font-size: 15px; line-height: 1.55; }
.narrative .redacted { color: var(--ink-3); }
.narrative.is-clamped { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 7; }
.item-cite { margin-top: 10px; color: var(--ink-3); font-size: 13px; }

/* Toast */
.toast { position: fixed; z-index: 50; left: 50%; bottom: 20px; display: flex; width: max-content; max-width: min(560px, calc(100% - 32px)); align-items: center; gap: 12px; padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 15px; line-height: 1.4; box-shadow: 0 10px 30px rgb(29 33 37 / .25); opacity: 0; pointer-events: none; transform: translate(-50%, 140%); transition: transform .35s var(--ease), opacity .35s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast::before { width: 6px; height: 11px; flex: 0 0 auto; margin: -3px 4px 0 3px; border: solid #8fe0b4; border-width: 0 2.5px 2.5px 0; content: ''; transform: rotate(45deg); }
.toast[data-tone='info']::before { width: 8px; height: 8px; margin: 0 3px; border: 0; border-radius: 2px; background: #c9cfca; transform: none; }

/* Panel intros (trend, how it works) */
.panel-intro h2 { font: 600 clamp(30px, 4vw, 42px)/1.04 var(--cond); letter-spacing: -.015em; }
.panel-intro p { max-width: 36em; margin-top: 10px; color: var(--ink-2); }

/* Monthly trend */
.stage { margin-top: 22px; padding: 22px 22px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.stage-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.stage-label { color: var(--ink-2); font-size: 15px; font-weight: 600; }
.stage-count { font: 600 40px/1 var(--cond); }
.stage-unit { color: var(--ink-3); font: 500 15px/1 var(--sans); }
.chart { position: relative; margin: 0 -4px; border-radius: 8px; }
.chart:focus-visible { outline-offset: 6px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: #e7e9e3; stroke-width: 1; }
.chart .axis { stroke: #c4c9c1; stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font: 500 12px/1 var(--sans); }
.chart .tick--year { fill: var(--ink-2); font-weight: 600; }
.chart .value { fill: var(--ink); font: 600 14px/1 var(--sans); }
.chart .bar { fill: #a3aaa2; transition: fill .15s; }
.chart .bar--latest { fill: var(--ink); }
.chart .bar.is-active { fill: #4a5158; }
.chart .bar--latest.is-active { fill: #000; }
.chart .hit { fill: transparent; }
.chart-tip { position: absolute; z-index: 2; display: grid; gap: 1px; padding: 9px 12px; border-radius: 10px; background: var(--ink); color: #c9cfca; font-size: 13px; line-height: 1.35; pointer-events: none; transform: translate(-50%, -100%); white-space: nowrap; }
.chart-tip strong { color: #fff; font-size: 16px; }
.data-error { margin-top: 10px; color: var(--ink-2); }
.numbers { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.numbers summary { display: inline-flex; min-height: 40px; align-items: center; font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.numbers table { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.numbers th, .numbers td { padding: 6px 4px; border-top: 1px solid var(--line-soft); text-align: end; }
.numbers th[scope='row'], .numbers thead th:first-child { text-align: start; }
.numbers thead th { color: var(--ink-3); font-weight: 600; }
.numbers tbody th { font-weight: 500; }
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.figures li { display: grid; align-content: start; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.figures strong { font: 600 34px/1 var(--cond); letter-spacing: -.01em; }
.figures span { color: var(--ink-2); font-size: 15px; line-height: 1.35; }
.source-note { max-width: 52em; margin-top: 24px; color: var(--ink-3); font-size: 14px; }

/* How it works */
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; counter-reset: flow; }
.flow li { display: grid; align-content: start; gap: 6px; padding: 16px 18px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); counter-increment: flow; }
.flow li::before { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: var(--tint); color: var(--ink-2); content: counter(flow); font-size: 14px; font-weight: 600; }
.flow strong { font: 600 22px/1.15 var(--cond); }
.flow span { color: var(--ink-2); font-size: 16px; line-height: 1.45; }
.rules { margin-top: 40px; }
.rules h3 { font: 600 24px/1.2 var(--cond); }
.rules ul { margin-top: 10px; }
.rules li { display: grid; grid-template-columns: 13em minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.rules strong { font-weight: 600; }
.rules span { color: var(--ink-2); font-size: 16px; line-height: 1.45; }

.foot { display: grid; gap: 10px; padding: 22px 0 40px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 14px; }
.foot-work { max-width: 46em; color: var(--ink-2); font-size: 16px; }
.foot-work a { font-weight: 600; }
.noscript { margin-top: 16px; color: var(--cone-ink); font-weight: 500; }

@media (max-width: 720px) {
  .app { width: calc(100% - 32px); }
  .intro { padding: 30px 0 22px; }
  .intro h1 { font-size: clamp(40px, 11vw, 52px); }
  .lede { font-size: 18px; }
  .tabs { justify-content: space-between; gap: 12px; }
  .tab { min-height: 50px; font-size: 15px; }
  .panel { padding-top: 22px; }
  .summary { padding: 18px 16px 20px; }
  .summary-actions .act--big { width: 100%; }
  .done { grid-template-columns: 1fr; gap: 10px; padding: 16px; }
  .item-toggle { grid-template-columns: 36px minmax(0, 1fr) 16px; gap: 12px; padding: 14px; }
  .item-top { flex-direction: column; align-items: flex-start; }
  .kind { width: 36px; height: 36px; border-radius: 10px; }
  .kind svg { width: 20px; height: 20px; }
  .item-act { padding: 0 14px 14px; }
  .item-act .act { width: 100%; }
  .decide-buttons .act { flex: 1 1 100%; }
  .item-details { padding: 0 14px 16px; }
  .facts { grid-template-columns: 6.8em minmax(0, 1fr); gap: 6px 12px; }
  .figures { grid-template-columns: minmax(0, 1fr); }
  .figures li { grid-template-columns: 4.6em minmax(0, 1fr); align-items: baseline; gap: 12px; padding: 12px 14px; }
  .figures strong { font-size: 30px; }
  .stage { padding: 16px 14px 12px; }
  .stage-count { font-size: 32px; }
  .flow { grid-template-columns: minmax(0, 1fr); }
  .rules li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

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