/* ═══════════════════════════════════════════════════════
   LivrCI ID — Design System v2
   Premium Dark UI · Polices modernes · Icônes SVG
   Charte: Orange Feu + Nuit Profonde + Accents
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Palette principale ── */
  --noir:    #080A10;
  --nuit:    #0E1018;
  --surface: #141722;
  --surface2:#1A1F2E;
  --surface3:#202535;
  --bordure: #252B3B;
  --bordure2:#2E3650;

  /* ── Couleurs d'action ── */
  --orange:  #FF6B35;
  --orange2: #FF8B55;
  --orange3: #FFB088;
  --vert:    #00D48A;
  --vert2:   #00B876;
  --rouge:   #F03E52;
  --rouge2:  #FF6070;
  --jaune:   #FFB800;
  --bleu:    #5B8EF0;
  --bleu2:   #3B6FD4;
  --violet:  #8B5CF6;

  /* ── Textes ── */
  --blanc:   #F2F4F8;
  --gris2:   #B8C0D0;
  --gris:    #6E7A94;
  --gris3:   #404858;

  /* ── Polices ── */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Plus Jakarta Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* ── Rayons ── */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  18px;
  --r-2xl: 24px;

  /* ── Ombres ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.6), 0 4px 8px rgba(0,0,0,.4);
  --shadow-orange: 0 0 24px rgba(255,107,53,.2);
  --shadow-vert:   0 0 24px rgba(0,212,138,.15);

  /* ── Transitions ── */
  --ease: cubic-bezier(.25, .46, .45, .94);
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 350ms;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--noir);
  color: var(--blanc);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════
   SCROLLBAR PERSONNALISÉE
   ═══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--nuit); }
::-webkit-scrollbar-thumb { background: var(--bordure2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gris3); }

/* ═══════════════════════════════════════════════
   SÉLECTION
   ═══════════════════════════════════════════════ */
::selection { background: rgba(255,107,53,.25); color: var(--blanc); }

/* ═══════════════════════════════════════════════
   LOGO & BRAND
   ═══════════════════════════════════════════════ */
.brand { text-align: center; margin-bottom: 2rem; }
.brand-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--orange), #FF3D00);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 1rem;
  box-shadow: 0 0 0 1px rgba(255,107,53,.3), var(--shadow-orange);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.brand-name span { color: var(--orange); }
.brand-sub    { font-size: .8rem; color: var(--gris); margin-top: 3px; font-weight: 400; }
.brand-country {
  font-size: .72rem;
  background: var(--surface2);
  border: 1px solid var(--bordure);
  border-radius: 99px;
  padding: 4px 14px;
  display: inline-block;
  color: var(--gris2);
  margin-top: 10px;
  letter-spacing: .3px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
  text-decoration: none;
  color: var(--blanc);
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--orange), #FF3D00);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  box-shadow: 0 0 12px rgba(255,107,53,.3);
  flex-shrink: 0;
}
.logo span { color: var(--orange); }

/* ═══════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════ */
.login-body { align-items: center; justify-content: center; background: var(--noir); }
.login-wrap { width: 100%; max-width: 420px; padding: 1.5rem; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-2xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.footer-note { text-align: center; font-size: .7rem; color: var(--gris); margin-top: 1.4rem; }
.divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 1.4rem 0; color: var(--gris); font-size: .73rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--bordure);
}
.demo-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.demo-btn {
  background: var(--surface2);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  padding: 8px 6px;
  cursor: pointer;
  font-size: .71rem;
  color: var(--gris2);
  font-family: var(--font-body);
  transition: all var(--t-fast) var(--ease);
  display: flex; align-items: center; gap: 5px; justify-content: center;
  text-align: center;
}
.demo-btn:hover { background: var(--bordure2); color: var(--blanc); border-color: var(--bordure2); }

/* ═══════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════ */
.topbar {
  background: rgba(14,16,24,.85);
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  border-bottom: 1px solid var(--bordure);
  padding: 0 1.5rem;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: .82rem;
  font-weight: 500;
  color: var(--gris);
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
  position: relative;
}
.nav-links a:hover { color: var(--blanc); background: var(--surface2); }
.nav-links a.active { color: var(--orange); background: rgba(255,107,53,.1); }
.user-badge { display: flex; align-items: center; gap: 10px; font-size: .82rem; }
.avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--orange), #FF3D00);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem; color: white;
  box-shadow: 0 0 0 2px rgba(255,107,53,.3);
}
.role-pill {
  background: var(--surface2);
  border: 1px solid var(--bordure);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: .7rem;
  color: var(--gris2);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════
   LAYOUT PRINCIPAL
   ═══════════════════════════════════════════════ */
.app-shell { display: flex; flex: 1; min-height: calc(100vh - 58px); }
.main { flex: 1; padding: 1.8rem 2rem; overflow-y: auto; max-width: 100%; }

/* ═══════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════ */
.sidebar {
  width: 220px;
  background: var(--nuit);
  border-right: 1px solid var(--bordure);
  padding: 1rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  /* Transition pour le drawer mobile */
  transition: transform var(--t-base) var(--ease);
  will-change: transform;
}
.sidebar-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gris3);
  padding: 10px 16px 5px;
  font-family: var(--font-body);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  margin: 0 8px;
  border-radius: var(--r-md);
  font-size: .83rem;
  font-weight: 500;
  color: var(--gris2);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  text-decoration: none;
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
  position: relative;
}
.sidebar-link:hover {
  background: var(--surface2);
  color: var(--blanc);
}
.sidebar-link.active {
  background: rgba(255,107,53,.12);
  color: var(--orange);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--orange);
  border-radius: 0 3px 3px 0;
  margin-left: -12px;
}
.sidebar-link .icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  opacity: .85;
}
.badge-count {
  background: var(--orange);
  color: white;
  font-size: .64rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  margin-left: auto;
  font-family: var(--font-mono);
  min-width: 18px;
  text-align: center;
}

/* ═══════════════════════════════════════════════
   CARDS & SURFACES
   ═══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card:hover {
  border-color: var(--bordure2);
}

/* ═══════════════════════════════════════════════
   STAT CARDS — Redesignées
   ═══════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .9rem;
  margin-bottom: 1.8rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-xl);
  padding: 1.3rem 1.4rem 1.1rem;
  position: relative;
  overflow: hidden;
  transition: all var(--t-base) var(--ease);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-card .stat-icon-bg {
  position: absolute;
  top: -10px; right: -10px;
  width: 70px; height: 70px;
  border-radius: 50%;
  opacity: .07;
}
.stat-card.orange { border-color: rgba(255,107,53,.2); }
.stat-card.orange .stat-icon-bg { background: var(--orange); }
.stat-card.vert   { border-color: rgba(0,212,138,.2); }
.stat-card.vert   .stat-icon-bg { background: var(--vert); }
.stat-card.jaune  { border-color: rgba(255,184,0,.2); }
.stat-card.jaune  .stat-icon-bg { background: var(--jaune); }
.stat-card.rouge  { border-color: rgba(240,62,82,.2); }
.stat-card.rouge  .stat-icon-bg { background: var(--rouge); }
.stat-card.bleu   { border-color: rgba(91,142,240,.2); }
.stat-card.bleu   .stat-icon-bg { background: var(--bleu); }

.stat-label {
  font-size: .72rem;
  color: var(--gris);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: .55rem;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}
.stat-sub {
  font-size: .71rem;
  color: var(--gris);
  margin-top: 5px;
  font-weight: 400;
}
.stat-card.orange .stat-value { color: var(--orange); }
.stat-card.vert   .stat-value { color: var(--vert);   }
.stat-card.jaune  .stat-value { color: var(--jaune);  }
.stat-card.rouge  .stat-value { color: var(--rouge);  }
.stat-card.bleu   .stat-value { color: var(--bleu);   }

/* ═══════════════════════════════════════════════
   HEADERS DE SECTION
   ═══════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.section-sub {
  font-size: .8rem;
  color: var(--gris);
  margin-top: 3px;
  font-weight: 400;
}

/* ═══════════════════════════════════════════════
   BOUTONS — Redesignés
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t-fast) var(--ease);
  font-family: var(--font-body);
  letter-spacing: .1px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--t-fast);
}
.btn:hover::after { background: rgba(255,255,255,.06); }
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 0 0 1px rgba(255,107,53,.5), 0 2px 8px rgba(255,107,53,.25);
}
.btn-primary:hover {
  background: var(--orange2);
  box-shadow: 0 0 0 1px rgba(255,107,53,.6), 0 4px 16px rgba(255,107,53,.3);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--surface2);
  color: var(--gris2);
  border: 1px solid var(--bordure);
}
.btn-ghost:hover {
  background: var(--surface3);
  color: var(--blanc);
  border-color: var(--bordure2);
}

.btn-success {
  background: var(--vert);
  color: #001A0D;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(0,212,138,.4), 0 2px 8px rgba(0,212,138,.2);
}
.btn-success:hover {
  background: var(--vert2);
  box-shadow: 0 4px 16px rgba(0,212,138,.25);
}

.btn-danger {
  background: var(--rouge);
  color: white;
  box-shadow: 0 2px 8px rgba(240,62,82,.25);
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm   { padding: 5px 10px; font-size: .76rem; }
.btn-lg   { padding: 11px 22px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ═══════════════════════════════════════════════
   FORMULAIRES — Redesignés
   ═══════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: .9rem; }
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }

label {
  font-size: .71rem;
  font-weight: 600;
  color: var(--gris2);
  text-transform: uppercase;
  letter-spacing: .7px;
  font-family: var(--font-body);
}

input[type=text],
input[type=email],
input[type=password],
input[type=tel],
input[type=date],
input[type=number],
input[type=datetime-local],
select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: .86rem;
  color: var(--blanc);
  font-family: var(--font-body);
  transition: all var(--t-fast) var(--ease);
  width: 100%;
  line-height: 1.5;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  background: var(--surface3);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
input::placeholder, textarea::placeholder { color: var(--gris3); }
input:hover:not(:focus), select:hover:not(:focus) {
  border-color: var(--bordure2);
}

.photo-upload {
  border: 2px dashed var(--bordure2);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-base) var(--ease);
  font-size: .82rem;
  color: var(--gris);
}
.photo-upload:hover {
  border-color: var(--orange);
  color: var(--orange3);
  background: rgba(255,107,53,.04);
}

/* ═══════════════════════════════════════════════
   FILTRES & RECHERCHE
   ═══════════════════════════════════════════════ */
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-lg);
  padding: .9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.search-wrap { position: relative; }
.search-input {
  background: var(--surface2);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  padding: 8px 12px 8px 34px;
  font-size: .83rem;
  color: var(--blanc);
  width: 220px;
  font-family: var(--font-body);
  transition: all var(--t-fast) var(--ease);
}
.search-input:focus { border-color: var(--orange); outline: none; width: 260px; }
.search-wrap::before {
  content: '';
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  background: var(--gris);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") center/contain no-repeat;
}
.select-filter {
  background: var(--surface2);
  border: 1px solid var(--bordure);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-size: .82rem;
  color: var(--gris2);
  font-family: var(--font-body);
  cursor: pointer;
  width: auto;
  transition: all var(--t-fast) var(--ease);
}
.select-filter:focus { outline: none; border-color: var(--orange); }

/* ═══════════════════════════════════════════════
   TABLEAU — Redesigné
   ═══════════════════════════════════════════════ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 1rem;
  text-align: left;
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gris);
  border-bottom: 1px solid var(--bordure);
  background: rgba(255,255,255,.015);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.03);
  transition: background var(--t-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.025); }
tbody td {
  padding: 11px 1rem;
  font-size: .82rem;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════
   STATUTS — Pills redesignées
   ═══════════════════════════════════════════════ */
.statut {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
}
.statut::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.statut.actif,      .statut.vert     { background: rgba(0,212,138,.1);   color: var(--vert);   border: 1px solid rgba(0,212,138,.2); }
.statut.actif::before, .statut.vert::before { background: var(--vert); box-shadow: 0 0 6px var(--vert); }
.statut.en_attente, .statut.jaune    { background: rgba(255,184,0,.1);   color: var(--jaune);  border: 1px solid rgba(255,184,0,.2); }
.statut.en_attente::before, .statut.jaune::before { background: var(--jaune); }
.statut.suspendu,   .statut.rouge    { background: rgba(240,62,82,.1);   color: var(--rouge);  border: 1px solid rgba(240,62,82,.2); }
.statut.suspendu::before, .statut.rouge::before { background: var(--rouge); }
.statut.banni,      .statut.gris     { background: rgba(110,122,148,.1); color: var(--gris);   border: 1px solid rgba(110,122,148,.15); }
.statut.banni::before, .statut.gris::before { background: var(--gris); }
.statut.orange                       { background: rgba(255,107,53,.1);  color: var(--orange); border: 1px solid rgba(255,107,53,.2); }
.statut.orange::before               { background: var(--orange); }
.statut.bleu                         { background: rgba(91,142,240,.1);  color: var(--bleu);   border: 1px solid rgba(91,142,240,.2); }
.statut.bleu::before                 { background: var(--bleu); }

/* ═══════════════════════════════════════════════
   LIVREUR CELL
   ═══════════════════════════════════════════════ */
.livreur-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.livreur-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(255,107,53,.12);
  color: var(--orange);
  font-family: var(--font-display);
  border: 1px solid rgba(255,107,53,.15);
}
.livreur-avatar-img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.livreur-name { font-weight: 600; font-size: .84rem; line-height: 1.3; }
.livreur-id   { font-size: .7rem; color: var(--gris); font-family: var(--font-mono); margin-top: 2px; }

/* ═══════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--bordure);
}
.page-btn {
  background: var(--surface2);
  border: 1px solid var(--bordure);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  font-size: .78rem;
  color: var(--gris2);
  text-decoration: none;
  transition: all var(--t-fast) var(--ease);
  font-family: var(--font-body);
  font-weight: 500;
}
.page-btn:hover { background: var(--surface3); color: var(--blanc); border-color: var(--bordure2); }
.page-btn.active { background: var(--orange); color: white; border-color: var(--orange); }
.page-info { margin-left: auto; font-size: .73rem; color: var(--gris); }

/* ═══════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px) saturate(.8);
  -webkit-backdrop-filter: blur(6px) saturate(.8);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--bordure2);
  border-radius: var(--r-2xl);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn var(--t-base) var(--ease);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.04);
}
@keyframes popIn {
  from { transform: scale(.96) translateY(8px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);   opacity: 1; }
}
.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--bordure);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.015);
}
.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .98rem;
  letter-spacing: -0.2px;
}
.modal-close {
  background: var(--surface3);
  border: 1px solid var(--bordure);
  color: var(--gris);
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: .88rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.modal-close:hover { color: var(--blanc); background: var(--bordure2); }
.modal-body   { padding: 1.4rem 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--bordure);
  display: flex; gap: .7rem; justify-content: flex-end;
  background: rgba(255,255,255,.01);
}

/* ═══════════════════════════════════════════════
   INCIDENTS
   ═══════════════════════════════════════════════ */
.incident-card {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-lg);
  padding: 1rem 1.2rem;
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: .55rem;
  transition: all var(--t-fast) var(--ease);
}
.incident-card:hover {
  border-color: var(--bordure2);
  transform: translateX(3px);
  background: var(--surface2);
}
.incident-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  background: rgba(240,62,82,.1);
  border: 1px solid rgba(240,62,82,.15);
}
.incident-info { flex: 1; }
.incident-type { font-size: .84rem; font-weight: 600; }
.incident-meta { font-size: .74rem; color: var(--gris); margin-top: 2px; }

/* ═══════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════ */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.chart-box {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-xl);
  padding: 1.4rem;
}
.chart-box-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--gris);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .8px;
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS — Redesignées
   ═══════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--bordure2);
  border-radius: var(--r-lg);
  padding: 13px 16px;
  font-size: .82rem;
  display: flex; align-items: center; gap: 10px;
  animation: toastSlide var(--t-base) var(--ease);
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}
.toast.success { border-left: 3px solid var(--vert);   }
.toast.error   { border-left: 3px solid var(--rouge);  }
.toast.info    { border-left: 3px solid var(--orange);  }
.toast.warning { border-left: 3px solid var(--jaune);  }
@keyframes toastSlide {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ═══════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: .83rem;
  margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: 10px;
  font-weight: 500;
}
.alert-danger  {
  background: rgba(240,62,82,.08);
  border: 1px solid rgba(240,62,82,.2);
  color: var(--rouge2);
}
.alert-success {
  background: rgba(0,212,138,.08);
  border: 1px solid rgba(0,212,138,.2);
  color: var(--vert);
}
.alert-warning {
  background: rgba(255,184,0,.08);
  border: 1px solid rgba(255,184,0,.2);
  color: var(--jaune);
}
.alert-info {
  background: rgba(91,142,240,.08);
  border: 1px solid rgba(91,142,240,.2);
  color: var(--bleu);
}

/* ═══════════════════════════════════════════════
   TAGS & BADGES
   ═══════════════════════════════════════════════ */
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .3px;
}
.tag-moto { background: rgba(255,107,53,.1); color: var(--orange3); border: 1px solid rgba(255,107,53,.15); }

/* ═══════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--gris);
}
.empty-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
  filter: grayscale(.3);
}
.empty-text { font-size: .88rem; font-weight: 500; color: var(--gris2); }

/* ═══════════════════════════════════════════════
   UTILS
   ═══════════════════════════════════════════════ */
.flex  { display: flex; }
.gap-2 { gap: .5rem; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1.2rem; }
.text-muted  { color: var(--gris); }
.text-mono   { font-family: var(--font-mono); font-size: .88em; }
.text-orange { color: var(--orange); }
.text-vert   { color: var(--vert); }
.text-rouge  { color: var(--rouge); }
.separator   { height: 1px; background: var(--bordure); margin: 1.2rem 0; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 960px) {
  .sidebar { display: none; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .form-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
}

/* ═══════════════════════════════════════════════
   ANIMATIONS GLOBALES
   ═══════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
.animate-fade-up { animation: fadeUp .35s var(--ease) forwards; }
.animate-pulse   { animation: pulse 2s ease-in-out infinite; }

/* ═══════════════════════════════════════════════
   LIVREUR MOBILE OVERRIDE
   Masque sidebar+topbar admin pour les livreurs
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  body.livreur-with-admin-layout .topbar  { display: none !important; }
  body.livreur-with-admin-layout .sidebar { display: none !important; }
  body.livreur-with-admin-layout .app-shell { display: block; }
  body.livreur-with-admin-layout .main {
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden;
  }
  body.livreur-with-admin-layout {
    padding-bottom: 84px;
  }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE COMPLET — Tous écrans
   Mobile (<768px) · Tablette (768-1024px) · Desktop (>1024px)
   ═══════════════════════════════════════════════════════ */

/* ── TOPBAR RESPONSIVE ─────────────────────────── */

/* Bouton hamburger — masqué sur desktop */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.hamburger:hover { background: var(--surface2); }
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--gris2);
  border-radius: 2px;
  transition: all var(--t-base) var(--ease);
}
/* Animation croix */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Drawer overlay (fond sombre quand menu ouvert) */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  z-index: 300;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
}
.drawer-overlay.open { opacity: 1; }

/* Drawer sidebar mobile */
.sidebar.drawer-open {
  transform: translateX(0) !important;
}

/* ── TABLETTE (768px - 1024px) ─────────────────── */
@media (max-width: 1024px) {
  /* Sidebar plus étroite */
  .sidebar { width: 200px; }

  /* Topbar — masquer les nav-links texte, garder logos */
  .nav-links a span:not(.nav-icon) { display: none; }
  .nav-links a {
    padding: 7px 9px;
    font-size: 0; /* Masquer le texte */
  }
  .nav-links a svg { display: block; }

  /* User badge — masquer nom et role */
  .user-badge .role-pill { display: none; }
  .user-badge > div:first-child { display: none; }

  /* Stats 2 colonnes */
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── MOBILE (<768px) ───────────────────────────── */
@media (max-width: 768px) {

  /* SIDEBAR → devient un drawer latéral */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    z-index: 400;
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease);
    height: 100vh;
    padding-top: 60px; /* espace pour la topbar */
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
  }

  /* TOPBAR MOBILE */
  .topbar {
    height: 54px;
    padding: 0 1rem;
  }

  /* Masquer nav-links sur mobile → remplacé par hamburger */
  .nav-links { display: none !important; }

  /* Afficher hamburger */
  .hamburger { display: flex; }

  /* Masquer détails user */
  .user-badge .role-pill { display: none; }
  .user-badge > div:first-child { display: none; }

  /* Logo plus compact */
  .logo { font-size: .95rem; }
  .logo-icon { width: 28px; height: 28px; border-radius: 7px; font-size: .78rem; }

  /* MAIN — pleine largeur */
  .app-shell { display: block; }
  .main {
    padding: 1rem;
    min-height: calc(100vh - 54px);
  }

  /* DRAWER OVERLAY */
  .drawer-overlay { display: block; pointer-events: none; }
  .drawer-overlay.open { display: block; pointer-events: auto; }

  /* STATS — 2 colonnes sur mobile */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.6rem; }

  /* TABLEAUX — scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }

  /* MODALS — plein écran sur mobile */
  .modal {
    width: 100%;
    max-width: 100%;
    min-height: 60vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 95vh;
    animation: slideUp var(--t-base) var(--ease);
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* FILTRES — scroll horizontal */
  .filters-bar { flex-wrap: nowrap; overflow-x: auto; gap: .5rem; }
  .search-input { width: 160px; }
  .search-input:focus { width: 180px; }

  /* FORMULAIRES — 1 colonne */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1; }

  /* GRILLES */
  .chart-grid { grid-template-columns: 1fr; }

  /* SECTION HEADER — empilé */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .6rem;
  }

  /* PAGINATION — centré */
  .pagination { justify-content: center; flex-wrap: wrap; }
  .page-info { width: 100%; text-align: center; margin: 0; }

  /* TOPBAR URGENCES badge pulsant visible */
  .topbar .badge-count {
    position: absolute;
    top: 6px; right: 6px;
    min-width: 16px; height: 16px;
    font-size: .58rem;
  }
}

/* ── PETIT MOBILE (<480px) ─────────────────────── */
@media (max-width: 480px) {
  .main { padding: .75rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .stat-card { padding: .85rem .75rem; }
  .stat-value { font-size: 1.45rem; }
  .stat-label { font-size: .65rem; }

  /* Topbar encore plus compact */
  .topbar { padding: 0 .75rem; height: 52px; }

  /* Tableaux — colonnes prioritaires visibles */
  table td:nth-child(4),
  table th:nth-child(4),
  table td:nth-child(5),
  table th:nth-child(5) { display: none; }
}

/* ── GRAND ÉCRAN (>1400px) ─────────────────────── */
@media (min-width: 1400px) {
  .main { padding: 2rem 2.5rem; }
  .stats-row { grid-template-columns: repeat(4, 1fr); }
  .sidebar { width: 240px; }
}
