/* stocks — fiche article détaillée, formulaires en liste, voyants (0.4.1). */

/* ---- Fiche article détaillée (0.2.105) ---- */
.stk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stk-stats .stat { background: var(--glass3); border: 1px solid var(--stroke2); border-radius: 9px; padding: 10px 12px; }
.stk-h { font: 400 var(--fs-base) var(--sans); letter-spacing: .02em; text-transform: uppercase; color: var(--ink3); margin: 18px 0 8px; }
.stk-fiche .tbl td, .stk-fiche .tbl th { font-size: 12px; }

/* ---- Formulaire en liste ----
   Une information par ligne, nommée à gauche, saisie à droite. C'est ce qui
   remplace les rangées de champs sans étiquette : elles tenaient tant que la
   fenêtre était large, et découpaient les libellés dès qu'elle ne l'était
   plus. La colonne des libellés se replie au-dessus du champ sous 640 px. */
.stk-liste { display: flex; flex-direction: column; gap: 12px; }
/* Proportions revues en 0.4.9 : une colonne de libellés plus étroite, et
   des champs qui ne s'étirent plus sur toute la largeur de la modale — une
   liste de quatre types, un prix ou un seuil n'ont pas besoin de 500 px, et
   un champ trop long se lit comme un champ de texte libre. */
.stk-ligne { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 14px; align-items: center; }
.stk-ligne .stk-ctl > .inp { max-width: 440px; }
.stk-ligne .stk-ctl > .inp.num { max-width: 220px; }
.stk-ligne .stk-ctl > .hint { max-width: 440px; }
.stk-inter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stk-ligne > label { font-size: var(--fs-sm); color: var(--encre2); }
.stk-ligne .stk-ctl { min-width: 0; }
.stk-ligne .hint { margin-top: 5px; }
/* Colonne étroite (panneau « Nouveau mouvement ») : tout s'empile. */
.stk-liste.etroit { gap: 9px; }
.stk-liste.etroit .stk-ligne { grid-template-columns: 1fr; gap: 4px; align-items: stretch; }
.stk-liste.etroit .stk-ligne > label { font-size: var(--fs-xs); color: var(--encre3); }
@media (max-width: 640px) {
  .stk-ligne { grid-template-columns: 1fr; gap: 5px; align-items: stretch; }
  .stk-ligne > label { font-size: var(--fs-xs); color: var(--encre3); }
}

/* Dépôt de départ → dépôt d'arrivée, sur une seule ligne. */
.stk-flux { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stk-flux .inp { flex: 1 1 0; min-width: 0; }
.stk-fleche { flex: 0 0 auto; color: var(--encre3); }
@media (max-width: 520px) { .stk-flux { flex-direction: column; align-items: stretch; } .stk-fleche { text-align: center; } }

/* ---- Gestion des quantités : deux cases, un seul mode ----
   Des boutons radio (l'exclusivité est garantie par le navigateur, pas par
   du script) habillés en cases à cocher : le dessin dit « on en coche une ». */
.stk-modes { display: flex; gap: 8px; flex-wrap: wrap; }
.stk-mode {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  height: 38px; padding: 0 14px; border-radius: var(--r-ctl);
  background: var(--panneau); box-shadow: 0 0 0 1px var(--trait);
  font-size: 13.5px; color: var(--encre2);
  transition: box-shadow var(--t-fast), color var(--t-fast);
}
.stk-mode:hover { box-shadow: 0 0 0 1px var(--encre3); }
.stk-mode input { width: 15px; height: 15px; margin: 0; accent-color: var(--encre); cursor: pointer; }
.stk-mode:has(input:checked) { box-shadow: 0 0 0 2px var(--encre); color: var(--encre); }
.stk-mode:focus-within { box-shadow: 0 0 0 2px var(--encre); }

/* ---- Voyant d'alerte dans le registre ----
   Une colonne étroite, sans en-tête : le voyant se lit seul. 9 px plutôt que
   les 7 px du voyant courant — c'est ici la seule chose que porte la case. */
.stk-tbl .stk-c-led { width: 26px; padding-right: 0; }
.stk-tbl .stk-c-led .led { width: 9px; height: 9px; flex-basis: 9px; }

/* ---- Fiche article : emplacement photo et cadre descriptif (0.4.6) ----
   Les dix vignettes chiffrées sont parties dans le registre. Reste ce que la
   fiche seule peut montrer : à quoi l'article ressemble, et ce qu'il est.
   Sous 720 px la photo passe au-dessus du descriptif plutôt que de se
   réduire à un timbre-poste. */
.stk-entete { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 720px) { .stk-entete { grid-template-columns: 1fr; } }

.stk-photo {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  aspect-ratio: 1 / 1; padding: 14px; text-align: center;
  border: 1px dashed var(--trait2); border-radius: 12px;
  background: var(--panneau); color: var(--encre3);
}
.stk-photo > span { font-size: var(--fs-sm); letter-spacing: .04em; text-transform: uppercase; }
.stk-photo .hint { margin: 0; font-size: var(--fs-xs); }
@media (max-width: 720px) { .stk-photo { aspect-ratio: auto; min-height: 120px; } }

.stk-desc { min-width: 0; }
.stk-desc h3 { margin: 0 0 2px; font: 500 17px/1.3 var(--sans); color: var(--encre); }
.stk-desc .ref { margin: 0 0 12px; font-size: 12px; color: var(--encre3); }
.stk-desc-l { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 5px 0; }
.stk-desc-l + .stk-desc-l { border-top: 1px solid var(--trait); }
.stk-desc-l .k { font-size: var(--fs-sm); color: var(--encre3); }
.stk-desc-l .v { font-size: 13px; color: var(--encre2); }
.stk-desc .hint { margin-top: 12px; }
@media (max-width: 520px) { .stk-desc-l { grid-template-columns: 1fr; gap: 2px; } }

/* ---- Bouton dont le libellé se déplie au survol ----
   L'icône seule tient la place ; le mot arrive quand on s'y arrête, et au
   clavier dès que le bouton prend le focus. Généralisé en 0.4.6 à TOUTE la
   barre du poste : quatre libellés côte à côte prenaient la largeur d'une
   colonne du tableau sans rien apprendre à qui revient tous les jours.

   Le nom reste porté par `title` et `aria-label` : un bouton qui ne se
   nommerait qu'à la souris serait perdu pour qui n'en a pas. */
/* 0.4.19 : les règles .btn.icone-revele sont passées dans common/components.css —
   le poste Achats reprend les mêmes boutons. */

/* ---- Voyant de péremption dans le registre ----
   Le voyant et la date vont ensemble : la couleur dit l'urgence, la date dit
   laquelle. Séparés en deux colonnes, il faudrait lire de gauche à droite
   pour comprendre une seule information. */
.stk-per { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.stk-per .mono { font-family: var(--mono); font-size: 12px; }
.stk-per .led { width: 9px; height: 9px; flex-basis: 9px; }

/* ---- Sélecteur de colonnes (0.4.7) ----
   Deux colonnes de cases : la liste tient d'un regard jusqu'à seize entrées,
   et l'écran reste visible derrière la modale — on coche, on voit le tableau
   changer, on ajuste. Une colonne fixe est cochée et inerte : un tableau sans
   REF ni désignation n'est plus un tableau. */
.stk-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2px 18px; }
.stk-col {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 7px 8px; border-radius: 8px; font-size: 13px; color: var(--encre2);
  transition: background var(--t-fast);
}
.stk-col:hover { background: var(--voile2); }
.stk-col input { width: 15px; height: 15px; margin: 0; accent-color: var(--encre); cursor: pointer; }
.stk-col.fixe { cursor: default; color: var(--encre3); }
.stk-col.fixe:hover { background: none; }
.stk-col .hint { margin: 0 0 0 auto; font-size: var(--fs-xs); }

/* ---- Descriptif et visuel dans la fiche de création (0.4.7) ---- */
.stk-pj { display: flex; align-items: flex-start; gap: 14px; }
.stk-pj-apercu {
  flex: 0 0 auto; width: 88px; height: 88px; border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--trait2); background: var(--panneau); color: var(--encre3);
}
.stk-pj-apercu img { width: 100%; height: 100%; object-fit: cover; }
.stk-pj-cmd { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.stk-pj-cmd .hint { margin: 0; }
.stk-desc-champ textarea {
  width: 100%; min-height: 86px; resize: vertical; font: inherit; line-height: 1.5;
  padding: 9px 11px; border-radius: var(--r-ctl); border: 0;
  background: var(--panneau); box-shadow: 0 0 0 1px var(--trait); color: var(--encre);
}
.stk-desc-champ textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--encre); }

.stk-photo.pleine { padding: 0; border-style: solid; overflow: hidden; }
.stk-photo.pleine img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stk-desc-texte { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--encre2); }

/* ---- Fiche article responsive (0.4.9) ----
   Les tableaux défilent dans leur propre cadre : la fiche ne s'élargit plus
   au-delà de l'écran. Sous 720 px la photo passe au-dessus, réduite, et le
   descriptif prend toute la largeur. */
.stk-fiche { min-width: 0; }
.stk-defile { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px; padding: 0 2px; }
.stk-defile table { min-width: 560px; }   /* K.table l'enveloppe désormais dans .tablewrap (0.4.13) */
@media (max-width: 720px) {
  .stk-entete { gap: 14px; }
  .stk-photo, .stk-photo.pleine { width: min(220px, 100%); aspect-ratio: 1 / 1; min-height: 0; margin: 0 auto; }
  .stk-desc h3 { font-size: 16px; }
  .stk-desc-l { grid-template-columns: 110px minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .stk-pj { flex-direction: column; }
  .stk-desc-l { grid-template-columns: 1fr; }
}

/* ---- Modale Mouvements en bordereau (0.4.9) ---- */
.stk-mv-tete { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stk-mv-aide { margin: -4px 2px 12px; }
.stk-mv-tbl .stk-mv-des { font-size: 13px; color: var(--encre2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-mv-tbl .stk-mv-u { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stk-mv-tbl input:disabled { background: transparent; box-shadow: none; color: var(--encre3); }
.stk-mv-tbl tr.stk-mv-err td { background: var(--alerte-voile); }
.stk-mv-tbl tr.stk-mv-err td:first-child { box-shadow: inset 3px 0 0 var(--alerte); }

/* ---- Filtres et échelle de temps (0.4.14) ----
   Deux étages : la période, commune au poste, puis les critères de l'écran.
   Posés sur le papier du fond, pas dans une carte : ils règlent le tableau
   en dessous, ils n'en sont pas un second. */
.stk-filtres {
  display: flex; flex-direction: column; gap: 10px; margin: 0 0 14px;
  padding: 12px 14px; border-radius: var(--r-ctl);
  background: var(--panneau); box-shadow: 0 0 0 1px var(--trait);
}
/* 0.4.16 — le panneau s'ouvre depuis le bouton « Filtres » de l'en-tête. */
.stk-f-entete { display: flex; align-items: center; justify-content: space-between; }
.stk-f-nom { font-weight: 600; font-size: var(--fs-sm); }
.stk-btn-filtres { position: relative; }
.stk-btn-filtres.ouvert, .stk-btn-filtres.filtre-actif { box-shadow: inset 0 0 0 1px var(--encre); }
.stk-f-compte {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px;
  margin-left: 4px; border-radius: 9px; background: var(--encre); color: var(--panneau);
  font-size: 11px; font-weight: 600; line-height: 1;
}
.stk-f-resume { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 12px; }
.stk-f-pastille {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px;
  border-radius: 999px; background: var(--panneau); box-shadow: 0 0 0 1px var(--trait);
  font-size: var(--fs-sm); color: var(--encre);
}
.stk-f-retirer {
  border: 0; background: none; cursor: pointer; color: var(--encre2);
  width: 22px; height: 22px; border-radius: 50%; font-size: 15px; line-height: 1;
}
.stk-f-retirer:hover { background: var(--trait); color: var(--encre); }
.stk-f-retirer:focus-visible { outline: 2px solid var(--encre); outline-offset: 1px; }
.stk-f-temps, .stk-f-crit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.stk-f-titre { font-size: var(--fs-sm); color: var(--encre2); margin-right: 2px; }
.stk-f-date { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--encre2); }
.stk-f-date input {
  height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-ctl);
  background: var(--panneau); box-shadow: 0 0 0 1px var(--trait);
  font: inherit; font-size: var(--fs-sm); color: var(--encre);
}
.stk-f-date input:focus-visible { outline: 2px solid var(--encre); outline-offset: 1px; }
/* 0.4.17 — listes à cocher : famille, fournisseur, dépôt (avec recherche),
   niveau (trois cases). Une colonne par liste, qui se replient sous 640 px. */
.stk-f-listes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.stk-fm { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.stk-fm legend { font-size: var(--fs-xs); color: var(--encre3); padding: 0; margin-bottom: 4px; }
.stk-fm-n {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 4px;
  border-radius: 8px; background: var(--encre); color: var(--panneau); font-size: 10px; font-weight: 600;
}
.stk-fm-liste { max-height: 168px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  padding: 4px; border-radius: var(--r-ctl); box-shadow: 0 0 0 1px var(--trait); }
.stk-fm.court .stk-fm-liste { max-height: none; }
.stk-fm-opt { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 4px;
  font-size: var(--fs-sm); cursor: pointer; }
.stk-fm-opt:hover { background: var(--trait); }
.stk-fm-opt[hidden] { display: none; }
.stk-fm-opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-fm .btn { align-self: flex-start; }
.stk-f { display: inline-flex; flex-direction: column; gap: 3px; min-width: 0; }
.stk-f > span:first-child { font-size: var(--fs-xs); color: var(--encre3); }
.stk-f .inp { min-width: 150px; max-width: 240px; }
.stk-f-crit .btn { align-self: flex-end; }
@media (max-width: 640px) {
  .stk-f { flex: 1 1 140px; }
  .stk-f .inp { max-width: none; }
}

/* Choix du document à imprimer depuis le registre. */
.stk-choix-imp { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

/* 0.4.27.P5 (INV) — inventaire en session (modules/stocks/inventaires.js). */
.inv-feuille .inv-q { width: 96px; text-align: right; font: inherit; padding: 3px 6px; border-radius: var(--r-ctl);
  border: 0; box-shadow: 0 0 0 1px var(--trait); background: var(--panneau); color: var(--encre); }
.inv-feuille .inv-q:focus-visible { outline: 2px solid var(--encre); outline-offset: 1px; }
.inv-feuille .inv-q.inv-envoi { opacity: .6; }
.inv-feuille .inv-q.inv-faux { box-shadow: 0 0 0 2px var(--bad); }
.inv-pos { color: var(--ok); font-weight: 600; }
.inv-neg { color: var(--bad); font-weight: 600; }
.inv-alerte { padding: 8px 12px; border-radius: var(--r-ctl); box-shadow: inset 3px 0 0 var(--bad), 0 0 0 1px var(--trait); }
.inv-choix { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px;
  max-height: 200px; overflow-y: auto; padding: 6px; border-radius: var(--r-ctl); box-shadow: 0 0 0 1px var(--trait); }
.inv-non { margin: 6px 0; padding-left: 18px; max-height: 220px; overflow-y: auto; font-size: var(--fs-sm); }
.inv-info { font-size: var(--fs-sm); align-items: center; }

/* 0.4.27.P6 (DOC) — documents de stock (modules/stocks/documents-stock.js). */
.dst-tbl tr.dst-annule td { color: var(--encre3); }
.dst-tbl tr.dst-annule td.ref { text-decoration: line-through; }
.dst-info { font-size: var(--fs-sm); align-items: center; }

/* 0.4.28.P1 (REA) — réapprovisionnement (modules/stocks/reappro.js). */
.rea-tbl .rea-q, .rea-tbl .rea-s { width: 84px; text-align: right; font: inherit; padding: 3px 6px; border: 0;
  border-radius: var(--r-ctl); box-shadow: 0 0 0 1px var(--trait); background: var(--panneau); color: var(--encre); }
.rea-tbl .rea-s[data-modifie] { box-shadow: 0 0 0 2px var(--accent); }
.rea-tbl .rea-q:focus-visible, .rea-tbl .rea-s:focus-visible { outline: 2px solid var(--encre); outline-offset: 1px; }
.rea-manque { color: var(--bad); font-weight: 600; }
.rea-alerte { box-shadow: inset 3px 0 0 var(--warn); padding-left: 10px; }
/* 0.4.28.P2 (RES) — le réservé dépasse le stock. */
.stk-res-manque { color: var(--bad); font-weight: 600; }
.rea-params .rea-p { font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: 6px; }
.rea-params .rea-p input { width: 64px; font: inherit; padding: 3px 6px; border: 0; border-radius: var(--r-ctl);
  box-shadow: 0 0 0 1px var(--trait); background: var(--panneau); color: var(--encre); }
.rea-groupes { margin: 6px 0 10px; padding-left: 18px; }

/* Contrôle MOA du 2026-10-28 : onglets de « Stock » (Documents, Réapprovisionnement, Réservation, Inventaire). */
.stk-onglets { margin-bottom: 16px; }
