:root {
  color-scheme: light;
  --surface-0: #f6f6f4;
  --surface-1: #ffffff;
  --text-primary: #191919;
  --text-secondary: #666666;
  --grid: #e6e6e6;
  --series-1: #257de0;
  --series-2: #f47230;
  --track: #eef3fb;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111111;
    --surface-1: #191919;
    --text-primary: #efefef;
    --text-secondary: #9c9c9c;
    --grid: #2c2c2c;
    --series-1: #338ced;
    --series-2: #e76624;
    --track: #1f2733;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #111111;
  --surface-1: #191919;
  --text-primary: #efefef;
  --text-secondary: #9c9c9c;
  --grid: #2c2c2c;
  --series-1: #338ced;
  --series-2: #e76624;
  --track: #1f2733;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font:
    15px/1.45 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  max-width: 1100px;
  margin: 0 auto;
}
h1 {
  font-size: 20px;
  margin: 0;
}
h2 {
  font-size: 15px;
  margin: 0 0 8px;
}
.range {
  display: flex;
  gap: 4px;
}
.range button {
  border: 1px solid var(--grid);
  background: var(--surface-1);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}
.range button[aria-pressed="true"] {
  border-color: var(--series-1);
  color: var(--series-1);
  font-weight: 600;
}
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 32px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}
.card {
  background: var(--surface-1);
  border-radius: 12px;
  padding: 14px;
  min-width: 0;
}
.card.wide {
  grid-column: 1 / -1;
}
.note,
.status {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 4px 0 0;
}
.status {
  grid-column: 1 / -1;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.tile .value {
  font-size: 28px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.tile .label {
  color: var(--text-secondary);
  font-size: 13px;
}
svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
svg text {
  fill: var(--text-secondary);
  font-size: 11px;
}
.legend {
  display: flex;
  gap: 14px;
  font-size: 13px;
  margin: 0 0 6px;
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  background: var(--swatch);
  vertical-align: -1px;
}
.bars {
  display: grid;
  gap: 6px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 38%) 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.bar-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-row .track {
  display: block;
  height: 12px;
  background: var(--track);
  border-radius: 4px;
  overflow: hidden;
}
.bar-row .fill {
  display: block;
  height: 100%;
  background: var(--series-1);
  border-radius: 4px;
}
.bar-row .count {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
th,
td {
  text-align: right;
  padding: 4px 6px;
  border-bottom: 1px solid var(--grid);
}
th:first-child,
td:first-child {
  text-align: left;
}
th {
  color: var(--text-secondary);
  font-weight: 500;
}
details summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 8px;
}
.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--text-primary);
  color: var(--surface-1);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: pre;
  z-index: 10;
}
