:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #142033;
  --muted: #5b6678;
  --line: #e3e7ee;
  --accent: #0b6e7f;
  --accent-soft: #e2f1f3;
  --warn: #b5541c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .06), 0 4px 16px rgba(20, 32, 51, .04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d131c; --surface: #151d29; --ink: #e6ebf2; --muted: #9aa6b8;
    --line: #253142; --accent: #4fc1d1; --accent-soft: #15333a; --warn: #f0a070;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d131c; --surface: #151d29; --ink: #e6ebf2; --muted: #9aa6b8;
  --line: #253142; --accent: #4fc1d1; --accent-soft: #15333a; --warn: #f0a070;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.02em; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; color: var(--muted); font-weight: 600; }
p { margin: 0 0 .8em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* header */
header.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
header.top .wrap { display: flex; align-items: center; gap: 20px; min-height: 58px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav.tabs a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; }
nav.tabs a:hover { background: var(--bg); color: var(--ink); }
nav.tabs a.on { background: var(--accent-soft); color: var(--accent); }
.theme-btn { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: inherit; }

/* hero */
.hero { padding: 32px 0 8px; }
.hero p.lead { color: var(--muted); max-width: 760px; font-size: 1.02rem; }
.stamp { display: inline-flex; gap: 8px; align-items: center; font-size: .82rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; margin-bottom: 12px; }
.stamp .live { width: 8px; height: 8px; border-radius: 50%; background: #2fa66a; }

/* grid & cards */
.grid { display: grid; gap: 16px; margin: 16px 0; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.span2 { grid-column: span 2; }
@media (max-width: 900px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3, .g2 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card .note { color: var(--muted); font-size: .82rem; margin-top: 8px; }
.kpi .v { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.chart { width: 100%; height: 320px; }
.chart.tall { height: 460px; }

/* insights */
.insights { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.insights li { padding: 12px 14px 12px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; position: relative; }
.insights li::before { content: counter(i); counter-increment: i; position: absolute; left: 12px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .75rem; display: grid; place-items: center; font-weight: 700; }
.insights { counter-reset: i; }

/* table / explorer */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters input, .filters select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; }
.filters input[type=search] { flex: 1 1 220px; }
.filters label { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }
.tag { display: inline-block; font-size: .74rem; padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); margin: 2px 2px 0 0; color: var(--muted); white-space: nowrap; }
.tag.no { border-color: var(--warn); color: var(--warn); }
.tag.en { border-color: var(--accent); color: var(--accent); }
.count { color: var(--muted); font-size: .9rem; }

/* prose (methodology) */
.prose { max-width: 820px; }
.prose h2 { margin-top: 1.6em; }
.prose code { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-size: .88em; }
.prose table { margin: 10px 0 18px; }
.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.flow span { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.flow i { color: var(--muted); font-style: normal; }

footer { color: var(--muted); font-size: .85rem; padding: 32px 0 48px; }
.skeleton { color: var(--muted); padding: 40px 0; text-align: center; }
