:root {
  --green: #4cb122;
  --green-dark: #3a8a19;
  --ink: #14181a;
  --muted: #6b7680;
  --line: #e4e8ea;
  --bg: #f2f4f2;
  --danger: #c0392b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(20, 24, 26, 0.06);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(20, 24, 26, 0.15);
}
.topbar h1 { font-size: 16px; margin: 0; flex: 1; font-weight: 700; }
.topbar .back { color: #fff; font-weight: 700; cursor: pointer; background: none; border: none; font-size: 18px; }
.topbar .staff { font-size: 12px; opacity: 0.7; }

.screen { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 16px; }

.hero { text-align: center; padding: 40px 20px 20px; }
.hero .logo { font-size: 24px; font-weight: 800; }
.hero .logo .ride { color: var(--green); }
.hero p { color: var(--muted); font-size: 14px; }
.hero-logo { width: 72px; height: 72px; margin-bottom: 10px; }

label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }
.field { margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

input, select {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(76, 177, 34, 0.12); }

button.primary {
  width: 100%;
  padding: 17px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
button.primary.green { background: var(--green); }
button.primary.danger { background: var(--danger); }
button.primary:disabled { opacity: 0.4; }
button.primary:not(:disabled):active { transform: scale(0.98); opacity: 0.92; }

button.ghost {
  width: 100%;
  padding: 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
button.ghost:active { transform: scale(0.98); background: var(--bg); }

.error-banner { background: #fdecea; color: var(--danger); padding: 12px 14px; border-radius: 10px; font-size: 13.5px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 3px rgba(20, 24, 26, 0.04); }

.vehicle-tile {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  cursor: pointer; background: #fff; text-align: left; width: 100%;
  box-shadow: 0 1px 3px rgba(20, 24, 26, 0.04);
  transition: transform 0.1s ease;
}
.vehicle-tile:not([disabled]):active { transform: scale(0.99); }
.vehicle-tile[disabled] { opacity: 0.4; cursor: default; }
.vehicle-tile .icon { width: 44px; height: 44px; border-radius: 12px; background: #eef7ea; color: var(--green-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vehicle-tile .title { font-weight: 700; font-size: 15px; }
.vehicle-tile .sub { color: var(--muted); font-size: 13px; }

.battery-bar {
  height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 6px;
}
.battery-bar > div { height: 100%; background: var(--green); }

.status-pill {
  display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.status-assigned { background: #fff3d9; color: #8a5a00; }
.status-en_route, .status-arrived { background: #e4eefb; color: #205a9e; }
.status-in_progress { background: #eaf7e6; color: var(--green-dark); }
.status-completed { background: #eaf7e6; color: var(--green-dark); }
.status-achrams-not_enrolled { background: #fdecea; color: var(--danger); }
.status-achrams-pending { background: #fff3d9; color: #8a5a00; }
.status-achrams-accredited { background: #eaf7e6; color: var(--green-dark); }

.compliance-banner {
  background: #fff3d9; color: #8a5a00; border-radius: var(--radius);
  padding: 12px 14px; font-size: 13px; line-height: 1.4;
  display: flex; align-items: flex-start; gap: 8px;
}
.compliance-banner .inline-icon { margin-top: 1px; flex-shrink: 0; }

.trip-detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.trip-detail-row:last-child { border-bottom: none; }
.trip-detail-row .label { color: var(--muted); }
.trip-detail-row .value { font-weight: 600; text-align: right; }

.big-action {
  width: 100%; padding: 22px; border: none; border-radius: 18px;
  font-size: 18px; font-weight: 800; color: #fff; cursor: pointer;
}
.big-action.en_route { background: #205a9e; }
.big-action.arrived { background: #8a5a00; }
.big-action.in_progress { background: var(--green); }
.big-action.completed { background: var(--ink); }

.pin-box { text-align: center; padding: 14px; background: var(--bg); border-radius: 12px; }
.pin-box .pin { font-size: 26px; font-weight: 800; letter-spacing: 0.15em; }

.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  animation: spin 0.7s linear infinite; vertical-align: -3px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.tabbar {
  display: flex; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff;
  box-shadow: 0 -2px 10px rgba(20, 24, 26, 0.05);
}
.tabbar button { flex: 1; padding: 12px 0; background: none; border: none; font-size: 12px; color: var(--muted); font-weight: 600; cursor: pointer; transition: color 0.15s ease; }
.tabbar button.active { color: var(--green-dark); }
.tabbar .tab-icon { display: flex; justify-content: center; margin-bottom: 2px; }

.review-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.review-row:last-child { border-bottom: none; }
.stars { color: #e0a300; display: inline-flex; gap: 1px; }
.waiting-icon { color: var(--muted); display: flex; justify-content: center; }
.inline-icon { display: inline-flex; vertical-align: -3px; margin-right: 4px; }

/* --- Offline banner -------------------------------------------------------
   Pinned to the top so it is visible on whatever screen the user is on. The
   point is that they never wonder whether a tap registered or the network
   ate it. */
.offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  background: var(--danger);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-top, 0px));
  transform: translateY(-100%);
  transition: transform .25s ease;
}
.offline-banner.on { transform: translateY(0); }


/* ==========================================================================
   REAL-DEVICE FIXES (7 Aug 2026)
   Issues that only show up on an actual phone, not in a desktop browser.
   ========================================================================== */

/* 1. iOS Safari zooms the whole page whenever a focused input has a font
      smaller than 16px. The rider then has to pinch back out mid-booking.
      16px is the minimum that prevents it — this is not a style choice. */
input, select, textarea { font-size: 16px; }

/* 2. On iPhones with a home indicator (X and later) the bottom tab bar sits
      underneath it, so the bottom few pixels of each button aren't tappable.
      Pad by the safe area the device reports. */
.tabbar {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 3. 100vh on mobile means "viewport with the URL bar hidden", so content is
      taller than the visible area and jumps as the bar collapses. dvh is the
      dynamic viewport height; the 100vh line stays first as a fallback for
      older browsers. */
.app { min-height: 100vh; min-height: 100dvh; }

/* 4. Tap targets. Apple's guideline is 44pt, Google's 48dp. The tab buttons
      were ~40px, which is the difference between a confident tap and a
      missed one for someone in a moving car. */
.tabbar button { min-height: 48px; }
button, .suggestions button { min-height: 44px; }

/* 5. Suppress the grey/blue flash iOS and Android draw over tapped elements —
      we already have our own :active states. */
* { -webkit-tap-highlight-color: transparent; }

/* 6. Stop the whole page rubber-banding when a scrollable list hits its end,
      which on iOS makes the app feel like a web page rather than an app. */
body { overscroll-behavior-y: none; }

/* 7. Long place names and email addresses must wrap rather than force the
      layout wider than the screen — a horizontal scrollbar on a 320px
      phone breaks every screen at once. */
body { overflow-x: hidden; }
.sug-name, .sug-sub, .card { overflow-wrap: anywhere; }

/* --- Driver flight status -------------------------------------------------
   Answers "should I set off yet". A cancellation is shown as a full alert,
   because a driver who misses it drives to NAIA and waits for nobody. */
.flight-strip { border-left: 3px solid var(--green); }
.flight-strip s { color: var(--muted); font-weight: 400; }
.flight-note { margin-top: 10px; font-size: 13px; color: var(--muted); }
.flight-alert {
  background: var(--danger); color: #fff; border-radius: var(--radius);
  padding: 14px 16px; margin: 14px 0; font-size: 14px; line-height: 1.5;
}
.flight-alert b { display: block; font-size: 15px; margin-bottom: 4px; letter-spacing: .3px; }
.flight-sim {
  margin-top: 10px; font-size: 12px; font-weight: 600; color: #8a6d00;
  background: #fff8e1; border-radius: 8px; padding: 8px 10px;
}


/* The coming-soon screen uses an <a> for its main action so it can carry an
   href to WhatsApp. The button styles are element-scoped (button.primary),
   so an anchor got none of them and rendered as a plain blue link. */
a.primary {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 15px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  min-height: 44px;
  box-sizing: border-box;
}
a.primary.green { background: var(--green); color: #fff; }
a.primary:active { opacity: .92; }
