[x-cloak] { display: none !important; }

/*
 * Gestion Moulin v4.0 — Feuille de style principale
 * Palette : Blanc (dominant) · Noir (structure) · Orange (accent)
 *
 * Variables CSS centralisées :
 *   --blanc      #FFFFFF  → fond des pages, cartes, formulaires
 *   --gris-clair #F5F5F5  → fond secondaire, alternance lignes tableau
 *   --gris       #E0E0E0  → bordures, séparateurs
 *   --noir       #1A1A1A  → texte principal, navbar, sidebar
 *   --noir-doux  #333333  → texte secondaire
 *   --orange     #F97316  → boutons primaires, badges, accents
 *   --orange-fonce #EA6004 → hover des boutons orange
 *   --orange-clair #FFF7ED → fond des alertes et badges orange
 *   --rouge      #EF4444  → alertes critiques, blocage rouge
 *   --vert       #22C55E  → validations, succès
 *   --jaune      #F59E0B  → avertissements, conflits sync
 */

/* ═══════════════════════════════════════════════════════════════
   1. VARIABLES & RESET
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Palette principale */
  --blanc:         #FFFFFF;
  --gris-clair:    #F5F5F5;
  --gris:          #E0E0E0;
  --gris-moyen:    #9CA3AF;
  --noir:          #1A1A1A;
  --noir-doux:     #333333;

  /* Accent orange */
  --orange:        #F97316;
  --orange-fonce:  #EA6004;
  --orange-clair:  #FFF7ED;
  --orange-border: #FED7AA;

  /* États */
  --rouge:         #EF4444;
  --rouge-clair:   #FEF2F2;
  --vert:          #22C55E;
  --vert-clair:    #F0FDF4;
  --jaune:         #F59E0B;
  --jaune-clair:   #FFFBEB;

  /* Typographie */
  --font-base:     'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:     'Consolas', 'Courier New', monospace;

  /* Espacements */
  --radius:        8px;
  --radius-sm:     4px;
  --radius-lg:     12px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.14);

  /* Transitions */
  --transition:    all .18s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-base);
  background-color: var(--gris-clair);
  color: var(--noir);
  line-height: 1.6;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════
   2. MISE EN PAGE GLOBALE
   ═══════════════════════════════════════════════════════════════ */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Contenu principal (à droite de la sidebar) */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.app-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════
   3. NAVBAR SUPÉRIEURE
   ═══════════════════════════════════════════════════════════════ */

.navbar {
  background-color: var(--noir);
  color: var(--blanc);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blanc);
  text-decoration: none;
  letter-spacing: .02em;
}

/* Point orange dans le logo */
.navbar-brand .dot {
  width: 10px;
  height: 10px;
  background: var(--orange);
  border-radius: 50%;
  display: inline-block;
}

/* Bandeau de statut : LOCAL/CLOUD · PENDING · Conflits */
.navbar-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .82rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .65rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .03em;
}

.status-badge.local   { background: #2d3748; color: #90CDF4; }
.status-badge.cloud   { background: #1a3a2a; color: #6EE7B7; }
.status-badge.pending { background: var(--orange-clair); color: var(--orange-fonce); }
.status-badge.conflit { background: var(--jaune-clair); color: #92400E; }

/* Informations utilisateur à droite */
.navbar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.navbar-user .username {
  font-weight: 600;
  font-size: .9rem;
}

.navbar-user .role-badge {
  background: var(--orange);
  color: var(--blanc);
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ═══════════════════════════════════════════════════════════════
   4. SIDEBAR (NAVIGATION LATÉRALE)
   ═══════════════════════════════════════════════════════════════ */

.sidebar {
  width: 240px;
  background-color: var(--noir);
  min-height: calc(100vh - 60px);
  padding: 1.5rem 0;
  flex-shrink: 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gris-moyen);
  padding: 0 1.2rem .5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.2rem;
  color: #CBD5E1;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background-color: rgba(255,255,255,.06);
  color: var(--blanc);
}

.sidebar-link.actif {
  background-color: rgba(249,115,22,.12);  /* orange très transparent */
  color: var(--orange);
  border-left-color: var(--orange);
}

.sidebar-link .icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   5. CARTES
   ═══════════════════════════════════════════════════════════════ */

.card {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gris);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gris);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--blanc);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--noir);
}

.card-body { padding: 1.25rem; }

/* Carte KPI (tableau de bord) */
.card-kpi {
  background: var(--blanc);
  border-radius: var(--radius);
  border: 1px solid var(--gris);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-kpi .kpi-label {
  font-size: .8rem;
  color: var(--gris-moyen);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .4rem;
}

.card-kpi .kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--noir);
  line-height: 1.2;
}

.card-kpi .kpi-value.orange { color: var(--orange); }
.card-kpi .kpi-value.vert   { color: var(--vert); }
.card-kpi .kpi-value.rouge  { color: var(--rouge); }

.card-kpi .kpi-sous-texte {
  font-size: .8rem;
  color: var(--gris-moyen);
  margin-top: .3rem;
}

/* ═══════════════════════════════════════════════════════════════
   6. BOUTONS
   ═══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* Bouton principal — Orange (action principale) */
.btn-primary {
  background-color: var(--orange);
  color: var(--blanc);
  border-color: var(--orange);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--orange-fonce);
  border-color: var(--orange-fonce);
  box-shadow: 0 2px 8px rgba(249,115,22,.35);
}

/* Bouton secondaire — Contour noir */
.btn-secondary {
  background-color: var(--blanc);
  color: var(--noir);
  border-color: var(--gris);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--noir);
  background-color: var(--gris-clair);
}

/* Bouton danger — Rouge (annulation, suppression) */
.btn-danger {
  background-color: var(--rouge);
  color: var(--blanc);
  border-color: var(--rouge);
}
.btn-danger:hover:not(:disabled) {
  background-color: #DC2626;
  box-shadow: 0 2px 8px rgba(239,68,68,.35);
}

/* Bouton succès — Vert (validation) */
.btn-success {
  background-color: var(--vert);
  color: var(--blanc);
  border-color: var(--vert);
}
.btn-success:hover:not(:disabled) {
  background-color: #16A34A;
}

/* Bouton noir */
.btn-dark {
  background-color: var(--noir);
  color: var(--blanc);
  border-color: var(--noir);
}
.btn-dark:hover:not(:disabled) {
  background-color: #333;
}

/* Tailles */
.btn-sm { padding: .35rem .75rem; font-size: .82rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ═══════════════════════════════════════════════════════════════
   7. FORMULAIRES
   ═══════════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--noir-doux);
  margin-bottom: .35rem;
}

.form-label .required {
  color: var(--rouge);
  margin-left: .2rem;
}

.form-control {
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid var(--gris);
  border-radius: var(--radius-sm);
  font-size: .92rem;
  color: var(--noir);
  background: var(--blanc);
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font-base);
}

.form-control:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}

.form-control::placeholder { color: var(--gris-moyen); }

.form-hint {
  font-size: .78rem;
  color: var(--gris-moyen);
  margin-top: .3rem;
}

.form-error {
  font-size: .8rem;
  color: var(--rouge);
  margin-top: .3rem;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   8. TABLEAUX
   ═══════════════════════════════════════════════════════════════ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gris);
  background: var(--blanc);
}

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

thead th {
  background: var(--noir);
  color: var(--blanc);
  padding: .8rem 1rem;
  text-align: left;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

/* En-tête triable */
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { background: #333; }

tbody tr { border-bottom: 1px solid var(--gris); }
tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background-color: #FFF7ED; }  /* Orange très léger au survol */

tbody tr:nth-child(even) { background-color: var(--gris-clair); }
tbody tr:nth-child(even):hover { background-color: #FFF7ED; }

tbody td {
  padding: .75rem 1rem;
  vertical-align: middle;
  color: var(--noir-doux);
}

/* Colonne montant : alignement droite */
.col-montant { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.col-actions { text-align: center; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════
   9. BADGES ET STATUTS
   ═══════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Statuts de vente */
.badge-brouillon { background: var(--gris-clair); color: var(--gris-moyen); border: 1px solid var(--gris); }
.badge-validee   { background: var(--vert-clair);  color: #15803D; }
.badge-annulee   { background: var(--rouge-clair); color: #B91C1C; }

/* Statuts de stock */
.badge-actif     { background: var(--vert-clair);  color: #15803D; }
.badge-epuise    { background: var(--rouge-clair); color: #B91C1C; }
.badge-alerte    { background: var(--orange-clair); color: var(--orange-fonce); }

/* Statuts de sync */
.badge-pending   { background: var(--jaune-clair); color: #92400E; }
.badge-synced    { background: var(--vert-clair);  color: #15803D; }
.badge-failed    { background: var(--rouge-clair); color: #B91C1C; }

/* Types de lignes vente */
.badge-matiere-client  { background: #EFF6FF; color: #1D4ED8; }
.badge-vente-matiere   { background: var(--orange-clair); color: var(--orange-fonce); }
.badge-aliment-fini    { background: #F0FDF4; color: #166534; }
.badge-prestation      { background: #FDF4FF; color: #7E22CE; }

/* Badge VIP */
.badge-vip {
  background: linear-gradient(135deg, var(--orange), var(--orange-fonce));
  color: var(--blanc);
  font-size: .7rem;
}

/* ═══════════════════════════════════════════════════════════════
   10. ALERTES ET NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1.1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid transparent;
  font-size: .9rem;
  margin-bottom: 1rem;
}

.alert-orange {
  background: var(--orange-clair);
  border-color: var(--orange);
  color: var(--orange-fonce);
}

.alert-rouge {
  background: var(--rouge-clair);
  border-color: var(--rouge);
  color: #991B1B;
}

.alert-vert {
  background: var(--vert-clair);
  border-color: var(--vert);
  color: #166534;
}

.alert-jaune {
  background: var(--jaune-clair);
  border-color: var(--jaune);
  color: #92400E;
}

/* Alerte stock faible (orange) */
.alerte-stock {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--orange);
  font-weight: 600;
  font-size: .85rem;
}

/* Blocage rouge FIFO — très visible */
.blocage-rouge {
  background: var(--rouge);
  color: var(--blanc);
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   11. ÉCRAN CAISSE — Zone de saisie principale
   ═══════════════════════════════════════════════════════════════ */

/* Zone 1 : En-tête de la vente */
.caisse-header {
  background: var(--noir);
  color: var(--blanc);
  padding: .75rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.caisse-header .vente-numero {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Zone 2 : Bandeau client */
.caisse-client {
  background: var(--blanc);
  border: 1px solid var(--gris);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.client-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
}

.client-nom {
  font-weight: 700;
  font-size: 1rem;
}

/* Compteur fidélité — affiché en orange */
.fidelite-compteur {
  background: var(--orange-clair);
  border: 1px solid var(--orange-border);
  border-radius: var(--radius-sm);
  padding: .4rem .85rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--orange-fonce);
  white-space: nowrap;
}

.fidelite-compteur.prochaine-gratuite {
  background: var(--orange);
  color: var(--blanc);
  border-color: var(--orange-fonce);
  animation: pulse-orange .9s ease-in-out infinite alternate;
}

@keyframes pulse-orange {
  from { box-shadow: 0 0 0 0 rgba(249,115,22,.4); }
  to   { box-shadow: 0 0 0 6px rgba(249,115,22,0); }
}

/* Zone 3 : Boutons d'ajout de lignes */
.caisse-boutons-ajout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  padding: 1rem 1.25rem;
  background: var(--gris-clair);
  border: 1px solid var(--gris);
  border-top: none;
}

.btn-ajout-ligne {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .85rem .5rem;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px dashed var(--gris);
  background: var(--blanc);
  transition: var(--transition);
  text-align: center;
  color: var(--noir-doux);
}

.btn-ajout-ligne:hover:not(:disabled) {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-clair);
}

.btn-ajout-ligne:disabled {
  opacity: .4;
  cursor: not-allowed;
  border-style: dashed;
  filter: grayscale(60%);
}

.btn-ajout-ligne .icone-ajout {
  font-size: 1.4rem;
  line-height: 1;
}

/* Zone 4 : Panier */
.caisse-panier {
  background: var(--blanc);
  border: 1px solid var(--gris);
  border-top: none;
  min-height: 200px;
}

.panier-vide {
  padding: 3rem;
  text-align: center;
  color: var(--gris-moyen);
}

/* Ligne de panier */
.ligne-panier {
  display: flex;
  align-items: center;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--gris);
  gap: 1rem;
  transition: background .12s;
}

.ligne-panier:hover { background: var(--gris-clair); }
.ligne-panier:last-child { border-bottom: none; }

.ligne-panier .ligne-badge { flex-shrink: 0; }
.ligne-panier .ligne-detail { flex: 1; }

.ligne-panier .ligne-nom {
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .1rem;
}

.ligne-panier .ligne-meta {
  font-size: .8rem;
  color: var(--gris-moyen);
}

/* Réduction appliquée — visible en orange */
.ligne-panier .ligne-reduction {
  font-size: .78rem;
  color: var(--orange-fonce);
  font-weight: 600;
}

.ligne-panier .ligne-montant {
  font-weight: 800;
  font-size: 1rem;
  text-align: right;
  white-space: nowrap;
}

.ligne-panier .ligne-montant.barre {
  text-decoration: line-through;
  color: var(--gris-moyen);
  font-size: .85rem;
  font-weight: 400;
}

.ligne-panier .btn-supprimer-ligne {
  color: var(--rouge);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: .25rem;
  border-radius: var(--radius-sm);
  transition: background .12s;
}

.ligne-panier .btn-supprimer-ligne:hover {
  background: var(--rouge-clair);
}

/* Totaux du panier */
.panier-totaux {
  padding: 1rem 1.25rem;
  background: var(--gris-clair);
  border-top: 2px solid var(--gris);
}

.panier-totaux .ligne-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .2rem 0;
  font-size: .9rem;
}

.panier-totaux .ligne-total.brut { color: var(--gris-moyen); }

.panier-totaux .ligne-total.reduction {
  color: var(--orange-fonce);
  font-weight: 600;
}

.panier-totaux .ligne-total.net {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--noir);
  border-top: 2px solid var(--gris);
  padding-top: .6rem;
  margin-top: .3rem;
}

/* Actions du bas de caisse */
.caisse-actions {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.25rem;
  background: var(--blanc);
  border: 1px solid var(--gris);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ═══════════════════════════════════════════════════════════════
   12. PAGINATION
   ═══════════════════════════════════════════════════════════════ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-top: 1px solid var(--gris);
  background: var(--blanc);
  font-size: .875rem;
}

.pagination-info { color: var(--gris-moyen); }

.pagination-links {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--gris);
  background: var(--blanc);
  color: var(--noir);
  text-decoration: none;
  transition: var(--transition);
}

.page-btn:hover:not(.actif):not(:disabled) {
  border-color: var(--orange);
  color: var(--orange);
}

.page-btn.actif {
  background: var(--orange);
  color: var(--blanc);
  border-color: var(--orange);
}

.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════════
   13. MODALE
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal {
  background: var(--blanc);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--gris);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header .modal-title {
  font-size: 1rem;
  font-weight: 700;
}

/* Trait orange sous le titre */
.modal-header .modal-title::after {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  background: var(--orange);
  border-radius: 2px;
  margin-top: .3rem;
}

.modal-body { padding: 1.4rem; flex: 1; }
.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--gris);
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gris-moyen);
  line-height: 1;
  transition: color .12s;
}
.btn-close-modal:hover { color: var(--rouge); }

/* ═══════════════════════════════════════════════════════════════
   14. UTILITAIRES
   ═══════════════════════════════════════════════════════════════ */

/* Textes */
.text-orange  { color: var(--orange); }
.text-noir    { color: var(--noir); }
.text-muted   { color: var(--gris-moyen); }
.text-rouge   { color: var(--rouge); }
.text-vert    { color: var(--vert); }
.text-sm      { font-size: .85rem; }
.text-xs      { font-size: .75rem; }
.fw-bold      { font-weight: 700; }
.fw-semi      { font-weight: 600; }

/* Espacement */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Grilles */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* Flex */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1        { gap: .5rem; }
.gap-2        { gap: 1rem; }

/* Séparateur */
.divider {
  height: 1px;
  background: var(--gris);
  margin: 1.5rem 0;
}

/* ═══════════════════════════════════════════════════════════════
   15. RESPONSIVE (≥ 768px tablette, ≥ 360px mobile)
   ═══════════════════════════════════════════════════════════════ */

/* Bouton hamburger — invisible sur grand écran */
.navbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--blanc);
  font-size: 1.5rem;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  line-height: 1;
  flex-shrink: 0;
}
.navbar-hamburger:hover { background: rgba(255,255,255,.12); }

/* Overlay fond sombre — invisible sur grand écran, jamais au-dessus des modals */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 60px;
  background: rgba(0,0,0,.45);
  z-index: 140;
}

@media (max-width: 1024px) {
  /* Hamburger visible */
  .navbar-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Sidebar : tiroir fixe, hors écran par défaut, glisse à l'ouverture */
  .sidebar {
    display: block;
    position: fixed;
    top: 60px;
    left: 0;
    width: 240px;
    height: calc(100vh - 60px);
    z-index: 150;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .25s ease;
    visibility: hidden;
  }
  .sidebar.sidebar--open {
    transform: translateX(0);
    visibility: visible;
  }

  /* Overlay visible quand menu ouvert */
  .sidebar-overlay.sidebar-overlay--visible { display: block; }

  .grid-4  { grid-template-columns: repeat(2, 1fr); }
  .caisse-boutons-ajout { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .app-content    { padding: 1rem .75rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .caisse-boutons-ajout { grid-template-columns: repeat(2, 1fr); }
  .navbar-status  { display: none; }
  .pagination     { flex-direction: column; gap: .75rem; }
}

/* ═══════════════════════════════════════════════════════════════
   16. PAGE LOGIN (AUTHENTIFICATION)
   ═══════════════════════════════════════════════════════════════ */

.content-auth {
  min-height: 100vh;
  background: var(--gris-clair);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

.auth-card {
  background: var(--blanc);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  border-top: 4px solid var(--orange);
}

.auth-header { text-align: center; margin-bottom: 2rem; }

.auth-logo {
  font-size: 2.5rem;
  color: var(--orange);
  margin-bottom: .5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--noir);
  margin-bottom: .25rem;
}

.auth-subtitle {
  font-size: .88rem;
  color: var(--gris-moyen);
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .78rem;
  color: var(--gris-moyen);
}

.btn-block { width: 100%; }

/* ═══════════════════════════════════════════════════════════════
   17. MODAL ALIASES + EXTRAS
   ═══════════════════════════════════════════════════════════════ */

/* Alias .modal-box → .modal pour compatibilité templates */
.modal-box {
  background: var(--blanc);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-box.modal-sm { max-width: 380px; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gris-moyen);
  line-height: 1;
  transition: color .12s;
  padding: 0 .25rem;
}
.modal-close:hover { color: var(--rouge); }

/* ═══════════════════════════════════════════════════════════════
   18. BANDEAU CLIENT — RECHERCHE + FIDÉLITÉ
   ═══════════════════════════════════════════════════════════════ */

.client-search-wrapper {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
}

.client-search-label {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  color: var(--noir-doux);
}

.client-search-input { max-width: 280px; }

.client-resultats {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--blanc);
  border: 1px solid var(--gris);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
}

.client-resultat-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--gris);
}
.client-resultat-item:last-child { border-bottom: none; }
.client-resultat-item:hover { background: var(--orange-clair); }

.client-resultat-nom { font-weight: 600; font-size: .9rem; flex: 1; }
.client-resultat-tel { font-size: .82rem; color: var(--gris-moyen); }

/* Fidélité mini dans le bandeau client */
.fidelite-mini {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.fidelite-progress-label { font-size: .82rem; color: var(--gris-moyen); }

.fidelite-bar {
  width: 120px;
  height: 8px;
  background: var(--gris);
  border-radius: 4px;
  overflow: hidden;
}

.fidelite-bar-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 4px;
  transition: width .4s ease;
}

.fidelite-restant-mini { font-size: .8rem; color: var(--gris-moyen); }

/* Bandeau fidélité dans les modals */
.fidelite-banner {
  background: var(--orange-clair);
  border: 1px solid var(--orange-border);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}
.fidelite-label { font-weight: 700; font-size: .85rem; color: var(--orange-fonce); }
.fidelite-restant { font-size: .82rem; color: var(--noir-doux); }

/* ═══════════════════════════════════════════════════════════════
   19. BADGES SUPPLÉMENTAIRES
   ═══════════════════════════════════════════════════════════════ */

.badge-vip {
  background: var(--orange);
  color: var(--blanc);
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-success {
  background: var(--vert-clair);
  color: var(--vert);
  border: 1px solid #bbf7d0;
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 20px;
}

.badge-danger {
  background: var(--rouge-clair);
  color: var(--rouge);
  border: 1px solid #fecaca;
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 20px;
}

.badge-brouillon { background: var(--jaune-clair); color: #92400E; border: 1px solid #fde68a; font-size:.78rem; font-weight:600; padding:.2rem .6rem; border-radius:20px; }
.badge-validee   { background: var(--vert-clair);  color: #15803d; border: 1px solid #bbf7d0; font-size:.78rem; font-weight:600; padding:.2rem .6rem; border-radius:20px; }
.badge-annulee   { background: var(--rouge-clair); color: var(--rouge); border: 1px solid #fecaca; font-size:.78rem; font-weight:600; padding:.2rem .6rem; border-radius:20px; }

/* ═══════════════════════════════════════════════════════════════
   20. CAISSE — EN-TÊTE + INDICATEURS
   ═══════════════════════════════════════════════════════════════ */

.caisse-wrapper { max-width: 1100px; margin: 0 auto; }

.caisse-numero { font-size: 1.1rem; font-weight: 700; color: var(--blanc); }

.caisse-header-left  { display: flex; align-items: center; gap: .75rem; }
.caisse-header-right { display: flex; align-items: center; gap: .75rem; }

.caisse-heure {
  font-size: .85rem;
  color: #CBD5E1;
  font-weight: 500;
}

/* Ligne offerte en vert */
.ligne-offerte { background: var(--vert-clair) !important; }

/* Indicateur de sync dans la navbar */
.sync-indicator { display: flex; align-items: center; }
.sync-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.sync-dot.sync-pending { background: var(--orange); animation: pulse-orange .9s ease-in-out infinite alternate; }
.sync-dot.sync-ok      { background: var(--vert); }
.sync-dot.sync-error   { background: var(--rouge); }

/* Formulaire row (2 colonnes) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-total { font-size: 1.15rem; font-weight: 800; color: var(--orange); margin: 0; }
.form-hint  { font-size: .82rem; color: var(--gris-moyen); margin-top: -.25rem; }

/* Input group (mot de passe + toggle) */
.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.input-group-addon {
  padding: .55rem .85rem;
  background: var(--gris-clair);
  border: 1.5px solid var(--gris);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  font-size: 1rem;
  transition: background .12s;
}
.input-group-addon:hover { background: var(--gris); }

/* btn-outline-light (navbar logout) */
.btn-outline-light {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.5);
  color: var(--blanc);
  padding: .35rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn-outline-light:hover { background: rgba(255,255,255,.12); border-color: var(--blanc); }

/* Navbar layout complémentaire */
.navbar-info  { display: flex; align-items: center; gap: .6rem; }
.navbar-actions { display: flex; align-items: center; gap: .75rem; }
.navbar-user  { font-weight: 600; font-size: .9rem; color: var(--blanc); }

/* Messages container */
.messages-container { margin-bottom: 1rem; }
.alert-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: inherit; opacity: .7;
  float: right; padding: 0 .25rem;
}
.alert-close:hover { opacity: 1; }

/* btn-xs (tiny delete buttons dans panier table) */
.btn-xs { padding: .15rem .5rem !important; font-size: .75rem !important; }
.btn-sm { padding: .35rem .75rem; font-size: .85rem; }

/* ═══════════════════════════════════════════════════════════════
   21. UTILITAIRES SUPPLÉMENTAIRES
   ═══════════════════════════════════════════════════════════════ */

/* Alignement tableau */
.text-right  { text-align: right !important; }
.text-center { text-align: center !important; }
.text-left   { text-align: left !important; }
.text-danger { color: var(--rouge) !important; }
.text-vert   { color: var(--vert) !important; }
.text-rouge  { color: var(--rouge) !important; }

/* Poids typographique */
.font-bold { font-weight: 700 !important; }
.d-block   { display: block !important; }

/* Ligne d'alerte dans un tableau */
.table-row-alerte { background-color: var(--rouge-clair) !important; }
.table-row-alerte:hover { background-color: #fee2e2 !important; }

/* KPI valeur standalone (hors .card-kpi) */
.kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--noir);
}

/* Ligne cachée (toggle JS) */
.hidden { display: none !important; }

/* Table complète dans .card (sans wrapper séparé) */
.card .table { border: none; }
.card .table thead th:first-child { border-radius: 0; }

/* Alerte inline (hors messages système) */
.alert-inline {
  padding: .5rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .5rem;
}
.alert-inline.danger { background: var(--rouge-clair); color: var(--rouge); border: 1px solid #fecaca; }
.alert-inline.success { background: var(--vert-clair); color: #15803d; border: 1px solid #bbf7d0; }

/* ═══════════════════════════════════════════════════════════════
   22. TABLEAU DE BORD (BILAN)
   ═══════════════════════════════════════════════════════════════ */

/* Grille de 4 KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* Carte KPI standalone */
.kpi-card {
  background: var(--blanc);
  border: 1px solid var(--gris);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
}
.kpi-card-accent {
  border-left: 4px solid var(--orange);
}

.kpi-card .kpi-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gris-moyen);
  margin-bottom: .35rem;
  min-height: 2.1rem;
}
.kpi-card .kpi-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--noir);
  line-height: 1.2;
  white-space: nowrap;
}
.kpi-card .kpi-sub {
  font-size: .8rem;
  color: var(--gris-moyen);
  margin-top: auto;
  padding-top: .3rem;
  min-height: 1.2rem;
}

/* Layout 2 colonnes pour les rangées du dashboard */
.dashboard-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
/* Rangée dédiée aux 6 KPI — stretch pour hauteur uniforme */
.kpi-row {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}
.dashboard-col-lg {
  flex: 2 1 0;
  min-width: 0;
}
.dashboard-col-sm {
  flex: 1 1 0;
  min-width: 0;
}
@media (max-width: 820px) {
  .dashboard-row { flex-direction: column; }
  .kpi-row { flex-direction: column; }
  .dashboard-col-lg,
  .dashboard-col-sm { flex: none; width: 100%; }
}

/* ── Section 23 — Badges de rôle utilisateur ─────────────────────────────── */
.badge-caissiere      { background: #e0f0ff; color: #1565c0; }
.badge-gestionnaire   { background: #fff3e0; color: #e65100; }
.badge-administrateur { background: #f3e5f5; color: #6a1b9a; }
.badge-danger  { background: #fde8e8; color: #c62828; }
.btn-danger    { background: var(--rouge, #e53935); color: #fff; border: none; }
.btn-danger:hover { background: #c62828; }
