/* ==========================================================================
   Xentra Driver App — High-Contrast AMOLED Dark & Outdoor Light Theme System
   1:1 Visual & Structural Parity with prototype.html
   ========================================================================== */

:root, [data-theme="dark"] {
  --bg-body: #030712;
  --bg-app: #090D16;
  --bg-surface: #131B2A;
  --bg-card: #182234;
  --bg-subtle: #1E293B;
  --border-color: #243046;
  --border-focus: #38BDF8;
  --text-main: #F1F5F9;
  --text-sub: #94A3B8;
  --text-muted: #64748B;

  --brand-green: #10B981;
  --brand-green-hover: #059669;
  --accent-amber: #F59E0B;
  --accent-blue: #0284C7;
  --accent-red: #EF4444;

  --slider-bg: #111827;
  --slider-border: #1F2937;
  --slider-label: #CBD5E1;
  --dock-bg: linear-gradient(180deg, rgba(9, 13, 22, 0.78) 0%, #090D16 35%);
  --sheet-bg: #131B2A;
  --input-bg: #090D16;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* Legacy Variable Aliasing for Shared Sheets */
  --primary: #0284C7;
  --primary-dark: #0369A1;
  --primary-soft: rgba(2, 132, 199, 0.15);
  --blue: #0284C7;
  --blue-dark: #0369A1;
  --green: #10B981;
  --green-dark: #059669;
  --green-soft: rgba(16, 185, 129, 0.15);
  --orange: #F59E0B;
  --orange-soft: rgba(245, 158, 11, 0.15);
  --red: #EF4444;
  --red-soft: rgba(239, 68, 68, 0.15);
  --ink: #F1F5F9;
  --ink-secondary: #CBD5E1;
  --muted: #94A3B8;
  --line: #243046;
  --surface: #182234;
  --surface-2: #090D16;
  --nav-h: 64px;
  --radius: 16px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.5);
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme="light"] {
  --bg-body: #E2E8F0;
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --border-color: #E2E8F0;
  --border-focus: #0284C7;
  --text-main: #0F172A;
  --text-sub: #475569;
  --text-muted: #94A3B8;

  --slider-bg: #E2E8F0;
  --slider-border: #CBD5E1;
  --slider-label: #334155;
  --dock-bg: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, #F8FAFC 45%);
  --sheet-bg: #FFFFFF;
  --input-bg: #F8FAFC;

  --ink: #0F172A;
  --ink-secondary: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-body);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  letter-spacing: -0.01em;
}

button, input, select, textarea {
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, sans-serif !important;
}
button { border: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
a { color: inherit; text-decoration: none; }

/* App Shell */
.driver-app {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background: var(--bg-body);
}

.driver-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  background: var(--bg-app);
  color: var(--text-main);
  position: relative;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* App Header (Prototype 1:1 Anatomy) */
.app-header,
.driver-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.header-driver-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 0;
  min-width: 0;
}

.driver-avatar-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #38BDF8;
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.driver-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.driver-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.driver-sub {
  font-size: 11px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn-header {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  position: relative;
  transition: all 0.2s ease;
  padding: 0;
}
.icon-btn-header:hover { background: var(--border-color); }

.chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 50%;
  background: #EF4444;
  color: #FFF;
  font-size: 9px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-surface);
}

.theme-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s ease;
  padding: 0;
}
.theme-toggle-btn:hover { background: var(--border-color); }

.online-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.online-toggle.online {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10B981;
}
.online-toggle.online .online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}
.online-toggle.offline {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #EF4444;
}
.online-toggle.offline .online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #EF4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

/* Main Viewport Content */
.content,
.screen-viewport {
  flex: 1;
  padding: 14px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.screen-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-main);
}

.screen-subtitle {
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 500;
  margin-top: -6px;
  margin-bottom: 4px;
  line-height: 1.4;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.card.compact { padding: 12px 14px; }
.card.no-shadow { box-shadow: none; }

/* Stepper Bar (Prototype 4-Step Header) */
.stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
}
.step-node {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
}
.step-node.active { color: #38BDF8; font-weight: 800; }
.step-node.done { color: var(--brand-green); font-weight: 800; }
.step-node.danger { color: #EF4444; font-weight: 800; }
.step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-main);
}
.step-node.active .step-num { background: #0284C7; color: #FFF; font-weight: 800; }
.step-node.done .step-num { background: var(--brand-green); color: #042F1E; font-weight: 800; }
.step-node.danger .step-num { background: #EF4444; color: #FFF; font-weight: 800; }
.step-arrow { color: var(--border-color); font-size: 10px; }

/* Sticky Bottom Action Dock */
.bottom-action-dock,
.sticky-action {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  background: var(--dock-bg);
  padding: 12px 18px max(18px, env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  z-index: 60;
}

/* Modern Bottom Navigation Bar */
.bottom-nav-bar,
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  height: 64px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px max(4px, env(safe-area-inset-bottom));
  z-index: 55;
}

.nav-tab-btn,
.nav-item {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-sub);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}
.nav-tab-btn:hover,
.nav-item:hover { color: var(--text-main); }
.nav-tab-btn.active,
.nav-item.active {
  color: #38BDF8;
  background: transparent;
  box-shadow: none;
}

.nav-badge {
  position: absolute;
  top: 8px;
  right: 28%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 50%;
  background: #0284C7;
  color: #FFF;
  font-size: 9px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

/* Slider Track & Thumb */
.slider-track {
  position: relative;
  width: 100%;
  height: 56px;
  box-sizing: border-box;
  background: var(--slider-bg);
  border: 1px solid var(--slider-border);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.slider-track.is-dragging {
  cursor: grabbing;
}
.slider-track.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  touch-action: pan-y;
}
.slider-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: var(--slider-accent, #0284C7);
  opacity: 0.24;
  pointer-events: none;
  will-change: width;
}
.slider-track:has(.slider-thumb.green) { --slider-accent: #10B981; }
.slider-track:has(.slider-thumb.amber) { --slider-accent: #F59E0B; }
.slider-track:has(.slider-thumb.red) { --slider-accent: #EF4444; }
.slider-track:has(.slider-thumb.locked) { --slider-accent: #64748B; }
.slider-label {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 0 56px;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--slider-label);
  pointer-events: none;
  letter-spacing: 0.01em;
  transition: opacity 0.1s linear;
}
.slider-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 46px;
  height: 46px;
  box-sizing: border-box;
  border-radius: 50%;
  background: #0284C7;
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
.slider-thumb:active { cursor: grabbing; }
.slider-thumb.green { background: #10B981; color: #042F1E; }
.slider-thumb.amber { background: #F59E0B; color: #042F1E; }
.slider-thumb.red { background: #EF4444; color: #FFF; }
.slider-thumb.locked { background: #64748B; color: #FFF; cursor: not-allowed; }

/* Buttons (Prototype + Legacy Aliases) */
.btn-primary,
.primary-btn {
  width: 100%;
  height: 48px;
  min-height: 48px;
  background: #0284C7;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  box-sizing: border-box;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-primary:active, .primary-btn:active,
.btn-secondary:active, .secondary-btn:active,
.danger-btn:active {
  transform: scale(0.98);
}
.btn-primary.green,
.primary-btn.green { background: #10B981; color: #042F1E; }
.btn-primary.amber,
.primary-btn.amber,
.primary-btn.orange { background: #F59E0B; color: #042F1E; }
.btn-primary.red,
.primary-btn.red { background: #EF4444; color: #FFFFFF; }
.btn-primary.blue,
.primary-btn.blue { background: #0284C7; color: #FFFFFF; }

.btn-secondary,
.secondary-btn {
  height: 48px;
  min-height: 48px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  box-sizing: border-box;
  transition: all 0.15s ease;
}
.btn-secondary:hover,
.secondary-btn:hover { background: var(--border-color); }

.btn-secondary.danger,
.danger-btn {
  height: 48px;
  min-height: 48px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px;
  color: #EF4444;
  background: rgba(239, 68, 68, 0.08);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  box-sizing: border-box;
}
.btn-secondary.danger:hover,
.danger-btn:hover {
  background: rgba(239, 68, 68, 0.16);
}

/* Crop Editor Modal Footer CTA Alignment */
#modal-crop-editor .x-modal-footer {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
}
#modal-crop-editor .x-btn-primary,
#modal-crop-editor .x-btn-secondary {
  height: 48px !important;
  min-height: 48px !important;
  padding: 0 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

.btn-edit-text {
  background: transparent;
  border: none;
  color: #38BDF8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
}

/* Badges & Pills */
.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-amber, .pill.orange {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-green, .pill.green {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-blue, .pill.blue {
  background: rgba(56, 189, 248, 0.15);
  color: #38BDF8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.badge-red, .pill.red {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.pill.gray {
  background: var(--bg-subtle);
  color: var(--text-sub);
  border: 1px solid var(--border-color);
}

/* COD & Prepaid Payment Boxes (Step 4) */
.cod-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid #F59E0B;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cod-amount {
  font-size: 24px;
  font-weight: 900;
  color: var(--accent-amber);
}

.prepaid-box {
  background: rgba(16, 185, 129, 0.08);
  border: 2px solid #10B981;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

/* Calculator (Step 4 COD) */
.calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.calc-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.calc-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.calc-chip.selected {
  background: #0284C7;
  border-color: #38BDF8;
  color: #FFFFFF;
}
.calc-change-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.calc-change-val {
  font-size: 18px;
  font-weight: 800;
  color: #10B981;
}

/* Checklist (Step 2 Pickup) */
.checklist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.checklist-row.checked {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}
.check-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  flex-shrink: 0;
}
.checklist-row.checked .check-box {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #042F1E;
  font-weight: 900;
}

/* QR Card (Step 5 & Batch Settlement) */
.qr-card {
  background: #FFFFFF;
  color: #0F172A;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.qr-mock {
  width: 176px;
  height: 176px;
  border: 3px solid #0F172A;
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 4px;
  padding: 6px;
  background: #FFF;
}
.qr-mock.qr-real-svg {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  overflow: hidden;
}
.qr-mock.qr-real-svg svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.qr-pixel { background: #0F172A; border-radius: 2px; }
.qr-pixel.white { background: #FFF; }

/* Profile Rows (Prototype Style) */
.profile-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}
.profile-item-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* WhatsApp & RTS Modal Option Cards */
.wa-option-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wa-option-card:hover {
  border-color: #25D366;
  background: rgba(37, 211, 102, 0.06);
}

.rts-option-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rts-option-card.selected {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.08);
}
.rts-radio-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rts-option-card.selected .rts-radio-circle {
  border-color: #EF4444;
  background: #EF4444;
}
.rts-option-card.selected .rts-radio-circle::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FFF;
}

/* Map Contained Card & Mapbox Elements */
.map-card-container {
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  height: 172px;
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

/* Streamlined Driver Strips & One-Thumb Helpers */
.driver-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
}
.driver-strip.cod {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--accent-amber);
}
.driver-strip.qris {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10B981;
}
.driver-comms-row {
  display: grid;
  grid-template-columns: 1fr 1fr 44px;
  gap: 8px;
  margin-top: 4px;
}
.driver-comms-row .btn-secondary {
  height: 40px;
  min-height: 40px;
  font-size: 12.5px;
  border-radius: 10px;
}
.driver-comms-row .btn-chat-icon {
  padding: 0;
  width: 44px;
  justify-content: center;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
  color: #0284C7;
}
[data-theme="dark"] .driver-comms-row .btn-chat-icon {
  color: #38BDF8;
}
.driver-calc-details {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
}
.driver-calc-details summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-sub);
}
.driver-calc-details summary::-webkit-details-marker { display: none; }
.driver-calc-details[open] summary {
  margin-bottom: 10px;
  color: var(--text-main);
}
.driver-issue-link {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #EF4444;
  opacity: 0.85;
  cursor: pointer;
}
.driver-dock-sublink {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: transparent;
  border: none;
  padding: 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  text-decoration: underline;
  cursor: pointer;
}
.driver-wait-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}
.driver-wait-box.ready {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.1);
}
.driver-wait-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.driver-wait-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: rgba(245, 158, 11, 0.18);
  color: #D97706;
}
.driver-wait-box.ready .driver-wait-pill {
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
}
[data-theme="dark"] .driver-wait-pill {
  color: #FBBF24;
}
[data-theme="dark"] .driver-wait-box.ready .driver-wait-pill {
  color: #34D399;
}
.driver-multi-switch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(2, 132, 199, 0.09);
  border: 1px solid rgba(2, 132, 199, 0.25);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}
.driver-multi-switch-btn {
  background: #0284C7;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

#driver-map,
.driver-map {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

#driver-detail-map,
.driver-detail-map {
  width: 100% !important;
  position: relative !important;
  overflow: hidden !important;
}

.driver-map .mapboxgl-canvas,
#driver-detail-map .mapboxgl-canvas {
  outline: none;
}

.mapboxgl-map {
  width: 100% !important;
  height: 100% !important;
}

[data-theme="dark"] #driver-map img,
[data-theme="dark"] #driver-detail-map img {
  filter: brightness(0.75) contrast(1.15);
}

.map-floating-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.map-recenter-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.map-refresh-btn {
  position: absolute;
  bottom: 10px;
  right: 50px;
  width: 34px;
  height: 34px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.map-zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.map-zoom-btn {
  width: 34px;
  height: 32px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.map-zoom-btn:last-child {
  border-bottom: none;
}

.map-zoom-btn:hover,
.map-zoom-btn:active,
.map-recenter-btn:hover,
.map-refresh-btn:hover {
  background: var(--bg-subtle);
}

.map-error {
  position: absolute;
  left: 10px;
  right: 92px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #FCA5A5;
  font-size: 10.5px;
  font-weight: 700;
  z-index: 10;
}

.map-status {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-sub);
}
.map-status.success { color: #10B981; }
.map-status.warning { color: #F59E0B; }
.map-status.error { color: #EF4444; }

/* Incoming Task Alert Overlay (Prototype Step 1 Anatomy) */
.incoming-overlay,
.incoming-task-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.incoming-modal,
.incoming-task-modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border-top: 3px solid #F59E0B;
  border-radius: 24px 24px 0 0;
  padding: 20px 20px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.6);
  color: var(--text-main);
}
.incoming-modal.qris {
  border-top-color: #10B981;
}

/* Modal Sheets */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9900;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.sheet-card,
.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--sheet-bg);
  border-top: 1px solid var(--border-color);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.6);
  max-height: 88vh;
  overflow-y: auto;
  color: var(--text-main);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-color);
  margin: 0 auto 4px;
}

.sheet h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--text-main); }
.sheet p { margin: 0; color: var(--text-sub); font-size: 12px; line-height: 1.45; }
.sheet textarea {
  width: 100%;
  min-height: 90px;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  resize: none;
  outline: none;
  font-size: 13px;
}
.sheet textarea:focus { border-color: #38BDF8; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; margin-top: 6px; }

.form-input,
.sheet-input {
  width: 100%;
  height: 46px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
}
.form-input:focus,
.sheet-input:focus {
  border-color: #38BDF8;
}

.input-label {
  display: block;
  color: var(--text-sub);
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 5px;
}

/* Info Box & Empty States */
.info-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38BDF8;
  font-size: 12px;
  line-height: 1.45;
}
.info-box.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #FBBF24;
}
.info-box.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10B981;
}

.empty { text-align: center; padding: 36px 16px; }
.empty-art {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  color: var(--text-sub);
}
.empty h3 { margin: 0 0 6px; font-size: 15px; font-weight: 800; color: var(--text-main); }
.empty p { color: var(--text-sub); font-size: 12px; line-height: 1.45; margin: 0 auto 16px; max-width: 260px; }

/* KTP Upload Card */
.ktp-upload-card {
  position: relative;
  width: 100%;
  height: 165px;
  border: 2px dashed var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  cursor: pointer;
}
.ktp-preview-img { width: 100%; height: 100%; object-fit: cover; }
.ktp-empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
}
.ktp-overlay-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.88);
  color: #FFFFFF;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Loading & Toast */
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border-color);
  border-top-color: #38BDF8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 240px; color: var(--text-sub); font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(10px);
  width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  background: #1E293B;
  border: 1px solid #38BDF8;
  color: #F1F5F9;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 10000;
  font-size: 12.5px;
  font-weight: 700;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.back-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: grid;
  place-items: center;
}
.back-title { font-size: 15px; font-weight: 800; color: var(--text-main); }

/* Driver Photo Lightbox / QRIS Popup Overlay */
.driver-photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  animation: driverPhotoFadeIn 0.2s ease;
}

@keyframes driverPhotoFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.driver-photo-lightbox-card {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  padding: 24px 20px 20px;
  max-width: min(94vw, 440px);
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.driver-photo-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.driver-photo-lightbox-close:hover {
  background: #e2e8f0;
}

.driver-photo-lightbox-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 2px;
  padding: 0 36px;
  line-height: 1.3;
}

.driver-photo-lightbox-subtitle {
  font-size: 19px;
  font-weight: 900;
  color: #059669;
  margin-bottom: 14px;
}

.driver-photo-lightbox-img-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 10px;
  box-sizing: border-box;
  margin-bottom: 0;
}

.driver-photo-lightbox-img {
  display: block;
  width: 100%;
  max-width: 360px;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 10px;
  cursor: pointer;
}
