:root {
  color-scheme: dark;
  --bg: #0d0f13;
  --panel: #15181f;
  --panel2: #1a1e26;
  --line: #292e39;
  --text: #f4f6f8;
  --muted: #9299a6;
  --good: #77d68a;
  --warn: #f1c75b;
  --bad: #ef7575;
  --accent: #91b5ff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px max(24px, calc((100vw - 1380px)/2)); background: rgba(13,15,19,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.brand { font-size: 23px; font-weight: 800; letter-spacing: -.5px; }
.subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.top-status { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 12px rgba(119,214,138,.55); }
.dot.error { background: var(--bad); box-shadow: none; }
main { width: min(1380px, calc(100% - 48px)); margin: 28px auto 60px; }
.system-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 36px; }
.system-card { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.system-card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.system-card strong { font-size: 22px; }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 14px; }
h1,h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.section-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.sensor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(305px, 1fr)); gap: 12px; }
.sensor-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; cursor: pointer; transition: border-color .15s, transform .15s, background .15s; }
.sensor-card:hover { border-color: #454d5d; transform: translateY(-1px); background: #171b22; }
.sensor-card.selected { border-color: var(--accent); }
.sensor-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.sensor-name { font-weight: 800; font-size: 17px; }
.sensor-age { color: var(--muted); font-size: 11px; margin-top: 4px; }
.status-pill { font-size: 10px; padding: 5px 8px; border-radius: 999px; background: rgba(119,214,138,.1); color: var(--good); border: 1px solid rgba(119,214,138,.25); }
.status-pill.stale { color: var(--warn); border-color: rgba(241,199,91,.25); background: rgba(241,199,91,.08); }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric { min-height: 82px; padding: 12px; background: var(--panel2); border: 1px solid #242934; border-radius: 12px; }
.metric-label { color: var(--muted); font-size: 11px; }
.metric-value { font-size: 25px; font-weight: 750; margin-top: 4px; letter-spacing: -.6px; }
.metric-range { color: var(--muted); font-size: 10px; margin-top: 3px; }
.battery-low { color: var(--bad); }
.details { margin-top: 42px; }
.details-title { align-items: center; }
.range-switch { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.range-switch button { color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 7px 11px; cursor: pointer; font: inherit; font-size: 11px; }
.range-switch button.active { color: var(--text); background: #272c36; }
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; min-width: 0; }
.chart-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.chart-heading strong { color: var(--text); font-size: 15px; }
.chart { height: 185px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.grid-line { stroke: #292e39; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.3; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(145,181,255,.07); }
.chart-label { fill: #747c8b; font-size: 9px; }
.chart-empty { color: var(--muted); display: grid; place-items: center; height: 100%; font-size: 12px; }
.table-card { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.table-title { padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th,td { text-align: left; padding: 11px 16px; border-bottom: 1px solid #222731; font-size: 12px; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #13161c; }
td { color: #d8dce3; }
tbody tr:last-child td { border-bottom: 0; }
.empty { border: 1px dashed var(--line); border-radius: 16px; padding: 40px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
@media (max-width: 900px) { .system-grid { grid-template-columns: repeat(2, 1fr); } .charts-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { main { width: min(100% - 24px, 1380px); margin-top: 18px; } .topbar { padding: 15px 12px; } .system-grid { gap: 8px; } .system-card { padding: 13px; } .system-card strong { font-size: 18px; } .sensor-grid { grid-template-columns: 1fr; } .details-title { align-items: flex-start; flex-direction: column; } }
