:root {
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --border: #d8dee4;
  --text: #1f2328;
  --text-muted: #59636e;
  --ok: #1a7f37;
  --degraded: #9a6700;
  --down: #cf222e;
  --unknown: #59636e;
  --accent: #0969da;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-subtle: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #9198a1;
    --ok: #3fb950;
    --degraded: #d29922;
    --down: #f85149;
    --unknown: #9198a1;
    --accent: #4493f8;
  }
}

* { box-sizing: border-box; }

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

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  margin-bottom: 28px;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.brand-suffix {
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── Overall banner ──────────────────────────────────────────────────────── */

.banner {
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 10px;
}

.banner h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
}

.banner-detail {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.banner--ok       { border-left-color: var(--ok);       background: color-mix(in srgb, var(--ok) 7%, var(--bg)); }
.banner--degraded { border-left-color: var(--degraded); background: color-mix(in srgb, var(--degraded) 9%, var(--bg)); }
.banner--down     { border-left-color: var(--down);     background: color-mix(in srgb, var(--down) 9%, var(--bg)); }
.banner--unknown  { border-left-color: var(--unknown);  background: var(--bg-subtle); }

.freshness {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 32px;
}

/* ─── Sections ────────────────────────────────────────────────────────────── */

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
}

.components { margin-bottom: 36px; }

/* ─── Component rows ──────────────────────────────────────────────────────── */

.component-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.component {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.component:last-child { border-bottom: 0; }

.component--loading,
.component--empty {
  color: var(--text-muted);
  justify-content: center;
}

.component-name {
  flex: 0 0 130px;
  font-weight: 500;
}

.component-status {
  flex: 0 0 130px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.dot--ok       { background: var(--ok); }
.dot--degraded { background: var(--degraded); }
.dot--down     { background: var(--down); }
.dot--unknown  { background: var(--unknown); }

.status-text--ok       { color: var(--ok); }
.status-text--degraded { color: var(--degraded); }
.status-text--down     { color: var(--down); }
.status-text--unknown  { color: var(--text-muted); }

/* ─── Uptime bars ─────────────────────────────────────────────────────────── */

.uptime {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 26px;
  min-width: 0;
}

.bar {
  flex: 1;
  min-width: 2px;
  border-radius: 2px;
  background: var(--ok);
  height: 100%;
  transition: opacity .12s;
}

.bar:hover { opacity: .65; }

/* Partial uptime still shows a full-height bar, tinted by severity, matching how
   GitHub renders a day that was not fully healthy. */
.bar--warn  { background: var(--degraded); }
.bar--bad   { background: var(--down); }
.bar--none  { background: var(--border); height: 40%; }

.uptime-pct {
  flex: 0 0 62px;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ─── Incidents ───────────────────────────────────────────────────────────── */

.incidents { margin-bottom: 40px; }

.incident-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.incident {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-color: var(--degraded);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
}

.incident--resolved { border-left-color: var(--ok); }

.incident-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 500;
}

.incident-time {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.incident-body {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0 40px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 6px;
}

@media (max-width: 640px) {
  .component { flex-wrap: wrap; gap: 8px; }
  .component-name { flex: 1 0 100%; }
  .component-status { flex: 0 0 auto; }
  .uptime { order: 3; flex: 1 0 100%; }
  .uptime-pct { order: 4; flex: 0 0 auto; }
}
