:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1d2330; --muted: #5b6475;
  --border: #d9dde5; --accent: #0b6bcb; --on-accent: #ffffff; --warn: #a15c00; --grid: #e3e6ec;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c; --surface: #1a1f29; --text: #e6e9ef; --muted: #9aa3b2;
    --border: #2c3341; --accent: #5aa9ff; --on-accent: #0b1220; --warn: #f0b458; --grid: #2a303c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c; --surface: #1a1f29; --text: #e6e9ef; --muted: #9aa3b2;
  --border: #2c3341; --accent: #5aa9ff; --on-accent: #0b1220; --warn: #f0b458; --grid: #2a303c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner, main, .site-footer { max-width: 1200px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.site-nav a { text-decoration: none; padding: 4px 10px; border-radius: 6px; color: var(--text); }
.site-nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.header-tools { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 14px; }
#theme-toggle { font: inherit; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); cursor: pointer; }
main { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: 28px; margin: 0 0 16px; }
h2 { font-size: 21px; margin: 32px 0 12px; }
h3 { font-size: 17px; margin: 0 0 8px; }
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.metric, .card, details.source { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.metric-label { font-size: 14px; color: var(--muted); }
.metric-value { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric-note { font-size: 14px; }
.provenance { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.stale { color: var(--warn); font-weight: 600; }
.missing { color: var(--muted); font-style: italic; }
.components { margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
details.source { margin-bottom: 12px; }
details.source > summary { cursor: pointer; font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.status-error { color: var(--warn); }
.site-footer { padding-top: 16px; padding-bottom: 32px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); }
.chart-map { min-height: 460px; }
.country-index { columns: 3 200px; padding-left: 20px; margin: 0; }
.country-index li { break-inside: avoid; }
/* Grid cells must be allowed to shrink below their content, or Plotly's initial width overflows. */
.grid-2 > *, .metric-row > * { min-width: 0; }
.chart { width: 100%; overflow: hidden; }
