/* ═══════════════════════════════════════════════════════════════
   XGo 2.0 — نظام التصميم
   خريطة كاملة + بطاقات عائمة · أخضر XGo · ليلي افتراضياً (وفاتح اختياري)
   RTL كامل · الكيبورد/الدوران/الأوفلاين محسوبين
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #121212;
  --surface: #1E1E1E;
  --surface-2: #262626;
  --surface-3: #2F2F2F;
  --ink: #F3F3F3;
  --ink-soft: #A3A3A3;
  --line: #333333;
  --green: #16D33A;
  --green-deep: #0FB02D;
  --green-ink: #0B2A12;
  --green-soft: rgba(22, 211, 58, .14);
  --red: #F2484B;
  --red-soft: rgba(242, 72, 75, .16);
  --blue: #3B82F6;
  --amber: #F5B83D;
  --amber-soft: rgba(245, 184, 61, .15);
  --shadow: 0 12px 32px -10px rgba(0, 0, 0, .65);
  --shadow-sm: 0 4px 14px -6px rgba(0, 0, 0, .55);

  --r-xl: 24px;
  --r-lg: 20px;
  --r-md: 16px;
  --r-sm: 12px;

  --nav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --kb: 0px; /* ارتفاع الكيبورد (iOS عبر visualViewport) */
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F4F5F3;
  --surface: #FFFFFF;
  --surface-2: #F0F1EE;
  --surface-3: #E6E8E4;
  --ink: #161816;
  --ink-soft: #626862;
  --line: #E1E4DF;
  --green: #11B832;
  --green-deep: #0C9628;
  --green-ink: #FFFFFF;
  --green-soft: rgba(17, 184, 50, .12);
  --shadow: 0 12px 32px -12px rgba(20, 24, 20, .28);
  --shadow-sm: 0 4px 14px -6px rgba(20, 24, 20, .2);
  color-scheme: light;
}

/* ── أساسيات ── */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-weight: 700; line-height: 1.3; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }
.danger-text { color: var(--red); }

.ic {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ── شاشة البداية ── */
#splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: #121212; color: #fff;
  transition: opacity .35s, visibility .35s;
}
#splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-mark { border-radius: 26px; box-shadow: 0 14px 40px -10px rgba(22, 211, 58, .5); animation: rise .6s cubic-bezier(.2, .9, .3, 1.2) both; }
.splash-title { font-size: 1.9rem; letter-spacing: .5px; animation: rise .6s .1s both; }
.splash-sub { color: #A3A3A3; animation: rise .6s .18s both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ── شريط الأوفلاين ── */
#offline-bar {
  position: fixed; z-index: 90; top: calc(var(--safe-t) + 8px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: var(--amber); color: #1A1406; font-weight: 600; font-size: .85rem;
  padding: 7px 14px; border-radius: 99px; box-shadow: var(--shadow-sm); white-space: nowrap;
}
#offline-bar .ic { width: 18px; height: 18px; }
/* الشريط ما بيغطي بطاقة المسار — كل شي فوق بينزل شوي */
body.offline .route-card, body.offline .ride-card-top-float, body.offline #installbar { transform: translateY(44px); }
body.offline .active-banner, body.offline .guest-chip { transform: translateY(44px); }

/* ── الشاشات ── */
#app { min-height: 100%; }
.view-page {
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 20px) 16px calc(var(--nav-h) + var(--safe-b) + 24px);
  max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px;
}
.view-login { padding-bottom: calc(var(--safe-b) + 28px); justify-content: safe center; }
@media (orientation: landscape) and (max-height: 520px) { .view-login { justify-content: flex-start; } .login-hero { flex-direction: row; text-align: start; } .login-logo { width: 56px; height: 56px; } }
.page-title { font-size: 1.45rem; }
.page-sub { margin-top: -8px; font-size: .92rem; }
.page-head { display: flex; align-items: center; gap: 8px; }
.section-title { font-size: 1.1rem; margin-top: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px;
}
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 12px; text-align: center; color: var(--ink-soft); }
.empty-art { width: 56px; height: 56px; color: var(--surface-3); stroke-width: 1.4; }
.empty-line { text-align: center; padding: 6px 0; }

/* ── الأزرار ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: var(--r-md);
  font-weight: 700; font-size: 1.02rem; white-space: nowrap;
  transition: transform .1s, background .2s, opacity .2s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-green { background: var(--green); color: var(--green-ink); }
.btn-green .ic { stroke-width: 2.6; }
.btn-outline { border: 1.5px solid var(--line); color: var(--ink); background: transparent; }
[data-theme="dark"] .btn-outline, :root:not([data-theme="light"]) .btn-outline { border-color: #3A3A3A; }
.btn-ghost { color: var(--ink-soft); min-height: 44px; }
.btn-wa { background: #25D366; color: #06210F; }
.btn-danger-outline { border: 1.5px solid var(--red); color: var(--red); }
.btn-xl { width: 100%; min-height: 56px; font-size: 1.08rem; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: .92rem; border-radius: var(--r-sm); }
.btn-grow { flex: 1 1 auto; }
.btn-quiet { color: var(--ink-soft); padding: 8px; font-size: .9rem; }
.linkish { color: var(--green); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  color: var(--ink);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn-sm { width: 36px; height: 36px; }
.icon-btn-float { background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1 1 0; min-width: 0; }
.btn-row > .btn-grow { flex: 1.6 1 0; }

/* ── الحقول ── */
.field-label { font-weight: 600; font-size: .95rem; display: block; }
.field-hint { color: var(--ink-soft); font-size: .84rem; }
input[type="text"], input[type="tel"], input[type="search"], input[type="datetime-local"], #name-input {
  width: 100%; min-height: 52px; padding: 0 14px;
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--r-sm);
  font-size: 16px; /* 16+ يمنع زوم iOS */
}
input:focus { outline: none; border-color: var(--green); }
input::placeholder { color: var(--ink-soft); opacity: .8; }

/* ── الدخول ── */
.login-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 8px; }
.login-logo { border-radius: 22px; box-shadow: 0 10px 30px -10px rgba(22, 211, 58, .45); }
.login-title { font-size: 1.5rem; }
.login-sub { color: var(--ink-soft); max-width: 32ch; }
.login-step { display: flex; flex-direction: column; gap: 12px; }
.phone-field { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: var(--r-sm); padding-inline-start: 14px; border: 1.5px solid transparent; }
.phone-field:focus-within { border-color: var(--green); }
.phone-field input { background: none; border: 0; font-size: 20px; unicode-bidi: plaintext; letter-spacing: 1px; }
.login-alt { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; color: var(--ink-soft); font-size: .92rem; margin-top: 4px; }
.otp-sent-to { color: var(--ink-soft); }
.otp-boxes { display: flex; gap: 8px; justify-content: center; }
.otp-cell { width: 46px !important; min-height: 56px !important; padding: 0 !important; text-align: center; font-size: 22px !important; font-weight: 700; }
.otp-cell.filled { border-color: var(--green); background: var(--green-soft); }

/* ═══════════ الخريطة الكاملة ═══════════ */
.view-map { position: fixed; inset: 0; overflow: hidden; }
.map-full, .map-full.maplibregl-map { position: absolute; inset: 0; background: #1b1b1b; }
[data-theme="light"] .map-full { background: #E9ECE6; }

/* الدبوس الثابت بالنص */
.center-pin {
  position: absolute; z-index: 4; left: 50%; top: 50%;
  width: 44px; height: 58px; margin-left: -22px; margin-top: -58px; /* رأس الدبوس عالمركز */
  pointer-events: none; transition: transform .18s ease;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .5));
}
.center-pin-shadow {
  position: absolute; left: 50%; bottom: -4px; width: 12px; height: 5px; margin-left: -6px;
  border-radius: 50%; background: rgba(0, 0, 0, .45);
}
.view-map.moving .center-pin { transform: translateY(-10px); }
/* فوق حلقة «من» (ارتفاعها ~58px) — نفس ترتيب اللقطة */
.center-pin.stacked { transform: translateY(-56px); }
.center-pin.stacked .center-pin-shadow { display: none; }
.view-map.moving .center-pin.stacked { transform: translateY(-66px); }
.center-pin.from-mode path { fill: var(--green); }

/* بطاقة المسار */
.route-card {
  position: absolute; z-index: 6;
  top: calc(var(--safe-t) + 10px); left: 12px; right: 12px;
  max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow); padding: 4px 6px;
}
.rc-row {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 12px;
  border-radius: var(--r-md); cursor: pointer;
}
.rc-row:active { background: var(--surface-2); }
.rc-value { flex: 1; font-weight: 700; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-value.placeholder { color: var(--ink-soft); font-weight: 600; }
.rc-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); border-radius: 50%; }
.rc-icon:active { background: var(--surface-3); }
.rc-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; margin: 0 4px; }
.dot-green { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.rc-pin { width: 22px; height: 22px; color: var(--red); flex: none; }
.rc-mid { position: relative; height: 22px; display: flex; align-items: center; padding: 0 12px; }
.rc-dots { display: flex; flex-direction: column; gap: 3px; width: 22px; align-items: center; }
.rc-dots i { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-soft); }
.rc-line { flex: 1; height: 1px; background: var(--line); margin-inline: 14px 58px; }
.rc-swap {
  position: absolute; inset-inline-start: 4px; inset-inline-start: auto; left: 10px; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.rc-swap:active { background: var(--surface-2); }
/* RTL: زر التبديل عاليسار (طرف الخط) — نفس اللقطة */

/* السعر داخل بطاقة المسار (التأكيد) */
.rc-fare { border-top: 1px solid var(--line); margin: 4px 6px 0; padding: 10px 0 6px; }
.rc-fare .fare-box { margin: 0; background: transparent; padding: 0 6px; }
.rc-fare .fare-skel { height: 56px; margin: 0 6px; }
.fare-kind { color: var(--ink); font-weight: 600; }
.btn-square { flex: 0 0 52px !important; padding: 0; }
.view-home.confirming .rc-swap { display: none; }

/* بطاقة «مشوار شغال» */
.active-banner {
  position: absolute; z-index: 7; left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  top: calc(var(--safe-t) + 168px);
  display: flex; align-items: center; gap: 12px; text-align: start;
  background: var(--green); color: var(--green-ink); border-radius: var(--r-lg);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.active-banner .ic { width: 26px; height: 26px; }
.ab-text { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.ab-text span { font-size: .86rem; opacity: .85; }
.ab-go { font-weight: 700; background: rgba(0, 0, 0, .14); border-radius: 99px; padding: 6px 14px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }

.guest-chip {
  position: absolute; z-index: 5; left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  top: calc(var(--safe-t) + 168px);
  left: 0; right: 0; width: max-content; max-width: calc(100% - 24px);
  background: rgba(30, 30, 30, .92); color: var(--amber); border: 1px solid rgba(245, 184, 61, .4);
  border-radius: 99px; padding: 6px 14px; font-size: .82rem; font-weight: 600;
}
.active-banner:not([hidden]) ~ .guest-chip { display: none; }

/* الأزرار العائمة */
.fab-col {
  position: absolute; z-index: 5; right: 14px;
  bottom: calc(var(--sheet-h, 190px) + var(--nav-h) + var(--safe-b) + 18px);
  display: flex; flex-direction: column; gap: 14px;
  transition: bottom .25s ease, opacity .2s;
}
.fab {
  width: 60px; height: 60px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: var(--shadow);
}
.fab .ic { width: 28px; height: 28px; }
.fab-ai { background: linear-gradient(135deg, #2BE36B, #10C9A0); color: #0B2A12; }
.fab-offers { background: #10301A; color: #fff; border: 2px solid var(--green-deep); outline: 3px solid rgba(242, 72, 75, .45); outline-offset: 0; }
[data-theme="light"] .fab-offers { background: #10301A; }
.fab-badge { position: absolute; top: -5px; left: -5px; width: 16px; height: 16px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }
.fab-locate {
  position: absolute; z-index: 5; left: 14px;
  bottom: calc(var(--sheet-h, 190px) + var(--nav-h) + var(--safe-b) + 18px);
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  transition: bottom .25s ease;
}
.fab-locate .ic { width: 24px; height: 24px; }

/* الورقة السفلية */
.home-sheet {
  position: absolute; z-index: 8; left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  bottom: calc(var(--nav-h) + var(--safe-b) + 10px + var(--kb));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow); padding: 14px 16px 16px;
  max-height: calc(100dvh - var(--nav-h) - var(--safe-b) - var(--safe-t) - 40px - var(--kb));
  overflow-y: auto; overscroll-behavior: contain;
  transition: bottom .22s ease;
}
.hint-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; min-height: 52px; }
.hint-ic {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--red-soft); color: var(--red);
}
.hint-ic.from { background: var(--green-soft); color: var(--green); }
.hint-ic .ic { width: 26px; height: 26px; }
.hint-txt { display: flex; flex-direction: column; min-width: 0; }
.hint-txt b { font-size: 1.05rem; font-weight: 600; }
.hint-txt span { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.confirm-head { display: flex; align-items: center; gap: 4px; margin: -6px -8px 6px; }
.confirm-head h3 { font-size: 1.1rem; }
.trip-mini { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; margin-bottom: 10px; }
.trip-mini .arrow { width: 16px; height: 16px; transform: scaleX(-1); color: var(--ink-soft); }
.trip-mini .rc-pin { width: 18px; height: 18px; }
.trip-mini .rc-dot { width: 11px; height: 11px; margin: 0 2px; }

.fare-box { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px; }
.fare-main { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.fare-price { font-size: 1.6rem; font-weight: 700; color: var(--green); }
.fare-note { font-size: .82rem; color: var(--ink-soft); text-align: end; }
.fare-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: .85rem; color: var(--ink-soft); }
.fare-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.fare-meta .ic { width: 16px; height: 16px; }
.fare-coupon { color: var(--green) !important; font-weight: 600; }
.fare-route-note { font-size: .78rem; color: var(--amber); margin-top: 6px; }
.fare-skel { height: 86px; margin-bottom: 10px; }
#ride-notes { margin-bottom: 10px; }
.sched-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.book-error { color: var(--red); font-size: .88rem; margin-bottom: 8px; }

/* الكيبورد مفتوح — منخبي الزوائد ومنرفع الورقة فوقه */
body.kb-open #bottomnav,
body.kb-open .fab-col,
body.kb-open .fab-locate,
body.kb-open #installbar { display: none !important; }
body.kb-open .home-sheet { bottom: calc(10px + var(--kb)); max-height: calc(100dvh - var(--kb) - 20px); }
body.kb-open .route-card { display: none; }

/* ═══════════ التتبع: الطلب فوق، الخريطة مالية الشاشة ═══════════ */
.ride-card-top-float {
  position: absolute; z-index: 6; top: calc(var(--safe-t) + 10px); left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
}
.rt-head { display: flex; align-items: center; gap: 12px; }
.rt-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; flex: none; }
.rt-ic .ic { width: 26px; height: 26px; }
.rt-txt { min-width: 0; }
#ride-status-title { font-size: 1.08rem; }
.ride-sub { color: var(--ink-soft); font-size: .88rem; }
.rt-route { display: flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; font-size: .95rem; }
.rt-route .arrow { width: 16px; height: 16px; transform: scaleX(-1); color: var(--ink-soft); }
.rt-route .rc-pin { width: 18px; height: 18px; }
.rt-route .rc-dot { width: 11px; height: 11px; margin: 0 2px; }
.rt-price { margin-inline-start: auto; color: var(--green); font-weight: 700; }
/* خطوات أفقية */
.timeline.steps { list-style: none; display: flex; gap: 0; }
.timeline.steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; text-align: center; }
.timeline.steps li:not(:last-child)::after {
  content: ''; position: absolute; top: 8px; right: 50%; left: -50%; height: 2px; background: var(--line); z-index: 0;
}
.timeline.steps li.tl-done:not(:last-child)::after { background: var(--green); }
.timeline.steps .tl-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); position: relative; z-index: 1; }
.timeline.steps li.tl-done .tl-dot { background: var(--green); border-color: var(--green); }
.timeline.steps li.tl-now .tl-dot { border-color: var(--green); box-shadow: 0 0 0 5px var(--green-soft); animation: pulse 1.6s infinite; }
.timeline.steps b { display: block; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.timeline.steps li:not(.tl-done):not(.tl-now) b { color: var(--ink-soft); font-weight: 500; }
.timeline.steps time { color: var(--ink-soft); font-size: .66rem; }
.ride-tools {
  position: absolute; z-index: 6; left: 12px; right: 12px;
  bottom: calc(var(--ride-bottom-h, 90px) + var(--nav-h) + var(--safe-b) + 18px);
  display: flex; justify-content: space-between; pointer-events: none;
}
.ride-tools > * { pointer-events: auto; }
.follow-chip {
  position: absolute; z-index: 6; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--ride-bottom-h, 90px) + var(--nav-h) + var(--safe-b) + 22px);
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 8px 14px;
  font-weight: 600; font-size: .88rem; box-shadow: var(--shadow-sm);
}
.follow-chip .ic { width: 18px; height: 18px; }
.ride-bottom {
  position: absolute; z-index: 7; left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  bottom: calc(var(--nav-h) + var(--safe-b) + 10px);
  display: flex; flex-direction: column; gap: 10px;
}
.ride-bottom .card { box-shadow: var(--shadow); }
.ride-bottom #btn-cancel-ride { background: var(--surface); box-shadow: var(--shadow); min-height: 52px; }
.driver-id { display: flex; align-items: center; gap: 12px; }
.driver-id > div { flex: 1; min-width: 0; }
.driver-id b { display: block; font-size: 1.05rem; }
.driver-avatar { width: 50px; height: 50px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.3rem; flex: none; }
.icon-btn.wa { color: #25D366; }
.rate { text-align: center; display: flex; flex-direction: column; gap: 8px; }
.stars { display: flex; justify-content: center; gap: 6px; }
.star { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; color: var(--surface-3); }
.star .ic { width: 34px; height: 34px; fill: currentColor; }
.star.on { color: var(--amber); }

/* ═══════════ القوائم ═══════════ */
.ride-card { display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.ride-card:active { transform: scale(.99); }
.ride-card-top, .ride-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ride-card-bottom { color: var(--ink-soft); font-size: .85rem; }
.ride-route { display: flex; align-items: center; gap: 6px; font-weight: 600; flex-wrap: wrap; }
.ride-route .ic { width: 18px; height: 18px; color: var(--ink-soft); }
.ride-price { color: var(--ink); font-weight: 700; }
.active-ride-card { border-color: var(--green); background: linear-gradient(0deg, var(--green-soft), var(--green-soft)), var(--surface); }
.chip { font-size: .76rem; font-weight: 600; border-radius: 99px; padding: 3px 10px; background: var(--surface-2); color: var(--ink-soft); }
.chip-new, .chip-dispatching, .chip-pending { background: var(--amber-soft); color: var(--amber); }
.chip-assigned, .chip-arrived, .chip-in_ride, .chip-done, .chip-dispatched { background: var(--green-soft); color: var(--green); }
.chip-cancelled, .chip-expired, .chip-failed { background: var(--red-soft); color: var(--red); }
.sched-card .btn { align-self: flex-start; }

.coupon {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px dashed var(--green); border-radius: var(--r-lg); padding: 14px;
}
.coupon-value { font-size: 1.25rem; font-weight: 700; color: var(--green); min-width: 70px; text-align: center; }
.coupon-body { flex: 1; }
.coupon-body b { display: block; }
.coupon-body span { font-size: .82rem; color: var(--ink-soft); }
.promo { display: flex; flex-direction: column; gap: 8px; }
.promo-row { display: flex; gap: 8px; }
.promo-row input { flex: 1; min-width: 0; }
.promo-row .btn { min-height: 52px; }

.profile { display: flex; align-items: center; gap: 14px; }
.profile b { display: block; font-size: 1.1rem; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.avatar-lg { width: 60px; height: 60px; font-size: 1.5rem; }
.settings { padding: 4px; }
.setting-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 12px; border-radius: var(--r-md); text-align: start; }
.setting-row:active { background: var(--surface-2); }
.setting-row > span:not(.switch) { flex: 1; font-weight: 500; }
.chev { transform: scaleX(-1); width: 18px; height: 18px; }
.switch { width: 46px; height: 27px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .2s; flex: none; }
.switch i { position: absolute; top: 3px; right: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .2s; }
.setting-row[aria-checked="true"] .switch { background: var(--green); }
.setting-row[aria-checked="true"] .switch i { transform: translateX(-19px); }
.guest-upgrade { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-color: rgba(245, 184, 61, .4); }
.guest-upgrade > .ic { color: var(--amber); }
.guest-upgrade > div { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.version { text-align: center; font-size: .8rem; }

/* ═══════════ الدرج السفلي ═══════════ */
#bottomnav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: var(--bg); border-top: 1px solid var(--line);
}
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-soft); font-size: .86rem; font-weight: 500; }
.nav-btn .ic { width: 28px; height: 28px; }
.nav-btn[aria-current="page"] { color: var(--green); font-weight: 600; }

/* ═══════════ شريط التثبيت ═══════════ */
#installbar {
  position: fixed; z-index: 30; left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  top: calc(var(--safe-t) + 10px);
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 10px 12px; box-shadow: var(--shadow);
}
.install-ic { border-radius: 10px; }
.install-txt { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.install-txt span { font-size: .8rem; color: var(--ink-soft); }

/* ═══════════ لوحة البحث ═══════════ */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .25s; }
.backdrop.show { opacity: 1; }
.search-panel {
  position: fixed; z-index: 41; inset: 0;
  background: var(--bg);
  padding: calc(var(--safe-t) + 10px) 16px calc(var(--safe-b) + 16px);
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateY(16px); opacity: 0; transition: transform .22s ease, opacity .22s ease;
}
.search-panel.show { transform: none; opacity: 1; }
.search-panel > * { width: 100%; max-width: 560px; margin-inline: auto; }
.sp-head { display: flex; align-items: center; gap: 6px; }
.sp-head h3 { font-size: 1.15rem; }
.search-field { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: var(--r-md); padding-inline: 14px 6px; border: 1.5px solid transparent; position: sticky; top: 0; z-index: 1; }
.search-field:focus-within { border-color: var(--green); }
.search-field input { background: none; border: 0; padding: 0; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-panel.ai .search-field { border-color: #10C9A0; }
.pick-on-map { display: flex; align-items: center; gap: 10px; color: var(--green); font-weight: 600; min-height: 48px; padding: 0 4px; }
.zone-recents { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-zone { background: var(--surface-2); border-radius: 99px; padding: 8px 14px; font-weight: 500; min-height: 40px; }
.zone-results { gap: 2px; }
.zone-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 10px; border-radius: var(--r-sm); text-align: start; }
.zone-item:active { background: var(--surface-2); }
.zone-item .ic { color: var(--ink-soft); }
.zone-item > span:nth-child(2) { flex: 1; min-width: 0; }
.zone-item b { display: block; font-weight: 600; }
.zone-item .belt { font-size: .78rem; color: var(--ink-soft); }
.belt-pill { display: none; }
.zone-empty { text-align: center; padding: 22px 8px; line-height: 1.7; }
.ai-hint { padding: 0 4px; }
.zone-item.ai-apply { background: rgba(16, 201, 160, .12); border: 1px solid rgba(16, 201, 160, .4); }
.zone-item.ai-apply .ic { color: #10C9A0; }

/* ═══════════ توست + هيكل ═══════════ */
#toast {
  position: fixed; z-index: 95; left: 16px; right: 16px; max-width: 520px; margin: 0 auto;
  top: calc(var(--safe-t) + 12px);
  background: #F3F3F3; color: #121212; font-weight: 600;
  padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--shadow); text-align: center;
  animation: toast-in .25s ease both;
}
[data-theme="light"] #toast { background: #161816; color: #fff; }
#toast.err { background: var(--red); color: #fff; }
#toast.hide { animation: toast-out .3s both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }
.skel { border-radius: var(--r-md); background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ═══════════ MapLibre ═══════════ */
.maplibregl-ctrl-attrib { direction: ltr; font-size: 9px !important; opacity: .7; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(var(--nav-h) + var(--safe-b)); }
.view-ride .maplibregl-ctrl-bottom-left, .view-ride .maplibregl-ctrl-bottom-right { bottom: 0; }
.maplibregl-ctrl-top-left { top: calc(var(--safe-t) + 64px); }
:root:not([data-theme="light"]) .maplibregl-ctrl-attrib { background: rgba(18, 18, 18, .7) !important; color: #999; }
:root:not([data-theme="light"]) .maplibregl-ctrl-attrib a { color: #bbb; }
.hpin { position: relative; width: 34px; height: 44px; }
.hpin svg { filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .5)); }
.hpin .pin-lbl { position: absolute; top: 6px; left: 0; right: 0; text-align: center; font-weight: 700; font-size: 12px; }
/* علامة «من» (حلقة خضرا) */
.from-pin { position: relative; width: 52px; height: 62px; display: flex; flex-direction: column; align-items: center; }
.from-pin .ring {
  width: 48px; height: 48px; border-radius: 50%; background: #121212; border: 5px solid var(--green);
  color: var(--green); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}
.from-pin .tip { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 12px solid var(--green); margin-top: -3px; }
.to-pin { color: var(--red); }
.gps-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(59, 130, 246, .25), 0 2px 6px rgba(0, 0, 0, .4); }
.car-pin {
  width: 42px; height: 42px; border-radius: 50%; background: var(--green); color: #0B2A12;
  display: flex; align-items: center; justify-content: center; border: 3px solid #121212; box-shadow: var(--shadow-sm);
}
.car-pin .ic { width: 24px; height: 24px; }

/* ═══════════ الدوران/الشاشات القصيرة ═══════════ */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --nav-h: 54px; }
  .nav-btn { flex-direction: row; gap: 8px; }
  .nav-btn .ic { width: 22px; height: 22px; }
  .route-card { left: 12px; right: auto; width: min(420px, 48vw); margin: 0; }
  .rc-row { min-height: 46px; }
  .home-sheet { left: auto; right: 12px; width: min(420px, 48vw); margin: 0; padding: 10px 12px 12px; }
  .hint-row { margin-bottom: 8px; min-height: 0; }
  .hint-ic { width: 40px; height: 40px; }
  .btn { min-height: 46px; }
  .fab-col { right: auto; left: calc(min(420px, 48vw) + 26px); bottom: calc(var(--nav-h) + var(--safe-b) + 12px); flex-direction: row; }
  .fab { width: 52px; height: 52px; }
  .fab-locate { left: calc(min(420px, 48vw) + 26px + 140px); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); }
  .active-banner, .guest-chip { top: auto; bottom: calc(var(--nav-h) + var(--safe-b) + 76px); left: 12px; right: auto; width: min(420px, 48vw); margin: 0; }
  .ride-card-top-float { left: auto; right: 12px; width: min(420px, 48vw); margin: 0; }
  .ride-bottom { left: 12px; right: auto; width: min(420px, 46vw); margin: 0; }
  .ride-tools { left: auto; right: 12px; width: min(420px, 48vw); bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }
}
@media (max-height: 640px) and (orientation: portrait) {
  .rc-row { min-height: 48px; }
  .hint-row { margin-bottom: 10px; }
  .hint-ic { width: 44px; height: 44px; }
  .btn { min-height: 48px; }
  .fab { width: 52px; height: 52px; }
  .active-banner, .guest-chip { top: calc(var(--safe-t) + 150px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
