/* Feuille de style unique du dashboard Marcel.
 *
 * Identité « Marcel » : palette chaude (orange / navy / crème), ombres douces,
 * contraste AA+, rythme 8 px, focus toujours visible, transitions 150-300 ms.
 * Polices Poppins (charte) et Inter (repli), auto-hébergées en woff2 (OFL) :
 * aucune dépendance externe, aucun CDN — la CSP de l'app l'interdit.
 *
 * Organisation du fichier, dans cet ordre :
 *   1. POLICES      — @font-face
 *   2. VARIABLES    — tokens de :root (couleurs, rayons, ombres, mesures)
 *   3. BASE         — reset léger, typographie, focus
 *   4. COQUE        — topbar, navigation, menu utilisateur, contenu, pied
 *   5. COMPOSANTS   — cartes, boutons, formulaires, sections, listes, badges…
 *   6. UTILITAIRES  — classes d'appoint (hors-écran, actions-row, num…)
 *
 * Conventions de nommage : blocs en français, éléments en `bloc__element`,
 * états en `est-actif` / `est-fait`. Aucun style en ligne dans les gabarits :
 * tout ce qui s'affiche a une classe ici.
 */

/* ======================================================================== */
/* 1. POLICES                                                               */
/* ======================================================================== */
@font-face {
  font-family: "Poppins";
  src: url("/dashboard/static/fonts/poppins-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/dashboard/static/fonts/poppins-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/dashboard/static/fonts/poppins-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "InterVar";
  src: url("/dashboard/static/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ======================================================================== */
/* 2. VARIABLES                                                             */
/* ======================================================================== */
:root {
  --brand: #fe8220;          /* orange Marcel : APLATS et filets seulement */
  /* L'orange de marque ne passe pas le contraste AA en couleur de texte (2,49:1
     sur blanc). Deux jetons derives le remplacent des qu'il s'agit de LIRE :
     `--brand-texte` pour un texte orange, `--brand-ink` pour ce qui se pose SUR
     l'aplat orange. L'orange brut reste pour les fonds, filets et `accent-color`. */
  --brand-texte: #b34700;    /* 5,50:1 sur blanc, 5,20:1 sur creme */
  --brand-ink: #091e36;      /* navy sur orange : 6,74:1 */
  --accent: #a6ccb8;         /* vert sauge, touches decoratives */

  --bg: #fef8eb;             /* creme papier */
  --surface: #ffffff;
  --surface-2: #fdf3e2;      /* teinte chaude */
  --border: #f0e6d3;
  --border-strong: #e6d6b8;

  --text: #091e36;           /* navy */
  --text-muted: #51677d;
  --text-subtle: #5f7285;    /* 4,96:1 sur blanc : il porte des titres et des etats vides */

  /* Indicateur de focus : un bleu profond, lisible sur les trois fonds de l'app
     (11,46:1 sur blanc). L'orange de marque n'y suffisait pas (2,49:1, sous le
     seuil 3:1 de WCAG 1.4.11 pour un indicateur non textuel). */
  --focus: #0b3a6b;

  --ok: #0a7d3c;   --ok-bg: #e8f6ee;   --ok-bd: #b6e2c6;
  --warn: #955700; --warn-bg: #fbf1df; --warn-bd: #ecd3a3;
  --err: #c0342b;  --err-bg: #fdecea;  --err-bd: #f3c6c1;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(9,30,54,.06), 0 1px 3px rgba(9,30,54,.05);
  --shadow: 0 12px 30px -14px rgba(9,30,54,.20), 0 5px 12px -8px rgba(9,30,54,.10);

  --topbar-h: 62px;
  --maxw: 1080px;
  /* Hauteur minimale d'une cible tactile (bouton, lien-action). */
  --cible: 40px;
  --font: "Poppins", "InterVar", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ======================================================================== */
/* 3. BASE                                                                  */
/* ======================================================================== */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "ss01";
  letter-spacing: -0.004em;
  -webkit-font-smoothing: antialiased;
}

/* Poppins ne va que jusqu'a la SemiBold (600) : on cale les gras sur 600 pour
   eviter le faux-gras synthetise par le navigateur. */
strong, b { font-weight: 600; }

a { color: var(--brand-texte); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 .35rem; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .9rem; letter-spacing: -.005em; }
h3 { font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
     color: var(--text-subtle); margin: 1.25rem 0 .6rem; }

code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .05rem .38rem; border-radius: 6px; font-size: .86em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text);
}

/* Focus visible : la navigation au clavier doit toujours dire où elle en est. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Champs de saisie : meme anneau, colle au bord (un champ a deja sa bordure).
   `:focus-visible` et non `:focus` — l'anneau sert au clavier, pas a la souris —
   et l'`outline` n'est JAMAIS retiree : la bordure teintee seule ne se voit pas. */
.form input:focus-visible, .form-inline input:focus-visible, .tab input:focus-visible,
.form textarea:focus-visible, textarea.champ:focus-visible,
.form select:focus-visible, select.select:focus-visible,
.brique__param input:focus-visible, .brique__param textarea:focus-visible,
.brique__param select:focus-visible,
.zone-copie:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--text);
  box-shadow: none;
}

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

/* ======================================================================== */
/* 4. COQUE (topbar, navigation, menu utilisateur, contenu, pied)           */
/* ======================================================================== */

/* Premier élément focusable de la page : sauter la barre pour aller au contenu. */
.saut-contenu {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
  background: var(--brand); color: var(--brand-ink); font-weight: 600;
}
.saut-contenu:focus { left: 0; text-decoration: none; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2rem);
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(1.6) blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand__logo { width: auto; height: 42px; max-width: 220px; object-fit: contain; display: block; }

/* Navigation principale : elle défile horizontalement plutôt que de se replier
   dans un menu — six entrées se lisent d'un coup d'œil, même à 380 px. */
.topnav {
  display: flex; gap: .2rem; min-width: 0; flex: 1 1 auto;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav__lien {
  flex: 0 0 auto; white-space: nowrap;
  display: inline-flex; align-items: center; min-height: var(--cible);
  color: var(--text-muted); font-weight: 550; font-size: .92rem;
  padding: .4rem .7rem; border-radius: 8px;
  transition: background .15s, color .15s;
}
.topnav__lien:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topnav__lien.est-actif {
  color: var(--brand-texte); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* Menu utilisateur : un <details>, donc ouvrable sans JavaScript. Le script ne
   sert qu'à le refermer quand on clique ailleurs ou qu'on appuie sur Échap. */
.usermenu { position: relative; margin-left: auto; flex: 0 0 auto; }
.usermenu__bouton {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: var(--cible); padding: .3rem .55rem;
  border-radius: var(--radius-pill); cursor: pointer; list-style: none;
  color: var(--text-muted); font-size: .88rem;
  transition: background .15s;
}
.usermenu__bouton::-webkit-details-marker { display: none; }
.usermenu__bouton:hover { background: var(--surface-2); }
.usermenu__pastille {
  display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto;
  border-radius: 50%; background: var(--brand); color: var(--brand-ink);
  font-weight: 600; font-size: .85rem;
}
.usermenu__email { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu__chevron {
  width: 14px; height: 14px; flex: 0 0 auto;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat center / contain;
  transition: transform .2s ease;
}
.usermenu[open] .usermenu__chevron { transform: rotate(180deg); }
.usermenu__panneau {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 30;
  min-width: 15rem; padding: .4rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
}
.usermenu__identite {
  display: flex; flex-direction: column; gap: .3rem; align-items: flex-start;
  margin: 0; padding: .45rem .6rem .6rem;
  border-bottom: 1px solid var(--border);
}
.usermenu__adresse { font-size: .85rem; color: var(--text-muted); word-break: break-all; }
.usermenu__lien {
  display: flex; align-items: center; width: 100%; min-height: var(--cible);
  padding: .5rem .6rem; margin-top: .2rem; border-radius: 8px;
  color: var(--text); font: inherit; font-size: .9rem; text-align: left;
  background: none; border: none; cursor: pointer;
}
.usermenu__lien:hover { background: var(--surface-2); text-decoration: none; }
.usermenu__lien--action { color: var(--err); }

/* Sur un écran étroit, l'adresse email cède la place à la navigation. */
@media (max-width: 720px) {
  /* La barre passe sur deux rangees : le jeton de hauteur le dit, et tout ce qui
     se colle dessous (`.barre-etat`, `.consignes__apercu`) se recale tout seul. */
  :root { --topbar-h: 104px; }
  .usermenu__email { display: none; }
  .brand__logo { height: 34px; max-width: 130px; }
  .topbar { gap: .6rem; padding: .35rem clamp(.75rem, 4vw, 1rem); flex-wrap: wrap; }
  .topnav { order: 3; flex-basis: 100%; }
}

/* Sous 560 px, les six entrees ne tiennent plus sur une ligne. Plutot qu'un
   defilement muet qui coupe « Compte » au milieu d'un mot, elles se replient sur
   deux lignes : tout est visible, rien n'est a deviner. */
@media (max-width: 560px) {
  :root { --topbar-h: 150px; }
  .topnav { flex-wrap: wrap; overflow-x: visible; }
  .topnav__lien { flex: 0 1 auto; }
}

.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 4vw, 2rem) 3rem;
}
/* Pages de saisie tabulaire : la largeur de lecture (1080px) tasse les colonnes. */
.content--large { max-width: min(1600px, 100%); }
.shell--public .content { max-width: 420px; padding-top: clamp(2rem, 10vh, 5rem); }
.shell--public .topbar { justify-content: center; background: transparent; border: 0; backdrop-filter: none;
  height: auto; padding-top: clamp(1.5rem, 6vh, 3rem); }
.shell--public .topnav, .shell--public .usermenu { display: none; }
/* Sur les pages publiques (connexion), le logotype respire davantage. */
.shell--public .brand__logo { height: 54px; max-width: 260px; }

/* Pied de page légal (CGU / CGV) */
.pied {
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: .85rem;
}
.pied__lien { color: var(--text-muted); text-decoration: none; }
.pied__lien:hover { color: var(--text); text-decoration: underline; }
/* Les liens légaux s'espacent, ils ne se séparent pas par un caractère. */
.pied { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; }

/* ======================================================================== */
/* 5. COMPOSANTS                                                            */
/* ======================================================================== */

/* ---- Cartes et en-têtes de page ---------------------------------------- */
.carte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
/* Deux cartes qui se suivent, y compris de part et d'autre d'un formulaire :
   « Vos règles, avec vos mots » est dans le formulaire des consignes, « Vos
   demandes reçues par email » juste après, et rien ne les séparait. */
.carte + .carte, form + .carte { margin-top: 1.1rem; }
.carte h1 { color: var(--text); }
.carte-etroite { max-width: 640px; }
.carte-danger { border-color: var(--err-bd); }
.carte-danger h2 { color: var(--err); }

/* Titre de carte : le libellé à gauche, un compteur discret à droite. */
.carte__titre { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.carte__compteur {
  margin-left: auto; font-size: .78rem; font-weight: 600;
  color: var(--text-subtle); text-transform: none; letter-spacing: 0;
}

/* Bloc secondaire à l'intérieur d'une section (les clés d'un fournisseur). */
.sous-carte {
  margin-top: 1.1rem; padding: 1rem 1.1rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.sous-carte h3 { margin-top: 0; color: var(--text); }

.page-head { margin-bottom: 1.1rem; }
.page-head .sous { color: var(--text-muted); margin: 0; }
.retour { display: inline-block; color: var(--text-muted); font-size: .9rem; margin-bottom: .9rem; }

/* ---- Boutons ----------------------------------------------------------- */
.bouton, button.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--cible);
  background: var(--brand); color: var(--brand-ink);
  border: 1px solid transparent; border-radius: 10px;
  padding: .5rem 1rem; font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; text-decoration: none; transition: filter .15s, box-shadow .15s, transform .05s;
  box-shadow: var(--shadow-sm);
}
.bouton:hover { filter: brightness(1.06); text-decoration: none; }
.bouton:active { transform: translateY(1px); }
.bouton.petit { min-height: 36px; padding: .3rem .7rem; font-size: .85rem; border-radius: 8px; }
.bouton.secondaire {
  background: var(--surface); color: var(--text);
  border-color: var(--border-strong); box-shadow: none;
}
.bouton.secondaire:hover { background: var(--surface-2); filter: none; }
.bouton.danger { background: var(--err); color: #ffffff; }
.bouton.danger.secondaire {
  background: var(--surface); color: var(--err); border-color: var(--err-bd); box-shadow: none;
}
.bouton.danger.secondaire:hover { background: var(--err-bg); filter: none; }

.btn-icon {
  display: grid; place-items: center; width: var(--cible); height: var(--cible);
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 9px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-icon:hover { background: var(--err-bg); color: var(--err); border-color: var(--err-bd); }

/* Action secondaire écrite comme un lien (retirer, supprimer). */
.lien {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font: inherit; font-size: .88rem; padding: .35rem .3rem; text-decoration: underline;
}
.lien:hover { color: var(--err); }

/* Au doigt, les petites cibles remontent à la taille réglementaire. */
@media (pointer: coarse) {
  .bouton.petit, .lien { min-height: var(--cible); }
}

.inline { display: inline; margin: 0; }
/* Deux formulaires empilés — « Enregistrer mes clés », puis « Vérifier la
   connexion » — ne doivent pas se toucher : chacun est un formulaire distinct
   (jamais imbriqué), donc rien ne les séparait. Les formulaires côte à côte
   d'une cellule d'actions portent `.inline`, dont la marge nulle l'emporte. */
form + form { margin-top: .7rem; }

/* ---- Formulaires ------------------------------------------------------- */
/* Rythme porté par des marges (et non par un `gap` de flex) : les champs d'un
   formulaire ne sont pas toujours ses enfants directs — un dépliant en contient
   souvent — et un `gap` les aurait laissés collés. */
.form { display: block; max-width: 520px; }
.form label {
  display: block; margin-top: .85rem;
  font-size: .88rem; font-weight: 550; color: var(--text-muted);
}
.form > :first-child + label, .form label:first-child { margin-top: 0; }
.form label code { white-space: nowrap; }  /* le format ne se coupe pas en son milieu */
.form input, .form select, .form textarea { display: block; width: 100%; margin-top: .3rem; }
.form label > input, .form label > select, .form label > textarea { margin-top: .35rem; }
.form .aide { margin: .3rem 0 0; }
.form .bouton, .form button.bouton { margin-top: 1.2rem; }
.form .depliant { margin-top: 1rem; }
/* Une case à cocher garde sa mise en ligne, même dans un `.form`. */
.form label.option-case { display: flex; font-size: inherit; color: inherit; font-weight: inherit; }

.form input, .form-inline input, .tab input, .brique__param input {
  padding: .55rem .7rem; border: 1px solid var(--border-strong);
  border-radius: 9px; font: inherit; font-size: .92rem; color: var(--text);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
  min-height: var(--cible);
}
.form-inline { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-top: .8rem; }
/* Formulaire en ligne qui occupe toute la largeur de son hôte (ligne de liste). */
.form-inline--pleine { flex: 1 1 100%; margin-top: 0; }
/* Champ qui reçoit une vraie phrase (un nom d'entreprise) et non une valeur courte. */
.champ-large { min-width: min(22rem, 100%); flex: 1 1 18rem; }

/* Champs multilignes : même traitement que les champs simples (aucun champ natif
   nu dans l'interface), avec un redimensionnement vertical seulement — un champ
   élargi à la souris casserait la colonne de lecture. */
.form textarea, textarea.champ, .brique__param textarea {
  padding: .6rem .75rem; border: 1px solid var(--border-strong);
  border-radius: 9px; font: inherit; font-size: .92rem; line-height: 1.6;
  color: var(--text); background: var(--surface);
  resize: vertical; min-height: 6.5rem;
  transition: border-color .15s, box-shadow .15s;
}
.form textarea::placeholder { color: var(--text-subtle); }

/* Champ de consignes : le filet vertical reprend celui de `.reglage`, qui signale
   déjà « suite de règles » ailleurs dans l'app. Le champ ressemble donc à ce qu'il
   produit, et le fond chaud le distingue d'une saisie ordinaire. */
/* Une saisie de consignes : le filet orange la distingue d'un champ ordinaire,
   et sa hauteur de départ invite à écrire plusieurs lignes. `resize: vertical`
   (hérité de `.form textarea`) laisse l'agrandir à la main. */
.champ-consignes {
  background: var(--surface-2);
  border-left: 3px solid color-mix(in srgb, var(--brand) 55%, var(--border-strong));
  border-radius: 4px 9px 9px 4px;
  min-height: 8.5rem;
}
.champ-consignes:focus {
  background: var(--surface);
  border-left-color: var(--brand);
}
/* Un formulaire qui occupe toute sa carte : pour les textes longs, la colonne
   de 520 px casse la lecture au milieu de la carte. */
.form--pleine { max-width: none; }

/* Etiquette de groupe dans un formulaire (separe des sous-parties sans titre lourd). */
.form-legende {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 600; color: var(--text-subtle); margin: 1.4rem 0 0;
}

/* Menus déroulants (select stylisé, chevron maison) */
.form select, select.select, .brique__param select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  width: 100%; max-width: 100%; min-height: var(--cible);
  padding: .55rem 2.4rem .55rem .7rem;
  border: 1px solid var(--border-strong); border-radius: 9px;
  font: inherit; font-size: .92rem; font-weight: 550; color: var(--text);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 16px 16px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.form select:hover, select.select:hover { border-color: var(--brand); }
/* Le focus des champs est traite en un seul endroit, plus bas (`.champ:focus-visible`). */

/* Champ piège de l'inscription : hors de l'écran et hors du parcours clavier.
   `display:none` serait ignoré par certains robots ; on le sort du cadre. */
.champ-piege {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Cases à cocher groupées par domaine (fournisseurs d'un espace) */
.domaine-fournisseurs {
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: .3rem 1rem .6rem; margin: .85rem 0 0; min-width: 0;
}
.domaine-fournisseurs legend {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 650; color: var(--text-muted); padding: 0 .45rem;
}
.option-case {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .55rem 0; cursor: pointer; min-height: var(--cible);
}
.option-case + .option-case { border-top: 1px solid var(--border); }
/* Case native (accent-color), en réinitialisant les styles globaux de .form input. */
.option-case > input[type="checkbox"] {
  display: inline-block; width: 1.15rem; height: 1.15rem; min-height: 0; flex: 0 0 auto;
  margin: .3rem 0 0; padding: 0; border-radius: 5px;
  accent-color: var(--brand); cursor: pointer; box-shadow: none;
}
.option-case__texte { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.option-case__texte strong { font-size: .92rem; font-weight: 600; color: var(--text); }
.option-case__texte .aide { margin: 0; }

/* Choix radio en ligne (ex. offre de départ d'un espace) */
.choix { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-top: .35rem; }
.choix__opt {
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
  min-height: var(--cible);
  font-size: .92rem; font-weight: 500; color: var(--text);
}
/* Rond natif (accent-color), en réinitialisant les styles globaux de .form input. */
.choix__opt > input[type="radio"] {
  width: 1.05rem; height: 1.05rem; min-height: 0; flex: 0 0 auto; margin: 0; padding: 0;
  border: none; border-radius: 50%; accent-color: var(--brand);
  cursor: pointer; box-shadow: none;
}

/* ---- Sections repliables à pastille d'état ----------------------------- */
/* Le cœur de la page « Connexions » : une section déjà réglée se replie sur sa
   ligne d'état (« Axonaut · relié »), une section à régler s'ouvre d'elle-même.
   C'est un <details> : tout fonctionne sans JavaScript. */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.section + .section, .section + .carte, .carte + .section { margin-top: 1.1rem; }
.section__tete {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  margin: 0; padding: 1rem 1.3rem; min-height: 56px;
  cursor: pointer; list-style: none;
  transition: background .15s;
}
.section__tete::-webkit-details-marker { display: none; }
.section > summary.section__tete:hover { background: var(--surface-2); }
.section__titre { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--text); }
.section__chevron {
  width: 16px; height: 16px; flex: 0 0 auto; margin-left: auto;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat center / contain;
  transition: transform .2s ease;
}
.section[open] .section__chevron { transform: rotate(180deg); }
.section__corps { padding: 0 1.3rem 1.3rem; border-top: 1px solid var(--border); padding-top: 1.1rem; }
.section__corps > :first-child { margin-top: 0; }
/* Section fermée par l'offre : on montre ce qu'elle contient, pas un cadenas muet. */
.section--verrouillee { padding: 1rem 1.3rem 1.2rem; background: var(--surface-2); }
.section--verrouillee .section__tete { padding: 0 0 .4rem; cursor: default; min-height: 0; }

/* ---- Dépliant (détail secondaire, replié par défaut) -------------------- */
/* Remplace le rendu natif de <details> : le triangle système jure avec le reste
   de l'interface. Le chevron est celui des menus déroulants, pour que « ça
   s'ouvre » se lise partout de la même façon. */
.depliant {
  margin-top: .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.depliant > summary {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .85rem; min-height: var(--cible); cursor: pointer;
  font-size: .88rem; font-weight: 550; color: var(--text-muted);
  list-style: none;
  transition: color .15s, background .15s;
}
.depliant > summary::-webkit-details-marker { display: none; }
.depliant > summary::after {
  content: ""; flex: 0 0 auto; margin-left: auto; width: 15px; height: 15px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat center / contain;
  transition: transform .2s ease;
}
.depliant[open] > summary::after { transform: rotate(180deg); }
.depliant > summary:hover { color: var(--text); background: color-mix(in srgb, var(--brand) 5%, transparent); }
.depliant > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.depliant__corps {
  padding: 0 .85rem .85rem;
  color: var(--text-muted); font-size: .88rem;
  animation: depliant-in .18s ease both;
}
.depliant__corps > :first-child { margin-top: 0; }
.depliant__corps > :last-child { margin-bottom: 0; }
@keyframes depliant-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* ---- Checklist de démarrage (accueil) ---------------------------------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist__item {
  display: flex; align-items: flex-start; gap: .8rem;
  padding: .8rem .1rem; border-top: 1px solid var(--border);
}
.checklist__item:first-child { border-top: 0; }
.checklist__coche {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: .15rem;
  border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface);
}
.checklist__item.est-fait .checklist__coche {
  border-color: var(--ok); background: var(--ok) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") no-repeat center / 14px 14px;
}
.checklist__texte { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1 1 auto; }
.checklist__lien { font-weight: 600; color: var(--text); }
.checklist__lien:hover { color: var(--brand-texte); }
.checklist__etat { flex: 0 0 auto; margin-left: auto; align-self: center; }
@media (max-width: 560px) {
  .checklist__item { flex-wrap: wrap; }
  .checklist__etat { margin-left: 2.8rem; }
}

/* ---- Jauge de devis du mois -------------------------------------------- */
.jauge__ligne { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: 0 0 .6rem; }
.jauge__offre { font-weight: 600; }
.jauge__barre {
  display: block; width: 100%; max-width: 22rem; height: 10px;
  margin: .2rem 0 .6rem; border: none; border-radius: var(--radius-pill);
  background: var(--surface-2); appearance: none; -webkit-appearance: none;
  overflow: hidden;
}
.jauge__barre::-webkit-progress-bar { background: var(--surface-2); border-radius: var(--radius-pill); }
.jauge__barre::-webkit-progress-value { background: var(--brand); border-radius: var(--radius-pill); }
.jauge__barre::-moz-progress-bar { background: var(--brand); border-radius: var(--radius-pill); }

/* ---- Dernières demandes (accueil) -------------------------------------- */
.demandes { list-style: none; margin: 0; padding: 0; }
.demandes__item {
  display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap;
  padding: .7rem .1rem; border-top: 1px solid var(--border);
}
.demandes__item:first-child { border-top: 0; }
.demandes__objet { display: flex; flex-direction: column; gap: .05rem; min-width: 0; flex: 1 1 14rem; }
.demandes__meta { flex: 0 0 auto; }
.demandes__etat { flex: 0 0 auto; margin-left: auto; }

/* ---- Valeur à copier (adresse du connecteur, phrase planifiée) --------- */
.copiable {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin: .6rem 0;
}
.copiable__valeur {
  flex: 1 1 18rem; min-width: 0;
  padding: .6rem .8rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  font-size: .88rem; word-break: break-all; user-select: all;
}

/* ---- Table de correspondance (un choix par ligne : nom + où le trouver) --- */
/* Trois alternatives, pas une séquence : aucune numérotation, juste des filets
   qui alignent le regard sur la colonne des noms. */
.chemins { list-style: none; margin: 0; padding: 0; }
.chemins li {
  display: grid; grid-template-columns: minmax(7rem, max-content) 1fr;
  gap: .15rem 1rem; align-items: baseline;
  padding: .5rem 0; border-top: 1px solid var(--border);
}
.chemins li:first-child { border-top: 0; padding-top: .2rem; }
.chemins__nom { font-weight: 600; color: var(--text); }
.chemins__ou { color: var(--text-muted); }
@media (max-width: 560px) { .chemins li { grid-template-columns: 1fr; } }

/* ---- Note d'information (rassure, n'alerte pas) ------------------------- */
/* Volontairement plus calme que `.ok` / `.erreur` : elle dit « il n'y a rien à
   faire », elle ne doit pas capter l'attention comme un statut. */
.note {
  margin: 1rem 0 0;
  padding: .7rem .9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .9rem;
}
.note__titre { display: block; font-weight: 600; color: var(--text); margin-bottom: .1rem; }
.note--calme { border-left-color: color-mix(in srgb, var(--brand) 45%, var(--border-strong)); }

/* ---- Suite de réglages sans puce (un filet vertical remplace la liste) -- */
.reglage { display: flex; flex-direction: column; gap: 0; }
.reglage > p { margin: .5rem 0; padding-left: .9rem; border-left: 2px solid var(--border-strong); }
.reglage > p strong { color: var(--text); }

/* Marche à suivre numérotée : une étape par ligne, dans l'ordre où on la fait. */
.etapes { margin: .5rem 0 0; padding-left: 1.4rem; color: var(--text-muted); }
.etapes li { margin-top: .5rem; }
.etapes li strong { color: var(--text); }

/* ---- Bloc de texte à relire (consignes compilées) ---------------------- */
.zone-copie {
  width: 100%; box-sizing: border-box;
  padding: .9rem 1rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .82rem; line-height: 1.5;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}

/* ---- Onglets (segmented control) + panneaux ---------------------------- */
/* Sans JavaScript : la barre est masquée et tous les panneaux restent empilés
   et lisibles. Le script ajoute `.js-onglets` sur <body> pour activer le mode. */
.onglets {
  display: none;
  gap: .2rem;
  padding: .3rem;
  margin-bottom: 1.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.onglets::-webkit-scrollbar { display: none; }
.js-onglets .onglets { display: inline-flex; max-width: 100%; }
.onglet {
  flex: 0 0 auto; white-space: nowrap;
  display: inline-flex; align-items: center; min-height: var(--cible);
  padding: .5rem .95rem; border-radius: 9px;
  font-weight: 600; font-size: .9rem; color: var(--text-muted);
  background: none; border: none; cursor: pointer;
  transition: color .15s, background .15s, box-shadow .15s;
}
.onglet:hover { color: var(--text); text-decoration: none; }
.onglet.est-actif {
  color: var(--brand-texte); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panneau + .panneau { margin-top: 1.1rem; }
.js-onglets .panneau { display: none; margin-top: 0; }
.js-onglets .panneau.est-actif { display: block; animation: panneau-in .2s ease both; }
@keyframes panneau-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- Tableaux ---------------------------------------------------------- */
.table-scroll { overflow-x: auto; border-radius: var(--radius-sm); }
.tab { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tab thead th {
  text-align: left; font-size: .72rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-subtle);
  padding: .55rem .7rem; border-bottom: 1px solid var(--border);
}
.tab td { padding: .62rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tab tbody tr:last-child td { border-bottom: 0; }
.tab tbody tr { transition: background .12s; }
.tab tbody tr:hover { background: var(--surface-2); }
.tab input { width: 100%; min-width: 5rem; }
.tab input.etroit { min-width: 4.2rem; }
/* Un lien à recopier a besoin d'être lu en entier, même en colonne de tableau. */
.tab input.zone-copie { min-width: 18rem; padding: .5rem .6rem; }

/* Tableau de SAISIE (éditeur de tarifs) : une grille compte de 10 à 25 paliers ;
   avec `width:100%`, toutes les colonnes retombent à leur minimum et on ne lit
   plus ce qu'on tape. Ici le tableau prend la largeur dont il a besoin et défile
   dans `.table-scroll` ; les colonnes d'identification restent visibles. */
.tab--saisie { width: auto; min-width: 100%; }
.tab--saisie td { padding: .5rem .45rem; }
.tab--saisie thead th { padding: .5rem .45rem; }
/* Le libellé et la clé reçoivent de vrais mots : ils ont besoin de place. */
.tab--saisie input.cle { min-width: 11rem; }
.tab--saisie input.libelle { min-width: 16rem; }
.tab--saisie input.etroit { min-width: 5rem; }
.tab--saisie input { padding: .5rem .55rem; }
/* Colonnes figées : sans elles, « quel produit ? » disparaît dès qu'on fait
   défiler vers les derniers paliers. */
.tab--fige th.fixe, .tab--fige td.fixe {
  position: sticky; background: var(--surface); z-index: 1;
}
.tab--fige thead th.fixe { z-index: 2; }
.tab--fige .fixe-1 { left: 0; box-shadow: 1px 0 0 var(--border); }
.tab--fige tbody tr:hover .fixe { background: var(--surface-2); }
/* Sur petit écran, une colonne figée mangerait toute la largeur utile. */
@media (max-width: 700px) {
  .tab--fige th.fixe, .tab--fige td.fixe { position: static; }
}
/* Le champ actif passe au premier plan et s'élargit : on relit toujours sa saisie. */
.tab--saisie input:focus {
  position: relative; z-index: 3;
  min-width: 12rem; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent),
    var(--shadow-sm);
}

/* Les gestes d'une ligne tiennent sur une ligne, et passent à la suivante plutôt
   que de pousser le tableau hors de l'écran. */
.tab__actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
/* Une précision sous le nom d'une ligne (mots-clés, référence) se lit dessous. */
.tab td .aide { display: block; }
/* Palier dit en français (« 0 à 1 m² ») : c'est le titre de la ligne. */
.palier__libelle { font-weight: 600; color: var(--text); white-space: nowrap; }

/* Colonnes techniques du tableau de prix : repliées par défaut, dépliées par une
   case à cocher. Sans JavaScript, et sans sortir les champs de la page — replier
   une colonne ne doit rien effacer à l'enregistrement. */
/* `.avance` reste un bloc : le tableau est son enfant, c'est ce qui permet au
   selecteur `~ .table-scroll` de replier les colonnes sans JavaScript. Seule la
   commande grossit — le libelle porte le `for`, donc il EST la cible tactile. */
.avance { display: block; margin-top: .7rem; }
.avance__case {
  width: 1.15rem; height: 1.15rem; min-height: 0; margin: 0;
  accent-color: var(--brand); vertical-align: -.35rem;
}
.avance__label {
  display: inline-flex; align-items: center; min-height: var(--cible);
  padding: .4rem 0; margin-left: .45rem;
  font-size: .9rem; color: var(--text-muted); cursor: pointer;
}
.avance__case:not(:checked) ~ .table-scroll .col-avancee { display: none; }

/* ---- Listes et fiches --------------------------------------------------- */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .2rem; border-bottom: 1px solid var(--border);
}
.liste li:last-child { border-bottom: 0; }
.liste a { font-weight: 550; }
/* Une pastille d'état en fin de ligne se range à droite, alignée d'une ligne à l'autre. */
.liste li .badge:last-child { margin-left: auto; }

.fiche { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.25rem; margin: 0; }
.fiche dt { color: var(--text-subtle); font-size: .85rem; }
.fiche dd { margin: 0; }

/* Une donnée et son libellé sur une ligne (email du compte…). */
.fiche-ligne {
  display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap;
  margin: 0 0 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--border);
}
.fiche-ligne > :last-child { margin-left: auto; }

/* ---- Badges ------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .16rem .55rem; border-radius: var(--radius-pill);
  font-size: .74rem; font-weight: 600; line-height: 1.4;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.badge-role { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.badge-active { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bd); }
.badge-draft { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.badge-alerte { background: var(--err-bg); color: var(--err); border-color: var(--err-bd); }

/* ---- Alertes / messages ------------------------------------------------ */
.ok, .erreur {
  display: flex; align-items: flex-start; gap: .55rem;
  padding: .7rem .9rem; border-radius: 10px; font-size: .92rem;
  border: 1px solid; margin-bottom: 1rem;
}
.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bd); }
.erreur { background: var(--err-bg); color: var(--err); border-color: var(--err-bd); }

/* ---- Bloc secret (affiché une seule fois) ------------------------------ */
.secret {
  background: #0f172a; color: #e6edf6; padding: .85rem 1rem; border-radius: 10px;
  overflow-x: auto; font-size: .95rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  user-select: all; border: 1px solid #1e293b; white-space: pre-wrap; word-break: break-all;
}

/* ---- Pastille de feedback (fixe, toutes pages) ------------------------- */
.feedback-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: flex-end;
}
.feedback-fab__btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: var(--cible);
  padding: .5rem .8rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.feedback-fab__btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: var(--brand);
  box-shadow: 0 14px 34px -12px rgba(15,23,42,.28), 0 5px 12px -6px rgba(15,23,42,.12);
}
.feedback-fab__emoji { font-size: 1.02rem; }

/* Tant que la colonne de lecture touche le bord droit, les pastilles recouvrent
   le coin bas de la page : on réserve leur hauteur sous le contenu. */
@media (max-width: 1120px) {
  .content { padding-bottom: 8rem; }
  .pied { padding-bottom: 4rem; }
}

/* Petit écran : les pastilles se rangent sur UNE rangée de 40 px et gardent leur
   nom. `display: none` sur le libellé le retirait de l'arbre d'accessibilité en
   même temps que de l'écran, et l'emoji est `aria-hidden` : il ne restait plus
   rien à annoncer. La même mise hors-champ que `.hors-ecran` conserve le nom. */
@media (max-width: 640px) {
  .feedback-fab { right: 12px; bottom: 12px; flex-direction: row; }
  .feedback-fab__label {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .feedback-fab__btn { padding: .55rem; border-radius: 50%; width: var(--cible); justify-content: center; }
  .feedback-fab__emoji { font-size: 1.15rem; }
  /* Les pastilles flottent au-dessus du contenu : on leur réserve leur place,
     sinon le dernier bouton de chaque page passe dessous en fin de défilement. */
  .content { padding-bottom: 5.5rem; }
  .pied { padding-bottom: 4rem; }
}


/* ---- Éditeur de consignes ---------------------------------------------- */
/* Deux colonnes : les règles à gauche, le texte que l'assistant recevra à
   droite. Sous 1000 px, l'aperçu passe dessous — jamais côte à côte à l'étroit. */
.content--editeur { max-width: min(1320px, 100%); }

.consignes__colonnes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
@media (min-width: 1000px) {
  .consignes__colonnes { grid-template-columns: minmax(0, 1fr) 24rem; align-items: start; }
  /* Sous la barre d'état, qui est elle-même collante sous la barre du haut. */
  .consignes__apercu { position: sticky; top: calc(var(--topbar-h) + 5.6rem); }
  /* L'aperçu défile dans son cadre : c'est ce qui le garde en vue pendant qu'on
     règle ses briques. En une seule colonne il défile avec la page — un cadre à
     défilement imbriqué au doigt se referme sur lui-même. */
  .apercu { max-height: calc(100vh - var(--topbar-h) - 7rem); overflow-y: auto; }
}
.consignes__principal { min-width: 0; }
.consignes__apercu { min-width: 0; }

/* Barre d'état : ce qui est enregistré, et le bouton qui enregistre. Collante,
   pour que « Enregistrer » ne soit jamais à deux écrans de la saisie en cours. */
.barre-etat {
  position: sticky; top: var(--topbar-h); z-index: 5;
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  margin-bottom: 1.1rem; padding: .7rem 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.barre-etat__etat {
  margin: 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-size: .9rem; color: var(--text-muted); flex: 1 1 16rem;
}
.barre-etat__actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }

/* Une section de l'éditeur : un <details> qui garde l'allure d'une carte. */
.editeur__section { padding: 0; }
.editeur__section + .editeur__section { margin-top: 1.1rem; }
.editeur__tete {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: 1rem 1.3rem; min-height: var(--cible); cursor: pointer;
  font-family: var(--font); font-size: 1.05rem; font-weight: 600; color: var(--text);
  list-style: none;
}
.editeur__tete::-webkit-details-marker { display: none; }
.editeur__titre { margin: 0; font-size: inherit; font-weight: inherit; color: inherit; }
.editeur__tete::after {
  content: ""; margin-left: auto; width: .5rem; height: .5rem;
  border-right: 2px solid var(--text-subtle); border-bottom: 2px solid var(--text-subtle);
  transform: rotate(45deg); transition: transform .2s;
}
.editeur__section[open] .editeur__tete::after { transform: rotate(-135deg); }
.editeur__tete:hover { background: var(--surface-2); }
.editeur__corps { padding: 0 1.3rem 1.3rem; border-top: 1px solid var(--border); padding-top: 1rem; }

/* Carte d'une règle. La poignée ne sert qu'au glisser : les boutons monter /
   descendre font le même travail au clavier et au doigt. */
.briques { list-style: none; margin: 0 0 .9rem; padding: 0; display: grid; gap: .6rem; }
.brique {
  padding: .75rem .85rem; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.brique:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.brique.est-eteinte { opacity: .62; background: var(--surface-2); }
.brique.est-portee { opacity: .45; }
.brique.est-survolee { border-color: var(--brand); box-shadow: 0 -3px 0 -1px var(--brand); }
.brique__tete { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.brique__poignee { color: var(--text-subtle); cursor: grab; font-size: 1.05rem; line-height: 1; }
.brique__titre { font-weight: 600; color: var(--text); }
.brique__gestes { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; margin-left: auto; }
.brique__geste {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--cible); min-height: var(--cible);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-muted);
  font-size: .95rem; line-height: 1; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.brique__geste:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.brique__geste:disabled { opacity: .35; cursor: default; }
.brique__geste--retirer:hover { background: var(--err-bg); color: var(--err); border-color: var(--err-bd); }
.brique .aide { margin: .35rem 0 0; }
.brique .erreur { margin: .5rem 0 0; }

/* Interrupteur actif / en pause : une case à cocher, dite avec des mots. */
.interrupteur {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: var(--cible); padding: 0 .6rem;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: .82rem; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.interrupteur input { width: 1rem; height: 1rem; accent-color: var(--brand); }

.brique__params { display: grid; gap: .7rem; margin-top: .7rem; }
@media (min-width: 640px) { .brique__params { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.brique__param { min-width: 0; }
.brique__param > label {
  display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted);
  margin-bottom: .25rem;
}
.brique__param input, .brique__param select, .brique__param textarea {
  width: 100%; margin-top: .3rem;
}
/* Une saisie de règle : plus basse que la grande zone des consignes libres,
   mais toujours agrandissable. */
.brique__param textarea, .brique__param .champ-consignes { min-height: 5.5rem; }
/* Un nombre n'a pas besoin de toute la largeur : le champ dit sa mesure. */
.brique__param input[type="number"] { width: auto; min-width: 7rem; max-width: 12rem; }
/* Une zone de texte prend toute la largeur : deux colonnes la rendraient illisible. */
.brique__param:has(textarea) { grid-column: 1 / -1; }

/* Liste « Ajouter une règle » : un bouton par brique, avec son aide. */
.ajouts { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
@media (min-width: 640px) { .ajouts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ajouts__bouton {
  display: flex; flex-direction: column; gap: .12rem; width: 100%;
  min-height: var(--cible); padding: .5rem .7rem; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-family: var(--font);
  transition: border-color .15s, background .15s;
}
.ajouts__bouton:hover { border-color: var(--brand); background: var(--surface-2); }
.ajouts__titre { font-weight: 600; color: var(--text); font-size: .9rem; }
.ajouts__bouton .aide { margin: 0; font-size: .82rem; }

.suggestions { margin-top: 1rem; }
.suggestions__liste {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 .85rem;
}
.suggestions__liste .option-case { padding-left: 0; padding-right: 0; }

/* Aperçu : ce que l'assistant recevra. Ce qui vient du membre est surligné ;
   les garde-fous sont repliés et marqués verrouillés. */
.apercu {
  padding: 1.1rem 1.2rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.apercu__compteur { margin: .6rem 0 .2rem; font-size: .85rem; color: var(--text-muted); }
/* Titre du mode : il ne sert que sans onglets, où les deux aperçus s'empilent. */
.apercu__mode { margin: 1rem 0 .3rem; font-size: .95rem; }
.js-onglets .apercu__mode { display: none; }
.apercu__taille { margin: 0 0 .7rem; font-size: .8rem; }
/* Aperçu en cours de calcul, ou qui n'a pas pu se recalculer. Dans les deux cas
   l'écran doit le dire à l'œil ET au lecteur d'écran : afficher un texte périmé
   comme s'il était à jour serait pire que ne rien afficher. */
.apercu[aria-busy="true"] { opacity: .7; }
.apercu__alerte {
  margin: 0 0 .7rem; padding: .5rem .65rem;
  border: 1px solid var(--warn-bd); border-radius: var(--radius-sm);
  background: var(--warn-bg); color: var(--warn); font-size: .85rem;
}
.apercu__alerte:empty { display: none; }
.apercu.est-perime .apercu__contenu { opacity: .55; }
.apercu__bloc { margin-bottom: .5rem; border-radius: var(--radius-sm); }
.apercu__bloc--vous {
  padding: .5rem .6rem;
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  border-left: 3px solid var(--brand);
}
.apercu__bloc--verrouille { background: var(--surface-2); border: 1px solid var(--border); }
.apercu__bloc--verrouille > summary {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem .6rem; min-height: var(--cible); cursor: pointer;
  list-style: none; font-size: .85rem; color: var(--text-muted);
}
.apercu__bloc--verrouille > summary::-webkit-details-marker { display: none; }
.apercu__bloc--verrouille > .aide { padding: 0 .6rem; margin: 0 0 .4rem; font-size: .82rem; }
.apercu__titre { font-size: .85rem; font-weight: 600; color: var(--text); margin: 0 0 .25rem; }
.apercu__texte {
  margin: 0; padding: 0 .6rem .5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .85rem; line-height: 1.6; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.apercu__bloc--vous .apercu__texte { padding: 0; }

/* Règles en lecture seule (offre gratuite, et repli sans JavaScript). */
.regles { list-style: none; margin: .4rem 0 0; padding: 0; }
.regles__item { padding: .55rem .2rem; border-top: 1px solid var(--border); }
.regles__item:first-child { border-top: 0; }
.regles__item.est-eteinte { opacity: .6; }
.regles__titre { margin: 0; font-weight: 600; color: var(--text); }
.regles__valeurs { margin-top: .2rem; font-size: .88rem; }
.regles__valeurs dd { color: var(--text-muted); }

/* Motifs d'un refus d'enregistrement, dans le bandeau d'erreur. */
.liste-motifs { margin: .3rem 0 0; padding-left: 1.1rem; }
.liste-motifs li { margin-top: .15rem; }

/* Le repli « sans JavaScript » disparaît dès que l'éditeur a pris la main. */
.js-consignes .repli-sans-js { display: none; }

/* ======================================================================== */
/* 6. UTILITAIRES                                                           */
/* ======================================================================== */
.aide { color: var(--text-muted); font-size: .9rem; }
.attente { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1.1rem; }

/* Respiration : deux pas seulement, pour ne pas réinventer un jeu d'utilitaires. */
.espace-avant { margin-top: 1.1rem; }
.espace-apres { margin-bottom: 1.2rem; }
.sans-marge { margin: 0; }
/* Une valeur sans espace (adresse, jeton) se coupe plutôt que de déborder. */
.mot-coupe { word-break: break-all; }
/* Titre de sous-partie à l'intérieur d'une carte déjà titrée. */
.sous-titre { margin-top: 1.4rem; }

/* Lisible par un lecteur d'écran, invisible à l'œil (libellés de tableau,
   annonces `aria-live`). Jamais `display:none` : ce serait muet pour tous. */
.hors-ecran {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
