:root {
  --bg: #F6F5F0; --surface: #FFFFFF; --ink: #15201A; --ink-soft: #4E5A53; --muted: #5B6660;
  --line: #E3E1D8; --line-strong: #D6D3C8; --line-soft: #EEECE5;
  --green: #0B7A45; --green-dark: #075C33; --green-soft: #E6F2EB; --green-text: #0F3D25;
  --red: #B42318; --red-soft: #FDECEA; --red-text: #8F1C13;
  --warn: #FFF4D6; --warn-text: #6B4A00; --warn-strong: #8A5D00; --amber: #C98A00;
  --dark-card: #24332B; --dark-sub: #B9C4BD; --dark-text: #D9E0DB;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-size: 15px; }
[hidden] { display: none !important; }
a { color: var(--green); } a:hover { color: var(--green-dark); }
h1, h2 { margin: 0; font-weight: 700; } h1 { font-size: 28px; } h2 { font-size: 19px; }
svg:not(.leaflet-zoom-animated) { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
input { font: inherit; color: var(--ink); }
input::placeholder { color: #7A847E; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
.muted { color: var(--muted); font-size: 14px; } .small { font-size: 13px; line-height: 1.7; } .center { text-align: center; }
.grow { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }

/* الأزرار */
.btn { height: 46px; padding: 0 24px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 600; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--green-dark); }
.btn.lg { height: 54px; border-radius: 14px; font-size: 17px; }
.btn.sm { height: 36px; padding: 0 16px; border-radius: 10px; font-size: 14px; }
.btn.danger { color: var(--red-text); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 15px; font-weight: 600; }
.field input { height: 52px; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 0 14px; font-size: 16px; background: var(--surface); }
.field input[dir="ltr"] { text-align: right; }
.field input:focus, .search:focus-within { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.error { margin: 0; color: var(--red-text); background: var(--red-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* الشعار */
.brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; }
.brand.sm { gap: 10px; padding: 0 8px 20px; }
.brand.sm div { display: flex; flex-direction: column; }
.brand.sm strong { font-size: 17px; } .brand.sm div span { font-size: 12px; color: var(--dark-sub); font-weight: 400; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--green); display: flex; align-items: center; justify-content: center; color: #fff; }
.logo.lg { width: 48px; height: 48px; border-radius: 14px; } .logo.lg svg { width: 26px; height: 26px; }

/* تسجيل الدخول */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; }
.login-hero { flex: 1 1 420px; background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; min-height: 320px; }
.hero-text { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.hero-text h1 { font-size: 40px; line-height: 1.3; }
.hero-text p { margin: 0; font-size: 17px; line-height: 1.8; color: var(--dark-text); }
.flag { display: flex; height: 6px; max-width: 220px; border-radius: 3px; overflow: hidden; }
.flag i { flex: 1; } .flag i:nth-child(1) { background: #fff; } .flag i:nth-child(2) { background: var(--green); } .flag i:nth-child(3) { background: var(--red); }
.login-main { flex: 999 1 480px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-card { width: 100%; max-width: 420px; border-radius: 24px; padding: 36px; display: flex; flex-direction: column; gap: 20px; }
.login-card h2 { font-size: 26px; margin-bottom: 6px; }

/* هيكل اللوحة */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--ink); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; }
.side a, .logout { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; color: var(--dark-text); text-decoration: none; font-size: 15px; border: none; background: none; text-align: start; }
.side a:hover { background: #1E2B24; color: #fff; }
.side a[aria-current="page"] { background: var(--dark-card); color: #fff; font-weight: 600; }
.side a[aria-current="page"] svg { color: #7FD1A3; }
.logout { color: #F2B8B2; }
.badge { background: var(--amber); color: var(--ink); border-radius: 10px; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.page { flex: 999 1 560px; min-width: 0; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.page-head > div { display: flex; flex-direction: column; gap: 4px; }
.page-head > .head-tools { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 12px; padding: 8px 14px; font-size: 14px; font-weight: 600; }
.pill i { width: 8px; height: 8px; border-radius: 50%; }
.pill.green { background: var(--green-soft); color: var(--green-dark); } .pill.green i { background: var(--green); }
.pill.off { background: var(--warn); color: var(--warn-text); } .pill.off i { background: var(--amber); }

/* الأرقام */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat span, .stat small { color: var(--muted); } .stat span { font-size: 14px; } .stat small { font-size: 13px; }
.stat strong { font-size: 34px; } .c-green { color: var(--green); } .c-warn { color: var(--warn-strong); }

/* الأقسام */
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.panel { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel.wide { flex: 999 1 560px; } .panel.narrow { flex: 1 1 300px; }
.panel.half { flex: 1 1 420px; padding: 22px; gap: 18px; } .panel.half-s { flex: 1 1 320px; padding: 22px; gap: 14px; }
.panel.dark { background: var(--ink); color: #fff; border: none; }
.panel.dark .sub { font-size: 13px; color: var(--dark-sub); }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.panel-head a { font-size: 14px; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.empty { margin: 0; color: var(--muted); text-align: center; padding: 16px; }

/* الفلاتر */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 14px; }
.chips button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; font-weight: 600; }

/* الجداول */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 14px; }
th { text-align: start; color: var(--muted); font-weight: 500; padding: 12px 8px; border-bottom: 1px solid var(--line); }
td { padding: 12px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
td.nowrap, td.time { white-space: nowrap; } td.time { color: var(--muted); } td.strong { font-weight: 600; }
td.ltr { direction: ltr; text-align: right; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.tag { display: inline-block; border-radius: 8px; padding: 3px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tag.pending { background: var(--warn); color: var(--warn-text); } .tag.active { background: var(--green-soft); color: var(--green-dark); }
.tag.done { background: var(--line-soft); color: #3A463F; } .tag.cancelled, .tag.blocked { background: var(--red-soft); color: var(--red-text); }
.tag.approved { background: var(--green-soft); color: var(--green-dark); }
.actions { display: flex; gap: 6px; }

/* بطاقة سائق بانتظار التفعيل */
.pending-card { border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.pending-card div { display: flex; flex-direction: column; }
.pending-card strong { font-size: 15px; } .pending-card span { font-size: 13px; color: var(--muted); }
.pending-card .ltr { direction: ltr; text-align: right; }
.pending-card .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pending-card .btn { height: 40px; font-size: 14px; padding: 0; }

/* البحث */
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 12px; height: 44px; flex: 0 1 320px; color: var(--muted); }
.search input { border: none; outline: none; font-size: 15px; flex: 1; min-width: 0; background: transparent; }

/* الإعدادات */
.stepper-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.stepper-row:last-child { border-bottom: none; padding-bottom: 0; }
.stepper-row div:first-child { display: flex; flex-direction: column; min-width: 0; }
.stepper-row strong { font-size: 16px; font-weight: 600; } .stepper-row small { font-size: 13px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 20px; color: var(--ink); }
.stepper output { min-width: 84px; text-align: center; font-size: 19px; font-weight: 700; }
.preview-row { display: flex; justify-content: space-between; align-items: center; background: var(--dark-card); border-radius: 14px; padding: 12px 16px; }
.preview-row span { font-size: 15px; color: var(--dark-text); } .preview-row strong { font-size: 22px; }
.info { display: flex; gap: 12px; align-items: flex-start; background: var(--green-soft); border-radius: 14px; padding: 14px 16px; max-width: 760px; color: var(--green-dark); }
.info p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--green-text); }

.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 10; }
.toast.err { background: var(--red); }

@media (max-width: 720px) {
  .page { padding: 20px 16px 32px; }
  .side { flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .side .brand { width: 100%; padding-bottom: 8px; }
  .side .grow { display: none; }
  .login-hero { padding: 28px 24px; } .hero-text h1 { font-size: 30px; }
  .login-card { padding: 24px; }
}

/* صفوف قابلة للضغط */
table.clickable tbody tr { cursor: pointer; }
table.clickable tbody tr:hover td { background: var(--bg); }
table.clickable tbody tr:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }

/* النوافذ المنبثقة */
dialog.sheet { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: none; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(21, 32, 26, .25); }
dialog.sheet.wide { width: min(1100px, calc(100vw - 24px)); }
dialog.sheet::backdrop { background: rgba(21, 32, 26, .45); }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--surface); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line-soft); }
.sheet-head > div { display: flex; flex-direction: column; gap: 2px; }
.sheet-body { padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.sheet-body h3 { margin: 6px 0 0; font-size: 16px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.info-grid div { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.info-grid span { font-size: 13px; color: var(--muted); }
.info-grid strong { font-size: 15px; overflow-wrap: anywhere; }
.info-grid .ltr { direction: ltr; text-align: right; }
.ride-layout { display: flex; flex-direction: row; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.ride-map-wrap { flex: 3 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ride-map { height: 440px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #E8E4DC; }
.ride-side { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.dot.pickup { background: var(--green); } .dot.dest { background: var(--ink); } .dot.driver { background: #1F5FBF; }
.legend .line { width: 22px; height: 4px; border-radius: 2px; background: var(--green); display: inline-block; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; padding: 0 26px 16px 0; display: flex; flex-direction: column; gap: 1px; }
.timeline li::before { content: ''; position: absolute; right: 5px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); }
.timeline li::after { content: ''; position: absolute; right: 10px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.unknown::before { background: var(--line-strong); }
.timeline li.bad::before { background: var(--red); }
.timeline strong { font-size: 15px; } .timeline span { font-size: 13px; color: var(--muted); }
.timeline .gap { font-size: 12px; color: var(--green-dark); font-weight: 600; }
.leaflet-container { font-family: inherit; }
@media (max-width: 640px) { .ride-map { height: 300px; } .sheet-body { padding: 14px 16px 20px; } }

/* نموذج إضافة مستخدم */
dialog.sheet.narrow { width: min(480px, calc(100vw - 24px)); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
#new-user-form.rider .driver-only { display: none; }

/* الخريطة المباشرة */
.live-map { height: 560px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #E8E4DC; }
.dot.busy { background: #C98A00; } .dot.pending { background: var(--red); }
.live-pin { border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
@media (max-width: 640px) { .live-map { height: 380px; } }

/* الرسائل */
textarea { font: inherit; color: var(--ink); border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; resize: vertical; }
textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.bc-item { border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.bc-item strong { font-size: 15px; } .bc-item p { margin: 0; font-size: 14px; } .bc-item small { color: var(--muted); font-size: 12px; }

/* العمولة والتقييم */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.commission { display: flex; flex-direction: column; gap: 10px; }
.pay-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.pay-form .field { flex: 1 1 140px; } .pay-form .field.grow { flex: 3 1 220px; }
.pay-form input { height: 46px; }
.pay-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 8px 12px; background: var(--bg); border-radius: 10px; }
.stars { color: #E0A100; letter-spacing: 1px; white-space: nowrap; }
.review { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.review small { color: var(--muted); }

/* طلب هاتفي */
.dp-map { height: 460px; cursor: crosshair; }
@media (max-width: 640px) { .dp-map { height: 320px; } }
.field select { height: 52px; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 0 12px; font: inherit; font-size: 16px; background: var(--surface); color: var(--ink); }
.field select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.tag.phone { background: #E8EFFA; color: #1F4E99; }
/* الحظر والبلاغات */
.block-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-radius: 14px; padding: 12px 14px; margin: 12px 0; background: var(--line-soft); }
.block-box.on { background: var(--red-soft); color: var(--red-text); }
.report-note { color: var(--ink-soft); font-size: 14px; max-width: 320px; }
#ride-actions { margin-top: 16px; }
