/*
 * Primitives de composants — back-office MenuPay
 * Spécification complète (structure HTML, ARIA, comportement responsive) :
 * docs/design/design-system.md §7. Ce fichier pose UNIQUEMENT les classes de
 * base (styles visuels) pour que l'implémenteur assemble les vues ERB sans
 * improviser de couleur/mesure — il ne contient aucun balisage, aucune vue.
 *
 * Périmètre : back-office (dashboard, réglages, gestion de carte, etc.).
 * Ne remplace ni ne modifie primitives.css (menu client, intouché). Dépend
 * de tokens.css (couche --mp-*, doit être chargé avant ce fichier).
 *
 * Convention de nommage : préfixe `mp-` pour tout composant back-office, afin
 * qu'aucune classe ne collide jamais avec celles du menu client
 * (`.dish-card`, `.btn`, `.badge`, etc. définies dans primitives.css).
 */

/* ============================================================
   Base de page back-office
   ============================================================ */

.mp-app {
  min-height: 100vh;
  background: var(--mp-canvas);
  color: var(--mp-text);
  /* Passe 2 : police de base manquante en passe 1 — sans elle, tout texte
     hors bouton/champ (déjà réglés individuellement, §7.1/§7.2) retombe sur
     la police serif par défaut du navigateur (titres, paragraphes), jamais
     la sans-serif système voulue par design-system.md §3 pour l'ensemble
     du produit. */
  font-family: var(--font-family-default);
}

.mp-app :focus-visible {
  outline: var(--focus-ring-width) solid var(--mp-focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* ============================================================
   Boutons — docs/design/design-system.md §7.1
   Variantes : primary / secondary / ghost / danger. Tailles : sm / md / lg.
   Toute cible ≥ 44px (min) quelle que soit la taille (voir §7.1 mesures).
   ============================================================ */

.mp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8px);
  min-height: var(--tap-target-min);
  padding: 0 var(--space-16px);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-family-default);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.mp-btn--sm  { min-height: var(--tap-target-min); padding: 0 var(--space-12px); font-size: var(--font-size-sm); }
.mp-btn--md  { min-height: var(--tap-target-comfortable); padding: 0 var(--space-20px); }
.mp-btn--lg  { min-height: 56px; padding: 0 var(--space-24px); font-size: var(--font-size-md); }

.mp-btn--primary {
  background: var(--mp-accent);
  border-color: var(--mp-accent);
  color: var(--mp-on-accent);
}
.mp-btn--primary:hover  { background: var(--mp-accent-hover); border-color: var(--mp-accent-hover); }
.mp-btn--primary:active { background: var(--mp-accent-active); border-color: var(--mp-accent-active); }

.mp-btn--secondary {
  background: var(--mp-surface);
  border-color: var(--mp-border-strong);
  color: var(--mp-text);
}
.mp-btn--secondary:hover  { background: var(--mp-canvas); border-color: var(--mp-accent); }
.mp-btn--secondary:active { background: var(--mp-accent-surface); }

.mp-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--mp-text-secondary);
}
.mp-btn--ghost:hover  { background: var(--mp-canvas); color: var(--mp-text); }
.mp-btn--ghost:active { background: var(--mp-border); }

.mp-btn--danger {
  background: var(--mp-danger-solid);
  border-color: var(--mp-danger-solid);
  color: var(--mp-on-danger);
}
.mp-btn--danger:hover  { background: var(--mp-danger-solid-hover); border-color: var(--mp-danger-solid-hover); }
.mp-btn--danger:active { background: var(--mp-danger-solid-active); border-color: var(--mp-danger-solid-active); }

.mp-btn[disabled],
.mp-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* État chargement : le libellé reste dans le DOM (annoncé), un spinner CSS
   pur remplace visuellement l'icône ; jamais de changement de taille du
   bouton (évite un saut de mise en page). `aria-busy="true"` porté par le
   bouton, spinner `aria-hidden="true"` (le texte visible suffit). */
.mp-btn--loading {
  color: transparent;
  pointer-events: none;
  position: relative;
}
.mp-btn--loading::after {
  content: "";
  position: absolute;
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  color: inherit;
  animation: mp-spin 700ms linear infinite;
}
.mp-btn--primary.mp-btn--loading::after { color: var(--mp-on-accent); }
.mp-btn--danger.mp-btn--loading::after  { color: var(--mp-on-danger); }
.mp-btn--secondary.mp-btn--loading::after,
.mp-btn--ghost.mp-btn--loading::after { color: var(--mp-text); }

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

@media (prefers-reduced-motion: reduce) {
  .mp-btn--loading::after { animation-duration: 1ms; }
}

/* ============================================================
   Champs de formulaire — §7.2
   ============================================================ */

.mp-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
  margin-bottom: var(--space-20px);
}

.mp-field__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--mp-text);
}

.mp-field__hint {
  font-size: var(--font-size-caption);
  color: var(--mp-text-secondary);
}

.mp-field__error {
  font-size: var(--font-size-caption);
  color: var(--mp-danger-text);
  display: flex;
  align-items: center;
  gap: var(--space-4px);
}

.mp-input,
.mp-textarea,
.mp-select {
  /* Passe 2 : sans ces deux déclarations, un champ qui reçoit l'attribut
     HTML `size` (posé automatiquement par Rails dès qu'un `maxlength:` est
     donné à `text_field`/`password_field`, ex. les champs de mot de passe)
     retombe sur sa largeur intrinsèque (souvent > 600px pour size="72")
     plutôt que de remplir `.mp-field` — invisible tant qu'aucun champ stylé
     ne portait de `maxlength` (passe 1), révélé par les écrans d'auth. */
  box-sizing: border-box;
  width: 100%;
  min-height: var(--tap-target-min);
  padding: var(--space-8px) var(--space-12px);
  border-radius: var(--radius-sm);
  border: 1px solid var(--mp-border-strong);
  background: var(--mp-surface);
  color: var(--mp-text);
  font-family: var(--font-family-default);
  font-size: var(--font-size-base); /* ≥16px : évite le zoom auto Safari mobile */
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.mp-textarea { min-height: 96px; resize: vertical; }

.mp-input:hover,
.mp-textarea:hover,
.mp-select:hover { border-color: var(--mp-text-secondary); }

.mp-input:focus-visible,
.mp-textarea:focus-visible,
.mp-select:focus-visible {
  outline: var(--focus-ring-width) solid var(--mp-focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-color: var(--mp-focus-ring-color);
}

.mp-input[aria-invalid="true"],
.mp-textarea[aria-invalid="true"],
.mp-select[aria-invalid="true"] {
  border-color: var(--mp-danger-text);
}

.mp-input[disabled],
.mp-textarea[disabled],
.mp-select[disabled] {
  background: var(--mp-canvas);
  color: var(--mp-text-disabled);
  cursor: not-allowed;
}

/* Champ fichier (ex. photo de plat) : le bouton natif `::file-selector-button`
   n'hérite d'aucun token par défaut (gris clair fixe du navigateur) et
   détonne sur fond sombre — même traitement que `.mp-btn--secondary`, en
   clair comme en sombre puisque tout passe par la couche sémantique --mp-*. */
.mp-input[type="file"] {
  padding: var(--space-8px) var(--space-12px);
}

.mp-input[type="file"]::file-selector-button {
  margin-right: var(--space-12px);
  padding: 0 var(--space-16px);
  min-height: var(--tap-target-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--mp-border-strong);
  background: var(--mp-surface);
  color: var(--mp-text);
  font-family: var(--font-family-default);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.mp-input[type="file"]::file-selector-button:hover {
  background: var(--mp-canvas);
  border-color: var(--mp-accent);
}

/* Checkbox / radio : la case native est agrandie (cible ≥ 24px visuel dans
   une zone cliquable ≥ 44px portée par le label, jamais la case seule). */
.mp-checkbox,
.mp-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8px);
  min-height: var(--tap-target-min);
  cursor: pointer;
}

.mp-checkbox input,
.mp-radio input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--mp-accent);
  flex-shrink: 0;
}

/* Switch (interrupteur) — alternative visuelle à une case à cocher unique
   pour un réglage on/off (ex. "établissement ouvert"). `role="switch"`
   `aria-checked` portés par l'implémenteur sur un <button>.
   Dimensions entièrement dérivées des tokens d'espacement (aucun composant
   n'utilise encore .mp-switch : zéro risque de régression visuelle à choisir
   des paliers de la grille 8px plutôt que reproduire au pixel près un
   premier jet en dur — piste 44/24/20/2px, voir revue). Piste :
   piste = --space-48px, pastille = --space-16px, décalage haut/gauche =
   --space-4px (2 x 4px + 16px = 24px = piste --space-24px, cohérent). */
.mp-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: var(--space-48px);
  height: var(--space-24px);
  min-width: var(--space-48px);
  border-radius: var(--radius-pill);
  background: var(--mp-border-strong);
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.mp-switch::before {
  content: "";
  position: absolute;
  top: var(--space-4px);
  left: var(--space-4px);
  width: var(--space-16px);
  height: var(--space-16px);
  border-radius: 50%;
  background: var(--mp-neutral-0);
  box-shadow: var(--shadow-subtle);
  transition: transform var(--transition-fast);
}

.mp-switch[aria-checked="true"] {
  background: var(--mp-accent);
}
.mp-switch[aria-checked="true"]::before {
  /* Trajet de la pastille = piste - pastille - (2 x décalage) =
     48px - 16px - 8px = 24px = --space-24px, sans calc() nécessaire. */
  transform: translateX(var(--space-24px));
}

/* Cible tactile réelle du switch : agrandie par un pseudo-halo invisible
   jusqu'au plancher --tap-target-min, plutôt que par la taille visuelle
   (qui doit rester compacte) — calculé depuis les tokens, jamais en dur
   ((--tap-target-min - hauteur piste) / 2 = (44px - 24px) / 2 = 10px). */
.mp-switch::after {
  content: "";
  position: absolute;
  inset: calc((var(--space-24px) - var(--tap-target-min)) / 2);
}

/* ============================================================
   Cartes — §7.4
   ============================================================ */

.mp-card {
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
  padding: var(--space-24px);
}

.mp-card--elevated {
  background: var(--mp-surface-elevated);
  border-color: transparent;
  box-shadow: var(--shadow-medium);
}

.mp-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12px);
  margin-bottom: var(--space-16px);
}

.mp-card__title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

/* ============================================================
   Dialogue — <dialog> natif, même mécanisme que la feuille de détail du
   menu client (docs/design/ecran-menu-client.md §5.2). §7.5
   ============================================================ */

.mp-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--mp-surface-elevated);
  box-shadow: var(--shadow-large);
  color: var(--mp-text);
  max-width: min(560px, calc(100vw - var(--space-32px)));
  width: 100%;
}

.mp-dialog::backdrop {
  background: var(--mp-scrim);
}

@media (prefers-reduced-motion: no-preference) {
  .mp-dialog {
    transition: opacity var(--transition-base), transform var(--transition-base);
  }
}

.mp-dialog__body {
  padding: var(--space-24px);
}

.mp-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12px);
  padding: var(--space-20px) var(--space-24px);
  border-bottom: 1px solid var(--mp-border);
}

.mp-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-12px);
  padding: var(--space-16px) var(--space-24px);
  border-top: 1px solid var(--mp-border);
}

.mp-dialog__close {
  min-width: var(--tap-target-min);
  min-height: var(--tap-target-min);
}

/* ============================================================
   Tableau dense — §7.6
   ============================================================ */

.mp-table-wrap {
  overflow-x: auto;
}

.mp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.mp-table th,
.mp-table td {
  padding: var(--space-12px) var(--space-16px);
  text-align: left;
  border-bottom: 1px solid var(--mp-border);
  vertical-align: middle;
}

.mp-table thead th {
  font-weight: var(--font-weight-medium);
  color: var(--mp-text-secondary);
  font-size: var(--font-size-caption);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--mp-border-strong);
}

.mp-table tbody tr:hover {
  background: var(--mp-canvas);
}

/* En-tête triable : le triangle visuel n'est jamais le seul indicateur —
   `aria-sort` sur le <th> porte l'état réel pour les lecteurs d'écran. */
.mp-table__sort-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  min-height: var(--tap-target-min);
}

.mp-table__sort-icon {
  width: 0.75em;
  height: 0.75em;
  opacity: 0.4;
}
th[aria-sort="ascending"] .mp-table__sort-icon,
th[aria-sort="descending"] .mp-table__sort-icon {
  opacity: 1;
}

/* Repli responsive : cartes empilées en dessous de 640px (§7.6). Passe en
   mode "carte" — chaque <tr> devient un bloc, chaque cellule affiche son
   en-tête via `data-label` (fourni par l'implémenteur), sans dépendre de
   JS. Activé par la classe `.mp-table--stacked-mobile` posée par
   l'implémenteur (générique, ne dépend d'aucun contenu précis). */
@media (max-width: 640px) {
  .mp-table--stacked-mobile thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .mp-table--stacked-mobile,
  .mp-table--stacked-mobile tbody,
  .mp-table--stacked-mobile tr,
  .mp-table--stacked-mobile td {
    display: block;
    width: 100%;
    /* Passe 2 : `tr` porte un padding horizontal (ci-dessous) ; sans
       `border-box`, `width: 100%` s'ajoute à ce padding et la ligne déborde
       de `.mp-table-wrap` de la largeur du padding (même bug que
       `.mp-input`, voir plus haut). */
    box-sizing: border-box;
  }
  .mp-table--stacked-mobile tr {
    margin-bottom: var(--space-16px);
    border: 1px solid var(--mp-border);
    border-radius: var(--radius-md);
    padding: var(--space-12px) var(--space-16px);
  }
  .mp-table--stacked-mobile td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4px) var(--space-12px);
    border-bottom: 1px solid var(--mp-border);
    padding: var(--space-8px) 0;
  }
  .mp-table--stacked-mobile td:last-child { border-bottom: none; }
  .mp-table--stacked-mobile td::before {
    content: attr(data-label);
    font-weight: var(--font-weight-medium);
    color: var(--mp-text-secondary);
    margin-right: var(--space-12px);
  }

  /* Passe 2 : un `.mp-btn` porte `white-space: nowrap` (§7.1) — juste pour
     un libellé court, mais un bouton de téléchargement (« Télécharger le QR
     (PDF) ») peut dépasser une carte de ~300px de large sur mobile puisqu'il
     ne peut alors pas se replier sur lui-même. Une fois passé à la ligne par
     `flex-wrap` ci-dessus, on l'autorise à prendre toute la largeur de la
     carte et à revenir à la ligne en son sein plutôt que de déborder. */
  .mp-table--stacked-mobile td > .mp-btn {
    flex: 1 1 100%;
    min-width: 0;
    white-space: normal;
    text-align: left;
  }
}

/* ============================================================
   Pagination — §7.7
   ============================================================ */

.mp-pagination {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
  list-style: none;
  margin: var(--space-16px) 0 0;
  padding: 0;
}

.mp-pagination__item a,
.mp-pagination__item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap-target-min);
  min-height: var(--tap-target-min);
  padding: 0 var(--space-8px);
  border-radius: var(--radius-sm);
  color: var(--mp-text);
  text-decoration: none;
}

.mp-pagination__item a:hover { background: var(--mp-canvas); }

.mp-pagination__item[aria-current="true"] span {
  background: var(--mp-accent);
  color: var(--mp-on-accent);
  font-weight: var(--font-weight-bold);
}

.mp-pagination__item--disabled span {
  color: var(--mp-text-disabled);
  cursor: not-allowed;
}

/* ============================================================
   Badge de statut — §7.8. TOUJOURS icône + texte, jamais la couleur seule.
   ============================================================ */

.mp-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  padding: var(--space-4px) var(--space-8px);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
}

.mp-badge__icon { width: 0.9em; height: 0.9em; flex-shrink: 0; }

.mp-badge--neutral { background: var(--mp-border); color: var(--mp-text); }
.mp-badge--success  { background: var(--mp-success-bg); color: var(--mp-success-text); }
.mp-badge--warning  { background: var(--mp-warning-bg); color: var(--mp-warning-text); }
.mp-badge--danger   { background: var(--mp-danger-bg);  color: var(--mp-danger-text); }
.mp-badge--info     { background: var(--mp-info-bg);    color: var(--mp-info-text); }

/* ============================================================
   Toast — §7.9. Non-bloquant, jamais seul mécanisme (l'action a aussi un
   retour dans le flux — flash de page ou aria-live — pour Turbo sans JS).
   ============================================================ */

.mp-toast-region {
  position: fixed;
  right: var(--space-16px);
  bottom: var(--space-16px);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
  max-width: min(360px, calc(100vw - var(--space-32px)));
}

.mp-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-8px);
  padding: var(--space-12px) var(--space-16px);
  border-radius: var(--radius-sm);
  background: var(--mp-surface-elevated);
  box-shadow: var(--shadow-large);
  border: 1px solid var(--mp-border);
  font-size: var(--font-size-sm);
}

.mp-toast--success { border-left: 4px solid var(--mp-success-text); }
.mp-toast--danger  { border-left: 4px solid var(--mp-danger-text); }
.mp-toast--info    { border-left: 4px solid var(--mp-info-text); }

/* ============================================================
   Tooltip — §7.10. Complément, jamais l'unique porteur d'une information
   nécessaire à l'usage (aussi disponible via aria-label/texte visible).
   ============================================================ */

.mp-tooltip {
  position: relative;
  display: inline-flex;
}

.mp-tooltip__bubble {
  position: absolute;
  bottom: calc(100% + var(--space-8px));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  padding: var(--space-4px) var(--space-8px);
  border-radius: var(--radius-xs);
  background: var(--mp-neutral-950);
  color: var(--mp-neutral-0);
  font-size: var(--font-size-caption);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.mp-tooltip:hover .mp-tooltip__bubble,
.mp-tooltip:focus-within .mp-tooltip__bubble {
  opacity: 1;
}

/* ============================================================
   Tabs — §7.11. Liens simples + aria-current par défaut (cf. parti pris
   category-nav du menu client) ; passer à un vrai tablist ARIA seulement si
   un futur écran l'exige explicitement (voir doc).
   ============================================================ */

.mp-tabs {
  display: flex;
  gap: var(--space-8px);
  border-bottom: 1px solid var(--mp-border);
  overflow-x: auto;
}

.mp-tabs__item {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target-min);
  padding: 0 var(--space-12px);
  color: var(--mp-text-secondary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.mp-tabs__item[aria-current="page"] {
  color: var(--mp-accent);
  border-bottom-color: var(--mp-accent);
}

/* ============================================================
   Breadcrumb — §7.12
   ============================================================ */

.mp-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8px);
  list-style: none;
  margin: 0 0 var(--space-16px);
  padding: 0;
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
}

.mp-breadcrumb a { color: var(--mp-text-secondary); }
.mp-breadcrumb a:hover { color: var(--mp-text); }

.mp-breadcrumb__item[aria-current="page"] {
  color: var(--mp-text);
  font-weight: var(--font-weight-medium);
}

/* ============================================================
   Avatar — §7.13
   ============================================================ */

.mp-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--mp-accent-surface);
  color: var(--mp-accent);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  overflow: hidden;
  flex-shrink: 0;
}

.mp-avatar img { width: 100%; height: 100%; object-fit: cover; }

.mp-avatar--sm { width: 1.75rem; height: 1.75rem; font-size: var(--font-size-caption); }
.mp-avatar--lg { width: 3rem; height: 3rem; font-size: var(--font-size-md); }

/* ============================================================
   Stat / metric card — §7.14 (futurs tableaux de bord)
   ============================================================ */

.mp-stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
  padding: var(--space-20px);
}

.mp-stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8px);
}

.mp-stat-card__label {
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
}

.mp-stat-card__icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--mp-accent);
  flex-shrink: 0;
}

.mp-stat-card__value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

.mp-stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-medium);
}

.mp-stat-card__trend--up   { color: var(--mp-success-text); }
.mp-stat-card__trend--down { color: var(--mp-danger-text); }
.mp-stat-card__trend--flat { color: var(--mp-text-secondary); }

/* ============================================================
   États : vide / chargement (skeleton) / erreur / succès — §7.15
   ============================================================ */

.mp-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-12px);
  padding: var(--space-48px) var(--space-24px);
  color: var(--mp-text-secondary);
}

.mp-empty-state__icon { width: 2.5rem; height: 2.5rem; opacity: 0.6; }
.mp-empty-state__title { font-size: var(--font-size-md); font-weight: var(--font-weight-bold); color: var(--mp-text); }

.mp-skeleton {
  background: var(--mp-border);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.mp-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: mp-shimmer 1.4s ease-in-out infinite;
}

@keyframes mp-shimmer { 100% { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  .mp-skeleton::after { animation: none; display: none; }
}

.mp-inline-status {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
  padding: var(--space-12px) var(--space-16px);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}
/* Re-QA #1 : `display: flex` ci-dessus l'emporte sur le défaut UA
   `[hidden] { display: none }` — sans cette garde, le bandeau « Hors ligne —
   reconnexion… » de l'écran d'encaissement (marqué `hidden` tant qu'on est en
   ligne) restait affiché EN PERMANENCE, trompeur pour le staff. Même correctif
   que `.order-status__live[hidden]` (primitives.css) ; les indicateurs `.kds-*`
   ont déjà chacun leur garde. */
.mp-inline-status[hidden] { display: none; }

.mp-inline-status--error   { background: var(--mp-danger-bg); color: var(--mp-danger-text); }
.mp-inline-status--success { background: var(--mp-success-bg); color: var(--mp-success-text); }
.mp-inline-status--warning { background: var(--mp-warning-bg); color: var(--mp-warning-text); }
.mp-inline-status--info    { background: var(--mp-info-bg); color: var(--mp-info-text); }

/* ============================================================
   Navigation back-office : barre + sidebar — §7.16
   ============================================================ */

.mp-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12px);
  height: 64px;
  padding: 0 var(--space-16px);
  background: var(--mp-surface);
  border-bottom: 1px solid var(--mp-border);
}

/* Audit accessibilité jalon 3 (M5, design-system §8.7 : reflow à 320px CSS
   sans défilement horizontal) : `.mp-topbar` en flex sans repli débordait
   dès 320px (les deux groupes `.mp-topbar__actions` — hamburger+marque à
   gauche, déconnexion à droite — n'avaient nulle part où aller, `nowrap`
   implicite). Passe sur deux lignes en dessous du repli mobile de la
   sidebar (960px, cf. règle existante ci-dessous) plutôt que de rétrécir
   jusqu'à déborder ; `height` fixe redevient `min-height` pour laisser la
   deuxième ligne s'ajouter sans rogner son contenu. */
@media (max-width: 480px) {
  .mp-topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 64px;
    padding: var(--space-8px) var(--space-16px);
  }
  /* Débordement horizontal à 375px (re-QA jalon 9) : même wrappé sur deux
     lignes, le groupe d'actions de DROITE (« Voir mon menu public » + « Se
     déconnecter » ≈ 398px) dépassait la largeur du viewport. On autorise les
     boutons à se replier ET on condense leurs LIBELLÉS en icône seule sous ce
     repli — le texte reste dans le DOM (accessible name préservé). */
  .mp-topbar__actions { flex-wrap: wrap; }
  .mp-topbar__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

.mp-layout {
  display: flex;
  min-height: 100vh;
}

.mp-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--mp-surface);
  border-right: 1px solid var(--mp-border);
  padding: var(--space-16px) var(--space-8px);
}

.mp-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-4px);
  list-style: none;
  margin: 0;
  padding: 0;
}

.mp-sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
  min-height: var(--tap-target-min);
  padding: 0 var(--space-12px);
  border-radius: var(--radius-sm);
  color: var(--mp-text-secondary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

.mp-sidebar__link:hover { background: var(--mp-canvas); color: var(--mp-text); }

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

.mp-sidebar__icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }

.mp-main {
  flex: 1;
  min-width: 0;
  padding: var(--space-24px);
}

/* Repli mobile (< 960px) : la sidebar quitte le flux, devient un panneau
   glissé (même pattern que .sheet du menu client) plutôt qu'un rétrécissement
   illisible — voir doc §7.16 pour le détail exact attendu de l'implémenteur
   (bouton menu ≥44px dans .mp-topbar, aria-expanded, focus piégé). */
@media (max-width: 960px) {
  .mp-sidebar {
    position: fixed;
    inset: 0 25% 0 0;
    z-index: var(--z-sheet);
    width: auto;
    max-width: 320px;
    box-shadow: var(--shadow-large);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }
  .mp-sidebar[data-open="true"] {
    transform: translateX(0);
  }
  .mp-main {
    padding: var(--space-16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mp-sidebar { transition: none; }
}

/* Rideau derrière la sidebar mobile ouverte : clic pour fermer, jamais
   présent (0 pointer-events) tant qu'elle est repliée ou en desktop. */
.mp-sidebar__overlay {
  display: none;
}

@media (max-width: 960px) {
  .mp-sidebar__overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay-scrim);
    background: var(--mp-scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
  }
  .mp-sidebar__overlay[data-open="true"] {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mp-sidebar__overlay { transition: none; }
}

/* ============================================================
   Extensions implémenteur (back-office) — au-delà des primitives listées
   par docs/design/design-system.md §7, nécessaires à l'assemblage réel du
   layout et des écrans pilotes (passe 1). Même discipline : uniquement des
   tokens, aucune couleur/mesure en dur, préfixe `mp-`. À faire revoir par le
   designer au même titre que le reste (voir compte rendu implémenteur).
   ============================================================ */

/* Masque visuellement un élément sans le retirer des lecteurs d'écran —
   même utilitaire que `.visually-hidden` de primitives.css (menu client),
   dupliqué ici (identique, zéro dépendance à un token de couleur) pour que
   le back-office n'ait pas à charger primitives.css, qui pose des styles de
   `body` liés à --brand-* / --color-* hors périmètre back-office (voir
   design-system.md §1/§3 : le produit n'emprunte jamais la marque tenant). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mp-topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-md);
  color: var(--mp-text);
  text-decoration: none;
}

.mp-topbar__brand:focus-visible,
.mp-topbar__menu-btn:focus-visible {
  outline: var(--focus-ring-width) solid var(--mp-focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.mp-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
}

.mp-topbar__menu-btn {
  display: none;
}

@media (max-width: 960px) {
  .mp-topbar__menu-btn { display: inline-flex; }
}

/* Icône portée par un `.mp-btn` (hamburger, déconnexion, etc.) : le SVG
   inline n'a pas de taille intrinsèque utile, toujours cadrée ici plutôt
   que redéfinie ad hoc à chaque bouton. */
.mp-btn__icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }

/* Icône de 1em (suit la taille de police du texte porteur) — champ en
   erreur (§7.2), bandeau `.mp-inline-status` (§7.15) : contextes où
   l'icône accompagne une ligne de texte de taille courante, jamais la
   couleur seule. */
.mp-icon-sm { width: 1em; height: 1em; flex-shrink: 0; }

/* En-tête de page back-office : titre + action principale ; empile sous
   640px pour ne jamais tronquer le bouton d'action. */
.mp-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16px);
  flex-wrap: wrap;
  margin-bottom: var(--space-24px);
}

.mp-page-header h1 {
  font-size: var(--font-size-xl);
}

/* Groupe de champs apparentés (fieldset natif stylé) : allergènes/régimes,
   options de réglage — remplace le cadre gris par défaut du navigateur. */
.mp-fieldset {
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
  padding: var(--space-8px) var(--space-20px) var(--space-20px);
  margin: 0 0 var(--space-20px);
}

.mp-fieldset legend {
  padding: 0 var(--space-8px);
  font-weight: var(--font-weight-bold);
  color: var(--mp-text);
}

.mp-fieldset__hint {
  margin-top: 0;
  color: var(--mp-text-secondary);
  font-size: var(--font-size-caption);
}

.mp-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-16px);
  row-gap: var(--space-8px);
}

/* Groupe d'options radio empilées (une par ligne) — plus lisible qu'un flux
   en ligne dès que le libellé de chaque option dépasse un mot (ex. réglages
   de présentation du menu). `.mp-radio` garde son propre `display: inline-flex`
   pour l'alignement interne label+bouton. */
.mp-radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
}

.mp-form-actions {
  display: flex;
  align-items: center;
  /* Les boutons (`.mp-btn` = white-space: nowrap) ne se compriment pas : sans
     repli, une rangée d'actions (ex. « Suspendre 15/30/60 min » de la pause de
     prise de commande) déborde horizontalement à ≤375/320px. `flex-wrap: wrap`
     les fait passer à la ligne sans jamais de défilement horizontal ; en
     desktop la rangée tient et ne se replie pas. */
  flex-wrap: wrap;
  gap: var(--space-12px);
  margin-top: var(--space-24px);
}

/* ============================================================
   Extensions implémenteur — passe 2 (écrans back-office restants + auth).
   Rien ci-dessous n'introduit de nouveau token : uniquement des assemblages
   de mise en page à partir des tokens/primitives déjà posés en passe 1.
   ============================================================ */

/* Empilement vertical générique à espacement régulier (cartes de formule/
   zone, contenu interne d'une carte) — évite de dupliquer une marge ad hoc
   à chaque écran qui aligne plusieurs `.mp-card`/blocs les uns sous les
   autres. */
.mp-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-16px);
}

/* Regroupe une action de ligne de tableau qui ouvre un `.mp-dialog` (§7.5) :
   le `<dialog>` fermé n'a pas de rendu (UA stylesheet, `display: none` tant
   qu'il n'est pas `[open]`), ce wrapper ne fait donc que garder son
   déclencheur aligné avec les autres actions de la même cellule. */
.mp-table__action-group {
  display: inline-flex;
  align-items: center;
}

/* Regroupe PLUSIEURS actions de ligne de tableau (ex. "Modifier" +
   "Marquer en rupture") sans qu'elles se chevauchent/s'empilent de façon
   brouillonne : ligne horizontale en desktop (repli mobile ci-dessous, en
   cohérence avec `.mp-table--stacked-mobile`, §7.6). `display: contents` sur
   le `<form>` généré par `button_to` neutralise sa boîte de bloc, pour que
   son `.mp-btn` participe directement à ce flex comme s'il en était
   l'enfant direct — sinon le form (bloc) casse la ligne après le premier
   bouton. */
.mp-table__row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8px);
}

.mp-table__row-actions form {
  display: contents;
}

@media (max-width: 640px) {
  .mp-table__row-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  /* Cibles tactiles ≥44px déjà garanties par `.mp-btn` (min-height) — ici on
     ne fait que leur donner la pleine largeur de la carte empilée, sans
     chevauchement, une par ligne. */
  .mp-table__row-actions .mp-btn {
    width: 100%;
  }
}

/* Paragraphe d'introduction de page (aide, contexte avant un formulaire) —
   mesure de ligne bornée pour la lecture debout/rapide (design-system.md
   §3 : max-width 72ch sur tout bloc de texte de paragraphe long). */
.mp-page-intro {
  max-width: 72ch;
  margin: 0 0 var(--space-24px);
  color: var(--mp-text-secondary);
}

/* Coque des écrans d'authentification (inscription/connexion/mot de passe,
   app.* — design-system.md §1 : jamais la marque d'un établissement).
   Réutilise `.mp-topbar__brand` pour la marque MenuPay, `.mp-card`/
   `.mp-card--elevated` pour la carte de formulaire (§7.4) — seule la coque
   de centrage/largeur est nouvelle ici. */
.mp-auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-32px);
  padding: var(--space-24px);
}

.mp-auth-page__card {
  width: 100%;
  max-width: 440px;
}

.mp-auth-page__card--wide {
  max-width: 620px;
}

.mp-auth-page__footer {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
  text-align: center;
  color: var(--mp-text-secondary);
  font-size: var(--font-size-sm);
}

.mp-auth-page__footer a {
  color: var(--mp-accent);
}

.mp-auth-page__footer a:hover {
  color: var(--mp-accent-hover);
}

/* ============================================================
   Écran de validation d'un import IA (ADR-004 §7). Assemblages à partir des
   tokens/composants déjà posés — aucun nouveau token. Deux briques propres à
   cet écran : le SURLIGNAGE d'un champ incertain (bordure ambre + marqueur)
   et les CHIPS d'allergènes suggérés/confirmés.
   ============================================================ */

/* Attente rassurante (queued/extracting) : la carte reste centrée et calme,
   jamais une page blanche (SPEC §1). Le skeleton réutilise `.mp-skeleton`. */
.mp-import-waiting {
  display: flex;
  flex-direction: column;
  gap: var(--space-16px);
  align-items: flex-start;
}

.mp-import-waiting__steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
  width: 100%;
}

.mp-import-waiting__bar {
  height: var(--space-8px);
  border-radius: var(--radius-pill);
}

/* Carte de relecture d'un plat/formule. Bordure fine par défaut (parti pris
   bordures > ombres) ; se colore en ambre si l'élément porte un champ
   incertain, pour attirer l'œil sans masquer le contenu. */
.mp-review-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
}

.mp-review-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-8px);
}

.mp-review-item__name {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.mp-review-item__price {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}

.mp-review-item__desc {
  color: var(--mp-text-secondary);
  margin: 0;
}

.mp-review-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4px);
}

.mp-review-section__label {
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-medium);
  color: var(--mp-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mp-review-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8px);
  align-items: center;
}

/* Surlignage d'un champ incertain (`low_confidence_fields`, ADR-004 §3) :
   bordure ambre + fond très léger. Jamais la couleur SEULE — un marqueur
   texte `.mp-uncertain-flag` (icône + « À vérifier ») l'accompagne toujours. */
.mp-uncertain {
  border: 1px solid var(--mp-warning-text);
  background: var(--mp-warning-bg);
  border-radius: var(--radius-xs);
  padding: var(--space-4px) var(--space-8px);
}

.mp-uncertain-flag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  padding: var(--space-4px) var(--space-8px);
  border-radius: var(--radius-pill);
  background: var(--mp-warning-bg);
  color: var(--mp-warning-text);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
}

.mp-uncertain-flag .mp-badge__icon { width: 0.9em; height: 0.9em; flex-shrink: 0; }

/* Note d'extraction affichée EN CLAIR sur la carte (pas seulement en tooltip —
   design-system §7.10 : le tooltip n'est jamais l'unique porteur). */
.mp-review-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-8px);
  color: var(--mp-warning-text);
  font-size: var(--font-size-sm);
  max-width: 72ch;
}

.mp-review-note .mp-icon-sm { flex-shrink: 0; margin-top: 0.15em; }

/* Chip d'allergène/régime. `--suggested` : ambre, en attente de confirmation
   explicite. `--confirmed` : vert, visible côté client. Le chip suggéré porte
   son bouton de confirmation (button_to → confirm!). */
.mp-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  padding: var(--space-4px) var(--space-8px);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
  border: 1px solid var(--mp-border);
}

.mp-chip svg { width: 1em; height: 1em; flex-shrink: 0; }

.mp-chip--suggested { background: var(--mp-warning-bg); color: var(--mp-warning-text); border-color: var(--mp-warning-text); }
.mp-chip--confirmed { background: var(--mp-success-bg); color: var(--mp-success-text); border-color: var(--mp-success-text); }

.mp-chip__tag { font-weight: var(--font-weight-regular); opacity: 0.85; }

/* Le button_to « Confirmer » est un frère du chip dans `.mp-review-chips`
   (jamais imbriqué dans le <span> du chip) — `display: contents` neutralise
   la boîte du <form> pour qu'il participe directement au flex des chips. */
.mp-review-chips form { display: contents; }
.mp-chip__confirm.mp-btn { min-height: var(--tap-target-min); }

/* Rappel produit visible : une suggestion non confirmée n'apparaît jamais
   côté client (ADR-003 §7). */
.mp-review-hint {
  color: var(--mp-text-secondary);
  font-size: var(--font-size-sm);
  max-width: 72ch;
}

/* ============================================================
   Écran d'encaissement (back-office tablette comptoir) — jalon 6
   ------------------------------------------------------------
   Spécifié dans docs/design/ecran-encaissement.md. Composition par-dessus les
   primitives existantes (`.mp-card`, `.mp-btn`, `.mp-badge`) — additif, tokens
   --mp-* uniquement, aucune couleur en dur. Liste des commandes `placed` à
   encaisser, geste rapide en plein rush.
   ============================================================ */

/* Grille de cartes « à encaisser » — dense mais aérée, tablette d'abord. */
.mp-cashier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: var(--space-16px);
}

/* Carte commande à encaisser (hérite de .mp-card). */
.mp-cashier-ticket__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-12px);
  margin-bottom: var(--space-12px);
}

/* OÙ — zone+table (« Terrasse 3 ») ou « Comptoir » : bien visible, on encaisse
   la bonne commande sans confusion. */
.mp-cashier-ticket__where {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
}
.mp-cashier-ticket__ref {
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Colonne de droite de l'en-tête : montant (le plus gros) au-dessus des badges. */
.mp-cashier-ticket__head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-8px);
  flex-shrink: 0;
}

/* Montant — l'information à décider en un coup d'œil, la plus grosse. */
.mp-cashier-ticket__amount {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Config figée d'une ligne (variantes/options) — précision discrète. */
.mp-cashier-ticket__config {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
}

/* Annulation avant encaissement (spec §2.2) — action secondaire discrète,
   sous les moyens de paiement ; le poids « danger » est porté par le dialogue. */
.mp-cashier-ticket__cancel {
  margin-top: var(--space-8px);
  display: flex;
  justify-content: flex-end;
}

.mp-cashier-ticket__items {
  list-style: none;
  margin: 0 0 var(--space-16px);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4px);
  font-size: var(--font-size-base);
  color: var(--mp-text);
}
.mp-cashier-ticket__items li {
  display: flex;
  gap: var(--space-8px);
}
.mp-cashier-ticket__items .qty {
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
}

/* Zone d'action : « Encaisser » → révèle le choix du moyen en place (2 gros
   boutons Espèces / CB terminal). 2 taps max, délibéré, rapide (doc §2). */
.mp-cashier-ticket__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8px);
}
/* flex-basis 0 + grow : les 2 moyens se partagent la ligne ; s'ils ne tiennent
   pas côte à côte (≤320px), `flex-wrap` les empile plein-largeur — jamais de
   débordement horizontal, cible ≥44px conservée par `.mp-btn`. */
.mp-cashier-ticket__actions .mp-btn { flex: 1 1 0; }
/* Le second temps (choix du moyen) : deux button_to côte à côte, cible ≥48px. */
.mp-cashier-methods {
  display: flex;
  gap: var(--space-8px);
}
.mp-cashier-methods form { display: contents; }
.mp-cashier-methods .mp-btn { flex: 1; }

/* Récap de fin de service — total simple des encaissements (lecture, jalon 6). */
.mp-cashier-recap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-24px);
  align-items: baseline;
}
.mp-cashier-recap__total {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}
.mp-cashier-recap__split {
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
}

/* Nouvelle commande `placed` arrivée en direct : halo bref, jamais la couleur
   seule (elle porte déjà tout son texte). Neutralisé sous reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  .mp-cashier-ticket--new { animation: mp-cashier-in var(--duration-slow) var(--ease-out); }
  @keyframes mp-cashier-in {
    from { transform: translateY(-6px); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }
}

/* ============================================================
   Jalon 7 — ACTIVATION PAIEMENT (KYC) & REMBOURSEMENT (back-office, --mp-*)
   ------------------------------------------------------------
   Spécifié dans docs/design/ecran-paiement.md §5-§6. Additif, tokens --mp-*
   uniquement, aucune couleur en dur. Composition par-dessus les primitives
   existantes (.mp-card, .mp-btn, .mp-badge, .mp-field, .mp-dialog). Persona
   Karim : méfiant, échaudé — l'activation est un BÉNÉFICE NON BLOQUANT, jamais
   un mur. Le KYC lui-même est hébergé par Stripe (lien), pas redessiné ici.
   ============================================================ */

/* Carte « Activez le paiement à table » — formulée par le bénéfice (§5.1). */
.mp-kyc-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-16px);
}
.mp-kyc-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin: 0;
}
.mp-kyc-card__title svg { width: 1.2em; height: 1.2em; flex-shrink: 0; }

/* Corps : arguments qui parlent à Karim (un geste, argent direct, zéro commission). */
.mp-kyc-card__body {
  color: var(--mp-text-secondary);
  max-width: 72ch;
}

/* Ligne d'état — réutilise .mp-badge (icône + texte, jamais couleur seule). */
.mp-kyc-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8px);
}

/* Déminage explicite : « vous pouvez le faire plus tard, la caisse marche déjà ».
   Rassure le méfiant — jamais un bandeau « action requise » anxiogène. */
.mp-kyc-card__defer {
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
  max-width: 72ch;
}

/* Message d'état « en cours de vérification » qui redemande une info Stripe :
   réutilise .mp-inline-status--warning (icône + texte), langage simple. */
.mp-kyc-card__requirement {
  /* pas de style propre : l'implémenteur pose .mp-inline-status--warning */
  display: block;
}

/* ---- Écran de remboursement — sobre, tracé (§6) ---- */
.mp-refund {
  display: flex;
  flex-direction: column;
  gap: var(--space-16px);
  max-width: 32rem;
}
.mp-refund__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-4px);
}
.mp-refund__title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  margin: 0;
}
/* Rappel : payé en ligne · montant · table — montant AUTORITAIRE serveur. */
.mp-refund__meta {
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Bloc « montant à rembourser » : radios totalité/partiel (aucun pré-coché). */
.mp-refund__amount {
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
}
/* Champ du montant partiel — révélé quand l'option « partiel » est active. */
.mp-refund__partial {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
  padding-left: var(--space-24px);
}
.mp-refund__partial[hidden] { display: none; }
.mp-refund__partial .mp-input { max-width: 9rem; }

/* Actions : Annuler (ghost/secondary) + Rembourser (danger, via dialogue de
   confirmation .mp-dialog — jamais un confirm() ni un bouton frôlable). */
.mp-refund__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8px);
  flex-wrap: wrap;
}

/* ============================================================
   Jalon 7 (sous-tâche 3) — wiring implémenteur : classes utilitaires
   ajoutées AUTOUR des primitives designer (.mp-kyc-*/.mp-refund-*), tokens
   --mp-* uniquement, aucune couleur en dur. Activation (KYC), historique de
   remboursement, liste de réconciliation.
   ============================================================ */

/* Actions de la carte d'activation (boutons alignés, retour à la ligne mobile). */
.mp-kyc-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8px);
}
/* Message d'état sous le badge (non activé / vérification / actif). */
.mp-kyc-card__message {
  color: var(--mp-text);
  max-width: 72ch;
  margin: 0;
}

/* Historique des remboursements d'une commande (repli <details> natif). */
.mp-refund-history {
  margin-top: var(--space-8px);
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
}
.mp-refund-history summary {
  cursor: pointer;
  color: var(--mp-accent);
}
.mp-refund-history ul {
  margin: var(--space-8px) 0 0;
  padding-left: var(--space-20px);
}
.mp-refund-history__done { color: var(--mp-text-secondary); }

/* Liste d'écarts de réconciliation (orphelins / non finalisés). */
.mp-recon-list {
  margin: var(--space-12px) 0 0;
  padding-left: var(--space-20px);
  font-variant-numeric: tabular-nums;
}
.mp-recon-list li { margin-bottom: var(--space-4px); }

/* ============================================================
   Jalon 8 — ONBOARDING GUIDÉ (wizard, personnalisation, relecture
   des traductions, modification en langage naturel) — back-office --mp-*
   ------------------------------------------------------------
   Spécifié dans docs/design/parcours-onboarding.md. Additif, tokens --mp-*
   uniquement, aucune couleur/mesure en dur. Composition par-dessus les
   primitives existantes (.mp-card, .mp-btn, .mp-badge, .mp-field,
   .mp-inline-status). Préfixes exclusifs : .mp-wizard*, .mp-brand-preview*,
   .mp-lang-picker, .mp-tr*, .mp-nl*, .mp-testorder*. Persona Karim :
   pressé, technophobe — le wizard RASSURE, ne piège jamais, ne bloque jamais.
   Aucune vue ERB / logique ici : l'implémenteur branche (doc §12).
   ============================================================ */

/* --- Coque du wizard (doc §1.2) --------------------------------------- */
.mp-wizard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--mp-canvas);
  color: var(--mp-text);
  font-family: var(--font-family-default);
}
.mp-wizard__topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16px);
  min-height: var(--tap-target-comfortable);
  padding: var(--space-12px) var(--space-20px);
  background: var(--mp-surface);
  border-bottom: 1px solid var(--mp-border);
  box-shadow: var(--shadow-subtle);
}
.mp-wizard__brand { font-weight: var(--font-weight-bold); }
/* Rappel de temps : positif, jamais un compte à rebours anxiogène. */
.mp-wizard__time { font-size: var(--font-size-sm); color: var(--mp-text-secondary); }
.mp-wizard__exit {
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
}
.mp-wizard__body {
  flex: 1 1 auto;
  width: 100%;
  max-width: 46rem;         /* largeur de lecture — jamais la pleine largeur dense */
  margin: 0 auto;
  padding: var(--space-32px) var(--space-20px) var(--space-96px);
}
.mp-wizard__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-8px);
}
.mp-wizard__lede {
  font-size: var(--font-size-base);
  color: var(--mp-text-secondary);
  max-width: 72ch;
  margin: 0 0 var(--space-24px);
}

/* --- Progression (doc §1.3) — <ol> de 5 pastilles reliées ------------- */
.mp-wizard__progress {
  position: sticky;
  top: var(--tap-target-comfortable);
  z-index: 9;
  display: flex;
  align-items: flex-start;
  gap: var(--space-8px);
  margin: 0;
  padding: var(--space-16px) var(--space-20px);
  list-style: none;
  background: var(--mp-canvas);
  border-bottom: 1px solid var(--mp-border);
}
.mp-wizard__progress-step {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4px);
  text-align: center;
  min-width: 0;
}
/* Le lien/bouton d'une étape faite (retour) et le libellé courant. */
.mp-wizard__progress-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4px);
  min-height: var(--tap-target-min);
  color: var(--mp-text-secondary);
  text-decoration: none;
}
.mp-wizard__dot {
  --dot-size: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: var(--radius-pill);
  border: 2px solid var(--mp-border-strong);
  background: var(--mp-surface);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-bold);
  color: var(--mp-text-secondary);
  flex-shrink: 0;
}
.mp-wizard__dot svg { width: 0.85em; height: 0.85em; }
.mp-wizard__step--done .mp-wizard__dot {
  background: var(--mp-accent);
  border-color: var(--mp-accent);
  color: var(--mp-on-accent);
}
.mp-wizard__step--current .mp-wizard__dot {
  border-color: var(--mp-accent);
  color: var(--mp-accent);
  box-shadow: 0 0 0 3px var(--mp-accent-surface);
}
.mp-wizard__step--current .mp-wizard__label { color: var(--mp-text); font-weight: var(--font-weight-medium); }
.mp-wizard__label {
  font-size: var(--font-size-caption);
  line-height: 1.2;
}
/* Barre de remplissage compacte (mobile, doc §1.3). */
.mp-wizard__progress--compact { flex-direction: column; align-items: stretch; gap: var(--space-8px); }
.mp-wizard__progress-count { font-size: var(--font-size-sm); font-weight: var(--font-weight-bold); }
.mp-wizard__progress-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--mp-border);
  overflow: hidden;
}
.mp-wizard__progress-bar > span {
  display: block;
  height: 100%;
  background: var(--mp-accent);
  border-radius: inherit;
  transition: width var(--transition-base);
}

/* --- Navigation d'étape (doc §1.4) — barre collante en bas ------------ */
.mp-wizard__nav {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--space-12px);
  padding: var(--space-16px) var(--space-20px);
  background: var(--mp-surface);
  border-top: 1px solid var(--mp-border);
  box-shadow: var(--shadow-subtle);
}
.mp-wizard__nav-spacer { flex: 1 1 auto; }   /* pousse le primaire à droite */

/* --- Bandeau de reprise sur le tableau de bord (doc §1.5) ------------- */
.mp-wizard-resume {
  display: flex;
  align-items: center;
  gap: var(--space-16px);
  flex-wrap: wrap;
  padding: var(--space-16px) var(--space-20px);
  background: var(--mp-accent-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
}
.mp-wizard-resume__text { flex: 1 1 12rem; }
.mp-wizard-resume__actions { display: flex; gap: var(--space-8px); flex-wrap: wrap; }

/* --- Étape 3 : personnalisation — split contrôles / aperçu (doc §4.1) - */
.mp-brand-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-32px);
  align-items: start;
}
.mp-brand-preview {
  position: sticky;
  top: calc(var(--tap-target-comfortable) + var(--space-64px));
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--mp-surface);
}
.mp-brand-preview__frame {
  /* Aperçu du VRAI menu client à échelle réduite ; la couleur choisie est
     portée par --brand-primary sur ce conteneur via le CSSOM (Stimulus
     brand-preview#paint, hors attribut style= : la CSP style-src reste intacte).
     Valeur PAR DÉFAUT ici (thème MenuPay) tant que rien n'est peint. */
  --brand-primary: #0B6E5B;
  --brand-on-primary: #FFFFFF;
  padding: var(--space-16px);
}
/* Bouton « Ajouter » de l'aperçu : suit la couleur de marque via var(), sans
   style= inline (l'ancien inline était bloqué par la CSP). */
.mp-brand-preview__cta {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--brand-on-primary);
}
.mp-brand-preview__empty {
  color: var(--mp-text-secondary);
  font-style: italic;
}
.mp-brand-preview__caption {
  padding: var(--space-8px) var(--space-16px);
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
  border-top: 1px solid var(--mp-border);
}
/* Dépôt du logo (doc §4.2) — cliquable ET drag-and-drop, cible large. */
.mp-brand-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-8px);
  min-height: 7rem;
  padding: var(--space-24px);
  text-align: center;
  border: 2px dashed var(--mp-border-strong);
  border-radius: var(--radius-md);
  background: var(--mp-canvas);
  color: var(--mp-text-secondary);
  cursor: pointer;
}
.mp-brand-logo--dragover { border-color: var(--mp-accent); background: var(--mp-accent-surface); }
.mp-brand-logo__preview {
  display: flex;
  align-items: center;
  gap: var(--space-12px);
}
.mp-brand-logo__thumb {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
}
/* Sélecteur de couleur (doc §4.3) — 8 teintes sûres, cibles ≥44px. */
.mp-brand-color__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8px);
}
.mp-brand-color__swatch {
  width: var(--tap-target-min);
  height: var(--tap-target-min);
  border-radius: var(--radius-pill);
  border: 2px solid var(--mp-border);
  cursor: pointer;
  padding: 0;
}
.mp-brand-color__swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--mp-accent-surface);
  border-color: var(--mp-accent);
}
/* Pastilles à couleurs FIXES : une classe statique par teinte de la palette
   (ADR-009 §4). Remplace le `style="background:…"` inline bloqué par la CSP
   style-src 'self'. Les hex correspondent à `swatches` dans la vue. */
.mp-swatch--0b6e5b { background: #0B6E5B; }
.mp-swatch--c0392b { background: #C0392B; }
.mp-swatch--b9770e { background: #B9770E; }
.mp-swatch--1f6fb2 { background: #1F6FB2; }
.mp-swatch--6c3483 { background: #6C3483; }
.mp-swatch--17795e { background: #17795E; }
.mp-swatch--a93226 { background: #A93226; }
.mp-swatch--2c3e50 { background: #2C3E50; }
/* Sélecteur de langues (doc §4.4). */
.mp-lang-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8px);
  align-items: center;
}
/* Chaque langue = une cible tactile ≥44px (audit : cases 13×13px trop petites).
   Le label ENTIER est cliquable et porte le plancher tactile + un padding
   confortable ; la case elle-même est agrandie. */
.mp-lang-picker__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8px);
  min-height: var(--tap-target-min);
  padding: var(--space-8px) var(--space-12px);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.mp-lang-picker__item input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

/* --- Étape 5 : commande test (doc §6) -------------------------------- */
.mp-testorder {
  display: flex;
  flex-direction: column;
  gap: var(--space-24px);
  align-items: stretch;
}
.mp-testorder__scan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-24px);
}
.mp-testorder__qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8px);
  padding: var(--space-16px);
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
}
.mp-testorder__qr img,
.mp-testorder__qr svg { width: 10rem; height: 10rem; }
.mp-testorder__qr-label { font-size: var(--font-size-sm); color: var(--mp-text-secondary); }
/* Zone d'attente vivante → devient le récap de la commande reçue.
   `display: flex` bat le `[hidden]` global (même spécificité) : on rétablit
   l'attribut hidden avec une règle classe+attribut (spécificité supérieure)
   pour que le contrôleur test-order puisse réellement MASQUER l'attente à
   l'arrivée de la commande (parcours-onboarding §6.3 : « la zone se transforme »). */
.mp-testorder__waiting[hidden],
.mp-testorder__result[hidden] { display: none; }
.mp-testorder__waiting {
  display: flex;
  align-items: center;
  gap: var(--space-12px);
  padding: var(--space-20px);
  border: 1px dashed var(--mp-border-strong);
  border-radius: var(--radius-md);
  color: var(--mp-text-secondary);
}
.mp-testorder__spinner {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--mp-border);
  border-top-color: var(--mp-accent);
  flex-shrink: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .mp-testorder__spinner { animation: mp-spin 0.9s linear infinite; }
}
@keyframes mp-spin { to { transform: rotate(360deg); } }
.mp-testorder__result {
  display: flex;
  flex-direction: column;
  gap: var(--space-12px);
  padding: var(--space-20px);
  border: 1px solid var(--mp-success-text);
  border-radius: var(--radius-md);
  background: var(--mp-success-bg);
}
/* Récap de la commande test reçue (articles + total), rempli par Stimulus. */
.mp-testorder__recap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.mp-testorder__recap li { display: flex; gap: var(--space-8px); }
.mp-testorder__recap .qty { font-weight: var(--font-weight-medium); flex-shrink: 0; }
.mp-testorder__recap-total {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
}

/* --- Relecture des traductions (doc §7) — non bloquant --------------- */
.mp-tr__langtabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8px);
  margin-bottom: var(--space-16px);
}
.mp-tr__row {
  display: flex;
  flex-direction: column;
  gap: var(--space-4px);
  padding: var(--space-12px) 0;
  border-bottom: 1px solid var(--mp-border);
}
.mp-tr__source { font-weight: var(--font-weight-medium); }
.mp-tr__target {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
}
/* Champ de traduction : cible tactile ≥44px (audit : ~21px trop petit). */
.mp-tr__target input[type="text"] {
  flex: 1 1 auto;
  min-height: var(--tap-target-min);
  padding: var(--space-8px) var(--space-12px);
}
/* Marqueur auto vs relu-humain : icône + TEXTE, jamais la couleur seule. */
.mp-tr__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  font-size: var(--font-size-caption);
}
.mp-tr__badge svg { width: 0.9em; height: 0.9em; }
.mp-tr__badge--auto  { color: var(--mp-text-secondary); }
.mp-tr__badge--human { color: var(--mp-success-text); font-weight: var(--font-weight-medium); }
.mp-tr__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12px);
  margin-top: var(--space-24px);
}
.mp-tr__count { font-size: var(--font-size-sm); color: var(--mp-text-secondary); }

/* --- Modification en langage naturel (doc §8) : proposer → confirmer -- */
.mp-nl {
  display: flex;
  flex-direction: column;
  gap: var(--space-12px);
}
.mp-nl__label {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
  font-weight: var(--font-weight-bold);
}
/* Exemples cliquables (chips) — désamorcent la page blanche. */
.mp-nl__examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8px);
}
.mp-nl__chip {
  min-height: var(--tap-target-min);
  padding: var(--space-4px) var(--space-12px);
  border-radius: var(--radius-pill);
  border: 1px solid var(--mp-border-strong);
  background: var(--mp-surface);
  color: var(--mp-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
}
.mp-nl__chip:hover { border-color: var(--mp-accent); color: var(--mp-text); }
/* Bloc des propositions : rien n'est appliqué avant confirmation. */
.mp-nl__proposal {
  display: flex;
  flex-direction: column;
  gap: var(--space-12px);
  margin-top: var(--space-16px);
}
.mp-nl-change {
  display: flex;
  align-items: flex-start;
  gap: var(--space-12px);
  padding: var(--space-16px);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
  background: var(--mp-surface);
}
.mp-nl-change--dismissed { opacity: 0.5; }   /* décochée avant confirmation */
.mp-nl-change__icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; color: var(--mp-text-secondary); }
.mp-nl-change__body { flex: 1 1 auto; min-width: 0; }
.mp-nl-change__title { font-weight: var(--font-weight-medium); }
/* avant → après explicite (icône+texte, jamais la couleur seule). */
.mp-nl-change__delta {
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
  font-variant-numeric: tabular-nums;
}
.mp-nl-change__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target-min);
  height: var(--tap-target-min);
  flex-shrink: 0;
}
.mp-nl__confirm {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12px);
  margin-top: var(--space-16px);
}

/* --- Responsive onboarding (doc §1.2, §4.1) : mobile-first strict ----- */
@media (max-width: 640px) {
  /* Personnalisation : aperçu AU-DESSUS des contrôles, non collant. */
  .mp-brand-layout { grid-template-columns: 1fr; gap: var(--space-24px); }
  .mp-brand-preview { position: static; order: -1; }
  /* Navigation d'étape : pile pleine largeur, primaire d'abord. */
  .mp-wizard__nav { flex-direction: column-reverse; align-items: stretch; }
  .mp-wizard__nav .mp-btn { width: 100%; }
  .mp-wizard__nav-spacer { display: none; }
  /* Commande test : QR et attente empilés pleine largeur. */
  .mp-testorder__scan { flex-direction: column; align-items: stretch; }
}

/* ============================================================
   Jalon 9 — LE QUOTIDIEN DU RESTAURATEUR (back-office --mp-*)
   ------------------------------------------------------------
   Spécifié dans docs/design/parcours-quotidien.md. Additif, tokens --mp-*
   uniquement, aucune couleur/mesure en dur, aucune classe existante modifiée.
   Composition par-dessus les primitives déjà posées (.mp-table, .mp-badge,
   .mp-btn, .mp-card, .mp-stat-card, .mp-dialog, .mp-field, .mp-avatar).
   Préfixes EXCLUSIFS nouveaux : .mp-staff-*, .mp-invite-*, .mp-segmented*,
   .mp-stat-grid, .mp-ranklist*, .mp-peak*, .mp-client-flag*.
   Le 86 temps réel CÔTÉ CLIENT et l'avis Google (page de suivi) vivent sur
   les surfaces publiques (primitives.css, tokens --color-*/--brand-*) : ils
   NE dépendent d'aucune classe ci-dessous (voir doc §5-§6) — components.css
   n'est chargé que par le back-office.
   ============================================================ */

/* --- 1. Gestion du personnel (doc §1) -------------------------------- */

/* Cellule d'identité d'un membre dans la table « Personnel » : avatar
   (.mp-avatar) + nom + e-mail empilés. L'e-mail peut être long : il se coupe
   proprement plutôt que d'élargir la colonne / faire déborder la carte mobile. */
.mp-staff-identity {
  display: flex;
  align-items: center;
  gap: var(--space-12px);
  min-width: 0;
}
.mp-staff-identity__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mp-staff-identity__name {
  font-weight: var(--font-weight-medium);
}
.mp-staff-identity__email {
  font-size: var(--font-size-sm);
  color: var(--mp-text-secondary);
  overflow-wrap: anywhere;
}

/* Lien d'invitation copiable (mode sans e-mail, ADR-011 §3) : champ lecture
   seule (.mp-input) + bouton « Copier » (.mp-btn--secondary) côte à côte,
   repli en colonne sur mobile. Le jeton est long : le champ prend la place
   disponible, le bouton garde sa cible ≥44px. */
.mp-invite-link {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: var(--space-8px);
}
.mp-invite-link__field {
  flex: 1 1 16rem;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
/* Confirmation « Lien copié » — succès discret, annoncé en aria-live par
   l'implémenteur. Icône + texte (jamais la couleur seule) ; masqué au repos. */
.mp-invite-link__copied {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  font-size: var(--font-size-sm);
  color: var(--mp-success-text);
  font-weight: var(--font-weight-medium);
}
.mp-invite-link__copied[hidden] { display: none; }
.mp-invite-link__copied svg { width: 1em; height: 1em; flex-shrink: 0; }

/* --- 2. Sélecteur de période (doc §3) — contrôle segmenté --------------
   Jour / Semaine. Ce sont des LIENS (la période est un paramètre d'URL,
   rendu serveur — au rechargement l'état est correct). L'option active porte
   `aria-current="page"` (jamais la couleur seule : fond + ombre + poids). */
.mp-segmented {
  display: inline-flex;
  gap: var(--space-4px);
  padding: var(--space-4px);
  background: var(--mp-canvas);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
}
.mp-segmented__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-target-min);
  padding: 0 var(--space-16px);
  border-radius: var(--radius-sm);
  color: var(--mp-text-secondary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}
.mp-segmented__option:hover { color: var(--mp-text); }
.mp-segmented__option[aria-current="page"] {
  background: var(--mp-surface);
  color: var(--mp-text);
  box-shadow: var(--shadow-subtle);
}

/* --- 3. Statistiques (doc §3) --------------------------------------- */

/* Grille des stat cards (.mp-stat-card, §7.14) — lisible en un coup d'œil,
   mobile-first : une colonne étroite, autant que la largeur le permet. */
.mp-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-16px);
}

/* Best-sellers RÉELS (comptes de ventes, ADR-011 §4) — liste ordonnée,
   rang + nom + nombre. Distincte du drapeau `best_seller` curé (menu client). */
.mp-ranklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.mp-ranklist__item {
  display: flex;
  align-items: center;
  gap: var(--space-12px);
  padding: var(--space-12px) 0;
  border-bottom: 1px solid var(--mp-border);
}
.mp-ranklist__item:last-child { border-bottom: none; }
.mp-ranklist__rank {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-pill);
  background: var(--mp-accent-surface);
  color: var(--mp-accent);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}
.mp-ranklist__name { flex: 1 1 auto; min-width: 0; }
.mp-ranklist__count {
  flex-shrink: 0;
  color: var(--mp-text-secondary);
  font-weight: var(--font-weight-medium);
  font-variant-numeric: tabular-nums;
}

/* Heures de pointe (ADR-011 §4) — histogramme à SÉRIE UNIQUE, monochrome
   accent, chaque barre TOUJOURS accompagnée de son libellé d'heure et de sa
   valeur chiffrée (jamais l'info par la seule longueur/couleur). */
.mp-peak {
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
}
.mp-peak__row {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  align-items: center;
  gap: var(--space-8px);
  font-size: var(--font-size-sm);
}
.mp-peak__hour {
  color: var(--mp-text-secondary);
  font-variant-numeric: tabular-nums;
}
.mp-peak__track {
  height: var(--space-16px);
  background: var(--mp-canvas);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.mp-peak__bar {
  height: 100%;
  background: var(--mp-accent);
  border-radius: inherit;
}
.mp-peak__value {
  color: var(--mp-text-secondary);
  font-weight: var(--font-weight-medium);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* Largeurs DISCRÈTES par palier de 5 % — même parti pris CSP-safe que
   .mp-swatch--* (jalon 8) : la CSP `style-src 'self'` interdit un
   `style="width:…"` en dur. L'implémenteur arrondit la proportion (valeur /
   max de la période) au palier le plus proche. 0 % = heure sans vente. */
.mp-peak__bar--0   { width: 0; }
.mp-peak__bar--5   { width: 5%; }
.mp-peak__bar--10  { width: 10%; }
.mp-peak__bar--15  { width: 15%; }
.mp-peak__bar--20  { width: 20%; }
.mp-peak__bar--25  { width: 25%; }
.mp-peak__bar--30  { width: 30%; }
.mp-peak__bar--35  { width: 35%; }
.mp-peak__bar--40  { width: 40%; }
.mp-peak__bar--45  { width: 45%; }
.mp-peak__bar--50  { width: 50%; }
.mp-peak__bar--55  { width: 55%; }
.mp-peak__bar--60  { width: 60%; }
.mp-peak__bar--65  { width: 65%; }
.mp-peak__bar--70  { width: 70%; }
.mp-peak__bar--75  { width: 75%; }
.mp-peak__bar--80  { width: 80%; }
.mp-peak__bar--85  { width: 85%; }
.mp-peak__bar--90  { width: 90%; }
.mp-peak__bar--95  { width: 95%; }
.mp-peak__bar--100 { width: 100%; }

/* --- 4. Opérations menu « en un tap » (doc §4) ---------------------- */

/* Marqueur de réassurance « visible côté client » sous les actions rapides
   d'une ligne de plat (86, plat du jour, masquer/afficher, prix) : dit à
   Karim que son geste a un effet public immédiat. Icône + texte, jamais la
   couleur seule. Neutre au repos, vert bref après une action réussie
   (.mp-client-flag--live, posé par l'implémenteur puis retiré). */
.mp-client-flag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  font-size: var(--font-size-caption);
  color: var(--mp-text-secondary);
}
.mp-client-flag svg { width: 0.9em; height: 0.9em; flex-shrink: 0; }
.mp-client-flag--live { color: var(--mp-success-text); font-weight: var(--font-weight-medium); }

