:root {
  --bg: #0b0f14;
  --bar: #0e141b;
  --card: #121821;
  --line: #1f2a37;
  --text: #e6edf3;
  --muted: #8b98a5;
  --faint: #5b6773;
  --green: #22c55e;
  --green-ink: #04210f;
  --red: #ef4444;
  --amber: #eab308;
  --blue: #60a5fa;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--green); }

.dev-banner {
  background: #ef4444;
  color: #fff;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  font-size: 13px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 61px;
  padding: 12px 32px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}

.brand, .nav, .top-actions {
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand { gap: 10px; font-weight: 700; font-size: 16px; }
.brand a { display: flex; align-items: center; gap: 10px; }
.nav a { color: var(--muted); font-size: 13.5px; }
.nav a.active { color: var(--green); font-weight: 600; }

.top-actions { gap: 12px; }

.page { padding: 32px; display: flex; flex-direction: column; gap: 20px; }
.page-head, .section-head, .card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.page-head h1, .sign-title { margin: 0; font-size: 24px; font-weight: 700; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.card h2, .card h3 { margin: 0; font-size: 15px; font-weight: 600; }

.stats, .metrics {
  display: grid;
  gap: 16px;
}
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.metrics.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card, .stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.stat { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.stat span, .metric span, .label { color: var(--muted); font-size: 12px; }
.stat strong, .metric strong { font-size: 22px; font-weight: 600; }
.stat em, .metric em { font-style: normal; color: var(--muted); font-size: 11px; }
.card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.metric { display: flex; flex-direction: column; gap: 6px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12.5px;
  text-align: right;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: 0; }
.name { font-weight: 600; }
.up { color: var(--green); }
.down { color: var(--red); }
.good { color: var(--green); font-weight: 600; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-amber { background: rgba(234, 179, 8, 0.15); color: var(--amber); }
.pill-green { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.pill-red { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.pill-blue { background: rgba(96, 165, 250, 0.15); color: var(--blue); }
.pill-muted { background: var(--line); color: var(--muted); }

.chart-card { min-height: 360px; }
.chart-frame { position: relative; height: 320px; }
.chart-frame.short { height: 220px; }
.chart-frame.tiny { height: 110px; }
.legend-note { color: var(--muted); font-size: 12px; }

.split { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.daily-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.heat-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.heat-track { height: 8px; background: #1b2633; border-radius: 999px; overflow: hidden; }
.heat-fill { height: 100%; background: var(--green); border-radius: 999px; }
.heat-fill.warn { background: var(--red); }
.heat-note { color: var(--amber); font-size: 12.5px; margin: 8px 0 0; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.pager a, button, .button {
  background: var(--green);
  color: var(--green-ink);
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.pager a.quiet, a.quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.date-form { display: flex; align-items: end; gap: 8px; }
.date-form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
input[type="date"], .fake-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 40px;
  padding: 0 12px;
}
.ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}
.or-row { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or-row span { flex: 1; height: 1px; background: var(--line); }

.sign-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 32px 16px;
}
.sign-brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; }
.sign-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sign-card h1 { margin: 0; font-size: 20px; }
.sign-card .button, .sign-card button { width: 100%; height: 40px; }
.sign-foot { text-align: center; color: var(--muted); font-size: 11px; }
.sign-pills { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.variant-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.variant-grid a { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.empty { color: var(--muted); }

@media (max-width: 1100px) {
  .stats, .metrics, .variant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .daily-grid { grid-template-columns: 1fr; }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .nav { gap: 14px; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .stats, .metrics, .metrics.compact, .variant-grid { grid-template-columns: 1fr; }
  .heat-row { grid-template-columns: 1fr; }
}
