:root {
  --bg: #0b1020;
  --panel: #11182b;
  --panel-2: #151e34;
  --text: #eef3ff;
  --muted: #8f9bb8;
  --accent: #4f8cff;
  --accent-2: #25c2a0;
  --border: rgba(255,255,255,.08);
  --danger: #ff6b6b;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top right, #14244a 0, var(--bg) 34%);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: rgba(8, 13, 27, .88);
  backdrop-filter: blur(16px);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 36px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #765dff);
  box-shadow: 0 10px 28px rgba(79,140,255,.28);
}
.brand strong { display: block; font-size: 15px; }
.brand span { color: var(--muted); font-size: 11px; }

.nav { display: grid; gap: 8px; }
.nav-item {
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  transition: .2s ease;
}
.nav-item:hover, .nav-item.active { background: rgba(79,140,255,.12); color: #fff; }
.sidebar-footer { margin-top: auto; color: var(--muted); font-size: 12px; display:flex; align-items:center; gap:8px; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; display:inline-block; }
.status-dot.online { background: #2dd4a3; box-shadow: 0 0 0 4px rgba(45,212,163,.12); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,107,107,.1); }

.main-content { padding: 32px; max-width: 1600px; width: 100%; margin: 0 auto; }
.topbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:24px; }
.eyebrow, .panel-kicker { margin:0 0 6px; font-size:11px; letter-spacing:.16em; color:#6f8bc7; font-weight:800; }
h1 { margin:0; font-size:30px; letter-spacing:-.02em; }
.topbar-right { display:flex; align-items:center; gap:18px; }
.last-update { text-align:right; }
.last-update span { display:block; color:var(--muted); font-size:11px; }
.last-update strong { font-size:12px; }
.avatar { width:40px; height:40px; border-radius:50%; display:grid; place-items:center; font-size:12px; font-weight:800; background:#1c2a48; border:1px solid var(--border); }

.hero-card {
  display:flex; justify-content:space-between; gap:30px; align-items:center;
  padding:30px; border-radius:20px;
  background: linear-gradient(130deg, rgba(79,140,255,.20), rgba(17,24,43,.88) 45%, rgba(37,194,160,.08));
  border:1px solid rgba(110,150,255,.18); box-shadow:var(--shadow);
}
.hero-card h2 { margin:14px 0 8px; font-size:26px; }
.hero-card p { margin:0; color:var(--muted); max-width:720px; line-height:1.6; }
.pill { display:inline-flex; padding:6px 10px; border-radius:999px; background:rgba(37,194,160,.12); color:#5ce5c7; font-size:11px; font-weight:800; }
.hero-device { min-width:230px; padding:18px; border-radius:16px; background:rgba(8,13,27,.6); border:1px solid var(--border); }
.hero-device span, .hero-device small { display:block; color:var(--muted); }
.hero-device strong { display:block; margin:7px 0; font-size:18px; }
.hero-device small { color:#5ce5c7; }

.metrics-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin:20px 0; }
.metric-card, .panel { background:rgba(17,24,43,.88); border:1px solid var(--border); border-radius:18px; box-shadow:0 12px 36px rgba(0,0,0,.18); }
.metric-card { padding:20px; }
.metric-label { color:var(--muted); font-size:12px; }
.metric-value { display:flex; align-items:baseline; gap:8px; margin:12px 0 10px; }
.metric-value span { font-size:30px; font-weight:800; letter-spacing:-.03em; }
.metric-value small { color:#8da4d2; font-size:13px; }
.metric-foot { color:var(--muted); font-size:11px; }
.metric-foot.positive { color:#5ce5c7; }

.content-grid { display:grid; grid-template-columns:2fr 1fr; gap:16px; margin-bottom:16px; }
.lower-grid { grid-template-columns:1fr 1fr; }
.panel { padding:22px; }
.panel-header { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin-bottom:18px; }
.panel-header h3 { margin:0; font-size:18px; }
select { background:#0d1528; color:var(--text); border:1px solid var(--border); border-radius:10px; padding:9px 12px; }
.chart-panel canvas { width:100% !important; max-height:320px; }

.signal-row { padding:16px 0; border-bottom:1px solid var(--border); }
.signal-row > div:first-child { display:flex; justify-content:space-between; gap:20px; margin-bottom:9px; }
.signal-row span { color:var(--muted); font-size:12px; }
.signal-row strong { font-size:14px; }
.signal-bar { height:8px; background:#0a1122; border-radius:999px; overflow:hidden; }
.signal-bar span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg, var(--accent), var(--accent-2)); }
.device-info { display:grid; gap:12px; margin-top:18px; }
.device-info div { display:flex; justify-content:space-between; gap:16px; }
.device-info span { color:var(--muted); font-size:12px; }
.device-info strong { font-size:12px; }

.device-list { display:grid; }
.device-row { display:flex; justify-content:space-between; align-items:center; padding:14px 0; border-bottom:1px solid var(--border); color:var(--muted); font-size:12px; }
.device-row:last-child { border-bottom:0; }
.device-row > div { display:flex; align-items:center; gap:10px; }
.device-row strong { color:var(--text); font-size:13px; }
.alarm.empty { min-height:140px; display:flex; align-items:center; justify-content:center; gap:16px; color:var(--muted); }
.alarm-icon { width:42px; height:42px; border-radius:50%; display:grid; place-items:center; background:rgba(37,194,160,.12); color:#5ce5c7; font-weight:900; }
.alarm strong, .alarm span { display:block; }
.alarm strong { color:var(--text); margin-bottom:5px; }
.alarm span { font-size:12px; }

footer { display:flex; justify-content:space-between; gap:20px; color:var(--muted); font-size:11px; padding:10px 2px 0; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position:relative; height:auto; border-right:0; border-bottom:1px solid var(--border); }
  .nav { grid-template-columns: repeat(5, auto); overflow:auto; }
  .sidebar-footer { display:none; }
  .metrics-grid { grid-template-columns:repeat(2,1fr); }
  .content-grid { grid-template-columns:1fr; }
}

@media (max-width: 650px) {
  .main-content { padding:20px 14px; }
  .topbar { align-items:flex-start; gap:14px; }
  .last-update { display:none; }
  .hero-card { flex-direction:column; align-items:stretch; }
  .metrics-grid { grid-template-columns:1fr; }
  .nav { grid-template-columns:1fr 1fr; }
  .topbar h1 { font-size:24px; }
  .hero-card h2 { font-size:22px; }
  footer { flex-direction:column; }
}
