:root {
  color-scheme: dark;
}

body {
  background: #111418;
  color: #e6e6e6;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 2rem;
}

h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #c7ccd4;
  margin-top: 2.25rem;
  margin-bottom: 0.5rem;
}

.hint {
  color: #9aa4b2;
  font-size: 0.85rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  max-width: 1000px;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #2a2f36;
}

th {
  color: #9aa4b2;
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.live { color: #3ddc84; font-weight: 600; }
.offline { color: #8a8f98; }
.revoked { color: #e05252; font-weight: 600; }
.warning { color: #f2b84b; }
/* "blocked" (rate-limited IP, etc.) is distinct from "rejected" (bad/
   unknown/revoked key) - both used to render identically in red, which
   made it impossible to tell "someone's guessing keys" apart from
   "someone typo'd their key" at a glance. */
.blocked { color: #f2b84b; font-weight: 600; }

.slug-tag {
  color: #7fd0ff;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.85em;
}

.subtle { color: #8a8f98; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid #2a2f36;
  background: #1a1e24;
  color: #e6e6e6;
  cursor: pointer;
}
.btn:hover { border-color: #3a4048; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.danger { border-color: #472121; background: #261212; color: #f2a0a0; }
.btn.danger:hover { border-color: #6b2f2f; }

.stream-card {
  border: 1px solid #2a2f36;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  max-width: 640px;
}
.stream-card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.stream-card .row { display: flex; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px solid #1e2229; font-size: 0.9rem; }
.stream-card .row:last-child { border-bottom: none; }
.stream-card code { color: #7fd0ff; word-break: break-all; }

.banner {
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  margin: 1rem 0;
}
.banner.success { background: #10261a; border: 1px solid #21472f; color: #6fe3a4; }
.banner.error { background: #261212; border: 1px solid #472121; color: #f2a0a0; }
.banner.info { background: #12202a; border: 1px solid #1e3a4a; color: #7fd0ff; }
.status-banner-head {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 0.2rem;
}
.status-banner-note { margin-top: 0.4rem; opacity: 0.9; }

/* Top navigation, shared across every page behind a login. */
.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #2a2f36;
}
.nav .brand { font-weight: 600; color: #e6e6e6; margin-right: auto; }
.nav a { color: #9aa4b2; text-decoration: none; font-size: 0.9rem; }
.nav a:hover { color: #e6e6e6; }
.nav a.current { color: #7fd0ff; }
.nav .user { color: #8a8f98; font-size: 0.85rem; }

/* Issues panel - a short, prioritized summary computed server-side
   from real service/stream/event data, not a decorative widget. */
.issues-panel {
  margin-bottom: 2rem;
}
.issue-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.issue-row.critical { background: #261212; border: 1px solid #472121; color: #f2a0a0; }
.issue-row.warning { background: #2a1f10; border: 1px solid #4a3418; color: #f2b84b; }
.issue-row .sev {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  opacity: 0.85;
  flex-shrink: 0;
}
.issues-clear {
  color: #6fe3a4;
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  background: #10261a;
  border: 1px solid #21472f;
}

/* Card grids replacing the old bare-pill services strip and the
   streams table - more room for a live-preview toggle and sparklines
   per stream than a table row allows. */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.service-card {
  border: 1px solid #2a2f36;
  border-radius: 8px;
  padding: 0.9rem 1rem;
}
.service-card .name { font-weight: 600; font-size: 0.92rem; }
.service-card .state { font-size: 0.8rem; margin-top: 0.2rem; }

.streams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.stream-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.stream-card .slug-line { color: #7fd0ff; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.82rem; margin-bottom: 0.5rem; }
.stream-card .metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.88rem;
  border-bottom: 1px solid #1e2229;
}
.stream-card .metric-row:last-of-type { border-bottom: none; }
.stream-card .metric-row .label { color: #9aa4b2; }
.stream-card .sparkline { display: block; }
.stream-card .actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; }
.stream-card .preview {
  margin-top: 0.75rem;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}
.stream-card .preview video { width: 100%; display: block; }
.stream-card .preview-status { font-size: 0.8rem; color: #8a8f98; margin-top: 0.3rem; }

/* Admin-with-a-stream-of-their-own toggle between the two dashboard
   views on index.html - a small tab strip, distinct from the page nav
   above it so the two don't read as one wider bar. */
.view-switch {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.view-switch a {
  color: #9aa4b2;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  border: 1px solid #2a2f36;
}
.view-switch a:hover { color: #e6e6e6; }
.view-switch a.current { color: #7fd0ff; border-color: #184a5c; background: #10202a; }

/* Centered auth-style pages (login). */
.auth-page {
  max-width: 380px;
  margin: 4rem auto;
}
.auth-page h1 { text-align: center; margin-bottom: 1.5rem; }

.field-group { margin-bottom: 1rem; }
.field-group label {
  display: block;
  color: #9aa4b2;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.3rem;
}
.field-group input {
  width: 100%;
  box-sizing: border-box;
  background: #1a1e24;
  border: 1px solid #2a2f36;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  color: #e6e6e6;
  font-size: 0.95rem;
  font-family: inherit;
}
.field-group input:focus { outline: 1px solid #7fd0ff; border-color: #7fd0ff; }

.btn.full { width: 100%; }

.legal-page {
  max-width: 680px;
  line-height: 1.6;
}
.legal-page h2 { border-bottom: none; margin-top: 1.75rem; }

footer.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid #2a2f36;
  font-size: 0.8rem;
  color: #8a8f98;
}
footer.site-footer a { color: #8a8f98; }
footer.site-footer a:hover { color: #e6e6e6; }

.error {
  color: #e05252;
  margin-top: 1rem;
}

.services-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.service-pill {
  font-size: 0.8rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid #2a2f36;
}

.service-pill.up {
  color: #3ddc84;
  border-color: #21472f;
  background: #12261a;
}

.service-pill.down {
  color: #e05252;
  border-color: #472121;
  background: #261212;
}

.logs {
  max-width: 1000px;
}

.logs details {
  border: 1px solid #2a2f36;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.logs summary {
  cursor: pointer;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.9rem;
  color: #c7ccd4;
}

.log-pane {
  margin-top: 0.6rem;
  max-height: 320px;
  overflow-y: auto;
  background: #0b0d10;
  border: 1px solid #1e2229;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #b7c4d4;
}

/* EU edge / load-balancer panel */
.edge-panel {
  max-width: 1000px;
  border: 1px solid #1e2229;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.edge-panel .banner { margin-bottom: 0.85rem; }

.edge-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.edge-row label { color: #9aa4b2; font-size: 0.85rem; }

.edge-row input {
  flex: 1;
  min-width: 240px;
  background: #0e1116;
  border: 1px solid #262b33;
  color: #e6e6e6;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

.edge-row input:focus { outline: 1px solid #7fd0ff; border-color: #7fd0ff; }

.edge-health {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.edge-pill {
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #262b33;
  color: #8a8f98;
}

.edge-pill.up { color: #3ddc84; border-color: #21472f; }
.edge-pill.down { color: #e05252; border-color: #472121; }

.edge-actions { margin-bottom: 0.5rem; }

.edge-steps ol {
  margin: 0.3rem 0 0;
  padding-left: 1.2rem;
  color: #9aa4b2;
  font-size: 0.85rem;
}

.edge-steps li { margin: 0.25rem 0; }

.btn.small { padding: 0.3rem 0.7rem; font-size: 0.8rem; font-weight: 500; }

/* Incidents panel - triage view for diagnostics/incident_sync.py's feed.
   Same severity coloring as .issue-row (see above), plus per-row status
   controls the Issues panel doesn't have. */
.incidents-panel { max-width: 1000px; margin-bottom: 1.5rem; }

.incident-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.85rem; flex-wrap: wrap; }
.incident-tab {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #262b33;
  color: #9aa4b2;
  font-size: 0.85rem;
  text-decoration: none;
}
.incident-tab:hover { border-color: #3a4048; color: #e6e6e6; }
.incident-tab.active { border-color: #7fd0ff; color: #7fd0ff; }

.incident-empty {
  color: #6fe3a4;
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  background: #10261a;
  border: 1px solid #21472f;
}

.incident-row {
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.incident-row.critical { background: #261212; border: 1px solid #472121; }
.incident-row.warning { background: #2a1f10; border: 1px solid #4a3418; }

.incident-top { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.incident-top .sev {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  opacity: 0.85;
}
.incident-row.critical .sev { color: #f2a0a0; }
.incident-row.warning .sev { color: #f2b84b; }
.incident-src, .incident-cat {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: #0e1116;
  border: 1px solid #262b33;
  color: #8a8f98;
}
.incident-cat { color: #9aa4b2; }

.incident-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.2rem;
  margin: 0.6rem 0 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #9aa4b2;
  border-bottom: 1px solid #1e2229;
}
.incident-group-header:first-child { margin-top: 0; }
.incident-active { font-size: 0.75rem; margin-left: auto; }
.incident-active.live { color: #f2a0a0; }
.incident-active.resolved { color: #8a8f98; }

.incident-occ {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #1e2229;
  color: #7fd0ff;
}

.incident-msg { color: #e6e6e6; margin-bottom: 0.25rem; }
.incident-meta { color: #9aa4b2; font-size: 0.8rem; margin-bottom: 0.5rem; }
.incident-note {
  color: #6fe3a4;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  background: #10261a;
}
.incident-actions { display: flex; gap: 0.4rem; }

.incident-resolve-form { margin-top: 0.4rem; }
.incident-resolve-form textarea {
  width: 100%;
  background: #0e1116;
  border: 1px solid #262b33;
  color: #e6e6e6;
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
  margin: 0.35rem 0 0.5rem;
}
.incident-resolve-form textarea:focus { outline: 1px solid #7fd0ff; border-color: #7fd0ff; }
