/* ═══════════════════════════════════════════
   TALARIA DRIVER — MOBILE-FIRST DESIGN TOKENS
   Same Nexus/Hydra Teal system as Atlas V2
   ═══════════════════════════════════════════ */
:root, [data-theme="light"] {
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --color-bg: #f7f6f2;
  --color-surface: #f9f8f5;
  --color-surface-2: #fbfbf9;
  --color-surface-offset: #f3f0ec;
  --color-surface-offset-2: #edeae5;
  --color-divider: #dcd9d5;
  --color-border: #d4d1ca;
  --color-tx: #28251d;
  --color-tx-muted: #7a7974;
  --color-tx-faint: #bab9b4;
  --color-tx-inverse: #f9f8f4;
  --color-primary: #01696f;
  --color-primary-hover: #0c4e54;
  --color-primary-active: #0f3638;
  --color-primary-hl: #cedcd8;
  --color-error: #a12c7b;
  --color-error-hl: #e0ced7;
  --color-success: #437a22;
  --color-success-hl: #d4dfcc;
  --color-warning: #964219;
  --color-warning-hl: #ddcfc6;
  --color-blue: #006494;
  --color-blue-hl: #c6d8e4;
  --color-orange: #da7101;
  --color-orange-hl: #e7d7c4;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--color-tx); background: var(--color-bg);
  line-height: 1.5; max-width: 100vw; overflow-x: hidden;
}

/* ═══════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════ */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; background: var(--color-bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  padding: 2rem 1.5rem; box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-title { font-size: var(--text-lg); font-weight: 700; margin-top: 0.75rem; }
.login-subtitle { font-size: var(--text-sm); color: var(--color-tx-muted); margin-top: 0.25rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-error {
  font-size: var(--text-sm); color: var(--color-error); background: var(--color-error-hl);
  padding: 0.5rem 0.75rem; border-radius: var(--radius-md);
}

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 0.25rem; }
.form-label { font-size: var(--text-sm); font-weight: 500; }
.form-input {
  width: 100%; padding: 0.625rem 0.75rem; font-size: 16px;
  font-family: inherit; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface-2);
  color: var(--color-tx); transition: var(--transition-interactive);
  -webkit-appearance: none;
}
.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-hl); }
textarea.form-input { min-height: 80px; resize: vertical; }
select.form-input { cursor: pointer; }

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.625rem 1rem; font-size: var(--text-sm); font-weight: 600;
  font-family: inherit; border: 1px solid transparent; border-radius: var(--radius-md);
  cursor: pointer; transition: var(--transition-interactive); white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--color-primary); color: var(--color-tx-inverse); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:active { background: var(--color-primary-active); }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:active { opacity: 0.85; }
.btn-ghost { background: transparent; color: var(--color-tx-muted); border-color: var(--color-border); }
.btn-ghost:active { background: var(--color-surface-offset); }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-sm { padding: 0.375rem 0.625rem; font-size: var(--text-xs); }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.625rem; border-radius: 0.375rem; }
.btn-full { width: 100%; }
.btn.loading { opacity: 0.6; pointer-events: none; }

/* ═══════════════════════════════════════════
   APP SHELL — MOBILE
   ═══════════════════════════════════════════ */
.app-shell {
  display: flex; flex-direction: column; min-height: 100vh;
}

/* Top bar */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider); position: sticky;
  top: 0; z-index: 100;
}
.top-bar-brand {
  display: flex; align-items: center; gap: 0.5rem;
}
.top-bar-title { font-size: var(--text-base); font-weight: 700; }
.top-bar-subtitle { font-size: var(--text-xs); color: var(--color-tx-muted); }
.top-bar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Page content */
.page-content {
  flex: 1; padding: 1rem; padding-bottom: 5rem;
  overflow-y: auto;
}
.page-title {
  font-size: var(--text-lg); font-weight: 700; margin-bottom: 1rem;
}

/* Bottom nav */
.bottom-nav {
  display: flex; align-items: center; justify-content: space-around;
  padding: 0.5rem 0; padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: var(--color-surface); border-top: 1px solid var(--color-divider);
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
}
.nav-tab {
  display: flex; flex-direction: column; align-items: center; gap: 0.125rem;
  padding: 0.25rem 0.5rem; font-size: 0.6rem; font-weight: 500;
  color: var(--color-tx-muted); cursor: pointer; -webkit-tap-highlight-color: transparent;
  background: none; border: none; font-family: inherit;
  transition: var(--transition-interactive); position: relative;
}
.nav-tab.active { color: var(--color-primary); }
.nav-tab svg { width: 22px; height: 22px; }

/* Unread badge on nav tab */
.nav-badge {
  position: absolute; top: 0; right: 4px;
  background: var(--color-error); color: #fff;
  font-size: 0.5625rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--color-surface);
}

/* ═══════════════════════════════════════════
   CLOCK STATUS BAR
   ═══════════════════════════════════════════ */
.clock-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.625rem 1rem; background: var(--color-primary-hl);
  border-bottom: 1px solid var(--color-primary);
}
.clock-bar.clocked-out { background: var(--color-surface-offset); border-color: var(--color-divider); }
.clock-status {
  display: flex; align-items: center; gap: 0.5rem;
}
.clock-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--color-success);
}
.clock-dot.off { background: var(--color-tx-faint); }
.clock-label { font-size: var(--text-xs); font-weight: 600; }
.clock-time { font-size: var(--text-xs); color: var(--color-tx-muted); }

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 1rem; margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.card-title { font-size: var(--text-sm); font-weight: 700; }
.card-subtitle { font-size: var(--text-xs); color: var(--color-tx-muted); }

/* ═══════════════════════════════════════════
   STOP CARDS
   ═══════════════════════════════════════════ */
.stop-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 0.875rem; margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm); position: relative;
}
.stop-card.completed {
  opacity: 0.65; border-color: var(--color-success);
}
.stop-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  font-size: 0.6875rem; font-weight: 700;
}
.stop-card.completed .stop-number { background: var(--color-success); }
.stop-header {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem;
}
.stop-delivery-num { font-size: var(--text-xs); font-weight: 600; color: var(--color-primary); }
.stop-card.completed .stop-delivery-num { color: var(--color-success); }
.stop-address { font-size: var(--text-sm); font-weight: 500; margin-bottom: 0.25rem; }
.stop-city { font-size: var(--text-xs); color: var(--color-tx-muted); margin-bottom: 0.5rem; }
.stop-details {
  display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: var(--text-xs);
  color: var(--color-tx-muted); margin-bottom: 0.75rem;
}
.stop-detail-item {
  display: flex; align-items: center; gap: 0.25rem;
}
.stop-actions {
  display: flex; gap: 0.5rem;
}
.stop-actions .btn { flex: 1; }

/* ═══════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; padding: 0.125rem 0.5rem;
  font-size: 0.6875rem; font-weight: 600; border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge-pending { background: var(--color-warning-hl); color: var(--color-warning); }
.badge-scheduled { background: var(--color-blue-hl); color: var(--color-blue); }
.badge-in-transit { background: var(--color-orange-hl); color: var(--color-orange); }
.badge-delivered { background: var(--color-success-hl); color: var(--color-success); }
.badge-route { background: var(--color-primary-hl); color: var(--color-primary); }
.badge-dispatched { background: var(--color-blue-hl); color: var(--color-blue); }
.badge-completed { background: var(--color-success-hl); color: var(--color-success); }

/* ═══════════════════════════════════════════
   STAT CARDS (dashboard)
   ═══════════════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem; margin-bottom: 1rem;
}
.stat-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 0.75rem; text-align: center;
}
.stat-value { font-size: var(--text-xl); font-weight: 700; color: var(--color-primary); }
.stat-label { font-size: var(--text-xs); color: var(--color-tx-muted); margin-top: 0.125rem; }

/* ═══════════════════════════════════════════
   MODAL (for POD capture)
   ═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200; display: flex;
  align-items: flex-end; justify-content: center;
}
.modal-sheet {
  width: 100%; max-width: 500px; background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem; max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-title {
  font-size: var(--text-lg); font-weight: 700; margin-bottom: 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-close {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--color-surface-offset); border: none; border-radius: 50%; cursor: pointer;
  font-size: 1.25rem; color: var(--color-tx-muted);
}

/* Signature canvas */
.signature-area {
  border: 2px dashed var(--color-border); border-radius: var(--radius-md);
  background: #fff; margin-bottom: 0.75rem; position: relative;
}
.signature-area canvas { width: 100%; height: 150px; display: block; touch-action: none; }
.signature-label {
  font-size: var(--text-xs); color: var(--color-tx-faint);
  text-align: center; padding: 0.25rem; position: absolute;
  bottom: 4px; left: 0; right: 0; pointer-events: none;
}

/* Photo preview */
.photo-preview {
  width: 100%; max-height: 200px; object-fit: cover;
  border-radius: var(--radius-md); margin-bottom: 0.75rem;
  border: 1px solid var(--color-border);
}

/* POD notes */
.pod-notes {
  width: 100%; min-height: 60px; padding: 0.5rem 0.75rem;
  font-size: var(--text-sm); font-family: inherit;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-2); color: var(--color-tx);
  resize: vertical; margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════
   CONFIRM MODAL
   ═══════════════════════════════════════════ */
.confirm-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 300; display: flex;
  align-items: center; justify-content: center; padding: 1rem;
}
.confirm-box {
  width: 100%; max-width: 340px; background: var(--color-surface);
  border-radius: var(--radius-xl); padding: 1.5rem;
  box-shadow: var(--shadow-lg); text-align: center;
}
.confirm-title { font-size: var(--text-base); font-weight: 700; margin-bottom: 0.5rem; }
.confirm-msg { font-size: var(--text-sm); color: var(--color-tx-muted); margin-bottom: 1.25rem; }
.confirm-actions { display: flex; gap: 0.75rem; }
.confirm-actions .btn { flex: 1; }

/* ═══════════════════════════════════════════
   TIMESHEET PAGE
   ═══════════════════════════════════════════ */
.timesheet-entry {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 0; border-bottom: 1px solid var(--color-divider);
}
.timesheet-entry:last-child { border-bottom: none; }
.timesheet-date { font-size: var(--text-sm); font-weight: 500; }
.timesheet-hours { font-size: var(--text-sm); font-weight: 700; color: var(--color-primary); }
.timesheet-times { font-size: var(--text-xs); color: var(--color-tx-muted); }

/* ═══════════════════════════════════════════
   LOADING / EMPTY
   ═══════════════════════════════════════════ */
.loading-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 1rem; color: var(--color-tx-faint);
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--color-divider);
  border-top-color: var(--color-primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center; padding: 3rem 1rem;
}
.empty-state svg { margin-bottom: 0.75rem; color: var(--color-tx-faint); }
.empty-state-title { font-size: var(--text-base); font-weight: 600; margin-bottom: 0.25rem; }
.empty-state-msg { font-size: var(--text-sm); color: var(--color-tx-muted); }

/* ═══════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════ */
.hidden { display: none; }
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ═══════════════════════════════════════════
   FILTER TABS (Deliveries page)
   ═══════════════════════════════════════════ */
.filter-tabs {
  display: flex; gap: 0; margin-bottom: 1rem;
  background: var(--color-surface-offset); border-radius: var(--radius-md);
  padding: 3px; border: 1px solid var(--color-border);
}
.filter-tab {
  flex: 1; padding: 0.375rem 0.5rem; font-size: var(--text-xs); font-weight: 600;
  border: none; background: transparent; color: var(--color-tx-muted);
  border-radius: calc(var(--radius-md) - 2px); cursor: pointer;
  transition: var(--transition-interactive); font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.filter-tab.active {
  background: var(--color-surface); color: var(--color-primary);
  box-shadow: var(--shadow-sm); border: 1px solid var(--color-border);
}

/* ═══════════════════════════════════════════
   ROUTE CARDS
   ═══════════════════════════════════════════ */
.route-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 1rem; margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}
.route-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 0.625rem;
}
.route-card-title { font-size: var(--text-sm); font-weight: 700; }
.route-card-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  font-size: var(--text-xs); color: var(--color-tx-muted);
  margin-bottom: 0.75rem;
}
.route-meta-item {
  display: flex; align-items: center; gap: 0.25rem;
}
.route-card-actions { display: flex; gap: 0.5rem; }
.route-card-actions .btn { flex: 1; }

/* Route stops expand list */
.route-stops-list {
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--color-divider);
}
.route-stop-item {
  display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap;
  padding: 0.5rem 0; border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-xs);
}
.route-stop-item:last-child { border-bottom: none; }
.route-stop-num {
  width: 20px; height: 20px; border-radius: 50%; background: var(--color-primary);
  color: #fff; font-size: 0.5625rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.route-stop-info { flex: 1; min-width: 0; }
.route-stop-addr { color: var(--color-tx); font-weight: 500; }
.route-stop-status { color: var(--color-tx-muted); flex-shrink: 0; }
.route-stop-actions {
  width: 100%; display: flex; gap: 0.375rem; padding-left: 2rem;
  margin-top: 0.25rem;
}

/* Sub-tabs (Routes page) */
.sub-tabs {
  display: flex; gap: 0; margin-bottom: 1rem;
  border-bottom: 2px solid var(--color-divider);
}
.sub-tab {
  padding: 0.5rem 1rem; font-size: var(--text-sm); font-weight: 600;
  color: var(--color-tx-muted); border: none; background: transparent;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; font-family: inherit;
  transition: var(--transition-interactive);
  -webkit-tap-highlight-color: transparent;
}
.sub-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ═══════════════════════════════════════════
   CHECKOUT FORM
   ═══════════════════════════════════════════ */
.checkout-steps {
  display: flex; gap: 0.25rem; margin-bottom: 1.25rem; align-items: center;
}
.checkout-step-indicator {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--color-border); color: var(--color-tx-muted);
  background: var(--color-surface);
}
.checkout-step-indicator.active {
  border-color: var(--color-primary); color: var(--color-primary);
  background: var(--color-primary-hl);
}
.checkout-step-indicator.done {
  border-color: var(--color-success); background: var(--color-success); color: #fff;
}
.checkout-step-line {
  flex: 1; height: 2px; background: var(--color-divider);
}
.checkout-step-line.done { background: var(--color-success); }

.checkout-section-title {
  font-size: var(--text-base); font-weight: 700; margin-bottom: 1rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-divider);
}

/* Receipt items */
.receipt-list { margin-bottom: 0.75rem; }
.receipt-item {
  background: var(--color-surface-offset); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 0.75rem; margin-bottom: 0.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.receipt-item-info { flex: 1; }
.receipt-item-amount { font-size: var(--text-sm); font-weight: 700; color: var(--color-primary); }
.receipt-item-desc { font-size: var(--text-xs); color: var(--color-tx-muted); }
.receipt-remove {
  background: none; border: none; color: var(--color-error);
  cursor: pointer; font-size: 1.125rem; padding: 0.25rem; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

/* File upload area */
.upload-area {
  border: 2px dashed var(--color-border); border-radius: var(--radius-md);
  padding: 1.5rem 1rem; text-align: center; cursor: pointer;
  transition: var(--transition-interactive); background: var(--color-surface-2);
}
.upload-area:hover { border-color: var(--color-primary); background: var(--color-primary-hl); }
.upload-area-icon { color: var(--color-tx-faint); margin-bottom: 0.5rem; }
.upload-area-text { font-size: var(--text-sm); color: var(--color-tx-muted); }

/* Thumbnail grid */
.thumbnail-grid {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem;
}
.thumbnail-item {
  position: relative; width: 72px; height: 72px;
}
.thumbnail-item img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--color-border);
}
.thumbnail-remove {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-error); color: #fff; border: none;
  font-size: 0.625rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════
   MESSAGING
   ═══════════════════════════════════════════ */
/* Thread list */
.thread-list { }
.thread-item {
  display: flex; align-items: center; gap: 0.875rem;
  padding: 0.875rem; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  margin-bottom: 0.5rem; cursor: pointer;
  transition: var(--transition-interactive);
  -webkit-tap-highlight-color: transparent;
}
.thread-item:active { background: var(--color-surface-offset); }
.thread-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: 700; flex-shrink: 0;
}
.thread-body { flex: 1; min-width: 0; }
.thread-name { font-size: var(--text-sm); font-weight: 600; margin-bottom: 0.125rem; }
.thread-preview {
  font-size: var(--text-xs); color: var(--color-tx-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thread-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.thread-time { font-size: 0.625rem; color: var(--color-tx-faint); }
.thread-unread-badge {
  background: var(--color-primary); color: #fff;
  font-size: 0.5625rem; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* Chat view */
.chat-view {
  display: flex; flex-direction: column; height: calc(100vh - 180px);
}
.chat-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding-bottom: 0.75rem; border-bottom: 1px solid var(--color-divider);
  margin-bottom: 0.75rem;
}
.chat-back {
  background: none; border: none; cursor: pointer; padding: 0.25rem;
  color: var(--color-primary); display: flex; align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.chat-recipient-name { font-size: var(--text-base); font-weight: 700; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 0.5rem 0;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.chat-bubble-wrap {
  display: flex; flex-direction: column;
}
.chat-bubble-wrap.sent { align-items: flex-end; }
.chat-bubble-wrap.received { align-items: flex-start; }
.chat-bubble {
  max-width: 78%; padding: 0.625rem 0.875rem;
  border-radius: var(--radius-lg); font-size: var(--text-sm); line-height: 1.45;
  word-break: break-word;
}
.chat-bubble.sent {
  background: var(--color-primary); color: var(--color-tx-inverse);
  border-bottom-right-radius: var(--radius-sm);
}
.chat-bubble.received {
  background: var(--color-surface-offset-2); color: var(--color-tx);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: var(--radius-sm);
}
.chat-bubble-time {
  font-size: 0.625rem; color: var(--color-tx-faint);
  margin-top: 0.25rem; padding: 0 0.25rem;
}
.chat-input-bar {
  display: flex; gap: 0.5rem; padding-top: 0.75rem;
  border-top: 1px solid var(--color-divider);
}
.chat-input {
  flex: 1; padding: 0.625rem 0.875rem; font-size: 16px;
  font-family: inherit; border: 1px solid var(--color-border);
  border-radius: var(--radius-full); background: var(--color-surface-2);
  color: var(--color-tx); outline: none; resize: none;
  -webkit-appearance: none;
}
.chat-input:focus { border-color: var(--color-primary); }
.chat-send-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--transition-interactive);
  -webkit-tap-highlight-color: transparent;
}
.chat-send-btn:active { background: var(--color-primary-active); }
.chat-date-divider {
  text-align: center; font-size: 0.625rem; color: var(--color-tx-faint);
  margin: 0.25rem 0; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}

/* New message recipient select */
.recipient-list {
  display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem;
}
.recipient-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  cursor: pointer; transition: var(--transition-interactive);
  -webkit-tap-highlight-color: transparent;
}
.recipient-item:active { background: var(--color-surface-offset); }
.recipient-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--color-surface-offset-2); color: var(--color-tx-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 700; flex-shrink: 0;
}
.recipient-name { font-size: var(--text-sm); font-weight: 600; }
.recipient-role { font-size: var(--text-xs); color: var(--color-tx-muted); }

/* ═══════════════════════════════════════════
   DASHBOARD WELCOME BANNER
   ═══════════════════════════════════════════ */
.welcome-banner {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  border-radius: var(--radius-lg); padding: 1.25rem;
  margin-bottom: 1rem; color: var(--color-tx-inverse);
}
.welcome-name { font-size: var(--text-lg); font-weight: 700; margin-bottom: 0.125rem; }
.welcome-sub { font-size: var(--text-xs); opacity: 0.85; }

/* Dashboard quick actions */
.quick-actions {
  display: flex; gap: 0.75rem; margin-bottom: 1rem;
}
.quick-actions .btn { flex: 1; }

/* Recent activity */
.activity-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0; border-bottom: 1px solid var(--color-divider);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-success); flex-shrink: 0;
}
.activity-addr { font-size: var(--text-sm); font-weight: 500; flex: 1; }
.activity-time { font-size: var(--text-xs); color: var(--color-tx-muted); }

/* Section label */
.section-label {
  font-size: var(--text-xs); font-weight: 700; color: var(--color-tx-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 0.5rem; margin-top: 0.25rem;
}

/* Toast notification */
.toast {
  position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--color-tx); color: var(--color-tx-inverse);
  padding: 0.75rem 1.25rem; border-radius: var(--radius-lg);
  font-size: var(--text-sm); font-weight: 600;
  z-index: 9999; white-space: nowrap;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease-out;
}
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-error); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Manifest upload area (in delivery card) */
.manifest-upload-area {
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--color-divider);
}
.manifest-thumbnail {
  width: 80px; height: 60px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  margin-top: 0.5rem;
}
.manifest-btn-row {
  display: flex; gap: 0.5rem; margin-top: 0.25rem;
}
.manifest-btn-row .btn { flex: 1; font-size: var(--text-xs); }

/* ═══ Delivery Route Grouping ═══ */
.delivery-route-group {
  margin-bottom: 1.25rem;
}
.delivery-route-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; margin-bottom: 0.5rem;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
}
.delivery-route-header svg { flex-shrink: 0; }
.delivery-route-count {
  margin-left: auto; font-size: var(--text-xs);
  font-weight: 500; color: var(--color-tx-muted);
  background: var(--color-surface-offset);
  padding: 0.125rem 0.5rem; border-radius: var(--radius-full);
}

/* Return to Hub card */
.hub-return-card {
  border-color: var(--color-primary) !important;
  border-style: dashed !important;
  background: var(--color-primary-hl) !important;
  opacity: 1 !important;
}
.hub-stop {
  background: var(--color-primary) !important;
}
.badge-hub {
  background: var(--color-primary-hl); color: var(--color-primary);
}

/* Arrived status */
.badge-arrived {
  background: #E8F5E9; color: #2E7D32;
}
.stop-card.arrived {
  border-color: #2E7D32;
}
.stop-card.arrived .stop-number {
  background: #2E7D32;
}
.btn-arrived {
  background: #2E7D32 !important; color: #fff !important;
  border: none !important;
}
.btn-arrived:hover, .btn-arrived:active {
  background: #1B5E20 !important;
}

/* ── Route Fuel, Receipts & Comments Panel ── */
.route-extras-panel {
  margin-top: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  overflow: hidden;
}
.route-extras-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-tx);
  background: var(--color-surface);
  border-bottom: 1px solid transparent;
  transition: background 0.15s;
}
.route-extras-toggle:hover {
  background: var(--color-surface-hl);
}
.route-extras-body {
  padding: 1rem;
  border-top: 1px solid var(--color-border);
}
.extras-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.extras-section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-tx-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.form-row {
  display: flex;
  gap: 0.75rem;
}
