/* ==========================================================================
   RÉSA-VTC-63 — Nouveaux composants uniquement  (.wt-* / .mb-*)
   Design system : RÉSA-VTC-63 Design System — src/css/style.css
   Tokens       : phase 2 RESA-VTC-63 (repris tels quels, voir :root ci-dessous)
   Fichier autonome, sans CDN ni ressource externe. Copier tel quel dans le site.

   CONTRAINTE : aucune règle ci-dessous ne cible .btn, .card, .panel, .kpi,
   .admin-total, .ct-* ou .suivi-*. Ces classes existantes sont intouchables.
   Les classes de démonstration (.proto-*) vivent uniquement dans _proto-resa.html.

   POINTS D'INSERTION
   1. admin.html (vue d'ensemble) : envelopper les deux blocs dans .wt-overview,
      puis déplacer « Sommes encaissées » APRÈS « Activité » (ordre CSS 1 / 2).
   2. Modale de détail réservation (admin.html) : .wt-ring--compact + .wt-pay-btn.
   3. suivi.html (suivi client public) : .wt-ring--client.
   4. Messagerie admin : .mb-shell / .mb-sidebar / .mb-list / .mb-thread.
   5. contact.html : .wt-print-grid (deux cartes, après le formulaire).
   6. Pied d'article blog : .wt-print-inline (emplacement discret).
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Tokens locaux — aucune valeur hors palette de marque
   -------------------------------------------------------------------------- */
:root {
  /* Rouge « brand-spec » : #C0392B, blanc dessus = 5,44:1 (AA).
     Distinct de --red (#E63946, 4,17:1) réservé aux anciens usages. */
  --wt-red: #C0392B;

  /* Rouge allégé pour l'arc sur fond nuit : mélange de --red et --white
     (~5,6:1 sur navy), sans aucune couleur hors palette. */
  --wt-arc-alert-navy: color-mix(in srgb, var(--red) 72%, var(--white));

  /* LECTURE DE LA FRACTION (règle confirmée par l'exploitant)
     Le NUMÉRATEUR suit les MINUTES ÉCOULÉES plafonnées : 1/6, 2/6 … 6/6,
     puis 6/10 … 10/10. Le dénominateur change à 6 minutes.
     Le mm:ss affiché sous la fraction donne le temps écoulé réel.
     Le nombre d'arcs allumés = numérateur. Ces tokens sont le contrat JS. */
  --wt-ring-seg-1: 6;              /* 6 segments × 60° — gouttière 3°        */
  --wt-ring-seg-2: 10;             /* 10 segments × 36° — gouttière 3°       */
  --wt-ring-gap: 2.199;            /* 3° exprimés en unités SVG à r=42       */
  --wt-ring-size: 128px;           /* 360 / 390 / 768 / 1440 px              */
  --wt-ring-rail: var(--navy-100); /* rail clair par défaut                  */
  --wt-ring-fg: var(--text);       /* texte central, suit le thème           */

  /* Compteur : Inter, chiffres tabulaires */
  --wt-counter-font: var(--font-body);
  --wt-counter-size: clamp(2.25rem, 9vw, 3.5rem);

  --wt-touch-min: 48px;            /* mobile                                 */
  --wt-order-gap: var(--space-6);  /* entre « Activité » et « Sommes »       */
  --wt-inner-gap: var(--space-3);  /* entre cartes / tuiles                  */

  --mb-row-h: 48px;
  --mb-unread-bg: var(--navy-100);
  --mb-bar: 3px;
  --mb-badge-bg: #C0392B;
}

@media (min-width: 390px) { :root { --wt-ring-size: 136px; } }
@media (min-width: 768px) {
  :root { --wt-ring-size: 160px; --wt-touch-min: 44px; }
}
@media (min-width: 1440px) { :root { --wt-ring-size: 176px; } }

/* --------------------------------------------------------------------------
   1. Réordonnancement vue d'ensemble  — POINT D'INSERTION 1
   Les .kpi / .admin-total restent utilisés tels quels dans le HTML.
   -------------------------------------------------------------------------- */
.wt-overview {
  display: grid;
  gap: var(--wt-order-gap);
}

.wt-overview__activity { order: 1; }
.wt-overview__totals   { order: 2; }

.wt-overview__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--wt-inner-gap);
  margin-bottom: var(--wt-inner-gap);
}

.wt-overview__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.wt-overview__hint {
  font-size: .78rem;
  color: var(--text-muted);
}

.wt-overview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--wt-inner-gap);
}

.wt-overview__totals .wt-overview__grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* --------------------------------------------------------------------------
   2. Compteur d'attente circulaire — POINTS D'INSERTION 2 & 3
   Géométrie : rayon 42 / viewBox 100. Les arcs sont définis une seule fois
   dans <defs> (#wt-arc-6 = 57°, #wt-arc-10 = 33°), puis rotation de 60°/36°.
   -------------------------------------------------------------------------- */
.wt-ring {
  --wt-arc: var(--green);
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  flex: none;
}

/* Le disque seul porte la dimension ; le libellé peut rester à l'intérieur. */
.wt-ring__dial {
  position: relative;
  width: var(--wt-ring-size);
  height: var(--wt-ring-size);
  display: grid;
  place-items: center;
}

/* Variantes de fond : le cercle reste lisible sur navy et sur fond clair. */
.wt-ring--light {
  --wt-ring-rail: var(--navy-100);
  --wt-ring-fg: var(--text);
}

.wt-ring--navy {
  --wt-ring-rail: color-mix(in srgb, var(--white) 22%, transparent);
  --wt-ring-fg: var(--white);
}

/* Modale admin : même composant, densité resserrée sans quitter l'échelle
   de diamètres 128/136/160/176 px. */
.wt-ring--compact { --wt-ring-size: calc(var(--wt-ring-size) * .875); gap: var(--space-2); }
.wt-ring--compact .wt-counter__frac { font-size: clamp(1.7rem, 6vw, 2.25rem); }
.wt-ring--compact .wt-counter__time { font-size: .8rem; }

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

.wt-ring__rail,
.wt-ring__seg {
  fill: none;
  stroke-width: 9;
  stroke-linecap: butt;
}

/* Le rail reprend la segmentation des arcs : les tokens --wt-ring-seg-* et
   --wt-ring-gap sont ainsi consommés (et non plus seulement documentés).
   C = 2πr = 263,894 unités SVG ; rotate(-90) aligne les gouttières avec les arcs. */
.wt-ring__rail {
  stroke: var(--wt-ring-rail);
  stroke-dasharray: calc(263.894 / var(--wt-ring-seg-1) - var(--wt-ring-gap)) 263.894;
  transform: rotate(-90deg);
  transform-box: view-box;
  transform-origin: 50px 50px;
}

.wt-ring--alerte .wt-ring__rail,
.wt-ring--arret .wt-ring__rail {
  stroke-dasharray: calc(263.894 / var(--wt-ring-seg-2) - var(--wt-ring-gap)) 263.894;
}

.wt-ring__seg  { stroke: var(--wt-ring-rail); }
.wt-ring__seg.is-on { stroke: var(--wt-arc); }

/* Paliers de couleur — arc / icône uniquement, jamais de fond coloré. */
.wt-ring--offert   { --wt-arc: var(--green); }
.wt-ring--payant   { --wt-arc: var(--gold); }
.wt-ring--alerte   { --wt-arc: var(--wt-red); }
.wt-ring--arret    { --wt-arc: var(--gray-400); }

/* Sur fond nuit, #C0392B devient trop sombre au creux du clignotement :
   on éclaircit l'arc avec un mélange --red + --white (aucune nouvelle couleur). */
.wt-ring--navy.wt-ring--alerte { --wt-arc: var(--wt-arc-alert-navy); }

/* Clignotement DISCRET de l'arc seul à partir de 6 min (pas de fond rouge). */
.wt-ring--alerte .wt-ring__seg.is-on {
  animation: wt-arc-blink 1.15s var(--ease) infinite;
}

@keyframes wt-arc-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .72; }
}

@media (prefers-reduced-motion: reduce) {
  .wt-ring--alerte .wt-ring__seg.is-on { animation: none; }
}

.wt-ring__center {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: .2rem;
  text-align: center;
}

.wt-counter__frac {
  font-family: var(--wt-counter-font);
  font-size: var(--wt-counter-size);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  color: var(--wt-ring-fg);
  letter-spacing: -.03em;
}

.wt-counter__time {
  font-family: var(--wt-counter-font);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  line-height: 1;
  color: var(--wt-ring-fg);
  opacity: 1;
}

.wt-ring__meta {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  text-align: center;
}

.wt-ring__label {
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.wt-ring--navy .wt-ring__label { color: var(--white); }

/* Emplacement réservé aux 2 bips — le déclenchement JS est hors prototype. */
.wt-beep-slot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 20px;
  padding: 2px 9px;
  border: 1px dashed color-mix(in srgb, var(--wt-red) 45%, transparent);
  border-radius: var(--radius-pill);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--wt-red);
  font-family: var(--font-body);
}

.wt-beep-slot__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  border: 1px solid currentColor;
  background: transparent;
}

.wt-beep-slot__dot.is-armed { background: var(--wt-red); }

.wt-ring--navy .wt-beep-slot {
  color: var(--white);
  border-color: color-mix(in srgb, var(--white) 35%, transparent);
}

.wt-ring--navy .wt-beep-slot__dot.is-armed { background: var(--wt-red); border-color: var(--wt-red); }

/* Variante suivi client : le chrono est le point focal de la carte. */
.wt-ring--client {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.wt-ring--client .wt-ring__label { font-size: .88rem; }

/* --------------------------------------------------------------------------
   3. Bouton « Encaisser-Absent » — POINT D'INSERTION 2
   S'applique EN PLUS de .btn .btn--orange existants ; ne les redéfinit pas.
   -------------------------------------------------------------------------- */
.wt-pay-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: var(--wt-touch-min);
  padding-inline: var(--space-5);
  font-weight: 700;
  white-space: nowrap;
}

.wt-pay-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Avant 6 min : gardé désactivé par le JS, sans remboursement possible. */
.wt-pay-btn[disabled],
.wt-pay-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .5;
  pointer-events: none;
}

/* Après clic : confirmation sobre, dans la palette (jamais de vert pur en fond). */
.wt-pay-btn.is-done {
  background: var(--green-light);
  color: var(--green-dark);
  border-color: var(--green);
  box-shadow: none;
}

.wt-pay-btn__hint {
  display: block;
  margin-top: var(--space-2);
  font-size: .74rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   4. Messagerie admin — POINT D'INSERTION 4
   -------------------------------------------------------------------------- */
.mb-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: var(--wt-order-gap);
}

.mb-sidebar {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.mb-sidebar__title {
  font-family: var(--font-heading);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
}

.mb-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--wt-touch-min);
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.mb-folder:hover { background: var(--surface); border-color: var(--border); }

.mb-folder.is-active {
  background: var(--mb-unread-bg);
  border-color: var(--navy-100);
  color: var(--text);
  font-weight: 800;
}

.mb-folder svg { width: 16px; height: 16px; flex: none; }
.mb-folder__label { display: flex; align-items: center; gap: var(--space-2); flex: 1; }

.mb-folder__badge {
  min-width: 22px;
  height: 22px;
  padding-inline: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--mb-badge-bg);
  color: var(--white);   /* 5,44:1 sur #C0392B — AA */
  font-size: .7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.mb-sidebar__sep {
  height: 1px;
  background: var(--border);
  margin: var(--space-2) var(--space-3);
}

.mb-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.mb-list__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.mb-list__title {
  font-family: var(--font-heading);
  font-size: .9rem;
  font-weight: 800;
  color: var(--text);
}

.mb-list__count { font-size: .76rem; color: var(--text-muted); }

.mb-row {
  position: relative;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-3);
  height: var(--mb-row-h);
  min-height: var(--mb-row-h);
  padding-inline: var(--space-4);
  padding-left: calc(var(--mb-bar) + var(--space-4));
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.mb-row:last-child { border-bottom: 0; }

/* Barre verticale verte à gauche, visible uniquement sur les non-lus. */
.mb-row::before {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 0;
  width: var(--mb-bar);
  background: var(--green);
  opacity: 0;
}

.mb-row--unread { background: var(--mb-unread-bg); }
.mb-row--unread::before { opacity: 1; }

.mb-row.is-selected { outline: 2px solid var(--green); outline-offset: -2px; }

.mb-row__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--green);
}

.mb-row--unread .mb-row__dot { background: var(--green); }

.mb-row__from {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mb-row--unread .mb-row__from { font-weight: 800; }

.mb-row__subject {
  font-size: .82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mb-row__time {
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.mb-thread {
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.mb-thread__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.mb-thread__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.mb-thread__meta { font-size: .76rem; color: var(--text-muted); }

.mb-thread__body {
  padding-block: var(--space-4);
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text);
}

.mb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.mb-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--wt-touch-min);
  padding-inline: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}

.mb-action:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-light);
}

.mb-action svg { width: 15px; height: 15px; flex: none; }

/* Rouge en icône/texte seulement — jamais en fond clignotant. */
.mb-action--danger { color: var(--wt-red); }
.mb-action--danger:hover {
  border-color: var(--wt-red);
  color: var(--wt-red);
  background: color-mix(in srgb, var(--wt-red) 6%, var(--surface));
}

@media (max-width: 767px) {
  .mb-shell { grid-template-columns: 1fr; }
  .mb-sidebar {
    display: flex;
    overflow-x: auto;
    gap: var(--space-2);
    padding: var(--space-2);
  }
  .mb-sidebar__title, .mb-sidebar__sep { display: none; }
  .mb-folder { flex: none; white-space: nowrap; }
  .mb-row { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .mb-row__subject { display: none; }
}

/* --------------------------------------------------------------------------
   5. Supports imprimés — POINTS D'INSERTION 5 & 6
   -------------------------------------------------------------------------- */
/* Alias partagés : les classes .mb-print-* du site reprennent exactement
   les règles .wt-print-* — une seule définition, deux vocabulaires. */
.mb-print { display: grid; gap: var(--wt-order-gap); }

.wt-print-grid,
.mb-print__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--wt-order-gap);
}

@media (max-width: 639px) {
  .wt-print-grid,
  .mb-print__grid { grid-template-columns: 1fr; }
}

.wt-print-card,
.mb-print__card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-5);
  gap: var(--space-3);
}

.wt-print-card__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.wt-print-card__desc {
  font-size: .86rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.wt-print-card__media,
.mb-print__shot {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  border: 1px solid var(--border);
}

.wt-print-card__media img,
.mb-print__shot img {
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Aperçus : flyer ≤ 240 px, carte de visite ≤ 320 px. */
.wt-print-card__media--flyer img { max-height: 240px; }
.wt-print-card__media--card  img,
.mb-print__shot img { max-height: 320px; }

.wt-print-card__faces {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.wt-print-card__faces figure { display: grid; gap: var(--space-2); }

.wt-print-card__faces .wt-print-card__media { min-height: 180px; }

.wt-print-card__faces figcaption {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  text-align: center;
}

.wt-print-card__actions,
.mb-print__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
}

.wt-print-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--wt-touch-min);
  padding-inline: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  font-weight: 700;
  color: var(--text);
  /* .btn pose un fond vert : sans cette remise a zero, le texte sombre
     tombait sur le vert (2,03:1). Le lien est ici un bouton CONTOUR. */
  background: transparent;
}

.wt-print-link:hover { border-color: var(--green); color: var(--green-dark); }
.wt-print-link svg { width: 15px; height: 15px; flex: none; }

/* Emplacement discret en pied d'article blog. */
.wt-print-inline,
.mb-print--inline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-muted);
}

.wt-print-inline img,
.mb-print--inline img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: none;
}

.wt-print-inline a,
.mb-print--inline a {
  font-weight: 700;
  color: var(--green-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* QR de réservation — bloc pleine largeur sous les deux supports.
   Le QR doit rester GRAND : sous 180 px il ne se scanne plus à l'écran, donc
   on ne le traite pas comme une vignette. Le cadre blanc est la marge claire
   du code lui-même, doublée par le rembourrage. */
.wt-print-qr {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-5);
  margin-top: var(--wt-order-gap);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.wt-print-qr__img {
  width: 200px;
  height: 200px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.wt-print-qr__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.wt-print-qr__desc {
  margin-top: .25rem;
  font-size: .88rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.wt-print-qr__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

@media (max-width: 639px) {
  .wt-print-qr { grid-template-columns: 1fr; justify-items: start; }
  .wt-print-qr__img { width: 180px; height: 180px; }
}

/* --------------------------------------------------------------------------
   6. Messagerie — classes d'intégration (src/mailbox.html + js/mailbox.js)
   Vocabulaire DOM réel, en complément des classes de maquette de la section 4.
   Palette existante uniquement ; cibles 48 px mobile / 44 px desktop.
   -------------------------------------------------------------------------- */

/* Grille 3 colonnes : dossiers / liste / lecture. Une colonne sous 900 px.
   La barre laterale passe de 220 a 240 px : a 220, « Boite de reception »
   se repliait sur deux lignes et le titre « BOITE MAIL » debordait de son
   en-tete (constate sur capture du 23/11/2026). */
.mb-app {
  display: grid;
  grid-template-columns: 240px minmax(240px, 1fr) minmax(320px, 1.25fr);
  align-items: start;
  gap: var(--wt-order-gap);
}

/* En-tete de la barre laterale : titre puis mention, l'un sous l'autre.
   En flex space-between, « Exploitant » etait pousse hors de la colonne. */
.mb-sidebar__head {
  display: grid;
  gap: 2px;
  padding: var(--space-2) var(--space-3) var(--space-3);
}

.mb-sidebar__title {
  white-space: nowrap;
}

.mb-sidebar__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-size: .95rem;
  font-weight: 800;
  color: var(--text);
}

.mb-sidebar__sub { font-size: .72rem; color: var(--text-muted); }
.mb-new { width: 100%; min-height: var(--wt-touch-min); margin-bottom: var(--space-3); }
.mb-folders { display: grid; gap: var(--space-1); }

.mb-folder--active,
.mb-folder.is-active {
  background: var(--mb-unread-bg);
  border-color: var(--navy-100);
  color: var(--text);
  font-weight: 800;
}

.mb-folder__count {
  font-size: .72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.mb-folder__unread {
  min-width: 22px;
  height: 22px;
  padding-inline: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--mb-badge-bg);
  color: var(--white);   /* 5,44:1 sur #C0392B — AA */
  font-size: .7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.mb-folder-add {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.mb-folder-add__toggle { width: 100%; min-height: var(--wt-touch-min); }
.mb-folder-form { display: grid; gap: var(--space-2); margin-top: var(--space-2); }
.mb-folder-form .input { min-height: var(--wt-touch-min); }

.mb-error {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--wt-red);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--wt-red) 6%, var(--surface));
  color: var(--wt-red);          /* texte/icône rouge, jamais de fond clignotant */
  font-size: .8rem;
  font-weight: 600;
}

.mb-toast {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 60;
  max-width: min(380px, calc(100vw - 2rem));
  padding: var(--space-3) var(--space-4);
  border-left: var(--mb-bar) solid var(--green);
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow);
  font-size: .86rem;
  font-weight: 600;
}

.mb-list__toolbar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.mb-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.mb-search i { width: 16px; height: 16px; flex: none; color: var(--text-muted); }
.mb-search .input { min-height: var(--wt-touch-min); }
.mb-list__items { display: grid; }

/* Ligne de message : structure réelle .mb-row__bar + __dot + __main. */
.mb-row {
  grid-template-columns: var(--mb-bar) 10px minmax(0, 1fr);
  height: auto;
  min-height: var(--mb-row-h);
  padding: var(--space-2) var(--space-3) var(--space-2) 0;
  width: 100%;
  text-align: left;
  background: transparent;
}

/* La barre verte est un enfant explicite dans le DOM réel : on neutralise
   le pseudo-élément de la maquette pour éviter un double trait. */
.mb-row:has(.mb-row__bar)::before { display: none; }

.mb-row__bar {
  display: block;
  width: var(--mb-bar);
  height: 100%;
  min-height: var(--mb-row-h);
  border-radius: var(--radius-pill);
  background: var(--green);
  opacity: 0;
}

.mb-row--unread .mb-row__bar { opacity: 1; }
.mb-row--unread .mb-row__from,
.mb-row--unread .mb-row__subject { font-weight: 800; }

.mb-row__dot { justify-self: center; align-self: center; }
.mb-row__main { display: grid; gap: 2px; min-width: 0; }
.mb-row__line { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); min-width: 0; }

.mb-row__from,
.mb-row__subject,
.mb-row__snippet {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-row__subject { color: var(--text); }
.mb-row__snippet { font-size: .76rem; color: var(--text-muted); }

.mb-row__date {
  flex: none;
  font-size: .72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.mb-row__attach {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--green-dark);
}

/* aria-current="true" est posé par mailbox.js sur la ligne élue ;
   l'activation clavier Entrée/Espace est à brancher dans ce même JS. */
.mb-row--active,
.mb-row.is-selected {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.mb-empty {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-7) var(--space-4);
  text-align: center;
  color: var(--text-muted);
}

.mb-empty i { width: 28px; height: 28px; color: var(--gray-400); }
.mb-empty p { margin: 0; font-size: .85rem; }

/* Panneau de lecture */
.mb-read { min-height: 320px; overflow: hidden; }
.mb-read__empty { display: grid; place-items: center; gap: var(--space-2); min-height: 280px; text-align: center; color: var(--text-muted); }
.mb-read__empty i { width: 32px; height: 32px; color: var(--gray-400); }
.mb-read__empty p { margin: 0; font-size: .9rem; }
.mb-read__content { display: grid; gap: var(--space-4); }
.mb-read__head { display: grid; gap: var(--space-2); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }

.mb-read__subject {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
}

.mb-read__meta { font-size: .78rem; color: var(--text-muted); }
.mb-read__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.mb-read__move-label { display: inline-flex; align-items: center; gap: var(--space-2); font-size: .8rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.mb-read__move { min-height: var(--wt-touch-min); }

.mb-read__body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  font-size: .92rem;
  line-height: 1.7;
  color: var(--text);
}

/* Pièces jointes */
.mb-attach__list { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.mb-attach__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-alt);
  font-size: .78rem;
  color: var(--text);
}

.mb-attach__item i { width: 14px; height: 14px; flex: none; color: var(--green-dark); }
.mb-attach__size { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.mb-attach__remove {
  min-width: var(--wt-touch-min);
  min-height: var(--wt-touch-min);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--wt-red);
  font-size: 1rem;
  font-weight: 800;
}

.mb-attach__remove:hover {
  border-color: var(--wt-red);
  background: color-mix(in srgb, var(--wt-red) 8%, var(--surface));
}

/* Rédaction — restera masquée par la classe utilitaire .hidden du site. */
.mb-compose { display: grid; gap: var(--space-4); }

.mb-compose__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.mb-compose__head h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

@media (max-width: 899px) {
  .mb-app { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   6 bis. Correctifs de mise en page mesures le 23/11/2026
   --------------------------------------------------------------------------
   Défaut constaté sur capture : dans la barre latérale, « Nouveau message »,
   « Nouveau dossier » et « Paramètres » sortaient tronqués, le libellé
   « Exploitant » débordait sur la colonne de la liste et le compteur de
   dossiers s'affichait sous la liste. Mesure instrumentée : .mb-sidebar
   scrollWidth 298 px pour clientWidth 218 px.

   Cause : une colonne implicite de grille se dimensionne sur max-content.
   Les boutons en width:100% se réglaient donc sur 286 px (la largeur du plus
   long libellé) et non sur les 220 px de la colonne ; .mb-list, peinte
   ensuite, recouvrait le débordement. Une colonne explicite minmax(0, 1fr)
   et min-width:0 sur les enfants rendent la largeur de la colonne
   souveraine — le texte se replie au lieu de pousser la grille.
   -------------------------------------------------------------------------- */
.mb-app > * { min-width: 0; }
.mb-sidebar { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.mb-settings-btn,
.mb-folder-add__toggle { width: 100%; justify-content: flex-start; }
.mb-settings-btn { margin-top: var(--space-3); white-space: normal; text-align: left; }

/* Sous 767 px, la section 4 transforme TOUTE .mb-sidebar en bandeau
   horizontal defilant — utile pour la maquette .mb-shell, nefaste pour la
   vraie boite mail : les six blocs (en-tete, bouton, dossiers, nouveau
   dossier, parametres) partaient a l'horizontale, hors de l'ecran. Mesure du
   23/11/2026 : .mb-new a x=201, .mb-settings a x=636 pour une carte de 355 px.
   On retablit ici la colonne, avec la specificite suffisante pour l'emporter. */
@media (max-width: 899px) {
  .mb-app .mb-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
    padding: var(--space-3);
  }
  .mb-app .mb-sidebar__title { display: inline-flex; }
  .mb-app .mb-folder { white-space: normal; flex: 0 0 auto; }
}

/* Hiérarchie des actions de lecture : le second rideau reste lisible mais ne
   concurrence plus l'action principale. */
.mb-read__danger {
  color: var(--wt-red);
  border-color: color-mix(in srgb, var(--wt-red) 34%, var(--border));
}
.mb-read__danger:hover { border-color: var(--wt-red); color: var(--wt-red); }

/* Barre de recherche : le champ occupe la place disponible, le bouton
   d'actualisation garde sa taille au lieu de s'étirer. Sur téléphone, la
   regle globale « .btn { width: 100% } » (style.css, petits ecrans) donnait
   au bouton toute la largeur : le champ tombait a 0 px (mesure du 23/11). */
.mb-list__toolbar .btn { flex: 0 0 auto; width: auto; }
.mb-search { flex: 1 1 6rem; min-width: 5rem; }

@media (max-width: 899px) {
  /* Sur téléphone, l'en-tête garde sa colonne : titre sur une ligne, mention
     « Exploitant » en dessous. Les actions secondaires passent pleine largeur. */
  .mb-sidebar__title { font-size: .95rem; }
  .mb-read__move-label { width: 100%; justify-content: space-between; }
  .mb-read__move { flex: 1; }
}

/* --------------------------------------------------------------------------
   7. Focus clavier — cibles interactives des nouveaux composants
   -------------------------------------------------------------------------- */
.wt-pay-btn:focus-visible,
.mb-folder:focus-visible,
.mb-action:focus-visible,
.wt-print-link:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* Offset négatif : .mb-list est en overflow:hidden, un offset positif serait coupé.
   Le rôle bouton est porté par le HTML ; l'activation clavier (Entrée/Espace)
   est à brancher côté JS applicatif, hors prototype statique. */
.mb-row[role="button"]:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

/* --------------------------------------------------------------------------
   Intégration modale admin — compteur compact + bouton d'absence
   --------------------------------------------------------------------------
   Deux règles seulement, pour placer le chrono dans une rangée d'actions
   existante sans toucher à .admin-actions ni à .btn. */
.wt-wait-inline {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  min-width: 0;
}
.wt-absent {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  min-width: 0;
}
.wt-absent .wt-pay-btn__hint {
  max-width: 28rem;
}
@media (max-width: 640px) {
  .admin-actions__row--wait { align-items: flex-start; }
  .wt-wait-inline { width: 100%; }
}

/* Fin du fichier — nouveaux composants uniquement. */

/* --------------------------------------------------------------------------
   Boîte mail : filtres, réglages et lisibilité sur téléphone
   -------------------------------------------------------------------------- */
.mb-tabs {
  display: flex;
  gap: .25rem;
  padding: .35rem .4rem 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.mb-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 .85rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: .84rem;
  cursor: pointer;
}
.mb-tab.is-on {
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--green);
}
.mb-row--active { background: var(--navy-100); }
.mb-row__snippet { max-width: 100%; }
.mb-settings-btn { margin-top: .6rem; min-height: var(--wt-touch-min); }
.mb-settings { margin-top: 1rem; padding: 1rem; }
.mb-settings h3 { margin: .8rem 0 .2rem; font-size: 1rem; }
.mb-settings fieldset { border: 1px solid var(--border); border-radius: 10px; padding: .7rem; }
.mb-settings fieldset label { display: block; font-size: .84rem; margin-top: .45rem; }
.mb-settings fieldset .input,
.mb-settings fieldset .textarea { width: 100%; margin-top: .2rem; }
.mb-check { display: flex; align-items: center; gap: .5rem; min-height: 44px; }
.mb-sig-preview {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .7rem; border: 1px dashed var(--border); border-radius: 10px;
}
.mb-sig-preview img { flex: none; width: 56px; height: 56px; }
.mb-sig-preview pre {
  margin: 0; white-space: pre-wrap; font: inherit; font-size: .78rem;
  line-height: 1.45; color: var(--text-muted);
}
@media (max-width: 700px) {
  .mb-settings { padding: .75rem; }
  .mb-settings .btn[type="submit"] { width: 100%; min-height: 48px; }
}

/* Liste façon boîte mail : case de sélection, étoile, expéditeur et date
   alignés. Le clic reste sur la ligne entière (un seul bouton). */
.mb-row {
  grid-template-columns: var(--mb-bar) 10px 18px 18px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-2);
}
.mb-row__check {
  width: 16px; height: 16px;
  border: 1.5px solid var(--text-muted);
  border-radius: 3px;
  justify-self: center;
}
.mb-row--active .mb-row__check { border-color: var(--green); background: var(--navy-100); }
.mb-row__star { width: 16px; height: 16px; justify-self: center; color: var(--gold, #FFC93C); }
.mb-row__star i { display: block; width: 16px; height: 16px; }
.mb-row__star:empty::after { content: ''; }
