:root {
  --fond: #f4f5f7;
  --surface: #ffffff;
  --encre: #1c2330;
  --encre-douce: #5b6577;
  --ligne: #e1e4ea;
  --nav: #172033;
  --nav-encre: #c9d1e0;
  --accent: #2563c9;
  --accent-doux: #e8effb;
  --ok: #1d7a4a;
  --ok-doux: #e5f4ec;
  --alerte: #b26b00;
  --alerte-doux: #fdf3e1;
  --danger: #b42323;
  --danger-doux: #fbe9e9;
  --transit: #6b46c1;
  --transit-doux: #f0ebfb;
  /* Harmonisation (7.50) : un seul jeu de valeurs pour toutes les pages, tableau de bord compris.
     Rayon des cartes et tuiles, rayon des boutons et champs, ombre légère, fond des en-têtes de tableau. */
  --rayon: 12px;
  --rayon-petit: 8px;
  --ombre: 0 1px 2px rgba(16, 24, 40, .04);
  --ombre-survol: 0 6px 18px rgba(16, 24, 40, .09);
  --fond-doux: #f7f8fa;
  --survol: #f5f8fe;
}
* { box-sizing: border-box; }
html { font-size: 15px; }  /* 7.52 : 15 px plutôt que 14, plus lisible */
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 1.15rem; margin: 0 0 12px; font-weight: 620; }
h3 { font-size: 1rem; margin: 18px 0 8px; font-weight: 620; }
.sous-titre { color: var(--encre-douce); margin: 0 0 20px; }

/* Mise en page */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.nav { background: var(--nav); color: var(--nav-encre); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav .logo { color: #fff; font-weight: 700; font-size: 1.05rem; padding: 4px 10px 18px; letter-spacing: .2px; }
.nav .logo small { display: block; font-weight: 400; color: var(--nav-encre); font-size: .8rem; }
/* Menu écrit plus gros et plus clair (Gaëlle, 30/11/2026 : « on voit mal ») */
.nav .groupe { text-transform: uppercase; font-size: .83rem; font-weight: 600; letter-spacing: 0; color: #b4c0d6; margin: 16px 10px 6px; }
.nav a { display: block; color: var(--nav-encre); padding: 7px 10px; border-radius: 6px; font-size: 1.05rem; }
.nav a:hover { background: #22304a; text-decoration: none; color: #fff; }
.nav a.actif { background: var(--accent); color: #fff; }
.nav a.sous { padding-left: 30px; font-size: 1rem; }
/* Sections repliables : la section de la page en cours reste ouverte (calculée par le serveur) */
.nav details.section > summary { list-style: none; cursor: pointer; display: flex; gap: 6px; justify-content: space-between; align-items: center; border-radius: 6px; padding: 4px 0; }
.nav details.section > summary::-webkit-details-marker { display: none; }
.nav details.section > summary::after { content: "▸"; font-size: .8rem; transition: transform .15s; }
.nav details.section[open] > summary::after { transform: rotate(90deg); }
.nav details.section > summary:hover { color: #fff; }
/* Titre de section = lien vers son tableau de bord (26/11/2026) ; la flèche ouvre ou ferme le menu */
.nav details.section > summary .lien-section { color: inherit; padding: 0; margin: 0; flex: 1; text-decoration: none; background: none; }
.nav details.section > summary .lien-section:hover, .nav details.section > summary .lien-section.actif { color: #fff; text-decoration: underline; }
.nav .bientot { display: block; color: #56627a; padding: 7px 10px; font-size: .92rem; }
.nav .bientot em { font-style: normal; font-size: .7rem; border: 1px solid #3a4660; border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.nav .utilisateur { margin-top: 24px; border-top: 1px solid #2a3753; padding: 14px 10px 0; font-size: .85rem; }
.contenu { padding: 32px 36px 64px; max-width: 1400px; width: 100%; position: relative; }
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.entete h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
.entete .sous-titre { max-width: 900px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cartes et grilles */
.carte { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 20px 22px; margin-bottom: 20px;
  box-shadow: var(--ombre); }
/* Carte qui ne contient qu'un tableau : le tableau va jusqu'au bord (remplace style="padding:0") */
.carte.tableau, .carte[style*="padding:0"] { padding: 0; overflow: hidden; }
/* Titre d'une carte-tableau, au-dessus du tableau */
.carte-tete { padding: 16px 18px 8px; }
.carte-tete h2 { margin: 0; }
.carte-tete p { margin: 4px 0 0; }
.grille { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px 16px; }
.kpi .libelle { color: var(--encre-douce); font-size: .85rem; }
.kpi .valeur { font-size: 1.55rem; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .detail { color: var(--encre-douce); font-size: .8rem; }
.kpi.transit { border-left: 4px solid var(--transit); }
.kpi.reel { border-left: 4px solid var(--ok); }
.kpi.alerte { border-left: 4px solid var(--alerte); }

/* Tableaux */
.tableau-conteneur { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--ligne); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--encre-douce); font-weight: 600; background: var(--fond-doux); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td.n { white-space: nowrap; }
/* 7.54 : un texte long (désignation, mots-clés, libellé) passe à la ligne plutôt que d'élargir la page */
td { overflow-wrap: break-word; }
td .badge { white-space: normal; }
tbody tr:hover td { background: var(--survol); }
tbody tr:last-child td { border-bottom: 0; }
td.transit, th.transit { background: var(--transit-doux); }
tfoot td { font-weight: 650; background: var(--fond-doux); border-top: 1px solid var(--ligne); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.muet { color: var(--encre-douce); }
.petit { font-size: .85rem; }

/* Étiquettes */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #eef0f4; color: var(--encre-douce); white-space: nowrap; }
.badge.ok { background: var(--ok-doux); color: var(--ok); }
.badge.alerte { background: var(--alerte-doux); color: var(--alerte); }
.badge.danger { background: var(--danger-doux); color: var(--danger); }
.badge.transit { background: var(--transit-doux); color: var(--transit); }
.badge.info { background: var(--accent-doux); color: var(--accent); }

/* Boutons et formulaires */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--rayon-petit); border: 1px solid var(--ligne); background: var(--surface); color: var(--encre); cursor: pointer; font: inherit; font-weight: 550; }
.btn:hover { background: #f1f3f6; text-decoration: none; }
.btn.primaire { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 201, .25); }
.btn.primaire:hover { background: #1d52aa; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-doux); border-color: #f1c4c4; }
.btn.petit { padding: 3px 9px; font-size: .85rem; }
form.ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
form.ligne > * { margin: 0; }
label { display: block; font-size: .85rem; font-weight: 550; margin-bottom: 4px; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=email], input[type=password], input:not([type]), select, textarea {
  font: inherit; padding: 7px 9px; border: 1px solid #cfd4dd; border-radius: var(--rayon-petit); background: #fff; color: var(--encre); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input.a-completer, select.a-completer, textarea.a-completer { border-color: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, .25); }
.champ { margin-bottom: 12px; }
.champ .aide { color: var(--encre-douce); font-size: .78rem; margin-top: 3px; }
.champ ul.errorlist, ul.errorlist { color: var(--danger); margin: 4px 0 0; padding-left: 16px; font-size: .85rem; }
.form-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.radio-ligne ul, .radio-ligne > div { display: flex; gap: 16px; list-style: none; padding: 0; margin: 0; }
.radio-ligne label { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.checkbox-liste ul, .checkbox-liste > div { list-style: none; padding: 0; margin: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.checkbox-liste label { font-weight: 500; display: inline-flex; gap: 6px; }
input.court { width: 110px; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 6px; margin-bottom: 6px; background: var(--accent-doux); }
.messages .success { background: var(--ok-doux); color: #14532d; }
.messages .warning { background: transparent; color: var(--encre-douce); border-left: 3px solid var(--alerte); border-radius: 0; padding: 4px 10px; font-size: .9rem; }
.messages .error { background: var(--danger-doux); color: #7f1d1d; }

/* Onglets */
.onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--ligne); margin-bottom: 18px; flex-wrap: wrap; }
.onglets a { padding: 9px 14px; color: var(--encre-douce); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; border-radius: 6px 6px 0 0; }
.onglets a:hover { background: #eef1f6; }
.onglets a.actif { color: var(--accent); border-color: var(--accent); }
.onglets a:hover { text-decoration: none; color: var(--encre); }

/* Fiche produit */
.fiche-tete { display: flex; gap: 18px; align-items: center; }
.vignette { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 1px solid var(--ligne); background: #fff; }
.vignette.vide { display: grid; place-items: center; color: #a0a8b6; font-size: .7rem; }
.vignette.mini { width: 36px; height: 36px; border-radius: 6px; }
dl.infos { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; margin: 0; }
dl.infos dt { color: var(--encre-douce); }
dl.infos dd { margin: 0; }
.galerie { display: flex; gap: 12px; flex-wrap: wrap; }
.galerie figure { margin: 0; border: 1px solid var(--ligne); border-radius: 8px; padding: 8px; background: #fff; width: 170px; }
.galerie img { width: 100%; height: 130px; object-fit: contain; }
.galerie figcaption { display: flex; gap: 4px; justify-content: space-between; margin-top: 6px; }
.etats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 12px; }
.vide-etat { text-align: center; color: var(--encre-douce); padding: 28px; }
.connexion { max-width: 380px; margin: 12vh auto; }

.fiche-produit { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 16px; }
.grande-image { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; border-radius: 8px; background: #fff; display: block; }
.grande-image.vide { display: grid; place-items: center; color: #a0a8b6; background: #f7f8fa; border: 1px dashed var(--ligne); }
.miniatures { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.miniatures img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--ligne); border-radius: 6px; cursor: pointer; background: #fff; }
dl.infos.compact { grid-template-columns: 130px 1fr; }

/* Tablettes (et tout écran tactile) : mêmes écrans que l'ordinateur, barre latérale comprise ;
   seulement des boutons et champs plus grands au toucher. */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
  .nav a { padding: 11px 10px; }
  .nav details.section > summary { padding: 10px 0; }
}
@media (max-width: 1280px) { .app { grid-template-columns: 210px minmax(0, 1fr); } }
/* 7.54 : toute la page tient dans la largeur de la fenêtre, sans barre de défilement sur le côté */
@media (max-width: 1500px) { th, td { padding: 8px 8px; } th { letter-spacing: .02em; } }
.defile-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 900px) {
  .fiche-produit { grid-template-columns: 1fr; }
  .contenu { padding: 18px 16px 40px; }
}
/* Téléphone seulement (moins de 768 px) : la barre passe au-dessus du contenu */
@media (max-width: 767px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; }
  .contenu { padding: 18px 16px 40px; }
  .g2, .g3, .g4, .etats { grid-template-columns: 1fr 1fr; }
  dl.infos { grid-template-columns: 1fr; }
}
@media print {
  .nav, .actions, .no-print, .onglets, .etats { display: none !important; }
  .carte { break-inside: avoid; border-color: #ccc; }
  .app { display: block; }
}

/* Documents de vente imprimés (A4) */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11px; }
  .contenu { padding: 0; max-width: none; }
  .messages { display: none; }
  .document-imprime { border: none; padding: 0; }
  .document-imprime th { background: #f1f2f4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
details > summary { list-style: none; cursor: pointer; display: inline-flex; }

/* Tri des colonnes */
th.triable a { color: inherit; text-decoration: none; display: block; }
th.triable a:hover, th.triable-js:hover { color: var(--accent); }
th.triable.actif a { color: var(--accent); }
th.triable-js { cursor: pointer; user-select: none; }
th.triable-js[data-sens="asc"]::after { content: " ▲"; color: var(--accent); }
th.triable-js[data-sens="desc"]::after { content: " ▼"; color: var(--accent); }
@media print { th.triable-js::after { content: none !important; } }

/* Clic droit sur les listes */
tr[data-menu] { cursor: context-menu; }
.menu-contextuel { position: fixed; z-index: 1000; min-width: 200px; background: var(--surface, #fff); border: 1px solid var(--ligne, #d7dce3);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, .18); padding: 4px; display: flex; flex-direction: column; }
.menu-contextuel button { background: none; border: 0; text-align: left; padding: 8px 12px; border-radius: 6px; font: inherit; cursor: pointer; color: inherit; }
.menu-contextuel button:hover, .menu-contextuel button:focus { background: var(--fond, #f3f5f8); outline: none; }
.menu-contextuel button.danger { color: var(--danger, #b42318); }
.modale-fond { position: fixed; inset: 0; z-index: 1001; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modale { background: var(--surface, #fff); border-radius: 10px; max-width: 460px; width: 100%; padding: 20px 22px; box-shadow: 0 12px 40px rgba(15, 23, 42, .3); }
.modale h2 { margin: 0 0 8px; }
.modale p { margin: 0 0 14px; line-height: 1.45; }
.modale .motif { width: 100%; margin-bottom: 14px; }
.modale .actions { display: flex; justify-content: flex-end; gap: 8px; }
.modale-fond[hidden] { display: none; }
.modale form label { display: block; margin-bottom: 12px; }
.modale form label input { display: block; width: 100%; margin-top: 4px; }

/* Choix de la société (PAPG / X-PAINT / Groupe) */
.choix-societe { padding: 0 14px 12px; }
.choix-societe select { width: 100%; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: 7px 8px; font: inherit; }
.choix-societe select option { color: #111; }
.bandeau-groupe { background: #fff4cc; border: 1px solid #f0d77a; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: .9rem; }
.logo-societe { max-height: 40px; max-width: 150px; display: inline-block; vertical-align: middle; background: #fff; border-radius: 6px; padding: 3px 6px; }
.logos-groupe { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.logos-groupe .logo-societe { max-height: 32px; max-width: 95px; }
.logos-groupe .plus { opacity: .7; font-weight: 700; }

[hidden]{display:none!important}

/* Imports : catégories puis sous-onglets */
.onglets-cat { margin-bottom: 8px; }
.onglets-cat a { font-weight: 600; }
.sous-onglets { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.sous-onglets a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--ligne); font-size: .88rem; color: var(--encre-douce); text-decoration: none; background: var(--surface); }
.sous-onglets a.actif { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Champ de recherche (client, fournisseur) : liste des noms existants */
.choix-liste { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--ligne); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); margin-top: 2px; }
.choix-item { padding: 7px 10px; cursor: pointer; font-size: .92rem; }
.choix-item.choix-produit { display: flex; align-items: baseline; gap: 12px; }
.choix-texte { flex: 1; min-width: 0; }
/* stock des propositions d'article : colonne fixe tout à droite (30/11/2026) */
.choix-stock { flex: none; min-width: 6.5em; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.choix-item:hover, .choix-item.actif { background: var(--accent-doux); }
.choix-vide { padding: 8px 10px; color: var(--encre-douce); font-size: .88rem; }

/* Aperçu des pièces choisies avant envoi */
.apercus { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 12px 0; }
.apercu-fichier { border: 1px solid var(--ligne); border-radius: 8px; overflow: hidden; background: #fff; }
.apercu-titre { font-size: .82rem; padding: 6px 10px; background: #f7f8fa; border-bottom: 1px solid var(--ligne); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apercu-fichier iframe { width: 100%; height: 380px; border: 0; display: block; }
.apercu-fichier img { width: 100%; max-height: 380px; object-fit: contain; display: block; }

/* Scan à la chaîne dans les documents de vente */
.scan-carte input#scan { font-size: 1.05rem; }
@keyframes scan-flash { from { background: #e6f6ec; } to { background: transparent; } }
tr.scan-flash td { animation: scan-flash 1.2s ease-out; }

/* Recherche de produits (documents de vente) */
.recherche-produit { position: relative; }
.recherche-produit .choix-liste { min-width: 420px; max-width: 90vw; }
.choix-liste.flottante { position: fixed; right: auto; z-index: 1000; } /* static/app.js placer() */

.print-only { display: none; }
@media print { .print-only { display: table-cell; } }

/* Arrivage fournisseur en attente de comptage : bandeau sur toutes les pages du magasinier */
.bandeau-arrivage { display: block; background: #fff4e0; border: 1px solid #f0c27a; color: #7a4b00; border-radius: 8px;
  padding: 12px 16px; margin-bottom: 16px; font-size: 1rem; text-decoration: none; }
.bandeau-arrivage:hover { background: #ffe9c4; text-decoration: none; }

/* Choix multiples avec recherche */
.multi-recherche { position: relative; border: 1px solid var(--ligne); border-radius: 8px; padding: 6px; background: var(--surface); }
.multi-recherche input { border: 0; outline: none; width: 100%; padding: 6px 4px; background: transparent; }
.multi-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.multi-puces:empty { display: none; }
.puce { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-doux); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: .88rem; }
.puce button { border: 0; background: transparent; cursor: pointer; font-size: .8rem; padding: 2px 6px; border-radius: 999px; }
.puce button:hover { background: rgba(0,0,0,.08); }
.desactive { opacity: .6; pointer-events: none; }

/* Statut de livraison d'un arrivage : étapes cliquables */
.stepper { display: flex; flex-wrap: wrap; gap: 6px; }
.stepper .etape { border: 1px solid var(--ligne); background: var(--surface); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: .9rem; color: inherit; }
.stepper .etape:hover:not([disabled]) { border-color: var(--accent); }
.stepper .etape.courante { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.stepper .etape[disabled] { cursor: default; }
.select-etape { min-width: 170px; font-weight: 600; }

/* Retour à la page principale de la rubrique */
.lien-retour { display: inline-block; margin-bottom: 10px; font-size: .9rem; color: var(--accent); }
.lien-retour:hover { text-decoration: underline; }

.choix-fournisseurs { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; max-width: 320px; font-size: .85rem; }
.choix-fournisseurs label { font-weight: 400; display: inline-flex; gap: 4px; align-items: center; }
.etiquettes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: text; }
.etiquettes input { flex: 1; min-width: 140px; width: auto; }
.etiquettes .multi-puces:empty { display: none; }
.factures-a-regler { border-left: 3px solid var(--accent); padding: 4px 0 4px 10px; margin-top: 6px; }
.liste-factures { max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.facture-a-regler { display: block; font-weight: normal; cursor: pointer; }

/* Dépenses : libellé bancaire long sur plusieurs lignes, jamais caché sous la colonne voisine */
td.libelle-depense { max-width: 380px; min-width: 200px; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
td.libelle-depense a { white-space: normal; }

/* « + Justificatif » : depuis l'ordinateur ou parmi les justificatifs déjà déposés */
.menu-justif { display: inline-block; position: relative; }
.menu-justif > summary { list-style: none; cursor: pointer; }
.menu-justif > summary::-webkit-details-marker { display: none; }
.menu-justif-choix { position: absolute; right: 0; top: 100%; z-index: 20; margin-top: 4px; display: flex; flex-direction: column;
  gap: 6px; padding: 8px; background: var(--surface); border: 1px solid var(--ligne); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); white-space: nowrap; }
/* sélection multiple dans la recherche de produits */
.choix-case { margin: 0 6px 0 0; vertical-align: middle; pointer-events: auto; }
.choix-pied { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; background: var(--surface); border-top: 1px solid var(--ligne); }
/* Contrôle des données */
.controle-total { display: flex; flex-direction: column; gap: 8px; }
.controle-total strong { font-size: 1.4rem; }
.controle-barre { height: 8px; border-radius: 4px; background: var(--ligne); overflow: hidden; }
.controle-barre span { display: block; height: 100%; background: var(--ok); }
table.controle td { vertical-align: middle; }
.controle-etat { font-size: 1.1rem; text-align: center; }
.alerte-txt { color: var(--alerte); }

/* Documents de vente : nombre à traiter sur les onglets, filtres rapides, chiffres de la sélection, mois */
.compte-onglet { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center; background: var(--accent-doux); color: var(--accent); }
.compte-onglet.danger { background: var(--danger-doux); color: var(--danger); }
.filtres-docs { margin-bottom: 12px; }
.filtres-docs a b { font-weight: 700; margin-left: 2px; }
.filtres-docs a.vide { opacity: .55; }
.recherche-docs { margin-bottom: 12px; }
.resume-docs { margin: 0 0 10px; color: var(--encre-douce); }
.resume-docs strong { color: var(--encre); }
table.liste-docs tr.mois td { background: #f6f7f9; padding: 6px 10px; font-weight: 650; font-size: .85rem; }
table.liste-docs tr.mois span + span { float: right; font-weight: 500; }
table.liste-docs tr.mois:hover td { background: #f6f7f9; }
@media print { .filtres-docs, .recherche-docs { display: none !important; } }

/* ---------------------------------------------------------------------------------------------------------
   Sections plus agréables (v7.03) : chiffres clés en tête de page, cartes et tableaux plus doux.
   Le tableau de bord (main.page-accueil) garde son propre style (dashboard.css) : il n'est pas concerné.
   --------------------------------------------------------------------------------------------------------- */

/* Rangée de chiffres clés : includes/chiffres_cles.html, calculés dans core/chiffres_cles.py */
.chiffres-cles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 0 0 20px; }
.chiffre { position: relative; display: flex; flex-direction: column; gap: 2px; background: var(--surface); color: var(--encre);
  border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px 18px 14px 20px; overflow: hidden;
  box-shadow: var(--ombre); transition: box-shadow .15s, transform .15s; }
.chiffre::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.chiffre .libelle { color: var(--encre-douce); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.chiffre .valeur { font-size: 1.7rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chiffre .detail { color: var(--encre-douce); font-size: .82rem; }
a.chiffre:hover { text-decoration: none; box-shadow: var(--ombre-survol); transform: translateY(-1px); }
.chiffre.ok::before { background: var(--ok); }
.chiffre.alerte::before { background: var(--alerte); }
.chiffre.alerte .valeur { color: var(--alerte); }
.chiffre.danger::before { background: var(--danger); }
.chiffre.danger .valeur { color: var(--danger); }
.chiffre.transit::before { background: var(--transit); }

/* Mêmes tuiles pour les chiffres déjà présents sur certaines pages (échéanciers, trésorerie, change…) */
.contenu:not(.page-accueil) .kpi { border-radius: 12px; padding: 14px 18px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  border-left: 4px solid var(--accent); }
.contenu:not(.page-accueil) .kpi .libelle { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.contenu:not(.page-accueil) .kpi .valeur { font-size: 1.6rem; font-weight: 700; }
.contenu:not(.page-accueil) .kpi.reel { border-left-color: var(--ok); }
.contenu:not(.page-accueil) .kpi.alerte { border-left-color: var(--alerte); }
.contenu:not(.page-accueil) .kpi.transit { border-left-color: var(--transit); }

@media (max-width: 767px) {
  .chiffres-cles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .chiffre { padding: 12px 12px 12px 16px; }
  .chiffre .valeur { font-size: 1.3rem; }
}
@media print {
  .chiffre { box-shadow: none; border-color: #ccc; }
  .chiffre::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Copie d'essai (deploy/essai/) : bandeau rouge fixe en haut de chaque page */
.bandeau-essai { position: sticky; top: 0; z-index: 1000; background: #b42318; color: #fff; text-align: center;
  font-weight: 700; padding: 6px 12px; font-size: .9rem; }

/* Pages de contrôle : détails repliés sous l'essentiel */
details.repli > summary { display: flex; align-items: center; gap: 8px; }
details.repli > summary h2 { margin: 0; }
details.repli > summary::after { content: "▸"; color: var(--encre-douce); transition: transform .15s; }
details.repli[open] > summary::after { transform: rotate(90deg); }
details.repli[open] > summary { margin-bottom: 10px; }
ul.liste-ok { list-style: none; margin: 0; padding: 0; columns: 2 280px; }
ul.liste-ok li { padding: 3px 0; break-inside: avoid; }
details.aide-repliee { margin: 4px 0 10px; }
details.aide-repliee > summary { color: var(--encre-douce); font-size: .85rem; }
details.aide-repliee > summary::before { content: "ⓘ\00a0"; }
details.aide-repliee > p { margin: 6px 0 0; font-size: .85rem; color: var(--encre-douce); }
.chiffre.bouton-controle { border-style: dashed; }

/* Apports des associés : pastille de couleur par associé, formulaires sur une ligne */
.pastille-associe { display: inline-block; padding: 2px 12px; border-radius: 999px; color: #fff; font-weight: 550; white-space: nowrap; }
.ligne-apport { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ligne-apport input, .ligne-apport select { width: auto; margin: 0; }
.ligne-apport .montant-apport { width: 9em; }
details.modif-apport > summary { list-style: none; display: inline-flex; }
details.modif-apport > summary::-webkit-details-marker { display: none; }
details.modif-apport[open] { text-align: left; }
details.modif-apport[open] > form { margin-top: 6px; }
table.apports tfoot td { padding: 10px 12px; }
table.apports td:first-child { white-space: nowrap; }

/* Commentaire interne des documents de vente (liste et fiche) : se lit comme du texte, s'écrit d'un clic */
table.liste-docs .col-note { min-width: 180px; width: 26%; }
.note-interne { margin: 0; }
.note-interne textarea { width: 100%; min-height: 0; padding: 3px 6px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; font: inherit; font-size: .88rem; line-height: 1.35; resize: none; overflow: hidden; color: var(--encre); }
.note-interne textarea::placeholder { color: var(--encre-douce); opacity: 0; }
tr:hover .note-interne textarea::placeholder, .note-fiche textarea::placeholder, .note-interne textarea:focus::placeholder { opacity: .7; }
.note-interne textarea:hover { border-color: var(--ligne); }
.note-interne textarea:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.note-interne textarea.enregistre { border-color: var(--ok); }
.note-interne textarea.erreur { border-color: var(--danger); }
.note-interne-texte { font-size: .88rem; }
.note-fiche { padding: 10px 14px; margin-bottom: 14px; }

/* Suivi clients (7.94) : note rapide sur une ligne, date de rappel colorée selon l'urgence */
.suivi-rapide { display: flex; gap: 6px; margin: 0; }
.suivi-rapide input[name=texte] { flex: 1; min-width: 0; }
.suivi-rapide.enregistre input[name=texte] { border-color: var(--ok); }
.suivi-rapide.erreur input[name=texte] { border-color: var(--danger); }
.suivi-date { width: 100%; }
.suivi-date.retard, .suivi-date-texte.retard { color: var(--danger); border-color: var(--danger); background: var(--danger-doux); }
.suivi-date.aujourdhui, .suivi-date-texte.aujourdhui { color: var(--alerte); border-color: var(--alerte); background: var(--alerte-doux); }
/* Lignes marquées « ✓ Fait » (8.34) : en bas de la page, grisées */
tr.suivi-effectues-titre td { padding-top: 18px; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--encre-douce); background: var(--surface); }
tr.suivi-effectue td { color: var(--encre-douce); opacity: .65; }
tr.suivi-effectue td a { color: inherit; }
tr.suivi-effectue td:last-child { opacity: 1; }

/* ---------------------------------------------------------------------------------------------------------
   Harmonisation (7.50) : composants communs à toutes les pages. Voir docs/STYLES.md avant d'en créer un autre.
   --------------------------------------------------------------------------------------------------------- */

/* Barre d'actions groupées : une seule par liste, cachée tant qu'aucune ligne n'est cochée (static/app.js,
   attribut data-selection). Elle reste visible en haut de l'écran pendant qu'on fait défiler la liste. */
.barre-selection { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; margin: 0 0 14px; background: var(--accent-doux); border: 1px solid var(--accent);
  border-radius: var(--rayon); box-shadow: var(--ombre-survol); }
.barre-selection [data-selection-compte] { font-weight: 650; color: var(--accent); margin-right: auto; }
.barre-selection select { width: auto; min-width: 240px; }
.barre-selection > * { margin: 0; }
.barre-selection.en-bas { position: static; margin: 14px 0 0; box-shadow: none; }  /* total répété en bas de liste */

/* Formulaire de recherche ou de filtre en tête de liste : champs alignés en bas, sur une ligne */
.filtres { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filtres > * { margin: 0; }
.filtres .large { flex: 1; min-width: 240px; }

/* Petites aides de mise en page, à préférer aux style="…" écrits dans les pages */
.sans-marge { margin: 0; }
.mt { margin-top: 12px; }
.nowrap { white-space: nowrap; }
.droite { text-align: right; }
.etire { flex: 1; }

/* Champ ou case qui attend une réponse (ex. dépense à classer) */
.a-classer { border-color: #d97706 !important; background: #fff7e6 !important; }
/* Ligne de tableau mise en avant (ex. ligne en cours, ligne d'un dossier) */
tr.groupe td, td.groupe { background: var(--fond-doux); font-weight: 600; }
tr.surligne td { background: var(--ok-doux); }
/* Explication au survol (ⓘ) plutôt qu'un paragraphe sous le titre : la page reste légère */
.info-bulle { color: var(--encre-douce); font-size: .8rem; font-weight: 400; cursor: help; vertical-align: middle; }
/* Les pastilles de couleur des tuiles ne servaient que de décor : la barre de gauche suffit */
.kpi-titre .pastille { display: none; }
h2.carte-tete { margin: 0; }
.carte-tete.ligne { display: flex; gap: 10px; align-items: center; }
.carte-pied { padding: 8px 18px 14px; margin: 0; }
.fond-doux { background: var(--fond-doux); }
.facture-a-regler.suggere { background: var(--ok-doux); }
.bord-alerte { border-left: 4px solid var(--alerte); }
.bord-ok { border: 2px solid var(--ok); }
pre.texte-email { white-space: pre-wrap; background: var(--fond-doux); border: 1px solid var(--ligne); border-radius: var(--rayon-petit);
  padding: 12px; font-family: inherit; font-size: .9rem; max-height: 420px; overflow: auto; }
.jauge-barre { background: var(--ligne); border-radius: 4px; height: 8px; overflow: hidden; }
.jauge-barre > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------------------------------------------------------------------------------------------------------
   Facilité d'utilisation (7.52) : recherche générale, « + Nouveau », formulaires et messages.
   --------------------------------------------------------------------------------------------------------- */
.nav .role { color: #7d8aa3; }
/* Sous-pages : en retrait avec un filet, sans flèche */
.nav a.sous { padding-left: 22px; margin-left: 12px; border-left: 1px solid #2f3d59; border-radius: 0 6px 6px 0; }

/* Formulaires : le bouton « Enregistrer » reste visible en bas de l'écran sur les longs formulaires */
form:not(.ligne):not(.filtres) > .actions:last-child { position: sticky; bottom: 0; z-index: 4; background: var(--fond);
  padding: 12px 0; margin-top: 8px; border-top: 1px solid var(--ligne); }
form.carte:not(.ligne) > .actions:last-child { background: var(--surface); }
/* Champ en erreur : bordure rouge, bien visible */
.champ:has(ul.errorlist) input, .champ:has(ul.errorlist) select, .champ:has(ul.errorlist) textarea { border-color: var(--danger); }
.champ:has(ul.errorlist) label { color: var(--danger); }
.resume-erreurs { background: var(--danger-doux); color: #7f1d1d; border-left: 4px solid var(--danger); border-radius: var(--rayon-petit);
  padding: 12px 16px; margin: 0 0 16px; }
.resume-erreurs ul { margin: 6px 0 0; padding-left: 18px; }
.resume-erreurs a { color: #7f1d1d; text-decoration: underline; }
.resume-erreurs:focus { outline: 2px solid var(--danger); outline-offset: 2px; }

/* Messages : un symbole devant, le message de réussite s'efface tout seul (static/app.js) */
.messages li { display: flex; gap: 8px; align-items: flex-start; transition: opacity .4s; }
.messages li.success::before { content: "✓"; font-weight: 700; }
.messages li.error::before { content: "!"; font-weight: 700; }
.messages li.disparait { opacity: 0; }

/* Accessibilité (méthode UI UX Pro Max, priorité 1) */
/* Contour bien visible sur l'élément atteint au clavier (Tab) */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.nav a:focus-visible, .nav summary:focus-visible { outline-color: #fff; }
/* Lien « Aller au contenu » : invisible tant qu'on n'appuie pas sur Tab */
.aller-contenu { position: absolute; left: 8px; top: -60px; z-index: 2000; background: var(--accent); color: #fff; padding: 8px 14px;
  border-radius: var(--rayon-petit); font-weight: 600; }
.aller-contenu:focus { top: 8px; text-decoration: none; }
/* Tout ce qui se clique a la main au survol */
summary, label:has(> input[type=checkbox]), label:has(> input[type=radio]), input[type=checkbox], input[type=radio], select { cursor: pointer; }
/* Bouton pendant l'envoi : grisé, sablier */
button.en-cours, .btn.en-cours { opacity: .6; cursor: progress; }
/* Moins d'animations pour qui l'a demandé dans son système */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
main.contenu:focus { outline: none; }

/* Photo du produit au début des lignes de documents (7.54, balise {% photo_produit %}) */
.photo-ligne { display: inline-block; width: 40px; height: 40px; flex: none; vertical-align: middle; margin-right: 10px;
  border: 1px solid var(--ligne); border-radius: 6px; background: #fff; position: relative; }
.photo-ligne img { width: 100%; height: 100%; object-fit: contain; border-radius: 5px; display: block; background: #fff; }
/* Aperçu agrandi au survol (static/app.js) : posé au-dessus de la page, jamais coupé par le tableau */
.apercu-photo { position: fixed; z-index: 3000; width: 220px; height: 220px; padding: 6px; background: #fff; border: 1px solid var(--ligne);
  border-radius: var(--rayon); box-shadow: 0 12px 32px rgba(16, 24, 40, .22); pointer-events: none; }
.apercu-photo img { width: 100%; height: 100%; object-fit: contain; }
.photo-ligne.vide { background: var(--fond-doux); border-style: dashed; }
.cellule-produit { display: flex; align-items: center; gap: 0; }
@media print { .photo-ligne { display: none !important; } }
.cellule-produit input { flex: 1; min-width: 0; }

/* 7.54 : tableaux à nombreuses colonnes (mois, montants) resserrés pour tenir dans la largeur de la fenêtre */
table.compact th, table.compact td { padding: 6px 4px; font-size: .8rem; }
table.compact th { letter-spacing: 0; white-space: normal; }
table.compact td:first-child, table.compact th:first-child { white-space: normal; width: 9em; min-width: 7em; padding-left: 8px; }
/* listes longues (fiches produits…) : un peu plus serrées, le texte passe à la ligne au lieu d'élargir la page */
table.serre th, table.serre td { padding: 7px 6px; font-size: .9rem; }
table.serre th { font-size: .74rem; letter-spacing: 0; }
input[type=file] { max-width: 100%; }

/* Bouton « Imprimer » commun (7.78) : en haut à droite de chaque page, sauf le tableau de bord qui a le sien.
   L'impression garde le contenu seul, lisible sur A4 : ni menu, ni boutons, ni formulaires d'action. */
.boutons-page { position: absolute; top: 6px; right: 36px; z-index: 5; display: flex; gap: 6px; }
.bouton-imprimer, .bouton-fenetre { color: var(--encre-douce); }
@media (max-width: 900px) { .boutons-page { right: 16px; } }
@media print {
  .aller-contenu, .bouton-imprimer, .lien-retour, .bandeau-arrivage, .barre-selection, .menu-contextuel,
  .btn, button, form.note-interne, .info-bulle { display: none !important; }
  html, body, .app, .contenu { background: #fff !important; }
  .contenu { position: static; }
  .carte { box-shadow: none !important; }
  .carte:has(table) { break-inside: auto; }  /* un long tableau commence sur la page, sans laisser une page vide */
  .carte-filtres, .carte.filtres, .carte:has(> form.ligne[method="get"]:only-child) { display: none !important; }
  a { color: inherit; text-decoration: none; }
  table { width: 100% !important; min-width: 0 !important; font-size: 9.5px; }
  .carte.tableau, .tableau-conteneur, .defile-x { overflow: visible !important; }
  th, td { padding: 4px 5px !important; white-space: normal !important; }
  td.n, th.n { white-space: nowrap !important; }
  thead { display: table-header-group; }
  tr, img { break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
  .entete { margin-bottom: 10px; }
}

/* Imprimer un seul cadre (7.84) : bouton [data-imprimer-cadre] dans une .carte (ex. « Prix de revient » d'une facture
   fournisseur). static/app.js marque le cadre et ses parents ; tout le reste de la page est masqué à l'impression. */
.titre-cadre { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.titre-cadre h2 { margin-bottom: 0; }
.imprime-seul { display: none; }
@media print {
  .imprime-seul { display: block; margin: 0 0 8px; font-weight: 600; }
  body.impression-cadre .bandeau-essai,
  body.impression-cadre .contenu *:not(.cadre-a-imprimer):not(.contient-cadre):not(.cadre-a-imprimer *) { display: none !important; }
  body.impression-cadre .cadre-a-imprimer { border: none; padding: 0; }
}

/* Fenêtre « Ajouter un client » du suivi (7.97) : boutons en bas de la fenêtre, sans la barre collante des formulaires */
.modale-fond .modale form.suivi-ajout > .actions:last-child { position: static; background: none; padding: 0; margin: 4px 0 0; border: 0; box-shadow: none; }

/* Photo de notes manuscrites sur la fiche client (7.99) : petite image, cliquer l'ouvre en grand */
.note-photo { display: flex; gap: 10px; align-items: flex-end; margin-top: 6px; }
.note-photo img { width: 160px; max-height: 200px; object-fit: cover; border-radius: var(--rayon-petit); border: 1px solid var(--ligne); }
.suivi-rapide .btn { flex: none; }
/* Poignée ⠿ des suivis (8.31) : on fait glisser la ligne pour la classer ; assez grande pour le doigt */
.poignee { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 30px; margin: -4px 4px -4px -6px;
  vertical-align: middle; color: var(--encre-douce); font-size: 1.1rem; cursor: grab; touch-action: none; user-select: none;
  -webkit-user-select: none; border-radius: 6px; }
.poignee:hover { background: var(--accent-doux); color: var(--accent); }
tr.ligne-glissee td { background: var(--accent-doux) !important; }
tr.ligne-glissee, tr.ligne-glissee .poignee { cursor: grabbing; }
tr.ligne-rangee td { background: var(--ok-doux); transition: background .6s; }

/* Récapitulatif « Suivi des tâches » (8.01, templates/core/suivi_taches.html) : un bloc par suivi, côte à côte */
.recap-suivi { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.recap-suivi h2 { margin: 0 0 10px; }
.recap-chiffres { display: flex; flex-direction: column; }
.recap-chiffre { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--ligne); color: var(--encre); }
.recap-chiffre:hover { text-decoration: none; color: var(--accent); }
.recap-chiffre strong { font-variant-numeric: tabular-nums; }
.recap-chiffre strong.danger { color: var(--danger); }
.recap-chiffre strong.alerte { color: var(--alerte); }
.recap-a-faire { list-style: none; margin: 12px 0 0; padding: 0; }
.recap-a-faire li { padding: 5px 0; }
.recap-a-faire .suivi-date-texte { font-size: .82rem; padding: 0 6px; border-radius: 6px; }

/* BL et factures sans internet (static/hors_ligne.js, 27/11/2026) */
.bandeau-hors-ligne { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; padding: 8px 14px;
  background: #b45309; color: #fff; font-size: .92rem; text-align: center; box-shadow: 0 -2px 8px rgba(0,0,0,.2); }
.bandeau-hors-ligne a { color: #fff; text-decoration: underline; }
/* Campagne du 27/11/2026 : le bandeau couvrait « Se déconnecter » en bas du menu. Sur ordinateur et tablette il
   commence après le menu (232 px) ; sur téléphone le menu ouvert passe au-dessus (z-index 1001). La page garde
   une marge en bas pour que sa dernière ligne ne soit pas cachée. */
@media (min-width: 768px) { .bandeau-hors-ligne { left: 232px; } }
body.avec-bandeau-hl .contenu { padding-bottom: 64px; }
.bon-provisoire-lignes input.court { width: 90px; }
.bon-etat { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .8rem; background: #e5e7eb; }
.bon-etat.en_attente { background: #fde68a; } .bon-etat.envoye { background: #bbf7d0; } .bon-etat.erreur { background: #fecaca; }
@media print { .bon-imprime { display: block !important; } }

/* Bouton ⓘ « Infos client » des documents de vente et sa fenêtre (28/11/2026) */
.bouton-info { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1.5px solid var(--accent); background: transparent;
  color: var(--accent); font: italic 700 14px/1 Georgia, serif; cursor: pointer; padding: 0; }
.bouton-info:hover { background: var(--accent); color: #fff; }
.dialog-client { width: calc(100% - 32px); max-width: 860px; max-height: calc(100vh - 40px); border: none;
  border-radius: 10px; padding: 18px 20px; overflow: auto; }
.dialog-client::backdrop { background: rgba(0, 0, 0, .35); }

/* Caisse au comptoir (28/11/2026, templates/ventes/caisse.html) : menu de gauche rangé (☰ Menu le ressort par-dessus
   la page), barre du haut réduite au nécessaire, paiement en bas de l'écran */
body.page-caisse .app { grid-template-columns: minmax(0, 1fr); }
body.page-caisse .nav { position: fixed; top: 0; left: 0; bottom: 0; width: min(84vw, 300px); z-index: 1001;
  transform: translateX(-105%); transition: transform .2s ease; overflow-y: auto; }
body.page-caisse.menu-ouvert .nav { transform: none; box-shadow: 8px 0 32px rgba(0, 0, 0, .35); }
body.page-caisse.menu-ouvert .voile-menu { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(15, 20, 30, .45); }
body.page-caisse .bouton-imprimer { display: none; }
body.page-caisse .bandeau-hors-ligne { display: none; }  /* la caisse a son propre message « Sans internet » */
body.page-caisse .caisse-haut .btn:disabled { opacity: .45; cursor: not-allowed; }
body.page-caisse .contenu { padding-top: 12px; padding-bottom: 150px; }
.caisse-haut { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
/* Caisse de cet ordinateur, toujours écrite en gros (29/11/2026) */
.caisse-nom { font-weight: 700; font-size: 1.15rem; padding: 4px 12px; border-radius: 8px; background: var(--accent); color: #fff; white-space: nowrap; }
.caisse-postes { display: inline-flex; gap: 4px; flex-wrap: wrap; }
/* Article scanné introuvable : la case clignote en rouge (avec deux bips) */
@keyframes scan-refuse { 0%, 50% { background: #fde2e2; border-color: #c62828; } 100% { background: inherit; } }
.scan-refuse { animation: scan-refuse 0.8s ease-out 2; }
/* Échange au comptoir : article rendu par le client (ligne en moins, 01/12/2026) */
.caisse-articles tr.ligne-rendue td:first-child { border-left: 4px solid var(--danger); }
.caisse-attentes { position: relative; }
.caisse-attentes #ca-liste-attente { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 380px; margin: 0; }
.caisse-client { margin-bottom: 10px; }
.caisse-bas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid;
  grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) 200px; gap: 16px; align-items: center;
  padding: 10px 18px; background: var(--fond-carte, #fff); border-top: 1px solid var(--ligne); box-shadow: 0 -6px 18px rgba(0, 0, 0, .08); }
.caisse-total { display: flex; flex-direction: column; min-width: 150px; }
.caisse-total strong { font-size: 1.9rem; line-height: 1.1; }
.caisse-questions { display: flex; flex-direction: column; gap: 6px; }
/* « Facture ? oui non » sur une seule ligne (Gaëlle : « pourquoi ça prend en hauteur ») */
.caisse-questions > div:not([hidden]) { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.caisse-questions label.case { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.caisse-questions input[type=checkbox] { margin: 0; width: 20px; height: 20px; }
.caisse-questions label.case { font-size: 1.05rem; font-weight: 600; }
.caisse-encaisser { font-size: 1.15rem; padding: 14px 18px; }
/* Choix du document à la fin (29/11/2026) : Ticket | Facture | BL | Devis */
.caisse-sorties { display: inline-flex; border: 1px solid var(--ligne); border-radius: 8px; overflow: hidden; }
.caisse-sorties label { padding: 6px 12px; cursor: pointer; border-right: 1px solid var(--ligne); font-size: 1rem; }
.caisse-sorties label:last-child { border-right: 0; }
.caisse-sorties input { position: absolute; opacity: 0; pointer-events: none; }
.caisse-sorties label:has(input:checked) { background: var(--accent); color: #fff; }
.caisse-sorties label:has(input:disabled) { opacity: .4; cursor: not-allowed; }
.caisse-sorties label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -3px; }
@media (max-width: 900px) { .caisse-bas { grid-template-columns: 1fr 1fr; } }

/* Prix sous le tarif du client (Gaëlle, 29/11/2026) : en gras et en couleur sur le BL et la facture, imprimé aussi */
.sous-tarif { color: #c2410c; font-weight: 700; }
@media print { .sous-tarif { color: #c2410c !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* Caisse : une couleur par moyen de paiement et par document (Gaëlle, 30/11/2026), reprise dans la fenêtre de rappel
   avant de valider. Texte blanc sur fond coloré (contraste suffisant en clair comme en sombre). */
.k-especes { --k: #15803d; } .k-carte { --k: #1d4ed8; } .k-virement { --k: #7e22ce; } .k-cheque { --k: #a16207; }
.k-avoir { --k: #0f766e; } .k-ticket { --k: #334155; } .k-facture { --k: #be123c; } .k-bl { --k: #c2410c; }
.k-devis { --k: #db2777; }
.btn.kc { background: var(--k); border-color: var(--k); color: #fff; }
.btn.kc:hover { filter: brightness(1.1); }
.caisse-sorties label.kc { color: var(--k); font-weight: 600; box-shadow: inset 0 -3px 0 var(--k); }
.caisse-sorties label.kc:has(input:checked) { background: var(--k); color: #fff; }
.puce { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--k, #475569); color: #fff;
        font-weight: 600; white-space: nowrap; }
.puce.grande { padding: 6px 14px; font-size: 1.05rem; margin: 2px 4px 2px 0; }

.caisse-paiements .btn.kc { margin-right: 4px; border-radius: 8px; }

/* Menu compact (static/app.js) : sous-pages du menu montrées en onglets en haut de leur page. */
html.menu-compact .nav a.sous-cachee { display: none; }
.onglets-section { margin: 0 0 16px; }
/* « ? » des mots techniques (core/glossaire.py, {% aide %}) */
.aide-terme { display: inline-block; position: relative; vertical-align: middle; margin-left: 4px; text-transform: none; letter-spacing: 0; }
.aide-terme > summary { list-style: none; cursor: pointer; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; line-height: 18px; text-align: center; }
.aide-terme > summary::-webkit-details-marker { display: none; }
.aide-bulle { position: absolute; z-index: 50; top: 24px; left: -8px; width: min(320px, 80vw); background: var(--surface); color: var(--encre); border: 1px solid var(--ligne); border-radius: 8px; padding: 10px 12px; box-shadow: 0 6px 20px rgba(0,0,0,.15); font-size: .88rem; font-weight: 400; line-height: 1.4; }
/* Client choisi dans un document (Gaëlle, 05/12/2026) : rouge = plafond atteint, orange = fiche incomplète,
   vert = complète et plafond pas atteint, gris = complète sans plafond (templates/ventes/document_form.html) */
input.client-rouge { color: #b91c1c; font-weight: 600; border-color: #dc2626; background: #fef2f2; }
input.client-orange { color: #c2410c; font-weight: 600; border-color: #f59e0b; background: #fff7e6; }
input.client-vert { color: #15803d; font-weight: 600; border-color: #16a34a; }
input.client-gris { color: #6b7280; font-weight: 600; border-color: #9ca3af; }
/* ===== Téléphone (8.00) =====
   Sur ordinateur et tablette, rien ne change : la barre du haut est masquée.
   Sous 768 px : une barre fine en haut avec « ☰ Menu » ; le menu s'ouvre par-dessus la page (static/app.js),
   les tableaux défilent dans leur cadre au lieu d'élargir la page, les formulaires passent sur une colonne. */
.barre-telephone { display: none; }
.voile-menu { display: none; }
@media (max-width: 767px) {
  .barre-telephone { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 900;
    background: var(--nav); color: #fff; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .bouton-menu { font: inherit; font-weight: 600; color: #fff; background: #22304a; border: 1px solid #33425f;
    border-radius: var(--rayon-petit); min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
  .titre-telephone { color: #fff; font-weight: 700; letter-spacing: .3px; }
  .titre-telephone:hover { text-decoration: none; }
  /* Menu caché, ouvert par-dessus la page */
  .nav { position: fixed; top: 0; left: 0; bottom: 0; width: min(84vw, 320px); height: 100vh; height: 100dvh; z-index: 1001;
    transform: translateX(-105%); transition: transform .2s ease; overflow-y: auto; padding-bottom: 32px; }
  body.menu-ouvert .nav { transform: none; box-shadow: 8px 0 32px rgba(0, 0, 0, .35); }
  body.menu-ouvert .voile-menu { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(15, 20, 30, .45); }
  body.menu-ouvert { overflow: hidden; }
  .nav a { padding: 11px 10px; }
  .nav details.section > summary { padding: 10px 0; }
  /* Page : une seule colonne qui ne s'élargit jamais au-delà de l'écran */
  .app { grid-template-columns: minmax(0, 1fr); }
  .contenu { padding: 14px 12px 40px; }
  .entete { margin-bottom: 14px; gap: 10px; }
  .entete h1, h1 { font-size: 1.35rem; }
  .entete .actions { width: 100%; }
  .bouton-imprimer, .bouton-fenetre { display: none; }
  .carte { padding: 14px 14px; margin-bottom: 14px; }
  /* Tableaux : défilement dans le cadre, la page ne bouge pas sur le côté */
  .carte, .carte.tableau, .carte[style*="padding:0"], .tableau-conteneur { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 8px; }
  td { min-width: 0; }
  /* Formulaires : une colonne, champs à 16 px (pas de zoom automatique de l'iPhone), boutons faciles à toucher */
  .form-grille, .g2, .g3 { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  .btn.petit { min-height: 34px; }
  form.ligne > * { flex: 1 1 140px; }
  form.ligne > .btn, form.ligne > button { flex: 0 0 auto; }
  input.court { width: 100%; }
  .onglets { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .onglets a { white-space: nowrap; flex: none; }
  .fiche-tete { flex-wrap: wrap; }
  .galerie figure { width: calc(50% - 6px); }
  img, video { max-width: 100%; }
}
@media print { .barre-telephone, .voile-menu { display: none !important; } }
/* Listes en cartes sur téléphone : chaque ligne du tableau devient un petit bloc (client, note, date, note rapide).
   Classe à poser sur un tableau : .empile-telephone (le Suivi clients l'a d'office). */
@media (max-width: 767px) {
  table.empile-telephone, table.suivi-clients { background: transparent; }
  table.empile-telephone thead, table.suivi-clients thead { display: none; }
  table.empile-telephone tr, table.suivi-clients tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--ligne); }
  table.empile-telephone td, table.suivi-clients td { display: block; width: auto !important; padding: 3px 0; border: 0; }
  table.empile-telephone tbody tr:hover td, table.suivi-clients tbody tr:hover td { background: none; }
  table.suivi-clients td:nth-child(3) { display: flex; align-items: center; gap: 8px; padding-top: 8px; }
  table.suivi-clients td:nth-child(3)::before { content: "À recontacter le"; font-size: .85rem; color: var(--encre-douce); white-space: nowrap; }
  table.suivi-clients td:nth-child(3) input { flex: 1; }
  table.suivi-clients td:nth-child(3).suivi-date-texte { display: block; }
  table.suivi-administratif td:nth-child(3)::before { content: "À faire le"; }
  table.suivi-clients tr.suivi-effectue td:nth-child(3)::before { content: none; }
  .poignee { width: 36px; height: 36px; font-size: 1.3rem; }
}


/* ===== Tablette (02/12/2026, Gaëlle : tablettes Android, en hauteur ou en largeur selon le salarié) =====
   Tablette en hauteur (768 à 1100 px de large) : le menu se range derrière « ☰ Menu » comme sur téléphone, la page
   prend toute la largeur ; les formulaires gardent leurs colonnes (contrairement au téléphone).
   Tout écran tactile (tablette en largeur comprise) : onglets, filtres et pastilles faciles à toucher, et les
   boutons « Nouvelle fenêtre / Imprimer » ne recouvrent plus les boutons de la page. */
@media (min-width: 768px) and (max-width: 1100px) {
  .barre-telephone { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 900;
    background: var(--nav); color: #fff; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); }
  .bouton-menu { font: inherit; font-weight: 600; color: #fff; background: #22304a; border: 1px solid #33425f;
    border-radius: var(--rayon-petit); min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
  .titre-telephone { color: #fff; font-weight: 700; letter-spacing: .3px; }
  .titre-telephone:hover { text-decoration: none; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .nav { position: fixed; top: 0; left: 0; bottom: 0; width: min(60vw, 340px); height: 100vh; height: 100dvh; z-index: 1001;
    transform: translateX(-105%); transition: transform .2s ease; overflow-y: auto; padding-bottom: 32px; }
  body.menu-ouvert .nav { transform: none; box-shadow: 8px 0 32px rgba(0, 0, 0, .35); }
  body.menu-ouvert .voile-menu { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(15, 20, 30, .45); }
  body.menu-ouvert { overflow: hidden; }
  .contenu { padding: 18px 18px 40px; }
  .carte.tableau, .carte[style*="padding:0"], .tableau-conteneur { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .g4, .etats { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) and (max-width: 1100px) and (prefers-reduced-motion: reduce) { .nav { transition: none; } }
@media (pointer: coarse) {
  .boutons-page { position: static; justify-content: flex-end; margin: -6px 0 8px; }
  .bouton-fenetre { display: none; }
  .onglets a, .pilules a { min-height: 44px; display: inline-flex; align-items: center; }
  .btn.petit { min-height: 38px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 22px; height: 22px; }
  .poignee { width: 36px; height: 36px; }
  td input, td select { min-width: 3.5em; }
}
