:root {
  --bg: #1b1d22; --panel: #23262d; --panel2: #2b2f37; --fg: #e6e6e6; --muted: #9aa0a8;
  --accent: #4fc3f7; --accent2: #ffb74d; --border: #353a44; --danger: #ef5350;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 13px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden; }
#map { position: absolute; inset: 0; }
#sidebar {
  position: absolute; top: 12px; left: 12px; bottom: 12px; width: 340px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  display: flex; flex-direction: column; box-shadow: 0 4px 24px rgba(0,0,0,.4); z-index: 2;
}
#sidebar header { padding: 10px 12px 0; border-bottom: 1px solid var(--border); }
#sidebar h1 { font-size: 15px; margin: 0 0 8px; font-weight: 600; letter-spacing: .02em; }
#tabs { display: flex; gap: 4px; }
#tabs button { background: none; border: 0; color: var(--muted); padding: 6px 10px; cursor: pointer;
  border-bottom: 2px solid transparent; font-size: 13px; }
#tabs button.active { color: var(--fg); border-bottom-color: var(--accent); }
#panels { flex: 1; overflow-y: auto; padding: 10px 12px; }
#panels > section[hidden] { display: none; }
#status { padding: 6px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; min-height: 28px; }
/* min-width: 0 overrides the UA's min-content floor on fieldsets: without it one long
   route name widens the whole panel and everything past it is clipped. */
fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 10px; padding: 8px 10px;
  min-width: 0; }
legend { color: var(--muted); padding: 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
label { display: block; margin: 4px 0; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.row > * { flex: 1 1 0; min-width: 0; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=datetime-local], select {
  background: var(--panel2); color: var(--fg); border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px;
  font: inherit; width: 100%; }
select[multiple] { height: 130px; }
/* Route picker: checkboxes, so one click toggles one route and a second click undoes it. */
.checklist { max-height: 150px; overflow-y: auto; overflow-x: hidden; min-width: 0; border: 1px solid var(--border); border-radius: 4px;
  background: var(--panel2); padding: 2px 4px; }
.checklist label.check { display: flex; align-items: center; gap: 6px; margin: 0; padding: 2px 2px;
  white-space: nowrap; overflow: hidden; cursor: pointer; min-width: 0; }
.checklist label.check:hover { color: var(--accent); }
.checklist label.check input { flex: none; }
.checklist label.check > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.row.between > *:first-child { flex: 1 1 auto; }
.row.between > *:last-child { flex: 0 0 auto; }
button.link { background: none; border: none; color: var(--muted); padding: 0 2px; font-size: 12px;
  text-decoration: underline; }
button.link:hover { color: var(--danger); }
button, .btn { background: var(--panel2); color: var(--fg); border: 1px solid var(--border); border-radius: 4px;
  padding: 5px 10px; cursor: pointer; font: inherit; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
button.live.on { background: var(--danger); color: #fff; border-color: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 1px 8px; cursor: pointer; }
.chip:hover { border-color: var(--danger); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.card { background: var(--panel2); border-radius: 6px; padding: 8px; margin: 6px 0; }
.card h3 { margin: 0 0 4px; font-size: 13px; }
.results { max-height: 160px; overflow: auto; }
.results div { padding: 2px 4px; cursor: pointer; }
.results div:hover { background: var(--panel2); }

#timeline {
  position: absolute; left: 364px; right: 12px; bottom: 12px; height: 56px; z-index: 2;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  display: flex; align-items: center; gap: 8px; padding: 0 12px; box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
#timeline[hidden] { display: none; }
#timeline input[type=range] { flex: 1; accent-color: var(--accent); }
#timeline .clock { font-variant-numeric: tabular-nums; min-width: 190px; text-align: right; }
#timeline .clock b { color: var(--accent2); }
#timeline select { width: auto; }
@media (max-width: 700px) {
  #sidebar { width: calc(100vw - 24px); bottom: auto; max-height: 55vh; }
  #timeline { left: 12px; }
}
.deck-tooltip { font-size: 12px !important; background: rgba(20,22,28,.95) !important; color: #eee !important;
  border-radius: 4px; padding: 6px 8px !important; max-width: 300px; }
