:root {
  color-scheme: light dark;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --link: #0284c7;
  --link-hover: #0369a1;
  --ok-square: #16a34a;
  --ok-ring: rgba(22, 163, 74, 0.22);
  --ok-bg: #dcfce7;
  --ok-fg: #166534;
  --err-square: #dc2626;
  --err-ring: rgba(220, 38, 38, 0.22);
  --err-bg: #fee2e2;
  --err-fg: #991b1b;
  --pending-square: #94a3b8;
  --pending-ring: rgba(148, 163, 184, 0.24);
  --warn-bg: #fef9c3;
  --warn-fg: #854d0e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --surface: #171e29;
    --surface-alt: #1e2736;
    --border: #2a3547;
    --text: #e8eef7;
    --muted: #93a3b8;
    --link: #38bdf8;
    --link-hover: #7dd3fc;
    --ok-square: #22c55e;
    --ok-ring: rgba(34, 197, 94, 0.25);
    --ok-bg: rgba(34, 197, 94, 0.16);
    --ok-fg: #86efac;
    --err-square: #ef4444;
    --err-ring: rgba(239, 68, 68, 0.25);
    --err-bg: rgba(239, 68, 68, 0.16);
    --err-fg: #fca5a5;
    --pending-square: #64748b;
    --pending-ring: rgba(100, 116, 139, 0.28);
    --warn-bg: rgba(234, 179, 8, 0.16);
    --warn-fg: #fde047;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-block-size: 100dvb;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  line-height: 1.45;
  padding: 2rem 1rem;
  display: grid;
  place-items: start center;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.card {
  inline-size: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  display: grid;
  gap: 1rem;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.summary-ok {
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.summary-warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.summary-err {
  background: var(--err-bg);
  color: var(--err-fg);
}

.service-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.service-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.status-square {
  display: inline-block;
  flex-shrink: 0;
  inline-size: 12px;
  block-size: 12px;
  border-radius: 2px;
}

.status-healthy {
  background: var(--ok-square);
  box-shadow: 0 0 0 3px var(--ok-ring);
}

.status-unhealthy {
  background: var(--err-square);
  box-shadow: 0 0 0 3px var(--err-ring);
}

.status-checking {
  background: var(--pending-square);
  box-shadow: 0 0 0 3px var(--pending-ring);
}

.service-link {
  color: var(--link);
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.service-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.service-link:focus-visible,
.refresh-link:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 4px;
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.refresh-link {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.refresh-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

@media (forced-colors: active) {
  .status-square {
    border: 2px solid CanvasText;
  }
  .status-healthy {
    background: Highlight;
  }
  .status-unhealthy {
    background: CanvasText;
  }
  .summary-pill {
    border-color: CanvasText;
  }
}
