:root {
  color-scheme: light dark;
  --navy: #14213d;
  --navy-soft: #223454;
  --ink: #172033;
  --muted: #607089;
  --line: #d9e0e8;
  --surface: #ffffff;
  --surface-soft: #f3f6f9;
  --page: #eef2f6;
  --teal: #087f73;
  --green: #26724a;
  --amber: #946200;
  --red: #a33a36;
  --content: 1180px;
  --radius: 6px;
  --font: Inter, Onest, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--page); font-family: var(--font); line-height: 1.5; }
a { color: inherit; }
button, input { font: inherit; }

.skip-link { position: fixed; z-index: 20; top: 8px; left: 8px; padding: 9px 12px; color: white; background: var(--navy); transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.topbar { min-height: 68px; display: flex; align-items: center; gap: 28px; padding: 0 max(20px, calc((100vw - var(--content)) / 2)); color: white; background: var(--navy); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.36); border-radius: 4px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small { color: #b9c6da; font-size: .72rem; }
.topbar nav { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.topbar nav a { color: #dbe4f1; font-size: .83rem; font-weight: 650; text-decoration: none; }
.topbar nav a:hover, .topbar nav a:focus-visible { color: white; }
.portal-link { padding: 8px 11px; border: 1px solid rgba(255,255,255,.32); border-radius: 4px; font-size: .78rem; font-weight: 700; text-decoration: none; }

main { max-width: var(--content); margin: 0 auto; padding: 36px 24px 72px; }
section { margin-top: 44px; }
.summary { margin-top: 0; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 24px; }
.summary__main, .quality-callout { min-width: 0; padding: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.status-line { display: flex; align-items: center; gap: 12px; }
.status-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 5px rgba(96,112,137,.12); }
[data-regime="normal"] .status-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(38,114,74,.12); }
[data-regime="heightened"] .status-dot, [data-regime="stress"] .status-dot { background: var(--amber); box-shadow: 0 0 0 5px rgba(148,98,0,.12); }
[data-regime="severe"] .status-dot { background: var(--red); box-shadow: 0 0 0 5px rgba(163,58,54,.12); }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.55rem); line-height: 1.08; letter-spacing: 0; }
h2 { margin: 0; font-size: 1.4rem; line-height: 1.18; letter-spacing: 0; }
h3 { margin: 0; font-size: 1rem; }
.summary__text { max-width: 68ch; margin: 16px 0 0; color: #3d4d65; font-size: 1rem; }
.summary__meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 24px; color: var(--muted); font-size: .78rem; }
.quality-callout { border-top: 4px solid var(--muted); }
.quality-callout[data-quality-state="complete"] { border-top-color: var(--green); }
.quality-callout[data-quality-state="limited"] { border-top-color: var(--amber); background: #fffaf0; }
.quality-callout[data-quality-state="unavailable"] { border-top-color: var(--red); background: #fff7f6; }
.quality-callout h2 { font-size: 1.15rem; }
.quality-callout p:not(.eyebrow) { margin: 10px 0 16px; color: var(--muted); font-size: .84rem; }
.quality-callout a { color: var(--navy); font-size: .82rem; font-weight: 750; }

.metric-band { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 18px; background: var(--navy); border-radius: var(--radius); overflow: hidden; }
.metric-band article { min-width: 0; padding: 19px 22px; color: white; border-right: 1px solid rgba(255,255,255,.15); }
.metric-band article:last-child { border-right: 0; }
.metric-band span, .metric-band strong, .metric-band small { display: block; }
.metric-band span { color: #b9c6da; font-size: .72rem; }
.metric-band strong { margin-top: 5px; font-size: 1.5rem; line-height: 1; }
.metric-band small { margin-top: 6px; color: #b9c6da; font-size: .67rem; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.section-heading > p { max-width: 58ch; margin: 0; color: var(--muted); font-size: .78rem; text-align: right; }
.change-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.change-grid article { min-width: 0; padding: 17px 20px; border-right: 1px solid var(--line); }
.change-grid article:last-child { border-right: 0; }
.change-grid span, .change-grid strong { display: block; }
.change-grid span { color: var(--muted); font-size: .72rem; }
.change-grid strong { margin-top: 4px; font-size: .95rem; }
.delta-up { color: var(--red); }
.delta-down { color: var(--green); }

.driver-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.driver-card { min-width: 0; padding: 21px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--navy-soft); border-radius: var(--radius); }
.driver-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.driver-card__head span { flex: 0 0 auto; padding: 3px 7px; border-radius: 3px; color: var(--muted); background: var(--surface-soft); font-size: .68rem; font-weight: 750; }
.driver-card p { margin: 12px 0 0; color: var(--muted); font-size: .8rem; }
.driver-card small { display: block; margin-top: 14px; color: var(--muted); font-size: .7rem; }
.empty-note { grid-column: 1 / -1; margin: 0; padding: 22px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }

.quality-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 18px; }
.coverage-panel, .limitations-panel { min-width: 0; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.coverage-row { display: flex; align-items: baseline; gap: 8px; }
.coverage-row strong { font-size: 1.8rem; }
.coverage-row span { color: var(--muted); font-size: .78rem; }
.coverage-track { height: 8px; margin-top: 13px; overflow: hidden; background: var(--surface-soft); border-radius: 4px; }
.coverage-track span { display: block; width: 0; height: 100%; background: var(--teal); transition: width .25s ease; }
.source-counts { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 13px; color: var(--muted); font-size: .74rem; }
.source-counts strong { color: var(--ink); }
.source-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin-top: 18px; }
.source-item { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .74rem; }
.source-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.source-item[data-state="limited"] i { background: var(--amber); }
.source-item[data-state="failed"] i { background: var(--red); }
.source-item small { color: var(--muted); }
.limitations-panel { background: #fffaf0; border-color: #e8d8b3; }
.limitations-panel ul { margin: 14px 0 0; padding-left: 18px; }
.limitations-panel li { margin-top: 8px; color: #5a4a2a; font-size: .78rem; }

.interpretation { padding: 28px; color: white; background: var(--navy); border-radius: var(--radius); }
.interpretation .eyebrow, .interpretation .section-heading > p { color: #b9c6da; }
.interpretation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 18px; background: rgba(255,255,255,.14); }
.interpretation-grid article { padding: 18px; background: var(--navy); }
.interpretation-grid span { color: #b9c6da; font-size: .7rem; font-weight: 750; text-transform: uppercase; }
.interpretation-grid p { margin: 7px 0 0; color: #edf3fb; font-size: .78rem; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.button { display: inline-flex; min-height: 38px; align-items: center; padding: 8px 12px; color: white; border: 1px solid rgba(255,255,255,.3); border-radius: 4px; font-size: .76rem; font-weight: 750; text-decoration: none; }
.button--primary { color: var(--navy); background: white; border-color: white; }

.error-state { padding: 24px; border: 1px solid #e4b5b2; background: #fff7f6; border-radius: var(--radius); }
.error-state p { color: var(--muted); }
.error-state button { padding: 8px 12px; border: 1px solid var(--navy); border-radius: 4px; color: white; background: var(--navy); cursor: pointer; }
[data-brief-state="unavailable"] [data-brief-dependent] { display: none; }
footer { display: grid; grid-template-columns: 1fr 2fr; gap: 30px; padding: 28px max(24px, calc((100vw - var(--content)) / 2)); color: #c8d2e1; background: #0d172a; }
footer strong, footer span { display: block; }
footer span, footer p { margin: 3px 0 0; color: #9eacc0; font-size: .72rem; }
footer a { color: inherit; text-decoration-color: rgba(158,172,192,.45); text-underline-offset: 3px; }
footer a:hover { color: #edf3fb; text-decoration-color: currentColor; }

@media (max-width: 880px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
  .topbar nav { order: 3; width: 100%; gap: 16px; overflow-x: auto; padding-bottom: 2px; }
  .portal-link { margin-left: auto; }
  .summary, .quality-layout { grid-template-columns: 1fr; }
  .metric-band, .change-grid { grid-template-columns: 1fr 1fr; }
  .metric-band article:nth-child(2) { border-right: 0; }
  .metric-band article:nth-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,.15); }
  .change-grid article:nth-child(2) { border-right: 0; }
  .change-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .driver-grid, .interpretation-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .section-heading > p { text-align: left; }
}

@media (max-width: 520px) {
  main { padding: 22px 14px 52px; }
  .summary__main, .quality-callout, .coverage-panel, .limitations-panel, .interpretation { padding: 20px; }
  .metric-band, .change-grid, .source-list { grid-template-columns: 1fr; }
  .metric-band article, .change-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-band article { border-bottom-color: rgba(255,255,255,.15); }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 8px; }
  footer { grid-template-columns: 1fr; gap: 12px; }
}

@media (prefers-color-scheme: dark) {
  :root { --ink: #e8edf5; --muted: #a5b1c2; --line: #334057; --surface: #172238; --surface-soft: #202d45; --page: #0f1828; }
  .summary__text { color: #c7d1df; }
  .quality-callout[data-quality-state="limited"], .limitations-panel { background: #2a251b; border-color: #5d4c2c; }
  .quality-callout[data-quality-state="unavailable"], .error-state { background: #2d1d20; }
  .limitations-panel li { color: #e4d4af; }
  .button--primary { color: var(--navy); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .coverage-track span { transition: none; }
}
