:root {
  --bg: #ffffff; --fg: #1d2330; --muted: #667085; --line: #d9dee7; --panel: #f6f7f9; --accent: #1f6feb;
  --pass: #1a9e5c; --near: #e3a008; --insufficient: #8b5cf6; --pending: #9aa7b8; --fail: #e8a3a3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b; --fg: #e6e9ef; --muted: #98a2b3; --line: #2b3442; --panel: #161d26; --accent: #4c8dff;
    --fail: #7a3b3b; --pending: #4b5666;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b; --fg: #e6e9ef; --muted: #98a2b3; --line: #2b3442; --panel: #161d26; --accent: #4c8dff;
  --fail: #7a3b3b; --pending: #4b5666;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { padding: 8px 16px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
h1 { font-size: 17px; margin: 0; }
h2 { font-size: 14px; margin: 0 0 6px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
select, input, button { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
button { cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.statuses { display: flex; flex-wrap: wrap; gap: 6px; }
.statuses label, .chk { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
main { display: flex; height: calc(100% - 52px); }
#map { flex: 1; min-width: 0; }
#side { width: 380px; max-width: 100%; overflow: auto; border-left: 1px solid var(--line); background: var(--panel); padding: 12px 16px; }
#side section { margin-bottom: 16px; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg); }
.stack td:first-child { color: var(--muted); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; color: #fff; font-size: 12px; }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); max-width: 720px; width: calc(100% - 32px); }
#settingsGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; }
#settingsGrid label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
#settingsGrid input { width: 100%; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (max-width: 760px) {
  main { flex-direction: column; height: auto; }
  #map { height: 60vh; }
  #side { width: 100%; border-left: 0; border-top: 1px solid var(--line); }
}
