/* =============================================================================
 * POPOVERS DE LA TOPBAR (menu mobile, notifications, compte, dossiers clients)
 * Le squelette est rendu par shell.js ; ici, uniquement l'habillage.
 * ============================================================================= */
.topbar-popover-wrap { position: relative; display: inline-block; }
.topbar-popover {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
  min-width: 280px; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-4); box-shadow: var(--shadow-4);
  padding: 6px; font-size: 13.5px;
}
.topbar-popover[hidden] { display: none; }
.topbar-popover__head {
  padding: 8px 10px 10px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-3); font-weight: 600;
  border-bottom: 1px solid var(--divider); margin-bottom: 6px;
}
.topbar-popover__head--user {
  display: flex; flex-direction: column; gap: 2px;
  text-transform: none; letter-spacing: normal; font-size: 14px; color: var(--text);
}
.topbar-popover__sub { font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.topbar-popover__item {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 10px;
  border-radius: var(--r-2); color: var(--text); text-decoration: none;
  font-size: 13.5px;
}
.topbar-popover__item:hover { background: var(--surface-2); }
.topbar-popover__item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.topbar-popover__item--active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
/* Un <button> de formulaire qui doit ressembler à un item de menu. */
.topbar-popover__item--btn {
  width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 0; font-family: inherit;
}
.topbar-popover__item--danger { color: var(--danger-text); }
.topbar-popover__item--danger:hover { background: var(--danger-soft); }
.topbar-popover__check { display: inline-flex; width: 14px; flex: 0 0 auto; color: var(--accent); }
.topbar-popover__stack { display: flex; flex-direction: column; min-width: 0; }
.topbar-popover__form { margin: 0; }
.topbar-popover__empty { padding: 18px 10px; text-align: center; color: var(--text-3); font-size: 13px; }
.topbar-popover__foot { padding: 10px; margin-top: 4px; border-top: 1px solid var(--divider); color: var(--text-3); font-size: 12px; }
.topbar-popover__foot kbd { padding: 1px 5px; border-radius: var(--r-1); background: var(--surface-2); border: 1px solid var(--divider); font-family: var(--font-mono); font-size: 11px; }

/* =============================================================================
 * ux.css — Composants UX transverses (Phase 6bis du PLAN-ACTION)
 *  - Glossary popover  (CN-UX01)
 *  - Toast              (CN-UX29)
 *  - Submit spinner     (CN-UX28)
 *  - Password toggle    (CN-UX25)
 *  - Help drawer + FAQ  (CN-UX23)
 *  - Onboarding         (CN-UX20)
 * ============================================================================= */

/* ---------------------------------------------------------------------------
 * 1. Glossary popover — <span class="term">TVQ<button class="term__info">?</button></span>
 * --------------------------------------------------------------------------- */
.term {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.term__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--text-3);
  background: var(--surface);
  color: var(--text-3);
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.term__info:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.term__info:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.term__popover {
  position: absolute;
  bottom: 100%; left: 0;
  margin-bottom: 6px;
  z-index: 200;
  display: block;
  min-width: 240px;
  max-width: 320px;
  padding: 10px 12px;
  background: var(--carbon);
  color: var(--carbon-text);
  border: 1px solid var(--carbon-strong);
  border-radius: var(--r-3);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-3);
  white-space: normal;
}
.term__popover::after {
  content: "";
  position: absolute;
  bottom: -5px; left: 12px;
  width: 9px; height: 9px;
  background: var(--carbon);
  border-right: 1px solid var(--carbon-strong);
  border-bottom: 1px solid var(--carbon-strong);
  transform: rotate(45deg);
}
.term__popover[hidden] { display: none; }

/* ---------------------------------------------------------------------------
 * 2. Toast (notifications non bloquantes)
 * --------------------------------------------------------------------------- */
#toast-stack {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  background: var(--text);
  color: var(--accent-fg);
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: var(--shadow-3);
  animation: toast-in 200ms ease-out;
}
.toast--success { background: var(--ok-text); }
.toast--error   { background: var(--danger-text); }
.toast--leaving { animation: toast-out 220ms ease-in forwards; }

@keyframes toast-in  { from { transform: translateX(40%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateX(40%); opacity: 0; } }

/* Pastille de ton du toast simple (.toast-stack, shell.js) : la couleur vient
   d'une classe, jamais d'un style inline. */
.toast { transition: opacity 200ms ease, transform 200ms ease; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }
.toast--ok .dot     { background: var(--ok); }
.toast--danger .dot { background: var(--danger); }
.toast--warn .dot   { background: var(--warn); }
.toast--info .dot   { background: var(--info); }

/* ---------------------------------------------------------------------------
 * 3. Submit spinner (CN-UX28 — bouton "is-loading")
 * --------------------------------------------------------------------------- */
.btn.is-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--accent-fg);
  animation: btn-spin 700ms linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------------
 * 4. Password toggle  (<button data-password-toggle>)
 * --------------------------------------------------------------------------- */
.field-with-toggle { position: relative; display: flex; align-items: stretch; }
.field-with-toggle .field { padding-right: 40px; flex: 1; }
.password-toggle {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.password-toggle:hover { background: var(--surface-2); }
.password-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------------------
 * 5. Help drawer (FAQ) — bouton flottant + panneau latéral
 * --------------------------------------------------------------------------- */
.help-fab {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-4);
  transition: background 120ms ease, transform 120ms ease;
}
.help-fab:hover { background: var(--accent-hover); transform: translateY(-1px); }
.help-fab:focus-visible { outline: none; box-shadow: var(--shadow-4), var(--focus-ring); }

#help-drawer { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
#help-drawer[data-state="closed"] { visibility: hidden; }
#help-drawer[data-state="open"]   { visibility: visible; pointer-events: auto; }
#help-drawer .help-drawer__backdrop {
  position: absolute; inset: 0;
  background: var(--scrim);
  opacity: 0; transition: opacity 200ms ease;
  cursor: pointer;
}
#help-drawer[data-state="open"] .help-drawer__backdrop { opacity: 1; }
#help-drawer .help-drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--surface);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow-pop);
}
#help-drawer[data-state="open"] .help-drawer__panel { transform: translateX(0); }
.help-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
}
.help-drawer__head h2 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.help-drawer__body { flex: 1 1 auto; overflow-y: auto; padding: 18px; font-size: 14px; line-height: 1.6; }
.help-drawer__intro { margin: 0 0 16px; font-size: 13.5px; color: var(--text-3); }
.help-drawer__body details {
  margin-bottom: 6px; padding: 10px 12px;
  border: 1px solid transparent; border-radius: var(--r-3);
}
.help-drawer__body details:hover { background: var(--surface-2); }
.help-drawer__body details[open] { background: var(--surface-2); border-color: var(--border); }
.help-drawer__body details summary { cursor: pointer; font-weight: 600; color: var(--text); min-height: 24px; }
.help-drawer__body details summary:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-2); }
.help-drawer__body details p { margin: 8px 0 0 0; color: var(--text-2); }
.help-drawer__foot {
  margin-top: 20px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-3);
}
body.help-drawer-open { overflow: hidden; }

/* ---------------------------------------------------------------------------
 * 6. Onboarding (Phase 6bis.3)
 * --------------------------------------------------------------------------- */
.onboarding { max-width: 720px; margin: 0 auto; padding: 24px; }
.onboarding__head { margin-bottom: 28px; }
.onboarding__head h1 { font-size: 26px; margin: 4px 0 8px; }
.onboarding__intro { color: var(--text-2); font-size: 14px; margin: 0; }

.onboarding__steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.onboarding__step {
  display: flex; gap: 14px;
  padding: 16px;
  border: 1px solid var(--divider);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.onboarding__step.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.onboarding__step.is-done    { background: var(--ok-soft); border-color: var(--ok-text); }

.onboarding__step-marker {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 700; font-size: 13px;
}
.is-current .onboarding__step-marker { background: var(--accent); color: var(--accent-fg); }
.is-done    .onboarding__step-marker { background: var(--ok-text); color: var(--accent-fg); }

.onboarding__step-body { flex: 1 1 auto; }
.onboarding__step-title  { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; }
.onboarding__step-detail { margin: 0 0 10px; font-size: 13px; color: var(--text-3); }

.onboarding__footer {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
  margin-top: 24px;
}

/* =============================================================================
 * BANDEAUX DU SHELL (rendus par shell.js, au-dessus du contenu)
 *   --danger : paiement échoué (past_due, §2.6)
 *   --legal  : ré-acceptation des conditions — jaune duplicata (§3.2)
 * ============================================================================= */
.billing-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-3);
  background: var(--surface-2); color: var(--text);
  font-size: 14px;
}
.billing-banner__txt { flex: 1 1 260px; }
.billing-banner__ico { display: inline-flex; flex-shrink: 0; }
.billing-banner__form { margin: 0; flex-shrink: 0; }
.billing-banner__cta { flex-shrink: 0; }
.billing-banner a { color: inherit; }

.billing-banner--danger {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger-text);
}
.billing-banner--danger .billing-banner__ico { color: var(--danger); }

.billing-banner--legal {
  border-color: var(--carbon-strong);
  background: var(--carbon);
  color: var(--carbon-text);
}
.billing-banner--legal .billing-banner__ico { color: var(--carbon-text); }

/* =============================================================================
 * MESSAGES FLASH (succès / erreur / info) — partagés par toutes les vues
 * ============================================================================= */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin-bottom: 16px;
  border: 1px solid var(--border-strong);
  border-left-width: 3px;
  border-radius: var(--r-3);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.alert__ico { display: inline-flex; flex-shrink: 0; margin-top: 1px; }
.alert__txt { flex: 1; min-width: 0; }
.alert__close {
  flex-shrink: 0;
  width: 28px; height: 28px; margin: -2px -4px 0 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-2);
  background: transparent; color: inherit; cursor: pointer; opacity: 0.7;
}
.alert__close:hover { opacity: 1; background: var(--surface-3); }
.alert__close:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.alert.alert-ok,
.alert--ok      { background: var(--ok-soft);     color: var(--ok-text);     border-color: var(--ok); }
.alert.alert-error,
.alert--error   { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger); }
.alert--warn    { background: var(--warn-soft);   color: var(--warn-text);   border-color: var(--warn); }
.alert--info    { background: var(--info-soft);   color: var(--info-text);   border-color: var(--info); }

/* =============================================================================
 * PAGINATION (_partials/_pagination.php)
 * ============================================================================= */
.pagination-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-top: 16px;
}
.pagination-nav__count {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-3);
}
.pagination-nav__sep { color: var(--border-strong); }
.pagination-nav__size { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.pagination-nav__size .field { width: auto; height: 32px; padding: 0 26px 0 8px; font-size: 13px; }
.pagination-nav__pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination-nav__page {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--r-2);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 500;
  color: var(--text-2); text-decoration: none; background: transparent;
}
.pagination-nav__page:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.pagination-nav__page:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pagination-nav__page--current {
  background: var(--accent); border-color: var(--accent); color: var(--accent-fg);
  font-weight: 600; pointer-events: none;
}
.pagination-nav__page--disabled { opacity: 0.4; pointer-events: none; }
.pagination-nav__gap { padding: 0 4px; color: var(--text-3); user-select: none; }
.pagination-nav__arrow { display: inline-flex; }

/* =============================================================================
 * ÉTAT VIDE — pictogramme trait fin, titre court, phrase d'aide, action
 * (affine .empty défini dans tokens.css)
 * ============================================================================= */
.empty { padding: 56px 24px; }
.empty .empty-icon {
  width: 64px; height: 64px;
  border-radius: var(--r-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  margin-bottom: 16px;
}
.empty .empty-icon svg { width: 32px; height: 32px; }
.empty h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.empty p { font-size: 14px; color: var(--text-2); max-width: 42ch; margin: 0 0 16px; }

/* =============================================================================
 * DIALOGUE DE CONFIRMATION (action destructive)
 * ============================================================================= */
.dialog { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.dialog[hidden] { display: none; }
.dialog__backdrop { position: absolute; inset: 0; background: var(--scrim); }
.dialog__panel {
  position: relative;
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-pop);
  padding: 22px;
}
.dialog__title { margin: 0 0 8px; font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.dialog__text { margin: 0 0 20px; font-size: 14px; color: var(--text-2); line-height: 1.55; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dialog__actions .btn { min-height: 40px; }
.btn-danger-solid {
  background: var(--danger); border-color: var(--danger); color: var(--accent-fg);
}
.btn-danger-solid:hover { background: var(--danger-text); border-color: var(--danger-text); }

/* =============================================================================
 * TIROIR D'APERÇU DU DOCUMENT (_invoice_preview_drawer.php)
 * Base commune à toutes les pages qui incluent le partial. La page Paramètres
 * charge ensuite son propre CSS, qui affine ces règles.
 * ============================================================================= */
.preview-drawer { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.preview-drawer[data-state="closed"] { visibility: hidden; }
.preview-drawer[data-state="open"]   { visibility: visible; pointer-events: auto; }
.preview-drawer__backdrop {
  position: absolute; inset: 0;
  background: var(--scrim);
  opacity: 0; transition: opacity 200ms ease; cursor: pointer;
}
.preview-drawer[data-state="open"] .preview-drawer__backdrop { opacity: 1; }
.preview-drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(900px, 100%);
  background: var(--surface);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow-pop);
}
.preview-drawer[data-state="open"] .preview-drawer__panel { transform: translateX(0); }
.preview-drawer__header {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px;
  border-bottom: 2px dashed var(--perfo); /* la souche détachable (§3.5-2) */
}
.preview-drawer__title { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.preview-drawer__tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.preview-drawer__tab {
  min-height: 40px; padding: 8px 16px;
  border: 0; background: transparent;
  border-radius: var(--r-3) var(--r-3) 0 0;
  font: inherit; font-size: 13.5px; cursor: pointer; color: var(--text-2);
}
.preview-drawer__tab:hover { color: var(--text); }
.preview-drawer__tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* Onglet actif = languette carbone (§3.5-4). */
.preview-drawer__tab.is-active {
  background: var(--carbon);
  color: var(--carbon-text);
  font-weight: 600;
  border-top: 3px solid var(--accent);
}
.preview-drawer__body,
.preview-drawer__viewport { flex: 1 1 auto; position: relative; background: var(--surface-2); min-height: 0; }
.preview-drawer__viewport iframe { width: 100%; height: 100%; border: 0; display: block; }
.preview-drawer__footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--surface);
}
body.preview-drawer-open { overflow: hidden; }

/* =============================================================================
 * MOUVEMENT RÉDUIT — composants transverses
 * ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  .toast,
  .help-fab,
  .onboarding__step,
  .alert__close { transition: none; }
  .toast { animation: none; }
  #help-drawer .help-drawer__panel,
  #help-drawer .help-drawer__backdrop,
  .preview-drawer__panel,
  .preview-drawer__backdrop { transition: none; }
  .help-fab:hover { transform: none; }
}

/* Cadenas de feature dans la nav (§2.6) — l'habillage vit dans shell.css. */

/* =============================================================================
 * SIGNATURES « LE CARNET » (PLAN_BUILD_UI_V2 §3.5) — étape 0
 * L'univers du carnet de factures à papier carbone. À utiliser EXACTEMENT
 * là où le plan l'indique : un clin d'œil de trop et l'écran devient kitsch.
 * ============================================================================= */

/* --- 1. NUMÉRO ESTAMPÉ : toute référence de document (FAC-2026-042) --------- */
.numero-estampe {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-2);
  background: var(--numero-soft);
  color: var(--numero-text);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.numero-estampe--lg { font-size: 17px; padding: 4px 10px; }

/* --- 2. PERFORATION : la souche détachable, sous chaque h1 ------------------ */
.perforation {
  position: relative;
  height: 0;
  margin: 14px 0 16px;
  border-bottom: 2px dashed var(--perfo);
}
.perforation::before,
.perforation::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--perfo);
}
.perforation::before { left: -4px; }
.perforation::after  { right: -4px; }

/* --- 3. TAMPON : statut fort (fiche, portail, aperçu SEULEMENT) ------------- */
.tampon {
  display: inline-flex; align-items: center;
  padding: 5px 14px;
  transform: rotate(-4deg);
  border: 2px double currentColor;
  border-radius: var(--r-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tampon--ok     { color: var(--stamp-ok); }
.tampon--danger { color: var(--stamp-danger); }

/* --- 4. LANGUETTE CARBONE : onglet / filtre ACTIF --------------------------- */
.languette {
  position: relative;
  background: var(--carbon);
  color: var(--carbon-text);
  font-weight: 600;
  border-top: 3px solid var(--accent);
  border-radius: var(--r-3) var(--r-3) 0 0;
}

/* --- 5. FILET DE TOTAL : ligne de total d'une table d'argent ---------------- */
.filet-total > td,
.filet-total > th,
td.filet-total,
tr.filet-total > * {
  border-top: 3px double var(--text);
  font-weight: 600;
}

/* --- PATRON DE PAGE : eyebrow → h1 → perforation → sous-titre → actions ----- */
.page-head { margin-bottom: 22px; }
.page-head__eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.page-head__eyebrow::before {
  content: "";
  width: 16px; height: 3px;
  border-radius: 2px;
  background: var(--numero);
  flex-shrink: 0;
}
.page-head__row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.page-head__lede {
  margin: 0;
  font-size: 15px;
  color: var(--text-2);
  max-width: 62ch;
}
.page-head__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 768px) {
  .page-head h1 { font-size: 24px; }
  .page-head__row { flex-direction: column; align-items: stretch; }
  .page-head__actions .btn { width: 100%; }
}

/* --- Table d'argent : défilement CONTENU sur mobile (jamais en cartes) ------ */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  /* Sans cela, place dans une grille ou un flex, le conteneur refuse de
     devenir plus etroit que sa table : il ne defile jamais, il pousse. */
  min-width: 0;
}
/* Une zone qui défile à la souris doit défiler au clavier.
   Le conteneur reçoit tabindex="0" (posé par ux.js) : ce focus doit se voir,
   sinon la personne ne sait pas que les flèches vont bouger le tableau. */
.table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.table-scroll table { min-width: 100%; }

/* --- Montants et chiffres tabulaires ---------------------------------------- */
.montant {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.montant--heros { font-size: 30px; font-weight: 600; line-height: 1.1; }

@media (prefers-reduced-motion: reduce) {
  .tampon { transform: none; }
}

/* ============================================================
   Sélecteur de langue visible (vitrine + connexion/inscription).
   La détection navigateur reste le repli — jamais le seul chemin.
   ============================================================ */
.lang-switch { display: inline-flex; gap: 2px; align-items: center; }
.lang-switch a {
  /* Cible tactile : changer de langue au doigt, sans viser. 32 x 26 px
     obligeait à s'y reprendre à deux fois. */
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  padding: 4px 8px; border-radius: var(--r-2); font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em; text-decoration: none; color: var(--text-2);
}
.lang-switch a:hover { background: var(--surface); color: var(--text); }
.lang-switch a[aria-current="true"] { background: var(--surface); color: var(--text); }
.lang-switch--auth { justify-content: flex-end; margin-bottom: 8px; }

/* « Défaire » : offert dans le message qui suit une action réversible. */
.undo-form { display: inline; margin-left: 10px; }
.undo-btn {
  background: none; border: 0; padding: 0 2px; cursor: pointer;
  font: inherit; font-weight: 600; color: inherit;
  text-decoration: underline; text-underline-offset: 2px;
  min-height: 44px;
}
.undo-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-1); }

/* =============================================================================
 * RÉCAPITULATIF DES ERREURS DE VALIDATION (nœud A4)
 * -----------------------------------------------------------------------------
 * Un formulaire refusé revenait identique, sans un mot. C'est le moment exact
 * où quelqu'un qui n'est pas à l'aise avec l'informatique abandonne. Ce bloc
 * s'affiche en haut de page, dit ce qui manque, et rassure sur ce qui a été
 * tapé : rien n'est perdu.
 * ========================================================================== */
.valid-recap {
  margin: 0 auto 18px;
  max-width: 1120px;
  padding: 16px 18px;
  border: 1px solid var(--danger-border, var(--border-strong));
  border-left: 4px solid var(--danger-text, var(--text));
  border-radius: var(--r-3);
  background: var(--danger-surface, var(--surface-2));
  color: var(--text);
}
.valid-recap:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.valid-recap__titre {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 6px;
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  color: var(--danger-text, var(--text));
}
.valid-recap__ico { display: inline-flex; flex: 0 0 auto; }
.valid-recap__aide { margin: 0 0 10px; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.valid-recap__liste { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.valid-recap__liste li { font-size: 15px; line-height: 1.5; }
.valid-recap__liste a { color: var(--text); text-decoration: underline; }
.valid-recap__liste a:hover { color: var(--accent-text); }

@media (max-width: 640px) {
  .valid-recap { margin-left: 12px; margin-right: 12px; padding: 14px; }
}
