/* ============================================
   🍞 Bread Delivery Web App — Design System
   Mobile-first / Dark Glassmorphism Theme
   ============================================ */

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

/* ── Root Variables ── */
:root {
  /* Background */
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-strong: rgba(255, 255, 255, 0.1);
  --bg-input: rgba(255, 255, 255, 0.08);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #9a9ab0;
  --text-muted: #6a6a80;
  --text-accent: #fbbf24;

  /* Accent — warm bread tones */
  --accent-amber: #fbbf24;
  --accent-orange: #f97316;
  --accent-warm: linear-gradient(135deg, #fbbf24, #f97316);
  --accent-gold: linear-gradient(135deg, #f59e0b, #d97706);

  /* Status Colors */
  --status-pending: #ef4444;
  --status-pending-bg: rgba(239, 68, 68, 0.15);
  --status-pending-glow: rgba(239, 68, 68, 0.4);

  --status-loading: #eab308;
  --status-loading-bg: rgba(234, 179, 8, 0.15);
  --status-loading-glow: rgba(234, 179, 8, 0.4);

  --status-delivering: #3b82f6;
  --status-delivering-bg: rgba(59, 130, 246, 0.15);
  --status-delivering-glow: rgba(59, 130, 246, 0.4);

  --status-delivered: #22c55e;
  --status-delivered-bg: rgba(34, 197, 94, 0.15);
  --status-delivered-glow: rgba(34, 197, 94, 0.4);

  --status-problem: #6b7280;
  --status-problem-bg: rgba(107, 114, 128, 0.15);
  --status-problem-glow: rgba(107, 114, 128, 0.4);

  /* Borders */
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(251, 191, 36, 0.1);
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.4);

  /* Transition */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Font */
  --font-thai: 'Noto Sans Thai', 'Inter', sans-serif;
  --font-inter: 'Inter', 'Noto Sans Thai', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

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

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(251, 191, 36, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(249, 115, 22, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent-amber); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Navigation ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  padding: var(--space-md);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.navbar-brand .brand-icon {
  font-size: 1.5rem;
}

.navbar-nav {
  display: flex;
  gap: var(--space-xs);
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.navbar-nav::-webkit-scrollbar { display: none; }

.navbar-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  text-decoration: none;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.navbar-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
  text-decoration: none;
}

.navbar-nav a.active {
  color: #0a0a1a;
  background: var(--accent-warm);
  font-weight: 600;
}

/* ── Main Container ── */
.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

/* ── Page Header ── */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--accent-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-value {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--font-inter);
  line-height: 1.2;
}

/* ── Stat Cards Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.stat-total::before { background: var(--accent-warm); }
.stat-card.stat-delivered::before { background: var(--status-delivered); }
.stat-card.stat-pending::before { background: var(--status-pending); }
.stat-card.stat-problem::before { background: var(--status-problem); }

.stat-card.stat-total .card-value { color: var(--accent-amber); }
.stat-card.stat-delivered .card-value { color: var(--status-delivered); }
.stat-card.stat-pending .card-value { color: var(--status-pending); }
.stat-card.stat-problem .card-value { color: var(--status-problem); }

.stat-card .stat-icon {
  font-size: 2rem;
  opacity: 0.3;
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
}

/* ── Progress Bar ── */
.progress-section {
  margin-bottom: var(--space-xl);
}

.progress-section .section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.progress-bar-container {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  height: 28px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #22c55e, #16a34a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  min-width: 40px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Multi-color progress bar */
.progress-multi {
  display: flex;
  height: 100%;
  width: 100%;
}

.progress-multi .progress-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.progress-segment.seg-delivered { background: var(--status-delivered); }
.progress-segment.seg-delivering { background: var(--status-delivering); }
.progress-segment.seg-loading { background: var(--status-loading); }
.progress-segment.seg-pending { background: var(--status-pending); }
.progress-segment.seg-problem { background: var(--status-problem); }

/* ── Section Grid ── */
.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  .section-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .section-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Area Card ── */
.area-card {
  padding: var(--space-lg);
}

.area-card .area-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.area-card .area-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.area-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-inter);
}

.area-stat-badge.badge-delivered {
  background: var(--status-delivered-bg);
  color: var(--status-delivered);
}
.area-stat-badge.badge-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
}
.area-stat-badge.badge-delivering {
  background: var(--status-delivering-bg);
  color: var(--status-delivering);
}
.area-stat-badge.badge-loading {
  background: var(--status-loading-bg);
  color: var(--status-loading);
}
.area-stat-badge.badge-problem {
  background: var(--status-problem-bg);
  color: var(--status-problem);
}

/* ── Bread Type Bar ── */
.bread-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-glass);
}

.bread-item:last-child {
  border-bottom: none;
}

.bread-info {
  flex: 1;
  min-width: 0;
}

.bread-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bread-occasion {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bread-bar-wrapper {
  flex: 2;
  min-width: 0;
}

.bread-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bread-bar-fill {
  height: 100%;
  background: var(--accent-warm);
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

.bread-qty {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
  font-family: var(--font-inter);
}

/* ── Status Badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-badge.status-pending {
  background: var(--status-pending-bg);
  color: var(--status-pending);
}
.status-badge.status-pending .status-dot { background: var(--status-pending); }

.status-badge.status-loading {
  background: var(--status-loading-bg);
  color: var(--status-loading);
}
.status-badge.status-loading .status-dot { background: var(--status-loading); }

.status-badge.status-delivering {
  background: var(--status-delivering-bg);
  color: var(--status-delivering);
}
.status-badge.status-delivering .status-dot { background: var(--status-delivering); }

.status-badge.status-delivered {
  background: var(--status-delivered-bg);
  color: var(--status-delivered);
}
.status-badge.status-delivered .status-dot {
  background: var(--status-delivered);
  animation: none;
}

.status-badge.status-problem {
  background: var(--status-problem-bg);
  color: var(--status-problem);
}
.status-badge.status-problem .status-dot { background: var(--status-problem); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-base);
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent-warm);
  color: #0a0a1a;
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(251, 191, 36, 0.5);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
  box-shadow: 0 6px 24px rgba(34, 197, 94, 0.5);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.5);
  transform: translateY(-2px);
}

.btn-danger:active {
  transform: translateY(0);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
}

.btn-block {
  width: 100%;
}

/* ── Filters / Controls ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
}

.filter-bar .filter-group {
  flex: 1;
  min-width: 140px;
}

.filter-bar label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.filter-bar select,
.filter-bar input[type="text"],
.filter-bar input[type="search"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: border-color var(--transition-fast);
  appearance: auto;
}

.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

/* ── Table ── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead {
  background: rgba(255, 255, 255, 0.04);
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.data-table th.sortable:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.sort-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.4;
  margin-left: 4px;
  transition: all var(--transition-fast);
  display: inline-block;
}

.data-table th.sortable:hover .sort-icon {
  opacity: 0.7;
}

.sort-icon.active {
  opacity: 1;
  color: var(--accent-amber);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .cell-area {
  font-weight: 500;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .cell-position {
  font-family: var(--font-inter);
  font-weight: 600;
  color: var(--accent-amber);
}

.data-table .cell-qty {
  font-family: var(--font-inter);
  font-weight: 700;
  text-align: right;
}

/* ── Mobile Card View (for list page on small screens) ── */
.mobile-cards {
  display: none;
}

@media (max-width: 767px) {
  .table-wrapper {
    display: none;
  }
  
  .mobile-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    backdrop-filter: blur(16px);
    transition: all var(--transition-base);
  }
  
  .mobile-card:active {
    background: var(--bg-card-hover);
  }
  
  .mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
  }
  
  .mobile-card-header .mc-position {
    font-family: var(--font-inter);
    font-weight: 700;
    color: var(--accent-amber);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .mc-id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    background: var(--accent-warm);
    color: #0a0a1a;
    font-family: var(--font-inter);
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: var(--radius-full);
    flex-shrink: 0;
  }
  
  .mobile-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    font-size: 0.85rem;
  }
  
  .mobile-card-body .mc-label {
    color: var(--text-muted);
    font-size: 0.75rem;
  }
  
  .mobile-card-body .mc-value {
    font-weight: 500;
  }
  
  .mobile-card-footer {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-glass);
  }
  
  .mobile-card-footer .btn {
    flex: 1;
  }
  
  /* GPS Navigation Bar */
  .mc-gps-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: var(--space-md);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    text-decoration: none;
    transition: all var(--transition-base);
    cursor: pointer;
  }
  
  .mc-gps-bar:not(.mc-gps-none):hover,
  .mc-gps-bar:not(.mc-gps-none):active {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    transform: scale(1.01);
    text-decoration: none;
  }
  
  .mc-gps-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
  }
  
  .mc-gps-text {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--status-delivered);
  }
  
  .mc-gps-arrow {
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--status-delivered);
    flex-shrink: 0;
  }
  
  .mc-gps-bar.mc-gps-none {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-glass);
    cursor: default;
  }
}

/* ── Select Status Dropdown ── */
.status-select {
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  appearance: auto;
}

.status-select:focus {
  outline: none;
  border-color: var(--accent-amber);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-elevated);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-glass-strong);
}

.modal .form-group {
  margin-bottom: var(--space-md);
}

.modal .form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast);
}

.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

.modal .form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.modal-actions .btn {
  flex: 1;
}

/* ── GPS Page ── */
.gps-card {
  text-align: center;
  padding: var(--space-2xl);
}

.gps-card .gps-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  display: block;
  animation: bounce-pin 2s infinite;
}

@keyframes bounce-pin {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.gps-card p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.gps-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.gps-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.gps-item:hover {
  background: var(--bg-card-hover);
}

.gps-item .gps-point-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.gps-item .gps-point-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.gps-item .gps-point-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.gps-item .gps-coords {
  font-family: var(--font-inter);
  font-size: 0.75rem;
  color: var(--status-delivered);
  margin-top: 2px;
}

.gps-item .gps-actions {
  display: flex;
  gap: var(--space-xs);
}

/* GPS has/no indicator */
.gps-has { color: var(--status-delivered); }
.gps-none { color: var(--text-muted); }

/* ── Toast / Notification ── */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 260px;
  animation: toast-in 0.3s ease;
}

.toast.toast-success { border-left: 4px solid var(--status-delivered); }
.toast.toast-error { border-left: 4px solid var(--status-pending); }
.toast.toast-info { border-left: 4px solid var(--status-delivering); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-exit {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ── Loading Spinner ── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-glass);
  border-top: 3px solid var(--accent-amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--space-xl) auto;
}

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

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
  gap: var(--space-md);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  display: block;
}

/* ── Count Badge ── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-inter);
  background: var(--accent-warm);
  color: #0a0a1a;
}

/* ── Refresh Indicator ── */
.refresh-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.refresh-indicator .refresh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-delivered);
  animation: pulse-dot 2s infinite;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .navbar-brand span:not(.brand-icon) {
    display: none;
  }
  
  .page-header h1 {
    font-size: 1.4rem;
  }
  
  .container {
    padding: var(--space-md) var(--space-sm);
  }
  
  .card {
    padding: var(--space-md);
  }
  
  .card-value {
    font-size: 2rem;
  }
  
  .stats-grid {
    gap: var(--space-sm);
  }
}

@media (max-width: 767px) {
  .filter-bar {
    flex-direction: column;
  }
  
  .filter-bar .filter-group {
    min-width: 100%;
  }
}

/* ── Fade-in animation ── */
.fade-in {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Photo Capture ── */
.photo-capture-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  border: 2px dashed rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-lg);
  background: rgba(251, 191, 36, 0.03);
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 200px;
}

.photo-capture-area:hover {
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(251, 191, 36, 0.06);
}

.photo-capture-area:active {
  transform: scale(0.98);
}

.photo-capture-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-md);
  animation: bounce-pin 2s infinite;
}

.photo-capture-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-amber);
  margin-bottom: var(--space-xs);
}

.photo-capture-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.photo-preview-wrapper {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--status-delivered);
  background: rgba(34, 197, 94, 0.05);
  position: relative;
}

.photo-preview-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 400px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.3);
}

.photo-preview-wrapper::after {
  content: '✅';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Bread Rows (Add Modal) ── */
.bread-rows-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
}

.bread-rows-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bread-rows-header label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.bread-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  animation: fadeSlideUp 0.2s ease;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bread-row-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-warm);
  color: #0a0a1a;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 50%;
  flex-shrink: 0;
  font-family: var(--font-inter);
}

.bread-row-fields {
  flex: 1;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.bread-row-fields select {
  flex: 2;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  appearance: auto;
  min-width: 0;
}

.bread-row-fields input {
  flex: 0.8;
  min-width: 70px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  font-family: var(--font-inter);
}

.bread-row-fields select:focus,
.bread-row-fields input:focus {
  outline: none;
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.15);
}

.bread-row-remove {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.bread-row-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

@media (max-width: 480px) {
  .bread-row-fields {
    flex-direction: column;
    gap: 6px;
  }
  .bread-row-fields input {
    text-align: left;
  }
}
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-inter); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.hidden { display: none !important; }
