:root {
  --bg: #0b0f14;
  --bg-2: #10161d;
  --panel: #131a22;
  --line: #222c38;
  --text: #e6edf3;
  --muted: #7d8a99;
  --amber: #f5b83d;
  --down: #3dd6c6;
  --up: #b48cff;
  --ok: #4ade80;
  --warn: #f5b83d;
  --err: #ff5d6c;
  --info: #6aa8ff;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --r: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; }
body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(245, 184, 61, 0.07), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, rgba(61, 214, 198, 0.06), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
a { color: inherit; }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  background: rgba(11, 15, 20, 0.85); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand svg { width: 38px; height: 38px; padding: 7px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.brand svg path { stroke: var(--amber); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.brand h1 { font-size: 19px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-family: var(--mono); }

.status-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-family: var(--mono);
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill-ok i { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.pill-live i { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2s infinite; }
.pill-warn i { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.pill-err i { background: var(--err); box-shadow: 0 0 10px var(--err); }
.pill-wait i { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

main { padding: 24px clamp(16px, 4vw, 40px) 60px; display: grid; gap: 26px; max-width: 1500px; margin: 0 auto; }

/* hero meters */
.hero { display: grid; grid-template-columns: 1.4fr 1.4fr 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr 1fr; } }
.meter {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.meter::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); }
.meter.down::before { background: var(--down); }
.meter.up::before { background: var(--up); }
.meter .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.meter .value { font-family: var(--mono); font-size: clamp(26px, 3.4vw, 40px); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter.down .value { color: var(--down); }
.meter.up .value { color: var(--up); }
.meter.small .value { font-size: clamp(22px, 2.6vw, 30px); }
.meter .split { font-family: var(--mono); font-size: 12px; color: var(--muted); min-height: 1em; }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.panel-head, .section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button {
  background: transparent; color: var(--muted); border: 0; padding: 6px 12px; font: 12px var(--mono); cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--bg-2); color: var(--amber); }

.chart-wrap { position: relative; height: 240px; }
#chart { width: 100%; height: 100%; display: block; }
.legend { position: absolute; top: 0; right: 0; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.legend .k { width: 12px; height: 3px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.legend .k.down { background: var(--down); }
.legend .k.up { background: var(--up); }

/* service cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px; transition: border-color 0.2s;
}
.card:hover { border-color: #33414f; }
.card.is-down { border-color: rgba(255, 93, 108, 0.5); }
.card.has-issue { border-color: rgba(245, 184, 61, 0.35); }
.card header { display: flex; align-items: center; gap: 10px; }
.card h3 { font-size: 16px; }
.card .ver { font: 11px var(--mono); color: var(--muted); }
.card .open {
  margin-left: auto; text-decoration: none; font-size: 12px; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted);
}
.card .open:hover { color: var(--amber); border-color: var(--amber); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); flex: none; }
.dot.down { background: var(--err); box-shadow: 0 0 8px var(--err); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.dot.link { background: var(--muted); box-shadow: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 12px var(--mono); padding: 4px 8px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }
.chip b { color: var(--text); font-weight: 600; }
.chip.down b { color: var(--down); }
.chip.up b { color: var(--up); }
.chip.warn { border-color: rgba(245, 184, 61, 0.4); color: var(--warn); }
.chip.bad { border-color: rgba(255, 93, 108, 0.4); color: var(--err); }

.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.top-list:empty { display: none; }
.top-list li { font-size: 12px; display: grid; gap: 4px; }
.top-list .row { display: flex; justify-content: space-between; gap: 10px; }
.top-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c4ced8; }
.top-list .spd { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
.bar { height: 3px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--down); }
.err { margin: 0; font: 12px var(--mono); color: var(--err); }
.err:empty { display: none; }

/* issues */
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.issues li {
  display: grid; grid-template-columns: 74px 110px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; font-size: 13px;
}
@media (max-width: 760px) { .issues li { grid-template-columns: 70px 1fr; } .issues .msg { grid-column: 1 / -1; } }
.issues li.resolved { opacity: 0.55; }
.issues li.acked { opacity: 0.7; }
.lvl { font: 11px var(--mono); text-transform: uppercase; padding: 3px 7px; border-radius: 6px; text-align: center; }
.lvl.error { background: rgba(255, 93, 108, 0.12); color: var(--err); }
.lvl.warning { background: rgba(245, 184, 61, 0.12); color: var(--warn); }
.lvl.info { background: rgba(106, 168, 255, 0.12); color: var(--info); }
.issues .svc { font-family: var(--mono); color: var(--muted); font-size: 12px; }
.issues .msg { word-break: break-word; }
.issues .when { font: 11px var(--mono); color: var(--muted); text-align: right; white-space: nowrap; }
.issues .ack { margin-top: 4px; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; font: 11px var(--mono); padding: 2px 8px; cursor: pointer; }
.issues .ack:hover { color: var(--amber); border-color: var(--amber); }
.empty { color: var(--muted); font-size: 13px; padding: 12px; text-align: center; }
