/* =====================================================================
   Hamsafar PWA styles
   Mobile first. Glass surfaces over a full screen map. Light and dark.
   Every interactive element is at least 48 x 48 px.
   ===================================================================== */

:root {
    --brand: #0f766e;
    --brand-strong: #0b5f58;
    --brand-soft: rgba(15, 118, 110, 0.12);
    --warm: #b45309;
    --warm-soft: #fef3c7;
    --danger: #b91c1c;
    --ok: #15803d;
    --pickup: #16a34a;
    --dropoff: #dc2626;

    --text: #0f172a;
    --muted: #475569;
    --line: rgba(15, 23, 42, 0.12);
    --surface: rgba(255, 255, 255, 0.78);
    --surface-solid: #ffffff;
    --surface-2: rgba(241, 245, 249, 0.9);
    --glass-border: rgba(255, 255, 255, 0.65);
    --shadow: 0 12px 40px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
    --focus: 0 0 0 3px rgba(15, 118, 110, 0.45);

    --radius-lg: 24px;
    --radius: 16px;
    --radius-sm: 12px;
    --tap: 48px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}

:root[data-theme="dark"] {
    --brand: #2dd4bf;
    --brand-strong: #5eead4;
    --brand-soft: rgba(45, 212, 191, 0.14);
    --warm: #fbbf24;
    --warm-soft: rgba(251, 191, 36, 0.14);
    --danger: #f87171;
    --ok: #4ade80;
    --text: #e2e8f0;
    --muted: #a3b1c6;
    --line: rgba(226, 232, 240, 0.14);
    --surface: rgba(15, 23, 42, 0.72);
    --surface-solid: #0f172a;
    --surface-2: rgba(30, 41, 59, 0.85);
    --glass-border: rgba(148, 163, 184, 0.22);
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    --focus: 0 0 0 3px rgba(45, 212, 191, 0.5);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: var(--font); color: var(--text); background: var(--surface-solid); font-size: 16px; line-height: 1.45; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
p { margin: 6px 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* Glass surface */
.glass {
    background: var(--surface);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass { background: var(--surface-solid); }
}

/* ---------------- Map ---------------- */
#map { position: fixed; inset: 0; z-index: 0; background: #dfe7ef; }
:root[data-theme="dark"] #map { background: #0b1220; }
/* Day: slightly richer and higher contrast OSM tiles. Night: inverted and re-tinted tiles; markers keep their colours. */
#map .leaflet-tile-pane { filter: saturate(1.05) contrast(1.06); transition: filter 0.4s ease; }
:root[data-theme="dark"] #map .leaflet-tile-pane { filter: invert(1) hue-rotate(185deg) brightness(0.92) contrast(1.1) saturate(0.6); }
.leaflet-control-attribution { font-size: 10px; background: var(--surface) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--brand); }
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-solid); color: var(--text); }

/* Markers */
.pin { width: 34px; height: 44px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.pin svg { width: 100%; height: 100%; display: block; }
.vehicle-marker { width: 44px; height: 44px; display: grid; place-items: center; }
.vehicle-marker .body {
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface-solid); box-shadow: 0 3px 10px rgba(0,0,0,.35);
    border: 2px solid var(--brand);
    transition: transform 0.9s linear;
}
.vehicle-marker .body svg { width: 26px; height: 26px; display: block; }
.vehicle-marker.mine .body { border-color: #2563eb; }
.me-dot { width: 22px; height: 22px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.25); }
.pulse-ring { width: 120px; height: 120px; position: relative; pointer-events: none; }
.pulse-ring span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand); opacity: 0; animation: ring 2.4s var(--ease) infinite; }
.pulse-ring span:nth-child(2) { animation-delay: 0.8s; }
.pulse-ring span:nth-child(3) { animation-delay: 1.6s; }
@keyframes ring { 0% { transform: scale(0.2); opacity: 0.9; } 100% { transform: scale(1); opacity: 0; } }

/* ---------------- Top bar ---------------- */
.topbar {
    position: fixed; z-index: 1100; top: 0; left: 0; right: 0;
    padding: calc(10px + env(safe-area-inset-top)) 12px 0;
    display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.greeting { border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; min-width: 0; flex: 1; max-width: 460px; }
.greeting-salaam {
    font-weight: 800; font-size: 17px; color: var(--warm); line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.greeting-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.conn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.conn[data-state="live"] .conn-dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(22,163,74,.2); }
.conn[data-state="reconnecting"] .conn-dot { background: #f59e0b; animation: blink 1s infinite; }
.conn[data-state="polling"] .conn-dot { background: #f59e0b; }
@keyframes blink { 50% { opacity: 0.3; } }

.icon-btn {
    width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line);
    display: grid; place-items: center; cursor: pointer; color: var(--text); background: var(--surface-2); padding: 0;
    transition: transform 0.15s var(--ease);
}
.icon-btn:active { transform: scale(0.92); }
.ico { width: 22px; height: 22px; flex: none; }
.fab {
    position: fixed; z-index: 1050; right: 14px; width: 52px; height: 52px; border-radius: 50%;
    display: grid; place-items: center; color: var(--brand); cursor: pointer;
    bottom: calc(var(--sheet-visible, 46vh) + 14px); transition: bottom 0.35s var(--ease), transform 0.15s var(--ease);
}
.fab:active { transform: scale(0.92); }

.offline-banner {
    position: fixed; z-index: 1200; left: 50%; transform: translateX(-50%);
    top: calc(78px + env(safe-area-inset-top)); background: #7c2d12; color: #fff;
    padding: 10px 16px; border-radius: 16px; font-size: 14px; box-shadow: var(--shadow); max-width: 92vw; width: max-content; text-align: center;
}

/* ---------------- Bottom sheet ---------------- */
.sheet {
    position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0;
    height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex; flex-direction: column;
    transform: translateY(var(--sheet-offset, 46vh));
    transition: transform 0.38s var(--ease);
    will-change: transform; touch-action: none;
}
.sheet.dragging { transition: none; }
.sheet-handle { min-height: var(--tap); display: grid; place-items: center; cursor: grab; flex: none; }
.grabber { width: 44px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.5; }
/* The scroll area matches the part of the sheet that is on screen, so everything can be scrolled into view. */
.sheet-body {
    overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
    padding: 0 18px calc(16px + env(safe-area-inset-bottom)); flex: none;
    max-height: calc(var(--sheet-visible, 46vh) - 44px);
}
/* The main action stays visible at the bottom of the panel while the content above scrolls. */
.sticky-cta {
    position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); z-index: 3;
    margin: 8px -18px 0; padding: 4px 18px calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, transparent, var(--surface-solid) 22%);
}
.sticky-cta .btn.block { margin-top: 10px; }

/* Large screens: floating side panel instead of a sheet */
@media (min-width: 900px) {
    .sheet {
        left: 16px; right: auto; top: 92px; bottom: 16px; width: 400px; height: auto;
        border-radius: var(--radius-lg); transform: none !important; touch-action: auto;
    }
    .sheet-handle { display: none; }
    .sheet-body { padding-top: 18px; max-height: none; flex: 1; }
    .fab { bottom: 24px !important; }
    .greeting { max-width: 400px; }
}

/* ---------------- Typography and forms ---------------- */
.brand { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; color: var(--brand); margin-top: 4px; }
.hint { color: var(--muted); font-size: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.field { display: block; margin-top: 12px; border: 0; padding: 0; }
.field > span, .field > legend { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
input:not([type=radio]):not([type=checkbox]) {
    width: 100%; min-height: var(--tap); padding: 12px 14px; font: inherit; font-size: 16px; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }
input::placeholder { color: var(--muted); opacity: 0.8; }

/* Buttons */
.btn {
    min-height: var(--tap); padding: 12px 18px; border-radius: var(--radius-sm); border: 0;
    font: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.12s var(--ease), background 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 14px; }
.btn.big { min-height: 56px; font-size: 17px; border-radius: var(--radius); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(15, 118, 110, 0.35); }
:root[data-theme="dark"] .btn.primary { color: #042f2e; }
.btn.primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.danger-ghost { background: transparent; color: var(--danger); border: 1px solid currentColor; }
.btn.text { background: none; color: var(--brand); padding: 12px 8px; min-width: var(--tap); }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
    content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

/* Segmented controls */
.segmented { display: flex; gap: 4px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px; margin-top: 14px; border: 1px solid var(--line); }
.seg, .seg-radio span {
    flex: 1; min-height: var(--tap); border: 0; border-radius: 9px; background: none; color: var(--muted);
    font: inherit; font-weight: 700; cursor: pointer; display: grid; place-items: center; text-align: center; padding: 0 8px;
}
.seg-radio { flex: 1; display: flex; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg.active, .seg-radio input:checked + span { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.seg-radio input:focus-visible + span { box-shadow: var(--focus); }
.field .segmented { margin-top: 0; }

.settings { margin-top: 18px; font-size: 14px; }
.settings summary { cursor: pointer; color: var(--brand); min-height: var(--tap); display: flex; align-items: center; font-weight: 600; }

/* ---------------- Booking ---------------- */
.route-inputs { display: grid; grid-template-columns: 18px 1fr var(--tap); gap: 10px; align-items: center; margin-top: 12px; }
.route-line { display: flex; flex-direction: column; align-items: center; height: 82px; justify-content: space-between; padding: 18px 0; }
.route-line .line { flex: 1; width: 2px; background: repeating-linear-gradient(var(--muted) 0 4px, transparent 4px 8px); margin: 4px 0; opacity: 0.6; }
.route-fields { display: grid; gap: 8px; min-width: 0; }
.place { position: relative; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.dot.pickup { background: var(--pickup); box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.dot.dropoff { background: var(--dropoff); box-shadow: 0 0 0 3px rgba(220,38,38,.2); border-radius: 3px; }

.results {
    list-style: none; margin: 6px 0 0; padding: 4px; border-radius: var(--radius-sm);
    background: var(--surface-solid); border: 1px solid var(--line); box-shadow: var(--shadow);
    max-height: 260px; overflow-y: auto; position: relative; z-index: 2;
}
.results li { min-height: var(--tap); padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.results li .muted { display: block; font-size: 12px; }
.results li:hover, .results li:focus, .results li[aria-selected="true"] { background: var(--brand-soft); outline: none; }

.trip-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }

.vehicles { display: grid; gap: 10px; margin-top: 10px; }
.vehicle {
    display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px;
    min-height: 72px; padding: 10px 14px; border-radius: var(--radius); cursor: pointer;
    background: var(--surface-2); border: 2px solid transparent; text-align: left; font: inherit; color: var(--text);
    transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease);
}
.vehicle:active { transform: scale(0.985); }
.vehicle[aria-checked="true"] { border-color: var(--brand); background: var(--brand-soft); }
.vehicle .v-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-solid); }
.vehicle .v-icon svg { width: 36px; height: 36px; }
.vehicle .v-name { font-weight: 800; font-size: 16px; }
.vehicle .v-sub { font-size: 13px; color: var(--muted); }
.vehicle .v-fare { text-align: right; font-weight: 800; font-size: 18px; }
.vehicle .v-fare .badge { margin-top: 4px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--brand-soft); color: var(--brand); }
.badge.warm { background: var(--warm-soft); color: var(--warm); }

.skeleton-group { display: grid; gap: 10px; margin-top: 14px; }
.skeleton { height: 72px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- Trip states ---------------- */
.stepper { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 0; margin: 8px 0 14px; }
.stepper li { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding-top: 10px; position: relative; }
.stepper li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; border-radius: 3px; background: var(--line); transition: background 0.4s; }
.stepper li.done::before, .stepper li.current::before { background: var(--brand); }
.stepper li.current { color: var(--text); }

.status-hero { display: flex; align-items: center; gap: 14px; }
.radar { width: 56px; height: 56px; flex: none; position: relative; border-radius: 50%; background: var(--brand-soft); }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand); opacity: 0; animation: ring 2s var(--ease) infinite; }
.radar span:nth-child(2) { animation-delay: 0.66s; }
.radar span:nth-child(3) { animation-delay: 1.33s; }
.radar.still span { animation: none; opacity: 0; }
.radar.still { background: var(--brand); }
.radar.still::after { content: "\2713"; color: #fff; font-size: 26px; font-weight: 900; position: absolute; inset: 0; display: grid; place-items: center; }

.driver-card {
    display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
    margin-top: 14px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line);
    animation: rise 0.45s var(--ease);
}
.avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 20px; color: #fff; background: linear-gradient(135deg, var(--brand), #0ea5e9); }
.driver-info { display: flex; flex-direction: column; min-width: 0; }
.driver-info strong { font-size: 17px; }
.plate { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 800; padding: 6px 10px; border-radius: 8px; background: #fde047; color: #111827; border: 2px solid #111827; letter-spacing: 0.04em; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 14px; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #0ea5e9); transition: width 1s linear; }

.trip-summary { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 14px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); }
.trip-points p { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 14px; }
.fare-box { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.fare-box strong { font-size: 22px; }

/* ---------------- Driver ---------------- */
.earnings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.earnings > div { padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; }
.earnings strong { font-size: 17px; }

.online-switch { display: flex; align-items: center; gap: 14px; margin-top: 14px; min-height: 64px; padding: 8px 14px; border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
.online-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { width: 60px; height: 34px; border-radius: 17px; background: #94a3b8; position: relative; flex: none; transition: background 0.25s; }
.thumb { position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform 0.25s var(--ease); }
.online-switch input:checked + .track { background: var(--ok); }
.online-switch input:checked + .track .thumb { transform: translateX(26px); }
.online-switch input:focus-visible + .track { box-shadow: var(--focus); }
.online-label { display: flex; flex-direction: column; }

.card { margin-top: 14px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.big-fare { font-size: 22px; }
.request-list { display: grid; gap: 10px; }
.request { padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); animation: rise 0.35s var(--ease); }
.request.securing { opacity: 0.7; }
.request .row-between strong { font-size: 20px; }

/* ---------------- Toasts ---------------- */
.toast-stack {
    position: fixed; z-index: 1300; left: 50%; transform: translateX(-50%);
    top: calc(84px + env(safe-area-inset-top)); display: grid; gap: 8px; width: min(440px, 92vw); pointer-events: none;
}
.toast {
    padding: 12px 16px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
    background: #0f172a; color: #f8fafc; box-shadow: var(--shadow); animation: drop 0.3s var(--ease);
}
:root[data-theme="dark"] .toast { background: #f8fafc; color: #0f172a; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* Respect people who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
/* Windows high contrast and forced colours. */
@media (forced-colors: active) {
    .glass, .btn, .vehicle, .card { border: 1px solid CanvasText; }
}

/* =====================================================================
   Growth, trust and driver tools
   ===================================================================== */

/* Drawers (native dialogs): bottom sheet on phones, centred card on large screens */
.drawer {
    padding: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; color: var(--text);
    width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; background: var(--surface-solid);
}
.drawer::backdrop { background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); }
.drawer[open] { animation: rise 0.3s var(--ease); }
.drawer-body { padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 4px; }
@media (min-width: 900px) {
    .drawer { max-width: 460px; margin: auto; border-radius: var(--radius-lg); }
}

.icon-btn.small { width: 36px; height: 36px; }
.ico.tiny { width: 14px; height: 14px; vertical-align: -2px; }

/* Promo */
.promo-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.promo-applied { display: inline-flex; align-items: center; gap: 4px; }
.promo-list { display: grid; gap: 8px; margin-top: 10px; }
.promo-chip {
    display: grid; gap: 2px; text-align: left; width: 100%; min-height: var(--tap); padding: 10px 12px; cursor: pointer;
    border-radius: var(--radius-sm); border: 1px dashed var(--brand); background: var(--brand-soft); color: var(--text); font: inherit;
}
.promo-chip strong { color: var(--brand); font-family: ui-monospace, Menlo, monospace; }
.vehicle .v-fare s { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }

/* Invite */
.invite { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.invite-code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.04em; }

/* Ratings and tips */
.stars { display: flex; gap: 4px; margin: 8px 0; }
.star { width: var(--tap); height: var(--tap); border: 0; background: none; cursor: pointer; font-size: 32px; line-height: 1; color: #cbd5e1; padding: 0; }
.star[aria-checked="true"] { color: #f59e0b; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.chip-btn { min-height: var(--tap); min-width: var(--tap); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.chip-btn[aria-checked="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Chat buttons and unread badges */
.chat-btn { position: relative; }
.unread { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; padding: 0 5px; }
.driver-card { grid-template-columns: 52px 1fr auto auto; }
.btn-row.three { grid-template-columns: 1fr 1fr 1fr; }
.btn-row.three .btn { padding: 12px 8px; font-size: 15px; }

/* SOS */
.sos-fab {
    position: fixed; z-index: 1060; left: 14px; width: 60px; height: 60px; border-radius: 50%;
    bottom: calc(var(--sheet-visible, 46vh) + 14px); transition: bottom 0.35s var(--ease), transform 0.15s var(--ease);
    background: #dc2626; color: #fff; border: 3px solid #fff; font-weight: 900; font-size: 15px; letter-spacing: 0.04em; cursor: pointer;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.55); animation: sos-pulse 2.4s infinite;
}
.sos-fab:active { transform: scale(0.92); }
@keyframes sos-pulse { 0%, 100% { box-shadow: 0 6px 20px rgba(220,38,38,.55), 0 0 0 0 rgba(220,38,38,.45); } 50% { box-shadow: 0 6px 20px rgba(220,38,38,.55), 0 0 0 12px rgba(220,38,38,0); } }
@media (min-width: 900px) { .sos-fab { left: auto; right: 80px; bottom: 24px !important; } }
.btn.danger { background: #dc2626; color: #fff; }
.emergency-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.emergency-grid a {
    display: grid; place-items: center; min-height: 72px; border-radius: var(--radius); text-decoration: none;
    background: #fee2e2; color: #991b1b; font-weight: 900; font-size: 22px; text-align: center; line-height: 1.1;
}
.emergency-grid a span { font-size: 12px; font-weight: 700; }
:root[data-theme="dark"] .emergency-grid a { background: rgba(220,38,38,.2); color: #fecaca; }
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.contact-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--tap); padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.contact-actions { display: flex; gap: 6px; align-items: center; }
#sosResult .row-between { margin-top: 8px; }
.contact-actions a { min-height: var(--tap); min-width: 48px; justify-content: center; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 700; text-decoration: none; }
.contact-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 8px; }
@media (max-width: 420px) { .contact-form { grid-template-columns: 1fr 1fr; } .contact-form .btn { grid-column: span 2; } }

/* Chat */
.drawer.chat { height: 88vh; }
.chat-body { height: 100%; grid-template-rows: auto 1fr auto auto; }
.e2ee { display: flex; align-items: center; gap: 4px; color: var(--ok); }
.messages { list-style: none; margin: 8px 0; padding: 4px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.messages li { max-width: 80%; padding: 8px 12px; border-radius: 16px; font-size: 15px; word-wrap: break-word; }
.messages li.mine { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
:root[data-theme="dark"] .messages li.mine { color: #042f2e; }
.messages li.theirs { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.messages li time { display: block; font-size: 11px; opacity: 0.7; margin-top: 2px; }
.messages li.system { align-self: center; background: none; color: var(--muted); font-size: 13px; text-align: center; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* Wallet */
.earnings { width: 100%; border: 0; padding: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.wallet-hero { display: grid; gap: 2px; text-align: center; padding: 18px 12px; margin-top: 12px; border-radius: var(--radius); background: linear-gradient(135deg, var(--brand-soft), transparent); }
.wallet-hero strong { font-size: 36px; font-weight: 900; color: var(--brand); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat-grid > div { padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; }
.stat-grid strong { font-size: 17px; }
.owed { border-color: var(--warm); }
.bar-chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 120px; padding: 6px 0; }
.bar-chart .bar { background: var(--brand); border-radius: 4px 4px 0 0; min-height: 3px; position: relative; }
.bar-chart .bar.today { background: var(--warm); }
.bar-chart .bar span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.ledger { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 6px; }
.ledger li { display: flex; justify-content: space-between; gap: 8px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; }
.ledger li .amount { white-space: nowrap; }
.ledger li .amount.plus { color: var(--ok); font-weight: 800; }
.ledger li .amount.minus { color: var(--muted); font-weight: 800; }

/* Offline outbox: actions saved on the phone, waiting for signal */
.offline-queue { display: block; font-weight: 700; margin-top: 2px; }
.outbox-pill { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 74px); z-index: 650;
    padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; max-width: calc(100vw - 32px); text-align: center; }

/* Cash at the end of a trip */
.cash-due { font-size: 18px; margin: 4px 0 0; }
.cash-due strong { font-size: 28px; color: var(--brand); display: block; }

/* Ride offers */
.request .offer { display: inline-block; margin-top: 4px; }
.request .btn-row { margin-top: 10px; grid-template-columns: 1fr 2fr; }

/* Driver statement */
.statement { display: grid; gap: 8px; margin-top: 10px; }
.statement details { border-radius: var(--radius-sm); background: var(--surface-2); }
.statement summary { min-height: var(--tap); display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 12px; cursor: pointer; font-weight: 700; list-style: none; }
.statement summary::-webkit-details-marker { display: none; }
.statement summary .muted { font-weight: 600; }
.statement .ledger { margin: 0; padding: 0 8px 8px; }
.statement .ledger li { background: var(--surface); }
.tag { display: inline-block; margin: 2px 4px 0 0; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.tag.warn { background: var(--warm-soft); color: var(--warm); }
