:root {
  --bg: #0b1020;
  --panel: #111a31;
  --text: #e6ecff;
  --muted: #9aa8cc;
  --good: #34d399;
  --warn: #f59e0b;
  --bad: #ef4444;
  --critical: #f43f5e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Arial, sans-serif;
  background: linear-gradient(180deg, #070b16 0%, #0b1020 30%);
  color: var(--text);
}

.app {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

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

.toolbar label { font-size: 13px; color: var(--muted); }

h1 { margin: 2px 0 0; }

.kicker { color: var(--muted); margin: 0; }

.btn {
  background: #26345e;
  color: var(--text);
  border: 1px solid #40549a;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

select {
  background: #1a2342;
  color: var(--text);
  border: 1px solid #3a4b87;
  border-radius: 8px;
  padding: 8px 10px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.grid { display: grid; gap: 12px; }
.two-col { grid-template-columns: 1fr 1fr; }

.card {
  background: var(--panel);
  border: 1px solid #22305f;
  border-radius: 16px;
  padding: 16px;
}

.wide { min-height: 360px; }
.card h2 { margin-top: 0; }

#globalStatus { font-weight: 700; }
.status.good { color: var(--good); }
.status.warn { color: var(--warn); animation: pulseWarn 1.6s ease-in-out infinite; }
.status.bad { color: var(--bad); animation: pulseBad 1.4s ease-in-out infinite; }

.status { padding: 2px 8px; border-radius: 999px; display: inline-block; }

#services { display: grid; gap: 10px; }
.service-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid #2a3a6b;
  border-radius: 10px;
}

.service-item.has-alert {
  border-color: var(--warn);
}

.event {
  padding: 10px;
  border-left: 4px solid #3c4e86;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.event-meta { font-weight: 700; margin-right: 6px; }
.event-badge { display: inline-block; margin-left: 6px; margin-right: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; text-transform: capitalize; }
.event-badge.warn { background: rgba(245,158,11,.2); color: var(--warn); }
.event-badge.critical { background: rgba(244,63,94,.2); color: var(--critical); }
.event-badge.info { background: rgba(59,130,246,.2); color: #93c5fd; }

.incident-link {
  color: #7dd3fc;
  text-decoration: none;
  font-size: 12px;
}

.incident-link:hover { text-decoration: underline; }

.small { font-size: 12px; color: var(--muted); }

ul { list-style: none; padding: 0; margin: 0; }
li + li { margin-top: 10px; }

footer { margin-top: 14px; color: var(--muted); }

@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  header { display: block; }
  .toolbar { margin-top: 8px; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; justify-content: flex-start; }
}

@keyframes pulseWarn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
}

@keyframes pulseBad {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}
