/* جيبلي — أنماط الواجهة (العميل، المندوب، المالك). عربي أولاً مع دعم كامل للإنجليزية عبر الخصائص المنطقية. */
:root {
  --bg: #FFFBF5;
  --surface: #FFFFFF;
  --ink: #2B1D16;
  --ink-2: #6F5D54;
  --ink-3: #A08E84;
  --line: #EFE3D6;
  --line-2: #E2D3C4;
  --brand: #C8102E;
  --brand-ink: #FFFFFF;
  --brand-soft: #FBE9EC;
  --brand-deep: #9B0B22;
  --saffron: #F5B82E;
  --saffron-soft: #FFF3D6;
  --sea: #0E7C86;
  --sea-soft: #DDF2F3;
  --ok: #1F8A5B;
  --ok-soft: #E1F4EA;
  --warn: #B7791F;
  --warn-soft: #FFF1D6;
  --bubble-user: #FBE9EC;
  --shadow: 0 -8px 24px rgba(43, 29, 22, 0.06);
  --radius-card: 16px;
  --radius-bubble: 18px;
  --radius-btn: 12px;
  --font: 'Alexandria', 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1512; --surface: #251C18; --ink: #F6EEE6; --ink-2: #C2B0A5; --ink-3: #8F7C72; --line: #3A2C25; --line-2: #4A3A31;
    --brand: #E8354F; --brand-soft: #3D1A21; --brand-deep: #F4607A; --saffron: #F5B82E; --saffron-soft: #3B2F14; --sea: #3BB7C1; --sea-soft: #123238;
    --ok: #3FBF83; --ok-soft: #14352A; --warn: #E0A43C; --warn-soft: #3A2C12; --bubble-user: #3D1A21; --shadow: 0 -8px 24px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1512; --surface: #251C18; --ink: #F6EEE6; --ink-2: #C2B0A5; --ink-3: #8F7C72; --line: #3A2C25; --line-2: #4A3A31;
  --brand: #E8354F; --brand-soft: #3D1A21; --brand-deep: #F4607A; --saffron: #F5B82E; --saffron-soft: #3B2F14; --sea: #3BB7C1; --sea-soft: #123238;
  --ok: #3FBF83; --ok-soft: #14352A; --warn: #E0A43C; --warn-soft: #3A2C12; --bubble-user: #3D1A21; --shadow: 0 -8px 24px rgba(0,0,0,.35); color-scheme: dark;
}
[data-role="driver"] { --brand: var(--sea); --brand-soft: var(--sea-soft); --brand-deep: #0A5C64; --bubble-user: var(--sea-soft); }
:root[data-theme="dark"] [data-role="driver"], :root:not([data-theme="light"]) [data-role="driver"] { --brand-deep: #6ED3DB; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-deep); }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- الهيكل ---------- */
.app { max-width: 680px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; gap: 12px; position: sticky; top: env(safe-area-inset-top, 0px); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 12px; background: var(--brand); display: grid; place-items: center; color: #fff; }
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.brand-tag { font-size: 12px; color: var(--ink-3); margin-inline-start: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.pill-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.pill-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.pill-btn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.avatar-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--saffron-soft); color: var(--ink); font-weight: 600; display: grid; place-items: center; position: relative; }
/* عدد الطلبات الجارية على زر «📦 طلباتي» */
#ordersBtn .count { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; line-height: 18px; font-weight: 700; }

.thread { flex: 1; padding: 8px 16px 12px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- التحية ---------- */
.hero { padding: 28px 4px 12px; }
.hero-greet { font-size: 17px; color: var(--ink-2); margin: 0 0 6px; font-weight: 500; }
.hero-q { font-size: clamp(28px, 7vw, 38px); font-weight: 700; line-height: 1.25; margin: 0; position: relative; display: block; max-width: 100%; letter-spacing: -0.01em; text-wrap: balance; }
.hero-q .stroke { position: absolute; inset-inline-start: -2px; width: calc(100% + 4px); bottom: -4px; height: 12px; z-index: -1; opacity: .95; }
.hero-sub { margin: 14px 0 0; color: var(--ink-3); font-size: 14px; }
.hero-live { margin: 10px 0 0; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.live-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--ok-soft); color: var(--ok); border-radius: 999px; padding: 3px 10px; font-weight: 600; font-size: 12px; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.hero.compact .hero-live { display: none; }
.hero.compact { padding: 6px 4px 2px; }
.hero.compact .hero-q { font-size: 20px; }
.hero.compact .hero-sub, .hero.compact .stroke { display: none; }
.hero.compact .hero-greet { font-size: 14px; margin: 0; }

/* ---------- بانر «انضم حديثاً» (عمودي على جهة البداية = اليمين في العربية) ---------- */
/* شريط أخبار متحرك أسفل الصفحة: عبارات المالك وأسطر المنصة وسعر مجلوب */
.newsbar { overflow: hidden; margin: 0 0 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.nb-track { overflow: hidden; }
.nb-list { display: flex; align-items: center; gap: 26px; white-space: nowrap; width: max-content; padding: 5px 12px; animation: nb-slide var(--nb-dur, 40s) linear infinite; }
/* الوقوف عند المرور بالفأرة فقط: على الهاتف تبقى حالة :hover/:active بعد اللمسة فيتجمّد الشريط */
@media (hover: hover) and (pointer: fine) { .newsbar:hover .nb-list { animation-play-state: paused; } }
.newsbar.hold .nb-list { animation-play-state: paused; } /* لمسة مطوّلة على الهاتف: يقف ليقرأ، ويمشي عند الرفع */
.nb-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); text-decoration: none; }
.nb-item b { color: var(--ink); font-weight: 600; }
.nb-item.link { color: var(--brand); }
.nb-dot { color: var(--line); }
@keyframes nb-slide { from { transform: translateX(-50%); } to { transform: translateX(0); } }
[dir="ltr"] .nb-list { animation-name: nb-slide-ltr; }
@keyframes nb-slide-ltr { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .nb-list { animation: none; } }

/* ---------- الفقاعات ---------- */
.msg { display: flex; gap: 8px; max-width: 100%; animation: rise .22s ease-out both; }
.msg.bot { justify-content: flex-start; }
.msg.user { justify-content: flex-end; }
.bubble { padding: 11px 15px; border-radius: var(--radius-bubble); max-width: min(86%, 560px); white-space: pre-wrap; word-wrap: break-word; }
/* الهاتف: خط أصغر قليلاً وسطور أضيق ليُقرأ الرد كاملاً بلا تمرير طويل */
@media (max-width: 480px) { .bubble { font-size: 15px; line-height: 1.55; padding: 10px 13px; max-width: 92%; } }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--line); border-start-start-radius: 6px; }
.msg.user .bubble { background: var(--bubble-user); border-end-end-radius: 6px; }
.msg .stamp { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.bot-dot { width: 26px; height: 26px; border-radius: 9px; background: var(--brand); flex: none; margin-top: 4px; display: grid; place-items: center; color: #fff; }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; } .typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .msg, .card, .sheet { animation: none !important; transition: none !important; } }

/* السمة hidden تغلب أي display في الأصناف (وإلا غطّت طبقة map-fallback الخفية الخريطة ومنعت تحريكها) */
[hidden] { display: none !important; }

/* ---------- البطاقات ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 14px; max-width: min(96%, 600px); animation: rise .22s ease-out both; }
.card h4 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.card .muted { color: var(--ink-3); font-size: 13px; }
.row-list { display: flex; flex-direction: column; }
.rest { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.rest:first-child { border-top: 0; padding-top: 4px; }
.rest-badge { width: 44px; height: 44px; border-radius: 12px; background: var(--saffron-soft); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.rest-body { flex: 1; min-width: 0; }
.rest-name { font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rest-meta { color: var(--ink-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px; vertical-align: middle; }
.dot.open { background: var(--ok); } .dot.closed { background: var(--ink-3); }
.rest-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--sea-soft); color: var(--sea); font-weight: 600; }
.tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.brand { background: var(--brand-soft); color: var(--brand-deep); display: inline-block; /* لا يرث display:flex من شعار .brand */ } .tag.plain { background: var(--saffron-soft); color: var(--ink-2); }

.btn { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: var(--radius-btn); padding: 8px 14px; font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; line-height: 1.3; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand-deep); padding-inline: 8px; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }

/* مقارنة الأصناف والتعليقات */
table.list.items td { padding: 8px 4px; }
table.list.items .rest-badge { display: none; }
.review { font-size: 13px; margin-top: 4px; line-height: 1.5; }
.stars-inline { color: var(--warn); font-size: 12px; letter-spacing: 1px; }
.stars-inline .dim { color: var(--line-2); }
.rest-badge.small { font-size: 13px; }
/* المنيو */
.menu-section { margin-top: 10px; }
.menu-section h5 { margin: 0 0 4px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.mi { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.mi-name { flex: 1; min-width: 0; font-size: 14px; }
.mi-price { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.qty button { width: 30px; height: 30px; border: 0; background: transparent; font-size: 18px; line-height: 1; }
.qty span { min-width: 22px; text-align: center; font-weight: 600; font-size: 14px; }
.menu-foot { position: sticky; bottom: 0; background: var(--surface); padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.total { font-weight: 700; font-size: 16px; }

/* الموقع */
.radius-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13px; color: var(--ink-2); }
.seg button + button { border-inline-start: 1px solid var(--line-2); }
.seg button.on { background: var(--saffron-soft); color: var(--ink); font-weight: 600; }
details.area { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
details.area summary { cursor: pointer; color: var(--brand-deep); font-weight: 500; font-size: 14px; }
details.area label { font-size: 13px; color: var(--ink-2); display: block; }
details.area .field { margin-top: 4px; }
/* لوحة المالك: اختيار مناطق ظهور عبارة الشريط (ولاحقاً البانرات) */
.tk-areas { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.tk-gov { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.tk-gov:last-child { border-bottom: 0; }
.tk-wils { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 2px 16px 4px; }
.tk-wils .check { font-size: 12px; }
.tk-areas .check { display: inline-flex; align-items: center; gap: 5px; }
.loc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.map-wrap { height: 260px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); margin-top: 10px; background: var(--saffron-soft); position: relative; }
.map-wrap .pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); z-index: 500; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.map-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--ink-2); font-size: 14px; }
.field { width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-btn); padding: 10px 12px; background: var(--surface); }
.field:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.field.invalid { border-color: var(--danger, #c0392b); box-shadow: 0 0 0 3px rgba(192, 57, 43, .12); }
.check.consent { margin: 10px 0 2px; font-size: 13px; line-height: 1.6; align-items: flex-start; }
.check.consent a { color: var(--brand); text-decoration: underline; }
.foot-links { margin: 0; padding: 0 16px 2px; font-size: 10.5px; line-height: 1.6; color: var(--muted); text-align: center; opacity: .85; }
.foot-links a { color: inherit; text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.consent-banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 8px 16px 0; }
.consent-banner a { color: inherit; text-decoration: underline; }
.form-row { display: flex; gap: 8px; margin-top: 8px; }
.form-row .field { flex: 1; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); margin-top: 10px; }

/* الملخص والإيصال */
.receipt { border: 1px dashed var(--line-2); border-radius: 12px; padding: 10px 12px; margin-top: 6px; background: var(--bg); }
.receipt .line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; border-top: 1px dashed var(--line); }
.receipt .line:first-child { border-top: 0; }
.receipt .k { color: var(--ink-3); flex: none; }
.receipt .v { text-align: end; }
.code { font-weight: 700; letter-spacing: .08em; color: var(--brand-deep); }

/* حالة الطلب */
.timeline { display: flex; flex-direction: column; gap: 0; margin: 10px 0 4px; }
.step { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; position: relative; }
.step .knob { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); flex: none; margin-top: 5px; position: relative; z-index: 1; }
.step.done .knob { background: var(--ok); border-color: var(--ok); }
.step.now .knob { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step .lbl { font-size: 14px; color: var(--ink-3); }
.step.done .lbl { color: var(--ink-2); }
.step.now .lbl { color: var(--ink); font-weight: 600; }
.step:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 6px; top: 22px; bottom: -8px; width: 2px; background: var(--line); }
.driver-box { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--sea-soft); margin-top: 8px; }
.driver-box .who { flex: 1; min-width: 0; }
.driver-box .name { font-weight: 600; }
.driver-box .sub { font-size: 13px; color: var(--ink-2); }
.parcel { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.parcel:first-child { border-top: 0; }
.parcel-block { padding: 10px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.parcel-block:first-child { border-top: 0; }
.parcel-title { font-weight: 600; }
.mini { display: flex; align-items: center; gap: 0; margin: 8px 0 2px; }
.mini .ms { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-3); position: relative; }
.mini .ms i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); position: relative; z-index: 1; }
.mini .ms:not(:last-child)::after { content: ''; position: absolute; top: 6px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line); }
.mini .ms.done i { background: var(--ok); border-color: var(--ok); } .mini .ms.done { color: var(--ink-2); }
.mini .ms.done:not(:last-child)::after { background: var(--ok); }
.mini .ms.now i { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); } .mini .ms.now { color: var(--ink); font-weight: 600; }
.ask-banner { background: var(--saffron-soft); border: 1px solid var(--saffron); border-radius: 10px; padding: 8px 10px; font-size: 14px; margin-top: 8px; }

/* الرسم التخطيطي للتتبع */
.schem { width: 100%; height: auto; max-height: 140px; margin-top: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.schem .route { stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 4 4; }
.schem .trail { fill: none; stroke: var(--sea); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.schem .p-pick { fill: var(--saffron); stroke: var(--surface); stroke-width: 2; }
.schem .p-drop { fill: var(--ok); stroke: var(--surface); stroke-width: 2; }
.schem .p-drv { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.schem .lbl { font-size: 10px; fill: var(--ink-2); text-anchor: middle; }
/* التقييم */
.stars { display: flex; gap: 6px; margin: 6px 0 10px; }
.stars button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 20px; color: var(--ink-3); }
.stars button.on { background: var(--saffron-soft); border-color: var(--saffron); color: var(--warn); }

/* ---------- الخيارات السريعة والمُدخل ---------- */
.composer-wrap { position: sticky; bottom: 0; background: var(--bg); box-shadow: var(--shadow); z-index: 15; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; max-height: 152px; overflow-y: auto; scrollbar-width: thin; }
/* وضع الحوار: صفّان على الأكثر ثم تمرير عمودي واضح بدل قصّ الطرف */
body.in-flow .chips.wrap { padding-top: 6px; }
.chip { flex: none; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft); }
.chip.more { border-style: dashed; color: var(--ink-2); } /* بقية الخيارات: تظهر بضغطة واحدة */
/* زر صغير داخل سطر البطاقة: يغيّر مكان التسليم في مكانه */
.icon-edit { border: 1px solid var(--line-2); background: var(--surface); color: var(--brand-deep); border-radius: 8px; width: 24px; height: 24px; font-size: 13px; line-height: 1; margin-inline-start: 6px; vertical-align: middle; }
.icon-edit:hover { border-color: var(--brand); background: var(--brand-soft); }
.chip.accent { background: var(--saffron-soft); border-color: transparent; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 6px 16px 4px; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 22px; padding: 12px 16px; max-height: 140px; min-height: 48px; background: var(--surface); line-height: 1.45; }
.composer textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.send { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.send:disabled { background: var(--line-2); color: var(--ink-3); }
.send svg { width: 20px; height: 20px; }
[dir="rtl"] .send svg, [dir="rtl"] .brand-mark svg, [dir="rtl"] .bot-dot svg { transform: scaleX(-1); }

/* ---------- النافذة المنزلقة (الدخول / الخريطة / الملف) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 12, 8, .45); z-index: 40; display: none; }
.scrim.open { display: block; }
.sheet { position: fixed; inset-inline: 0; bottom: 0; margin: 0 auto; max-width: 680px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 18px 20px max(20px, env(safe-area-inset-bottom)); z-index: 41; transform: translateY(102%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s .28s; max-height: 92dvh; overflow: auto; }
.sheet.open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 20px; }
.sheet p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.phone-row { display: flex; gap: 8px; }
.phone-row .cc { flex: none; width: 84px; text-align: center; }
.otp { letter-spacing: .5em; text-align: center; font-size: 22px; font-weight: 600; }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 8px; }
.hint.dev { background: var(--warn-soft); color: var(--warn); padding: 8px 10px; border-radius: 10px; font-weight: 500; }
.err { color: var(--brand-deep); font-size: 13px; margin-top: 6px; min-height: 18px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; justify-content: center; }
.demo-banner { background: var(--warn-soft); color: var(--warn); font-size: 13px; text-align: center; padding: 6px 12px; }

.how-list { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.how-list li::marker { color: var(--brand); font-weight: 700; }
/* ---------- صفحة المندوب / المالك ---------- */
.doc-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px dashed var(--line-2); border-radius: 12px; padding: 10px; font-size: 12px; color: var(--ink-2); cursor: pointer; text-align: center; position: relative; overflow: hidden; min-height: 78px; }
.doc-slot.on { border-style: solid; border-color: var(--ok); }
.doc-slot.missing { border-color: var(--brand); border-style: solid; background: var(--brand-soft, #fdecee); }
.doc-slot img { width: 100%; height: 70px; object-fit: cover; border-radius: 8px; }
.doc-ico { font-size: 20px; }
.doc-view { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.doc-view figure { margin: 0; } .doc-view img { width: 100%; border-radius: 10px; border: 1px solid var(--line); } .doc-view figcaption { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px; margin: 0 16px 12px; }
.panel h3 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.status-big { display: flex; align-items: center; gap: 12px; }
.status-big .light { width: 14px; height: 14px; border-radius: 50%; background: var(--ink-3); }
.status-big.available .light { background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft); }
.status-big.busy .light { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); }
.status-big .t { font-weight: 700; font-size: 18px; }
.status-big .s { font-size: 13px; color: var(--ink-2); }
.offer { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }
.offer .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.offer .head .kind { font-size: 16px; }
.offer .route { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 8px 0; font-size: 14px; }
.offer .route .k { color: var(--ink-3); }
.offer .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { font-size: 13px; color: var(--ink-2); }
.tabs { display: flex; gap: 6px; padding: 0 16px 12px; overflow-x: auto; }
.tab { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-size: 14px; white-space: nowrap; }
.tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: start; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
table.list th { color: var(--ink-3); font-weight: 600; font-size: 12px; border-top: 0; }
table.list.wide { min-width: 760px; }
.select-multi { display: flex; flex-wrap: wrap; gap: 6px; }
.select-multi label { border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.select-multi input { display: none; }
.select-multi label.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); }
.toast { position: fixed; bottom: 90px; inset-inline: 0; margin: 0 auto; width: max-content; max-width: 90%; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.empty { text-align: center; color: var(--ink-3); padding: 18px 8px; font-size: 14px; }
.foot-note { text-align: center; color: var(--ink-3); font-size: 12px; padding: 10px 16px 24px; }
.foot-note a { color: inherit; }
/* محرر المنيو في صفحة الشريك: بطاقة لكل صنف تناسب الهاتف */
.mi { display: grid; grid-template-columns: 1fr 1fr 1fr 40px; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mi .name { grid-column: 1 / 4; }
.mi .btn { grid-column: 4; grid-row: 1; padding: 6px 0; }
.mi .field { min-width: 0; }

/* هاشتاقات المطعم في قائمة العميل */
.rest-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tagbtn { border: 1px solid var(--line-2); background: var(--saffron-soft); color: var(--ink-2); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 500; }
.tagbtn:hover { border-color: var(--saffron); color: var(--ink); }

/* خيارات البداية مجمّعة بعناوين */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; padding: 2px 0; }
.chip-group + .chip-group { border-top: 1px dashed var(--line); padding-top: 6px; }
.chip-group-label { font-size: 11px; color: var(--ink-3); font-weight: 600; width: 100%; }
.chips.wrap:has(.chip-group) { max-height: 240px; }

/* اقتراحات أثناء الكتابة */
.chip.suggest { border-color: var(--saffron); background: var(--saffron-soft); }

/* صفحة الشروط والخصوصية (ومعاينتها في اللوحة) */
.terms { max-width: 720px; margin: 0 auto; padding: 8px 16px 40px; }
.terms h2 { font-size: 20px; margin: 22px 0 8px; color: var(--brand-deep, #A30D26); }
.terms h3 { font-size: 16px; margin: 16px 0 6px; }
.terms p, .terms li { line-height: 1.8; }
.terms ul { padding-inline-start: 20px; }
.offer .terms { max-width: none; padding: 8px 0 0; }

/* بطاقة قائمة الأغراض */
.items-card .sug { padding: 6px 0 2px; }
.items-card .item-rows { display: grid; gap: 8px; margin: 8px 0; }
.item-row { display: flex; gap: 8px; align-items: center; }
.item-row .field { flex: 1; min-width: 0; }
.item-row .qty { display: inline-flex; align-items: center; gap: 6px; }
.item-row .qty b { min-width: 18px; text-align: center; }
.dtabs { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 0 10px; background: var(--bg); }
.dtabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 8px; font: inherit; font-weight: 700; font-size: 14px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.dtabs button.on { color: #fff; background: var(--brand); border-color: var(--brand); }
.dtabs button.on .tag { background: rgba(255,255,255,.22); color: #fff; }

.cust-price { font-size: 15px; color: var(--brand); }

.quote-done { margin: 8px 0 4px; padding: 9px 11px; border-radius: 12px; background: var(--ok-soft, #E8F6EF); border: 1px solid var(--ok, #0E7C86); }
.quote-done .q-sent { font-size: 13.5px; font-weight: 600; }
.quote-done .muted { font-size: 12px; margin-top: 4px; display: block; }

.quote-row { display: grid; gap: 3px; font-size: 13px; margin: 8px 0 4px; }
.quote-row .muted { font-size: 11.5px; }
.quote-row .field { max-width: 180px; }

.quotes { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.q-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.quote { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.quote:last-of-type { border-bottom: 0; }
.q-who { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.q-who .muted { font-size: 11.5px; }
.q-act { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.q-note { font-size: 11.5px; margin-top: 6px; }

.eta { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--brand, #0a7); }
.eta .muted { font-weight: 400; }

.items-budget { display: block; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.items-budget .field { margin-top: 4px; max-width: 160px; }

.itemlist { margin: 2px 0 0; padding-inline-start: 0; list-style: none; }
.itemlist li.gone { opacity: .55; text-decoration: line-through; }
.btn.tiny { padding: 1px 7px; font-size: 11px; border-radius: 999px; }
.itemlist li { padding: 1px 0; }
.itemlist b { color: var(--brand); }

/* تقييمات العملاء وتعليقاتهم: صفحة المندوب وصفحة الشريك */
.reviews { display: grid; gap: 8px; margin-top: 8px; }
.review { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card, #fff); }
.rv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.rv-head .stars { color: #F5B82E; letter-spacing: 1px; }
.rv-text { margin-top: 6px; line-height: 1.6; }

/* السعر والتأكيد داخل بطاقة الملخص: خطوة واحدة بدل ثلاث */
.pricebox { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.pb-q { font-weight: 600; margin-bottom: 8px; }
.pb-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pb-row2 { display: flex; gap: 6px; margin-top: 8px; }
.pb-row2 .field { flex: 1; min-width: 0; }

/* سطر صغير تحت نص الرسالة (المسافة، تنبيه قصير) */
.b-sub { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }

/* بطاقة مزوّدي الخدمة: اسم ورقم وزرّا اتصال وواتساب */
.provs { display: grid; gap: 8px; }
.prov { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.pv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pv-sub { font-size: 12.5px; line-height: 1.6; margin-top: 3px; }
.pv-act { display: flex; gap: 8px; margin-top: 9px; }
.pv-act .btn { flex: 1; justify-content: center; }
.pv-act .btn:last-child { flex: 0 0 auto; }
/* بطاقة خطوة سابقة: أزرارها مطفأة بعد أن مضى العميل (تبقى للقراءة فقط) */
.card.stale button:disabled, .card.stale input:disabled, .card.stale select:disabled { opacity: .45; cursor: default; }
.card.stale { opacity: .9; }
/* عناويني: صف لكل عنوان مع أزرار التسمية وتحريك الدبوس والحذف */
.place-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.place-row:last-of-type { border-bottom: 0; }
.pl-main { display: flex; flex-direction: column; min-width: 0; }
.pl-main .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.pl-act { display: flex; gap: 6px; flex: none; }
.pl-rename { width: 100%; }
.pl-rename .chips { margin-top: 6px; gap: 6px; }
.btn.place { align-items: flex-start; text-align: start; }
.btn.place span { display: flex; flex-direction: column; line-height: 1.35; }
.btn.place i { font-style: normal; font-size: 11px; opacity: .7; }
/* علامات أماكن المحيط على الخريطة: حرف أول في دائرة، والمسجّل عندنا بلون المنصة */
.pm { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid #8A8A85; color: #1A1A19; font-weight: 700; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.pm.reg { background: var(--brand); border-color: #fff; color: #fff; }
.pm-pop { display: flex; flex-direction: column; gap: 4px; min-width: 150px; font-family: inherit; }
.pm-pop b { font-size: 14px; }
.pm-pop .muted { font-size: 12px; }
.leaflet-popup-content { margin: 10px 12px; }
/* كرت الطلب عند المندوب: زر القبول بعرض الكرت تحت سعر العميل مباشرة، ثم عرض السعر البديل */
.offer .accept-main { margin-top: 10px; }
.offer .accept-main .btn { width: 100%; }
.offer .accept-main + .quote-row { margin-top: 10px; }

/* تغيّر حالة الطلب: حركة قصيرة تشدّ الانتباه (عند العميل وعند المندوب) */
@keyframes statusFlash {
  0%   { box-shadow: 0 0 0 0 rgba(200,16,46,.45); transform: translateY(0); }
  18%  { box-shadow: 0 0 0 7px rgba(200,16,46,.16); transform: translateY(-3px); }
  45%  { box-shadow: 0 0 0 0 rgba(200,16,46,.30); transform: translateY(0); }
  65%  { box-shadow: 0 0 0 6px rgba(200,16,46,.12); transform: translateY(-2px); }
  100% { box-shadow: 0 0 0 0 rgba(200,16,46,0); transform: translateY(0); }
}
@keyframes statusTagPop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.22); }
  60%  { transform: scale(.98); }
  100% { transform: scale(1); }
}
.status-flash { animation: statusFlash 1.5s ease-out 2; }
.status-flash .tag.brand, .status-flash .tag.ok, .status-flash > h4 .tag { animation: statusTagPop .6s ease-out 2; }
/* الخطوة التي وصل إليها الطلب تنبض مرتين */
.status-flash .timeline .step.now .knob, .status-flash .mini .ms.now i { animation: statusTagPop .7s ease-out 3; }
@media (prefers-reduced-motion: reduce) {
  .status-flash, .status-flash .tag.brand, .status-flash .tag.ok, .status-flash .timeline .step.now .knob, .status-flash .mini .ms.now i { animation: none; }
  .status-flash { outline: 2px solid var(--brand); outline-offset: 2px; }
}

/* طلباتي: صف لكل طلب (في «حسابي» وفي بطاقة «السابقة» داخل المحادثة) */
.ord-group { margin-bottom: 10px; }
.ord-title { font-weight: 600; font-size: 13px; color: var(--ink-2); margin: 6px 0 4px; }
.ord-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px dashed var(--line); }
.ord-row:first-child { border-top: 0; }
.ord-main { min-width: 0; flex: 1; font-size: 14px; }
.ord-main .muted { font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.ord-acts { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.orders-card .ord-row:first-child { padding-top: 0; }
