/* ═══════════════════════════════════════════════════════════════════
   Anticipation des stocks — ByLED
   Sobre, dense, lecture instantanée (§5 du brief) : la hiérarchie
   visuelle est portée par la date limite et les pastilles de statut,
   tout le reste s'efface.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --fond:        #f6f7f9;
  --carte:       #ffffff;
  --encre:       #1a202c;
  --encre-2:     #5a6472;
  --trait:       #e3e6ea;
  --accent:      #2456a6;

  --rouge:       #d23f31;
  --rouge-fond:  #fdeceb;
  --orange:      #c46b00;
  --orange-fond: #fff3e0;
  --jaune:       #997a00;
  --jaune-fond:  #fdf6d8;
  --vert:        #1a7f37;
  --vert-fond:   #e6f4ea;
  --gris:        #6e7781;
  --gris-fond:   #eef0f2;
  --accent-fond: #eaf1fc;
  --survol:      #f1f4f8;

  --ombre: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --rayon: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond:   #0e1116;   --carte: #161b23;
    --encre:  #e8ecf1;   --encre-2: #98a2b0;
    --trait:  #262d38;   --accent: #6ea8fe;
    --rouge-fond:  #3a1512; --orange-fond: #33230a;
    --jaune-fond:  #2e2708; --vert-fond:   #0f2917; --gris-fond: #1d232c;
    --accent-fond: #14243d; --survol: #1c2330;
    --rouge: #ff7b6e; --orange: #ffb35c; --jaune: #e5c94e; --vert: #57c977; --gris: #8b949e;
    --ombre: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fond);
  color: var(--encre);
}
.cache { display: none !important; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }

/* ── Barre du haut ─────────────────────────────────────────────── */
header {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .65rem 1.25rem;
  background: var(--carte); border-bottom: 1px solid var(--trait);
  position: sticky; top: 0; z-index: 40;
}
.titre { font-size: 1rem; white-space: nowrap; }
.titre .sep { margin: 0 .45rem; color: var(--encre-2); }
nav#onglets { display: flex; gap: .25rem; }
nav#onglets button {
  border: 0; background: none; color: var(--encre-2);
  padding: .45rem .8rem; border-radius: 7px;
}
nav#onglets button:hover { background: var(--gris-fond); }
nav#onglets button.actif { background: var(--gris-fond); color: var(--encre); font-weight: 600; }
.etat-donnees { margin-left: auto; font-size: .82rem; color: var(--encre-2); white-space: nowrap; }
.etat-donnees .pastille { margin-right: .4rem; }

/* ── Bandeau mode dégradé ──────────────────────────────────────── */
.bandeau {
  margin: .9rem 1.25rem 0; padding: .6rem 1rem;
  border-radius: var(--rayon); font-size: .9rem;
  background: var(--rouge-fond); color: var(--rouge);
  border: 1px solid color-mix(in srgb, var(--rouge) 35%, transparent);
}

/* ── KPI ───────────────────────────────────────────────────────── */
.kpis {
  display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  padding: 1rem 1.25rem 0;
}
.kpi {
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: .75rem .95rem;
}
.kpi .val { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .lib { font-size: .78rem; color: var(--encre-2); margin-top: .1rem; }
.kpi.rouge .val { color: var(--rouge); }
.kpi.orange .val { color: var(--orange); }
.kpi .note { font-size: .72rem; color: var(--encre-2); }

/* ── Vues ──────────────────────────────────────────────────────── */
.vue { padding: 1rem 1.25rem 3rem; }
.explication { color: var(--encre-2); max-width: 60rem; }

/* ── Filtres ───────────────────────────────────────────────────── */
.filtres {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-bottom: .8rem;
}
.filtres input[type=search], .filtres select {
  padding: .45rem .7rem; border: 1px solid var(--trait); border-radius: 8px;
  background: var(--carte); min-width: 130px;
}
.filtres input[type=search] { flex: 1 1 230px; max-width: 340px; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--trait); background: var(--carte); color: var(--encre-2);
  border-radius: 999px; padding: .28rem .7rem; font-size: .82rem;
}
.chip b { font-weight: 700; margin-left: .25rem; }
.chip.actif[data-s=rouge]  { background: var(--rouge-fond);  color: var(--rouge);  border-color: currentColor; }
.chip.actif[data-s=orange] { background: var(--orange-fond); color: var(--orange); border-color: currentColor; }
.chip.actif[data-s=jaune]  { background: var(--jaune-fond);  color: var(--jaune);  border-color: currentColor; }
.chip.actif[data-s=vert]   { background: var(--vert-fond);   color: var(--vert);   border-color: currentColor; }
.chip.actif[data-s=gris]   { background: var(--gris-fond);   color: var(--gris);   border-color: currentColor; }
.espace { flex: 1; }
.compteur { color: var(--encre-2); font-size: .82rem; }

.btn {
  display: inline-block; border: 1px solid var(--trait); border-radius: 8px;
  background: var(--carte); color: var(--encre); text-decoration: none;
  padding: .42rem .85rem; font-size: .88rem;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.discret { color: var(--encre-2); }
.btn.primaire { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.plus { display: block; margin: .8rem auto; }

/* ── Tableau ───────────────────────────────────────────────────── */
.table-cadre {
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); box-shadow: var(--ombre); overflow-x: auto;
}
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--carte);
  text-align: left; font-weight: 600; font-size: .78rem;
  color: var(--encre-2); text-transform: uppercase; letter-spacing: .03em;
  padding: .6rem .65rem; border-bottom: 1px solid var(--trait);
  cursor: pointer; user-select: none; white-space: nowrap;
}
thead th.num { text-align: right; }
thead th[data-dir="1"]::after  { content: " ↑"; color: var(--accent); }
thead th[data-dir="-1"]::after { content: " ↓"; color: var(--accent); }
tbody td {
  padding: .42rem .65rem; border-bottom: 1px solid var(--trait);
  white-space: nowrap;
}
tbody tr { cursor: pointer; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
.col-nom { max-width: 26rem; }
td.nom { max-width: 26rem; overflow: hidden; text-overflow: ellipsis; color: var(--encre-2); }
td.ref { font-weight: 600; }
td.date-limite { font-weight: 700; font-variant-numeric: tabular-nums; }
td.date-limite small { font-weight: 400; color: var(--encre-2); margin-left: .35rem; }

.pastille {
  display: inline-block; width: .62rem; height: .62rem; border-radius: 50%;
  vertical-align: middle;
}
.pastille.rouge  { background: var(--rouge); }
.pastille.orange { background: var(--orange); }
.pastille.jaune  { background: var(--jaune); }
.pastille.vert   { background: var(--vert); }
.pastille.gris   { background: var(--gris); }
.pastille.exclu  { background: transparent; border: 1px solid var(--gris); }

.badge {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.badge.rouge  { background: var(--rouge-fond);  color: var(--rouge); }
.badge.orange { background: var(--orange-fond); color: var(--orange); }
.badge.jaune  { background: var(--jaune-fond);  color: var(--jaune); }
.badge.vert   { background: var(--vert-fond);   color: var(--vert); }
.badge.gris   { background: var(--gris-fond);   color: var(--gris); }
/* Exclu : volontairement en creux — la ligne existe, elle est juste hors
   calcul. Sans cette règle, la couverture des exclues s'affichait sur un
   badge sans fond, illisible en thème sombre. */
.badge.exclu  { background: transparent; color: var(--gris);
                border: 1px dashed var(--gris); padding: .1rem .45rem; }

.tend { font-size: .95rem; }
.tend.hausse { color: var(--vert); }
.tend.baisse { color: var(--rouge); }
.tend.stable { color: var(--encre-2); }

.drapeau { font-size: .72rem; color: var(--orange); margin-left: .3rem; cursor: help; }

/* ── Cartes fournisseurs ───────────────────────────────────────── */
.cartes {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}
.carte-f {
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: .9rem 1.05rem;
  display: flex; flex-direction: column; gap: .55rem;
}
.carte-f.inactif { opacity: .62; border-style: dashed; }
.carte-f .entete { display: flex; align-items: baseline; gap: .5rem; }
.carte-f h3 { margin: 0; font-size: .98rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte-f .code { color: var(--encre-2); font-size: .78rem; }
.carte-f .stats { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.carte-f .ligne { display: flex; justify-content: space-between; font-size: .85rem; color: var(--encre-2); }
.carte-f .ligne b { color: var(--encre); font-variant-numeric: tabular-nums; }
.carte-f .lead input {
  width: 4.2rem; text-align: right; padding: .15rem .35rem;
  border: 1px solid var(--trait); border-radius: 6px; background: var(--fond);
}
.carte-f .exports { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .2rem; }
.carte-f .exports .btn { padding: .25rem .55rem; font-size: .78rem; }
.a-confirmer { color: var(--orange); font-size: .74rem; }

/* ── Timeline ──────────────────────────────────────────────────── */
#timeline-svg { background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); box-shadow: var(--ombre); padding: .8rem; overflow-x: auto; }
#timeline-svg svg { display: block; }
#timeline-svg text { fill: var(--encre); font-size: 12px; }
#timeline-svg .axe text { fill: var(--encre-2); font-size: 11px; }

/* ── Fiche produit ─────────────────────────────────────────────── */
.voile { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 60; }
.fiche {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  /* Élargie le 05/08/2026 : la fiche porte maintenant le comparatif des
     méthodes et les tableaux de containers, illisibles à 680 px. */
  width: min(820px, 96vw);
  background: var(--carte); border-left: 1px solid var(--trait);
  box-shadow: -12px 0 32px rgba(0, 0, 0, .18);
  overflow-y: auto; padding: 1.2rem 1.4rem 2rem;
}
.fiche .fermer {
  position: absolute; top: .8rem; right: .9rem;
  border: 0; background: var(--gris-fond); color: var(--encre-2);
  width: 2rem; height: 2rem; border-radius: 50%; font-size: 1rem;
}
.fiche h2 { margin: .2rem 0 0; font-size: 1.15rem; }
.fiche .sous { color: var(--encre-2); margin: .15rem 0 1rem; font-size: .9rem; }
.fiche .grille {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .6rem; margin: .8rem 0;
}
.fiche .cellule { background: var(--fond); border-radius: 8px; padding: .55rem .7rem; }
.fiche .cellule .l { font-size: .72rem; color: var(--encre-2); }
.fiche .cellule .v { font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .1rem; }
.fiche h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--encre-2); margin: 1.4rem 0 .5rem; }
.fiche svg { display: block; width: 100%; }
.fiche svg text { fill: var(--encre-2); font-size: 10px; }
.fiche .avert { background: var(--orange-fond); color: var(--orange);
  padding: .5rem .8rem; border-radius: 8px; font-size: .85rem; margin: .6rem 0; }

.form-ligne { display: flex; align-items: center; gap: .6rem; margin: .45rem 0; flex-wrap: wrap; }
.form-ligne label { min-width: 11rem; color: var(--encre-2); font-size: .88rem; }
.form-ligne input[type=number], .form-ligne select {
  padding: .35rem .55rem; border: 1px solid var(--trait); border-radius: 7px;
  background: var(--fond); width: 8rem;
}
.form-ok { color: var(--vert); font-size: .85rem; }
.form-erreur { color: var(--rouge); font-size: .85rem; }

/* ── Réglages ──────────────────────────────────────────────────── */
.bloc-reglage {
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: 1rem 1.2rem; margin-bottom: 1rem; max-width: 46rem;
}
.bloc-reglage h2 { margin: 0 0 .25rem; font-size: 1rem; }
.bloc-reglage .aide { color: var(--encre-2); font-size: .84rem; margin: 0 0 .8rem; }
.tableau-mini { width: 100%; font-size: .86rem; }
.tableau-mini th { text-align: left; color: var(--encre-2); font-weight: 600; padding: .3rem .4rem; }
.tableau-mini td { padding: .25rem .4rem; }
.tableau-mini input { width: 5.5rem; }

/* ── Login ─────────────────────────────────────────────────────── */
.login {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--fond); z-index: 100;
}
.login-carte {
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: 14px; box-shadow: var(--ombre);
  padding: 2.2rem 2.4rem; width: min(360px, 92vw);
  display: flex; flex-direction: column; gap: .8rem;
}
.login-carte h1 { margin: 0; font-size: 1.25rem; }
.login-carte .sous { margin: -0.5rem 0 .4rem; color: var(--encre-2); font-size: .88rem; }
.login-carte input {
  padding: .6rem .8rem; border: 1px solid var(--trait); border-radius: 8px; background: var(--fond);
}
.login-carte button {
  padding: .6rem; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.erreur { color: var(--rouge); font-size: .86rem; margin: 0; }

@media (max-width: 720px) {
  header { flex-wrap: wrap; gap: .5rem .8rem; }
  .etat-donnees { margin-left: 0; }
  .vue { padding: .8rem .6rem 3rem; }
  .kpis { padding: .8rem .6rem 0; }
}

/* ═══════════════════════════════════════════════════════════════════
   Fiche référence enrichie et vue Analyse (05/08/2026)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Bandeau de décision : ce qu'on lit en premier ────────────────
   Volontairement gros et coloré. Le reste de la fiche est de la
   justification ; ceci est la consigne. */
.decision {
  border-radius: var(--rayon); padding: .85rem 1rem; margin: .7rem 0;
  border-left: 4px solid var(--gris); background: var(--gris-fond);
}
.decision .quoi { font-size: 1.02rem; line-height: 1.45; }
.decision .pourquoi { color: var(--encre-2); font-size: .82rem; margin-top: .3rem; }
.decision.rouge  { border-left-color: var(--rouge);  background: var(--rouge-fond); }
.decision.orange { border-left-color: var(--orange); background: var(--orange-fond); }
.decision.jaune  { border-left-color: var(--jaune);  background: var(--jaune-fond); }
.decision.vert, .decision.ok { border-left-color: var(--vert); background: var(--vert-fond); }
.decision.attention { border-left-color: var(--orange); background: var(--orange-fond); }
.decision.neutre { border-left-color: var(--gris); }
.decision .urgence {
  display: inline-block; margin-left: .3rem; padding: .05rem .45rem;
  background: var(--rouge); color: #fff; border-radius: 4px;
  font-size: .82rem; font-weight: 700;
}

.fiche-entete { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.fiche-entete h2 { margin: 0; }
.fiche-entete .badges { display: flex; align-items: center; gap: .35rem; }
.badge.classe { background: var(--accent-fond); color: var(--accent); letter-spacing: .04em; }

/* ── Onglets internes à la fiche ─────────────────────────────────── */
.onglets-fiche {
  display: flex; gap: .15rem; margin: 1rem 0 .8rem;
  border-bottom: 1px solid var(--trait);
}
.onglets-fiche button {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: .45rem .8rem; cursor: pointer; color: var(--encre-2);
  font-size: .86rem; font-family: inherit;
}
.onglets-fiche button:hover { color: var(--encre); }
.onglets-fiche button.actif { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Encadré d'explication : pourquoi ce chiffre, pas seulement lequel. */
.explique {
  background: var(--accent-fond); border-radius: var(--rayon);
  padding: .65rem .8rem; font-size: .82rem; line-height: 1.5;
  color: var(--encre); margin: .6rem 0;
}
.explique code { font-size: .78rem; background: var(--carte); padding: .05rem .3rem; border-radius: 3px; }

/* ── Tableau comparatif des méthodes ─────────────────────────────── */
.tableau-mini.methodes td { font-size: .8rem; }
.tableau-mini tr.retenue { background: var(--vert-fond); }
.tableau-mini td.barre { width: 40%; padding-right: .5rem; }
.tableau-mini td.barre span {
  display: inline-block; height: 8px; background: var(--accent);
  opacity: .55; border-radius: 4px; vertical-align: middle;
}
.tableau-mini tr.retenue td.barre span { background: var(--vert); opacity: .8; }
.tableau-mini td.barre small { color: var(--encre-2); margin-left: .35rem; }
.tableau-mini.large { width: 100%; }
.tableau-mini th.courant, .tableau-mini td.courant {
  outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 700;
}
.tableau-mini td.num.vert { color: var(--vert); font-weight: 600; }
.tableau-mini td.num.orange { color: var(--orange); font-weight: 600; }
.tableau-mini tr.cliquable { cursor: pointer; }
.tableau-mini tr.cliquable:hover { background: var(--survol); }

/* ── Matrice ABC / XYZ ───────────────────────────────────────────── */
.matrice { border-collapse: separate; border-spacing: 3px; margin-top: .6rem; }
.matrice th {
  color: var(--encre-2); font-size: .8rem; font-weight: 600;
  padding: .2rem .5rem; text-align: center;
}
.matrice tbody th { text-align: right; }
.matrice td {
  /* --i porte l'intensité : le poids en valeur écoulée se lit d'un
     coup d'œil, sans avoir à comparer des nombres. */
  background: color-mix(in srgb, var(--accent) calc(var(--i, 0) * 55%), var(--carte));
  border: 1px solid var(--trait); border-radius: 6px;
  padding: .5rem .7rem; min-width: 92px; text-align: center;
  cursor: help;
}
.matrice td b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.matrice td small { display: block; color: var(--encre-2); font-size: .72rem; }
.matrice td em { display: block; color: var(--orange); font-size: .72rem; font-style: normal; font-weight: 600; }
.matrice td.vide { color: var(--encre-2); background: none; border-style: dashed; }
.matrice td.d, .matrice th.d { background: var(--gris-fond); }

.kpis.serre { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: .6rem 0; }

/* ── Vue Analyse : les blocs y portent des tableaux larges ───────────
   `.bloc-reglage` est plafonné à 46 rem, ce qui convient à un formulaire
   de réglages mais faisait déborder la liste du stock dormant hors de sa
   carte. Dans la vue Analyse, les blocs prennent la largeur disponible et
   les tableaux trop larges défilent à l'intérieur de leur carte plutôt
   que de la traverser. */
#analyse-contenu .bloc-reglage { max-width: 78rem; }
#analyse-contenu .tableau-mini.large { display: block; overflow-x: auto; }
#analyse-contenu .tableau-mini.large tbody,
#analyse-contenu .tableau-mini.large thead { display: table; width: 100%; }
#analyse-contenu .tableau-mini td.nom {
  max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#analyse-contenu .kpis.serre { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  #analyse-contenu .kpis.serre { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Statuts issus de l'éclatement du « gris » (05/08/2026) ──────────
   Le fourre-tout unique masquait 550 000 € de stock derrière un mot vague.
   Chaque situation a maintenant sa couleur, choisie pour ce qu'elle
   demande : l'orangé appelle une action humaine, le gris n'appelle rien. */
.pastille.a_verifier { background: transparent; border: 2px solid var(--orange); }
.pastille.pack       { background: var(--accent); opacity: .55; }
.pastille.peu_fiable { background: transparent; border: 1px dashed var(--gris); }
.pastille.sans_vente { background: var(--gris); opacity: .45; }

.badge.a_verifier { background: var(--orange-fond); color: var(--orange); }
.badge.pack       { background: var(--accent-fond); color: var(--accent); }
.badge.peu_fiable { background: var(--gris-fond); color: var(--gris); }
.badge.sans_vente { background: var(--gris-fond); color: var(--gris); }

.chip.actif[data-s=a_verifier] { background: var(--orange-fond); color: var(--orange); border-color: currentColor; }
.chip.actif[data-s=pack]       { background: var(--accent-fond); color: var(--accent); border-color: currentColor; }
.chip.actif[data-s=peu_fiable],
.chip.actif[data-s=sans_vente] { background: var(--gris-fond); color: var(--gris); border-color: currentColor; }

.decision.pack { border-left-color: var(--accent); background: var(--accent-fond); }
.decision.pack a { color: var(--accent); }

/* Encart qui explique un report de lot : bleu, informatif, pas alarmant. */
.encart-lot {
  background: var(--accent-fond); border-radius: var(--rayon);
  padding: .6rem .8rem; font-size: .82rem; line-height: 1.5; margin: .6rem 0;
}
.encart-lot code { background: var(--carte); padding: .05rem .3rem; border-radius: 3px; }

h2 .compte {
  font-size: .82rem; font-weight: 600; color: var(--encre-2);
  background: var(--gris-fond); border-radius: 999px; padding: .1rem .55rem;
  vertical-align: middle; margin-left: .4rem;
}

/* ── Statut « non suivi » ─────────────────────────────────────────────
   Barré plutôt que coloré : la référence existe, elle vit encore, mais
   elle est sortie du cycle de réapprovisionnement. Le barré dit « fin de
   parcours » là où une couleur d'alerte dirait « occupe-t'en ». */
.pastille.non_suivi { background: var(--gris); opacity: .35; }
.badge.non_suivi {
  background: transparent; color: var(--encre-2);
  border: 1px solid var(--trait); text-decoration: line-through;
}
.chip.actif[data-s=non_suivi] { background: var(--gris-fond); color: var(--encre-2); border-color: currentColor; }
.decision.non_suivi { border-left-color: var(--encre-2); background: var(--gris-fond); }
tbody tr[data-statut=non_suivi] td.ref { text-decoration: line-through; opacity: .75; }

/* ═══════════════════════════════════════════════════════════════════
   Comptes, identité et remontées (05/08/2026)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Connexion à deux modes ────────────────────────────────────────── */
.login-aide { margin: .6rem 0 0; text-align: center; font-size: .8rem; }
.login-aide a { color: var(--encre-2); text-decoration: none; border-bottom: 1px dotted; }
.login-aide a:hover { color: var(--accent); }

/* ── Identité dans la barre du haut ────────────────────────────────── */
.moi { position: relative; margin-left: .8rem; }
.moi-bouton {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0;
  background: none; border: 1px solid var(--trait); border-radius: 8px;
  padding: .3rem .6rem; line-height: 1.15; color: inherit;
}
.moi-bouton:hover { border-color: var(--accent); }
.moi-nom  { font-size: .82rem; font-weight: 600; white-space: nowrap; }
.moi-role { font-size: .7rem; color: var(--encre-2); white-space: nowrap; }
.moi-menu {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 50;
  background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); box-shadow: 0 6px 20px rgba(16, 24, 40, .16);
  padding: .6rem; min-width: 15rem; display: flex; flex-direction: column; gap: .4rem;
}
.moi-ligne { font-size: .8rem; color: var(--encre-2); }
.moi-avert {
  font-size: .78rem; line-height: 1.45; color: var(--orange);
  background: var(--orange-fond); border-radius: 7px; padding: .5rem .6rem;
}

/* ── Pastille de compteur (onglet, ligne, volet) ───────────────────── */
.pastille-nb {
  display: inline-block; min-width: 1.15rem; padding: 0 .3rem;
  background: var(--gris); color: #fff; border-radius: 999px;
  font-size: .68rem; font-weight: 700; text-align: center; vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.pastille-nb.urgent { background: var(--rouge); }
.pastille-nb.petite { font-size: .62rem; min-width: 1rem; }
nav#onglets .pastille-nb { margin-left: .3rem; }

/* ── Fil de remontées ──────────────────────────────────────────────── */
.fil { display: flex; flex-direction: column; gap: .5rem; }
.remontee {
  border: 1px solid var(--trait); border-left: 3px solid var(--gris);
  border-radius: 8px; padding: .55rem .75rem; background: var(--carte);
}
.remontee.urgente { border-left-color: var(--orange); }
/* Traitée : atténuée mais toujours lisible. Effacer l'historique d'une
   référence serait perdre le contexte d'anciennes décisions. */
.remontee.traitee { opacity: .58; border-left-color: var(--vert); }
.r-entete { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .8rem; }
.r-ref { font-weight: 600; color: var(--accent); text-decoration: none; }
.r-texte-lu { margin: .35rem 0 .2rem; white-space: pre-wrap; }
.r-pied { display: flex; align-items: center; gap: .6rem; font-size: .78rem; }
.r-pied .btn { padding: .2rem .55rem; font-size: .76rem; }

.form-remontee {
  background: var(--fond); border-radius: var(--rayon);
  padding: .7rem .85rem; margin: .6rem 0;
}
.form-remontee textarea {
  flex: 1; width: 100%; font: inherit; padding: .45rem .6rem; resize: vertical;
  border: 1px solid var(--trait); border-radius: 8px;
  background: var(--carte); color: inherit;
}
.form-remontee select, .form-remontee input {
  padding: .4rem .55rem; border: 1px solid var(--trait);
  border-radius: 8px; background: var(--carte);
}
.r-retour { font-size: .8rem; }
.r-aide { font-size: .78rem; color: var(--encre-2); margin: 0; }

/* Une affaire annoncée n'est PAS dans la quantité suggérée : le rappel doit
   trancher visuellement avec le reste du bandeau, sinon on croit l'inverse. */
.rappel-affaire {
  margin-top: .5rem; padding: .45rem .6rem; border-radius: 7px;
  background: var(--carte); border: 1px dashed var(--orange);
  color: var(--orange); font-size: .82rem;
}

/* ── Mot de passe provisoire : affiché une seule fois ───────────────── */
.mdp-provisoire {
  margin-top: .8rem; padding: .8rem 1rem; border-radius: var(--rayon);
  background: var(--vert-fond); border: 1px solid var(--vert);
  display: flex; flex-direction: column; gap: .4rem;
}
.mdp-valeur {
  font-family: "Cascadia Mono", Consolas, monospace; font-size: 1.3rem;
  font-weight: 700; letter-spacing: .06em; user-select: all;
  background: var(--carte); padding: .4rem .7rem; border-radius: 7px;
  align-self: flex-start;
}
.tableau-mini tr.inactive { opacity: .5; }
.tableau-mini tr.inactive b { text-decoration: line-through; }

/* Nom modifiable dans la liste des comptes : discret jusqu'au survol, pour
   ne pas transformer un tableau de consultation en formulaire. */
.c-nom-ligne {
  font: inherit; font-weight: 600; width: 11rem;
  border: 1px solid transparent; border-radius: 6px;
  padding: .2rem .35rem; background: transparent; color: inherit;
}
.c-nom-ligne:hover  { border-color: var(--trait); background: var(--carte); }
.c-nom-ligne:focus  { border-color: var(--accent); background: var(--carte); outline: none; }

/* ── Réponses : une conversation, pas une liste plate ────────────────
   Décalées et reliées par un filet à gauche : l'œil suit le fil sans
   avoir à lire les noms. Deux niveaux seulement — une arborescence
   profonde dans un outil de stock ne se lit plus. */
.reponses {
  margin: .5rem 0 .2rem .4rem; padding-left: .8rem;
  border-left: 2px solid var(--trait);
  display: flex; flex-direction: column; gap: .45rem;
}
.reponse .r-entete { gap: .4rem; font-size: .78rem; }
.reponse .r-texte-lu { margin: .1rem 0 0; font-size: .92rem; }

.form-reponse { margin-top: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.form-reponse textarea {
  width: 100%; font: inherit; padding: .45rem .6rem; resize: vertical;
  border: 1px solid var(--trait); border-radius: 8px;
  background: var(--carte); color: inherit;
}
.rp-actions { display: flex; align-items: center; gap: .5rem; }
.rp-actions .btn { padding: .25rem .7rem; font-size: .82rem; }
.rp-retour { font-size: .8rem; }

/* ── Cycle de vie de la fiche produit (06/08/2026) ──────────────────
   Une fiche non publiée ne peut rien vendre : elle est visible mais
   visiblement à l'écart, sans couleur d'alerte — il n'y a rien à faire
   d'urgent, juste à savoir. */
.pastille.hors_ligne { background: transparent; border: 1px dotted var(--encre-2); }
/* Sans fiche : moitié pleine, moitié vide — le stock existe, la fiche non. */
.pastille.hors_catalogue { background: linear-gradient(90deg, var(--encre-2) 50%, transparent 50%);
                           border: 1px solid var(--encre-2); }
.badge.hors_catalogue { background: color-mix(in srgb, var(--encre-2) 12%, transparent);
                        color: var(--encre-2); }
.badge.hors_ligne {
  background: transparent; color: var(--encre-2);
  border: 1px dotted var(--encre-2); font-weight: 500;
}
.chip.actif[data-s=hors_ligne] { background: var(--gris-fond); color: var(--encre-2); border-color: currentColor; }
tbody tr[data-statut=hors_ligne] td { opacity: .72; }

/* « Via composite » : le stock BOUGE, c'est une information utile, pas une
   anomalie — d'où l'accent plutôt qu'une couleur d'alerte. */
.pastille.consomme_composite { background: var(--accent); }
.badge.consomme_composite { background: var(--accent-fond); color: var(--accent); }
.chip.actif[data-s=consomme_composite] { background: var(--accent-fond); color: var(--accent); border-color: currentColor; }

td.fiche-col { font-size: .8rem; color: var(--encre-2); white-space: nowrap; }

/* ── Onglet Statistiques ─────────────────────────────────────────── */
.stats-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(26rem, 1fr));
                gap: 1rem; align-items: start; }
.stats-kpis { margin: .6rem 0 1rem; }
.stats-kpis .kpi { border: 1px solid var(--trait); }
.stats-barres { width: 100%; height: auto; display: block; margin: .4rem 0 .2rem; }
.stats-barres .barre { fill: var(--accent); opacity: .8; }
.stats-barres g:hover .barre { opacity: 1; }
.stats-barres text { font-size: 10px; fill: var(--encre-2); }
.stats-explo-resultat { border-top: 1px solid var(--trait); margin-top: .8rem; padding-top: .8rem; }
.stats-explo-resultat h3 { margin: 1rem 0 .4rem; }
.stats-explo-resultat .chip { cursor: default; }
#stats-contenu .ref a { text-decoration: none; }
#stats-contenu .ref a:hover { text-decoration: underline; }
#stats-contenu td.nom { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Historique du stock (fiche) ─────────────────────────────────── */
.fh-controles { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .4rem 0 .6rem; }
.fh-controles .chips { margin: 0; }
.fh-dates { color: var(--encre-2); font-size: .85rem; display: inline-flex; gap: .35rem; align-items: center; }
.fh-dates input[type=date] { background: var(--fond-2); color: var(--encre); border: 1px solid var(--trait);
                             border-radius: 6px; padding: .2rem .35rem; font: inherit; font-size: .85rem; }
.fh-graph { width: 100%; height: auto; display: block; margin-top: .4rem; }
.fh-graph text { font-size: 10px; fill: var(--encre-2); }
.fh-ligne { fill: none; stroke-width: 1.8; }
.fh-mesure { stroke: var(--accent); }
.fh-recon { stroke: var(--accent); opacity: .55; stroke-dasharray: 5 4; }
.fh-recu { stroke: var(--vert); stroke-width: 2.5; }
.fh-zero { stroke: var(--rouge); stroke-width: 1; stroke-dasharray: 2 3; opacity: .6; }
#fh-resume { margin-bottom: .2rem; }

/* ── Onglet Commandes ────────────────────────────────────────────── */
.cmd { border: 1px solid var(--trait); border-radius: 10px; margin: .5rem 0;
       background: var(--fond-2); }
.cmd summary { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem;
               cursor: pointer; list-style: none; flex-wrap: wrap; }
.cmd summary::-webkit-details-marker { display: none; }
.cmd[open] summary { border-bottom: 1px solid var(--trait); }
.cmd-ref { font-weight: 600; font-family: var(--mono, monospace); }
.cmd-fourn { color: var(--encre-2); font-size: .85rem; }
.cmd-eta { color: var(--encre-2); font-size: .85rem; white-space: nowrap; }
.cmd-prog { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem;
            color: var(--encre-2); min-width: 7.5rem; justify-content: flex-end; }
.cmd-barre { width: 5rem; height: 6px; border-radius: 3px; background: var(--trait);
             overflow: hidden; display: inline-block; }
.cmd-barre i { display: block; height: 100%; background: var(--vert); }
.cmd-recue { opacity: .8; }
.cmd-corps { padding: .5rem .8rem .8rem; }
.cmd-corps td.nom { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cmd-date-edit { margin: .2rem 0 .6rem; align-items: center; }
.cmd-date-edit label { display: inline-flex; gap: .4rem; align-items: center;
                       color: var(--encre-2); font-size: .85rem; }
.cmd-date-edit input[type=date] { background: var(--fond); color: var(--encre);
  border: 1px solid var(--trait); border-radius: 6px; padding: .25rem .4rem; font: inherit; }
.cmd-date-edit .cmd-note { min-width: 14rem; }

/* ── Onglet Arrivage ─────────────────────────────────────────────── */
.arr-mois { margin: 1.1rem 0 .4rem; display: flex; align-items: baseline; gap: .6rem; }
.arr-mois.arr-retard { color: var(--rouge); }
.arr-date { font-weight: 700; min-width: 7.5rem; }
.arr-vol { color: var(--encre-2); font-size: .85rem; white-space: nowrap; }
.arr-rupture td { background: color-mix(in srgb, var(--rouge) 7%, transparent); }
