/* =====================================================================
   Gestion Commerciale des Articles en Resine
   Feuille de style principale — design 2.0
   Police : Plus Jakarta Sans (embarquee, fonctionne hors ligne)
   Responsive : ordinateur, tablette, mobile
   ===================================================================== */

/* ---------- Police embarquee ---------- */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
                 U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: italic;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/plus-jakarta-sans-latin-wght-italic.woff2") format("woff2-variations"),
       url("../fonts/plus-jakarta-sans-latin-wght-italic.woff2") format("woff2");
}

/* ---------- Jetons de design ---------- */
:root {
  --vert:        #14784f;
  --vert-clair:  #22a06b;
  --vert-pale:   #e7f5ee;
  --vert-fonce:  #0b4a31;
  --nuit:        #0a2a1f;
  --nuit-2:      #0f3a2b;
  --or:          #c99a3b;
  --or-pale:     #fbf3e2;
  --ambre:       #b7730f;
  --ambre-pale:  #fdf3e3;
  --rouge:       #c93a2e;
  --rouge-pale:  #fdecea;
  --bleu:        #2563a8;
  --bleu-pale:   #e8f0fa;
  --violet:      #7c4dbd;

  --gris-900:    #14201b;
  --gris-700:    #3b4843;
  --gris-500:    #66756f;
  --gris-300:    #cfd8d4;
  --gris-150:    #e5ebe8;
  --gris-100:    #f0f4f2;
  --gris-50:     #f6f8f7;
  --blanc:       #ffffff;

  --fond:        #f3f6f4;
  --surface:     var(--blanc);
  --surface-2:   #f8faf9;
  --texte:       var(--gris-900);
  --texte-doux:  var(--gris-500);
  --bordure:     var(--gris-150);
  --champ-bord:  #d3ddd8;

  --rayon:       16px;
  --rayon-md:    12px;
  --rayon-sm:    10px;
  --ombre:       0 1px 2px rgba(10, 42, 31, .04), 0 2px 8px rgba(10, 42, 31, .05);
  --ombre-md:    0 10px 30px -12px rgba(10, 42, 31, .22);
  --ombre-lg:    0 24px 60px -20px rgba(10, 42, 31, .35);
  --anneau:      0 0 0 4px rgba(34, 160, 107, .16);
  --largeur-menu: 268px;
  --hauteur-barre: 64px;
  --police:      "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

[data-theme="sombre"] {
  --fond:        #0d1512;
  --surface:     #141f1b;
  --surface-2:   #18241f;
  --texte:       #e7eeea;
  --texte-doux:  #95a59e;
  --bordure:     #24332d;
  --champ-bord:  #2f4038;
  --gris-100:    #1b2823;
  --gris-50:     #16211d;
  --gris-150:    #24332d;
  --gris-300:    #34463e;
  --gris-700:    #c3cfca;
  --vert-pale:   #133427;
  --vert-fonce:  #8fe0b8;
  --ambre-pale:  #33270f;
  --rouge-pale:  #3a1a17;
  --bleu-pale:   #152840;
  --or-pale:     #2e2512;
  --ombre:       0 1px 2px rgba(0,0,0,.35);
  --ombre-md:    0 10px 30px -12px rgba(0,0,0,.6);
  --ombre-lg:    0 24px 60px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.55;
  color: var(--texte);
  background: var(--fond);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-spacing: .08em;
}
button, input, select, textarea { font-family: inherit; }

a { color: var(--vert); text-decoration: none; font-weight: 500; }
a:hover { color: var(--vert-clair); }
[data-theme="sombre"] a { color: #5fd29c; }

h1, h2, h3, h4 { margin: 0 0 .6rem; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; word-spacing: .1em; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; }
h2 { font-size: 1.08rem; }
h3 { font-size: 1rem; }
h2 svg, h3 svg { vertical-align: -3px; color: var(--vert); margin-right: .2rem; }
::selection { background: rgba(34,160,107,.22); }

/* =====================================================================
   PAGE DE CONNEXION
   ===================================================================== */
.page-connexion {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  background: var(--fond);
}
.connexion-visuel {
  position: relative; overflow: hidden; color: #fff;
  background: var(--nuit) var(--fond-connexion, none) center / cover no-repeat;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 2.6rem 3rem;
}
.connexion-visuel::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 26, 19, .55) 0%, rgba(6, 26, 19, .05) 38%, rgba(6, 26, 19, .15) 60%, rgba(6, 26, 19, .82) 100%);
}
.connexion-visuel > * { position: relative; }
.connexion-visuel .marque-visuel { display: flex; align-items: center; gap: .8rem; font-weight: 700; font-size: 1.05rem; }
.connexion-visuel .marque-visuel img {
  height: 44px; width: auto; background: rgba(255,255,255,.92); border-radius: 12px; padding: 5px;
}
.connexion-visuel .marque-visuel .pastille-marque {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(6px);
}
.connexion-visuel .accroche { max-width: 34rem; }
.connexion-visuel .accroche .surtitre {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #f3d99a; margin-bottom: .9rem;
}
.connexion-visuel .accroche .surtitre::before { content: ""; width: 26px; height: 2px; background: currentColor; border-radius: 2px; }
.connexion-visuel .accroche h1 {
  font-size: clamp(1.9rem, 3.2vw, 2.9rem); font-weight: 800; line-height: 1.12; letter-spacing: -.025em; word-spacing: .12em; margin: 0 0 .9rem;
  text-shadow: 0 2px 24px rgba(0,0,0,.25);
}
.connexion-visuel .accroche p { margin: 0; font-size: 1rem; color: rgba(255,255,255,.86); max-width: 28rem; }
.connexion-visuel .points { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.4rem; }
.connexion-visuel .points span {
  font-size: .8rem; font-weight: 600; padding: .38rem .8rem; border-radius: 999px;
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(8px);
}

.connexion-formulaire {
  display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem;
  background: var(--surface);
}
.carte-connexion { width: 100%; max-width: 400px; }
.carte-connexion .logo { margin-bottom: 1.8rem; }
.carte-connexion .logo img { max-height: 64px; margin-bottom: .8rem; }
.carte-connexion .logo .marque { font-size: 1.65rem; font-weight: 800; letter-spacing: -.03em; color: var(--texte); line-height: 1.2; }
.carte-connexion .logo small { color: var(--texte-doux); display: block; margin-top: .35rem; font-size: .92rem; }
.carte-connexion .champ { margin-bottom: 1rem; }
.carte-connexion .bouton-principal { height: 48px; font-size: .95rem; }
.champ-icone { position: relative; }
.champ-icone > svg {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: var(--texte-doux); pointer-events: none;
}
.champ-icone input { padding-left: 2.6rem !important; }
.champ-icone .voir-mdp {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--texte-doux); cursor: pointer; padding: .45rem; border-radius: 8px;
}
.champ-icone .voir-mdp:hover { background: var(--gris-100); color: var(--texte); }
.connexion-pied { margin-top: 2rem; font-size: .8rem; color: var(--texte-doux); text-align: center; }

/* Carte centree (installation, pages simples) */
.page-connexion.centree {
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: var(--nuit) var(--fond-connexion, none) center / cover no-repeat;
}
.page-connexion.centree .carte-connexion {
  background: var(--surface); border-radius: 22px; box-shadow: var(--ombre-lg); padding: 2.2rem 2rem;
}

/* =====================================================================
   STRUCTURE
   ===================================================================== */
.appli { display: flex; min-height: 100vh; }

.menu-lateral {
  width: var(--largeur-menu); flex: 0 0 var(--largeur-menu);
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(34,160,107,.22), transparent 60%),
    linear-gradient(180deg, var(--nuit-2) 0%, var(--nuit) 100%);
  color: #c9d8d1;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.menu-lateral::-webkit-scrollbar { width: 6px; }
.menu-lateral::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 6px; }
.menu-lateral .entete {
  padding: 1.25rem 1.2rem 1.1rem; display: flex; align-items: center; gap: .75rem;
  position: sticky; top: 0; z-index: 1;
  background: linear-gradient(180deg, var(--nuit-2) 70%, rgba(15,58,43,0));
}
.menu-lateral .entete img { height: 38px !important; width: auto; background: #fff; border-radius: 10px; padding: 3px; }
.menu-lateral .entete .logo-lettre {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; color: var(--nuit);
  background: linear-gradient(135deg, #f3d99a, var(--or));
  box-shadow: 0 6px 16px -6px rgba(201,154,59,.7);
}
.menu-lateral .entete .lien-logo { display: inline-flex; padding: 0; margin: 0; border-radius: 11px; flex: 0 0 auto; }
.menu-lateral .entete .lien-logo:hover { background: none; box-shadow: 0 0 0 2px rgba(243,217,154,.6); }
.menu-lateral .entete .marque { color: #fff; font-weight: 700; font-size: .98rem; line-height: 1.2; letter-spacing: -.01em; min-width: 0; }
.menu-lateral .entete .marque small { display: block; font-weight: 500; font-size: .72rem; color: #86a398; margin-top: .1rem; }
.menu-lateral nav { padding: .2rem .75rem 1.5rem; flex: 1; }
.menu-lateral .groupe-titre {
  padding: 1rem .7rem .4rem; font-size: .66rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: #6f8d82;
}
.menu-lateral a {
  position: relative;
  display: flex; align-items: center; gap: .7rem;
  padding: .56rem .75rem; margin: 1px 0; color: #c9d8d1; font-size: .885rem; font-weight: 500;
  border-radius: 10px; text-decoration: none;
  transition: background .15s, color .15s;
}
.menu-lateral a:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-lateral a.actif {
  background: linear-gradient(90deg, rgba(34,160,107,.30), rgba(34,160,107,.10));
  color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.menu-lateral a.actif::before {
  content: ""; position: absolute; left: -.75rem; top: 22%; bottom: 22%; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--or);
}
.menu-lateral a svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.menu-lateral a.actif svg { opacity: 1; color: #7be0ae; }
.menu-lateral .pied-menu {
  margin: 0 .75rem 1rem; padding: .85rem .9rem; border-radius: 12px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07);
  font-size: .74rem; color: #86a398;
}
.menu-lateral .pied-menu strong { color: #dce8e2; display: block; font-size: .8rem; }

.zone-principale {
  flex: 1; margin-left: var(--largeur-menu); display: flex; flex-direction: column; min-width: 0;
}

.barre-haute {
  height: var(--hauteur-barre);
  background: color-mix(in srgb, var(--fond) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--bordure);
  padding: 0 1.75rem; display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 30;
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .barre-haute { background: var(--fond); }
}
.barre-haute .titre {
  font-size: .95rem; font-weight: 600; flex: 1; min-width: 0; color: var(--texte-doux);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barre-haute .titre .fil { color: var(--texte-doux); font-weight: 500; }
.barre-haute .titre strong { color: var(--texte); font-weight: 700; }
.barre-haute .actions { display: flex; align-items: center; gap: .35rem; }
.bouton-menu {
  display: none; background: var(--surface); border: 1px solid var(--bordure); cursor: pointer;
  width: 40px; height: 40px; border-radius: 11px; place-items: center; color: var(--texte); padding: 0;
}

.profil {
  display: flex; align-items: center; gap: .6rem; padding: .3rem .8rem .3rem .3rem;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--bordure); margin-left: .35rem;
}
.profil .pastille {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--vert-clair), var(--vert-fonce));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .82rem;
}
[data-theme="sombre"] .profil .pastille { background: linear-gradient(135deg, var(--vert-clair), #0b4a31); }
.profil .infos { line-height: 1.2; }
.profil .infos strong { font-size: .82rem; display: block; font-weight: 700; }
.profil .infos small { color: var(--texte-doux); font-size: .72rem; }

.contenu { padding: 1.75rem; flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; }
.contenu > .entete-page {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem;
}
.entete-page h1 { margin: 0; }
.entete-page .sous-titre, .sous-titre { margin: .3rem 0 0; color: var(--texte-doux); font-size: .92rem; }

/* =====================================================================
   CARTES ET STATISTIQUES
   ===================================================================== */
.carte {
  background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--rayon); box-shadow: var(--ombre); margin-bottom: 1.35rem;
  min-width: 0;
}
.carte > .entete {
  padding: 1rem 1.3rem; border-bottom: 1px solid var(--bordure);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
}
.carte > .entete h2, .carte > .entete h3 { margin: 0; }
.carte > .corps { padding: 1.3rem; }
.carte > .corps.serre { padding: 0; }
.carte > .corps.serre .table-zone { border-radius: 0 0 var(--rayon) var(--rayon); }

.grille-stats {
  display: grid; gap: 1rem; margin-bottom: 1.35rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: 1.05rem 1.2rem 1.1rem; box-shadow: var(--ombre);
  transition: transform .15s, box-shadow .15s;
}
.stat:hover { transform: translateY(-1px); box-shadow: var(--ombre-md); }
.stat::after {
  content: ""; position: absolute; right: -28px; top: -28px; width: 90px; height: 90px; border-radius: 50%;
  background: var(--accent-stat, var(--gris-100)); opacity: .55;
}
.stat .libelle {
  position: relative; z-index: 1;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--texte-doux); margin-bottom: .45rem;
}
.stat .valeur { position: relative; z-index: 1; font-size: 1.5rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; word-spacing: .12em; }
.stat .detail { position: relative; z-index: 1; font-size: .78rem; color: var(--texte-doux); margin-top: .35rem; }
.stat.vert  { --accent-stat: var(--vert-pale); }
.stat.rouge { --accent-stat: var(--rouge-pale); }
.stat.ambre { --accent-stat: var(--ambre-pale); }
.stat.bleu  { --accent-stat: var(--bleu-pale); }
.stat.vert   .valeur { color: var(--vert); }
.stat.rouge  .valeur { color: var(--rouge); }
.stat.ambre  .valeur { color: var(--ambre); }
.stat.bleu   .valeur { color: var(--bleu); }
[data-theme="sombre"] .stat.vert .valeur { color: #5fd29c; }
[data-theme="sombre"] .stat.bleu .valeur { color: #7fb1ec; }
[data-theme="sombre"] .stat.rouge .valeur { color: #f08a80; }
[data-theme="sombre"] .stat.ambre .valeur { color: #e7b35a; }

/* =====================================================================
   TABLEAUX
   ===================================================================== */
.table-zone { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
table.table th, table.table td {
  padding: .78rem 1rem; text-align: left; border-bottom: 1px solid var(--bordure);
  vertical-align: middle;
}
table.table thead th {
  background: var(--surface-2); font-weight: 700; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .07em; color: var(--texte-doux);
  white-space: nowrap; position: sticky; top: 0;
}
table.table tbody tr { transition: background .12s; }
table.table tbody tr:hover { background: var(--surface-2); }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tfoot td { background: var(--surface-2); border-top: 1px solid var(--bordure); border-bottom: 0; }
table.table td.nombre, table.table th.nombre { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.table td.actions { text-align: right; white-space: nowrap; }
table.table td.actions > * + * { margin-left: .3rem; }
.vide { padding: 2.6rem 1rem; text-align: center; color: var(--texte-doux); }

/* =====================================================================
   FORMULAIRES
   ===================================================================== */
.grille-champs { display: grid; gap: 1rem 1.1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.champ { display: flex; flex-direction: column; gap: .38rem; margin-bottom: .25rem; min-width: 0; }
.champ label { font-size: .8rem; font-weight: 600; color: var(--gris-700); }
.champ .aide { font-size: .76rem; color: var(--texte-doux); }
.champ.pleine-largeur, .pleine-largeur { grid-column: 1 / -1; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=datetime-local], input[type=tel], input[type=search], input[type=month],
input[type=time], input[type=url], input[type=file],
select, textarea {
  width: 100%; min-height: 42px; padding: .55rem .8rem; font: inherit; font-size: .9rem;
  color: var(--texte); background: var(--surface);
  border: 1px solid var(--champ-bord); border-radius: var(--rayon-sm);
  transition: border-color .15s, box-shadow .15s;
}
input[type=file] { padding: .45rem .6rem; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366756f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center;
}
select[multiple] { background-image: none; padding-right: .8rem; }
input:hover, select:hover, textarea:hover { border-color: var(--gris-300); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--vert-clair); box-shadow: var(--anneau);
}
input[readonly], input:disabled, select:disabled { background: var(--gris-100); color: var(--texte-doux); }
input[type=checkbox], input[type=radio] { accent-color: var(--vert); width: 16px; height: 16px; }
textarea { min-height: 90px; resize: vertical; }
.champ-erreur input, .champ-erreur select, .champ-erreur textarea { border-color: var(--rouge); }
.message-erreur { color: var(--rouge); font-size: .78rem; font-weight: 500; }

.barre-filtres { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.barre-filtres .champ { margin: 0; min-width: 160px; }

.case-a-cocher {
  display: inline-flex; align-items: center; gap: .55rem; margin-top: 1rem; cursor: pointer;
  font-size: .88rem; font-weight: 500; padding: .6rem .85rem; border-radius: var(--rayon-sm);
  background: var(--surface-2); border: 1px solid var(--bordure);
}
.champ-avec-bouton { display: flex; gap: .4rem; }
.champ-avec-bouton .bouton { flex: 0 0 auto; }
.aide-ligne { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--texte-doux); margin: .6rem 0 0; }
.recherche-select { margin-bottom: .4rem; }
input[type=search].recherche-select {
  padding-left: 2.3rem;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2366756f' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat .8rem center;
}

/* =====================================================================
   BOUTONS
   ===================================================================== */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: .5rem 1rem; font: inherit; font-size: .86rem; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--rayon-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s, filter .15s;
}
.bouton:hover { text-decoration: none; }
.bouton:active { transform: translateY(1px); }
.bouton:focus-visible { outline: none; box-shadow: var(--anneau); }
.bouton svg { width: 16px; height: 16px; flex: 0 0 auto; }
.bouton-principal {
  background: linear-gradient(180deg, #1c9463 0%, var(--vert) 100%); color: #fff !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 6px 16px -8px rgba(20,120,79,.7);
}
.bouton-principal:hover { filter: brightness(1.06); color: #fff; }
.bouton-secondaire { background: var(--surface); color: var(--texte) !important; border-color: var(--champ-bord); }
.bouton-secondaire:hover { background: var(--surface-2); border-color: var(--gris-300); color: var(--texte); }
.bouton-danger { background: var(--rouge); color: #fff !important; }
.bouton-danger:hover { filter: brightness(1.07); }
.bouton-discret { background: transparent; color: var(--texte-doux) !important; min-height: 38px; padding: .4rem .55rem; }
.bouton-discret:hover { background: var(--gris-100); color: var(--texte) !important; }
.bouton-petit { min-height: 32px; padding: .3rem .65rem; font-size: .79rem; border-radius: 9px; }
.bouton:disabled { opacity: .6; cursor: not-allowed; }
.rond-chargement {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: tourner .7s linear infinite;
}
@keyframes tourner { to { transform: rotate(360deg); } }

/* Menu deroulant (bouton a options) */
.menu-deroulant { position: relative; display: inline-block; }
.menu-deroulant-liste {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 250px;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-md);
  box-shadow: var(--ombre-lg); padding: .35rem;
}
.menu-deroulant.ouvert .menu-deroulant-liste { display: block; }
.menu-deroulant-liste a {
  display: flex; align-items: center; gap: .55rem; padding: .6rem .7rem; border-radius: 8px;
  color: var(--texte); font-size: .86rem; font-weight: 500;
}
.menu-deroulant-liste a:hover { background: var(--surface-2); color: var(--texte); }

/* =====================================================================
   BADGES ET ALERTES
   ===================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; white-space: nowrap; letter-spacing: .01em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge-vert   { background: var(--vert-pale);  color: var(--vert-fonce); }
.badge-rouge  { background: var(--rouge-pale); color: var(--rouge); }
.badge-orange { background: var(--ambre-pale); color: var(--ambre); }
.badge-bleu   { background: var(--bleu-pale);  color: var(--bleu); }
.badge-gris   { background: var(--gris-100);   color: var(--gris-700); border: 1px solid var(--bordure); }
[data-theme="sombre"] .badge-rouge  { color: #f08a80; }
[data-theme="sombre"] .badge-orange { color: #e7b35a; }
[data-theme="sombre"] .badge-bleu   { color: #7fb1ec; }

.alerte {
  position: relative; padding: .8rem 1rem .8rem 2.75rem; border-radius: var(--rayon-md); margin-bottom: 1.1rem;
  font-size: .88rem; border: 1px solid transparent; font-weight: 500;
}
.alerte::before {
  content: ""; position: absolute; left: 1rem; top: .95rem; width: 18px; height: 18px;
  background: currentColor; -webkit-mask: var(--icone-alerte) center / contain no-repeat; mask: var(--icone-alerte) center / contain no-repeat;
  --icone-alerte: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
}
.alerte-succes::before { --icone-alerte: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E"); }
.alerte-erreur::before, .alerte-avert::before { --icone-alerte: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E"); }
.alerte-succes { background: var(--vert-pale);  color: var(--vert-fonce); border-color: rgba(34,160,107,.25); }
.alerte-erreur { background: var(--rouge-pale); color: var(--rouge);      border-color: rgba(201,58,46,.22); }
.alerte-info   { background: var(--bleu-pale);  color: var(--bleu);       border-color: rgba(37,99,168,.2); }
.alerte-avert  { background: var(--ambre-pale); color: var(--ambre);      border-color: rgba(183,115,15,.22); }
.alerte a { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-weight: 700; }
[data-theme="sombre"] .alerte-erreur { color: #f08a80; }
[data-theme="sombre"] .alerte-info { color: #7fb1ec; }
[data-theme="sombre"] .alerte-avert { color: #e7b35a; }

.bandeau-astuce {
  display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1.1rem; margin-bottom: 1.2rem;
  border-radius: var(--rayon-md); background: var(--or-pale); border: 1px solid rgba(201,154,59,.3);
  font-size: .86rem; color: var(--gris-700);
}
.bandeau-astuce > svg { color: var(--or); flex: 0 0 auto; margin-top: 2px; }
.bandeau-impression {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1.3rem;
  border-radius: var(--rayon); color: #fff;
  background: linear-gradient(120deg, var(--nuit-2), var(--vert));
  box-shadow: var(--ombre-md);
}
.bandeau-impression > div:nth-child(2) { flex: 1; min-width: 0; }
.bandeau-impression strong { display: block; font-size: 1rem; }
.bandeau-impression span { font-size: .85rem; color: rgba(255,255,255,.85); }
.bandeau-impression-icone { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.14); flex: 0 0 auto; }
.bandeau-impression .bouton-principal { background: #fff; color: var(--vert-fonce) !important; box-shadow: none; }
[data-theme="sombre"] .bandeau-impression .bouton-principal { color: #0b4a31 !important; }

/* =====================================================================
   PAGINATION
   ===================================================================== */
.pagination { display: flex; gap: .35rem; padding: .9rem 1.2rem; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--bordure); }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; padding: 0 .6rem; display: inline-grid; place-items: center;
  border: 1px solid var(--bordure); border-radius: 9px;
  font-size: .82rem; font-weight: 600; color: var(--texte); text-decoration: none; background: var(--surface);
}
.pagination a:hover { border-color: var(--gris-300); background: var(--surface-2); }
.pagination .actif { background: var(--vert); color: #fff; border-color: var(--vert); }
.pagination .infos { border: none; color: var(--texte-doux); margin-left: auto; background: none; font-weight: 500; }

/* =====================================================================
   FORMATIONS : FORMULAIRE D'INSCRIPTION
   ===================================================================== */
.etape-form + .etape-form { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px dashed var(--bordure); }
.etape-titre { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: .98rem; margin-bottom: 1rem; }
.etape-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800;
  background: var(--vert-pale); color: var(--vert-fonce); border: 1px solid rgba(34,160,107,.3);
}
.choix-sessions { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.choix-session { position: relative; cursor: pointer; display: block; }
.choix-session input { position: absolute; opacity: 0; pointer-events: none; }
.choix-corps {
  display: flex; flex-direction: column; gap: .4rem; height: 100%;
  padding: 1rem 1.05rem; border-radius: var(--rayon-md); border: 1.5px solid var(--bordure); background: var(--surface);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.choix-session:hover .choix-corps { border-color: var(--gris-300); }
.choix-session input:checked + .choix-corps {
  border-color: var(--vert-clair); background: var(--vert-pale); box-shadow: var(--anneau);
}
.choix-session input:focus-visible + .choix-corps { box-shadow: var(--anneau); }
.choix-session input:checked + .choix-corps::after {
  content: ""; position: absolute; top: .8rem; right: .8rem; width: 20px; height: 20px; border-radius: 50%;
  background: var(--vert) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.choix-session.complete { cursor: not-allowed; opacity: .55; }
.choix-titre { font-weight: 700; font-size: .95rem; padding-right: 1.6rem; }
.choix-meta { font-size: .8rem; color: var(--texte-doux); display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.choix-bas { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; padding-top: .3rem; }

.onglets-segment {
  display: inline-flex; padding: 4px; gap: 4px; margin-bottom: 1rem; border-radius: 12px;
  background: var(--gris-100); border: 1px solid var(--bordure);
}
.onglets-segment label { cursor: pointer; }
.onglets-segment input { position: absolute; opacity: 0; pointer-events: none; }
.onglets-segment span {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border-radius: 9px;
  font-size: .84rem; font-weight: 600; color: var(--texte-doux); transition: all .15s;
}
.onglets-segment input:checked + span { background: var(--surface); color: var(--texte); box-shadow: var(--ombre); }
.onglets-segment input:focus-visible + span { box-shadow: var(--anneau); }
.actions-form { margin-top: 1.5rem; }

/* Zone de suppression */
.carte-danger { border-color: rgba(201,58,46,.3); }
.carte-danger > .entete h2, .carte-danger > .entete h2 svg { color: var(--rouge); }
.choix-suppression { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.choix-radio {
  display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; padding: .85rem 1rem;
  border: 1.5px solid var(--bordure); border-radius: var(--rayon-md); background: var(--surface); font-size: .9rem;
}
.choix-radio input { margin-top: .2rem; flex: 0 0 auto; }
.choix-radio:has(input:checked) { border-color: var(--vert-clair); background: var(--vert-pale); }
.bouton-suppr:hover { color: var(--rouge) !important; border-color: rgba(201,58,46,.45); background: var(--rouge-pale); }

/* Logo (Parametres) */
.bloc-logo { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; margin-bottom: .7rem; }
.apercu-logo {
  height: 120px; border-radius: var(--rayon-md); border: 1px solid var(--bordure);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; padding: .8rem;
  background: #ffffff; color: var(--gris-500); font-size: .72rem; font-weight: 600;
}
.apercu-logo.sombre { background: var(--nuit); color: #9fb8ad; }
.apercu-logo img { max-height: 64px; max-width: 90%; object-fit: contain; }
.apercu-logo .sans-logo { font-size: .85rem; font-weight: 500; color: var(--gris-500); }

/* Apercu de l'image de fond (Parametres > Apparence) */
.apercu-fond {
  height: 150px; border-radius: var(--rayon-md); background: var(--nuit) center / cover no-repeat;
  display: flex; align-items: flex-end; padding: .7rem; margin-bottom: .5rem; border: 1px solid var(--bordure);
}
.apercu-fond span { font-size: .75rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.45); padding: .25rem .6rem; border-radius: 999px; }

/* Etat vide */
.etat-vide { text-align: center; padding: 3rem 1.5rem !important; }
.etat-vide-icone {
  width: 70px; height: 70px; margin: 0 auto 1rem; border-radius: 20px; display: grid; place-items: center;
  background: var(--vert-pale); color: var(--vert);
}

/* =====================================================================
   DIVERS
   ===================================================================== */
.texte-doux { color: var(--texte-doux); }
.texte-petit { font-size: .82rem; }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace; font-size: .82em; letter-spacing: -.01em; }
.pile { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.pile-fin { margin-left: auto; }
.separateur { height: 1px; background: var(--bordure); margin: 1.2rem 0; }
.voile {
  display: none; position: fixed; inset: 0; background: rgba(6, 20, 15, .5); z-index: 35;
  backdrop-filter: blur(2px);
}
.voile.visible { display: block; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; background: var(--gris-100); padding: .1rem .35rem; border-radius: 5px; }

/* Graphiques SVG : texte dans la police de l'application */
svg text { font-family: var(--police); }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1100px) {
  .page-connexion { grid-template-columns: 1fr 1fr; }
  .connexion-visuel { padding: 2rem; }
}

@media (max-width: 992px) {
  .menu-lateral { transform: translateX(-100%); box-shadow: none; }
  .menu-lateral.ouvert { transform: translateX(0); box-shadow: var(--ombre-lg); }
  .zone-principale { margin-left: 0; }
  .bouton-menu { display: inline-grid; }
  .contenu { padding: 1.35rem; }
  .barre-haute { padding: 0 1.1rem; }
}

@media (max-width: 820px) {
  /* Connexion : l'image passe en fond plein ecran, le formulaire flotte dessus */
  .page-connexion {
    display: flex; flex-direction: column; justify-content: flex-end;
    background: var(--nuit) var(--fond-connexion, none) center / cover no-repeat;
  }
  .connexion-visuel { background: none; padding: 1.4rem 1.25rem 1.2rem; min-height: 38vh; }
  .connexion-visuel::before { background: linear-gradient(180deg, rgba(6,26,19,.45), rgba(6,26,19,.15)); }
  .connexion-visuel .accroche h1 { font-size: 1.7rem; }
  .connexion-visuel .accroche p, .connexion-visuel .points { display: none; }
  .connexion-formulaire {
    border-radius: 26px 26px 0 0; padding: 2rem 1.35rem 2.2rem; box-shadow: 0 -20px 50px -20px rgba(0,0,0,.45);
  }
  .carte-connexion .logo { margin-bottom: 1.3rem; }
  .carte-connexion .logo .marque { font-size: 1.35rem; }
}

@media (max-width: 720px) {
  /* Tableaux en cartes : chaque ligne devient une carte lisible */
  table.table-cartes thead { display: none; }
  table.table-cartes, table.table-cartes tbody, table.table-cartes tr, table.table-cartes td { display: block; width: 100%; }
  table.table-cartes tbody tr {
    padding: .75rem .95rem; border-bottom: 1px solid var(--bordure);
  }
  table.table-cartes tbody tr:last-child { border-bottom: 0; }
  table.table-cartes td {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .28rem 0; border: 0; text-align: right !important; white-space: normal !important;
  }
  table.table-cartes td[data-label]::before {
    content: attr(data-label); flex: 0 0 auto; max-width: 45%;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-doux); text-align: left;
  }
  table.table-cartes td:first-child { font-size: .95rem; }
  table.table-cartes td.actions { justify-content: flex-end; padding-top: .55rem; }
  table.table-cartes td.actions::before { content: none; }
  table.table-cartes td.vide { display: block; text-align: center !important; }
  table.table-cartes td.vide::before { content: none; }
  table.table-cartes td:empty { display: none; }
  table.table-cartes tfoot { display: block; }
  table.table-cartes tfoot tr { display: flex; justify-content: space-between; padding: .6rem .95rem; }
  table.table-cartes tfoot td { display: inline; width: auto; padding: 0; border: 0; background: none; }
}

@media (max-width: 640px) {
  html, body { font-size: 14.5px; }
  h1 { font-size: 1.35rem; }
  .contenu { padding: 1rem .85rem 2rem; }
  .contenu > .entete-page { align-items: flex-start; margin-bottom: 1.1rem; }
  .contenu > .entete-page > .pile { width: 100%; }
  .contenu > .entete-page > .pile .bouton { flex: 1 1 auto; }
  .grille-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .stat { padding: .85rem .9rem; border-radius: 14px; }
  .stat .valeur { font-size: 1.12rem; word-break: break-word; }
  .stat .libelle { font-size: .64rem; }
  .profil .infos { display: none; }
  .profil { padding: .25rem; margin-left: 0; }
  .barre-haute { padding: 0 .8rem; gap: .6rem; }
  .carte { border-radius: 14px; }
  .carte > .corps { padding: 1rem; }
  .carte > .entete { padding: .85rem 1rem; }
  table.table th, table.table td { padding: .6rem .7rem; }
  .barre-filtres .champ { min-width: 100%; }
  .choix-sessions { grid-template-columns: 1fr; }
  .onglets-segment { display: flex; }
  .onglets-segment label { flex: 1; }
  .onglets-segment span { justify-content: center; width: 100%; }
  .actions-form .bouton { width: 100%; }
  .bandeau-impression { flex-wrap: wrap; }
  .bandeau-impression .bouton { width: 100%; }
  .menu-deroulant-liste { right: auto; left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .menu-lateral, .barre-haute, .bouton, .pagination, .barre-filtres, .bandeau-astuce, .bandeau-impression { display: none !important; }
  .zone-principale { margin-left: 0; }
  .contenu { padding: 0; max-width: none; }
  .carte, .stat { border: 1px solid #ddd; box-shadow: none; }
  body { background: #fff; }
}

/* ---------- Recherche d'article dans la caisse ---------- */
.barre-recherche-article { padding: 1rem 1.25rem .4rem; }
.barre-recherche-article input[type=search] { margin-bottom: 0; font-size: 1rem; min-height: 46px; }
.liste-articles {
  position: fixed; z-index: 1000; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--bordure); border-radius: var(--rayon-sm);
  box-shadow: 0 16px 40px -12px rgba(10, 42, 31, .35);
}
.liste-articles .opt {
  display: flex; justify-content: space-between; align-items: center; gap: .8rem;
  padding: .55rem .8rem; cursor: pointer; border-bottom: 1px solid var(--bordure);
}
.liste-articles .opt:last-child { border-bottom: 0; }
.liste-articles .opt.actif, .liste-articles .opt:hover { background: var(--surface-2); }
.liste-articles .opt strong { display: block; font-size: .9rem; font-weight: 600; }
.liste-articles .opt small { color: var(--texte-doux); font-size: .74rem; }
.liste-articles .droite { text-align: right; flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; }
.liste-articles .prix { font-weight: 700; font-size: .88rem; }
.liste-articles .stk { font-size: .72rem; font-weight: 600; }
.liste-articles .stk.ok { color: var(--vert); }
.liste-articles .stk.cmd { color: #b7791f; }
.liste-articles .stk.rupt { color: var(--rouge); }
.liste-articles .aucun { padding: .8rem; font-size: .82rem; color: var(--texte-doux); }

/* ---------- Nouveau client a la volee ---------- */
[hidden] { display: none !important; }
.nouveau-client {
  margin-top: .7rem; padding: .9rem 1rem 1rem; border-radius: var(--rayon-sm);
  background: var(--surface-2); border: 1px dashed var(--vert);
}
.nouveau-client .titre-panneau { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--vert); margin-bottom: .6rem; }
.case-option { display: flex; gap: .55rem; align-items: center; cursor: pointer; font-weight: 500; font-size: .9rem; }
.case-option input[type=checkbox] { width: auto; }
