:root {
  --teal: #19BBB7;
  --teal-dark: #128f8c;
  --teal-tint: #e6f7f7;

  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f5f5f1;
  --border: #e8e6df;
  --border-strong: #d4d2cb;

  --fg: #1a1d28;
  --fg-2: #4a4f5e;
  --fg-muted: #7a8090;

  --green: #16a34a;
  --green-tint: #ecfdf5;
  --yellow: #d97706;
  --yellow-tint: #fef7e6;
  --orange: #ea580c;
  --orange-tint: #fff1e8;
  --red: #dc2626;
  --red-tint: #fee8e8;
  --blue: #2563eb;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 30, 0.04);
  --shadow: 0 6px 20px rgba(20, 22, 30, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background:
    linear-gradient(180deg, #d8f0ee 0%, #ecf6f4 40%, var(--bg) 90px) no-repeat,
    var(--bg);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  min-height: 100vh;
}
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: "Geist Mono", ui-monospace, monospace;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}
button { font-family: inherit; cursor: pointer; }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 10px 24px 32px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 10px 14px 10px 18px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(15, 30, 35, 0.04),
    0 6px 18px rgba(15, 50, 55, 0.06);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 700;
}
.brand:hover { text-decoration: none; color: var(--teal-dark); }
.brand-name {
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--teal-dark);
}
.brand-pill {
  padding: 4px 10px;
  background: var(--teal-tint);
  color: var(--teal-dark);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand-mark { display: block; width: 28px; height: 28px; }

.btn-primary {
  background: var(--teal);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  transition: background 0.12s, transform 0.06s;
  box-shadow: 0 1px 2px rgba(25, 187, 183, 0.25);
}
.btn-primary:hover { background: var(--teal-dark); }
.btn-primary:active { transform: translateY(1px); }

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.banner-icon {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.banner-text { flex: 1; min-width: 0; }
.banner-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.banner-sub {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--fg-muted);
}
.banner-operational {
  border-color: rgba(22, 163, 74, 0.25);
  background: var(--green-tint);
}
.banner-operational .banner-icon { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18); }
.banner-operational .banner-title { color: var(--green); }
.banner-degraded {
  border-color: rgba(217, 119, 6, 0.3);
  background: var(--yellow-tint);
}
.banner-degraded .banner-icon { background: var(--yellow); box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.18); }
.banner-degraded .banner-title { color: var(--yellow); }
.banner-partial_outage {
  border-color: rgba(234, 88, 12, 0.3);
  background: var(--orange-tint);
}
.banner-partial_outage .banner-icon { background: var(--orange); box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.18); }
.banner-partial_outage .banner-title { color: var(--orange); }
.banner-major_outage {
  border-color: rgba(220, 38, 38, 0.35);
  background: var(--red-tint);
}
.banner-major_outage .banner-icon { background: var(--red); box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18); }
.banner-major_outage .banner-title { color: var(--red); }
.banner-loading {
  border-color: var(--border);
  background: var(--surface);
}
.banner-loading .banner-icon { background: var(--fg-muted); }
.banner-loading .banner-title { color: var(--fg-muted); }

.active-incidents {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.active-incident {
  border: 1px solid rgba(217, 119, 6, 0.25);
  background: var(--yellow-tint);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.active-incident.severity-critical {
  border-color: rgba(220, 38, 38, 0.3);
  background: var(--red-tint);
}
.active-incident.severity-major {
  border-color: rgba(234, 88, 12, 0.3);
  background: var(--orange-tint);
}
.active-incident-title {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 4px;
}
.active-incident-meta {
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.active-incident-meta .sev {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-head h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.section-meta {
  font-size: 12px;
  color: var(--fg-muted);
}
.link {
  font-size: 13px;
  color: var(--fg-2);
}

.system-status { margin-bottom: 24px; }
.components-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.component {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.component:last-child { border-bottom: none; }
.component.skeleton {
  height: 76px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.component-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.component-info { min-width: 0; flex: 1; }
.component-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
}
.component-icon-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.component-icon-status.s-operational { background: var(--green); }
.component-icon-status.s-degraded { background: var(--yellow); }
.component-icon-status.s-partial_outage { background: var(--orange); }
.component-icon-status.s-major_outage { background: var(--red); }
.component-icon-status.s-maintenance { background: var(--blue); }
.component-desc {
  margin-top: 1px;
  font-size: 12px;
  color: var(--fg-muted);
}
.component-status-text {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.component-status-text.s-operational { color: var(--green); }
.component-status-text.s-degraded { color: var(--yellow); }
.component-status-text.s-partial_outage { color: var(--orange); }
.component-status-text.s-major_outage { color: var(--red); }
.component-status-text.s-maintenance { color: var(--blue); }

.uptime-bar {
  display: flex;
  gap: 1px;
  align-items: stretch;
  height: 22px;
}
.uptime-tick {
  flex: 1;
  border-radius: 1px;
  background: var(--green);
  transition: opacity 0.2s, background 0.2s;
  min-width: 1px;
}
.uptime-tick:hover { opacity: 0.6; }
.uptime-tick.t-degraded { background: var(--yellow); }
.uptime-tick.t-partial { background: var(--orange); }
.uptime-tick.t-outage { background: var(--red); }
.uptime-tick.t-unknown { background: var(--border-strong); }
.uptime-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 4px;
}

.incident-history { margin-top: 4px; }
.incidents-list { display: flex; flex-direction: column; gap: 8px; }
.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}
.incident-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 3px;
}
.incident-card-title {
  font-weight: 600;
  font-size: 13px;
  margin: 0;
  line-height: 1.35;
}
.incident-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--fg-muted);
}
.incident-card-meta .sev {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}
.incident-card-meta .sev-critical { color: var(--red); }
.incident-card-meta .sev-major { color: var(--orange); }
.incident-card-meta .sev-minor { color: var(--yellow); }
.incident-updates {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.incident-update {
  font-size: 12px;
  color: var(--fg-2);
  padding: 1px 0;
  line-height: 1.4;
}
.incident-update strong { color: var(--fg); margin-right: 4px; font-weight: 600; }
.incident-update .ts { color: var(--fg-muted); font-size: 11px; }

.muted { color: var(--fg-muted); }

.footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 11px;
  color: var(--fg-muted);
}
.footer-sep { margin: 0 6px; opacity: 0.6; }
.footer a { color: var(--fg-2); }

.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
  max-width: 380px;
  width: 90vw;
}
.dialog::backdrop { background: rgba(20, 22, 30, 0.4); }
.dialog-form { padding: 20px; }
.dialog-form h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.dialog-form p { margin: 0 0 14px; font-size: 13px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 500; color: var(--fg-2); }
.field input {
  font-family: inherit;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.btn-secondary {
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
}
.btn-secondary:hover { background: var(--border); }
.dialog-actions .btn-primary { padding: 8px 14px; font-size: 13px; }
.dialog-aside {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-muted);
  text-align: center;
}
.dialog-msg {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.dialog-msg.success { background: var(--green-tint); color: var(--green); }
.dialog-msg.error { background: var(--red-tint); color: var(--red); }

@media (max-width: 600px) {
  .page { padding: 10px 16px 32px; }
  .brand-name { font-size: 18px; }
  .component { padding: 14px 16px; }
  .component-name { font-size: 14px; }
  .uptime-bar { height: 22px; }
  .banner { padding: 16px 18px; }
  .banner-title { font-size: 15px; }
}
