/* Feuille de style de l'ERP BARA.
   Structure, composants et échelle typographique : Human Interface Guidelines d'Apple (ADR-003).
   Couleurs et polices : charte.md du 6 mai 2026 (docs/07), le brun bois tenant le rôle de couleur d'accent. */

@import url("fonts.af31607f79b8.css");

:root {
  /* Palette de la charte (docs/07), noms d'origine conservés. */
  --couleur-pilier: #916F45;
  --couleur-secondaire-1: #5A5A5C;
  --couleur-secondaire-2: #8894AB;
  --couleur-secondaire-3: #4F7A4D;
  --couleur-secondaire-4: #F2EBE0;
  --couleur-secondaire-5: #C97B3F;
  --couleur-alerte: #B5391C;
  --couleur-succes: #4F7A4D;
  --couleur-fond: #FBF8F2;
  --couleur-fond-alt: #FFFFFF;
  --couleur-texte: #2E2A26;
  --couleur-texte-alt: #000000;
  --couleur-texte-muted: #8894AB;

  /* Couleurs sémantiques à la manière des HIG, dérivées de la charte. */
  --tint: var(--couleur-pilier);
  --tint-presse: #7A5D39;
  --tint-leger: rgba(145, 111, 69, 0.12);
  --label: var(--couleur-texte);
  --label-secondaire: var(--couleur-secondaire-1);
  /* Texte tertiaire (notes, aides de champ, pieds de groupe) : bleu industriel assombri, 5,0:1 sur
     le fond principal, 4,5:1 sur la crème (niveau AA, docs/07 et ADR-003) ; le #8894AB de la charte
     reste pour les filets et les icônes (--filet), jamais pour du texte. */
  --label-tertiaire: #5F6B85;
  --filet: var(--couleur-secondaire-2);
  --fond-groupe: var(--couleur-fond);
  --fond-element: var(--couleur-fond-alt);
  --fond-remplissage: var(--couleur-secondaire-4);
  --separateur: rgba(46, 42, 38, 0.14);
  --materiau: rgba(251, 248, 242, 0.82);
  /* Verre liquide (HIG, iOS et macOS 26) : réservé à la couche de navigation, jamais au contenu. */
  --verre: rgba(255, 253, 249, 0.66);
  --verre-bord: rgba(255, 255, 255, 0.8);
  --verre-reflet: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -0.5px 0 rgba(46, 42, 38, 0.08);
  --verre-ombre: 0 10px 30px rgba(46, 42, 38, 0.12), 0 1px 3px rgba(46, 42, 38, 0.08);
  --verre-flou: saturate(190%) blur(24px);
  --rayon-verre: 22px;
  --fond-ligne-paire: #FDFBF7;          /* ligne paire de tableau, entre fond blanc et crème */
  --tint-presse-leger: rgba(145, 111, 69, 0.2);

  /* États : fonds légers et teintes « pressé » dérivés de la charte (jamais la couleur seule, docs/07). */
  --succes-leger: rgba(79, 122, 77, 0.14);
  --succes-presse: #3F633D;
  --attention-leger: rgba(201, 123, 63, 0.16);
  --attention-tres-leger: rgba(201, 123, 63, 0.10);
  --attention-texte: #874E22;           /* orange usinage assombri : AA (4,9:1) sur fond clair, blanc et crème */
  --alerte-leger: rgba(181, 57, 28, 0.12);
  --alerte-tres-leger: rgba(181, 57, 28, 0.08);
  --alerte-presse: #962F17;

  --police-titres: "Source Serif 4", Georgia, "Times New Roman", serif;
  --police-corps: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --police-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;

  /* Échelle typographique des HIG (taille par défaut). */
  --t-large-title: 2.125rem;  /* 34 */
  --t-title1: 1.75rem;        /* 28 */
  --t-title2: 1.375rem;       /* 22 */
  --t-title3: 1.25rem;        /* 20 */
  --t-headline: 1.0625rem;    /* 17 semi-gras */
  --t-body: 1.0625rem;        /* 17 */
  --t-callout: 1rem;          /* 16 */
  --t-subheadline: 0.9375rem; /* 15 */
  --t-footnote: 0.8125rem;    /* 13 */
  --t-caption: 0.75rem;       /* 12 */

  --rayon-petit: 8px;
  --rayon: 10px;
  --rayon-grand: 14px;
  --cible: 44px;              /* cible tactile minimale des HIG */
  --cible-atelier: 56px;      /* atelier : au-delà des 48 px de docs/07 */
  --largeur-barre-laterale: 15rem;
  --largeur-contenu: 64rem;
  --ombre: 0 1px 2px rgba(46, 42, 38, 0.06), 0 4px 16px rgba(46, 42, 38, 0.05);
  --transition: 180ms cubic-bezier(0.25, 0.1, 0.25, 1);

  /* Thème clair seulement : la charte fixe le fond #FBF8F2 et le logo sur fond clair (docs/07).
     « only » empêche aussi l'assombrissement automatique de certains navigateurs. */
  color-scheme: only light;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond-groupe);
  color: var(--label);
  font-family: var(--police-corps);
  font-size: var(--t-body);
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Titres : jamais en majuscules, ni soulignés, ni en italique (docs/07). */
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.titre-large, h1 {
  font-family: var(--police-titres); font-size: var(--t-large-title); line-height: 1.2;
  color: var(--tint); letter-spacing: -0.01em;
}
h2 { font-family: var(--police-titres); font-size: var(--t-title2); line-height: 1.27; color: var(--tint); }
h3 { font-family: var(--police-titres); font-size: var(--t-title3); font-weight: 500; line-height: 1.25; }
h4 { font-size: var(--t-headline); line-height: 1.3; }

p { margin: 0 0 0.75rem; }
/* Liens en corps de page : teinte « pressée » (5,7:1 sur le fond, AA) ; le brun bois reste aux boutons. */
a { color: var(--tint-presse); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--tint); outline-offset: 2px; border-radius: 4px; }

.secondaire { color: var(--label-secondaire); }
.note, small { font-size: var(--t-footnote); color: var(--label-tertiaire); }
.legende { font-size: var(--t-caption); color: var(--label-tertiaire); }
/* Indicateur d'attente d'un appel HTMX (hx-indicator) : visible pendant la requête seulement. */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
.visuellement-cache {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
code, .code-technique { font-family: var(--police-mono); font-size: 0.9em; }
.code-technique { overflow-wrap: anywhere; }

.lien-evitement {
  position: absolute; left: -999px; top: 0.5rem; z-index: 50;
  background: var(--fond-element); padding: 0.5rem 1rem; border-radius: var(--rayon);
}
.lien-evitement:focus { left: 0.5rem; }

/* ---------- Disposition : barre latérale + zone de contenu (style iPadOS et macOS) ---------- */
.app { display: grid; grid-template-columns: var(--largeur-barre-laterale) 1fr; min-height: 100vh; }
.app--sans-barre { grid-template-columns: 1fr; }
/* Sans min-width: 0, un tableau large élargit la colonne de grille et fait défiler toute la page. */
.zone-contenu { min-width: 0; }

.barre-laterale {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--fond-remplissage);
  border-right: 0.5px solid var(--separateur);
  padding: 1rem 0.75rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.barre-laterale__section { font-size: var(--t-footnote); font-weight: 600; color: var(--label-secondaire); padding: 0 0.75rem; margin: 0.5rem 0 0.25rem; }
.barre-laterale ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.barre-laterale a {
  display: flex; align-items: center; gap: 0.625rem; min-height: 36px; padding: 0.375rem 0.75rem;
  border-radius: var(--rayon-petit); color: var(--label); font-size: var(--t-subheadline); font-weight: 500;
}
.barre-laterale a:hover { background: var(--tint-leger); text-decoration: none; }
.barre-laterale a[aria-current="page"] { background: var(--tint); color: var(--fond-element); }
.barre-laterale a[aria-current="page"] .icone { color: var(--fond-element); }
.barre-laterale__pied { margin-top: auto; font-size: var(--t-footnote); color: var(--label-secondaire); padding: 0 0.75rem; }

.icone { width: 1.125rem; height: 1.125rem; flex: none; color: var(--tint); }

/* Barre d'outils translucide en tête du contenu. */
.barre-outils {
  position: sticky; top: 0; z-index: 20;
  background: var(--materiau);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separateur);
}
.barre-outils__interieur {
  max-width: var(--largeur-contenu); margin: 0 auto; min-height: 52px; padding: 0.5rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.barre-outils__titre { font-size: var(--t-headline); font-weight: 600; }
.barre-outils__actions { display: flex; align-items: center; gap: 0.75rem; font-size: var(--t-subheadline); }
.barre-outils__page { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.barre-outils__page:empty { display: none; }
.barre-outils__logo { display: none; }
/* 80 px de large au minimum à l'écran (docs/07). */
.barre-outils__logo img { width: 80px; height: auto; display: block; }

.bandeau-environnement {
  background: var(--attention-leger); color: var(--attention-texte);
  text-align: center; font-size: var(--t-footnote); font-weight: 600; padding: 0.25rem 1rem;
}

main { width: 100%; max-width: var(--largeur-contenu); margin: 0 auto; padding: 1.5rem 1.5rem 4rem; }
.entete-page { margin: 0.5rem 0 1.5rem; }
.entete-page .secondaire { margin-top: 0.25rem; }

/* Barre d'onglets en bas d'écran sur téléphone (style iOS). */
.barre-onglets { display: none; }

/* ---------- Listes groupées en encart (« inset grouped ») ---------- */
.groupe { margin: 0 0 2rem; }
.groupe__titre {
  font-size: var(--t-footnote); color: var(--label-secondaire); font-weight: 400;
  margin: 0 1rem 0.375rem; font-family: var(--police-corps);
}
.groupe__pied { font-size: var(--t-footnote); color: var(--label-tertiaire); margin: 0.375rem 1rem 0; }
.liste {
  list-style: none; margin: 0; padding: 0;
  background: var(--fond-element); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre);
}
.liste > li { position: relative; }
.liste > li + li::before {
  content: ""; position: absolute; top: 0; left: 1rem; right: 0; border-top: 0.5px solid var(--separateur);
}
.ligne {
  display: flex; align-items: center; gap: 0.75rem; min-height: var(--cible); padding: 0.625rem 1rem;
  color: var(--label);
}
a.ligne:hover { background: var(--tint-leger); text-decoration: none; }
a.ligne::after {
  content: ""; width: 0.5rem; height: 0.5rem; margin-left: auto; flex: none;
  border-right: 2px solid var(--filet); border-top: 2px solid var(--filet);
  transform: rotate(45deg);
}
.ligne__texte { flex: 1; min-width: 0; }
.ligne__titre { display: block; }
.ligne__detail { display: block; font-size: var(--t-subheadline); color: var(--label-secondaire); }
.ligne__valeur { color: var(--label-secondaire); text-align: right; font-variant-numeric: tabular-nums; }
/* Libellé jamais écrasé lettre par lettre (recette du 18/10, T19) : une valeur ou des boutons trop
   larges passent sous le libellé au lieu de le réduire à une colonne d'une lettre. */
.ligne:not(a) { flex-wrap: wrap; }
.ligne:not(a) > .ligne__texte { flex: 1 1 12rem; }
.ligne > .ligne__valeur, .ligne > .actions-ligne { min-width: 0; overflow-wrap: break-word; }
/* Ligne empilée : texte en haut, boutons dessous (accusés de réception, envois). */
.ligne.ligne--empilee { flex-direction: column; align-items: stretch; }
.ligne.ligne--empilee > .ligne__texte { flex: none; }
/* Ligne qui est un bouton de formulaire (« Se déconnecter » de l'écran « Plus ») : aspect d'une ligne. */
.ligne-formulaire { margin: 0; }
.ligne--bouton {
  width: 100%; border: none; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--tint);
}
.ligne--bouton:hover { background: var(--tint-leger); }

/* Cartes (tableau de bord) */
.grille { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin-bottom: 2rem; }
.carte {
  background: var(--fond-element); border-radius: var(--rayon-grand); padding: 1.25rem; box-shadow: var(--ombre);
}
.carte__titre { display: block; font-size: var(--t-subheadline); font-weight: 600; color: var(--label-secondaire); margin-bottom: 0.5rem; font-family: var(--police-corps); }
.carte__valeur { display: block; font-family: var(--police-titres); font-size: var(--t-title1); font-weight: 600; color: var(--tint); line-height: 1.15; }
.carte--lien { display: block; color: var(--label); }
.carte--lien:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--tint-leger), var(--ombre); }

/* Fiche (liste de définitions) : libellé à gauche, valeur à droite, valeurs longues renvoyées à la ligne. */
.fiche { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 0.375rem 1rem; margin: 0; }
.fiche dt { color: var(--label-secondaire); font-size: var(--t-subheadline); }
.fiche dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.fiche dt { min-width: 0; overflow-wrap: break-word; }

.encadre { background: var(--fond-remplissage); border-radius: var(--rayon); padding: 1rem 1.25rem; margin: 1rem 0; }
.encadre--pefc { border-left: 4px solid var(--couleur-secondaire-3); }
.encadre--succes { border-left: 4px solid var(--couleur-succes); }
.encadre--attention { border-left: 4px solid var(--couleur-secondaire-5); }
.encadre--alerte { border-left: 4px solid var(--couleur-alerte); }

/* ---------- Tableaux ---------- */
.tableau-conteneur { position: relative; overflow-x: auto; background: var(--fond-element); border-radius: var(--rayon); box-shadow: var(--ombre); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-subheadline); }
th {
  background: var(--fond-remplissage); color: var(--label-secondaire); text-align: left; font-weight: 600;
  font-size: var(--t-footnote); padding: 0.625rem 1rem; border-bottom: 0.5px solid var(--separateur);
}
td { padding: 0.625rem 1rem; border-bottom: 0.5px solid var(--separateur); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: var(--fond-ligne-paire); }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
/* Tableau dense : sur la table ou sur son conteneur. */
.tableau-dense th, .tableau-dense td { padding: 0.5rem 0.625rem; }
.tableau-dense td.nombre { white-space: nowrap; }
.tableau-dense tfoot td { font-weight: 600; background: var(--fond-remplissage); }

/* ---------- Boutons (rempli, teinté, contour, simple) ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--cible); padding: 0.5rem 1.25rem; border: none; border-radius: var(--rayon);
  background: var(--tint); color: var(--fond-element);
  font: inherit; font-size: var(--t-body); font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer; text-decoration: none; transition: background var(--transition), transform var(--transition);
}
.bouton:hover { background: var(--tint-presse); text-decoration: none; color: var(--fond-element); }
.bouton:active { transform: scale(0.98); }
.bouton--teinte { background: var(--tint-leger); color: var(--tint); }
.bouton--teinte:hover { background: var(--tint-presse-leger); color: var(--tint); }
.bouton--contour { background: transparent; color: var(--tint); box-shadow: inset 0 0 0 1.5px var(--tint); }
.bouton--contour:hover { background: var(--tint-leger); color: var(--tint); }
.bouton--simple { background: none; color: var(--tint); padding: 0.25rem 0.5rem; min-height: 0; font-weight: 500; }
.bouton--simple:hover { background: var(--tint-leger); color: var(--tint); }
.bouton--destructif { background: var(--couleur-alerte); }
.bouton--destructif:hover { background: var(--alerte-presse); }
/* Action destructrice discrète (supprimer une ligne, révoquer) : texte rouge d'alerte, sans aplat (HIG). */
.bouton--simple.bouton--destructif { background: none; color: var(--couleur-alerte); }
.bouton--simple.bouton--destructif:hover { background: var(--alerte-tres-leger); color: var(--couleur-alerte); }
.bouton--plein { width: 100%; }
.bouton--petit { min-height: 36px; padding: 0.25rem 0.75rem; font-size: var(--t-subheadline); }
.bouton--grand { min-height: 50px; font-size: var(--t-headline); border-radius: var(--rayon-grand); }

/* ---------- Champs ---------- */
.champ { margin-bottom: 1rem; }
.champ label { display: block; font-size: var(--t-footnote); color: var(--label-secondaire); margin: 0 0 0.375rem 0.25rem; }
.champ input, .champ select, .champ textarea {
  width: 100%; min-height: var(--cible); padding: 0.625rem 0.875rem; font: inherit; color: var(--label);
  background: var(--fond-element); border: 0.5px solid var(--separateur); border-radius: var(--rayon);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.champ input:focus, .champ select:focus, .champ textarea:focus {
  outline: none; border-color: var(--tint); box-shadow: 0 0 0 4px var(--tint-leger);
}
.champ .erreur { color: var(--couleur-alerte); font-size: var(--t-footnote); margin: 0.375rem 0 0 0.25rem; }
.champ .aide { font-size: var(--t-footnote); color: var(--label-tertiaire); margin: 0.375rem 0 0 0.25rem; }

/* Champs regroupés dans une liste (formulaire façon Réglages). */
.liste .champ { margin: 0; }
.liste .champ input { border: none; border-radius: 0; box-shadow: none; }

/* ---------- Messages : la couleur ne porte jamais seule le sens (docs/07) ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.5rem; }
.message {
  display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.875rem 1rem;
  background: var(--fond-element); border-radius: var(--rayon); box-shadow: var(--ombre); font-size: var(--t-subheadline);
}
.message::before {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 1.375rem; height: 1.375rem; border-radius: 50%; color: var(--fond-element);
  font-size: var(--t-footnote); font-weight: 700; background: var(--couleur-secondaire-2); content: "i";
}
.message--success::before { content: "\2713"; background: var(--couleur-succes); }
.message--warning::before { content: "!"; background: var(--couleur-secondaire-5); }
.message--error::before { content: "\00D7"; background: var(--couleur-alerte); }
.message strong { display: block; }
/* Message ramené en vue (static/js/messages.js) : jamais caché sous l'en-tête collant (CR-02). */
.messages, .erreur { scroll-margin-top: 4.5rem; }
.messages--bandeau {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 25; width: min(40rem, calc(100% - 2rem));
  margin: 0; padding: 0.5rem; border-radius: var(--rayon-grand);
  background: var(--verre); -webkit-backdrop-filter: var(--verre-flou); backdrop-filter: var(--verre-flou);
  border: 0.5px solid var(--verre-bord); box-shadow: var(--verre-reflet), var(--verre-ombre);
}
.messages__fermer { justify-self: end; }

/* Pastilles */
.badge {
  display: inline-flex; align-items: center; min-height: 1.375rem; padding: 0 0.625rem; border-radius: 999px;
  font-size: var(--t-footnote); font-weight: 600; background: var(--fond-remplissage); color: var(--label-secondaire);
}
.badge--pefc, .badge--succes { background: var(--succes-leger); color: var(--couleur-secondaire-3); }
.badge--attention { background: var(--attention-leger); color: var(--attention-texte); }
.badge--alerte { background: var(--alerte-leger); color: var(--couleur-alerte); }

/* Contrôle segmenté : sous-navigation (aria-current="page") ou filtre (aria-current="true", aria-pressed). */
.segments {
  display: inline-flex; flex-wrap: wrap; max-width: 100%;
  background: var(--fond-remplissage); border-radius: var(--rayon-petit); padding: 2px; gap: 2px;
}
.segments a, .segments button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 32px;
  border: none; background: none; font: inherit; font-size: var(--t-subheadline); font-weight: 500;
  padding: 0.3rem 0.875rem; border-radius: 6px; color: var(--label); cursor: pointer; text-decoration: none;
}
.segments a:hover { text-decoration: none; background: var(--tint-leger); }
.segments [aria-current="page"], .segments [aria-current="true"], .segments [aria-pressed="true"] {
  background: var(--fond-element); box-shadow: var(--ombre);
}
.segments .compte { color: var(--label-tertiaire); font-variant-numeric: tabular-nums; margin-left: 0.25rem; }

/* Pastille de compte (barre latérale, écran « Plus ») : un nombre, toujours doublé d'un texte caché. */
.barre-laterale__libelle { flex: 1; min-width: 0; }
.pastille-compte {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.375rem; height: 1.375rem;
  padding: 0 0.375rem; border-radius: 999px; background: var(--tint-leger); color: var(--tint);
  font-size: var(--t-caption); font-weight: 600; font-variant-numeric: tabular-nums;
}
.barre-laterale a[aria-current="page"] .pastille-compte { background: var(--fond-element); }
.ligne .pastille-compte { margin-left: auto; }

/* ---------- « À faire » ---------- */
.a-faire__contenu { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); align-items: start; }
.a-faire__contenu > .a-faire__vide, .a-faire__contenu > div[hx-get] { grid-column: 1 / -1; }
.a-faire__titre { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
.a-faire__note { color: var(--label-tertiaire); }
.a-faire__tout { color: var(--tint); font-size: var(--t-subheadline); }
.a-faire__attente { margin: 0 1rem; }
.ligne--alerte { box-shadow: inset 3px 0 0 var(--couleur-alerte); }
.grille--compacte { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.75rem; margin-bottom: 0; }
.carte--compacte { padding: 0.875rem 1rem; border-radius: var(--rayon); }
.carte--compacte .carte__titre { font-size: var(--t-footnote); margin-bottom: 0.25rem; }
.carte--compacte .carte__valeur { font-size: var(--t-title3); }
.carte--compacte .note { margin: 0.25rem 0 0; }

/* Sous-navigation d'un module chargé : rangée principale (contrôle segmenté), puis une rangée discrète
   « Paramétrage » et « Voir aussi » pour les écrans rares (ADR-003, note du 10/10/2026). */
.navigation-module { margin: 0 0 1.25rem; display: grid; gap: 0.5rem; justify-items: start; }
.navigation-module .sous-navigation { margin: 0; }
.navigation-module__secondaire {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin: 0 0.25rem;
  font-size: var(--t-footnote); color: var(--label-secondaire);
}
.navigation-module__secondaire ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.125rem 0.25rem; margin: 0; padding: 0; }
.navigation-module__secondaire a { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 6px; }
.navigation-module__secondaire a[aria-current="page"] { background: var(--tint-leger); font-weight: 600; text-decoration: none; }
.navigation-module__intitule { font-weight: 600; }

/* Menu « Dans ce module » (contre-recette du 18/10, CR-02) : sur poste, la sous-navigation est toujours
   dépliée et le titre du menu masqué ; sous 640 px, elle est repliée derrière ce titre pour que le
   contenu de l'écran vienne en premier. Aucun script : élément details natif. */
.menu-module__titre { display: none; }
@media (min-width: 40.0625rem) {
  .menu-module::details-content { content-visibility: visible; display: contents; }
}
@media (max-width: 40rem) {
  .menu-module { margin: 0 0 1rem; }
  .menu-module__titre {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: var(--cible);
    padding: 0.5rem 1rem; border-radius: var(--rayon); background: var(--tint-leger); color: var(--tint);
    font-weight: 600; font-size: var(--t-subheadline); cursor: pointer; list-style: none;
  }
  .menu-module__titre::-webkit-details-marker { display: none; }
  .menu-module__titre::after {
    content: ""; width: 0.5rem; height: 0.5rem; flex: none; margin: 0 0.25rem 0.25rem 0;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
    transition: transform var(--transition);
  }
  .menu-module[open] > .menu-module__titre::after { transform: rotate(225deg); margin-bottom: -0.25rem; }
  /* Menu ouvert : une entrée par ligne, cibles de 44 px, l'écran en cours marqué. */
  .menu-module[open] > nav, .menu-module[open] > nav > .segments {
    display: flex; flex-direction: column; align-items: stretch; gap: 0.125rem; margin: 0.5rem 0 0;
    width: 100%; background: var(--fond-element); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 0.25rem;
  }
  .menu-module[open] > nav > .segments { box-shadow: none; padding: 0; margin: 0; }
  .menu-module[open] .segments a { justify-content: flex-start; text-align: left; border-radius: var(--rayon-petit); }
  .menu-module[open] .navigation-module__secondaire { margin: 0.5rem 0.75rem 0.25rem; }
}

/* ---------- Écran de connexion (feuille centrée) ---------- */
.ecran-centre { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.feuille { width: 100%; max-width: 26rem; }
.feuille__logo { display: block; width: 180px; margin: 0 auto 1.5rem; background: var(--fond-element); padding: 0.75rem; border-radius: var(--rayon-grand); box-shadow: var(--ombre); }
.feuille__logo img { width: 100%; height: auto; display: block; }
.feuille h1 { text-align: center; margin-bottom: 0.5rem; }
.feuille .sous-titre { text-align: center; color: var(--label-secondaire); margin-bottom: 1.75rem; }
.separateur { display: flex; align-items: center; gap: 0.75rem; color: var(--label-tertiaire); margin: 1.25rem 0; font-size: var(--t-footnote); }
.separateur::before, .separateur::after { content: ""; flex: 1; border-top: 0.5px solid var(--separateur); }

/* Mention de l'auteur de l'ERP : discrète, dans l'interface seulement (jamais sur les documents clients). */
.credit { font-size: var(--t-caption); color: var(--label-secondaire); text-align: center; margin: 1rem 0 0; }
/* Lien de 44 px au moins (HIG), 56 px à l'atelier. */
.credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; display: inline-flex; align-items: center; min-height: var(--cible); }
.ecran-centre { grid-template-rows: 1fr auto; }
.ecran-centre .feuille { align-self: center; }

/* ---------- Écrans atelier : grandes cibles, contraste fort, une action par écran (docs/07) ---------- */
.atelier .champ input { font-size: 1.75rem; min-height: var(--cible-atelier); text-align: center; letter-spacing: 0.15em; }
.atelier .bouton { min-height: var(--cible-atelier); font-size: 1.25rem; }
.atelier .champ label { font-size: var(--t-headline); color: var(--label); font-weight: 600; }
/* Liens texte de l'atelier (changer de badge, revenir) : cible de 56 px aussi. */
.atelier .groupe__pied a { display: inline-flex; align-items: center; min-height: var(--cible-atelier); }
.atelier .credit a { min-height: var(--cible-atelier); }
/* Listes de cibles de l'atelier (ordres de fabrication, fiches de perçage) : 64 px, une seule définition. */
.cibles-atelier { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.cible-atelier {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; min-height: 64px;
  padding: 1rem 1.25rem; background: var(--fond-element); border-radius: var(--rayon-grand); box-shadow: var(--ombre);
  color: var(--label); cursor: pointer;
}
.cible-atelier:hover { text-decoration: none; background: var(--tint-leger); }
.cible-atelier__titre { font-size: var(--t-title3); font-weight: 600; flex: 1 1 auto; }
.cible-atelier__detail { font-size: var(--t-body); color: var(--label-secondaire); flex: 1 1 100%; }
.cible-atelier input[type="radio"] { width: 1.75rem; height: 1.75rem; accent-color: var(--tint); flex: none; }

.sprite { display: none; }
.centre { text-align: center; }
.espace-haut { margin-top: 1rem; }

.liste-simple { padding-left: 1.25rem; margin: 0; }

/* Filtres du journal des modifications et pagination (recette du 18/10, T35). */
.filtres-journal {
  display: grid; gap: 0 1rem; align-items: end; margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
}
.filtres-journal__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 1rem 0; }
.journal-modifications td:nth-child(1), .journal-modifications td:nth-child(3) { white-space: nowrap; }
.journal-modifications td:nth-child(2) { min-width: 9rem; }
.journal-modifications td:nth-child(4) { min-width: 14rem; }
.journal-modifications td:nth-child(5) { min-width: 16rem; }
@media (max-width: 40rem) { .journal-modifications td:nth-child(n) { min-width: 0; white-space: normal; } }

/* Recherche : champ et bouton sur une ligne, le champ se rétrécit sur téléphone. */
.recherche { display: flex; gap: 0.5rem; margin-bottom: 1rem; max-width: 32rem; min-width: 0; }
.recherche input[type="search"] {
  flex: 1; min-width: 0; min-height: var(--cible); padding: 0 0.875rem; font: inherit; color: var(--label);
  background: var(--fond-element); border: 0.5px solid var(--separateur); border-radius: var(--rayon);
}

/* ---------- Téléphone : barre latérale remplacée par une barre d'onglets ---------- */
/* Textes longs : retour à la ligne plutôt que défilement de toute la page. */
main { overflow-wrap: break-word; }   /* noms de fichier, références, adresses longues */
main .note, main .ligne__detail, main td { overflow-wrap: anywhere; }

@media (max-width: 52rem) {
  /* En-tête sur une seule ligne (recette du 18/10, T41) : logo, actions de la page qui défilent si
     elles sont nombreuses, bouton « ? » toujours visible ; « Se déconnecter » passe dans « Plus ». */
  .barre-outils__interieur { flex-wrap: nowrap; gap: 0.5rem; min-height: 48px; padding: 0.25rem 1rem; }
  .barre-outils__titre { display: none; }
  .barre-outils__actions { flex: 1; min-width: 0; justify-content: flex-end; gap: 0.25rem; }
  .barre-outils__page {
    flex-wrap: nowrap; gap: 0.25rem; min-width: 0; overflow-x: auto;
    scrollbar-width: none;
  }
  .barre-outils__page::-webkit-scrollbar { display: none; }
  .barre-outils__page .bouton { white-space: nowrap; flex: none; }
  .barre-outils__deconnexion { display: none; }
  .barre-outils__logo img { width: 80px; }
  .app { grid-template-columns: 1fr; }
  .barre-laterale { display: none; }
  .barre-outils__logo { display: block; }
  main { padding: 1rem 1rem 6rem; }
  .barre-onglets {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--materiau);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--separateur); padding: 0.25rem 0 calc(0.25rem + env(safe-area-inset-bottom));
  }
  .barre-onglets a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: var(--cible);
    justify-content: center; font-size: 0.625rem; font-weight: 500; color: var(--label-tertiaire);
  }
  .barre-onglets a .icone { width: 1.5rem; height: 1.5rem; color: currentColor; }
  .barre-onglets a[aria-current="page"] { color: var(--tint); }
  .barre-onglets a:hover { text-decoration: none; }
}

/* Moins de 640 px (recette du 18/10, T19 et T41) : libellé et valeur empilés, tableaux marqués
   « tableau-cartes » lus en cartes (une carte par ligne, chaque valeur précédée de son en-tête). */
@media (max-width: 40rem) {
  .ligne:not(a) > .ligne__texte { flex-basis: 100%; }
  .ligne:not(a) > .ligne__valeur { flex-basis: 100%; text-align: left; color: var(--label); }
  .fiche { grid-template-columns: minmax(0, 1fr); gap: 0.125rem; }
  .fiche dd { margin-bottom: 0.5rem; }
  .tableau-conteneur:has(.tableau-cartes) { background: none; box-shadow: none; overflow: visible; }
  .tableau-cartes, .tableau-cartes tbody, .tableau-cartes tr, .tableau-cartes td { display: block; width: 100%; }
  .tableau-cartes.tableau-large { min-width: 0; }
  .tableau-cartes thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .tableau-cartes tr {
    background: var(--fond-element); border-radius: var(--rayon); box-shadow: var(--ombre);
    padding: 0.5rem 1rem; margin-bottom: 0.75rem;
  }
  .tableau-cartes tbody tr:nth-child(even) td { background: none; }
  .tableau-cartes td {
    display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr); gap: 0.75rem;
    padding: 0.375rem 0; border-bottom: 0.5px solid var(--separateur); text-align: left;
  }
  .tableau-cartes tr td:last-child { border-bottom: none; }
  .tableau-cartes td.nombre { text-align: left; }
  /* Contenu d'une cellule (texte, précision, pastille) toujours dans la colonne des valeurs. */
  .tableau-cartes td > * { grid-column: 2; }
  .tableau-cartes td > br { display: none; }
  .tableau-cartes td > .badge, .tableau-cartes td > .bouton { justify-self: start; }
  .tableau-cartes td::before {
    content: attr(data-libelle); color: var(--label-secondaire); font-size: var(--t-footnote); font-weight: 600;
  }
  .tableau-cartes td:not([data-libelle]), .tableau-cartes td[data-libelle=""] { display: block; }
  .tableau-cartes td:not([data-libelle])::before, .tableau-cartes td[data-libelle=""]::before { content: none; }
  /* Contre-recette du 18/10 (CR-02) : tous les tableaux de l'ERP en cartes. Les largeurs minimales et
     les cellules sans retour à la ligne des feuilles de module ne s'appliquent plus aux cartes. */
  .tableau-cartes, .tableau-cartes th, .tableau-cartes td { min-width: 0 !important; white-space: normal !important; }
  .tableau-cartes tfoot { display: block; width: 100%; }
  .tableau-cartes tfoot tr { background: var(--fond-remplissage); }
  .tableau-cartes tfoot td { background: none; }
  /* En-tête de ligne (section, semaine, fournisseur) : titre de la carte. */
  .tableau-cartes tbody th, .tableau-cartes tfoot th {
    display: block; width: 100%; padding: 0.25rem 0 0.375rem; background: none; text-align: left;
    font-size: var(--t-subheadline); color: var(--label); border-bottom: 0.5px solid var(--separateur);
  }
  /* Rangée de groupe (« Bloquant », « À vérifier ») : intitulé au-dessus des cartes du groupe. */
  .tableau-cartes tr:has(> th[scope="rowgroup"]) { background: none; box-shadow: none; padding: 0.5rem 0 0; margin: 0; }
  .tableau-cartes th[scope="rowgroup"] { border-bottom: none; color: var(--label-secondaire); font-size: var(--t-footnote); }
  .tableau-cartes td:empty { display: none; }
  /* Tableaux de bord (lundi, PEFC) : indicateurs et alertes avant les filtres de période. */
  .tete-ecran { display: flex; flex-direction: column; }
  .tete-ecran > .barre-filtres { order: 1; }
  /* Cartes d'indicateurs courtes (taux, statut) : deux par rangée pour tout voir sans défiler. */
  .grille--deux-colonnes-telephone { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
  .grille--deux-colonnes-telephone .carte { padding: 0.75rem; }
  .grille--deux-colonnes-telephone .carte__titre { font-size: var(--t-footnote); margin-bottom: 0.25rem; }
  .grille--deux-colonnes-telephone .carte__valeur { font-size: var(--t-title2); }
  .tableau-cartes caption:not(.visuellement-cache) { display: block; text-align: left; margin-bottom: 0.5rem; }
}

/* Écran tactile ou téléphone : toutes les cibles à 44 px au moins (HIG, ADR-003). */
@media (pointer: coarse), (max-width: 52rem) {
  .bouton--simple, .bouton--petit, .segments a, .segments button { min-height: var(--cible); }
  .barre-laterale a { min-height: var(--cible); }
  .groupe__pied a, .ligne__valeur a { display: inline-flex; align-items: center; min-height: var(--cible); }
  .navigation-module__secondaire a { min-height: var(--cible); }
}

/* ---------- Verre liquide : barre latérale flottante, barre d'outils, barre d'onglets en capsule ----------
   Effet en CSS seul (backdrop-filter) : aucun script, compatible avec la politique de sécurité stricte,
   sans capture de page ni WebGL. Le contenu (listes, tableaux, fiches) reste opaque pour la lisibilité. */
.barre-laterale {
  top: 0.5rem; height: calc(100vh - 1rem); margin: 0.5rem 0 0.5rem 0.5rem;
  background: var(--verre);
  -webkit-backdrop-filter: var(--verre-flou); backdrop-filter: var(--verre-flou);
  border: 0.5px solid var(--verre-bord); border-radius: var(--rayon-verre);
  box-shadow: var(--verre-reflet), var(--verre-ombre);
}
/* Barre plus haute que l'écran : elle défile, ses éléments ne se tassent pas (logo écrasé sinon). */
.barre-laterale > * { flex-shrink: 0; }
.barre-outils {
  background: var(--verre);
  -webkit-backdrop-filter: var(--verre-flou); backdrop-filter: var(--verre-flou);
  box-shadow: var(--verre-reflet);
}
@media (max-width: 52rem) {
  main { padding-bottom: 7rem; }
  .barre-onglets {
    left: 0.75rem; right: 0.75rem; bottom: calc(0.5rem + env(safe-area-inset-bottom));
    padding: 0.25rem; border-radius: 999px;
    background: var(--verre);
    -webkit-backdrop-filter: var(--verre-flou); backdrop-filter: var(--verre-flou);
    border: 0.5px solid var(--verre-bord);
    box-shadow: var(--verre-reflet), var(--verre-ombre);
  }
  .barre-onglets a { border-radius: 999px; }
  .barre-onglets a[aria-current="page"] { background: var(--tint-leger); }
}

/* Écrans centrés (connexion, atelier, consentement, erreurs) : fond dégradé aux couleurs de la charte,
   statique (pas d'animation : téléphones de l'atelier), feuille en verre par-dessus. */
.ecran-centre {
  background:
    radial-gradient(60rem 40rem at 10% 0%, rgba(145, 111, 69, 0.22), transparent 60%),
    radial-gradient(50rem 36rem at 100% 30%, rgba(79, 122, 77, 0.14), transparent 60%),
    radial-gradient(48rem 40rem at 30% 100%, rgba(201, 123, 63, 0.14), transparent 60%),
    var(--couleur-fond);
}
.ecran-centre .feuille {
  padding: 2rem 1.5rem; border-radius: 28px;
  background: var(--verre);
  -webkit-backdrop-filter: var(--verre-flou); backdrop-filter: var(--verre-flou);
  border: 0.5px solid var(--verre-bord);
  box-shadow: var(--verre-reflet), var(--verre-ombre);
}

/* Repli opaque : navigateur sans flou d'arrière-plan, transparence réduite ou contraste élevé demandés. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .barre-laterale, .barre-outils, .barre-onglets, .ecran-centre .feuille { background: var(--fond-element); }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .barre-laterale, .barre-outils, .barre-onglets, .ecran-centre .feuille {
    background: var(--fond-element); -webkit-backdrop-filter: none; backdrop-filter: none;
    border: 1px solid var(--separateur);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .barre-laterale, .barre-outils, .barre-onglets, .bandeau-environnement { display: none; }
  .app { display: block; }
  body { background: var(--fond-element); }
}
