:root {
  --bg: #ffffff;
  --fg: #16181d;
  --muted: #646a75;
  --line: #e3e5e9;
  --accent: #e4572e;
  --route: #2b6cb0;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --bad: #c53030;
  --panel-shadow: 0 -4px 24px rgb(0 0 0 / 0.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171b;
    --fg: #eceef2;
    --muted: #9aa1ad;
    --line: #2a2e35;
    --route: #63a4ff;
    --ok: #48bb78;
    --warn: #ecc94b;
    --bad: #fc8181;
    --panel-shadow: 0 -4px 24px rgb(0 0 0 / 0.5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#map { position: fixed; inset: 0; }

#panel {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 52vh; overflow-y: auto;
  background: var(--bg); border-radius: 14px 14px 0 0; box-shadow: var(--panel-shadow);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); z-index: 1000;
}
/* Phones: map fills the area above the panel so the runner is never hidden. */
@media (max-width: 899px) {
  #map { bottom: calc(46vh - 14px); }
  #panel { height: 46vh; max-height: none; }
}
@media (min-width: 900px) {
  #map { right: 384px; }
  #panel { left: auto; top: 12px; right: 12px; bottom: 12px; width: 360px; max-height: none;
    border-radius: 14px; }
}

header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.eyebrow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.big { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }

.fix { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  border: 1px solid currentColor; }
.fix.fresh { color: var(--ok); }
.fix.aging { color: var(--warn); }
.fix.stale { color: var(--bad); }

.bar { height: 6px; background: var(--line); border-radius: 3px; margin: 10px 0 12px; overflow: hidden; }
#progress { height: 100%; width: 0; background: var(--accent); transition: width .6s; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 8px; }
.stats div { min-width: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.banner { background: color-mix(in srgb, var(--warn) 18%, transparent); border-radius: 8px;
  padding: 8px 10px; margin: 8px 0; font-size: 13px; }

h2 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 6px; }
.crew { list-style: none; margin: 0; padding: 0; }
.crew li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0;
  border-top: 1px solid var(--line); cursor: pointer; }
.crew li.passed { opacity: .45; }
.crew .name { font-weight: 600; }
.crew .eta { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.crew .sub { font-size: 12px; color: var(--muted); }
.crew .sub.right { text-align: right; }

.settings { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.settings summary { cursor: pointer; color: var(--muted); }
.settings label { display: block; margin: 10px 0; font-size: 13px; }
.settings label.check { display: flex; gap: 8px; align-items: center; }
.settings input[type=number] { display: block; margin-top: 4px; width: 100px; padding: 6px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
button { font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); cursor: pointer; }
button:hover { border-color: var(--muted); }

/* Map markers */
.runner { width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  border: 3px solid #fff; box-shadow: 0 0 0 2px var(--accent); }
.runner.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 2px var(--accent); } 70% { box-shadow: 0 0 0 14px transparent; } 100% { box-shadow: 0 0 0 2px transparent; } }
.crewpin { background: #fff; color: #16181d; border: 2px solid var(--route); border-radius: 6px;
  font-size: 11px; font-weight: 700; padding: 1px 5px; white-space: nowrap; transform: translate(-50%, -50%);
  display: inline-block; }
.kmtick { color: var(--route); font-size: 10px; font-weight: 700; text-shadow: 0 0 3px #fff, 0 0 3px #fff;
  transform: translate(-50%, -50%); display: inline-block; }
.leaflet-div-icon { background: none; border: none; }
