:root {
  --bg: #EEF2EF;
  --surface: #FFFFFF;
  --ink: #17252B;
  --muted: #5B6B6F;
  --line: #D3DCD7;
  --green: #0B7A57;
  --green-dark: #08603F;
  --green-soft: #DCEFE6;
  --yellow: #FFC233;
  --yellow-soft: #FFF2CC;
  --rust: #B8432C;
  --rust-soft: #F8E2DC;
  --display: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabs-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 var(--body);
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px);
}
a { color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  background: var(--ink); color: #fff;
}
.wordmark {
  font: 900 26px/1 var(--display); font-stretch: 125%; letter-spacing: -0.02em;
  color: #fff; text-decoration: none;
}
.topbar-side { font-size: 14px; color: #B9C7C2; }
.topbar-side button { color: #fff; background: none; border: 1px solid #4A5C61; border-radius: 8px; padding: 6px 10px; font: inherit; }

.view { max-width: 560px; margin: 0 auto; padding: 20px 16px; outline: none; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0 0 8px; }
h1 { font-size: 30px; font-weight: 850; font-stretch: 112%; letter-spacing: -0.015em; }
h2 { font-size: 22px; font-weight: 800; font-stretch: 108%; margin-top: 28px; }
h3 { font-size: 18px; font-weight: 750; }
p { margin: 0 0 12px; }
.lead { font-size: 19px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.pay { font: 900 34px/1 var(--display); font-stretch: 118%; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pay small { font: 600 14px/1 var(--body); color: var(--muted); letter-spacing: 0; margin-left: 4px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; margin: 16px 0 6px; }
label .hint { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }
input[type=text], input[type=tel], input[type=number], input[type=email], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 52px;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: none; }
textarea { min-height: 88px; resize: vertical; }
input.code-input { font: 800 30px/1 var(--display); letter-spacing: 0.3em; text-align: center; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 14px; }
.check input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--green); flex: none; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 14px; font-weight: 700; }
.switch input { width: 26px; height: 26px; accent-color: var(--green); }
.switch.on { border-color: var(--yellow); background: var(--yellow-soft); }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 14px 18px; margin-top: 20px;
  font: 800 18px/1.1 var(--display); font-stretch: 108%;
  border: 0; border-radius: 12px; cursor: pointer; text-decoration: none;
  background: var(--green); color: #fff;
}
.btn:active { background: var(--green-dark); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 2px solid var(--line); }
.btn.danger { background: var(--surface); color: var(--rust); border: 2px solid var(--rust-soft); }
.btn.small { min-height: 44px; font-size: 15px; margin-top: 0; width: auto; padding: 10px 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- choice cards (onboarding) ---------- */
.choices { display: grid; gap: 12px; margin-top: 20px; }
.choice {
  text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: 18px; font: inherit; color: var(--ink); cursor: pointer;
}
.choice strong { display: block; font: 800 21px/1.15 var(--display); font-stretch: 110%; margin-bottom: 4px; }
.choice:hover, .choice:focus-visible { border-color: var(--green); }

/* ---------- runs ---------- */
.run {
  display: block; background: var(--surface); border-radius: 14px; padding: 16px;
  margin-top: 12px; color: var(--ink); text-decoration: none; border: 2px solid transparent;
}
a.run:hover { border-color: var(--line); }
.run.asap { border-color: var(--yellow); }
.run-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.run-what { font-weight: 700; margin-top: 4px; }
.badge {
  display: inline-block; font: 800 13px/1 var(--body); padding: 6px 9px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-dark); white-space: nowrap;
}
.badge.asap { background: var(--yellow); color: var(--ink); }
.badge.cancelled { background: var(--rust-soft); color: var(--rust); }
.badge.waiting { background: #E6ECEA; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 15px; color: var(--muted); margin-top: 10px; }

/* The route line: runner → pickup → drop-off, with a dot that moves as the run progresses. */
.route { position: relative; margin: 18px 4px 6px; height: 64px; }
.route-track { position: absolute; left: 6px; right: 6px; top: 9px; height: 4px; background: repeating-linear-gradient(90deg, var(--line) 0 10px, transparent 10px 16px); border-radius: 2px; }
.route-fill { position: absolute; left: 6px; top: 9px; height: 4px; background: var(--green); border-radius: 2px; transition: width .6s ease; }
.route-stop { position: absolute; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 4px solid var(--line); transform: translateX(-50%); }
.route-stop.done { border-color: var(--green); background: var(--green); }
.route-label { position: absolute; top: 28px; transform: translateX(-50%); font-size: 13px; font-weight: 700; text-align: center; width: 33%; line-height: 1.2; color: var(--muted); }
.route-label.first { transform: none; text-align: left; }
.route-label.last { transform: translateX(-100%); text-align: right; }
.route-dot {
  position: absolute; top: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--yellow); border: 3px solid var(--ink); transform: translateX(-50%);
  transition: left .6s ease;
}
@media (prefers-reduced-motion: reduce) { .route-fill, .route-dot { transition: none; } }

/* ---------- detail ---------- */
.panel { background: var(--surface); border-radius: 14px; padding: 16px; margin-top: 14px; }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; font-weight: 700; }
.money { display: grid; grid-template-columns: 1fr auto; gap: 6px 0; font-variant-numeric: tabular-nums; }
.money > span:nth-child(odd) { padding-right: 12px; }
.money .total { font: 900 22px/1.2 var(--display); border-top: 2px solid var(--line); padding-top: 8px; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: var(--line); }
.photos figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.contact { display: flex; gap: 10px; margin-top: 12px; }
.contact .btn { margin: 0; }

.notice { padding: 14px 16px; border-radius: 12px; background: var(--yellow-soft); margin-top: 14px; }
.notice.bad { background: var(--rust-soft); color: #6E2414; }
.notice.good { background: var(--green-soft); color: var(--green-dark); }
.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.empty strong { display: block; font: 800 20px/1.2 var(--display); color: var(--ink); margin-bottom: 6px; }

/* ---------- admin ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { background: var(--surface); border-radius: 12px; padding: 14px; }
.stat b { display: block; font: 900 28px/1 var(--display); font-stretch: 115%; }
.stat span { font-size: 14px; color: var(--muted); }
.person { background: var(--surface); border-radius: 14px; padding: 16px; margin-top: 12px; }
.docs { display: flex; gap: 10px; margin: 10px 0; }
.docs a { display: block; width: 96px; }
.docs img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--line); }
.docs span { font-size: 12px; color: var(--muted); }
.rates { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: end; }
.segmented { display: flex; background: #DCE4E0; border-radius: 12px; padding: 4px; margin-top: 16px; }
.segmented button { flex: 1; border: 0; background: none; font: 700 15px var(--body); padding: 10px; border-radius: 9px; color: var(--muted); cursor: pointer; }
.segmented button[aria-pressed=true] { background: var(--surface); color: var(--ink); }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; max-width: 160px; height: var(--tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; position: relative;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current=page] { color: var(--green-dark); }
.tabs a[aria-current=page]::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--green); border-radius: 0 0 3px 3px; }
.tabs .count { position: absolute; top: 8px; left: 56%; background: var(--yellow); color: var(--ink); font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px);
  max-width: 520px; margin: 0 auto; background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 12px;
  font-weight: 700; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20;
}
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: var(--rust); }

/* ---------- sign-in hero ---------- */
.hero { padding: 8px 0 4px; }
.hero h1 { font-size: 38px; font-stretch: 118%; }
.hero-route { margin: 22px 0 8px; }
.sides { display: grid; gap: 10px; margin-top: 22px; }
.sides div { background: var(--surface); border-radius: 12px; padding: 14px 16px; }
.sides b { font-family: var(--display); font-weight: 800; }

@media (min-width: 700px) {
  .view { padding-top: 32px; }
  .sides { grid-template-columns: 1fr 1fr; }
}

/* ---------- consent + legal pages ---------- */
.consent { margin: 12px 0 0; line-height: 1.45; }
.site-foot { margin-top: 28px; text-align: center; }
.legal h2 { margin-top: 24px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }

/* ---------- vehicle picker ---------- */
fieldset.vehicle { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
fieldset.vehicle legend { font-weight: 700; padding: 0; margin-bottom: 2px; }
fieldset.vehicle legend .hint { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }
fieldset.vehicle .row label { margin-top: 8px; }
fieldset.vehicle input[type=text] { margin-top: 8px; }
select:disabled { color: var(--muted); background: #F4F6F5; }
.pdf-tile { display: grid; place-items: center; width: 96px; height: 72px; border-radius: 8px; background: var(--rust-soft); color: var(--rust); font: 800 16px var(--display); }
