:root {
  --navy: #171c4a;
  --navy-2: #262e7a;
  --indigo: #3b44a8;
  --indigo-dark: #2c348c;
  --cyan: #00a3e0;
  --bg: #f2f4fa;
  --card: #ffffff;
  --ink: #171a2e;
  --muted: #5c6484;
  --line: #e3e7f1;
  --ok: #0f7546;
  --ok-bg: #e6f4ec;
  --warn: #8a5300;
  --warn-bg: #fdf1dd;
  --danger: #a3261c;
  --danger-bg: #fbeae8;
  --shadow: 0 1px 2px rgba(23, 28, 74, .06), 0 10px 30px rgba(23, 28, 74, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(900px 380px at 50% -140px, #dfe6ff 0%, rgba(223, 230, 255, 0) 70%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 14px 20px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex: none; opacity: .95; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 18px; font-weight: 650; letter-spacing: .2px; }
.brand-sub { font-size: 13px; opacity: .72; letter-spacing: .3px; text-transform: uppercase; }

/* ---------- layout ---------- */
main {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  flex: 1;
}
.view { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.3px; }

/* ---------- login ---------- */
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px 26px;
  max-width: 460px;
  margin: 12px auto 0;
}
.wordmark { display: block; height: 30px; width: auto; margin: 0 0 22px; }
.lede { color: var(--muted); margin: 0 0 24px; font-size: 16px; }

label { display: block; font-size: 14px; font-weight: 650; margin: 0 0 6px; letter-spacing: .1px; }

input[type="text"], input[type="password"] {
  width: 100%;
  height: 54px;
  padding: 0 14px;
  font-size: 17px;
  color: var(--ink);
  background: #fbfcff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(59, 68, 168, .13);
  background: #fff;
}
#rider-id { margin-bottom: 18px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle {
  position: absolute;
  top: 0; right: 0;
  width: 50px; height: 54px;
  display: grid; place-items: center;
  background: none; border: 0; cursor: pointer;
  color: var(--muted);
  border-radius: 0 12px 12px 0;
}
.pw-toggle:hover { color: var(--indigo); }

.remember {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 500; color: var(--muted);
  margin: 16px 0 20px; cursor: pointer;
}
.remember input { width: 18px; height: 18px; accent-color: var(--indigo); }

button { font: inherit; }

.primary {
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-dark) 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .2px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(43, 49, 130, .28);
  transition: transform .06s, box-shadow .15s, opacity .15s;
}
.primary:hover { box-shadow: 0 8px 20px rgba(43, 49, 130, .34); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .6; cursor: progress; box-shadow: none; }

.ghost {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--indigo);
  font-size: 15px;
  font-weight: 650;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ghost:hover { background: #f4f6fd; border-color: #cfd6ec; }
.ghost-light {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .32);
  color: #fff;
}
.ghost-light:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .5); }

.error {
  color: var(--danger);
  font-size: 15px;
  margin: 14px 0 0;
  min-height: 0;
}
.error:empty { display: none; }

.fineprint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ---------- trips ---------- */
.trips-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 2px 0 6px;
}
.hello { margin: 0 0 2px; color: var(--muted); font-size: 15px; font-weight: 600; }
.trips-head h1 { margin: 0; }

.updated { color: var(--muted); font-size: 14px; margin: 0 0 18px; min-height: 20px; }

.banner {
  background: #eaf3ff;
  border: 1px solid #cfe2fb;
  color: #1c4f8f;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14.5px;
  margin: 6px 0 14px;
}
.banner-warn { background: var(--warn-bg); border-color: #f1d9ae; color: var(--warn); }

.trips { display: flex; flex-direction: column; gap: 14px; }

.trip {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: 96px 1fr;
}
.trip-when {
  background: linear-gradient(160deg, #f7f8fe 0%, #eef1fb 100%);
  border-right: 1px solid var(--line);
  padding: 20px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
}
.trip-dow { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.trip-day { font-size: 26px; font-weight: 750; line-height: 1.05; color: var(--navy); }
.trip-month { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; }
.trip-time { margin-top: 9px; font-size: 15px; font-weight: 700; color: var(--indigo); white-space: nowrap; }

.trip-body { padding: 18px 18px 16px; min-width: 0; }
.trip-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pill {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef0f8;
  color: var(--muted);
  white-space: nowrap;
}
.pill.scheduled { background: #e8f1ff; color: #1e4e9c; }
.pill.active    { background: var(--ok-bg); color: var(--ok); }
.pill.done      { background: #eef0f6; color: #4a5169; }
.pill.cancelled { background: var(--danger-bg); color: var(--danger); }
.pill.warn      { background: var(--warn-bg); color: var(--warn); }

.conf { font-size: 13px; color: var(--muted); white-space: nowrap; }

.trip-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.fare {
  font-size: 13px;
  font-weight: 700;
  color: var(--ok);
  background: var(--ok-bg);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fare.pending,
.fare.na { color: var(--muted); background: #eef0f8; font-weight: 600; }

.route { display: grid; grid-template-columns: 22px 1fr; gap: 0 10px; }
.route-rail { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 7px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--indigo); flex: none; }
.dot.end { background: #fff; border: 2.5px solid var(--indigo); }
.rail-line { width: 2px; flex: 1; background: linear-gradient(var(--indigo), #c9cdea); margin: 4px 0; min-height: 26px; }
.stop { padding: 1px 0 14px; min-width: 0; }
.stop:last-child { padding-bottom: 0; }
.stop-label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); margin-bottom: 1px; }
.stop-addr { display: block; font-size: 16.5px; font-weight: 550; line-height: 1.35; overflow-wrap: anywhere; }
.stop-city { display: block; font-size: 13.5px; color: var(--muted); margin-top: 1px; }

.trip-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13.5px;
  color: var(--muted);
}
.trip-foot strong { color: var(--ink); font-weight: 650; }
.trip-note { margin: 10px 0 0; font-size: 13.5px; color: var(--warn); }

.empty {
  background: var(--card);
  border: 1.5px dashed #d3d9ea;
  border-radius: var(--radius);
  padding: 34px 24px;
  text-align: center;
  color: var(--muted);
}
.empty h2 { margin: 0 0 6px; font-size: 19px; color: var(--ink); }
.empty p { margin: 0; font-size: 15px; }

.skeleton { height: 132px; border-radius: var(--radius); background: linear-gradient(90deg, #eceff8 25%, #f6f8fd 37%, #eceff8 63%); background-size: 400% 100%; animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.foot {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 28px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  color: #8a90a8;
  font-size: 12.5px;
  line-height: 1.5;
}
.foot p { margin: 3px 0; }
.debug-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: #6b7290;
  text-decoration: underline;
  cursor: pointer;
}
.debug-link:hover { color: var(--indigo); }

@media (max-width: 520px) {
  body { font-size: 16px; }
  main { padding: 22px 14px 32px; }
  .login-card { padding: 26px 20px 22px; }
  h1 { font-size: 25px; }
  .trip { grid-template-columns: 92px 1fr; }
  .trip-when { padding: 16px 6px; }
  .trip-time { font-size: 14px; }
  .trip-day { font-size: 23px; }
  .trip-body { padding: 15px 14px 14px; }
  .trip-top { flex-wrap: wrap; gap: 6px; }
  .trips-head { align-items: center; }
  .ghost { padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- booking ---------- */
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.primary-sm {
  width: auto;
  height: 42px;
  padding: 0 18px;
  font-size: 15px;
  border-radius: 999px;
}

.steps {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 4px 0 20px;
  counter-reset: step;
}
.steps li {
  flex: 1;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  padding: 9px 10px 10px;
  border-top: 3px solid var(--line);
  counter-increment: step;
}
.steps li::before {
  content: counter(step) ". ";
  color: inherit;
}
.steps li.on { color: var(--indigo); border-top-color: var(--indigo); }
.steps li.complete { color: var(--ok); border-top-color: var(--ok); }

.book-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 24px 22px;
}
.book-card h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.2px; }
.book-card .sub { margin: 0 0 20px; color: var(--muted); font-size: 14.5px; }

.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row .field { margin-bottom: 16px; }

select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fbfcff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select {
  height: 52px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%235c6484' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
textarea { padding: 12px; min-height: 84px; resize: vertical; line-height: 1.45; }
select:focus, textarea:focus, input[type="date"]:focus, input[type="time"]:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(59, 68, 168, .13);
  background-color: #fff;
}
input[type="date"], input[type="time"] {
  width: 100%;
  height: 52px;
  font: inherit;
  color: var(--ink);
  background: #fbfcff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  outline: none;
}

.manual-fields { margin-top: 10px; padding-left: 12px; border-left: 2px solid var(--line); }
.manual-fields .field:last-child { margin-bottom: 0; }

.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

.slot-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.slot {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  min-height: 44px;
}
.slot:hover { border-color: var(--indigo); color: var(--indigo); }
.slot.is-on { border-color: var(--indigo); background: #eef1fb; color: var(--indigo); }

.checkline {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 500; color: var(--ink);
  margin: 2px 0 18px; cursor: pointer;
}
.checkline input { width: 18px; height: 18px; accent-color: var(--indigo); }

.book-actions { display: flex; gap: 12px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.book-actions .primary { flex: 1; min-width: 180px; }

.notice {
  background: #eef4ff;
  border: 1px solid #d3e2fb;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: #274b7d;
  margin: 0 0 18px;
}
.notice-warn { background: var(--warn-bg); border-color: #f1d9ae; color: var(--warn); }

.review-list { display: flex; flex-direction: column; margin: 0 0 8px; }
.review-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15.5px;
}
.review-row:last-child { border-bottom: 0; }
.review-row dt { color: var(--muted); font-weight: 650; font-size: 14px; }
.review-row dd { margin: 0; overflow-wrap: anywhere; }

.done {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 26px 28px;
  text-align: center;
}
.done .tick {
  width: 62px; height: 62px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok);
  display: grid; place-items: center;
}
.done h2 { margin: 0 0 8px; font-size: 22px; }
.done p { margin: 0 auto 10px; max-width: 44ch; color: var(--muted); font-size: 15px; }
.done .book-actions { justify-content: center; margin-top: 20px; }
.done .book-actions .primary { flex: none; min-width: 160px; }
.done-summary { text-align: left; margin: 20px 0 0; background: #f8faff; border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px; }

.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fare-card {
  margin-top: 12px;
  padding: 14px 16px;
  background: #f8faff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.fare-total { font-size: 26px; font-weight: 750; color: var(--ink); line-height: 1.15; }
.fare-card .hint { margin: 2px 0 0; }
.fare-rows { margin: 10px 0 0; }
.fare-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
}
.fare-row:first-child { border-top: 0; }
.fare-row dt { margin: 0; color: var(--muted); }
.fare-row dd { margin: 0; font-variant-numeric: tabular-nums; }

@media (max-width: 520px) {
  .head-actions { justify-content: flex-end; }
  .primary-sm { height: 38px; padding: 0 14px; font-size: 14px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .review-row { grid-template-columns: 100px 1fr; }
  .book-card { padding: 20px 16px 18px; }
  .steps li { font-size: 12px; padding: 8px 4px 9px; }
}

/* ---------- vehicle tracking ---------- */
.trip-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.trip-actions .ghost { font-size: 14.5px; padding: 8px 14px; }

.eta-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  border-radius: 16px;
  padding: 16px 18px 17px;
  margin: 4px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
}
.eta-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .9px;
  font-weight: 700;
  opacity: .7;
}
.eta-value { font-size: 25px; font-weight: 750; line-height: 1.2; letter-spacing: -.2px; }
.eta-sub { font-size: 14px; opacity: .8; }
.eta-sub:empty { display: none; }

.track-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.track-map { height: 380px; width: 100%; background: #eef1f8; }
.track-map.leaflet-container { font: inherit; }
.track-map-note {
  margin: 0;
  padding: 15px 18px;
  font-size: 14.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.track-info {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 10px;
  margin-top: 16px;
}
.track-info h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: -.1px; }
.track-details { margin: 0; }
.track-details .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.track-details .row:first-child { border-top: 0; }
.track-details dt { margin: 0; color: var(--muted); flex: none; }
.track-details dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.track-details dd.empty { font-weight: 400; color: var(--muted); }
.track-details a { color: var(--indigo); }

.track-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.track-note:empty { display: none; }
.track-updated {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  font-weight: 650;
}

.map-pin-wrap { background: none; border: 0; }
.map-pin {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(23, 26, 46, .38);
  background: #6aa84f;
}
.map-pin.pick { background: #6aa84f; }
.map-pin.drop { background: #9d1d3f; }
.map-pin.veh { width: 44px; height: 44px; background: var(--indigo); }

@media (max-width: 520px) {
  .track-map { height: 300px; }
  .eta-value { font-size: 22px; }
  .track-info { padding: 16px 16px 8px; }
}
