/* PURP Driver PWA — styles.css
 * Mobile-first dark theme, PURP Design Brain `driver` surface.
 *
 * ─────────────────────────────────────────────────────────────────
 * DESIGN BRAIN MIRROR (CSS-only — this PWA is vanilla JS and cannot
 * read @purp/ui CSS custom properties at runtime, so the locked
 * Design Brain values are mirrored here as static hex/rgba).
 *
 * Source of truth: packages/ui/src/styles.css
 *   [data-pdb-surface="driver"]  +  the LOCKED :root role palette (3j).
 *
 * Driver surface (exact, mirrored):
 *   --pdb-bg-app / --pdb-bg-page  = --pdb-purp-midnight  #15001f
 *   --pdb-bg-surface              = --pdb-purp-plum      #210033
 *   --pdb-text-primary            = #ffffff
 *   --pdb-text-secondary          = rgba(255,255,255,.82)
 *   --pdb-border-default          = rgba(217,203,255,.28)
 *   --pdb-action-primary-bg       = --pdb-purp-violet    #7c3aed
 *   --pdb-action-primary-text     = #ffffff
 *   --pdb-status-positive-text    = --pdb-purp-lavender  #d9cbff
 *   --pdb-button-height-md        = 50px
 *
 * Status families the driver block leaves to :root are mirrored using
 * the LOCKED PURP role palette, treated for a dark surface the same
 * way the sibling dark surface (commandDark) does — never green / raw
 * blue / teal as a status. Positive = PURP-violet/lavender, warning =
 * champagne, danger = rose-plum, info/location = periwinkle/indigo.
 *
 * Mirrored named roles (LOCKED):
 *   ink #17121f · midnight #15001f · plum #210033 · royal #3f0a6a
 *   primary #5b16a3 · action #6d28d9 · violet #7c3aed · orchid #a78bfa
 *   lavender #d9cbff · mist #eee7ff · pearl #f8f5ff
 *   champagne-accent #f3c969 · gold-antique #b98218
 *   rose-plum danger: text #f5a9c8 · dot #c02666 · deep #8e164d
 *   return lifecycle: bg rgba(192,38,102,.20) · text #f5a9c8
 *                     border rgba(245,169,200,.34) · action #c02666
 *   periwinkle info: text #b9c7ff · dot #4f46e5
 * Update this file only when the locked palette changes.
 * ─────────────────────────────────────────────────────────────────
 */

:root {
  /* Driver surface — mirrored Design Brain values (see header). */
  --bg-deep: #15001f;        /* --pdb-purp-midnight */
  --bg-card: #210033;        /* --pdb-purp-plum (--pdb-bg-surface) */
  --bg-surface: #3f0a6a;     /* --pdb-purp-royal (raised/tinted) */
  --border: rgba(217,203,255,.18);   /* --pdb-border-subtle (dark) */
  --purple: #7c3aed;         /* --pdb-purp-violet (--pdb-action-primary-bg) */
  --purple-brand: #a78bfa;   /* --pdb-purp-orchid (on-dark brand link) */
  --purple-dim: rgba(217,203,255,.62); /* lavender-muted label */
  --orange: #f3c969;         /* --pdb-champagne-accent (premium accent) */
  --green: #d9cbff;          /* --pdb-purp-lavender (positive on dark) */
  --amber: #f3c969;          /* --pdb-champagne-accent (warning on dark) */
  --red: #f5a9c8;            /* rose-plum danger text (on dark) */
  --blue: #b9c7ff;           /* periwinkle info / location (on dark) */
  --blue-dim: rgba(79,70,229,.22);  /* PURP-indigo at 22% — periwinkle chip bg on dark */
  /* Return to Store is a rose lifecycle stage, not danger. These mirror
     packages/ui --pdb-lifecycle-return-* for this standalone surface. */
  --pdb-lifecycle-return-bg: rgba(192,38,102,.20);
  --pdb-lifecycle-return-border: rgba(245,169,200,.34);
  --pdb-lifecycle-return-text: #f5a9c8;
  --pdb-lifecycle-return-dot: #c02666;
  --pdb-lifecycle-return-action: #c02666;
  --gold: #f3c969;           /* --pdb-champagne-accent (amount accent) */
  --text-0: #ffffff;         /* --pdb-text-primary */
  --text-1: rgba(255,255,255,.82); /* --pdb-text-secondary */
  --text-2: rgba(255,255,255,.56); /* --pdb-text-muted (on dark) */
  --radius: 12px;
  --radius-lg: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --browser-bottom-inset: 0px;

  /* V4.5.1 — Operational status palette converted to commandDark PURP.
     V4.4 W3 introduced `--driver-raw-*` as raw Tailwind semantic hex
     (#10B981 emerald / #DC2626 red / #3B82F6 blue) for inline scan/error
     status feedback. V4.5.1 routes these onto the locked PURP commandDark
     surface so the driver UI doesn't carry raw green/red/blue:
       positive → PURP-action #7c3aed (deliberate "go" tone on dark)
       danger   → rose-plum red-strong #c02666
       info     → periwinkle #b9c7ff
     The legacy var names stay (consumed by status messages in auth.js +
     button bg in index.html + delivering badge in render.js); only the
     values port. R21 hard-fails any reintroduction of the V4.4 raw
     Tailwind hex on this surface. */
  --driver-raw-positive: #7c3aed;
  --driver-raw-danger:   #c02666;
  --driver-raw-info:     #b9c7ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; min-height: 100%; background: var(--bg-deep); color: var(--text-0); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; overflow-x: hidden; overscroll-behavior: none; }
body.browser-shell { --browser-bottom-inset: 0px; }
body.ios-browser-shell { --browser-bottom-inset: 0px; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; -webkit-tap-highlight-color: transparent; }
input { font-family: inherit; outline: none; }
/* Inside the native shell, native.js adds .purp-shell to <html> (bridge
   contract v1.3.0). Scope app-native polish to it: no tap flash, no
   accidental long-press text selection on chrome. Both properties inherit,
   so the body rule covers everything; inputs stay selectable/editable. */
.purp-shell body { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.purp-shell input, .purp-shell textarea { -webkit-user-select: text; user-select: text; }

/* ── Screens ──────────────────────────────────────────────── */
.screen { display: none; flex-direction: column; height: 100dvh; min-height: 100dvh; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); overflow-x: hidden; overflow-y: auto; overscroll-behavior: none; -webkit-overflow-scrolling: touch; }
.screen.active { display: flex; }
.driver-booting .screen:not(#screen-loading) { display: none !important; }
.driver-booting #screen-loading { display: flex !important; }
#screen-loading {
  background: linear-gradient(180deg, #0c0520 0%, #15001f 60%, #070213 100%);
}
.center-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; }
/* Native keyboard contract: enter the compact login layout as soon as a
   field receives focus, before iOS animates the visual viewport. This keeps
   the card anchored instead of re-centering on every keyboard frame. */
.purp-shell #screen-login:focus-within .center-content {
  justify-content: flex-start;
  padding-top: 16px;
}

/* ── Logo ─────────────────────────────────────────────────── */
.logo-large { width: min(246px, 72vw); margin-bottom: 4px; }
.purp-wordmark { display: block; height: auto; object-fit: contain; }
.purp-wordmark--hero { width: 100%; }
.purp-wordmark--compact { width: 92px; max-width: 24vw; }
.logo-sub { font-size: 13px; font-weight: 600; color: var(--purple-dim); letter-spacing: 4px; margin-top: 2px; }

/* One loading brain across Admin, POS, Driver PWA, and the native shells.
   Date-based phase locking in boot-ui.js keeps a native-to-web handoff on the
   same 1.8-second pulse instead of restarting the logo animation. */
@keyframes pdb-logo-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.97); }
}
@keyframes pdb-logo-pulse-fade {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
#screen-loading .pdb-logo-pulse {
  animation: pdb-logo-pulse 1.8s ease-in-out infinite;
  animation-delay: var(--pdb-pulse-phase, 0ms);
  transform-origin: center;
  will-change: opacity, transform;
}
@media (prefers-reduced-motion: reduce) {
  #screen-loading .pdb-logo-pulse {
    animation-name: pdb-logo-pulse-fade;
  }
}

/* ── Employee login ───────────────────────────────────────── */
#screen-login {
  background:
    radial-gradient(circle at 50% -12%, rgba(124,58,237,.30), transparent 44%),
    linear-gradient(180deg, var(--bg-deep), var(--bg-card) 58%, var(--bg-deep));
}
.driver-boot-failed .screen:not(#screen-login) { display: none !important; }
.driver-boot-failed #screen-login { display: flex !important; }
.driver-boot-failed #screen-login .employee-login-form,
.driver-boot-failed #screen-login .employee-password-change,
.driver-boot-failed #screen-login .employee-access-denied:not(#driver-boot-recovery) {
  display: none !important;
}
.driver-boot-failed #login-status { display: none !important; }
.driver-boot-failed #driver-boot-recovery { display: grid !important; }
.driver-boot-failed #screen-login .center-content {
  min-height: min-content;
  justify-content: flex-start;
}
#screen-login .center-content {
  width: 100%;
  min-height: 100%;
  justify-content: safe center;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.employee-login-card {
  isolation: isolate;
  contain: layout paint;
  display: flex;
  width: min(100%, 390px);
  flex-direction: column;
  align-items: center;
  padding: clamp(20px, 5vw, 28px);
  border: 1px solid rgba(217,203,255,.28);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(63,10,106,.88), rgba(21,0,31,.96));
  box-shadow: 0 24px 64px rgba(8,0,18,.38), inset 0 1px 0 rgba(255,255,255,.05);
}
.employee-login-brand { width: min(218px, 64vw); }
.employee-help { color: var(--text-1); font-size: 14px; margin: 24px 0 16px; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 8px; text-align: center; }

.login-status { max-width: 30ch; font-size: 15px; line-height: 1.45; color: var(--text-1); margin: 20px 0 16px; min-height: 20px; text-align: center; }
.login-status.connecting { color: var(--amber); }
.login-status.error { color: var(--red); }
.login-status.success { color: var(--green); }
.employee-login-form { width: 100%; max-width: 340px; display: grid; gap: 12px; margin-top: 0; }
.employee-login-form input, .employee-login-form select {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(21,0,31,.76);
  border: 1px solid rgba(217,203,255,.30);
  border-radius: var(--radius);
  color: var(--text-0);
  caret-color: transparent;
  font-size: 16px;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.employee-login-form input:focus, .employee-login-form select:focus {
  border-color: var(--purple-brand);
  box-shadow: 0 0 0 3px rgba(167,139,250,.14);
  caret-color: var(--purple-brand);
}
.employee-login-form .btn-primary { min-height: 54px; }
.purp-shell #screen-login:focus-within .employee-login-card {
  contain: layout paint;
  padding-block: 18px;
  box-shadow: 0 14px 38px rgba(8,0,18,.30);
}
.purp-shell #screen-login:focus-within .employee-login-brand { width: min(170px, 50vw); }
.purp-shell #screen-login:focus-within .login-status { min-height: 0; margin-block: 10px 12px; }
.employee-password-change { width: 100%; max-width: 360px; gap: 12px; margin-top: 4px; padding: 24px; border: 1px solid rgba(217,203,255,.30); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgba(124,58,237,.14), var(--bg-card)); box-shadow: 0 22px 60px rgba(8,0,18,.30); }
.employee-password-change-eyebrow { color: var(--purple-brand); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.employee-password-change-title { color: var(--text-0); font-size: 21px; font-weight: 800; line-height: 1.2; }
.employee-password-change-help { color: var(--text-1); font-size: 14px; line-height: 1.5; }
.employee-password-change-field { display: grid; gap: 7px; color: var(--text-1); font-size: 13px; font-weight: 700; }
.employee-password-field-shell { position: relative; display: block; }
.employee-password-field-shell input { width: 100%; min-height: 52px; padding: 14px 72px 14px 16px; background: rgba(21,0,31,.70); border: 1px solid rgba(217,203,255,.30); border-radius: var(--radius); color: var(--text-0); caret-color: var(--purple-brand); font-size: 16px; }
.employee-password-field-shell input:focus { border-color: var(--purple-brand); box-shadow: 0 0 0 3px rgba(167,139,250,.14); }
.employee-password-visibility { position: absolute; inset: 4px 4px 4px auto; min-width: 62px; min-height: 44px; border-radius: 10px; background: transparent; color: var(--purple-brand); font-size: 13px; font-weight: 800; }
.employee-password-requirements { margin-top: -5px; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.employee-password-change-message { min-height: 18px; color: var(--text-1); font-size: 13px; line-height: 1.4; text-align: center; }
.employee-password-change-message:empty { min-height: 0; }
.employee-password-change-message.error { color: var(--red); }
.employee-password-change-message.success { color: var(--green); }
.employee-password-change .btn-primary, .employee-password-change .btn-secondary { width: 100%; min-height: 50px; }
.employee-access-denied { width: 100%; max-width: 360px; gap: 12px; margin-top: 4px; padding: 24px; border: 1px solid rgba(245,169,200,.34); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgba(192,38,102,.16), var(--bg-card)); text-align: center; }
.employee-access-denied-mark { width: 42px; height: 42px; margin: 0 auto 2px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(192,38,102,.24); color: var(--red); font-size: 22px; font-weight: 900; }
.employee-access-denied-title { color: var(--text-0); font-size: 20px; font-weight: 800; line-height: 1.2; }
.employee-access-denied-message { color: var(--text-1); font-size: 15px; line-height: 1.5; }
.employee-access-denied-help { color: var(--text-2); font-size: 13px; line-height: 1.45; }
.employee-access-denied .btn-primary { width: 100%; margin-top: 4px; }
.driver-boot-recovery[hidden] { display: none; }
.recaptcha-disclosure { width: 100%; max-width: 340px; margin-top: 18px; color: var(--text-2); font-size: 11px; line-height: 1.45; text-align: center; }
.recaptcha-disclosure a { color: var(--purple-brand); }
.driver-resource-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 12px;
}
.driver-resource-links a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding-inline: 10px;
  border-radius: 10px;
  color: var(--purple-brand);
  font-weight: 700;
  text-underline-offset: 3px;
}
.driver-resource-links a:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}
.driver-resource-links--login { margin-top: 4px; }
/* Invisible reCAPTCHA may hide its badge only when the required Google
   disclosure remains visible in the sign-in flow above. This is presentation
   only: Firebase MFA verification and App Check remain enabled. */
.grecaptcha-badge { visibility: hidden !important; }
.text-action { margin-top: 18px; color: var(--purple-brand); background: transparent; border: 0; font-size: 13px; text-decoration: underline; }
@media (max-height: 700px) {
  #screen-login .center-content { justify-content: flex-start; }
}
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }
.shake { animation: shake .4s ease; }

/* ── Home Dashboard ───────────────────────────────────────── */
#screen-home { padding-bottom: 0; }
body.ios-browser-shell #screen-home { padding-top: var(--safe-top); }
.home-topbar { display: flex; justify-content: space-between; align-items: center; min-height: 72px; padding: 16px 20px; }
.home-driver { display: flex; align-items: center; gap: 12px; }
.driver-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--purple); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.driver-name { font-weight: 600; font-size: 16px; }
.home-brand { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; }

.status-strip { text-align: center; padding: 8px; font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.status-strip.idle, .status-strip.standby { background: rgba(255,255,255,.07); color: var(--text-2); }
.status-strip.go { background: rgba(124,58,237,.22); color: var(--green); }
.status-strip.wait { background: rgba(243,201,105,.16); color: var(--amber); }
.status-strip.on_route, .status-strip.delivering { background: rgba(124,58,237,.20); color: var(--purple-brand); }
.status-strip.return_to_store, .status-strip.return { background: var(--pdb-lifecycle-return-bg); color: var(--pdb-lifecycle-return-text); border-block: 1px solid var(--pdb-lifecycle-return-border); }
.status-strip.syncing { background: rgba(255,255,255,.08); color: var(--text-1); }

.hero-card { margin: 20px; padding: 40px 24px; border-radius: var(--radius-lg); text-align: center; min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hero-card.idle, .hero-card.standby { background: linear-gradient(135deg, #210033, #15001f); border: 1px solid var(--border); }
.hero-card.wait { background: linear-gradient(135deg, #3a2e0a, #210033); border: 1px solid rgba(243,201,105,.34); }
.hero-card.go { background: linear-gradient(135deg, #2e0850, #210033); border: 1px solid rgba(217,203,255,.30); }
.hero-card.delivering { background: linear-gradient(135deg, #3f0a6a, #210033); border: 1px solid rgba(124,58,237,.34); }
.hero-card.return { background: linear-gradient(135deg, var(--pdb-lifecycle-return-bg), var(--bg-card)); border: 1px solid var(--pdb-lifecycle-return-border); }
.hero-card.syncing { background: linear-gradient(135deg, #1d0030, #15001f); border: 1px solid rgba(255,255,255,.08); }
.hero-label { font-size: 28px; font-weight: 900; letter-spacing: 2px; margin-bottom: 8px; }
.hero-sub { font-size: 14px; color: var(--text-1); }
.hero-count { font-size: 16px; color: var(--text-1); margin-top: 8px; }
.hero-next { font-size: 15px; color: var(--amber); margin-top: 4px; }

.cta-btn { display: block; width: calc(100% - 40px); margin: 0 20px 20px; padding: 18px; border-radius: var(--radius); font-size: 18px; font-weight: 800; letter-spacing: 1px; color: #fff; transition: all .15s; }
.cta-btn:active { transform: scale(0.98); }
.cta-btn.idle, .cta-btn.standby { background: var(--bg-card); color: var(--text-2); }
.cta-btn.go { background: var(--purple); }
.cta-btn.delivering { background: var(--purple); }
.cta-btn.return { background: var(--pdb-lifecycle-return-action); }

.home-runtime-summary { padding: 0 20px 18px; }
.home-summary-card { background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.home-summary-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--purple-dim); }
.home-summary-copy { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--text-1); }
.home-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.home-summary-block { min-width: 0; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); }
.home-summary-block.accent { border-color: rgba(124,58,237,.32); background: rgba(124,58,237,.14); }
.home-summary-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--purple-dim); }
.home-summary-value { margin-top: 6px; font-size: 15px; font-weight: 700; line-height: 1.35; color: var(--text-0); word-break: break-word; }
.home-summary-note { margin-top: 14px; padding: 12px; border-radius: 12px; background: rgba(243,201,105,.12); border: 1px solid rgba(243,201,105,.26); }
.home-summary-note-text { margin-top: 6px; font-size: 14px; line-height: 1.45; color: var(--text-0); }
.app-upgrade-warning { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; background: rgba(192,38,102,.20); border: 1px solid rgba(245,169,200,.34); color: #f5a9c8; }
.app-upgrade-title { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.app-upgrade-copy { margin-top: 4px; font-size: 13px; line-height: 1.4; color: rgba(255,255,255,.86); }

.secondary-cta { display: block; width: calc(100% - 40px); margin: -8px 20px 18px; padding: 0; background: none; color: rgba(255,255,255,.82); font-size: 14px; font-weight: 500; text-align: center; }
.secondary-cta:disabled { opacity: 0.45; }
.return-arrived-cta { display: block; width: calc(50% - 28px); margin: -8px 8px 18px 20px; padding: 14px 8px; border-radius: var(--radius); background: var(--pdb-lifecycle-return-action); color: #fff; font-size: 15px; font-weight: 800; float: left; }
.return-arrived-cta + .secondary-cta { width: calc(50% - 28px); margin: -8px 20px 18px 8px; padding: 14px 8px; border-radius: var(--radius); background: rgba(192,38,102,.14); border: 1px solid rgba(245,169,200,.34); color: var(--red); font-weight: 700; float: left; }
.stats-row { clear: both; }

.stats-row { display: flex; justify-content: center; gap: 12px; padding: 16px 16px; }
.stat { text-align: center; flex: 1 1 0; min-width: 0; }
.stat-num { font-size: 22px; font-weight: 700; display: block; white-space: nowrap; }
.stat-num.green { color: var(--green); }
.stat-num.red { color: var(--red); }
.stat-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 1px; }

.home-bottom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; padding: 12px 16px calc(12px + var(--safe-bottom)); margin-top: auto; background: var(--bg-deep); border-top: 1px solid var(--border); }
.bottom-btn { min-width: 0; min-height: 50px; padding: 12px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-1); font-size: 14px; font-weight: 700; }
.home-bottom .bottom-btn.danger { grid-column: 1 / -1; }
.bottom-btn.danger { color: var(--red); border-color: rgba(245,169,200,.34); }
.driver-resource-links--home {
  grid-column: 1 / -1;
  min-height: 44px;
  border-top: 1px solid rgba(217,203,255,.12);
}

/* ── Screen Header ────────────────────────────────────────── */
.screen-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--bg-deep); position: sticky; top: 0; z-index: 10; }
.back-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-card); color: var(--text-0); font-size: 18px; display: flex; align-items: center; justify-content: center; }
.screen-title { font-size: 18px; font-weight: 700; }

/* ── Stop List ────────────────────────────────────────────── */
.stop-list { padding: 0 16px 24px; }
.stop-section-label { font-size: 11px; font-weight: 700; color: var(--purple-brand); letter-spacing: 2px; padding: 16px 4px 8px; text-transform: uppercase; }
.stop-section-label.muted { color: var(--text-2); }
.stop-card { display: flex; align-items: center; gap: 12px; padding: 14px 12px; margin-bottom: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: all .1s; }
.stop-card:active { background: var(--bg-surface); }
.stop-card.done { opacity: 0.6; }
.stop-route-cta { margin: 12px 0 16px; padding: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 16px; }
.stop-route-secondary { width: 100%; margin-top: 8px; padding: 10px 0 0; background: none; color: var(--red); font-size: 14px; font-weight: 600; text-align: center; }
.stop-seq { width: 36px; height: 36px; border-radius: 50%; background: var(--purple); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.stop-seq.done { background: #5b16a3; }
.stop-seq.failed { background: #c02666; }
.stop-seq.return { background: var(--pdb-lifecycle-return-bg); color: var(--pdb-lifecycle-return-text); border: 1.5px solid var(--pdb-lifecycle-return-border); font-size: 18px; }
.stop-card.return-stop { border-color: var(--pdb-lifecycle-return-border); background: linear-gradient(135deg, var(--pdb-lifecycle-return-bg), var(--bg-card)); }
.stop-info { flex: 1; min-width: 0; }
.stop-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-addr { font-size: 12px; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-badges { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.stop-amount { font-size: 14px; font-weight: 600; color: var(--gold); flex-shrink: 0; }
.stop-reorder-controls { width: 44px; display: grid; grid-template-rows: repeat(2, 44px); gap: 4px; flex: 0 0 44px; }
.stop-reorder-btn { width: 44px; min-width: 44px; min-height: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--purple-brand); font-size: 20px; font-weight: 800; line-height: 1; touch-action: manipulation; }
.stop-reorder-btn:active:not(:disabled) { background: var(--purple-dim); transform: scale(.96); }
.stop-reorder-btn:disabled { opacity: .3; color: var(--text-2); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-2); font-size: 15px; }

/* ── Badges ───────────────────────────────────────────────── */
.badge { padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge.express { background: rgba(243,201,105,.16); color: var(--orange); }
.badge.window { background: rgba(124,58,237,.20); color: var(--purple-brand); }
.badge.first-order { background: rgba(124,58,237,.20); color: var(--purple-brand); }
.badge.ready { background: rgba(124,58,237,.22); color: var(--green); }
.badge.delivered { background: rgba(124,58,237,.22); color: var(--green); }
.badge.failed { background: rgba(192,38,102,.20); color: var(--red); }

/* ── Stop Detail ──────────────────────────────────────────── */
.detail-content { padding: 16px 16px 24px; flex: 1; overflow-y: auto; }
.detail-hero { text-align: center; padding: 24px; background: var(--bg-card); border-radius: var(--radius-lg); margin-bottom: 16px; }
.detail-seq { width: 48px; height: 48px; border-radius: 50%; background: var(--purple); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; margin-bottom: 12px; }
.detail-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.detail-addr { font-size: 14px; color: var(--text-1); }
.detail-phone { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-top: 12px; color: var(--text-0); font-size: 15px; line-height: 1.35; }
.detail-phone-label { color: var(--text-2); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.detail-phone-number { font-variant-numeric: tabular-nums; font-weight: 700; }
.detail-phone--unavailable { color: var(--text-1); font-size: 13px; }
.detail-map-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden; }
.detail-map-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; }
.detail-map-title { font-size: 15px; font-weight: 800; }
.detail-map-subtitle { font-size: 12px; color: var(--text-1); margin-top: 4px; line-height: 1.4; }
.detail-map-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.detail-map-chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.detail-map-chip-route { background: rgba(124,58,237,.22); color: #d9cbff; }
.detail-map-chip-preview { background: rgba(243,201,105,.16); color: #f3c969; }
.detail-map-chip-muted { background: rgba(255,255,255,.07); color: var(--text-1); }
.map-open-link { flex-shrink: 0; align-self: center; padding: 10px 12px; border-radius: 10px; background: rgba(79,70,229,.20); color: #b9c7ff; text-decoration: none; font-size: 12px; font-weight: 700; text-align: center; }
.detail-map-shell { position: relative; background: #15001f; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); min-height: 272px; }
.detail-map-canvas { width: 100%; height: 272px; background: linear-gradient(180deg, #210033 0%, #15001f 100%); }
.detail-map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: linear-gradient(180deg, rgba(21,0,31,.22), rgba(21,0,31,.6)); color: var(--text-0); font-size: 13px; font-weight: 600; line-height: 1.5; pointer-events: none; }
.detail-map-note { padding: 12px 16px 14px; font-size: 12px; color: var(--text-1); line-height: 1.5; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.action-btn { flex: 1 1 120px; padding: 14px 8px; border-radius: var(--radius); text-align: center; text-decoration: none; font-weight: 600; font-size: 14px; }
.action-btn.navigate { background: #4f46e5; color: #fff; }
.action-btn.call { background: var(--bg-card); border: 1px solid var(--border); color: var(--green); }
.action-btn.text { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-1); }
.detail-card { background: var(--bg-card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.detail-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.detail-label { color: var(--text-2); font-size: 12px; }
.detail-notes { color: var(--text-1); font-size: 14px; margin-top: 4px; }
.detail-warning { color: var(--amber); font-size: 13px; font-weight: 600; margin-top: 8px; padding: 8px 12px; background: rgba(243,201,105,.12); border-radius: 8px; }
.detail-delivery-actions { display: flex; gap: 12px; padding: 16px 0; }
/* Store-return actions: Navigate spans the full top row (inline grid-column:1/-1),
 * Arrived + End sit side-by-side below — activates the previously-dead class. */
.store-action-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 0; }
.detail-secondary-action { width: 100%; padding: 10px 0 4px; background: none; color: var(--purple-brand); font-size: 14px; font-weight: 600; text-align: center; }
.deliver-btn { flex: 1; padding: 16px; border-radius: var(--radius); background: var(--purple); color: #fff; font-size: 16px; font-weight: 700; }
/* Affirmative "Arrived/go" action — locked PURP positive (replaces the
 * old raw-green inline background on #btn-deliver). Uses
 * --pdb-purp-action #6d28d9 (mirrored, see header line: "action
 * #6d28d9"): the deliberate commit/go tone of the locked violet
 * positive family on the driver dark surface. No raw green. */
.deliver-btn--go { background: #6d28d9; color: #fff; }
.fail-btn { flex: 1; padding: 16px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid rgba(245,169,200,.34); color: var(--red); font-size: 16px; font-weight: 700; }
.detail-status-badge { text-align: center; padding: 12px; border-radius: var(--radius); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.detail-status-badge.delivered { background: rgba(124,58,237,.22); color: var(--green); }
.detail-status-badge.failed, .detail-status-badge.skipped { background: rgba(192,38,102,.20); color: var(--red); }
.gold { color: var(--gold); }

/* ── In-App Navigation ───────────────────────────────────── */
.nav-screen { padding-top: 0; padding-bottom: 0; overflow: hidden; background: #15001f; }
.nav-content { position: relative; flex: 1; min-height: 100dvh; background: #15001f; }
.nav-shell { position: relative; width: 100%; min-height: 100dvh; background: #15001f; }
.nav-map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; background: linear-gradient(180deg, #210033 0%, #15001f 100%); }
.nav-map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: linear-gradient(180deg, rgba(21,0,31,.2), rgba(21,0,31,.55)); color: var(--text-0); font-size: 14px; font-weight: 700; line-height: 1.5; pointer-events: none; }
.nav-top-card { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: flex-start; gap: 14px; padding: calc(var(--safe-top) + 14px) 18px 20px; border-radius: 0 0 28px 28px; background: rgba(255,255,255,0.98); border-bottom: 1px solid rgba(21,0,31,.08); box-shadow: 0 16px 36px rgba(0,0,0,.18); backdrop-filter: blur(16px); }
.nav-top-main { flex: 1; min-width: 0; }
.nav-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #5f536f; }
.nav-stop-name { font-size: 24px; font-weight: 800; line-height: 1.05; margin-top: 8px; color: #17121f; }
.nav-stop-address { font-size: 14px; color: #423a52; line-height: 1.35; margin-top: 6px; }
.nav-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.nav-chip { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0.02em; }
.nav-chip-route { background: rgba(123,63,206,.14); color: #5b16a3; }
.nav-chip-preview { background: rgba(243,201,105,.20); color: #6d4300; }
.nav-chip-muted { background: rgba(23,18,31,.06); color: #423a52; }
.nav-trip-metric { flex-shrink: 0; min-width: 88px; text-align: right; }
.nav-trip-time { font-size: 28px; font-weight: 900; line-height: 1; color: #5b16a3; }
.nav-trip-distance { font-size: 13px; font-weight: 700; color: #423a52; margin-top: 8px; }
.nav-bottom-sheet { position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + var(--browser-bottom-inset) + 12px); z-index: 3; padding: 18px 16px 16px; border-radius: 22px; background: rgba(21, 0, 31, 0.94); border: 1px solid rgba(217,203,255,.22); box-shadow: 0 18px 48px rgba(0,0,0,.4); backdrop-filter: blur(16px); }
.nav-step-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--purple-dim); }
.nav-next-step { font-size: 18px; font-weight: 700; line-height: 1.35; margin-top: 10px; }
.nav-route-summary { font-size: 13px; color: rgba(255,255,255,.74); margin-top: 10px; }
.nav-native-status { min-height: 0; margin-top: 8px; color: var(--text-1); font-size: 13px; line-height: 1.45; }
.nav-native-status:empty { display: none; }
.nav-button-row { display: flex; gap: 10px; margin-top: 16px; }
.nav-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 14px 16px; border-radius: 16px; text-decoration: none; font-size: 15px; font-weight: 800; text-align: center; }
.nav-btn-primary { flex: 1.2; background: var(--purple); color: #fff; }
.nav-btn-secondary { flex: 1; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); color: #fff; }
.nav-native-fallback { display: block; min-height: 44px; margin-top: 10px; padding: 12px 8px; color: var(--blue); font-size: 13px; font-weight: 700; line-height: 20px; text-align: center; text-decoration: underline; text-underline-offset: 3px; }
.nav-native-fallback[hidden] { display: none; }

/* ── Proof ─────────────────────────────────────────────────── */
.proof-content { padding: 16px 16px 24px; flex: 1; display: flex; flex-direction: column; }
.proof-customer { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 16px; }
.proof-media-frame { position: relative; width: 100%; height: clamp(220px, 42dvh, 420px); border-radius: var(--radius); background: #120020; border: 1px solid rgba(255,255,255,.10); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.proof-video,
.proof-preview { width: 100%; height: 100%; max-height: clamp(220px, 42dvh, 420px); object-fit: contain; background: #120020; display: block; }
.proof-media-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; color: var(--text-2); font-size: 13px; font-weight: 700; text-align: center; background: radial-gradient(circle at top, rgba(124,58,237,.16), rgba(18,0,32,.92)); pointer-events: none; }
.proof-photo-status { min-height: 20px; margin-top: 10px; color: var(--text-1); font-size: 13px; font-weight: 650; text-align: center; }
.proof-photo-status.ready { color: #d9cbff; }
.proof-photo-status.error { color: #f5a9c8; }
.proof-actions { display: flex; gap: 12px; margin: 16px 0; }
.proof-submit-row { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

/* ── Shift Checklist ─────────────────────────────────────── */
.checklist-content { padding: 16px; flex: 1; }
.checklist-card { background: linear-gradient(180deg, rgba(63,10,106,.98), rgba(33,0,51,.98)); border: 1px solid var(--border); border-radius: 20px; padding: 18px; box-shadow: 0 18px 42px rgba(0,0,0,.26); }
.checklist-kicker { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--purple-dim); text-transform: uppercase; }
.checklist-title { font-size: 24px; font-weight: 800; margin-top: 8px; }
.checklist-context { display: grid; gap: 8px; margin-top: 16px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); }
.checklist-context-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-1); }
.checklist-context-row strong { color: var(--text-0); font-weight: 700; text-align: right; }
.checklist-item { margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.07); }
.checklist-item:first-of-type { margin-top: 18px; }
.checklist-label { font-size: 16px; font-weight: 700; line-height: 1.35; }
.checklist-required { color: #f5a9c8; }
.checklist-help { font-size: 13px; color: var(--text-1); line-height: 1.45; margin-top: 6px; }
.checklist-choice-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.checklist-choice { min-width: 96px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--text-0); font-size: 14px; font-weight: 600; }
.checklist-choice.active { background: rgba(124,58,237,.26); border-color: rgba(124,58,237,.50); color: #fff; }
.checklist-textarea { width: 100%; min-height: 108px; margin-top: 12px; padding: 14px; border-radius: 14px; background: rgba(21,0,31,.88); border: 1px solid var(--border); color: var(--text-0); font-size: 14px; resize: vertical; }
.checklist-photo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.checklist-photo-thumb { position: relative; overflow: hidden; border-radius: 14px; border: 1px solid rgba(255,255,255,.10); aspect-ratio: 4 / 3; background: rgba(255,255,255,.05); }
.checklist-photo-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; background: rgba(18,0,32,.72); }
.checklist-photo-remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(21,0,31,.82); color: #fff; font-size: 18px; line-height: 1; }
.checklist-photo-btn { margin-top: 12px; width: 100%; }
.checklist-photo-status { margin-top: 8px; color: var(--text-1); font-size: 12px; font-weight: 650; }
.checklist-error { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: rgba(192,38,102,.20); color: #f5a9c8; font-size: 13px; line-height: 1.45; }
.checklist-submit-btn { margin-top: 20px; }
.checklist-loading { min-height: calc(100dvh - 76px - var(--safe-top) - var(--safe-bottom)); display: grid; place-items: center; padding: 24px 18px; }
.checklist-loading-card { width: min(100%, 420px); padding: 32px 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(63,10,106,.94), rgba(33,0,51,.98)); box-shadow: 0 20px 50px rgba(0,0,0,.28); text-align: center; }
.checklist-loading-mark { width: 144px; min-height: 56px; margin: 0 auto 18px; padding: 10px 16px; display: grid; place-items: center; border: 1px solid rgba(217,203,255,.24); border-radius: 16px; background: rgba(21,0,31,.46); box-shadow: 0 0 0 0 rgba(167,139,250,.38); animation: checklist-mark-pulse 1.5s ease-in-out infinite; }
.purp-wordmark--checklist { width: 112px; max-width: 100%; }
.checklist-loading-title { color: var(--text-0); font-size: 21px; font-weight: 800; letter-spacing: -.2px; }
.checklist-loading-message { margin-top: 8px; color: var(--text-1); font-size: 14px; line-height: 1.45; }
.checklist-loading-lines { display: grid; gap: 9px; margin-top: 24px; }
.checklist-loading-lines i { display: block; height: 10px; border-radius: 999px; background: linear-gradient(90deg, rgba(217,203,255,.10), rgba(217,203,255,.32), rgba(217,203,255,.10)); background-size: 200% 100%; animation: checklist-line-pulse 1.35s ease-in-out infinite; }
.checklist-loading-lines i:nth-child(2) { width: 78%; animation-delay: .12s; }
.checklist-loading-lines i:nth-child(3) { width: 58%; animation-delay: .24s; }
.checklist-load-error { margin: 24px 16px; padding: 24px 20px; border: 1px solid rgba(245,169,200,.34); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgba(192,38,102,.15), var(--bg-card)); text-align: center; }
.checklist-load-error-title { color: var(--text-0); font-size: 19px; font-weight: 800; }
.checklist-load-error-message { margin-top: 8px; color: var(--text-1); font-size: 14px; line-height: 1.5; }
.checklist-retry-btn { width: 100%; margin-top: 18px; }
.checklist-empty { padding: 32px 18px; text-align: center; color: var(--text-1); font-size: 15px; }
@keyframes checklist-mark-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(167,139,250,.36); } 50% { transform: scale(1.035); box-shadow: 0 0 0 12px rgba(167,139,250,0); } }
@keyframes checklist-line-pulse { 0% { background-position: 200% 0; opacity: .58; } 50% { opacity: 1; } 100% { background-position: -200% 0; opacity: .58; } }
@media (prefers-reduced-motion: reduce) { .checklist-loading-mark, .checklist-loading-lines i { animation: none; } }

/* ── Failure Reasons ──────────────────────────────────────── */
.failure-content { padding: 16px 16px 24px; }
.failure-hint { color: var(--text-1); font-size: 14px; margin-bottom: 16px; }
.fail-reason-btn { display: block; width: 100%; padding: 16px; margin-bottom: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-0); font-size: 15px; text-align: left; transition: all .1s; }
.fail-reason-btn:active { background: var(--bg-surface); border-color: #c02666; }

/* ── Route Complete ───────────────────────────────────────── */
.complete-icon { font-size: 64px; color: var(--green); margin-bottom: 16px; }
.complete-title { font-size: 24px; font-weight: 800; margin-bottom: 24px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary { padding: 16px 24px; border-radius: var(--radius); background: var(--purple); color: #fff; font-size: 16px; font-weight: 700; width: 100%; }
.btn-primary:disabled { opacity: 0.4; }
.btn-secondary { padding: 14px 20px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-0); font-size: 14px; font-weight: 500; flex: 1; }
.btn-muted { padding: 14px 20px; border-radius: var(--radius); background: none; color: var(--text-2); font-size: 14px; width: 100%; }

/* ── Sync Health Chip ────────────────────────────────────── */
.sync-chip { font-size: 11px; padding: 3px 10px; border-radius: 12px; margin: 0 20px 6px; display: inline-block; font-weight: 600; }
.sync-chip.synced { background: rgba(124,58,237,.22); color: #d9cbff; }
.sync-chip.syncing { background: rgba(243,201,105,.16); color: #f3c969; animation: pulse-chip 1.5s infinite; }
.sync-chip.delayed { background: rgba(192,38,102,.20); color: #f5a9c8; }
.sync-chip.attention { background: rgba(192,38,102,.26); color: #f5a9c8; font-weight: 700; }
@keyframes pulse-chip { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Command Banner ──────────────────────────────────────── */
.command-banner { display: none; background: #f3c969; color: #2d2438; padding: 12px 16px; align-items: center; gap: 12px; font-size: 14px; }
.command-banner.visible { display: flex; }
.command-banner.return { background: var(--pdb-lifecycle-return-action); color: #fff; }
.command-banner.priority { background: #c02666; color: #fff; }
.command-banner.complete { background: #7c3aed; color: #fff; }
.cmd-banner-content { flex: 1; }
.cmd-banner-title { font-weight: 800; font-size: 15px; }
.cmd-banner-msg { font-size: 13px; opacity: 0.85; }
.cmd-banner-close { background: none; border: none; font-size: 24px; padding: 0 4px; cursor: pointer; color: inherit; opacity: 0.7; }

/* ── Update Banner ───────────────────────────────────────── */
.home-notice-stack { display: grid; gap: 8px; padding: 0 16px; }
.update-banner { display: none; min-width: 0; background: var(--purple); color: #fff; padding: 10px 12px; border-radius: 14px; align-items: center; gap: 10px; justify-content: space-between; font-size: 13px; font-weight: 700; }
.device-health-banner { display: none; min-width: 0; gap: 12px; align-items: center; justify-content: space-between; padding: 12px; border-radius: 14px; background: rgba(79,70,229,.18); border: 1px solid rgba(185,199,255,.30); color: var(--text-0); font-size: 13px; font-weight: 700; }
.device-health-banner.attention { background: rgba(243,201,105,.12); border-color: rgba(243,201,105,.32); }
.device-health-banner.critical { background: rgba(192,38,102,.18); border-color: rgba(245,169,200,.38); }
.device-health-copy { min-width: 0; display: grid; gap: 4px; overflow-wrap: anywhere; }
.device-health-kicker { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.device-health-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.device-health-banner .update-apply-btn,
.device-health-dismiss { min-height: 44px; border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 800; }
.device-health-dismiss { background: transparent; border: 1px solid var(--border); color: var(--text-1); }
.sync-issues-list { display: grid; gap: 10px; margin-top: 12px; max-height: 42vh; overflow: auto; }
.sync-issue-row { padding: 10px; border-radius: 10px; background: rgba(255,255,255,.07); }
.sync-issue-row strong, .sync-issue-row span { display: block; }
.sync-issue-row span { color: var(--text-1); font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }
.update-apply-btn { min-height: 44px; background: #fff; color: var(--purple); border: none; border-radius: 10px; padding: 10px 14px; font-size: 12px; font-weight: 800; cursor: pointer; }

/* ── Server-enforced app upgrade block ──────────────────────── */
.app-upgrade-blocker { position: fixed; inset: 0; z-index: 2000; align-items: center; justify-content: center; overflow: hidden; padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom)); background: rgba(15,0,22,.94); backdrop-filter: blur(14px); }
.app-upgrade-card { width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 28px 22px 24px; border: 1px solid rgba(245,169,200,.4); border-radius: 24px; background: linear-gradient(180deg, rgba(72,12,100,.99), rgba(33,0,51,.99)); box-shadow: 0 24px 64px rgba(0,0,0,.48); text-align: center; }
.app-upgrade-mark { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 50%; background: rgba(192,38,102,.3); border: 1px solid rgba(245,169,200,.55); color: #f5a9c8; font-size: 30px; font-weight: 900; }
.app-upgrade-card-title { font-size: 24px; font-weight: 850; line-height: 1.15; }
.app-upgrade-card-copy { margin-top: 12px; color: var(--text-1); font-size: 15px; line-height: 1.5; }
.app-upgrade-card-minimum { min-height: 20px; margin: 14px 0; color: #f3c969; font-size: 14px; font-weight: 750; }
.app-upgrade-card .btn-primary { width: 100%; min-height: 50px; }
.app-upgrade-card-help { margin-top: 14px; color: var(--text-2); font-size: 12px; line-height: 1.45; }

/* ── Pending Queue Badge ─────────────────────────────────── */
.pending-badge { font-size: 11px; padding: 3px 10px; border-radius: 12px; margin: 0 20px 4px; background: rgba(192,38,102,.20); color: #f5a9c8; font-weight: 600; display: inline-block; }

/* ── Install Guide ───────────────────────────────────────── */
.install-guide { padding: 0 24px; text-align: left; }
.install-steps { margin-top: 12px; }
.install-step { padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 15px; color: var(--text-0); }

/* ── Dialog ─────────────────────────────────────────────── */
.dialog-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; padding: 20px; padding-bottom: calc(20px + var(--safe-bottom)); background: rgba(15,0,22,.72); backdrop-filter: blur(10px); }
.dialog-card { width: 100%; max-width: 420px; max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 40px); overflow-y: auto; overscroll-behavior: contain; background: linear-gradient(180deg, rgba(63,10,106,.98), rgba(33,0,51,.98)); border: 1px solid var(--border); border-radius: 22px; padding: 20px; box-shadow: 0 22px 52px rgba(0,0,0,.38); }
.dialog-title { font-size: 22px; font-weight: 800; line-height: 1.15; }
.dialog-body { margin-top: 12px; }
.dialog-copy { font-size: 14px; line-height: 1.5; color: var(--text-1); }
.dialog-warning { margin-top: 10px; font-size: 13px; line-height: 1.45; color: #f3c969; }
.dialog-radio-list { display: grid; gap: 8px; margin-top: 14px; }
.dialog-radio-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); }
.dialog-radio-option input { width: 18px; height: 18px; accent-color: var(--purple-brand); }
.dialog-radio-option span { font-size: 14px; line-height: 1.35; color: var(--text-0); }
.dialog-actions { display: grid; gap: 10px; margin-top: 18px; }
.dialog-btn { width: 100%; }
.driver-warning-open { overflow: hidden; }
.driver-warning-overlay { align-items: center; padding-top: calc(20px + var(--safe-top)); }
.driver-warning-card {
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 40px);
  overflow: auto;
  overscroll-behavior: contain;
  border-color: rgba(217,203,255,.38);
  box-shadow: 0 22px 58px rgba(15,0,24,.58), 0 0 34px rgba(124,58,237,.18);
}
.driver-warning-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border-radius: 14px;
  color: var(--text-0);
  background: var(--purple);
  border: 1px solid rgba(217,203,255,.38);
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
}
.driver-warning-card[data-severity="info"] .driver-warning-mark {
  color: #b9c7ff;
  background: #1e1b4b;
  border-color: rgba(185,199,255,.38);
}
.driver-warning-card[data-severity="warning"] .driver-warning-mark {
  color: #f3c969;
  background: #3a2e0a;
  border-color: rgba(243,201,105,.38);
}
.driver-warning-card[data-severity="critical"] .driver-warning-mark {
  color: #f5a9c8;
  background: #4a1834;
  border-color: rgba(245,169,200,.42);
}
.driver-warning-card .dialog-copy { font-size: 15px; }
.driver-warning-card button:focus-visible { outline: 3px solid #d9cbff; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .driver-warning-overlay,
  .driver-warning-card { animation: none !important; transition: none !important; }
}

@media (max-width: 380px) {
  .home-summary-grid { grid-template-columns: 1fr; }
  .detail-map-head { flex-direction: column; }
  .map-open-link { width: 100%; }
  .detail-map-canvas { height: 248px; }
  .detail-map-shell { min-height: 248px; }
  .nav-top-card,
  .nav-bottom-sheet { left: 10px; right: 10px; }
  .nav-top-card { left: 0; right: 0; padding: calc(var(--safe-top) + 12px) 14px 16px; gap: 10px; }
  .nav-stop-name { font-size: 21px; }
  .nav-trip-time { font-size: 24px; }
  .nav-next-step { font-size: 16px; }
  .nav-button-row { flex-direction: column; }
}

@media (max-width: 480px) {
  /* Return actions stack on compact phones and keyboard-shortened viewports.
     The screen itself remains 100dvh and safe-area padded, so no action is
     trapped behind browser/native chrome or clipped off-screen. */
  .return-arrived-cta,
  .return-arrived-cta + .secondary-cta {
    float: none;
    width: calc(100% - 32px);
    margin: 8px 16px 12px;
  }
  .store-action-layout { grid-template-columns: minmax(0, 1fr); }
  .store-action-layout > * { grid-column: 1 / -1 !important; }
  #screen-login .center-content { padding-inline: 14px; }
  .employee-login-card { width: 100%; padding-inline: 18px; border-radius: 20px; }
  .device-health-banner { align-items: stretch; flex-direction: column; }
  .device-health-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .device-health-actions button { width: 100%; }
  .stats-row { gap: 6px; padding-inline: 10px; }
  .stat-num { font-size: 20px; }
  .stat-label { font-size: 9px; }
}

@media (max-height: 700px) {
  #screen-login .center-content { justify-content: flex-start; padding-top: 12px; }
  .employee-login-card { padding-block: 16px; }
  .employee-login-brand { width: min(166px, 48vw); }
  #screen-login .logo-sub { font-size: 11px; letter-spacing: 3px; }
  #screen-login .login-status { min-height: 0; margin-block: 8px 10px; font-size: 14px; }
  .home-topbar { min-height: 60px; padding-block: 10px; }
  .hero-card { min-height: 0; margin-block: 12px; padding-block: 24px; }
}

@media (hover: none) and (pointer: coarse) {
  /* `100dvh` already follows the live browser viewport. Never add a guessed
     toolbar height; safe-area padding is applied once by `.screen`. */
  body.browser-shell,
  body.ios-browser-shell { --browser-bottom-inset: 0px; }
}

@media (min-width: 560px) {
  .home-bottom { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-bottom .bottom-btn.danger { grid-column: auto; }
}

/* ── Public Driver privacy/support pages ────────────────────
   These pages use the same mirrored Driver Design Brain roles as the app.
   They deliberately override the app shell's fixed viewport and scroll lock,
   while preserving notch/home-indicator safe areas on public mobile URLs. */
html.public-info-root {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
body.public-info-page {
  height: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background:
    radial-gradient(circle at 50% -8%, rgba(124,58,237,.25), transparent 34rem),
    var(--bg-deep);
  color: var(--text-1);
  line-height: 1.6;
}
.public-info-wrap {
  width: min(100%, 820px);
  margin-inline: auto;
  padding-inline: clamp(18px, 5vw, 32px);
}
.public-info-header {
  padding-top: max(28px, calc(var(--safe-top) + 16px));
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(63,10,106,.94), rgba(21,0,31,.96));
}
.public-info-brand {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  gap: 14px;
  color: var(--purple-dim);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-decoration: none;
}
.public-info-wordmark { width: 154px; max-width: 48vw; }
.public-info-header h1 {
  margin-top: 22px;
  color: var(--text-0);
  font-size: clamp(28px, 7vw, 42px);
  line-height: 1.12;
}
.public-info-header p {
  max-width: 54ch;
  margin-top: 10px;
  color: var(--text-1);
  font-size: 15px;
}
.public-info-main {
  display: grid;
  gap: 18px;
  padding-top: 28px;
  padding-bottom: 28px;
}
.public-info-main > p { font-size: 15px; }
.public-info-page a {
  color: var(--purple-brand);
  text-underline-offset: 3px;
}
.public-info-page a:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
.public-info-page code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--text-0);
  overflow-wrap: anywhere;
}
.public-info-card,
.public-info-callout {
  padding: clamp(20px, 5vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, rgba(63,10,106,.64), rgba(33,0,51,.94));
  box-shadow: 0 18px 50px rgba(8,0,18,.24);
}
.public-info-callout {
  border-color: rgba(243,201,105,.34);
  background: linear-gradient(145deg, rgba(243,201,105,.12), rgba(33,0,51,.94));
}
.public-info-eyebrow {
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.public-info-card h2,
.public-info-callout h2 {
  margin: 0 0 10px;
  color: var(--text-0);
  font-size: 20px;
  line-height: 1.25;
}
.public-info-callout h2 { margin-top: 8px; }
.public-info-card p + p { margin-top: 12px; }
.public-info-card ul {
  display: grid;
  gap: 8px;
  padding-left: 22px;
}
.public-info-notice {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(217,203,255,.30);
  border-radius: var(--radius);
  background: rgba(124,58,237,.14);
  color: var(--text-1);
}
.public-info-notice strong { color: var(--text-0); }
.public-info-action {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--purple);
  color: var(--text-0) !important;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}
.public-info-action--secondary {
  margin-top: 0;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--purple-brand) !important;
}
.public-info-navigation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.public-info-navigation--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.public-info-footer {
  padding: 0 20px max(40px, calc(var(--safe-bottom) + 24px));
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}
@media (max-width: 440px) {
  .public-info-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .public-info-navigation,
  .public-info-navigation--three { grid-template-columns: 1fr; }
  .public-info-action { width: 100%; }
}

/* Universal scroll treatment for the driver PWA scroll surfaces — matches @purp/ui .pdb-scroll
   (momentum + overscroll containment + flex-scroll min-width guard + thin themed scrollbar). */
.screen, .detail-content {
  min-width: 0;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--pdb-border-strong, rgba(217, 203, 255, 0.35)) transparent;
}
