/* =========================================================
   TOKENS
   ========================================================= */
:root{
  --orange: #E67E22;
  --orange-dark: #C1580A;
  --orange-light: #FDEBD3;
  --orange-pale: #FFF6EC;

  --ink: #241C14;
  --ink-soft: #6b5f52;
  --bg: #FBF8F4;
  --surface: #FFFFFF;
  --border: #EEE3D6;

  --green: #1E7A34;   --green-bg: #EAF7EC;
  --red: #B5121B;     --red-bg: #FCEAEA;
  --status-orange: #9C5700; --status-orange-bg: #FFF3E6;
  --gray: #595959;    --gray-bg: #F1F1F1;

  --radius: 10px;
  --sidebar-bg: linear-gradient(180deg, var(--orange-dark), #8f4207);
  --sidebar-text: rgba(255,255,255,.82);
  --sidebar-text-solid: #fff;
  --shadow: 0 1px 2px rgba(36,28,20,.06), 0 4px 14px rgba(36,28,20,.05);
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
}

*{box-sizing:border-box;}

/* =========================================================
   MODE SOMBRE — surcharge des mêmes variables, rien d'autre à
   toucher : tout le reste du CSS lit déjà ces tokens dynamiquement.
   ========================================================= */
body.dark-mode{
  --orange: #F0923D;
  --orange-dark: #D97D2A;
  --orange-light: #4A3420;
  --orange-pale: #2A2118;

  --ink: #F2ECE3;
  --ink-soft: #A89C8C;
  --bg: #17130F;
  --surface: #221C16;
  --border: #3A3128;

  --green: #4CAF6B;   --green-bg: #1D2E20;
  --red: #E0666D;     --red-bg: #33191B;
  --status-orange: #E0A94C; --status-orange-bg: #332615;
  --gray: #B8B0A5;    --gray-bg: #2A2620;

  --sidebar-bg: linear-gradient(180deg, #2A2118, #16110B);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 4px 18px rgba(0,0,0,.32);
}
body.dark-mode img{ filter:brightness(.92) contrast(1.03); }


/* Règle générique de secours : garantit que la classe "hidden" masque TOUJOURS un élément,
   même si aucune règle plus précise (ex. ".truc.hidden{...}") n'a été ajoutée pour un composant
   donné. Sans ça, ajouter "hidden" via JavaScript sur un nouvel élément ne fait rien tant qu'une
   règle CSS dédiée n'existe pas — bug repéré sur plusieurs composants (zone de recherche
   d'article, recherche globale, bandeau hors-ligne, onglet Ma Tournée...) et corrigé ici une fois
   pour toutes, pour que ça ne se reproduise plus jamais à l'avenir non plus.
*/
.hidden{ display:none !important; }
html,body{margin:0;padding:0; overflow-x:hidden;}
body{
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  width:100%;
}
h1,h2,h3{font-family: var(--font-display); margin:0; color:var(--ink);}
button{font-family:inherit; cursor:pointer;}
input,select{font-family:inherit;}
::selection{background: var(--orange-light);}

/* Barre de défilement discrète (navigateurs à base WebKit/Blink) */
::-webkit-scrollbar{ width:9px; height:9px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:#DCCBB3; border-radius:20px; border:2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover{ background:var(--orange); }

:focus-visible{ outline:2px solid var(--orange); outline-offset:2px; }

/* =========================================================
   LAYOUT
   ========================================================= */
.app-shell{
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar{
  background: var(--sidebar-bg);
  color: var(--sidebar-text-solid);
  display:flex;
  flex-direction:column;
  padding: 20px 14px;
  position: fixed; top:0; left:0; width:240px; height:100vh; z-index:100;
  overflow: hidden; /* le fond orange couvre toujours toute la hauteur, quel que soit le nombre d'onglets */
}
.brand{ display:flex; align-items:center; gap:10px; padding: 4px 8px 22px; flex-shrink:0; }
.brand-mark{
  width:36px; height:36px; border-radius:9px; background:#fff; color:var(--orange-dark);
  font-family:var(--font-display); font-weight:800; display:flex; align-items:center; justify-content:center;
  flex-shrink:0; overflow:hidden; padding:0; border:none;
}
.brand-mark img{ width:100%; height:100%; object-fit:cover; }
.brand-text{ display:flex; flex-direction:column; line-height:1.25; }
.brand-text strong{ font-family:var(--font-display); font-size:14.5px; }
.brand-text span{ font-size:11px; opacity:.8; }

.nav{
  display:flex; flex-direction:column; gap:2px; flex:1; min-height:0; overflow-y:auto;
  scrollbar-width:thin; scrollbar-color:rgba(255,255,255,.3) transparent;
}
.nav::-webkit-scrollbar{ width:5px; }
.nav::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.25); border-radius:10px; }
.nav::-webkit-scrollbar-track{ background:transparent; }
.nav-item{
  display:flex; align-items:center; gap:10px;
  background:transparent; border:none; border-left:3px solid transparent; color:var(--sidebar-text);
  padding:10px 12px; border-radius:8px; font-size:13.5px; font-weight:500;
  text-align:left; text-decoration:none; cursor:pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-item svg{ width:18px; height:18px; flex-shrink:0; opacity:.9; }
.nav-item:hover{ background: rgba(255,255,255,.10); color:var(--sidebar-text-solid); }
.nav-item.active{ background:#fff; color: var(--orange-dark); font-weight:700; border-left-color:var(--orange-dark); box-shadow:0 2px 8px rgba(0,0,0,.12); }
.nav-item-external{
  display:flex; align-items:center; gap:10px;
  background:transparent; border:none; color:var(--sidebar-text);
  padding:10px 12px; border-radius:8px; font-size:13.5px; font-weight:500;
  text-align:left; text-decoration:none; cursor:pointer; transition: background .15s ease, color .15s ease;
}
.nav-item-external svg{ width:18px; height:18px; flex-shrink:0; opacity:.9; }
.nav-item-external:hover{ background: rgba(255,255,255,.10); color:var(--sidebar-text-solid); }
.alert-badge{
  margin-left:auto; background:var(--red); color:#fff; font-size:10.5px; font-weight:700;
  border-radius:999px; padding:1px 7px; line-height:1.5;
}
.alert-badge.hidden{ display:none; }

/* =========================================================
   GROUPE DE NAVIGATION AVEC SOUS-MENU (ex. Fournisseurs)
   ========================================================= */
.nav-group{ margin-bottom:1px; }
.nav-group-toggle{
  display:flex; align-items:center; gap:10px; width:100%;
  background:transparent; border:none; color:var(--sidebar-text);
  padding:10px 12px; border-radius:8px; font-size:12.5px; font-weight:700; text-transform:uppercase; letter-spacing:.03em;
  text-align:left; cursor:pointer; transition: background .15s ease, color .15s ease;
}
.nav-group-toggle svg{ width:17px; height:17px; flex-shrink:0; opacity:.85; }
.nav-group-toggle:hover{ background: rgba(255,255,255,.10); color:var(--sidebar-text-solid); }
.nav-group-toggle.active{ background:#fff; color: var(--orange-dark); }
.nav-chevron{ margin-left:auto; transition:transform .2s ease; opacity:.7; }
.nav-group.open .nav-chevron{ transform:rotate(180deg); }
.nav-submenu{ display:flex; flex-direction:column; gap:2px; padding-left:14px; margin-top:2px; border-left:1px solid rgba(255,255,255,.12); margin-left:16px; }
.nav-submenu.hidden{ display:none; }
.nav-subitem{ font-size:12.5px; padding:8px 12px; font-weight:500; text-transform:none; letter-spacing:normal; }
.nav-subitem svg{ width:15px; height:15px; }

.sidebar-footer{ display:flex; align-items:center; gap:8px; font-size:11.5px; opacity:.85; padding:10px 10px 2px; flex-shrink:0; }
.nav-section-label{ display:none; } /* visible uniquement sur mobile, voir media query dédiée plus bas */
.conn-dot{ width:8px; height:8px; border-radius:50%; background:#ddd; flex-shrink:0; }
.conn-dot.ok{ background:#5BD98A; }
.conn-dot.err{ background:#FF6B6B; }

/* ---- Main ---- */
.main{ padding: 30px 34px 60px; max-width: 1320px; min-width:0; margin-left:240px; }
.view-header{ margin-bottom: 22px; }
.view-header h1{ font-size:24px; font-weight:700; }
.view-header p{ margin:4px 0 0; color:var(--ink-soft); font-size:13.5px; }
.view.hidden{ display:none; }
.view:not(.hidden){ animation: viewFadeIn .22s ease; }
@keyframes viewFadeIn{ from{ opacity:0; transform:translateY(4px);} to{ opacity:1; transform:translateY(0);} }

/* =========================================================
   KPI CARDS
   ========================================================= */
/* ---- Galerie d'accueil (page-test, pas encore accrochée au menu) ----
   Signature : un motif tissé très discret en fond (clin d'œil au monde du commerce/textile
   que gère la plateforme), un en-tête qui salue la personne selon l'heure, et des tuiles qui
   entrent en scène en cascade plutôt que d'apparaître toutes d'un coup. ---- */
#view-galerie-accueil{ position:relative; overflow:hidden; padding:0; }
.galerie-accueil-fond{
  position:absolute; inset:0; z-index:0; pointer-events:none;
  background-color:var(--bg);
  background-image:
    linear-gradient(135deg, rgba(230,126,34,.05) 0%, transparent 45%),
    repeating-linear-gradient(45deg, rgba(230,126,34,.045) 0, rgba(230,126,34,.045) 1px, transparent 1px, transparent 22px),
    repeating-linear-gradient(-45deg, rgba(230,126,34,.045) 0, rgba(230,126,34,.045) 1px, transparent 1px, transparent 22px);
}
.galerie-accueil-contenu{ position:relative; z-index:1; max-width:1180px; margin:0 auto; padding:0 24px 48px; }

.galerie-accueil-hero{ text-align:center; padding:56px 16px 8px; }
.galerie-accueil-eyebrow{
  font-family:var(--font-body); font-size:11.5px; font-weight:700; letter-spacing:.14em; text-transform:uppercase;
  color:var(--orange-dark); margin:0 0 10px;
}
.galerie-accueil-salutation{
  font-family:var(--font-display); font-size:clamp(28px, 4vw, 42px); font-weight:800; color:var(--ink);
  margin:0 0 8px; letter-spacing:-.01em;
}
.galerie-accueil-souslegende{ font-family:var(--font-body); font-size:14.5px; color:var(--ink-soft); margin:0; }

.galerie-accueil-grille{
  display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:16px;
  padding:24px 0 0; box-sizing:border-box; align-content:start;
}
.galerie-accueil-tuile{
  position:relative; overflow:hidden;
  background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:28px 16px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px;
  cursor:pointer; text-align:center; transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  min-height:150px;
  opacity:0; transform:translateY(14px); animation:galerieTuileEntree .5s ease forwards;
}
/* Décalage progressif de l'animation d'entrée, tuile par tuile — un vrai déroulé plutôt qu'un
   effet uniforme qui semble artificiel. */
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(1){ animation-delay:.05s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(2){ animation-delay:.10s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(3){ animation-delay:.15s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(4){ animation-delay:.20s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(5){ animation-delay:.25s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(6){ animation-delay:.30s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(7){ animation-delay:.35s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(8){ animation-delay:.40s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(9){ animation-delay:.45s; }
.galerie-accueil-grille .galerie-accueil-tuile:nth-child(n+10){ animation-delay:.5s; }
@keyframes galerieTuileEntree{ to{ opacity:1; transform:translateY(0); } }
.galerie-accueil-tuile::before{
  content:""; position:absolute; top:0; left:0; right:0; height:3px;
  background:var(--orange); transform:scaleX(0); transform-origin:left; transition:transform .2s ease;
}
.galerie-accueil-tuile:hover{ transform:translateY(-4px); box-shadow:0 14px 30px rgba(36,28,20,.14); border-color:var(--orange-light); }
.galerie-accueil-tuile:hover::before{ transform:scaleX(1); }
.galerie-accueil-icone{ font-size:38px; line-height:1; }
.galerie-accueil-titre{ font-family:var(--font-display); font-weight:700; font-size:14.5px; color:var(--ink); }

/* ---- Tuile Pointage isolée — volontairement très différente du reste : plus grande, centrée
   seule, couleurs vives en dégradé, légère pulsation pour attirer l'œil en priorité. ---- */
.galerie-accueil-pointage-zone{
  display:flex; justify-content:center; padding:8px 24px 8px;
}
.galerie-accueil-pointage-tuile{
  background:linear-gradient(135deg, var(--orange) 0%, #ff8a3d 100%);
  border-radius:20px; padding:36px 64px; cursor:pointer; text-align:center;
  display:flex; flex-direction:column; align-items:center; gap:8px;
  box-shadow:0 14px 34px rgba(230,126,34,.35);
  transition:transform .15s ease, box-shadow .15s ease;
  animation:galeriePointagePulse 2.4s ease-in-out infinite;
}
.galerie-accueil-pointage-tuile:hover{ transform:translateY(-4px) scale(1.02); box-shadow:0 18px 40px rgba(230,126,34,.45); }
.galerie-accueil-pointage-icone{ font-size:52px; line-height:1; filter:drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.galerie-accueil-pointage-titre{ font-family:var(--font-display); font-weight:800; font-size:22px; color:#fff; letter-spacing:.3px; }
.galerie-accueil-pointage-sous-titre{ font-family:var(--font-body); font-size:12.5px; color:rgba(255,255,255,.9); }
@keyframes galeriePointagePulse{
  0%, 100% { box-shadow:0 14px 34px rgba(230,126,34,.35); }
  50% { box-shadow:0 14px 34px rgba(230,126,34,.55); }
}
@media (prefers-reduced-motion: reduce){
  .galerie-accueil-tuile{ animation:none; opacity:1; transform:none; }
  .galerie-accueil-pointage-tuile{ animation:none; }
}

/* ---- Galerie d'accueil sur mobile : 2 tuiles par ligne (hors Pointage, qui reste seule et
   pleine largeur), avec un habillage repensé pour rester élégant en petit format plutôt que de
   simplement rétrécir la version desktop. ---- */

/* ---- Mode plein écran de la galerie d'accueil : pas de menu latéral, le contenu principal
   occupe toute la largeur disponible (la galerie gère elle-même son propre espacement interne
   via .galerie-accueil-contenu, donc on ne touche pas au padding de .main ici). ---- */
body.mode-galerie-plein-ecran .sidebar{ display:none; }
body.mode-galerie-plein-ecran .main{ margin-left:0; max-width:none; }
body.mode-galerie-plein-ecran .mobile-topbar{ display:none; }

@media (max-width:640px){
  .galerie-accueil-contenu{ padding:0 14px 36px; }
  .galerie-accueil-hero{ padding:36px 8px 4px; }
  .galerie-accueil-souslegende{ font-size:13px; }

  .galerie-accueil-grille{ grid-template-columns:repeat(2, 1fr); gap:12px; padding-top:18px; }
  .galerie-accueil-tuile{
    min-height:126px; padding:20px 10px; border-radius:16px;
    background:linear-gradient(160deg, var(--surface) 0%, var(--orange-pale) 130%);
  }
  .galerie-accueil-icone{ font-size:30px; }
  .galerie-accueil-titre{ font-size:12.5px; line-height:1.3; }

  .galerie-accueil-pointage-zone{ padding:0 14px 4px; }
  .galerie-accueil-pointage-tuile{ padding:28px 20px; width:100%; box-sizing:border-box; border-radius:18px; }
  .galerie-accueil-pointage-icone{ font-size:42px; }
  .galerie-accueil-pointage-titre{ font-size:19px; }
}

.kpi-grid{
  display:grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap:14px; margin-bottom: 24px;
}
.kpi-grid-compact{ grid-template-columns: repeat(5,minmax(0,1fr)); margin-top:16px; margin-bottom:0;}
@media (min-width:900px){ .sdb-colonnes{ grid-template-columns:1fr 1fr !important; } }
.kpi-card{
  background: var(--surface); border:1px solid var(--border); border-left:3px solid var(--orange); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  display:flex; flex-direction:column; gap:6px;
  transition: transform .18s ease, box-shadow .18s ease;
  animation: kpiCardEntree .35s ease;
}
@keyframes kpiCardEntree{ from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:translateY(0); } }
.kpi-card:hover{ transform:translateY(-2px); box-shadow:0 6px 20px rgba(36,28,20,.1); }
.kpi-label{ font-size:11px; text-transform:uppercase; letter-spacing:.03em; color:var(--ink-soft); font-weight:600;}
.kpi-value{ font-family:var(--font-display); font-size:24px; font-weight:800; letter-spacing:-.01em; }
.kpi-hero{ background:linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%); border-color:var(--orange); border-left-color:#fff; grid-column: span 2; }
.kpi-hero .kpi-label, .kpi-hero .kpi-value{ color:#fff; }
.kpi-green{ background:var(--green-bg); border-left-color:var(--green); } .kpi-green .kpi-value{ color:var(--green); }
.kpi-red{ background:var(--red-bg); border-left-color:var(--red); } .kpi-red .kpi-value{ color:var(--red); }
.kpi-orange{ background:var(--status-orange-bg); border-left-color:var(--status-orange); } .kpi-orange .kpi-value{ color:var(--status-orange); }
.kpi-gray{ background:var(--gray-bg); border-left-color:var(--gray); } .kpi-gray .kpi-value{ color:var(--gray); }
@media (prefers-reduced-motion: reduce){ .kpi-card{ animation:none; } }

/* =========================================================
   PANELS / CHARTS
   ========================================================= */
.panel-grid{ display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap:16px; }
.panel-wide{ grid-column: span 2; }
.panel{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px; box-shadow: var(--shadow);
  transition: box-shadow .18s ease;
}
.panel:hover{ box-shadow:0 6px 20px rgba(36,28,20,.08); }
.panel h3{ font-size:14px; margin-bottom:12px; }
.panel canvas{ max-height: 260px; }

/* =========================================================
   TOOLBAR / TABLES
   ========================================================= */
.toolbar{ display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; align-items:center;}
.toolbar input[type="search"]{
  flex:1; min-width:220px; padding:9px 12px; border:1px solid var(--border); border-radius:8px; background:#fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.toolbar input[type="search"]:focus, .toolbar select:focus, .toolbar input[type="date"]:focus{
  outline:none; border-color:var(--orange); box-shadow:0 0 0 3px rgba(230,126,34,.15);
}
.toolbar select, .toolbar input[type="date"]{
  padding:9px 12px; border:1px solid var(--border); border-radius:8px; background:#fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.btn{
  border:none; border-radius:8px; padding:9px 16px; font-size:13.5px; font-weight:600;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}
.btn:active{ transform:scale(.97); }
.btn-primary{ background:var(--orange); color:#fff; box-shadow:0 2px 8px rgba(230,126,34,.35); }
.btn-primary:hover{ background:var(--orange-dark); transform:translateY(-1px); box-shadow:0 5px 14px rgba(230,126,34,.42); }
.btn-danger{ background:#B5121B; color:#fff; box-shadow:0 2px 8px rgba(181,18,27,.3); }
.btn-danger:hover{ background:#94090F; transform:translateY(-1px); box-shadow:0 5px 14px rgba(181,18,27,.38); }

/* ---- Fenêtre de confirmation de suppression ---- */
.confirm-delete-box{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; padding:6px 4px 2px; }
.confirm-delete-icon{
  width:52px; height:52px; border-radius:50%; background:#FCEAEA; color:#B5121B;
  display:flex; align-items:center; justify-content:center; font-size:26px; flex-shrink:0;
}
.confirm-delete-title{ font-size:15px; font-weight:700; color:var(--ink); margin:0; }
.confirm-delete-text{ font-size:13px; color:var(--ink-soft); margin:0; line-height:1.5; }

/* =========================================================
   SÉLECTION MULTIPLE (suppression groupée)
   ========================================================= */
.bulk-bar{
  display:none; align-items:center; gap:10px; background:var(--orange-pale); border:1px solid var(--orange-light);
  border-radius:9px; padding:9px 14px; margin-bottom:10px; font-size:12.5px; color:var(--orange-dark); font-weight:600;
}
.bulk-bar.show{ display:flex; }
.bulk-bar button{ margin-left:auto; }
.data-table td.bulk-col, .data-table th.bulk-col{ width:32px; text-align:center; }
.bulk-cb, .bulk-selectall{ width:15px; height:15px; cursor:pointer; }

/* =========================================================
   CATALOGUE : vue grille/liste + vignettes photo
   ========================================================= */
.view-toggle{ display:flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.view-toggle-btn{
  padding:9px 14px; font-size:12.5px; font-weight:600; background:#fff; color:var(--ink-soft); border:none;
  border-right:1px solid var(--border);
}
.view-toggle-btn:last-child{ border-right:none; }
.view-toggle-btn.active{ background:var(--orange); color:#fff; }
.produit-thumb{
  width:38px; height:38px; border-radius:7px; object-fit:cover; background:var(--gray-bg); display:block;
}
.produit-thumb-placeholder{
  width:38px; height:38px; border-radius:7px; background:var(--gray-bg); color:var(--ink-soft);
  display:flex; align-items:center; justify-content:center; font-size:16px;
}
.catalogue-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); gap:14px; }
.produit-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  overflow:hidden; cursor:pointer; transition:transform .12s ease, box-shadow .12s ease; display:flex; flex-direction:column;
}
.produit-card:hover{ transform:translateY(-2px); box-shadow:0 6px 16px rgba(0,0,0,.1); }
.produit-card.inactive{ opacity:.5; }
.produit-card-img{ width:100%; aspect-ratio:1/1; object-fit:cover; background:var(--gray-bg); }
.produit-card-img-placeholder{
  width:100%; aspect-ratio:1/1; background:var(--gray-bg); color:var(--ink-soft);
  display:flex; align-items:center; justify-content:center; font-size:30px;
}
.produit-card-body{ padding:10px 12px; display:flex; flex-direction:column; gap:4px; flex:1; }
.produit-card-name{ font-size:12.5px; font-weight:700; color:var(--ink); line-height:1.3; }
.produit-card-meta{ font-size:10.5px; color:var(--ink-soft); }
.produit-card-price{ font-size:13.5px; font-weight:700; color:var(--orange-dark); margin-top:auto; }
.produit-card-price-promo{ text-decoration:line-through; color:var(--ink-soft); font-size:10.5px; font-weight:400; margin-right:4px; }
.produit-card-stock{ position:absolute; margin:8px; padding:2px 8px; border-radius:999px; font-size:9.5px; font-weight:700; }
.produit-card-img-wrap{ position:relative; }
.btn-primary:hover{ background:var(--orange-dark); }
.btn-ghost{ background:transparent; color:var(--ink-soft); border:1px solid var(--border); }
.btn-icon{
  background:var(--bg); border:1px solid transparent; padding:5px 7px; font-size:14px; border-radius:7px;
  transition:background .15s ease, border-color .15s ease, transform .12s ease;
}
.btn-icon:hover{ background:var(--orange-pale); border-color:var(--orange-light); transform:translateY(-1px); }
.btn-icon:active{ transform:scale(.92); }
.btn-export{ background:var(--surface); color:var(--orange-dark); border:1px solid var(--orange); transition:background .15s ease, transform .12s ease, box-shadow .15s ease; }
.btn-export:hover{ background:var(--orange-pale); transform:translateY(-1px); box-shadow:0 4px 12px rgba(230,126,34,.18); }
.btn-export-sm{ padding:5px 10px; font-size:12px; }

.panel-head-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }

/* =========================================================
   AVIS CLIENTS (tableau de bord)
   ========================================================= */
.avis-panel-head{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:14px; }
.avis-summary{ display:flex; gap:18px; }
.avis-summary-item{ display:flex; align-items:center; gap:8px; }
.avis-summary-item div{ display:flex; flex-direction:column; }
.avis-summary-emoji{ font-size:26px; }
.avis-summary-item strong{ font-size:17px; font-family:var(--font-display); color:var(--ink); line-height:1.1; }
.avis-summary-item span{ font-size:10px; text-transform:uppercase; color:var(--ink-soft); letter-spacing:.03em; }

.avis-list{ display:flex; flex-direction:column; gap:0; max-height:340px; overflow-y:auto; }
.avis-row{ display:flex; gap:12px; padding:12px 4px; border-bottom:1px solid var(--border); }
.avis-row:last-child{ border-bottom:none; }
.avis-row-emoji{ font-size:22px; flex-shrink:0; }
.avis-row-body{ flex:1; min-width:0; }
.avis-row-head{ display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:12px; }
.avis-row-numero{ font-weight:700; color:var(--orange-dark); }
.avis-row-agent{ color:var(--ink-soft); font-size:11px; }
.avis-row-date{ color:var(--ink-soft); font-size:11px; white-space:nowrap; }
.avis-row-comment{ font-size:12.5px; color:var(--ink); margin-top:3px; font-style:italic; }
.avis-empty{ text-align:center; color:var(--ink-soft); padding:24px; font-size:13px; }
.panel-head-row h3{ margin:0; }

.data-table th[data-key]{ cursor:pointer; user-select:none; }
.data-table th[data-key]:hover{ color:var(--orange); }
.data-table th[aria-sort="asc"]::after{ content:" \25B2"; font-size:9px; }
.data-table th[aria-sort="desc"]::after{ content:" \25BC"; font-size:9px; }

.table-wrap{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:auto; box-shadow:var(--shadow);}
.data-table{ width:100%; border-collapse:collapse; font-size:13px; }
.data-table th{
  text-align:left; padding:11px 12px; background:var(--orange-pale); color:var(--orange-dark);
  font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; white-space:nowrap; position:sticky; top:0;
  border-bottom:2px solid var(--orange-light);
}
.data-table td{ padding:10px 12px; border-top:1px solid var(--border); white-space:nowrap; font-variant-numeric:tabular-nums; }
.data-table tbody tr{ transition: background .12s ease; }
.data-table tbody tr:nth-child(even){ background:color-mix(in srgb, var(--surface) 96%, var(--ink) 4%); }
.data-table tbody tr:hover{ background: var(--orange-pale); }
.data-table.small th, .data-table.small td{ padding:7px 10px; font-size:12.5px; }

.status-pill{ padding:3px 10px; border-radius:999px; font-size:11.5px; font-weight:700; display:inline-block; }
.status-Livré{ background:var(--green-bg); color:var(--green); }
.status-Annulé{ background:var(--red-bg); color:var(--red); }
.status-Reporté{ background:var(--status-orange-bg); color:var(--status-orange); }
.status-En.attente, .status-En_attente{ background:var(--gray-bg); color:var(--gray); }

.period-bar{ display:flex; gap:16px; align-items:end; margin-bottom:6px; }
.period-bar label{ display:flex; flex-direction:column; gap:4px; font-size:12px; color:var(--ink-soft); font-weight:600; }

/* =========================================================
   MODAL
   ========================================================= */
.modal-overlay{
  position:fixed; inset:0; background:rgba(20,15,10,.55); backdrop-filter:blur(2px);
  display:flex; align-items:center; justify-content:center; z-index:100;
}
.modal-overlay.hidden{ display:none; }
.modal{
  background:var(--surface); border-radius:14px; width:460px; max-width:92vw; max-height:88vh; max-height:88dvh;
  display:flex; flex-direction:column; box-shadow:0 24px 70px rgba(0,0,0,.28);
  animation: modalPop .22s cubic-bezier(.2,.8,.3,1.1);
}
@keyframes modalPop{ from{ opacity:0; transform:scale(.95) translateY(10px);} to{ opacity:1; transform:scale(1) translateY(0);} }
.modal-header{
  display:flex; justify-content:space-between; align-items:center; padding:18px 22px;
  border-bottom:1px solid var(--border); flex-shrink:0; background:var(--orange-pale); border-radius:14px 14px 0 0;
}
.modal-header h2, .modal-header h3{ font-family:var(--font-display); }
.modal-close{ background:none; border:none; font-size:20px; color:var(--ink-soft); transition:color .15s ease, transform .15s ease; }
.modal-close:hover{ color:var(--red); transform:rotate(90deg); }
.modal-body{ padding:20px 22px; overflow-y:auto; display:flex; flex-direction:column; gap:12px; min-height:0; }
.modal-body label, .panel-form label{
  display:flex; flex-direction:column; gap:6px; font-size:12.5px; font-weight:600; color:var(--ink-soft); margin-bottom:2px;
}
.modal-body input, .modal-body select, .modal-body textarea,
.panel-form input, .panel-form select, .panel-form textarea{
  padding:10px 12px; border:1px solid var(--border); border-radius:8px; font-size:13.5px; font-family:inherit;
  width:100%; background:var(--surface); color:var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus,
.panel-form input:focus, .panel-form select:focus, .panel-form textarea:focus{
  outline:none; border-color:var(--orange); box-shadow:0 0 0 3px var(--orange-light);
}
.modal-body input:disabled, .panel-form input:disabled{ background:var(--gray-bg); color:var(--ink-soft); cursor:not-allowed; }
.panel-form{ display:flex; flex-direction:column; gap:14px; }
.item-row{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:6px; }
@media (prefers-reduced-motion: reduce){ .modal{ animation:none; } }

/* ---- Autocomplete de recherche produit (bon de commande fournisseur) ---- */
.cf-produit-recherche{ width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:8px; font-size:13px; }
.cf-produit-resultats{
  position:absolute; top:100%; left:0; right:0; z-index:50; background:#fff; border:1px solid var(--border);
  border-radius:8px; box-shadow:0 8px 20px rgba(36,28,20,.15); max-height:220px; overflow-y:auto; margin-top:2px;
}
.cf-produit-resultat-item{ display:flex; justify-content:space-between; gap:10px; padding:8px 10px; font-size:12.5px; cursor:pointer; border-bottom:1px solid var(--border); }
.cf-produit-resultat-item:last-child{ border-bottom:none; }
.cf-produit-resultat-item:hover{ background:var(--orange-pale); }
.cf-produit-resultat-vide{ padding:10px; font-size:12.5px; color:var(--ink-soft); text-align:center; }
.item-variante{ flex:0 0 170px; padding:8px 10px; border:1px solid var(--border); border-radius:8px; font-size:12.5px; }

/* =========================================================
   SECTIONS DE FORMULAIRE — regroupe visuellement les champs par thème
   (ex. "Informations générales", "Tarification", "Recette"), avec un
   en-tête icône + titre, pour des formulaires longs plus lisibles et
   plus agréables à remplir.
   ========================================================= */
.form-section{
  background:var(--surface); border:1px solid var(--border); border-radius:10px;
  padding:14px 16px; margin-bottom:2px;
}
.form-section-titre{
  display:flex; align-items:center; gap:8px; font-size:12px; font-weight:800; text-transform:uppercase;
  letter-spacing:.03em; color:var(--orange-dark); margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--border);
}
.form-section-titre .icone{ font-size:15px; }
.form-section .modal-body-row{ display:flex; gap:10px; flex-wrap:wrap; }
.form-section .modal-body-row > label{ flex:1; min-width:120px; }
.form-grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
@media (max-width:480px){ .form-grid-2{ grid-template-columns:1fr; } }

/* =========================================================
   ÉCHÉANCES DE PAIEMENT FOURNISSEUR (détail par fournisseur)
   ========================================================= */
.echeance-row{
  display:flex; align-items:center; gap:6px; padding:7px 4px; border-bottom:1px solid var(--border); font-size:12px;
}
.echeance-row.payee{ background:#EAF7EC; }
.echeance-check{ flex:0 0 auto; }
.echeance-date-input{ flex:1; padding:6px 8px; border:1px solid var(--border); border-radius:6px; font-size:12px; }
.echeance-montant-input{ flex:1; padding:6px 8px; border:1px solid var(--border); border-radius:6px; font-size:12px; }
.echeance-date-paiement{ flex:1; padding:6px 8px; border:1px solid #1E7A34; border-radius:6px; font-size:12px; color:#1E7A34; }
.echeance-statut-label{ flex:1; text-align:center; font-size:11px; color:var(--ink-soft); font-style:italic; }
.services-section{
  background:var(--orange-pale); border-radius:10px; padding:12px 14px; display:flex; flex-direction:column; gap:8px;
}
.services-optional-tag{
  display:inline-block; background:var(--orange-light); color:var(--orange-dark); font-size:9.5px; font-weight:700;
  text-transform:uppercase; letter-spacing:.03em; padding:2px 7px; border-radius:999px; margin-left:6px;
}
.item-row .service-libelle{ flex:2; }
.item-row .service-montant{ flex:1; }
.item-row .item-produit{ flex:1; }
.item-row .item-qte{ width:70px; flex:none; }

/* =========================================================
   ZONE DE RECHERCHE D'ARTICLE (remplace le long menu déroulant)
   ========================================================= */
.produit-combo{ position:relative; flex:1; min-width:0; }
.produit-combo-input{
  width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:8px; font-size:13px;
  background:#fff url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b5f52' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size:15px; padding-right:32px;
}
.produit-combo-input:focus{ outline:none; border-color:var(--orange); box-shadow:0 0 0 3px var(--orange-light); }
.produit-combo-results{
  position:absolute; top:calc(100% + 4px); left:0; right:0; background:#fff; border:1px solid var(--border);
  border-radius:9px; box-shadow:0 10px 26px rgba(0,0,0,.15); max-height:280px; overflow-y:auto; z-index:80;
}
.produit-combo-results.hidden{ display:none; }
.produit-combo-row{
  display:flex; align-items:center; gap:10px; padding:9px 12px; cursor:pointer; font-size:12.5px;
  border-bottom:1px solid var(--border);
}
.produit-combo-row:last-child{ border-bottom:none; }
.produit-combo-row:hover, .produit-combo-row.active{ background:var(--orange-pale); }
.produit-combo-row img{ width:30px; height:30px; border-radius:6px; object-fit:cover; flex-shrink:0; }
.produit-combo-row-placeholder{
  width:30px; height:30px; border-radius:6px; background:var(--gray-bg); display:flex; align-items:center;
  justify-content:center; font-size:14px; flex-shrink:0;
}
.produit-combo-empty{ padding:14px; text-align:center; color:var(--ink-soft); font-size:12.5px; }

/* =========================================================
   MES NOTES (bloc-notes personnel)
   ========================================================= */
.notes-board{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:16px; }
.note-card{
  border-radius:10px; padding:14px 16px; min-height:140px; display:flex; flex-direction:column; gap:8px;
  box-shadow:0 3px 10px rgba(0,0,0,.08); position:relative; cursor:pointer; transition:transform .12s ease;
}
.note-card:hover{ transform:translateY(-2px) rotate(-.3deg); }
.note-card-title{ font-weight:700; font-size:13.5px; font-family:var(--font-display); padding-right:20px; }
.note-card-content{ font-size:12.5px; line-height:1.5; white-space:pre-wrap; flex:1; overflow:hidden; }
.note-card-date{ font-size:9.5px; opacity:.6; }
.note-card-del{
  position:absolute; top:10px; right:10px; background:rgba(0,0,0,.06); border:none; border-radius:6px;
  width:22px; height:22px; font-size:11px; color:inherit; opacity:.6;
}
.note-card-del:hover{ opacity:1; background:rgba(0,0,0,.12); }
.note-card.jaune{ background:#FFF6C4; color:#5c5326; }
.note-card.orange{ background:#FFE1C2; color:#7a3d10; }
.note-card.vert{ background:#D8F5D0; color:#245c1a; }
.note-card.bleu{ background:#D6E8FA; color:#1a3d61; }
.note-card.rose{ background:#FBDCE8; color:#6b1d40; }
.note-card.violet{ background:#E7DBFA; color:#432a70; }
.note-color-picker{ display:flex; gap:8px; }
.note-color-dot{
  width:26px; height:26px; border-radius:50%; cursor:pointer; border:2px solid transparent;
}
.note-color-dot.selected{ border-color:var(--ink); }
.note-color-dot.jaune{ background:#FFF6C4; } .note-color-dot.orange{ background:#FFE1C2; }
.note-color-dot.vert{ background:#D8F5D0; } .note-color-dot.bleu{ background:#D6E8FA; }
.note-color-dot.rose{ background:#FBDCE8; } .note-color-dot.violet{ background:#E7DBFA; }

/* =========================================================
   ESPACE MARKETING (campagnes + tâches kanban)
   ========================================================= */
.campagnes-list{ display:flex; flex-direction:column; gap:10px; margin-bottom:20px; }
.campagne-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:14px 16px; display:flex; align-items:center; gap:16px; cursor:pointer;
}
.campagne-card-body{ flex:1; min-width:0; }
.campagne-card-nom{ font-weight:700; font-size:13.5px; }
.campagne-card-dates{ font-size:11.5px; color:var(--ink-soft); margin-top:2px; }
.campagne-card-progress{ font-size:11px; color:var(--ink-soft); }
.campagne-statut-badge{ font-size:10px; font-weight:700; padding:3px 9px; border-radius:999px; white-space:nowrap; }
.campagne-statut-planifiee{ background:#F1F1F1; color:#595959; }
.campagne-statut-en_cours{ background:#EAF1FB; color:#2E5395; }
.campagne-statut-terminee{ background:#EAF7EC; color:#1E7A34; }
.campagne-statut-annulee{ background:#FCEAEA; color:#B5121B; }

.kanban-board{ display:grid; grid-template-columns:repeat(3, 1fr); gap:14px; }
.contenu-kanban{ grid-template-columns:repeat(5, 1fr); }
@media (max-width:1100px){ .contenu-kanban{ grid-template-columns:repeat(2, 1fr); } }
.contenu-type-badge{
  display:inline-flex; align-items:center; gap:4px; font-size:9.5px; font-weight:700; padding:2px 8px;
  border-radius:999px; align-self:flex-start;
}
.contenu-type-live_tiktok{ background:#FFE1EC; color:#B5124A; }
.contenu-type-shooting_photo{ background:#E7DBFA; color:#5B2E8C; }
.contenu-type-shooting_video{ background:#DCE9FC; color:#1A4C8C; }
.contenu-type-video{ background:#DCE9FC; color:#1A4C8C; }
.contenu-type-post{ background:#EAF7EC; color:#1E7A34; }
.contenu-type-story{ background:#FFF3E6; color:#9C5700; }
.contenu-type-autre{ background:#F1F1F1; color:#595959; }
.tache-card-link{ font-size:10.5px; color:#2E5395; word-break:break-all; }

/* =========================================================
   PROJETS — DIAGRAMME DE GANTT
   ========================================================= */
.gantt-layout{ display:flex; border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; background:#fff; box-shadow:var(--shadow); }
.gantt-labels-col{ flex-shrink:0; width:220px; border-right:1px solid var(--border); }
.gantt-labels-header-spacer{ height:40px; border-bottom:1px solid var(--border); background:var(--bg); box-sizing:border-box; }
.gantt-label-row{
  height:38px; display:flex; align-items:center; padding:0 12px; font-size:12px; border-bottom:1px solid var(--border);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; box-sizing:border-box; cursor:pointer;
}
.gantt-label-row.projet-row{ font-weight:700; background:var(--bg); }
.gantt-label-row.tache-row{ padding-left:26px; color:var(--ink-soft); font-size:11.5px; }
.gantt-scroll-area{ flex:1; overflow-x:auto; }
.gantt-dates-header{ height:40px; display:flex; border-bottom:1px solid var(--border); background:var(--bg); box-sizing:border-box; }
.gantt-date-cell{
  flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:10px; color:var(--ink-soft);
  border-right:1px solid var(--border); font-weight:600; box-sizing:border-box; text-align:center; line-height:1.2;
}
.gantt-bar-row{ height:38px; position:relative; border-bottom:1px solid var(--border); box-sizing:border-box; }
.gantt-bar-row.projet-row{ background:var(--bg); }
.gantt-bar{
  position:absolute; top:7px; height:24px; border-radius:6px; cursor:pointer; display:flex; align-items:center;
  padding:0 8px; font-size:10px; color:#fff; font-weight:600; white-space:nowrap; overflow:hidden;
  box-shadow:0 1px 3px rgba(0,0,0,.2); min-width:8px;
}
.gantt-bar-progress{ position:absolute; top:0; left:0; bottom:0; background:rgba(255,255,255,.4); border-radius:6px 0 0 6px; }
.gantt-bar-text{ position:relative; z-index:1; }
.gantt-today-line{ position:absolute; top:0; bottom:0; width:2px; background:#B5121B; z-index:5; pointer-events:none; }

/* =========================================================
   EMPLOYÉS & POINTAGE
   ========================================================= */
.employes-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:16px; }

/* =========================================================
   ESPACE DE TRAVAIL (documents & tableaux)
   ========================================================= */
.documents-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:14px; }
.doc-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:16px; cursor:pointer; display:flex; flex-direction:column; gap:6px; transition:transform .12s ease;
}
.doc-card:hover{ transform:translateY(-2px); }
.doc-card-icon{ font-size:26px; }
.doc-card-titre{ font-weight:700; font-size:13.5px; word-break:break-word; }
.doc-card-meta{ font-size:11px; color:var(--ink-soft); }
/* =========================================================
   ORGANIGRAMME (arbre hiérarchique en CSS pur)
   ========================================================= */
.org-tree, .org-tree ul{ list-style:none; margin:0; padding:0; position:relative; }
.org-tree{ display:flex; justify-content:center; }
.org-tree ul{ display:flex; padding-top:24px; }
.org-tree li{ position:relative; padding:0 10px; text-align:center; }
.org-tree li::before{
  content:''; position:absolute; top:0; left:50%; width:1px; height:24px; background:var(--border);
}
.org-tree > li::before{ display:none; }
.org-tree ul li::after{
  content:''; position:absolute; top:0; left:0; right:50%; height:1px; background:var(--border);
}
.org-tree ul li:first-child::after{ left:50%; }
.org-tree ul li:last-child::after{ right:50%; }
.org-tree ul li:only-child::after{ display:none; }
.org-node{
  display:inline-flex; flex-direction:column; align-items:center; gap:2px; background:var(--surface);
  border:1px solid var(--border); border-radius:10px; padding:10px 14px; box-shadow:var(--shadow); min-width:130px;
}
.org-node-avatar{
  width:34px; height:34px; border-radius:50%; background:var(--orange-pale); color:var(--orange-dark);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; overflow:hidden;
}
.org-node-avatar img{ width:100%; height:100%; object-fit:cover; }
.org-node-nom{ font-size:12px; font-weight:700; }
.org-node-poste{ font-size:10.5px; color:var(--ink-soft); }

/* =========================================================
   RECRUTEMENT (pipeline façon kanban)
   ========================================================= */
.recrutement-pipeline-cols{ display:flex; gap:12px; min-width:max-content; }
.recrutement-col{ flex:0 0 220px; background:var(--gray-bg); border-radius:10px; padding:10px; }
.recrutement-col-header{ font-size:11px; font-weight:700; text-transform:uppercase; color:var(--ink-soft); margin-bottom:8px; display:flex; justify-content:space-between; }
.recrutement-card{
  background:var(--surface); border-radius:8px; padding:10px; margin-bottom:8px; box-shadow:var(--shadow);
  cursor:pointer; font-size:12px;
}
.recrutement-card:hover{ box-shadow:0 2px 8px rgba(0,0,0,.12); }
.recrutement-card-nom{ font-weight:700; margin-bottom:2px; }
.recrutement-card-poste{ color:var(--ink-soft); font-size:11px; }

/* =========================================================
   PERSONNALISER LE MENU (glisser-déposer)
   ========================================================= */
.menu-org-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px; }
.menu-org-groupe{
  background:var(--surface); border:2px dashed var(--border); border-radius:10px; padding:12px; min-height:130px;
  transition:background .12s ease, border-color .12s ease;
}
.menu-org-groupe.drag-over{ background:var(--orange-pale); border-color:var(--orange-dark); }
.menu-org-groupe-titre{ font-size:11.5px; font-weight:700; text-transform:uppercase; color:var(--ink-soft); margin-bottom:8px; }
.menu-org-item{
  background:var(--gray-bg); border:1px solid var(--border); border-radius:6px; padding:7px 10px; margin-bottom:6px;
  font-size:12.5px; cursor:grab; user-select:none;
}
.menu-org-item:active{ cursor:grabbing; }
.menu-org-item.dragging{ opacity:.35; }
.menu-org-fixe{
  grid-column:1 / -1; background:var(--orange-pale); color:var(--orange-dark); font-weight:600;
  font-size:12.5px; padding:10px 14px; border-radius:8px; margin-bottom:2px;
}

.doc-editor-toolbar{ display:flex; gap:4px; flex-wrap:wrap; border:1px solid var(--border); border-radius:8px 8px 0 0; padding:6px; background:var(--gray-bg); }
.doc-editor-toolbar button{
  background:#fff; border:1px solid var(--border); border-radius:6px; width:30px; height:30px; font-size:13px; cursor:pointer;
}
.doc-editor-toolbar button:hover{ background:var(--orange-pale); }
.doc-editor-content{
  border:1px solid var(--border); border-top:none; border-radius:0 0 8px 8px; padding:16px; min-height:340px;
  font-size:14px; line-height:1.6; outline:none;
}
.doc-editor-content:focus{ box-shadow:0 0 0 2px var(--orange-pale) inset; }
.tableau-editor-wrap{ overflow:auto; border:1px solid var(--border); border-radius:8px; max-height:420px; }
.tableau-editor{ border-collapse:collapse; }
.tableau-editor td{
  border:1px solid var(--border); padding:0; min-width:90px;
}
.tableau-editor td[contenteditable]{ padding:6px 8px; font-size:12.5px; outline:none; }
.tableau-editor td[contenteditable]:focus{ background:var(--orange-pale); }
.tableau-editor th{ background:var(--gray-bg); font-size:11px; color:var(--ink-soft); padding:4px 8px; border:1px solid var(--border); }
.entrepots-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:16px; }
.livreurs-bilan-grid{ display:grid; grid-template-columns:repeat(4, 1fr); gap:16px; }

/* =========================================================
   AGENDA (calendrier mensuel)
   ========================================================= */
.agenda-grid-header{
  display:grid; grid-template-columns:repeat(7, 1fr); gap:6px; margin-top:16px; margin-bottom:6px;
  font-size:11px; font-weight:700; color:var(--ink-soft); text-transform:uppercase; text-align:center;
}
.agenda-grid{ display:grid; grid-template-columns:repeat(7, 1fr); gap:6px; }
.agenda-day{
  min-height:96px; background:var(--surface); border:1px solid var(--border); border-radius:8px;
  padding:6px; cursor:pointer; display:flex; flex-direction:column; gap:3px; transition:background .12s ease;
}
.agenda-day:hover{ background:var(--orange-pale); }
.agenda-day.hors-mois{ opacity:.4; }
.agenda-day.aujourdhui{ border-color:var(--orange); box-shadow:0 0 0 1px var(--orange) inset; }
.agenda-day-number{ font-size:12px; font-weight:700; color:var(--ink); }
.agenda-day-events{ display:flex; flex-direction:column; gap:2px; overflow:hidden; }
.agenda-event-pill{
  font-size:10px; padding:2px 5px; border-radius:5px; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.agenda-event-pill.plus{ background:transparent !important; color:var(--ink-soft) !important; font-weight:700; }
@media (max-width:820px){
  .agenda-grid-header{ display:none; }
  .agenda-grid{ grid-template-columns:1fr; }
  .agenda-day{ min-height:auto; flex-direction:row; align-items:center; gap:10px; }
}
@media (max-width:1200px){ .livreurs-bilan-grid{ grid-template-columns:repeat(3, 1fr); } }
@media (max-width:820px){ .livreurs-bilan-grid{ grid-template-columns:repeat(2, 1fr); } }
@media (max-width:560px){ .livreurs-bilan-grid{ grid-template-columns:1fr; } }
.employe-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:16px; cursor:pointer; display:flex; flex-direction:column; gap:8px; transition:transform .12s ease;
}
.employe-card:hover{ transform:translateY(-2px); }
.employe-card.inactif{ opacity:.55; }
.employe-card-top{ display:flex; align-items:center; gap:12px; }
.employe-card-avatar{
  width:46px; height:46px; border-radius:50%; background:var(--orange-pale); color:var(--orange-dark);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:16px; flex-shrink:0; overflow:hidden;
}
.employe-card-avatar img{ width:100%; height:100%; object-fit:cover; }
.employe-card-nom{ font-weight:700; font-size:13.5px; }
.employe-card-poste{ font-size:11.5px; color:var(--ink-soft); }
.employe-card-meta{ font-size:11px; color:var(--ink-soft); display:flex; flex-direction:column; gap:3px; }

.livreur-bilan-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:18px 16px; cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:4px; text-align:center;
  transition:transform .12s ease;
}
.livreur-bilan-card:hover{ transform:translateY(-2px); }
.livreur-bilan-photo{
  width:72px; height:72px; border-radius:50%; overflow:hidden; background:var(--orange-pale);
  display:flex; align-items:center; justify-content:center; font-size:28px; margin-bottom:6px;
}
.livreur-bilan-photo img{ width:100%; height:100%; object-fit:cover; }
.employe-contrat-badge{
  align-self:flex-start; font-size:9.5px; font-weight:700; padding:2px 9px; border-radius:999px; text-transform:uppercase;
}
.employe-contrat-cdi{ background:#EAF7EC; color:#1E7A34; } .employe-contrat-cdd{ background:#EAF1FB; color:#2E5395; }
.employe-contrat-stage{ background:#FFF3E6; color:#9C5700; } .employe-contrat-consultant{ background:#E7DBFA; color:#5B2E8C; }
.employe-contrat-autre{ background:#F1F1F1; color:#595959; }

.pointage-widget{ display:flex; align-items:center; justify-content:space-between; gap:16px; padding:20px 24px; flex-wrap:wrap; margin-bottom:20px; }
.pointage-status{ font-size:14px; font-weight:600; color:var(--ink); }
.pointage-status .heure{ color:var(--orange-dark); font-weight:800; }
.pointage-buttons{ display:flex; gap:10px; flex-wrap:wrap; }

/* =========================================================
   SCANNER QR (pointage GPS + code QR)
   ========================================================= */
.scanner-overlay{
  position:fixed; inset:0; background:rgba(20,15,10,.75); z-index:150; display:flex;
  align-items:center; justify-content:center; padding:16px;
}
.scanner-box{
  background:#fff; border-radius:14px; padding:20px; width:380px; max-width:100%;
  display:flex; flex-direction:column; align-items:center; gap:12px; text-align:center;
}
.scanner-title{ font-weight:700; font-size:14px; margin:0; }
.scanner-hint{ font-size:12px; color:var(--ink-soft); margin:0; }
#scanner-video{ width:100%; border-radius:10px; background:#000; aspect-ratio:1/1; object-fit:cover; }

/* =========================================================
   HEURES DE TRAVAIL — résumé par employé
   ========================================================= */
.heures-summary-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:12px; margin:14px 0 20px; }
.heures-summary-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:14px 16px; display:flex; flex-direction:column; gap:4px;
}
.heures-summary-nom{ font-weight:700; font-size:12.5px; }
.heures-summary-total{ font-family:var(--font-display); font-size:22px; font-weight:800; color:var(--orange-dark); }
.heures-summary-meta{ font-size:10.5px; color:var(--ink-soft); }
.heures-summary-card.alerte .heures-summary-total{ color:#B5121B; }

/* =========================================================
   DÉPENSES — répartition par catégorie
   ========================================================= */
.depenses-categories-summary{ display:flex; flex-wrap:wrap; gap:10px; margin:14px 0 18px; }
.dep-cat-chip{
  display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border);
  border-radius:999px; padding:7px 14px; font-size:12px; box-shadow:var(--shadow);
}
.dep-cat-dot{ width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.dep-cat-montant{ font-weight:700; }
.dep-cat-badge{
  display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700; padding:2px 9px; border-radius:999px;
}

/* =========================================================
   TOTAL EN DIRECT DANS LE FORMULAIRE DE COMMANDE
   ========================================================= */
.cmd-total-live{
  display:grid; grid-template-columns:1fr auto; gap:4px 12px; background:var(--orange-pale);
  border:1px solid var(--orange-light); border-radius:9px; padding:12px 16px; font-size:12.5px; color:var(--ink-soft);
}
.cmd-total-live strong{ text-align:right; color:var(--ink); }
#cmd-total-remise, #cmd-total-remise-label{ color:#B5121B; }
.cmd-total-final-label{ font-weight:700; color:var(--ink); font-size:13.5px; padding-top:6px; border-top:1px solid var(--orange-light); margin-top:2px; }
.cmd-total-final-value{ font-size:15px; color:var(--orange-dark) !important; padding-top:6px; border-top:1px solid var(--orange-light); margin-top:2px; }
.kanban-col{ background:var(--bg); border-radius:var(--radius); padding:10px; min-height:120px; }
.kanban-col-title{ font-size:12px; font-weight:700; color:var(--ink-soft); margin-bottom:8px; padding:0 4px; }
.kanban-col-body{ display:flex; flex-direction:column; gap:8px; min-height:60px; }
.tache-card{
  background:var(--surface); border:1px solid var(--border); border-radius:9px; padding:10px 12px;
  box-shadow:var(--shadow); cursor:pointer; display:flex; flex-direction:column; gap:5px;
}
.tache-card-titre{ font-size:12.5px; font-weight:700; }
.tache-card-meta{ font-size:10.5px; color:var(--ink-soft); display:flex; justify-content:space-between; gap:6px; }
.tache-card-assigne{
  display:inline-flex; align-items:center; gap:4px; background:var(--orange-pale); color:var(--orange-dark);
  font-size:10px; font-weight:700; padding:2px 8px; border-radius:999px; align-self:flex-start;
}
.tache-card.echeance-proche .tache-card-meta{ color:#B8630A; font-weight:700; }
.tache-card.echeance-depassee .tache-card-meta{ color:#B5121B; font-weight:700; }

@media (max-width:800px){ .kanban-board{ grid-template-columns:1fr; } }
.reprise-suggestion{
  display:flex; align-items:center; gap:10px; background:#EAF1FB; border:1px solid #C7D9F0; border-radius:8px;
  padding:9px 12px; font-size:12px; color:#2E5395;
}
.reprise-suggestion #btn-reprise{ flex-shrink:0; padding:5px 12px; font-size:11.5px; }
.item-row .item-remove{ flex:none; color:var(--red); }

.account-avatar-row{ display:flex; align-items:center; gap:16px; margin-bottom:18px; }
.account-avatar-preview{
  width:72px; height:72px; border-radius:50%; background:var(--orange-pale); color:var(--orange-dark);
  display:flex; align-items:center; justify-content:center; font-family:var(--font-display); font-weight:800;
  font-size:24px; flex-shrink:0; overflow:hidden; border:2px dashed var(--orange-light); padding:0;
}
.account-avatar-preview img{ width:100%; height:100%; object-fit:cover; }

/* =========================================================
   PARAMÈTRES & MON COMPTE (mise en page en cartes)
   ========================================================= */
.params-grid{ display:grid; grid-template-columns:1fr 1fr; gap:18px; align-items:start; }
.params-grid-3col{ grid-template-columns:1fr 1fr 1fr; }
@media (max-width:1100px){ .params-grid-3col{ grid-template-columns:1fr 1fr; } }

/* =========================================================
   IMPORT / EXPORT
   ========================================================= */
/* =========================================================
   TRI AVANCÉ (contrôle réutilisable)
   ========================================================= */
.sort-control{ display:flex; align-items:center; gap:0; }
.sort-control select{
  border-radius:8px 0 0 8px; border-right:none; padding:9px 10px; border:1px solid var(--border);
  font-size:12.5px; background:#fff; color:var(--ink); max-width:160px;
}
.sort-dir-btn{
  border-radius:0 8px 8px 0; border:1px solid var(--border); background:#fff; color:var(--ink-soft);
  padding:9px 12px; font-size:13px; font-weight:700; transition: background .15s ease, color .15s ease;
}
.sort-dir-btn:hover{ background:var(--orange-pale); color:var(--orange-dark); }
.sort-dir-btn.active{ background:var(--orange); color:#fff; border-color:var(--orange); }

/* =========================================================
   CALENDRIER DES LIVRAISONS
   ========================================================= */
.cal-toolbar{ align-items:center; }
.cal-month-label{ font-size:15px; text-transform:capitalize; min-width:170px; text-align:center; }
.cal-legend{ display:flex; gap:12px; margin-left:auto; flex-wrap:wrap; font-size:11px; color:var(--ink-soft); }
.cal-legend span{ display:flex; align-items:center; gap:5px; }
.cal-legend i{ width:9px; height:9px; border-radius:50%; display:inline-block; }
.cal-grid{ display:grid; grid-template-columns:repeat(7, 1fr); gap:6px; }
#cal-weekdays{
  margin-top:14px; text-align:center; font-size:11px; font-weight:700; color:var(--ink-soft);
  text-transform:uppercase; letter-spacing:.03em;
}
.cal-grid-body{ margin-top:6px; }
.cal-day{
  background:var(--surface); border:1px solid var(--border); border-radius:9px; min-height:96px;
  padding:6px; display:flex; flex-direction:column; gap:3px; cursor:default;
}
.cal-day.other-month{ opacity:.4; }
.cal-day.today{ border-color:var(--orange); box-shadow:0 0 0 2px var(--orange-light); }
.cal-day-num{ font-size:11.5px; font-weight:700; color:var(--ink-soft); }
.cal-day.today .cal-day-num{ color:var(--orange-dark); }
.cal-pill{
  font-size:9.5px; padding:2px 6px; border-radius:5px; color:#fff; white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; cursor:pointer; transition:transform .1s ease;
}
.cal-pill:hover{ transform:scale(1.03); }
.cal-more{ font-size:9.5px; color:var(--ink-soft); cursor:pointer; text-decoration:underline; }

/* =========================================================
   PLANNING ÉQUIPE
   ========================================================= */
.plan-board{ display:flex; flex-direction:column; gap:8px; max-height:72vh; overflow-y:auto; }
.plan-day-row{
  background:var(--surface); border:1px solid var(--border); border-radius:9px; padding:10px 14px;
  display:flex; align-items:flex-start; gap:14px; flex-wrap:wrap;
}
.plan-day-row.today{ border-color:var(--orange); box-shadow:0 0 0 2px var(--orange-light); }
.plan-day-row-label{ font-size:12px; font-weight:700; color:var(--ink); min-width:120px; flex-shrink:0; text-transform:capitalize; }
.plan-day-row-entries{ display:flex; flex-wrap:wrap; gap:6px; flex:1; min-width:180px; }
.plan-entry{
  background:var(--orange-pale); border-left:3px solid var(--orange); border-radius:6px; padding:5px 9px;
  font-size:11px; position:relative; padding-right:20px;
}
.plan-entry.repos{ background:#EAF1FB; border-left-color:#2E5395; }
.plan-entry.conge{ background:#EDE7F6; border-left-color:#5B2E8C; }
.plan-entry.absence{ background:#FCEAEA; border-left-color:#B5121B; }
.plan-entry-name{ font-weight:700; }
.plan-entry-time{ color:var(--ink-soft); margin-left:4px; }
.plan-entry-del{
  position:absolute; top:3px; right:5px; font-size:11px; color:var(--ink-soft); cursor:pointer;
  background:none; border:none; line-height:1;
}
.plan-entry-del:hover{ color:#B5121B; }
.plan-empty-day{ font-size:10.5px; color:var(--ink-soft); font-style:italic; }

/* =========================================================
   MESSAGERIE
   ========================================================= */
.msg-layout{ display:grid; grid-template-columns:260px 1fr; gap:16px; height:74vh; }
.msg-contacts-col{ display:flex; flex-direction:column; min-height:0; }
.msg-contacts-col .msg-contacts{ flex:1; }
.msg-contacts{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  overflow-y:auto; padding:10px; box-shadow:var(--shadow);
}
.msg-contact{
  display:flex; align-items:center; gap:10px; padding:10px 11px; border-radius:12px; cursor:pointer;
  font-size:12.5px; transition:background .18s ease, transform .12s ease; margin-bottom:2px;
}
.msg-contact:hover{ background:var(--orange-pale); }
.msg-contact:active{ transform:scale(.98); }
.msg-contact.active{ background:linear-gradient(135deg, var(--orange), var(--orange-dark)); color:#fff; box-shadow:0 2px 10px rgba(230,126,34,.35); }
.msg-contact-avatar{
  position:relative; width:36px; height:36px; border-radius:50%;
  background:linear-gradient(135deg, var(--orange-pale), #fde8cf); color:var(--orange-dark);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex-shrink:0; overflow:hidden;
  box-shadow:0 1px 3px rgba(36,28,20,.12);
}
.msg-contact.active .msg-contact-avatar{ background:rgba(255,255,255,.25); color:#fff; box-shadow:none; }
.msg-contact-avatar img{ width:100%; height:100%; object-fit:cover; }
.msg-contact-name{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; }
.msg-contact-unread{
  background:#B5121B; color:#fff; font-size:10px; font-weight:700; border-radius:999px;
  padding:2px 7px; min-width:17px; text-align:center; box-shadow:0 1px 3px rgba(181,18,27,.4);
}
.msg-contact.active .msg-contact-unread{ background:#fff; color:var(--orange-dark); box-shadow:none; }
.msg-conversation{
  display:flex; flex-direction:column; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow);
}
.msg-conv-header{
  padding:14px 18px; border-bottom:1px solid var(--border); font-weight:700; font-size:14px;
  background:linear-gradient(180deg, var(--surface), var(--orange-pale) 400%); letter-spacing:.1px;
}
.msg-messages{
  flex:1; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:3px;
  background:
    radial-gradient(circle at 15% 8%, rgba(230,126,34,.045) 0%, transparent 45%),
    radial-gradient(circle at 85% 92%, rgba(230,126,34,.04) 0%, transparent 45%),
    var(--bg);
}
.msg-date-separator{
  display:flex; align-items:center; gap:10px; margin:14px 0 10px; font-size:10.5px; font-weight:700;
  color:var(--ink-soft); text-transform:uppercase; letter-spacing:.4px;
}
.msg-date-separator::before, .msg-date-separator::after{ content:""; flex:1; height:1px; background:var(--border); }
.msg-row{ display:flex; align-items:flex-end; gap:7px; margin-bottom:2px; animation:msgFadeIn .25s ease; }
.msg-row.mine{ flex-direction:row-reverse; }
@keyframes msgFadeIn{ from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:translateY(0); } }
.msg-row-avatar{
  width:24px; height:24px; border-radius:50%; flex-shrink:0; overflow:hidden;
  background:linear-gradient(135deg, var(--orange-pale), #fde8cf); color:var(--orange-dark);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:10px;
}
.msg-row-avatar img{ width:100%; height:100%; object-fit:cover; }
.msg-row-avatar.spacer{ visibility:hidden; }
.msg-bubble{
  max-width:66%; padding:9px 13px; border-radius:16px 16px 16px 4px; font-size:13px; line-height:1.42;
  align-self:flex-start; background:var(--surface); box-shadow:0 1px 2px rgba(36,28,20,.08); word-wrap:break-word;
}
.msg-bubble.mine{
  border-radius:16px 16px 4px 16px;
  background:linear-gradient(135deg, var(--orange), var(--orange-dark)); color:#fff;
  box-shadow:0 2px 8px rgba(230,126,34,.3);
}
.msg-bubble-author{ font-size:10px; font-weight:700; margin-bottom:2px; opacity:.7; color:var(--orange-dark); }
.msg-bubble.mine .msg-bubble-author{ color:rgba(255,255,255,.85); }
.msg-bubble-time{ font-size:9px; opacity:.55; margin-top:3px; text-align:right; display:flex; align-items:center; justify-content:flex-end; gap:5px; }
.msg-bubble-modifie{ font-style:italic; }
.msg-bubble-edit-btn{ background:none; border:none; padding:0; font-size:10px; opacity:.6; cursor:pointer; }
.msg-bubble-edit-btn:hover{ opacity:1; }
.msg-bubble-edition{ display:flex; flex-direction:column; gap:6px; }
.msg-bubble-edit-input{ width:100%; border:1px solid rgba(255,255,255,.4); border-radius:8px; background:rgba(255,255,255,.15); color:inherit; padding:6px 8px; font-family:inherit; font-size:inherit; resize:vertical; }
.msg-bubble:not(.mine) .msg-bubble-edit-input{ border-color:var(--border); background:#fff; }
.msg-bubble-edit-actions{ display:flex; gap:6px; justify-content:flex-end; }
.msg-bubble-edit-actions .btn-icon{ font-size:12px; }
.msg-typing-indicator{ padding:4px 14px; font-size:11.5px; font-style:italic; color:var(--ink-soft); }
.msg-typing-indicator.hidden{ display:none; }
.msg-typing-indicator::after{ content:""; display:inline-block; width:4px; height:4px; border-radius:50%; background:currentColor; margin-left:3px; animation:msgTypingPulse 1s ease-in-out infinite; }
@keyframes msgTypingPulse{ 0%,100%{ opacity:.3; } 50%{ opacity:1; } }
.msg-input-row{ display:flex; gap:8px; padding:12px 14px; border-top:1px solid var(--border); background:var(--surface); align-items:center; }
.msg-input-row input{
  flex:1; padding:11px 16px; border:1px solid var(--border); border-radius:999px; font-size:13px;
  background:var(--bg); transition:border-color .15s ease, box-shadow .15s ease;
}
.msg-input-row input:focus{ outline:none; border-color:var(--orange); box-shadow:0 0 0 3px rgba(230,126,34,.12); }
.msg-input-row .btn{ border-radius:999px; padding:10px 20px; box-shadow:0 2px 8px rgba(230,126,34,.3); }

@media (max-width:800px){ .msg-layout{ grid-template-columns:1fr; height:auto; } .msg-contacts{ max-height:160px; } }


/* =========================================================
   BADGES & CLASSEMENT
   ========================================================= */
.badges-row{ display:flex; flex-wrap:wrap; gap:10px; }
.badge-item{
  display:flex; align-items:center; gap:8px; background:var(--orange-pale); border:1px solid var(--orange-light);
  border-radius:999px; padding:8px 14px; font-size:12px; font-weight:600; color:var(--orange-dark);
}
.badge-item .badge-icon{ font-size:16px; }
.badge-empty{
  display:block; text-align:center; color:var(--ink-soft); font-size:13px; font-style:normal;
  padding:32px 20px; border:1.5px dashed var(--border); border-radius:12px; background:var(--bg);
  line-height:1.6;
}
.badge-empty::before{ content:"🗂️"; display:block; font-size:28px; margin-bottom:8px; opacity:.7; }

.leaderboard{ display:flex; flex-direction:column; gap:8px; }
.leaderboard-row{
  display:flex; align-items:center; gap:14px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:12px 16px; box-shadow:var(--shadow);
}
.leaderboard-rank{
  width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:13px; background:var(--gray-bg); color:var(--gray); flex-shrink:0;
}
.leaderboard-row:nth-child(1) .leaderboard-rank{ background:#FFD700; color:#7a5c00; }
.leaderboard-row:nth-child(2) .leaderboard-rank{ background:#C8C8C8; color:#555; }
.leaderboard-row:nth-child(3) .leaderboard-rank{ background:#CD7F32; color:#4a2e11; }
.leaderboard-name{ flex:1; font-weight:700; font-size:13.5px; }
.leaderboard-stats{ display:flex; gap:18px; font-size:11.5px; color:var(--ink-soft); }
.leaderboard-stats strong{ color:var(--ink); font-size:13px; }

/* Chrono visuel sur les commandes en attente */
.chrono-badge{
  font-size:9.5px; font-weight:700; padding:2px 7px; border-radius:999px; white-space:nowrap; margin-left:6px;
}
.chrono-badge.recent{ background:#EAF7EC; color:#1E7A34; }
.chrono-badge.warn{ background:#FFF3E6; color:#B8630A; }
.chrono-badge.late{ background:#FCEAEA; color:#B5121B; }

/* =========================================================
   RECHERCHE GLOBALE
   ========================================================= */
.global-search-wrap{ position:relative; margin-bottom:18px; max-width:520px; }
#global-search-input{
  width:100%; padding:11px 16px; border:1px solid var(--border); border-radius:10px; font-size:13.5px;
  background:#fff; box-shadow:var(--shadow);
}
#global-search-input:focus{ outline:none; border-color:var(--orange); box-shadow:0 0 0 3px var(--orange-light); }
.global-search-results{
  position:absolute; top:calc(100% + 6px); left:0; right:0; background:#fff; border:1px solid var(--border);
  border-radius:10px; box-shadow:0 10px 30px rgba(0,0,0,.15); max-height:60vh; overflow-y:auto; z-index:60;
}
.global-search-results.hidden{ display:none; }
.gs-group-label{
  font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft);
  padding:8px 14px 4px;
}
.gs-result-row{
  display:flex; flex-direction:column; gap:1px; padding:8px 14px; cursor:pointer; border-bottom:1px solid var(--border);
}
.gs-result-row:last-child{ border-bottom:none; }
.gs-result-row:hover{ background:var(--orange-pale); }
.gs-result-title{ font-size:12.5px; font-weight:700; color:var(--ink); }
.gs-result-sub{ font-size:11px; color:var(--ink-soft); }
.gs-empty{ padding:16px; text-align:center; color:var(--ink-soft); font-size:12.5px; }

@media (max-width:700px){
  .cal-legend{ display:none; }
  .cal-day{ min-height:64px; font-size:10px; }
  #cal-weekdays div:nth-child(n){ font-size:9px; }
}

.ie-grid{ display:grid; grid-template-columns:repeat(3, 1fr); gap:16px; }
.ie-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:16px; display:flex; flex-direction:column; gap:10px;
}
.ie-card-title{ display:flex; align-items:center; gap:8px; font-size:14.5px; margin:0; }
.ie-card-desc{ font-size:11.5px; color:var(--ink-soft); margin:0; }
.ie-card-buttons{ display:flex; flex-direction:column; gap:7px; margin-top:auto; }
.ie-card-buttons button{ width:100%; justify-content:center; font-size:12px; }
.ie-import-input{ display:none; }
.ie-result{
  font-size:11.5px; border-radius:8px; padding:8px 10px; margin-top:2px; display:none;
}
.ie-result.show{ display:block; }
.ie-result.ok{ background:#EAF7EC; color:#1E7A34; }
.ie-result.error{ background:#FCEAEA; color:#B5121B; }
.ie-result ul{ margin:6px 0 0; padding-left:16px; max-height:100px; overflow-y:auto; }

@media (max-width:1100px){ .ie-grid{ grid-template-columns:repeat(2, 1fr); } }
@media (max-width:700px){ .ie-grid{ grid-template-columns:1fr; } }
.params-card{ display:flex; flex-direction:column; gap:14px; }
.params-card-title{
  display:flex; align-items:center; gap:9px; font-size:15px; margin:0 0 2px;
  padding-bottom:12px; border-bottom:2px solid var(--orange-light);
}
.params-card-icon{ font-size:18px; }
.params-card-subtitle{ font-size:12px; color:var(--ink-soft); margin:-8px 0 2px; }
.params-save-btn{ align-self:flex-start; margin-top:4px; }

.params-logo-row{ display:flex; align-items:center; gap:16px; }
.params-logo-preview{
  width:76px; height:76px; border-radius:16px; background:var(--orange-pale); color:var(--orange-dark);
  display:flex; align-items:center; justify-content:center; font-family:var(--font-display); font-weight:800;
  font-size:22px; flex-shrink:0; overflow:hidden; border:2px dashed var(--orange-light);
}
.params-logo-preview img{ width:100%; height:100%; object-fit:cover; }
.params-logo-actions{ display:flex; flex-direction:column; gap:8px; }
.params-logo-buttons{ display:flex; gap:8px; flex-wrap:wrap; }
.params-logo-hint{ font-size:11px; color:var(--ink-soft); margin:0; }

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

.sav-client-comment{
  background:#FFF3E6; border-left:4px solid #B8630A; border-radius:8px; padding:12px 14px; margin-bottom:6px;
}
.sav-client-comment span{ display:block; font-size:11px; font-weight:700; color:#B8630A; text-transform:uppercase; letter-spacing:.03em; margin-bottom:4px; }
.sav-client-comment p{ margin:0; font-size:13px; color:var(--ink); font-style:italic; }

.livreur-summary{
  display:grid; grid-template-columns:1fr 1fr; gap:0; background:var(--orange-pale);
  border-radius:8px; margin-bottom:14px; overflow:hidden;
}
.livreur-summary div{ padding:9px 12px; border-bottom:1px solid rgba(0,0,0,.06); }
.livreur-summary div:nth-child(2n+1){ border-right:1px solid rgba(0,0,0,.06); }
.livreur-summary span{ display:block; font-size:10px; text-transform:uppercase; color:var(--ink-soft); letter-spacing:.03em; }
.livreur-summary strong{ font-size:12.5px; }

/* =========================================================
   MA TOURNÉE (livreurs)
   ========================================================= */
.offline-banner{
  background:#B5121B; color:#fff; padding:10px 16px; border-radius:9px; margin-bottom:14px;
  font-size:13px; font-weight:600; text-align:center;
}
.tournee-section-title{ margin:18px 0 10px; font-size:14px; }
.tournee-list{ display:flex; flex-direction:column; gap:12px; }
.tournee-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:16px;
}
.tournee-card-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:10px; }
.tournee-card-numero{ font-family:var(--font-display); font-weight:700; color:var(--orange-dark); font-size:14px; }
.tournee-card-client{ font-size:15px; font-weight:700; color:var(--ink); margin-top:2px; }
.tournee-card-addr{ font-size:12.5px; color:var(--ink-soft); margin-top:3px; }
.tournee-card-meta{ display:flex; gap:14px; margin-top:8px; font-size:12px; color:var(--ink-soft); flex-wrap:wrap; }
.tournee-card-links{ display:flex; gap:8px; margin-top:12px; }
.tournee-assign-row{ margin-top:10px; }
.tournee-assign-select{ width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:8px; font-size:12.5px; }
.tournee-card-livree{ opacity:.85; }
.tournee-link-btn{
  flex:1; text-align:center; padding:10px; border-radius:9px; font-size:12.5px; font-weight:700;
  text-decoration:none; display:flex; align-items:center; justify-content:center; gap:6px;
}
.tournee-link-nav{ background:#2E5395; color:#fff; }
.tournee-link-call{ background:var(--orange-pale); color:var(--orange-dark); }
.tournee-card-actions{ display:flex; gap:8px; margin-top:10px; }
.tournee-empty{ text-align:center; color:var(--ink-soft); padding:40px 20px; font-size:13.5px; }
.tournee-sync-badge{
  display:inline-block; background:#B8630A; color:#fff; font-size:10px; font-weight:700;
  padding:2px 8px; border-radius:999px; margin-left:8px;
}

.livreur-actions{ display:flex; flex-direction:column; gap:8px; }
.livreur-actions-secondary{ flex-direction:row; margin-top:2px; }
.livreur-action-btn{
  padding:13px 16px; border-radius:10px; border:2px solid var(--orange-light); background:var(--orange-pale);
  color:var(--orange-dark); font-weight:700; font-size:14px; text-align:left;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
.livreur-action-btn:hover{ background:var(--orange-light); box-shadow:0 3px 10px rgba(230,126,34,.2); }
.livreur-action-btn:active{ transform:scale(.98); }
.livreur-action-btn:disabled{ opacity:.5; cursor:not-allowed; }
.livreur-action-success{ background:#EAF7EC; border-color:#BFE6C6; color:#1E7A34; }
.livreur-action-success:hover{ background:#D7F0DB; }
.livreur-action-btn-sm{
  flex:1; padding:9px 10px; border-radius:8px; border:1px solid var(--border); background:#fff;
  color:var(--ink-soft); font-size:12px; font-weight:600; transition: background .15s ease;
}
.livreur-action-btn-sm:hover{ background:var(--gray-bg); }
.livreur-action-btn-sm:disabled{ opacity:.5; cursor:not-allowed; }
.livreur-action-btn:disabled{
  opacity:.6; cursor:not-allowed; background:var(--gray-bg); color:var(--ink-soft);
  border-color:var(--border); box-shadow:none; transform:none;
}
.livreur-action-btn.livreur-action-success:disabled{ background:var(--gray-bg); color:var(--ink-soft); }
.livreur-locked-msg{
  background:var(--gray-bg); color:var(--ink-soft); padding:14px 16px; border-radius:10px;
  text-align:center; font-weight:600; font-size:13.5px;
}

.role-checkbox-list{
  display:flex; flex-direction:column; gap:6px; max-height:220px; overflow-y:auto;
  border:1px solid var(--border); border-radius:8px; padding:10px; margin-top:4px;
}
.modal-footer{ display:flex; justify-content:flex-end; gap:10px; padding:14px 20px; border-top:1px solid var(--border); flex-shrink:0; }

/* =========================================================
   TOASTS
   ========================================================= */
.toast-container{ position:fixed; top:18px; right:18px; z-index:200; display:flex; flex-direction:column; gap:8px; }

#app-loading-screen{
  position:fixed; inset:0; z-index:9999; background:linear-gradient(160deg, var(--orange-dark), #6e330a);
  display:flex; align-items:center; justify-content:center;
  transition:opacity .25s ease; opacity:1;
}
#app-loading-screen.hidden{ opacity:0; pointer-events:none; }
.app-loading-mark{
  width:56px; height:56px; border-radius:14px; background:#fff; color:var(--orange-dark);
  font-family:var(--font-display); font-weight:800; font-size:20px;
  display:flex; align-items:center; justify-content:center;
  animation: appLoadingPulse 1.1s ease-in-out infinite;
}
@keyframes appLoadingPulse{ 0%,100%{ transform:scale(1); opacity:1; } 50%{ transform:scale(.9); opacity:.7; } }
@keyframes appLoadingSpin{ from{ transform:rotate(0deg); } to{ transform:rotate(360deg); } }
#app-loading-message{ position:absolute; bottom:15%; left:0; right:0; text-align:center; color:#fff; font-size:13px; font-weight:600; letter-spacing:.3px; opacity:.9; }
#app-loading-message.hidden{ display:none; }
.toast{
  background:var(--ink); color:#fff; padding:11px 16px; border-radius:8px; font-size:13px; box-shadow:var(--shadow);
  animation: slidein .2s ease;
}
.toast.error{ background: var(--red); }
.toast.success{ background: var(--green); }
@keyframes slidein{ from{ transform:translateX(20px); opacity:0;} to{ transform:translateX(0); opacity:1;} }

/* =========================================================
   RECEIPT & BON DE COMMANDE — format A5, compacts par défaut
   ========================================================= */
.receipt{
  background:#fff; border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); max-width:420px; padding:0; overflow:hidden;
  font-size:12px;
}
.receipt-empty{
  color:var(--ink-soft); text-align:center; padding:60px 20px; display:flex;
  flex-direction:column; align-items:center; gap:10px; font-size:13.5px;
}
.receipt-empty-icon{ font-size:34px; opacity:.5; }
.receipt-content.hidden{ display:none; }

/* ---- Onglets Facture / Bon de commande ---- */
.doc-tabs{ display:flex; gap:8px; margin-bottom:14px; }
.doc-tab{
  padding:9px 14px; border-radius:8px; border:1px solid var(--border); background:#fff;
  color:var(--ink-soft); font-size:12.5px; font-weight:600; transition: all .15s ease;
}
.doc-tab:hover{ background:var(--orange-pale); }
.doc-tab.active{ background:var(--orange); color:#fff; border-color:var(--orange); }

/* ---- Bon de commande (document remis au livreur) ---- */
.bon-commande.hidden{ display:none; }
.bon-band{
  display:flex; align-items:center; gap:10px; padding:12px 16px;
  background:var(--doc-entete, #2E5395); color:#fff;
}
.bon-band h2{ color:#fff; font-size:14px; margin:0; letter-spacing:.02em; }
.bon-instructions{
  background:#EAF1FB; color:#2E5395; font-size:10px; font-weight:600; text-align:center;
  padding:6px 14px; margin:0; line-height:1.4;
}
.bon-expedition-badge{
  background:#C1580A; color:#fff; font-size:11.5px; font-weight:800; text-align:center;
  padding:8px 14px; margin:0; letter-spacing:.02em; text-transform:uppercase;
}
.bon-expedition-badge span{ text-transform:none; font-weight:800; }
.bon-collect-box{
  margin:10px 16px; padding:9px 14px; background:var(--orange-pale); border:1.5px dashed var(--orange);
  border-radius:9px; text-align:center; display:flex; flex-direction:column; gap:1px;
}
.bon-collect-box span:first-child{ font-size:9px; text-transform:uppercase; color:var(--orange-dark); letter-spacing:.03em; }
.bon-collect-box strong{ font-size:19px; color:var(--orange-dark); font-family:var(--font-display); }
.bon-collect-box span:last-child{ font-size:10px; color:var(--ink-soft); margin-top:1px; }
.bon-signatures{ display:grid; grid-template-columns:1fr 1fr; gap:14px; padding:4px 16px 14px; }
.bon-signatures span{ font-size:9px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.03em; }
.bon-signature-line{ border-bottom:1px solid var(--ink-soft); height:34px; margin-top:4px; }

.receipt-band{
  display:flex; align-items:center; gap:10px; padding:12px 16px;
  background:var(--doc-entete, var(--orange-dark)); color:#fff;
}
.receipt-mark{
  width:34px; height:34px; border-radius:9px; background:#fff; color:var(--orange-dark);
  display:flex; align-items:center; justify-content:center; font-family:var(--font-display);
  font-weight:800; font-size:13px; flex-shrink:0; overflow:hidden;
}
.receipt-mark img{ width:100%; height:100%; object-fit:cover; }
.receipt-band h2{ color:#fff; font-size:14px; margin:0; }
.receipt-band .receipt-sub{ color:rgba(255,255,255,.85); text-align:left; margin:1px 0 0; font-size:10px; }
.receipt-numero-box{
  margin-left:auto; text-align:right; display:flex; flex-direction:column; gap:1px;
  background:rgba(255,255,255,.15); padding:5px 9px; border-radius:7px;
}
.receipt-numero-box span{ font-size:8px; text-transform:uppercase; letter-spacing:.04em; opacity:.85; }
.receipt-numero-box strong{ font-size:11.5px; }

.receipt-grid{
  display:grid; grid-template-columns:1fr 1fr; gap:0; margin:0; font-size:10.5px;
  border-bottom:1px solid var(--border);
}
.receipt-grid-3{ grid-template-columns:repeat(3, 1fr); }
.receipt-grid div{
  display:flex; flex-direction:column; gap:1px; padding:6px 10px;
  border-right:1px solid var(--border); border-bottom:1px solid var(--border);
}
.receipt-grid div:nth-child(2n){ border-right:1px solid var(--border); }
.receipt-grid.receipt-grid-3 div:nth-child(3n){ border-right:none; }
.receipt-grid:not(.receipt-grid-3) div:nth-child(2n){ border-right:none; }
.receipt-grid div:last-child, .receipt-grid div:nth-last-child(-n+3){ border-bottom:none; }
.receipt-grid span{ font-size:8px; text-transform:uppercase; color:var(--ink-soft); letter-spacing:.03em; }
.receipt-grid strong{ font-size:11px; overflow-wrap:break-word; }

.receipt-table{ width:100%; border-collapse:collapse; margin:0; font-size:11px; }
.receipt-table th{
  background:var(--orange-pale); color:var(--orange-dark); padding:5px 10px;
  text-align:left; font-size:8.5px; text-transform:uppercase; letter-spacing:.03em;
}
.receipt-table th:last-child, .receipt-table td:last-child{ text-align:right; }
.receipt-table td{ padding:5px 10px; border-top:1px solid var(--border); }
.receipt-table tbody tr:nth-child(even){ background:#FBF8F4; }
.receipt-table-services{ margin-top:2px; }
.receipt-table-services th{ background:#EAF1FB; color:#2E5395; }
.receipt-table-services.hidden{ display:none; }

.receipt-totals{ padding:9px 16px; }
.receipt-totals div{ display:flex; justify-content:space-between; padding:3px 0; font-size:11px; }
.receipt-totals div.hidden{ display:none; }
.receipt-grand-total{
  background:var(--orange); color:#fff; padding:8px 12px !important; border-radius:7px;
  font-size:13.5px !important; font-weight:700; margin-top:5px;
}
.receipt-footer{ padding:10px 16px 12px; border-top:1px dashed var(--border); }
.receipt-footer-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.receipt-footer-text{ text-align:left; }
.receipt-thanks{ color:var(--orange-dark); font-size:11.5px; font-weight:700; margin:0; }
.receipt-footer-contact{ color:var(--ink-soft); font-size:9.5px; margin:2px 0 0; }
.receipt-footer-note{ color:var(--ink-soft); font-size:9px; margin:3px 0 0; font-style:italic; }
.receipt-facture-box{
  background:#EAF1FB; color:#2E5395; font-size:10px; font-weight:700; text-align:center;
  padding:5px 12px; margin:0;
}
.receipt-legal-mentions{ font-size:8px; color:var(--ink-soft); text-align:center; margin:0 0 8px; line-height:1.5; }
.receipt-track-link{ color:var(--orange-dark); font-size:9.5px; margin:8px 0 0; background:var(--orange-pale); padding:5px 8px; border-radius:6px; text-align:center; }
.receipt-qr{ flex-shrink:0; width:56px; height:56px; }
.receipt-qr img, .receipt-qr canvas{ width:100% !important; height:100% !important; }
.receipt-footer-note:empty{ display:none; }
.receipt-track-link{ color:var(--orange-dark); font-size:11.5px; margin:8px 0 0; background:var(--orange-pale); padding:7px 10px; border-radius:7px; }

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-body{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background: linear-gradient(160deg, var(--orange-dark), #6e330a);
  background-image:
    linear-gradient(160deg, var(--orange-dark), #6e330a),
    repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0, rgba(255,255,255,.035) 1px, transparent 1px, transparent 24px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.035) 0, rgba(255,255,255,.035) 1px, transparent 1px, transparent 24px);
}
.login-card{
  background:#fff; border-radius:18px; padding:40px 34px; width:360px; max-width:90vw;
  box-shadow:0 26px 70px rgba(0,0,0,.32); text-align:center;
  animation: loginCardEntree .4s cubic-bezier(.2,.8,.3,1.1);
}
@keyframes loginCardEntree{ from{ opacity:0; transform:translateY(16px) scale(.97); } to{ opacity:1; transform:translateY(0) scale(1); } }
.login-mark{ margin:0 auto 14px; }
.login-card h1{ font-family:var(--font-display); font-size:19px; }
.login-sub{ color:var(--ink-soft); font-size:12.5px; margin:2px 0 22px; }
.login-card form{ display:flex; flex-direction:column; gap:14px; text-align:left; }
.login-card label{ display:flex; flex-direction:column; gap:5px; font-size:12.5px; font-weight:600; color:var(--ink-soft); }
.login-card input{
  padding:10px 12px; border:1px solid var(--border); border-radius:8px; font-size:14px; font-family:inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-card input:focus{ outline:none; border-color:var(--orange); box-shadow:0 0 0 3px var(--orange-light); }
.login-submit{ margin-top:6px; padding:11px; font-size:14px; }
.login-error{ background:var(--red-bg); color:var(--red); padding:9px 12px; border-radius:8px; font-size:12.5px; }
.login-error.hidden{ display:none; }
@media (prefers-reduced-motion: reduce){ .login-card{ animation:none; } }

/* =========================================================
   ALERTS VIEW
   ========================================================= */
.alert-list{ display:flex; flex-direction:column; gap:8px; margin-top:14px; }
.alert-row{
  display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:8px;
  background:var(--red-bg); border-left:4px solid var(--red); font-size:13px;
}
.alert-row.warn{ background:var(--status-orange-bg); border-left-color:var(--status-orange); }
.alert-row strong{ min-width:110px; }
.alert-empty{ color:var(--ink-soft); text-align:center; padding:30px 0; font-size:13.5px; }

/* =========================================================
   TIMELINE (historique des statuts)
   ========================================================= */
.timeline{ display:flex; flex-direction:column; gap:0; max-height:50vh; overflow-y:auto; }

/* ---- Fiche client (historique + notes) ---- */
.client-histo-list, .client-notes-list{
  display:flex; flex-direction:column; gap:0; max-height:180px; overflow-y:auto;
  border:1px solid var(--border); border-radius:8px;
}
.client-histo-row{
  display:grid; grid-template-columns:1fr 1fr 1fr 1fr; align-items:center; gap:8px;
  padding:8px 12px; font-size:12px; border-bottom:1px solid var(--border);
}
.client-histo-row:last-child{ border-bottom:none; }
.client-histo-numero{ font-weight:700; color:var(--orange-dark); }
.client-histo-total{ text-align:right; font-weight:600; }

.client-prix-list{ max-height:200px; overflow-y:auto; border:1px solid var(--border); border-radius:9px; }
.client-prix-row{ padding:8px 12px; border-bottom:1px solid var(--border); }
.client-prix-row:last-child{ border-bottom:none; }
.client-prix-produit{ font-size:12px; font-weight:700; }
.client-prix-dernier{ font-size:11.5px; color:var(--ink-soft); }
.client-prix-historique-mini{ font-size:10px; color:var(--ink-soft); opacity:.8; margin-top:2px; }
.palier-badge{
  display:inline-block; padding:6px 14px; border-radius:999px; border:1px solid; font-weight:700; font-size:12px; margin-top:4px;
}

/* =========================================================
   CAISSE (vente sur place)
   ========================================================= */
.caisse-layout{ display:grid; grid-template-columns:1fr 320px; gap:20px; align-items:start; }
@media (max-width:900px){ .caisse-layout{ grid-template-columns:1fr; } }
.caisse-scan-input{
  width:100%; padding:16px; font-size:16px; border:2px solid var(--orange); border-radius:10px;
  margin-bottom:12px; background:var(--orange-pale);
}
.caisse-scan-input:focus{ outline:none; border-color:var(--orange-dark); }
#caisse-produit-combo{ margin-bottom:16px; }
.caisse-right{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:18px; display:flex; flex-direction:column; gap:12px; position:sticky; top:16px;
}
.caisse-total-box{
  display:flex; flex-direction:column; align-items:center; padding:16px; background:var(--orange-pale); border-radius:10px;
}
.caisse-total-box span{ font-size:11px; text-transform:uppercase; color:var(--ink-soft); letter-spacing:.05em; }
.caisse-total-box strong{ font-family:var(--font-display); font-size:32px; color:var(--orange-dark); }
.caisse-btn-encaisser{ width:100%; padding:16px; font-size:16px; font-weight:700; }

.caisse-panier-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.caisse-panier-header span:first-child{ font-weight:700; font-size:13px; }
.caisse-panier-count{
  font-size:11px; font-weight:700; color:var(--orange-dark); background:var(--orange-pale);
  padding:3px 10px; border-radius:999px;
}

.caisse-section{ border-top:1px solid var(--border); padding-top:12px; }
.caisse-section-label{ font-size:11.5px; font-weight:700; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.03em; margin-bottom:8px; }
.caisse-input-compact{
  width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:8px; font-size:13px; font-family:inherit;
}
.caisse-input-compact:focus{ outline:none; border-color:var(--orange); }

.caisse-remise-row{ display:flex; gap:8px; }
.caisse-remise-row input{ flex:1; padding:10px 12px; border:1px solid var(--border); border-radius:8px; font-size:13px; }
.caisse-remise-row select{ width:70px; padding:10px 6px; border:1px solid var(--border); border-radius:8px; font-size:13px; }

.caisse-paiement-pills{ display:flex; flex-direction:column; gap:6px; }
.caisse-pill{
  display:flex; align-items:center; gap:8px; padding:10px 14px; border:1.5px solid var(--border); border-radius:9px;
  background:#fff; font-size:13px; font-weight:600; color:var(--ink); cursor:pointer; text-align:left; transition:all .12s ease;
}
.caisse-pill:hover{ border-color:var(--orange-light); background:var(--orange-pale); }
.caisse-pill.active{ border-color:var(--orange); background:var(--orange-pale); color:var(--orange-dark); box-shadow:0 0 0 1px var(--orange) inset; }

.caisse-montants-rapides{ display:grid; grid-template-columns:repeat(3, 1fr); gap:6px; margin-bottom:8px; }
.caisse-montant-btn{
  padding:8px 4px; border:1px solid var(--border); border-radius:7px; background:#fff; font-size:12px; font-weight:600;
  cursor:pointer; color:var(--ink);
}
.caisse-montant-btn:hover{ background:var(--orange-pale); border-color:var(--orange-light); }

.caisse-monnaie-row{
  display:flex; justify-content:space-between; align-items:center; margin-top:8px; padding:10px 12px;
  background:var(--gray-bg); border-radius:8px; font-size:12.5px;
}
.caisse-monnaie-row strong{ font-size:16px; color:var(--orange-dark); }
.caisse-monnaie-row.insuffisant strong{ color:#B5121B; }

/* =========================================================
   PAGINATION (numérotée, avec navigation précédent/suivant)
   ========================================================= */
.pagination-bar{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:14px; flex-wrap:wrap; }

/* =========================================================
   BASCULE LISTE / GRILLE (ex. Commandes)
   ========================================================= */
.view-mode-toggle{ display:flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; }

/* =========================================================
   CALENDRIER VISUEL — Rendez-vous (vue mensuelle)
   ========================================================= */
.rdv-cal-nav{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.rdv-cal-nav h2{ font-size:16px; margin:0; text-transform:capitalize; }
.rdv-cal-grille{ display:grid; grid-template-columns:repeat(7, 1fr); gap:6px; }
.rdv-cal-jour-nom{ text-align:center; font-size:11px; font-weight:700; color:var(--ink-soft); padding:6px 0; }
.rdv-cal-case{
  min-height:90px; background:#fff; border:1px solid var(--border); border-radius:8px; padding:6px;
  display:flex; flex-direction:column; gap:3px; cursor:pointer; transition:background .12s ease;
}
.rdv-cal-case:hover{ background:var(--orange-pale); }
.rdv-cal-case.rdv-cal-hors-mois{ background:#FAFAFA; opacity:.5; }
.rdv-cal-case.rdv-cal-aujourdhui{ border:2px solid var(--orange); }
.rdv-cal-case-numero{ font-size:11.5px; font-weight:700; }
.rdv-cal-rdv-puce{ font-size:9.5px; padding:2px 5px; border-radius:5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#fff; }
.rdv-cal-plus{ font-size:9.5px; color:var(--ink-soft); padding-left:4px; }
@media (max-width:700px){
  .rdv-cal-jour-nom:nth-child(n+1):nth-child(-n+7){ font-size:9px; }
  .rdv-cal-case{ min-height:60px; }
}
.view-mode-btn{ background:#fff; border:none; padding:8px 12px; font-size:12.5px; font-weight:600; color:var(--ink-soft); cursor:pointer; transition:background .15s ease, color .15s ease; }
.view-mode-btn:first-child{ border-right:1px solid var(--border); }
.view-mode-btn.active{ background:var(--orange); color:#fff; }
.commandes-grille{ display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:14px; margin-top:14px; }

/* =========================================================
   AFFICHES & COMMUNICATION VISUELLE — galerie des graphistes
   ========================================================= */
/* Mise en page façon Pinterest (masonry) — colonnes CSS plutôt qu'une grille rigide, pour laisser
   chaque affiche garder ses propres proportions au lieu de toutes les forcer au même ratio. */
.affiches-grille{ column-count:2; column-gap:16px; margin-top:14px; }
@media (min-width:600px){ .affiches-grille{ column-count:3; } }
@media (min-width:900px){ .affiches-grille{ column-count:4; } }
@media (min-width:1300px){ .affiches-grille{ column-count:5; } }

.affiche-carte{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden; display:inline-block; width:100%;
  break-inside:avoid; margin-bottom:16px; position:relative;
  animation:afficheApparition .35s ease; transition:transform .15s ease, box-shadow .15s ease;
}
.affiche-carte:hover{ transform:translateY(-3px); box-shadow:0 4px 18px rgba(36,28,20,.12); }
@keyframes afficheApparition{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:translateY(0); } }

.affiche-carte-img{ width:100%; display:block; object-fit:cover; background:var(--orange-pale); cursor:pointer; }
.affiche-carte-badges{ position:absolute; top:8px; left:8px; display:flex; flex-direction:column; gap:4px; z-index:2; }
.affiche-badge{ font-size:10px; font-weight:800; padding:3px 9px; border-radius:6px; color:#fff; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.affiche-badge.nouveau{ background:var(--green); }
.affiche-badge.populaire{ background:linear-gradient(120deg, #FF6B35, var(--orange-dark)); }

.affiche-carte-favori{
  position:absolute; top:8px; right:8px; z-index:2; width:32px; height:32px; border-radius:50%;
  background:rgba(255,255,255,.92); border:none; font-size:15px; display:flex; align-items:center;
  justify-content:center; cursor:pointer; transition:transform .12s ease;
}
.affiche-carte-favori:hover{ transform:scale(1.12); }
.affiche-carte-favori.actif{ color:#FFB800; }

.affiche-carte-body{ padding:12px 14px; display:flex; flex-direction:column; gap:4px; }
.affiche-carte-titre{ font-size:13.5px; font-weight:700; }
.affiche-carte-meta{ font-size:11px; color:var(--ink-soft); display:flex; align-items:center; gap:6px; }
.affiche-carte-actions{ display:flex; gap:6px; margin-top:8px; }
.affiche-carte-actions .btn{ flex:1; font-size:11.5px; padding:8px; text-align:center; justify-content:center; }
.affiche-carte-whatsapp{ background:#25D366 !important; color:#fff !important; }

/* =========================================================
   RESTAURANT & FAST-FOOD — plan de salle
   ========================================================= */
.resto-tables-grille{ display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:14px; margin-top:14px; }
.resto-table-carte{
  border-radius:var(--radius); padding:18px 14px; text-align:center; cursor:pointer;
  border:2px solid transparent; transition:transform .12s ease, box-shadow .12s ease; box-shadow:var(--shadow);
}
.resto-table-carte:hover{ transform:translateY(-2px); box-shadow:0 4px 14px rgba(36,28,20,.12); }
.resto-table-carte.libre{ background:var(--green-bg); border-color:var(--green); }
.resto-table-carte.occupee{ background:var(--red-bg); border-color:var(--red); }
.resto-table-carte.reservee{ background:#FDF3E3; border-color:#8A5A00; }
.resto-table-numero{ font-family:var(--font-display); font-size:22px; font-weight:800; }
.resto-table-capacite{ font-size:11px; color:var(--ink-soft); margin-top:2px; }
.resto-table-statut{ font-size:10.5px; font-weight:700; margin-top:8px; text-transform:uppercase; }

/* ---- Prise de commande (caisse) ---- */
.resto-caisse-layout{ display:grid; grid-template-columns:1fr; gap:16px; margin-top:14px; }
@media (min-width:900px){ .resto-caisse-layout{ grid-template-columns:1.6fr 1fr; align-items:start; } }
.resto-caisse-plats-grille{ display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:10px; margin-top:10px; }
.resto-plat-btn{
  background:#fff; border:1px solid var(--border); border-radius:10px; padding:10px; text-align:left;
  cursor:pointer; transition:border-color .12s ease; box-shadow:var(--shadow);
}
.resto-plat-btn:hover{ border-color:var(--orange); }
.resto-plat-btn:disabled{ opacity:.4; cursor:not-allowed; }
.resto-plat-btn img{ width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:7px; margin-bottom:6px; background:var(--orange-pale); }
.resto-plat-btn-nom{ font-size:12px; font-weight:700; }
.resto-plat-btn-prix{ font-size:11.5px; color:var(--orange-dark); font-weight:700; }

.resto-caisse-panier{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:16px; position:sticky; top:78px; }
.resto-caisse-type-toggle{ display:flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; margin-bottom:10px; }
.resto-caisse-type-toggle .view-mode-btn{ flex:1; }
.resto-panier-ligne{ display:flex; align-items:center; gap:8px; padding:7px 0; border-bottom:1px solid var(--border); font-size:12.5px; }
.resto-panier-ligne-nom{ flex:1; }
.resto-panier-ligne-qte{ display:flex; align-items:center; gap:4px; }
.resto-panier-ligne-qte button{ width:22px; height:22px; border-radius:5px; border:1px solid var(--border); background:#fff; font-size:12px; }
.resto-caisse-total{ font-family:var(--font-display); font-size:18px; font-weight:800; text-align:right; margin-top:10px; padding-top:10px; border-top:2px solid var(--ink); }

/* ---- Écran cuisine ---- */
.resto-cuisine-grille{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:12px; margin-top:14px; }
.resto-cuisine-carte{
  background:#fff; border-radius:10px; padding:12px 14px; box-shadow:var(--shadow); border-left:5px solid var(--border);
  transition:border-color .2s ease;
}
.resto-cuisine-carte.a_preparer{ border-left-color:var(--red); }
.resto-cuisine-carte.en_preparation{ border-left-color:#8A5A00; }
.resto-cuisine-carte-header{ display:flex; justify-content:space-between; font-size:11px; color:var(--ink-soft); margin-bottom:6px; }
.resto-cuisine-carte-plat{ font-size:14px; font-weight:700; margin-bottom:4px; }
.resto-cuisine-carte-notes{ font-size:11.5px; color:var(--orange-dark); font-style:italic; margin-bottom:8px; }
.resto-cuisine-carte-btn{ width:100%; padding:9px; border-radius:8px; font-size:12px; font-weight:700; border:none; }
.resto-cuisine-carte-btn.a_preparer{ background:var(--red); color:#fff; }
.resto-cuisine-carte-btn.en_preparation{ background:#8A5A00; color:#fff; }

/* ---- Reçu de paiement restaurant (style ticket de caisse) ---- */
.resto-recu-papier{
  background:#fff; color:#2A2A2A; width:320px; max-width:90vw; padding:24px 20px;
  border-radius:6px; box-shadow:0 8px 40px rgba(0,0,0,.35); font-family:'Courier New', monospace;
  max-height:70vh; overflow-y:auto;
}
.resto-recu-header{ text-align:center; margin-bottom:10px; }
.resto-recu-header img{ max-width:90px; max-height:60px; margin-bottom:6px; }
.resto-recu-nom-entreprise{ font-size:16px; font-weight:800; font-family:var(--font-display); }
.resto-recu-adresse{ font-size:10.5px; color:#666; margin-top:2px; }
.resto-recu-divider{ border-top:1px dashed #999; margin:10px 0; }
.resto-recu-meta{ font-size:11.5px; display:flex; flex-direction:column; gap:3px; }
.resto-recu-items{ width:100%; font-size:11.5px; border-collapse:collapse; margin-top:6px; }
.resto-recu-items th{ text-align:left; border-bottom:1px solid #ccc; padding:4px 2px; font-size:10px; text-transform:uppercase; color:#666; }
.resto-recu-items td{ padding:5px 2px; vertical-align:top; }
.resto-recu-items th:nth-child(2), .resto-recu-items td:nth-child(2){ text-align:center; }
.resto-recu-items th:nth-child(3), .resto-recu-items td:nth-child(3), .resto-recu-items th:nth-child(4), .resto-recu-items td:nth-child(4){ text-align:right; }
.resto-recu-total{ font-size:17px; font-weight:800; text-align:right; margin-top:4px; }
.resto-recu-provisoire{ background:#FDF3E3; color:#8A5A00; font-size:10.5px; font-weight:700; text-align:center; padding:6px; border-radius:4px; margin-top:10px; }

/* ---- Document de bilan restaurant ---- */
.resto-bilan-config{ width:320px; max-width:90vw; }
.resto-bilan-papier{
  background:#fff; color:#2A2A2A; width:480px; max-width:92vw; padding:28px 24px;
  border-radius:8px; box-shadow:0 8px 40px rgba(0,0,0,.35); max-height:72vh; overflow-y:auto;
}
.resto-bilan-header{ text-align:center; margin-bottom:16px; border-bottom:2px solid var(--orange); padding-bottom:14px; }
.resto-bilan-header img{ max-width:100px; max-height:60px; margin-bottom:8px; }
.resto-bilan-titre{ font-size:19px; font-weight:800; font-family:var(--font-display); }
.resto-bilan-periode{ font-size:13px; color:#666; margin-top:4px; }
.resto-bilan-kpis{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:18px; }
.resto-bilan-kpis > div{ background:var(--orange-pale); border-radius:8px; padding:10px 12px; }
.resto-bilan-kpis .label{ font-size:10px; text-transform:uppercase; color:#8A5A00; font-weight:700; }
.resto-bilan-kpis .valeur{ font-size:16px; font-weight:800; font-family:var(--font-display); }
.resto-bilan-section{ margin-bottom:16px; }
.resto-bilan-section h4{ font-size:12.5px; text-transform:uppercase; color:#8A5A00; margin-bottom:8px; }
.resto-recu-merci{ text-align:center; font-size:12px; margin-top:16px; color:#8A5A00; }

/* Impression du reçu OU du bilan restaurant — un seul bloc caché à la fois est réellement affiché
   à l'écran (l'autre reste avec la classe "hidden"), donc masquer tout sauf le contenu visible
   fonctionne pour les deux documents sans se marcher dessus. */
@media print {
  body.impression-resto *{ visibility:hidden; }
  #resto-recu-papier, #resto-recu-papier *,
  #resto-bilan-papier, #resto-bilan-papier *,
  #bilan-fourn-papier, #bilan-fourn-papier *,
  #bon-cmd-fourn-papier, #bon-cmd-fourn-papier *,
  #soldes-fourn-papier, #soldes-fourn-papier *{ visibility:visible; }
  #resto-recu-papier, #resto-bilan-papier, #bilan-fourn-papier, #bon-cmd-fourn-papier, #soldes-fourn-papier{ position:fixed; top:0; left:0; width:100%; box-shadow:none; max-height:none; overflow:visible; }
}

/* Aperçu plein écran (lightbox) */
.affiche-lightbox{
  position:fixed; inset:0; background:rgba(20,14,8,.94); z-index:200;
  display:flex; align-items:center; justify-content:center; flex-direction:column; padding:20px;
  animation:afficheApparition .2s ease;
}
.affiche-lightbox-img{ max-width:88vw; max-height:64vh; border-radius:10px; box-shadow:0 8px 40px rgba(0,0,0,.4); }
.affiche-lightbox-fermer{
  position:absolute; top:18px; right:20px; background:rgba(255,255,255,.15); color:#fff;
  width:40px; height:40px; border-radius:50%; font-size:18px; border:none; cursor:pointer;
}
.affiche-lightbox-nav{
  position:absolute; top:50%; transform:translateY(-50%); background:rgba(255,255,255,.15); color:#fff;
  width:48px; height:48px; border-radius:50%; font-size:26px; border:none; cursor:pointer;
}
.affiche-lightbox-prec{ left:16px; } .affiche-lightbox-suiv{ right:16px; }
.affiche-lightbox-info{ margin-top:18px; text-align:center; color:#fff; }
.affiche-lightbox-titre{ font-size:15px; font-weight:700; margin-bottom:12px; }
.affiche-lightbox-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }

.commandes-grille.hidden{ display:none; }
.cmd-carte{ background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; box-shadow:var(--shadow); cursor:pointer; transition:box-shadow .12s ease; }
.cmd-carte:hover{ box-shadow:0 4px 14px rgba(36,28,20,.12); }
.cmd-carte-actions button{ cursor:pointer; }
.cmd-carte-entete{ display:flex; justify-content:space-between; align-items:flex-start; gap:8px; margin-bottom:6px; }
.cmd-carte-numero{ font-weight:700; font-size:13.5px; }
.cmd-carte-client{ font-size:12.5px; color:var(--ink-soft); margin-bottom:8px; }
.cmd-carte-ligne{ display:flex; justify-content:space-between; font-size:12px; padding:3px 0; border-top:1px solid var(--border); }
.cmd-carte-total{ font-weight:700; color:var(--orange-dark); }
.cmd-carte-actions{ display:flex; gap:6px; margin-top:10px; }

/* =========================================================
   MENU CONTEXTUEL (clic droit) — ex. Commandes : reçu / bon
   ========================================================= */
/* =========================================================
   SONNERIE URGENTE — bandeau plein écran quand une notification
   push arrive pendant que l'application est ouverte au premier plan
   ========================================================= */
.sonnerie-urgente-bandeau{
  position:fixed; top:0; left:0; right:0; z-index:9998; display:flex; align-items:center; gap:14px;
  background:linear-gradient(90deg, #B5121B, #7a0d12); color:#fff; padding:14px 20px; box-shadow:0 4px 20px rgba(0,0,0,.3);
  animation: sonnerieUrgentePulse 0.9s ease-in-out infinite;
}
.sonnerie-urgente-bandeau.hidden{ display:none; }
.sonnerie-urgente-icone{ font-size:28px; animation: sonnerieUrgenteCloche 0.5s ease-in-out infinite; }
.sonnerie-urgente-texte{ flex:1; display:flex; flex-direction:column; }
.sonnerie-urgente-texte strong{ font-size:14.5px; }
.sonnerie-urgente-texte span{ font-size:12.5px; opacity:.9; }
@keyframes sonnerieUrgentePulse{ 0%,100%{ box-shadow:0 4px 20px rgba(181,18,27,.3); } 50%{ box-shadow:0 4px 30px rgba(181,18,27,.7); } }
@keyframes sonnerieUrgenteCloche{ 0%,100%{ transform:rotate(-12deg); } 50%{ transform:rotate(12deg); } }

.cmd-context-menu{  position:fixed; z-index:5000; background:#fff; border:1px solid var(--border); border-radius:10px;
  box-shadow:0 6px 24px rgba(0,0,0,.18); padding:6px; min-width:210px; display:flex; flex-direction:column; gap:2px;
}
.cmd-context-menu.hidden{ display:none; }
.cmd-context-menu button{
  background:transparent; border:none; text-align:left; padding:9px 12px; border-radius:7px;
  font-size:13px; color:var(--ink); cursor:pointer; transition:background .12s ease;
}
.cmd-context-menu button:hover{ background:var(--orange-pale); }
.pagination-info{ font-size:12px; color:var(--ink-soft); }
.pagination-pages{ display:flex; align-items:center; gap:4px; }
.pagination-page-btn, .pagination-nav-btn{
  min-width:30px; height:30px; padding:0 6px; border:1px solid var(--border); border-radius:7px;
  background:#fff; font-size:12px; cursor:pointer; color:var(--ink);
}
.pagination-page-btn:hover, .pagination-nav-btn:hover:not(:disabled){ background:var(--orange-pale); border-color:var(--orange-light); }
.pagination-page-btn.active{ background:var(--orange); color:#fff; border-color:var(--orange); font-weight:700; }
.pagination-nav-btn:disabled{ opacity:.4; cursor:not-allowed; }
.pagination-ellipsis{ color:var(--ink-soft); padding:0 2px; font-size:12px; }
.client-note-row{ padding:10px 12px; border-bottom:1px solid var(--border); }
.client-note-row:last-child{ border-bottom:none; }
.client-note-row p{ margin:0; font-size:12.5px; color:var(--ink); }
.client-note-row span{ font-size:10.5px; color:var(--ink-soft); display:block; margin-top:3px; }
.timeline-item{ display:flex; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }
.timeline-item:last-child{ border-bottom:none; }
.timeline-dot{ width:10px; height:10px; border-radius:50%; margin-top:5px; flex-shrink:0; }
.timeline-content{ flex:1; }
.timeline-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.timeline-date{ font-size:11.5px; color:var(--ink-soft); }
.timeline-comment{ font-size:12.5px; color:var(--ink); margin-top:5px; font-style:italic; }
.timeline-user{ font-size:11px; color:var(--ink-soft); margin-top:3px; }

/* =========================================================
   SORT / CSV BUTTONS
   ========================================================= */
.data-table th.sortable{ cursor:pointer; user-select:none; }
.data-table th.sortable:hover{ color:var(--orange-dark); }
.data-table th .sort-arrow{ margin-left:3px; opacity:.6; font-size:10px; }
.btn-csv{ background:var(--gray-bg); color:var(--ink); }
.btn-csv:hover{ background:var(--border); }
.pagination{ display:flex; align-items:center; gap:10px; justify-content:center; padding:14px; font-size:13px; color:var(--ink-soft); }
.pagination button{ background:var(--surface); border:1px solid var(--border); border-radius:6px; padding:6px 12px; }
.pagination button:disabled{ opacity:.4; cursor:not-allowed; }
.user-menu{ display:flex; flex-direction:column; align-items:flex-start; gap:6px; font-size:12px; flex-shrink:0; }
.user-menu-identity{ display:flex; align-items:center; gap:8px; margin-bottom:2px; }
.sidebar-avatar{
  width:30px; height:30px; border-radius:50%; background:rgba(255,255,255,.18); border:2px solid rgba(255,255,255,.3);
  color:#fff; font-weight:700; font-size:12.5px; display:flex; align-items:center; justify-content:center;
  overflow:hidden; flex-shrink:0; padding:0; transition: border-color .15s ease;
}
.sidebar-avatar:hover{ border-color:#fff; }
.sidebar-avatar img{ width:100%; height:100%; object-fit:cover; }
.user-menu button{ background:transparent; border:none; color:rgba(255,255,255,.8); text-decoration:underline; font-size:11.5px; padding:0; }
.user-menu button:hover{ color:#fff; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

/* ---- Barre mobile + menu hamburger (masqués par défaut, activés en dessous de 980px) ---- */
.mobile-topbar{ display:none; }
.sidebar-backdrop{ display:none; }
.sidebar-close{ display:none; }

@media (max-width: 980px){
  .mobile-topbar{
    display:flex; align-items:center; gap:12px; position:fixed; top:0; left:0; right:0; z-index:120;
    background:linear-gradient(135deg, var(--orange-dark), #8f4207); color:#fff;
    padding:12px 16px; box-shadow:0 2px 10px rgba(0,0,0,.15);
  }
  .mobile-menu-btn{
    display:flex; flex-direction:column; justify-content:center; gap:4px;
    width:34px; height:34px; background:rgba(255,255,255,.15); border:none; border-radius:8px; flex-shrink:0;
    transition:background .15s ease;
  }
  .mobile-menu-btn:active{ background:rgba(255,255,255,.3); }
  .mobile-menu-btn span{ display:block; width:16px; height:2px; background:#fff; border-radius:2px; margin:0 auto; }
  .mobile-topbar-brand{ display:flex; align-items:center; gap:10px; }
  .mobile-topbar-brand .brand-mark{ width:30px; height:30px; font-size:12px; }
  .mobile-topbar-brand strong{ font-family:var(--font-display); font-size:14px; }

  /* La barre du haut est désormais fixe (sort du flux normal) : on réserve son espace via un
     padding-top calculé sur sa hauteur réelle (~58px), et la marge du bureau ne s'applique plus. */
  /* La barre du haut est désormais fixe (sort du flux normal) : on réserve son espace via un
     padding-top calculé sur sa hauteur réelle (~58px), et la marge du bureau ne s'applique plus.
     Ciblé sur .main (propre à index.html) plutôt que sur body, pour ne pas affecter la page de
     connexion ni la page de suivi client, qui n'ont pas cette barre mobile. */
  .main{ padding: 78px 18px 40px; margin-left:0; }

  /* La barre latérale devient un tiroir plein écran qui glisse depuis la gauche, avec un fond
     légèrement flouté derrière pour un effet plus soigné qu'un simple voile uni. */
  .sidebar{
    position:fixed; top:0; left:0; height:100vh; width:270px; max-width:82vw;
    transform:translateX(-100%); transition:transform .32s cubic-bezier(.22,.68,0,1.11); z-index:200;
    box-shadow:10px 0 32px rgba(0,0,0,.3); overflow-y:auto;
  }
  .sidebar.open{ transform:translateX(0); }
  .sidebar-close{
    display:block; align-self:flex-end; background:rgba(255,255,255,.15); color:#fff;
    border:none; width:28px; height:28px; border-radius:7px; font-size:14px; margin-bottom:6px;
  }
  .nav{ flex-direction:column; }
  .nav-item{ white-space:normal; }
  .sidebar-backdrop{
    display:block; position:fixed; inset:0; background:rgba(20,14,8,.55); z-index:150;
    opacity:0; pointer-events:none; transition:opacity .25s ease; backdrop-filter:blur(2px);
  }
  .sidebar-backdrop.visible{ opacity:1; pointer-events:auto; }

  /* Carte profil déplacée visuellement en haut du tiroir (juste sous le logo), sans changer
     l'ordre du HTML — évite tout risque pour le JS qui cible ces éléments par leur id. */
  .sidebar .user-menu{
    order:-1; flex-direction:row; align-items:center; background:rgba(255,255,255,.12);
    border-radius:12px; padding:10px 12px; margin:2px 0 14px; gap:10px;
  }
  .sidebar .user-menu-identity{ flex:1; min-width:0; }
  .sidebar .sidebar-avatar{ width:38px; height:38px; }
  .sidebar #current-username{ font-size:12.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; max-width:140px; }
  .sidebar .user-menu button#btn-logout{
    background:rgba(255,255,255,.14); color:#fff; border:none; border-radius:7px;
    padding:6px 10px; font-size:11px; flex-shrink:0;
  }
  .sidebar .user-menu button#btn-logout:active{ background:rgba(255,255,255,.28); }

  /* Onglet actif : accent gauche coloré plutôt qu'un simple fond blanc plein, pour une touche
     plus moderne façon application mobile, avec une légère mise en valeur douce. */
  .nav-item.active, .nav-group-toggle.active{
    background:#fff; color:var(--orange-dark); font-weight:700;
    box-shadow:-3px 0 0 0 var(--orange-dark) inset;
  }
  .nav-item, .nav-group-toggle{ border-radius:10px; padding:11px 12px; }
  .nav-item:active, .nav-group-toggle:active{ background:rgba(255,255,255,.18); }

  /* Petites étiquettes de section, pour aérer visuellement la longue liste d'onglets sur mobile. */
  .nav-section-label{
    font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em;
    color:rgba(255,255,255,.55); padding:14px 12px 4px; display:block;
  }
  .nav-section-label:first-of-type{ padding-top:4px; }

  .kpi-grid{ grid-template-columns: repeat(2,minmax(0,1fr)); }
  .kpi-hero{ grid-column: span 2; }
  .panel-grid{ grid-template-columns: 1fr; }
  .panel-wide{ grid-column: span 1; }
  .bj-section-grid{ grid-template-columns: 1fr; }
  .bj-section-grid .bj-section:first-child{ border-right:none; }
  .bj-cash-row{ grid-template-columns: 1fr; }
  .bj-band{ flex-direction:column; align-items:flex-start; }
  .bj-band-date{ text-align:left; }
  .bj-hero-stats{ gap:10px 0; }
  .bj-hero-stats div{ padding:0 14px; }
  .bj-bar-row{ grid-template-columns: 80px 1fr 70px; }
}

/* =========================================================
   RESPONSIVE — TÉLÉPHONE (écrans étroits)
   ========================================================= */
@media (max-width: 640px){
  body{ font-size:14px; }
  .main{ padding: 78px 12px 32px; }
  .view-header h1{ font-size:19px; }
  .view-header p{ font-size:12.5px; }

  /* Tiroir de menu : pleine largeur autorisée, libellés toujours visibles */
  .sidebar{ padding:14px 10px; width:82vw; }
  .brand{ padding:2px 6px 16px; }
  .nav-item{ padding:10px 12px; font-size:13px; gap:10px; }
  .nav-item svg{ width:17px; height:17px; }
  .sidebar-footer{ font-size:10.5px; padding:6px 6px 2px; }
  .user-menu{ font-size:10.5px; flex-wrap:wrap; gap:4px 8px; }

  /* Cartes KPI : une seule colonne pour rester lisible */
  .kpi-grid{ grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap:10px; }
  .kpi-hero{ grid-column: span 2; }
  .kpi-value{ font-size:19px; }
  .kpi-grid-compact{ grid-template-columns: 1fr 1fr; }

  /* Barres d'outils : chaque contrôle prend toute la largeur */
  .toolbar{ flex-direction:column; align-items:stretch; gap:8px; }
  .toolbar input[type="search"], .toolbar select, .toolbar input[type="date"]{ width:100%; min-width:0; }
  .toolbar button{ width:100%; justify-content:center; }

  /* Tableaux : défilement horizontal, texte resserré */
  .data-table{ font-size:12px; }
  .data-table th, .data-table td{ padding:8px 10px; }
  .btn-icon{ font-size:15px; padding:3px; }

  /* Modales : quasi plein écran, formulaires en une colonne */
  .modal{ width:100%; max-width:100vw; max-height:94vh; border-radius:12px 12px 0 0; margin-top:auto; }
  .modal-overlay{ align-items:flex-end; }
  .item-row{ flex-wrap:wrap; }
  .item-row .item-produit{ flex:1 1 100%; min-width:0; }
  .item-row .item-qte{ flex:1; width:auto; }
  .livreur-summary{ grid-template-columns: 1fr; }
  .livreur-summary div:nth-child(2n+1){ border-right:none; }
  .role-checkbox-list{ max-height:160px; }

  /* Connexion */
  .login-card{ padding:28px 22px; width:100%; }

  /* Reçu */
  .receipt{ max-width:100%; }
  .receipt-band{ flex-wrap:wrap; gap:10px; padding:18px 16px; }
  .receipt-numero-box{ margin-left:0; }
  .receipt-grid{ grid-template-columns: 1fr; }
  .receipt-grid div:nth-child(2n){ border-right:1px solid var(--border); }
  .receipt-grid div:nth-last-child(-n+2){ border-bottom:1px solid var(--border); }
  .receipt-grid div:last-child{ border-bottom:none; }
  .receipt-table{ font-size:11.5px; }
  .receipt-table th, .receipt-table td{ padding:8px 12px; }

  /* Bilan journalier */
  .bj-band{ padding:18px 16px; }
  .bj-hero{ padding:20px 16px; }
  .bj-hero-value{ font-size:30px; }
  .bj-hero-stats{ justify-content:space-between; }
  .bj-hero-stats div{ border-left:none; padding:0 6px; flex:1; }
  .bj-section{ padding:16px 16px; }
  .bj-bar-row{ grid-template-columns: 64px 1fr 60px; font-size:11px; }
  .bj-footer{ padding:16px 16px 20px; }
}

/* =========================================================
   BILAN JOURNALIER (rapport imprimable, design pro)
   ========================================================= */
.bj-report{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); max-width:960px; overflow:hidden;
}

.bj-band{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:24px 30px; background:linear-gradient(135deg, var(--orange-dark), #8f4207); color:#fff;
}
.bj-band-left{ display:flex; align-items:center; gap:14px; }
.bj-band-left h2{ color:#fff; font-size:19px; margin:0; }
.bj-band-left p{ color:rgba(255,255,255,.85); font-size:12px; margin:2px 0 0; }
.bj-band-date{
  text-align:right; background:rgba(255,255,255,.15); padding:9px 16px; border-radius:9px;
  display:flex; flex-direction:column; gap:2px;
}
.bj-band-date span{ font-size:10px; text-transform:uppercase; letter-spacing:.05em; opacity:.85; }
.bj-band-date strong{ font-size:14.5px; text-transform:capitalize; }

.bj-hero{
  text-align:center; padding:28px 30px; border-bottom:1px solid var(--border);
  background:var(--orange-pale);
}
.bj-hero-label{ display:block; font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-soft); }
.bj-hero-value{ display:block; font-family:var(--font-display); font-size:40px; font-weight:800; color:var(--orange-dark); margin:4px 0 18px; }
.bj-hero-stats{ display:flex; justify-content:center; gap:0; flex-wrap:wrap; }
.bj-hero-stats div{
  display:flex; flex-direction:column; align-items:center; padding:0 22px; border-left:1px solid var(--border);
}

.bj-net-row{ display:flex; gap:0; margin-bottom:14px; }
.bj-net-row > div{ flex:1; text-align:center; padding:10px; border-right:1px solid var(--border); }
.bj-net-row > div:last-child{ border-right:none; }
.bj-net-row span{ display:block; font-size:11px; color:var(--ink-soft); margin-bottom:4px; }
.bj-net-row strong{ font-size:16px; }
.bj-net-final{ background:var(--orange-pale); border-radius:8px; }
.bj-net-final strong{ color:var(--orange-dark); font-size:19px; }

.bj-hero-stats div:first-child{ border-left:none; }
.bj-hero-stats strong{ font-size:20px; color:var(--ink); }
.bj-hero-stats span{ font-size:10.5px; text-transform:uppercase; letter-spacing:.03em; color:var(--ink-soft); margin-top:2px; }
.bj-hero-stats .bj-stat-green strong{ color:#1E7A34; }
.bj-hero-stats .bj-stat-red strong{ color:#B5121B; }
.bj-hero-stats .bj-stat-orange strong{ color:#B8630A; }

.bj-section{ padding:22px 30px; border-bottom:1px solid var(--border); }
.bj-section:last-of-type{ border-bottom:none; }
.bj-section h3{
  display:flex; align-items:center; gap:8px; font-size:14px; color:var(--ink);
  margin:0 0 14px; padding-bottom:10px; border-bottom:2px solid var(--orange-light);
}
.bj-section-icon{ font-size:16px; }
.bj-section-grid{ display:grid; grid-template-columns:1fr 1fr; }
.bj-section-grid .bj-section{ border-bottom:1px solid var(--border); }
.bj-section-grid .bj-section:first-child{ border-right:1px solid var(--border); }

.bj-cash-row{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:18px; }
.bj-cash-card{
  border-radius:10px; padding:14px 18px; display:flex; flex-direction:column; gap:4px;
}
.bj-cash-card span{ font-size:11px; text-transform:uppercase; letter-spacing:.03em; opacity:.85; }
.bj-cash-card strong{ font-size:21px; font-family:var(--font-display); }
.bj-cash-card-cash{ background:#EAF7EC; color:#1E7A34; }
.bj-cash-card-mobile{ background:#CFE2F3; color:#2E5395; }

.bj-bars{ display:flex; flex-direction:column; gap:9px; margin-bottom:18px; }
.bj-bar-row{ display:grid; grid-template-columns:120px 1fr 90px; align-items:center; gap:10px; font-size:12px; }
.bj-bar-label{ color:var(--ink-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bj-bar-track{ background:var(--orange-pale); border-radius:6px; height:14px; overflow:hidden; }
.bj-bar-fill{ height:100%; background:linear-gradient(90deg, var(--orange), var(--orange-dark)); border-radius:6px; }
.bj-bar-amount{ text-align:right; font-weight:700; color:var(--ink); }

.bj-table{ width:100%; border-collapse:collapse; font-size:12.5px; }
.bj-table th{
  background:var(--orange-pale); color:var(--orange-dark); text-align:left; padding:8px 12px;
  font-size:10.5px; text-transform:uppercase; letter-spacing:.03em;
}
.bj-table th:last-child, .bj-table td:last-child{ text-align:right; }
.bj-table td{ padding:8px 12px; border-top:1px solid var(--border); }
.bj-table tbody tr:nth-child(even){ background:#FBF8F4; }

.bj-footer{ padding:22px 30px 26px; }
.bj-signature{ margin-bottom:18px; max-width:240px; }
.bj-signature span{ font-size:11px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.03em; }
.bj-signature-line{ border-bottom:1px solid var(--ink-soft); height:44px; margin-top:4px; }
.bj-footer p{ font-size:11px; color:var(--ink-soft); text-align:center; font-style:italic; margin:0; }

/* =========================================================
   PRINT (reçu + bon de commande en A5, bilan journalier en A4)
   ========================================================= */
@page{ margin:10mm; }
@page recu-a5{ size:A5 portrait; margin:8mm; }
@page bilan-a4{ size:A4 portrait; margin:12mm; }

@media print{
  .sidebar, .toolbar, .no-print{ display:none !important; }
  .app-shell{ display:block; }
  .main{ padding:0; max-width:none; }

  /* Sans ceci, la plupart des navigateurs suppriment les couleurs de fond à l'impression (pour
     économiser l'encre par défaut) — ce qui transformait l'en-tête orange et le total en gris.
     Appliqué à TOUS les éléments de la page (et pas seulement au reçu) pour être sûr de ne rien
     manquer, y compris le bon de commande et ses propres éléments colorés. */
  *{
    -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; color-adjust:exact !important;
  }

  /* Reçu et bon de commande : format A5, le plus compact possible */
  .receipt{ page:recu-a5; box-shadow:none; border:none; margin:0 auto; max-width:none; }

  /* Bilan journalier : format A4 */
  .bj-report{ page:bilan-a4; box-shadow:none; border:none; margin:0 auto; max-width:none; }
  .bj-section{ break-inside:avoid; }
}

/* Sous-onglets du module Média */
.media-sous-onglet { border-radius:8px 8px 0 0; border-bottom:2px solid transparent; margin-bottom:-2px; }
.media-sous-onglet.active { border-bottom:2px solid var(--orange-dark); color:var(--orange-dark); font-weight:600; }

/* Sous-onglets du module Gestion de Flotte */
.vehicules-sous-onglet { border-radius:8px 8px 0 0; border-bottom:2px solid transparent; margin-bottom:-2px; }
.vehicules-sous-onglet.active { border-bottom:2px solid var(--orange-dark); color:var(--orange-dark); font-weight:600; }

/* Pulsation du marqueur d'un livreur en alerte, sur la carte de suivi */
@keyframes pulseAlerteLivreur {
  0%, 100% { transform: scale(1); box-shadow: 0 1px 5px rgba(181,18,27,.45); }
  50% { transform: scale(1.25); box-shadow: 0 1px 10px rgba(181,18,27,.7); }
}
