:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d2327;
  --muted: #5d676e;
  --line: #e3e0d8;
  --accent: #0f6e56;
  --accent-soft: #e3f1ec;
  --accent-text: #ffffff;
  --code-bg: #f2f0ea;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181b;
    --surface: #1b2024;
    --text: #e6e8e9;
    --muted: #9aa3a9;
    --line: #2c3338;
    --accent: #4cc39c;
    --accent-soft: #1d3530;
    --accent-text: #0c1a15;
    --code-bg: #232a2f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14181b; --surface: #1b2024; --text: #e6e8e9; --muted: #9aa3a9; --line: #2c3338;
  --accent: #4cc39c; --accent-soft: #1d3530; --accent-text: #0c1a15; --code-bg: #232a2f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--font);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code { font: 0.88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
pre code { background: none; padding: 0; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin: 0.4em 0 0.3em; }
h2 { font-size: 1.35rem; margin: 1.8em 0 0.6em; }
h3 { font-size: 1.05rem; margin: 0 0 0.35em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.tabs a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.tabs a:hover, .tabs a[aria-current] { color: var(--accent); }
main.wrap { padding-bottom: 48px; }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: 0.88rem; }

.lede { font-size: 1.12rem; color: var(--muted); max-width: 46em; margin-top: 0; }



.search input, .filters input, .filters select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.search input:focus, .filters input:focus, .filters select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }


.crumbs { font-size: 0.88rem; color: var(--muted); margin: 20px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button { display: inline-block; padding: 8px 16px; border-radius: 8px; background: var(--accent); color: var(--accent-text); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin: 1em 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--code-bg); position: sticky; top: 0; }
tbody tr:last-child > * { border-bottom: 0; }


.filters { display: grid; grid-template-columns: 2fr 1.4fr 1fr 0.7fr; gap: 10px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr; } .filters label:first-child { grid-column: 1 / -1; } }
.lit { list-style: none; padding: 0; }
.lit li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; }
.lit p { margin: 0.25em 0; }
.lit .meta { font-size: 0.88rem; color: var(--muted); }
.tag { display: inline-block; font-size: 0.76rem; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); margin: 2px 6px 2px 0; }
.lit details { font-size: 0.9rem; }
.lit summary { cursor: pointer; color: var(--accent); }

.tabs a { padding: 4px 0; border-bottom: 2px solid transparent; }
.tabs a[aria-current] { border-bottom-color: var(--accent); }
.lede { margin-bottom: 0.4em; }
.source-list { list-style: none; padding: 0; margin: 24px 0; max-width: 46em; }
.source-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.source-list a { font-size: 1.15rem; font-weight: 600; }
.search { display: block; margin: 16px 0 4px; max-width: 28em; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.datasets td { padding: 10px; }
.table-scroll.data { max-height: 75vh; }

.v-controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 16px 0 8px; }
.v-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--muted); min-width: 0; }
.v-controls .v-search { grid-column: 1 / -1; max-width: 28em; }
.v-controls input, .v-controls select { width: 100%; font: inherit; font-size: 0.92rem; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.v-controls input:focus, .v-controls select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.v-fixed { color: var(--muted); }
.v-fixed span { white-space: normal; }
.v-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.v-pager { display: flex; flex-wrap: wrap; gap: 6px; }
.v-pager button { font: inherit; font-size: 0.88rem; padding: 5px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.v-pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.v-pager button:disabled { opacity: 0.45; cursor: default; }
#viewer th button { all: unset; cursor: pointer; font-weight: 600; white-space: nowrap; }
#viewer th button:hover { color: var(--accent); }
#viewer td { white-space: nowrap; max-width: 32em; overflow: hidden; text-overflow: ellipsis; }
#viewer td.num, #viewer th.num { text-align: right; font-variant-numeric: tabular-nums; }
.qa { white-space: pre-line; max-width: 46em; }
#viewer td.long { white-space: normal; min-width: 24em; max-width: 40em; }
