/* PULSE ECG — theme tokens from the validated default palette
   (references/palette.md). Light is the default; dark responds to the OS
   setting and to a `data-theme` toggle stamped on <html>, whichever wins. */

:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  /* categorical slots 1-4, fixed order — used for capital rails 1-4 */
  --series-1: #2a78d6; /* rail 1: sovereign / defence budgets */
  --series-2: #eb6834; /* rail 2: institutional VC & growth */
  --series-3: #1baf7a; /* rail 3: public markets / M&A */
  --series-4: #eda100; /* rail 4: corporate strategic capex */
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --page: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.classification-banner {
  background: var(--text-primary);
  color: var(--page);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

header.page-header {
  margin-bottom: 28px;
}
header.page-header h1 {
  font-size: 20px;
  margin: 0 0 4px;
}
header.page-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}
.panel h2 {
  font-size: 15px;
  margin: 0 0 4px;
}
.panel .subtitle {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0 0 16px;
}

/* Filter — preset row, per dataviz interaction spec */
.filter-row {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}
.filter-row button {
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-row button:hover {
  background: var(--gridline);
}
.filter-row button[aria-pressed="true"] {
  background: var(--text-primary);
  color: var(--page);
  border-color: var(--text-primary);
  font-weight: 600;
}

/* Chart */
.currency-block { margin-bottom: 20px; }
.currency-block:last-child { margin-bottom: 0; }
.currency-block h3 {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.chart-svg text {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.chart-svg .gridline { stroke: var(--gridline); stroke-width: 1; }
.chart-svg .baseline { stroke: var(--baseline); stroke-width: 1; }
.chart-svg .bar { cursor: pointer; }
.chart-svg .bar:hover { opacity: 0.85; }

.table-toggle {
  font: inherit;
  font-size: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0 12px;
}
.table-toggle:hover { color: var(--text-primary); }

.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--text-primary);
  color: var(--page);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  z-index: 10;
  display: none;
}

/* Ledger table */
table.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.ledger th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--gridline);
}
table.ledger td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--gridline);
  vertical-align: top;
}
table.ledger tr:last-child td { border-bottom: none; }
table.ledger a { color: var(--series-1); }

.state-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gridline);
  color: var(--text-secondary);
  white-space: nowrap;
}

.empty-state, .error-state, .loading-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 0;
}
.error-state { color: #d03b3b; }

footer.provenance {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 12px;
}
