:root {
  --purple: #303391;
  --gold-bright: #F8D541;
  --gold-deep: #C9A008;
  --ok: #2f9e44;
  --warn: #f08c00;
  --partial: #fd7e14;
  --down: #e03131;
  --maint: #4c6ef5;
  --ink: #1a1a2e;
  --muted: #5c5c70;
  --line: #e8e8ef;
  --bg: #fff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 24px 20px 64px; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 12px;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--purple);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.logo img {
  height: 50px;
  width: auto;
  display: block;
}
.logo-fallback {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-fallback[hidden] {
  display: none !important;
}
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--purple);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.logo-mark span {
  width: 14px;
  height: 14px;
  background: var(--gold-bright);
  border-radius: 3px;
}
.btn {
  border: 1.5px solid var(--purple);
  color: var(--purple);
  background: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: #f5f5fa; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}
.btn-primary:hover { background: #262a7a; color: #fff; }
.banner {
  color: #fff;
  text-align: center;
  padding: 18px 16px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 1.15rem;
  margin-bottom: 36px;
}
.banner.operational { background: var(--ok); }
.banner.degraded { background: var(--warn); }
.banner.partial { background: var(--partial); }
.banner.major { background: var(--down); }
.banner.maintenance { background: var(--maint); }
h2 { font-size: 1.35rem; font-weight: 600; margin: 0 0 8px; }
.about { color: var(--muted); font-size: 0.95rem; margin: 0 0 28px; max-width: 62ch; }
.meta-link { color: var(--purple); font-size: 0.9rem; text-decoration: none; }
.meta-link:hover { text-decoration: underline; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 8px 0 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.component {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 12px;
  background: #fff;
}
.comp-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}
.comp-name { font-weight: 600; font-size: 1.05rem; }
.comp-name .q {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #bbb;
  color: #888;
  font-size: 11px;
  text-align: center;
  line-height: 14px;
  margin-left: 6px;
  vertical-align: middle;
  cursor: help;
}
.status-label { font-weight: 600; font-size: 0.95rem; }
.status-label.operational { color: var(--ok); }
.status-label.degraded { color: var(--warn); }
.status-label.partial { color: var(--partial); }
.status-label.major { color: var(--down); }
.status-label.maintenance { color: var(--maint); }
.bars {
  display: flex;
  gap: 2px;
  height: 34px;
  align-items: stretch;
}
.bars i {
  flex: 1;
  background: var(--ok);
  border-radius: 1px;
  min-width: 2px;
}
.bars i.degraded { background: var(--warn); }
.bars i.partial { background: var(--partial); }
.bars i.major { background: var(--down); }
.bars i.maintenance { background: var(--maint); }
.bars i.nodata { background: #ddd; }
.bar-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 8px;
}
.bar-meta .pct { font-weight: 600; color: var(--ink); }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin: 20px 0 36px;
  font-size: 0.85rem;
  color: var(--muted);
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.legend .l-ok::before { background: var(--ok); }
.legend .l-deg::before { background: var(--warn); }
.legend .l-part::before { background: var(--partial); }
.legend .l-maj::before { background: var(--down); }
.legend .l-maint::before { background: var(--maint); }
.day { border-bottom: 1px solid var(--line); padding: 14px 0; }
.day strong { display: block; margin-bottom: 4px; }
.day .none { color: var(--muted); font-size: 0.95rem; }
.incident-update {
  margin: 10px 0 0;
  padding-left: 12px;
  border-left: 3px solid var(--line);
}
.incident-update .tag {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  margin-right: 8px;
}
.incident-update .tag.investigating { color: var(--warn); }
.incident-update .tag.monitoring { color: var(--maint); }
.incident-update .tag.resolved { color: var(--ok); }
.incident-update .tag.identified { color: var(--partial); }
.incident-update .when {
  color: var(--muted);
  font-size: 0.85rem;
}
.incident-update p {
  margin: 4px 0 0;
  font-size: 0.95rem;
}
footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
footer a { color: var(--purple); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.error-box {
  background: #fff5f5;
  border: 1px solid #fcc;
  color: #a00;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 24px;
}

/* Subscribe modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 8px;
  max-width: 420px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.modal h3 { margin: 0 0 8px; font-size: 1.15rem; color: var(--purple); }
.modal p { margin: 0 0 16px; color: var(--muted); font-size: 0.92rem; }
.modal label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.modal input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 14px;
}
.modal input:focus {
  outline: 2px solid var(--gold-bright);
  border-color: var(--purple);
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal .msg {
  font-size: 0.9rem;
  margin: 0 0 12px;
  min-height: 1.2em;
}
.modal .msg.ok { color: var(--ok); }
.modal .msg.err { color: var(--down); }

@media (max-width: 560px) {
  .comp-top { flex-direction: column; align-items: flex-start; }
  .logo img { height: 36px; }
}
