:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-elev: #131a30;
  --bg-elev-2: #1a2240;
  --fg: #e9eefc;
  --fg-muted: #9aa6c7;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --accent: #6ea8ff;

  --up: #3ec477;
  --up-dim: rgba(62, 196, 119, 0.18);
  --partial: #f0b537;
  --partial-dim: rgba(240, 181, 55, 0.18);
  --down: #e15765;
  --down-dim: rgba(225, 87, 101, 0.18);
  --empty: rgba(255, 255, 255, 0.07);
  --empty-fg: rgba(255, 255, 255, 0.25);

  /* Manually-disabled service — neutral grey, not an alarm. */
  --disabled: #6b7593;
  --disabled-dim: rgba(107, 117, 147, 0.18);

  --radius: 14px;
  --gap: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

/* Header --------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.eyebrow {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}

.meta { text-align: right; }
.home-link {
  display: inline-block;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px dashed transparent;
  transition: color .15s, border-color .15s;
}
.home-link:hover { color: var(--fg); border-bottom-color: var(--border-strong); }
.updated {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--fg-muted);
}

/* Overall dot (large) -------------------------------------------------- */
.brand .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--empty-fg);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.04);
  transition: background .2s, box-shadow .2s;
}
.brand[data-state="up"]      .dot { background: var(--up);      box-shadow: 0 0 0 4px var(--up-dim); }
.brand[data-state="partial"] .dot { background: var(--partial); box-shadow: 0 0 0 4px var(--partial-dim); }
.brand[data-state="down"]    .dot { background: var(--down);    box-shadow: 0 0 0 4px var(--down-dim); }

/* Legend --------------------------------------------------------------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  margin-bottom: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--fg-muted);
}
.legend-title { font-weight: 600; color: var(--fg); margin-right: auto; letter-spacing: 0.01em; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-swatch {
  width: 12px; height: 12px; border-radius: 3px; display: inline-block;
}
.legend-swatch.up       { background: var(--up); }
.legend-swatch.partial  { background: var(--partial); }
.legend-swatch.down     { background: var(--down); }
.legend-swatch.disabled { background: var(--disabled); }
.legend-swatch.empty    { background: var(--empty); border: 1px solid var(--border-strong); }

/* Services list -------------------------------------------------------- */
.services {
  display: grid;
  gap: var(--gap);
}

.service {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 18px;
  transition: border-color .2s;
}
.service:hover { border-color: var(--border-strong); }

.service-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.service-id { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.service-id .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--empty-fg);
  margin-top: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.03);
  transition: background .2s, box-shadow .2s;
}
.service[data-state="up"]       .service-id .dot { background: var(--up);       box-shadow: 0 0 0 3px var(--up-dim); }
.service[data-state="partial"]  .service-id .dot { background: var(--partial);  box-shadow: 0 0 0 3px var(--partial-dim); }
.service[data-state="down"]     .service-id .dot { background: var(--down);     box-shadow: 0 0 0 3px var(--down-dim); }
.service[data-state="disabled"] .service-id .dot { background: var(--disabled); box-shadow: 0 0 0 3px var(--disabled-dim); }

.service[data-state="disabled"] { opacity: 0.72; }
.service[data-state="disabled"] .service-label { color: var(--fg-muted); }

.service-label {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.service-address {
  margin: 2px 0 0;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.service-stats {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.service-current {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--empty);
  color: var(--fg-muted);
}
.service[data-state="up"]       .service-current { background: var(--up-dim);       color: var(--up); }
.service[data-state="partial"]  .service-current { background: var(--partial-dim);  color: var(--partial); }
.service[data-state="down"]     .service-current { background: var(--down-dim);     color: var(--down); }
.service[data-state="disabled"] .service-current { background: var(--disabled-dim); color: var(--disabled); }
.service-uptime { font-size: 12px; font-variant-numeric: tabular-nums; }

/* Bars ---------------------------------------------------------------- */
.bars {
  display: grid;
  grid-template-columns: repeat(var(--bucket-count, 96), 1fr);
  gap: 2px;
  height: 38px;
}
.bar {
  background: var(--empty);
  border-radius: 2px;
  transition: transform .12s, background .12s;
  cursor: default;
}
.bar[data-state="up"]       { background: var(--up); }
.bar[data-state="partial"]  { background: var(--partial); }
.bar[data-state="down"]     { background: var(--down); }
.bar[data-state="disabled"] { background: var(--disabled); opacity: 0.55; }
.bar:hover { transform: scaleY(1.08); }

.axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* Footer -------------------------------------------------------------- */
.footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.muted { color: var(--fg-muted); margin: 0; font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  color: var(--fg);
  transition: background .15s, border-color .15s;
}
.btn:hover { background: rgba(110, 168, 255, 0.12); border-color: var(--accent); }
.btn.ghost { background: transparent; }

/* Loading / error states --------------------------------------------- */
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--fg-muted);
  background: var(--bg-elev);
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}

/* Responsive ---------------------------------------------------------- */
@media (max-width: 620px) {
  .page { padding: 28px 16px 48px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 14px; }
  .meta { text-align: left; }
  .service { padding: 16px 16px 14px; }
  .service-head { flex-direction: column; align-items: flex-start; }
  .service-stats { align-items: flex-start; text-align: left; }
  .bars { height: 32px; gap: 1.5px; }
  .axis { font-size: 10px; }
  .footer { flex-direction: column; align-items: stretch; }
  .footer .btn { justify-content: center; }
}
