/* ─── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Outfit', 'Inter', system-ui, sans-serif;

  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-pill: 9999px;

  /* Default Theme: Fond clair par défaut (Nami Express) */
  --bg-base:        #F8FAFC;
  --bg-surface:     rgba(255, 255, 255, 0.95);
  --bg-card:        #ffffff;
  --bg-hover:       #f1f5f9;
  --header-bg:      rgba(255, 255, 255, 0.92);
  --border:         #e2e8f0;
  --border-focus:   rgba(37, 99, 235, 0.6);

  --blue-500:       #2563eb;
  --blue-600:       #1d4ed8;
  --blue-400:       #3b82f6;
  --teal-500:       #0d9488;
  --red-400:        #dc2626;
  --amber-400:      #d97706;
  --green-400:      #16a34a;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #64748b;

  --shadow-sm:      0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-card:    0 4px 20px rgba(15, 23, 42, 0.04);
  --shadow-glow:    0 0 20px rgba(37, 99, 235, 0.12);
  --dropzone-bg:    rgba(255, 255, 255, 0.92);
  --dropzone-hover: rgba(37, 99, 235, 0.04);
  --pulse-ring:     rgba(37, 99, 235, 0.12);
}

[data-theme="light"] {
  --bg-base:        #F8FAFC;
  --bg-surface:     rgba(255, 255, 255, 0.95);
  --bg-card:        #ffffff;
  --bg-hover:       #f1f5f9;
  --header-bg:      rgba(255, 255, 255, 0.92);
  --border:         #e2e8f0;
  --border-focus:   rgba(37, 99, 235, 0.6);

  --blue-500:       #2563eb;
  --blue-600:       #1d4ed8;
  --blue-400:       #3b82f6;
  --teal-500:       #0d9488;
  --red-400:        #dc2626;
  --amber-400:      #d97706;
  --green-400:      #16a34a;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #64748b;

  --shadow-sm:      0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-card:    0 4px 20px rgba(15, 23, 42, 0.04);
  --shadow-glow:    0 0 20px rgba(37, 99, 235, 0.12);
  --dropzone-bg:    rgba(255, 255, 255, 0.92);
  --dropzone-hover: rgba(37, 99, 235, 0.04);
  --pulse-ring:     rgba(37, 99, 235, 0.12);
}

[data-theme="dark"] {
  --bg-base:        #0d1117;
  --bg-surface:     #161b22;
  --bg-card:        #1c2230;
  --bg-hover:       #21293a;
  --header-bg:      rgba(13, 17, 23, 0.85);
  --border:         rgba(255, 255, 255, 0.08);
  --border-focus:   rgba(59, 130, 246, 0.6);

  --blue-500:       #3b82f6;
  --blue-600:       #2563eb;
  --blue-400:       #60a5fa;
  --teal-500:       #14b8a6;
  --red-400:        #f87171;
  --amber-400:      #fbbf24;
  --green-400:      #4ade80;

  --text-primary:   #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;

  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-card:    0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow:    0 0 24px rgba(59, 130, 246, 0.25);
  --dropzone-bg:    #161b22;
  --dropzone-hover: rgba(59, 130, 246, 0.08);
  --pulse-ring:     rgba(59, 130, 246, 0.18);
}

/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: clip;
}

/* 1. Fond général clair */
body {
  position: relative;
  background-color: #F8FAFC; /* Fond clair par défaut */
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font-body);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
}

[data-theme="dark"] body {
  background-color: var(--bg-base);
}

/* 2. Carte One Piece en filigrane fixe */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;

  /* Chemin vers votre image de la carte */
  background-image: url('/assets/image_0ca3e1.jpg'); 
  background-position: center center;
  background-repeat: no-repeat;
  
  /* Zoom à 135% pour masquer les bords en cuir foncé de l'image d'origine */
  /* Utilisez 'cover' si vous souhaitez garder le cuir et le rouleau entier */
  background-size: 135% auto; 

  /* --- DONNÉES D'OPACITÉ ET DE CONTRASTE --- */
  opacity: 0.15; /* 15% d'opacité : compromis idéal entre visibilité et sobriété */
  filter: saturate(0.85) contrast(1.05); /* Adoucit légèrement les teintes chaudes */

  /* Estompage sous la colonne centrale (20% de visibilité au centre, 100% sur les côtés) */
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2) 25%, rgba(0, 0, 0, 1) 80%);
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2) 25%, rgba(0, 0, 0, 1) 80%);
}

/* 3. Cartes blanches semi-opaques pour une lisibilité parfaite */
.section-card {
  width: 100%;
  min-width: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
  padding: 16px;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .section-card {
  background-color: rgba(22, 27, 34, 0.92);
  border-color: var(--border);
}
a { color: var(--blue-400); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 24px;
  height: 66px;
  display: flex; align-items: center; gap: 20px;
}
.logo { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo-img {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(249, 115, 22, 0.55);
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.25);
}
.logo-brand-block {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.logo-text {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--text-primary);
}
.logo-nami { color: #f97316; }
.logo-express { color: var(--text-primary); font-style: italic; }
.logo-tagline {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}
.header-nav { display: flex; gap: 4px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.nav-btn svg { width: 16px; height: 16px; }
.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-btn.active { background: var(--bg-card); color: var(--blue-400); box-shadow: inset 0 0 0 1px var(--border-focus); }

/* Header Actions & Theme Toggle */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
}
.theme-toggle-btn:hover {
  background: var(--bg-hover);
  border-color: var(--blue-400);
  transform: translateY(-1px);
}
.theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-icon svg {
  width: 15px;
  height: 15px;
  transition: transform 0.25s ease;
}
.theme-toggle-btn:hover .theme-icon svg {
  transform: rotate(15deg);
}

/* Toggle icon states based on theme */
[data-theme="dark"] .theme-icon.icon-moon,
:root:not([data-theme="light"]) .theme-icon.icon-moon {
  display: none;
}
[data-theme="dark"] .theme-icon.icon-sun,
:root:not([data-theme="light"]) .theme-icon.icon-sun {
  display: inline-flex;
  color: var(--amber-400);
}

[data-theme="light"] .theme-icon.icon-sun {
  display: none;
}
[data-theme="light"] .theme-icon.icon-moon {
  display: inline-flex;
  color: var(--blue-500);
}

.rgpd-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--green-400);
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.2);
  padding: 5px 12px; border-radius: var(--radius-pill); flex-shrink: 0;
  white-space: nowrap; font-weight: 500;
}
.rgpd-badge svg { width: 12px; height: 12px; }

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 14px; }
.view { min-height: calc(100vh - 120px); max-width: 100%; }

/* ─── Section Headers ───────────────────────────────────────────────────────── */
section { padding: 14px 0; border-bottom: none; }
section:last-child { border-bottom: none; }
.section-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.results-section-header { justify-content: space-between; }
.results-title-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.results-header-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; }
.section-header h2 { font-family: var(--font-head); font-size: 18px; font-weight: 700; color: var(--text-primary); }
.step-badge {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  background: linear-gradient(135deg, var(--blue-500), var(--teal-500));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}
.count-badge {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 20px; font-size: 12px; color: var(--text-secondary);
}

/* ─── Config ────────────────────────────────────────────────────────────────── */
.config-section { background: transparent; }
.config-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.config-grid > * { min-width: 0; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px;
  color: var(--text-primary); font-size: 14px; font-family: var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--shadow-glow); }
.field-hint { font-size: 11px; color: var(--text-muted); }

/* ─── Departure Time Controls & Tour Options ────────────────────────────────── */
.preview-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 24px; flex-wrap: wrap;
}
.btn-action-control {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--radius-md);
  cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.btn-action-control:hover {
  background: var(--bg-hover); border-color: var(--blue-400);
  transform: translateY(-1px);
}
.btn-action-control svg {
  width: 15px; height: 15px; color: var(--blue-400);
  flex-shrink: 0; transition: transform 0.25s ease, color 0.2s;
}
.btn-action-control.active {
  background: rgba(59, 130, 246, 0.15); border-color: var(--blue-500);
  color: var(--blue-400); box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}
.btn-action-control.active#btn-fasting-first {
  background: rgba(251, 191, 36, 0.15); border-color: var(--amber-400);
  color: var(--amber-400); box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}
.btn-action-control.active#btn-fasting-first svg {
  color: var(--amber-400);
}
.btn-action-control.active#btn-reverse-route svg {
  transform: rotate(180deg);
}

[data-theme="light"] .btn-action-control {
  background: #ffffff; border-color: #cbd5e1; color: #1e293b;
}
[data-theme="light"] .btn-action-control:hover {
  background: #f8fafc; border-color: var(--blue-500);
}
[data-theme="light"] .btn-action-control.active {
  background: rgba(37, 99, 235, 0.1); border-color: var(--blue-500); color: #1d4ed8;
}
[data-theme="light"] .btn-action-control.active#btn-fasting-first {
  background: rgba(217, 119, 6, 0.1); border-color: #d97706; color: #b45309;
}
[data-theme="light"] .btn-action-control.active#btn-fasting-first svg {
  color: #d97706;
}

.departure-time-control {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); padding: 8px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.departure-time-control label {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
}
.time-input-badge {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--blue-400); font-weight: 700; font-size: 14px;
  padding: 6px 10px; border-radius: var(--radius-sm); outline: none;
  font-family: var(--font-body);
}
.time-input-badge:focus {
  border-color: var(--border-focus); box-shadow: var(--shadow-glow);
}
.mobile-start-control {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-card); padding: 4px 10px; border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.mobile-start-control label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase;
}
.m-time-input {
  background: transparent; border: none; color: var(--blue-400);
  font-size: 13px; font-weight: 700; font-family: var(--font-body);
  cursor: pointer; padding: 0; outline: none;
}

/* ─── Hero Central Dropzone ─────────────────────────────────────────────────── */
.dropzone-hero {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--dropzone-bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.dropzone-hero:hover,
.dropzone-hero.drag-over {
  border-color: var(--blue-500);
  background: var(--dropzone-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.dropzone-icon-pulse {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--pulse-ring);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}
.dropzone-hero:hover .dropzone-icon-pulse,
.dropzone-hero.drag-over .dropzone-icon-pulse {
  transform: scale(1.08);
  background: rgba(59, 130, 246, 0.25);
}
.dropzone-icon svg {
  width: 30px;
  height: 30px;
  color: var(--blue-400);
  transition: transform 0.2s ease;
}
.dropzone-hero:hover .dropzone-icon svg {
  transform: translateY(-2px);
}
.dropzone-text {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.dropzone-subtext {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.dropzone-browse-link {
  color: var(--blue-400);
  font-weight: 600;
  text-decoration: underline;
}
.dropzone-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.file-badge {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.file-badge.csv {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.25);
}
[data-theme="dark"] .file-badge.csv,
:root:not([data-theme="light"]) .file-badge.csv {
  color: #38bdf8;
}
.file-badge.xlsx {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
[data-theme="dark"] .file-badge.xlsx,
:root:not([data-theme="light"]) .file-badge.xlsx {
  color: #34d399;
}
.file-badge.pdf {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
[data-theme="dark"] .file-badge.pdf,
:root:not([data-theme="light"]) .file-badge.pdf {
  color: #f87171;
}
.file-badge-info {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
}

/* Quick Bar below dropzone */
.upload-quick-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 22px 0;
  flex-wrap: wrap;
}

/* ─── Format Accordion (Menu Déroulant) ────────────────────────────────────────── */
.format-accordion {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}
.format-accordion[open] {
  border-color: var(--blue-400);
}
.format-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: var(--bg-surface);
  transition: background 0.15s ease;
}
.format-summary::-webkit-details-marker {
  display: none;
}
.format-summary:hover {
  background: var(--bg-hover);
}
.summary-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.summary-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-400);
  flex-shrink: 0;
}
.summary-icon svg {
  width: 18px;
  height: 18px;
}
.summary-text-group {
  display: flex;
  flex-direction: column;
}
.summary-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.summary-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}
.summary-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.summary-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-400);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.summary-chevron {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: transform 0.25s ease;
}
.summary-chevron svg {
  width: 16px;
  height: 16px;
}
.format-accordion[open] .summary-chevron {
  transform: rotate(180deg);
  color: var(--blue-400);
}
.format-accordion-body {
  padding: 0 20px 20px 20px;
  border-top: 1px solid var(--border);
  animation: accordionFade 0.25s ease;
}
@keyframes accordionFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Data Tables & Badges ──────────────────────────────────────────────────── */
.table-wrapper {
  width: 100%; max-width: 100%; overflow-x: auto;
  -webkit-overflow-scrolling: touch; border-radius: var(--radius-md);
}
.format-table, .data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.format-table th, .data-table th {
  background: var(--bg-hover); color: var(--text-secondary);
  font-weight: 600; text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.format-table td, .data-table td {
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-primary); vertical-align: middle;
}
.format-table tr:last-child td, .data-table tr:last-child td { border-bottom: none; }
.format-table tr:hover td, .data-table tr:hover td { background: var(--bg-hover); }
.badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge.req { background: rgba(59,130,246,0.15); color: var(--blue-400); }
.badge.opt { background: rgba(139,148,158,0.15); color: var(--text-secondary); }
.badge.ajeun { background: rgba(251,191,36,0.15); color: var(--amber-400); }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
  color: white; font-weight: 600; font-size: 14px;
  padding: 11px 22px; border-radius: var(--radius-md);
  border: none; cursor: pointer; transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(59,130,246,0.4);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,0.5); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary svg { width: 16px; height: 16px; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-card); color: var(--text-primary);
  font-weight: 600; font-size: 14px; padding: 11px 22px;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--blue-400); }
.btn-secondary svg { width: 16px; height: 16px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; padding: 8px 14px;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-ghost svg { width: 15px; height: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.desktop-map {
  height: 260px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  z-index: 10;
}

/* ─── Error / Status Panels ─────────────────────────────────────────────────── */
.error-panel {
  background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius-md); padding: 16px; margin-bottom: 20px;
}
.error-panel-header { display: flex; align-items: center; gap: 8px; color: var(--red-400); font-weight: 600; margin-bottom: 10px; }
.error-panel-header svg { width: 18px; height: 18px; flex-shrink: 0; }
.error-panel ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.error-panel li { font-size: 13px; color: #fca5a5; padding-left: 8px; border-left: 2px solid var(--red-400); }
.geocode-error-panel {
  background: rgba(251,191,36,0.06); border: 1px solid rgba(251,191,36,0.25);
  border-radius: var(--radius-md); padding: 16px; margin-top: 20px;
}
.geocode-error-panel h3 { display: flex; align-items: center; gap: 8px; color: var(--amber-400); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.geocode-error-panel h3 svg { width: 16px; height: 16px; }
.geocode-fix-row { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 12px; }
.geocode-fix-row span { color: var(--text-secondary); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.geocode-fix-row input { flex: 1; min-width: 0; min-height: 44px; }
.geocode-fix-row button { padding: 10px 14px; font-size: 13px; min-height: 44px; width: 100%; }
.vroom-error { padding: 0 0 24px; }
.pdf-warn-panel {
  background: rgba(251,191,36,0.07); border: 1px solid rgba(251,191,36,0.28);
  border-radius: var(--radius-md); padding: 16px; margin-bottom: 20px;
}
.pdf-warn-panel ul { list-style: none; display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }

/* ─── Preview & Data Table ──────────────────────────────────────────────────── */
.preview-section, .results-section { background: transparent; }
.preview-actions, .export-actions {
  margin-top: 20px; display: flex; flex-direction: column; align-items: stretch; gap: 10px;
}
.preview-actions > button,
.export-actions > button {
  width: 100%; justify-content: center; min-height: 46px;
}

/* ─── Stats Grid ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px; min-width: 0;
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.stat-value { font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--text-primary); }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Route Cards (Minimalist Calm UI) ─────────────────────────────────────── */
.route-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 24px; overflow: hidden;
  box-shadow: var(--shadow-card);
}
.route-card-header {
  padding: 14px 16px; background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
}
.route-card-header h3 { font-family: var(--font-head); font-size: 15px; font-weight: 700; flex: 1; min-width: 120px; }
.route-meta { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; flex-basis: 100%; }

.traffic-summary-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg-hover); color: var(--text-secondary);
}
.traffic-summary-pill.is-fluid { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.traffic-summary-pill.is-moderate { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.traffic-summary-pill.is-heavy { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
[data-theme="dark"] .traffic-summary-pill.is-fluid { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.3); }
[data-theme="dark"] .traffic-summary-pill.is-moderate { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border-color: rgba(251, 191, 36, 0.3); }
[data-theme="dark"] .traffic-summary-pill.is-heavy { background: rgba(239, 68, 68, 0.14); color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }

.stop-row {
  display: flex; align-items: flex-start; padding: 14px 20px;
  border-bottom: 1px solid var(--border); gap: 14px;
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease;
}
.stop-row:last-child { border-bottom: none; }
.stop-row:hover { background: var(--bg-hover); }
.stop-row.is-done { opacity: 0.65; border-left-color: #0d9488; background: rgba(13, 148, 136, 0.03); }
.stop-row.is-urgent,
.stop-row.is-late { border-left-color: #dc2626; background: rgba(220, 38, 38, 0.03); }

.stop-num {
  width: 26px; height: 26px; border-radius: 50%; margin-top: 1px;
  background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.stop-time-col {
  display: flex; flex-direction: column; min-width: 54px; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.stop-time { font-weight: 700; font-size: 15px; color: var(--blue-600); line-height: 1.25; }
[data-theme="dark"] .stop-time { color: var(--blue-400); }
.stop-time.is-late { color: #b91c1c; }
[data-theme="dark"] .stop-time.is-late { color: #fca5a5; }
.stop-dur { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-top: 2px; }

.stop-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.stop-header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 2px; }
.stop-initials { font-weight: 700; font-size: 14px; color: var(--text-primary); letter-spacing: 0.01em; }
.stop-fullname { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.stop-tags { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.stop-addr { font-size: 13px; color: var(--text-primary); font-weight: 400; line-height: 1.4; overflow-wrap: anywhere; }
.stop-submeta {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px;
  font-size: 12px; color: var(--text-secondary);
}
.stop-access { color: #92400e; }
[data-theme="dark"] .stop-access { color: #fcd34d; }

.tag {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; line-height: 1.2;
  padding: 2px 8px; border-radius: var(--radius-pill);
  border: 1px solid transparent; white-space: nowrap;
}
.tag-priority { background: #fdf2f8; color: #9d174d; border-color: #fbcfe8; }
.tag-danger   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tag-fasting  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.tag-note     { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.tag-done     { background: #f0fdfa; color: #0f766e; border-color: #ccfbf1; }
.tag-neutral  { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.tag-traffic-moderate { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.tag-traffic-heavy    { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

[data-theme="dark"] .tag-priority { background: rgba(219, 39, 119, 0.14); color: #f9a8d4; border-color: rgba(244, 114, 182, 0.28); }
[data-theme="dark"] .tag-danger   { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }
[data-theme="dark"] .tag-fasting,
[data-theme="dark"] .tag-note,
[data-theme="dark"] .tag-traffic-moderate { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border-color: rgba(251, 191, 36, 0.28); }
[data-theme="dark"] .tag-done     { background: rgba(20, 184, 166, 0.15); color: #5eead4; border-color: rgba(45, 212, 191, 0.28); }
[data-theme="dark"] .tag-neutral  { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.25); }
[data-theme="dark"] .tag-traffic-heavy { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }

.stop-links { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
.stop-cancelled-label { font-size: 12px; color: var(--text-muted); font-style: italic; }

/* ─── QR Panel ──────────────────────────────────────────────────────────────── */
.qr-panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; margin-top: 24px;
  text-align: center;
}
.qr-panel h3 { margin-bottom: 20px; font-size: 15px; color: var(--text-secondary); }
.qr-panel canvas { border-radius: var(--radius-md); }
.qr-hint { margin-top: 12px; font-size: 12px; color: var(--text-muted); }

/* ─── Mobile View ───────────────────────────────────────────────────────────── */
.mobile-view { padding: 0; }
.mobile-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 80px 24px; text-align: center;
}
.placeholder-icon svg { width: 64px; height: 64px; color: var(--text-muted); }
.mobile-placeholder h2 { font-family: var(--font-head); font-size: 22px; }
.mobile-placeholder p { color: var(--text-secondary); max-width: 300px; }
.mobile-header {
  padding: 12px 16px; background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.mobile-progress { font-weight: 700; font-size: 15px; }
.mobile-eta { font-size: 13px; color: var(--text-secondary); }
.mobile-map { height: 240px; background: var(--bg-card); border-bottom: 1px solid var(--border); position: relative; }
.mobile-stop-card {
  padding: 20px; background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.stop-info { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.mobile-stop-card .stop-initials {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--teal-500));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 18px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.stop-number-badge {
  position: absolute; /* positioned via JS */ background: var(--blue-500);
  color: white; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; margin-bottom: 12px;
}
.stop-time { font-size: 22px; font-weight: 700; color: var(--blue-500); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .stop-time { color: var(--blue-400); }
.stop-ajeun { font-size: 13px; color: var(--text-secondary); font-weight: 600; margin-top: 2px; }
.mobile-addr-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-right: 6px; vertical-align: middle; }
.stop-traffic-badge {
  display: inline-block; margin-top: 8px; padding: 3px 10px;
  border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
}
.stop-traffic-badge.is-moderate { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.stop-traffic-badge.is-heavy { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
[data-theme="dark"] .stop-traffic-badge.is-moderate { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border-color: rgba(251, 191, 36, 0.28); }
[data-theme="dark"] .stop-traffic-badge.is-heavy { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }

.stop-nav-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.nav-btn-large {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 10px 14px; border-radius: var(--radius-md);
  font-weight: 700; font-size: 14px; text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.nav-btn-large:hover { text-decoration: none; transform: translateY(-1px); }
.nav-btn-large.nav-app-tile {
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .nav-btn-large.nav-app-tile { background: #1c2230; }
.nav-btn-large.nav-app-tile.gmaps:hover { border-color: rgba(37, 99, 235, 0.45); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12); }
.nav-btn-large.nav-app-tile.waze:hover  { border-color: rgba(51, 204, 255, 0.55); box-shadow: 0 4px 12px rgba(5, 180, 220, 0.14); }
.nav-app-logo { height: 32px; width: auto; max-width: 100%; object-fit: contain; display: block; }

.btn-arrive {
  width: 100%; min-height: 50px; padding: 13px 16px; border-radius: var(--radius-md);
  background: #0f766e; border: none; color: #ffffff;
  font-size: 15px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color 0.15s ease;
}
.btn-arrive:hover { background: #115e59; }
.btn-arrive:disabled { opacity: 0.6; cursor: default; }
.btn-arrive svg { width: 18px; height: 18px; }

.mobile-secondary-actions {
  display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px;
}
.btn-secondary-mobile {
  min-height: 46px; padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-secondary-mobile:hover { background: var(--bg-hover); border-color: var(--border-focus); color: var(--text-primary); }

.btn-mobile-util {
  min-width: 44px; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-mobile-util:hover { background: var(--bg-hover); color: var(--text-primary); }

.stops-list { padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.stop-list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--bg-card); border-radius: var(--radius-md);
  border: 1px solid var(--border); transition: opacity 0.25s;
}
.stop-list-item.done { opacity: 0.45; }
.stop-list-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-hover); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.stop-list-num.is-cancelled { background: #64748b; color: #ffffff; }
.stop-list-num.is-urgent { background: #dc2626; color: #ffffff; }
.stop-list-item.active .stop-list-num { background: var(--blue-500); color: white; }
.stop-list-info { flex: 1; }
.stop-list-initials { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.stop-list-initials.is-cancelled { text-decoration: line-through; color: var(--text-muted); }
.stop-list-meta { font-weight: 500; font-size: 12px; color: var(--text-secondary); }
.stop-list-time { font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ─── Loading ───────────────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; background: var(--overlay-bg, rgba(13,17,23,0.85));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.loading-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 40px 56px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  box-shadow: var(--shadow-card);
}
.loading-spinner {
  width: 44px; height: 44px; border: 3px solid var(--border);
  border-top-color: var(--blue-500); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 14px; color: var(--text-secondary); }

/* ─── Light Mode Overrides for Navigation Buttons & Panels ───────────────────── */
[data-theme="light"] .nav-btn-large.nav-app-tile.gmaps,
[data-theme="light"] .nav-btn-large.nav-app-tile.waze {
  background: #ffffff;
  border: 1px solid var(--border);
}
[data-theme="light"] .error-panel li { color: #b91c1c; }

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.app-footer {
  border-top: 1px solid var(--border); padding: 16px 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text-muted); font-size: 12px;
}
[data-theme="dark"] .app-footer {
  background: rgba(13, 17, 23, 0.85);
}
.app-footer .container { display: flex; align-items: center; gap: 8px; }
.app-footer svg { width: 13px; height: 13px; color: var(--green-400); flex-shrink: 0; }

/* ─── Responsive Mobile-First + Breakpoints Standards (sm / md / lg) ────────── */
/* Base Mobile (< 640px, ex. 390x844) */
.header-inner {
  height: auto;
  min-height: 60px;
  padding: 10px 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.logo { min-width: 0; flex: 1 1 auto; gap: 10px; }
.logo-img { width: 38px; height: 38px; }
.logo-text { font-size: 16px; }
.logo-tagline { display: none; }
.theme-toggle-btn { min-height: 44px; padding: 8px 12px; }
.theme-toggle-btn .theme-label { display: none; }
.rgpd-badge { min-height: 44px; padding: 8px 12px; }
.rgpd-badge span { display: none; }
.header-nav {
  order: 3;
  flex: 0 0 100%;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.nav-btn { min-height: 44px; justify-content: center; padding: 8px 10px; font-size: 13px; }
.btn-primary, .btn-secondary, .btn-ghost { min-height: 44px; }
.preview-actions {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
}
.btn-action-control,
.departure-time-control {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}
.departure-time-control { justify-content: space-between; }
.m-time-input { font-size: 16px; min-height: 34px; }
.stop-row { padding: 12px 14px; gap: 10px; }
.btn-cancel-stop { min-width: 44px; min-height: 44px; }
.format-summary { padding: 14px 16px; }
.summary-subtitle { display: none; }
.modal-overlay { padding: 10px; }
.modal-body { padding: 14px; }
.modal-close-btn {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-footer { flex-direction: column-reverse; gap: 8px; }
.modal-footer > button { width: 100%; min-height: 46px; justify-content: center; }

/* sm (>= 640px) : Grands smartphones paysage / petites tablettes */
@media (min-width: 640px) {
  .container { padding: 0 20px; }
  .section-card { padding: 22px; border-radius: 14px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .mobile-secondary-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results-header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: auto;
  }
  .preview-actions, .export-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .preview-actions { justify-content: flex-end; }
  .preview-actions > button,
  .export-actions > button,
  .btn-action-control,
  .departure-time-control { width: auto; }
  .route-card-header { padding: 16px 20px; }
  .route-card-header .route-meta { flex-basis: auto; }
  .geocode-fix-row { flex-direction: row; align-items: center; }
  .geocode-fix-row span { min-width: 180px; }
  .geocode-fix-row button { width: auto; }
  .summary-subtitle { display: block; }
  .modal-overlay { padding: 16px; }
  .modal-body { padding: 20px; }
  .modal-footer { flex-direction: row; }
  .modal-footer > button { width: auto; }
}

/* md (>= 768px) : Tablettes (ex. 768x1024) */
@media (min-width: 768px) {
  .header-inner { flex-wrap: nowrap; height: 66px; padding: 0 20px; gap: 14px; }
  .logo { flex: 0 0 auto; gap: 12px; }
  .logo-img { width: 42px; height: 42px; }
  .logo-text { font-size: 17px; }
  .header-nav {
    order: initial;
    flex: 1;
    width: auto;
    display: flex;
    gap: 4px;
    padding-top: 0;
    border-top: none;
  }
  .nav-btn { justify-content: flex-start; min-height: 40px; padding: 6px 14px; }
  .section-header h2 { font-size: 20px; }
  .config-grid { grid-template-columns: 1.5fr 1fr; gap: 16px; }
  .desktop-map { height: 340px; }
  .stop-row { padding: 14px 20px; gap: 14px; }
}

/* lg (>= 1024px) : Bureau (ex. 1440x900) */
@media (min-width: 1024px) {
  .header-inner { padding: 0 24px; gap: 20px; }
  .container { padding: 0 24px; }
  .section-card { padding: 28px; border-radius: 16px; }
  .logo-img { width: 44px; height: 44px; }
  .logo-text { font-size: 18px; }
  .logo-tagline { display: block; }
  .theme-toggle-btn { padding: 6px 14px; }
  .theme-toggle-btn .theme-label { display: inline; }
  .rgpd-badge { padding: 5px 12px; }
  .rgpd-badge span { display: inline; }
  .config-grid { grid-template-columns: 2fr 1fr; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 32px; }
  .desktop-map { height: 400px; margin-bottom: 24px; }
}

/* ─── File Queue (multi-PDF) ─────────────────────────────────────────────────── */
.file-queue {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  animation: fadeIn 0.3s ease;
}
.file-queue-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.file-queue-header svg { width: 18px; height: 18px; color: var(--blue-400); flex-shrink: 0; }
#file-queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: background 0.2s;
}
.file-queue-item svg { width: 16px; height: 16px; color: var(--blue-400); flex-shrink: 0; }
.fq-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fq-size {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.fq-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 90px;
  text-align: right;
}
.fq-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.fq-remove:hover { color: var(--red-400); background: rgba(248,113,113,0.1); }

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

/* ─── Boutons Urgence en Cours de Tournée ───────────────────────────────────── */
.btn-urgent-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  background: #dc2626;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  border: 1px solid #b91c1c;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.34);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-urgent-add:hover {
  background: #b91c1c;
  border-color: #991b1b;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(185, 28, 28, 0.42);
}
.btn-urgent-add:active {
  transform: translateY(0);
}

.btn-urgent-mobile {
  min-height: 46px;
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #b91c1c;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.3);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-urgent-mobile:hover {
  background: #b91c1c;
  border-color: #991b1b;
}

/* ─── Modal Dialog & Overlay ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card), 0 0 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-title-group h3 {
  margin: 0;
  font-size: 17px;
  font-family: var(--font-head);
  color: var(--text-primary);
}

.modal-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.modal-icon-urgent {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-icon-urgent svg { width: 20px; height: 20px; }

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}
.modal-close-btn:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Relance Box ───────────────────────────────────────────────────────────── */
.urgent-relance-box {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.relance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.relance-hint {
  font-size: 11px;
  background: rgba(14, 165, 233, 0.2);
  color: var(--blue-400);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.relance-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.relance-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-primary);
}

.relance-radio-label input[type="radio"] {
  accent-color: var(--blue-500);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */
.urgent-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.urgent-tab-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.urgent-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.urgent-tab-btn.active {
  background: var(--blue-600);
  color: #ffffff;
  border-color: var(--blue-600);
  font-weight: 600;
}

.urgent-tab-pane {
  display: none;
}
.urgent-tab-pane.active {
  display: block;
}

.urgent-toggles-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 6px;
}

/* Badge patient urgent dans la liste */
.badge-urgent {
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ─── Styles d'Annulation de Passage ───────────────────────────────────────── */
.btn-cancel-mobile {
  min-height: 44px;
  background: transparent;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-cancel-mobile:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}
[data-theme="dark"] .btn-cancel-mobile {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}
[data-theme="dark"] .btn-cancel-mobile:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.55);
}

.btn-cancel-stop {
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stop-row:hover .btn-cancel-stop,
.btn-cancel-stop:focus-visible {
  opacity: 1;
}
.btn-cancel-stop:hover,
.btn-cancel-stop:focus-visible {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}
[data-theme="dark"] .btn-cancel-stop:hover,
[data-theme="dark"] .btn-cancel-stop:focus-visible {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(248, 113, 113, 0.32);
}
@media (hover: none) {
  .btn-cancel-stop {
    opacity: 0.78;
    min-width: 40px;
    min-height: 40px;
  }
}

.badge-cancelled {
  background: #64748b;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.stop-row-cancelled {
  opacity: 0.6;
  background: rgba(100, 116, 139, 0.06) !important;
  border-left: 3px solid #64748b !important;
}
.stop-row-cancelled .stop-initials,
.stop-row-cancelled .stop-fullname,
.stop-row-cancelled .stop-addr {
  text-decoration: line-through;
  color: var(--text-muted);
}

.stop-list-item.cancelled {
  opacity: 0.55;
  background: rgba(100, 116, 139, 0.08);
  border-left: 3px solid #64748b;
}
.stop-list-item.cancelled .stop-list-num {
  background: #64748b !important;
}
.stop-list-item.cancelled .stop-list-initials {
  text-decoration: line-through;
}

/* ─── Accessibilité clavier & Préférence de mouvement réduit ─────────────────── */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

