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

/* ===========================
   DESIGN TOKENS
   =========================== */
:root {
  --bg-primary: #0D1117;
  --bg-secondary: #161B22;
  --bg-tertiary: #21262D;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-glass: rgba(33, 38, 45, 0.6);
  --border: #30363D;
  --border-light: rgba(48, 54, 61, 0.5);

  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted: #484F58;

  --accent: #F59E0B;
  --accent-dark: #D97706;
  --accent-light: rgba(245, 158, 11, 0.12);
  --accent-glow: 0 0 24px rgba(245, 158, 11, 0.3);

  --success: #22C55E;
  --success-light: rgba(34, 197, 94, 0.12);
  --error: #EF4444;
  --error-light: rgba(239, 68, 68, 0.12);
  --warning: #F97316;
  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.12);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.7);

  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --header-h: 60px;
  --sidebar-w: 380px;
  --z-header: 100;
  --z-modal: 200;
  --z-toast: 300;
  --z-map: 1;
}

/* ===========================
   RESET & BASE
   =========================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, textarea, select { font-family: var(--font); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===========================
   TYPOGRAPHY
   =========================== */
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.03em; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ===========================
   LAYOUT UTILITIES
   =========================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ===========================
   HEADER
   =========================== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: var(--z-header);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, #EA580C 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

.header-title {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title span {
  color: var(--text-primary);
}

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

/* ===========================
   BUTTONS
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition-fast);
}

.btn:hover::after { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
}
.btn-primary:hover { background: var(--accent-dark); box-shadow: var(--accent-glow); }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); background: var(--bg-glass); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #16A34A; box-shadow: 0 0 20px rgba(34, 197, 94, 0.3); }

.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover { background: #DC2626; box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-icon-sm {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===========================
   CARDS
   =========================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-hover {
  transition: var(--transition);
  cursor: pointer;
}
.card-hover:hover {
  border-color: rgba(245, 158, 11, 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(245, 158, 11, 0.1);
}

/* ===========================
   FORM ELEMENTS
   =========================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font);
  transition: var(--transition-fast);
  width: 100%;
  outline: none;
}

.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.form-input-lg {
  padding: 14px 16px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.input-icon-wrapper {
  position: relative;
}
.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.input-icon-wrapper .form-input {
  padding-left: 38px;
}

/* Search dropdown */
.search-wrapper {
  position: relative;
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.search-result {
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-tertiary); }
.search-result-main { color: var(--text-primary); font-weight: 500; }
.search-result-sub { color: var(--text-secondary); font-size: 0.8rem; margin-top: 2px; }
.search-loading {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ===========================
   BADGES / PILLS
   =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-accent { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.2); }
.badge-error { background: var(--error-light); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-info { background: var(--info-light); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); }

/* ===========================
   STAT CARDS
   =========================== */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===========================
   STOP CARD
   =========================== */
.stop-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.stop-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: var(--transition-fast);
}
.stop-card:hover::before { opacity: 1; }
.stop-card.dragging {
  opacity: 0.5;
  border-color: var(--accent);
}
.stop-card.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}
.stop-card.delivered { opacity: 0.6; }
.stop-card.delivered::before { background: var(--success); opacity: 1; }
.stop-card.failed::before { background: var(--error); opacity: 1; }

.stop-card-inner { padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; }

.stop-number {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #000;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.stop-card.delivered .stop-number { background: var(--success); color: #fff; }
.stop-card.failed .stop-number { background: var(--error); color: #fff; }

.stop-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 0.9rem;
  padding: 4px 2px;
  flex-shrink: 0;
  margin-top: 4px;
  transition: var(--transition-fast);
}
.stop-drag-handle:hover { color: var(--text-secondary); }
.stop-drag-handle:active { cursor: grabbing; }

.stop-content { flex: 1; min-width: 0; }
.stop-address { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.stop-name { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.stop-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.stop-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-items: flex-start;
}

/* ===========================
   PACKAGE LOCATION SELECTOR
   =========================== */
.vehicle-diagram {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  position: relative;
}

.vehicle-front-label {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.vehicle-rear-label {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.vehicle-zone {
  padding: 10px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition-fast);
  background: var(--bg-secondary);
}
.vehicle-zone:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.vehicle-zone.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent); font-weight: 700; }
.vehicle-trunk { grid-column: 1 / -1; }

/* ===========================
   MAP CONTAINER
   =========================== */
#map {
  width: 100%;
  height: 100%;
  z-index: var(--z-map);
}

.leaflet-container {
  background: #1a1f28 !important;
  font-family: var(--font) !important;
}

.custom-marker {
  width: 32px;
  height: 38px;
  position: relative;
}
.marker-pin {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.marker-pin span {
  transform: rotate(45deg);
  color: #000;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  color: var(--text-primary) !important;
}
.leaflet-popup-tip { background: var(--bg-secondary) !important; }
.leaflet-popup-content { color: var(--text-primary) !important; font-family: var(--font) !important; }

/* ===========================
   PROGRESS BAR
   =========================== */
.progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warning));
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-ring {
  transform: rotate(-90deg);
}
.progress-ring-circle {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
}

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: var(--transition);
}
.modal-overlay.active .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  white-space: nowrap;
}
.toast.success { border-color: rgba(34, 197, 94, 0.3); color: var(--success); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); color: var(--error); }
.toast.info { border-color: rgba(59, 130, 246, 0.3); color: var(--info); }
.toast.warning { border-color: rgba(249, 115, 22, 0.3); color: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

/* ===========================
   DIVIDER
   =========================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}
.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===========================
   EMPTY STATE
   =========================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
  gap: 12px;
}
.empty-icon {
  font-size: 3rem;
  opacity: 0.4;
  margin-bottom: 8px;
}
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.empty-subtitle { font-size: 0.875rem; max-width: 280px; }

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  from { background-position: -200% center; }
  to { background-position: 200% center; }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }
.slide-up { animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ===========================
   FLOATING ACTION BUTTON
   =========================== */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #000;
  font-size: 1.5rem;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
  transition: var(--transition);
  z-index: 50;
  border: none;
  cursor: pointer;
}
.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(245, 158, 11, 0.7);
}
.fab:active { transform: scale(0.95); }

/* ===========================
   TIME WINDOW INPUT
   =========================== */
.time-window {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.time-window .form-input {
  width: auto;
  min-width: 0;
  flex: 1;
}
.time-sep {
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ===========================
   ROUTE LIST ITEM (dashboard)
   =========================== */
.route-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.route-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: 4px 0 0 4px;
}
.route-card:hover {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}
.route-card.completed::before { background: var(--success); }
.route-card.in_progress::before { background: var(--info); }

.route-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  border: 1px solid rgba(245, 158, 11, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.route-info { flex: 1; min-width: 0; }
.route-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.route-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 3px; }
.route-stats { display: flex; gap: 12px; margin-top: 6px; }
.route-stat { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

.route-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: var(--transition-fast);
}
.route-card:hover .route-arrow { color: var(--accent); transform: translateX(4px); }

/* ===========================
   NAVIGATION MODE
   =========================== */
.nav-mode {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.nav-stop-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.nav-stop-number {
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 40px rgba(245, 158, 11, 0.4);
}

.nav-address {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.nav-client {
  font-size: 1rem;
  color: var(--text-secondary);
  text-align: center;
}

.package-location-display {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.package-location-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-light);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.time-window-display {
  background: var(--info-light);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--info);
  font-weight: 600;
}

.nav-maps-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.maps-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.maps-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.maps-btn-icon { font-size: 1.4rem; }

.nav-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===========================
   PHOTO CAPTURE
   =========================== */
.photo-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.photo-placeholder {
  width: 100%;
  height: 160px;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-muted);
}
.photo-placeholder:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .btn-lg { padding: 14px 20px; }

  .fab { bottom: 80px; }

  .modal { padding: 20px; border-radius: var(--radius-lg); }
}

/* ===========================
   PLANNER LAYOUT
   =========================== */
.planner-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: calc(100vh - var(--header-h));
  margin-top: var(--header-h);
}

.planner-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-secondary);
}

.planner-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.planner-stops-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planner-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.planner-map-container {
  position: relative;
  overflow: hidden;
}

.optimize-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.route-stats-overlay {
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  gap: 20px;
  align-items: center;
}

.route-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.route-stat-value { font-size: 1rem; font-weight: 800; color: var(--accent); }
.route-stat-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

@media (max-width: 768px) {
  .planner-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 220px 1fr;
  }
  .planner-sidebar {
    border-right: none;
    border-top: 1px solid var(--border);
    order: 2;
  }
  .planner-map-container { order: 1; }
  --sidebar-w: 100%;
}

/* ===========================
   DASHBOARD LAYOUT
   =========================== */
.dashboard-layout {
  margin-top: var(--header-h);
  padding: 24px 16px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  margin-top: calc(var(--header-h) + 0px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.routes-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.routes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===========================
   MISC
   =========================== */
.separator { width: 1px; height: 20px; background: var(--border); }

.kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-success { background: var(--success); box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.dot-error { background: var(--error); box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
.dot-accent { background: var(--accent); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.dot-info { background: var(--info); box-shadow: 0 0 6px rgba(59, 130, 246, 0.5); }

/* Glow text effect */
.glow-text {
  text-shadow: 0 0 20px currentColor;
}

/* Stop expand animation */
.stop-expand-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 14px;
}
.stop-expand-content.open {
  max-height: 400px;
  padding: 0 14px 12px;
}
.stop-expand-inner {
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
