@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --background: #F8FAFC; /* Premium soft slate-50 background */
  --foreground: #0F172A; /* Corporate midnight slate */
  --header-bg: #0F172A; /* Midnight slate blue */
  --header-text: #FFFFFF;
  --border-color: #E2E8F0; /* Soft slate-200 border */
  --text-muted: #64748B; /* slate-500 */
  --text-primary: #0F172A;
  --text-secondary: #334155; /* slate-700 */
  --radius-lg: 8px; /* Standardized corner radius ratio */
  --radius-full: 9999px;
  
  /* App-specific Blue theme for Driver */
  --app-color: #3B82F6; /* Blue */
  --app-bg-light: #EFF6FF; /* Blue 50 */
  --app-glow: rgba(59, 130, 246, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overflow: hidden;
  height: 100dvh;
  width: 100%;
  position: fixed;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */
.mobile-header {
  height: 44px;
  width: 100%;
  background-color: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  user-select: none;
}

.mobile-header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-icon-btn {
  background: none;
  border: none;
  color: var(--header-text);
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.25s ease;
  outline: none;
}

.header-icon-btn:active {
  opacity: 0.6;
}

.header-icon-btn.left-icon {
  left: 8px;
}

.header-icon-btn.right-icon {
  right: 8px;
}

.header-icon {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Navigation Drawer
   ========================================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background-color: #FFFFFF;
  z-index: 1101;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.08);
}

.drawer.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
}

.drawer-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--foreground);
  letter-spacing: -0.03em;
}

.drawer-logo span {
  color: var(--app-color);
  font-weight: 500;
}

.drawer-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 4px;
  overflow-y: auto;
}

.drawer-item {
  background: none;
  border: none;
  outline: none;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.drawer-item:hover, .drawer-item.active {
  background-color: var(--app-bg-light);
  color: var(--app-color);
}

.drawer-item.active .menu-icon {
  stroke: var(--app-color);
}

.menu-icon {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  stroke-width: 2.2;
  fill: none;
  transition: stroke 0.2s ease;
}

.drawer-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 12px 16px;
}

.footer-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  width: 100%;
}

.footer-item {
  background: none;
  border: none;
  outline: none;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.footer-item:hover, .footer-item.active {
  background-color: var(--app-bg-light);
  color: var(--app-color);
}

.footer-item.active .footer-menu-icon {
  stroke: var(--app-color);
}

.footer-menu-icon {
  width: 15px;
  height: 15px;
  stroke: var(--text-muted);
  stroke-width: 2.2;
  fill: none;
  transition: stroke 0.2s ease;
}

#exit-btn {
  color: #EF4444;
}

#exit-btn:hover {
  background-color: #FEF2F2;
  color: #EF4444;
}

#exit-btn:hover .footer-menu-icon {
  stroke: #EF4444;
}

.footer-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 6px 0 10px 0;
  width: 100%;
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.5;
  letter-spacing: 0.05em;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-footer .copyright {
  font-size: 8.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Content Area
   ========================================================================== */
.mobile-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background-color: var(--background);
  width: 100%;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-content.map-active {
  padding: 0 !important;
}

/* Centered blank page view */
.blank-page-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  min-height: 250px;
}

/* ==========================================================================
   Subheader (Tabs & Qty Count)
   ========================================================================== */
.subheader {
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.tab-container {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.tab-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background-color: #F1F5F9;
  border: none;
  outline: none;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn:active {
  transform: scale(0.95);
}

.tab-btn.active {
  background-color: var(--app-color);
  color: #FFFFFF;
  box-shadow: 0 2px 6px var(--app-glow);
}

.qty-count-display {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Expandable Search Header Row
   ========================================================================== */
.content-header-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  margin-bottom: 16px;
  width: 100%;
}

.active-menu-label {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 36px;
}

.search-bar-expandable {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  width: 36px;
  height: 36px;
  background-color: transparent;
  border-radius: var(--radius-lg);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  z-index: 10;
  border: 1.5px solid transparent;
  box-sizing: border-box;
}

/* Expanded state - Keep the vertical centering transform */
.search-bar-expandable.expanded {
  width: 100%;
  background-color: #FFFFFF;
  border-color: var(--border-color);
  padding: 0 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.search-input-field {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  padding: 0 28px 0 8px; /* Room for clear button */
  display: none;
  font-family: inherit;
  box-sizing: border-box;
}

.search-bar-expandable.expanded .search-input-field {
  display: block;
}

.search-toggle-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
}

.search-bar-expandable.expanded .search-toggle-btn {
  color: var(--app-color);
}

.search-toggle-btn:hover {
  background-color: var(--app-bg-light);
  color: var(--app-color);
}

.search-icon-svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.5;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.search-clear-btn:hover {
  color: #EF4444;
}

.clear-icon-svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

/* ==========================================================================
   Order Cards List
   ========================================================================== */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.order-card {
  background-color: #FFFFFF;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 0;
  display: flex;
  align-items: stretch;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.order-card:active {
  transform: scale(0.99);
}

/* 1:1 Mark avatar - Full Height Left Side Bar in 1:1 square aspect ratio */
.mark-avatar {
  aspect-ratio: 1 / 1;
  background-color: var(--app-bg-light);
  border-right: 1.5px solid rgba(59, 130, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--app-color);
  font-weight: 800;
  font-size: 20px;
  flex-shrink: 0;
  user-select: none;
}

.order-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* Ensures text truncation works */
  padding: 14px 16px 14px 14px;
}

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-id {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-deliver-to {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  text-align: left;
  word-break: break-word;
}

/* Time Elapsed top right */
.time-elapsed {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Bottom Status Badges matching Merchandiser App */
.order-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  padding-top: 6px;
  width: 100%;
}

.order-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
}

.order-badge.zone-badge {
  background-color: #F1F5F9;
  color: #475569;
}

.order-badge.type-urgent {
  background-color: #FEE2E2;
  color: #B91C1C;
  border: 1px solid rgba(185, 28, 28, 0.15);
}

.order-badge.type-appointment {
  background-color: var(--app-bg-light);
  color: var(--app-color);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.order-badge.type-normal {
  background-color: #F1F5F9;
  color: #475569;
  border: 1px solid rgba(71, 85, 105, 0.1);
}

.order-badge.small-order-badge {
  background-color: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid rgba(29, 78, 216, 0.15);
}

/* ==========================================================================
   Blank States & Loading
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  stroke: var(--border-color);
  stroke-width: 1.5;
}

.empty-text {
  font-size: 13.5px;
  font-weight: 600;
}

.empty-subtext {
  font-size: 11.5px;
}

/* General Layout helpers */
.hidden {
  display: none !important;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinning {
  animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   Toast Notification Styling (Matching Merchandiser App)
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000; /* Above modals and overlays */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(-20px); /* Starts above the screen */
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
  box-sizing: border-box;
}

/* Slide down and fade in */
.toast-message.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Slide up and fade out when leaving */
.toast-message:not(.visible) {
  opacity: 0;
  transform: translateY(-30px); /* Slides upwards into invisibility */
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-icon.success-icon {
  color: #10B981; /* Emerald green */
}

.toast-icon.error-icon {
  color: #EF4444; /* Rose red */
}

.toast-icon.info-icon {
  color: var(--app-color); /* Theme blue */
}

.toast-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Custom Exit Confirmation Modal */
.exit-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.exit-modal-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 24px;
  width: 85%;
  max-width: 300px;
  text-align: center;
  box-sizing: border-box;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15), 0 8px 10px -6px rgba(0,0,0,0.15);
}

.exit-modal-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.exit-modal-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.45;
}

.exit-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.modal-btn {
  width: 100%;
  padding: 10px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.modal-btn.cancel {
  color: #475569;
  background-color: #F1F5F9;
  border: 1px solid var(--border-color);
}

.modal-btn.confirm {
  color: white;
  background-color: #EF4444;
  border: none;
}

/* ==========================================================================
   Picking List Detail View Page
   ========================================================================== */
.picking-page-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #F8FAFC;
  z-index: 500;
  display: none;
  flex-direction: column;
}

.picking-page-overlay.active {
  display: flex;
}

.picking-header {
  height: 44px;
  width: 100%;
  background-color: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 50;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  user-select: none;
  flex-shrink: 0;
}

.preview-back-btn {
  background: none;
  border: none;
  color: var(--header-text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  outline: none;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.preview-back-btn:active {
  opacity: 0.6;
}

.preview-back-btn .back-icon {
  width: 16px;
  height: 16px;
}

.picking-order-info-card {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background-color: #FFFFFF;
  margin: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  gap: 16px;
}

.picking-mark-box {
  aspect-ratio: 1 / 1;
  width: 54px;
  height: 54px;
  background-color: var(--app-bg-light);
  border: 1.5px solid rgba(59, 130, 246, 0.15);
  color: var(--app-color);
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
  user-select: none;
}

.picking-info-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.picking-info-row {
  display: flex;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
}

.picking-info-row .info-label {
  font-weight: 700;
  color: var(--text-muted);
}

.picking-info-row .info-value {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picking-items-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 90px 16px;
}

.picking-brand-section {
  margin-top: 14px;
}

.picking-brand-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  text-align: left;
}

.picking-item-card {
  background-color: #FFFFFF;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 0;
  display: flex;
  align-items: stretch;
  box-shadow: 0 1px 2px rgba(0,0,0,0.01);
  margin-bottom: 10px;
  overflow: hidden;
}

.picking-item-img-container {
  aspect-ratio: 1 / 1;
  width: 64px;
  background-color: #F8FAFC;
  border-right: 1.5px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.picking-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.picking-item-img-placeholder {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-muted);
}

.picking-item-content {
  flex: 1;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.picking-item-sku {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: left;
  line-height: 1.3;
}

.picking-item-name {
  font-size: 11.5px;
  color: var(--text-secondary);
  text-align: left;
  line-height: 1.4;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picking-item-qty {
  font-size: 11px;
  font-weight: 700;
  color: var(--app-color);
  background-color: var(--app-bg-light);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  align-self: flex-start;
}

.picking-item-check-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px 0 8px;
  flex-shrink: 0;
}

.picking-item-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: #FFFFFF;
  color: transparent;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.picking-item-checkbox.checked {
  background-color: var(--app-color);
  border-color: var(--app-color);
  color: #FFFFFF;
}

.picking-item-checkbox svg {
  width: 14px;
  height: 14px;
  stroke-width: 4.5;
  stroke: #FFFFFF !important;
}

.picking-footer-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #FFFFFF;
  border-top: 1.5px solid var(--border-color);
  padding: 12px 16px;
  box-sizing: border-box;
  z-index: 10;
}

.picking-action-btn {
  width: 100%;
  height: 52px;
  background-color: var(--app-color);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s;
}

.picking-action-btn.cancel-mode {
  background-color: #EF4444;
}

.picking-action-btn.ready-mode {
  background-color: #10B981;
}

.picking-action-btn.disabled-mode {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* ==========================================================================
   Goods Ready Proof Overlay
   ========================================================================== */
.proof-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.proof-modal-overlay.active {
  display: flex;
}

.proof-modal-card {
  background-color: #FFFFFF;
  border-radius: 16px;
  width: 88%;
  max-width: 340px;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  box-sizing: border-box;
}

.proof-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--border-color);
}

.proof-modal-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.proof-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.proof-close-btn svg {
  width: 18px;
  height: 18px;
}

.proof-modal-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

.camera-upload-box {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  background-color: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-sizing: border-box;
}

.camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.camera-icon {
  width: 30px;
  height: 30px;
  stroke: var(--text-muted);
  stroke-width: 1.8;
}

.camera-preview-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pin-entry-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.pin-entry-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pin-digits-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.pin-digit-input, .pin-digit-display {
  width: 48px;
  height: 48px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  outline: none;
  background-color: #FFFFFF;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  -webkit-text-security: disc; /* Mask characters with dots */
  box-sizing: border-box;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.pin-digit-input:focus, .pin-digit-display.active {
  border-color: var(--app-color);
  box-shadow: 0 0 0 3px var(--app-glow);
}

.pin-digit-input.error, .pin-digit-display.error {
  border-color: #EF4444 !important;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ==========================================================================
   Goods Ready Card Action Icons
   ========================================================================== */
.order-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  flex-shrink: 0;
}

.card-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.card-action-btn:active {
  transform: scale(0.95);
}

.card-action-btn.whatsapp-btn {
  background-color: #E8F5E9;
  border: 1px solid rgba(76, 175, 80, 0.2);
  color: #2E7D32;
}

.card-action-btn.whatsapp-btn:hover {
  background-color: #C8E6C9;
}

.card-action-btn.handover-btn {
  background-color: var(--app-bg-light);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--app-color);
}

.card-action-btn.handover-btn:hover {
  background-color: rgba(59, 130, 246, 0.15);
}

.card-action-btn .action-icon {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   WhatsApp Bottom Prep Drawer
   ========================================================================== */
.brand-select-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65dvh;
  background-color: #FFFFFF;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.15);
  z-index: 10500;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.brand-select-drawer.active {
  transform: translateY(0);
}

.drawer-drag-handle {
  width: 36px;
  height: 4px;
  background-color: #E2E8F0;
  border-radius: 2px;
  margin: 10px auto 4px auto;
  flex-shrink: 0;
}

.drawer-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   Inline Photo Section & Authentication Page View
   ========================================================================= */
.picking-photo-section {
  margin-top: 24px;
  margin-bottom: 24px;
  background-color: #FFFFFF;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.01);
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.picking-photo-section.disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(1);
}

.picking-photo-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  text-align: left;
}

.picking-photo-section.disabled .camera-upload-box {
  border-color: #E2E8F0;
  background-color: #F8FAFC;
}

.auth-page-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #F8FAFC;
  z-index: 10600;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-page-overlay.active {
  transform: translateY(0);
}

.auth-header {
  height: 44px;
  width: 100%;
  background-color: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 50;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  user-select: none;
  flex-shrink: 0;
}

.auth-content {
  flex: 1;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 30px;
}

/* ==========================================================================
   Map Page Styling
   ========================================================================== */
.map-page-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow-y: auto; /* Scroll parent page */
}

.map-wrapper {
  height: 60vh;
  width: 100%;
  position: relative;
  border-bottom: 1.5px solid var(--border-color);
  flex-shrink: 0;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1); /* Smooth shrink transition */
  background-color: #F1F5F9; /* Placeholder background before map load */
}

#leaflet-map {
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.map-wrapper.shrink {
  height: 10vh !important;
}

.map-wrapper.shrink #leaflet-map {
  filter: blur(3px);
  opacity: 0.5;
  pointer-events: none;
}

.map-wrapper.shrink .map-fullscreen-btn {
  filter: blur(3px);
  opacity: 0.5;
  pointer-events: none;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.map-wrapper.fullscreen {
  position: fixed;
  top: 44px; /* below header */
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(100dvh - 44px) !important;
  z-index: 450; /* below drawer overlay but above other content */
}

.map-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background-color: #FFFFFF;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  outline: none;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.map-fullscreen-btn:active {
  background-color: #F1F5F9;
}

.fullscreen-icon {
  width: 18px;
  height: 18px;
}

.map-details-container {
  flex: 1;
  padding: 16px;
  background-color: #FFFFFF;
  box-sizing: border-box;
}

.map-placeholder-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 36px 16px;
  line-height: 1.5;
}

/* Detailed Order Card in Map */
.map-order-detail-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}

.map-order-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1.5px solid var(--border-color);
  padding-bottom: 12px;
  position: relative;
}

.map-order-mark {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}

.map-order-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.map-order-id {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: left;
}

.map-order-type {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: left;
}

.map-order-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.map-order-close-btn:active {
  color: #EF4444;
}

.map-order-info-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-order-info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.map-order-info-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.map-order-info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.map-order-items-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1.5px solid var(--border-color);
  padding-top: 12px;
}

.map-order-items-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}

.map-order-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 12px;
}

.map-order-item-row .map-order-item-sku {
  font-weight: 700;
  color: var(--text-primary);
}

.map-order-item-row .map-order-item-qty {
  font-weight: 800;
  color: var(--app-color);
  background-color: var(--app-bg-light);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Job Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: transparent;
  border: 2px solid #E2E8F0;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: #E2E8F0;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #10B981;
  border-color: #10B981;
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: #FFFFFF;
}

input:disabled + .toggle-slider {
  cursor: not-allowed;
  opacity: 0.4;
  pointer-events: none;
}

/* Map Shrinking & Blur */
.map-wrapper.shrink {
  height: 10% !important;
  filter: blur(2.5px) grayscale(15%);
  transition: all 0.3s ease;
}

/* Expand Details Button & Container Panel */
.expand-details-btn {
  background-color: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin: 10px auto;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  outline: none;
  width: fit-content;
}
.expand-details-btn:active {
  background-color: #E2E8F0;
}
.details-expandable-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  padding: 0 4px;
  box-sizing: border-box;
}
.details-expandable-section.expanded {
  max-height: 1000px;
  transition: max-height 0.3s ease-in;
  margin-top: 8px;
}
.details-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #475569;
  padding: 6px 0;
  border-bottom: 1px solid #F1F5F9;
}
.details-info-label {
  font-weight: 500;
}
.details-info-value {
  font-weight: 700;
  text-align: right;
}

/* ==========================================================================
   ON Job Mode & Deliver Page CSS Extensions
   ========================================================================== */

/* 1. ON Mode Map Scaling */
.map-page-container.on-mode .map-wrapper:not(.fullscreen) {
  height: 30vh !important;
}
.map-page-container.on-mode .map-wrapper #leaflet-map,
.map-page-container.on-mode .map-wrapper .map-fullscreen-btn {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* 2. WhatsApp Drawer Slide-up animation class */
#whatsapp-share-drawer.active {
  display: flex !important;
}
#whatsapp-share-drawer.active #whatsapp-share-drawer-card {
  transform: translateY(0) !important;
}

/* 3. Deliver Items Qty Adjuster & Checkbox */
.deliver-qty-adjuster {
  display: flex;
  align-items: center;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  background-color: #FFF;
  height: 32px;
  overflow: hidden;
  box-sizing: border-box;
}
.deliver-qty-adjuster.disabled {
  background-color: #F1F5F9;
  border-color: #E2E8F0;
  pointer-events: none;
  opacity: 0.6;
}
.deliver-qty-btn {
  width: 28px;
  height: 100%;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #64748B;
  cursor: pointer;
  outline: none;
  user-select: none;
}
.deliver-qty-btn:active {
  background-color: #F1F5F9;
}
.deliver-qty-val {
  width: 26px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #1E293B;
  border-left: 1px solid #E2E8F0;
  border-right: 1px solid #E2E8F0;
  height: 100%;
  line-height: 29px;
  user-select: none;
}

/* 4. Ticking circle */
.deliver-check-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: #FFF;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}
.deliver-check-circle.checked {
  background-color: var(--app-color);
  border-color: var(--app-color);
}
.deliver-check-circle svg {
  display: none;
  width: 14px;
  height: 14px;
  color: #FFF;
}
.deliver-check-circle.checked svg {
  display: block;
}

/* 5. Discrepancy Remark styling */
.deliver-remark-container {
  width: 100%;
  margin-top: 8px;
  box-sizing: border-box;
  text-align: left;
}
.deliver-remark-input {
  width: 100%;
  height: 48px;
  border: 1.5px dashed #EF4444;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #1E293B;
  background-color: #FEF2F2;
  resize: none;
  box-sizing: border-box;
  outline: none;
}
.deliver-remark-input::placeholder {
  color: #fca5a5;
  font-style: italic;
}

/* 6. ON Mode Card List customizations */
.on-mode-order-card {
  padding: 0 !important;
  margin-bottom: 12px;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch;
  gap: 0;
  background-color: #FFFFFF;
  border-radius: 12px !important;
  border: 1.5px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  overflow: hidden;
  box-sizing: border-box;
  text-align: left;
  transition: background-color 0.2s ease;
}

.on-mode-card-banner {
  width: 100%;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  margin-top: -2px; /* Pull it up flush with the card bottom */
  border: 1.5px solid var(--border-color);
  border-top: none;
  box-sizing: border-box;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.on-mode-card-banner.urgent {
  background-color: #FEF2F2;
  border-color: #FCA5A5;
  color: #EF4444;
}

.on-mode-card-banner.appointment {
  background-color: #FFFBEB;
  border-color: #FDE68A;
  color: #D97706;
}

.on-mode-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px !important; /* Rounded square (not round/50%) */
  border: 1.5px solid var(--border-color);
  background-color: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.on-mode-action-btn.navigate {
  background-color: #F0F9FF !important;
  border-color: #BAE6FD !important;
  color: #0284C7 !important;
}

.on-mode-action-btn.deliver {
  background-color: #ECFDF5 !important;
  border-color: #A7F3D0 !important;
  color: #059669 !important;
}

