/* =====================================================================
   Driver app — work screen. The map takes the WHOLE phone screen; everything else floats on it:
   online bar (top), round map buttons (right), course card (bottom), floating navigation bar.
   Navy + orange (Deroua V9), green = go / accept. Built for iPhone size first.
   ===================================================================== */
:root { --navy: #14213d; --orange: #f97316; --orange-deep: #c2410c; --go: #16a34a; --go-deep: #15803d;
  --nav-h: calc(64px + env(safe-area-inset-bottom)); --radius: 20px;
  --glass: rgba(255,255,255,.92); --glass-dark: rgba(20,33,61,.9);
  --shadow: 0 12px 32px rgba(20,33,61,.20), 0 2px 8px rgba(20,33,61,.10); }
body { -webkit-tap-highlight-color: transparent; }
a.btn, a.btn:hover { text-decoration: none; }
.btn { border-radius: 12px; transition: transform .08s ease, background .15s ease; }
.btn:active, .fab:active { transform: scale(.95); }
.btn--go { background: var(--go); color: #fff; } .btn--go:hover { background: var(--go-deep); }
.btn--navy { background: var(--navy); color: #fff; } .btn--navy:hover { background: #24324f; }
.btn--xl { padding: 16px 18px; font-size: 17px; border-radius: 16px; min-height: 56px; }
.ico { flex: none; }

/* ---- navigation bar: icons + labels, active pill (floats over the map on the work screen) */
.nav { grid-template-columns: repeat(4, 1fr); height: var(--nav-h); padding: 6px 8px env(safe-area-inset-bottom); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid #e3e7ef; z-index: 30; }
.nav button { display: grid; justify-items: center; align-content: center; gap: 3px; padding: 4px 2px; font: 600 12px/1.1 inherit; color: #5b6782; border-radius: 14px; box-shadow: none; }
.nav button .ico { width: 24px; height: 24px; padding: 3px 14px; box-sizing: content-box; border-radius: 99px; transition: background .15s ease; }
.nav button[aria-current="page"] { color: var(--navy); box-shadow: none; }
.nav button[aria-current="page"] .ico { background: #fff1e6; color: var(--orange-deep); }
body.work-mode .nav { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); height: 64px; padding: 6px; border: 0; border-radius: 22px; background: var(--glass); box-shadow: var(--shadow); }

/* ---- work screen: map = whole screen */
body.work-mode { overflow: hidden; overscroll-behavior: none; }
body.work-mode .top { display: none; }
body.work-mode main { max-width: none; padding: 0; margin: 0; }
.work-mode #work { --float-bottom: calc(86px + env(safe-area-inset-bottom)); position: fixed; inset: 0; overflow: hidden; background: #e5e7eb; }
.work-mode .nav-panel { position: absolute; inset: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; }
.work-mode .nav-map { position: absolute; inset: 0; height: auto; border: 0; border-radius: 0; }
.work-mode .nav-map__route polyline { stroke: #2563eb; stroke-width: 7; opacity: .92; }
.work-mode .nav-map__mark--shop { background: var(--orange); width: 34px; height: 34px; font-size: 14px; }
.work-mode .nav-map__mark--customer { background: #dc2626; width: 34px; height: 34px; font-size: 14px; }
.work-mode .nav-map__status { top: 42%; inset-inline-start: 50%; transform: translateX(-50%); border-radius: 99px; }
.work-mode .nav-map__attr { top: calc(env(safe-area-inset-top) + 76px); bottom: auto; inset-inline-end: 6px; border-radius: 6px; opacity: .75; }

/* round map buttons, stacked on the right just above the course card */
.work-mode .nav-map__btn { inset-inline-end: 12px; top: auto; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--glass); color: var(--navy); box-shadow: var(--shadow); font-size: 22px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: bottom .25s ease; }
.work-mode .nav-map__btn--fit { bottom: calc(var(--float-bottom) + var(--dock-h, 120px) + 14px); }
.work-mode .nav-map__btn--me { bottom: calc(var(--float-bottom) + var(--dock-h, 120px) + 70px); color: #2563eb; }
.work-mode .nav-map__btn--out { bottom: calc(var(--float-bottom) + var(--dock-h, 120px) + 134px); }
.work-mode .nav-map__btn--in { bottom: calc(var(--float-bottom) + var(--dock-h, 120px) + 186px); }

/* top bar: online switch (dark glass) + small status chips */
.work-top { position: absolute; z-index: 12; top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 12px; display: grid; gap: 8px; pointer-events: none; }
.work-top > * { pointer-events: auto; }
.work-mode .switch { margin: 0; min-height: 60px; padding: 8px 8px 8px 16px; gap: 12px; border: 0; border-radius: 99px; background: var(--glass-dark); color: #fff; box-shadow: var(--shadow); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.switch__dot { width: 12px; height: 12px; border-radius: 50%; background: #94a3b8; flex: none; }
.switch--on .switch__dot { background: #22c55e; animation: dot 1.6s ease-out infinite; }
@keyframes dot { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 100% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } }
.switch__text { display: grid; flex: 1; min-width: 0; line-height: 1.2; } .switch__text b { font-size: 16px; } .switch__text .small { color: #cbd5e1; font-size: 12.5px; }
.work-mode .switch .btn { min-width: 0; padding: 12px 18px; font-size: 14.5px; border-radius: 99px; }
.work-mode .switch .btn--ghost { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.work-top__chips { display: flex; gap: 6px; min-width: 0; } .work-top__chips:empty { display: none; }
.work-mode .gps-line { display: flex; flex-wrap: nowrap; justify-content: flex-start; align-items: center; gap: 6px; min-width: 0; margin: 0; padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--glass); color: #3b4763; box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.work-mode .gps-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .work-mode .gps-line .small { display: none; }
.work-mode .gps-line--ok { color: #065f46; } .work-mode .gps-line--ok::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.work-mode .gps-line--bad { color: #991b1b; }
.alerts-chip { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 99px; background: var(--orange); color: #fff; font: 700 12px inherit; box-shadow: var(--shadow); cursor: pointer; }
.alerts-chip .ico { width: 15px; height: 15px; }
.work-banners { position: absolute; z-index: 12; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 112px); display: grid; gap: 6px; }
.work-banners:empty { display: none; } .work-banners .banner { margin: 0; box-shadow: var(--shadow); font-size: 13px; }

/* next turn + status chips float under the top bar */
.work-mode .nav-overlay { position: absolute; z-index: 11; top: calc(env(safe-area-inset-top) + 112px); left: 12px; right: 12px; display: grid; gap: 6px; pointer-events: none; }
.work-mode .nav-next { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 16px; border-radius: var(--radius); background: var(--go-deep); box-shadow: var(--shadow); font-size: 16px; line-height: 1.25; }
.work-mode .nav-next[hidden] { display: none; }
.nav-next__dist { flex: none; font: 800 21px/1 system-ui, sans-serif; padding-inline-end: 12px; border-inline-end: 1px solid rgba(255,255,255,.35); }
.work-mode .nav-chips { margin: 0; } .work-mode .nav-chip { box-shadow: var(--shadow); background: var(--glass); font-weight: 600; }
.work-mode .nav-chip--bad { background: #fee2e2; } .work-mode .nav-chip--warn { background: #fef3c7; }

/* ---- course card floating above the navigation bar */
.dock { position: absolute; z-index: 15; left: 12px; right: 12px; bottom: var(--float-bottom); max-height: calc(100% - var(--float-bottom) - 120px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 12px; padding: 14px; border-radius: 24px; background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.dock--urgent { animation: dock-in .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes dock-in { from { transform: translateY(30%); opacity: .4; } to { transform: none; opacity: 1; } }
.dock .card { margin: 0; } .dock .install-card { padding: 12px; }

/* round icon buttons (Maps, Appeler, Voix…) */
.fab { display: inline-grid; justify-items: center; align-content: center; gap: 2px; width: 58px; height: 58px; flex: none; border: 0; border-radius: 18px; background: #eef1f6; color: var(--navy); font: 700 11px/1 inherit; text-decoration: none; cursor: pointer; }
.fab .ico { width: 22px; height: 22px; } .fab[hidden] { display: none; }
.fab[aria-pressed="true"] { background: #dcfce7; color: #166534; }
.fab--sm { width: 40px; height: 40px; border-radius: 50%; }

/* waiting for offers */
.waiting { display: flex; align-items: center; gap: 14px; }
.waiting b { display: block; font-size: 15.5px; }
.radar { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; background: #e2e8f0; }
.radar::after { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: #94a3b8; }
.waiting--on .radar { background: #dcfce7; } .waiting--on .radar::after { background: var(--go); }
.waiting--on .radar::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--go); animation: radar 1.8s ease-out infinite; }
@keyframes radar { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

/* offer (compact, on the map) */
.offer-card { display: grid; gap: 12px; }
.dock--urgent { box-shadow: 0 0 0 3px var(--orange), var(--shadow); }
.offer-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.offer-card__head h2 { margin: 2px 0 0; font-size: 18px; }
.eyebrow { font: 800 11.5px/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--orange-deep); }
.offer-card__pay { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.offer-card__pay .small { flex-basis: 100%; color: #5b6782; }
.offer-card__pay b { font-size: 30px; line-height: 1.05; color: var(--navy); }
.offer-card .trip { display: flex; gap: 10px; }
.offer-card .trip__stop { flex: 1 1 0; min-width: 0; padding: 10px 10px 10px 32px; border-radius: 14px; background: #f3f5f9; }
.offer-card .trip__stop::before { left: 10px; top: 12px; } .offer-card .trip__stop::after { display: none; }
.offer-card .trip__stop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[dir="rtl"] .offer-card .trip__stop { padding: 10px 32px 10px 10px; } [dir="rtl"] .offer-card .trip__stop::before { right: 10px; left: auto; }
.offer-card .acts { margin: 0; grid-template-columns: 1fr 1.6fr; }
.ring { position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring__bg { fill: none; stroke: #e3e7ef; stroke-width: 5; }
.ring__arc { fill: none; stroke: var(--go); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring--late .ring__arc { stroke: #dc2626; }
.ring__num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; }

/* delivery in progress (compact card) */
.job-dock { display: grid; gap: 10px; }
.job-dock__head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.job-dock__ref { margin-inline-start: auto; font-weight: 700; color: #5b6782; font-size: 13px; }
.job-dock__dest { display: grid; gap: 2px; } .job-dock__dest b { font-size: 17px; }
.job-dock__dest .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-dock .nav-summary { margin: 0; font-size: 14px; } .job-dock .nav-summary__legs { display: none; }
.job-dock__acts { display: flex; gap: 8px; align-items: center; }
.job-dock__main { flex: 1; min-width: 0; gap: 8px; }

/* details of the delivery: slides over the map on demand */
.details { position: absolute; z-index: 40; inset: calc(env(safe-area-inset-top) + 40px) 0 0 0; display: flex; flex-direction: column; background: #fff; border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(20,33,61,.3);
  transform: translateY(105%); visibility: hidden; transition: transform .3s cubic-bezier(.2,.9,.3,1), visibility 0s .3s; }
.details--open { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2,.9,.3,1); }
.details__bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.details__bar b { font-size: 17px; }
.details__body { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(100px + env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start; }

/* trip timeline (shop → customer) */
.trip { list-style: none; margin: 0; padding: 0; display: grid; }
.trip__stop { position: relative; display: grid; gap: 2px; padding: 0 0 14px 30px; }
.trip__stop:last-child { padding-bottom: 0; }
.trip__stop::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--orange); box-sizing: border-box; }
.trip__stop--customer::before { border-color: #dc2626; }
.trip__stop:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 22px; bottom: 2px; border-left: 2px dashed #cbd5e1; }
.trip__stop--done { opacity: .55; }
.trip__stop--now.trip__stop--shop::before { background: var(--orange); } .trip__stop--now.trip__stop--customer::before { background: #dc2626; }
[dir="rtl"] .trip__stop { padding: 0 30px 14px 0; } [dir="rtl"] .trip__stop::before { left: auto; right: 3px; } [dir="rtl"] .trip__stop:not(:last-child)::after { left: auto; right: 10px; }

/* full delivery card (in the details sheet) */
.job-card { display: grid; gap: 12px; }
.job-card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; } .job-card__head h2 { margin: 0; }
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; background: #eef1f6; color: #3b4763; white-space: nowrap; }
.chip--cash, .chip--shop { background: #fff1e6; color: var(--orange-deep); } .chip--paid, .chip--go { background: #dcfce7; color: #166534; }
.cash-banner { padding: 12px 14px; border-radius: 14px; background: var(--navy); color: #fff; font-weight: 800; font-size: 16px; }
.cash-banner--paid { background: #dcfce7; color: #166534; }
.quick { display: flex; gap: 8px; margin-top: 8px; }
.quick .btn { flex: 1 1 0; min-width: 0; justify-content: center; gap: 6px; padding: 11px 8px; border-radius: 12px; font-size: 13.5px; white-space: nowrap; }
.quick .ico { width: 18px; height: 18px; }
.job-card .pin-input { font-size: 32px; padding: 14px; border-radius: 14px; border-width: 2px; }
.job-card form .btn[type=submit] { min-height: 56px; font-size: 17px; border-radius: 14px; background: var(--go); }
.nav-info { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: #f6f7fb; }
.nav-info p { margin: 0; }
.nav-tools { display: flex; gap: 6px; flex-wrap: wrap; } .nav-tools [hidden] { display: none; }
.work-mode .toasts { top: 44%; bottom: auto; left: 12px; right: 12px; justify-items: center; z-index: 50; }

/* larger screens: card + details as a side panel */
@media (min-width: 900px) {
  .dock { left: auto; width: 400px; }
  .details { inset: 16px 16px calc(96px + env(safe-area-inset-bottom)) auto; width: 420px; border-radius: 24px; }
  .work-top, .work-mode .nav-overlay, .work-banners { right: auto; width: 420px; }
  body.work-mode .nav { left: 50%; right: auto; width: 440px; transform: translateX(-50%); }
  .work-mode .nav-map__btn { inset-inline-end: 428px; }
}
@media (prefers-reduced-motion: reduce) { .dock--urgent, .radar::before, .switch__dot { animation: none !important; } .details { transition: none; } }

/* chat / in-app call buttons in the delivery card */
.fab { position: relative; }
.fab--go { background: #16a34a; color: #fff; }
.fab .chat-badge { top: -4px; inset-inline-end: -4px; }
.job-dock__acts { gap: 6px; } .job-dock__acts .fab { width: 52px; height: 56px; }
.details__body .chat-entry { margin-top: 2px; }
