/* ==========================================================================
   EvenGate · Système de conception (composants)
   Ne contient AUCUNE couleur en dur : tout passe par les jetons
   (jetons/registre.css par défaut, jetons/salon.css en option).
   Sommaire : 1 base · 2 cadre · 3 page · 4 boutons · 5 champs · 6 badges et puces
   · 7 cartes et tuiles · 8 tableau · 9 panneau de détail · 10 états
   · 11 dialogue · 12 notifications · 13 annonce · 14 onglets · 15 chronologie · 16 utilitaires
   ========================================================================== */

/* 1. Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: var(--taille-base);
  line-height: var(--interligne);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--police-titre);
  font-weight: var(--graisse-titre);
  letter-spacing: var(--interlettrage-titre);
  line-height: 1.2;
  text-wrap: balance;
}
h1 { font-size: var(--taille-h1); }
h2 { font-size: var(--taille-h2); }
h3 { font-size: var(--taille-h3); }
p { margin: 0; }
a { color: var(--lien); text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.ic { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic--petit { width: 1rem; height: 1rem; }
.ic--grand { width: 1.75rem; height: 1.75rem; }
.chiffres { font-family: var(--police-chiffres); font-variant-numeric: tabular-nums; }
.doux { color: var(--texte-doux); }
.petit { font-size: var(--taille-petit); }
.mini { font-size: var(--taille-mini); }
.visuellement-cache {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.lien-evitement {
  position: absolute; left: var(--e-3); top: -100px; z-index: 100;
  background: var(--primaire); color: var(--sur-primaire); padding: var(--e-2) var(--e-4);
  border-radius: var(--rayon-petit); font-weight: 600; text-decoration: none;
}
.lien-evitement:focus { top: var(--e-2); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 2. Cadre commun (en-tête EvenGate) ------------------------------------- */
.cadre {
  position: sticky; top: 0; z-index: 40;
  background: var(--entete-fond);
  color: var(--entete-texte);
  border-bottom: 1px solid var(--entete-bordure);
}
.cadre__barre {
  max-width: var(--largeur-max); margin: 0 auto;
  min-height: var(--hauteur-entete);
  display: flex; align-items: center; gap: var(--e-3);
  padding: var(--e-2) var(--e-4);
}
.cadre__marque {
  display: inline-flex; align-items: center; gap: var(--e-2);
  color: inherit; text-decoration: none; min-height: var(--cible-tactile); flex: none;
}
.cadre__logo {
  display: block; width: 132px; height: 17px;
  background: var(--logo-portail) left center / contain no-repeat;
}
.cadre__module {
  display: flex; align-items: center; gap: var(--e-2);
  min-width: 0; padding-left: var(--e-3); border-left: 1px solid currentColor;
  border-left-color: color-mix(in srgb, currentColor 30%, transparent);
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cadre__module span { overflow: hidden; text-overflow: ellipsis; }
.cadre__espace { flex: 1; }
.cadre__actions { display: flex; align-items: center; gap: var(--e-1); position: relative; }
.cadre .bouton-icone { color: inherit; }
.cadre .bouton-icone:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--primaire-doux); color: var(--primaire);
  font-weight: 700; font-size: .8125rem; letter-spacing: .02em;
}
.avatar--grand { width: 2.75rem; height: 2.75rem; font-size: 1rem; }
.cadre .avatar { background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: min(300px, calc(100vw - 24px));
  background: var(--surface); color: var(--texte);
  border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre-3);
  padding: var(--e-2);
}
.menu__tete { display: flex; gap: var(--e-3); align-items: center; padding: var(--e-2); border-bottom: 1px solid var(--bordure); margin-bottom: var(--e-2); }
.menu__tete strong { display: block; }
.menu__item {
  display: flex; width: 100%; align-items: center; gap: var(--e-3);
  min-height: var(--cible-tactile); padding: 0 var(--e-3);
  border: 0; border-radius: var(--rayon-petit); background: none;
  color: inherit; text-decoration: none; text-align: left;
}
.menu__item:hover { background: var(--surface-survol); }
.menu__sep { height: 1px; background: var(--bordure); margin: var(--e-2) 0; }
.menu__libelle { font-size: var(--taille-mini); color: var(--texte-doux); padding: var(--e-2) var(--e-3) var(--e-1); }

@media (max-width: 640px) {
  .cadre__barre { padding: var(--e-1) var(--e-3); gap: var(--e-2); }
  .cadre__logo { width: 104px; height: 14px; }
  .cadre__module { padding-left: var(--e-2); font-size: var(--taille-petit); }
  .cadre__module .ic { display: none; }
}
@media (max-width: 380px) {
  .cadre__logo { width: 22px; height: 22px; background-image: url("../images/icon-32.png"); border-radius: 6px; }
}

/* 3. Page ------------------------------------------------------------------ */
.page { max-width: var(--largeur-max); margin: 0 auto; padding: var(--e-5) var(--e-4) var(--e-7); }
.page--large { max-width: 1480px; }
.page__entete {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--e-3) var(--e-4); margin-bottom: var(--e-5);
}
.page__entete > div { min-width: 0; }
.page__entete p { color: var(--texte-doux); margin-top: var(--e-1); }
.page__actions { display: flex; flex-wrap: wrap; gap: var(--e-2); }
.fil {
  display: inline-flex; align-items: center; gap: var(--e-1);
  font-size: var(--taille-petit); color: var(--texte-doux); text-decoration: none;
  margin-bottom: var(--e-2); min-height: 32px;
}
.fil:hover { color: var(--lien); text-decoration: underline; }
.section + .section { margin-top: var(--e-6); }
.section__titre { display: flex; align-items: center; gap: var(--e-2); margin-bottom: var(--e-3); }
.section__titre .compteur { margin-left: auto; }
@media (max-width: 640px) { .page { padding: var(--e-4) var(--e-3) var(--e-6); } }

/* 4. Boutons ---------------------------------------------------------------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2);
  min-height: 40px; padding: 0 var(--e-4);
  border: 1px solid var(--bordure-forte); border-radius: var(--rayon-petit);
  background: var(--surface); color: var(--texte);
  font-weight: 600; font-size: var(--taille-petit); text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.bouton:hover { background: var(--surface-survol); }
.bouton--primaire { background: var(--primaire); border-color: var(--primaire); color: var(--sur-primaire); }
.bouton--primaire:hover { background: var(--primaire-survol); border-color: var(--primaire-survol); }
.bouton--danger { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.bouton--danger:hover { filter: brightness(.92); background: var(--danger); }
.bouton--discret { border-color: transparent; background: transparent; color: var(--lien); }
.bouton--discret:hover { background: var(--primaire-doux); }
.bouton[disabled], .bouton[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.bouton--bloc { width: 100%; }
.bouton-icone {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--cible-tactile); height: var(--cible-tactile);
  border: 0; border-radius: var(--rayon-petit); background: transparent; color: var(--texte);
}
.bouton-icone:hover { background: var(--surface-survol); }
.compteur-pastille {
  position: absolute; top: 5px; right: 4px; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem;
  border-radius: var(--rayon-pilule); background: var(--danger); color: var(--surface);
  font-size: .6875rem; font-weight: 700; line-height: 1.15rem; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.cadre .compteur-pastille { box-shadow: none; }
@media (pointer: coarse) { .bouton { min-height: var(--cible-tactile); } }

/* 5. Champs ------------------------------------------------------------------ */
.champ { display: grid; gap: var(--e-1); min-width: 0; }
.champ > span, .champ > label, .etiquette { font-size: var(--taille-mini); font-weight: 600; color: var(--texte-doux); }
.entree, .liste-choix, textarea.entree {
  width: 100%; min-height: 40px; padding: 0 var(--e-3);
  border: 1px solid var(--bordure-forte); border-radius: var(--rayon-petit);
  background: var(--surface); color: var(--texte);
}
textarea.entree { padding: var(--e-2) var(--e-3); min-height: 5rem; }
.liste-choix { padding-right: var(--e-6); appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.entree::placeholder { color: var(--texte-doux); opacity: .85; }
.entree:focus-visible, .liste-choix:focus-visible { outline-offset: 0; border-color: var(--focus); }
.recherche { position: relative; display: block; min-width: 0; }
.recherche .ic { position: absolute; left: var(--e-3); top: 50%; translate: 0 -50%; color: var(--texte-doux); pointer-events: none; }
.recherche .entree { padding-left: 2.5rem; }
.recherche kbd {
  position: absolute; right: var(--e-2); top: 50%; translate: 0 -50%;
  font: 600 .75rem var(--police-texte); color: var(--texte-doux);
  border: 1px solid var(--bordure); border-radius: 4px; padding: 0 .35rem; background: var(--surface-2);
}
@media (pointer: coarse) { .recherche kbd { display: none; } .entree, .liste-choix { min-height: var(--cible-tactile); } }
.case { display: inline-flex; align-items: center; gap: var(--e-2); min-height: 36px; cursor: pointer; }
.case input { width: 1.1rem; height: 1.1rem; accent-color: var(--primaire); margin: 0; }
.aide { font-size: var(--taille-mini); color: var(--texte-doux); }
.erreur-champ { font-size: var(--taille-mini); color: var(--danger); font-weight: 600; }

/* 6. Badges, puces, segments -------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .1rem .55rem; border-radius: var(--rayon-pilule);
  font-size: .75rem; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: var(--surface-3); color: var(--texte);
}
.badge .ic { width: .85rem; height: .85rem; }
.badge--succes { background: var(--succes-doux); color: var(--succes); }
.badge--attention { background: var(--attention-doux); color: var(--attention); }
.badge--danger { background: var(--danger-doux); color: var(--danger); }
.badge--info { background: var(--info-doux); color: var(--info); }
.badge--nouveau { background: var(--nouveau-doux); color: var(--nouveau); }
.badge--contour { background: transparent; border: 1px solid var(--bordure-forte); color: var(--texte-doux); }
.compteur { font-size: var(--taille-mini); font-weight: 600; color: var(--texte-doux); }
.puces { display: flex; flex-wrap: wrap; gap: var(--e-2); }
.puce {
  display: inline-flex; align-items: center; gap: var(--e-1);
  min-height: 36px; padding: 0 var(--e-3);
  border: 1px solid var(--bordure-forte); border-radius: var(--rayon-pilule);
  background: var(--surface); color: var(--texte); font-size: var(--taille-petit); font-weight: 500;
}
.puce:hover { background: var(--surface-survol); }
.puce[aria-pressed="true"] { background: var(--primaire); border-color: var(--primaire); color: var(--sur-primaire); }
.puce[aria-pressed="true"]::before { content: "✓"; font-weight: 700; }
.segments {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border-radius: var(--rayon-petit);
}
.segments button {
  display: inline-flex; align-items: center; gap: var(--e-1);
  min-height: 34px; padding: 0 var(--e-3); border: 0; border-radius: calc(var(--rayon-petit) - 2px);
  background: transparent; color: var(--texte-doux); font-weight: 600; font-size: var(--taille-petit);
}
.segments button[aria-pressed="true"] { background: var(--surface); color: var(--texte); box-shadow: var(--ombre-1); }

/* 7. Cartes et tuiles ------------------------------------------------------- */
.carte {
  background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--rayon-grand); box-shadow: var(--ombre-1);
}
.carte__corps { padding: var(--e-4); }
.carte__tete { display: flex; align-items: center; justify-content: space-between; gap: var(--e-3); padding: var(--e-3) var(--e-4); border-bottom: 1px solid var(--bordure); }
.grille-tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--e-3); }
.tuile {
  --tuile-couleur: var(--gestion); --tuile-doux: var(--gestion-doux);
  position: relative; display: flex; align-items: flex-start; gap: var(--e-3);
  min-height: 88px; padding: var(--e-4);
  background: var(--surface); color: var(--texte); text-decoration: none;
  border: 1px solid var(--bordure); border-radius: var(--rayon-grand); box-shadow: var(--ombre-1);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tuile--terrain { --tuile-couleur: var(--terrain); --tuile-doux: var(--terrain-doux); }
a.tuile:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); border-color: var(--tuile-couleur); }
.tuile__icone {
  display: grid; place-items: center; flex: none;
  width: 2.75rem; height: 2.75rem; border-radius: var(--rayon);
  background: var(--tuile-doux); color: var(--tuile-couleur);
}
.tuile__icone .ic { width: 1.6rem; height: 1.6rem; stroke-width: 1.7; }
.tuile__texte { min-width: 0; }
.tuile__nom { display: block; font-family: var(--police-titre); font-weight: var(--graisse-titre); font-size: var(--taille-h3); line-height: 1.25; }
.tuile__desc { display: block; margin-top: 2px; font-size: var(--taille-petit); color: var(--texte-doux); line-height: 1.35; }
.tuile__meta { display: flex; flex-wrap: wrap; gap: var(--e-1); margin-top: var(--e-2); }
.tuile__coin { position: absolute; top: var(--e-2); right: var(--e-2); }
.tuile--sans-acces { background: var(--surface-2); box-shadow: none; border-style: dashed; }
.tuile--sans-acces .tuile__icone { background: var(--surface-3); color: var(--texte-doux); }
.tuile--sans-acces .tuile__nom { color: var(--texte-doux); }
.tuile--sans-acces .bouton { margin-top: var(--e-2); min-height: 34px; padding: 0 var(--e-3); }
.tuile--nouveau { border-color: var(--nouveau); }
@media (max-width: 480px) {
  .grille-tuiles { grid-template-columns: 1fr 1fr; gap: var(--e-2); }
  .tuile { flex-direction: column; gap: var(--e-2); padding: var(--e-3); min-height: 0; }
  .tuile__desc { font-size: var(--taille-mini); }
  .tuile__icone { width: 2.5rem; height: 2.5rem; }
  .tuile__coin { top: var(--e-2); right: var(--e-2); }
}

/* 8. Tableau avec filtres --------------------------------------------------- */
.filtres {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--e-3);
  padding: var(--e-3) var(--e-4); border-bottom: 1px solid var(--bordure);
}
.filtres .recherche { flex: 1 1 240px; }
.filtres .champ { flex: 0 1 180px; }
.filtres__resume { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); padding: var(--e-2) var(--e-4); font-size: var(--taille-petit); color: var(--texte-doux); border-bottom: 1px solid var(--bordure); }
.tableau-zone { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: var(--taille-petit); }
.tableau th, .tableau td { padding: var(--densite-ligne) var(--e-3); text-align: left; border-bottom: 1px solid var(--bordure); vertical-align: middle; }
.tableau th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--texte-doux);
  font-size: var(--taille-mini); font-weight: 700; white-space: nowrap;
}
.tableau th button { display: inline-flex; align-items: center; gap: 2px; border: 0; padding: 0; background: none; color: inherit; font-weight: inherit; }
.tableau th[aria-sort] button { color: var(--texte); }
.tableau td.nombre, .tableau th.nombre { text-align: right; font-family: var(--police-chiffres); font-variant-numeric: tabular-nums; }
.tableau tbody tr { cursor: pointer; }
.tableau tbody tr:hover { background: var(--surface-survol); }
.tableau tbody tr[aria-selected="true"] { background: var(--primaire-doux); box-shadow: inset 3px 0 0 var(--primaire); }
.tableau .principal { font-weight: 600; color: var(--texte); }
.tableau .secondaire { display: block; font-size: var(--taille-mini); color: var(--texte-doux); }
.tableau__pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e-2); padding: var(--e-3) var(--e-4); font-size: var(--taille-petit); color: var(--texte-doux); }
@media (max-width: 700px) {
  .tableau--cartes thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tableau--cartes, .tableau--cartes tbody { display: block; }
  .tableau--cartes tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--e-1) var(--e-3);
    padding: var(--e-3) var(--e-4); border-bottom: 1px solid var(--bordure);
  }
  .tableau--cartes td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .tableau--cartes td[data-label]::before { content: attr(data-label); display: block; font-family: var(--police-texte); font-size: .75rem; color: var(--texte-doux); font-weight: 600; }
  .tableau--cartes td.pleine { grid-column: 1 / -1; }
  .tableau--cartes td.nombre { text-align: left; }
  .filtres { padding: var(--e-3); }
  .filtres .champ { flex: 1 1 130px; }
}

/* 9. Panneau de détail ------------------------------------------------------- */
.disposition { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--e-4); align-items: start; }
.disposition--panneau { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); }
.panneau {
  position: sticky; top: calc(var(--hauteur-entete) + var(--e-4));
  max-height: calc(100dvh - var(--hauteur-entete) - var(--e-6));
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon-grand); box-shadow: var(--ombre-2);
}
.panneau__tete { display: flex; align-items: flex-start; gap: var(--e-3); padding: var(--e-4); border-bottom: 1px solid var(--bordure); }
.panneau__tete > div { flex: 1; min-width: 0; }
.panneau__tete h2 { font-size: var(--taille-h3); overflow-wrap: anywhere; }
.panneau__corps { padding: var(--e-4); overflow: auto; overscroll-behavior: contain; }
.panneau__pied { display: flex; flex-wrap: wrap; gap: var(--e-2); padding: var(--e-3) var(--e-4); border-top: 1px solid var(--bordure); }
.faits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e-3); margin: 0; }
.faits div { min-width: 0; }
.faits dt { font-size: var(--taille-mini); color: var(--texte-doux); font-weight: 600; }
.faits dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.faits--une { grid-template-columns: 1fr; }
@media (max-width: 1000px) {
  .disposition--panneau { grid-template-columns: minmax(0, 1fr); }
  .panneau {
    position: fixed; inset: auto 0 0 0; z-index: 60; top: auto;
    max-height: 88dvh; border-radius: var(--rayon-grand) var(--rayon-grand) 0 0;
    box-shadow: var(--ombre-3); border-bottom: 0;
  }
  .panneau--entree { animation: monte .2s ease-out; }  /* seulement à l'ouverture, pas à chaque rendu */
  .panneau__tete::before {
    content: ""; position: absolute; left: 50%; top: 6px; translate: -50% 0;
    width: 40px; height: 4px; border-radius: 4px; background: var(--bordure-forte);
  }
  .panneau__tete { position: relative; padding-top: var(--e-5); }
  .voile-panneau { position: fixed; inset: 0; z-index: 55; background: var(--voile); }
}
@media (min-width: 1001px) { .voile-panneau { display: none; } }
@keyframes monte { from { transform: translateY(30px); opacity: 0; } }

/* 10. États : vide, chargement, erreur, refus ------------------------------ */
.etat {
  display: grid; justify-items: center; text-align: center; gap: var(--e-2);
  padding: var(--e-6) var(--e-4); max-width: 34rem; margin: 0 auto;
}
.etat__icone { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%; background: var(--surface-3); color: var(--texte-doux); margin-bottom: var(--e-1); }
.etat__icone .ic { width: 1.6rem; height: 1.6rem; }
.etat p { color: var(--texte-doux); }
.etat .page__actions { justify-content: center; margin-top: var(--e-2); }
.etat--erreur .etat__icone { background: var(--danger-doux); color: var(--danger); }
.etat--refus .etat__icone { background: var(--attention-doux); color: var(--attention); }
.etat__code { font-family: var(--police-chiffres); font-size: .75rem; color: var(--texte-doux); }
.squelette {
  display: block; height: .9rem; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-survol) 50%, var(--surface-3) 75%);
  background-size: 300% 100%; animation: luit 1.4s ease-in-out infinite;
}
.squelette--titre { height: 1.3rem; width: 55%; }
.squelette--bloc { height: 4.5rem; border-radius: var(--rayon); }
@keyframes luit { from { background-position: 100% 0; } to { background-position: 0 0; } }
.bandeau {
  display: flex; align-items: flex-start; gap: var(--e-3);
  padding: var(--e-3) var(--e-4); border-radius: var(--rayon);
  background: var(--info-doux); color: var(--texte); border: 1px solid transparent;
  font-size: var(--taille-petit);
}
.bandeau > .ic { color: var(--info); margin-top: 1px; }
.bandeau > div { flex: 1; min-width: 0; }
.bandeau strong { display: block; }
.bandeau--attention { background: var(--attention-doux); } .bandeau--attention > .ic { color: var(--attention); }
.bandeau--danger { background: var(--danger-doux); } .bandeau--danger > .ic { color: var(--danger); }
.bandeau--succes { background: var(--succes-doux); } .bandeau--succes > .ic { color: var(--succes); }

/* 11. Dialogue de confirmation --------------------------------------------- */
.dialogue {
  width: min(480px, calc(100vw - 2 * var(--e-4)));
  max-height: calc(100dvh - 2 * var(--e-4));
  padding: 0; border: 1px solid var(--bordure); border-radius: var(--rayon-grand);
  background: var(--surface); color: var(--texte); box-shadow: var(--ombre-3);
}
.dialogue--large { width: min(640px, calc(100vw - 2 * var(--e-4))); }
.dialogue::backdrop { background: var(--voile); }
.dialogue__tete { display: flex; align-items: flex-start; gap: var(--e-3); padding: var(--e-4) var(--e-4) 0; }
.dialogue__tete h2 { flex: 1; font-size: var(--taille-h2); }
.dialogue__corps { padding: var(--e-3) var(--e-4); display: grid; gap: var(--e-3); }
.dialogue__corps > p { color: var(--texte-doux); }
.dialogue__pied { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--e-2); padding: var(--e-3) var(--e-4) var(--e-4); }
.recap-action { background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: var(--e-3); font-size: var(--taille-petit); }
.recap-action ul { margin: var(--e-1) 0 0; padding-left: 1.1rem; }
@media (max-width: 480px) {
  .dialogue { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: var(--rayon-grand) var(--rayon-grand) 0 0; }
  .dialogue__pied { flex-direction: column-reverse; }
  .dialogue__pied .bouton { width: 100%; }
}

/* 12. Centre de notifications --------------------------------------------- */
.notifs {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: min(400px, calc(100vw - 24px)); max-height: min(560px, calc(100dvh - 90px));
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--texte);
  border: 1px solid var(--bordure); border-radius: var(--rayon-grand); box-shadow: var(--ombre-3);
}
.notifs__tete { display: flex; align-items: center; gap: var(--e-2); padding: var(--e-3) var(--e-3) var(--e-2) var(--e-4); }
.notifs__tete h2 { flex: 1; font-size: var(--taille-h3); }
.notifs__filtres { padding: 0 var(--e-4) var(--e-2); border-bottom: 1px solid var(--bordure); }
.notifs__liste { list-style: none; margin: 0; padding: var(--e-1); overflow: auto; overscroll-behavior: contain; }
.notif {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--e-1) var(--e-3);
  padding: var(--e-3); border-radius: var(--rayon);
}
.notif + .notif { border-top: 1px solid var(--bordure); border-radius: 0; }
.notif__icone { grid-row: span 3; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--surface-3); color: var(--texte-doux); }
.notif--attention .notif__icone { background: var(--attention-doux); color: var(--attention); }
.notif--danger .notif__icone { background: var(--danger-doux); color: var(--danger); }
.notif--succes .notif__icone { background: var(--succes-doux); color: var(--succes); }
.notif--info .notif__icone { background: var(--info-doux); color: var(--info); }
.notif__titre { font-weight: 600; font-size: var(--taille-petit); padding-right: var(--e-4); }
.notif__texte { font-size: var(--taille-mini); color: var(--texte-doux); }
.notif__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); font-size: .75rem; color: var(--texte-doux); }
.notif__meta a { font-weight: 600; }
.notif--non-lue { background: var(--primaire-doux); }
.notif--non-lue::after { content: ""; position: absolute; right: var(--e-3); top: 1.05rem; width: .55rem; height: .55rem; border-radius: 50%; background: var(--primaire); }
.notifs__pied { padding: var(--e-2) var(--e-4); border-top: 1px solid var(--bordure); font-size: var(--taille-mini); color: var(--texte-doux); }
@media (max-width: 640px) {
  .notifs, .menu { position: fixed; left: var(--e-2); right: var(--e-2); top: calc(var(--hauteur-entete) - 2px); width: auto; max-height: calc(100dvh - var(--hauteur-entete) - var(--e-3)); }
}

/* 13. Annonce (toast) ------------------------------------------------------ */
.annonces { position: fixed; left: 50%; bottom: var(--e-4); translate: -50% 0; z-index: 90; display: grid; gap: var(--e-2); width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.annonce {
  display: flex; align-items: center; gap: var(--e-3); pointer-events: auto;
  padding: var(--e-3) var(--e-4); border-radius: var(--rayon);
  background: var(--texte); color: var(--texte-inverse); box-shadow: var(--ombre-3);
  font-size: var(--taille-petit); font-weight: 500; animation: monte .2s ease-out;
}
.annonce .ic { flex: none; }
.annonce span { flex: 1; }
.annonce button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; padding: var(--e-1); }

/* 14. Onglets ----------------------------------------------------------------- */
.onglets { display: flex; gap: var(--e-1); border-bottom: 1px solid var(--bordure); overflow-x: auto; scrollbar-width: none; padding: 0 var(--e-3); }
.onglets [role="tab"] {
  display: inline-flex; align-items: center; gap: var(--e-2);
  min-height: var(--cible-tactile); padding: 0 var(--e-3);
  border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--texte-doux); font-weight: 600; font-size: var(--taille-petit); white-space: nowrap;
}
.onglets [role="tab"][aria-selected="true"] { color: var(--primaire); border-bottom-color: var(--primaire); }
.onglets [role="tab"]:hover { color: var(--texte); }

/* 15. Chronologie (versions, journal) ------------------------------------ */
.chronologie { list-style: none; margin: 0; padding: 0; }
.chronologie > li { position: relative; padding: 0 0 var(--e-4) 1.75rem; }
.chronologie > li::before { content: ""; position: absolute; left: .45rem; top: 1.1rem; bottom: 0; width: 2px; background: var(--bordure); }
.chronologie > li:last-child::before { display: none; }
.chronologie__point { position: absolute; left: 0; top: .2rem; width: 1rem; height: 1rem; border-radius: 50%; border: 3px solid var(--surface); background: var(--bordure-forte); box-shadow: 0 0 0 1px var(--bordure-forte); }
.chronologie__point--actuel { background: var(--primaire); box-shadow: 0 0 0 1px var(--primaire); }
.chronologie__point--annule { background: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.chronologie__tete { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-1) var(--e-2); font-size: var(--taille-petit); }
.chronologie__tete time { color: var(--texte-doux); font-size: var(--taille-mini); }
.diff { margin: var(--e-2) 0 0; padding: var(--e-2) var(--e-3); background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--rayon-petit); font-size: var(--taille-mini); display: grid; gap: 2px; }
.diff div { display: flex; flex-wrap: wrap; gap: 0 var(--e-2); }
.diff dt { color: var(--texte-doux); min-width: 7.5rem; }
.diff dd { margin: 0; }
.diff del { color: var(--danger); text-decoration: line-through; }
.diff ins { color: var(--succes); text-decoration: none; font-weight: 600; }

/* 16. Utilitaires ------------------------------------------------------------ */
.pile { display: grid; gap: var(--e-3); }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); }
.ligne--entre { justify-content: space-between; }
.separateur { height: 1px; background: var(--bordure); border: 0; margin: var(--e-4) 0; }
.pied-page { max-width: var(--largeur-max); margin: 0 auto; padding: var(--e-5) var(--e-4); font-size: var(--taille-mini); color: var(--texte-doux); display: flex; flex-wrap: wrap; gap: var(--e-2) var(--e-4); justify-content: space-between; }
.legende-maquette {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2) var(--e-3);
  background: var(--surface-3); color: var(--texte); font-size: var(--taille-mini);
  padding: var(--e-2) var(--e-4); border-bottom: 1px solid var(--bordure);
}
.legende-maquette strong { font-weight: 700; }
.legende-maquette .liste-choix { min-height: 32px; width: auto; font-size: var(--taille-mini); }

/* Variantes « statiques » : pour présenter panneau et notifications dans la documentation. */
.panneau.panneau--statique { position: static; max-height: none; animation: none; border-radius: var(--rayon-grand); border-bottom: 1px solid var(--bordure); box-shadow: var(--ombre-1); }
.panneau--statique .panneau__tete::before { display: none; }
.panneau--statique .panneau__tete { padding-top: var(--e-4); }
.notifs.notifs--statique { position: static; width: 100%; max-height: none; box-shadow: var(--ombre-1); }
.dialogue--statique { position: static; display: block; margin: 0; width: 100%; max-width: 480px; box-shadow: var(--ombre-1); }

/* Téléphone : on gagne de la place dans le cadre et les onglets. */
@media (max-width: 480px) {
  .cadre [data-cadre="theme"] { display: none; }   /* le thème reste dans le menu du compte */
  .onglets { padding: 0 var(--e-1); gap: 0; }
  .onglets [role="tab"] { padding: 0 var(--e-2); }
  .onglets [role="tab"] .ic { display: none; }
}
