:root {
  --bg: #0f1419;
  --panel: #1a2230;
  --panel-2: #232d3d;
  --ink: #e6edf3;
  --muted: #9fb0c3;
  --accent: #4ea1ff;
  --danger: #ff6b6b;
  --ok: #4caf7d;
  --border: #2c3a4d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.session {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.banner {
  margin: 0.75rem 1.25rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid var(--danger);
  color: #ffd9d9;
  font-size: 0.9rem;
}

.banner.ok {
  background: rgba(76, 175, 125, 0.12);
  border-color: var(--ok);
  color: #d6ffe9;
}

.view {
  padding: 1.25rem;
}

.dash {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}

.card h2 {
  margin-top: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.stack.inline {
  flex-direction: row;
  align-items: center;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 0.95rem;
}

button {
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #06121f;
  font-weight: 600;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--accent);
}

button.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
}

.list li.active {
  border-color: var(--accent);
}

.list .name {
  cursor: pointer;
  flex: 1;
}

.subsection {
  margin-top: 1.1rem;
}

.subsection h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--muted);
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0 0.6rem;
}

#map {
  width: 100%;
  height: 360px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.status {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* Live-view freshness words mirror the map dot colors: live=green, stale=amber,
   lost=red — the safety signal is legible in the list even off the map. */
.status.live-live {
  color: #2ecc71;
  border-color: #2ecc71;
}

.status.live-stale {
  color: #f1c40f;
  border-color: #f1c40f;
}

.status.live-lost {
  color: #e74c3c;
  border-color: #e74c3c;
}

/* Replay transport (S04): play/pause + timeline scrubber + elapsed clock. */
.transport {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.transport #timeline {
  flex: 1;
}

.transport .meta {
  margin: 0;
  min-width: 3.5rem;
  text-align: right;
}

/* Per-rider legend color swatch on the replay page. */
.swatch {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
