/*
 * One stylesheet for the portal.
 *
 * Tokens on :root so the dark variant redefines values rather than
 * components - a colour whose only definition lives inside a media query is
 * the classic way a page ends up with one theme's text on the other's ground.
 */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --line: #e6e2da;
  --ink: #1c1a17;
  --muted: #6b6559;
  --faint: #938c7e;
  --accent: #2e6f5e;
  --accent-ink: #ffffff;
  --warn-bg: #fdf3e3;
  --warn-line: #e8c98a;
  --warn-ink: #7a5212;
  --bar: #2e6f5e;
  --bar-soft: #cfe0da;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.06), 0 4px 16px rgba(28, 26, 23, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a;
    --surface: #1d1f24;
    --line: #2e3138;
    --ink: #eceef2;
    --muted: #a2a8b4;
    --faint: #767d8b;
    --accent: #5fbfa3;
    --accent-ink: #0f1113;
    --warn-bg: #3a2f17;
    --warn-line: #6b5423;
    --warn-ink: #f0d9a8;
    --bar: #5fbfa3;
    --bar-soft: #2b3b37;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  --bg: #15161a;
  --surface: #1d1f24;
  --line: #2e3138;
  --ink: #eceef2;
  --muted: #a2a8b4;
  --faint: #767d8b;
  --accent: #5fbfa3;
  --accent-ink: #0f1113;
  --warn-bg: #3a2f17;
  --warn-line: #6b5423;
  --warn-ink: #f0d9a8;
  --bar: #5fbfa3;
  --bar-soft: #2b3b37;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* Explicit, because the page composites over a ground the browser paints in
     its own theme - a transparent body borrows the wrong one. */
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

header.bar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
header.bar .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 58px;
}
.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
}
.brand span { color: var(--accent); }
.spacer { flex: 1; }

h1 { font-size: 26px; letter-spacing: -0.02em; margin: 28px 0 4px; text-wrap: balance; }
h2 { font-size: 15px; margin: 28px 0 10px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.sub { color: var(--muted); margin: 0 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value {
  font-size: 26px;
  font-weight: 620;
  letter-spacing: -0.02em;
  /* Figures line up between cards and down the table. */
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.stat .note { font-size: 12px; color: var(--faint); margin-top: 2px; }

.banner {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
}

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td { border-bottom: 0; }

/* Wide content scrolls inside its own container; the body never does. */
.scroll-x { overflow-x: auto; }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 48px; margin-top: 10px; }
.spark i {
  flex: 1;
  background: var(--bar-soft);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  display: block;
}
.spark i[data-on="1"] { background: var(--bar); }

button, .btn {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
}
button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 560;
}
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }
.err { color: #b3261e; font-size: 14px; min-height: 20px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .err { color: #ff9a92; }
}
:root[data-theme="dark"] .err { color: #ff9a92; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
code.key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
}
footer { color: var(--faint); font-size: 13px; margin: 40px 0 28px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
