:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #d9dee8;
  --text: #1c2230;
  --text-dim: #5a6478;
  --primary: #2d6cdf;
  --good: #1f9d55;
  --good-bg: #e3f5ea;
  --bad: #d23b3b;
  --bad-bg: #fbe6e6;
  --warn: #c67a00;
  --warn-bg: #fdf1dd;
  --neutral: #5a6478;
  --neutral-bg: #eceef3;
  --chart-grid: #e6e9f0;
  --axis: #8a93a6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171f;
    --surface: #1c212c;
    --surface-2: #232936;
    --border: #333c4d;
    --text: #e8ebf1;
    --text-dim: #9aa4b8;
    --primary: #5b91f5;
    --good: #46c37b;
    --good-bg: #17301f;
    --bad: #f16c6c;
    --bad-bg: #341a1a;
    --warn: #e0a83c;
    --warn-bg: #332713;
    --neutral: #9aa4b8;
    --neutral-bg: #262c38;
    --chart-grid: #2b3342;
    --axis: #737d90;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 22px; position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; }
.topbar nav { display: flex; gap: 18px; }
.container { max-width: 1080px; margin: 22px auto; padding: 0 18px; }
.foot { text-align: center; color: var(--text-dim); padding: 30px 0; font-size: 13px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0; }
.sub { color: var(--text-dim); margin: 0 0 18px; }

/* cards + headline tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .lbl { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile .val { font-size: 24px; font-weight: 700; margin-top: 4px; }
.tile .hint { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

/* verdict banner */
.verdict { border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; border: 1px solid var(--border); }
.verdict.good { background: var(--good-bg); border-color: var(--good); }
.verdict.bad { background: var(--bad-bg); border-color: var(--bad); }
.verdict.warn { background: var(--warn-bg); border-color: var(--warn); }
.verdict.neutral { background: var(--neutral-bg); }
.verdict .big { font-size: 17px; font-weight: 600; }
.verdict .why { color: var(--text-dim); margin-top: 4px; font-size: 14px; }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge.muted { background: var(--neutral-bg); color: var(--text-dim); }

/* collapsible detail sections */
details.section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; }
details.section > summary {
  cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 16px; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: "▸"; color: var(--text-dim); transition: transform .15s; }
details.section[open] > summary::before { transform: rotate(90deg); }
details.section > summary .muted { color: var(--text-dim); font-weight: 400; font-size: 13px; }
.section-body { padding: 0 18px 18px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }
.scroll-x { overflow-x: auto; }

/* per-endpoint expandable */
.ep-detail { background: var(--surface-2); }
.ep-detail td { padding: 12px 14px; }

/* charts */
.svg-chart { width: 100%; height: auto; }
.svg-chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.svg-chart .axis-lbl { fill: var(--axis); font-size: 11px; }
.svg-chart .axis-title { fill: var(--text-dim); font-size: 11px; }
.svg-chart .legend-lbl { fill: var(--text-dim); font-size: 11px; }
.svg-chart .bar-val { fill: var(--text-dim); font-size: 10px; }
.chart-empty { color: var(--text-dim); padding: 20px; text-align: center; }
.chart-wrap { margin: 10px 0 20px; }
.chart-wrap h3 { font-size: 14px; margin: 0 0 6px; color: var(--text-dim); }
.chart-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }

/* glossary hint */
.hintline { color: var(--text-dim); font-size: 13px; margin: 2px 0 12px; }
.info { color: var(--text-dim); cursor: help; border-bottom: 1px dotted var(--text-dim); }

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.controls select, .controls input { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px; }
.btn { display: inline-block; background: var(--primary); color: #fff; border: none; border-radius: 7px; padding: 7px 14px; font-size: 14px; cursor: pointer; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn:hover { text-decoration: none; opacity: .92; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.pill { font-size: 12px; color: var(--text-dim); }
.mono { font-variant-numeric: tabular-nums; }
