body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-7);
  padding: 42px max(var(--space-6), calc((100vw - 1280px) / 2));
  background: var(--bg-card);
}

.page-header-copy { max-width: 760px; }

.eyebrow,
.context-label {
  color: var(--accent-strong);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.page-header h1 {
  margin-top: var(--space-2);
  color: var(--text-strong);
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: 1;
}

.page-header .subtitle {
  max-width: 680px;
  margin-top: var(--space-4);
  color: var(--muted);
  font-size: var(--fs-base);
  letter-spacing: 0;
  line-height: 1.6;
}

.header-note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-panel);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 4px var(--up-soft);
}

.last-updated {
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.drawdown-page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: var(--space-7) var(--space-6) var(--space-8);
}

.context-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: var(--space-7);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-1);
}

.context-strip > div { padding: var(--space-5); }
.context-strip > div + div { border-left: 1px solid var(--border-soft); }
.context-strip p {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.data-section {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-2);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  margin-top: var(--space-1);
  color: var(--text-strong);
  font-size: var(--fs-lg);
  font-weight: 650;
  letter-spacing: -.02em;
}

.section-heading > p {
  max-width: 390px;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
  text-align: right;
}

.table-wrapper {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 13px var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: .1em;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

thead th:first-child {
  left: 0;
  z-index: 3;
  width: 145px;
  text-align: left;
}

tbody tr:not(.event-row) { transition: background var(--dur-1); }
tbody tr:not(.event-row):hover { background: var(--accent-soft); }

td {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  font-size: var(--fs-sm);
  text-align: right;
  vertical-align: top;
  white-space: nowrap;
}

td.year {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 145px;
  background: var(--bg-card);
  text-align: left;
}

tbody tr:not(.event-row):hover td.year { background: color-mix(in srgb, var(--bg-card) 90%, var(--accent)); }

.cell-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  min-height: 22px;
}

.cell-line + .cell-line { margin-top: var(--space-1); }
.cell-line-left { justify-content: flex-start; }

.year-num {
  min-width: 38px;
  color: var(--text-strong);
  font-size: var(--fs-base);
  font-weight: 700;
}

.row-label {
  color: var(--muted-dim);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pct {
  min-width: 64px;
  font-size: var(--fs-base);
  font-weight: 700;
  text-align: right;
}

.z-score {
  width: 5.25em;
  flex-shrink: 0;
  color: var(--muted-dim);
  font-size: var(--fs-xs);
  text-align: left;
}

.z-score.outlier { color: var(--text-soft); font-weight: 650; }
.no-data { color: var(--muted-dim); }

.live-dot {
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--up);
}

.live-dot.active {
  display: inline-block;
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse { 50% { opacity: .28; } }

.event-row td {
  padding: 0 var(--space-5) var(--space-3);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-card);
  text-align: left;
}

.event-text {
  display: block;
  max-width: 840px;
  padding: var(--space-2) var(--space-3);
  border-left: 2px solid var(--accent-line);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-style: normal;
  line-height: 1.5;
  white-space: normal;
}

@media (max-width: 760px) {
  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--space-7) var(--space-4);
  }

  .page-header h1 { font-size: 2.15rem; }
  .drawdown-page { padding: var(--space-5) var(--space-3) var(--space-7); }
  .context-strip { grid-template-columns: 1fr; }
  .context-strip > div { padding: var(--space-4); }
  .context-strip > div + div { border-top: 1px solid var(--border-soft); border-left: 0; }
  .section-heading { align-items: flex-start; flex-direction: column; padding: var(--space-4); }
  .section-heading > p { text-align: left; }
  thead th, td { padding-right: var(--space-3); padding-left: var(--space-3); }
  thead th:first-child, td.year { width: 126px; }
  .event-row td { padding-right: var(--space-3); padding-left: var(--space-3); }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot.active { animation: none; }
}
