:root {
  --incident: #d68a00;
  --maintenance: #2f6fdb;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6573;
  --border: #e2e5ea;
  --good: #1f9d55;
  --warn: #d68a00;
  --bad: #d23f3f;
  --none: #d5d9e0;
  --banner-unknown: #5d6573;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --text: #e8eaee;
    --muted: #9aa3b2;
    --border: #2a2f38;
    --good: #2fb36a;
    --warn: #e09b1a;
    --bad: #e05656;
    --none: #343a45;
    --banner-unknown: #4b5260;
    --maintenance: #5b8ff0;
  }
}

* { box-sizing: border-box; }

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

.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand-sub { font-weight: 400; color: var(--muted); }

select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px;
}

.banner {
  margin: 28px 0 20px; padding: 16px 20px; border-radius: 8px;
  color: #fff; font-weight: 600; font-size: 17px;
}
.banner-operational { background: var(--good); }
.banner-degraded { background: var(--warn); }
.banner-outage { background: var(--bad); }
.banner-unknown, .banner-loading { background: var(--banner-unknown); }

.notices:not(:empty) { margin-top: 28px; display: grid; gap: 12px; }
.notices:not(:empty) + .banner { margin-top: 12px; }
.notice {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--incident);
  border-radius: 8px; padding: 14px 18px;
}
.notice-maintenance { border-left-color: var(--maintenance); }
.notice-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.notice-title { font-weight: 600; font-size: 16px; }
.notice-status { font-size: 14px; font-weight: 600; white-space: nowrap; }
.status-incident { color: var(--incident); }
.status-maintenance { color: var(--maintenance); }
.status-closed { color: var(--muted); }
.notice-meta { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.notice-update { font-size: 14px; margin-top: 8px; overflow-wrap: anywhere; white-space: pre-wrap; }
.notice-update-status { font-weight: 600; }
.notice-update-at { font-size: 12px; color: var(--muted); }

.history { margin-top: 20px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-item { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: 0; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 15px; }

.window { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.window button {
  font: inherit; font-size: 13px; color: var(--muted); background: transparent;
  border: 0; padding: 4px 10px; cursor: pointer;
}
.window button + button { border-left: 1px solid var(--border); }
.window button[aria-pressed="true"] { color: var(--text); background: var(--bg); font-weight: 600; }

.components { list-style: none; margin: 0; padding: 0; }
.component { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.component.empty { color: var(--muted); }
.component-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.component-name { font-weight: 600; }
.component-status { font-size: 14px; }
.status-operational { color: var(--good); }
.status-degraded { color: var(--warn); }
.status-outage { color: var(--bad); }
.status-unknown { color: var(--muted); }
.component-uptime { margin-top: 6px; font-size: 13px; color: var(--muted); text-align: right; }

.bars { display: grid; grid-template-columns: repeat(var(--n, 30), 1fr); gap: 3px; height: 32px; }
.bar { border-radius: 2px; min-width: 2px; }
.bar-good { background: var(--good); }
.bar-warn { background: var(--warn); }
.bar-bad { background: var(--bad); }
.bar-none { background: var(--none); }

.legend {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; font-size: 12px; color: var(--muted);
}
.legend-keys { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.legend-keys i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; }

.updated { margin: 16px 0 40px; font-size: 13px; color: var(--muted); text-align: center; }

@media (max-width: 520px) {
  .bars { gap: 2px; height: 28px; }
  .legend-keys { display: none; }
}
