:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1c2330; --muted: #5d6675; --line: #d6dae1; --accent: #1f5fbf;
  --bad-bg: #fde8e6; --bad-ink: #7a1a12;
  --aro: #1f5fbf; --x40: #b3541e; --other: #5a3fa0; --stale: #8b929e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --panel: #1b212b; --ink: #e7eaf0; --muted: #a2abb9; --line: #323a47; --accent: #6ea4f4;
    --bad-bg: #4a1e1a; --bad-ink: #ffd5cf;
    --aro: #6ea4f4; --x40: #f0a070; --other: #b9a2f0; --stale: #7a8190;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --panel: #1b212b; --ink: #e7eaf0; --muted: #a2abb9; --line: #323a47; --accent: #6ea4f4;
  --bad-bg: #4a1e1a; --bad-ink: #ffd5cf;
  --aro: #6ea4f4; --x40: #f0a070; --other: #b9a2f0; --stale: #7a8190;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
h1 { font-size: 18px; margin: 0; }
h2, h3, h4 { margin: 12px 0 4px; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 0; }
h4 { font-size: 13px; color: var(--muted); }
nav { display: flex; gap: 12px; }
nav a { color: var(--accent); text-decoration: none; padding: 2px 6px; border-radius: 4px; }
nav a:hover, nav a:focus-visible { text-decoration: underline; }
.picker { display: flex; align-items: center; gap: 6px; color: var(--muted); }
select, button { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
button { cursor: pointer; }
.spacer { flex: 1; }
#banner { padding: 8px 16px; background: var(--bad-bg); color: var(--bad-ink); }
main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; padding: 16px; }
@media (max-width: 800px) { main { grid-template-columns: 1fr; } }
#mapbox { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; align-items: center; justify-content: center; min-height: 240px; }
#mapwrap { position: relative; line-height: 0; width: min(100%, calc(75vh * var(--ratio, 1))); aspect-ratio: var(--ratio, 1); }
#mapimg { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#mapnote { color: var(--muted); }
aside { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; align-self: start; }
#robots { list-style: none; padding: 0; margin: 0; }
.robot { padding: 8px; border: 1px solid var(--line); border-left-width: 5px; border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.robot.selected { outline: 2px solid var(--accent); }
.robot.fresh { border-left-color: var(--accent); }
.robot.stale, .robot.offline { border-left-color: var(--stale); color: var(--muted); }
.robot.empty { border: none; cursor: default; color: var(--muted); }
.marker { cursor: pointer; }
.marker circle { fill: var(--other); stroke: var(--panel); stroke-width: 2; }
.marker path { fill: var(--panel); stroke: var(--other); stroke-width: 1.5; stroke-linejoin: round; }
.marker.aro circle { fill: var(--aro); } .marker.aro path { stroke: var(--aro); }
.marker.x40 circle { fill: var(--x40); } .marker.x40 path { stroke: var(--x40); }
.marker text { fill: var(--ink); stroke: var(--panel); stroke-width: 3px; paint-order: stroke; text-anchor: middle; font-weight: 600; }
.marker.dim circle { fill: var(--stale); }
.marker.dim path { stroke: var(--stale); }
.marker.offline { opacity: .55; }
.marker.offline circle { stroke-dasharray: 3 2; }
.marker.selected circle { stroke: var(--ink); stroke-width: 3; }
.marker:focus-visible circle { stroke: var(--ink); stroke-width: 3; }
#d-next { margin: 0; padding-left: 18px; }
footer { padding: 8px 16px; color: var(--muted); font-size: 12px; }
