/* Base commune aux trois espaces (client, caisse, administration) : éléments de formulaire, boutons,
   cartes, tableaux, fenêtres. Rien de spécifique à un espace ici. */
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{ background:var(--paper); color:var(--ink); font-family:'Futura Book', 'Helvetica Neue', Arial, sans-serif; min-height:100vh; }
.brand{ font-family:'Playfair Display', serif; font-weight:700; }
input, select{
  width:100%; padding:10px 12px; font-family:'Futura Book', 'Helvetica Neue', Arial, sans-serif; font-size:14px;
  background:var(--panel); border:1px solid var(--line); color:var(--ink);
}
textarea{
  width:100%; padding:10px 12px; font-family:'Futura Book', 'Helvetica Neue', Arial, sans-serif; font-size:14px;
  background:var(--panel); border:1px solid var(--line); color:var(--ink); resize:vertical;
}
input::placeholder, textarea::placeholder{ color:#9a9a9a; }
input:focus, textarea:focus{ outline:2px solid var(--red); outline-offset:1px; }
label{ display:block; margin-bottom:14px; }
label span{ display:block; font-size:11px; letter-spacing:.08em; opacity:.65; margin-bottom:4px; }
button{ font-family:'Futura Book', 'Helvetica Neue', Arial, sans-serif; cursor:pointer; border:none; }
.btn-primary{ background:var(--red); color:#FFFFFF; padding:12px; font-size:12px; font-weight:700; letter-spacing:.05em; width:100%; }
.btn-outline{ background:transparent; border:1px solid var(--ink); color:var(--ink); padding:9px 14px; font-size:12px; font-weight:700; }
.btn-ghost{ background:transparent; color:var(--ink); opacity:.65; font-size:11px; text-decoration:underline; padding:4px; }
.container{ max-width:480px; margin:0 auto; padding:28px 20px 60px; }
.container.wide{ max-width:920px; }
.card{ background:var(--panel); border:1px solid var(--line); padding:20px; }
.dashed{ border-bottom:2px dashed var(--line); }
.row{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.top-nav{
  display:grid; grid-template-columns:1fr auto 1fr; align-items:center; padding:14px 20px;
  position:sticky; top:0; z-index:100; background:var(--paper);
}
.top-nav > :first-child{ grid-column:2; justify-self:center; }
.top-nav > :last-child:not(:only-child){ grid-column:3; justify-self:end; }
.stamp-grid{ display:flex; flex-wrap:wrap; gap:8px; }
.stamp{ width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center; border:1.5px solid var(--line); font-size:12px; color:#FFFFFF; }
.stamp.filled{ background:var(--red); border-color:var(--red); }
.progress-track{ width:100%; height:16px; background:#2a2a2a; border-radius:999px; overflow:hidden; border:1px solid var(--line); }
.progress-fill{ height:100%; background:var(--red); border-radius:999px; transition:width .4s ease; }
.err{ background:#3a1414; color:#ff8a8a; font-size:12px; padding:8px 10px; margin-bottom:12px; border:1px solid var(--red); }
.ok{ background:#1f2e1f; color:#8fd88f; font-size:12px; padding:8px 10px; margin-bottom:12px; border:1px solid #3a5a3a; }
.muted{ opacity:.55; font-size:12px; }
table{ width:100%; border-collapse:collapse; font-size:12px; }
td, th{ padding:6px 4px; border-bottom:1px dotted var(--line); text-align:left; }
.chip{ display:inline-flex; align-items:center; gap:6px; padding:6px 10px; font-size:12px; border:1px solid var(--line); background:var(--panel); margin:3px; cursor:pointer; }
.chip.disabled{ opacity:.4; cursor:default; }
.chip.available{ border-color:#EABA5C; color:#EABA5C; }
/* Statut "reste à traiter" (ex. alertes fraude non acquittées) — même famille que .err mais en ligne,
   sans marge ni bordure pleine largeur : un simple repère visuel dans une cellule de tableau. */
.badge-warn{ display:inline-block; font-size:11px; font-weight:700; letter-spacing:.03em; color:#ff8a8a; }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
/* Sans ça, un <select> (ou tout contenu large) ne rétrécit jamais sous sa largeur naturelle dans une
   colonne de grille (min-width:auto par défaut) : il pousse sa colonne plus large que prévu et fait
   déborder le parent sur le côté — visible dans les formulaires civilité/indicatif+numéro. */
.grid2 > *{ min-width:0; }
@media (max-width:520px){ .grid2{ grid-template-columns:1fr; } }
.qr-box{ background:#fff; padding:12px; display:inline-block; border:1px solid var(--line); }
.modal-bg{ position:fixed; inset:0; background:rgba(0,0,0,.7); display:flex; align-items:center; justify-content:center; padding:16px; z-index:200; }
/* max-height:90vh peut déborder sur mobile si la barre d'adresse est repliée ; overflow:auto en x
   n'est pas voulu ici (voir grid2 ci-dessous pour la vraie cause du débordement latéral), seul le y
   doit défiler. */
.modal{ background:var(--panel); border:1px solid var(--line); width:100%; max-width:380px; padding:20px; max-height:90vh; overflow-y:auto; overflow-x:hidden; }

/* ===================================================================================================
   Socle d'interface partagé — chantier L5 (voir js/ui.js)
   =================================================================================================== */

/* ----- Focus clavier visible -----------------------------------------------------------------------
   Jusqu'ici seuls les champs de saisie montraient le focus : on pouvait parcourir toute l'administration
   à la tabulation sans jamais savoir où l'on se trouvait. La règle vaut pour tout ce qui est actionnable,
   et n'utilise que :focus-visible — le contour n'apparaît donc pas sur un simple clic à la souris ou au
   doigt, uniquement quand la navigation se fait au clavier. */
:where(button, a, select, [tabindex]):focus-visible{
  outline:2px solid var(--red); outline-offset:2px;
}
/* Cases à cocher et boutons radio : le contour décalé les rendait illisibles à cette taille. */
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible{
  outline:2px solid var(--red); outline-offset:2px;
}

/* Texte réservé aux lecteurs d'écran : présent dans l'arbre d'accessibilité, invisible à l'écran.
   Sert notamment à annoncer « Chargement en cours » là où l'on n'affiche plus que des barres grises. */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

/* ----- Fenêtre de confirmation (askConfirm) --------------------------------------------------------
   Remplace confirm(). Le bouton de validation est à droite, le retrait à gauche et en retrait visuel :
   l'ordre de lecture mène à « ne rien faire » par défaut. */
.confirm-modal{ max-width:420px; }
.confirm-modal .confirm-titre{ font-size:15px; margin:0 0 10px; }
.confirm-modal .confirm-message{ font-size:13px; line-height:1.5; margin:0 0 20px; }
.confirm-modal .confirm-actions{ display:flex; align-items:center; justify-content:flex-end; gap:14px; }
.confirm-modal .confirm-actions .btn-outline,
.confirm-modal .confirm-actions .btn-primary{ width:auto; min-width:140px; }
/* En caisse (tablette), les deux boutons occupent toute la largeur et gardent la hauteur tactile. */
body.caisse-page .confirm-modal .confirm-actions{ flex-direction:column-reverse; align-items:stretch; gap:10px; }
body.caisse-page .confirm-modal .confirm-actions .btn-outline,
body.caisse-page .confirm-modal .confirm-actions .btn-primary{ width:100%; min-height:52px; }

/* ----- Messages brefs (toast) ----------------------------------------------------------------------
   Empilés en bas de l'écran. La variable --toast-bas permet à l'espace caisse de les remonter au-dessus
   de sa barre d'action fixe, sans dupliquer la règle. */
.toast-zone{
  position:fixed; left:16px; right:16px; bottom:var(--toast-bas, 20px); z-index:200;
  display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none;
}
.toast{
  pointer-events:auto; cursor:pointer; max-width:560px; width:100%; padding:12px 14px; font-size:13px;
  line-height:1.4; text-align:center; box-shadow:0 6px 18px rgba(0,0,0,.45);
  animation:toast-entree .18s ease-out;
}
.toast-ok{ background:#1f2e1f; color:#a9e5a9; border:1px solid #4a7a4a; }
.toast-err{ background:#3a1414; color:#ff9c9c; border:1px solid var(--red); }
@keyframes toast-entree{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }

/* ----- Squelettes de chargement --------------------------------------------------------------------
   Barres grises animées à la place des « Chargement… » en texte brut : la page garde sa forme pendant
   l'attente, et le contenu ne saute plus à l'arrivée de la réponse. */
.skel{ display:block; }
.skel-ligne{
  display:block; height:12px; margin:9px 0; border-radius:3px;
  background:linear-gradient(90deg, var(--line) 25%, #4a4a4a 37%, var(--line) 63%);
  background-size:400% 100%; animation:skel-balayage 1.3s ease-in-out infinite;
}
.skel-ligne-courte{ width:55%; }
.skel-tr td{ border-bottom:1px dotted var(--line); }
@keyframes skel-balayage{ from{ background-position:100% 50%; } to{ background-position:0 50%; } }
/* Respect du réglage système « réduire les animations » : la barre reste, le balayage s'arrête. */
@media (prefers-reduced-motion: reduce){
  .skel-ligne{ animation:none; background:var(--line); }
  .toast{ animation:none; }
}

/* ===================================================================================================
   Écrans de connexion du personnel (caisse et administration) — chantier de finition sur session.js
   ===================================================================================================
   Remplace les styles en ligne accumulés depuis L1 sur ces trois écrans (identifiant/mot de passe, code
   2FA, verrouillage). Carte centrée à largeur de lecture, cibles tactiles confortables pour une connexion
   au doigt sur la tablette de caisse — l'administration en profite aussi, sans gêner l'usage au clavier. */
.auth-shell{ max-width:340px; margin:0 auto; padding-top:60px; }
.auth-header{ text-align:center; margin-bottom:16px; }
.auth-logo{ height:56px; margin-bottom:10px; }
.auth-title{ font-size:20px; }
.auth-hint{ text-align:center; margin-top:14px; font-size:12px; opacity:.7; }
.auth-shell input, .auth-shell select{ min-height:52px; }
.auth-shell .btn-primary, .auth-shell .btn-outline{ min-height:52px; }

/* Code à six cases (double authentification personnel) — même composant que le code SMS de l'espace
   client (voir css/client.css), redéfini ici car les deux espaces ne partagent pas de feuille de style. */
.otp-cases{ display:flex; gap:8px; justify-content:center; margin-bottom:18px; }
.otp-case{
  width:44px; height:56px; text-align:center; font-size:22px; font-weight:700; padding:0;
  -moz-appearance:textfield;
}
.auth-shell .otp-case{ min-height:0; }
.otp-case::-webkit-outer-spin-button, .otp-case::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
.resend{ text-align:center; font-size:13px; opacity:.65; margin:0; }
.resend .btn-ghost{ font-size:13px; }
