:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.1);
  --seq-100: #cde2fb;
  --seq-450: #2a78d6;
  --seq-650: #104281;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.1);
    --seq-100: #184f95;
    --seq-450: #3987e5;
    --seq-650: #86b6ef;
    --good: #0ca30c;
    --warning: #fab219;
    --critical: #e66767;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

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

header h1 {
  font-size: 1.25rem;
  margin: 0;
}

header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.85rem;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 6px 14px;
  border-radius: 999px;
}

.badge.critical {
  color: var(--critical);
  background: color-mix(in srgb, var(--critical) 14%, transparent);
}

.badge.good {
  color: var(--good);
  background: color-mix(in srgb, var(--good) 14%, transparent);
}

.freshness {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 10px;
}

.meter {
  position: relative;
  height: 14px;
  border-radius: 7px;
  background: var(--seq-100);
  margin: 18px 0 8px;
  overflow: visible;
}

.meter-fill {
  position: absolute;
  inset: 0;
  width: var(--pct, 0%);
  background: var(--seq-450);
  border-radius: 7px;
}

.meter-threshold {
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: var(--threshold-pct, 71%);
  width: 2px;
  background: var(--text-primary);
}

.meter-threshold::after {
  content: "decision threshold";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hero-value {
  font-size: 2.4rem;
  font-weight: 700;
  font-variant-numeric: proportional-nums;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.stat-tile .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-tile .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-icon.good { color: var(--good); }
.status-icon.critical { color: var(--critical); }
.status-icon.warning { color: var(--warning); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  font-size: 0.8rem;
}

.feature-grid div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--gridline);
  padding: 4px 0;
}

.feature-grid .fname {
  color: var(--text-muted);
}

button.refresh {
  font: inherit;
  background: var(--seq-450);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
}

button.refresh:hover {
  background: var(--seq-650);
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

h2 {
  font-size: 1rem;
  margin-top: 0;
}
