/* Feuille de l'application (docs/design-app.md ; sa direction, « sobre et pro », est dans .builder/design.md) : les
   jetons, la base, la coquille (la colonne gris pâle sur un ordinateur, la barre et le menu plein écran sur un
   téléphone), les composants de src/web/ui/, leurs graphiques, et les motifs que partagent plusieurs pages en attendant
   qu'elles soient refaites. Chaque page charge ensuite sa propre feuille, src/web/static/app/<page>.css (layout/
   page-sheets.ts), et Inter avant elle (fonts/inter.css). Aucune couleur, police, taille de texte, graisse,
   interlignage, espacement ni arrondi n'est écrit hors des jetons de :root.
   Le site vitrine la charge avant site.css, qui reprend ses jetons (docs/site-vitrine.md), et l'administration avant
   admin.css : les règles d'élément propres à l'application passent par :where(.app-body, .public-body), sans poids, et
   la classe d'un composant l'emporte toujours. Rien ne bouge que ce que fait l'utilisateur, et seulement si le système
   l'autorise. */

/* Les jetons (.builder/design.md, « Les jetons » ; les écarts aux valeurs de départ sont dans docs/design-app.md). */

:root {
  color-scheme: light;
  /* L'encre : le texte, le texte secondaire, et le gris discret des traits (bord des champs, icônes au repos). */
  --color-text: #0e1220;
  --color-muted: #5b6272;
  --color-faint: #868d9c;
  /* Les fonds : la page, les surfaces en retrait, le survol, ce qui flotte. */
  --color-bg: #ffffff;
  --color-surface: #f6f7f9;
  --color-hover: #eef0f3;
  --color-raised: #ffffff;
  /* Les bordures : les filets, et les contours plus marqués (boutons secondaires, schémas). */
  --color-border: #e4e7ec;
  --color-border-strong: #d0d5dd;
  /* L'accent : l'action principale, les liens, l'élément actif, le point fort d'un graphique ; nulle part ailleurs. */
  --color-accent: #4b3fd8;
  --color-accent-hover: #3f33c2;
  --color-accent-surface: #eeecfd;
  --color-on-accent: #ffffff;
  --color-link: #4b3fd8;
  --color-focus: #4b3fd8;
  /* Les états, sourds : réussi, à valider, en erreur. */
  --color-success: #15803d;
  --color-success-surface: #ecf8f0;
  --color-warning: #b45309;
  --color-warning-surface: #fdf6e7;
  --color-danger: #b42318;
  --color-danger-hover: #912018;
  --color-danger-surface: #fdf0ef;
  --color-on-danger: #ffffff;
  /* L'ombre de ce qui flotte (menus, fenêtres), et le voile sous une fenêtre. */
  --color-shadow: rgb(14 18 32 / 0.12);
  --color-backdrop: rgb(14 18 32 / 0.32);
  --shadow-float: 0 0.75rem 2rem -0.5rem var(--color-shadow), 0 0.125rem 0.375rem var(--color-shadow);
  /* Le texte : Inter, avec la police du système derrière elle. */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.875rem;
  --leading-body: 1.45;
  --leading-title: 1.2;
  --tracking-title: -0.011em;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  /* Les espacements : des multiples de 4 px. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  /* Les arrondis : les pastilles, les champs et boutons, les cartes et panneaux, les points. */
  --radius-small: 0.25rem;
  --radius: 0.375rem;
  --radius-panel: 0.5rem;
  --radius-round: 50%;
  /* Les hauteurs : un bouton ou un champ, un bouton dans un tableau, une ligne de tableau, une cible au doigt. */
  --control-height: 2rem;
  --control-compact: 2rem;
  --row-height: 2.5rem;
  --touch-target: 2.75rem;
  --icon-size: 1rem;
  --icon-stroke: 1.75;
  /* La mise en page. */
  --nav-width: 14.5rem;
  --content-width: 75rem;
  --bar-height: 3.5rem;
  --measure: 70ch;
}

/* Un téléphone : des champs et des boutons de 36 px ; au doigt, de 44 px. */
@media (max-width: 40rem) {
  :root {
    --control-height: 2.25rem;
  }
}

@media (pointer: coarse) {
  :root {
    --control-height: var(--touch-target);
    --control-compact: var(--touch-target);
  }
}

/* La base, commune à toutes les pages */

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

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-kerning: normal;
  line-height: var(--leading-body);
  overflow-wrap: break-word;
}

main {
  flex: 1;
  padding-block: var(--space-12);
}

h1 {
  margin: 0 0 var(--space-4);
  font-size: var(--text-2xl);
  line-height: var(--leading-title);
}

h2,
h3 {
  line-height: var(--leading-title);
}

p {
  margin: 0 0 var(--space-4);
}

/* Une page en plusieurs parties : de l'air entre elles. */
main section + section {
  margin-top: var(--space-8);
}

/* Les mentions légales : l'intitulé en gras, sa valeur dessous. */
dt {
  font-weight: var(--weight-semibold);
}

dd {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--color-link);
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.container {
  width: min(100% - var(--space-8), 64rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  z-index: 20;
  top: calc(-1 * var(--space-16));
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Le texte de l'application et de ses pages sans compte : 14 px, des titres en 600, jamais plus gras. */

.app-body,
.public-body {
  font-size: var(--text-base);
}

:where(.app-body, .public-body) :where(h1, h2, h3) {
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
  text-wrap: balance;
}

:where(.app-body, .public-body) h1 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xl);
}

:where(.app-body, .public-body) h2 {
  margin: var(--space-8) 0 var(--space-3);
  font-size: var(--text-md);
}

:where(.app-body, .public-body) h3 {
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--text-base);
}

:where(.app-body, .public-body) :where(p, li) {
  max-width: var(--measure);
}

:where(.app-body, .public-body) :where(strong, b, th) {
  font-weight: var(--weight-semibold);
}

:where(.app-body, .public-body) .lead {
  color: var(--color-muted);
}

/* Un volet qui s'ouvre : son titre en encre, son triangle dit qu'il s'ouvre ; l'indigo reste aux liens et aux actions. */
:where(.app-body, .public-body) details > summary {
  font-weight: var(--weight-medium);
  cursor: pointer;
}

/* Les classes de texte des écrans d'avant, que reprennent encore plusieurs pages. */

.muted {
  color: var(--color-muted);
}

.break-anywhere {
  overflow-wrap: anywhere;
}

.page-intro {
  max-width: 48rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

/* Un prix : le nombre net. */
.price {
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
  line-height: var(--leading-title);
}

/* Les icônes Lucide (src/web/ui/icon.tsx) : un trait fin de la couleur du texte qu'elles accompagnent. */

.ui-icon {
  flex: none;
  width: var(--icon-size);
  height: var(--icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Le logo : les trois points qui tombent vers la ligne, et le nom en Inter semi-gras, d'une seule couleur. */

.brand {
  display: inline-flex;
  align-items: center;
  margin-inline-end: auto;
  color: var(--color-text);
}

.logo {
  display: block;
  width: auto;
  height: 1.5rem;
}

.logo text {
  font-family: var(--font-sans);
  font-weight: var(--weight-semibold);
}

.logo-dots {
  fill: currentColor;
}

.logo-line {
  stroke: currentColor;
}

/* La coquille de l'espace connecté. Sur un téléphone : la barre blanche du haut, son bouton « Menu », et le menu qui
   s'ouvre en plein écran par-dessus la page (attribut popover, sans script). */

.shell {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.shell-bar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: var(--bar-height);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.menu-open,
.menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.menu-open:hover,
.menu-close:hover {
  background: var(--color-hover);
}

/* La tête du menu ouvert : le logo et la croix, là où étaient le logo et « Menu » dans la barre. */
.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--bar-height);
}

.menu-close {
  padding: 0;
  border-color: transparent;
}

@media (max-width: 63.9375rem) {
  /* La barre reste en haut : une ancre, ou un champ atteint au clavier, s'arrête sous elle, jamais dessous. */
  html:has(.shell-bar) {
    scroll-padding-top: calc(var(--bar-height) + var(--space-3));
  }

  .shell-menu:popover-open {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    width: auto;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0 var(--space-4) var(--space-6);
    overflow-y: auto;
    border: 0;
    background: var(--color-bg);
    color: var(--color-text);
  }

  .shell-menu .nav-link,
  .shell-menu .nav-page {
    min-height: var(--touch-target);
    font-size: var(--text-md);
  }
}

@media (max-width: 63.9375rem) and (prefers-reduced-motion: no-preference) {
  .shell-menu:popover-open > * {
    animation: menu-in 160ms ease-out;
  }

  /* Le contenu du menu glisse sur son fond, déjà là : à tout instant, il couvre la page et son texte se lit. */
  @keyframes menu-in {
    from {
      transform: translateY(calc(-1 * var(--space-3)));
    }
  }
}

.shell-nav ul,
.shell-account ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-sections,
.shell-account ul {
  display: grid;
  gap: var(--space-1);
}

/* Un lien de la colonne : son icône, son libellé ; la page en cours sur le fond indigo pâle. */
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--color-text);
  font: inherit;
  font-weight: var(--weight-medium);
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.nav-link .ui-icon {
  color: var(--color-muted);
}

.nav-link:hover,
.nav-page:hover {
  background: var(--color-hover);
}

.nav-link[aria-current="page"],
.nav-page[aria-current="page"] {
  background: var(--color-accent-surface);
  color: var(--color-accent);
}

.nav-link:where([aria-current]) .ui-icon {
  color: currentColor;
}

.nav-count {
  margin-inline-start: auto;
  padding: 0 var(--space-2);
  border-radius: var(--radius-small);
  background: var(--color-warning-surface);
  color: var(--color-warning);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Les pages d'une section, sous elle, sur un filet qui part de son icône ; alignées sur son libellé. */
.shell-nav .nav-pages {
  display: grid;
  gap: var(--space-1);
  margin: var(--space-1) 0 var(--space-2) var(--space-4);
  padding-inline-start: var(--space-1);
  border-left: 1px solid var(--color-border-strong);
}

.nav-page {
  display: flex;
  align-items: center;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  color: var(--color-muted);
  text-decoration: none;
}

.shell-account {
  display: grid;
  gap: var(--space-1);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.shell-account form {
  margin: 0;
}

.account-email {
  margin: 0 0 var(--space-1);
  padding-inline: var(--space-2);
  color: var(--color-muted);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

.shell-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.shell-content {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding: var(--space-6) var(--space-4) var(--space-12);
}

.shell-footer,
.page-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
}

/* Le pied d'une page sans compte : ses liens sur la largeur de la page, au même bord qu'elle. */
.page-footer {
  padding-inline: 0;
}

.shell-footer ul,
.page-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.shell-footer a,
.page-footer a {
  color: var(--color-muted);
}

/* Sur un ordinateur, la colonne gris pâle de 232 px à gauche, collée en hauteur ; le menu y est toujours ouvert. */
@media (min-width: 64rem) {
  .shell {
    display: grid;
    grid-template-columns: var(--nav-width) minmax(0, 1fr);
  }

  .shell-bar {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-5);
    height: 100vh;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
    border-right: 1px solid var(--color-border);
    border-bottom: 0;
    background: var(--color-surface);
  }

  .shell-bar .brand {
    margin: 0;
    padding: var(--space-1) var(--space-2);
  }

  .menu-open,
  .menu-head {
    display: none;
  }

  .shell-menu {
    position: static;
    inset: auto;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-6);
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: none;
    color: inherit;
  }

  .shell-content {
    padding: var(--space-8) var(--space-10) var(--space-16);
  }

  .shell-footer {
    padding-inline: var(--space-10);
  }
}

/* Les pages sans compte (connexion, inscription, page introuvable) : la barre blanche, une colonne étroite, le pied. */

.topbar {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  width: min(100% - var(--space-8), var(--content-width));
  min-height: var(--bar-height);
  margin-inline: auto;
  padding-block: var(--space-2);
}

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

.topbar-nav a,
.topbar .lang-switch {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  color: var(--color-text);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.topbar .lang-switch {
  color: var(--color-muted);
}

.topbar-nav a:hover,
.topbar .lang-switch:hover {
  background: var(--color-hover);
}

/* « Créer un compte » : bordé, pour que l'action de la page reste la seule en indigo. */
.topbar .topbar-cta {
  border: 1px solid var(--color-border-strong);
}

/* Sur un téléphone, la connexion et l'inscription passent sous le logo, à droite comme la langue. */
@media (max-width: 40rem) {
  .topbar-nav {
    flex-basis: 100%;
    order: 3;
  }

  .topbar-nav ul {
    justify-content: flex-end;
  }
}

.page {
  width: min(100% - var(--space-8), var(--content-width));
  margin-inline: auto;
}

/* Une page sans compte est un formulaire court : une colonne étroite, au milieu. */
.page > .page-intro {
  max-width: 26rem;
  margin-inline: auto;
}

.page-footer nav {
  width: min(100% - var(--space-8), var(--content-width));
  margin-inline: auto;
}

/* L'en-tête d'une page : le titre et sa phrase à gauche, l'action principale à droite. */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4) var(--space-6);
  margin-bottom: var(--space-8);
}

.page-header h1 {
  margin: 0;
}

.page-header-intro {
  margin: var(--space-1) 0 0;
  color: var(--color-muted);
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* Les boutons : principal (indigo, un par page), secondaire (contour), discret (sans fond), destructeur (rouge). */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font: inherit;
  font-weight: var(--weight-medium);
  line-height: var(--leading-title);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--color-accent-hover);
}

.button-secondary {
  border-color: var(--color-border-strong);
  background: var(--color-bg);
  color: var(--color-text);
}

.button-secondary:hover {
  background: var(--color-hover);
}

.button-quiet {
  padding: 0 var(--space-2);
  background: transparent;
  color: var(--color-text);
}

.button-quiet:hover {
  background: var(--color-hover);
}

.button-danger {
  background: var(--color-danger);
  color: var(--color-on-danger);
}

.button-danger:hover {
  background: var(--color-danger-hover);
}

.button-compact {
  min-height: var(--control-compact);
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
}

.button:disabled {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  cursor: not-allowed;
}

.link-button {
  display: inline-block;
  padding: var(--space-1) 0;
  border: 0;
  background: none;
  color: var(--color-text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

/* Les champs : l'intitulé au-dessus, le champ sur toute la largeur, l'erreur puis l'aide en dessous. Le bord d'un
   champ se voit (3:1 sur le blanc) ; le champ atteint prend l'anneau indigo. */

.field {
  margin-bottom: var(--space-4);
}

.field label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: var(--weight-medium);
}

:where(.field, .app-body, .public-body)
  :where(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea) {
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-faint);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  line-height: var(--leading-body);
}

:where(.field, .app-body, .public-body) :where(input, select, textarea):focus-visible {
  border-color: var(--color-focus);
  outline-offset: 0;
}

:where(.field, .app-body, .public-body) textarea {
  min-height: 6rem;
  padding-block: var(--space-2);
  resize: vertical;
}

:where(.field, .app-body, .public-body) ::placeholder {
  color: var(--color-muted);
}

:where(.field, .app-body, .public-body) [aria-invalid="true"] {
  border-color: var(--color-danger);
  box-shadow: inset 0 0 0 1px var(--color-danger);
}

.field p {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
}

.field-hint {
  color: var(--color-muted);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  color: var(--color-danger);
  font-weight: var(--weight-medium);
}

/* Le pictogramme de l'erreur, centré sur sa première ligne. */
.field-error .ui-icon {
  height: 1lh;
}

:where(.app-body, .public-body) fieldset {
  min-width: 0;
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4) var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
}

:where(.app-body, .public-body) legend {
  padding-inline: var(--space-1);
  font-weight: var(--weight-medium);
}

:where(.app-body, .public-body) :where(input[type="checkbox"], input[type="radio"]) {
  flex: none;
  width: var(--icon-size);
  height: var(--icon-size);
  margin: calc((1lh - var(--icon-size)) / 2) 0 0;
  accent-color: var(--color-accent);
}

/* Une case et son libellé : le libellé qui passe à la ligne reste aligné sur lui-même, pas sous la case. */
:where(.app-body, .public-body) label:has(> input[type="checkbox"], > input[type="radio"]) {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
}

/* Les bandeaux : un message de la page, sur le gris pâle ; une erreur, sur le rouge pâle, avec son filet. */

.banner {
  margin: 0 0 var(--space-6);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.banner[role="alert"] {
  border-color: var(--color-danger-surface);
  border-left-color: var(--color-danger);
  background: var(--color-danger-surface);
}

/* Les badges d'état : l'état en mots, une forme, un ton. « En cours » est en encre : seul ce qui attend ou échoue a
   une couleur. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  border-radius: var(--radius-small);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-body);
  white-space: nowrap;
}

.badge-mark {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.badge-mark .mark-fill {
  fill: currentColor;
  stroke: none;
}

.badge-active {
  background: var(--color-hover);
  color: var(--color-text);
}

.badge-waiting {
  background: var(--color-warning-surface);
  color: var(--color-warning);
}

.badge-success {
  background: var(--color-success-surface);
  color: var(--color-success);
}

.badge-danger {
  background: var(--color-danger-surface);
  color: var(--color-danger);
}

.badge-neutral {
  background: var(--color-bg);
  box-shadow: inset 0 0 0 1px var(--color-border);
  color: var(--color-muted);
}

/* Les chiffres : un panneau bordé, découpé par des filets ; le libellé en gris au-dessus, le nombre net dessous. */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  margin: 0 0 var(--space-8);
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  box-shadow:
    -1px 0 var(--color-border),
    0 -1px var(--color-border);
}

.stat-label {
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
}

.stat-value {
  margin: 0;
  font-size: var(--text-xl);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
  line-height: var(--leading-title);
}

.stat-detail {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-xs);
}

/* Les tableaux : des lignes serrées sous un en-tête gris pâle, les nombres à droite ; sur un téléphone, chaque ligne
   devient un bloc, chaque valeur précédée de son intitulé. */

.data-table-wrap {
  margin: 0 0 var(--space-8);
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table caption {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-weight: var(--weight-semibold);
  text-align: start;
}

.data-table th,
.data-table td {
  height: var(--row-height);
  padding: var(--space-1) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  text-align: start;
  vertical-align: middle;
}

.data-table tbody tr:last-child > :is(th, td) {
  border-bottom: 0;
}

.data-table thead th {
  height: var(--control-height);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.data-table tbody th {
  font-weight: var(--weight-medium);
}

.data-table .numeric {
  text-align: end;
}

@media (max-width: 40rem) {
  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
  }

  .data-table tr {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table th,
  .data-table td {
    height: auto;
    padding: var(--space-1) 0;
    border: 0;
  }

  .data-table tbody th {
    margin-bottom: var(--space-1);
  }

  /* Un badge ou un bouton garde sa largeur, comme sur l'ordinateur. */
  .data-table td {
    display: grid;
    grid-template-columns: minmax(6rem, 40%) minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    gap: var(--space-3);
  }

  .data-table td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-size: var(--text-sm);
  }

  .data-table .numeric {
    text-align: start;
  }
}

/* Les états vides : ce qui manque, pourquoi c'est utile, et le bouton qui le crée ; aucun dessin. */

.empty {
  margin: 0 0 var(--space-8);
  padding: var(--space-8) var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
}

.empty .empty-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-md);
}

.empty-text {
  margin: 0;
  color: var(--color-muted);
}

.empty .actions {
  margin: var(--space-4) 0 0;
}

/* L'aide courte : une question qui s'ouvre, son texte sur le gris pâle. */

.hint {
  margin: 0 0 var(--space-4);
}

.hint > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  color: var(--color-muted);
  list-style: none;
}

.hint > summary:hover {
  color: var(--color-text);
}

.hint > summary::-webkit-details-marker {
  display: none;
}

.hint-body {
  max-width: 62ch;
  margin-top: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.hint-body > :last-child {
  margin-bottom: 0;
}

/* La fenêtre de confirmation : au centre, sur la page voilée ; avec le menu, la seule ombre de l'application. */

.confirm {
  width: min(100% - var(--space-8), 28rem);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-raised);
  box-shadow: var(--shadow-float);
  color: var(--color-text);
}

.confirm::backdrop {
  background: var(--color-backdrop);
}

.confirm .confirm-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-md);
}

.confirm p {
  color: var(--color-muted);
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: var(--space-6) 0 0;
}

@media (prefers-reduced-motion: no-preference) {
  .confirm:popover-open {
    animation: confirm-in 120ms ease-out;
  }

  @keyframes confirm-in {
    from {
      transform: scale(0.97);
    }
  }
}

/* Les graphiques : une légende, le dessin caché aux lecteurs d'écran, les nombres en texte. Des gris neutres, l'indigo
   pour ce qui compte ; ni dégradé ni ombre. */

.chart {
  margin: 0 0 var(--space-8);
}

.chart-caption {
  margin-bottom: var(--space-4);
  font-weight: var(--weight-semibold);
}

.bars-list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.bar {
  display: grid;
  grid-template-columns: minmax(7rem, 38%) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
}

.bar-track {
  display: block;
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border-radius: var(--radius-small);
  background: var(--color-hover);
}

.bar-fill {
  fill: var(--color-faint);
}

.bar-highlight .bar-fill {
  fill: var(--color-accent);
}

.bar-value {
  min-width: 2.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-medium);
  text-align: end;
}

@media (max-width: 40rem) {
  .bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-1) var(--space-3);
  }

  .bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

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

.funnel-step {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--space-4);
  padding-block: 1px;
}

.funnel-shape {
  display: block;
  align-self: stretch;
  width: 100%;
  height: auto;
  min-height: 3.25rem;
}

.funnel-shape polygon {
  fill: var(--color-border-strong);
}

.funnel-last .funnel-shape polygon {
  fill: var(--color-accent);
}

/* Le nombre, l'intitulé et le taux, chacun sur sa ligne : la même lecture à chaque étape, quelle que soit la largeur. */
.funnel-text {
  display: grid;
  justify-items: start;
  align-self: center;
  margin: 0;
  padding-block: var(--space-1);
  line-height: var(--leading-title);
}

.funnel-value {
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
}

.funnel-label {
  font-weight: var(--weight-medium);
}

.funnel-rate {
  color: var(--color-muted);
  font-size: var(--text-xs);
}

@media (max-width: 40rem) {
  .funnel-step {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: var(--space-3);
  }
}

/* Le schéma : des nœuds bordés, reliés par des traits fins et leurs pastilles ; l'objectif bordé d'indigo. */

.flow-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow > .flow-list {
  max-width: 46rem;
}

.flow-step,
.flow-fork {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.flow-link {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 2.25rem;
}

.flow-link:has(.flow-pill) {
  min-height: 3.5rem;
}

.flow-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.flow-lines path {
  fill: none;
  stroke: var(--color-faint);
  stroke-width: 1;
}

.flow-pill,
.flow-answer {
  position: relative;
  padding: 0 var(--space-2);
  border-radius: var(--radius-small);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.flow-pill {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-muted);
}

.flow-node {
  width: min(100%, 21rem);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-bg);
}

.flow-node p {
  margin: 0;
}

.flow-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-semibold);
}

.flow-title .ui-icon {
  color: var(--color-muted);
}

.flow-detail {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.flow-node .flow-figures {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  margin-top: var(--space-2);
  color: var(--color-muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.flow-condition {
  width: auto;
  padding: var(--space-2) var(--space-4);
  border: 1px dashed var(--color-faint);
  border-radius: var(--radius);
  text-align: center;
}

.flow-goal {
  border-color: var(--color-accent);
}

.flow-goal .flow-title .ui-icon {
  color: var(--color-accent);
}

.flow-branches {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  width: 100%;
}

.flow-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding-inline: var(--space-2);
}

.flow-answer {
  margin: 0;
  background: var(--color-hover);
  color: var(--color-text);
}

@media (max-width: 40rem) {
  .flow-fork > .flow-link {
    display: none;
  }

  .flow-branches {
    grid-auto-flow: row;
    gap: var(--space-2);
  }

  .flow-branch {
    padding-inline: 0;
  }

  .flow-branch::before {
    width: 1px;
    height: var(--space-6);
    background: var(--color-faint);
    content: "";
  }
}

/* Les motifs que partagent plusieurs pages, repris des écrans d'avant en attendant que chaque page soit refaite
   (P-01 à P-15) : une page qui l'est garde ce qui lui sert ici, ou le remplace dans sa feuille. Les plus simples
   (.muted, .actions, .page-intro…) sont plus haut, avec le texte. */

/* Une page d'une campagne ou des prospects : le lien qui remonte, une colonne étroite pour une confirmation. */

.area-back {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
}

.area-back a {
  color: var(--color-muted);
}

.area-narrow {
  max-width: 44rem;
}

/* Un chiffre dans une phrase : net et aligné. */
.figure {
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
}

/* Une variable de mail ({{prénom}}) : une pastille grise, dans la police du texte. */
.area code {
  padding: 0 var(--space-1);
  border-radius: var(--radius-small);
  background: var(--color-hover);
  font-family: inherit;
  font-size: var(--text-sm);
}

/* Une liste de campagnes, de listes ou d'adresses : une rangée par élément, séparées par des filets ; son action à
   droite sur un écran assez large, dessous sur un téléphone. */

.item-rows {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
  list-style: none;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  max-width: none;
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.item-row > * {
  margin: 0;
}

.item-row-name {
  margin: 0;
  font-size: var(--text-md);
}

.item-row-name a {
  color: var(--color-text);
  text-decoration: none;
}

.item-row-name a:hover {
  color: var(--color-link);
  text-decoration: underline;
}

.item-row-figures {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-6);
  font-variant-numeric: tabular-nums;
}

.item-row-date {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.item-row-next {
  display: grid;
  justify-items: start;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.item-row-next form,
.item-row-next p {
  margin: 0;
}

@media (min-width: 48rem) {
  .item-row {
    grid-template-columns: minmax(0, 1fr) minmax(11rem, 15rem);
    column-gap: var(--space-10);
  }

  .item-row > * {
    grid-column: 1;
  }

  .item-row > .item-row-next {
    grid-column: 2;
    grid-row: 1 / span 5;
    align-self: center;
    margin: 0;
  }
}

/* Le bilan : une ligne par chiffre, le chiffre en avant. */

.report-lines {
  max-width: 40rem;
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.report-lines > li {
  max-width: none;
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.report-lines ul {
  margin: var(--space-1) 0 0;
  padding-left: var(--space-5);
  list-style: none;
}

/* Un filtre sur une ligne : ses listes de choix, puis son bouton. */

.inline-filter form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-6);
}

.inline-filter .field {
  flex: 1 1 12rem;
  max-width: 20rem;
  margin: 0;
}

/* Une précision à côté d'un réglage, et un choix parmi d'autres. */

.wizard-aside {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.choice {
  margin: 0 0 var(--space-3);
}

/* Les boutons d'un formulaire en plusieurs temps : revenir à gauche, avancer à droite, sur un filet. */

.wizard-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: 48rem;
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

/* Le schéma d'une séquence, sur la page d'une campagne et dans sa création : les nœuds et les liens du schéma, les
   délais qu'on règle, les étapes qu'on ajoute ; seuls les réglages flottent, un panneau à droite sur un ordinateur, une
   page sur un téléphone. */

.sequence-builder {
  min-width: 0;
  margin-block: var(--space-8);
}

.sequence-chart {
  margin: 0;
  padding: var(--space-6) var(--space-4);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
}

.sequence-chart > .flow-list {
  margin-inline: auto;
}

.sequence-chart .flow-node {
  padding: 0;
  overflow-wrap: anywhere;
}

.sequence-open,
.sequence-content {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  text-align: left;
}

.sequence-open {
  border: 0;
  border-radius: var(--radius-panel);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}

.sequence-open:hover {
  background: var(--color-hover);
}

.sequence-open:focus-visible {
  outline-offset: -2px;
}

.sequence-chart .flow-title {
  display: block;
}

.sequence-subject {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.sequence-chart .sequence-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  white-space: pre-line;
}

.sequence-chart .flow-node .flow-figures {
  gap: var(--space-1) var(--space-3);
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-border);
}

.sequence-failed {
  color: var(--color-danger);
}

.sequence-delay {
  min-height: var(--control-height);
  border: 1px solid var(--color-faint);
  background: var(--color-bg);
  font-family: inherit;
  cursor: pointer;
}

.sequence-fork {
  width: 100%;
}

.sequence-chart .flow-condition,
.sequence-chart .sequence-skip {
  padding: var(--space-2) var(--space-4);
}

.sequence-rejoin,
.sequence-end {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  color: var(--color-muted);
  font-size: var(--text-xs);
  text-align: center;
}

.sequence-rejoin {
  margin-top: var(--space-4);
}

.sequence-add {
  position: relative;
  width: min(100%, 21rem);
  margin-top: var(--space-3);
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.sequence-add summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-1) var(--space-2);
  border: 1px dashed var(--color-faint);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
}

.sequence-add summary > span:first-child {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
}

.sequence-add-options {
  display: grid;
  gap: var(--space-2);
  padding-top: var(--space-2);
}

.sequence-settings {
  position: fixed;
  inset: 0;
  width: min(28rem, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: var(--space-6);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-left: 1px solid var(--color-border);
  background: var(--color-raised);
  box-shadow: var(--shadow-float);
  color: var(--color-text);
}

.sequence-settings h2 {
  margin-top: var(--space-6);
}

.sequence-settings .actions {
  flex-wrap: wrap;
}

@media (max-width: 48rem) {
  .sequence-chart {
    padding: var(--space-4) var(--space-2);
  }

  .sequence-chart .flow-branches {
    grid-auto-flow: row;
    gap: var(--space-4);
  }

  .sequence-fork > .flow-link .flow-lines {
    display: none;
  }

  .sequence-fork > .flow-link {
    min-height: var(--space-4);
  }

  .sequence-settings {
    width: 100%;
    padding: var(--space-5);
    border: 0;
    box-shadow: none;
  }
}

/* L'en-tête de l'administration : le logo, la navigation ; la navigation passe dessous sur un écran étroit. */

.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
  padding-block: var(--space-3);
}

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

.site-nav a {
  display: inline-block;
  padding-block: var(--space-1);
  color: var(--color-text);
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-nav a[aria-current="page"] {
  box-shadow: inset 0 -2px var(--color-accent);
  font-weight: var(--weight-semibold);
}

.site-nav form {
  margin: 0;
}

@media (max-width: 40rem) {
  .site-nav {
    flex-basis: 100%;
    order: 3;
  }
}
