@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #07090e;
  --bg-glow-1: rgba(99,102,241,.10);
  --bg-glow-2: rgba(34,211,238,.06);
  --surface: rgba(20,24,34,.72);
  --surface-solid: #11141c;
  --surface-2: #171b26;
  --surface-3: #1e2331;
  --border: rgba(148,163,184,.10);
  --border-strong: rgba(148,163,184,.20);
  --text: #e6eaf2;
  --text-2: #a3adbf;
  --muted: #6b7489;
  --muted-2: #4a5265;

  --ok: #22c55e;   --ok-glow: rgba(34,197,94,.35);   --ok-soft: rgba(34,197,94,.10);
  --warn: #f59e0b; --warn-glow: rgba(245,158,11,.35); --warn-soft: rgba(245,158,11,.10);
  --crit: #ef4444; --crit-glow: rgba(239,68,68,.40);  --crit-soft: rgba(239,68,68,.10);
  --off: #64748b;  --off-soft: rgba(100,116,139,.10);

  --accent: #6366f1; --accent-2: #8b5cf6; --cyan: #22d3ee; --blue: #3b82f6;
  --accent-grad: linear-gradient(135deg, var(--accent), var(--accent-2));

  --radius: 14px; --radius-sm: 9px;
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -12px rgba(0,0,0,.6);
}

html { background: var(--bg); }
body {
  min-height: 100vh; color: var(--text); font-family: var(--font); font-size: 14px;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); }
.num  { font-variant-numeric: tabular-nums; }
a { color: inherit; }

/* ── Header ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 32px;
  background: rgba(7,9,14,.72); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent-grad); display: grid; place-items: center;
  font-weight: 800; color: #fff; box-shadow: 0 6px 20px -6px rgba(99,102,241,.7);
}
.brand h1 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p  { font-size: 11px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  font-family: inherit; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2);
  transition: color .15s, border-color .15s, background .15s, opacity .15s, transform .1s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { color: var(--text); border-color: rgba(148,163,184,.35); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px rgba(99,102,241,.8); }
.btn-primary:hover { color: #fff; opacity: .9; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 11px; border-radius: 7px; }
.btn.is-on { color: var(--ok); border-color: rgba(34,197,94,.45); background: var(--ok-soft); }
.btn-warn:hover { color: var(--warn); border-color: rgba(245,158,11,.5); }
.btn-info:hover { color: var(--cyan); border-color: rgba(34,211,238,.5); }
.btn:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ── Pills / dots ─────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.pill.ok   { color: var(--ok);   background: var(--ok-soft);   border-color: rgba(34,197,94,.3); }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(245,158,11,.3); }
.pill.crit { color: var(--crit); background: var(--crit-soft); border-color: rgba(239,68,68,.3); }

.sdot { position: relative; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--off); }
.sdot.ok   { background: var(--ok);   box-shadow: 0 0 10px var(--ok-glow); }
.sdot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn-glow); }
.sdot.crit { background: var(--crit); box-shadow: 0 0 10px var(--crit-glow); }
.sdot.ok::after, .sdot.crit::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: 0; animation: ping 2.4s cubic-bezier(0,0,.2,1) infinite;
}
.sdot.ok::after   { color: var(--ok); }
.sdot.crit::after { color: var(--crit); animation-duration: 1.4s; }
@keyframes ping { 0% { transform: scale(.6); opacity: .8 } 80%,100% { transform: scale(1.8); opacity: 0 } }

/* ── Panels ───────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.section-label .count { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted-2); }

/* ── Ring gauge ───────────────────────────────────────── */
.ring { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: rgba(148,163,184,.10); }
.ring .val { transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1), stroke .4s; stroke-linecap: round; }
.ring .val.ok   { stroke: var(--ok); }
.ring .val.warn { stroke: var(--warn); }
.ring .val.crit { stroke: var(--crit); }
.ring .val.off  { stroke: var(--off); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }

/* ── Sparkline ────────────────────────────────────────── */
.spark { display: block; width: 100%; height: 100%; overflow: visible; }
.spark .line { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* ── Bars ─────────────────────────────────────────────── */
.bar { height: 5px; border-radius: 4px; background: rgba(148,163,184,.10); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-crit { color: var(--crit); } .c-off { color: var(--off); }
.bg-ok { background: var(--ok); } .bg-warn { background: var(--warn); } .bg-crit { background: var(--crit); } .bg-off { background: var(--off); }

/* ── Skeleton ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(148,163,184,.06) 25%, rgba(148,163,184,.12) 50%, rgba(148,163,184,.06) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% } 100% { background-position: -200% } }

/* ── Entry animation ──────────────────────────────────── */
.rise { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* ── Toast ────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999; display: none;
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 11px 16px; font-size: 13px; box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
#toast.show { display: block; animation: rise .2s; }
#toast.success { border-color: rgba(34,197,94,.45); color: var(--ok); }
#toast.error   { border-color: rgba(239,68,68,.45); color: var(--crit); }

.spinner { display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Modal ────────────────────────────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0; z-index: 1000; padding: 16px;
  background: rgba(3,5,10,.65); backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
}
.overlay.open { display: flex; animation: rise .15s; }
.modal {
  width: 380px; max-width: 100%; padding: 26px;
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 14px;
}
.modal h3 { font-size: 15px; font-weight: 600; }
.modal p  { font-size: 12px; color: var(--muted); }
.modal input {
  background: var(--bg); border: 1px solid var(--border-strong); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font-size: 13px; width: 100%; outline: none; font-family: inherit;
}
.modal input:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

@media (max-width: 700px) {
  .topbar { padding: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
