:root{
  --ink:#14171F; --ink-2:#1B1F2C; --ink-3:#2B3044;
  --paper:#F6F3EC; --paper-2:#FFFFFF; --paper-soft:#EEEADC;
  --ink-soft:#5B5F72; --line:#E6E1D2;
  --amber:#E7A23A; --amber-deep:#C27F1F; --amber-pale:#F6DDB0;
  --go:#3E9C6F; --go-pale:#D9EFE2;
  --stop:#D45B45; --stop-pale:#F7DAD3;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  background: var(--ink);
  color: var(--ink);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}

.hidden { display: none !important; }

/* ================= views ================= */
.view {
  position: relative;
  z-index: 1;
  padding: 18px;
}

#view-login, #view-register {
  min-height: 100vh;
  padding: 0;
  background: var(--ink);
  display: flex;
  flex-direction: column;
}

.hero-brand {
  padding: 30px 24px 18px;
  flex: 1;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.hero-brand.small { flex: 0 0 auto; min-height: 0; justify-content: flex-start; padding: 30px 24px 14px; }
.wordmark {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.55rem; font-weight: 800; color: var(--paper); letter-spacing: -0.02em;
}
.wordmark .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); display: inline-block; flex: 0 0 auto; }
.tagline { color: #9CA1B8; font-size: 0.85rem; margin: 5px 0 0; }
.hero-illustration { width: 100%; height: 84px; margin-top: 18px; display: block; }

.login-card {
  background: var(--paper);
  border-radius: 22px 22px 0 0;
  padding: 26px 22px 30px;
  box-shadow: 0 -16px 30px -20px rgba(20,23,31,.5);
  position: relative;
  z-index: 1;
}
.login-card h2 { color: var(--ink); font-size: 1.15rem; margin: 0 0 4px; }
.hint.light { color: var(--ink-soft); margin: 0 0 4px; }

.login-toggle { text-align: center; font-size: 0.82rem; color: var(--ink-soft); margin-top: 16px; }
.login-toggle button {
  display: inline; width: auto; margin: 0; padding: 0; background: none; border: none;
  color: var(--amber-deep); font-weight: 700; font-size: inherit; font-family: inherit;
  cursor: pointer; text-decoration: underline;
}
.login-toggle button:active { background: none; }

.otp-row { display: flex; gap: 5px; margin-top: 10px; }
.otp-row .otp-box {
  flex: 1; min-width: 0; height: 48px; text-align: center; padding: 0 2px;
  font-size: 1.05rem; font-weight: 700;
}
.otp-row .otp-box:focus { outline: 2px solid var(--amber); outline-offset: 1px; }

#view-rate {
  min-height: 100vh;
  background: var(--paper);
}
#view-rate h2 { font-size: 1.2rem; margin: 0 0 4px; color: var(--ink); }
#view-rate h3 { font-size: 0.95rem; color: var(--ink-soft); margin: 18px 0 6px; }

/* Request + Status share the map-first "bottom sheet over a full-bleed map"
   layout. #map-container is a sibling, not a parent, of these views in the
   HTML, so this is achieved purely with absolute positioning inside the
   shared #app containing block — no structural changes needed. */
#view-request, #view-status {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -14px 30px -18px rgba(20,23,31,.35);
  max-height: 62vh;
  overflow-y: auto;
  padding: 18px 18px 22px;
}
#view-request h2, #view-status h2 { font-size: 1.05rem; margin: 0 0 4px; color: var(--ink); }

label {
  display: block;
  margin: 14px 0 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--paper-2);
  color: var(--ink);
}
#view-login input { background: var(--paper-2); }

textarea { min-height: 70px; resize: vertical; }

button {
  width: 100%;
  padding: 13px;
  margin-top: 16px;
  border: none;
  border-radius: 13px;
  background: var(--amber);
  color: #241703;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.btn-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(36,23,3,.3); border-top-color: #241703;
  animation: btn-spin .7s linear infinite;
  flex: 0 0 auto;
}
.btn-spinner[hidden] { display: none; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spinner { animation-duration: 1.4s; } }
button:active { background: var(--amber-deep); }
button:disabled { background: var(--line); color: var(--ink-soft); cursor: not-allowed; }

button.secondary {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
#view-login button.secondary,
#view-login button:not(.secondary) { background: var(--amber); }

/* ================= inline error convention ================= */
.error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  background: var(--stop-pale);
  color: #6B241A;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: 0.82rem;
  line-height: 1.4;
  margin-top: 10px;
}
.error[hidden] { display: none; }
.error .error-icon { flex: 0 0 auto; margin-top: 1px; color: #6B241A; }

.hint {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 4px 0;
  line-height: 1.4;
}

.search-box { margin-bottom: 6px; }
.search-box .place-input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 0.95rem; font-family: inherit; background: var(--paper-2); color: var(--ink);
}
.search-box .place-input::placeholder { color: var(--ink-soft); }
.search-box .place-input:focus { outline: 2px solid var(--amber); outline-offset: 1px; }
/* Google's suggestion dropdown is appended to <body>, not this container, so
   it can only be reached with the .pac-container selector it ships with. */
.pac-container {
  border-radius: 12px; border: 1px solid var(--line); margin-top: 4px;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; box-shadow: 0 10px 24px rgba(20,23,31,.18);
}
.pac-item { padding: 9px 12px; font-size: 0.85rem; border-color: var(--line); }
.pac-item-query { color: var(--ink); }
.pac-matched { color: var(--amber-deep); }
.selected-address {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink);
  font-weight: 600;
  min-height: 1.1em;
  margin: 2px 0 8px;
}
.selected-address[hidden] { display: none; }
.selected-address .pin-icon-inline { flex: 0 0 auto; color: var(--amber); }

.location-btn {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 0.85rem;
  padding: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

/* ================= map (full-bleed, behind the sheet) ================= */
#map-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 25% 20%, rgba(231,162,58,.10), transparent 42%),
    repeating-linear-gradient(115deg, var(--ink-3) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(25deg, var(--ink-3) 0 1px, transparent 1px 58px),
    var(--ink-2);
}
#map-container.hidden { display: none; }
#map { height: 100%; width: 100%; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,23,31,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--paper);
  border-radius: 18px;
  padding: 22px 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}
.modal-box .modal-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--amber-pale); color: var(--amber-deep);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.modal-box h3 { margin: 0 0 8px; font-size: 1rem; color: var(--ink); }
.modal-box p { font-size: 0.85rem; margin: 6px 0; color: var(--ink-soft); line-height: 1.5; }

.estimate-box {
  margin-top: 14px;
  padding: 13px 14px;
  background: var(--paper-soft);
  border-radius: 14px;
}
.estimate-box p { margin: 3px 0; font-size: 0.88rem; color: var(--ink); }
.estimate-box p:first-child { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ================= payment method row ================= */
.payment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-soft);
  border-radius: 13px;
  padding: 10px 12px;
  margin-top: 10px;
}
.payment-row .payment-icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--paper-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); flex: 0 0 auto;
}
.payment-row .payment-meta { flex: 1; min-width: 0; }
.payment-row .payment-meta .l { font-size: 0.65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.payment-row .payment-meta .v { font-size: 0.85rem; font-weight: 700; color: var(--ink); }

/* ================= trip-status panels ================= */
.status-panel.hidden { display: none; }
#view-status h2 { font-size: 1.05rem; margin: 0 0 6px; color: var(--ink); }

.tier-note {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 700; color: var(--amber-deep);
  background: var(--amber-pale); padding: 4px 9px; border-radius: 999px; margin-top: 8px;
}

.eta-line {
  display: flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: 0.9rem; color: var(--ink); margin-bottom: 4px;
}
.eta-line svg { color: var(--amber); flex: 0 0 auto; }

.driver-row { display: flex; align-items: center; gap: 11px; }
.driver-row .driver-meta { flex: 1; min-width: 0; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  background: var(--amber-pale); color: var(--amber-deep); border: none;
  display: flex; align-items: center; justify-content: center;
  padding: 0; margin: 0; margin-left: auto; cursor: pointer;
}
.icon-btn.hidden { display: none; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--amber-pale); color: var(--amber-deep);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem; flex: 0 0 auto;
}
.driver-meta p { margin: 0; font-size: 0.85rem; }
.driver-meta p:last-child { color: var(--ink-soft); font-size: 0.78rem; margin-top: 1px; }

.link-btn {
  background: none; border: none; color: var(--ink-soft);
  font-size: 0.82rem; text-decoration: underline; cursor: pointer;
  font-family: inherit; width: auto; padding: 6px 0; margin-top: 8px; display: block;
}

.arrived-banner {
  background: var(--go-pale); border-radius: 14px; padding: 13px 14px;
  display: flex; align-items: center; gap: 11px;
}
.arrived-icon {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--go); color: #fff;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.arrived-banner .t { font-weight: 800; font-size: 0.9rem; color: #1E6B44; }
.arrived-banner .s { font-size: 0.78rem; color: #2E5A44; }
.waiting-timer {
  text-align: center; font-size: 0.72rem; color: var(--ink-soft);
  margin: 8px 0 0; font-variant-numeric: tabular-nums;
}

.stop-focus {
  display: flex; align-items: center; gap: 9px; margin-top: 12px;
  padding: 10px 12px; background: var(--paper-soft); border-radius: 12px;
}
.stop-focus .l { font-size: 0.65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.stop-focus .a { font-size: 0.85rem; font-weight: 700; color: var(--ink); }

.recovery { text-align: center; padding: 20px 6px; }
.recovery-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 10px;
}
.recovery-icon.warn { background: var(--amber-pale); color: var(--amber-deep); }
.recovery-icon.muted { background: var(--paper-soft); color: var(--ink-soft); }
.recovery h2 { text-align: center; }
.recovery p { font-size: 0.85rem; color: var(--ink-soft); line-height: 1.5; max-width: 280px; margin: 0 auto; }
.recovery button:not(.link-btn) { max-width: 260px; margin-left: auto; margin-right: auto; }

#driver-info {
  margin: 14px 0;
  padding: 12px;
  background: var(--paper-soft);
  border-radius: 14px;
}

.check-badge {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--go-pale); color: #1E6B44;
  display: flex; align-items: center; justify-content: center;
  margin: 26px auto 6px;
}
#view-rate h2 { color: var(--ink); }

.fare-total {
  background: var(--paper-soft); border-radius: 14px; padding: 14px; text-align: center; margin-top: 8px;
}
.fare-total .l { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.fare-total .v { font-size: 1.5rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 2px; }
.fare-total .s { font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }

#star-rating {
  display: flex; justify-content: center; gap: 6px;
  color: var(--line);
  margin: 10px 0;
}
#star-rating span { cursor: pointer; display: inline-flex; }
#star-rating span.selected { color: var(--amber); }

/* ================= sheet topbar / menu button ================= */
.sheet-topbar { display: flex; justify-content: flex-start; margin-bottom: 4px; }
.menu-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--paper-soft); border: 1px solid var(--line);
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  padding: 0; margin: 0; cursor: pointer;
}

/* ================= navigation drawer ================= */
.drawer-overlay {
  position: absolute; inset: 0; background: rgba(20,23,31,.5);
  z-index: 50; opacity: 1; transition: opacity .25s ease;
}
.drawer-overlay.hidden { display: none; }
.drawer-panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: 78%; max-width: 300px;
  background: var(--paper); box-shadow: 10px 0 26px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
}
.drawer-profile { padding: 22px 18px 16px; border-bottom: 1px solid var(--line); }
.drawer-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--amber-pale); color: var(--amber-deep);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; margin-bottom: 10px;
}
.drawer-profile .name { font-weight: 800; font-size: 0.9rem; color: var(--ink); }
.drawer-profile .email { font-size: 0.75rem; color: var(--ink-soft); }
.drawer-menu { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.drawer-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  border: none; background: none; text-align: left; font-family: inherit;
  font-size: 0.88rem; font-weight: 600; color: var(--ink); cursor: pointer; width: 100%;
  margin: 0;
}
.drawer-item svg { flex: 0 0 auto; color: var(--ink-soft); }
.drawer-footer { padding: 14px 8px 18px; border-top: 1px solid var(--line); }
.drawer-item.signout { color: var(--stop); }
.drawer-item.signout svg { color: var(--stop); }

/* ================= subscreens reached from the drawer ================= */
.subscreen-header { display: flex; align-items: center; gap: 11px; margin-bottom: 8px; }
.back-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--paper-2); display: flex; align-items: center; justify-content: center;
  color: var(--ink); flex: 0 0 auto; padding: 0; margin: 0; cursor: pointer;
}
.subscreen-header h2 { margin: 0; font-size: 1.05rem; color: var(--ink); }

#view-history, #view-account, #view-deactivated { min-height: 100vh; background: var(--paper); }

.history-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; border-radius: 14px; background: var(--paper-soft); margin-top: 8px;
}
.history-row .route { font-size: 0.85rem; font-weight: 700; color: var(--ink); }
.history-row .date { font-size: 0.72rem; color: var(--ink-soft); margin-top: 1px; }
.history-row .history-price { font-size: 0.88rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.history-row.cancelled .history-price { color: var(--ink-soft); }

.account-card { background: var(--paper-soft); border-radius: 16px; padding: 18px; text-align: center; margin-top: 6px; }
.account-avatar {
  width: 54px; height: 54px; border-radius: 50%; background: var(--amber-pale); color: var(--amber-deep);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; margin: 0 auto 10px;
}
.account-card .name { font-weight: 800; font-size: 0.95rem; color: var(--ink); }
.account-card .email { font-size: 0.8rem; color: var(--ink-soft); margin-top: 2px; }
.account-rows { margin-top: 16px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.account-row { display: flex; justify-content: space-between; padding: 12px 14px; background: var(--paper-2); font-size: 0.85rem; }
.account-row + .account-row { border-top: 1px solid var(--line); }
.account-row .l { color: var(--ink-soft); }
.account-row .v { color: var(--ink); font-weight: 600; }
.account-danger { margin-top: 20px; text-align: center; }
.account-danger .hint { text-align: center; }
.danger-link { color: var(--stop); font-weight: 700; }
.danger-btn { background: var(--stop) !important; color: #fff; }

.deactivated-recovery { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 0 24px; }

.modal-icon.danger { background: var(--stop-pale); color: #6B241A; }

/* ================= map pin radar pulse (searching state) ================= */
.map-pin-radar { position: relative; display: inline-block; }
.map-pin-radar::before, .map-pin-radar::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  width: 14px; height: 14px; margin-left: -7px; margin-top: -14px;
  border-radius: 50%; border: 1.5px solid #E7A23A;
  animation: map-pin-ping 2.2s cubic-bezier(.2,.7,.3,1) infinite;
  pointer-events: none;
}
.map-pin-radar::after { animation-delay: 1.1s; }
@keyframes map-pin-ping {
  0% { transform: scale(1); opacity: .8; }
  100% { transform: scale(6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .map-pin-radar::before, .map-pin-radar::after { animation: none; opacity: .35; }
}
