:root {
  --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #33332f;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --muted: #8f8e86;
  --accent: #3987e5; --accent-2: #2a78d6; --series-1: #3987e5;
  --good: #0ca30c; --warning: #fab219; --critical: #d03b3b;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text-primary); }
body { display: flex; flex-direction: column; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface-1); }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand strong { font-size: 16px; }
.dot { width: 18px; height: 6px; border-radius: 3px; background: var(--accent); display: inline-block; align-self: center; }
.status { flex: 1; color: var(--text-secondary); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 8px; }
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 380px; flex: none; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; border-right: 1px solid var(--border); }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.card h2 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.map { height: 240px; border-radius: 6px; border: 1px solid var(--border); }
.map.drawing { cursor: crosshair; }
button, .button, select {
  background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
button:hover, .button:hover { border-color: #55554f; }
button.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
button.primary:hover { background: var(--accent); }
button.ghost, .button.ghost { background: transparent; }
button:disabled { opacity: .45; cursor: default; }
select { flex: 1; min-width: 0; }
input[type="range"] { flex: 1; accent-color: var(--accent); }
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; margin: 4px 0; color: var(--text-secondary); }
details summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.badge { background: var(--warning); color: #111; border-radius: 9px; padding: 0 6px; font-size: 11px; font-weight: 600; }
.log { margin: 6px 0 0; padding-left: 16px; font-size: 12px; color: var(--text-secondary); max-height: 180px; overflow: auto; }
.log li.warn { color: var(--warning); }
.log li.warn::marker { content: "⚠ "; }
.clock { display: flex; align-items: baseline; gap: 8px; }
.clock .mono { font-size: 22px; }
.progress { height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin: 6px 0 10px; }
.progress div { height: 100%; width: 0; background: var(--accent); }
.kpis { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 10px; margin: 0 0 8px; }
.kpis div { min-width: 0; }
.kpis dt { font-size: 11px; color: var(--muted); }
.kpis dd { margin: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.chart { position: relative; margin-top: 8px; }
.chart .title { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.chart svg { display: block; width: 100%; height: 90px; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; font-size: 11px; white-space: nowrap; transform: translate(-50%, -110%); }
.viewport { position: relative; flex: 1; min-width: 0; }
.scene { position: absolute; inset: 0; }
.scene canvas { display: block; }
.legend { position: absolute; left: 12px; bottom: 12px; background: rgba(26,26,25,.88); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12px; color: var(--text-secondary); }
.legend-title { color: var(--text-primary); margin-bottom: 4px; }
.legend .sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.hint { position: absolute; right: 12px; bottom: 30px; background: rgba(26,26,25,.75); padding: 4px 8px; border-radius: 4px; }
.attribution { position: absolute; right: 12px; bottom: 8px; color: var(--muted); }
.attribution a { color: var(--text-secondary); }
.inspector { position: absolute; right: 12px; top: 12px; width: 330px; background: rgba(26,26,25,.94); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; max-height: calc(100% - 80px); overflow: auto; }
.inspector h3 { margin: 0 0 6px; font-size: 14px; }
.inspector .close { position: absolute; right: 6px; top: 6px; padding: 2px 8px; }
.inspector table { width: 100%; border-collapse: collapse; font-size: 12px; }
.inspector td { padding: 2px 0; color: var(--text-secondary); }
.inspector td:last-child { text-align: right; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.inspector pre { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 6px; font-size: 11px; white-space: pre-wrap; word-break: break-all; margin: 6px 0; }
.inspector input[type="number"] { width: 80px; background: var(--bg); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; padding: 4px; }
.busy { position: absolute; inset: 0; background: rgba(18,18,17,.6); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-secondary); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.leaflet-container { background: #222; }
[hidden] { display: none !important; }
.mode { font-size: 12px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.mode.remote { border-color: var(--accent); color: var(--text-primary); }
