/*
 * components.css — Composants reutilisables
 * Layer : components
 * Role : .card, .btn, .pill, .badge, .tab, .table-data, .form-*
 * Convention : BEM (.card__header, .btn--primary)
 * Doc : docs/CSS_ARCHITECTURE.md
 *
 * PR Composants 1a.1 : slots .card__* + variant .card--neutral (opt-in).
 * Aucune regle generique sur .card elle-meme (la version legacy reste dans app.css).
 * Aucun impact visuel tant que le markup existant n'adopte pas explicitement les slots.
 */

@layer components {

  /* ============================================================
   * .c-breadcrumb — fil d'Ariane unifié (icône Tabler + chevron)
   * Markup : breadcrumb_render() / ui_icon() (app/helpers.php).
   * Icônes en --color-brand (suivent le thème). Variante --inverse
   * pour fond coloré (hero course, cf. race-shared.css).
   * ============================================================ */
  .c-breadcrumb {
    margin: var(--space-1) 0 var(--space-4);
    padding-inline: var(--space-4);
  }
  /* Fil d'Ariane en tête de carte : la carte fournit déjà le padding
     horizontal → on neutralise celui du composant pour aligner le fil
     sur le titre (sinon double indentation de 16px). N'affecte pas le
     hero course (fil dans .course-hero-topline, pas enfant direct) ni
     les pages sans carte (cheval, réunions, CMS) qui gardent le retrait. */
  .card > .c-breadcrumb {
    padding-inline: 0;
  }
  .c-breadcrumb__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--font-size-sm);
  }
  .c-breadcrumb__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
  }
  .c-breadcrumb__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text);
    text-decoration: none;
    transition: color 180ms ease;
  }
  .c-breadcrumb__link:hover,
  .c-breadcrumb__link:focus-visible {
    color: var(--color-link);
  }
  .c-breadcrumb__current {
    color: var(--color-text);
    font-weight: 600;
    min-width: 0;
  }
  .c-ico {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    vertical-align: -0.18em;
  }
  .c-breadcrumb__link .c-ico {
    width: 1.3em;
    height: 1.3em;
    color: var(--color-brand);
  }
  .c-breadcrumb__sep {
    width: 1.05em;
    height: 1.05em;
    color: var(--color-border-strong);
  }

  /* Variante fond coloré (hero course) : texte + icônes inversés */
  .c-breadcrumb--inverse .c-breadcrumb__link,
  .c-breadcrumb--inverse .c-breadcrumb__current {
    color: var(--color-text-inverse);
  }
  .c-breadcrumb--inverse .c-breadcrumb__current {
    font-weight: var(--text-regular-weight);
  }
  .c-breadcrumb--inverse .c-breadcrumb__link .c-ico {
    color: var(--color-text-inverse);
  }
  .c-breadcrumb--inverse .c-breadcrumb__sep {
    color: var(--palette-white-a88);
  }
  .c-breadcrumb--inverse .c-breadcrumb__link:hover,
  .c-breadcrumb--inverse .c-breadcrumb__link:focus-visible {
    color: var(--color-text-inverse);
    text-decoration: underline;
  }

  /* Téléphone (≤ 979 px, le « mobile » du site) : les espaces du fil d'Ariane sont réduits
   * de moitié (8 px → 4 px entre les niveaux et autour du chevron, 6 px entre l'icône et
   * son mot, chevron un peu plus petit) — demande Xavier 12/09/2026 : « Accueil › Mes points
   * XP › Boutique cadeaux » passait à la ligne. Commun à TOUS les fils d'Ariane du site. */
  @media (max-width: 979px) {
    .c-breadcrumb__list,
    .c-breadcrumb__item {
      gap: var(--space-1, 4px);
    }
    .c-breadcrumb__link {
      gap: 6px;
    }
    .c-breadcrumb__sep {
      width: 0.9em;
      height: 0.9em;
    }
  }

  /* Contexte hero course (topline flex + fond coloré) : overrides du composant.
   * Même layer que la base => la spécificité (.course-hero-topline .c-breadcrumb*)
   * l'emporte. Reproduit le comportement de l'ancien .course-hero-breadcrumb. */
  .course-hero-topline .c-breadcrumb {
    margin: 0;
    padding-inline: 0;
    min-width: 0;
    flex: 1 1 auto;
  }
  .course-hero-topline .c-breadcrumb__list {
    font-size: var(--font-size-13);
  }
  .course-hero-topline .c-breadcrumb__link {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  @media (max-width: 979px) {
    .course-hero-topline .c-breadcrumb__list {
      flex-wrap: nowrap;
      min-width: 0;
      overflow: hidden;
      font-size: var(--font-size-xs);
      gap: var(--space-1);
    }
    /* Chevrons resserrés : gap interne de l'item aligné sur le gap de liste (4px). */
    .course-hero-topline .c-breadcrumb__item {
      gap: var(--space-1);
    }
    .course-hero-topline .c-breadcrumb__item:last-child {
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
    }
    .course-hero-topline .c-breadcrumb__current {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    /* Mobile/tablette : on masque les pictos (home/calendar) du fil d'Ariane
       pour gagner de la place horizontale. Le chevron séparateur reste. */
    .course-hero-topline .c-breadcrumb__link .c-ico {
      display: none;
    }
  }

  /* ============================================================
   * .card slots — BEM opt-in
   * Composent le contenu d'une .card sans forcer de typo globale.
   * A utiliser progressivement a la place des <h1/h2/h3> implicites
   * dans .card (qui heritent aujourd'hui la typo prescriptive
   * de app.css L918-933 et du responsive L3738-3740).
   * ============================================================ */

  .card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .card__title {
    margin: 0;
    font-weight: 700;
    line-height: var(--line-height-tight);
    color: var(--color-text);
  }

  .card__subtitle {
    margin: var(--space-1) 0 0;
    color: var(--color-text-muted);
    font-weight: 500;
  }

  .card__footer {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
  }

  /* ============================================================
   * .card--neutral — annule le visuel "card" legacy
   * (background, border, padding, shadow).
   * Remplacement propre des hacks type `.card.m-db` (member.css L510-516)
   * et `.card.m-member-card` dans les pages auth.
   * Migration progressive en PR 1a.2.
   * ============================================================ */

  .card--neutral {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }

  /* ============================================================
   * .btn variants — BEM opt-in (PR Composants 1b)
   * Compose avec le .btn legacy (app.css L955) pour les proprietes
   * de structure (display, padding, border-radius, font-weight).
   * Les variants n'apportent que les couleurs via tokens composants.
   * Aucune regle generique .btn {...} ajoutee pour eviter le piege
   * cascade @layer legacy < @layer components.
   * Usage :
   *   <button class="btn btn--primary">Envoyer</button>
   *   <button class="btn btn--ghost">Annuler</button>
   *   <button class="btn btn--danger">Supprimer</button>
   * Les variants legacy .btn-primary (tiret simple) restent intacts
   * dans app.css — pas de migration HTML forcee dans ce PR.
   * ============================================================ */

  .btn--primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-border);
  }

  .btn--primary:hover {
    background: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
  }

  .btn--ghost {
    background: var(--btn-ghost-bg);
    color: var(--btn-ghost-text);
    border-color: var(--btn-ghost-border);
  }

  .btn--ghost:hover {
    background: var(--btn-ghost-bg-hover);
  }

  .btn--danger {
    background: var(--btn-danger-bg);
    color: var(--btn-danger-text);
    border-color: var(--btn-danger-border);
  }

  .btn--danger:hover {
    background: var(--btn-danger-bg-hover);
    border-color: var(--btn-danger-bg-hover);
  }

  /* ============================================================
   * .pill — PR Composants 1c
   * Label compact a coin arrondi. Toujours utilise avec un variant
   * (--brand/--success/--danger/--warning/--neutral) qui definit
   * les couleurs. La base .pill ne pose que la structure.
   * Aucun .pill legacy dans les CSS : pas de piege cascade.
   * Les namespaces existants (.course-pill, .arrivees-date-pill, etc.)
   * restent intacts (selecteurs differents).
   * ============================================================ */

  .pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--pill-padding-y) var(--pill-padding-x);
    font-size: var(--pill-font-size);
    font-weight: var(--pill-font-weight);
    border-radius: var(--pill-radius);
    line-height: 1;
    white-space: nowrap;
  }

  .pill--brand {
    background: var(--color-brand);
    color: var(--color-text-inverse);
  }

  .pill--success {
    background: var(--color-success);
    color: var(--color-text-inverse);
  }

  .pill--danger {
    background: var(--color-danger);
    color: var(--color-text-inverse);
  }

  .pill--warning {
    background: var(--color-warning);
    color: var(--color-text-inverse);
  }

  .pill--neutral {
    background: var(--color-surface-soft);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
  }

  /* ============================================================
   * .badge — PR Composants 1c
   * Marqueur minimal plus petit que .pill (radius plus carre).
   * Meme principe : structure dans .badge, couleurs dans variants.
   * Aucun .badge legacy dans les CSS : pas de piege cascade.
   * ============================================================ */

  .badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--badge-padding-y) var(--badge-padding-x);
    font-size: var(--badge-font-size);
    font-weight: var(--badge-font-weight);
    border-radius: var(--badge-radius);
    line-height: 1;
    white-space: nowrap;
  }

  .badge--brand {
    background: var(--color-brand);
    color: var(--color-text-inverse);
  }

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

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

  .badge--warning {
    background: var(--color-warning);
    color: var(--color-text-inverse);
  }

  .badge--neutral {
    background: var(--color-surface-soft);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
  }

  /* ============================================================
   * .notification-badge — pastille rouge style Messenger/FB
   * Positionnée en haut-droite d'un conteneur parent (avatar,
   * bouton hamburger, lien nav).
   * ============================================================ */

  /* Anchoring des conteneurs cibles : ils sont définis en @layer legacy
     (app.css) et doivent être position:relative pour ancrer la pastille.
     L'avatar passe en overflow:visible pour que la pastille puisse déborder ;
     l'image hérite du border-radius du parent pour rester clippée. */
  .top-account-avatar {
    position: relative;
    overflow: visible;
  }
  .top-account-avatar-image {
    border-radius: inherit;
  }
  .top-menu-btn,
  .bottom-nav a {
    position: relative;
  }

  /* Entrées "Notifications" et "Messagerie" (M10) du drawer mobile, et
     "Le Direct" (24/08/2026) : badge inline à droite du label, pas superposé
     au coin. On neutralise donc position:absolute pour ces trois cas. */
  .mobile-drawer-notifications,
  .mobile-drawer-messagerie,
  .mobile-drawer-direct {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .mobile-drawer-notifications .notification-badge,
  .mobile-drawer-messagerie .notification-badge,
  .mobile-drawer-direct .notification-badge {
    position: static;
    top: auto;
    right: auto;
    box-shadow: none;
  }

  /* Pastille « Mes points » (lot 1) : le solde, « 1 240 pts », en vert doux.
     Dans la barre (à gauche du compte) et dans le tiroir mobile (à droite du
     libellé, comme Notifications). [hidden] la retire (JS header-state). */
  .points-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--radius-full, 999px);
    background: var(--color-brand-soft, #e4f3ea);
    color: var(--color-brand, #14663c);
    font-size: 13px;
    font-weight: 700;
    line-height: 18px;
    white-space: nowrap;
    text-decoration: none;
  }
  .points-pill--barre {
    margin-right: 8px;
  }
  .points-pill--barre:hover,
  .points-pill--barre:focus-visible {
    background: var(--color-brand, #14663c);
    color: var(--color-text-inverse, #fff);
  }
  .mobile-drawer-points {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  [data-points-badge-link][hidden] {
    display: none;
  }

  .notification-badge {
    position: absolute;
    top: -1px;
    right: -2px;
    min-width: 12px;
    height: 12px;
    /* Centrage OPTIQUE du chiffre, REMESURÉ AU PIXEL (Xavier, 29/08/2026 :
       « c'est pas du tout centré »).
       La version du 25/08 corrigeait « ~0,7 px trop haut » d'après les
       métriques de la police. C'était l'erreur : ces métriques décrivent la
       CHASSE (la boîte d'avance du caractère), pas l'ENCRE (les pixels
       allumés). Mesuré cette fois sur la capture elle-même — disque rouge
       contre pixels blancs, agrandissement ×10 — le chiffre était déjà bien
       placé, et le padding haut de 1,4 px le poussait 0,5 à 0,65 px TROP BAS.
       Le voici retiré.

       Reste le seul écart réel, horizontal et propre à chaque chiffre : dans
       la même boîte, l'encre du « 1 » tombe ~0,4 px à gauche du centre quand
       celle du « 8 » y est déjà. Aucune valeur ne centre les deux : 3,7 px à
       gauche contre 3,3 px à droite partage la différence — plus aucun chiffre
       à plus de 0,2 px du centre, contre 0,5 px avant.
       Les flancs totalisent toujours 7 px : un chiffre seul reste à 12 px de
       large, la pastille reste RONDE et ne devient jamais ovale.
       Banc reproductible : capture Chrome headless à --force-device-scale-factor=10,
       puis comparaison des deux boîtes (cf. session du 29/08/2026). */
    padding: 0 3.3px 0 3.7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--color-red, var(--palette-red-500));
    color: var(--color-text-inverse);
    /* POLICE POSÉE ICI, jamais héritée (29/08/2026) : dans un `<button>` —
       la cloche du haut de page — l'agent utilisateur impose Arial, alors que
       la même pastille dans un `<a>` du menu prend la police du site. Deux
       dessins pour un seul composant, donc un centrage juste d'un côté et faux
       de l'autre. Même token que `body` (app.css) — le littéral « SF Pro Text »
       d'avant Arimo (11/09/2026) ne suivait plus la police du site. */
    font-family: var(--font-family-sans, "SF Pro Text", "Segoe UI", sans-serif);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--palette-white);
    pointer-events: none;
    z-index: 2;
  }
  .notification-badge[hidden] {
    display: none;
  }

  /* Barre de navigation du bas (17/09/2026) : la pastille se pose sur le coin
     de l'ICÔNE, pas du lien entier — sinon elle flotte au-dessus du libellé.
     ⚠️ Cette règle DOIT vivre ici et pas dans app.css : l'ordre déclaré des
     couches (partials/header.php) est `tokens, base, legacy, components, …`,
     donc `components` gagne sur `legacy` quelle que soit la spécificité. Un
     réglage écrit dans app.css serait purement et simplement ignoré. */
  .bottom-nav .notification-badge {
    top: -3px;
    right: -7px;
  }

  /* ============================================================
   * .notif-bell + .notif-dropdown — cloche desktop avec dropdown
   * AJAX lazy (Commit 8.3). Hidden en mobile via .desktop-account.
   * Le dropdown est ancré sur .notif-bell-wrap (position: relative).
   * ============================================================ */

  .notif-bell-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
  }

  .notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line, var(--color-border));
    border-radius: var(--radius-md, 10px);
    background: var(--color-surface, var(--color-surface));
    color: var(--text, var(--color-text));
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .notif-bell:hover,
  .notif-bell:focus-visible {
    background: var(--surface-soft, var(--color-surface-soft));
    color: var(--color-green, var(--color-success));
  }
  .notif-bell[aria-expanded="true"] {
    background: var(--surface-soft, var(--color-surface-soft));
    color: var(--color-green, var(--color-success));
  }
  .notif-bell-icon {
    width: 22px;
    height: 22px;
  }

  .notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 24px);
    background: var(--color-surface, var(--color-surface));
    border: 1px solid var(--line, var(--color-border));
    border-radius: 12px;
    box-shadow: 0 12px 32px var(--palette-blue-900-a18);
    overflow: hidden;
    z-index: 100;
  }
  .notif-dropdown[hidden] {
    display: none;
  }

  .notif-dropdown__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line, var(--color-border));
    background: var(--surface-soft, var(--color-surface-soft));
  }
  .notif-dropdown__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text, var(--color-text));
  }
  .notif-dropdown__mark-all {
    font-size: 0.82rem;
    background: transparent;
    border: none;
    color: var(--color-green, var(--color-success));
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
  }
  .notif-dropdown__mark-all:hover,
  .notif-dropdown__mark-all:focus-visible {
    background: var(--palette-green-800-a8b);
  }
  .notif-dropdown__mark-all[hidden] {
    display: none;
  }

  .notif-dropdown__list {
    max-height: 420px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .notif-dropdown__item {
    display: flex;
    gap: 0.65rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--line, var(--color-border));
    color: inherit;
    text-decoration: none;
    transition: background 0.1s ease;
    flex-wrap: wrap;
  }
  .notif-dropdown__item:hover {
    background: var(--surface-soft, var(--color-surface-soft));
  }
  /* Wrapper interne pour les items actionnables : le <a> enveloppe avatar+body
     uniquement, et les boutons Accept/Decline sont siblings (HTML valide). */
  .notif-dropdown__item-link {
    display: flex;
    gap: 0.65rem;
    flex: 1 1 100%;
    min-width: 0;
    color: inherit;
    text-decoration: none;
  }
  .notif-dropdown__item--unread {
    background: var(--palette-green-100l);
  }
  .notif-dropdown__item--unread:hover {
    background: var(--palette-green-150k);
  }
  .notif-dropdown__item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--palette-orange-600);
    color: var(--color-text-inverse);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
  }
  .notif-dropdown__item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
  }
  /* Sans photo : lettre grise sur rond gris clair, comme la page des
     notifications (Xavier 28/10/2026) ; une photo garde sa forme. */
  .notif-dropdown__item-avatar:not(:has(img)) {
    border-radius: 50%;
    background: var(--color-surface-soft, #f8fafc);
    box-shadow: inset 0 0 0 1px var(--color-border, #dce3ec);
    color: var(--color-text-muted, #5f6d82);
  }
  /* Un badge : sa médaille telle quelle (ronde, ou carrée pour un badge du
     moment), sans le fond orange d'une photo (Xavier 01/11/2026). */
  .notif-dropdown__item-avatar--badge {
    background: none;
    border-radius: 0;
  }
  /* Le résultat de la ligue du lundi : la lettre de la ligue dans la couleur
     de sa pastille du haut du site (variables de .ligue-pill--or, --argent…,
     hippique.header.css), Xavier 01/11/2026. */
  .notif-dropdown__item-avatar.notif-dropdown__item-avatar--ligue {
    background: var(--lp-fond, #dde3ea);
    color: var(--lp-texte, var(--color-text));
    box-shadow: none;
  }
  .notif-dropdown__item-body {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    line-height: 1.35;
  }
  .notif-dropdown__item-title {
    color: var(--text, var(--color-text));
  }
  .notif-dropdown__item--unread .notif-dropdown__item-title {
    font-weight: 700;
  }
  .notif-dropdown__item-excerpt {
    color: var(--muted, var(--color-text-muted));
    margin-top: 0.15rem;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .notif-dropdown__item-time {
    color: var(--muted, var(--color-text-muted));
    font-size: 0.75rem;
    margin-top: 0.2rem;
  }
  .notif-dropdown__item-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
    flex-basis: 100%;
    flex-wrap: wrap;
  }
  .notif-dropdown__item-actions .btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
  }

  .notif-dropdown__empty,
  .notif-dropdown__loading,
  .notif-dropdown__error {
    padding: 1.25rem 1rem;
    text-align: center;
    color: var(--muted, var(--color-text-muted));
    font-size: 0.9rem;
  }

  .notif-dropdown__footer {
    display: flex;
    border-top: 1px solid var(--line, var(--color-border));
    background: var(--surface-soft, var(--color-surface-soft));
  }
  .notif-dropdown__footer-link {
    flex: 1 1 0;
    text-align: center;
    padding: 0.65rem 1rem;
    color: var(--color-green, var(--color-success));
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
  }
  .notif-dropdown__footer-link + .notif-dropdown__footer-link {
    border-left: 1px solid var(--line, var(--color-border));
  }
  .notif-dropdown__footer-link:hover,
  .notif-dropdown__footer-link:focus-visible {
    background: var(--palette-green-800-a8b);
  }

  /* ============================================================
   * .form-* — socle BEM opt-in (PR Composants 1d)
   * Champs neutres consommant les tokens --form-* (tokens.css).
   * Pas de migration des templates legacy (.m-member-*, .m-db-*, etc.) :
   * le socle est disponible pour de nouveaux formulaires uniquement.
   * Etats : default + hover subtle + focus-visible + error + disabled.
   * Error pilotable par modificateur (.is-error, .form-field.is-error)
   * OU attribut a11y (aria-invalid="true").
   * Composants exclus du socle : emoji-picker, avatar upload, autocomplete,
   * password strength meter, toggles riches, search avec dropdown.
   * ============================================================ */

  /* Reset baseline + structure commune */
  .form-input,
  .form-textarea,
  .form-select {
    width: 100%;
    font: inherit;
    color: var(--form-text-color);
    background: var(--form-bg);
    border: 1px solid var(--form-border-color);
    border-radius: var(--form-radius);
    padding: var(--form-padding-y) var(--form-padding-x);
    transition: border-color var(--transition-interaction),
                box-shadow var(--transition-interaction);
  }

  /* Hauteur minimale (touch-friendly) sur input et select.
     Textarea garde son --form-textarea-min-height plus haut (override ci-dessous). */
  .form-input,
  .form-select {
    min-height: var(--form-control-min-height);
  }

  /* Hover subtle (skip si disabled) */
  .form-input:hover:not(:disabled),
  .form-textarea:hover:not(:disabled),
  .form-select:hover:not(:disabled) {
    border-color: var(--form-border-hover-color);
  }

  /* Focus-visible (pas :focus pour eviter le ring sur clic souris) */
  .form-input:focus-visible,
  .form-textarea:focus-visible,
  .form-select:focus-visible {
    outline: none;
    border-color: var(--form-border-focus-color);
    box-shadow: var(--form-focus-ring-shadow);
  }

  /* Disabled */
  .form-input:disabled,
  .form-textarea:disabled,
  .form-select:disabled {
    background: var(--form-bg-disabled);
    color: var(--form-text-disabled);
    cursor: not-allowed;
  }

  /* Error : modificateur, descendant .form-field.is-error, ou aria-invalid */
  .form-input.is-error,
  .form-textarea.is-error,
  .form-select.is-error,
  .form-input[aria-invalid="true"],
  .form-textarea[aria-invalid="true"],
  .form-select[aria-invalid="true"],
  .form-field.is-error .form-input,
  .form-field.is-error .form-textarea,
  .form-field.is-error .form-select {
    border-color: var(--form-border-error-color);
    background: var(--form-bg-error);
  }

  /* Textarea specifique */
  .form-textarea {
    min-height: var(--form-textarea-min-height);
    resize: vertical;
  }

  /* Checkbox / radio (natifs, pas d'appearance: none) */
  .form-checkbox,
  .form-radio {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-body-size);
    color: var(--color-text);
  }

  .form-checkbox-input,
  .form-radio-input {
    width: var(--form-checkbox-size);
    height: var(--form-checkbox-size);
    cursor: pointer;
    accent-color: var(--color-brand);
  }

  .form-checkbox:has(.form-checkbox-input:disabled),
  .form-radio:has(.form-radio-input:disabled) {
    cursor: not-allowed;
    opacity: 0.55;
  }

  /* Label */
  .form-label {
    display: inline-block;
    font-size: var(--text-body-size);
    font-weight: var(--text-semibold-weight);
    color: var(--color-text);
  }

  /* Required marker (asterisque) */
  .form-required {
    color: var(--color-danger);
    margin-left: 2px;
  }

  /* Hint (texte d'aide) */
  .form-hint {
    display: block;
    font-size: var(--font-size-13);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
  }

  /* Error message (recommande role="alert" cote markup) */
  .form-error {
    display: block;
    font-size: var(--font-size-13);
    color: var(--color-danger);
    margin-top: var(--space-1);
  }

  /* Layout : field wrapper (label + input + hint/error) */
  .form-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }

  /* Layout : group (suite de champs) */
  .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  /* Layout : row 2-col responsive.
     Convention start/max du contract : 769px en min-width pour eviter
     la collision a 768px exactement (cf. docs/CSS_TYPO_RESPONSIVE_CONTRACT.md §3.3). */
  .form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  @media (min-width: 769px) {
    .form-row {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  /* Layout : actions (row boutons submit / cancel) */
  .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
  }

  /* ============================================================
   * .table-data — primitive table opt-in (PR Composants 1e)
   * Socle minimaliste pour les nouveaux tableaux. Pas de migration
   * des templates legacy (.race-table, .qpt-table, .partants-table,
   * .arrivees-table, .pab-tbl, .presse-tbl, .concours-*-table) qui
   * gardent leurs styles module-specifiques.
   *
   * Baseline = table standard (14px). Pour turf/data dense, ajouter
   * la variante .table-data--dense (12px / 1.0 / 6x8px padding).
   *
   * Etats neutres scopes sous .table-data : .is-muted, .is-disabled,
   * .is-highlighted, .is-positive, .is-negative.
   * Patterns metier (NP, favori, podium, casaque, musique compacte,
   * distance rendu trot, cote theorique, PAB %, etc.) restent en
   * legacy — la primitive ne les genere pas.
   *
   * Mobile : table -> cards est un pattern de page/module, pas une
   * feature de la primitive. Le wrapper .table-data-wrap fournit
   * juste un scroll horizontal neutre.
   * ============================================================ */

  /* Wrapper scroll horizontal (mobile/tablette tres large) */
  .table-data-wrap {
    width: 100%;
    overflow-x: auto;
  }

  /* Socle table */
  .table-data {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: var(--table-data-font-size);
    line-height: var(--table-data-line-height);
  }

  .table-data th,
  .table-data td {
    padding: var(--table-data-padding-y) var(--table-data-padding-x);
    border-bottom: 1px solid var(--table-data-border-color);
    text-align: left;
    vertical-align: middle;
  }

  .table-data thead th {
    font-size: var(--table-data-header-font-size);
    font-weight: var(--text-semibold-weight);
    color: var(--table-data-header-color);
    letter-spacing: var(--table-data-header-letter-spacing);
    text-transform: var(--table-data-header-text-transform);
  }

  /* Slots cellule (modificateurs) */
  .table-data__cell--numeric { text-align: center; }
  .table-data__cell--strong  { font-weight: var(--text-bold-weight); }
  .table-data__cell--muted   { color: var(--color-text-muted); }

  /* === Variants === */

  /* Dense : turf/data haute densite (recommande pour tableaux PMU) */
  .table-data--dense {
    font-size: var(--table-data-dense-font-size);
    line-height: var(--table-data-dense-line-height);
  }
  .table-data--dense th,
  .table-data--dense td {
    padding: var(--table-data-dense-padding-y) var(--table-data-dense-padding-x);
  }

  /* Zebra : alternance odd/even (opt-in) */
  .table-data--zebra tbody tr:nth-child(even) {
    background: var(--color-surface-soft);
  }

  /* Grid : quadrillage complet (border-right + bottom) */
  .table-data--grid th,
  .table-data--grid td {
    border-right: 1px solid var(--table-data-border-color);
  }
  .table-data--grid th:last-child,
  .table-data--grid td:last-child {
    border-right: 0;
  }

  /* === Etats contextuels neutres (scopes sous .table-data) === */

  .table-data .is-muted {
    opacity: 0.65;
  }

  .table-data .is-disabled {
    opacity: 0.45;
    pointer-events: none;
  }

  .table-data .is-highlighted {
    background: var(--color-brand-soft);
  }

  .table-data .is-positive {
    color: var(--color-success);
  }

  .table-data .is-negative {
    color: var(--color-danger);
  }

  /* ============================================================
   * Etats transverses — focus / alert / empty-state / loader
   * (PR Composants 1f)
   *
   * Composants opt-in pour les nouveaux ecrans. Aucune migration
   * des templates legacy (.m-member-flash, .m-db-flash, .flash-*,
   * .vip-loader, .vip-unavailable, .notif-empty, etc.).
   *
   * Note : les 5 inputs legacy sans focus ring (auth, dashboard,
   * messagerie compositeur, comment-reply, home-program-row-toggle)
   * restent une dette a11y a traiter dans le chantier A11y baseline,
   * pas ici.
   * ============================================================ */

  /* === Focus-visible global (hors champs de formulaire) ===
     :where() = specificite 0, ne supplante PAS les composants qui
     ont deja leur focus explicite (.form-input:focus-visible,
     .notif-bell:focus-visible, etc.).
     input/select/textarea volontairement EXCLUS pour ne pas creer
     de doubles etats sur les formulaires legacy qui ont deja des
     :focus sans :focus-visible. */
  :where(a, button, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
  }

  /* === .alert — message global / inline (4 variants) === */

  .alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-size: var(--text-body-size);
    line-height: var(--text-ui-height);
  }

  .alert__icon {
    flex-shrink: 0;
    line-height: 1;
  }

  .alert__text {
    margin: 0;
    font-weight: var(--text-semibold-weight);
  }

  .alert__link {
    color: inherit;
    font-weight: var(--text-bold-weight);
    text-decoration: underline;
  }

  .alert--info {
    background: var(--color-brand-soft);
    color: var(--color-brand);
  }

  .alert--success {
    background: var(--color-success-soft);
    color: var(--color-success);
  }

  .alert--warning {
    background: var(--color-warning-soft);
    color: var(--color-warning);
  }

  .alert--danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
  }

  /* === .empty-state — zone vide / pas de resultat === */

  .empty-state {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--color-text-muted);
  }

  .empty-state__icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: var(--space-3);
  }

  .empty-state__title {
    margin: 0 0 var(--space-2);
    font-size: var(--font-size-lg);
    font-weight: var(--text-bold-weight);
    color: var(--color-text);
  }

  .empty-state__text {
    margin: 0;
    font-size: var(--text-body-size);
  }

  .empty-state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-5);
  }

  /* === .loader — spinner CSS (skeleton hors scope v1) ===
     Iso-compatible avec l'animation .vip-loader-spinner existante
     (cf. app.css). Renomme et tokenise pour reutilisation. */

  .loader {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-body-size);
    color: var(--color-text-muted);
  }

  .loader--block {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: var(--space-5) 0;
  }

  .loader__spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: loader-spin 600ms linear infinite;
    flex-shrink: 0;
  }

  .loader__text {
    font-weight: var(--text-semibold-weight);
  }

  @keyframes loader-spin {
    to {
      transform: rotate(360deg);
    }
  }

  /* a11y : respecte la preference reduced-motion (le .loader__text
     suffit a indiquer l'etat de chargement aux utilisateurs concernes). */
  @media (prefers-reduced-motion: reduce) {
    .loader__spinner {
      animation: none;
    }
  }

  /* ============================================================
   * .pb-* — LES BADGES (lot 3c, planche validée par Xavier le 16/09/2026)
   * Markup : app/modules/points/badges_affichage.php ; le panneau s'ouvre
   * au survol sur ordinateur (CSS) et au clic partout (header.js).
   * Trois formes, trois sens : rond doré = acquis (l'anneau suit le métal),
   * carré bleu = du moment (se perd), rond vert = premier jour. Les métaux
   * n'ont pas de token : ils ne servent qu'ici, ils vivent ici.
   * CINQ métaux depuis le 16/09/2026 (« il faut qu'il y ait toujours des
   * badges à gagner dans 5 ans ») : bronze, argent, or lisses ; PLATINE
   * turquoise et DIAMANT violet, tous deux à l'anneau CANNELÉ — la forme
   * les distingue même sans la couleur, et même à 24 px (planche validée).
   * Turquoise et violet sont libres : ni le bleu du moment, ni le vert du
   * premier jour ne s'en approchent.
   * ============================================================ */
  .pb-med, .pb-puce, .pb-mur, .pb-panneau {
    /* L'or est JAUNE partout depuis le 06/10/2026 (avant : beige #fdf6e6 et brun #8a6a15, confondus avec le bronze —
       Xavier : « partout le même jaune pour OR »). */
    --pb-or: #eab308; --pb-or-f: #fff3bf; --pb-or-t: #8a6500;
    --pb-arg: #9aa3ab; --pb-arg-f: #f4f6f8; --pb-arg-t: #5b6670;
    --pb-bro: #a97142; --pb-bro-f: #f9f1ea; --pb-bro-t: #7d5230;
    --pb-bleu: #1877f2; --pb-bleu-f: #eaf2fe; --pb-bleu-t: #0f5fc2;
    --pb-vert: var(--color-success); --pb-vert-f: #e9f5ee;
    --pb-pla: #06b6d4; --pb-pla-f: #e6fbff; --pb-pla-t: #0e7490;
    --pb-dia: #8b5cf6; --pb-dia-f: #f5ecff; --pb-dia-t: #6d28d9;
    --pb-gris: #d8dbe0; --pb-gris-f: #f2f3f5; --pb-gris-t: #b0b5bb;
  }
  .pb--n3 { background: var(--pb-or-f); border-color: var(--pb-or); color: var(--pb-or-t); }
  /* Le « border: … solid » de .pb-med et de .pb-puce (plus bas) ramène l'anneau à la couleur du dessin : l'or le
     reprend ici, sinon son anneau restait brun. */
  .pb-med.pb--n3, .pb-puce.pb--n3 { border-color: var(--pb-or); }
  .pb--n2 { background: var(--pb-arg-f); border-color: var(--pb-arg); color: var(--pb-arg-t); }
  .pb--n1 { background: var(--pb-bro-f); border-color: var(--pb-bro); color: var(--pb-bro-t); }
  .pb--n4 { background: var(--pb-pla-f); border-color: var(--pb-pla); color: var(--pb-pla-t); }
  .pb--n5 { background: var(--pb-dia-f); border-color: var(--pb-dia); color: var(--pb-dia-t); }
  .pb--moment { background: var(--pb-bleu-f); border-color: var(--pb-bleu); color: var(--pb-bleu-t); }
  .pb--debut { background: var(--pb-vert-f); border-color: var(--pb-vert); color: var(--pb-vert); }
  .pb--gris, .pb--plus, .pb--n0 { background: var(--pb-gris-f); border-color: var(--pb-gris); color: var(--pb-gris-t); }

  /* La médaille : le dessin ne change pas d'un métal à l'autre, seul l'anneau. */
  .pb-med {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    box-sizing: border-box;
    position: relative; /* l'anneau cannelé du platine et du diamant s'y accroche */
    border: 3px solid;
    border-radius: 50%;
    vertical-align: middle;
    font-weight: 700;
    line-height: 1;
  }
  .pb-med svg, .pb-puce__ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .pb-med--s { width: 24px; height: 24px; border-width: 2px; font-size: 12.5px; } /* le « +N » de la tuile est du TEXTE : jamais sous 12,5 px (règle du site, revue Codex 16/09) */
  .pb-med--s svg { width: 13px; height: 13px; stroke-width: 2.2; }
  .pb-med--m { width: 34px; height: 34px; }
  .pb-med--m svg { width: 18px; height: 18px; }
  .pb-med--l { width: 48px; height: 48px; }
  .pb-med--l svg { width: 25px; height: 25px; }
  .pb-med--xl { width: 104px; height: 104px; border-width: 4px; }
  .pb-med--xl svg { width: 52px; height: 52px; }
  /* L'ANNEAU CANNELÉ des deux plus hauts métaux (idée de Xavier, 16/09/2026) : des encoches régulières tout autour,
     obtenues par un éventail de rayons masqué en couronne. Le dessin du badge ne change pas — seul l'anneau.
     ⚠️ Cible : la MÉDAILLE seulement. La puce (.pb-puce) porte les mêmes classes de métal, mais c'est une pastille
     allongée, et son ::before est déjà la zone de clic au toucher.
     Les encoches sont LARGES (12 deg pleins sur 24) : en 24 px, une dentelure fine devenait un flou gris. */
  .pb-med.pb--n4::before,
  .pb-med.pb--n5::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: repeating-conic-gradient(currentColor 0deg 12deg, transparent 12deg 24deg);
    -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 7px), #000 calc(100% - 7px));
    mask: radial-gradient(closest-side, transparent calc(100% - 7px), #000 calc(100% - 7px));
  }
  .pb-med.pb--n4::before { color: var(--pb-pla); }
  .pb-med.pb--n5::before { color: var(--pb-dia); }
  .pb-med--s.pb--n4::before, .pb-med--s.pb--n5::before {
    inset: -2px;
    background: repeating-conic-gradient(currentColor 0deg 15deg, transparent 15deg 30deg);
    -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
    mask: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
  }
  .pb-med--xl.pb--n4::before, .pb-med--xl.pb--n5::before {
    inset: -4px;
    -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 13px), #000 calc(100% - 13px));
    mask: radial-gradient(closest-side, transparent calc(100% - 13px), #000 calc(100% - 13px));
  }
  /* Un badge pas encore obtenu reste gris et LISSE : la cannelure est une récompense, pas une promesse. */
  .pb-med.pb--gris::before { content: none; }

  .pb-med--carre.pb-med--s { border-radius: 7px; }
  .pb-med--carre.pb-med--m { border-radius: 10px; }
  .pb-med--carre.pb-med--l, .pb-med--carre.pb-med--xl { border-radius: 14px; }

  /* La puce à côté du pseudo : UN badge, icône + mot ; icône seule sur téléphone. */
  .pb-wrap {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    /* L'espace avant la puce LÀ OÙ RIEN NE LE DONNE : la fiche d'un membre, les classements du concours,
       les pages de points — des lignes de texte ordinaires, sans `gap`. */
    margin-inline-start: 5px;
  }
  /* ⚠️ DANS UNE LIGNE DE COMMENTAIRE, LA MARGE EST EN TROP (Xavier, 23/09/2026 : « mettre moins d'espace
     entre le pseudo et le badge »). Ces lignes-là sont des conteneurs flex qui posent DÉJÀ leur propre
     écart — 10 px sous `.social-comments-iso` (pages courses, fenêtre, cartes du fil), 6 px dans le corps
     d'une carte, 5 px dans la fenêtre superposée. La marge du composant s'y AJOUTAIT : 15 px avant la puce
     contre 10 après, et la pastille paraissait poussée vers la date. On la rend au parent, qui est le seul
     à savoir de combien il sépare les éléments de SA ligne. */
  .comment-meta .pb-wrap,
  .direct-post-ident .pb-wrap { margin-inline-start: 0; }
  /* PLUS PETITE (Xavier, 23/09/2026 : « ils prennent trop de place », puis « encore un peu trop grand » une
     fois la première réduction en ligne). Deux crans : 24 px de haut → 20 → 18, et 12,5 px de texte → 11 →
     10,5. À côté d'un pseudo de 14,5 px, elle redevient une annotation au lieu de disputer la ligne.
     Les chiffres ne sont pas libres : la hauteur doit rester au-dessus de la ligne de texte du pseudo (sinon
     la puce fait remonter la ligne) et le mot doit tenir sans césure.
     ⚠️ L'icône descend de 14 à 12 px mais son trait MONTE de 2,1 à 2,3 : un trait de 2,1 sur un dessin plus
     petit paraît plus maigre, c'est le même piège que sur les dessins de badges du lot 3c. */
  .pb-puce {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 18px;
    padding: 3px 5px;
    border: 1px solid;
    border-radius: 999px;
    font: inherit;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
  }
  .pb-puce__ico { width: 11px; height: 11px; stroke-width: 2.4; flex: 0 0 auto; }
  .pb-puce:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
  /* LE NOM N'EST PLUS CALÉ SUR LES ÉCRANS SANS RETINA (23/09/2026) — et c'est la RÉDUCTION de la puce qui
     l'a rendu inutile. Rappel du défaut d'origine (18/09) : à 12,5 px de texte dans une pastille de 24 px,
     un écran à un seul pixel par point posait la ligne de pied sur un pixel entier et remontait le mot
     d'environ 1,5 px, alors que l'icône à côté ne bougeait pas — d'où une règle `top: 1.5px` sous
     `max-resolution: 1.5dppx`.
     À 11 px dans une pastille de 20 px, l'arrondi tombe juste : le banc Chrome mesure la ligne de pied à
     15,41 px dans les DEUX densités (1× et 2×, police Arimo, mesure du nœud texte au Range). La règle ne
     corrigeait donc plus rien — elle descendait le mot de 1,5 px sur un écran ordinaire et lui faisait
     toucher le bas de la pastille, exactement le défaut inverse de celui qu'elle visait, visible à l'œil sur
     une capture agrandie.
     ⚠️ Si la taille de la puce rebouge un jour, REMESURER aux deux densités avant de remettre un calage :
     `node bin/outils_ui_chrome.js --densite=1` puis `--densite=2`. C'est l'option qui a servi ici. */

  /* L'ICÔNE SEULE, PARTOUT ET SUR TOUS LES ÉCRANS (Xavier, 23/09/2026 : « l'icône seule partout, dans le
     desktop aussi ; et quand on met la souris dessus au survol on a la liste des badges avec les noms »).
     La pastille n'écrit plus le nom du badge : c'est une gommette posée après le pseudo, qui dit qu'il y a
     quelque chose, et le panneau dit quoi — au SURVOL sur ordinateur, au CLIC partout (assets/js/header.js).
     Le panneau, lui, n'a pas changé : le badge en tête avec sa phrase, puis les autres avec leurs noms et
     leurs métaux, puis le lien vers le mur du membre.
     POURQUOI C'EST LA RÈGLE GÉNÉRALE, et pas une exception par écran : la puce paraît partout (fil du Direct,
     pages courses, fiche d'un membre, classements du concours, pages de points), et deux présentations du
     même composant auraient demandé de se souvenir, à chaque nouvel écran, laquelle s'applique.
     ⚠️ LE NOM RESTE DANS LE HTML — masqué, pas supprimé. Il porte le libellé pour qui lit le code ou le
     copie ; l'accessibilité, elle, passe par aria-label="Badge : Le Winner. Voir ses badges", que le bouton
     porte depuis le premier jour. Un `display: none` ne prive donc aucun lecteur d'écran. */
  .pb-puce__nom { display: none; }

  @media (max-width: 979px) {
    /* Au toucher, la zone de clic déborde le dessin sans rien déplacer : le banc Chrome la mesurait à 22 px,
       trop peu pour un doigt (16/09/2026).
       ⚠️ DÉBORDEMENT PLUS GRAND EN HAUT ET EN BAS QU'À GAUCHE ET À DROITE (23/09/2026). La pastille a perdu
       6 px de haut en rapetissant : à -8 px partout, la cible retombait de 40 à 34 px. On rattrape les 40 px
       par le haut et par le bas, où il n'y a personne — pas sur les côtés : la date n'est qu'à 10 px sur une
       page course et à 5 px dans Le Direct, et une zone plus large aurait mangé son survol. */
    .pb-puce::before { content: ""; position: absolute; inset: -11px -8px; }
  }

  /* Le panneau : les autres badges, six au plus, et le lien vers le mur. */
  .pb-panneau {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 60;
    min-width: 250px;
    max-width: min(320px, 90vw);
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    color: var(--color-text);
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
  }
  /* LE PONT (Xavier 16/09/2026 : « ça se referme trop vite, il faut aller doucement »). Le panneau est posé 6 px SOUS
     la puce, et il ne reste ouvert que tant que la souris touche l'une ou l'autre : en descendant, elle traversait une
     bande vide où plus rien n'était survolé — le panneau se fermait avant d'être atteint, et son lien était
     inatteignable au survol (5 pixels morts mesurés à 1280 px ; au toucher, le ::before de la puce les couvrait déjà).
     Ce pont invisible comble l'écart sur toute la largeur du panneau. Il n'existe que panneau ouvert (display:none
     cache aussi les pseudo-éléments) : les 2 px qu'il déborde sur le bas de la puce ne gênent jamais l'ouverture,
     seulement un re-clic sur ces 2 px-là. */
  .pb-panneau::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 8px;
  }

  /* Le panneau se CALE dans la fenêtre : header.js pose `left` à l'ouverture (clic ou survol) d'après la place
     de la puce — une puce centrée sous le pseudo, sur téléphone, ne tient ni à gauche ni à droite (banc Chrome
     du 16/09/2026). Sans JS, il reste à gauche de la puce. */
  .pb-wrap.is-open .pb-panneau { display: block; }
  @media (min-width: 980px) {
    .pb-wrap:hover .pb-panneau, .pb-wrap:focus-within .pb-panneau { display: block; }
    /* Échap a fermé le panneau et rendu le focus au bouton, qui est DANS la puce : sans cette ligne, :focus-within
       le rouvrait aussitôt — visible, et annoncé fermé (revue Codex n°2). Même poids que les deux règles
       ci-dessus : c'est l'ORDRE qui la fait gagner, elle doit rester APRÈS. header.js la lève dès que le focus
       sort, au survol et au clic suivant. */
    .pb-wrap.is-echap .pb-panneau { display: none; }
  }
  .pb-panneau__tete { display: flex; align-items: center; gap: 10px; }
  .pb-panneau__texte { display: flex; flex-direction: column; min-width: 0; }
  .pb-panneau__titre { display: flex; align-items: center; gap: 7px; min-width: 0; }
  .pb-panneau__texte strong { font-size: 14px; }
  .pb-panneau__texte small { color: var(--color-text-muted); font-size: 12.5px; }
  /* P2 (17/09/2026) : la liste est rangée par famille et le métal a quitté le nom pour une pastille de rang à droite.
     Le trait de séparation est porté par le PREMIER titre, plus par la liste : sinon chaque famille en dessinait un. */
  .pb-panneau__fam {
    margin: 8px 0 0; padding-top: 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .03em;
    text-transform: uppercase; color: var(--color-text-muted);
  }
  .pb-panneau__fam:first-of-type { border-top: 1px solid var(--color-border); }
  .pb-panneau__liste { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
  .pb-panneau__liste li { display: flex; align-items: center; gap: 8px; }
  .pb-panneau__nom { min-width: 0; flex: 1 1 auto; }
  .pb-panneau__rang {
    flex: 0 0 auto; padding: 1px 8px; border-radius: 99px; border: 1px solid;
    font-size: 12.5px; font-weight: 700; white-space: nowrap;
  }
  .pb-panneau__rang--n1 { background: var(--pb-bro-f); color: var(--pb-bro-t); border-color: #e8d5c4; }
  .pb-panneau__rang--n2 { background: var(--pb-arg-f); color: var(--pb-arg-t); border-color: #dfe2e7; }
  .pb-panneau__rang--n3 { background: var(--pb-or-f); color: var(--pb-or-t); border-color: #f3d55b; }
  .pb-panneau__rang--n4 { background: var(--pb-pla-f); color: var(--pb-pla-t); border-color: #b9ecf5; }
  .pb-panneau__rang--n5 { background: var(--pb-dia-f); color: var(--pb-dia-t); border-color: #ddc9fb; }
  .pb-panneau__plus { margin: 6px 0 0; color: var(--color-text-muted); font-size: 12.5px; }
  .pb-panneau__fiche { display: block; margin-top: 6px; padding: 10px 0 2px; color: var(--color-success); font-weight: 700; text-decoration: none; }
  .pb-panneau__fiche:hover { text-decoration: underline; }

  /* La rangée de la tuile « Mes badges » : hauteur FIXE, quatre miniatures au plus. */
  .top-mm-minis { display: flex; gap: 4px; margin-top: 6px; height: 24px; }

  /* LE MUR (la fiche) : trois familles, ce qui est gagné en couleur, le reste en gris avec ce qu'il manque. */
  .pb-mur { display: grid; gap: 4px; }
  .pb-mur__fam { margin: 12px 0 8px; font-size: 14px; font-weight: 700; }
  .pb-mur__fam:first-child { margin-top: 0; }
  .pb-mur__fam span { font-weight: 400; color: var(--color-text-muted); font-size: 13px; }
  .pb-mur__grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
  .pb-mur__b {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #fff;
  }
  .pb-mur__b--attente { background: var(--color-surface-soft); }
  .pb-mur__texte { min-width: 0; flex: 1 1 auto; }
  .pb-mur__nom { font-weight: 700; font-size: 14px; line-height: 1.25; }
  /* « Le Podium (points XP) » (Xavier 05/11/2026) : la précision à droite du nom, PAS en gras, 12,5 px (rien sous 12,5 px
     sur ce site), même couleur que le nom. Sur le mur ET dans le panneau ; « (points XP) » ne se coupe jamais en deux. */
  .pb-nom-precision { font-weight: 400; font-size: 12.5px; white-space: nowrap; }
  .pb-mur__b--attente .pb-mur__nom { color: var(--color-text-muted); }
  .pb-mur__quoi { color: var(--color-text-muted); font-size: 12.5px; line-height: 1.3; margin-top: 1px; }
  /* LES CINQ CRANS (« A + C », Xavier 17/09/2026) — ils remplacent la barre pleine, qui montrait une progression sans
     jamais dire vers quoi. Un cran par niveau : gagné = son métal ; pas encore gagné = gris ; et les deux derniers, tant
     qu'ils ne sont pas gagnés, sont HACHURÉS — la place du platine et du diamant se voit, elle ne s'offre pas, exactement
     comme l'anneau cannelé qu'on ne montre qu'une fois gagné. ⛔ Aucun cran ne se colore AVANT d'être gagné (Xavier
     27/09/2026) : le cran en cours se remplissait dans la couleur du métal visé, et « Niveau 2 sur 5 · argent » avait
     de l'or dessous. Les bornes écrivent les deux extrémités de l'échelle (12,5 px : rien sous 12,5 px sur ce site). */
  .pb-mur__crans { display: flex; gap: 3px; margin-top: 7px; }
  .pb-cran { flex: 1 1 0; height: 8px; border-radius: 2px; background: #eceef1; }
  .pb-cran--f1 { background: var(--pb-bro); }
  .pb-cran--f2 { background: var(--pb-arg); }
  .pb-cran--f3 { background: var(--pb-or); }
  .pb-cran--f4 { background: var(--pb-pla); }
  .pb-cran--f5 { background: var(--pb-dia); }
  .pb-cran--haut { background: repeating-linear-gradient(90deg, #d5dbe4 0 3px, #eef1f6 3px 6px); }
  .pb-mur__bornes {
    display: flex; justify-content: space-between; gap: 10px; margin-top: 4px;
    font-size: 12.5px; color: var(--color-text-muted);
  }
  /* LA PASTILLE DE NIVEAU — le métal a quitté le nom pour venir ici, avec sa position : « Niveau 1 sur 5 · bronze ».
     C'est elle qui règle le « il y a deux fois bronze, c'est un bug » : deux badges au même étage disent la même
     position, et une position ne se confond pas avec un nom. */
  .pb-mur__niveau {
    display: inline-block; margin-top: 4px; padding: 2px 9px; border-radius: 99px;
    font-size: 12.5px; font-weight: 700; border: 1px solid; white-space: nowrap; max-width: 100%;
  }
  .pb-mur__niveau--n1 { background: var(--pb-bro-f); color: var(--pb-bro-t); border-color: #e8d5c4; }
  .pb-mur__niveau--n2 { background: var(--pb-arg-f); color: var(--pb-arg-t); border-color: #dfe2e7; }
  .pb-mur__niveau--n3 { background: var(--pb-or-f); color: var(--pb-or-t); border-color: #f3d55b; }
  .pb-mur__niveau--n4 { background: var(--pb-pla-f); color: var(--pb-pla-t); border-color: #b9ecf5; }
  .pb-mur__niveau--n5 { background: var(--pb-dia-f); color: var(--pb-dia-t); border-color: #ddc9fb; }
  .pb-mur__rare { margin-top: 5px; font-size: 12.5px; color: var(--color-text-muted); } /* rien sous 12,5 px (règle du site) */
  /* LA CIBLE (refonte du 16/09/2026) : une seule, sous la vitrine — « Le plus proche : Le Juge, bronze dans 6 votes ». */
  .pb-mur__cible {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px dashed var(--color-border-strong, #b6c0cf);
    border-radius: var(--radius-md, 6px);
    background: var(--color-surface-soft, #f8fafc);
    font-size: 13.5px;
    line-height: 1.35;
  }
  .pb-mur__aller { color: var(--color-success); font-weight: 700; text-decoration: none; white-space: nowrap; }
  .pb-mur__aller:hover, .pb-mur__aller:focus-visible { text-decoration: underline; }
  .pb-mur__vide { margin: 0; color: var(--color-text-muted); font-size: 13.5px; line-height: 1.4; }
  .pb-mur__tous { margin: 10px 0 0; font-size: 13.5px; }
  .pb-mur__tous a { color: var(--color-success); font-weight: 700; text-decoration: none; }
  .pb-mur__tous a:hover, .pb-mur__tous a:focus-visible { text-decoration: underline; }
  @media (max-width: 979px) {
    .pb-mur__grille { grid-template-columns: 1fr; }
  }

  /* ══════════════════════════════════════════════════════════════
   *  .side-cmp — le bloc « Quel site pour parier ? » (300×100) de la colonne
   *  de droite, sous « Résultats de nos pronostics » (26/09/2026, Xavier : B1,
   *  emplacement 2). Markup : partials/blocks/comparateur-promo.php. Couleurs
   *  en variables locales (le doré = le jeton du bouton « Parier » du menu).
   * ══════════════════════════════════════════════════════════════ */
  .side-cmp {
    --side-cmp-deep: #0c3320;
    --side-cmp-green: #14663c;
    --side-cmp-gold: var(--palette-orange-500, #ffc235);
    --side-cmp-gold-ink: #2b1d00;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    max-width: 300px;
    height: 100px;
    margin: 0 auto;
    padding: 0 12px 0 14px;
    overflow: hidden;
    border-radius: var(--radius-md, 6px);
    color: #fff;
    text-decoration: none;
    background: linear-gradient(115deg, var(--side-cmp-deep) 0%, var(--side-cmp-green) 70%, #1a7a48 100%);
  }
  .side-cmp::before {
    content: "";
    position: absolute;
    right: -30px;
    top: -40px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
  }
  .side-cmp__txt { position: relative; min-width: 0; flex: 1 1 auto; }
  .side-cmp__kicker { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--side-cmp-gold); margin-bottom: 3px; }
  .side-cmp__title { display: block; font-size: 17px; line-height: 1.15; font-weight: 800; letter-spacing: -.1px; color: #fff; }
  .side-cmp__sub { display: block; font-size: 11px; line-height: 1.25; color: #d3e9dc; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-cmp__cta {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-md, 6px);
    background: var(--side-cmp-gold);
    color: var(--side-cmp-gold-ink);
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14);
  }
  .side-cmp__cta::after { content: "›"; font-size: 18px; margin-left: 5px; line-height: 1; }
  .side-cmp:hover .side-cmp__cta { filter: brightness(1.05); }
  /* La colonne du site empile ses cartes sans gouttière (--rail-gap: 0) : la carte des résultats
     porte déjà 14 px sous elle, le bloc en met 14 sous lui avant la zone collée. */
  .right-col-sidebar .side-cmp { margin-bottom: 14px; }

  /* ══════════════════════════════════════════════════════════════
   *  .pel — la carte « Parier en ligne » (partials/blocks/parier-en-ligne.php),
   *  version B de Xavier (06/11/2026) : les blocs du header, un book par
   *  tranche (logo, puis ligne 1 et ligne 2 en pleine largeur), habillée
   *  COMME « Résultats de nos pronostics » (.rsb, app.css) : même bandeau vert
   *  du titre, même filet entre les tranches, même pied gris clair. Les valeurs
   *  du bandeau et du pied sont celles de .rsb-head / .rsb-foot, recopiées
   *  (app.css n'est pas touché) : le banc bin/test_parier_en_ligne.php vérifie
   *  qu'elles restent égales — changer l'une sans l'autre le fait échouer.
   *  Couleurs et tailles des lignes : header.generated.css (l'admin), par la
   *  classe .top-bookmaker-line et ses attributs data-bm-id / data-bm-line.
   *  En @layer components : passe devant .card / .home-sidebar-card h2 /
   *  .layout-course .card h2 (@layer legacy) sans !important.
   *
   *  LE MILIEU = DES CARTES SÉPARÉES (Xavier 07/11/2026, choix A sur visuel :
   *  « le titre est bon et le bas footer aussi avec le lien ! au milieu fait
   *  d'autres propositions visuels. il faut bien différencier chaque book !
   *  leur logo doivent avoir la même hauteur ») : chaque book est sa propre
   *  carte blanche bordée, posée sur le fond gris clair du milieu, 10 px
   *  d'écart ; tous les logos à 28 px de haut. Avant (06/11) : un filet fin
   *  entre les books, logos dans un cadre 130 × 36 px.
   *
   *  HAUTEUR COMPTÉE (zone épinglée < écran, layout.css, seuil 735 px) : la
   *  carte fait ~437 px et reste seule dans la zone épinglée depuis que TRITURF
   *  défile (06/11) ; colonne à côté des commentaires : seuils de social.css.
   *
   *  PLEINE LARGEUR (page simple, pages 404, sous les commentaires sur
   *  téléphone et tablette) : les cartes des books se rangent côte à côte,
   *  base 240 px comme les anciens boutons (dans 300 px, une seule par rangée),
   *  10 px d'écart en colonne comme en rangée.
   * ══════════════════════════════════════════════════════════════ */
  .card.pel {
    padding: 0;
    overflow: hidden; /* le bandeau épouse l'arrondi de la carte */
  }
  .card.pel .pel-head {
    margin: 0;
    background: #1b764f;
    color: var(--color-text-inverse);
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    text-align: center;
  }
  .pel .pel-books {
    padding: 10px;
    background: var(--color-surface-canvas);
  }
  .pel .pel-books-in {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .pel .pel-book {
    flex: 1 1 240px;
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 10px;
    color: inherit;
    text-decoration: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
  }
  /* LA MÊME HAUTEUR POUR TOUS LES LOGOS : 28 px (Xavier 07/11/2026, « leur logo doivent
     avoir la même hauteur »). La largeur suit le logo : PMU PLAY (6 fois plus large que
     haut) ~171 px, ZETURF et Genybet ~60. ⚠️ Le fichier de Genybet a des bandes vides en
     haut et en bas : son dessin n'occupe qu'environ les trois quarts des 28 px. */
  .pel .pel-logo {
    display: block;
    width: auto;
    height: 28px;
    max-width: 100%;
  }
  .pel .pel-book .top-bookmaker-line {
    box-sizing: border-box;
    width: 100%;
    max-width: 360px;
    padding: 5px 8px;
    border-radius: 6px;
  }
  /* Une ligne 1 sur fond blanc (Genybet) garde un bord, sinon elle se perd dans la carte. */
  .pel .pel-book .top-bookmaker-line[data-bm-line="line1"] { box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12); }
  .pel .pel-vide { margin: 0; padding: 12px; }
  .pel .pel-note { margin: 0; padding: 0 12px 10px; }
  .pel .pel-foot {
    display: block;
    padding: 9px 10px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-soft);
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-link);
    text-decoration: none;
  }
  .pel .pel-foot:hover { text-decoration: underline; }
  /* Le cadre du clavier (Tab) DEDANS : le cadre global est posé 2 px autour du lien
     (:where(a…):focus-visible plus haut), et la carte rogne ce qui dépasse — le pied
     touche ses bords (audit Codex 06/11/2026 ; à l'époque un seul book perdait aussi tout
     son cadre). Dedans aussi pour les cartes des books, par cohérence. */
  .pel .pel-book:focus-visible,
  .pel .pel-foot:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: -3px;
  }
}
