/* DS-CG v1.3 · feuille complète, générée par build.mjs. Ne pas modifier ici. */

/* DS-CG · tokens v1.0
   Source : DESIGN.md. Toute valeur change d'abord dans DESIGN.md.
   Clair par défaut ; sombre selon le réglage du système,
   ou forcé avec <html data-theme="light|dark">. */

:root {
  color-scheme: light;

  /* Couleurs */
  --bg: #ffffff;
  --bg-subtle: #f5f5f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --border: #e3e3e8;
  --border-strong: #c9c9d1;
  --border-control: #86868b;
  --text: #1d1d1f;
  --text-muted: #636366;
  --text-faint: #8e8e93;
  --accent: #0071e3;
  --accent-hover: #0062c4;
  --accent-active: #00539f;
  --on-accent: #ffffff;
  --accent-text: #0066cc;
  --accent-soft: #e8f1fc;
  --link-visited: #7342b8;
  --success: #1a7a44;
  --success-soft: #e7f5ec;
  --warning: #9a5100;
  --warning-soft: #fdf1e3;
  --danger: #d70015;
  --danger-soft: #fde8ea;
  --danger-border: #f3b3b9;
  --inverse-bg: #1d1d1f;
  --inverse-text: #ffffff;
  --nav-bg: rgba(255, 255, 255, .8);
  --focus-ring: rgba(0, 113, 227, .3);
  --overlay: rgba(29, 29, 31, .4);
  --chart-1: #0071e3;
  --chart-2: #7fb4f0;
  --chart-3: #1d1d1f;
  --chart-4: #86868b;

  /* Typographie */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --font-display: var(--font-sans);

  /* Espacements (base 4 px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* Formes */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-full: 999px;

  /* Élévation */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .06);
  --shadow-2: 0 24px 64px rgba(0, 0, 0, .16);

  /* Mouvement */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: 150ms;
  --dur-open: 250ms;

  /* Densité (confortable par défaut) */
  --ctl-h: 44px;
  --ctl-px: 20px;
  --card-p: 32px;
  --cell: 12px 16px;

  /* Mise en page */
  --container: 1120px;
  --reading: 720px;
  --gutter: 24px;
}

[data-density="compact"] {
  --ctl-h: 36px;
  --ctl-px: 16px;
  --card-p: 20px;
  --cell: 8px 12px;
}

[data-pairing="serif"] {
  --font-display: var(--font-serif);
}

/* Écran tactile : les commandes compactes reprennent 44 px de haut */
@media (pointer: coarse) {
  [data-density="compact"] { --ctl-h: 44px; }
}

@media (max-width: 767px) {
  :root {
    --card-p: 24px;
    --gutter: 16px;
  }
  [data-density="compact"] {
    --card-p: 20px;
  }
}

/* Sombre : réglage du système */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111113;
    --bg-subtle: #1c1c1f;
    --surface: #18181b;
    --surface-raised: #222226;
    --border: #2e2e33;
    --border-strong: #4a4a52;
    --border-control: #7c7c82;
    --text: #f5f5f7;
    --text-muted: #a1a1a6;
    --text-faint: #76767c;
    --accent-text: #4da3ff;
    --accent-soft: #102a47;
    --link-visited: #c09cf5;
    --success: #3ddc84;
    --success-soft: #12301f;
    --warning: #ff9f0a;
    --warning-soft: #33240d;
    --danger: #ff6961;
    --danger-soft: #3a1b1c;
    --danger-border: #6b2b2e;
    --inverse-bg: #f5f5f7;
    --inverse-text: #1d1d1f;
    --nav-bg: rgba(17, 17, 19, .8);
    --focus-ring: rgba(77, 163, 255, .45);
    --overlay: rgba(0, 0, 0, .6);
    --chart-3: #f5f5f7;
    --chart-4: #6e6e73;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .4);
    --shadow-2: 0 24px 64px rgba(0, 0, 0, .5);
  }
}

/* Sombre : forcé */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111113;
  --bg-subtle: #1c1c1f;
  --surface: #18181b;
  --surface-raised: #222226;
  --border: #2e2e33;
  --border-strong: #4a4a52;
  --border-control: #7c7c82;
  --text: #f5f5f7;
  --text-muted: #a1a1a6;
  --text-faint: #76767c;
  --accent-text: #4da3ff;
  --accent-soft: #102a47;
  --link-visited: #c09cf5;
  --success: #3ddc84;
  --success-soft: #12301f;
  --warning: #ff9f0a;
  --warning-soft: #33240d;
  --danger: #ff6961;
  --danger-soft: #3a1b1c;
  --danger-border: #6b2b2e;
  --inverse-bg: #f5f5f7;
  --inverse-text: #1d1d1f;
  --nav-bg: rgba(17, 17, 19, .8);
  --focus-ring: rgba(77, 163, 255, .45);
  --overlay: rgba(0, 0, 0, .6);
  --chart-3: #f5f5f7;
  --chart-4: #6e6e73;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-2: 0 24px 64px rgba(0, 0, 0, .5);
}


/* DS-CG · base v1.0 : remise à zéro, typographie, liens, focus.
   À charger après tokens.css et avant les composants. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.625 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

::selection { background: var(--accent-soft); color: var(--text); }

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { text-wrap: balance; }
p, li { text-wrap: pretty; }

.ds-display, h1, h2 { font-family: var(--font-display); }
[data-pairing="serif"] :is(.ds-display, h1, h2) { font-weight: 500; }

.ds-display { font-size: clamp(2.5rem, 1.96rem + 2.41vw, 3.5rem); line-height: calc(1em + 4px); font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 1.73rem + 1.2vw, 2.5rem); line-height: calc(1em + 6px); font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
h4 { font-size: 16px; line-height: 24px; font-weight: 600; }

.ds-lead { font-size: 19px; line-height: 30px; color: var(--text-muted); }
.ds-small { font-size: 14px; line-height: 22px; }
.ds-muted { color: var(--text-muted); }
.ds-label { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .02em; color: var(--text-muted); }
.ds-tnum { font-variant-numeric: tabular-nums; }

a {
  color: var(--accent-text);
  text-decoration: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
@media (hover: hover) {
  a:hover { text-decoration: underline; }
}
/* Appuyé : trait de 2 px dans la couleur du texte (liens simples seulement : les liens à classe ont leur propre état) */
a:not([class]):active { color: var(--text); text-decoration: underline; text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Titre ou zone qui reçoit le focus par script : lu par le lecteur d'écran, sans anneau (ce n'est pas une commande) */
:is(h1, h2, h3, main)[tabindex="-1"]:focus { outline: none; }

/* Masqué à l'écran, lu par les lecteurs d'écran */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

code, kbd, pre { font-family: var(--font-mono); font-size: .875em; }

/* Animations réduites : les fondus et les couleurs restent ; chaque composant
   retire ses glissements et ses agrandissements (voir leur fichier). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}


/* DS-CG · Accordéon v2.0
   Une pile d'éléments <details> natifs, chacun dans sa propre carte : sans script,
   au clavier et lus correctement.
   Des éléments qui partagent le même attribut name se referment l'un l'autre.
   C'est toujours la carte entière qui réagit (jamais le titre seul) :
   question et réponse restent un seul bloc.
   L'ouverture glisse en hauteur avec un fondu là où le navigateur sait le faire
   (::details-content et interpolate-size), et s'ouvre d'un coup ailleurs. */

.accordion {
  interpolate-size: allow-keywords;
  display: grid;
  gap: var(--space-2);
}

/* Fermé : fond gris clair. Ouvert : fond de page et filet. */
.accordion details {
  background: var(--bg-subtle);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px transparent;
  transition: background-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.accordion details[open] {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.accordion summary {
  position: relative;
  display: block;
  padding: 18px 56px 18px 20px; /* 56 px à droite : la place du signe + */
  border-radius: var(--r-md);
  color: var(--text);
  font: 500 16px/24px var(--font-sans);
  list-style: none;
  cursor: pointer;
}
.accordion summary::-webkit-details-marker { display: none; }

/* Signe + dessiné en CSS : il n'est pas lu, et ne peut pas être oublié dans le code.
   La barre verticale se couche à l'ouverture et le + devient −. */
.accordion summary::before,
.accordion summary::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 29px; /* centré sur la première ligne de 24 px */
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--text-muted);
  transition: transform var(--dur-open) var(--ease), background-color var(--dur-fast) ease;
}
.accordion summary::after { transform: rotate(90deg); }
.accordion details[open] > summary::after { transform: rotate(0deg); }

/* Survol, à la souris seulement */
@media (hover: hover) {
  .accordion details:not([open]):has(> summary:hover) { background: var(--border); }
  .accordion details[open]:has(> summary:hover) { box-shadow: inset 0 0 0 1px var(--border-strong); }
  .accordion summary:hover::before,
  .accordion summary:hover::after { background: var(--text); }
}

/* Appuyé : un cran plus foncé que le survol */
.accordion details:not([open]):has(> summary:active) { background: var(--border-strong); }
.accordion details[open]:has(> summary:active) {
  background: color-mix(in srgb, var(--text) 7%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.accordion summary:active::before,
.accordion summary:active::after { background: var(--text); }

/* Focus clavier : anneau autour de la carte entière */
.accordion summary:focus-visible { outline: none; }
.accordion details:has(> summary:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.accordion__content {
  padding: 0 20px 20px;
  color: var(--text-muted);
  font: 400 16px/24px var(--font-sans);
}
.accordion__content > :first-child { margin-top: 0; }
.accordion__content > :last-child { margin-bottom: 0; }

/* Ouverture animée : hauteur et fondu */
.accordion details::details-content {
  block-size: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    block-size var(--dur-open) var(--ease),
    opacity var(--dur-open) var(--ease),
    content-visibility var(--dur-open) allow-discrete;
}
.accordion details[open]::details-content {
  block-size: auto;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .accordion details,
  .accordion summary::before,
  .accordion summary::after,
  .accordion details::details-content { transition: none; }
}


/* DS-CG · Alerte v2.0 · bandeau */

/* Tout le contenu prend la couleur du statut (--alert-c) sur sa teinte douce (--alert-soft). */
.alert {
  --alert-c: var(--accent-text);
  --alert-soft: var(--accent-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--r-sm);
  background: var(--alert-soft);
  color: var(--alert-c);
  font: 400 15px/24px var(--font-sans);
}
.alert[hidden] { display: none; }

.alert > svg {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: none;
  color: inherit;
}

/* Titre et message sur la même ligne, séparés par un point médian */
.alert-body { flex: 1 1 240px; min-width: 0; }
.alert-body > p { display: inline; }
.alert-title { font-weight: 600; }
.alert-title::after {
  content: " · ";
  content: " · " / "";
  font-weight: 400;
}

/* Actions : liens de texte à droite (sous le texte quand la place manque) */
.alert-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-4);
  margin-left: auto;
}
.alert-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-block: -10px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: 600 15px/24px var(--font-sans);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.alert-link.secondary { font-weight: 400; }
@media (hover: hover) {
  .alert-link:hover { text-decoration-thickness: 2px; }
}
/* Appuyé : trait de 2 px, comme le lien (garde la couleur du statut) */
.alert-link:active { text-decoration-thickness: 2px; }
.alert-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Fermer : bouton fantôme de 44 px, dans la couleur du statut */
.alert .alert-close {
  flex: none;
  margin: -10px -8px -10px 0;
  color: inherit;
}
@media (hover: hover) {
  .alert .alert-close:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
}
.alert .alert-close:active { background: color-mix(in srgb, currentColor 18%, transparent); }

/* Statuts */
.alert.success { --alert-c: var(--success); --alert-soft: var(--success-soft); }
.alert.warn { --alert-c: var(--warning); --alert-soft: var(--warning-soft); }
.alert.err { --alert-c: var(--danger); --alert-soft: var(--danger-soft); }


/* DS-CG · Avatar v1.3 (Bêta)
   Une photo ronde, ou des initiales quand il n'y a pas de photo.
   Tailles : 24, 32, 40 (par défaut) et 56 px.
   Les initiales restent neutres : jamais la couleur d'accent, réservée aux actions. */

.avatar {
  --size: 40px;
  position: relative;
  display: inline-grid;
  place-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--size);
  height: var(--size);
  flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font: 500 calc(var(--size) * .4) / 1 var(--font-sans);
  letter-spacing: .01em;
  overflow: hidden;
  vertical-align: middle;
  user-select: none;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar:has(img) { border-color: transparent; }
.avatar svg { display: block; width: calc(var(--size) * .6); height: calc(var(--size) * .6); }

.avatar--xs { --size: 24px; font-size: 12px; }
.avatar--sm { --size: 32px; }
.avatar--lg { --size: 56px; }

/* Avatar et nom côte à côte */
.avatar-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.avatar-name__text { display: grid; min-width: 0; font: 400 14px/20px var(--font-sans); }
.avatar-name__text strong { color: var(--text); font-weight: 500; }
.avatar-name__text span { color: var(--text-muted); }

/* Groupe : 4 avatars au plus, puis « +3 » */
.avatar-group {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.avatar-group > li { display: flex; }
.avatar-group > li + li { margin-left: -2px; }
.avatar-group .avatar { box-shadow: 0 0 0 2px var(--bg); }
.avatar--more { color: var(--text); font-size: 12px; }


/* DS-CG · Badge v1.0 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font: 500 12px/16px var(--font-sans);
  overflow-wrap: anywhere;
}
.badge svg { width: 14px; height: 14px; flex: none; }
/* Dans un tableau, la colonne s'adapte au badge : pas de coupure au milieu d'un mot */
td .badge, th .badge { overflow-wrap: normal; }

/* Point de couleur devant le texte */
.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: var(--r-full);
  background: currentColor;
}

/* Statuts : fond doux + texte de la même couleur */
.b-accent  { background: var(--accent-soft);  color: var(--accent-text); }
.b-success { background: var(--success-soft); color: var(--success); }
.b-warning { background: var(--warning-soft); color: var(--warning); }
.b-danger  { background: var(--danger-soft);  color: var(--danger); }


/* DS-CG · Barre de progression v1.3 (Bêta)
   Deux barres de 8 px, même dessin, deux sens différents :
   - .progress + <progress> : une tâche qui avance (envoi, import, étapes).
   - .progress + <meter> : une quantité dans des bornes (espace utilisé, quota).
   Le statut est toujours écrit en clair : la couleur ne le porte jamais seule. */

.progress {
  display: grid;
  gap: var(--space-2);
  font: 400 14px/20px var(--font-sans);
  --bar: var(--accent);
}
.progress__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}
.progress__head label,
.progress__label {
  color: var(--text);
  font-weight: 500;
}
.progress__value {
  flex: none;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Piste commune à <progress> et <meter> */
.progress progress,
.progress meter {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 8px;
  border: 1px solid var(--border-control);
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  color: var(--bar);
  overflow: hidden;
}
.progress progress::-webkit-progress-bar {
  background: var(--bg-subtle);
  border-radius: var(--r-full);
}
.progress progress::-webkit-progress-value {
  background: var(--bar);
  border-radius: var(--r-full);
  transition: width var(--dur-open) var(--ease);
}
.progress progress::-moz-progress-bar {
  background: var(--bar);
  border-radius: var(--r-full);
}
.progress meter::-webkit-meter-inner-element { display: block; height: 100%; }
.progress meter::-webkit-meter-bar {
  height: 100%;
  border: 0;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
}
.progress meter::-webkit-meter-optimum-value,
.progress meter::-webkit-meter-suboptimum-value,
.progress meter::-webkit-meter-even-less-good-value {
  background: var(--bar);
  border-radius: var(--r-full);
}
.progress meter::-moz-meter-bar {
  background: var(--bar);
  border-radius: var(--r-full);
}

/* Message de statut sous la barre : icône + texte */
.progress__status {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  color: var(--text-muted);
}
.progress__status svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* États */
.progress--success { --bar: var(--success); }
.progress--success .progress__status { color: var(--success); font-weight: 500; }
.progress--warning { --bar: var(--warning); }
.progress--warning .progress__status { color: var(--warning); font-weight: 500; }
.progress--danger { --bar: var(--danger); }
.progress--danger .progress__status { color: var(--danger); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .progress progress::-webkit-progress-value { transition: none; }
}


/* DS-CG · Bouton v1.0 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--ctl-h);
  padding: 0 var(--ctl-px);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  color: var(--text);
  font: 500 15px/1.2 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    color var(--dur-fast) ease;
}
.btn svg { width: 18px; height: 18px; flex: none; }

.btn:focus-visible {
  outline: 2px solid transparent; /* invisible à l'écran, dessiné en contraste élevé (le halo y est effacé) */
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
/* Bouton plein et bouton-icône : la bordure bleue se confond avec le fond ou ne se voit pas, un contour décalé la remplace */
.btn-primary:focus-visible,
.btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--focus-ring); /* halo élargi : il dépasse du contour décalé */
}

/* Secondaire (par défaut) */
@media (hover: hover) {
  .btn:hover { background: var(--border); text-decoration: none; }
}
.btn:active { background: var(--border-strong); }

/* Principal : un seul par vue */
.btn-primary { background: var(--accent); color: var(--on-accent); }
@media (hover: hover) {
  .btn-primary:hover { background: var(--accent-hover); }
}
.btn-primary:active { background: var(--accent-active); }

/* Fantôme */
.btn-ghost { background: transparent; }
@media (hover: hover) {
  .btn-ghost:hover { background: var(--bg-subtle); }
}
.btn-ghost:active { background: var(--border); }

/* Destructif */
.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-border);
}
@media (hover: hover) {
  .btn-danger:hover { background: var(--danger-soft); }
}
.btn-danger:active { background: var(--danger-soft); border-color: var(--danger); }

/* Bascule (aria-pressed) : sélectionné */
.btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}
@media (hover: hover) {
  .btn[aria-pressed="true"]:hover { background: var(--accent-soft); border-color: var(--accent-text); }
}

/* Ouvert (aria-expanded) : garde le fond appuyé (le chevron du menu tourne déjà) */
.btn[aria-expanded="true"]:not(.btn-primary):not([aria-pressed="true"]) { background: var(--border-strong); }
.btn-ghost[aria-expanded="true"]:not([aria-pressed="true"]) { background: var(--border); }

/* Petit */
.btn-sm { min-height: 32px; padding: 0 14px; font-size: 14px; }
.btn-sm svg { width: 16px; height: 16px; }

/* Icône seule : carré, libellé dans aria-label */
.btn-icon { width: var(--ctl-h); padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* Écran tactile : le petit bouton garde une zone de toucher de 44 px */
@media (pointer: coarse) {
  .btn-sm { position: relative; }
  .btn-sm::after { content: ""; position: absolute; inset: -6px 0; }
  .btn-icon.btn-sm::after { inset: -6px; }
}

/* Pleine largeur (mobile, formulaires) */
.btn-block { display: flex; width: 100%; }

/* Désactivé */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Chargement */
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] svg.btn-spinner { animation: btn-spin .8s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"] svg.btn-spinner { animation-duration: 2.4s !important; animation-iteration-count: infinite !important; }
}


/* DS-CG · Carte v1.0 */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--card-p);
}

.card > * + * { margin-top: var(--space-2); }

/* En-tête : titre à gauche, action à droite */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 20px;
}
.card-head h3 { min-width: 0; }

/* Listes dans une carte : retrait réduit */
.card :is(ul, ol) { padding-left: 20px; }

/* Pied : filet + actions alignées à droite, qui vont jusqu'aux bords de la carte */
.card-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: var(--space-5) calc(var(--card-p) * -1) calc(var(--card-p) * -1);
  padding: var(--space-4) var(--card-p);
  border-top: 1px solid var(--border);
}

/* Grille de cartes : écart de 24 px, une colonne sur petit écran */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  width: 100%;
}

/* Carte cliquable : un seul lien dont la zone couvre toute la carte */
.card-clickable { position: relative; }
.card-clickable h3 { margin: 0; }
.card-cover {
  color: var(--text);
  text-decoration: none;
}
.card-cover::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  transition:
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}
@media (hover: hover) {
  .card-cover:hover { text-decoration: none; }
  .card-cover:hover::after { border-color: var(--border-strong); }
}
/* Appuyé : bordure un cran plus foncée que le survol, la carte ne bouge pas */
.card-cover:active::after { border-color: var(--border-control); }
.card-cover:focus-visible { outline: none; }
.card-cover:focus-visible::after {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
  /* Le halo seul reste sous 3:1 : un contour bleu de 2 px entoure la carte */
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Carte statistique : libellé, chiffre, variation */
.kpi-label {
  font: 500 12px/16px var(--font-sans);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kpi-value {
  margin: var(--space-2) 0;
  font: 600 32px/40px var(--font-sans);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

/* Prix ou valeur mise en avant dans une carte */
.card-price {
  margin-top: var(--space-3);
  font: 600 20px/28px var(--font-sans);
  font-variant-numeric: tabular-nums;
}

/* Carte avec image : l'image, en premier enfant, va jusqu'aux bords du haut */
.card-media {
  display: block;
  width: calc(100% + var(--card-p) * 2);
  max-width: none;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin: calc(var(--card-p) * -1) calc(var(--card-p) * -1) var(--card-p);
  border-radius: calc(var(--r-md) - 1px) calc(var(--r-md) - 1px) 0 0;
  background: var(--border);
  height: auto;
}
.card > .card-media + * { margin-top: 0; }


/* DS-CG · Case à cocher, bouton radio, interrupteur v1.0
   Contrôles natifs (<input>) dessinés avec appearance: none. */

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--ctl-h);
  font-size: 16px;
  line-height: 24px;
  cursor: pointer;
}

.check input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--border-control);
  border-radius: var(--r-xs);
  background: var(--surface);
  cursor: pointer;
  transition:
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}
.check input[type="radio"] { border-radius: var(--r-full); }

/* Coche, tiret et point : dessinés avec un masque, ils prennent la couleur du texte sur accent */
.check input::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--on-accent);
  opacity: 0;
  transition: opacity var(--dur-fast) ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 100% no-repeat;
}
.check input[type="radio"]::before {
  inset: 6px;
  border-radius: var(--r-full);
  -webkit-mask: none;
  mask: none;
}
.check input[type="checkbox"]:indeterminate::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}

.check input:checked,
.check input[type="checkbox"]:indeterminate {
  background: var(--accent);
  border-color: var(--accent);
}
.check input:checked::before,
.check input[type="checkbox"]:indeterminate::before { opacity: 1; }

@media (hover: hover) {
  .check:hover input:not(:disabled, :checked, [type="checkbox"]:indeterminate) { border-color: var(--text); }
  .check:hover input:is(:checked, [type="checkbox"]:indeterminate):not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
  }
}

/* Appuyé : un cran plus foncé que le survol */
.check:active input:not(:disabled, :checked, [type="checkbox"]:indeterminate) {
  border-color: var(--text);
  background: var(--bg-subtle);
}
.check:active input:is(:checked, [type="checkbox"]:indeterminate):not(:disabled) {
  background: var(--accent-active);
  border-color: var(--accent-active);
}
.check:active input.toggle:not(:disabled, :checked) { background: var(--border); }

.check input:focus-visible {
  outline: 2px solid transparent; /* invisible à l'écran, dessiné en contraste élevé (le halo y est effacé) */
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Erreur */
.check input[aria-invalid="true"],
.check-group.error .check input:not(:checked) { border-color: var(--danger); }
.check input[aria-invalid="true"]:focus-visible,
.check-group.error .check input:focus-visible { border-color: var(--danger); }

/* Désactivé */
.check:has(input:disabled) { color: var(--text-faint); cursor: not-allowed; }
.check input:disabled { opacity: .4; cursor: not-allowed; }
.check:has(input:disabled) input { pointer-events: none; }

/* Interrupteur : 44 × 26, pilule */
.check input.toggle {
  width: 44px;
  height: 26px;
  border-width: 1px;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
}
.check input.toggle::before {
  inset: auto;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  background: var(--text-muted);
  opacity: 1;
  -webkit-mask: none;
  mask: none;
  transition:
    transform var(--dur-open) var(--ease),
    background-color var(--dur-fast) ease;
}
.check input.toggle:checked { background: var(--accent); border-color: var(--accent); }
.check input.toggle:checked::before { transform: translateX(18px); background: var(--on-accent); }
@media (prefers-reduced-motion: reduce) {
  .check input.toggle::before { transition: background-color var(--dur-fast) ease; }
}

/* Groupe : fieldset + legend */
.check-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.check-group > legend {
  padding: 0;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text);
}
.check-list { display: flex; flex-direction: column; }
.check-group--inline > .check-list { flex-direction: row; flex-wrap: wrap; column-gap: 24px; }

.check-help {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}
.check-help svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.check-group.error .check-help,
.check-help.error { color: var(--danger); }


/* DS-CG · Champ texte v1.3
   .field (libellé + champ + aide), .input, .help, .input-wrap (icône),
   .input-actions (un ou deux boutons icône seule à droite),
   règles de saisie (.field-rule, data-allow),
   zone de texte (.input--grow, .field-counter) et date (.date-fields).
   Ces classes servent aussi à la liste déroulante. */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label,
.field-label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text);
}
.field-optional { font-weight: 400; color: var(--text-muted); }

.help {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}
.help svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

.input {
  width: 100%;
  min-height: var(--ctl-h);
  padding: 0 14px;
  border: 1px solid var(--border-control);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font: 400 16px/1.5 var(--font-sans);
  transition:
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    background-color var(--dur-fast) ease;
}
textarea.input {
  min-height: 96px;
  padding: 10px 14px;
  resize: vertical;
}
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input[type="search"] { appearance: none; -webkit-appearance: none; }

@media (hover: hover) {
  .input:hover:not(:disabled):not([readonly]):not([aria-invalid="true"]) { border-color: var(--text-muted); }
  .field.error .input:hover { border-color: var(--danger); }
}

.input:focus-visible {
  outline: 2px solid transparent; /* invisible à l'écran, dessiné en contraste élevé (le halo y est effacé) */
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Erreur : bordure et message rouges, plus une icône dans le message */
.field.error .input,
.input[aria-invalid="true"] { border-color: var(--danger); }
.field.error .help { color: var(--danger); font-weight: 500; }
.field.error .input:focus-visible,
.input[aria-invalid="true"]:focus-visible { border-color: var(--danger); }

/* Désactivé */
.input:disabled {
  background: var(--bg-subtle);
  color: var(--text-faint);
  cursor: not-allowed;
}
.input:disabled::placeholder { color: var(--text-faint); }

/* Lecture seule : lisible, sélectionnable, atteignable au clavier, mais non modifiable */
.input[readonly] {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text);
  cursor: default;
}

/* Rempli par le navigateur : garde les couleurs du champ au lieu du fond jaune ou bleu */
.input:autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: inset 0 0 0 100px var(--surface);
  caret-color: var(--text);
}
.input:autofill:focus-visible {
  box-shadow: inset 0 0 0 100px var(--surface), 0 0 0 3px var(--focus-ring);
}

/* Champ avec icône (recherche) */
.input-wrap { position: relative; }
.input-wrap > svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  translate: 0 -50%;
  color: var(--text-muted);
  pointer-events: none;
}
.input-wrap > svg + .input { padding-left: 44px; }

/* Boutons d'action dans le champ : un ou deux au plus, icône seule, à droite
   (afficher le mot de passe, effacer, copier…). */
.input-actions {
  position: absolute;
  top: 50%;
  right: 6px;
  display: flex;
  gap: 4px;
  translate: 0 -50%;
}
.input-actions .btn { color: var(--text-muted); }
.input-actions [hidden] { display: none; }
@media (hover: hover) {
  .input-actions .btn:hover { color: var(--text); }
}
.input-wrap:has(.input-actions) > .input { padding-right: 46px; }
.input-wrap:has(.input-actions .btn + .btn) > .input { padding-right: 82px; }

/* Règle de saisie : message posé par champ-texte.js quand un caractère est refusé */
.field-rule[hidden] { display: none; }

/* Zone de texte (Bêta)
   - .input--grow : la zone grandit avec le texte, de 96 à 320 px.
   - .field-counter : le compteur de caractères, sous la zone (script champ-texte.js).
   Pas de maxlength : on laisse écrire, puis on dit de combien on dépasse. */
textarea.input--grow {
  min-height: 96px;
  max-height: 320px;
  field-sizing: content;
  /* Un mot très long (lien, suite de lettres) passe à la ligne au lieu d'élargir la zone */
  overflow-wrap: anywhere;
}

.field-counter {
  margin: 0;
  font: 400 14px/20px var(--font-sans);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.field-counter.is-over {
  color: var(--danger);
  font-weight: 500;
}

/* Date (Bêta). Deux formes, sans calendrier maison :
   - input type="date" natif, pour une date proche (rendez-vous, échéance) ;
   - .date-fields : trois champs Jour, Mois, Année dans un fieldset,
     pour une date que l'on connaît par cœur (naissance, document). */

/* Date native : même dessin que .input, icône du calendrier aux couleurs du thème */
.input[type="date"],
.input[type="time"] {
  max-width: 220px;
  font-variant-numeric: tabular-nums;
}
.input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  border-radius: var(--r-xs);
  padding: 4px;
  opacity: .75;
}
.input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* Trois champs */
.date-fields {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.date-fields > legend {
  padding: 0;
  margin-bottom: 6px;
  font: 500 14px/20px var(--font-sans);
  color: var(--text);
}
.date-fields > .help { margin-bottom: var(--space-2); }
.date-fields__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.date-fields__row .field label {
  font-weight: 400;
  color: var(--text-muted);
}
.date-fields__row .input {
  font-variant-numeric: tabular-nums;
}
.date-fields__day .input,
.date-fields__month .input { width: 4.5em; }
.date-fields__year .input { width: 6.5em; }

/* En erreur : le message sous l'aide, seule la partie fausse en rouge */
.date-fields > .help + .date-fields__error { margin-top: calc(-1 * var(--space-1)); }
.date-fields__error { color: var(--danger); font-weight: 500; }


/* DS-CG · Chargement v1.0
   Trois formes, sans script :
   - .spinner : une roue pour une attente courte et de durée inconnue ;
     elle n'apparaît qu'après 300 ms, pour ne pas clignoter quand tout va vite.
   - .progress : la barre de progression, décrite dans barre-progression.css.
   - .skeleton : des blocs fixes à la forme du contenu qui arrive, sans reflet ni pulsation. */

/* Roue */
.spinner {
  display: inline-block;
  flex: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: middle;
  animation:
    ds-spinner-show 1ms 300ms both,
    ds-spin 800ms linear infinite;
}
.spinner--sm { width: 16px; height: 16px; }
.spinner--lg { width: 32px; height: 32px; }

@keyframes ds-spin { to { transform: rotate(1turn); } }
@keyframes ds-spinner-show { from { opacity: 0; } to { opacity: 1; } }

/* Mouvement réduit : la roue tourne trois fois moins vite au lieu de s'arrêter,
   pour qu'on voie encore que la page travaille */
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 1ms, 2400ms !important;
    animation-iteration-count: 1, infinite !important;
  }
}

/* Squelette : blocs immobiles. La zone porte aria-busy="true" et un texte caché « Chargement… » */
.skeleton {
  display: block;
  border-radius: var(--r-sm);
  background: var(--border);
}
.skeleton--text {
  height: 16px;
  margin-block: var(--space-1);
}
.skeleton--title {
  width: 60%;
  height: 24px;
  margin-block: var(--space-1) var(--space-3);
}
.skeleton--short { width: 40%; }
.skeleton--media {
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
}
.skeleton--circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}


/* DS-CG · Confirmation après envoi v1.3
   Panneau vert pâle en haut de la page de fin d'un parcours :
   icône, titre au passé, numéro de référence copiable. */
.confirmation {
  display: grid;
  justify-items: start;
  gap: var(--space-3);
  padding: var(--space-6);
  border-radius: var(--r-lg);
  background: var(--success-soft);
  color: var(--text);
}
.confirmation > svg { width: 32px; height: 32px; color: var(--success); }
.confirmation__title { margin: 0; }
.confirmation__title:focus { outline: none; }
.confirmation__text { margin: 0; }
.confirmation__ref {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-2);
}
.confirmation__ref-label { display: block; font-size: 14px; line-height: 20px; font-weight: 500; }
.confirmation__number {
  display: block;
  font: 600 20px/28px var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

@media (max-width: 479px) {
  .confirmation { padding: var(--space-5); }
}


/* DS-CG · Curseur v1.3 (Bêta)
   Un <input type="range"> natif redessiné. La valeur est écrite dans un <output>.
   La partie choisie de la piste est bleue : la variable --fill (0 à 100 %)
   est tenue à jour par curseur.js ; Firefox la dessine seul. */

.slider {
  display: grid;
  gap: var(--space-1);
  font: 400 14px/20px var(--font-sans);
}
.slider__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}
.slider__head label { font-weight: 500; color: var(--text); }
.slider__head output {
  flex: none;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.slider__scale {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.slider__input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;          /* zone de toucher */
  margin: 0;
  background: transparent;
  cursor: pointer;
  --fill: 50%;
  --thumb-ring: 0 0 0 0 transparent;
}
.slider__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  --thumb-ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent), 0 0 0 7px var(--focus-ring);
}

/* Piste */
.slider__input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--r-full);
  background: linear-gradient(to right, var(--accent) var(--fill), var(--border-control) var(--fill));
}
.slider__input::-moz-range-track {
  height: 4px;
  border-radius: var(--r-full);
  background: var(--border-control);
}
.slider__input::-moz-range-progress {
  height: 4px;
  border-radius: var(--r-full);
  background: var(--accent);
}

/* Poignée */
.slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  margin-top: -10px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--thumb-ring), var(--shadow-1);
  transition: box-shadow var(--dur-fast) ease;
}
.slider__input::-moz-range-thumb {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--thumb-ring), var(--shadow-1);
  transition: box-shadow var(--dur-fast) ease;
}

/* Survol et appui de la poignée : bord plus foncé, puis fond bleu doux ; elle ne grossit pas */
@media (hover: hover) {
  .slider__input:not(:disabled):hover::-webkit-slider-thumb { border-color: var(--accent-hover); }
  .slider__input:not(:disabled):hover::-moz-range-thumb { border-color: var(--accent-hover); }
}
.slider__input:not(:disabled):active::-webkit-slider-thumb { border-color: var(--accent-active); background: var(--accent-soft); }
.slider__input:not(:disabled):active::-moz-range-thumb { border-color: var(--accent-active); background: var(--accent-soft); }

.slider__input:disabled { cursor: not-allowed; opacity: .4; }


/* DS-CG · En-tête (navigation du haut) v1.0
   Le menu se replie selon la largeur de l'en-tête lui-même (requête de conteneur),
   pas selon celle de la fenêtre : il se comporte pareil dans une page ou dans un aperçu. */

.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  container-type: inline-size;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.topnav__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  max-width: var(--container);
  min-height: 64px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Logo */
.logo {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--ctl-h);
  color: var(--text);
  font-weight: 600;
  letter-spacing: -.01em;
  text-decoration: none;
}
.logo span { color: var(--accent-text); }
@media (hover: hover) {
  .logo:hover { text-decoration: none; }
}

/* Zone repliable : liens puis actions */
.topnav__menu {
  flex: 1;
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: var(--space-5);
}

.topnav__links {
  align-self: stretch;
  margin-left: auto;
}
.topnav__links ul {
  display: flex;
  align-self: stretch;
  height: 100%;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}
.topnav__links li { display: flex; }

.topnav__links a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--ctl-h);
  padding: 0 var(--space-3);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
@media (hover: hover) {
  .topnav__links a:hover { color: var(--text); text-decoration: none; }
}
.topnav__links a:active { color: var(--text); background: var(--border); border-radius: var(--r-sm); }
.topnav__links a[aria-current] { cursor: default; }
.topnav__links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Page en cours : texte plein + barre bleue de 2 px sur le filet du bas */
.topnav__links a[aria-current] { color: var(--text); }
.topnav__links a[aria-current]::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: -1px;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--accent);
}

.topnav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Bouton du menu mobile (créé caché : visible seulement si le script est chargé) */
.topnav__toggle { display: none; margin-left: auto; }

/* Largeur étroite : le menu devient un panneau sous l'en-tête */
@container (max-width: 767px) {
  .topnav__inner { flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding-block: var(--space-2); }
  .topnav__menu {
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    align-self: auto;
    gap: var(--space-3);
    padding-bottom: var(--space-3);
  }
  .topnav__links { margin-left: 0; align-self: auto; }
  .topnav__links ul { flex-direction: column; height: auto; gap: 0; }
  .topnav__links a { width: 100%; padding: 0 var(--space-3); border-radius: var(--r-sm); }
  .topnav__links a[aria-current] { background: var(--accent-soft); color: var(--accent-text); }
  .topnav__links a[aria-current]::after { display: none; }
  .topnav__actions { flex-direction: column; align-items: stretch; }
  .topnav__actions .btn { width: 100%; }

  /* Avec le script : bouton visible, panneau replié par défaut */
  .topnav[data-js] .topnav__toggle { display: inline-flex; }
  .topnav[data-js] .topnav__inner { flex-wrap: nowrap; padding-block: 0; }
  .topnav[data-js] .topnav__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    padding: var(--space-3) var(--gutter) var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
    box-shadow: var(--shadow-1);
    opacity: 0;
    transform: translateY(-8px);
    transition:
      opacity var(--dur-open) var(--ease),
      transform var(--dur-open) var(--ease),
      display var(--dur-open) allow-discrete;
  }
  .topnav[data-js] .topnav__menu[data-open] {
    display: flex;
    opacity: 1;
    transform: none;
  }
  @starting-style {
    .topnav[data-js] .topnav__menu[data-open] {
      opacity: 0;
      transform: translateY(-8px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .topnav[data-js] .topnav__menu { transform: none; }
}

/* Aperçu dans la documentation : l'en-tête reste dans son cadre */
.topnav-scene {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 22rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
}
.topnav-scene__page { padding: var(--space-6) var(--gutter); color: var(--text-muted); }

/* Largeur d'un téléphone : montre le menu replié */
.topnav-scene--narrow { min-height: 26rem; max-width: 375px; margin-inline: auto; }

/* Pleine largeur de la zone de démo (annule sa marge intérieure : 40 × 32 px, 28 × 20 px sur mobile) */
.topnav-scene--flush {
  width: calc(100% + var(--space-6) * 2);
  margin: -40px calc(var(--space-6) * -1);
  border: 0;
  border-radius: 0;
}
@media (max-width: 767px) {
  .topnav-scene--flush { width: calc(100% + 40px); margin: -28px -20px; }
}


/* DS-CG · Envoi de fichier v1.3 (Bêta)
   Un vrai <input type="file">, caché visuellement mais atteignable au clavier,
   dans une zone où l'on peut aussi déposer un fichier.
   Toute la zone est un <label> qui ouvre le champ au clic. */

.upload__zone {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1.5px dashed var(--border-control);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}
.upload__zone > svg {
  width: 24px;
  height: 24px;
  flex: none;
  color: var(--text-muted);
}
@media (hover: hover) {
  .upload__zone:hover { border-color: var(--accent); }
}
/* Appuyé : fond un cran plus marqué */
.upload__zone:active { border-color: var(--accent); background: var(--border); }
/* Désactivé : seulement si l'envoi s'ouvre après une autre réponse */
.upload__zone:has(.upload__input:disabled) {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}
.upload__text {
  margin: 0;
  color: var(--text-muted);
  font: 400 15px/22px var(--font-sans);
}

/* Fichier glissé au-dessus de la zone */
.upload__zone.is-dragover {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Le champ natif : invisible, mais présent pour le clavier et les lecteurs d'écran */
.upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.upload__link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Son focus se voit sur toute la zone */
.upload__zone:has(.upload__input:focus-visible) {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field.error .upload__zone { border-color: var(--danger); }
.upload__msg[hidden] { display: none; }

/* Liste des fichiers choisis */
.upload__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}
.upload__list:empty { display: none; }
.upload__file {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--ctl-h);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font: 400 15px/22px var(--font-sans);
}
.upload__file > svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--text-muted);
}
.upload__name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload__size {
  flex: none;
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.upload__file .btn { flex: none; }

@media (max-width: 479px) {
  .upload__zone { flex-direction: column; }
}


/* DS-CG · Étapes numérotées v1.3 (Bêta)
   Une liste <ol> de 3 à 6 étapes. L'étape en cours porte aria-current="step".
   L'état de chaque étape est aussi écrit en texte caché (terminée, en cours, à venir).
   Les libellés s'affichent quand le composant fait au moins 560 px de large ;
   en dessous, une ligne « Étape 2 sur 4 · Adresse » les remplace. */

.steps { container-type: inline-size; }

.steps__list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.steps__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  text-align: center;
}
/* Trait qui relie l'étape à la précédente */
.steps__item + .steps__item::before {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(-50% + 24px);
  right: calc(50% + 24px);
  height: 2px;
  border-radius: var(--r-full);
  background: var(--border-control);
}
.steps__item.is-done + .steps__item::before { background: var(--accent); }

.steps__marker {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  flex: none;
  border: 1.5px solid var(--border-control);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font: 600 14px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
}
.steps__marker svg { width: 16px; height: 16px; stroke-width: 2.5; }

.steps__label {
  max-width: 100%;
  color: var(--text-muted);
  font: 400 14px/20px var(--font-sans);
}

/* Terminée */
.steps__item.is-done .steps__marker {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.steps__item.is-done .steps__label { color: var(--text); }

/* En cours */
.steps__item[aria-current="step"] .steps__marker {
  border: 2px solid var(--accent);
  color: var(--accent-text);
}
.steps__item[aria-current="step"] .steps__label {
  color: var(--text);
  font-weight: 500;
}

/* Résumé pour les petites largeurs */
.steps__summary {
  margin: var(--space-3) 0 0;
  color: var(--text);
  font: 500 14px/20px var(--font-sans);
}

@container (min-width: 560px) {
  .steps__summary { display: none; }
}
@container (max-width: 559.98px) {
  /* Les libellés restent lus par les lecteurs d'écran */
  .steps__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}


/* DS-CG · État vide v1.3
   Remplace une liste ou un tableau sans contenu : icône décorative, titre,
   une phrase, une action. Jamais une impasse. */

.empty {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  max-width: 480px;
  margin-inline: auto;
  padding: var(--space-7) var(--space-5);
  text-align: center;
}
.empty > svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-2);
  color: var(--text-muted);
  stroke-width: 1.5;
}
.empty__title { margin: 0; }
.empty__text { margin: 0; color: var(--text-muted); }
.empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.empty[hidden] { display: none; }


/* DS-CG · Étiquette v1.3 (Bêta)
   Une pastille pour un mot-clé choisi par la personne : catégorie, filtre actif.
   À ne pas confondre avec le badge, qui affiche un statut fixé par le système.
   - .tag : étiquette simple ;
   - .tag + .tag__remove : étiquette que l'on peut retirer ;
   - button.tag[aria-pressed] : filtre que l'on active ou désactive. */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  min-height: 32px;
  max-width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  color: var(--text);
  font: 500 14px/20px var(--font-sans);
  white-space: nowrap;
}
.tag svg { width: 16px; height: 16px; flex: none; }

/* Étiquette à retirer : bouton rond de 24 px en fin de pastille */
.tag:has(.tag__remove) { padding-right: 4px; }
.tag__remove {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.tag__remove svg { width: 14px; height: 14px; stroke-width: 2; }
@media (hover: hover) {
  .tag__remove:hover { background: var(--border); color: var(--text); }
}
.tag__remove:active { background: var(--border-strong); color: var(--text); }
.tag__remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

/* Filtre : un vrai bouton à deux états */
button.tag {
  border-color: var(--border-control);
  cursor: pointer;
  transition:
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease;
}
button.tag .tag__check { display: none; }
button.tag[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}
button.tag[aria-pressed="true"] .tag__check { display: block; }
@media (hover: hover) {
  button.tag:hover { background: var(--border); }
  button.tag[aria-pressed="true"]:hover { background: var(--accent-soft); border-color: var(--accent-hover); }
}
/* Appuyé : un cran plus foncé que le survol */
button.tag:active { background: var(--border-strong); }
button.tag[aria-pressed="true"]:active { background: var(--accent-soft); border-color: var(--accent-active); }
button.tag:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--focus-ring);
}
/* Désactivé */
button.tag:disabled,
button.tag[aria-disabled="true"],
.tag__remove:disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Écran tactile : zone de toucher de 44 px */
@media (pointer: coarse) {
  button.tag::after,
  .tag__remove::after {
    content: "";
    position: absolute;
    inset: -6px 0;
  }
  .tag__remove { position: relative; }
  .tag__remove::after { inset: -10px; }
}


/* DS-CG · Fenêtre modale v1.0
   Basée sur l'élément natif <dialog>, ouvert avec showModal().
   Le navigateur gère le piège du focus, la touche Échap et l'inertie du reste de la page. */

.modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - var(--space-6));
  margin: auto;
  padding: var(--card-p);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-2);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Écran réellement ouvert : marge latérale de sécurité sur petit écran */
dialog.modal {
  position: fixed;
  width: calc(100% - var(--gutter) * 2);
  max-width: 480px;
}

/* Voile derrière la fenêtre */
dialog.modal::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(8px);
}

/* La page derrière ne défile pas tant qu'une fenêtre est ouverte */
body:has(dialog.modal[open]) { overflow: hidden; }

/* Ouverture et fermeture : fondu + glissement de 8 px */
dialog.modal {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--dur-open) var(--ease),
    transform var(--dur-open) var(--ease),
    overlay var(--dur-open) allow-discrete,
    display var(--dur-open) allow-discrete;
}
dialog.modal[open] {
  opacity: 1;
  transform: none;
}
@starting-style {
  dialog.modal[open] {
    opacity: 0;
    transform: translateY(8px);
  }
}
dialog.modal::backdrop {
  opacity: 0;
  transition:
    opacity var(--dur-open) var(--ease),
    overlay var(--dur-open) allow-discrete,
    display var(--dur-open) allow-discrete;
}
dialog.modal[open]::backdrop { opacity: 1; }
@starting-style {
  dialog.modal[open]::backdrop { opacity: 0; }
}

/* Contenu */
.modal__title {
  padding-right: var(--space-6);
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.modal__body {
  margin-top: var(--space-2);
  color: var(--text-muted);
}
.modal__body > * + * { margin-top: var(--space-3); }

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* Bouton de fermeture, en haut à droite */
.modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}

/* Confirmation destructive : le seul endroit où le rouge est plein.
   Le texte prend la couleur du fond de page, qui reste lisible sur le rouge clair comme sur le rouge sombre. */
.btn.btn-danger-fill {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--bg);
}
@media (hover: hover) {
  .btn.btn-danger-fill:hover { background: var(--danger); filter: brightness(.9); }
}
.btn.btn-danger-fill:active { background: var(--danger); filter: brightness(.85); }
.btn.btn-danger-fill:focus-visible { border-color: var(--danger); box-shadow: 0 0 0 3px var(--focus-ring); outline: 2px solid var(--danger); outline-offset: 2px; }

/* Aperçu de la fenêtre dans la documentation (ni modal, ni interactif) */
.modal-scene {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: var(--space-8) var(--space-5);
  border-radius: var(--r-lg);
  background: var(--overlay);
}

@media (prefers-reduced-motion: reduce) {
  dialog.modal { transform: none; }
  @starting-style {
    dialog.modal[open] { transform: none; }
  }
}


/* DS-CG · Fil d'Ariane v1.0
   Montre où se trouve la page dans le site et permet d'en remonter. Sans script.
   Sous 480 px de large (la sienne, pas celle de l'écran), seul le niveau parent
   reste, en lien retour précédé d'un chevron vers la gauche. */

.breadcrumb {
  container-type: inline-size;
  font: 400 14px/20px var(--font-sans);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}

/* Chevron entre deux niveaux, dessiné en CSS : il n'est pas lu */
.breadcrumb li + li::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / 100% no-repeat;
}

/* Libellé coupé au-delà de 200 px */
.breadcrumb a,
.breadcrumb [aria-current="page"] {
  display: block;
  max-width: 200px;
  padding-block: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.breadcrumb a {
  border-radius: var(--r-xs);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--dur-fast) ease;
}
.breadcrumb a { text-underline-offset: 3px; }
@media (hover: hover) {
  .breadcrumb a:hover { color: var(--text); text-decoration: underline; }
}
/* Appuyé : trait de 2 px, comme le lien */
.breadcrumb a:active {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.breadcrumb a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--focus-ring);
  text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

/* Étroit : seul le parent reste, en lien retour de 44 px de haut, chevron compris */
@container (max-width: 479px) {
  .breadcrumb li:not(:nth-last-child(2)) { display: none; }
  .breadcrumb li + li::before { display: none; }
  .breadcrumb li:nth-last-child(2) > a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 44px;
    max-width: none;
    white-space: normal;
  }
  .breadcrumb li:nth-last-child(2) > a::before {
    content: "";
    flex: none;
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E") center / 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E") center / 100% no-repeat;
  }
}


/* DS-CG · Infobulle v1.0
   Petit texte qui nomme un bouton à icône seule, ou ajoute une courte précision.
   Apparaît au survol (après 300 ms) et au focus clavier (aussitôt), reste quand
   le pointeur passe dessus, se ferme avec Échap (script infobulle.js). */

.tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  z-index: 50;
  width: max-content;
  max-width: min(240px, calc(100vw - var(--space-4) * 2));
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--inverse-bg);
  color: var(--inverse-text);
  box-shadow: var(--shadow-1);
  font: 400 14px/20px var(--font-sans);
  text-align: start;
  white-space: normal;
  overflow-wrap: break-word;
  opacity: 0;
  visibility: hidden;
  transform: translate(calc(-50% + var(--tooltip-shift, 0px)), 4px);
  transition:
    opacity var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease),
    visibility 0s linear var(--dur-fast);
}

/* Pont invisible entre le déclencheur et la bulle : le pointeur peut y passer sans la fermer */
.tooltip::before {
  content: "";
  position: absolute;
  inset: 100% 0 calc(var(--space-2) * -1);
}

/* En dessous : choisi par l'auteur, ou par le script quand la place manque au-dessus */
.tooltip-wrap[data-placement="bottom"] > .tooltip {
  top: calc(100% + var(--space-2));
  bottom: auto;
  transform: translate(calc(-50% + var(--tooltip-shift, 0px)), -4px);
}
.tooltip-wrap[data-placement="bottom"] > .tooltip::before { inset: calc(var(--space-2) * -1) 0 100%; }

/* Affichage : au focus clavier tout de suite, au survol après 300 ms */
.tooltip-wrap:has(:focus-visible) > .tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(calc(-50% + var(--tooltip-shift, 0px)), 0);
  transition-delay: 0s;
}
@media (hover: hover) {
  .tooltip-wrap:hover > .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(calc(-50% + var(--tooltip-shift, 0px)), 0);
    transition-delay: 300ms;
  }
}

/* Fermée avec Échap, jusqu'à ce que le pointeur ou le focus quitte le déclencheur */
.tooltip-wrap[data-tooltip-dismissed] > .tooltip {
  opacity: 0;
  visibility: hidden;
  transition-delay: 0s, 0s, var(--dur-fast);
}

@media (prefers-reduced-motion: reduce) {
  .tooltip,
  .tooltip-wrap[data-placement="bottom"] > .tooltip,
  .tooltip-wrap:has(:focus-visible) > .tooltip,
  .tooltip-wrap:hover > .tooltip {
    transform: translateX(calc(-50% + var(--tooltip-shift, 0px)));
  }
}


/* DS-CG · Lien v1.1
   Un lien mène vers une autre page ou un autre endroit. Pour une action, voir bouton.css. */

.link {
  color: var(--accent-text);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-radius: 4px;
  cursor: pointer;
  transition:
    color var(--dur-fast) ease,
    text-decoration-thickness var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

@media (hover: hover) {
  .link:hover { text-decoration: underline; }
}

.link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--focus-ring);
  text-decoration: underline;
}

.link:active {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* Page courante : texte normal, ni soulignement ni survol */
.link[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  cursor: default;
}

/* Indisponible : rôle link + aria-disabled, sans href */
.link[aria-disabled="true"] {
  color: var(--text-faint);
  text-decoration: none;
  cursor: not-allowed;
  pointer-events: none;
}

/* Souligné en permanence : à préférer dans un paragraphe */
.link-underline { text-decoration: underline; }
@media (hover: hover) {
  .link-underline:hover { text-decoration-thickness: 2px; }
}

/* Visité : seulement dans le texte courant */
.link-underline:visited { color: var(--link-visited); }
.link-underline:visited:active { color: var(--text); }

/* Autonome, avec flèche (« Voir le détail ») */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--ctl-h);
  font-weight: 500;
}
.link-arrow svg {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform var(--dur-fast) var(--ease);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .link-arrow:hover svg { transform: translateX(3px); }
}

/* Externe : petite icône après le texte */
.link-external svg {
  display: inline-block;
  width: .875em;
  height: .875em;
  margin-left: .25em;
  vertical-align: -.1em;
}

/* Liste de liens : chaque ligne mène à une page (titre, phrase, flèche).
   Pas de fond au survol ni à l'appui : le texte passe en bleu, la flèche glisse. */
.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.link-list li { border-bottom: 1px solid var(--border); }
.link-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 24px;
  padding: 20px 4px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r-sm);
}
.link-list-title {
  font-size: 17px;
  font-weight: 600;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.link-list-desc {
  grid-column: 1;
  color: var(--text-muted);
  font-size: 15px;
}
.link-list svg {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) ease;
}
.link-list-title,
.link-list-desc { transition: color var(--dur-fast) ease; }

@media (hover: hover) {
  .link-list a:hover :is(.link-list-title, .link-list-desc, svg) { color: var(--accent-text); }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .link-list a:hover svg { transform: translateX(3px); }
}

/* Appuyé : texte bleu et titre souligné de 2 px, sans fond.
   La ligne entière ne se souligne jamais (annule le trait des liens simples). */
.link-list a:hover,
.link-list a:active { color: var(--text); text-decoration: none; }
.link-list a:active :is(.link-list-title, .link-list-desc, svg) { color: var(--accent-text); }
.link-list a:active .link-list-title { text-decoration-line: underline; }

.link-list a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}


/* DS-CG · Liste déroulante v1.0
   <select> natif dans .select, avec le même habillage que .input (voir champ-texte.css). */

.select { position: relative; }

.select > select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  cursor: pointer;
  text-overflow: ellipsis;
}
.select > select.input:disabled { cursor: not-allowed; }

/* Chevron : masque dessiné, il prend la couleur du texte secondaire */
.select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 16px;
  height: 16px;
  translate: 0 -50%;
  background: var(--text-muted);
  pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 100% no-repeat;
  transition: background-color var(--dur-fast) ease, rotate var(--dur-open) var(--ease);
}
/* Liste ouverte : le chevron se retourne (navigateurs qui gèrent :open) */
.select:has(select:open)::after { rotate: 180deg; }
.select:has(select:disabled)::after { background: var(--text-faint); }

/* La liste ouverte est dessinée par le navigateur : on lui donne les bonnes couleurs */
.select > select.input option {
  background: var(--surface);
  color: var(--text);
}


/* DS-CG · Menu déroulant v1.0
   Liste d'actions ouverte par un bouton (modèle WAI-ARIA « Menu Button »).
   Le script menu-deroulant.js ouvre, ferme et gère le clavier : il est indispensable. */

.menu-wrap {
  position: relative;
  display: inline-flex;
}

.menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  width: max-content;
  min-width: 200px;
  max-width: min(320px, calc(100vw - var(--space-4) * 2));
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-1);
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity var(--dur-open) var(--ease),
    transform var(--dur-open) var(--ease),
    display var(--dur-open) allow-discrete;
}
.menu:focus { outline: none; }
.menu[data-open] {
  display: flex;
  opacity: 1;
  transform: none;
}
@starting-style {
  .menu[data-open] {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* Près du bord droit : le script aligne le menu sur la fin du bouton */
.menu-wrap[data-align="end"] > .menu {
  left: auto;
  right: 0;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--ctl-h);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font: 400 15px/20px var(--font-sans);
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.menu__item svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--text-muted);
}

/* Survol et focus : une teinte du texte, visible sur la surface claire comme sur la surface sombre.
   Le script donne le focus à l'élément survolé : un seul élément est marqué à la fois. */
.menu__item:focus {
  outline: none;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
/* Au clavier, un contour accent en plus : la teinte seule ne suffit pas à repérer le focus */
.menu__item:focus-visible {
  outline: 2px solid var(--accent);
  /* Sur le bord de l'action, donc sur la surface du menu (3,4:1 en sombre) ;
     à l'intérieur, sur la teinte, il tomberait à 2,8:1 */
  outline-offset: 0;
}

/* Appuyé : teinte un cran plus forte */
.menu__item:active { background: color-mix(in srgb, var(--text) 12%, transparent); }

.menu__item--danger,
.menu__item--danger svg { color: var(--danger); }

/* Indisponible : reste lisible au clavier, ne réagit plus */
.menu__item:disabled,
.menu__item[aria-disabled="true"],
.menu__item[aria-disabled="true"] svg { color: var(--text-faint); cursor: not-allowed; }
.menu__item[aria-disabled="true"]:active,
.menu__item:disabled:active { background: color-mix(in srgb, var(--text) 6%, transparent); }

.menu__sep {
  height: 1px;
  margin: var(--space-1) calc(var(--space-1) * -1);
  border: 0;
  background: var(--border);
}

@media (prefers-reduced-motion: reduce) {
  .menu,
  .menu[data-open] { transform: none; }
}

/* Chevron du bouton : il se retourne quand le menu est ouvert */
.menu-wrap > [aria-haspopup="menu"] svg:last-child {
  transition: rotate var(--dur-open) var(--ease);
}
.menu-wrap > [aria-haspopup="menu"][aria-expanded="true"] svg:last-child { rotate: 180deg; }


/* DS-CG · Notification v1.0
   Courte confirmation après une action (« Bien enregistré »), qui disparaît seule.
   Le script notification.js crée la pile et la zone d'annonce, affiche, minute et ferme. */

.toast-stack {
  position: fixed;
  z-index: 60;
  left: var(--space-4);
  right: var(--space-4);
  bottom: max(var(--space-4), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}
.toast-stack:empty { display: none; }

@media (min-width: 768px) {
  .toast-stack {
    left: auto;
    right: var(--space-5);
    bottom: max(var(--space-5), env(safe-area-inset-bottom));
    align-items: flex-end;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  max-width: 400px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  background: var(--inverse-bg);
  color: var(--inverse-text);
  box-shadow: var(--shadow-1);
  font: 400 15px/20px var(--font-sans);
  pointer-events: auto;
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-open) var(--ease),
    transform var(--dur-open) var(--ease);
}
@starting-style {
  .toast {
    opacity: 0;
    transform: translateY(8px);
  }
}
.toast[data-leaving] {
  opacity: 0;
  transform: translateY(8px);
}

.toast__icon {
  flex: none;
  width: 20px;
  height: 20px;
}

.toast__text {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow-wrap: break-word;
}

/* Action et fermeture : cibles de 44 px qui débordent sur la marge intérieure,
   pour que la notification garde 44 px de haut */
.toast__action,
.toast__close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-block: calc(var(--space-3) * -1);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.toast__action {
  padding: 0 var(--space-2);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.toast__close {
  width: 44px;
  margin-inline: calc(var(--space-2) * -1) calc(var(--space-3) * -1);
}
.toast__close svg {
  width: 20px;
  height: 20px;
}
@media (hover: hover) {
  .toast__action:hover,
  .toast__close:hover { background: color-mix(in srgb, var(--inverse-text) 12%, transparent); }
}
.toast__action:active,
.toast__close:active { background: color-mix(in srgb, var(--inverse-text) 20%, transparent); }
.toast__action:focus-visible,
.toast__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast[data-leaving] { transform: none; }
  @starting-style {
    .toast { transform: none; }
  }
}


/* DS-CG · Onglets v1.0 */

/* Onglets soulignés : navigation d'une page ou d'une fiche */
.tabs {
  display: flex;
  gap: var(--space-5);
  overflow-x: auto;
  box-shadow: inset 0 -1px 0 var(--border);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: var(--ctl-h);
  padding: 0 var(--space-1);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font: 500 15px/1.2 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease;
}
@media (hover: hover) {
  .tab:hover { color: var(--text); border-bottom-color: var(--border-strong); }
}
/* Appuyé : le trait annonce déjà l'onglet choisi */
.tab:active { color: var(--text); border-bottom-color: var(--text-muted); }
.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab:disabled,
.tab[aria-disabled="true"] {
  color: var(--text-faint);
  border-bottom-color: transparent;
  cursor: not-allowed;
  pointer-events: none;
}
/* Contour à l'intérieur : la liste défile et rognerait un halo extérieur */
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--r-xs);
}

/* Contrôle segmenté : choisir entre quelques vues d'un même contenu */
.seg {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
}
.seg button {
  min-height: var(--ctl-h);
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-muted);
  font: 500 14px/1.2 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    color var(--dur-fast) ease;
}
@media (hover: hover) {
  .seg button:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
}
.seg button:active { color: var(--text); background: color-mix(in srgb, var(--text) 12%, transparent); }
.seg button:disabled,
.seg button[aria-disabled="true"] {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}
.seg button[aria-selected="true"],
.seg button[aria-pressed="true"] {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--border-control);
}
.seg button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.seg button[aria-selected="true"]:focus-visible,
.seg button[aria-pressed="true"]:focus-visible {
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--border-control), 0 0 0 3px var(--focus-ring);
}

/* Contenu associé à un onglet */
.tab-panel { padding-top: var(--space-5); }
.tab-panel[hidden] { display: none; }
.tab-panel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-md);
  box-shadow: 0 0 0 3px var(--focus-ring);
}


/* DS-CG · Pagination v1.0
   Passer d'une page de résultats à l'autre. Sans script.
   Sous 480 px de large (la sienne, pas celle de l'écran), les numéros laissent
   place à « Page 3 sur 12 » entre Précédent et Suivant. */

.pagination {
  container-type: inline-size;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font: 500 15px/20px var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.pagination__pages {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pagination__page,
.pagination__prev,
.pagination__next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--r-full);
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.pagination__page {
  min-width: 44px;
  padding: 0 var(--space-2);
}

.pagination__prev,
.pagination__next {
  gap: var(--space-1);
  padding: 0 var(--space-3);
}
.pagination__prev { padding-left: var(--space-2); }
.pagination__next { padding-right: var(--space-2); }
.pagination__prev svg,
.pagination__next svg {
  width: 20px;
  height: 20px;
  flex: none;
}

@media (hover: hover) {
  a.pagination__page:not([aria-current]):hover,
  a.pagination__prev[href]:hover,
  a.pagination__next[href]:hover { background: var(--bg-subtle); }
}
.pagination a:hover { text-decoration: none; }
/* Appuyé : un cran plus foncé que le survol */
a.pagination__page:not([aria-current]):active,
a.pagination__prev[href]:active,
a.pagination__next[href]:active { background: var(--border); }

.pagination__page[aria-current="page"] {
  background: var(--accent);
  color: var(--on-accent);
}

.pagination__page:focus-visible,
.pagination__prev:focus-visible,
.pagination__next:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Première ou dernière page : le lien reste en place, grisé et inactif */
.pagination__prev[aria-disabled="true"],
.pagination__next[aria-disabled="true"] {
  color: var(--text-faint);
  cursor: not-allowed;
}
/* Page en cours : ni survol ni appui */
.pagination__page[aria-current="page"] { cursor: default; }

.pagination__gap {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  color: var(--text-muted);
}

.pagination__status {
  display: none;
  margin: 0;
  color: var(--text);
  white-space: nowrap;
}

/* Étroit : « Page 3 sur 12 » au centre, Précédent et Suivant aux deux bords */
@container (max-width: 479px) {
  .pagination__pages { display: none; }
  .pagination__status {
    display: block;
    margin-inline: auto;
  }
}


/* DS-CG · Pied de page v1.0
   Deux versions : .footer (site vitrine, colonnes de liens) et .footer--compact (application). */

.footer {
  container-type: inline-size;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 22px;
}

.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-8) var(--gutter) var(--space-5);
}

.footer__top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

.footer__brand { max-width: 28ch; }
.footer__brand p { margin-top: var(--space-2); }

.footer .logo { min-height: var(--ctl-h); }

.footer__title {
  margin: 0 0 var(--space-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}

.footer__list { margin: 0; padding: 0; list-style: none; }

.footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ctl-h);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--dur-fast) ease;
}
@media (hover: hover) {
  .footer a:hover { color: var(--text); text-decoration: underline; }
}
/* Appuyé : trait de 2 px, comme le lien */
.footer a:active {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 5px var(--focus-ring);
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
/* Pied de page réduit à sa dernière ligne : pas de séparateur au-dessus */
.footer__bottom:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__social { display: flex; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.footer__social a {
  justify-content: center;
  width: var(--ctl-h);
  border-radius: var(--r-md);
}
.footer__social svg { width: 24px; height: 24px; }
.footer__social a { transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease; }
@media (hover: hover) {
  .footer__social a:hover { background: var(--border); }
}
.footer__social a:active { background: var(--border-strong); text-decoration: none; }

/* Version compacte (application) : une seule ligne */
.footer--compact .footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
  padding-block: var(--space-2);
}
.footer--compact .footer__legal { gap: 0 var(--space-3); }

/* Le seuil dépend de la largeur du pied de page lui-même */
@container (max-width: 767px) {
  .footer__top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__brand { grid-column: 1 / -1; max-width: none; }
}
@container (max-width: 479px) {
  .footer__top { grid-template-columns: minmax(0, 1fr); }
}

/* Aperçu dans la documentation */
.footer-scene {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
}
.footer-scene .footer { border-top-width: 0; }
.footer-scene--flush {
  width: calc(100% + var(--space-6) * 2);
  margin: -40px calc(var(--space-6) * -1);
  border: 0;
  border-radius: 0;
}
@media (max-width: 767px) {
  .footer-scene--flush { width: calc(100% + 40px); margin: -28px -20px; }
}


/* DS-CG · Recherche v1.0
   Palette de recherche inspirée de Spotlight : une barre en pilule, des filtres ronds
   à sa droite, les résultats juste dessous. Ouverte par un bouton d'icône, Ctrl K / ⌘ K ou « / ».
   Basée sur <dialog> ouvert avec showModal() : focus piégé, Échap et inertie gérés par le navigateur. */

.search {
  --search-glass: color-mix(in srgb, var(--surface-raised) 82%, transparent);
  --search-edge: color-mix(in srgb, var(--border-strong) 55%, transparent);
  --search-h: 56px;
  width: 100%;
  max-width: 760px;
  color: var(--text);
}

/* Fenêtre réellement ouverte : la barre au centre de l'écran, comme Spotlight ;
   les résultats descendent dessous sans la faire bouger */
dialog.search {
  position: fixed;
  inset: calc(50dvh - var(--search-h) / 2) 0 auto;
  width: calc(100% - var(--gutter) * 2);
  max-height: calc(50dvh + var(--search-h) / 2 - var(--space-5));
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
dialog.search::backdrop {
  background: color-mix(in srgb, var(--overlay) 45%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
body:has(dialog.search[open]) { overflow: hidden; }

/* Ouverture : fondu + léger zoom */
dialog.search {
  opacity: 0;
  transform: scale(.98);
  transition:
    opacity var(--dur-open) var(--ease),
    transform var(--dur-open) var(--ease),
    overlay var(--dur-open) allow-discrete,
    display var(--dur-open) allow-discrete;
}
dialog.search[open] { opacity: 1; transform: none; }
@starting-style {
  dialog.search[open] { opacity: 0; transform: scale(.98); }
}
dialog.search::backdrop {
  opacity: 0;
  transition:
    opacity var(--dur-open) var(--ease),
    overlay var(--dur-open) allow-discrete,
    display var(--dur-open) allow-discrete;
}
dialog.search[open]::backdrop { opacity: 1; }
@starting-style {
  dialog.search[open]::backdrop { opacity: 0; }
}

/* Verre dépoli commun à la barre, aux filtres et aux résultats */
.search__field,
.search__filter,
.search__panel {
  background: var(--search-glass);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--search-edge);
  box-shadow: var(--shadow-2);
}

/* Ligne du haut : barre + filtres */
.search__bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.search__field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--search-h);
  padding: 0 var(--space-5) 0 20px;
  border-radius: var(--r-full);
}
.search__field > svg {
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}
.search__field:focus-within {
  outline: 2px solid transparent; /* invisible à l'écran, dessiné en contraste élevé (le halo y est effacé) */
  border-color: var(--accent);
  box-shadow: var(--shadow-2), 0 0 0 3px var(--focus-ring);
}
.search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 20px;
  letter-spacing: -.01em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search__input::placeholder { color: var(--text-muted); opacity: 1; }
.search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Filtres ronds : une rubrique à la fois */
.search__filters {
  flex: none;
  display: flex;
  gap: var(--space-3);
}
/* Dès qu'un mot est tapé, la barre prend toute la largeur : seuls restent
   le filtre actif (pour pouvoir l'annuler) ou rien du tout */
.search:has(.search__input:not(:placeholder-shown)) .search__filter:not([aria-pressed="true"]),
.search:has(.search__input:not(:placeholder-shown)) .search__filters:not(:has([aria-pressed="true"])) {
  display: none;
}
.search__filter {
  display: inline-grid;
  place-items: center;
  width: var(--search-h);
  height: var(--search-h);
  padding: 0;
  border-radius: var(--r-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.search__filter svg { width: 22px; height: 22px; }
@media (hover: hover) {
  .search__filter:hover { color: var(--text); background: var(--surface-raised); }
}
.search__filter:active { color: var(--text); background: var(--border); }
.search__filter[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
@media (hover: hover) {
  .search__filter[aria-pressed="true"]:hover { background: var(--accent-hover); color: var(--on-accent); }
}
.search__filter[aria-pressed="true"]:active { background: var(--accent-active); color: var(--on-accent); }
.search__filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--shadow-2), 0 0 0 5px var(--focus-ring);
}

/* Panneau des résultats */
.search__panel {
  margin-top: var(--space-3);
  border-radius: var(--r-lg);
  overflow: hidden;
  /* Fond plein : pas de page floutée en transparence derrière la liste */
  background: var(--surface-raised);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.search__panel[hidden] { display: none; }

.search__results {
  max-height: min(440px, calc(50dvh - var(--search-h) / 2 - 96px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-2);
  list-style: none;
  margin: 0;
}
.search__group {
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

.search__option a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--r-md);
  color: var(--text);
  text-decoration: none;
}
.search__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
}
.search__icon svg { width: 18px; height: 18px; }
.search__text { flex: 1; min-width: 0; }
.search__title {
  display: block;
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
}
.search__meta {
  display: block;
  overflow: hidden;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.search__go {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--accent-text);
  opacity: 0;
}
.search mark {
  background: none;
  color: var(--text);
  font-weight: 600;
}

/* Résultat actif (flèches ou survol) */
@media (hover: hover) {
  .search__option a:hover { background: var(--bg-subtle); text-decoration: none; }
}
.search__option a:active { background: var(--border); }
.search__option[aria-selected="true"] a { background: var(--accent-soft); }
.search__option[aria-selected="true"] a:active { box-shadow: inset 0 0 0 1px var(--accent); }
.search__option[aria-selected="true"] .search__title,
.search__option[aria-selected="true"] .search__title mark { color: var(--accent-text); }
/* le gris secondaire tombe à 4,4:1 sur le bleu doux : on passe au texte principal */
.search__option[aria-selected="true"] .search__meta { color: var(--text); }
.search__option[aria-selected="true"] .search__icon { background: var(--surface-raised); color: var(--accent-text); }
.search__option[aria-selected="true"] .search__go { opacity: 1; }

/* Message quand rien ne correspond */
.search__empty {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  color: var(--text-muted);
}
.search__empty strong { color: var(--text); font-weight: 500; }

/* Aide clavier en pied de panneau (inutile au doigt) */
.search__hints {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--search-edge);
  font-size: 12px;
  line-height: 20px;
  color: var(--text-muted);
}
.search__hints kbd {
  display: inline-block;
  min-width: 20px;
  margin-right: var(--space-1);
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--surface-raised);
  font-family: var(--font-sans);
  font-size: 12px;
  text-align: center;
}
@media (hover: none) { .search__hints { display: none; } }

/* Petits écrans : la barre en haut (le clavier couvre le bas), les filtres en dessous */
@media (max-width: 767px) {
  dialog.search { inset-block-start: var(--space-3); max-height: calc(100dvh - var(--space-5)); }
  .search { --search-h: 48px; }
  .search__bar { flex-wrap: wrap; }
  .search__field { flex-basis: 100%; }
  .search__input { font-size: 17px; }
  .search__filters { flex: 1; justify-content: center; }
  .search__results { max-height: calc(100dvh - 180px); }
}

/* Aperçu dans la documentation (ni modal, ni interactif) */
.search-scene {
  width: 100%;
  padding: var(--space-7) var(--space-5);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 90% at 85% 100%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 60%),
    radial-gradient(80% 70% at 10% 0%, color-mix(in srgb, var(--chart-2) 45%, transparent), transparent 70%),
    var(--bg-subtle);
}
.search-scene .search { margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  dialog.search, dialog.search[open] { transform: none; }
  @starting-style {
    dialog.search[open] { transform: none; }
  }
}


/* DS-CG · Résumé des erreurs v1.3
   En haut d'un formulaire refusé : une phrase-titre, puis un lien par erreur,
   dans l'ordre des champs. Il reçoit le focus à l'affichage (tabindex="-1"). */

.error-summary {
  padding: 20px var(--space-5);
  border: 1px solid var(--danger-border);
  border-left: 3px solid var(--danger);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
}
.error-summary[hidden] { display: none; }
.error-summary:focus { outline: none; }
.error-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.error-summary__title {
  margin: 0;
  font: 600 20px/28px var(--font-sans);
  letter-spacing: -.01em;
}
.error-summary__text { margin: var(--space-2) 0 0; }

.error-summary__list {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}
.error-summary__list a {
  color: var(--danger);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* DS-CG · Tableau v1.0 */

/* Cadre : bordure, coins arrondis, défilement horizontal sur mobile */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow-x: auto;
  position: relative; /* garde les textes masqués (.sr-only) dans le cadre défilant */
}
.table-wrap:focus-visible {
  outline: 2px solid transparent; /* invisible à l'écran, dessiné en contraste élevé (le halo y est effacé) */
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
}

/* Légende visible (pour la rendre invisible : classe .sr-only) */
.table caption {
  padding: var(--space-4);
  text-align: left;
  font-weight: 500;
  color: var(--text);
}
.table caption small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
}

/* En-têtes de colonne */
.table th {
  padding: var(--cell);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: .02em;
  text-align: left;
  white-space: nowrap;
}
.table thead th { border-top: 1px solid var(--border); }

/* Cellules */
.table td {
  padding: var(--cell);
  border-top: 1px solid var(--border);
  white-space: nowrap;
}

/* En-tête de ligne : première cellule, lue comme titre de la ligne */
.table tbody th {
  background: none;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  line-height: 22px;
  font-weight: 500;
  letter-spacing: 0;
}

/* Chiffres : à droite, chiffres de même largeur */
.table .num { text-align: right; }

/* Survol et ligne mise en avant */
@media (hover: hover) {
  .table tbody tr:hover > * { background: var(--bg-subtle); }
}
.table tbody tr.is-selected > * { background: var(--accent-soft); }

/* Tri : l'état est porté par aria-sort sur l'en-tête */
.table th[aria-sort] { padding: 0; }
.table-sort {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
  min-height: var(--ctl-h);
  padding: var(--cell);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.table-sort svg { width: 16px; height: 16px; flex: none; }
.table .num .table-sort { justify-content: flex-end; }
.table th[aria-sort="ascending"],
.table th[aria-sort="descending"] { color: var(--text); }
.table th[aria-sort="descending"] .table-sort svg { transform: rotate(180deg); }
@media (hover: hover) {
  .table-sort:hover { color: var(--text); background: var(--border); }
}
.table-sort:active { color: var(--text); background: var(--border-strong); }
.table-sort:focus-visible {
  outline: 2px solid transparent; /* invisible à l'écran, dessiné en contraste élevé (le halo y est effacé) */
  box-shadow: inset 0 0 0 1px var(--accent), inset 0 0 0 4px var(--focus-ring);
}

/* Actions de ligne : boutons icône alignés à droite */
.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
}

@media (prefers-reduced-motion: reduce) {
  .table-sort { transition-duration: 0ms !important; }
}
