:root {
  --bg: #080b10;
  --ink: #f5f7fa;
  --muted: #8b96a8;
  --card: #10151d;
  --surface: #1a2230;
  --line: #243044;
  --accent: #20d6c7;
  --accent-soft: rgba(32, 214, 199, 0.12);
  --copper: #ffb45c;
  --danger: #ff5d73;
  --success: #38d996;
  --secondary: #47a7ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 420px at 50% -20%, rgba(32, 214, 199, 0.08), transparent 58%),
    var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, textarea { font: inherit; color: inherit; }
.skip {
  position: absolute; left: -999px; top: 0;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 20; background: var(--card); padding: 0.4rem 0.7rem; }

.top {
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 16, 0.86);
  backdrop-filter: blur(12px);
}
.top-inner {
  max-width: 72rem; margin: 0 auto; padding: 0.7rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--ink); font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; font-size: 11px; text-decoration: none;
}
.brand em { color: var(--muted); font-style: normal; font-weight: 500; letter-spacing: 0.08em; }
.mark {
  width: 8px; height: 8px; border-radius: 99px; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.top-actions { display: flex; align-items: center; gap: 0.75rem; }
.live { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

main { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; display: grid; gap: 1.25rem; }

.hero {
  display: grid; gap: 1.25rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.hero-status { display: flex; gap: 0.9rem; align-items: flex-start; }
.pulse {
  width: 12px; height: 12px; border-radius: 99px; margin-top: 0.35rem; background: var(--muted); flex-shrink: 0;
}
.hero.ok .pulse { background: var(--success); box-shadow: 0 0 0 6px rgba(56, 217, 150, 0.16); }
.hero.degraded .pulse, .hero.possible .pulse { background: var(--copper); box-shadow: 0 0 0 6px rgba(255, 180, 92, 0.16); }
.hero.outage .pulse { background: var(--danger); box-shadow: 0 0 0 6px rgba(255, 93, 115, 0.18); }
.kicker { margin: 0; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
h1 { margin: 0.2rem 0 0; font-size: 1.65rem; letter-spacing: -0.03em; font-weight: 600; }
.sub { margin: 0.35rem 0 0; color: var(--muted); }
.metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin: 0;
}
.metrics div {
  padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(8, 11, 16, 0.35);
}
.metrics dt { color: var(--muted); font-size: 11px; }
.metrics dd { margin: 0.2rem 0 0; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.panel {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 1rem 1.15rem 1.15rem;
}
.panel-head, .panel-head.tight {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; margin-bottom: 0.9rem;
}
.panel-head h2, .panel-head.tight h2 { margin: 0; font-size: 0.95rem; }
.panel-head p, .panel-head.tight p { margin: 0.2rem 0 0; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 0.25rem; background: var(--surface); padding: 0.2rem; border-radius: 8px; }
.tab, .btn {
  height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; padding: 0 0.7rem;
}
.tab.on, .btn:hover, .tab:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.btn { border: 1px solid var(--line); }
.btn.solid { background: var(--accent); color: #06221f; font-weight: 600; border-color: transparent; }
.btn.ghost { border-color: transparent; }

.chart-wrap { position: relative; }
canvas { width: 100%; height: 240px; display: block; }
.tooltip {
  position: absolute; pointer-events: none; background: #0c1118; border: 1px solid var(--line);
  border-radius: 8px; padding: 0.45rem 0.55rem; font-size: 11px; color: var(--ink); white-space: nowrap;
}
.legend { display: flex; gap: 1rem; list-style: none; margin: 0.7rem 0 0; padding: 0; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 0.35rem; vertical-align: middle; }
.lg-line { background: var(--accent); height: 2px !important; }
.lg-bar { background: rgba(255, 93, 115, 0.55); }
.lg-out { background: rgba(255, 93, 115, 0.18); }

.services { display: grid; gap: 0.75rem; }
.service {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 0.9rem 1rem;
  display: grid; gap: 0.65rem;
}
.service-top { display: grid; grid-template-columns: 8px 1fr auto auto; gap: 0.7rem; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--muted); }
.dot.ok { background: var(--success); }
.dot.down { background: var(--danger); }
.name { font-weight: 600; }
.meta { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.days { display: grid; grid-template-columns: repeat(90, minmax(3px, 1fr)); gap: 2px; height: 22px; }
.days b { display: block; height: 100%; border-radius: 2px; background: var(--surface); }
.days b.up { background: var(--success); }
.days b.warn { background: var(--copper); }
.days b.down { background: var(--danger); }
.spark { width: 88px; height: 22px; }

.count { margin: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.timeline { display: grid; gap: 0.65rem; }
.incidents-empty {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(8, 11, 16, 0.35);
}
.incidents-empty .mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft); box-shadow: none;
  display: grid; place-items: center; flex-shrink: 0;
}
.incidents-empty .mark::after {
  content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--success);
}
.incidents-empty strong { display: block; font-size: 0.92rem; }
.incidents-empty p { margin: 0; }
.incidents-empty span { color: var(--muted); font-size: 12px; }

.incident {
  display: grid; grid-template-columns: 16px 1fr; gap: 0.85rem;
  padding: 0.85rem 0.95rem; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(8, 11, 16, 0.28);
}
.incident.open { border-color: rgba(255, 93, 115, 0.35); background: rgba(255, 93, 115, 0.06); }
.rail {
  position: relative; width: 8px; margin: 0.15rem auto 0;
}
.rail::before {
  content: ""; position: absolute; left: 50%; top: 10px; bottom: 2px;
  width: 1px; background: var(--line); transform: translateX(-50%);
}
.rail i {
  position: relative; z-index: 1; display: block;
  width: 8px; height: 8px; border-radius: 99px; background: var(--success);
  box-shadow: 0 0 0 4px rgba(56, 217, 150, 0.12);
}
.incident.open .rail i { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 93, 115, 0.16); }
.incident-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; margin-bottom: 0.35rem;
}
.badge {
  height: 20px; padding: 0 0.45rem; border-radius: 999px;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600;
  display: inline-flex; align-items: center;
}
.badge.open { background: rgba(255, 93, 115, 0.16); color: var(--danger); }
.badge.done { background: rgba(56, 217, 150, 0.12); color: var(--success); }
.chip {
  height: 20px; padding: 0 0.45rem; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted); font-size: 11px;
}
.dur { margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.incident h3 { margin: 0; font-size: 0.95rem; font-weight: 600; letter-spacing: -0.02em; }
.incident .note { margin: 0.35rem 0 0; color: var(--muted); font-size: 12px; }
.updates { list-style: none; margin: 0.55rem 0 0; padding: 0; display: grid; gap: 0.28rem; }
.updates li {
  display: grid; grid-template-columns: 4.6rem 1fr; gap: 0.65rem;
  color: var(--muted); font-size: 12px;
}
.updates time { font-variant-numeric: tabular-nums; color: var(--muted); }

.reports-panel .report-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-stats { display: grid; gap: 0.6rem; }
.report-stats div {
  padding: 0.8rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(8, 11, 16, 0.35);
}
.report-stats strong { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.report-stats .meta { text-align: left; display: block; margin-bottom: 0.15rem; }

footer {
  max-width: 72rem; margin: 0 auto; padding: 0 1.25rem 2.5rem; color: var(--muted); font-size: 11px;
}

dialog {
  width: min(26rem, calc(100% - 2rem));
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
  padding: 1.1rem 1.15rem 1.15rem;
}
dialog::backdrop { background: rgba(4, 6, 10, 0.72); }
dialog h3 { margin: 0; }
dialog p { margin: 0.4rem 0 0.9rem; color: var(--muted); }
label { display: grid; gap: 0.3rem; margin-bottom: 0.7rem; font-size: 12px; color: var(--muted); }
select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #0c1118; color: var(--ink); padding: 0.45rem 0.55rem;
}
.form-actions { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.4rem; }
.form-error { color: var(--danger); font-size: 12px; }

@media (max-width: 860px) {
  .metrics, .reports-panel .report-stats { grid-template-columns: 1fr 1fr; }
  .top-inner, main { padding-left: 1rem; padding-right: 1rem; }
}
@media (max-width: 620px) {
  .metrics, .reports-panel .report-stats { grid-template-columns: 1fr; }
  h1 { font-size: 1.3rem; }
  .days { grid-template-columns: repeat(45, minmax(4px, 1fr)); }
  .days b:nth-child(-n + 45) { display: none; }
  .dur { margin-left: 0; }
}
