:root {
  --ink: #292e2b;
  --secondary: #737873;
  --tertiary: #9ea39c;
  --line: #e6e8e3;
  --canvas: #fbfbf9;
  --surface: #ffffff;
  --success: #407a5c;
  --warning: #ad7026;
  --danger: #c24a40;
  --codex: #306354;
  --claude: #b85e42;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--canvas); color: var(--ink); }

body {
  font: 15px/1.4 -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(160deg, #3a403c, #1f2321);
  color: #fff; display: grid; place-items: center; font-size: 18px; font-weight: 600;
}

h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: -0.2px; }
h2 { font-size: 16px; margin: 0 0 8px; }

.status { margin: 2px 0 0; font-size: 12px; color: var(--secondary); }

.icon-button {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 18px; cursor: pointer;
}
.icon-button:active { opacity: 0.6; }
.icon-button.spinning { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main { flex: 1; padding: 6px 14px 14px; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 12px; font-size: 14px;
}
.panel.warning { border-color: #e9d7bd; color: var(--warning); background: #fffaf2; }
.muted { color: var(--secondary); font-size: 13px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
}
.card.active { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

.identity { display: flex; align-items: center; gap: 10px; }
.provider-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  display: grid; place-items: center;
}
.logo { width: 18px; height: 18px; }
.card[data-provider="codex"] { --accent: var(--codex); }
.card[data-provider="claude"] { --accent: var(--claude); }
/* Tint the single-colour marks with the provider accent. */
.card[data-provider="codex"] .logo { filter: brightness(0) saturate(100%) invert(30%) sepia(24%) saturate(700%) hue-rotate(115deg) brightness(90%); }
.card[data-provider="claude"] .logo { filter: brightness(0) saturate(100%) invert(45%) sepia(45%) saturate(700%) hue-rotate(335deg) brightness(90%); }

.who { min-width: 0; flex: 1; }
.name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { color: var(--secondary); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.active-pill {
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
  border-radius: 999px; padding: 3px 8px; flex: none;
}

.meters { display: grid; gap: 12px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; }
.caption { font-size: 10px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--tertiary); font-weight: 500; }
.percent { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.percent small { font-size: 10px; color: var(--tertiary); font-weight: 400; margin-left: 3px; }
.bar { height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--line) 65%, transparent); margin: 6px 0 5px; overflow: hidden; }
.fill { height: 100%; border-radius: 999px; background: var(--accent); width: 0; transition: width 0.4s ease; }
.fill.low { background: var(--warning); }
.fill.empty { background: var(--danger); }
.reset { font-size: 12px; color: var(--secondary); font-variant-numeric: tabular-nums; }
.reset.passed { color: var(--warning); }
.meter.stale { opacity: 0.65; }

.card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--tertiary); }
.plan {
  font-size: 10px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--secondary); background: #f3f4f1; padding: 3px 6px; border-radius: 5px;
}
.issue { margin: 0; font-size: 12px; color: var(--warning); }

.foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 18px 18px; font-size: 12px; color: var(--tertiary);
}
.link { background: none; border: none; color: var(--secondary); font-size: 12px; text-decoration: underline; cursor: pointer; padding: 0; }

.hidden { display: none !important; }
