:root {
  --green: #0d4d2e;
  --green-dark: #083a22;
  --orange: #e8833a;
  --cream: #fdf8ef;
  --ink: #22301f;
  --muted: #6b7a68;
  --card: #ffffff;
  --danger: #b3382e;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream); color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--green); color: #fff; padding: 12px 16px;
  position: sticky; top: 0; z-index: 1000;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-bus { font-size: 30px; }
.brand strong { display: block; font-size: 17px; }
.brand small { opacity: .85; font-size: 12px; }
.lang-toggle {
  display: flex; align-items: center; gap: 4px;
  background: #fff; color: var(--green-dark);
  border: none; border-radius: 999px; padding: 5px 8px 5px 6px;
  font-size: 14px; font-weight: 800; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.3);
  animation: langPulse 1.6s ease-in-out 2;
}
.lang-toggle .lang-globe { font-size: 17px; line-height: 1; padding-left: 4px; }
.lang-toggle .lang-opt { padding: 6px 12px; border-radius: 999px; color: #6b7a68; line-height: 1; }
.lang-toggle .lang-opt.active { background: var(--green); color: #fff; }
.lang-toggle .lang-sep { color: #b9c6bc; font-weight: 400; }
@keyframes langPulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(0,0,0,.3); transform: scale(1); }
  50% { box-shadow: 0 2px 18px rgba(232,131,58,.9); transform: scale(1.06); }
}
.tabs {
  display: flex; background: var(--green-dark); position: sticky; top: 61px; z-index: 999;
}
.tab {
  flex: 1; background: none; border: none; color: #cfe0d2; padding: 12px 4px;
  font-size: 14px; font-weight: 600; border-bottom: 3px solid transparent;
}
.tab.active { color: #fff; border-bottom-color: var(--orange); }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.view { display: none; }
.view.active { display: block; }
.hero { text-align: center; margin: 8px 0 16px; }
.hero h1 { color: var(--green); margin: 0 0 6px; font-size: 24px; }
.hero p { color: var(--muted); margin: 0; }
/* Warm sunset banner in the church's brand tones */
.hero.banner {
  background: linear-gradient(135deg, #f9c46b 0%, #f09a4b 45%, #e8833a 100%);
  border-radius: 18px; padding: 26px 18px; margin: 4px 0 18px;
  box-shadow: 0 4px 16px rgba(232,131,58,.28);
}
.hero.banner h1 { color: var(--green-dark); font-size: 26px; }
.hero.banner p { color: #5a3a1a; font-weight: 600; }
.card {
  background: var(--card); border-radius: 14px; padding: 18px; margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(13,77,46,.08);
}
.card h2, .card h3 { color: var(--green); margin-top: 0; }
label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
label em { font-weight: 400; color: var(--muted); font-style: normal; }
input, select {
  width: 100%; margin-top: 6px; padding: 14px; font-size: 16px;
  border: 2px solid #d8e2d5; border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--orange); }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }
.big-btn {
  display: block; width: 100%; padding: 16px; font-size: 18px; font-weight: 800;
  background: linear-gradient(180deg, #f0924a, #e8833a); color: #fff; border: none; border-radius: 12px;
  text-align: center; text-decoration: none; cursor: pointer; margin-top: 6px;
  box-shadow: 0 3px 10px rgba(232,131,58,.35);
}
.big-btn:active { transform: scale(.98); }
.big-btn.danger { background: var(--danger); }
.big-btn.wa { background: #25d366; margin-bottom: 10px; }
.big-btn.sms { background: linear-gradient(180deg, #3aa7e0, #1f8fc9); margin-bottom: 10px;
  box-shadow: 0 3px 10px rgba(31,143,201,.35); }
.big-btn.msgr { background: linear-gradient(180deg, #1a9fff, #0084ff); margin-bottom: 4px;
  box-shadow: 0 3px 10px rgba(0,132,255,.35); }
.alt-title { text-align: center; font-weight: 800; color: var(--green); margin: 14px 0 8px; }

/* "Be ready" pop-up */
.modal { position: fixed; inset: 0; background: rgba(20,40,30,.55); display: flex;
  align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { background: var(--cream); border-radius: 18px; padding: 24px 20px;
  max-width: 380px; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.3); text-align: center; }
.modal-card h2 { color: var(--green); margin-bottom: 10px; }
.modal-card p { margin-bottom: 16px; line-height: 1.5; }
.modal-card .big-btn { margin-bottom: 8px; }
.ghost-btn {
  display: block; width: 100%; padding: 12px; background: none; border: none;
  color: var(--green); font-weight: 700; font-size: 15px;
}
.ghost-btn.small { width: auto; padding: 8px 12px; font-size: 14px; white-space: nowrap; }
.hint { color: var(--muted); font-size: 13px; text-align: center; }
.status { text-align: center; color: var(--muted); font-size: 14px; min-height: 20px; }
.error { color: var(--danger); font-weight: 700; text-align: center; }
.pin-wrap { position: relative; }
.pin-wrap input { width: 100%; padding-right: 46px; }
.pin-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 20px; line-height: 1;
  padding: 8px; cursor: pointer;
}
.link-btn {
  background: none; border: none; color: var(--green); text-decoration: underline;
  font-size: 14px; margin: 10px auto 0; display: block; cursor: pointer; padding: 6px;
}
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 20px;
}
.modal-card {
  background: var(--card); border-radius: 14px; padding: 24px;
  max-width: 340px; width: 100%; text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
.modal-emoji { font-size: 40px; margin-bottom: 12px; }
.modal-card p { margin: 0 0 16px; font-size: 15px; line-height: 1.5; }
.hidden { display: none !important; }
.info ul { margin: 0; padding-left: 4px; list-style: none; }
.info li { margin-bottom: 8px; font-size: 15px; }
#map { height: 60vh; min-height: 320px; border-radius: 14px; overflow: hidden;
       box-shadow: 0 2px 10px rgba(13,77,46,.12); z-index: 1; }
/* Big, thumb-friendly +/- zoom buttons on the rider map */
#map .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 24px;
  color: var(--green); }
#map .leaflet-bar { box-shadow: 0 2px 8px rgba(0,0,0,.25); border-radius: 10px; overflow: hidden; }
.bus-marker { font-size: 34px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
/* Modern map markers: pulsing green bus dot + clean church pin */
.bus-dot { position: relative; width: 44px; height: 44px; display: flex;
  align-items: center; justify-content: center; font-size: 24px;
  background: var(--green); border: 3px solid #fff; border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.bus-pulse { position: absolute; inset: -3px; border-radius: 50%;
  border: 3px solid var(--green); opacity: .7;
  animation: busPulse 2s ease-out infinite; pointer-events: none; }
@keyframes busPulse {
  0% { transform: scale(.75); opacity: .7; }
  100% { transform: scale(1.5); opacity: 0; } }
.church-dot { width: 36px; height: 36px; display: flex; align-items: center;
  justify-content: center; font-size: 20px; background: #fff;
  border: 2px solid var(--green); border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,.3); }
/* Rider route progress: anonymous numbered stops, no personal info */
.route-progress { text-align: center; margin-top: 10px; }
.rp-label { font-weight: 800; font-size: 16px; margin-bottom: 8px; }
.rp-dots { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
.rp-dot { width: 26px; height: 26px; border-radius: 50%; background: #dde3da;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #6b7a6e; }
.rp-dot.done { background: var(--green); color: #fff; }
.rp-dot.next { background: #fff; border: 3px solid var(--green); color: var(--green);
  animation: busPulse 2s ease-out infinite; }
/* Rider ETA notifications: global toast + persistent map banner */
.notify-toast { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 9999;
  background: var(--green); color: #fff; font-size: 19px; font-weight: 800;
  text-align: center; padding: 15px 12px; border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,.35); animation: toastIn .3s ease-out; }
.notify-toast.pullup { background: #b35400; }
@keyframes toastIn { from { transform: translateY(-16px); opacity: 0; }
  to { transform: none; opacity: 1; } }
.eta-banner { font-size: 20px; font-weight: 800; text-align: center;
  background: #e8f5e9; border: 2px solid var(--green); border-radius: 12px;
  padding: 10px; margin: 10px 0; }
.driver-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.driver-head select { width: auto; margin-top: 0; }
.gps-row { display: flex; gap: 10px; }
.gps-row .big-btn { margin-top: 10px; }
.pickups { list-style: none; margin: 0; padding: 0; }
.pickups li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 4px; border-bottom: 1px solid #eef2ec; font-size: 15px;
}
.pickups li:last-child { border-bottom: none; }
.pickups .who { flex: 1; min-width: 0; }
.pickups .who strong { display: block; }
.pickups .who small { color: var(--muted); }
.who-top { display: flex; align-items: center; }
.stop-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  background: var(--green); color: #fff; font-weight: 800; font-size: 14px;
  margin-right: 8px; flex-shrink: 0;
}
.pickups li.done .who { text-decoration: line-through; opacity: .55; }
/* Suggested-route list: stop number + rider name so the driver can
   mentally match who they're picking up at each location. */
.route-list { list-style: none; margin: 10px 0 0; padding: 0; }
.route-list li { display: flex; gap: 4px; align-items: flex-start;
  padding: 9px 2px; border-top: 1px solid #eef2ec; font-size: 15px; }
.route-list .rl-body { display: flex; flex-direction: column; min-width: 0; }
.route-list .rl-body strong { display: block; }
.route-list .rl-body small { color: var(--muted); }
.route-list li.church { background: #f4f8f4; border-radius: 10px;
  padding: 9px 10px; margin-top: 6px; }
.route-list li.church .stop-num { background: transparent; margin-right: 2px; }
#btnOpenRoute { margin-top: 12px; }
.nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; min-width: 44px; min-height: 44px; font-size: 20px;
  background: #e8f0fe; text-decoration: none; margin-right: 8px; flex: 0 0 auto;
}
.done-btn {
  border: none; border-radius: 999px; padding: 10px 14px; font-size: 14px;
  background: var(--orange); color: #fff; cursor: pointer; min-width: 44px; min-height: 44px;
  border: 2px solid var(--green); background: #fff; color: var(--green);
  border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 14px;
  white-space: nowrap;
}
.pickups li.done .done-btn { background: var(--green); color: #fff; }
.pickups li.cancelled { opacity: .55; }
.pickups li.cancelled .who { text-decoration: line-through; }
.cancel-tag { color: #b3261e; font-weight: 700; font-size: 13px; margin-left: 8px;
  text-decoration: none; display: inline-block; }
.dup-tag { color: #8a6d1b; font-weight: 700; font-size: 13px; margin-left: 8px;
  text-decoration: none; display: inline-block; }
#seatLine { font-size: 15px; margin: 4px 0 8px; }
#seatLine.seat-warn { color: #b3261e; font-weight: 700; }
/* Service picker (rider) + service tabs (driver) */
.svc-block { margin-bottom: 12px; }
.svc-label { display: block; font-weight: 700; margin-bottom: 6px; }
.svc-picker { display: flex; gap: 8px; margin-bottom: 12px; }
.svc-card {
  flex: 1; border: 2px solid #d7e3dc; background: #fff; border-radius: 12px;
  padding: 10px 6px; cursor: pointer; display: flex; flex-direction: column;
  gap: 2px; align-items: center; text-align: center; justify-content: center;
  min-height: 68px;
}
.svc-card strong { font-size: 14px; }
.svc-card small { font-size: 12px; color: var(--muted); }
.svc-card.active { border-color: var(--green); background: #eef7f0; }
.svc-picker.tabs { margin-bottom: 12px; }
.svc-tab {
  flex: 1; border: 1px solid #d7e3dc; background: #fff; border-radius: 999px;
  padding: 10px 4px; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--ink);
}
.svc-tab.active { background: var(--green); color: #fff; border-color: var(--green); }
/* Gender picker (rider form) */
.seg-block { margin-bottom: 12px; }
.seg-label { display: block; font-weight: 700; margin-bottom: 6px; }
.gender-picker { display: flex; gap: 8px; }
.gender-pill { flex: 1; margin: 0; }
.gender-pill input { position: absolute; opacity: 0; pointer-events: none; }
.gender-pill span {
  display: block; border: 2px solid #d7e3dc; background: #fff; border-radius: 999px;
  padding: 10px 4px; font-size: 15px; font-weight: 700; cursor: pointer;
  text-align: center; color: var(--ink);
}
.gender-pill input:checked + span { background: var(--green); color: #fff; border-color: var(--green); }
.gender-pill input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 12px; cursor: pointer; }
.check-row input { width: 22px; height: 22px; accent-color: var(--green); flex: none; }
.role-tab.active { background: var(--green); color: #fff; border-color: var(--green); }
.who-phone { display: block; font-size: 13px; color: var(--green); text-decoration: none; margin-top: 2px; }
.cancel-btn {
  border: 2px solid var(--danger); background: #fff; border-radius: 10px;
  min-width: 44px; min-height: 44px; font-size: 16px; cursor: pointer; margin-left: 8px;
}
.cancel-btn[data-arm="1"] { background: var(--danger); }
footer { text-align: center; padding: 18px; color: var(--muted); }

/* ---------- Bilingual two-tone text ---------- */
/* Spanish (primary) in church green, English (secondary) in warm sunset brown.
   Markup: <span class="bi-es">…</span> / <span class="bi-en">…</span> */
.bi-es { color: var(--green); font-weight: 700; }
.bi-en { color: #a05a10; }
/* On filled buttons the base tones would vanish: light-on-color variants. */
.big-btn .bi-es { color: #fff; }
.big-btn .bi-en { color: #ffe6c7; }
/* Error lines keep the red family in both languages. */
.error .bi-es { color: var(--danger); }
.error .bi-en { color: #cf6a4d; }
/* Header: English subtitle in warm gold, contrasting with the white Spanish title. */
#brandSub { color: #f2c078; opacity: 1; }
/* Two-tone overlay standing in for native placeholders (a real placeholder
   can't carry two colors). JS builds it from data-ph-es / data-ph-en. */
.ph-wrap { position: relative; display: block; }
.ph-overlay {
  position: absolute; left: 16px; right: 14px; top: 50%; transform: translateY(-50%);
  display: block; pointer-events: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 16px; color: #9aa79b;
}
.ph-overlay.hidden { display: none; }
.pin-wrap .ph-overlay { right: 46px; }
