:root {
  --bg: #0f1419; --panel: #1a222c; --panel2: #232e3b; --line: #2d3a49;
  --text: #e6edf3; --muted: #8b98a8; --accent: #3b82f6; --ok: #22c55e;
  --warn: #f59e0b; --bad: #ef4444;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
button { cursor: pointer; border: none; border-radius: 8px; padding: 9px 14px;
  background: var(--accent); color: #fff; font-size: 14px; }
button.ghost { background: var(--panel2); color: var(--text); }
button:hover { filter: brightness(1.1); }
input { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 15px; }
.err { color: var(--bad); min-height: 18px; margin: 4px 0 0; }

/* LOGIN */
.login-wrap { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--panel); padding: 32px; border-radius: 16px; width: 320px;
  display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); }
.login-card h1 { margin: 0 0 8px; font-size: 20px; }

/* APP */
header { display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
header h1 { font-size: 18px; margin: 0; }
.spacer { flex: 1; }
#who { color: var(--muted); font-size: 14px; }
main { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 57px); }
aside { border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; }
#detail { overflow-y: auto; padding: 20px; }
#detail.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); }

.dev { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin-bottom: 10px; cursor: pointer; }
.dev:hover { border-color: var(--accent); }
.dev.active { border-color: var(--accent); background: var(--panel2); }
.dev .row { display: flex; align-items: center; gap: 8px; }
.dev .name { font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--ok); } .dot.off { background: var(--muted); }
.dev .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.batt { font-variant-numeric: tabular-nums; }
.batt.low { color: var(--bad); } .batt.mid { color: var(--warn); } .batt.ok { color: var(--ok); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card .v { font-size: 22px; font-weight: 700; margin-top: 4px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.toolbar .chase { background: var(--bad); }
.panelbox { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panelbox h3 { margin: 0 0 12px; font-size: 15px; }
#map { height: 360px; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.bar { height: 6px; background: var(--accent); border-radius: 3px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 20px; background: var(--panel2); color: var(--muted); }
.tag.chase { background: #4a1d1d; color: #fca5a5; }
.tag.normal { background: #1d3a2a; color: #86efac; }

@media (max-width: 760px) {
  main { grid-template-columns: 1fr; height: auto; }
  aside { border-right: none; border-bottom: 1px solid var(--line); max-height: 40vh; }
}
