:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #1c2228;
  --muted: #5f6b76;
  --line: #dde2e7;
  --accent: #1f6feb;
  --fresh: #1a7f37;
  --recent: #bf8700;
  --stale: #8c959f;
  --danger: #cf222e;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --panel: #161c22;
    --text: #e6edf3;
    --muted: #8b98a5;
    --line: #2d3640;
    --accent: #4493f8;
    --fresh: #3fb950;
    --recent: #d29922;
    --stale: #6e7681;
    --danger: #f85149;
  }
}
* { box-sizing: border-box; }
/* `hidden` must win over any display rule (the bar is display: flex). */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
button, input, select {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
}
button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.5; cursor: default; }

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.bar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.bar nav a { padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--text); }
.bar nav a.active { background: var(--bg); font-weight: 600; }
.who { color: var(--muted); }

.notice { padding: 8px 16px; background: var(--danger); color: #fff; }
.demo-banner { padding: 6px 16px; background: var(--accent); color: #fff; font-size: 14px; }
/* A demonstration system refuses changes; don't offer them. */
body.demo .edit { display: none !important; }
.notice.ok { background: var(--fresh); }

main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page { padding: 16px; max-width: 1200px; width: 100%; margin: 0 auto; overflow: auto; }
.loading, .empty { color: var(--muted); padding: 16px; }
h2 { font-size: 18px; margin: 8px 0 12px; }
h3 { font-size: 15px; margin: 20px 0 8px; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; text-align: right; }
td.actions > * { margin-left: 6px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.tag.off { color: var(--danger); border-color: var(--danger); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.dot.fresh { background: var(--fresh); }
.dot.recent { background: var(--recent); }
.dot.stale { background: var(--stale); }

/* Sign-in */
.signin { max-width: 360px; margin: 10vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.signin h1 { font-size: 20px; margin: 0 0 16px; }
.signin label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.signin input { width: 100%; }
.signin button { width: 100%; margin-top: 16px; }
.signin .error { color: var(--danger); margin-top: 12px; min-height: 1.4em; }

/* Map views */
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; }
.split aside { border-right: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 12px; min-width: 0; }
.split .map { min-height: 400px; }
@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; grid-template-rows: auto 60vh; }
  .split aside { border-right: none; border-bottom: 1px solid var(--line); max-height: 40vh; }
}
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px; border-radius: 6px; cursor: pointer; }
.list li:hover, .list li.selected { background: var(--bg); }
.list .sub { font-size: 13px; color: var(--muted); }

.marker {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
  cursor: pointer;
}
.marker.fresh { background: var(--fresh); }
.marker.recent { background: var(--recent); }
.marker.stale { background: var(--stale); }
.maplibregl-popup-content { color: #1c2228; font-size: 14px; }

.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.controls select { max-width: 100%; min-width: 0; }
.secret { background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 12px; margin: 12px 0; word-break: break-all; }
