/* Composants — dépend de jetons.css.
   Réf. docs/claude design/docs/handoff-design.md §4.
   Un seul jeu de règles pour tout le produit. Aucun CSS par événement. */

/* ---------------------------------------------------------------------------
   Back-office
   --------------------------------------------------------------------------- */

.bo-cadre { background:var(--bo-surface); border:1px solid var(--bo-bordure);
  border-radius:6px; overflow:hidden; margin-bottom:var(--e-5); }
.bo-entete { padding:var(--e-4) var(--e-5); border-bottom:1px solid var(--bo-bordure-fine);
  display:flex; align-items:center; gap:var(--e-3); flex-wrap:wrap; }
.bo-entete .pousse { margin-left:auto; display:flex; gap:var(--e-2); }
.bo-titre { font-size:var(--t-titre-m); font-weight:700; margin:0; }
.bo-meta { font-family:var(--chiffres); font-size:var(--t-meta); color:var(--bo-gris); }

/* Compteurs — chiffre mono + libellé. Un seul jeu de règles : le budget, les
   tâches et tout écran de pilotage rendent la même bande. */
.bo-compteurs { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px,1fr));
  gap:1px; background:var(--bo-bordure-fine); border-bottom:1px solid var(--bo-bordure-fine); }
.bo-compteur { background:var(--bo-surface); padding:14px var(--e-4); }
.bo-compteur b { display:block; font-family:var(--chiffres); font-size:var(--t-compteur);
  font-weight:600; line-height:1.15; letter-spacing:-.01em; }
.bo-compteur span { font-size:var(--t-libelle); color:var(--bo-gris); }
.bo-compteur.bloquant b { color:var(--statut-bloquant); }
.bo-compteur.attention b { color:var(--statut-attention); }
.bo-compteur.ok b { color:var(--statut-ok); }
/* Deux bandes empilées gardent le filet qui les sépare, pas un vide. */
.bo-compteurs + .bo-compteurs { margin-top:1px; }
/* Hors d'un cadre, la bande se referme sur elle-même. */
.bo-compteurs.encadree { border:1px solid var(--bo-bordure-fine);
  border-radius:var(--r-s); overflow:hidden; }

/* Filtres et bascules de vue — des pastilles cliquables, l'active à l'encre.
   Même composant pour les filtres d'une liste et les vues d'un écran : ce
   sont deux fois le même geste, « je regarde ceci plutôt que cela ». */
.bo-filtres { display:flex; gap:4px; flex-wrap:wrap; }
.bo-filtre { padding:6px 12px; border-radius:4px; text-decoration:none;
  font-size:var(--t-libelle); font-weight:600; color:var(--bo-gris);
  border:1px solid transparent; background:none; cursor:pointer; font-family:inherit; }
.bo-filtre:hover { background:var(--bo-fond); color:var(--bo-encre); }
.bo-filtre.actif { background:var(--bo-encre); color:#fff; }
.bo-filtre.alerte.actif { background:var(--statut-bloquant); }

/* Note secondaire : une précision sous un libellé, jamais un second titre.
   Toujours en chasse fixe — c'est presque toujours une date, un compte ou une
   référence. */
.note { font-family:var(--chiffres); font-size:var(--t-libelle); color:var(--bo-gris); }

/* Tableau dense — 250 lignes lisibles sans fatigue, en-tête collant */
.bo-table { width:100%; border-collapse:collapse; }
.bo-table thead th { position:sticky; top:0; background:var(--bo-fond); text-align:left;
  padding:9px var(--e-5); font-size:var(--t-meta); font-weight:600;
  letter-spacing:.08em; text-transform:uppercase; color:var(--bo-gris); z-index:1; }
.bo-table td { padding:var(--e-3) var(--e-5); border-bottom:1px solid var(--bo-bordure-fine);
  font-size:var(--t-corps); vertical-align:middle; }
.bo-table td.num { font-family:var(--chiffres); font-variant-numeric:tabular-nums; }
.bo-table tr.bloquant { background:var(--statut-bloquant-fond); }
.bo-table tr:hover { background:var(--bo-fond); }

/* Pastilles — trois valeurs, jamais plus */
.pastille { display:inline-flex; align-items:center; gap:6px; font-size:var(--t-libelle);
  font-weight:600; padding:4px 9px; border-radius:var(--r-s); border:1px solid transparent;
  white-space:nowrap; }
.pastille::before { content:""; width:7px; height:7px; border-radius:50%; background:currentColor;
  flex:none; }
.pastille.bloquant  { color:var(--statut-bloquant);  background:var(--statut-bloquant-fond);
  border-color:var(--statut-bloquant-bord); }
.pastille.attention { color:var(--statut-attention); background:var(--statut-attention-fond);
  border-color:var(--statut-bloquant-bord); }
.pastille.ok        { color:var(--statut-ok);        background:var(--statut-ok-fond);
  border-color:var(--statut-ok-bord); }
/* Un état neutre n'est pas un statut : ni brique, ni ambre, ni vert. */
.pastille.neutre    { color:var(--bo-gris); background:var(--bo-fond); border-color:var(--bo-bordure); }

/* Un bloc posé dans un cadre garde la respiration du cadre. Écrit ici plutôt
   qu'en style en ligne dans un gabarit : une marge répétée à la main finit par
   diverger d'un écran à l'autre. */
.bo-encart { margin: var(--e-4) var(--e-5); }
.bo-cadre > .bo-encart { padding: 0; }
.bo-sous-entete { border-top: 1px solid var(--bo-bordure-fine); }
.bo-sous-titre { font-size: var(--t-titre-s); }

/* Une liste de manques : ce qui manque, pas des puces. L'admin impose
   `list-style-type: square` sur tout `ul > li` — la règle vise l'élément, et
   la retirer sur la liste ne suffit pas. */
.bo-manques { list-style: none; margin: 6px 0 0; padding: 0; }
.bo-manques > li { list-style: none; padding: 3px 0; font-size: var(--t-secondaire); }
.bo-manques > li .bo-meta { margin-right: 4px; }

/* Refus d'action : motif + règle citée. Jamais d'échec silencieux (§6). */
.bandeau-regle { border:1px solid var(--statut-bloquant-bord); background:var(--statut-bloquant-fond);
  border-radius:var(--r-m); padding:14px var(--e-4); display:flex; flex-direction:column; gap:6px;
  margin-bottom:var(--e-4); }
.bandeau-regle strong { color:var(--statut-bloquant); font-size:var(--t-secondaire); }
.bandeau-regle code, .bandeau-regle .regle { font-family:var(--chiffres); font-size:var(--t-libelle); }

/* Occupation d'une ressource. `display:block` : posée sur un `<span>`, une
   barre en ligne ignore sa hauteur et ne se voit pas. */
.jauge { display:block; height:6px; background:var(--bo-bordure-fine);
  border-radius:3px; overflow:hidden; }
.jauge > i { display:block; height:100%; background:var(--bo-accent); }
.jauge.pleine > i { background:var(--statut-ok); }
.jauge.saturee > i { background:var(--statut-bloquant); }

/* Journal d'audit */
.audit-ligne { display:flex; flex-direction:column; gap:2px; padding:var(--e-3) 0;
  border-bottom:1px solid var(--bo-bordure-fine); }
.audit-ligne .quand { font-family:var(--chiffres); font-size:var(--t-meta); color:var(--bo-gris-clair); }
.audit-ligne .quoi { font-size:var(--t-secondaire); }
.audit-ligne .motif { font-size:var(--t-libelle); color:var(--bo-gris); }

/* Boutons back-office */
.bo-btn { display:inline-flex; align-items:center; justify-content:center; gap:7px;
  min-height:36px; padding:8px 13px; border-radius:4px; font-size:var(--t-secondaire);
  font-weight:600; cursor:pointer; border:1px solid var(--bo-bordure); text-decoration:none;
  background:var(--bo-surface); color:var(--bo-accent); font-family:inherit; }
.bo-btn.primaire { background:var(--bo-accent); border-color:var(--bo-accent); color:#fff; }
.bo-btn.danger { border-color:var(--statut-bloquant-bord); color:var(--statut-bloquant); }
.bo-btn:focus-visible { outline:2px solid var(--bo-accent); outline-offset:2px; }

/* ---------------------------------------------------------------------------
   Espace famille (thémable)
   --------------------------------------------------------------------------- */

/* La même colonne que le bandeau, l'entête et le pied : sans quoi le contenu
   ne s'aligne pas sur le titre qui le surmonte. La valeur vit dans
   `--ef-largeur` (jetons.css) et nulle part ailleurs. */
.ef-page { max-width:var(--ef-largeur); margin:0 auto; padding:var(--e-4); }

/* Bandeau d'écran : surtitre en chasse fixe, titre dans la police d'ambiance. */
.ef-entete { background:var(--ef-accent); color:var(--ef-accent-texte);
  padding:var(--e-4) 18px; display:flex; flex-direction:column; gap:5px; }
.ef-entete .surtitre { font-family:var(--chiffres); font-size:10px;
  letter-spacing:.14em; text-transform:uppercase; opacity:.85; }
.ef-entete h1 { margin:0; font-size:19px; font-weight:700; line-height:1.25; }
.ef-entete .rang-etape { font-family:var(--chiffres); font-size:var(--t-secondaire); opacity:.85; }

/* Barre d'étapes 1/4 */
.ef-etapes { height:3px; background:var(--ef-bordure); }
.ef-etapes > i { display:block; height:100%; background:var(--ef-accent); }

/* Titre de section : petite capitale, jamais un h1 de plus */
.ef-section { font-size:var(--t-libelle); font-weight:600; letter-spacing:.08em;
  text-transform:uppercase; color:var(--ef-encre-doux); margin:var(--e-5) 0 var(--e-2); }
.ef-section:first-child { margin-top:0; }

.ef-carte { background:var(--ef-surface); border:1px solid var(--ef-bordure);
  border-radius:6px; padding:14px; display:flex; flex-direction:column; gap:7px; }
.ef-carte + .ef-carte { margin-top:var(--e-2); }
.ef-carte.choisie { border-width:1.5px; border-color:var(--ef-accent); }
/* La police de titre est réservée aux titres d'écran. Les maquettes rendent
   les noms de cartes et les libellés de boutons dans la police de texte : une
   Anton ou une Oswald sont des caractères d'affiche, illisibles en petit corps
   répété. Le CSS livré avec le handoff faisait l'inverse de ses propres
   maquettes ; ce sont les maquettes qui font foi. */
.ef-carte .nom { font-size:var(--t-titre-s); font-weight:600; }
.ef-carte .detail { font-family:var(--chiffres); font-size:var(--t-libelle); color:var(--ef-encre-doux); }
/* Une ligne « nom … montant » : le montant reste aligné à droite, en mono. */
.ef-carte .tete { display:flex; align-items:baseline; justify-content:space-between; gap:var(--e-3); }
.ef-carte .tete .montant { font-family:var(--chiffres); font-weight:600; white-space:nowrap; }

/* Carte cliquable = un choix. La cible tactile couvre toute la carte. */
.ef-choix { display:block; cursor:pointer; }
.ef-choix input { position:absolute; opacity:0; width:0; height:0; }
.ef-choix input:focus-visible + .ef-carte { outline:2px solid var(--ef-accent); outline-offset:2px; }
.ef-choix input:checked + .ef-carte { border-width:1.5px; border-color:var(--ef-accent); }

/* Alerte — trois valeurs, non thémable (§6 : ne jamais recolorer selon l'ambiance) */
.ef-alerte { display:flex; gap:8px; align-items:flex-start; padding:9px 11px;
  border-radius:4px; font-size:var(--t-libelle); line-height:1.45;
  color:var(--statut-attention); background:var(--statut-attention-fond);
  border:1px solid var(--statut-bloquant-bord); }
.ef-alerte::before { content:"•"; font-weight:700; line-height:1.2; flex:none; }
.ef-alerte.bloquant { color:var(--statut-bloquant); background:var(--statut-bloquant-fond); }
.ef-alerte.ok { color:var(--statut-ok); background:var(--statut-ok-fond); border-color:var(--statut-ok-bord); }

/* Bloc montant : sous-total, remise, total */
.ef-total { background:color-mix(in srgb, var(--ef-encre) 5%, transparent);
  border-radius:6px; padding:14px; display:flex; flex-direction:column; gap:8px;
  margin:var(--e-3) 0; }
.ef-total .ligne { display:flex; justify-content:space-between; gap:var(--e-3);
  font-size:var(--t-corps); }
.ef-total .ligne strong, .ef-total .ligne .montant {
  font-family:var(--chiffres); font-variant-numeric:tabular-nums; white-space:nowrap; }
.ef-total .ligne.remise { color:var(--statut-ok); }
.ef-total .ligne.resultat { border-top:1px solid var(--ef-bordure); padding-top:8px;
  font-size:var(--t-titre-s); font-weight:600; }

.ef-btn { display:block; width:100%; min-height:var(--touche-min); padding:15px;
  border:none; border-radius:6px; text-align:center; font-family:inherit;
  font-size:15px; font-weight:600; cursor:pointer; text-decoration:none;
  background:var(--ef-accent); color:var(--ef-accent-texte); }
.ef-btn + .ef-btn { margin-top:var(--e-2); }
.ef-btn.secondaire { background:transparent; color:var(--ef-accent);
  border:1px solid var(--ef-bordure); }
/* `body.ef a` pèse (0,1,2) — deux éléments et une classe. Un sélecteur
   `a.ef-btn` ne pèse que (0,1,1) et perd : le libellé prend alors la couleur
   d'accent sur un fond d'accent, et disparaît. Il faut égaler la spécificité
   et venir après. */
body.ef a.ef-btn { color:var(--ef-accent-texte); }
body.ef a.ef-btn.secondaire { color:var(--ef-accent); }
body.ef a.ef-btn:hover { color:var(--ef-accent-texte); }
body.ef a.ef-btn.secondaire:hover { color:var(--ef-accent); }
/* Le bouton d'une tâche bloquante est brique : son libellé reste blanc. */
body.ef .ef-tache a.ef-btn { color:#fff; }
.ef-btn.compact { display:inline-block; width:auto; padding:11px var(--e-4); font-size:var(--t-secondaire); }
.ef-btn:focus-visible { outline:2px solid var(--ef-accent); outline-offset:2px; }

/* Champs — libellé toujours visible, jamais de placeholder seul,
   erreur rattachée au champ (ENF-7.6, ENF-7.8) */
.champ { display:flex; flex-direction:column; gap:6px; margin-bottom:var(--e-4); }
.champ > label { font-size:var(--t-libelle); font-weight:600;
  letter-spacing:.06em; text-transform:uppercase; color:var(--ef-encre-doux); }
.champ > input, .champ > select, .champ > textarea { min-height:var(--touche-min);
  width:100%; border:1px solid var(--ef-bordure); border-radius:var(--r-m); padding:11px 12px;
  font-family:inherit;
  font-size:16px; /* 16px : empêche le zoom automatique iOS */
  color:var(--ef-encre); background:var(--ef-surface); }
.champ > input[type="date"], .champ > input[type="tel"], .champ > input[type="number"] {
  font-family:var(--chiffres); }
.champ .aide { font-size:var(--t-libelle); color:var(--ef-encre-doux); }
.champ.erreur > input, .champ.erreur > select, .champ.erreur > textarea {
  border-color:var(--statut-bloquant); border-width:2px; }
.champ .message-erreur { font-size:var(--t-libelle); color:var(--statut-bloquant); font-weight:600; }
.champ .obligatoire { color:var(--statut-bloquant); }

/* Groupe de cases ou de boutons radio rendu par Django (ul > li) */
.champ .choix-liste { list-style:none; margin:0; padding:0; display:flex;
  flex-direction:column; gap:var(--e-2); }
.champ .choix-liste li { display:flex; align-items:center; gap:var(--e-2);
  min-height:var(--touche-min); }
.champ .choix-liste input { width:auto; min-height:auto; }
.champ .choix-liste label { font-size:15px; font-weight:400; text-transform:none;
  letter-spacing:0; color:var(--ef-encre); }

@media (min-width:640px) { .ef-page { padding:var(--e-6); } }

/* Une ligne de tableau qui mène quelque part le dit : le curseur change, et
   la ligne survolée se détache. Le libellé reste un vrai lien — c'est lui la
   navigation, la ligne n'est qu'une zone de clic plus large. */
.bo-ligne-cliquable { cursor: pointer; }
.bo-ligne-cliquable a { text-decoration: none; }
.bo-ligne-cliquable:hover a { text-decoration: underline; }

/* Une case à cocher se lit avec son libellé sur la même ligne, et en phrase :
   les libellés de champ sont en capitales parce qu'ils titrent une saisie —
   ici le libellé *est* la question, et on ne crie pas une question. */
.champ.ef-couple {
  border: 1px solid var(--ef-bordure); border-radius: var(--r-m);
  padding: 12px 14px; gap: 4px;
}
.champ.ef-couple > label {
  display: flex; align-items: baseline; gap: 10px;
  font-size: var(--t-corps); font-weight: 600; letter-spacing: 0;
  text-transform: none; color: var(--ef-encre); cursor: pointer;
}
.champ.ef-couple > label input {
  min-height: 0; width: auto; flex: none; accent-color: var(--ef-accent);
}
.champ.ef-couple .aide { margin-left: 28px; }

/* ---------------------------------------------------------------------------
   Marque — logo « Filet »
   Un trait or à gauche du nom. Le nom prend l'encre de son fond, le trait ne
   change jamais : c'est lui qui identifie l'association. Réserve minimale
   autour du verrou : la largeur du trait.
   --------------------------------------------------------------------------- */
.marque-verrou { display:inline-flex; align-items:center; gap:11px;
  text-decoration:none; color:inherit; }
.marque-filet { flex:none; width:4px; align-self:stretch; min-height:30px;
  border-radius:2px; background:var(--marque-or); }
.marque-texte { display:flex; flex-direction:column; line-height:1.15; min-width:0; }
.marque-texte > strong { font-size:var(--t-titre-s); font-weight:700;
  letter-spacing:-.3px; }
.marque-ligne2 { font-family:var(--chiffres); font-size:9px; letter-spacing:.22em;
  text-transform:uppercase; opacity:.72; }
/* Sur une barre dense — l'espace famille — le verrou se fait discret sans
   perdre son trait : c'est une signature, pas un titre. */
.marque-verrou.compact { gap:8px; }
.marque-verrou.compact .marque-filet { width:3px; min-height:22px; }
.marque-verrou.compact .marque-texte > strong { font-size:var(--t-secondaire); }
.marque-verrou.compact .marque-ligne2 { font-size:8px; letter-spacing:.18em; }

/* --- Bandeau d'environnement ------------------------------------------------
   Sur un serveur de recette. Ambre — le code à trois valeurs du référentiel :
   ce n'est pas une règle violée, c'est un avertissement à tenir présent.
   Ni refermable ni animé : il doit se voir sans jamais se faire remarquer. */
.bandeau-environnement {
  display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: baseline;
  padding: .5rem 1rem; background: var(--statut-attention-fond);
  /* L'encre du back-office, qui n'est jamais thémée : le texte porte
     l'information, l'ambre porte le niveau. Ambre sur ambre donne 4,52:1 —
     AA de justesse, et ce bandeau doit se lire sans effort, y compris sous
     l'ambiance d'un événement qui redéfinirait --ef-encre. */
  color: var(--bo-encre);
  border-bottom: 1px solid var(--statut-attention);
  font-size: var(--t-libelle); line-height: 1.45;
}
.bandeau-environnement strong {
  font-family: var(--chiffres); font-size: .6875rem; letter-spacing: .08em;
  text-transform: uppercase; font-weight: 600;
  color: var(--statut-attention);
}

/* --- FD1 · l'état inactif, motif unique --------------------------------------
   « Jamais un aplat gris à texte blanc. » `opacity` produit exactement cela :
   un bouton primaire à 50 % sur page blanche rend du blanc sur #8A98A7, soit
   2,95:1 — et un libellé illisible n'informe pas qu'il est inactif, il
   disparaît.

   Le motif : fond transparent, bordure pleine pâle, libellé à --bo-gris-clair
   (5,05:1). L'état se lit sur la bordure, le texte reste lisible. */
.ef-btn[disabled], .bo-btn[disabled], button[disabled].ef-btn,
.bud-cloture .bo-btn[disabled], .rep-pied .bo-btn[disabled] {
  opacity: 1;
  background: transparent;
  border: 1px solid var(--bo-bordure-inactif);
  color: var(--bo-gris-clair);
  cursor: not-allowed;
}
/* Une carte de choix désactivée se retire par son fond et sa bordure, pas par
   la transparence : son libellé porte le motif du refus. */
.ef-choix input:disabled + .ef-carte {
  opacity: 1;
  background: var(--bo-fond);
  border-color: var(--bo-bordure-inactif);
  cursor: not-allowed;
}
