/* Bissda Driver: phone-first, one-handed, readable outdoors. Builds on /shared/bissda.css. */
:root { --tabbar-h: 64px; --go: #157a3a; --go-dark: #0f5c2b; --ink-strong: #120e0c; }
body { background: #f3eee9; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
.topbar .wrap { min-height: 56px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.label-like { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.section { padding: 16px 0 24px; }
.btn.huge { min-height: 64px; font-size: 1.15rem; font-weight: 700; border-radius: 16px; }
.btn.ok { color: #fff; }
.btn.ok:hover { background: var(--go-dark); }
.btn.danger { background: #fff; }
.btn[disabled] { opacity: .45; }
[aria-busy=true] { cursor: progress; }

/* top status pill */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.pill.on { background: var(--ok-soft); color: var(--go); }
.pill.on .dot { box-shadow: 0 0 0 0 rgba(21,122,58,.6); animation: ping 1.6s infinite; }
.pill.off { background: var(--surface-2); color: var(--ink-2); }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(21,122,58,0); } 100% { box-shadow: 0 0 0 0 rgba(21,122,58,0); } }

/* bottom tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border-top: 1px solid var(--line-2); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabbar-h);
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .8rem; }
.tab-icon { font-size: 1.35rem; line-height: 1; filter: grayscale(1); opacity: .75; }
.tab[aria-current=page] { color: var(--brand-dark); box-shadow: inset 0 3px 0 var(--brand); }
.tab[aria-current=page] .tab-icon { filter: none; opacity: 1; }
@media (min-width: 900px) {
  .tabbar { position: sticky; top: 56px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); max-width: 520px; margin: 0 auto; border-radius: 0 0 14px 14px; }
  body { padding-bottom: 0; }
}

/* toasts at the top so they never cover the big action buttons */
#toasts { top: 12px; bottom: auto; z-index: 1000; pointer-events: none; }
#toasts > .toast:nth-last-child(n+3) { display: none; }

/* online switch */
.online-switch { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 92px; padding: 14px 18px;
  border-radius: 20px; border: 0; cursor: pointer; text-align: start; font: inherit; color: #fff; background: var(--ink-strong); box-shadow: 0 6px 18px rgba(18,14,12,.25); }
.online-switch:hover { background: #2b2420; }
.online-switch.is-on { background: var(--go); }
.online-switch.is-on:hover { background: var(--go-dark); }
.online-switch[disabled] { opacity: .7; }
.online-switch.compact { min-height: 64px; padding: 8px 14px; border-radius: 16px; }
.online-switch.compact .sw-main { font-size: 1.1rem; }
.online-switch.compact .sw-track { width: 60px; height: 34px; }
.online-switch.compact .sw-knob { width: 24px; height: 24px; }
.online-switch.compact.is-on .sw-knob { transform: translateX(26px); }
.sw-text { display: grid; }
.sw-main { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.sw-sub { font-size: .92rem; opacity: .92; }
.sw-track { flex: none; width: 76px; height: 42px; border-radius: 999px; background: rgba(255,255,255,.28); position: relative; border: 2px solid rgba(255,255,255,.7); }
.sw-knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 32px; height: 32px; border-radius: 50%; background: #fff; transition: transform .2s; }
.is-on .sw-knob { transform: translateX(34px); }
[dir=rtl] .is-on .sw-knob { transform: translateX(-34px); }
[dir=rtl] .online-switch.compact.is-on .sw-knob { transform: translateX(-26px); }
.big-err:not(:empty) { background: var(--bad-soft); padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600; margin-top: 8px; }

/* small switch rows (test location, simulate driving) */
.switch-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: var(--ink); }
.switch-text { display: grid; gap: 2px; }
.switch-knob { flex: none; width: 52px; height: 30px; border-radius: 999px; background: #8c8079; position: relative; }
.switch-knob::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch-row[aria-checked=true] .switch-knob { background: var(--go); }
.switch-row[aria-checked=true] .switch-knob::after { transform: translateX(22px); }
[dir=rtl] .switch-row[aria-checked=true] .switch-knob::after { transform: translateX(-22px); }

/* status */
.status-card .big-name { font-size: 1.15rem; }
.rating { font-size: 1.3rem; font-weight: 800; color: var(--ink-strong); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* waiting */
.waiting { text-align: center; padding: 28px 16px; }
.waiting.off { padding: 20px 16px; }
.radar { position: relative; width: 96px; height: 96px; margin: 0 auto 14px; }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--brand); opacity: 0; animation: radar 2.4s infinite ease-out; }
.radar span:nth-child(2) { animation-delay: 1.2s; }
.radar .radar-dot { inset: 36px; background: var(--brand); border: 0; opacity: 1; animation: none; }
@keyframes radar { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }

/* location card */
.loc-card summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; list-style: none; }
.loc-card summary::-webkit-details-marker { display: none; }
.loc-card summary::after { content: '▾'; color: var(--muted); }
.loc-card[open] summary::after { content: '▴'; }
.loc-summary { margin-inline-start: auto; text-align: end; }

/* offer overlay */
.offer-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(18,14,12,.72); display: flex; align-items: flex-end; justify-content: center; padding: 12px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.offer { width: min(100%, 480px); max-height: calc(100vh - 24px); overflow: auto; background: var(--surface); border-radius: 24px; box-shadow: 0 24px 64px rgba(0,0,0,.4); animation: up .2s ease-out; }
.offer-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 10px; gap: 12px; }
.offer-top h2 { margin: 0; font-size: 1.3rem; }
.count { display: flex; align-items: baseline; gap: 2px; background: var(--ink-strong); color: #fff; border-radius: 14px; padding: 6px 12px; min-width: 74px; justify-content: center; }
.count-num { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.count small { font-size: .75rem; opacity: .85; }
.offer.urgent .count { background: var(--bad); }
.count-track { height: 8px; background: var(--surface-2); margin: 0 20px; border-radius: 999px; overflow: hidden; }
.count-bar { height: 100%; background: var(--brand); border-radius: 999px; transition: width .25s linear; }
.offer.urgent .count-bar { background: var(--bad); }
.offer-body { padding: 14px 20px 6px; }
.offer-pay { display: grid; margin-bottom: 12px; }
.offer-pay .pay { font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink-strong); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pay-label { color: var(--muted); font-weight: 600; }
.offer-facts { margin: 0; display: grid; gap: 10px; }
.offer-facts > div { display: grid; grid-template-columns: 104px 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.offer-facts dt { color: var(--muted); font-weight: 600; }
.offer-facts dd { margin: 0; display: grid; }
.offer-facts .hl { color: var(--brand-dark); font-weight: 700; }
.offer-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding: 12px 20px 20px; position: sticky; bottom: 0; background: var(--surface); }
.offer-accept { background: var(--go); border-color: var(--go); color: #fff; }
.offer-accept:hover { background: var(--go-dark); }
.offer-decline { background: #fff; border: 2px solid var(--ink-2); }

/* job */
.job-head { background: var(--ink-strong); color: #fff; border-radius: 18px; padding: 14px 16px 10px; }
.job-head .code-badge { font-size: .9rem; }
.earn { font-size: .95rem; }
.earn strong { font-size: 1.15rem; }
.seg { list-style: none; margin: 12px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg li { height: 8px; border-radius: 999px; background: rgba(255,255,255,.25); }
.seg li.done { background: #7fd39b; }
.seg li.current { background: var(--brand); }
.step-label { margin: 0; font-size: .95rem; }
.job-title { font-size: 1.5rem; margin: 6px 0 0; }
.place { display: grid; gap: 6px; }
.place-name { font-size: 1.3rem; font-weight: 800; }
.place-addr { font-size: 1.02rem; }
.big-addr { font-size: 1.2rem; font-weight: 700; }
.unit { font-size: 1.15rem; font-weight: 800; color: var(--brand-dark); }
.dist { font-weight: 700; color: var(--ink-2); }
.dropoff-notes { display: grid; gap: 2px; background: #fff3c4; border: 2px solid #e0b400; color: #3d2f00; border-radius: 12px; padding: 10px 12px; font-size: 1.05rem; font-weight: 600; }
.notes-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.job-map { height: 220px; }
.nav-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nav-btn { min-height: 52px; padding: 0 6px; font-size: .9rem; border-radius: 12px; border-width: 2px; white-space: normal; text-align: center; line-height: 1.1; }
.code-card { text-align: center; }
.big-code { font-size: 3rem; font-weight: 900; letter-spacing: .06em; color: var(--ink-strong); font-variant-numeric: tabular-nums; line-height: 1.1; margin: 4px 0; }
.items .item-line { display: flex; gap: 10px; font-size: 1.05rem; }
.items .qty { font-weight: 800; color: var(--brand-dark); min-width: 2.2em; }
.items .note { color: var(--warn); font-weight: 600; }
.banner.wait { display: flex; gap: 10px; align-items: center; background: var(--info-soft); color: var(--info); font-size: 1rem; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-check { background: var(--surface); border: 2px solid var(--line-2); border-radius: 14px; padding: 14px; font-size: 1.05rem; font-weight: 600; }
.big-check input { width: 26px; height: 26px; }
.pin-input { font-size: 2rem; min-height: 64px; max-width: 220px; }
.problem-btn { border-style: dashed; color: var(--ink-2); }
.next-step { font-size: 1.1rem; font-weight: 600; }
.radio-card { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
fieldset.plain { border: 0; padding: 0; margin: 0 0 12px; }
fieldset.plain legend { margin-bottom: 8px; }

/* success */
.done-card { text-align: center; padding: 28px 18px; }
.done-icon { font-size: 3rem; }
.trip-earn { display: grid; gap: 2px; background: var(--ok-soft); color: var(--go); border-radius: 14px; padding: 14px; }
.trip-earn .kpi { font-size: 2.4rem; }

/* earnings */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi-card { padding: 14px; }
.kpi-card.hero { background: var(--ink-strong); color: #fff; border-color: var(--ink-strong); }
.kpi-card.hero .muted { color: #e7ded6; }
.deliv { display: grid; gap: 4px; }

/* sign-up */
fieldset.card { margin: 0; }
fieldset.card legend { font-weight: 700; padding: 0 6px; }
.veh-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.veh { display: grid; justify-items: center; gap: 4px; min-height: 80px; padding: 10px 4px; border: 2px solid var(--line-2); border-radius: 14px; background: var(--surface); font: 600 .9rem var(--font); color: var(--ink); cursor: pointer; }
.veh-icon { font-size: 1.7rem; }
.veh[aria-pressed=true] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.photo-field { position: relative; }
.photo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.photo-btn { border: 2px dashed var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.photo-btn:hover { background: #ffe4d1; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.photo-field:focus-within .photo-btn { box-shadow: var(--focus); }
.photo-preview { width: 84px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); }
.photo-status { font-size: .9rem; font-weight: 600; margin-top: 6px; color: var(--ink-2); }
.pending-card { text-align: center; }
.pending-card .facts { text-align: start; }
.pending-icon { font-size: 3rem; }

@media (max-width: 360px) {
  .veh-grid { grid-template-columns: repeat(2, 1fr); }
  .offer-facts > div { grid-template-columns: 1fr; gap: 2px; }
}

/* keep the 16px side gutter (.section otherwise resets horizontal padding) */
.narrow.section { padding-left: 16px; padding-right: 16px; }
.narrow.section .narrow { padding-left: 0; padding-right: 0; }

/* special order types: offer label, party orders */
.offer-type { display: grid; gap: 6px; margin: 0 0 12px; }
.offer-type-label { display: inline-block; justify-self: start; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; padding: 6px 12px; border-radius: 999px; font-size: 1rem; }
.offer-car { display: grid; background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 8px 12px; font-weight: 800; }
.offer-car-sub { font-weight: 600; font-size: .85rem; }
.type-note { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.party-banner { background: #fff4e6; border: 2px solid var(--brand); border-radius: 16px; padding: 14px 16px; display: grid; gap: 6px; }
.party-head { display: flex; gap: 12px; align-items: center; }
.party-icon { font-size: 1.8rem; line-height: 1; }
.party-title { font-size: 1.25rem; font-weight: 800; color: var(--ink-strong); }
.party-when { color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.party-line { margin: 0; }
.party-line.strong { font-weight: 800; font-size: 1.05rem; color: var(--brand-dark); }
.party-line.setup { font-size: 1.05rem; background: #fff; border-radius: 10px; padding: 8px 10px; overflow-wrap: anywhere; }

/* language picker in the top bar: wraps under the logo on narrow screens instead of pushing the page wider */
.topbar .wrap { flex-wrap: wrap; row-gap: 4px; }
.topbar .lang-picker.compact select { max-width: 9.5rem; min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
/* phones: the top-bar picker shrinks to its globe; the real <select> sits invisibly on top of it, so tapping opens the list */
@media (max-width: 520px) {
  .topbar .lang-picker.compact { position: relative; width: 40px; height: 40px; justify-content: center; border-radius: 50%; border: 1px solid var(--line); font-size: 1.1rem; }
  .topbar .lang-picker.compact select { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; opacity: 0; cursor: pointer; }
  .topbar .lang-picker.compact:focus-within { outline: 3px solid var(--brand); outline-offset: 2px; }
}
#top-status { margin-inline-start: auto; }
#top-status .btn { white-space: normal; }

/* long translations: let buttons wrap instead of running off the screen */
.btn { white-space: normal; }
.count-num { white-space: nowrap; flex: none; }
.count small { max-width: 5.5em; overflow-wrap: anywhere; line-height: 1.1; }
.offer-top h2 { min-width: 0; }

/* right-to-left (Arabic): restaurant names and addresses keep their own order, aligned right */
[dir=rtl] :is(.place-name, .place-addr, .offer-facts dd > *, .offer-facts dd) { unicode-bidi: plaintext; text-align: right; }
.sealed-check { border: 1px solid var(--line, #e7e0d9); display: flex; flex-direction: column; gap: 8px; }
.sealed-check legend { padding: 0 4px; }
