:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --border: #e3e3de;
  --text: #1b1b19;
  --muted: #696964;
  --track: #ebebe6;
  --ok: #23885c;
  --warn: #b97700;
  --crit: #cf3b3b;
  --claude: #d97757;
  --codex: #10a37f;
  --pixellab: #8b5cf6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #1a1a1e;
    --border: #2b2b31;
    --text: #ececf0;
    --muted: #9b9ba4;
    --track: #2b2b32;
    --ok: #3fbf86;
    --warn: #e5a83b;
    --crit: #f06763;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

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

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 20px;
}

h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

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

#status {
  margin: 0;
  font-size: 13px;
}

#status.offline { color: var(--crit); }

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1240px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head h2 {
  margin: 0;
  font-size: 16px;
}

.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.claude .dot,
.claude-api .dot { background: var(--claude); }
.codex .dot { background: var(--codex); }
.pixellab .dot { background: var(--pixellab); }

.plan {
  min-width: 0;
  margin-left: auto;
  padding: 2px 8px;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.meters {
  display: grid;
  gap: 16px;
}

.card.stale .meters { opacity: 0.55; }

.meter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.label { font-size: 14px; }

.pct {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 8px;
  margin: 6px 0 5px;
  overflow: hidden;
  background: var(--track);
  border-radius: 999px;
}

.fill {
  height: 100%;
  background: var(--ok);
  border-radius: inherit;
  transition: width 0.4s ease;
}

.sev-warn .fill { background: var(--warn); }
.sev-crit .fill { background: var(--crit); }
.sev-crit .pct { color: var(--crit); }
.meter.reset .fill { opacity: 0.3; }

.sub {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.notes {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 12px 0 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.foot {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
}

.error {
  font-size: 12.5px;
  color: var(--warn);
}

footer {
  margin-top: 24px;
  font-size: 12px;
}

.meter-top + .sub { margin-top: 4px; }
