*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.15; letter-spacing: -0.025em; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
a { color: var(--action); }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-s); }

.shell { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-5) var(--space-7); }

.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-5) 0 var(--space-4); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: var(--space-2); font-weight: 600; letter-spacing: -0.01em; }
.brand .mark { color: var(--action); font-size: 13px; transform: translateY(-1px); }
.brand .domain { color: var(--text-muted); font-weight: 400; }
.theme {
  border: 1px solid var(--line); background: transparent; color: var(--text-muted);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.theme:hover { color: var(--text); border-color: var(--text-muted); }

.signal { position: relative; padding: var(--space-7) 0 var(--space-6); border-bottom: 1px solid var(--line); }
.signal::before {
  content: ""; position: fixed; inset: 0 0 auto; height: 4px; background: var(--signal, var(--line));
  transition: background-color .25s ease;
}
.signal[data-state="ok"] { --signal: var(--ok); }
.signal[data-state="problems"] { --signal: var(--warn); }
.signal[data-state="down"] { --signal: var(--bad); }
.signal[data-state="maintenance"] { --signal: var(--action); }
.signal[data-state="unknown"] { --signal: var(--line); }
.eyebrow { color: var(--text-muted); font-size: 13px; margin-bottom: var(--space-2); }
.signal h1 { max-width: 18ch; }
.signal .updated { margin-top: var(--space-3); color: var(--text-muted); font-size: 13px; font-family: var(--font-mono); }
.signal .updated .stale { color: var(--bad); }

.section { padding-top: var(--space-6); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.section-head .note { color: var(--text-muted); font-size: 13px; }

.components { border-top: 1px solid var(--line); }
.component {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-3);
  padding: var(--space-4) 0; border-bottom: 1px solid var(--line);
}
.component .name { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.component .name b { font-weight: 550; }
.component .latency { color: var(--text-muted); font-size: 13px; font-family: var(--font-mono); white-space: nowrap; }
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--state-color, var(--text-muted)); }
.component[data-state="ok"] { --state-color: var(--ok); }
.component[data-state="problems"] { --state-color: var(--warn); }
.component[data-state="down"] { --state-color: var(--bad); }
.component[data-state="maintenance"] { --state-color: var(--action); }
.component[data-state="unknown"] { --state-color: var(--line); }

.history { display: grid; gap: var(--space-3); }
.history-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: var(--space-3); }
.history-label { display: flex; justify-content: space-between; gap: var(--space-2); font-size: 13px; color: var(--text-muted); }
.history-label b { color: var(--text); font-weight: 550; }
.bars { display: flex; gap: 2px; height: 26px; align-items: stretch; }
.bar { flex: 1 1 0; min-width: 2px; border-radius: 1px; background: var(--line); }
.bar[data-state="ok"] { background: var(--ok); }
.bar[data-state="problems"] { background: var(--warn); }
.bar[data-state="down"] { background: var(--bad); }
.bar[data-state="maintenance"] { background: var(--action); opacity: .55; }
.bar.empty { background: var(--line); opacity: .45; }

.incidents { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.incidents li { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.incidents .when { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }
.incidents .open { color: var(--bad); }
.empty-note { color: var(--text-muted); padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }

.foot { margin-top: var(--space-6); color: var(--text-muted); font-size: 12px; }
.error-banner { margin-top: var(--space-4); padding: var(--space-3); border-left: 3px solid var(--bad); background: var(--bad-soft); font-size: 14px; display: none; }
.error-banner.show { display: block; }

@media (max-width: 640px) {
  .shell { padding-inline: var(--space-4); }
  .signal { padding-top: var(--space-6); }
  .component { grid-template-columns: minmax(0, 1fr) auto; }
  .component .latency { display: none; }
  .history-row { grid-template-columns: 1fr; gap: var(--space-1); }
  .incidents li { grid-template-columns: 1fr auto; }
  .incidents .when { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
