/* V5 · PRIMITIVES — contrôles partagés par toutes les pages ; grammaire visuelle Claude / ChatGPT, densité Cursor.
   Boutons (« Buttons ») : sans bordure (barres) · bordé (secondaire) · par défaut (accent, un par zone) · teinté ·
   destructeur · pop-up. Tailles : Small 20 · Regular 24 (défaut) · Large 28 et XL 36 (capsules).
   Chaque contrôle a ses états : repos, survol (discret : apport du web), appui, focus clavier, désactivé.
   Classes v5-* uniquement : aucune règle ici ne vise un élément ou une classe des anciennes couches
   (leur habillage est dans css/v5/herite.css). */

/* ------------------------------------------------------------------ socle commun */
:where(.v5-btn, .v5-champ, .v5-recherche, .v5-segmente button, .v5-ligne, .v5-nav-item){
  font: inherit; color: inherit; letter-spacing: normal; text-transform: none;
  -webkit-tap-highlight-color: transparent;
}
/* anneau de focus du système : épais, collé au contrôle, de la couleur d'accent ; au clavier seulement pour les boutons, toujours pour les champs */
:where(.v5-btn, .v5-segmente button, .v5-nav-item, .v5-ligne, .v5-comptes, .v5-compte):focus-visible,
:where(.v5-champ, .v5-recherche):focus-within{
  outline: var(--v5-focus-l) solid var(--v5-focus); outline-offset: var(--v5-focus-decalage, 0px);
}
/* une ligne de liste occupe toute la largeur de sa colonne (qui défile) : l'anneau est à l'intérieur, sinon ses côtés seraient rognés */
.v5-ligne{ --v5-focus-decalage: -3px; }
/* texte tertiaire sur un fond d'état : tant que l'état dure, le conteneur redéfinit le jeton en --v5-texte-2 (contraste gardé) */
:is(.v5-ligne, .v5-nav-item, .v5-comptes, .v5-compte, .pal-item, .v5-menu-item, .mc-item, .sel-item):is(:hover, :active, :focus-visible, [aria-selected="true"], [aria-current="page"], [aria-expanded="true"], .actif){
  --v5-texte-3: var(--v5-texte-2);
}
.v5-btn svg, .v5-nav-item svg, .v5-ligne svg{ flex: none; }

/* ------------------------------------------------------------------ boutons */
/* base = bouton sans bordure neutre (barres, lignes) : aucun fond au repos */
.v5-btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  box-sizing: border-box; height: var(--v5-ctrl-h); min-width: 0; padding: 0 10px; margin: 0;
  border: 0; border-radius: var(--v5-r-ctrl); background: transparent; box-shadow: none;
  font-size: var(--v5-t-13); font-weight: var(--v5-g-moyen); line-height: 16px; white-space: nowrap;
  color: var(--v5-texte); cursor: default; user-select: none;
  transition: background-color var(--v5-duree) var(--v5-courbe), color var(--v5-duree) var(--v5-courbe), opacity var(--v5-duree), scale var(--v5-duree-feuille) var(--v5-ressort);
}
.v5-btn:hover{ background: var(--v5-survol); }
.v5-btn:active, .v5-btn[aria-haspopup][aria-expanded="true"], .v5-btn[aria-pressed="true"]{ background: var(--v5-presse); }
.v5-btn:active{ scale: var(--v5-appui); }   /* 03/11 · Claude Desktop : le bouton s'enfonce sous le doigt, puis revient avec un léger rebond */
.v5-btn:disabled, .v5-btn[aria-disabled="true"]{ color: var(--v5-texte-inactif); background: transparent; pointer-events: none; }
.v5-btn svg{ width: 16px; height: 16px; }

/* symbole seul (retour, barre latérale, plus, fermer, menu …) */
.v5-btn-icone{ width: var(--v5-ctrl-h); padding: 0; color: var(--v5-texte-2); }
.v5-btn-icone:hover{ color: var(--v5-texte); }

/* « Bordered » : le bouton standard du système (Modifier, Gérer, Annuler) */
.v5-btn-gris{ padding: 0 14px; background: var(--v5-bouton); }
.v5-btn-gris:hover{ background: var(--v5-bouton); filter: brightness(.96); }
.v5-btn-gris:active, .v5-btn-gris[aria-haspopup][aria-expanded="true"], .v5-btn-gris[aria-pressed="true"]{ background: var(--v5-bouton-presse); filter: none; }
.v5-btn-gris:disabled, .v5-btn-gris[aria-disabled="true"]{ background: var(--v5-bouton-inactif); filter: none; }

/* « Bordered Default » : l'action par défaut de la zone (une seule), à la couleur d'accent */
.v5-btn-principal{ padding: 0 14px; background: var(--v5-violet); color: var(--v5-sur-violet); }
.v5-btn-principal:hover{ background: var(--v5-violet-survol); }
.v5-btn-principal:active{ background: var(--v5-violet-presse); }
.v5-btn-principal:disabled, .v5-btn-principal[aria-disabled="true"]{ background: var(--v5-violet); color: var(--v5-sur-violet); opacity: var(--v5-opacite-inactif); }

/* « Bordered Tinted » : action mise en avant sans être l'action par défaut */
.v5-btn-teinte{ padding: 0 14px; background: var(--v5-violet-doux); color: var(--v5-violet-texte); }
.v5-btn-teinte:hover{ background: var(--v5-violet-doux); filter: brightness(.95); }
.v5-btn-teinte:active{ filter: brightness(.88); }

/* « Borderless » à la couleur d'accent : lien d'action dans un texte ou une ligne */
.v5-btn-lien{ padding: 0 6px; color: var(--v5-violet-texte); }

/* « Bordered Destructive » (texte rouge sur fond rouge léger) et « Default Destructive » (plein) */
.v5-btn-danger{ padding: 0 14px; background: var(--v5-rouge-doux); color: var(--v5-rouge); }
.v5-btn-danger:hover{ background: var(--v5-rouge-doux); filter: brightness(.95); }
.v5-btn-danger:active{ background: var(--v5-rouge-doux); filter: brightness(.86); }
.v5-btn-danger-plein{ padding: 0 14px; background: var(--v5-rouge-plein); color: var(--v5-sur-violet); }
.v5-btn-danger-plein:hover{ background: var(--v5-rouge-plein); filter: brightness(.94); }

/* « Pop-up Button » : libellé + chevrons, ouvre un menu de choix (portée, filtre, compte, vue) */
.v5-btn-popover{ gap: 2px; padding: 0 5px 0 12px; background: var(--v5-bouton); }
.v5-btn-popover:hover{ background: var(--v5-bouton); filter: brightness(.96); }
.v5-btn-popover:active, .v5-btn-popover[aria-expanded="true"]{ background: var(--v5-bouton-presse); filter: none; }
.v5-btn-popover > span{ overflow: hidden; text-overflow: ellipsis; }
.v5-btn-popover .v5-chevrons{ width: 14px; height: 14px; color: var(--v5-texte-2); }

/* tailles : Small 20 (r5, texte 11) · Large 28 et XL 36 (capsules) */
.v5-btn-s{ height: var(--v5-ctrl-s); padding: 0 10px; border-radius: var(--v5-r-petit); font-size: var(--v5-t-11); line-height: 14px; }
.v5-btn-s svg{ width: 13px; height: 13px; }
.v5-btn-icone.v5-btn-s{ width: var(--v5-ctrl-s); padding: 0; }
.v5-btn-l{ height: var(--v5-ctrl-l); padding: 0 16px; border-radius: var(--v5-r-bouton); }
.v5-btn-icone.v5-btn-l{ width: var(--v5-ctrl-l); padding: 0; }
.v5-btn-xl{ height: var(--v5-ctrl-xl); padding: 0 20px; border-radius: var(--v5-r-bouton); }
.v5-btn-icone.v5-btn-xl{ width: var(--v5-ctrl-xl); padding: 0; }
.v5-btn-large{ width: 100%; }

/* groupe de boutons collés (− curseur +, ‹ ›) */
.v5-groupe{ display: inline-flex; align-items: center; gap: 2px; }

/* ------------------------------------------------------------------ raccourci clavier (menus : texte tertiaire, sans cadre) */
.v5-kbd{
  display: inline-flex; align-items: center; height: 16px; padding: 0 4px; border-radius: var(--v5-r-mini);
  font: var(--v5-g-moyen) var(--v5-t-11)/1 var(--v5-police); color: var(--v5-texte-3);
  background: var(--v5-rempli-3);
}

/* ------------------------------------------------------------------ champs (« Text Fields » : fond de saisie, bord fin, r6) */
.v5-champ{
  box-sizing: border-box; height: var(--v5-ctrl-h); padding: 0 7px; border: 0; border-radius: var(--v5-r-champ);
  background: var(--v5-surface-inset); box-shadow: inset 0 0 0 var(--v5-trait-fort) var(--v5-bord-champ);
  font-size: var(--v5-t-13); color: var(--v5-texte);
}   /* pas de « outline: none » ici : l'anneau vient de la règle :focus-within du socle */
.v5-champ::placeholder{ color: var(--v5-texte-3); }

/* champ de recherche (« Search Fields » : capsule, loupe à 8) : vrai champ ou bouton qui ouvre la palette */
.v5-recherche{
  display: inline-flex; align-items: center; gap: 5px; box-sizing: border-box; height: var(--v5-ctrl-h); min-width: 0;
  padding: 0 6px 0 8px; border: 0; border-radius: var(--v5-r-capsule);
  background: var(--v5-surface-inset); box-shadow: inset 0 0 0 var(--v5-trait-fort) var(--v5-bord-champ);
  color: var(--v5-texte-3); font-size: var(--v5-t-13); cursor: text; text-align: left;
  transition: box-shadow var(--v5-duree), background-color var(--v5-duree);
}
.v5-recherche svg{ width: 14px; height: 14px; flex: none; }
.v5-recherche input{ flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: none; font: inherit; color: var(--v5-texte); outline: none; }
.v5-recherche input::placeholder{ color: var(--v5-texte-3); }
.v5-recherche .v5-recherche-texte{ flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ contrôle segmenté (« Segmented Controls », zone de contenu)
   fond bordé r6, segments pleine hauteur, filet entre deux segments au repos, segment choisi à la couleur d'accent */
.v5-segmente{
  display: inline-flex; box-sizing: border-box; height: var(--v5-ctrl-h); padding: 0; gap: 0; border-radius: var(--v5-r-ctrl);
  background: var(--v5-bouton);
}
.v5-segmente button{
  position: relative; height: 100%; padding: 0 12px; border: 0; border-radius: var(--v5-r-ctrl); background: none;
  font-size: var(--v5-t-13); font-weight: var(--v5-g-moyen); line-height: 16px; color: var(--v5-texte); cursor: default; white-space: nowrap;
}
.v5-segmente button + button::before{ content: ""; position: absolute; left: -.5px; top: 5px; bottom: 5px; width: 1px; border-radius: 1px; background: var(--v5-rempli-1); }
.v5-segmente button:is([aria-pressed="true"], .actif)::before, .v5-segmente button:is([aria-pressed="true"], .actif) + button::before{ content: none; }
.v5-segmente button:active{ background: var(--v5-rempli-2); }
.v5-segmente button:disabled{ color: var(--v5-texte-inactif); pointer-events: none; }
.v5-segmente button[aria-pressed="true"], .v5-segmente button.actif{ background: var(--v5-violet); color: var(--v5-sur-violet); }

/* ------------------------------------------------------------------ statut : un POINT et un mot (jamais un bouton)
   13/10, analyse avec Lucas : la capsule teintée (fond + point + texte colorés) disait la couleur trois fois, ressemblait à un bouton et
   faisait trois taches saturées par colonne. Les références (Linear, Cursor, Finder, Mail, ChatGPT) n'utilisent qu'un point de couleur suivi
   d'un texte neutre : la couleur est un signal, pas une décoration. Une seule recette, deux variables (--v5-etat-point / -texte) : toutes les
   listes l'utilisent, qu'elles passent par .v5-statut (nouveau code) ou par les classes d'origine (.cl-etat, .an-etat, .envoi-badge,
   .ab4-statut, .cpt-ext). Teintes du point : vert = fait / en ligne · orange = en attente, lent, programmé · rouge = à débloquer ·
   violet qui pulse = en cours · gris = neutre. Le texte reste gris ; seul ce qui bloque passe en texte principal (plus foncé, pas rouge). */
.v5-statut, html.v5 :is(.cl-etat, .an-etat, .envoi-badge, .ab4-statut, .cpt-ext){
  --v5-etat-point: var(--v5-gris); --v5-etat-texte: var(--v5-texte-2);
  display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box; height: 20px; padding: 0;
  border: 0; border-radius: var(--v5-r-capsule); background: none; box-shadow: none; color: var(--v5-etat-texte);
  font-size: var(--v5-t-12); font-weight: var(--v5-g-normal); line-height: 1; white-space: nowrap;
}
/* le point d'état (ligne, photo, menu) : une pastille ronde de 8 px ; devant un libellé d'état il passe à 7 px */
.v5-point{ display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--v5-gris); }
.v5-point[data-etat="ok"]{ background: var(--v5-vert); }
.v5-point[data-etat="attente"], .v5-point[data-etat="lent"]{ background: var(--v5-orange); }
.v5-point[data-etat="erreur"], .v5-point[data-etat="hors"]{ background: var(--v5-rouge-plein); }
.v5-point[data-etat="encours"]{ background: var(--v5-texte-2); }   /* en cours : neutre (plus de point violet) ; vert, orange et rouge gardent leur sens */
.v5-point[data-etat="inactif"], .v5-point[data-etat="pause"], .v5-point[data-etat="absente"]{ background: var(--v5-gris); }
.v5-statut > .v5-point{ width: 7px; height: 7px; }
html.v5 :is(.cl-etat, .an-etat, .envoi-badge)::before, html.v5 :is(.ab4-statut, .cpt-ext) > i{
  content: ""; flex: none; width: 7px; height: 7px; margin: 0; border-radius: 50%; background: var(--v5-etat-point); animation: none;
}
.v5-statut:has(> .v5-point:is([data-etat="ok"])), html.v5 :is(.cl-etat--fait, .an-etat--ligne, .envoi-badge.ok, .envoi-badge.succes, .ab4-statut.is-actif, .cpt-ext.ok){
  --v5-etat-point: var(--v5-vert);
}
.v5-statut:has(> .v5-point:is([data-etat="attente"], [data-etat="lent"])), html.v5 :is(.cl-etat--prog, .envoi-badge.warn, .cpt-ext.pause, .cpt-ext.lent, .an-etat--masquee){
  --v5-etat-point: var(--v5-orange);
}
.v5-statut:has(> .v5-point:is([data-etat="erreur"], [data-etat="hors"])), html.v5 :is(.cl-etat--echec, .envoi-badge.danger, .envoi-badge.annulee, .cpt-ext.hors){
  --v5-etat-point: var(--v5-rouge-plein); --v5-etat-texte: var(--v5-texte);
}
html.v5 .cl-etat--cours{ --v5-etat-point: var(--v5-violet); --v5-etat-texte: var(--v5-texte); }
html.v5 .cl-etat--cours::before{ animation: clPouls 1.6s ease-in-out infinite; }
html.v5.sans-anim .cl-etat--cours::before{ animation: none; }
@media (prefers-reduced-motion: reduce){ html.v5 .cl-etat--cours::before{ animation: none; } }
html.v5 .an-etat--vendu{ --v5-etat-point: var(--v5-texte-2); }

.v5-compteur{ font-size: var(--v5-t-12); font-weight: var(--v5-g-moyen); color: var(--v5-texte-3); font-variant-numeric: tabular-nums; }
/* pastille (« badge ») : compteur ou état court dans une capsule de remplissage */
.v5-pastille{
  display: inline-flex; align-items: center; height: 16px; padding: 0 6px; border-radius: var(--v5-r-capsule);
  background: var(--v5-rempli-2); color: var(--v5-texte-2); font-size: var(--v5-t-11); font-weight: var(--v5-g-moyen); line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ listes : une ligne = un élément, actions au survol / dans « … » */
.v5-liste{ display: flex; flex-direction: column; }
.v5-ligne{
  display: flex; align-items: center; gap: 8px; min-height: var(--v5-ligne-h); padding: 0 10px;
  border: 0; border-radius: var(--v5-r-sel); background: none; text-align: left; width: 100%;
  font-size: var(--v5-t-13); color: var(--v5-texte); cursor: default;
}
/* pas d'effet au survol sur une ligne (demande de Lucas du 10/10) : comme dans le Finder, seule la sélection change son fond */
.v5-ligne[aria-selected="true"]{ background: var(--v5-selection); }
.v5-ligne .v5-ligne-plus{ opacity: 0; }
.v5-ligne:hover .v5-ligne-plus, .v5-ligne[aria-selected="true"] .v5-ligne-plus, .v5-ligne .v5-ligne-plus[aria-expanded="true"]{ opacity: 1; }
.v5-sep{ height: 1px; margin: 6px 0; background: var(--v5-separateur); border: 0; }

/* ------------------------------------------------------------------ états d'écran : vide, chargement, erreur */
.v5-etat{
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 220px; padding: 40px 24px; text-align: center; color: var(--v5-texte-2);
}
.v5-etat-icone{ width: 34px; height: 34px; color: var(--v5-texte-3); margin-bottom: 6px; }
.v5-etat-titre{ font-size: var(--v5-t-15); font-weight: var(--v5-g-fort); line-height: var(--v5-i-15); color: var(--v5-texte); }
.v5-etat-texte{ max-width: 360px; font-size: var(--v5-t-13); line-height: 1.45; color: var(--v5-texte-2); }
.v5-etat .v5-btn{ margin-top: 10px; }
.v5-etat[data-type="erreur"] .v5-etat-icone{ color: var(--v5-rouge); }

/* indicateur d'activité du système (« Progress Indicators / Circular / Indeterminate ») : huit traits qui s'éteignent en tournant */
.v5-roue{
  position: relative; display: inline-block; flex: none; width: 16px; height: 16px; color: var(--v5-texte-2);
  background: conic-gradient(from 0deg, currentColor 0 4%, transparent 4% 12.5%, currentColor 12.5% 16.5%, transparent 16.5% 25%, currentColor 25% 29%, transparent 29% 37.5%, currentColor 37.5% 41.5%, transparent 41.5% 50%, currentColor 50% 54%, transparent 54% 62.5%, currentColor 62.5% 66.5%, transparent 66.5% 75%, currentColor 75% 79%, transparent 79% 87.5%, currentColor 87.5% 91.5%, transparent 91.5%);
  -webkit-mask: radial-gradient(circle, transparent 0 28%, black 30% 68%, transparent 70%), conic-gradient(from 0deg, transparent, black);
  -webkit-mask-composite: source-in; mask: radial-gradient(circle, transparent 0 28%, black 30% 68%, transparent 70%), conic-gradient(from 0deg, transparent, black);
  mask-composite: intersect; border-radius: 50%;
  animation: v5-tourne .8s steps(8) infinite;
}
/* attente (22/10) : petit rectangle « texte + roue » (V5.attente, V5.etat chargement), comme « En route vers votre espace… » de Notion */
.v5-attente{
  display: inline-flex; align-items: center; gap: 14px; box-sizing: border-box; max-width: min(420px, calc(100vw - 48px)); padding: 12px 16px;
  border-radius: var(--v5-r-sel); background: var(--v5-surface-elevee); box-shadow: var(--v5-ombre-menu);
  font-size: var(--v5-t-13); line-height: 18px; color: var(--v5-texte); text-align: left;
}
.v5-attente .v5-roue{ width: 14px; height: 14px; color: var(--v5-texte-2); }
.v5-attente-fond{ position: fixed; inset: 0; z-index: 10050; display: grid; place-items: center; pointer-events: none; animation: v5-fondu 160ms ease-out; }
@keyframes v5-tourne{ to{ transform: rotate(360deg); } }

.v5-squelette{ display: block; height: 10px; border-radius: 4px; background: var(--v5-rempli-3); position: relative; overflow: hidden; }
.v5-squelette{ animation: v5-respire 1.4s ease-in-out infinite alternate; }   /* squelette qui « respire » (04/11/2026) */
@keyframes v5-respire{ from{ opacity: var(--v5-opacite-respire); } to{ opacity: 1; } }

/* halo léger autour de tout anneau de focus (filtre : n'écrase pas les ombres propres aux contrôles) */
:where(html.v5) :focus-visible{ filter: var(--v5-focus-halo); }

@media (prefers-reduced-motion: reduce){
  .v5-roue, .v5-squelette{ animation-duration: 0s; animation-iteration-count: 1; }
}

/* ------------------------------------------------------------------ bulle d'aide : surface neutre, lisible sur chaque page */
.v5-bulle{
  position: fixed; z-index: 10050; pointer-events: none;
  padding: 4px 8px; border: 1px solid var(--v5-separateur); border-radius: var(--v5-r-mini); background: var(--v5-surface-elevee); color: var(--v5-texte);
  font: var(--v5-g-moyen) var(--v5-t-11)/13px var(--v5-police); white-space: nowrap;
  box-shadow: var(--v5-ombre-menu); opacity: 0;
  transition: opacity var(--v5-duree);
}
.v5-bulle.visible{ opacity: 1; }
.v5-bulle .v5-kbd{ margin-left: 6px; height: 13px; background: none; padding: 0; }

/* ------------------------------------------------------------------ contraste élevé Windows (forced-colors)
   Dans ce mode les fonds et les ombres d'auteur ne sont pas rendus ; les contours le sont (recolorés par le système).
   - ligne sélectionnée et segment choisi : couleurs « sélection » du système (Highlight / HighlightText) ;
   - champs et recherche : leur bord (ombre intérieure) disparaît -> contour de 1 px au repos ; au focus, l'anneau du socle prend le relais. */
@media (forced-colors: active){
  .v5-ligne[aria-selected="true"]{ background: Highlight; color: HighlightText; }
  .v5-ligne[aria-selected="true"] *:not(#_){ color: inherit; }
  .v5-segmente button[aria-pressed="true"], .v5-segmente button.actif{ background: Highlight; color: HighlightText; }
  :where(.v5-champ, .v5-recherche):not(:focus-within){ outline: 1px solid ButtonBorder; outline-offset: -1px; }
  :where(.v5-btn-gris, .v5-btn-popover, .v5-btn-principal, .v5-btn-danger, .v5-btn-teinte){ outline: 1px solid ButtonBorder; outline-offset: -1px; }
}

/* 02/11 (audit) : la couleur d'un compte (bleu, vert, orange, rouge… au choix) se confondait avec les points d'état (vert = connecté,
   rouge = hors ligne) : « ● atelier.seconde.main » en vert à côté de « Hors ligne ». Le repère d'un compte est un petit carré arrondi,
   le point rond reste réservé aux états. */
html.v5 :is(.acct-dot, .an-compte > i, .vt-fiche-compte > i, .mm-pastille, .rel-nom > i, .ex-pastille, .cpt-couleur){ border-radius: 3px; }
