/* ════════════════════════════════════════════════════════════════════
   BoB — feuille unique de composants (docs/PLAN-UI-UX.md, D3).
   Bouton, champ, tableau, message, carte, fenêtre de confirmation, barre
   d'enregistrement. Chargée juste après app.css (jetons et socle), par
   views/partials/head.ejs. Une feuille de module peut contextualiser un
   composant (.matrice .btn-ghost), jamais le redéfinir globalement : le
   garde-fou backend/core/ui-cliquet.test.js le vérifie.
   ════════════════════════════════════════════════════════════════════ */
    /* ═══════════ Tableaux éditoriaux ═══════════ */
    /* Respiration en début/fin de ligne : le survol pose un fond pleine
       largeur (+ barre d'accent à gauche), le contenu ne doit pas toucher
       les bords du bloc. */
    .ed-table { width: 100%; border-collapse: collapse; font-family: var(--font-body); }
    .ed-table thead th {
      text-align: left;
      font-weight: 600;
      font-size: var(--fs-sm);
      letter-spacing: 0.01em;
      color: var(--ink-soft);
      padding: 16px 24px 16px 0;
      border-bottom: 1px solid var(--ink-line-strong);
      white-space: nowrap;
    }
    .ed-table thead th:first-child { padding-left: 16px; }
    .ed-table thead th:last-child { padding-right: 16px; text-align: right; }
    .ed-table tbody td {
      padding: 24px 24px 24px 0;
      border-bottom: 1px solid var(--ink-line);
      vertical-align: middle;
      font-size: var(--fs-md);
      color: var(--ink);
    }
    .ed-table tbody td:first-child { padding-left: 16px; }
    .ed-table tbody td:last-child { padding-right: 16px; text-align: right; }
    .ed-table tbody tr { transition: background .15s; }
    /* Ligne qui ouvre une fiche (docs/PLAN-LIGNES-DE-TABLEAU.md, D1, D2) : un
       seul vrai lien, sur la cellule qui nomme l'objet, étendu à toute la
       ligne par son ::after. Les autres commandes de la ligne passent dessus.
       Seule cette ligne s'éclaire au survol (D3) : une ligne qui n'ouvre rien
       ne promet rien. */
    .ed-table tbody tr.ligne-lien { position: relative; cursor: pointer; }
    .ed-table tbody tr.ligne-lien:hover { background: var(--ink-wash); }
    .ed-table tbody tr.ligne-lien:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
    .ligne-lien-cible { color: var(--ink); }
    .ligne-lien-cible::after { content: ""; position: absolute; inset: 0; }
    .ligne-lien :is(a:not(.ligne-lien-cible), button, input, select, textarea, label, summary) { position: relative; z-index: 1; }

    /* ═══════════ Fiche — libellé, valeur, Copier (docs/PLAN-FICHES-COPIABLES.md) ═══════════
       .datalist.fiche : une seule écriture pour toutes les valeurs, les
       actions dans une colonne fixe, largeur bornée pour que Copier reste près
       de sa valeur. Ligne simple : partials/fiche-ligne. [data-fiche-copie]
       sur la liste : une ligne qui porte Copier s'éclaire et se copie d'un
       clic (app.js) ; seule une ligne qui fait quelque chose s'éclaire
       (plan des lignes de tableau, D3), sans le filet bleu des fiches à ouvrir.
       Une valeur encore masquée ([data-reveal] non pressé) ne se copie pas. */
    .datalist.fiche { max-width: 880px; }
    .datalist.fiche > div { grid-template-columns: 200px minmax(0, 1fr); align-items: center; padding: var(--sp-3) 0; }
    .datalist.fiche dd {
      display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--sp-4);
      font-family: var(--font-body); font-size: var(--fs-md); font-weight: 500; letter-spacing: 0;
    }
    .fiche-valeur { overflow-wrap: anywhere; }
    .fiche-valeur.is-long { white-space: pre-wrap; font-weight: 400; }
    .fiche-vide { color: var(--ink-mute); }
    .fiche-suite { color: var(--ink-mute); font-size: var(--fs-sm); font-weight: 400; }
    .fiche-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }
    .datalist.fiche .btn-sm { padding: var(--sp-2) var(--sp-3); }
    [data-fiche-copie] > div { transition: background .15s, box-shadow .15s; }
    [data-fiche-copie] > div:has([data-copy]):not(:has([data-reveal][aria-pressed="false"])) { cursor: pointer; }
    /* Le fond déborde de --sp-3 de chaque côté par deux ombres décalées, sans
       marge négative : une marge négative faisait défiler à l'horizontale un
       conteneur à défilement (panneau de la fiche contact). */
    [data-fiche-copie] > div:has([data-copy]):not(:has([data-reveal][aria-pressed="false"])):hover {
      background: var(--ink-wash);
      box-shadow: calc(-1 * var(--sp-3)) 0 0 var(--ink-wash), var(--sp-3) 0 0 var(--ink-wash);
    }
    @media (max-width: 640px) {
      .datalist.fiche > div { grid-template-columns: 1fr; gap: var(--sp-1); }
    }
    /* Focus clavier : l'anneau entoure la ligne, pas le seul nom. Contour
       transparent (et non supprimé) : il reste visible en contraste forcé. */
    .ligne-lien-cible:focus-visible { outline-color: transparent; }
    .ligne-lien-cible:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
    .td-strong { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
    .td-mute   { color: var(--ink-soft); font-size: var(--fs-sm); }

    /* ═══════════ Pills & status ═══════════ */
    .pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-family: var(--font-body);
      font-weight: 700;
      font-size: var(--fs-xs);
      letter-spacing: 0.06em;
      text-transform: uppercase;
      padding: 4px 12px;
      border: 1px solid var(--ink-line-strong);
      color: var(--ink);
      border-radius: var(--r-sm);
      white-space: nowrap;
  }
    .pill::before {
      content: "";
      width: 6px; height: 6px;
      border-radius: var(--r-rond);
      background: var(--ink-soft);
    }
    .pill-ok   { color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
    .pill-ok::before   { background: var(--ok); }
    .pill-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
    .pill-warn::before { background: var(--warn); }
    .pill-err  { color: var(--err);  border-color: color-mix(in srgb, var(--err) 30%, transparent); }
    .pill-err::before  { background: var(--err); }
    .pill-info { color: var(--bleu-encre); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
    .pill-info::before { background: var(--accent); }
    .pill-plain { padding: 4px 12px; border: 1px solid var(--ink-line); color: var(--ink-soft); }
    .pill-plain::before { display: none; }

    /* ═══════════ Boutons éditoriaux ═══════════ */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      font-family: var(--font-body);
      font-weight: 600;
      font-size: var(--fs-sm);
      letter-spacing: 0.08em;
      text-transform: uppercase;
      padding: 16px 24px;
      border-radius: var(--r-sm);
      transition: background .2s, color .2s, border-color .2s, transform .2s, box-shadow .2s;
      cursor: pointer;
      border: 1px solid transparent;
      white-space: nowrap;
    }
    .btn-primary {
      background: var(--ink);
      color: var(--paper);
      border-top: 3px solid var(--accent);
      border-radius: 0;
      padding-top: 12px;
      box-shadow: 0 1px 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
    }
    .btn-primary:hover {
      background: var(--accent);
      color: var(--sur-accent);
      border-top-color: var(--accent);
      box-shadow: 0 2px 0 0 var(--ink);
    }
    .btn-ghost {
      background: transparent;
      color: var(--ink);
      border-color: var(--ink-line-strong);
    }
    .btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--ink-wash); }
    .btn-accent {
      background: var(--accent-soft);
      color: var(--bleu-encre);
      border-color: color-mix(in srgb, var(--accent) 50%, transparent);
    }
    .btn-accent:hover {
      background: var(--accent);
      color: var(--sur-accent);
      border-color: var(--accent);
    }
    .btn-success {
      background: color-mix(in srgb, var(--ok) 10%, transparent);
      color: var(--ok);
      border-color: color-mix(in srgb, var(--ok) 50%, transparent);
    }
    .btn-success:hover {
      background: var(--ok);
      color: var(--paper);
      border-color: var(--ok);
    }
    .btn-danger {
      background: color-mix(in srgb, var(--err) 8%, transparent);
      color: var(--err);
      border-color: color-mix(in srgb, var(--err) 45%, transparent);
    }
    .btn-danger:hover {
      background: var(--err);
      color: var(--paper);
      border-color: var(--err);
    }
    .btn-sm { padding: 12px 16px; font-size: var(--fs-xs); gap: 8px; letter-spacing: 0.06em; }
    .btn-sm.btn-primary { padding-top: 8px; }
    .btn .arrow { font-size: var(--fs-md); transition: transform .25s; }
    /* Icône au trait (remplace les emojis, D12) : suit la couleur du texte. */
    .ico { display: inline-block; width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.15em; }
    .ico > svg { display: block; width: 100%; height: 100%; }
    .btn:hover .arrow { transform: translate(2px, -2px); }
    .btn:disabled { opacity: .4; cursor: not-allowed; }

    /* ═══════════ Formulaires éditoriaux ═══════════ */
    .field { display: flex; flex-direction: column; gap: 8px; }
    /* Labels de formulaire en bas-de-casse : lus tous les jours, ils gagnent
       en vitesse de lecture et en contraste. Les capitales espacées restent
       réservées aux accents structurels (sections, kickers, en-têtes). */
    .field-label {
      font-family: var(--font-body);
      font-weight: 600;
      font-size: var(--fs-sm);
      letter-spacing: 0;
      text-transform: none;
      color: var(--ink);
    }
    .field-hint {
      font-size: var(--fs-sm);
      color: var(--ink-soft);
      margin-top: -2px;
    }
    .input, .select, .textarea {
      width: 100%;
      font-family: var(--font-display);
      font-weight: 500;
      font-size: var(--fs-champ);
      letter-spacing: -0.005em;
      color: var(--ink);
      background: var(--ink-wash);
      padding: 12px 16px;
      border: 1px solid var(--ink-line-strong);
      border-bottom: 2px solid var(--ink-line-strong);
      border-radius: var(--r-sm);
      transition: border-color .2s, background .2s, box-shadow .2s;
      outline: none;
      appearance: none;
    }
    .input::placeholder, .textarea::placeholder { color: var(--ink-faint); font-weight: 400; }
    .input:hover, .select:hover, .textarea:hover {
      border-color: var(--ink-soft);
    }
    .input:focus, .select:focus, .textarea:focus {
      border-color: var(--accent);
      border-bottom-color: var(--accent);
      background: var(--paper);
      box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
    }
    .textarea { min-height: 100px; padding-top: 12px; resize: vertical; line-height: 1.5; font-size: var(--fs-md); }
    .select {
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 12px center;
      padding-right: 40px;
      cursor: pointer;
    }

    .form-row {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 32px 32px;
    }
    .form-row.cols-1 { grid-template-columns: 1fr; }
    .form-row .col-full { grid-column: 1 / -1; }
    @media (max-width: 640px) { .form-row { grid-template-columns: 1fr; gap: 24px; } }

    .checkbox {
      display: inline-flex;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      font-size: var(--fs-md);
      color: var(--ink);
    }
    .checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

    /* ═══════════ Alerts (bandeau hairline) ═══════════ */
    .alert {
      display: flex;
      align-items: flex-start;
      gap: 16px;
      padding: 16px 20px;
      border: 1px solid var(--ink-line);
      border-left: 3px solid var(--ink-soft);
      font-size: var(--fs-md);
      color: var(--ink);
      margin-bottom: 24px;
    }
    .alert-ok   { border-left-color: var(--ok);     background: color-mix(in srgb, var(--ok)   4%, transparent); }
    .alert-warn { border-left-color: var(--warn);   background: color-mix(in srgb, var(--warn) 4%, transparent); }
    .alert-err  { border-left-color: var(--err);    background: color-mix(in srgb, var(--err)  4%, transparent); }
    .alert-info { border-left-color: var(--accent); background: var(--accent-soft); }
    .alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

    /* ═══════════ Table — wrapper de scroll horizontal ═══════════ */
    .table-scroll {
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
      position: relative;
    }
    .table-scroll::after {
      content: "";
      position: absolute;
      top: 0; right: 0; bottom: 0;
      width: 28px;
      pointer-events: none;
      background: linear-gradient(to right, transparent, color-mix(in srgb, var(--paper) 88%, transparent));
      opacity: 0;
      transition: opacity .2s;
    }
    .table-scroll[data-overflow="true"]::after { opacity: 1; }
    /* Sur mobile, indication de scroll horizontal */
    @media (max-width: 880px) {
      .table-scroll { box-shadow: inset -1px 0 0 var(--ink-line); }
    }

    /* ═══════════ Empty state ═══════════ */
    .empty-state {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
      padding: clamp(40px, 7vw, 80px) clamp(20px, 4vw, 40px);
      border-top: 1px solid var(--ink-line);
      border-bottom: 1px solid var(--ink-line);
    }
    .empty-state.is-centered { align-items: center; text-align: center; border: 1px dashed var(--ink-line); }
    .empty-state-k {
      font-family: var(--font-body);
      font-weight: 500;
      font-size: var(--fs-xs);
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--ink-faint);
    }
    .empty-state-h {
      margin: 4px 0 0;
      font-family: var(--font-display);
      font-weight: 600;
      font-size: clamp(22px, 2.6vw, 30px);
      letter-spacing: -0.025em;
      line-height: 1.1;
      color: var(--ink);
    }
    .empty-state-sub {
      margin: 0;
      color: var(--ink-mute);
      font-size: var(--fs-md);
      max-width: 50ch;
      line-height: 1.5;
    }
    .empty-state-actions { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }

    /* ═══════════ Texte monospace ═══════════ */
    .text-mono {
      font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
      font-size: var(--fs-sm);
      font-variant-numeric: tabular-nums;
    }

    /* ═══════════ Input désactivé (factorisé) ═══════════ */
    .input:disabled, .select:disabled, .textarea:disabled {
      color: var(--ink-mute);
      background: var(--ink-wash);
      border-bottom-color: var(--ink-line);
      cursor: not-allowed;
      opacity: 1;
    }

    /* ═══════════ Focus visible (accessibilité clavier) ═══════════ */
    :focus { outline: none; }
    :focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 3px;
      border-radius: var(--r-sm);
    }
    .btn:focus-visible { outline-offset: 4px; }
    .input:focus-visible, .select:focus-visible, .textarea:focus-visible {
      outline: 0;
      border-bottom-color: var(--accent);
      box-shadow: 0 1px 0 0 var(--accent);
    }
    a:focus-visible, .ed-link:focus-visible { outline-offset: 4px; }

    /* ═══════════ Texte réservé aux lecteurs d'écran ═══════════
       Légende de tableau, libellé de colonne d'actions, précision d'un bouton :
       lu par les lecteurs d'écran, invisible à l'écran. */
    .sr-only {
      position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
      overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }

    /* ═══════════ Filter bar (factorisé time-approvals / admin-time-leaves) ═══════════ */
    .filter-bar {
      display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
      border-bottom: 1px solid var(--ink-line);
    }
    .filter-link {
      padding: 12px 20px;
      font-family: var(--font-body); font-weight: 600;
      font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase;
      color: var(--ink-soft);
      border-bottom: 3px solid transparent;
      transition: color .15s, border-color .15s, background .15s;
      margin-bottom: -1px;
    }
    .filter-link:hover { color: var(--ink); background: var(--ink-wash); }
    .filter-link.is-active { color: var(--ink); border-bottom-color: var(--accent); }
    .filter-link .count {
      display: inline-block; margin-left: 8px;
      padding: 2px 8px; font-size: var(--fs-xs); font-weight: 700;
      background: var(--ink-wash); color: var(--ink-soft);
      letter-spacing: 0;
    }
    .filter-link.is-active .count { background: var(--accent-soft); color: var(--bleu-encre); }

    /* ═══════════ Action group — boutons d'actions visibles en tableau ═══════════ */
    .action-group {
      display: inline-flex; align-items: center; gap: 8px;
      flex-wrap: nowrap; justify-content: flex-end;
    }
    .action-group form { margin: 0; }

    /* ═══════════ Save bar sticky (formulaires longs) ═══════════ */
    .savebar {
      position: sticky;
      bottom: 0;
      z-index: var(--z-menu);
      background: color-mix(in srgb, var(--paper) 96%, transparent);
      backdrop-filter: saturate(180%) blur(10px);
      -webkit-backdrop-filter: saturate(180%) blur(10px);
      border-top: 1px solid var(--ink-line-strong);
      padding: 16px clamp(20px, 5vw, 64px);
      margin: 0 calc(-1 * var(--pad-x));
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
      flex-wrap: wrap;
    }
    .savebar-info { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; min-width: 0; }
    .savebar-stat { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
    .savebar-stat-k {
      font-family: var(--font-body); font-weight: 600;
      font-size: var(--fs-xs); letter-spacing: 0.01em;
      color: var(--ink-soft);
    }
    .savebar-stat-v {
      font-family: var(--font-display); font-weight: 700;
      font-size: var(--fs-lg); letter-spacing: -0.02em;
      font-variant-numeric: tabular-nums;
      color: var(--ink);
      margin-top: 2px;
    }
    .savebar-stat-v .u { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-soft); margin-left: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
    .savebar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

    /* ═══════════ Help banner — encadré pédagogique discret ═══════════ */
    .help-banner {
      display: flex; align-items: flex-start; gap: 16px;
      padding: 20px 20px;
      background: var(--ink-wash);
      border: 1px solid var(--ink-line);
      border-left: 3px solid var(--accent);
      margin-bottom: 24px;
    }
    .help-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--accent); }
    .help-banner-body, .regle-corps { font-size: var(--fs-sm); line-height: 1.55; color: var(--ink-mute); }
    .help-banner-body strong, .regle-corps strong { color: var(--ink); font-weight: 600; }
    .help-banner-body code, .regle-corps code { font-family: ui-monospace, monospace; background: var(--paper); padding: 1px 8px; font-size: var(--fs-sm); color: var(--ink); border: 1px solid var(--ink-line); }
    .help-banner-h {
      display: block;
      font-family: var(--font-body); font-weight: 600;
      font-size: var(--fs-sm); letter-spacing: 0.01em;
      color: var(--bleu-encre);
      margin-bottom: 8px;
    }

    /* Règle de la page (docs/PLAN-HARMONISATION-TITRES.md, D11) : ce qui ne se devine pas (un plafond, un
       verrou, une conséquence irréversible), sous l'en-tête. Un <details> replié par défaut : une ligne au
       lieu d'un encadré de 60 à 120 px (44 px au doigt), sans script. <summary> d'abord, puis .regle-corps. */
    .regle {
      background: var(--ink-wash);
      border: 1px solid var(--ink-line);
      border-left: 3px solid var(--accent);
      margin-bottom: var(--sp-6);
    }
    .regle > summary {
      display: flex; align-items: center; gap: var(--sp-2);
      padding: var(--sp-2) var(--sp-4);
      font-size: var(--fs-sm); font-weight: 600; color: var(--bleu-encre);
      cursor: pointer; list-style: none; user-select: none;
    }
    .regle > summary::-webkit-details-marker { display: none; }
    .regle > summary::before { content: "▸"; transition: transform .15s; }
    .regle[open] > summary::before { transform: rotate(90deg); }
    .regle > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
    .regle-corps { padding: 0 var(--sp-4) var(--sp-4) calc(var(--sp-4) + 1em); }

    /* ═══════════ Modale de confirmation (remplace window.confirm) ═══════════ */
    .bob-modal {
      position: fixed;
      inset: 0;
      z-index: var(--z-modale);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }
    .bob-modal[data-open="true"] { display: flex; }
    .bob-modal__backdrop {
      position: absolute;
      inset: 0;
      background: var(--voile);
      animation: bobFade .18s ease;
    }
    .bob-modal__panel {
      position: relative;
      width: min(440px, 100%);
      background: var(--paper);
      border: 1px solid var(--ink-line-strong);
      border-top: 3px solid var(--accent);
      box-shadow: var(--ombre-3);
      padding: 32px 32px 24px;
      animation: bobPop .2s cubic-bezier(.2, .8, .3, 1);
    }
    .bob-modal__title {
      font-family: var(--font-display);
      font-weight: var(--w-display);
      font-size: var(--fs-sm);
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--ink);
      margin: 0 0 12px;
    }
    .bob-modal__msg {
      font-size: var(--fs-md);
      line-height: 1.55;
      color: var(--ink-mute);
      white-space: pre-line;
      margin: 0 0 24px;
    }
    .bob-modal__actions {
      display: flex;
      justify-content: flex-end;
      gap: 12px;
      flex-wrap: wrap;
    }
    @keyframes bobFade { from { opacity: 0; } to { opacity: 1; } }
    @keyframes bobPop {
      from { opacity: 0; transform: translateY(8px) scale(.98); }
      to   { opacity: 1; transform: none; }
    }
    @media (prefers-reduced-motion: reduce) {
      .bob-modal__backdrop, .bob-modal__panel { animation: none; }
    }

    /* ═══════════ Densité compacte (préférence utilisateur) ═══════════
       Posée via html.is-compact par le script pré-paint. Resserre les écrans
       riches en données (tableaux, listes, plannings) sans toucher au style
       éditorial « pleine page » des fiches. */
    html.is-compact .ed-table thead th { padding-top: 8px; padding-bottom: 8px; }
    html.is-compact .ed-table tbody td  { padding-top: 12px; padding-bottom: 12px; }
    html.is-compact .section            { padding-top: clamp(var(--sp-4), 2vw, var(--sp-5)); padding-bottom: clamp(var(--sp-4), 2vw, var(--sp-5)); }
    html.is-compact .datalist > div     { padding: 12px 0; }
    html.is-compact .admin-row          { padding-top: 12px; padding-bottom: 12px; }

    /* ═══════════ Toasts — notifications non bloquantes ═══════════
       Empilées en bas-droite, annoncées via aria-live. API : window.bobToast().
       Réutilise la grammaire des .alert (filet gauche coloré). */
    .bob-toasts {
      position: fixed;
      bottom: 20px; right: 20px;
      z-index: var(--z-toast);
      display: flex; flex-direction: column; gap: 12px;
      max-width: min(380px, calc(100vw - 40px));
      pointer-events: none;
    }
    .bob-toast {
      pointer-events: auto;
      display: flex; align-items: flex-start; gap: 12px;
      background: var(--paper);
      border: 1px solid var(--ink-line-strong);
      border-left: 3px solid var(--ink-soft);
      padding: 12px 16px;
      font-size: var(--fs-sm); line-height: 1.45;
      color: var(--ink);
      box-shadow: var(--ombre-2);
      border-radius: var(--r-sm);
      opacity: 0; transform: translateY(8px);
      transition: opacity .22s ease, transform .22s ease;
    }
    .bob-toast.is-in { opacity: 1; transform: none; }
    .bob-toast--ok   { border-left-color: var(--ok); }
    .bob-toast--err  { border-left-color: var(--err); }
    .bob-toast--info { border-left-color: var(--accent); }
    .bob-toast--warn { border-left-color: var(--warn); }
    .bob-toast__msg { flex: 1; min-width: 0; white-space: pre-line; }
    .bob-toast__close {
      flex-shrink: 0; border: 0; background: transparent; cursor: pointer;
      color: var(--ink-faint); font-size: var(--fs-lg); line-height: 1; padding: 0 2px;
      min-width: 32px; min-height: 32px; margin: -8px -8px -8px 0;
    }
    @media (pointer: coarse) { .bob-toast__close { min-width: var(--cible); min-height: var(--cible); margin: -12px -12px -12px 0; } }
    .bob-toast__close:hover { color: var(--ink); }
    @media (prefers-reduced-motion: reduce) {
      .bob-toast { transition: none; opacity: 1; transform: none; }
    }

    /* ═══════════ État de soumission — anti double-envoi ═══════════
       Grise le bouton submit pendant le POST. On NE met PAS button:disabled
       (retirerait name/value du soumetteur du POST) : on bloque par drapeau JS. */
    form.is-submitting [type="submit"] { opacity: .6; pointer-events: none; }
    form.is-submitting [type="submit"] .arrow { opacity: 0; }

    /* ═══════════ Validation inline au blur ═══════════ */
    .input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
      border-bottom-color: var(--err);
    }

    /* ═══════════ Chantier interface (docs/PLAN-UI-UX.md) ═══════════ */

    /* Erreur de champ (D10) : bordure --err sur tout champ refusé, qu'il soit
       un .input ou un champ ad hoc (app.js pose aria-invalid à l'envoi), et
       message persistant sous le champ, lu par aria-describedby. */
    .input:user-invalid, .select:user-invalid, .textarea:user-invalid,
    input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
      border-color: var(--err);
      border-bottom-color: var(--err);
    }
    .field-erreur {
      display: flex; align-items: flex-start; gap: var(--sp-2);
      margin: var(--sp-1) 0 0;
      font-size: var(--fs-sm); font-weight: 600; line-height: 1.4;
      color: var(--err);
    }
    .field-erreur::before { content: "!"; flex: none; width: 16px; height: 16px; border-radius: var(--r-rond); background: var(--err); color: var(--paper); font-size: var(--fs-xs); line-height: 16px; text-align: center; }

    /* Carte (D3) : panneau bordé, pour un objet à part entière (une semaine,
       une personne, une tuile). Pas d'ombre au repos : un filet suffit. */
    .carte {
      background: var(--paper);
      border: 1px solid var(--ink-line-strong);
      border-radius: var(--r-sm);
      padding: var(--sp-5) var(--sp-6);
    }
    .carte-titre { margin: 0 0 var(--sp-3); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); letter-spacing: -0.01em; }
    .carte-k { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-soft); }
    @media (max-width: 640px) { .carte { padding: var(--sp-4); } }

    /* Bouton-icône (D3, D8) : carré, nom accessible obligatoire (aria-label). */
    .btn-icone {
      display: inline-flex; align-items: center; justify-content: center;
      width: var(--cible); height: var(--cible); padding: 0;
      border: 1px solid var(--ink-line-strong); border-radius: var(--r-sm);
      background: transparent; color: var(--ink); cursor: pointer;
    }
    .btn-icone:hover { border-color: var(--ink); background: var(--ink-wash); }
    .btn-icone svg { width: 18px; height: 18px; }

    /* Cibles tactiles de 44 px (D8) : au doigt seulement ; à la souris, le
       rendu ne change pas. */
    @media (max-width: 640px), (pointer: coarse) {
      .btn-sm { min-height: var(--cible); }
      .checkbox { min-height: var(--cible); }
      .checkbox input, .field input[type="checkbox"], .field input[type="radio"] { width: 20px; height: 20px; }
      .filter-link { min-height: var(--cible); }
      .regle > summary { min-height: var(--cible); }
      .crumb a { display: inline-flex; align-items: center; min-height: var(--cible); }
    }

    /* Barre d'enregistrement sur téléphone (D13) : une seule ligne. Les
       libellés longs passent à la ligne dans leur bouton au lieu d'empiler
       les boutons sur toute la largeur. */
    @media (max-width: 640px) {
      .savebar { padding: var(--sp-2) var(--sp-4); gap: var(--sp-2); }
      .savebar-actions { flex-wrap: nowrap; width: 100%; gap: var(--sp-2); }
      .savebar-actions > .btn, .savebar-actions > form > .btn {
        flex: 1 1 0; min-width: 0; min-height: var(--cible);
        white-space: normal; line-height: 1.2; text-align: center;
        padding: var(--sp-2) var(--sp-3); letter-spacing: 0.04em;
      }
      .savebar-actions > form { flex: 1 1 0; min-width: 0; display: flex; margin: 0; }
      .savebar-actions > .btn-ghost { flex: 0 1 auto; }
    }

    /* Tableau défilant (D10) : focalisable quand il déborde (app.js), pour
       défiler au clavier ; l'anneau commun le signale. */
    .table-scroll[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

    /* En-tête de page (docs/PLAN-HARMONISATION-TITRES.md, D1 à D3) : une rangée,
       celle des Contacts. Surtitre et titre à gauche, compte, boutons d'action à
       droite, filet dessous. Le balisage est écrit par views/partials/entete.ejs. */
    .entete {
      display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5);
      padding: var(--sp-5) 0 var(--sp-4); border-bottom: 1px solid var(--ink-line);
    }
    .entete .hero-eyebrow { margin-bottom: var(--sp-2); }
    .entete-titre {
      font-family: var(--font-display); font-weight: var(--w-display);
      font-size: var(--fs-titre); letter-spacing: -0.035em; line-height: 1; margin: 0;
      text-wrap: balance; overflow-wrap: anywhere;
    }
    /* Sans compte, le bloc du titre prend la place et les boutons restent à droite, même devant un titre qui passe sur
       plusieurs lignes ; au doigt il passe seul sur sa ligne et les boutons dessous. */
    .entete:not(:has(.entete-compte)) > div:first-child { flex: 1 1 24rem; min-width: 0; }
    .entete-titre--long { font-size: var(--fs-xl); }
    .entete-compte { margin: 0; flex: 1; min-width: 120px; color: var(--ink-soft); font-size: var(--fs-sm); }
    .entete-compte strong { color: var(--ink); font-family: var(--font-display); font-size: var(--fs-lg); }
    .entete-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
    .entete-actions form { margin: 0; }
    .entete-pastilles { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: var(--sp-3) 0 0; }
    .entete-chapo { flex: 0 0 100%; }
    .entete-chapo p { margin: 0; max-width: 72ch; font-size: var(--fs-sm); color: var(--ink-mute); }
    /* Sous un fil d'Ariane, l'en-tête n'ajoute pas sa propre marge haute (D8). */
    .crumb:has(+ .entete) { padding-top: var(--sp-4); }
    .crumb + .entete { padding-top: var(--sp-3); }
    @media (max-width: 640px) {
      .entete { padding-top: var(--sp-3); }
    }

    /* ═══════════ Utilitaires sur jetons (chargés après les composants) ═══════════
       Remplacent les attributs style="" des vues (D5, C6) : ils doivent
       l'emporter sur la marge propre d'un composant, d'où leur place ici, et
       sur la règle d'une seule classe d'un bloc <style> de vue, d'où la classe
       doublée (.mt-6.mt-6), plutôt qu'un !important. */
    /* Marges sur l'échelle (docs/PLAN-UI-UX.md, D5) : remplacent les style="margin…" des vues. */
    .m-0.m-0 { margin: 0; }
    .mx-0.mx-0 { margin-left: 0; margin-right: 0; }
    .mt-0.mt-0 { margin-top: 0; } .mt-1.mt-1 { margin-top: var(--sp-1); } .mt-2.mt-2 { margin-top: var(--sp-2); } .mt-3.mt-3 { margin-top: var(--sp-3); } .mt-4.mt-4 { margin-top: var(--sp-4); } .mt-5.mt-5 { margin-top: var(--sp-5); } .mt-6.mt-6 { margin-top: var(--sp-6); } .mt-7.mt-7 { margin-top: var(--sp-7); } .mt-8.mt-8 { margin-top: var(--sp-8); } .mt-9.mt-9 { margin-top: var(--sp-9); }
    .mb-0.mb-0 { margin-bottom: 0; } .mb-1.mb-1 { margin-bottom: var(--sp-1); } .mb-2.mb-2 { margin-bottom: var(--sp-2); } .mb-3.mb-3 { margin-bottom: var(--sp-3); } .mb-4.mb-4 { margin-bottom: var(--sp-4); } .mb-5.mb-5 { margin-bottom: var(--sp-5); } .mb-6.mb-6 { margin-bottom: var(--sp-6); } .mb-7.mb-7 { margin-bottom: var(--sp-7); } .mb-8.mb-8 { margin-bottom: var(--sp-8); } .mb-9.mb-9 { margin-bottom: var(--sp-9); }
    .ta-droite.ta-droite { text-align: right; } .ta-centre.ta-centre { text-align: center; } .italique.italique { font-style: italic; }
    /* Partie légère d'un grand titre (« Matrice de <span class="leger">répartition.</span> »). */
    .leger.leger { font-weight: 300; }
    .fs-xs.fs-xs { font-size: var(--fs-xs); } .fs-sm.fs-sm { font-size: var(--fs-sm); } .fs-md.fs-md { font-size: var(--fs-md); } .fs-lg.fs-lg { font-size: var(--fs-lg); }
