:root {
  --navy: #07152f;
  --panel: #0b1834;
  --panel-2: #101f41;
  --line: rgba(148,174,222,.24);
  --cyan: #62dfff;
  --red: #ed294c;
  --green: #35d399;
  --muted: #a8bad7;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: #eef6ff;
  background: var(--navy);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.map-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #07152f, #0e1e42);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  padding: 4px;
  border-radius: 10px;
  background: #fff;
}

.brand span { display: grid; gap: 2px; }
.brand strong { font-size: 18px; }
.brand small { color: var(--muted); font-size: 11px; }

.map-page-actions { display: flex; align-items: center; gap: 12px; }
.map-page-actions span { color: var(--muted); font-size: 12px; }
.map-page-actions a, button {
  min-height: 38px;
  border: 1px solid rgba(98,223,255,.32);
  border-radius: 8px;
  padding: 9px 12px;
  color: #e7fbff;
  background: rgba(98,223,255,.1);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.map-page-actions a:hover, button:hover { background: rgba(98,223,255,.18); }

.map-page-shell {
  display: grid;
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  height: calc(100% - 74px);
}

.map-page-panel {
  overflow: auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), #07142d);
}

.map-page-panel section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

h1, h2 { margin: 0 0 8px; letter-spacing: 0; }
h1 { font-size: 25px; }
h2 { font-size: 16px; }
p { margin: 0 0 14px; color: var(--muted); line-height: 1.55; }

.map-control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: #b9c9e2;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

input, select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(148,174,222,.28);
  border-radius: 8px;
  padding: 9px 10px;
  color: #fff;
  background: #0a142b;
  outline: none;
}

.button-row { display: flex; gap: 8px; margin-top: 12px; }
.button-row button { flex: 1; }
#btnTraceRoute { width: 100%; margin-top: 12px; }

.route-summary {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(98,223,255,.2);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(98,223,255,.06);
  font-size: 12px;
  line-height: 1.45;
}

.rider-list { display: grid; gap: 8px; }
.rider-card {
  padding: 11px;
  border: 1px solid rgba(148,174,222,.2);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  cursor: pointer;
}
.rider-card strong { display: block; color: #fff; }
.rider-card span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.rider-card.live { border-color: rgba(53,211,153,.38); box-shadow: inset 3px 0 0 var(--green); }
.rider-card.stale { border-color: rgba(237,41,76,.35); box-shadow: inset 3px 0 0 var(--red); }

.map-stage { position: relative; min-height: 100%; background: #dce8f3; }
#fullTrackingMap { position: absolute; inset: 0; }
.map-legend {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 500;
  display: flex;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 999px;
  color: #0b1834;
  background: rgba(255,255,255,.92);
  box-shadow: 0 14px 36px rgba(7,21,47,.18);
  font-size: 12px;
  font-weight: 850;
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.map-legend .live { background: var(--green); }
.map-legend .stale { background: var(--red); }
.map-legend .route { width: 28px; height: 4px; border-radius: 4px; background: #087ee8; }

.leaflet-popup-content-wrapper { border-radius: 8px; }
.rider-pin {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 4px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  box-shadow: 0 12px 28px rgba(7,21,47,.35);
  font-size: 12px;
  font-weight: 950;
}
.rider-pin.stale { background: var(--red); }

@media (max-width: 860px) {
  .map-page-shell { grid-template-columns: 1fr; height: auto; min-height: calc(100% - 74px); }
  .map-page-panel { border-right: 0; }
  .map-stage { min-height: 70vh; }
  .map-page-header { align-items: flex-start; flex-direction: column; }
}
