/* Pilotage des appels · styles du module « Règles automatiques » (regles.js).
   Jetons et composants de la refonte : app.css ; contrat du socle : specs/front-v2.md. Aucun nouveau jeton.
   Liste : cartes blanches bordées sur le fond de l'outil. Éditeur en schéma : blocs Quand (bleu), Si (ambre), Alors (rose)
   reliés par des connecteurs, la règle en clair et son test dans une colonne qui reste visible (bureau).
   Avatar de Léa : libre (détourée, jamais dans une bulle ni rognée), règle globale de app.css. */

/* ===== Sections de la page ===== */
.m-regles-section { margin-top: 40px; min-width: 0; }
.entete + .m-regles-section { margin-top: 0; }
.m-regles-section > .section-titre:focus { outline: none; }
.m-regles-section-sous { margin: -6px 0 18px; max-width: 72ch; font: 400 0.9375rem/1.5 var(--police); letter-spacing: -0.006em; color: var(--texte-2); }
.m-regles-stat .valeur { font-variant-numeric: tabular-nums; }

/* Pastille d'icône (déclencheur) : même langage que les blocs du schéma */
.m-regles-pastille-icone { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--accent-teinte); color: var(--accent); }
.m-regles-pastille-icone svg { width: 22px; height: 22px; }

/* Phrase de la règle : les éléments clés (ligne, montant, personnes, moyens) ressortent */
.m-regles-phrase strong, .m-regles-apercu-phrase strong, .m-regles-modele-phrase strong, .m-regles-personnes-exemple strong { font-weight: 650; color: var(--texte); }

/* ===== « Nouvelle règle » : trois tuiles ===== */
.m-regles-tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 16px; }
.m-regles-tuile {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 14px; row-gap: 4px; align-items: start;
  min-height: 116px; padding: 18px 44px 18px 18px; border-radius: var(--r-xl); text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--contour-carte); box-shadow: var(--ombre-carte); color: var(--texte); text-decoration: none;
  font: inherit; transition: box-shadow var(--d-rapide) var(--c-standard), transform var(--d-rapide) var(--c-sortie), border-color var(--d-rapide) var(--c-standard);
}
.m-regles-tuile > .m-regles-tuile-lea, .m-regles-tuile > .m-regles-tuile-icone { grid-row: 1 / span 2; }
@media (hover: hover) { .m-regles-tuile:hover { text-decoration: none; box-shadow: var(--ombre-survol); transform: translateY(-2px); } }
.m-regles-tuile:active { transform: scale(.985); }
.m-regles-tuile-titre { align-self: end; font: 650 1rem/1.3 var(--police); letter-spacing: -0.012em; color: var(--texte); }
.m-regles-tuile-texte { font: 400 0.8125rem/1.45 var(--police); letter-spacing: 0; color: var(--texte-2); }
.m-regles-tuile-chevron { position: absolute; top: 21px; right: 16px; width: 18px; height: 18px; color: #A3A8BA; transition: transform var(--d-rapide) var(--c-sortie), color var(--d-rapide); }
@media (hover: hover) { .m-regles-tuile:hover .m-regles-tuile-chevron { transform: translateX(2px); color: var(--accent); } }
/* Léa, libre : tête et épaules entières, au rapport de l'image (170 × 192) */
.m-regles-tuile-lea { display: block; width: 44px; height: 50px; margin-top: -4px; }
.m-regles-tuile-lea img, .m-regles-lea-mini img { display: block; width: 100%; height: 100%; }
.m-regles-tuile-icone { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.m-regles-tuile-icone svg { width: 22px; height: 22px; }
.m-regles-ton-quand { background: var(--accent-teinte); color: var(--accent); }
.m-regles-ton-alors { background: var(--rose-pale); color: var(--action); }

/* ===== Cartes des règles ===== */
.m-regles-cartes { display: grid; gap: 16px; }
.m-regles-vide .vide { padding-block: 26px; }
.m-regles-carte {
  position: relative; min-width: 0; padding: 20px 24px 18px; border-radius: var(--r-xl); scroll-margin: 24px 0 96px;
  background: var(--surface); border: 1px solid var(--contour-carte); box-shadow: var(--ombre-carte);
  transition: box-shadow var(--d-base) var(--c-standard);
}
/* Règle active : un liseré vert discret à gauche, en plus de l'interrupteur et de son libellé */
.m-regles-carte-active { box-shadow: inset 4px 0 0 var(--vert), var(--ombre-carte); }
.m-regles-surlignee { box-shadow: 0 0 0 3px rgba(33, 60, 160, .22), var(--ombre-survol); }
.m-regles-carte-active.m-regles-surlignee { box-shadow: inset 4px 0 0 var(--vert), 0 0 0 3px rgba(33, 60, 160, .22), var(--ombre-survol); }
.m-regles-carte-tete { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.m-regles-carte-titres { min-width: 0; }
.m-regles-carte-quand { margin: 0 0 2px; font: 600 0.8125rem/1.3 var(--police); letter-spacing: 0; color: var(--accent-texte); }
.m-regles-carte-titre { margin: 0; font: 650 1.0625rem/1.35 var(--police); letter-spacing: -0.012em; overflow-wrap: anywhere; }
.m-regles-carte-titre:focus { outline: none; }
.m-regles-carte-titre:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.m-regles-carte-meta { margin: 3px 0 0; }
.m-regles-source { display: inline-flex; align-items: center; gap: 5px; vertical-align: -6px; }
.m-regles-lea-mini { display: block; flex: none; width: 20px; height: 23px; }
.m-regles-carte-corps { margin-left: 58px; min-width: 0; }
.m-regles-phrase { margin: 12px 0 0; max-width: 78ch; font: 400 0.9375rem/1.6 var(--police); letter-spacing: -0.006em; color: var(--texte); overflow-wrap: anywhere; }
.m-regles-hors-outil { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; max-width: 78ch; font: 500 0.875rem/1.45 var(--police); letter-spacing: 0; color: var(--action); }
.m-regles-hors-outil svg { width: 17px; height: 17px; margin-top: 1px; flex: none; }
.m-regles-carte-alerte { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-m); background: var(--ambre-pale); color: var(--ambre-texte); font: 500 0.875rem/1.45 var(--police); }
.m-regles-carte-alerte svg { width: 17px; height: 17px; margin-top: 1px; flex: none; }
.m-regles-executions { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font: 500 0.8125rem/1.4 var(--police); letter-spacing: 0; color: var(--texte-2); }
.m-regles-executions svg { width: 15px; height: 15px; color: var(--texte-3); }
.m-regles-carte-zone:not(:empty) { margin-top: 14px; }
.m-regles-carte-pied { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 0 58px; padding-top: 14px; border-top: 1px solid var(--separateur); }
.m-regles-carte-pied .m-regles-supprimer { margin-left: auto; }
.btn-discret.m-regles-supprimer { color: var(--rouge-texte); }
@media (hover: hover) { .btn-discret.m-regles-supprimer:hover { background: var(--rouge-pale); } }

/* Interrupteur (role switch) : piste bordée hors tension (contour ≥ 3:1), verte en tension, libellé visible à gauche */
.m-regles-inter {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px 0 10px; margin: -6px -4px 0 0; border: 0; border-radius: var(--r-m);
  background: none; color: var(--texte-2); font: 600 0.8125rem/1 var(--police); letter-spacing: 0; cursor: pointer; white-space: nowrap;
}
@media (hover: hover) { .m-regles-inter:hover { background: var(--survol-ligne); } }
.m-regles-inter[aria-checked="true"] { color: var(--vert-texte); }
.m-regles-inter[aria-busy="true"] { cursor: progress; }
.m-regles-inter[aria-busy="true"] .m-regles-piste { opacity: .6; }
.m-regles-piste {
  position: relative; flex: none; width: 46px; height: 28px; border-radius: var(--r-capsule);
  background: var(--remplissage-presse); box-shadow: inset 0 0 0 1.5px var(--contour-champ);
  transition: background-color var(--d-rapide) var(--c-standard), box-shadow var(--d-rapide) var(--c-standard);
}
.m-regles-pouce { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; box-shadow: var(--ombre-pouce); transition: transform var(--d-base) var(--c-sortie); }
.m-regles-inter[aria-checked="true"] .m-regles-piste { background: var(--vert); box-shadow: none; }
.m-regles-inter[aria-checked="true"] .m-regles-pouce { transform: translateX(18px); }

/* Résultat d'un test, confirmation, messages */
.m-regles-test { position: relative; padding: 14px 16px; border-radius: var(--r-l); background: var(--surface-inset); }
/* Le bouton qui masque le résultat occupe le coin haut droit : seul le texte d'en-tête lui laisse la place, les exemples gardent toute la largeur */
.m-regles-test > .m-regles-test-titre, .m-regles-test > .m-regles-test-attente, .m-regles-test > .m-regles-erreur { margin-right: 40px; }
.m-regles-test-titre { margin: 0; font: 400 0.9375rem/1.5 var(--police); }
.m-regles-test-titre strong { font-weight: 650; }
.m-regles-test-plus { margin: 8px 0 0; font: 500 0.8125rem/1.4 var(--police); color: var(--texte-2); }
.m-regles-fermer {
  position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: none; color: var(--texte-2); transition: background-color var(--d-rapide) var(--c-standard);
}
.m-regles-fermer svg { width: 18px; height: 18px; }
@media (hover: hover) { .m-regles-fermer:hover { background: var(--remplissage); color: var(--texte); } }
.m-regles-exemples { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.m-regles-exemple {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 10px 8px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--separateur); color: inherit; text-decoration: none;
}
.m-regles-exemple-lien { transition: border-color var(--d-rapide) var(--c-standard), box-shadow var(--d-rapide) var(--c-standard); }
@media (hover: hover) { .m-regles-exemple-lien:hover { text-decoration: none; border-color: var(--separateur-fort); box-shadow: var(--ombre-carte); } }
.m-regles-exemple-corps { flex: 1; min-width: 0; display: grid; gap: 1px; }
.m-regles-exemple-texte { font: 500 0.875rem/1.4 var(--police); color: var(--texte); overflow-wrap: anywhere; }
.m-regles-exemple-date { font: 400 0.8125rem/1.35 var(--police); letter-spacing: 0; color: var(--texte-2); }
.m-regles-chevron { width: 16px; height: 16px; color: #A3A8BA; }
.m-regles-confirmation { padding: 14px 16px; border-radius: var(--r-l); background: var(--rouge-pale); }
.m-regles-confirmation p { margin: 0 0 12px; max-width: 70ch; font: 400 0.9375rem/1.5 var(--police); color: var(--texte); }
.m-regles-confirmation .m-regles-erreur { margin-bottom: 12px; background: var(--surface); }
.m-regles-btn-danger { background: var(--rouge-texte); color: #FFFFFF; }
@media (hover: hover) { .m-regles-btn-danger:hover { background: var(--rouge-texte); box-shadow: inset 0 0 0 100px rgba(14, 22, 56, .14); } }
.m-regles-btn-danger:active { background: var(--rouge-texte); box-shadow: inset 0 0 0 100px rgba(14, 22, 56, .22); }
.m-regles-erreur { margin: 0; }
.m-regles-erreur svg { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.m-regles-erreur-texte p { margin: 0; }
.m-regles-messages { margin: 0; padding-left: 18px; }
.m-regles-messages li + li { margin-top: 4px; }
.m-regles-messages li:first-child:not(:only-child) { list-style: none; margin-left: -18px; }

/* ===== Modèles prêts à l'emploi ===== */
.m-regles-modeles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); gap: 16px; }
.m-regles-modele {
  display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 20px 22px 20px; border-radius: var(--r-xl);
  background: var(--surface); border: 1px solid var(--contour-carte); box-shadow: var(--ombre-carte);
}
.m-regles-modele-tete { display: flex; align-items: center; gap: 14px; }
.m-regles-modele-titres { min-width: 0; }
.m-regles-modele-quand { margin: 0 0 2px; font: 600 0.8125rem/1.3 var(--police); letter-spacing: 0; color: var(--accent-texte); }
.m-regles-modele-tete h3 { margin: 0; font: 650 1.0625rem/1.3 var(--police); letter-spacing: -0.012em; }
.m-regles-modele-argument { margin: 0; font: 400 0.9375rem/1.55 var(--police); letter-spacing: -0.006em; color: var(--texte); }
.m-regles-modele-phrase { padding: 12px 14px; border-radius: var(--r-m); background: var(--surface-inset); }
.m-regles-modele-libelle { display: block; margin-bottom: 3px; font: 600 0.75rem/1.3 var(--police); letter-spacing: 0; color: var(--texte-2); }
.m-regles-modele-phrase p { margin: 0; font: 400 0.875rem/1.55 var(--police); letter-spacing: 0; color: var(--texte); }
.m-regles-modele-attention { display: flex; align-items: flex-start; gap: 8px; margin: 0; font: 500 0.8125rem/1.45 var(--police); letter-spacing: 0; color: var(--ambre-texte); }
.m-regles-modele-attention svg { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.m-regles-modele-sim { display: flex; align-items: center; gap: 8px; margin: 0; font: 400 0.875rem/1.45 var(--police); color: var(--accent-texte); }
.m-regles-modele-sim strong { font-weight: 650; }
.m-regles-modele-sim svg { width: 16px; height: 16px; color: var(--accent); }
.m-regles-modele-sim-zero { color: var(--texte-2); }
.m-regles-modele-sim-zero svg { color: var(--texte-3); }
.m-regles-modele-pied { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: auto; }
.m-regles-modele-note { font: 500 0.8125rem/1.4 var(--police); color: var(--ambre-texte); }

/* ===== Personnes à prévenir : mises en valeur (une alerte sans utiliser l'outil) ===== */
.m-regles-personnes { padding: 0; overflow: hidden; }
.m-regles-personnes-tete { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 16px; align-items: start; padding: 22px 24px 22px 28px; background: var(--rose-pale); border-bottom: 1px solid var(--separateur); }
.m-regles-personnes-icone { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--action); color: #FFFFFF; }
.m-regles-personnes-icone svg { width: 22px; height: 22px; }
.m-regles-personnes-corps { min-width: 0; display: grid; gap: 6px; }
.m-regles-personnes-titre { margin: 0; font: 700 1.0625rem/1.3 var(--police); letter-spacing: -0.014em; color: var(--texte); }
.m-regles-personnes-texte { margin: 0; max-width: 74ch; font: 400 0.9375rem/1.55 var(--police); letter-spacing: -0.006em; color: var(--texte); }
.m-regles-personnes-exemple { display: grid; gap: 2px; margin: 6px 0 0; max-width: 74ch; padding: 10px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--separateur); font: 400 0.875rem/1.55 var(--police); letter-spacing: 0; color: var(--texte-2); overflow-wrap: anywhere; }
.m-regles-personnes-ex-libelle { font: 600 0.75rem/1.3 var(--police); color: var(--action); }
.m-regles-personnes-liste { padding: 6px 24px 20px 28px; }
.m-regles-contacts-vide { margin: 0; padding: 14px 0 18px; font: 400 0.9375rem/1.5 var(--police); color: var(--texte-2); }
.m-regles-contact { padding: 12px 0; }
.m-regles-contact + .m-regles-contact { border-top: 1px solid var(--separateur); }
.m-regles-contact-ligne { display: flex; align-items: center; gap: 14px; min-height: 44px; }
.m-regles-contact-corps { flex: 1; min-width: 0; display: grid; gap: 2px; }
.m-regles-contact-nom { font: 600 0.9375rem/1.35 var(--police); overflow-wrap: anywhere; }
.m-regles-contact-moyens { font: 500 0.8125rem/1.35 var(--police); letter-spacing: 0; color: var(--action); }
.m-regles-contact-ajout { padding-top: 14px; border-top: 1px solid var(--separateur); }
.m-regles-contacts:has(.m-regles-contacts-vide) + .m-regles-contact-ajout { padding-top: 0; border-top: 0; }
.m-regles-form { display: grid; gap: 14px; }
.m-regles-form-titre { margin: 0; font: 650 1rem/1.3 var(--police); letter-spacing: -0.012em; }
.m-regles-form-erreur:empty { display: none; }
.m-regles-form-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.m-regles-form .m-regles-form-titre + .m-regles-aide { margin-top: -8px; }
.m-regles-form .m-regles-form-grille + .m-regles-aide { margin-top: -4px; }

/* ===== Champs du module ===== */
.m-regles-champ { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; align-content: start; }
.m-regles-etiquette-ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.m-regles-etiquette { font: 600 0.8125rem/1.3 var(--police); letter-spacing: 0; color: var(--texte-2); }
.m-regles-etiquette-ligne .pastille { height: 22px; padding: 0 8px; font-size: 0.75rem; }
.m-regles-aide { margin: 0; font: 400 0.8125rem/1.45 var(--police); letter-spacing: 0; color: var(--texte-2); }
.m-regles-aide-attention { display: flex; align-items: flex-start; gap: 8px; color: var(--ambre-texte); font-weight: 500; }
.m-regles-aide-attention svg { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.m-regles-saisie {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--contour-champ); border-radius: var(--r-m); background: var(--surface);
  font: 500 0.9375rem/1 var(--police); color: var(--texte); transition: border-color var(--d-rapide) var(--c-standard), box-shadow var(--d-rapide) var(--c-standard);
}
@media (hover: hover) { .m-regles-saisie:hover { border-color: var(--contour-champ-survol); } }
.m-regles-saisie:focus { outline: none; border-color: var(--accent); box-shadow: var(--halo-champ); }
.m-regles-saisie[aria-invalid="true"] { border-color: var(--rouge-texte); }
.m-regles-champ select { width: 100%; min-width: 0; }
.m-regles-nombre { position: relative; }
.m-regles-nombre .m-regles-saisie { padding-right: 84px; font-variant-numeric: tabular-nums; }
.m-regles-unite { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); font: 500 0.875rem/1 var(--police); color: var(--texte-2); pointer-events: none; }

/* ===== Éditeur en schéma ===== */
.m-regles-note { margin-top: -8px; }
.m-regles-note-attention { background: var(--ambre-pale); color: var(--ambre-texte); }
.m-regles-note-attention svg { color: var(--ambre-texte); }
.m-regles-lien-inline { display: inline; min-height: 0; vertical-align: baseline; color: var(--accent-texte); text-decoration: underline; text-underline-offset: 3px; }
.m-regles-lien-inline::after { display: none; }
.m-regles-etat { display: flex; align-items: center; gap: 8px; }
.m-regles-editeur { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: 28px; align-items: start; }
.m-regles-colonne { min-width: 0; }
.m-regles-legende { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font: 600 0.8125rem/1 var(--police); letter-spacing: 0; color: var(--texte-2); }
.m-regles-legende-item { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--r-capsule); }
.m-regles-legende-quand { background: var(--accent-teinte); color: var(--accent-texte); }
.m-regles-legende-si { background: var(--ambre-pale); color: var(--ambre-texte); }
.m-regles-legende-alors { background: var(--rose-pale); color: var(--action); }
.m-regles-legende-sep { color: var(--texte-3); }
.m-regles-schema { display: grid; max-width: 760px; }

/* Blocs : bande de couleur en tête (pastille d'icône pleine), corps blanc */
.m-regles-bloc {
  min-width: 0; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--contour-carte); box-shadow: var(--ombre-carte);
  scroll-margin: 24px 0 96px; transition: border-color var(--d-rapide) var(--c-standard), box-shadow var(--d-rapide) var(--c-standard);
}
.m-regles-nouveau { animation: m-regles-entre var(--d-base) var(--c-sortie); }
@keyframes m-regles-entre { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.m-regles-bloc-tete {
  display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 7px 8px 7px 14px;
  border-bottom: 1px solid var(--separateur); border-radius: calc(var(--r-l) - 1px) calc(var(--r-l) - 1px) 0 0;
}
.m-regles-bloc-quand .m-regles-bloc-tete { background: var(--accent-teinte); }
.m-regles-bloc-si .m-regles-bloc-tete { background: var(--ambre-pale); }
.m-regles-bloc-alors .m-regles-bloc-tete { background: var(--rose-pale); }
.m-regles-bloc-icone { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; color: #FFFFFF; }
.m-regles-bloc-icone svg { width: 18px; height: 18px; stroke-width: 2; }
.m-regles-bloc-quand .m-regles-bloc-icone { background: var(--accent); }
.m-regles-bloc-si .m-regles-bloc-icone { background: var(--ambre); }
.m-regles-bloc-alors .m-regles-bloc-icone { background: var(--action); }
.m-regles-bloc-titre { flex: 1; min-width: 0; margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; font: 700 1rem/1.3 var(--police); letter-spacing: -0.012em; }
.m-regles-bloc-quand .m-regles-bloc-mot { color: var(--accent-texte); }
.m-regles-bloc-si .m-regles-bloc-mot { color: var(--ambre-texte); }
.m-regles-bloc-alors .m-regles-bloc-mot { color: var(--action); }
.m-regles-bloc-quoi { font: 500 0.875rem/1.3 var(--police); letter-spacing: -0.006em; color: var(--texte-2); }
.m-regles-retirer {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: none; color: var(--texte-2); transition: background-color var(--d-rapide) var(--c-standard), color var(--d-rapide);
}
.m-regles-retirer svg { width: 18px; height: 18px; }
@media (hover: hover) { .m-regles-retirer:hover { background: rgba(14, 22, 56, .07); color: var(--texte); } }
.m-regles-bloc-corps { display: grid; gap: 14px; padding: 16px; min-width: 0; }
.m-regles-bloc-message:empty { display: none; }
.m-regles-bloc-message { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-m); background: var(--rouge-pale); color: var(--rouge-texte); font: 500 0.875rem/1.45 var(--police); }
.m-regles-bloc-message svg { width: 17px; height: 17px; margin-top: 1px; flex: none; }
.m-regles-bloc-erreur { border-color: var(--rouge-texte); }
.m-regles-select-large { width: 100%; height: 44px; font-weight: 600; }

/* Conditions : l'information sur toute la largeur (libellés longs), puis la comparaison et la valeur côte à côte */
.m-regles-condition { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 12px; align-items: start; }
.m-regles-condition > .m-regles-champ:first-child, .m-regles-condition-large > .m-regles-champ-large { grid-column: 1 / -1; }
.m-regles-champ-court { max-width: 220px; }

/* Puces à cocher (valeurs, lignes, canaux) */
.m-regles-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.m-regles-puce {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--r-capsule); cursor: pointer;
  border: 1px solid var(--contour-champ); background: var(--surface); color: var(--texte); font: 500 0.875rem/1 var(--police); letter-spacing: -0.004em;
  transition: background-color var(--d-rapide) var(--c-standard), border-color var(--d-rapide) var(--c-standard);
}
.m-regles-puce svg { display: none; width: 14px; height: 14px; stroke-width: 2.4; }
@media (hover: hover) { .m-regles-puce:not(:disabled):hover { border-color: var(--contour-champ-survol); } }
.m-regles-puce[aria-pressed="true"] { padding-left: 10px; background: var(--accent-teinte); border-color: var(--accent); color: var(--accent-texte); font-weight: 600; }
.m-regles-puce[aria-pressed="true"] svg { display: block; }
.m-regles-puce:disabled { cursor: default; border-style: dashed; border-color: var(--separateur-fort); color: var(--texte-3); background: transparent; }

/* Destinataires : puces retirables (personne à prévenir en rose, à choisir en ambre), puis la liste pour en ajouter */
.m-regles-dests { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.m-regles-dest {
  display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 2px 0 12px; border-radius: var(--r-capsule);
  background: var(--accent-teinte); color: var(--accent-texte); font: 600 0.875rem/1 var(--police); letter-spacing: -0.004em; max-width: 100%;
}
.m-regles-dest-nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-regles-dest-contact { gap: 6px; padding-left: 10px; background: var(--rose-pale); color: var(--action); }
.m-regles-dest-icone { width: 16px; height: 16px; flex: none; }
.m-regles-dest-vide { background: var(--ambre-pale); color: var(--ambre-texte); box-shadow: inset 0 0 0 1px var(--ambre-texte); }
.m-regles-dest-interdit { background: var(--rouge-pale); color: var(--rouge-texte); text-decoration: line-through; }
.m-regles-dest-retirer {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; background: none; color: inherit;
  transition: background-color var(--d-rapide) var(--c-standard);
}
.m-regles-dest-retirer svg { width: 15px; height: 15px; stroke-width: 2.2; }
@media (hover: hover) { .m-regles-dest-retirer:hover { background: rgba(14, 22, 56, .08); } }
.m-regles-dests .m-regles-ajout-dest { flex: 1 1 220px; width: auto; min-width: 0; max-width: 100%; height: 36px; border-style: dashed; }
.m-regles-lien-contacts { justify-self: start; gap: 6px; }
.m-regles-lien-contacts svg { width: 16px; height: 16px; stroke-width: 2.2; }
.m-regles-lien-contacts::after { display: none; }
/* Nouvelle personne à prévenir, directement dans le bloc « Alors » */
.m-regles-form-bloc { padding: 14px 16px 16px; border-radius: var(--r-m); background: var(--surface-inset); border: 1px solid var(--separateur); }

/* Choix d'une action */
.m-regles-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-regles-option {
  display: flex; align-items: flex-start; gap: 12px; min-height: 64px; padding: 12px 14px; border-radius: var(--r-m); text-align: left; cursor: pointer;
  border: 1px solid var(--separateur-fort); background: var(--surface); color: var(--texte); font: inherit;
  transition: border-color var(--d-rapide) var(--c-standard), box-shadow var(--d-rapide) var(--c-standard), transform var(--d-pression) var(--c-sortie);
}
@media (hover: hover) { .m-regles-option:not(:disabled):hover { border-color: var(--action); box-shadow: var(--ombre-carte); } }
.m-regles-option:not(:disabled):active { transform: scale(.985); }
.m-regles-option:disabled { cursor: default; background: var(--surface-inset); border-style: dashed; }
.m-regles-option:disabled .m-regles-option-icone { background: var(--remplissage); color: var(--texte-3); }
.m-regles-option-icone { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--rose-pale); color: var(--action); }
.m-regles-option-icone svg { width: 19px; height: 19px; }
.m-regles-option-texte { display: grid; gap: 3px; min-width: 0; }
.m-regles-option-titre { font: 650 0.9375rem/1.3 var(--police); letter-spacing: -0.008em; }
.m-regles-option-aide { font: 400 0.8125rem/1.4 var(--police); letter-spacing: 0; color: var(--texte-2); }

/* Connecteurs : trait vertical et flèche ; les boutons d'ajout se posent dessus */
.m-regles-lien { position: relative; display: flex; justify-content: center; align-items: center; min-height: 30px; }
.m-regles-lien::before { content: ''; position: absolute; top: 0; bottom: 2px; left: 50%; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--separateur-fort); }
.m-regles-lien::after {
  content: ''; position: absolute; bottom: 1px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px;
  border-right: 2px solid var(--separateur-fort); border-bottom: 2px solid var(--separateur-fort); transform: rotate(45deg); border-radius: 0 0 2px 0;
}
.m-regles-lien-ajout { min-height: 76px; padding-block: 16px; }
.m-regles-lien-fin { min-height: 64px; }
.m-regles-lien-fin::before { bottom: 50%; }
.m-regles-lien-fin::after { display: none; }
.m-regles-ajouts { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.m-regles-ajout {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px 0 12px; border-radius: var(--r-capsule); cursor: pointer;
  border: 1px dashed var(--contour-champ); background: var(--surface); font: 600 0.875rem/1 var(--police); letter-spacing: -0.004em;
  transition: border-color var(--d-rapide) var(--c-standard), box-shadow var(--d-rapide) var(--c-standard);
}
.m-regles-ajout svg { width: 16px; height: 16px; stroke-width: 2.2; }
.m-regles-ajout-si { color: var(--ambre-texte); }
.m-regles-ajout-alors { color: var(--action); }
@media (hover: hover) { .m-regles-ajout:hover { border-style: solid; box-shadow: var(--ombre-carte); } }

/* ===== Colonne de droite : la règle en clair, le test, l'enregistrement ===== */
.m-regles-apercu { display: grid; gap: 16px; min-width: 0; }
.m-regles-apercu.m-regles-collant { position: sticky; top: 24px; }
.m-regles-apercu .carte { padding: 20px 22px 22px; }
.m-regles-apercu h2 { margin: 0; font: 700 1.125rem/1.3 var(--police); letter-spacing: -0.016em; }
.m-regles-carte-clair-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.m-regles-apercu-phrase { margin: 0; padding: 14px 16px; border-radius: var(--r-m); background: var(--surface-inset); font: 400 0.9375rem/1.6 var(--police); letter-spacing: -0.006em; color: var(--texte); overflow-wrap: anywhere; }
.m-regles-apercu-note:empty { display: none; }
.m-regles-apercu-note .m-regles-hors-outil { margin-top: 12px; }
.m-regles-test-zone { margin-top: 16px; transition: opacity var(--d-rapide) var(--c-standard); }
.m-regles-test-maj { opacity: .55; }
.m-regles-test-attente { display: flex; align-items: flex-start; gap: 8px; margin: 0; font: 400 0.875rem/1.5 var(--police); color: var(--texte-2); }
.m-regles-test-attente svg { width: 17px; height: 17px; margin-top: 2px; flex: none; }
.m-regles-test-attente .chargeur { margin-top: 3px; }
.m-regles-test-surtitre { margin: 0; font: 600 0.8125rem/1.3 var(--police); letter-spacing: 0; color: var(--texte-2); }
.m-regles-chiffre { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 0; font: 500 0.9375rem/1.2 var(--police); color: var(--texte-2); }
.m-regles-chiffre strong { font: 700 2.25rem/1 var(--police); letter-spacing: -0.03em; color: var(--texte); font-variant-numeric: tabular-nums; }
.m-regles-test-detail { margin: 8px 0 0; font: 400 0.875rem/1.5 var(--police); color: var(--texte-2); }
.m-regles-test-zone .m-regles-exemple { background: var(--surface-inset); border-color: transparent; }
@media (hover: hover) { .m-regles-test-zone .m-regles-exemple-lien:hover { background: var(--surface); border-color: var(--separateur-fort); } }
.m-regles-carte-enregistrer { display: grid; gap: 14px; }
.m-regles-carte-enregistrer-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.m-regles-modifie { display: flex; align-items: center; gap: 8px; margin: -6px 0 0; font: 500 0.8125rem/1.3 var(--police); letter-spacing: 0; color: var(--ambre-texte); }
.m-regles-erreurs:empty { display: none; }
.m-regles-erreurs:focus { outline: none; }
.m-regles-erreurs:focus-visible .m-regles-erreur { outline: 2px solid var(--focus); outline-offset: 2px; }
.m-regles-boutons { display: grid; gap: 8px; }
.m-regles-btn-large { width: 100%; height: 44px; }
.m-regles-btn-large[aria-disabled="true"] { opacity: .55; cursor: progress; }

/* ===== Adaptations ===== */
@media (max-width: 1279px) {
  .m-regles-editeur { grid-template-columns: minmax(0, 1fr); }
  .m-regles-apercu { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); align-items: start; }
  .m-regles-schema { max-width: none; }
}
/* Tablette : les trois tuiles restent sur une ligne, le visuel passe au-dessus du titre (jamais une tuile seule sur sa ligne) */
@media (min-width: 641px) and (max-width: 1279px) {
  .m-regles-tuiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .m-regles-tuile { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; row-gap: 4px; padding: 16px 16px 18px; }
  .m-regles-tuile > .m-regles-tuile-lea, .m-regles-tuile > .m-regles-tuile-icone { grid-row: auto; margin-bottom: 8px; }
  .m-regles-tuile > .m-regles-tuile-lea { margin-top: -6px; margin-bottom: 2px; }
  .m-regles-tuile-titre { align-self: start; }
  .m-regles-tuile-chevron { top: 18px; right: 14px; }
}
@media (max-width: 899px) {
  .m-regles-carte, .m-regles-bloc { scroll-margin: 72px 0 96px; }
}
@media (max-width: 640px) {
  .m-regles-section { margin-top: 32px; }
  .m-regles-section-sous { margin-bottom: 14px; font-size: 0.875rem; }
  .m-regles-tuiles { gap: 12px; }
  .m-regles-tuile { min-height: 0; padding: 16px 40px 16px 16px; }
  .m-regles-carte { padding: 16px 16px 14px; }
  .m-regles-carte-tete { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; }
  .m-regles-pastille-icone { width: 40px; height: 40px; border-radius: 11px; }
  .m-regles-pastille-icone svg { width: 20px; height: 20px; }
  .m-regles-inter-texte { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .m-regles-inter { padding: 0 2px; margin: -4px -2px 0 0; }
  .m-regles-carte-corps, .m-regles-carte-pied { margin-left: 0; }
  .m-regles-carte-pied .btn { flex: 1 1 auto; min-height: 44px; }
  .m-regles-carte-pied .m-regles-supprimer { margin-left: 0; }
  .m-regles-test { padding: 12px 12px 12px 14px; }
  .m-regles-modele { padding: 18px 16px; }
  .m-regles-modele-pied .btn { min-height: 44px; }
  .m-regles-personnes-tete { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 18px 16px 18px 20px; }
  .m-regles-personnes-icone { width: 40px; height: 40px; border-radius: 11px; }
  .m-regles-personnes-liste { padding: 4px 16px 18px 20px; }
  .m-regles-form-grille { grid-template-columns: minmax(0, 1fr); }
  .m-regles-form-bloc { padding: 12px 12px 14px; }
  .m-regles-saisie { height: 44px; font-size: 1rem; }
  .m-regles-champ select { height: 44px; }
  .m-regles-condition { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .m-regles-champ-court { max-width: none; }
  .m-regles-options { grid-template-columns: minmax(0, 1fr); }
  .m-regles-bloc-corps { padding: 14px; }
  .m-regles-bloc-tete { padding-left: 12px; }
  .m-regles-legende { display: none; }
  .m-regles-apercu .carte { padding: 18px 16px 20px; }
}
@media (max-width: 640px), (pointer: coarse) {
  .m-regles-puce, .m-regles-dest { min-height: 40px; }
  .m-regles-dest-retirer { width: 40px; height: 40px; }
  .m-regles-dests .m-regles-ajout-dest { height: 40px; }
  .m-regles-lien-contacts { min-height: 40px; }
  .m-regles-exemple { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .m-regles-nouveau { animation: fondu var(--d-rapide) linear; }
  .m-regles-tuile, .m-regles-tuile-chevron, .m-regles-pouce, .m-regles-piste, .m-regles-carte, .m-regles-option, .m-regles-test-zone { transition: none; }
  @media (hover: hover) { .m-regles-tuile:hover, .m-regles-tuile:hover .m-regles-tuile-chevron { transform: none; } }
  .m-regles-tuile:active, .m-regles-option:not(:disabled):active { transform: none; }
}
@media (prefers-contrast: more) {
  .m-regles-puce:disabled { color: var(--texte-2); }
  .m-regles-lien::before { background: var(--contour-champ); }
  .m-regles-lien::after { border-color: var(--contour-champ); }
}
