:root {
  --ink: #11181c;
  --muted: #2d3139;
  --navy: #1f487a;
  --navy-dark: #112641;
  --line: #d9e3f1;
  --card: #ffffff;
  --bg: #f6f9fe;
  --danger: #ff3d3d;
  --ok: #0f9d58;
  --warn: #c47b00;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(255,61,61,0.18) 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(31,72,122,0.18) 0%, transparent 50%),
    var(--bg);
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 20px 48px; }

.hero {
  display: grid;
  gap: 20px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(17,38,65,0.98), rgba(31,72,122,0.96));
  color: #fff;
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(17,38,65,0.18);
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 280px;
}

.brand-mark {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25);
}

.brand-mark img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
  transform: none;
}

.hero-copy { min-width: 0; flex: 1; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: rgba(255,255,255,0.84);
  margin: 0 0 8px;
}
h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.15;
}
.lede { margin: 0; color: rgba(255,255,255,0.84); line-height: 1.5; }
h2 { margin: 28px 0 12px; font-size: 1.1rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  min-width: 0;
  padding: 12px 14px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 14px;
}
.stat-value {
  display: block;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  font-weight: 700;
  color: var(--navy-dark);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-label { color: var(--muted); font-size: 12px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  background: var(--danger);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn.secondary {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.live-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 12px;
  font-weight: 700;
}
.live-pill.on { background: rgba(15,157,88,0.28); }

.notice {
  padding: 12px 14px;
  border-radius: 12px;
  margin: 12px 0;
  background: #e8f7ee;
  border: 1px solid #b7e0c4;
}
.notice.error { background: #fdecea; border-color: #f5c2c0; }
.notice.hidden { display: none; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.pager { display: flex; gap: 8px; align-items: center; }
.pager .btn.secondary {
  background: #fff;
  color: var(--navy-dark);
  border: 1px solid var(--line);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
table { width: 100%; border-collapse: collapse; min-width: 960px; }
th, td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f8fbff;
}
tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.pill.up { background: var(--ok); }
.pill.down { background: var(--danger); }
.pill.level { background: var(--navy); }
.pill.pending { background: var(--warn); }
.pill.ack { background: var(--ok); }

details.notified summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--navy);
}
.notified-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.notified-list li {
  background: #f3f6fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-top: 18px;
}
.config-meta { display: grid; gap: 4px; margin: 0 0 12px; }
.form-stack { display: grid; gap: 12px; }
.level-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.level-card legend { font-weight: 700; padding: 0 6px; }
.recipient-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
label { font-size: 13px; color: var(--muted); }
input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.action-row .btn {
  background: var(--navy);
}
.action-row .btn.danger { background: var(--danger); }

.site-footer {
  margin-top: 40px;
  padding: 20px 4px 8px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(31,72,122,0.12);
}
.footer-brand strong {
  display: block;
  color: var(--navy-dark);
}
.footer-brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.footer-meta a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
}
.footer-meta a:hover { text-decoration: underline; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .hero-top { align-items: stretch; }
  .hero-actions { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer { align-items: flex-start; }
}
