:root {
  color-scheme: light;
  --page: #f5f5f3;
  --surface: #fcfcfb;
  --text: #0b0b0b;
  --text-secondary: #52514e;
  --border: #e2e1dc;
  --grid: #ecebe7;
  --series: #2a78d6;
  --on-series: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #111110;
    --surface: #1a1a19;
    --text: #f0efec;
    --text-secondary: #c3c2b7;
    --border: #353431;
    --grid: #2a2a28;
    --series: #3987e5;
    --on-series: #ffffff;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--series);
  outline-offset: 2px;
}

.primary {
  border-color: var(--series);
  background: var(--series);
  color: var(--on-series);
  font-weight: 600;
  padding: 0 28px;
}

.quiet {
  background: transparent;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  max-width: 1120px;
  margin: 0 auto;
}

.env {
  margin-left: 4px;
  font-weight: 400;
  color: var(--text-secondary);
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 20vh;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.range {
  display: flex;
  gap: 4px;
}

.range button[aria-pressed="true"] {
  border-color: var(--text);
  font-weight: 600;
}

.muted {
  color: var(--text-secondary);
}

.small {
  margin: 10px 0 16px;
  font-size: 13px;
}

.note {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

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

.tile,
.chart {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px 16px;
  min-width: 0;
}

.tile-value {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.tile-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 12px;
}

.chart-note {
  margin: -4px 0 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.plot {
  width: 100%;
}

.plot svg {
  display: block;
  width: 100%;
}

.plot text {
  fill: var(--text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.plot .grid {
  stroke: var(--grid);
  stroke-width: 1;
}

.plot .baseline {
  stroke: var(--border);
  stroke-width: 1;
}

.plot .mark {
  fill: var(--series);
}

.plot .hit {
  fill: transparent;
}

.plot .hit:hover + .mark,
.plot .hit:focus + .mark {
  opacity: 0.75;
}

.split {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px 10px;
  font-size: 13px;
}

.split-track {
  height: 14px;
  min-width: 0;
}

.split-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--series);
}

.split-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-view {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 12px 16px;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 12px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

th,
td {
  padding: 5px 10px;
  text-align: right;
  border-bottom: 1px solid var(--grid);
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  font-weight: 600;
  color: var(--text-secondary);
}

tfoot td {
  font-weight: 600;
  border-bottom: 0;
}

.tooltip {
  position: fixed;
  z-index: 10;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
}
