/* =====================================================================
   Back-office RUBI — système de design repris du prototype (rubi-erp,
   objets `C` et `S` de app.jsx) au pixel : mêmes couleurs, mêmes tailles,
   mêmes rayons, même densité. Ne pas « moderniser » ces valeurs sans le
   demander à Massimo : il connaît cet écran par cœur.
   ===================================================================== */

:root {
  --encre: #374151;
  --ardoise: #4B5563;
  --acier: #6B7280;
  --acier-pale: #9CA3AF;
  --papier: #F0EEEE;
  --panneau: #FFFFFF;
  --trait: #DEE2E6;
  --laiton: #1E5EAA;          /* accent bleu (et non prune) */
  --laiton-pale: #E9F1FA;
  --patine: #28A745;
  --patine-pale: #E9F6EC;
  --oxyde: #D9534F;
  --oxyde-pale: #FBEAEA;
  --barre: #1E5EAA;
  --barre-fonce: #17497F;
  --lien: #0F6CBD;
  --entete: #F8F9FA;
  --survol: #F5F3F4;

  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--sans);
  font-size: 13.5px;
  background: var(--papier);
  color: var(--encre);
}

a { color: var(--lien); text-decoration: none; }
a:hover { color: var(--barre-fonce); text-decoration: underline; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

#racine { min-height: 100vh; display: flex; flex-direction: column; }

/* --- Barre supérieure ------------------------------------------------ */
.entete {
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px; min-height: 46px;
  background: var(--barre); color: #fff; flex-wrap: wrap; flex-shrink: 0;
}
.marque-nom { font-weight: 700; font-size: 15px; letter-spacing: 0.02em; padding: 0 14px 0 6px; flex-shrink: 0; }
.marque-sep { width: 1px; height: 20px; background: rgba(255,255,255,0.25); }
.marque-ecran { font-size: 13px; color: rgba(255,255,255,0.75); flex-shrink: 0; white-space: nowrap; padding-right: 10px; }

.nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.menu { position: relative; }
.onglet {
  background: none; border: none; color: rgba(255,255,255,0.85);
  padding: 0 11px; min-height: 42px; font-size: 13px; cursor: pointer;
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
  font-family: var(--sans); border-radius: 0;
}
.onglet:hover { background: rgba(255,255,255,0.12); }
.onglet.actif { background: rgba(255,255,255,0.18); color: #fff; font-weight: 600; }
.pastille {
  background: rgba(255,255,255,0.22); color: #fff; font-size: 11px; font-weight: 600;
  border-radius: 9px; padding: 1px 6px; min-width: 18px; text-align: center;
}
.menu-deroulant {
  display: none;
  position: absolute; top: 100%; left: 0; z-index: 50; min-width: 210px;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: 0 0 4px 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18); padding: 4px;
  /* PAS de margin-top : un vide entre l'onglet et la liste ferait sortir
     la souris du .menu en route, et la liste se refermerait sous elle. */
}
/* Ouvert au survol — et au clavier, par le focus. Le survol n'existe qu'à
   la souris : sur un écran tactile, iOS le simulait au premier toucher
   (et avalait le clic), Android ne le simulait pas du tout. Au toucher,
   c'est chrome.js qui pose .ouvert. */
@media (hover: hover) {
  .menu:hover .menu-deroulant { display: block; }
  .menu:hover .onglet { background: rgba(255,255,255,0.12); }
}
.menu:focus-within .menu-deroulant, .menu.ouvert .menu-deroulant { display: block; }
.menu.ouvert .onglet { background: rgba(255,255,255,0.12); }
.item-menu {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border: none; border-radius: 3px; cursor: pointer;
  font-family: var(--sans); font-size: 13px; background: none; white-space: nowrap;
  color: var(--encre); text-align: left;
}
.item-menu:hover { background: var(--survol); }
.item-menu.actif { color: var(--laiton); font-weight: 600; }
.item-menu .pastille { background: var(--laiton-pale); color: var(--laiton); margin-left: auto; }

.segments { display: flex; border: 1px solid rgba(255,255,255,0.3); border-radius: 4px; overflow: hidden; }
.segment {
  font-size: 11.5px; letter-spacing: 0.04em; padding: 5px 11px; border: none;
  cursor: pointer; font-weight: 500; background: transparent; color: rgba(255,255,255,0.9);
  font-family: var(--sans);
}
.segment.actif { background: #fff; color: var(--laiton); }
/* Les mêmes segments sur le panneau de contrôle (fond blanc) : les
   couleurs de la barre bleue y seraient blanc sur blanc. */
.controle .segments { border-color: var(--trait); }
.controle .segment { color: var(--acier); }
.controle .segment:hover { background: var(--survol); }
.controle .segment.actif { background: var(--laiton); color: #fff; }
.qui { font-size: 12.5px; color: rgba(255,255,255,0.9); white-space: nowrap; }
/* Le choix de la localisation (le site) : un vrai filtre des écrans de
   stock, la liste vient du serveur (site-choisi.js). */
.choix-localisation { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; letter-spacing: 0.04em; color: rgba(255,255,255,0.8); }
.choix-localisation select {
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: #fff; background: transparent;
  border: 1px solid rgba(255,255,255,0.3); border-radius: 4px; padding: 4px 6px; max-width: 160px; cursor: pointer;
}
.choix-localisation select option { color: var(--encre); background: var(--panneau); }
.entete-droite { margin-left: auto; display: flex; align-items: center; gap: 10px; }
/* R222 : la recherche par code des écrans Achats, sur la barre bleue. */
.recherche-code { margin: 0; }
.recherche-code input { width: 190px; padding: 5px 9px; font-size: 12.5px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.35); background: #fff; color: var(--encre); }
/* Un trait entre les entrées d'un menu (Achats : le cycle, puis le quotidien). */
.menu-trait { height: 1px; margin: 4px 6px; background: var(--trait); }
/* R226 : le titre d'un groupe d'entrées (Direction › Administration). */
.menu-section { padding: 6px 12px 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--acier); }
/* Le bouton qui replie la barre sur un téléphone ; absent ailleurs. */
.bouton-menu { display: none; }
/* Le tiroir du menu (chrome.js) n'est une boîte qu'au téléphone ; ici ses
   deux blocs (menus, utilisateur) restent des enfants de la barre. */
.entete-tiroir { display: contents; }

/* --- Panneau de contrôle -------------------------------------------- */
.controle {
  display: flex; align-items: center; gap: 12px; padding: 9px 16px;
  background: var(--panneau); border-bottom: 1px solid var(--trait);
  flex-wrap: wrap; flex-shrink: 0;
}
.controle-droite { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ariane { font-size: 16px; font-weight: 500; color: var(--encre); }
.ariane-gris { font-size: 13px; color: var(--acier); font-weight: 400; }

/* --- Corps ----------------------------------------------------------- */
.corps { display: flex; flex: 1; min-height: 0; align-items: stretch; }
.principal { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 16px 48px; }
.page { max-width: 1180px; margin: 0 auto; }

.panneau {
  background: var(--panneau); border: 1px solid var(--trait);
  border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.panneau-titre {
  padding: 7px 12px; font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--acier); border-bottom: 1px solid var(--trait); background: var(--entete);
  border-radius: 6px 6px 0 0; display: flex; align-items: center; gap: 10px;
}
/* La note existait seulement dans un titre de panneau ; l'écran de saisie
   s'en sert aussi sous un champ et à côté d'un bouton. */
.note { font-size: 12.5px; color: var(--acier); line-height: 1.5; max-width: 560px; }
.panneau-titre .note { letter-spacing: 0.01em; text-transform: none; font-size: 12.5px; color: var(--acier-pale); font-weight: 400; max-width: none; }

/* Un résultat de recherche d'article : la boîte est en position absolue,
   ses éléments doivent donc s'aligner comme les entrées d'un menu. */
#resultats .item-menu { text-align: left; border-radius: 0; }
#resultats .item-menu:not(:last-child) { border-bottom: 1px solid var(--papier); }

h1.h1 { font-size: 21px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.intro { font-size: 13px; color: var(--acier); margin: 0 0 16px; max-width: 720px; line-height: 1.55; }
.vide { font-size: 13.5px; color: var(--acier); padding: 22px 0; line-height: 1.6; }

/* --- Journal (le chatter) -------------------------------------------- */
/* Plus de colonne (2026-11-25) : un bouton au bord droit, et le panneau
   s'ouvre par-dessus l'écran, sous l'en-tête. */
.journal {
  position: fixed; top: var(--haut-entete, 46px); right: 0; bottom: 0; z-index: 35;
  display: flex; align-items: flex-start; pointer-events: none;
}
.journal > * { pointer-events: auto; }
.journal-bouton {
  margin-top: 64px; padding: 10px 7px; writing-mode: vertical-rl; transform: rotate(180deg);
  font: 600 12px/1 inherit; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  color: var(--acier); background: var(--panneau); border: 1px solid var(--trait); border-right: none;
  border-radius: 0 6px 6px 0; box-shadow: -1px 1px 4px rgba(0,0,0,0.08);
}
.journal-bouton:hover { color: var(--encre); }
.journal-panneau {
  display: none; width: min(340px, 100vw); height: 100%; overflow-y: auto; padding: 0 0 32px;
  background: var(--panneau); border-left: 1px solid var(--trait); box-shadow: -6px 0 18px rgba(0,0,0,0.12);
}
.journal.ouvert .journal-panneau { display: block; }
.journal.ouvert .journal-bouton { display: none; }
.journal-titre {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  position: sticky; top: 0;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--acier); padding: 13px 16px; border-bottom: 1px solid var(--trait); background: var(--entete);
}
.journal-fermer {
  border: none; background: none; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px; color: var(--acier);
}
.journal-fermer:hover { color: var(--encre); }
.journal-ligne {
  display: flex; gap: 9px; padding: 11px 16px; font-size: 13px;
  border-bottom: 1px solid var(--papier); line-height: 1.45; color: var(--ardoise);
}
.journal-heure { font-family: var(--mono); font-size: 11.5px; color: var(--acier-pale); flex-shrink: 0; padding-top: 1px; }
.journal-acteur { color: var(--acier-pale); }

/* --- Champs et boutons ----------------------------------------------- */
.label { font-size: 12.5px; font-weight: 600; color: var(--ardoise); margin-bottom: 4px; display: block; }
.champ {
  width: 100%; padding: 6px 9px; border: 1px solid var(--trait); border-radius: 4px;
  font-size: 13.5px; font-family: var(--sans); background: var(--panneau); color: var(--encre);
}
/* Une note se tape sur plusieurs lignes ; l'étirer en largeur casserait la colonne. */
textarea.champ { resize: vertical; line-height: 1.4; }
.champ-qte {
  width: 72px; padding: 3px 6px; border: 1px solid var(--trait); border-radius: 4px;
  font-size: 12.5px; font-family: var(--mono); text-align: right;
  background: var(--panneau); color: var(--encre);
}
.recherche { display: flex; align-items: center; gap: 7px; border: 1px solid var(--trait); border-radius: 4px; padding: 4px 9px; background: var(--panneau); }
.recherche input { border: none; outline: none; font-family: var(--sans); font-size: 13px; width: 260px; color: var(--encre); }

.bouton-principal {
  background: var(--laiton); color: #fff; border: 1px solid var(--laiton);
  padding: 6px 14px; border-radius: 4px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; font-family: var(--sans);
}
.bouton-principal:hover { background: var(--barre-fonce); border-color: var(--barre-fonce); }
/* Un lien habillé en bouton (« Nouvelle promotion ») : `a:hover` lui
   donnait la couleur du fond — un bouton bleu sans texte sous la souris. */
a.bouton-principal:hover { color: #fff; text-decoration: none; }
a.bouton-secondaire:hover, a.bouton-mini:hover { text-decoration: none; }
.bouton-principal:disabled { opacity: 0.5; cursor: default; }
/* Un bouton d'effacement inactif doit SE VOIR inactif (Vider les données, R151). */
.bouton-danger:disabled { opacity: 0.45; cursor: default; }
.bouton-secondaire {
  background: var(--panneau); color: var(--laiton); border: 1px solid var(--laiton);
  padding: 6px 14px; border-radius: 4px; font-size: 13.5px; cursor: pointer; font-family: var(--sans);
}
.bouton-mini {
  background: var(--panneau); color: var(--laiton); border: 1px solid var(--trait);
  padding: 3px 9px; border-radius: 4px; font-size: 12px; cursor: pointer; font-family: var(--sans);
}
.bouton-danger {
  background: var(--panneau); color: var(--oxyde); border: 1px solid var(--oxyde);
  padding: 3px 9px; border-radius: 4px; font-size: 12px; cursor: pointer; font-family: var(--sans);
}
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
/* Le display ci-dessus l'emportait sur l'attribut hidden : « Charger plus »
   restait affiché sans rien à charger (fiche client, comptes à recevoir). */
.actions[hidden] { display: none; }

/* --- Listes ---------------------------------------------------------- */
.cadre-table { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--ardoise);
  padding: 6px 7px; border-bottom: 1px solid var(--trait); background: var(--entete); white-space: nowrap;
}
table.table th.droite, table.table td.droite { text-align: right; }
table.table td { padding: 6px 7px; border-bottom: 1px solid var(--papier); color: var(--ardoise); vertical-align: middle; }
table.table tbody tr:hover { background: var(--survol); }

/* Un tableau plus large que l'écran (Analyse des achats : seize colonnes
   pour qui voit les coûts). On le fait défiler vers la droite ; la PREMIÈRE
   colonne — l'article — reste en vue, sinon on lit des chiffres sans savoir
   de quoi. La cellule figée hérite du fond de sa ligne, survol compris :
   transparente, elle laisserait voir les chiffres qui passent dessous. */
table.table-large th:first-child, table.table-large td:first-child { position: sticky; left: 0; z-index: 1; }
table.table-large tbody tr { background: var(--panneau); }
table.table-large tbody td:first-child { background: inherit; box-shadow: 1px 0 0 var(--papier); }
table.table-large .col-article { min-width: 220px; max-width: 330px; }
/* L'EN-TÊTE reste en haut, lui aussi. Un en-tête collant se colle au cadre
   qui défile le plus proche — ici `.cadre-table`, à cause de son défilement
   horizontal : tant que c'est la PAGE qui défile vers le bas, il ne se colle
   à rien et sort de l'écran (à la 80e ligne de « PR », onze colonnes de
   chiffres sans titre). Le cadre défile donc dans les deux sens, borné à la
   hauteur de l'écran : la recherche et les filtres restent au-dessus, et le
   cadre descend jusqu'au bas de la fenêtre (168 px = ce qu'il y a au-dessus
   de lui, plus une marge) — « Voir les 50 suivants » et la légende viennent
   en défilant la page, une fois la liste parcourue. Le trait sous l'en-tête
   est une ombre : une bordure de tableau fusionné ne suit pas une cellule
   collante. */
.cadre-table.cadre-fige {
  overflow: auto;
  max-height: max(280px, calc(100vh - 168px));
  max-height: max(280px, calc(100dvh - 168px));
}
table.table-large thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--trait); }
table.table-large thead th:first-child { z-index: 3; }
/* Seize colonnes ne tiennent pas dans 1280 px, et sur un Mac aucune barre de
   défilement ne dit qu'il y en a d'autres : une ombre sur le bord droit du
   cadre tant qu'il reste des colonnes à voir (la classe est posée par
   l'écran, qui l'écrit aussi en toutes lettres sous le tableau). */
.cadre-ombre { position: relative; }
.cadre-ombre.reste-a-droite::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 22px; pointer-events: none;
  background: linear-gradient(to right, rgba(33, 37, 41, 0), rgba(33, 37, 41, 0.13));
}
/* Au toucher, un lien de tableau prend 44 px de haut (voir « Écran tactile »).
   Ici TOUTE la ligne ouvre la fiche, et elle fait déjà cette hauteur : le
   code reste une ligne de texte, sinon un vide s'ouvre entre lui et la
   description et un iPhone ne montre plus que sept articles. */
table.table-large td.col-article a { display: inline; min-height: 0; }
/* La ligne d'où l'on revient (on a ouvert sa fiche) : on la retrouve d'un
   coup d'œil dans une liste de trois cents. */
table.table-large tbody tr.revenu { background: var(--laiton-pale); }
/* Sur un téléphone AUSSI la colonne reste figée — mais ÉTROITE. À 330 px
   elle occupait tout le cadre d'un iPhone (349 px) : on voyait l'article OU
   les chiffres, jamais les deux, et une fois le tableau poussé vers la
   droite plus rien ne disait à quelle ligne appartenait un chiffre. Le code
   tient sur sa ligne (un long se coupe à ses tirets), la description est
   coupée ; il reste la place de trois colonnes de chiffres à côté. */
@media (max-width: 760px) {
  table.table-large .col-article { min-width: 0; width: 126px; max-width: 126px; }
  table.table-large td.col-article a { overflow-wrap: anywhere; }
  /* La page d'un téléphone défile elle aussi : le cadre peut prendre presque
     tout l'écran une fois la recherche passée au-dessus. */
  .cadre-table.cadre-fige {
    max-height: max(280px, calc(100vh - 112px));
    max-height: max(280px, calc(100dvh - 112px));
  }
}
/* Au toucher, le lien du fournisseur gardait ses 44 px de haut, plus sa ligne
   de détails : 72 px par ligne pour tout article qui a un fournisseur, alors
   que la colonne est hors de vue sur un téléphone — six articles à l'écran
   au lieu de dix. Le lien redevient une ligne de texte, et c'est la CELLULE
   entière qui en est la cible (elle fait la hauteur de la ligne, 44 px au
   moins) : le doigt vise aussi large, la ligne ne grandit plus. */
@media (pointer: coarse), (max-width: 760px), (max-width: 1100px) and (max-height: 500px) {
  table.table-large td.col-fournisseur { position: relative; }
  table.table-large td.col-fournisseur a { display: inline; min-height: 0; }
  table.table-large td.col-fournisseur a::after { content: ''; position: absolute; inset: 0; }
}

.filtres { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filtre {
  padding: 5px 13px; border-radius: 16px; border: 1px solid var(--trait);
  background: var(--panneau); color: var(--acier); font-size: 12.5px; font-weight: 500;
  cursor: pointer; font-family: var(--sans); white-space: nowrap;
}
.filtre.actif { border-color: var(--laiton); background: var(--laiton-pale); color: var(--laiton); }
/* Une bande de pastilles dans une barre de filtres : une simple suite de
   boutons, sauf au téléphone où elle défile seule (voir « Téléphone »). */
.filtres-pastilles { display: contents; }

/* --- Cartes ---------------------------------------------------------- */
.carte {
  background: var(--panneau); border: 1px solid var(--trait); border-left: 3px solid var(--acier-pale);
  border-radius: 6px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.carte-entete {
  display: flex; gap: 12px; align-items: center; padding: 11px 16px;
  font-size: 13.5px; flex-wrap: wrap; cursor: pointer;
}
.carte-corps { padding: 0 16px 14px; }
.cible-coche { display: inline-flex; align-items: center; cursor: pointer; }

/* --- Étiquettes, pastilles, bandeaux --------------------------------- */
/* Une pastille coupée en deux lignes perd son contour (« COMPTES /
   CLIENTS », 2026-09-24) : elle reste TOUJOURS d'un bloc, sur tout écran —
   la règle ne valait d'abord que sous 900 px. La colonne s'élargit, ou le
   tableau défile. */
.etiquette {
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 10px; border: 1px solid;
  display: inline-block; white-space: nowrap; line-height: 1.35;
}
.puce {
  font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; padding: 3px 9px;
  background: var(--panneau); border: 1px solid var(--trait); color: var(--acier);
  border-radius: 10px; font-weight: 600;
  display: inline-block; white-space: nowrap; line-height: 1.35;
}
.puce-laiton { background: var(--laiton-pale); border-color: var(--laiton); color: var(--laiton); }
.puce-oxyde { background: var(--oxyde-pale); border-color: var(--oxyde); color: var(--oxyde); }
/* Employée par les écrans (« répondue », « reçu ») sans avoir jamais été définie. */
.puce-patine { background: var(--patine-pale); border-color: var(--patine); color: var(--patine); }
.bandeau {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 9px 13px; border: 1px solid; border-radius: 4px; font-size: 13px; margin-top: 12px;
}
.bandeau-oxyde { background: var(--oxyde-pale); border-color: var(--oxyde); color: var(--oxyde); }
.bandeau-patine { background: var(--patine-pale); border-color: var(--patine); color: var(--patine); }

/* --- Barre d'état en chevrons ---------------------------------------- */
.barre-etat { display: flex; flex-wrap: wrap; gap: 0; margin-left: auto; }
.chevron {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 5px 15px 5px 20px; border: 1px solid var(--trait); border-right: none;
  background: var(--panneau); color: var(--acier); white-space: nowrap;
}
.chevron:first-child { border-radius: 4px 0 0 4px; }
.chevron:last-child { border-radius: 0 4px 4px 0; border-right: 1px solid var(--trait); }
.chevron.fait { background: var(--laiton-pale); color: var(--laiton); }
.chevron.actif { background: var(--laiton); color: #fff; border-color: var(--laiton); }
.chevron.actif:last-child { border-right-color: var(--laiton); }

/* --- Cadres à légende (disposition Fidelio de l'écran Stocks) -------- */
.deux-panneaux { display: grid; gap: 14px; align-items: start; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.deux-panneaux-bas { display: flex; gap: 14px; align-items: stretch; margin-top: 14px; flex-wrap: wrap; }
fieldset.cadre {
  border: 1px solid var(--trait); border-radius: 6px; margin: 0;
  padding: 6px 14px 14px; background: var(--panneau);
}
fieldset.cadre legend { font-size: 12px; font-weight: 600; color: var(--laiton); padding: 0 6px; }
.champ-ligne { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
/* `display: flex` l'emporte sur l'attribut hidden : sans cette ligne, une ligne cachée
   (le numéro de client d'un compte de portail) s'affichait pour tous les rôles. */
.champ-ligne[hidden] { display: none; }
.etiq-champ { font-size: 12.5px; color: var(--ardoise); width: 128px; flex-shrink: 0; }
.etiq-champ.large { width: 168px; }
.champ-lecture {
  font-size: 12.5px; padding: 5px 8px; background: var(--entete);
  border: 1px solid var(--trait); border-radius: 4px; color: var(--encre); min-height: 28px;
}
.case-chiffre {
  font-family: var(--mono); font-size: 13px; padding: 5px 9px; background: var(--entete);
  border: 1px solid var(--trait); border-radius: 4px; min-width: 104px; text-align: left; color: var(--encre);
}
.case-chiffre.accent { background: var(--laiton-pale); border-color: var(--laiton); color: var(--laiton); font-weight: 600; }
.case-chiffre.nul { color: var(--acier-pale); }
.noeud {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px;
  border: none; border-radius: 4px; cursor: pointer; font-family: var(--sans);
  font-size: 13px; color: var(--encre); margin-top: 2px; background: none; text-align: left;
}
.noeud:hover { background: var(--survol); }
.noeud.actif { background: var(--laiton-pale); border: 1px solid var(--laiton); color: var(--laiton); font-weight: 600; }
.noeud .compte { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--acier); }
.empl {
  font-family: var(--mono); font-size: 11.5px; background: var(--papier); padding: 3px 8px;
  border-radius: 4px; color: var(--ardoise); letter-spacing: 0.03em; border: 1px solid var(--trait);
}

/* --- En-tête de groupe (un lot d'achat par fournisseur) -------------- */
.entete-groupe {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--entete); border: 1px solid var(--trait); border-bottom: none;
  border-radius: 6px 6px 0 0; font-size: 13px; flex-wrap: wrap;
}
.corps-groupe {
  background: var(--panneau); border: 1px solid var(--trait);
  border-radius: 0 0 6px 6px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* --- Fiche ----------------------------------------------------------- */
.fiche { padding: 18px 20px; }
.fiche-haut { display: flex; gap: 24px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.fiche-nom { font-size: 22px; font-weight: 600; }
.fiche-sous { font-size: 14px; color: var(--ardoise); margin-top: 3px; }
.lecture-label { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--acier); }
.lecture-val { font-size: 40px; font-weight: 600; line-height: 1.05; margin-top: 2px; font-family: var(--mono); }
.section-titre {
  font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--acier);
  margin-bottom: 9px; font-weight: 600; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.encadre-adresse {
  font-size: 13px; line-height: 1.5; color: var(--ardoise); background: var(--entete);
  border: 1px solid var(--trait); border-radius: 4px; padding: 9px 12px; margin-top: 6px;
}
.rail { position: relative; height: 8px; background: var(--papier); border: 1px solid var(--trait); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.rail > span { position: absolute; left: 0; top: 0; bottom: 0; }
.paire { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ardoise); padding: 3px 0; }
.paire.fort { color: var(--encre); font-weight: 600; border-top: 1px solid var(--papier); margin-top: 4px; padding-top: 6px; }

/* --- Connexion ------------------------------------------------------- */
.connexion { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--papier); }
.connexion-boite { width: 420px; }
.connexion-boite .panneau { padding: 22px 24px; }
.connexion-marque { font-size: 21px; font-weight: 700; letter-spacing: 0.02em; color: var(--laiton); }
.qui-travaille { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.qui-bouton {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; text-align: left;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: 4px;
  cursor: pointer; font-family: var(--sans); font-size: 13.5px; color: var(--encre);
}
.qui-bouton:hover { border-color: var(--laiton); background: var(--laiton-pale); }
.qui-role { margin-left: auto; font-size: 11.5px; color: var(--acier); }

/* --- Divers ---------------------------------------------------------- */
.erreur-bandeau {
  background: var(--oxyde-pale); border: 1px solid var(--oxyde); color: var(--oxyde);
  padding: 9px 13px; border-radius: 4px; font-size: 13px; margin-bottom: 12px;
}
/* Le chargement RUBI (/commun/css/chargement.css) : il prend la couleur du
   texte autour (currentColor) — encre dans la page, blanc sur la barre. */
.rubi-chargement-bloc { padding: 48px 0; }
.rubi-chargement-petit { padding: 14px 0; }
.pointeur { cursor: pointer; }

/* --- Fenêtre étroite -------------------------------------------------
   Le back-office est fait pour un écran de bureau (la disposition de
   référence fait 1440 px). Sous 1100 px, le journal de 296 px comprimerait
   le contenu jusqu'à le pousser hors écran : il passe alors dessous, en
   pleine largeur, plutôt que de rester en colonne. */
@media (max-width: 1100px) {
  .corps { flex-direction: column; }
  .principal { overflow-y: visible; }
  .deux-panneaux-bas > fieldset.cadre { width: auto !important; flex: 1 1 100%; }
  .recherche input { width: 100%; min-width: 0; }
  .controle, .entete { row-gap: 4px; }
  /* Le bloc de droite (site, utilisateur, Quitter) débordait à droite dès
     que la fenêtre descendait sous sa largeur : il repasse à la ligne. */
  .entete-droite { margin-left: 0; flex-wrap: wrap; padding-bottom: 6px; }
  .qui { white-space: normal; }

  /* Tablette et téléphone. Un fieldset ne descend jamais sous la largeur
     de son contenu (min-inline-size: min-content par défaut) : un champ
     de 360 px poussait tout le cadre hors de l'écran. */
  fieldset.cadre { min-width: 0; }
  /* La liste de résultats de l'écran Stocks est ancrée à droite de la
     boîte de recherche, 480 px au minimum (style en ligne), et ses
     descriptions ne passaient jamais à la ligne : sur un écran étroit elle
     sortait par la gauche, codes coupés. */
  #resultats { min-width: min(480px, calc(100vw - 24px)) !important; max-width: calc(100vw - 24px); }
  #resultats .item-menu { white-space: normal; }
  .entete {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .controle, .principal {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* --- Écran tactile ----------------------------------------------------
   iPad et iPhone : un doigt ne vise pas comme une souris. Toute cible fait
   44 px de haut (recommandation d'Apple), sans rien changer à l'écran
   d'un ordinateur, qui a une souris (pointer: fine). Un téléphone qui ne
   se déclarerait pas tactile (la requête « téléphone » plus bas, la même que
   MODE_TACTILE) a les mêmes cibles. */
@media (pointer: coarse), (max-width: 760px), (max-width: 1100px) and (max-height: 500px) {
  .onglet { min-height: 44px; }
  .item-menu { min-height: 44px; font-size: 14px; }
  .segment { min-height: 44px; }
  .bouton-principal, .bouton-secondaire, .bouton-mini, .bouton-danger, .filtre {
    min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  }
  .bouton-mini, .bouton-danger { padding-left: 12px; padding-right: 12px; min-width: 44px; }
  .qui-bouton, .noeud { min-height: 44px; }
  .champ { min-height: 44px; }
  .champ-qte { min-height: 44px; }
  /* Une case à cocher se touche par son libellé : le libellé entier fait
     44 px de haut (« Seulement ce qu'il faut commander », le mode de
     paiement du comptoir, « Tout cocher »). */
  label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
    min-height: 44px; display: inline-flex; align-items: center; gap: 8px;
  }
  summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
  /* La case d'une carte de commande (lot de bons, R175) : 44 px de cible,
     pris sur la marge de la carte plutôt que sur sa hauteur. */
  .cible-coche { min-width: 44px; min-height: 44px; margin: -11px -8px -11px -14px; justify-content: center; }
  .onglet-page { min-height: 44px; }
  .choix-localisation select { min-height: 44px; }
  /* Safari (iPhone, et iPad selon le réglage) zoome sur tout champ écrit
     sous 16 px et ne dézoome pas en sortant : l'écran reste agrandi et
     déborde. !important : plusieurs écrans fixent 12 px en ligne. */
  input, select, textarea { font-size: 16px !important; }
  .recherche { min-height: 44px; }
  .recherche input { min-height: 42px; }
  .carte-entete { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  /* Un lien de tableau (numéro de commande, nom de client) est la cible la
     plus touchée de toutes : il prend la hauteur de la rangée. */
  table.table td { height: 44px; padding-top: 4px; padding-bottom: 4px; }
  table.table td a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* --- Téléphone ---------------------------------------------------------
   iPhone (375 à 430 px), et un iPhone couché (la hauteur manque alors plus
   que la largeur). La MÊME requête que MODE_TACTILE dans chrome.js. */
@media (max-width: 760px), (max-width: 1100px) and (max-height: 500px) {
  /* La barre se replie derrière « Menu » : logo, écran courant, bouton. */
  .entete {
    min-height: 48px; row-gap: 0; align-content: center;
    padding-top: env(safe-area-inset-top);
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .marque-nom { padding: 0 10px 0 4px; }
  .marque-ecran { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
  .bouton-menu {
    display: inline-flex; align-items: center; gap: 6px; margin-left: auto;
    min-height: 44px; min-width: 44px; padding: 0 10px;
    background: none; border: 1px solid rgba(255,255,255,0.3); border-radius: 4px;
    color: #fff; font-family: var(--sans); font-size: 13px; cursor: pointer;
  }
  /* Le menu ouvert est un TIROIR posé par-dessus la page, sous la barre :
     la barre garde sa hauteur (48 px), la page derrière ne bouge pas et ne
     défile pas (le tiroir défile seul). Avant, la liste s'ouvrait DANS la
     barre collante : 638 px de haut à 390 px de large, la page poussée
     dessous, et le bas du menu hors d'atteinte. */
  .entete-tiroir { display: none; }
  .entete.deplie .entete-tiroir {
    display: flex; flex-direction: column; gap: 12px;
    position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
    top: var(--haut-entete, 48px);
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    background: var(--barre-fonce);
    border-top: 1px solid rgba(255,255,255,0.2);
    padding: 8px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  /* La page derrière ne défile pas sous le doigt. Sur <html> SEULEMENT :
     posé aussi sur <body> (haut de 100 %), il ramenait la page en haut. */
  html:has(.entete.deplie) { overflow: hidden; }
  html:has(.entete.deplie) .rubi-assistant-bouton { display: none; }
  .entete.deplie .nav {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%;
  }
  .entete.deplie .menu { position: static; }
  .entete.deplie .onglet { width: 100%; min-height: 48px; font-size: 16px; padding: 0 12px; border-radius: 4px; }
  .entete.deplie .onglet svg { margin-left: auto; width: 12px; height: 12px; }
  .menu.ouvert .onglet svg { transform: rotate(180deg); }
  .menu-deroulant {
    position: static; min-width: 0; margin: 4px 0 8px;
    border: none; border-radius: 6px; box-shadow: none;
  }
  /* Le survol et le focus ne déplient rien ici : c'est le toucher. */
  .menu:not(.ouvert) .menu-deroulant { display: none; }
  .item-menu { min-height: 44px; font-size: 15px; padding: 8px 12px; white-space: normal; }
  /* Nom, localisation et Quitter : un bloc à part sous les menus, avec la
     même marge que les menus — le nom collé au bord gauche, la localisation
     et Quitter mal alignés, c'était la barre dépliée d'avant. */
  .entete.deplie .entete-droite {
    display: flex; flex-wrap: wrap; align-items: center; width: 100%; margin: 0; gap: 10px 12px;
    padding: 14px 12px 0; border-top: 1px solid rgba(255,255,255,0.2);
  }
  .entete.deplie .qui { order: -1; width: 100%; font-size: 15px; font-weight: 600; white-space: normal; }
  .entete.deplie .choix-localisation { flex: 1 1 auto; min-width: 0; font-size: 13px; }
  .entete.deplie .choix-localisation select { flex: 1 1 auto; min-width: 0; min-height: 44px; max-width: none; padding: 0 10px; }
  .entete.deplie .segment { min-height: 44px; padding: 0 16px; }
  .entete.deplie [data-deconnexion] { margin-left: auto; border: 1px solid rgba(255,255,255,0.3); border-radius: 4px; }

  /* Le fil d'Ariane sur sa ligne ; la recherche et les boutons dessous, en
     pleine largeur. */
  .controle { padding-top: 8px; padding-bottom: 8px; gap: 6px 10px; }
  .controle-droite { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .recherche { flex: 1 1 200px; min-width: 0; }
  /* Sous la boîte de recherche, sur toute sa largeur. */
  #resultats { left: 0 !important; min-width: 0 !important; max-width: none; }
  .recherche input { width: 100%; min-width: 0; }
  /* Les chevrons d'état restent sur UNE ligne, qui défile au doigt, plutôt
     que de s'empiler en escalier sur trois rangées. */
  .barre-etat { margin-left: 0; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  /* Une barre faite de PASTILLES seulement (« À approuver · 0 », « Back-
     orders · 14 »…) : une seule rangée qui défile au doigt dans sa bande,
     jusqu'au bord de l'écran, plutôt que trois rangées avant la liste. Une
     barre qui porte aussi des champs passe à la ligne (une liste de
     suggestions y est ancrée : un cadre qui défile la couperait). */
  .filtres:not(:has(> :not(.filtre))), .filtres-pastilles {
    display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin-left: calc(-1 * max(16px, env(safe-area-inset-left)));
    margin-right: calc(-1 * max(16px, env(safe-area-inset-right)));
    padding: 0 max(16px, env(safe-area-inset-right)) 2px max(16px, env(safe-area-inset-left));
    scroll-padding: 0 16px;
  }
  /* Les pastilles d'une barre qui porte aussi une recherche (Promotions) :
     leur bande prend la largeur, la recherche passe dessous. */
  .filtres-pastilles { flex: 1 1 100%; min-width: 0; width: auto; }
  .filtres-pastilles ~ .champ { margin-left: 0 !important; width: 100% !important; }
  .filtres:not(:has(> :not(.filtre)))::-webkit-scrollbar, .filtres-pastilles::-webkit-scrollbar { display: none; }
  .filtres:not(:has(> :not(.filtre))) > .filtre, .filtres-pastilles > .filtre { flex-shrink: 0; }
  /* La recherche de la barre d'écran prend sa rangée entière ; ses boutons
     (Exporter, Nouvel article…) passent dessous au lieu de l'écraser à
     cent pixels (fiche Stocks : « Code ou descript »). */
  .controle-droite > .recherche { flex: 1 1 100%; }

  /* Un tableau étroit devient une liste de cartes (classe `table-cartes`,
     une cellule = une rangée « libellé · valeur », la première cellule en
     titre) : sept colonnes dans 358 px donnaient « du 9 / septembre / 2026
     au 1 / février » sur cinq lignes, et la moitié du tableau hors de vue. */
  table.table-cartes thead { display: none; }
  table.table-cartes, table.table-cartes tbody, table.table-cartes tr, table.table-cartes td { display: block; width: auto; }
  table.table-cartes tr { padding: 10px 14px; border-bottom: 1px solid var(--trait); }
  table.table-cartes td { height: auto !important; border: 0; padding: 2px 0 !important; text-align: left; }
  table.table-cartes td[data-libelle] { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; text-align: right; }
  table.table-cartes td[data-libelle]::before { content: attr(data-libelle); color: var(--acier); font-size: 12px; text-align: left; flex-shrink: 0; font-family: var(--sans); font-weight: 400; }
  table.table-cartes td:first-child { font-size: 14px; padding-bottom: 6px !important; }
  table.table-cartes td.vide { padding: 22px 0 !important; }
  /* Les filtres de la liste des commandes (client, représentant, projets,
     tri) : un par rangée, le libellé dans une colonne, le champ dans le
     reste — ils s'alignaient chacun à sa façon. */
  .filtres-champs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px !important; }
  .filtres-champs > label, .filtres-champs > span {
    display: grid !important; grid-template-columns: 6.5rem minmax(0, 1fr) auto; align-items: center; gap: 6px 8px !important;
  }
  .filtres-champs .champ { width: 100% !important; max-width: none !important; }
  .filtres-champs [data-tri-vue] { grid-column: 2 / -1; justify-self: start; }
  .chevron { padding: 6px 10px 6px 12px; }

  /* 16 px de gouttière partout, comme la barre de l'écran au-dessus : à
     12 px la recherche et les cases semblaient collées au bord. */
  .principal {
    padding-top: 12px; padding-bottom: 32px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .journal-titre, .journal-ligne {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .fiche { padding: 14px; }
  .fiche-haut { gap: 14px; }
  .fiche-nom { font-size: 19px; }
  .lecture-val { font-size: 30px; }
  .panneau-titre { flex-wrap: wrap; }
  .deux-panneaux { grid-template-columns: minmax(0, 1fr); }
  fieldset.cadre { padding: 6px 10px 12px; }
  /* Une légende qui porte des boutons (fiche Stocks : Modifier la fiche,
     Pièces de rechange, Étiquettes) : une rangée qui passe à la ligne, sans
     les retraits faits pour un écran large. */
  /* `float` sort la légende du trait du cadre (une légende chevauche la
     bordure) : sur deux rangées, ses boutons tombaient à cheval dessus. */
  fieldset.cadre > legend:has(button) {
    float: left; width: 100%; padding: 6px 0 10px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  }
  fieldset.cadre > legend:has(button) + * { clear: both; }
  fieldset.cadre > legend:has(button) > *, fieldset.cadre > legend:has(button) > span > button { margin-left: 0 !important; }

  /* Les étiquettes de 128 et 168 px plus deux cases de 104 px dépassaient
     la largeur du cadre : l'étiquette rétrécit, et celles du tableau des
     disponibilités passent au-dessus de leurs chiffres. */
  .etiq-champ { width: 110px; }
  .etiq-champ.large { width: 100%; }
  .etiq-champ[style*="width:152px"] { width: 110px !important; }

  /* Aucun champ ne dépasse son cadre, quelle que soit la largeur fixée en
     ligne dans l'écran (260, 300, 360 px). */
  .principal input, .principal select, .principal textarea { max-width: 100%; }

  /* Même règle qu'au toucher (voir plus haut), pour un téléphone qui ne
     se déclarerait pas tactile. */
  input, select, textarea { font-size: 16px !important; }

  .connexion { align-items: flex-start; padding: max(16px, env(safe-area-inset-top)) 12px 16px; }
  .connexion-boite { width: 100%; max-width: 420px; }
  .connexion-boite .panneau { padding: 18px 16px; }

  .journal-ligne { padding-top: 10px; padding-bottom: 10px; }
}

/* Le mot-symbole de rubi.ca (SVG en ligne, /commun/js/logo.js) : blanc sur la barre. */
.marque-nom .logo { display: block; height: 16px; width: auto; color: #fff; }

/* --- Fiche commande : les expéditions et leur suivi ------------------ */
/* Le suivi se déplie SOUS la rangée de son expédition, en retrait sur le
   fond d'en-tête : on lit tout de suite à quel envoi il appartient. */
.bouton-mini.actif { background: var(--laiton-pale); border-color: var(--laiton); }
table.table tbody tr.rang-suivi, table.table tbody tr.rang-suivi:hover { background: var(--entete); }
tr.rang-suivi > td { padding: 10px 14px 14px; border-bottom: 1px solid var(--trait); }
.suivi-detail table.table { background: var(--panneau); border: 1px solid var(--trait); }
.suivi-entete { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; margin-bottom: 8px; font-size: 13px; color: var(--encre); }
.suivi-entete .lecture-label { margin-right: 6px; }

/* La ligne sur laquelle l'assistant (ou un lien) vient d'amener la
   personne : un liseré, le temps de la voir. */
tr.rangee-cible > td { box-shadow: inset 3px 0 0 var(--laiton); background: var(--laiton-pale); }

/* --- Comptabilité › Livres (R115) ------------------------------------------ */
/* Les onglets DANS un écran (balance, journal, grand livre…) — pas ceux du
   menu d'en-tête (.onglet), qui sont blancs sur fond sombre. */
.onglets-page { display: flex; gap: 4px; border-bottom: 1px solid var(--trait, #d9dde3); margin-bottom: 14px; flex-wrap: wrap; }
.onglet-page { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-size: 13.5px; color: var(--acier); cursor: pointer; margin-bottom: -1px; }
.onglet-page:hover { color: var(--encre); }
.onglet-page.actif { color: var(--encre); font-weight: 600; border-bottom-color: var(--encre); }
.succes-bandeau { background: rgba(46, 125, 50, 0.08); border: 1px solid rgba(46, 125, 50, 0.35); color: #1f5e23; border-radius: 6px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.etiquette.ok { border-color: var(--patine); color: var(--patine); }
.etiquette.erreur { border-color: var(--oxyde); color: var(--oxyde); }
/* Une écriture contrepassée reste au journal, barrée : elle a existé. */
tr.barre > td { text-decoration: line-through; color: var(--acier); }
tr.barre > td .etiquette { text-decoration: none; }
.sous-table { margin: 0; }
.sous-table td { padding: 4px 8px; font-size: 13px; border-bottom: 0; }
tr.detail > td { background: rgba(0, 0, 0, 0.025); }
/* Plan de comptes : un titre de section se lit comme une bande, un parent comme un sous-total. */
tr.niveau-titre > td { background: rgba(0, 0, 0, 0.04); text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; }

/* --- Entrepôt au bureau (R157) : prélever, emballer, l'atelier ---------
   Des rangées en grille plutôt qu'un tableau : sur un téléphone, la page
   ne défile jamais de côté (l'article passe sous la quantité). */
.ent-corps { padding: 10px 12px 14px; }
.ent-barre { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.ent-barre .champ { flex: 1 1 220px; min-width: 0; width: auto; }
.ent-ligne {
  display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; gap: 4px 10px;
  align-items: center; padding: 8px 0; border-bottom: 1px solid var(--papier);
}
.ent-ligne .ent-qte { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--encre); text-align: right; }
.ent-ligne .ent-sku { font-family: var(--mono); font-weight: 600; color: var(--encre); overflow-wrap: anywhere; }
.ent-ligne .ent-desc { font-size: 12.5px; color: var(--ardoise); }
.ent-ligne .ent-ou { grid-column: 2 / 4; font-size: 12.5px; color: var(--ardoise); }
.ent-ligne .ent-action { grid-column: 3; grid-row: 1; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ent-ligne.faite .ent-qte, .ent-ligne.faite .ent-sku { color: var(--patine); }
.ent-ligne.scannee { background: var(--laiton-pale); }
.ent-boite { border: 1px solid var(--trait); border-radius: 4px; padding: 8px 10px; margin-bottom: 8px; }
.ent-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.ent-sous { font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--acier); margin: 14px 0 6px; }
@media (max-width: 760px) {
  .ent-ligne { grid-template-columns: 2.6rem minmax(0, 1fr); }
  .ent-ligne .ent-action { grid-column: 1 / 3; grid-row: auto; justify-content: flex-start; }
  .ent-ligne .ent-ou { grid-column: 1 / 3; }
}

/* app.js : l'écran d'avant, estompé et inactif, pendant que le suivant se lit. */
.en-attente { opacity: .55; pointer-events: none; transition: opacity .12s ease-in .08s; }

/* En-tête compact de la fiche de commande (2026-10-22). */
.entete-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 18px; margin-top: 10px; }
.entete-case > div { font-size: 14px; color: var(--encre); overflow-wrap: anywhere; }
.entete-case.large { grid-column: 1 / -1; }
.entete-note { margin-top: 8px; font-size: 14px; white-space: pre-wrap; }

/* L'en-tête et la barre de l'écran restent en haut quand on défile
   (Massimo, 2026-10-22 : « je veux que le header soit flottant »). La
   barre se place sous l'en-tête, dont la hauteur varie (menus sur deux
   rangées) : app.js la tient dans --haut-entete. */
.entete { position: sticky; top: 0; z-index: 40; }
.controle { position: sticky; top: var(--haut-entete, 46px); z-index: 30; }
/* Sur un téléphone, l'écran est trop court pour deux barres fixes :
   l'en-tête seul reste. */
@media (max-width: 760px) {
  .controle { position: static; }
}

/* Saisie d'une commande : des rangées de champs qui passent à la ligne,
   sans débordement sur téléphone. */
.saisie-rangee { padding: 12px 14px 0; display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.saisie-rangee:last-child { padding-bottom: 12px; }
.saisie-rangee > div { max-width: 100%; }
.dispo-ligne { font-size: 12.5px; line-height: 1.35; white-space: normal; min-width: 150px; text-align: left; }

/* R169 : la boîte du motif d'un prix manuel (motif-prix.js). */
dialog.boite-motif {
  border: 1px solid var(--trait); border-radius: 8px; padding: 0;
  width: min(520px, calc(100vw - 32px)); background: var(--panneau, #fff); color: var(--encre);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
dialog.boite-motif::backdrop { background: rgba(20, 24, 28, 0.45); }
.champ[disabled][data-sans-droit] { cursor: not-allowed; }

/* --- Le bouton « Assistant » (assistant.js) ----------------------------
   Il flotte en bas à droite, par-dessus la page : sans place réservée, il
   cachait le dernier bouton d'une fiche et la dernière ligne d'une liste.
   La fin de la page (l'écran, ou le journal quand il passe dessous) garde
   donc sa hauteur, plus la marge du bas de l'iPhone. */
body:has(.rubi-assistant-bouton) .principal,
body:has(.rubi-assistant-bouton) .journal-panneau { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
/* Le tableau figé d'Analyse des achats défile dans son propre cadre, haut
   de presque tout l'écran : le cadre s'arrête au-dessus du bouton, sa
   dernière rangée reste lisible. */
@media (max-width: 760px) {
  body:has(.rubi-assistant-bouton) .cadre-table.cadre-fige {
    max-height: max(280px, calc(100vh - 180px - env(safe-area-inset-bottom)));
    max-height: max(280px, calc(100dvh - 180px - env(safe-area-inset-bottom)));
  }
}

/* V128 — Fournisseurs en lecture (rôle comptabilité) : les gestes d'écriture
   restent aux achats et à la direction, l'écran ne les propose pas. */
.fournisseurs-lecture #ouvrir-nouveau,
.fournisseurs-lecture #modifier-fiche,
.fournisseurs-lecture #ajouter-article,
.fournisseurs-lecture #approuver-fiche,
.fournisseurs-lecture [data-modifier-lien] { display: none !important; }

/* R225 : une facture à approuver depuis plus d’un jour ouvrable — en orange. */
.puce-ambre { background: #FEF3C7; border-color: #B45309; color: #92400E; }
table.table tbody tr.ligne-ambre { background: #FFF7E6; }

/* La bulle (?) — apps/backoffice/js/bulle.js : l'explication au besoin. */
details.bulle { display: inline-block; position: relative; vertical-align: middle; margin-left: 4px; }
details.bulle > summary {
  list-style: none; cursor: pointer; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--acier-pale); color: var(--acier); background: var(--panneau);
  font: 600 11px/16px var(--sans); text-align: center; user-select: none;
}
details.bulle > summary::-webkit-details-marker { display: none; }
details.bulle[open] > summary, details.bulle > summary:hover { border-color: var(--laiton); color: var(--laiton); }
details.bulle > .bulle-texte {
  position: absolute; z-index: 30; top: 24px; left: -8px; width: max-content; max-width: min(360px, 80vw);
  padding: 10px 12px; background: var(--panneau); border: 1px solid var(--trait); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12); color: var(--encre);
  font: 400 13px/1.45 var(--sans); text-transform: none; letter-spacing: normal; white-space: normal;
}
details.bulle.bulle-droite > .bulle-texte { left: auto; right: -8px; }

/* R235 — la page d'un groupe d'achat comme la maquette M2 : les tuiles, puis
   le tableau des codes en rupture à gauche et la décision à droite. */
.tuiles { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.grille-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.grille-2.egale { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 960px) { .grille-2, .grille-2.egale { grid-template-columns: minmax(0, 1fr); } }
.choix-decision {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; margin: 0 0 8px;
  border: 1px solid var(--trait); border-radius: 6px; background: var(--panneau); cursor: pointer;
}
.choix-decision:has(input:checked) { border-color: var(--laiton); background: var(--laiton-pale); }
.choix-decision.desactive { cursor: default; opacity: .65; }
.choix-decision input { margin-top: 3px; }
.choix-decision .choix-titre { font-weight: 600; color: var(--encre); font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase; }
.choix-decision .choix-texte { font-size: 12.5px; color: var(--ardoise); line-height: 1.45; }
.puce-mois { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--oxyde-pale); color: var(--oxyde); font-size: 12px; white-space: nowrap; }

/* Le tableau « Par groupe d'achat » de Décider (maquette M1) : treize colonnes
   tiennent à 1 400 px sans défilement de côté. */
table.table.table-serree th, table.table.table-serree td { padding-left: 4px; padding-right: 4px; }
