/* ==========================================================================
   SUPER TUNDRA - DESIGN SYSTEM & STYLESHEET
   Palette Glaciale, Glassmorphism, Responsive Mobile & Ergonomie Premium
   ========================================================================== */

:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #38bdf8;
  --primary-glow: rgba(2, 132, 199, 0.25);
  
  --ice-bg: #f0f9ff;
  --ice-card: #ffffff;
  --ice-border: #e0f2fe;
  
  --dark-navy: #091224;
  --sidebar-navy: #0f172a;
  --card-dark: #1e293b;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;
  
  --green-active: #10b981;
  --green-glow: rgba(16, 185, 129, 0.2);
  --amber-prospect: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.2);
  --red-danger: #ef4444;
  --purple-accent: #8b5cf6;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 25px -5px rgba(2, 132, 199, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 35px -10px rgba(9, 18, 36, 0.12);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8fafc;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   LAYOUT : SIDEBAR & MAIN CONTAINER
   -------------------------------------------------------------------------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #0b1329 0%, #070d1d 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.brand-logo-icon svg {
  width: 26px;
  height: 26px;
  color: #ffffff;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  line-height: 1.1;
}

.brand-text span {
  font-size: 0.72rem;
  color: var(--primary-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-menu {
  list-style: none;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 12px 12px 6px 12px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-item a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(4px);
}

.nav-item.active a {
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.25) 0%, rgba(2, 132, 199, 0.05) 100%);
  color: #38bdf8;
  border-left: 3px solid #38bdf8;
  font-weight: 600;
}

.nav-item a svg {
  width: 20px;
  height: 20px;
}

.sidebar-user {
  padding: 18px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-badge-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
}

.user-details h4 {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 600;
}

.user-details span {
  font-size: 0.72rem;
  color: #38bdf8;
}

/* --------------------------------------------------------------------------
   TOPBAR & CONTENUS
   -------------------------------------------------------------------------- */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: #ffffff;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 900;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.role-switcher-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ice-bg);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--ice-border);
}

.role-switcher-banner label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.role-select-box {
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--dark-navy);
  font-weight: 600;
  cursor: pointer;
}

.content-body {
  padding: 30px;
  flex-grow: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* --------------------------------------------------------------------------
   CARDS & GRIDS
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.stat-card.stat-green::before { background: var(--green-active); }
.stat-card.stat-amber::before { background: var(--amber-prospect); }
.stat-card.stat-purple::before { background: var(--purple-accent); }
.stat-card.stat-red::before { background: var(--red-danger); }

.stat-info h5 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-info .stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-info .stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.stat-icon-wrapper {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--ice-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-green .stat-icon-wrapper { background: #ecfdf5; color: var(--green-active); }
.stat-amber .stat-icon-wrapper { background: #fffbeb; color: var(--amber-prospect); }
.stat-purple .stat-icon-wrapper { background: #f5f3ff; color: var(--purple-accent); }
.stat-red .stat-icon-wrapper { background: #fef2f2; color: var(--red-danger); }

/* --------------------------------------------------------------------------
   PANELS & TABLES
   -------------------------------------------------------------------------- */
.panel {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
  overflow: hidden;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.panel-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark-navy);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-body {
  padding: 24px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.tundra-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.tundra-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
}

.tundra-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
  color: #1e293b;
  vertical-align: middle;
}

.tundra-table tr:hover td {
  background: #f8fbff;
}

/* --------------------------------------------------------------------------
   BADGES (PROSPECT VS CLIENT VERT)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-green-active {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  box-shadow: 0 0 10px var(--green-glow);
}

.badge-green-active::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse-green 1.8s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.badge-amber-prospect {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-category {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 600;
}

.badge-fifo {
  background: #312e81;
  color: #e0e7ff;
  font-weight: 800;
  font-family: monospace;
}

/* --------------------------------------------------------------------------
   BOUTONS & FORMULAIRES
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

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

.btn-outline {
  background: #ffffff;
  color: var(--primary-dark);
  border: 1px solid #cbd5e1;
}

.btn-outline:hover {
  background: var(--ice-bg);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.form-control:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

button[type="submit"].btn {
  border: none;
}

/* Petit indicateur de rotation dans les boutons (capture GPS en cours) */
.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 4px;
}

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

/* Bouton de capture de position automatique */
.btn-auto-location {
  background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 14px -4px rgba(2, 132, 199, 0.6);
  font-weight: 700;
}

.btn-auto-location:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -4px rgba(2, 132, 199, 0.7);
}

.btn-auto-location:disabled {
  opacity: 0.75;
  cursor: wait;
  transform: none;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: #0f172a;
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* --------------------------------------------------------------------------
   MAP & GEOLOCATION
   -------------------------------------------------------------------------- */

.gps-live-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.gps-live-coords {
  font-family: monospace;
  font-weight: 700;
  color: #065f46;
  font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   PROGRESS BARS (Objectif 25/jour & Fin de mois)
   -------------------------------------------------------------------------- */
.quota-progress-container {
  background: #f1f5f9;
  border-radius: var(--radius-full);
  height: 14px;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.quota-progress-fill {
  background: linear-gradient(90deg, #38bdf8 0%, #10b981 100%);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   STUDIO DESIGN BOUTEILLE 600ML & LOTERIE
   -------------------------------------------------------------------------- */
.bottle-canvas-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #ffffff 0%, #e0f2fe 100%);
  border-radius: var(--radius-md);
  padding: 30px;
  border: 1px solid #bae6fd;
  min-height: 400px;
}

.lottery-slot-box {
  background: linear-gradient(135deg, #091224 0%, #1e1b4b 100%);
  border: 2px solid #fbbf24;
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  color: #fff;
  box-shadow: 0 10px 30px rgba(251, 191, 36, 0.25);
}

.lottery-number-display {
  font-family: monospace;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 4px;
  background: rgba(0,0,0,0.5);
  border: 2px dashed #fbbf24;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  color: #fde047;
  margin: 20px 0;
}

/* --------------------------------------------------------------------------
   MAPLIBRE GL : CARTES, MARQUEURS, POPUPS & BARRE DE FILTRES
   (Tuiles vectorielles OpenFreeMap - gratuites, sans clé API)
   -------------------------------------------------------------------------- */
#pdv-map {
  height: 460px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.pdv-explorer-map {
  height: 460px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

/* Barre de filtres au-dessus de la carte */
.map-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px dashed #e2e8f0;
}

.map-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.map-chip {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.18s ease;
}

.map-chip:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.map-chip.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary-dark);
  color: #ffffff;
  box-shadow: 0 3px 10px -2px var(--primary-glow);
}

.map-chip.chip-green.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  box-shadow: 0 3px 10px -2px var(--green-glow);
}

.map-chip.chip-amber.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: #d97706;
  box-shadow: 0 3px 10px -2px var(--amber-glow);
}

.map-chip.chip-dormant.active {
  background: linear-gradient(135deg, #f472b6 0%, #be185d 100%);
  border-color: #be185d;
  box-shadow: 0 3px 10px -2px rgba(244, 114, 182, 0.55);
}

.map-filter-select {
  width: auto;
  min-width: 180px;
  padding: 6px 10px !important;
  font-size: 0.8rem !important;
}

.map-filter-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  padding: 6px 12px !important;
  font-size: 0.8rem !important;
}

/* Légende sous la carte */
.map-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 8px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: #475569;
  font-weight: 600;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.dot-green { background: var(--green-active); }
.dot-amber { background: var(--amber-prospect); }
.dot-dormant { background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%); }

.legend-hint { color: #94a3b8; font-weight: 500; font-size: 0.72rem; margin-left: auto; }

/* Bannière dormance dans la popup PDV */
.pdv-card-dormant-banner {
  background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
  border-bottom: 1px solid #fbcfe8;
  color: #be185d;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 12px;
  text-align: center;
}

/* ============================================================
   TOURNÉE OPTIMISÉE DU JOUR
   ============================================================ */

/* Épingle numérotée d'arrêt */
.tour-stop-marker {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 2.5px solid #ffffff;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px -2px rgba(2, 132, 199, 0.55);
  cursor: pointer;
}

.tour-stop-marker.is-dormant {
  background: linear-gradient(135deg, #f472b6 0%, #be185d 100%);
  box-shadow: 0 4px 12px -2px rgba(190, 24, 93, 0.55);
}

.tour-stop-marker.is-start {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  font-size: 0.95rem;
  box-shadow: 0 4px 12px -2px rgba(5, 150, 105, 0.55);
}

/* Sélecteur de fond de carte (Liberty / Bright / Positron) */
.map-style-switcher {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-style-btn {
  border: none;
  background: transparent;
  font-size: 0.62rem;
  font-weight: 700;
  color: #475569;
  padding: 5px 9px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.map-style-btn:hover { background: #f1f5f9; }

.map-style-btn.active {
  background: var(--primary, #0369a1);
  color: #ffffff;
}

/* Checklist des arrêts */
.tour-stops-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tour-stop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  font-size: 0.8rem;
}

.tour-stop-item:hover { background: #f8fafc; border-color: #cbd5e1; }

.tour-stop-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--primary, #0369a1);
}

.tour-stop-name {
  flex: 1;
  font-weight: 600;
  color: var(--dark-navy, #0f172a);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tour-stop-name small {
  display: block;
  font-weight: 500;
  color: #64748b;
  font-size: 0.68rem;
}

/* Badges de statut de la tournée */
.tour-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tour-badge.active { background: #dcfce7; color: #059669; }
.tour-badge.prospect { background: #fef3c7; color: #d97706; }
.tour-badge.dormant { background: #fce7f3; color: #be185d; }

/* Liste ordonnée des arrêts après optimisation */
.tour-order { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }

.tour-order-header {
  font-size: 0.78rem;
  font-weight: 800;
  color: #059669;
  padding: 2px 0;
}

.tour-order-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
}

.tour-order-rank {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.tour-order-info strong {
  display: block;
  font-size: 0.84rem;
  color: var(--dark-navy, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tour-order-info small { font-size: 0.7rem; color: #64748b; }

/* ============================================================
   ONGLETS DE TABLEAU DE BORD (par rôle) + PAGINATION
   ============================================================ */

.st-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 8px;
  z-index: 40;
}

.st-tab-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.st-tab-btn:hover { background: #f1f5f9; color: #0f172a; }

.st-tab-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 3px 8px -2px rgba(3, 105, 161, 0.45);
}

.st-tab-btn .st-tab-count {
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  padding: 1px 7px;
  border-radius: 10px;
}

.st-tab-btn:not(.active) .st-tab-count { background: #e2e8f0; color: #475569; }

.st-tab-panel { display: none; }

.st-tab-panel.active { display: block; animation: st-tab-fade 0.18s ease; }

@keyframes st-tab-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Pagination intégrée sous les tables */
.st-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 15px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.st-pager-info { font-size: 0.78rem; color: #64748b; font-weight: 600; }

.st-pager-controls { display: flex; align-items: center; gap: 6px; }

.st-pager-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.st-pager-btn:hover:not(:disabled) { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }

.st-pager-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.st-pager-page {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary-dark, #075985);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 5px 11px;
  cursor: pointer;
}

.st-pager-page.current { background: var(--primary, #0369a1); color: #fff; border-color: var(--primary, #0369a1); cursor: default; }

@media (max-width: 900px) {
  .st-tabs { top: 0; border-radius: 10px; }
  .st-tab-btn { font-size: 0.76rem; padding: 8px 12px; }
}

/* Épingles personnalisées des PDV (vert = actif / ambre = prospect) */
.pdv-marker {
  position: relative;
  cursor: pointer;
  width: 38px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pdv-marker-pin {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 2;
}

.pdv-marker-pin b {
  font-weight: 900;
  font-size: 0.85rem;
  line-height: 1;
}

.pdv-marker-pin > * { transform: rotate(45deg); }

.pdv-marker.is-active .pdv-marker-pin {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  color: #ffffff;
}

.pdv-marker.is-prospect .pdv-marker-pin {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #ffffff;
}

/* PDV dormant : épingle grise, halo rose pâle discret */
.pdv-marker.is-dormant .pdv-marker-pin {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  color: #ffffff;
  opacity: 0.92;
}

.pdv-marker.is-dormant .pdv-marker-pulse {
  background: rgba(244, 114, 182, 0.35);
  animation: marker-pulse 3.2s ease-out infinite;
}

.pdv-marker-tip {
  width: 2px;
  height: 10px;
  margin-top: -2px;
  background: rgba(255, 255, 255, 0);
  z-index: 1;
}

.pdv-marker-pulse {
  position: absolute;
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  z-index: 0;
}

.pdv-marker.is-active .pdv-marker-pulse {
  background: rgba(16, 185, 129, 0.35);
  animation: marker-pulse 2s ease-out infinite;
}

.pdv-marker.is-prospect .pdv-marker-pulse {
  background: rgba(245, 158, 11, 0.3);
  animation: marker-pulse 2.6s ease-out infinite;
}

@keyframes marker-pulse {
  0%   { transform: translateX(-50%) scale(0.8); opacity: 0.8; }
  70%  { transform: translateX(-50%) scale(2.1); opacity: 0; }
  100% { transform: translateX(-50%) scale(2.1); opacity: 0; }
}

.pdv-marker:hover .pdv-marker-pin {
  transform: rotate(-45deg) scale(1.18);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.45);
}

/* Épingle de sélection (formulaire de création) */
.pdv-picker-pin {
  position: relative;
  width: 40px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
}

.pdv-picker-pin:active { cursor: grabbing; }

.pdv-picker-pin-head {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  z-index: 2;
}

.pdv-picker-pin-head svg {
  width: 18px;
  height: 18px;
}

.pdv-picker-pin-shadow {
  width: 14px;
  height: 5px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.35);
  margin-top: 2px;
  filter: blur(1px);
}

/* Carte de sélection dans le formulaire */
.pdv-location-map {
  height: 340px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  z-index: 10;
}

/* Recherche d'adresse + liste de résultats */
.map-search-wrapper {
  position: relative;
  margin-bottom: 10px;
}

.map-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px -6px rgba(15, 23, 42, 0.25);
  z-index: 60;
  max-height: 240px;
  overflow-y: auto;
}

.map-search-item {
  padding: 9px 14px;
  font-size: 0.8rem;
  color: #334155;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.map-search-item:last-child { border-bottom: none; }
.map-search-item:hover { background: var(--ice-bg); color: var(--primary-dark); }
.map-search-item.muted { color: #94a3b8; cursor: default; }
.map-search-item.muted:hover { background: transparent; }

/* Puces de coordonnées */
.coord-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-family: monospace;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-full);
}

/* Popups MapLibre (carte PDV riche) */
.maplibregl-popup-content {
  padding: 0 !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  box-shadow: 0 18px 40px -8px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.06) !important;
}

/* Filet de sécurité : si la carte est trop petite, la popup défile au lieu d'être coupée/collée en bas */
.maplibregl-popup-content {
  max-height: min(68vh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ============================================================
   FICHE PDV FLOTTANTE FIXE (remplace la popup ancrée MapLibre)
   Position absolue dans le conteneur de la carte : le zoom et
   le déplacement n'ont AUCUN effet. Hauteur flexible + scroll.
   ============================================================ */

.pdv-flyout {
  position: absolute;
  top: 14px;
  left: 14px;
  width: min(320px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 25;
  border-radius: 16px;
  box-shadow: 0 24px 48px -16px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.pdv-flyout.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.pdv-flyout-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pdv-flyout-close:hover { background: rgba(15, 23, 42, 0.92); }

/* La fiche interne n'a plus besoin de sa propre ombre (portée par le conteneur) */
.pdv-flyout .pdv-card-popup {
  border-radius: 16px;
  box-shadow: none;
}

/* Mobile : la fiche devient un panneau bas plein largeur (pouce accessible) */
@media (max-width: 620px) {
  .pdv-flyout {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 62%;
    border-radius: 18px 18px 0 0;
  }
  .pdv-flyout .pdv-card-popup { border-radius: 18px 18px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pdv-flyout { transition: none; }
}

/* ============================================================
   ALERTES TEMPS RÉEL — pile de toasts (rupture, grosse commande, rebut)
   ============================================================ */

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--frost-line, #e8eef6);
  border-left: 4px solid #94a3b8;
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: 0 18px 40px -18px rgba(15, 23, 42, 0.4);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast-item.open { opacity: 1; transform: none; }

.toast-item.level-danger { border-left-color: #dc2626; }
.toast-item.level-warning { border-left-color: #d97706; }
.toast-item.level-info { border-left-color: #0284c7; }

.toast-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.toast-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
  color: #0f172a;
}

.level-danger .toast-title { color: #b91c1c; }
.level-warning .toast-title { color: #b45309; }

.toast-msg { font-size: 0.78rem; color: #475569; line-height: 1.45; }

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

.toast-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: #eff6ff;
  color: #0369a1;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.15s ease;
}

.toast-link:hover { background: #dbeafe; }

.toast-close {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
  width: 22px; height: 22px;
  border-radius: 6px;
}

.toast-close:hover { background: #f1f5f9; color: #475569; }

@media (max-width: 620px) {
  .toast-stack { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .toast-item { transition: opacity 0.2s ease; transform: none; }
}

.maplibregl-popup-close-button {
  width: 26px;
  height: 26px;
  font-size: 1rem;
  line-height: 26px;
  color: #ffffff;
  z-index: 5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  padding: 0;
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: #ffffff !important;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: #ffffff !important;
}

/* Contrôles MapLibre harmonisés avec le thème */
.maplibregl-ctrl-group {
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
  box-shadow: 0 4px 14px -4px rgba(15, 23, 42, 0.25) !important;
}

.maplibregl-ctrl-scale {
  border-radius: 4px;
  font-size: 0.7rem !important;
  color: #475569 !important;
}

@media (max-width: 992px) {
  #pdv-map,
  .pdv-explorer-map { height: 360px; }
  .pdv-location-map { height: 280px; }
  .legend-hint { display: none; }
}

.pdv-card-popup {
  background: #ffffff;
  border-radius: var(--radius-md);
  overflow: hidden;
  font-family: var(--font-body);
}

.pdv-card-photo-wrapper {
  position: relative;
  width: 100%;
  height: 92px;
  background: #0f172a;
  overflow: hidden;
}

.pdv-card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdv-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.pdv-card-badge.green {
  background: #10b981;
  color: #ffffff;
}

.pdv-card-badge.orange {
  background: #f59e0b;
  color: #ffffff;
}

.pdv-card-body {
  padding: 10px 12px;
}

.pdv-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 2px;
  line-height: 1.2;
}

.pdv-card-category {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

.pdv-card-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #475569;
  margin-bottom: 4px;
}

.pdv-card-rep-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 10px;
  margin: 8px 0;
  font-size: 0.75rem;
  color: #166534;
}

.pdv-card-action-btn {
  display: block;
  text-align: center;
  background: var(--primary);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  transition: all 0.2s ease;
}

.pdv-card-action-btn:hover {
  background: var(--primary-dark);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   RESPONSIVE MOBILE
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    left: -280px;
    height: 100vh;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .content-body {
    padding: 16px;
  }
  
  .topbar {
    padding: 0 16px;
  }
}

/* --------------------------------------------------------------------------
    MENU MOBILE (HAMBURGER) & OVERLAY
    -------------------------------------------------------------------------- */
.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: background 0.2s ease;
}

.mobile-menu-toggle:hover {
  background: #e2e8f0;
}

.mobile-menu-toggle svg {
  width: 20px;
  height: 20px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9, 18, 36, 0.55);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* --------------------------------------------------------------------------
    ANIMATIONS & POLISH GLOBAL
    -------------------------------------------------------------------------- */
@keyframes content-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.content-body > * {
  animation: content-fade-in 0.35s ease both;
}

.content-body > *:nth-child(2) { animation-delay: 0.04s; }
.content-body > *:nth-child(3) { animation-delay: 0.08s; }
.content-body > *:nth-child(4) { animation-delay: 0.12s; }

/* Barre de défilement discrète (sidebar & modals) */
.sidebar::-webkit-scrollbar,
.panel-body::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
.panel-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: var(--radius-full);
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

/* En-têtes de tableau collants dans les longues listes */
.tundra-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Lien de focus clavier visible */
a:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
  border-radius: 4px;
}

.btn:focus-visible,
.form-control:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
    RESPONSIVE : AFFINAGES MOBILE
    -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .mobile-menu-toggle {
    display: inline-flex;
  }

  .db-status-pill {
    display: none !important;
  }

  .logout-label {
    display: none;
  }

  .content-body div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-info .stat-value {
    font-size: 1.35rem;
  }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: 60px;
  }

  .tundra-table th,
  .tundra-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }
}

/* ============================================================
   GRILLES RESPONSIVES (classes utilitaires, mobile-first friendly)
   ============================================================ */

/* Deux colonnes égales — se replie naturellement (auto-fit) */
.grid-eq {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

/* Contenu principal + panneau latéral (2fr / 1fr) */
.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 25px;
  margin-bottom: 30px;
}

/* Analyse : graphique large + widget (1.2fr / 1fr) */
.grid-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 25px;
  margin-bottom: 30px;
}

/* Panneau latéral à gauche (1fr / 2fr) */
.grid-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 25px;
  margin-bottom: 30px;
}

/* Tournée optimisée : checklist 360px + carte fluide */
.tour-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
}

.tour-col-side {
  border-right: 2px solid #e2e8f0;
  padding: 14px 15px;
}

/* Formulaire de mouvement d'intrant (6 champs en ligne) */
.grid-mv {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 2fr auto;
  gap: 10px;
  align-items: end;
}

/* Ruptures responsive : tablette */
@media (max-width: 1100px) {
  .grid-hero,
  .grid-main,
  .grid-side {
    grid-template-columns: 1fr;
  }

  .tour-grid {
    grid-template-columns: 1fr;
  }

  .tour-grid > .tour-col-side {
    border-right: none;
    border-bottom: 2px solid #e2e8f0;
  }

  .grid-mv {
    grid-template-columns: 1fr 1fr;
  }
}

/* Rupture mobile */
@media (max-width: 620px) {
  .tour-grid,
  .grid-eq {
    grid-template-columns: 1fr;
  }

  .grid-mv {
    grid-template-columns: 1fr;
  }

  /* Onglets défilables horizontalement plutôt qu'écrasés */
  .st-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .st-tab-btn {
    flex-shrink: 0;
  }

  .pdv-explorer-map,
  #tour-map {
    height: 300px !important;
  }

  .tour-stop-item {
    padding: 8px;
  }
}

/* Mise en évidence du formulaire ciblé (après clic sur « Commander ») */
@keyframes st-glow {
  0% { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.75); }
  100% { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0); }
}

.st-highlight {
  animation: st-glow 1.6s ease-out 2;
}

@media (prefers-reduced-motion: reduce) {
  .st-highlight { animation: none; }
  .st-tab-panel.active { animation: none; }
}

/* ============================================================
   POLISH DISCIPLINÉ (accessibilité + hiérarchie visuelle)
   ============================================================ */

/* Focus clavier visible partout, cohérent avec la charte */
.btn:focus-visible,
.form-control:focus-visible,
.st-tab-btn:focus-visible,
.map-chip:focus-visible,
.st-pager-btn:focus-visible,
.st-pager-page:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: 2px;
}

/* Panneaux : en-tête marqué par une hairline, ombre douce unique */
.panel { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }

.panel-header {
  border-bottom: 1px solid #eef2f7;
}

/* Tables : le survol guidant, sobre */
.tundra-table tbody tr { transition: background 0.12s ease; }
.tundra-table tbody tr:hover { background: #f8fafc; }

/* Topbar : ombre légère au défilement (profondeur sans lourdeur) */
.topbar { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }

/* Badges : interlignage stable quel que soit le contenu */
.badge { line-height: 1.4; }

/* ============================================================
   PAGE-HEAD — en-tête unifié des tableaux de bord
   (remplace les bandeaux dégradés pleine largeur)
   ============================================================ */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 25px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* Signature : barre d'accent verticale navy → océan */
.page-head::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #0f172a 0%, #0369a1 100%);
}

.page-head-main { min-width: 0; }

.page-head-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0369a1;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 11px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.page-head-badge::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #38bdf8;
}

.page-head h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.42rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #0f172a;
  margin: 0 0 4px;
}

.page-head .page-head-sub {
  font-size: 0.86rem;
  color: #64748b;
  margin: 0;
  max-width: 72ch;
}

.page-head-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Chips KPI compacts dans l'en-tête */
.kpi-chip {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 108px;
}

.kpi-chip .kpi-value {
  font-family: 'Outfit', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.kpi-chip .kpi-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
}

.kpi-chip.accent-sky .kpi-value { color: #0369a1; }
.kpi-chip.accent-amber .kpi-value { color: #d97706; }
.kpi-chip.accent-green .kpi-value { color: #059669; }
.kpi-chip.accent-rose .kpi-value { color: #be185d; }

/* Progression compacte (objectif journalier commercial) */
.head-progress { min-width: 190px; }
.head-progress .kpi-value small { font-size: 0.8rem; color: #64748b; font-weight: 600; }
.head-progress .quota-progress-container { height: 6px; margin-top: 7px; }

/* Chiffres tabulaires partout où ça compte */
.stat-value,
.tundra-table td,
.kpi-chip .kpi-value {
  font-variant-numeric: tabular-nums;
}

/* Cartes KPI : hiérarchie par la barre d'accent, pas par la décoration */
.stat-card {
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.stat-value { font-family: 'Outfit', sans-serif; letter-spacing: -0.5px; }

/* Tablettes : l'en-tête s'empile */
@media (max-width: 900px) {
  .page-head { padding: 16px 18px; }
  .page-head h1 { font-size: 1.2rem; }
  .page-head-meta { width: 100%; }
  .kpi-chip { flex: 1 1 30%; min-width: 96px; }
}

/* ============================================================
   ⚡ REFONTE GLOBALE 2026 — « TUNDRA FROST »
   Langage : fond glacier, cartes bento, en-tête ouvert, pills.
   Ce bloc prime sur les règles antérieures (même spécificité, plus bas).
   ============================================================ */

:root {
  --frost-bg: #f4f7fb;
  --frost-card: #ffffff;
  --frost-line: #e8eef6;
  --frost-radius: 20px;
  --frost-shadow: 0 12px 32px -20px rgba(15, 23, 42, 0.18);
  --frost-shadow-hover: 0 18px 40px -20px rgba(15, 23, 42, 0.26);
}

body {
  background: var(--frost-bg);
}

/* ---- Zone de contenu : plus d'air, largeur génératrice ---- */
.content-body {
  padding: 28px 32px 48px;
  max-width: 1520px;
}

/* ---- En-tête de page : ouvert, pas de boîte ---- */
.page-head {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 6px 4px 20px;
  margin-bottom: 26px;
  gap: 22px;
}

.page-head::before { display: none; }

.page-head-badge {
  background: linear-gradient(90deg, #eff6ff, #f0f9ff);
  border: 1px solid #bae6fd;
  color: #0369a1;
  padding: 4px 14px;
  font-size: 0.7rem;
  letter-spacing: 0.01em;
}

.page-head h1 {
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  letter-spacing: -0.9px;
  background: linear-gradient(100deg, #0f172a 30%, #0369a1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 6px 0 5px;
}

.page-head .page-head-sub { color: #7c8ba1; font-size: 0.88rem; }

.kpi-chip {
  background: var(--frost-card);
  border: 1px solid var(--frost-line);
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: var(--frost-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-chip:hover { transform: translateY(-2px); box-shadow: var(--frost-shadow-hover); }
.kpi-chip .kpi-value { font-size: 1.45rem; letter-spacing: -0.6px; }

/* ---- Onglets : segmented control pill flottant ---- */
.st-tabs {
  background: var(--frost-card);
  border: 1px solid var(--frost-line);
  border-radius: 999px;
  padding: 5px;
  box-shadow: 0 6px 20px -14px rgba(15, 23, 42, 0.25);
  margin-bottom: 26px;
  gap: 2px;
}

.st-tab-btn {
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 0.83rem;
  color: #64748b;
}

.st-tab-btn.active {
  background: linear-gradient(120deg, #0f172a 0%, #0c4a6e 60%, #0369a1 100%);
  box-shadow: 0 6px 16px -6px rgba(3, 105, 161, 0.55);
}

.st-tab-btn .st-tab-count { border-radius: 999px; }

/* ---- Panneaux → cartes bento ---- */
.panel {
  background: var(--frost-card);
  border: 1px solid var(--frost-line);
  border-radius: var(--frost-radius);
  box-shadow: var(--frost-shadow);
  margin-bottom: 26px;
  overflow: hidden;
}

.panel-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.panel-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #0f172a;
}

.panel-body { padding: 20px 22px; }

/* ---- Cartes KPI → tuiles bento ---- */
.stats-grid { gap: 16px; }

.stat-card {
  border: 1px solid var(--frost-line);
  border-radius: var(--frost-radius);
  box-shadow: var(--frost-shadow);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0f172a, #0369a1);
}

.stat-card.stat-green::before { background: linear-gradient(90deg, #059669, #34d399); }
.stat-card.stat-purple::before { background: linear-gradient(90deg, #6d28d9, #a78bfa); }
.stat-card.stat-amber::before { background: linear-gradient(90deg, #d97706, #fbbf24); }

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--frost-shadow-hover); }

.stat-icon-wrapper {
  border-radius: 14px !important;
  width: 44px; height: 44px;
}

.stat-value { font-size: 1.65rem; }
.stat-info h5 { font-weight: 600; color: #64748b; font-size: 0.8rem; }

/* ---- Tables : lecture apaisée ---- */
.tundra-table thead th {
  background: #f8fafc;
  color: #7c8ba1;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--frost-line);
  padding: 12px 16px;
}

.tundra-table td { border-bottom: 1px solid #f1f5f9; padding: 13px 16px; }
.tundra-table tbody tr:hover { background: #f6faff; }

/* ---- Formulaires ---- */
.form-control {
  border-radius: 12px;
  border: 1.5px solid #dbe4ee;
  padding: 10px 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

/* ---- Boutons ---- */
.btn { border-radius: 12px; }
.btn-primary {
  background: linear-gradient(120deg, #0284c7, #0369a1);
  box-shadow: 0 6px 14px -6px rgba(3, 105, 161, 0.5);
}
.btn-success { box-shadow: 0 6px 14px -6px rgba(5, 150, 105, 0.5); }

/* ---- Badges pastilles douces ---- */
.badge { border-radius: 999px; padding: 3px 10px; font-weight: 700; }

/* ---- Pager arrondi ---- */
.st-pager { background: transparent; border-top: 1px solid #f1f5f9; border-radius: 0 0 var(--frost-radius) var(--frost-radius); }
.st-pager-btn, .st-pager-page { border-radius: 10px; }

/* ---- Sidebar : plus légère ---- */
.sidebar { box-shadow: 1px 0 24px -18px rgba(15, 23, 42, 0.4); }

/* ---- Carte & tour : mêmes rayons que le système ---- */
.pdv-explorer-map, #tour-map { border-radius: 16px; }

/* ---- Adaptation mobile de la refonte ---- */
@media (max-width: 900px) {
  .content-body { padding: 18px 16px 36px; }
  .page-head { padding: 2px 2px 16px; }
  .st-tabs { border-radius: 22px; }
  .panel { border-radius: 18px; }
  .panel-header { padding: 16px 18px 12px; }
  .panel-body { padding: 16px 18px; }
}
