/* ==========================================================================
   Stats page: Dexel core look (same base as the homepage, css/pages/home.css)
   Black, white and green base; each number gets its own score colour, like an arcade scoreboard.
   Press Start 2P for headings, labels and numbers; Inter for everything you read.
   Square-ish corners, 2px borders, hard offset shadows, stepped motion. All motion stops under reduced motion.
   The header strip is drawn by js/pages/stats-scene.js; cards, charts, count-ups and reveals by js/pages/stats.js.
   ========================================================================== */

.st-body {
  --st-bg: #FFFFFF;
  --st-ink: #0B0B0B;
  --st-text: #3D3D3D;
  --st-mute: #5C5C5C;
  --st-line: #E4E4E4;
  --st-edge: #0B0B0B;
  --st-card: #F6F6F4;
  --st-red: #ED4245;
  --st-red-text: #C42B2E;
  --st-pixel: var(--font-pixel, 'Press Start 2P', ui-monospace, monospace);
  --st-step: steps(4, end);
  background: var(--st-bg);
  color: var(--st-text);
  font-family: var(--font-sans);
  overflow-x: hidden;
}
.st-body [hidden] { display: none !important; }
[data-theme="dark"] .st-body {
  --st-bg: #0A0A0A;
  --st-ink: #FFFFFF;
  --st-text: #CFCFCF;
  --st-mute: #A8A8A8;
  --st-line: #222222;
  --st-edge: #333333;
  --st-card: #121212;
  --st-red-text: #FF6B6E;
}
.st-body .nav-bar { background-color: var(--st-bg); border-bottom-color: var(--st-line); }

/* Score colours. --acc is the fill (bars, shadows, chips), --acc-text the AA-safe text shade per theme,
   --acc-chart the line and bar colour (the text shade in light so marks stand out on a pale card). */
.st-acc-green  { --acc: #3FAE4F; --acc-text: #1F7A34; }
.st-acc-gold   { --acc: #FFCC33; --acc-text: #8A5F00; }
.st-acc-teal   { --acc: #38D9C0; --acc-text: #0E7A6A; }
.st-acc-violet { --acc: #A78BFA; --acc-text: #6D4BD1; }
.st-acc-pink   { --acc: #FF6FB5; --acc-text: #B4236E; }
[data-theme="dark"] .st-acc-green  { --acc-text: #7ED67A; }
[data-theme="dark"] .st-acc-gold   { --acc-text: #FFCC33; }
[data-theme="dark"] .st-acc-teal   { --acc-text: #38D9C0; }
[data-theme="dark"] .st-acc-violet { --acc-text: #A78BFA; }
[data-theme="dark"] .st-acc-pink   { --acc-text: #FF6FB5; }
[class*="st-acc-"] { --acc-chart: var(--acc-text); }
[data-theme="dark"] [class*="st-acc-"] { --acc-chart: var(--acc); }

/* A small solid square in the card's colour, with a hard ink shadow */
.st-chip {
  flex: 0 0 auto;
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--acc, var(--dx-green));
  box-shadow: 2px 2px 0 var(--st-ink);
}

/* --- header strip ---------------------------------------------------------------------------------- */
.st-strip {
  position: relative;
  height: clamp(96px, 13vw, 168px);
  overflow: hidden;
  background: #07070C;
  border-bottom: 2px solid var(--st-edge);
}
[data-theme="light"] .st-strip { background: #7CC8FF; }
.st-strip-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* --- page header ----------------------------------------------------------------------------------- */
/* .st-body in front so these win over responsive.css, which resets .container padding on small screens */
.st-body .stats-page-container {
  padding-top: 56px;
  padding-bottom: 96px;
  position: relative;
}

.stats-header-section { margin-bottom: 40px; }

.st-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-family: var(--st-pixel);
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  color: var(--dx-green-text);
}

.stats-title {
  font-family: var(--st-pixel);
  font-weight: 400;
  font-size: clamp(20px, 3.2vw, 34px);
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--st-ink);
  margin: 0 0 14px;
  text-wrap: balance;
}

.stats-lead {
  font-size: 17px;
  line-height: 1.6;
  color: var(--st-text);
  max-width: 56ch;
  margin: 0;
}

/* Online status: a neutral pill with a small solid dot (never glowing), then the last update time */
.stats-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 18px;
  scroll-margin-top: 96px;
}
.stats-uptime {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 12px;
  border: 2px solid var(--st-line);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--st-text);
}
.stats-uptime::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--dx-green);
}
.stats-uptime.is-offline::before { background: var(--st-red); }
.stats-updated { margin: 0; font-size: 14px; color: var(--st-mute); }

/* --- unavailable state ----------------------------------------------------------------------------- */
.stats-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 56px;
  padding: 40px 24px;
  text-align: center;
  background: var(--st-card);
  border: 2px solid var(--st-edge);
  border-radius: 6px;
  box-shadow: 6px 6px 0 var(--st-red);
  --acc: var(--st-red);
  --acc-chart: var(--st-red-text);
}
.stats-unavailable-title {
  margin: 0 0 8px;
  font-family: var(--st-pixel);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  color: var(--st-ink);
}
.stats-unavailable-desc { max-width: 48ch; margin: 0; font-size: 15px; line-height: 1.55; color: var(--st-mute); }

/* --- score cards ----------------------------------------------------------------------------------- */
.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 56px;
}

.stats-kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  min-height: 116px;
  padding: 18px;
  background: var(--st-card);
  border: 2px solid var(--st-edge);
  border-radius: 6px;
  box-shadow: 6px 6px 0 var(--acc);
  transition: transform 120ms var(--st-step), box-shadow 120ms var(--st-step);
}
.stats-kpi-card:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--acc); }

.stats-kpi-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--st-pixel);
  font-size: 10px;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--st-mute);
}
.stats-kpi-label .st-chip { margin-top: 2px; }

.stats-kpi-value {
  font-family: var(--st-pixel);
  font-size: clamp(18px, 1.9vw, 24px);
  line-height: 1.2;
  color: var(--st-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats-kpi-value.is-counting, .graph-current-num.is-counting { color: var(--acc-text); }
.stats-kpi-note { margin: auto 0 0; font-size: 13px; line-height: 1.45; color: var(--st-mute); }

/* --- sections -------------------------------------------------------------------------------------- */
.stats-group + .stats-group { margin-top: 56px; }
.stats-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  font-family: var(--st-pixel);
  font-weight: 400;
  font-size: clamp(14px, 1.6vw, 18px);
  line-height: 1.5;
  color: var(--st-ink);
}
.stats-group-title::after { content: ""; flex: 1 1 auto; height: 2px; background: var(--st-line); }

/* --- chart cards ----------------------------------------------------------------------------------- */
.stats-graphs-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.graph-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--st-card);
  border: 2px solid var(--st-edge);
  border-radius: 6px;
  box-shadow: 6px 6px 0 var(--acc);
}
.graph-card-span-2 { grid-column: span 2; }

.graph-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px 24px;
  padding: 22px 24px;
  border-bottom: 2px solid var(--st-line);
}

.graph-title-group { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.graph-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-family: var(--st-pixel);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--st-ink);
}

.graph-subtitle { margin: 0; font-size: 14px; line-height: 1.5; color: var(--st-mute); }

.graph-metric-highlight {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 6px;
}

.graph-current-num {
  font-family: var(--st-pixel);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.2;
  color: var(--st-ink);
  font-variant-numeric: tabular-nums;
}

/* Neutral pills with a small solid dot: no tints, no glow */
.graph-delta-pill,
.graph-secondary-pill,
.stats-empty-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 2px solid var(--st-line);
  border-radius: 4px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--st-text);
  white-space: nowrap;
}
.graph-delta-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--acc);
}
/* the pill inside the delta slot while there is no data: let the inner pill draw itself */
.graph-delta-pill:has(> .stats-empty-pill) { padding: 0; border: 0; }
.graph-delta-pill:has(> .stats-empty-pill)::before { display: none; }
.stats-empty-pill::before,
.graph-secondary-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--st-mute);
}

/* --- controls -------------------------------------------------------------------------------------- */
.graph-controls-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.graph-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 2px solid var(--st-edge);
  border-radius: 4px;
  background: var(--st-bg);
}

.graph-control-btn {
  min-width: 36px;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font-family: var(--st-pixel);
  font-size: 10px;
  line-height: 1;
  color: var(--st-text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms var(--st-step), color 120ms var(--st-step);
}
.graph-control-btn:hover { color: var(--st-ink); background: var(--st-line); }
.graph-control-btn.active { background: var(--dx-green); color: var(--dx-on-green); }
/* the measure switch (Daily / 7 days / 30 days, Servers / Member seats) reads as words, not a pixel code */
.graph-view-btn { font-family: var(--font-sans); font-size: 13px; font-weight: 600; padding: 0 10px; }

.st-body .graph-control-btn:focus-visible {
  outline: 3px solid var(--dx-green);
  outline-offset: 2px;
}

/* --- chart surface --------------------------------------------------------------------------------- */
.graph-svg-container {
  position: relative;
  width: 100%;
  height: 280px;
  background: var(--st-card);
  border-radius: 0 0 4px 4px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  cursor: crosshair;
}
.graph-svg-container svg { display: block; width: 100%; height: 100%; }

.chart-path-line {
  fill: none;
  stroke: var(--acc-chart);
  stroke-width: 3px;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.chart-path-area { fill: var(--acc); fill-opacity: 0.14; }
.chart-dither { fill: var(--acc); fill-opacity: 0.45; }
.chart-point { fill: var(--acc-chart); shape-rendering: crispEdges; }

.chart-bar { fill: var(--acc-chart); shape-rendering: crispEdges; transition: fill 120ms var(--st-step); }
.chart-bar:hover { fill: var(--st-ink); }
.chart-bar.is-removed { fill: var(--st-red); }
.chart-bar.is-removed:hover { fill: var(--st-red-text); }
/* today so far: a pale bar with a dashed edge, a hollow point at the end of a dashed line */
.chart-bar.is-partial { fill: var(--acc); fill-opacity: 0.35; stroke: var(--acc-chart); stroke-width: 1.5px; stroke-dasharray: 3 2; }
.chart-bar.is-removed.is-partial { fill: var(--st-red); stroke: var(--st-red-text); }
.chart-path-line.is-partial { stroke-dasharray: 5 4; stroke-width: 2px; }
.chart-point.is-partial { fill: var(--st-card); stroke: var(--acc-chart); stroke-width: 2px; }
/* older, less precise data: stripes behind the marks; days with nothing recorded: a plain grey band */
.chart-legacy-stripe { fill: var(--st-mute); fill-opacity: 0.16; }
.chart-bar.is-legacy { fill-opacity: 0.55; }
.chart-gap-band { fill: var(--st-line); fill-opacity: 0.7; }
.chart-zero-line { stroke: var(--st-mute); stroke-width: 1px; shape-rendering: crispEdges; }

.chart-grid-line { stroke: var(--st-line); stroke-width: 1px; stroke-dasharray: 2 4; shape-rendering: crispEdges; }
.chart-axis-text { font-family: var(--font-mono); font-size: 11px; fill: var(--st-mute); user-select: none; }

.chart-crosshair-line { stroke: var(--st-ink); stroke-width: 1px; stroke-dasharray: 2 3; pointer-events: none; shape-rendering: crispEdges; }
.chart-pin-halo { fill: none; stroke: var(--st-ink); stroke-width: 2px; pointer-events: none; shape-rendering: crispEdges; }
.chart-pin-dot { fill: var(--acc); stroke: var(--st-ink); stroke-width: 2px; pointer-events: none; shape-rendering: crispEdges; }

/* Hover readout */
.graph-hud-tooltip {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
  padding: 10px 12px;
  background: var(--st-bg);
  border: 2px solid var(--st-edge);
  border-radius: 4px;
  box-shadow: 4px 4px 0 var(--acc);
  pointer-events: none;
}
.graph-hud-tooltip.align-left { left: 18px; right: auto; }
.graph-hud-tooltip.align-right { right: 18px; left: auto; }
.graph-hud-date { font-size: 12px; color: var(--st-mute); }
.graph-hud-value { font-family: var(--st-pixel); font-size: 12px; line-height: 1.4; color: var(--st-ink); }
.graph-hud-meta { font-size: 12px; font-weight: 600; color: var(--acc-text); }

/* --- legend under each chart ----------------------------------------------------------------------- */
.graph-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 12px 24px 16px;
  border-top: 2px solid var(--st-line);
  font-size: 13px;
  color: var(--st-mute);
}
.graph-legend:empty { display: none; }
.lg-item { display: inline-flex; align-items: center; gap: 8px; }
.lg-utc { margin-left: auto; font-family: var(--font-mono); font-size: 12px; }
.lg-swatch { flex: 0 0 auto; width: 14px; height: 10px; border: 1px solid var(--st-edge); }
.lg-bar { background: var(--acc-chart); }
.lg-bar.is-removed { background: var(--st-red); }
.lg-legacy { background: repeating-linear-gradient(45deg, var(--st-mute) 0 1px, transparent 1px 4px); }
.lg-gap { background: var(--st-line); }
.lg-partial { border: 1.5px dashed var(--acc-chart); background: transparent; }

/* --- breakdown lists ------------------------------------------------------------------------------- */
.graph-breakdown { position: relative; min-height: 200px; padding: 18px 24px 20px; }
.bd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bd-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 12px;
}
.bd-label { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.bd-name { font-size: 14px; font-weight: 600; color: var(--st-ink); overflow-wrap: anywhere; }
.bd-tag {
  padding: 1px 6px;
  border: 1px solid var(--st-line);
  border-radius: 3px;
  font-size: 12px;
  color: var(--st-mute);
  white-space: nowrap;
}
.bd-value {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--st-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bd-share { color: var(--st-mute); font-weight: 500; }
.bd-bar { grid-column: 1 / -1; display: block; width: 100%; height: 6px; shape-rendering: crispEdges; }
.bd-bar-track { fill: var(--st-line); }
.bd-bar-fill { fill: var(--acc-chart); }
.bd-row.is-legacy .bd-bar-fill { fill-opacity: 0.5; }

/* --- second stacked series (returning people) --------------------------------------------------- */
.st-body { --st-second: #6D4BD1; }
[data-theme="dark"] .st-body { --st-second: #A78BFA; }
.chart-bar.is-second { fill: var(--st-second); }
.chart-bar.is-second.is-partial { fill: var(--st-second); fill-opacity: 0.35; stroke: var(--st-second); }
.lg-bar.is-second { background: var(--st-second); }

/* --- ranked tables (top commands, tokens by model, install sources) ------------------------------ */
.tb { width: 100%; border-collapse: collapse; font-size: 14px; }
.tb th {
  padding: 0 8px 10px;
  font-family: var(--st-pixel);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--st-mute);
  text-align: left;
  border-bottom: 2px solid var(--st-line);
}
.tb td { padding: 9px 8px; border-bottom: 1px solid var(--st-line); color: var(--st-text); vertical-align: middle; }
.tb tbody tr:last-child td { border-bottom: 0; }
.tb th:first-child, .tb td:first-child { padding-left: 0; }
.tb th:last-child, .tb td:last-child { padding-right: 0; }
.tb-rank { width: 2.5em; font-family: var(--font-mono); font-size: 12px; color: var(--st-mute); }
.tb-name { font-weight: 600; color: var(--st-ink); overflow-wrap: anywhere; }
.tb-tag { font-size: 13px; color: var(--st-mute); white-space: nowrap; }
.tb-num { text-align: right; font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.tb-num { font-weight: 600; color: var(--st-ink); }
.tb-share { width: 1%; color: var(--st-mute) !important; font-weight: 500 !important; }
/* bar and number in fixed columns so every row's bar starts and ends at the same x */
.tb-share-cell { display: inline-grid; grid-template-columns: 96px 5.5ch; align-items: center; gap: 10px; }
.tb-share-bar { display: block; width: 96px; height: 6px; shape-rendering: crispEdges; }
.tb-share-pct { text-align: right; }
.tb-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 16px;
}
.tb-page-label { font-family: var(--font-mono); font-size: 12px; color: var(--st-mute); font-variant-numeric: tabular-nums; }
.tb-page-btn { border: 2px solid var(--st-edge); min-width: 36px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.tb-page-btn:disabled { opacity: 0.35; cursor: default; }

/* --- split bar (how people use Dexel) ------------------------------------------------------------ */
.sp-bar { display: block; width: 100%; height: 22px; border: 2px solid var(--st-edge); shape-rendering: crispEdges; }
.sp-seg.is-legacy { fill-opacity: 0.55; }
.sp-gold { fill: #FFCC33; background: #FFCC33; }
.sp-pink { fill: #FF6FB5; background: #FF6FB5; }
.sp-teal { fill: #38D9C0; background: #38D9C0; }
.sp-violet { fill: #A78BFA; background: #A78BFA; }
.sp-green { fill: #3FAE4F; background: #3FAE4F; }
.sp-grey { fill: var(--st-mute); background: var(--st-mute); }
.sp-legend { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sp-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto 4.5em; align-items: center; gap: 10px; font-size: 14px; }
.sp-swatch { width: 12px; height: 12px; border: 1px solid var(--st-edge); }
.sp-name { font-weight: 600; color: var(--st-ink); }
.sp-value, .sp-share { font-family: var(--font-mono); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.sp-value { font-weight: 600; color: var(--st-ink); }
.sp-share { color: var(--st-mute); }

/* --- uptime (status-page form) ------------------------------------------------------------------- */
.up-body { min-height: 0; }
.up-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(90, minmax(0, 1fr)); gap: 2px; height: 34px; }
.up-cell { background: var(--st-line); }
.up-cell.is-up, .up-sw.is-up { background: #3FAE4F; }
.up-cell.is-brief, .up-sw.is-brief { background: #FFCC33; }
.up-cell.is-outage, .up-sw.is-outage { background: var(--st-red); }
.up-cell.is-no_data, .up-sw.is-no_data { background: var(--st-line); }
.up-cell.is-today { outline: 2px dashed var(--st-ink); outline-offset: -2px; }
.up-cell:hover { filter: brightness(0.8); }
.up-axis { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--st-mute); }
.up-sub {
  margin: 22px 0 10px;
  font-family: var(--st-pixel);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--st-mute);
}
.up-outages { list-style: none; margin: 0; padding: 0; }
.up-outage { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--st-line); font-size: 14px; }
.up-outage:last-child { border-bottom: 0; }
.up-when { color: var(--st-ink); font-weight: 600; }
.up-len { font-family: var(--font-mono); font-size: 13px; color: var(--st-mute); white-space: nowrap; }
.up-none { margin: 0; font-size: 14px; color: var(--st-mute); }
.up-more { margin-top: 10px; border: 2px solid var(--st-edge); padding: 6px 12px; }

/* --- empty state ----------------------------------------------------------------------------------- */
.graph-empty-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--st-card);
  border-radius: 0 0 4px 4px;
}
.graph-empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  background: var(--st-bg);
  border: 2px solid var(--st-edge);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--acc);
  color: var(--acc-chart);
}
.graph-empty-icon svg { shape-rendering: crispEdges; }
.graph-empty-title {
  margin-bottom: 10px;
  font-family: var(--st-pixel);
  font-size: 11px;
  line-height: 1.6;
  color: var(--st-ink);
}
.graph-empty-desc { max-width: 44ch; margin: 0; font-size: 14px; line-height: 1.55; color: var(--st-mute); }
.graph-empty-state.is-error .graph-empty-icon { box-shadow: 3px 3px 0 var(--st-red); color: var(--st-red-text); }

/* --- reveal: a stepped wipe the first time a card scrolls in (only when JS runs) -------------------- */
.st-js .st-reveal { clip-path: inset(0 0 100% 0); }
.st-js .st-reveal.is-in { clip-path: none; animation: st-wipe 420ms steps(6, end); }
@keyframes st-wipe {
  from { clip-path: inset(0 -12px 100% -12px); }
  to { clip-path: inset(0 -12px -12px -12px); }
}

/* --- smaller screens ------------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .stats-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 840px) {
  .st-body .stats-page-container { padding-top: 40px; padding-bottom: 72px; }
  .stats-graphs-section { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .graph-card-span-2 { grid-column: span 1; }
  .graph-card-header { padding: 18px; }
  .graph-svg-container { height: 230px; }
  .graph-control-btn { min-height: 40px; min-width: 40px; }
  .graph-legend { padding: 12px 18px 14px; }
  .graph-breakdown { padding: 16px 18px 18px; }
  .tb-pager { padding: 0 18px 14px; }
  .up-strip { grid-template-columns: repeat(45, minmax(0, 1fr)); height: auto; row-gap: 4px; }
  .up-cell { height: 18px; }
}

@media (max-width: 600px) {
  .st-body .stats-page-container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .stats-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .stats-kpi-card { padding: 14px; min-height: 104px; box-shadow: 4px 4px 0 var(--acc); }
  .stats-kpi-value { font-size: 18px; }
  .stats-lead { font-size: 16px; }
  .graph-card { box-shadow: 4px 4px 0 var(--acc); }
  .stats-kpi-card:hover { transform: none; box-shadow: 4px 4px 0 var(--acc); }
  .graph-current-num { font-size: 18px; }
  .graph-svg-container { height: 200px; }
  .graph-title { font-size: 12px; }
  .graph-btn-group { width: 100%; justify-content: space-between; }
  .graph-control-btn { flex: 1 1 0; min-width: 0; }
  .graph-controls-toolbar { width: 100%; }
  .lg-utc { margin-left: 0; }
  .stats-group + .stats-group { margin-top: 44px; }
  .tb-share { width: auto; }
  .tb-share-bar { display: none; }
  .tb-share-cell { grid-template-columns: 5.5ch; gap: 0; }
  .tb-tag { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .stats-kpi-card, .graph-control-btn, .chart-bar { transition: none; }
  .stats-kpi-card:hover { transform: none; }
  .st-js .st-reveal, .st-js .st-reveal.is-in { clip-path: none; animation: none; }
}
