:root{
  --bg-void:#05090f;
  --bg-glow-1: rgba(0,212,255,.10);
  --bg-glow-2: rgba(120,60,255,.08);
  --panel:rgba(16,32,50,.46);
  --panel-border:rgba(0,212,255,.22);
  --cyan:#00d4ff;
  --teal:#00ffb0;
  --amber:#ffb020;
  --red:#ff4d5e;
  --text:#eaf6ff;
  --text-dim:#7fa0bb;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
}

*{box-sizing:border-box;}

body{
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(1200px 600px at 12% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 100% 10%, var(--bg-glow-2), transparent 55%),
    var(--bg-void);
  color:var(--text);
  font-family:var(--sans);
  overflow-x:hidden;
}

/* subtle CRT-ish scanline texture over everything, very low opacity */
.scanlines{
  position:fixed; inset:0; pointer-events:none; z-index:50; opacity:.035;
  background:repeating-linear-gradient(to bottom, #fff 0 1px, transparent 1px 3px);
}

/* ---------- topbar ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 32px;
  background:linear-gradient(180deg, rgba(10,22,36,.85), rgba(10,22,36,.55));
  border-bottom:1px solid var(--panel-border);
  backdrop-filter:blur(14px);
  position:sticky; top:0; z-index:40;
}
.brand{display:flex; align-items:center; gap:14px;}
.brand-mark{
  font-size:26px; color:var(--cyan);
  text-shadow:0 0 18px var(--cyan);
  animation:spin 6s linear infinite;
  display:inline-block;
}
@keyframes spin{ to{ transform:rotate(360deg); } }
.brand-text h1{
  margin:0; font-size:26px; letter-spacing:2px; font-weight:700;
  color:var(--text);
}
.brand-sub{ color:var(--cyan); font-weight:500; }
.brand-text p{ margin:2px 0 0; font-size:11px; color:var(--text-dim); letter-spacing:1px; text-transform:uppercase; }

.topbar-right{ display:flex; align-items:center; gap:18px; }
.clock{ font-family:var(--mono); color:var(--text-dim); font-size:14px; letter-spacing:1px; }

.login-btn{
  background:transparent; border:1px solid var(--panel-border); color:var(--text-dim);
  padding:8px 14px; border-radius:8px; font-family:var(--sans); font-size:13px;
  cursor:pointer; transition:.2s; display:flex; align-items:center; gap:6px;
}
.login-btn:hover{ color:var(--cyan); border-color:var(--cyan); box-shadow:0 0 12px rgba(0,212,255,.25); }

.status-pill{
  display:flex; align-items:center; gap:8px;
  background:rgba(0,255,140,.08); border:1px solid rgba(0,255,140,.35);
  padding:7px 14px; border-radius:20px; font-family:var(--mono); font-size:12px;
  letter-spacing:1px; color:var(--teal);
}
.pulse-dot{
  width:8px; height:8px; border-radius:50%; background:var(--teal);
  box-shadow:0 0 8px var(--teal); animation:pulse 1.6s ease-in-out infinite;
}
@keyframes pulse{ 0%,100%{opacity:1; transform:scale(1);} 50%{opacity:.4; transform:scale(.7);} }
.status-pill.offline{ background:rgba(255,77,94,.1); border-color:rgba(255,77,94,.4); color:var(--red); }
.status-pill.offline .pulse-dot{ background:var(--red); box-shadow:0 0 8px var(--red); }

/* ---------- layout ---------- */
.dashboard{
  max-width:1240px; margin:0 auto; padding:28px 32px 60px;
  display:flex; flex-direction:column; gap:22px;
}
.row-split{ display:grid; grid-template-columns:1fr 1fr; gap:22px; }
@media (max-width:820px){ .row-split{ grid-template-columns:1fr; } }

.panel{
  background:var(--panel);
  border:1px solid var(--panel-border);
  border-radius:16px;
  padding:22px 24px;
  backdrop-filter:blur(16px) saturate(140%);
  box-shadow:0 8px 32px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.03);
}
.panel-title{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:16px; }
.panel-title h2{ margin:0; font-size:15px; letter-spacing:1.5px; text-transform:uppercase; color:var(--cyan); font-weight:600; }
.panel-note{ font-size:11px; color:var(--text-dim); font-family:var(--mono); }

/* ---------- gauges ---------- */
.gauge-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:18px; }
@media (max-width:900px){ .gauge-row{ grid-template-columns:repeat(2,1fr); } }

.gauge-card{ display:flex; flex-direction:column; align-items:center; gap:10px; }
.gauge{ width:120px; height:120px; transform:rotate(-90deg); }
.gauge-track{ fill:none; stroke:rgba(255,255,255,.06); stroke-width:10; }
.gauge-arc{
  fill:none; stroke:var(--cyan); stroke-width:10; stroke-linecap:round;
  stroke-dasharray:364.4; stroke-dashoffset:364.4;
  filter:drop-shadow(0 0 6px var(--cyan));
  transition:stroke-dashoffset .6s ease, stroke .4s ease;
}
.gauge-arc--mem{ stroke:var(--teal); filter:drop-shadow(0 0 6px var(--teal)); }
.gauge-arc--disk{ stroke:#a586ff; filter:drop-shadow(0 0 6px #a586ff); }
.gauge-label{ display:flex; flex-direction:column; align-items:center; margin-top:-92px; }
.gauge-value{ font-family:var(--mono); font-size:24px; font-weight:700; }
.gauge-name{ font-size:11px; letter-spacing:1.5px; color:var(--text-dim); margin-top:2px; }

.gauge-card--net{ justify-content:center; }
.net-badge{ display:flex; flex-direction:column; align-items:center; }
.net-value{ font-family:var(--mono); font-size:24px; font-weight:700; color:var(--cyan); }
.spark{ width:150px; height:44px; margin-top:6px; }

/* ---------- charts ---------- */
.chart-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:18px; }
@media (max-width:820px){ .chart-grid{ grid-template-columns:1fr; } }
.chart-box-title{ font-size:11px; letter-spacing:1px; color:var(--text-dim); font-family:var(--mono); margin-bottom:6px; }
.chart{ width:100%; height:100px; background:rgba(255,255,255,.02); border-radius:8px; }

/* ---------- network map ---------- */
.netmap{ width:100%; height:220px; }

/* ---------- iot / health ---------- */
.iot-stats{ display:flex; justify-content:space-around; }
.iot-stat{ display:flex; flex-direction:column; align-items:center; gap:4px; }
.iot-num{ font-family:var(--mono); font-size:30px; font-weight:700; }
.iot-num--ok{ color:var(--teal); }
.iot-num--warn{ color:var(--amber); }
.iot-num--alert{ color:var(--red); }
.iot-label{ font-size:11px; color:var(--text-dim); letter-spacing:1px; text-transform:uppercase; }

.health-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.health-list li{ display:flex; justify-content:space-between; font-size:13px; border-bottom:1px dashed rgba(255,255,255,.06); padding-bottom:8px; }
.health-key{ color:var(--text-dim); }
.health-val{ font-family:var(--mono); }
.dot{ display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:6px; }
.dot--muted{ background:var(--text-dim); }
.dot--ok{ background:var(--teal); box-shadow:0 0 6px var(--teal); }
.dot--warn{ background:var(--amber); box-shadow:0 0 6px var(--amber); }

/* ---------- events ---------- */
.events-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; font-family:var(--mono); font-size:13px; }
.event-row{ display:flex; align-items:center; gap:10px; color:var(--text-dim); }
.event-row .event-icon{ width:16px; text-align:center; }
.event-row.ok .event-icon{ color:var(--teal); }
.event-row.warn .event-icon{ color:var(--amber); }
.event-row.error .event-icon{ color:var(--red); }
.event-time{ margin-left:auto; opacity:.6; }

/* ---------- login modal ---------- */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(0,4,10,.65); backdrop-filter:blur(4px);
  display:none; align-items:center; justify-content:center; z-index:100;
}
.modal-backdrop.open{ display:flex; }
.modal{
  background:#0d1f33; border:1px solid var(--panel-border); border-radius:14px;
  padding:26px 28px; width:300px; box-shadow:0 20px 60px rgba(0,0,0,.5);
}
.modal h3{ margin:0 0 6px; color:var(--cyan); }
.modal-note{ font-size:12px; color:var(--text-dim); margin:0 0 16px; line-height:1.4; }
.modal label{ display:block; font-size:12px; color:var(--text-dim); margin-bottom:12px; }
.modal input{
  display:block; width:100%; margin-top:5px; padding:8px 10px; border-radius:6px;
  border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.04); color:var(--text);
  font-family:var(--sans);
}
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:6px; }
.btn-ghost, .btn-primary{
  border-radius:7px; padding:8px 14px; font-size:13px; cursor:pointer; border:1px solid transparent;
}
.btn-ghost{ background:transparent; color:var(--text-dim); border-color:rgba(255,255,255,.12); }
.btn-primary{ background:var(--cyan); color:#04141f; font-weight:600; }
.modal-result{ font-size:12px; color:var(--amber); min-height:16px; margin:10px 0 0; }
