/* Bissda shared styles: one look across the Customer, Restaurant, Driver and Admin apps. */
:root {
  --brand: #e8590c; --brand-dark: #b8430a; --brand-soft: #fff1e8;
  --ink: #1f1a17; --ink-2: #4a423c; --muted: #6b625b; --line: #e7e0d9; --line-2: #d6ccc3;
  --bg: #faf7f4; --surface: #ffffff; --surface-2: #f4efea;
  --ok: #1b7a3d; --ok-soft: #e3f4e8; --warn: #8a5a00; --warn-soft: #fff3d6; --bad: #b42318; --bad-soft: #fde7e5; --info: #1e4e79; --info-soft: #e6f0fa;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(31,26,23,.06), 0 4px 16px rgba(31,26,23,.06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans Gurmukhi", Raavi, "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif;
  --focus: 0 0 0 3px #fff, 0 0 0 5px #1a73e8;
  color-scheme: light;
}
@media (prefers-contrast: more) { :root { --muted: #3d3530; --line: #8c8079; --brand: #a63c00; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; overflow-wrap: anywhere; }
img { max-width: 100%; display: block; }
a { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
/* The page area is focused after each page change so screen readers start at the new content; it isn't a control, so no ring. */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible, main:focus, main:focus-visible { box-shadow: none; outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }

/* layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 520px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap-row { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.bold { font-weight: 600; }
.right { text-align: end; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 1rem; font-weight: 800; }
.logo small { font-weight: 600; font-size: .8rem; color: var(--muted); letter-spacing: 0; }
.topbar .grow { flex: 1; }

/* cards & surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h2, .card h3 { margin-bottom: 8px; }
.section { padding-top: 20px; padding-bottom: 20px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.danger { color: var(--bad); border-color: #f2b8b3; }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 1.05rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; font-size: 1.1rem; }

/* forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; font: inherit; color: inherit; }
textarea { min-height: 80px; resize: vertical; }
/* Stripe's card box (its own frame) styled like our inputs */
.stripe-card { min-height: 44px; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; }
.stripe-card.StripeElement--focus { box-shadow: var(--focus); border-color: #1a73e8; }
.stripe-card.StripeElement--invalid { border-color: var(--bad); }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: var(--focus); border-color: #1a73e8; }
input[aria-invalid=true] { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.otp { letter-spacing: .5em; font-size: 1.4rem; text-align: center; font-variant-numeric: tabular-nums; }
.error-text { color: var(--bad); font-size: .9rem; margin-top: 6px; }
dialog .error-text:not(:empty) { background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; }

/* chips, badges, status */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font: 600 .85rem var(--font); cursor: pointer; color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--info-soft); color: var(--info); } .badge.brand { background: var(--brand-soft); color: var(--brand-dark); }
.s-placed, .s-searching, .s-offered { background: var(--warn-soft); color: var(--warn); }
.s-accepted, .s-preparing, .s-assigned, .s-at_restaurant { background: var(--info-soft); color: var(--info); }
.s-ready, .s-picked_up, .s-on_the_way { background: var(--brand-soft); color: var(--brand-dark); }
.s-delivered { background: var(--ok-soft); color: var(--ok); }
.s-declined, .s-cancelled, .s-delivery_failed { background: var(--bad-soft); color: var(--bad); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }

/* toast */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; width: min(92vw, 460px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: up .2s ease-out; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* dialogs */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(94vw, 520px); max-height: 90vh; max-height: 90dvh; box-shadow: 0 24px 64px rgba(0,0,0,.25); color: var(--ink); }
dialog::backdrop { background: rgba(31,26,23,.45); }
.dlg-head { padding: 18px 20px 4px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
dialog[open] { display: flex; flex-direction: column; }
.dlg-head { flex: none; }
.dlg-body { padding: 8px 20px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.dlg-foot { flex: none; }
.dlg-foot { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* misc */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big-emoji { font-size: 2.4rem; }
.banner { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: .9rem; font-weight: 500; }
.banner.info { background: var(--info-soft); color: var(--info); } .banner.bad { background: var(--bad-soft); color: var(--bad); } .banner.ok { background: var(--ok-soft); color: var(--ok); }
.test-strip { background: repeating-linear-gradient(45deg, #fff3d6, #fff3d6 10px, #ffeab3 10px, #ffeab3 20px); color: #6b4700; text-align: center; font-size: .8rem; font-weight: 600; padding: 4px 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), #fff, var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.map { height: 320px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 6px 0; color: var(--muted); }
.steps li .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); margin-top: 2px; background: #fff; }
.steps li.done { color: var(--ink); } .steps li.done .dot { background: var(--ok); border-color: var(--ok); }
.steps li.current { color: var(--ink); font-weight: 700; } .steps li.current .dot { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.kpi { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.price { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* money and numbers never break across lines */
.price, .num, td.num, .kpi { white-space: nowrap; overflow-wrap: normal; }
.logo, .logo-mark, .badge, .btn, .chip { overflow-wrap: normal; white-space: nowrap; }

/* language picker */
.lang-picker { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.lang-picker select { padding: 6px 10px; padding-inline: 10px 28px; border-radius: 999px; min-height: 36px; font-size: .9rem; width: auto; }
.lang-picker.compact select { padding-inline-start: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }
/* On phones the compact picker is a round 🌐 button; the real menu sits invisibly on top of it. */
@media (max-width: 520px) {
  .lang-picker.compact { position: relative; width: 40px; height: 40px; justify-content: center; border-radius: 50%; border: 1px solid var(--line, #e5ded6); font-size: 1.1rem; flex: none; }
  .lang-picker.compact select { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; opacity: 0; cursor: pointer; }
  .lang-picker.compact:focus-within { outline: 3px solid var(--brand, #e8590c); outline-offset: 2px; }
}
:lang(pa) { line-height: 1.65; }
:lang(ar) { line-height: 1.7; }

/* ---------- right-to-left (Arabic) ---------- */
/* Arrows that mean back / forward / next point the other way. */
[dir=rtl] .dir-flip { display: inline-block; transform: scaleX(-1); }
/* Numbers, money, phone numbers, codes and times keep their own order inside Arabic text. */
[dir=rtl] :is(.price, .num, .kpi, .mono, .code, .code-badge, bdi, time, a[href^="tel:"]) { unicode-bidi: isolate; }
/* Phone, card, code and number fields are typed left to right; text sits on the right, next to the Arabic label. */
[dir=rtl] :is(input[type=tel], input[type=email], input[type=number], input[type=url], input[inputmode=numeric], input[inputmode=decimal], input[inputmode=tel], input[autocomplete^=cc-], .otp) { direction: ltr; text-align: right; }
[dir=rtl] .otp { text-align: center; }
/* Maps stay left to right inside (tiles, controls and attribution). */
.leaflet-container { direction: ltr; }
/* Text that is all data (restaurant names, addresses): ordered by its own first letter, so "300 Crown St" and
   "Pizza Co." read correctly, but still aligned to the right like the Arabic around it. */
[dir=rtl] :is(.page-title, .data-text) { unicode-bidi: plaintext; text-align: right; }
/* Free text fields: what's typed (an English dish name, "12 portions") keeps its own order. */
[dir=rtl] :is(textarea, input[type=text], input[type=search]) { unicode-bidi: plaintext; text-align: right; }
/* AI images panel (restaurant Menu and admin) */
.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ai-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ai-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; background: var(--surface-2, #f4f0eb); }
.ai-card .ai-body { padding: 10px 12px 12px; }
.ai-desc { margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Bissda Help chat (all three apps) ---------- */
.help-fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; background: var(--brand); color: #fff; font: inherit; font-weight: 700; padding: 10px 16px 10px 10px; box-shadow: 0 6px 20px rgba(31,26,23,.25); cursor: pointer; }
.help-fab span:first-child { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.help-fab:focus-visible { outline: 3px solid var(--brand-dark); outline-offset: 3px; }
dialog.hc-dialog { padding: 0; border: 0; border-radius: 18px; width: min(96vw, 440px); height: min(86vh, 680px); display: flex; flex-direction: column; overflow: hidden; }
dialog.hc-dialog:not([open]) { display: none; }
.hc-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.hc-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.hc-titles { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.hc-sub { font-size: .8rem; color: var(--muted); }
.hc-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.hc-msg { max-width: 88%; padding: 9px 12px; border-radius: 16px; display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere; }
.hc-me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.hc-bot { align-self: flex-start; background: var(--brand-soft); border-bottom-left-radius: 5px; }
.hc-staff { border: 1px solid var(--brand); }
.hc-who { font-size: .75rem; font-weight: 700; color: var(--brand-dark); }
.hc-typing { opacity: .7; }
.hc-card { background: var(--card, #fff); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; display: flex; flex-direction: column; gap: 5px; font-size: .88rem; color: inherit; text-decoration: none; }
.hc-row { display: flex; justify-content: space-between; gap: 10px; }
.hc-subrow { color: var(--muted); padding-left: 10px; font-size: .82rem; }
.hc-total { border-top: 1px solid var(--line); padding-top: 5px; }
.hc-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hc-chip { font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--brand-soft); color: var(--brand-dark); }
.hc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-sys { align-self: center; font-size: .8rem; color: var(--muted); text-align: center; }
.hc-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.hc-form input { flex: 1; min-width: 0; }
@media print { .help-fab { display: none; } }
/* Phones: Help is a small round "?" and pages keep room at the bottom so it never covers a field or button */
@media (max-width: 700px) {
  .help-fab { padding: 0; width: 44px; height: 44px; justify-content: center; gap: 0; border-radius: 50%; right: max(12px, env(safe-area-inset-right, 0px)); }
  .help-fab span:first-child { background: transparent; width: auto; height: auto; font-size: 1.15rem; }
  .help-fab span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  main, #main, .page-main { padding-bottom: 64px; }
}

/* Tax screens for restaurants and drivers (20 Nov 2026) */
.tax-box { display: grid; gap: 8px; margin: 12px 0; }
.tax-h { font-size: 1rem; margin: 0 0 4px; }
.tax-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.tax-row .tax-v { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tax-row.big .tax-v { font-size: 1.2rem; }
.tax-row.total { border-top: 2px solid currentColor; padding-top: 6px; }
.tax-l { color: var(--brand, #e8590c); display: inline-block; min-width: 28px; }

/* Where a payout is (sent → on the way → in bank) */
.pt-track { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--muted); margin: 4px 0; flex-wrap: wrap; }
.pt-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.pt-dot.on { background: var(--ok); } .pt-dot.now { background: var(--info); } .pt-dot.wait { background: var(--warn); } .pt-dot.bad { background: var(--bad); }
.pt-line { flex: 1; min-width: 10px; height: 2px; background: var(--line); } .pt-line.on { background: var(--ok); }
td .badge { white-space: normal; }

/* A message translated for you: the original, opened from "Show original" */
.tr-original { margin-top: 4px; padding: 6px 8px; border-left: 3px solid var(--line, #e3dbd0); font-size: .92em; opacity: .85; white-space: pre-wrap; }
.tr-toggle, .hc-msg .linklike, .convo .linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-size: .85em; text-decoration: underline; cursor: pointer; min-height: 24px; }
