/* QUIMITRA Gestion — thème inspiré de l'interface utilisée en magasin (fenêtres claires,
   menu accordéon à gauche, en-têtes bleu foncé, tuiles colorées). */
:root {
  --bleu: #0b3f94;
  --bleu-2: #1559c7;
  --bleu-clair: #e8f0fc;
  --gris-fond: #eef0f3;
  --gris-panneau: #f7f8fa;
  --bord: #c9cfd8;
  --texte: #1d2430;
  --doux: #5d6878;
  --rouge-ligne: #f4a39a;
  --rouge: #d93025;
  --vert-ligne: #8ee58e;
  --vert: #1e8e3e;
  --jaune: #f7e27a;
  --t-articles: #8cc63f;
  --t-caisse: #2aa4df;
  --t-achat: #8f4fd6;
  --t-treso: #e8842b;
  --t-stock: #17b3a3;
  --t-depenses: #d35bd6;
  --police: "Segoe UI", "Noto Sans", "DejaVu Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--police); font-size: 13px; color: var(--texte); background: var(--gris-fond); }
a { color: var(--bleu-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: 13px; }
input, select, textarea {
  border: 1px solid var(--bord); border-radius: 2px; padding: 4px 6px; background: #fff; min-height: 26px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0ff; border-color: var(--bleu-2); }
label { display: block; color: var(--doux); font-size: 12px; margin-bottom: 2px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.centre { text-align: center; }
.doux { color: var(--doux); }
.rouge { color: var(--rouge); }
.vert { color: var(--vert); }
.gras { font-weight: 700; }
.cache { display: none !important; }

/* ---------- Barre de titre (comme une fenêtre Windows) ---------- */
.titre-app {
  height: 24px; display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 12px;
  background: #fff; border-bottom: 1px solid var(--bord); color: #333;
}
.titre-app .logo-mini { width: 16px; height: 16px; }

/* ---------- Grille principale ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; height: calc(100vh - 24px - 22px); }
.app.sans-menu { grid-template-columns: 1fr; }

/* ---------- Menu de gauche ---------- */
.menu-gauche {
  background: #fff; border-right: 1px solid var(--bord); display: flex; flex-direction: column; overflow: hidden;
}
.societe {
  padding: 14px 8px; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .5px;
  border-bottom: 1px solid var(--bord); background: linear-gradient(#fff, #f2f4f7); text-transform: uppercase;
}
.accordeon { flex: 1; overflow-y: auto; }
.acc-titre {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #dde1e7;
  background: linear-gradient(#fbfbfc, #eceff3); padding: 6px 10px; font-size: 13px; color: #333; cursor: pointer;
}
.acc-titre.ouvert { background: var(--bleu); color: #fff; font-weight: 700; }
.acc-corps { display: none; padding: 2px 0 6px; background: #fff; }
.acc-titre.ouvert + .acc-corps { display: block; }
.acc-corps a, .menu-module a {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 14px; color: #222;
  border-bottom: 1px solid #f0f1f4; font-size: 13px;
}
.acc-corps a:hover, .menu-module a:hover { background: var(--bleu-clair); text-decoration: none; }
.acc-corps a.actif, .menu-module a.actif { background: #d6e4fb; font-weight: 600; }
.acc-corps a.inactif, .menu-module a.inactif { color: #a0a7b2; }
.ico { width: 20px; text-align: center; font-size: 15px; flex: none; }
.sous-titre { padding: 6px 10px 2px; font-size: 11px; color: var(--doux); background: #eef1f5; font-weight: 600; }
.pied-menu {
  border-top: 1px solid var(--bord); padding: 6px 10px; font-size: 12px; display: flex; align-items: center;
  gap: 6px; background: #f3f5f8;
}
.pied-menu .barre-reseau { margin-left: auto; color: var(--vert); letter-spacing: -2px; }

/* ---------- Zone principale ---------- */
.principal { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.entete {
  display: flex; align-items: flex-start; gap: 14px; padding: 6px 12px 4px; background: #fff;
  border-bottom: 1px solid #e1e4e9;
}
.entete .date-jour { font-size: 17px; font-weight: 600; letter-spacing: .3px; }
.entete .date-jour small { display: block; font-size: 11px; color: var(--doux); font-weight: 400; }
.modules { display: flex; gap: 8px; margin-top: 4px; }
.btn-module {
  display: flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--bord);
  background: linear-gradient(#fff, #eceff3); border-radius: 3px; color: #222; font-weight: 600; font-size: 12px;
}
.btn-module:hover { text-decoration: none; background: #e3ecfb; }
.entete .droite { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.horloge { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.btn-ico {
  width: 28px; height: 28px; border: 1px solid var(--bord); border-radius: 3px; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; position: relative; cursor: pointer;
}
.btn-ico:hover { background: #e3ecfb; text-decoration: none; }
.pastille {
  position: absolute; top: -6px; right: -6px; background: var(--rouge); color: #fff; border-radius: 9px;
  font-size: 10px; min-width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.barre-periode {
  display: flex; align-items: center; gap: 6px; padding: 5px 12px; background: #fff; flex-wrap: wrap;
}
.barre-periode input[type=date] { width: 132px; }
.btn-jaune { background: var(--jaune); border: 1px solid #c9b04a; }
.onglets { display: flex; gap: 2px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--bord); }
.onglets a {
  padding: 5px 12px; border: 1px solid transparent; border-bottom: 0; color: #333; border-radius: 3px 3px 0 0;
  font-size: 12px;
}
.onglets a.actif { background: var(--gris-fond); border-color: var(--bord); margin-bottom: -1px; }
.contenu { flex: 1; overflow: auto; padding: 10px 12px; position: relative; }

/* ---------- Barre d'état ---------- */
.barre-etat {
  height: 22px; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 11px;
  background: #e9ecf0; border-top: 1px solid var(--bord); color: #333; white-space: nowrap; overflow: hidden;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; min-height: 28px; cursor: pointer;
  border: 1px solid var(--bord); border-radius: 3px; background: linear-gradient(#fff, #e9ecf0); color: #222;
  font-weight: 600; white-space: nowrap;
}
.btn:hover { background: #e3ecfb; text-decoration: none; }
.btn.bleu { background: var(--bleu-2); border-color: var(--bleu); color: #fff; }
.btn.vert { background: #6fcf6f; border-color: #3fa53f; color: #083b08; }
.btn.rouge { background: #f3a8a1; border-color: #d46a60; color: #5a0c06; }
.btn.jaune { background: var(--jaune); border-color: #c9b04a; }
.btn.rose { background: #e9a8f0; border-color: #b65ec4; }
.btn.petit { padding: 2px 8px; min-height: 24px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn .touche { font-weight: 400; color: inherit; opacity: .75; font-size: 11px; }

/* ---------- Tableau de bord ---------- */
.accueil { display: grid; grid-template-columns: 1fr 260px; gap: 12px; height: 100%; }
.schema {
  position: relative; min-height: 460px; display: grid; grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr; align-items: center; justify-items: center; padding: 10px;
}
.schema svg.liens { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.tuile {
  z-index: 1; width: 170px; height: 96px; color: #fff; border-radius: 3px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 14px; letter-spacing: .5px;
  box-shadow: 0 2px 4px rgba(0,0,0,.18); text-transform: uppercase; transition: transform .1s;
}
.tuile:hover { transform: translateY(-2px); text-decoration: none; filter: brightness(1.05); }
.tuile .ti { font-size: 34px; line-height: 1; filter: grayscale(1) brightness(5); }
.tuile.articles { background: var(--t-articles); }
.tuile.caisse { background: var(--t-caisse); }
.tuile.achat { background: var(--t-achat); }
.tuile.treso { background: var(--t-treso); }
.tuile.stock { background: var(--t-stock); }
.tuile.depenses { background: var(--t-depenses); }
.logo-centre { z-index: 1; text-align: center; }
.logo-centre .nom { font-weight: 800; color: #0f5f73; font-size: 20px; letter-spacing: 1px; }
.logo-centre .sous { font-size: 9px; letter-spacing: 3px; color: #0f5f73; }
.notifications { background: #fff; border: 1px solid var(--bord); overflow-y: auto; max-height: 100%; }
.notifications h3 { margin: 0; padding: 6px 10px; font-size: 13px; background: #f0f2f5; border-bottom: 1px solid var(--bord); }
.notif { display: flex; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #eef0f3; font-size: 12px; color: #222; }
.notif:hover { background: var(--bleu-clair); text-decoration: none; }
.notif .ico { font-size: 18px; }
.notif b { display: block; }
.indicateurs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.indic { background: #fff; border: 1px solid var(--bord); padding: 8px 10px; }
.indic .lib { font-size: 11px; color: var(--doux); text-transform: uppercase; }
.indic .val { font-size: 17px; font-weight: 700; margin-top: 2px; }

/* ---------- Fenêtre de module ---------- */
.fenetre { background: #fff; border: 1px solid #aeb6c2; box-shadow: 0 3px 12px rgba(0,0,0,.12); display: flex; flex-direction: column; min-height: 100%; }
.fenetre-titre {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid var(--bord);
  background: #fff; font-size: 13px;
}
.fenetre-titre .fermer { margin-left: auto; font-size: 16px; color: #333; padding: 0 6px; }
.fenetre-titre .fermer:hover { background: #e81123; color: #fff; text-decoration: none; }
.fenetre-corps { display: grid; grid-template-columns: 210px 1fr; flex: 1; min-height: 0; }
.fenetre-corps.plein { grid-template-columns: 1fr; }
.menu-module { border-right: 1px solid var(--bord); background: var(--gris-panneau); overflow-y: auto; }
.menu-module .sous-titre:first-child { margin-top: 0; }
.menu-module .compteur { margin-left: auto; background: #e8542c; color: #fff; border-radius: 3px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.zone { padding: 8px 10px; min-width: 0; overflow: auto; }
.onglets-int { display: flex; gap: 2px; border-bottom: 1px solid var(--bord); margin-bottom: 8px; }
.onglets-int a, .onglets-int span {
  padding: 4px 12px; border: 1px solid var(--bord); border-bottom: 0; background: #f0f2f5; font-size: 12px; color: #333;
}
.onglets-int .actif { background: #fff; margin-bottom: -1px; font-weight: 600; }

/* ---------- Ruban (barre d'outils des documents) ---------- */
.ruban { display: flex; flex-wrap: wrap; background: #fff; border: 1px solid var(--bord); margin-bottom: 6px; }
.groupe { padding: 4px 8px 2px; border-right: 1px solid #e1e4e9; display: flex; flex-direction: column; }
.groupe .elems { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); gap: 1px 10px; flex: 1; }
.groupe .elems a { display: flex; align-items: center; gap: 5px; padding: 2px 4px; font-size: 12px; color: #222; white-space: nowrap; }
.groupe .elems a:hover { background: var(--bleu-clair); text-decoration: none; }
.groupe .nom-groupe { font-size: 10.5px; color: var(--doux); text-align: center; margin-top: 2px; }
.ruban .horloge-ruban { margin-left: auto; padding: 4px 12px; text-align: left; }
.ruban .horloge-ruban .h { font-size: 24px; font-weight: 700; color: var(--bleu); font-variant-numeric: tabular-nums; }
.ruban .horloge-ruban .d { font-size: 10px; color: var(--bleu); font-weight: 600; }

/* ---------- Filtres ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: flex-end; margin-bottom: 6px; }
.filtres > div { display: flex; flex-direction: column; }
.filtres input, .filtres select { min-width: 110px; }
.filtres .large input { min-width: 240px; }

/* ---------- Grilles de données ---------- */
.grille-wrap { border: 1px solid var(--bord); background: #fff; overflow: auto; max-height: calc(100vh - 300px); }
.grille-wrap.haute { max-height: calc(100vh - 230px); }
table.grille { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.grille th {
  position: sticky; top: 0; z-index: 2; background: linear-gradient(#fafbfc, #e6e9ee); color: #333; font-weight: 600;
  text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--bord); border-right: 1px solid #dde1e7;
  white-space: nowrap; font-size: 11.5px; text-transform: uppercase;
}
table.grille.bleue th { background: var(--bleu); color: #fff; border-right-color: #2f62b7; }
table.grille td { padding: 3px 6px; border-bottom: 1px solid #e8ebef; border-right: 1px solid #f0f1f4; white-space: nowrap; }
table.grille tbody tr:nth-child(even) td { background: #f5f8fc; }
table.grille tbody tr:hover td { background: #dfeafc; }
table.grille tbody tr.sel td { background: #3d4b5e !important; color: #fff; }
table.grille tbody tr.sel td a { color: #fff; }
table.grille tbody tr.neg td { background: var(--vert-ligne) !important; }
table.grille tbody tr.zero td { background: var(--rouge-ligne) !important; }
table.grille tbody tr.inactif td { color: #8d96a3; background: #e5e7ea !important; }
table.grille tbody tr.promo td:first-child { box-shadow: inset 4px 0 0 #63c132; }
table.grille tbody tr.gratuit td:first-child { box-shadow: inset 4px 0 0 #b03bc9; }
table.grille tbody tr.annule td { color: #999; text-decoration: line-through; }
table.grille td.credit-client { background: var(--rouge-ligne) !important; font-weight: 600; }
table.grille td.ttc-rouge { background: #f39a90 !important; }
table.grille tfoot td {
  position: sticky; bottom: 0; background: #e9edf2; font-weight: 700; border-top: 2px solid var(--bord); padding: 4px 6px;
}
table.grille tr[data-href] { cursor: pointer; }
.legende { display: flex; gap: 14px; font-size: 11.5px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.legende span::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; border: 1px solid #999; }
.legende .l-inactif::before { background: #8d96a3; }
.legende .l-gratuit::before { background: #b03bc9; }
.legende .l-promo::before { background: #63c132; }
.legende .l-zero::before { background: var(--rouge-ligne); }
.legende .l-neg::before { background: var(--vert-ligne); }
.legende .l-credit::before { background: var(--rouge-ligne); }

/* ---------- Bas d'écran des documents ---------- */
.bas-doc { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; margin-top: 6px; align-items: start; }
.cadre { border: 1px solid var(--bord); background: #fff; padding: 6px 8px; position: relative; }
.cadre > .legende-cadre { position: absolute; top: -8px; left: 8px; background: #fff; padding: 0 4px; font-size: 11px; color: var(--doux); }
.totaux-mini { display: grid; grid-template-columns: auto auto auto auto; gap: 2px 8px; font-size: 11.5px; align-items: center; }
.totaux-mini .v { background: #eef1f5; border: 1px solid #d9dde3; padding: 1px 8px; text-align: right; min-width: 110px; font-weight: 600; }
.actions-bas { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.radios { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.radios label { display: inline-flex; gap: 3px; align-items: center; color: #222; margin: 0; font-size: 12px; }

/* ---------- Formulaires ---------- */
.form-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.form-grille .x2 { grid-column: span 2; }
.form-grille input, .form-grille select, .form-grille textarea { width: 100%; }
.case { display: flex; align-items: center; gap: 6px; color: #222; font-size: 13px; }
.case input { min-height: 0; }
fieldset { border: 1px solid var(--bord); padding: 8px 10px 10px; margin: 0 0 10px; background: #fff; }
legend { font-size: 12px; color: var(--bleu); font-weight: 700; padding: 0 4px; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Éditeur de document ---------- */
.doc-entete { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px 12px; margin-bottom: 8px; }
.doc-entete input, .doc-entete select { width: 100%; }
.recherche-art { position: relative; }
.suggestions {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--bleu-2);
  max-height: 300px; overflow-y: auto; box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.suggestions div { padding: 5px 8px; cursor: pointer; display: flex; gap: 10px; border-bottom: 1px solid #eef0f3; }
.suggestions div.actif, .suggestions div:hover { background: var(--bleu-clair); }
.suggestions .s-ref { color: var(--doux); width: 110px; flex: none; font-size: 12px; }
.suggestions .s-des { flex: 1; }
.suggestions .s-px { font-weight: 600; }
.suggestions .s-st { width: 70px; text-align: right; font-size: 12px; }
table.lignes input { width: 100%; min-height: 24px; padding: 2px 4px; border-color: transparent; background: transparent; }
table.lignes input:focus { background: #fff; border-color: var(--bleu-2); }
table.lignes td { padding: 1px 3px; }
.totaux-doc { display: grid; grid-template-columns: auto auto; gap: 3px 16px; justify-content: end; margin-top: 8px; font-size: 13px; }
.totaux-doc .num { min-width: 130px; }
.totaux-doc .net { font-size: 17px; font-weight: 800; color: var(--bleu); }

/* ---------- Caisse comptoir ---------- */
.pos { display: grid; grid-template-columns: 1fr 340px; gap: 10px; height: calc(100vh - 190px); }
.pos .gauche { display: flex; flex-direction: column; min-height: 0; }
.pos .scan input { font-size: 18px; padding: 8px 10px; width: 100%; }
.pos .panier { flex: 1; overflow: auto; border: 1px solid var(--bord); background: #fff; margin-top: 8px; }
.pos .droite { display: flex; flex-direction: column; gap: 8px; }
.afficheur { background: #10261a; color: #63ff8f; font-family: "DejaVu Sans Mono", monospace; padding: 10px 14px; border-radius: 3px; text-align: right; }
.afficheur .total { font-size: 34px; font-weight: 700; }
.afficheur .lib { font-size: 12px; color: #a6e8b8; text-align: left; }
.pave-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pave-modes label { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--bord); background: #fff; color: #222; font-size: 13px; cursor: pointer; border-radius: 3px; margin: 0; }
.pave-modes input:checked + span { font-weight: 700; color: var(--bleu); }
.grand-btn { font-size: 18px; padding: 12px; justify-content: center; width: 100%; }

/* ---------- Messages ---------- */
.flash { padding: 8px 12px; margin-bottom: 8px; border: 1px solid; border-radius: 3px; background: #fff; }
.flash.ok { border-color: #8fd19e; background: #eaf7ed; color: #155724; }
.flash.erreur { border-color: #f1a7a0; background: #fdecea; color: #8a1c12; }
.flash.info { border-color: #9cc0ff; background: #eaf2ff; color: #123d82; }
.vide { padding: 30px; text-align: center; color: var(--doux); }
.badge { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 11px; font-weight: 600; background: #e3e7ee; color: #333; }
.badge.vert { background: #d4f3dc; color: #126b2c; }
.badge.rouge { background: #fbd9d5; color: #8a1c12; }
.badge.orange { background: #ffe4c2; color: #8a4a00; }
.badge.bleu { background: #dbe7fd; color: #123d82; }

/* ---------- Connexion ---------- */
.ecran-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 30%, #f4f7fb, #dfe5ee);
}
.boite-login { width: 400px; max-width: 94vw; background: #fff; border: 1px solid #aeb6c2; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.boite-login .bt { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--bord); font-size: 13px; }
.boite-login .bt .ok { color: #1e8e3e; font-weight: 900; }
.boite-login .sous-bt { display: flex; justify-content: space-between; padding: 6px 10px; font-weight: 600; font-size: 12px; border-bottom: 1px solid #eee; }
.boite-login .corps { padding: 10px 18px 16px; }
.boite-login .champ { margin-bottom: 10px; }
.boite-login input { width: 100%; font-size: 17px; padding: 8px 10px; }
.boite-login .mdp { position: relative; }
.boite-login .oeil { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 16px; cursor: pointer; }
.boite-login .bas { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.support { background: var(--t-caisse); color: #fff; font-weight: 800; padding: 6px 12px; font-size: 18px; line-height: 1.2; border-radius: 2px; }
.support small { display: block; font-size: 10px; font-weight: 600; }
.valider-rond { width: 54px; height: 54px; border-radius: 50%; background: #0f3466; color: #fff; border: 0; font-size: 24px; cursor: pointer; }
.valider-rond:hover { background: var(--bleu-2); }
.logo-login { text-align: center; padding: 8px 0 4px; }

/* ---------- Impression écran ---------- */
@media print {
  .titre-app, .menu-gauche, .entete, .barre-periode, .onglets, .barre-etat, .menu-module, .fenetre-titre,
  .filtres, .ruban, .actions, .bas-doc, .no-print { display: none !important; }
  .app { display: block; height: auto; }
  .contenu, .zone { overflow: visible; padding: 0; }
  .fenetre { border: 0; box-shadow: none; }
  .fenetre-corps { display: block; }
  .grille-wrap { max-height: none; overflow: visible; border: 0; }
  table.grille th { position: static; }
}

/* ---------- Téléphone / tablette ---------- */
.btn-menu-mobile { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 46px); }
  .menu-gauche { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 18px rgba(0,0,0,.25); }
  body.menu-ouvert .menu-gauche { transform: none; }
  body.menu-ouvert::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; }
  .btn-menu-mobile { display: inline-flex; }
  .principal { overflow: visible; }
  .contenu { overflow: visible; padding: 8px; }
  .entete { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .entete .date-jour { font-size: 14px; }
  .modules { display: none; }
  .horloge { font-size: 16px; }
  .accueil { grid-template-columns: 1fr; }
  .schema { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: none; gap: 10px; min-height: 0; }
  .schema svg.liens, .schema .logo-centre, .schema .vide-cell { display: none; }
  .tuile { width: 100%; height: 92px; }
  .indicateurs { grid-template-columns: 1fr 1fr; }
  .fenetre-corps { grid-template-columns: 1fr; }
  .menu-module { border-right: 0; border-bottom: 1px solid var(--bord); max-height: none; display: flex; overflow-x: auto; }
  .menu-module .sous-titre { display: none; }
  .menu-module a { white-space: nowrap; border-bottom: 0; border-right: 1px solid #e3e6ea; padding: 8px 10px; }
  .grille-wrap, .grille-wrap.haute { max-height: none; }
  .doc-entete { grid-template-columns: 1fr 1fr; }
  .doc-entete > :first-child { grid-column: span 2; }
  .bas-doc { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; height: auto; }
  .pos .panier { min-height: 220px; }
  .ruban .groupe .elems { grid-template-rows: none; grid-auto-flow: row; }
  .barre-etat { font-size: 10px; justify-content: flex-start; padding: 0 6px; }
  .form-grille .x2 { grid-column: span 1; }
  input, select { font-size: 16px; } /* évite le zoom automatique sur téléphone */
}
.filtres input[type=checkbox], .filtres input[type=radio], .case input { min-width: 0 !important; width: auto; min-height: 0; }
.ico, .tuile .ti, .btn-ico, .notif .ico { font-family: "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji", sans-serif; }
.col-tuiles { display: flex; flex-direction: column; gap: 8px; z-index: 1; }
@media (max-width: 900px) {
  .col-tuiles { display: contents; }
  .schema { padding: 0; }
}

/* ---------- Bouton de validation (tout le système) ---------- */
.actions { justify-content: center; }
.btn-valider {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 220px; padding: 10px 26px 10px 10px; min-height: 46px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #12a150 0%, #0f9b8e 55%, #1559c7 100%); color: #fff;
  font-size: 15px; font-weight: 800; letter-spacing: .3px; cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 16px rgba(15, 155, 142, .35), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn-valider .coche {
  width: 30px; height: 30px; flex: none; border-radius: 50%; background: #fff; color: #0f9b8e;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.btn-valider:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15, 155, 142, .45); filter: brightness(1.05); text-decoration: none; }
.btn-valider:active { transform: translateY(0); box-shadow: 0 3px 8px rgba(15, 155, 142, .35); }
.btn-valider[disabled] { opacity: .55; cursor: default; transform: none; }
.btn-valider.grand { min-width: 260px; min-height: 54px; font-size: 17px; }
.zone-valider { display: flex; justify-content: center; margin: 14px 0 4px; }
/* Connexion : grand bouton rond au centre */
.valider-centre { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 14px 0 6px; }
.valider-rond {
  width: 74px; height: 74px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; font-size: 34px; font-weight: 900;
  background: linear-gradient(135deg, #12a150 0%, #0f9b8e 55%, #1559c7 100%);
  box-shadow: 0 8px 22px rgba(15, 155, 142, .45), 0 0 0 6px rgba(15, 155, 142, .12);
  transition: transform .12s ease, box-shadow .12s ease;
}
.valider-rond:hover { transform: scale(1.06); box-shadow: 0 12px 26px rgba(15, 155, 142, .55), 0 0 0 8px rgba(15, 155, 142, .15); background: linear-gradient(135deg, #12a150 0%, #0f9b8e 55%, #1559c7 100%); }
.valider-centre small { color: var(--doux); font-weight: 600; letter-spacing: .5px; text-transform: uppercase; font-size: 11px; }

/* ---------- Menu clic droit sur les tableaux ---------- */
.menu-contextuel { position: fixed; z-index: 200; background: #fff; border: 1px solid var(--bord); border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.2); padding: 4px; min-width: 230px; font-size: 13px; }
.menu-contextuel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; color: #1d2430; }
.menu-contextuel button:hover { background: var(--bleu-clair); }
.menu-contextuel hr { border: 0; border-top: 1px solid #eef0f3; margin: 3px 0; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: #1d2430; color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 210; font-weight: 600; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.sans-prix-impr .col-prix { display: none !important; }
.erreurs-prix { border: 1px solid #f1a7a0; background: #fdecea; color: #8a1c12; padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.erreurs-prix li { margin: 2px 0; }
input.invalide { border-color: var(--rouge) !important; background: #fff5f4 !important; }
table.grille th[title="Cliquer pour trier"]:hover { filter: brightness(.93); }
table.grille th .fleche-tri { color: #f7e27a; font-size: 10px; }
table.grille:not(.bleue) th .fleche-tri { color: var(--bleu-2); }

/* ---------- Chemin de navigation (fil d'Ariane) ---------- */
.fil { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; margin: -2px 0 8px; font-size: 13px; min-height: 26px; }
.fil:empty { display: none; }
.fil a, .fil span.courant { padding: 3px 9px; border-radius: 999px; white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.fil a { color: var(--bleu-2); background: #fff; border: 1px solid #d6e0ef; }
.fil a:hover { background: var(--bleu-clair); text-decoration: none; }
.fil span.courant { background: var(--bleu); color: #fff; font-weight: 700; }
.fil .sep { color: #9aa6b8; font-weight: 700; }
.fil .retour { margin-right: 6px; background: var(--jaune); border-color: #c9b04a; color: #333; font-weight: 700; }
@media print { .fil { display: none !important; } }
@media (max-width: 900px) { .fil a, .fil span.courant { max-width: 200px; } }

/* =====================================================================================
   THÈME 2 — design moderne et coloré (même organisation des écrans)
   ===================================================================================== */
:root {
  --nuit: #0c1a3d; --nuit-2: #13306b; --bleu: #1446a8; --bleu-2: #1f6ae0; --cyan: #12b5cb; --vert-vif: #16a34a;
  --orange-vif: #f97316; --violet: #7c3aed; --rose: #db2777; --fond-2: #edf2fa; --carte: #ffffff;
  --ombre: 0 2px 6px rgba(15, 35, 80, .08), 0 8px 24px rgba(15, 35, 80, .06);
  --degrade: linear-gradient(135deg, #1446a8 0%, #1f6ae0 55%, #12b5cb 100%);
}
body { background: var(--fond-2); color: #16213a; }

/* Barre de titre */
.titre-app { background: linear-gradient(90deg, var(--nuit), var(--nuit-2)); color: #dbe6ff; border-bottom: 0; height: 26px; letter-spacing: .3px; }
.titre-app .logo-mini { filter: brightness(1.6); }

/* Menu de gauche bleu nuit */
.menu-gauche { background: linear-gradient(180deg, var(--nuit) 0%, #10275a 100%); border-right: 0; box-shadow: 2px 0 14px rgba(12, 26, 61, .25); }
.societe { background: transparent; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); padding: 16px 10px; font-size: 13px; }
.societe::before { content: ""; display: block; width: 34px; height: 4px; border-radius: 4px; margin: 0 auto 8px; background: var(--degrade); }
.acc-titre { background: transparent; color: #b9c7e6; border-bottom: 1px solid rgba(255,255,255,.06); padding: 9px 14px; font-weight: 600; letter-spacing: .2px; transition: background .15s; }
.acc-titre:hover { background: rgba(255,255,255,.06); color: #fff; }
.acc-titre.ouvert { background: var(--degrade); color: #fff; box-shadow: inset 4px 0 0 #7ff0ff; }
.acc-corps { background: rgba(0,0,0,.18); padding: 4px 0 8px; }
.acc-corps a { color: #dbe4f7; border-bottom: 0; padding: 7px 12px 7px 18px; border-radius: 0 999px 999px 0; margin-right: 10px; }
.acc-corps a:hover { background: rgba(255,255,255,.09); color: #fff; }
.acc-corps a.actif { background: rgba(31, 106, 224, .45); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 #7ff0ff; }
.acc-corps a.inactif { color: #6f80a6; }
.menu-gauche .sous-titre { background: transparent; color: #7ff0ff; text-transform: uppercase; font-size: 10.5px; letter-spacing: 1px; padding: 10px 16px 3px; }
.pied-menu { background: rgba(0,0,0,.25); border-top: 1px solid rgba(255,255,255,.06); color: #dbe4f7; }
.pied-menu a { color: #fff; }

/* En-tête */
.entete { background: var(--carte); border-bottom: 0; box-shadow: 0 2px 10px rgba(15, 35, 80, .06); position: relative; z-index: 2; padding: 8px 14px 6px; }
.entete .date-jour { color: var(--nuit); }
.entete .date-jour small { color: var(--bleu-2); font-weight: 600; }
.horloge { background: var(--degrade); color: #fff; padding: 3px 14px; border-radius: 999px; font-size: 18px; box-shadow: 0 4px 12px rgba(31, 106, 224, .3); }
.btn-module { border: 0; border-radius: 10px; background: linear-gradient(135deg, #eef4ff, #e3fbff); color: var(--nuit); box-shadow: 0 1px 3px rgba(15, 35, 80, .12); }
.btn-module:hover { background: var(--degrade); color: #fff; }
.btn-ico { border: 0; border-radius: 10px; background: #f0f4fb; box-shadow: 0 1px 3px rgba(15, 35, 80, .12); }
.btn-ico:hover { background: #dfe9fb; }
.barre-periode { background: var(--carte); padding: 6px 14px; }
.barre-periode input, .barre-periode select { border-radius: 8px; border-color: #cfd9ea; }
.onglets { background: var(--carte); border-bottom: 1px solid #dfe6f2; padding: 0 14px 6px; gap: 6px; }
.onglets a { border: 0; border-radius: 999px; padding: 5px 16px; color: #3a4a6b; background: #f0f4fb; font-weight: 600; }
.onglets a:hover { background: #e1eafb; text-decoration: none; }
.onglets a.actif { background: var(--degrade); color: #fff; margin-bottom: 0; box-shadow: 0 3px 10px rgba(31, 106, 224, .3); }
.contenu { padding: 12px 16px; }

/* Champs */
input, select, textarea { border-radius: 8px; border-color: #cfd9ea; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(31, 106, 224, .18); border-color: var(--bleu-2); }

/* Boutons */
.btn { border-radius: 9px; border: 1px solid #d3ddee; background: #fff; box-shadow: 0 1px 2px rgba(15, 35, 80, .08); color: #1b2a4a; transition: transform .08s, box-shadow .12s, background .12s; }
.btn:hover { background: #f2f6ff; box-shadow: 0 3px 10px rgba(15, 35, 80, .12); }
.btn:active { transform: translateY(1px); }
.btn.bleu { background: var(--degrade); border: 0; color: #fff; }
.btn.vert { background: linear-gradient(135deg, #16a34a, #22c55e); border: 0; color: #fff; }
.btn.rouge { background: linear-gradient(135deg, #dc2626, #f43f5e); border: 0; color: #fff; }
.btn.jaune { background: linear-gradient(135deg, #f59e0b, #fbbf24); border: 0; color: #3b2600; }
.btn.rose { background: linear-gradient(135deg, #c026d3, #db2777); border: 0; color: #fff; }
.btn-jaune { background: linear-gradient(135deg, #f59e0b, #fbbf24); border: 0; }

/* Fenêtres des modules */
.fenetre { border: 0; border-radius: 14px; overflow: hidden; box-shadow: var(--ombre); background: var(--carte); }
.fenetre-titre { background: linear-gradient(90deg, var(--nuit-2), var(--bleu) 60%, var(--bleu-2)); color: #fff; border-bottom: 0; padding: 9px 14px; font-size: 14px; }
.fenetre-titre b { font-weight: 700; letter-spacing: .2px; }
.fenetre-titre .fermer { color: #fff; border-radius: 8px; }
.fenetre-titre .doux { color: #cfe0ff; }
.fenetre-titre .badge { background: rgba(255,255,255,.2); color: #fff; }
.menu-module { background: #f4f7fc; border-right: 1px solid #e3e9f4; padding: 4px 0; }
.menu-module .sous-titre { background: transparent; color: var(--bleu-2); text-transform: uppercase; font-size: 10.5px; letter-spacing: .8px; padding: 10px 14px 3px; }
.menu-module a { border-bottom: 0; border-radius: 0 999px 999px 0; margin-right: 8px; padding: 7px 10px 7px 14px; color: #22324f; }
.menu-module a:hover { background: #e4ecfb; }
.menu-module a.actif { background: var(--degrade); color: #fff; font-weight: 700; }
.menu-module .compteur { background: linear-gradient(135deg, #f97316, #ef4444); border-radius: 999px; }
.onglets-int { border-bottom: 2px solid #e3e9f4; gap: 4px; }
.onglets-int a, .onglets-int span { border: 0; background: #eef3fb; border-radius: 10px 10px 0 0; padding: 6px 14px; color: #3a4a6b; }
.onglets-int .actif { background: var(--degrade); color: #fff; }

/* Tableaux */
.grille-wrap { border: 0; border-radius: 12px; box-shadow: var(--ombre); background: #fff; }
table.grille th, table.grille.bleue th { background: linear-gradient(180deg, #1b4fb8, #1446a8); color: #fff; border-right: 1px solid rgba(255,255,255,.12); border-bottom: 0; font-weight: 700; padding: 8px 8px; letter-spacing: .3px; }
table.grille td { border-bottom: 1px solid #edf1f8; border-right: 0; padding: 6px 8px; }
table.grille tbody tr:nth-child(even) td { background: #f6f9fe; }
table.grille tbody tr:hover td { background: #e2ecff; }
table.grille tbody tr.sel td { background: linear-gradient(90deg, #1446a8, #1f6ae0) !important; color: #fff; }
table.grille tfoot td { background: #e7efff; color: var(--nuit); border-top: 2px solid #b9cdf3; font-size: 13px; }
table.grille tbody tr.neg td { background: #d9fbe3 !important; }
table.grille tbody tr.zero td { background: #ffe1dd !important; }
table.grille td.credit-client { background: #ffe1dd !important; color: #b42318; }
table.grille td.ttc-rouge { background: #ffd5cf !important; color: #b42318; font-weight: 700; }
table.grille th .fleche-tri { color: #fde68a; }

/* Ruban et cadres */
.ruban { border: 0; border-radius: 12px; box-shadow: var(--ombre); overflow: hidden; }
.groupe { border-right: 1px solid #eef2f8; }
.groupe .nom-groupe { color: var(--bleu-2); font-weight: 700; text-transform: uppercase; font-size: 9.5px; letter-spacing: .6px; }
.groupe .elems a:hover { background: #e7efff; border-radius: 6px; }
.ruban .horloge-ruban { background: var(--degrade); color: #fff; }
.ruban .horloge-ruban .h, .ruban .horloge-ruban .d { color: #fff; }
.cadre, fieldset { border: 1px solid #dfe7f4; border-radius: 12px; background: #fff; box-shadow: 0 1px 3px rgba(15, 35, 80, .05); }
legend, .cadre > .legende-cadre { color: var(--bleu); font-weight: 800; }
.totaux-mini .v { background: #eef3fb; border-color: #dbe5f5; border-radius: 6px; }

/* Tableau de bord */
.indic { border: 0; border-radius: 14px; background: #fff; box-shadow: var(--ombre); position: relative; overflow: hidden; padding: 12px 14px 12px 18px; }
.indic::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--degrade); }
.indicateurs .indic:nth-child(1)::before { background: linear-gradient(180deg, #1f6ae0, #12b5cb); }
.indicateurs .indic:nth-child(2)::before { background: linear-gradient(180deg, #16a34a, #4ade80); }
.indicateurs .indic:nth-child(3)::before { background: linear-gradient(180deg, #dc2626, #fb7185); }
.indicateurs .indic:nth-child(4)::before { background: linear-gradient(180deg, #f97316, #fbbf24); }
.indic .lib { color: #64748b; font-weight: 700; letter-spacing: .4px; }
.indic .val { font-size: 22px; color: var(--nuit); }
.indicateurs .indic:nth-child(1) .val { color: #1446a8; } .indicateurs .indic:nth-child(2) .val { color: #15803d; }
.tuile { border-radius: 16px; box-shadow: 0 10px 24px rgba(15, 35, 80, .18); }
.tuile:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 14px 30px rgba(15, 35, 80, .25); }
.tuile.articles { background: linear-gradient(135deg, #65a30d, #22c55e); }
.tuile.caisse { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.tuile.achat { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.tuile.treso { background: linear-gradient(135deg, #ea580c, #fb923c); }
.tuile.stock { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.tuile.depenses { background: linear-gradient(135deg, #be185d, #ec4899); }
.schema svg.liens line { stroke: #c4d2ea; stroke-width: 2; stroke-dasharray: 4 4; }
.logo-centre .nom { background: var(--degrade); -webkit-background-clip: text; background-clip: text; color: transparent; }
.notifications { border: 0; border-radius: 14px; box-shadow: var(--ombre); overflow: hidden; }
.notifications h3 { background: var(--degrade); color: #fff; border-bottom: 0; padding: 10px 14px; font-size: 14px; }
.notif { border-bottom: 1px solid #eef2f8; padding: 10px 14px; }
.notif:hover { background: #eef4ff; }

/* Messages, badges, barre d'état */
.flash { border-radius: 10px; border-width: 0 0 0 5px; box-shadow: 0 1px 4px rgba(15, 35, 80, .08); }
.flash.ok { border-color: #16a34a; background: #ecfdf3; } .flash.erreur { border-color: #dc2626; background: #fef2f2; } .flash.info { border-color: #1f6ae0; background: #eff6ff; }
.badge { border-radius: 999px; padding: 1px 9px; }
.badge.vert { background: #dcfce7; color: #166534; } .badge.rouge { background: #fee2e2; color: #b91c1c; } .badge.orange { background: #ffedd5; color: #9a3412; } .badge.bleu { background: #dbeafe; color: #1e40af; }
.barre-etat { background: linear-gradient(90deg, var(--nuit), var(--nuit-2)); color: #aebfe2; border-top: 0; }
.fil a { border-color: #d4def0; box-shadow: 0 1px 2px rgba(15, 35, 80, .06); }
.fil span.courant { background: var(--degrade); }
.fil .retour { background: linear-gradient(135deg, #f59e0b, #fbbf24); border: 0; }

/* Écran de connexion */
.ecran-login { background: radial-gradient(circle at 20% 20%, #1f6ae0 0%, transparent 45%), radial-gradient(circle at 85% 80%, #12b5cb 0%, transparent 45%), linear-gradient(135deg, #0c1a3d, #13306b); }
.boite-login { border: 0; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.boite-login .bt { background: var(--degrade); color: #fff; border-bottom: 0; padding: 10px 14px; }
.boite-login .bt .ok { color: #fff; }
.boite-login .sous-bt { color: var(--bleu); }

/* Mobile : menu en tiroir */
@media (max-width: 900px) {
  .acc-corps a { margin-right: 6px; }
  .horloge { font-size: 15px; padding: 2px 10px; }
  .onglets { overflow-x: auto; }
}
.pastille { font-family: "Segoe UI", "Noto Sans", Arial, sans-serif !important; font-weight: 800; box-shadow: 0 0 0 2px #fff; }
.indicateurs .indic:nth-child(3) .val { color: #dc2626; }
.indicateurs .indic:nth-child(4) .val { color: #c2410c; }

/* ---------- Fenêtre de confirmation moderne (centre de l'écran) ---------- */
.qm-fond { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(12, 26, 61, .55); backdrop-filter: blur(3px); animation: qm-entre .14s ease; }
.qm-fond.qm-sort { animation: qm-sort .14s ease forwards; }
.qm { width: 440px; max-width: 100%; background: #fff; border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; text-align: center;
  padding: 26px 26px 20px; position: relative; animation: qm-pop .18s cubic-bezier(.2,.9,.3,1.3); }
.qm::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, #1446a8, #1f6ae0, #12b5cb); }
.qm.danger::before { background: linear-gradient(90deg, #dc2626, #f97316); }
.qm-ic { width: 64px; height: 64px; margin: 2px auto 10px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: linear-gradient(135deg, #e0ecff, #d9f7fb); box-shadow: 0 6px 16px rgba(31, 106, 224, .18); }
.qm.danger .qm-ic { background: linear-gradient(135deg, #fee2e2, #ffedd5); box-shadow: 0 6px 16px rgba(220, 38, 38, .18); }
.qm h3 { margin: 0 0 8px; font-size: 19px; color: #0c1a3d; }
.qm-msg { color: #334155; font-size: 14.5px; line-height: 1.5; max-height: 50vh; overflow-y: auto; }
.qm-msg p { margin: 0 0 4px; }
.qm-puce { text-align: left; margin: 2px 0 2px 20px; font-weight: 600; }
.qm-btns { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.qm-btns button { flex: 1; max-width: 190px; border: 0; border-radius: 12px; padding: 12px 14px; font-size: 15px; font-weight: 800; cursor: pointer;
  transition: transform .08s, box-shadow .12s, filter .12s; font-family: inherit; }
.qm-btns button:active { transform: translateY(1px); }
.qm-non { background: #eef2f8; color: #1d2a44; }
.qm-non:hover { background: #e2e8f3; }
.qm-oui { color: #fff; background: linear-gradient(135deg, #12a150, #0f9b8e 55%, #1559c7); box-shadow: 0 6px 16px rgba(15, 155, 142, .35); }
.qm-oui:hover { filter: brightness(1.06); }
.qm.danger .qm-oui { background: linear-gradient(135deg, #dc2626, #f97316); box-shadow: 0 6px 16px rgba(220, 38, 38, .35); }
.qm-oui:focus-visible, .qm-non:focus-visible { outline: 3px solid rgba(31, 106, 224, .35); outline-offset: 2px; }
@keyframes qm-entre { from { opacity: 0; } } @keyframes qm-sort { to { opacity: 0; } }
@keyframes qm-pop { from { transform: scale(.9) translateY(10px); opacity: 0; } }

/* ---------- Fenêtre « Historique de vente / d'achat » ---------- */
.qm.hist { width: 1000px; max-width: 98vw; padding: 0; text-align: left; display: flex; flex-direction: column; max-height: 92vh; }
.qm.hist::before { display: none; }
.hist-tete { display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: #fff; background: linear-gradient(90deg, #1446a8, #1f6ae0 60%, #12b5cb); }
.hist-tete.achat { background: linear-gradient(90deg, #6d28d9, #a855f7 60%, #db2777); }
.hist-titre { font-size: 18px; font-weight: 800; } .hist-art { font-size: 13px; opacity: .92; margin-top: 2px; }
.hist-fermer { margin-left: auto; border: 0; background: rgba(255,255,255,.2); color: #fff; width: 34px; height: 34px; border-radius: 10px; font-size: 16px; cursor: pointer; }
.hist-fermer:hover { background: rgba(255,255,255,.35); }
.hist-filtres { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px 18px 6px; }
.hist-filtres input { width: 100%; }
.hist-raccourcis { display: flex; gap: 4px; } .hist-raccourcis button { border: 1px solid #d3ddee; background: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: 12px; }
.hist-raccourcis button:hover { background: #e7efff; }
.hist-resume { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 6px 18px 10px; }
.hist-resume span { background: #f1f5fd; border-radius: 10px; padding: 6px 10px; } .hist-resume small { display: block; color: #64748b; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.hist-resume b { font-size: 16px; color: #0c1a3d; font-variant-numeric: tabular-nums; }
.hist-table { overflow: auto; padding: 0 18px 16px; flex: 1; min-height: 160px; }
@media (max-width: 700px) { .hist-resume { grid-template-columns: repeat(3, 1fr); } }
td.orange, span.orange { color: #c2410c; }
/* Fenêtre de choix de clôture */
.qm.cl-choix { width: 620px; }
.cl-liste { display: grid; gap: 10px; text-align: left; max-height: 60vh; overflow-y: auto; padding: 2px; }
.cl-carte { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 2px solid #e2e8f3; text-decoration: none; color: #0c1a3d; background: #fff; transition: .12s; }
.cl-carte:hover { border-color: #1f6ae0; background: #f3f7ff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(31,106,224,.15); }
.cl-carte.gestion { border-color: #c7d7f5; background: linear-gradient(135deg, #f3f7ff, #fff); }
.cl-ic { font-size: 30px; width: 46px; text-align: center; }
.cl-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; } .cl-txt b { font-size: 16.5px; } .cl-txt small { color: #64748b; font-size: 12.5px; }
.cl-mt { text-align: right; display: flex; flex-direction: column; white-space: nowrap; } .cl-mt b { font-size: 20px; color: #15803d; } .cl-mt small { color: #64748b; font-size: 11.5px; }
body { padding-top: env(safe-area-inset-top); }
/* Cases à cocher des listes + barre de sélection */
th.col-coche, td.col-coche { width: 30px; text-align: center; padding-left: 4px !important; padding-right: 4px !important; }
.col-coche input { width: 16px; height: 16px; cursor: pointer; margin: 0; vertical-align: middle; }
tr:has(.coche-doc:checked) td { background: #e0edff !important; }
.barre-selection { position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 140%); z-index: 250; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 14px; background: #0c1a3d; color: #fff; box-shadow: 0 14px 40px rgba(0,0,0,.35); transition: transform .18s ease; max-width: calc(100vw - 24px); }
.barre-selection.visible { transform: translate(-50%, 0); }
.barre-selection .bs-tot b { font-size: 15px; } .barre-selection .rouge { color: #fca5a5; }
.barre-selection .btn { margin: 0; } .barre-selection .btn:disabled { opacity: .45; cursor: not-allowed; }

/* Ctrl+B : bulle du bénéfice (petite, en bas à gauche) */
.benef-bulle { position: fixed; left: 250px; bottom: 34px; z-index: 400; min-width: 200px; max-width: 320px; text-align: left; padding: 8px 12px;
  border-radius: 10px; background: linear-gradient(135deg, #0f7a3a, #12a150); color: #fff; box-shadow: 0 8px 22px rgba(0,0,0,.28);
  display: flex; flex-direction: column; gap: 1px; animation: benef-in .18s ease; transition: opacity .4s ease; pointer-events: none; }
.benef-bulle.perte { background: linear-gradient(135deg, #b42318, #e04f3c); }
.benef-bulle small { font-size: 10.5px; opacity: .9; letter-spacing: .4px; text-transform: uppercase; }
.benef-bulle b { font-size: 18px; } .benef-bulle span { font-size: 11px; opacity: .92; line-height: 1.3; } .benef-bulle em { font-size: 10.5px; opacity: .85; }
.benef-bulle.sort { opacity: 0; }
@media (max-width: 900px) { .benef-bulle { left: 10px; } }
@keyframes benef-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Fenêtre « Code de sécurité » */
.qm.code-secu { width: 380px; }
.code-secu .cs-code { display: block; margin: 14px auto 4px; width: 170px; font-size: 30px; text-align: center; letter-spacing: 14px; padding: 10px 6px 10px 20px;
  border: 2px solid #cbd5e1; border-radius: 12px; font-weight: 800; }
.code-secu .cs-code:focus { border-color: #dc2626; outline: none; box-shadow: 0 0 0 4px rgba(220,38,38,.15); }
.code-secu .cs-err { min-height: 18px; color: #b42318; font-weight: 700; font-size: 13px; }

/* Pastille du menu de gauche (ex. demandes de chargement en attente) */
.badge-menu { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #e11d48; color: #fff;
  font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px rgba(255,255,255,.35); animation: pulse-menu 1.6s ease-in-out infinite; }
@keyframes pulse-menu { 50% { transform: scale(1.15); } }

/* Barre de saisie des lignes (BL / facture / devis) */
.barre-saisie { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: flex-end; padding: 8px 10px; margin: 4px 0 8px; border: 2px dashed #b9cdf5; border-radius: 10px; background: #f5f9ff; }
.barre-saisie.active { border-style: solid; border-color: #1559c7; background: #eaf2ff; }
.barre-saisie.edition { border-color: #e8842b; background: #fff6ea; }
.barre-saisie label { font-size: 11.5px; margin: 0 0 2px; display: block; }
.barre-saisie .bs-des { flex: 1 1 280px; } .barre-saisie .bs-n { width: 110px; } .barre-saisie .bs-p { width: 75px; }
.barre-saisie input, .barre-saisie select { width: 100%; }
.barre-saisie .bs-b { display: flex; gap: 4px; } .barre-saisie .bs-b .btn { min-width: 44px; font-size: 17px; padding: 6px 12px; }
.barre-saisie .bs-aide { flex-basis: 100%; font-size: 11.5px; }
table.lignes tr { cursor: pointer; } table.lignes tr.en-edition td { background: #ffe9cc !important; }
table.lignes input[readonly] { cursor: pointer; } table.lignes select.lecture { pointer-events: none; appearance: none; -webkit-appearance: none; border-color: transparent; background: transparent; }

/* Lignes d'une facture scannée : désignation du fournisseur sous la nôtre */
table.lignes .desf { font-size: 11.5px; line-height: 1.5; padding: 1px 4px 3px; } table.lignes .desf .btn { padding: 1px 8px; font-size: 11.5px; }
