@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #0a1420;
  --bg-alt: #0d1826;
  --surface: #131f31;
  --surface-2: #182740;
  --border: #24354d;
  --text: #eaf2fa;
  --text-muted: #8ea0b8;
  --text-faint: #5f7288;

  --accent: #2fd3c0;
  --accent-dim: #1c4b47;
  --amber: #e8a33d;

  --op: #34d17f;
  --op-dim: #123625;
  --maint: #4c8dff;
  --maint-dim: #16264a;
  --deg: #e8a33d;
  --deg-dim: #3a2a0f;
  --out: #ff5c6e;
  --out-dim: #3a1620;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

/* The [hidden] attribute must always win over any display rule set below,
   otherwise elements toggled via `el.hidden = true/false` in JS (like the
   admin panel) can stay visible even when the attribute is present. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: radial-gradient(ellipse 1200px 600px at 50% -10%, #0f2436 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.display {
  font-family: "Space Grotesk", "Inter", sans-serif;
}

a {
  color: var(--accent);
}

button {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #1a8f82);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #06201c;
  flex-shrink: 0;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.brand-name span {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  display: block;
  margin-top: -2px;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06201c;
}

.btn-primary:hover {
  background: #4fe0cf;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.user-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
}

.admin-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}

/* ---------- Banner ---------- */
.banner {
  margin-top: 22px;
  padding: 26px 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.banner[data-status="operational"] {
  background: linear-gradient(120deg, var(--op-dim), var(--surface) 70%);
  border-color: #1e5b3e;
}
.banner[data-status="maintenance"] {
  background: linear-gradient(120deg, var(--maint-dim), var(--surface) 70%);
  border-color: #2a4a86;
}
.banner[data-status="degraded"] {
  background: linear-gradient(120deg, var(--deg-dim), var(--surface) 70%);
  border-color: #7a5518;
}
.banner[data-status="outage"] {
  background: linear-gradient(120deg, var(--out-dim), var(--surface) 70%);
  border-color: #8a2536;
}

.banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.banner[data-status="operational"] .banner-icon { background: var(--op); }
.banner[data-status="maintenance"] .banner-icon { background: var(--maint); }
.banner[data-status="degraded"] .banner-icon { background: var(--deg); }
.banner[data-status="outage"] .banner-icon { background: var(--out); }

.banner-icon svg { width: 22px; height: 22px; }

.banner-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  font-weight: 700;
}

.banner-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ---------- Sections ---------- */
.section {
  margin-top: 34px;
}

.section-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 12px 2px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-block + .group-block {
  margin-top: 22px;
}

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.service-row:last-child {
  border-bottom: none;
}

.service-name {
  font-weight: 600;
  font-size: 14.5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pill[data-status="operational"] { color: var(--op); background: var(--op-dim); }
.pill[data-status="maintenance"] { color: var(--maint); background: var(--maint-dim); }
.pill[data-status="degraded"] { color: var(--deg); background: var(--deg-dim); }
.pill[data-status="outage"] { color: var(--out); background: var(--out-dim); }

/* ---------- Incidents ---------- */
.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.incident-card + .incident-card {
  margin-top: 12px;
}

.incident-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.incident-title {
  font-weight: 700;
  font-size: 15px;
}

.incident-meta {
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 3px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline {
  margin-top: 12px;
  border-left: 2px solid var(--border);
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item {
  position: relative;
  font-size: 13.5px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -20.5px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-alt);
}

.timeline-item strong {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.timeline-time {
  color: var(--text-faint);
  font-size: 11.5px;
}

.empty-note {
  color: var(--text-faint);
  font-size: 13.5px;
  padding: 18px;
  text-align: center;
}

/* ---------- Footer ---------- */
.footer {
  margin: 50px 0 40px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ---------- Admin panel ---------- */
.admin-toggle-row {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.admin-panel {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 20px;
}

.admin-panel h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  margin: 0 0 4px;
}

.admin-panel .hint {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 0 0 16px;
}

.admin-block {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.admin-block:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.admin-block h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

select,
input[type="text"],
textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
}

textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
}

.service-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.service-admin-row:last-child {
  border-bottom: none;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  font-weight: 600;
  z-index: 50;
  animation: toast-in 0.2s ease;
}

.toast.error {
  border-color: var(--out);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .banner { flex-direction: column; align-items: flex-start; }
}
