/* =========================================================
   MOBA — feuille de style commune  (v1 — 14/11/2026)
   ---------------------------------------------------------
   À relier dans chaque page :
     <link rel="stylesheet" href="/MOBA/commun/css/moba.css">
   Icônes : Font Awesome 6 (déjà utilisé sur l'accueil).

   Sommaire
     1. Variables (couleurs, tailles, espaces)
     2. Base (reset, texte, liens)
     3. Mise en page (conteneur, grille, utilitaires)
     4. Barre du haut / barre d'onglets
     5. Boutons
     6. Badges / labels
     7. Alertes / toasts
     8. Formulaires
     9. Barres de progression / spinner
    10. Tableaux
    11. Panels (cartes)
    12. Listes (list group)
    13. Onglets, accordéon, fenêtre (modal)
    14. Divers (avatar, état vide, squelette, fil d'Ariane, pagination)
    15. En-tête et pied de page communs (commun/php/nav.php)
   ========================================================= */


/* ---------------------------------------------------------
   1. VARIABLES
   Thème sombre par défaut (comme l'accueil et le login).
   Thème clair : <html data-theme="light">
   --------------------------------------------------------- */
:root {
    /* Fonds */
    --bg:          #161618;   /* fond de page              */
    --surface:     #232326;   /* panels, cartes            */
    --surface-2:   #2c2c30;   /* champs, survol            */
    --surface-3:   #36363b;   /* éléments actifs           */
    --border:      #3a3a3f;
    --border-strong: #55555c;

    /* Texte */
    --text:        #ececf0;
    --text-muted:  #a1a1a8;
    --text-faint:  #6e6e76;
    --on-color:    #0b0d10;   /* texte posé sur une couleur vive */

    /* Couleurs de la marque et des états */
    --primary:     #00b4ff;   /* bleu MOBA (accueil)       */
    --secondary:   #8e8e96;
    --success:     #50cd89;   /* Succès                    */
    --info:        #7c8cff;   /* Information               */
    --warning:     #ffc700;   /* Attention                 */
    --danger:      #ff5f5f;   /* Erreur                    */

    /* Fonds « doux » des états (alertes, badges légers) */
    --primary-soft: color-mix(in srgb, var(--primary) 16%, transparent);
    --success-soft: color-mix(in srgb, var(--success) 16%, transparent);
    --info-soft:    color-mix(in srgb, var(--info)    16%, transparent);
    --warning-soft: color-mix(in srgb, var(--warning) 16%, transparent);
    --danger-soft:  color-mix(in srgb, var(--danger)  16%, transparent);
    --secondary-soft: color-mix(in srgb, var(--secondary) 18%, transparent);

    /* Typographie */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --fs-xs: 12px;
    --fs-sm: 14px;
    --fs-md: 16px;   /* ≥ 16px dans les champs : pas de zoom auto sur iPhone */
    --fs-lg: 18px;
    --fs-xl: 22px;
    --fs-2xl: 28px;

    /* Espaces */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;

    /* Arrondis */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-pill: 999px;

    /* Ombres */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow-md: 0 6px 18px rgba(0,0,0,.35);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.45);

    /* Taille mini d'une zone tactile (Apple : 44px) */
    --touch: 44px;

    --speed: .18s;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg:          #f2f2f7;
    --surface:     #ffffff;
    --surface-2:   #f4f4f7;
    --surface-3:   #e8e8ee;
    --border:      #dcdce3;
    --border-strong: #b9b9c3;
    --text:        #1c1c1e;
    --text-muted:  #5f5f68;
    --text-faint:  #9a9aa3;
    --on-color:    #ffffff;
    --primary:     #0088cc;
    --secondary:   #6b6b74;
    --success:     #1f9d5c;
    --info:        #4a5bd8;
    --warning:     #b98a00;
    --danger:      #d93636;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.08);
    --shadow-md: 0 6px 18px rgba(0,0,0,.10);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.16);
    color-scheme: light;
}


/* ---------------------------------------------------------
   2. BASE
   --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    font-size: var(--fs-md);
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--sp-3); line-height: 1.25; font-weight: 650; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
h5 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
h6 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }

p { margin: 0 0 var(--sp-3); }
small, .small { font-size: var(--fs-sm); }
.lead { font-size: var(--fs-lg); color: var(--text-muted); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, .mono { font-family: var(--font-mono); font-size: .9em; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: var(--r-sm); }
kbd  { background: var(--surface-3); padding: 1px 6px; border-radius: var(--r-sm); border-bottom: 2px solid var(--border-strong); }
hr   { border: 0; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }
mark { background: var(--warning-soft); color: var(--text); padding: 0 3px; border-radius: 3px; }

/* Couleurs de texte */
.text-muted     { color: var(--text-muted) !important; }
.text-faint     { color: var(--text-faint) !important; }
.text-primary   { color: var(--primary) !important; }
.text-success   { color: var(--success) !important; }
.text-info      { color: var(--info) !important; }
.text-warning   { color: var(--warning) !important; }
.text-danger    { color: var(--danger) !important; }
.text-center    { text-align: center; }
.text-right     { text-align: right; }
.fw-bold        { font-weight: 650; }
.nowrap         { white-space: nowrap; }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ---------------------------------------------------------
   3. MISE EN PAGE
   --------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--sp-4) max(var(--sp-4), env(safe-area-inset-right)) var(--sp-6) max(var(--sp-4), env(safe-area-inset-left));
}
.container-sm { max-width: 640px; }

.section { margin-bottom: var(--sp-6); }
.section-title {
    display: flex; align-items: center; gap: var(--sp-2);
    font-size: var(--fs-lg);
    padding-bottom: var(--sp-2);
    margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border);
}
.section-title i { color: var(--primary); }

/* Grille 12 colonnes : .row > .col-6 (mobile) .md-col-4 (≥ 768px) */
.row { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--sp-3); }
.row > * { grid-column: span 12; min-width: 0; }
.col-1{grid-column:span 1}.col-2{grid-column:span 2}.col-3{grid-column:span 3}.col-4{grid-column:span 4}
.col-5{grid-column:span 5}.col-6{grid-column:span 6}.col-7{grid-column:span 7}.col-8{grid-column:span 8}
.col-9{grid-column:span 9}.col-10{grid-column:span 10}.col-11{grid-column:span 11}.col-12{grid-column:span 12}
@media (min-width: 768px) {
    .md-col-1{grid-column:span 1}.md-col-2{grid-column:span 2}.md-col-3{grid-column:span 3}.md-col-4{grid-column:span 4}
    .md-col-5{grid-column:span 5}.md-col-6{grid-column:span 6}.md-col-7{grid-column:span 7}.md-col-8{grid-column:span 8}
    .md-col-9{grid-column:span 9}.md-col-10{grid-column:span 10}.md-col-11{grid-column:span 11}.md-col-12{grid-column:span 12}
}

/* Grille automatique : autant de colonnes que la largeur permet */
.grid-auto { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(var(--min, 160px), 1fr)); }

/* Utilitaires d'alignement */
.flex    { display: flex; }
.stack   { display: flex; flex-direction: column; gap: var(--sp-3); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grow    { flex: 1; min-width: 0; }
.gap-1{gap:var(--sp-1)}.gap-2{gap:var(--sp-2)}.gap-3{gap:var(--sp-3)}.gap-4{gap:var(--sp-4)}
.mt-0{margin-top:0}.mt-2{margin-top:var(--sp-2)}.mt-3{margin-top:var(--sp-3)}.mt-4{margin-top:var(--sp-4)}
.mb-0{margin-bottom:0}.mb-2{margin-bottom:var(--sp-2)}.mb-3{margin-bottom:var(--sp-3)}.mb-4{margin-bottom:var(--sp-4)}
.w-100 { width: 100%; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: var(--sp-4) 0; }


/* ---------------------------------------------------------
   4. BARRE DU HAUT / BARRE D'ONGLETS (bas d'écran)
   --------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: var(--sp-2);
    min-height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(var(--sp-3), env(safe-area-inset-right)) 0 max(var(--sp-3), env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title small { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--text-muted); }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 11px; color: var(--text-muted); text-decoration: none; min-height: var(--touch); justify-content: center;
}
.tabbar a i { font-size: 20px; }
.tabbar a.active { color: var(--primary); }
.has-tabbar { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }


/* ---------------------------------------------------------
   5. BOUTONS
   .btn + couleur : .btn-primary .btn-success .btn-info
   .btn-warning .btn-danger .btn-secondary
   Variantes : .btn-outline  .btn-ghost
   Tailles   : .btn-sm  .btn-lg  .btn-block  .btn-icon
   --------------------------------------------------------- */
.btn {
    --c: var(--surface-3);
    --c-text: var(--text);
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    min-height: var(--touch);
    padding: 0 var(--sp-4);
    font: inherit; font-size: var(--fs-md); font-weight: 600; line-height: 1;
    color: var(--c-text);
    background: var(--c);
    border: 1px solid var(--c);
    border-radius: var(--r-md);
    cursor: pointer;
    text-decoration: none !important;
    user-select: none; -webkit-user-select: none;
    touch-action: manipulation;
    transition: filter var(--speed), transform .08s, background var(--speed), border-color var(--speed), opacity var(--speed);
}
.btn:hover  { filter: brightness(1.1); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }

.btn-primary   { --c: var(--primary);   --c-text: var(--on-color); }
.btn-secondary { --c: var(--surface-3); --c-text: var(--text); }
.btn-success   { --c: var(--success);   --c-text: var(--on-color); }
.btn-info      { --c: var(--info);      --c-text: var(--on-color); }
.btn-warning   { --c: var(--warning);   --c-text: #1a1400; }
.btn-danger    { --c: var(--danger);    --c-text: var(--on-color); }

.btn-outline { background: transparent; color: var(--c); border-color: var(--c); }
.btn-outline.btn-secondary { --c: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: color-mix(in srgb, var(--c) 14%, transparent); filter: none; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--c); }
.btn-ghost.btn-secondary { color: var(--text); }
.btn-ghost:hover { background: color-mix(in srgb, var(--c) 14%, transparent); filter: none; }

.btn-soft { background: color-mix(in srgb, var(--c) 16%, transparent); border-color: transparent; color: var(--c); }
.btn-soft.btn-secondary { color: var(--text); }

.btn-sm    { min-height: 34px; padding: 0 var(--sp-3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg    { min-height: 54px; padding: 0 var(--sp-5); font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn-block { display: flex; width: 100%; }
.btn-icon  { width: var(--touch); padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-round { border-radius: var(--r-pill); }

/* Bouton « en cours » : <button class="btn btn-primary is-loading"> */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: ""; position: absolute; width: 18px; height: 18px;
    border: 2px solid var(--c-text); border-right-color: transparent; border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn-outline.is-loading::after, .btn-ghost.is-loading::after, .btn-soft.is-loading::after { border-color: var(--c); border-right-color: transparent; }

/* Groupe de boutons collés */
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.btn-group .btn:last-child  { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* Sélecteur segmenté (style iOS) */
.segmented { display: flex; padding: 3px; gap: 3px; background: var(--surface-2); border-radius: var(--r-md); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
    flex: 1; text-align: center; padding: 8px 10px; min-height: 38px;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted);
    border-radius: 8px; cursor: pointer; transition: background var(--speed), color var(--speed);
}
.segmented input:checked + label { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }

/* Bouton flottant (bas droite) */
.fab {
    position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40;
    width: 56px; height: 56px; border-radius: 50%; font-size: 22px; box-shadow: var(--shadow-lg);
}


/* ---------------------------------------------------------
   6. BADGES / LABELS
   .badge + .badge-success  (plein)  /  .badge-soft (léger)
   .badge-outline  .badge-pill  .badge-dot  .badge-count
   --------------------------------------------------------- */
.badge {
    --c: var(--secondary);
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px;
    font-size: var(--fs-xs); font-weight: 650; line-height: 1.3;
    letter-spacing: .02em;
    color: var(--on-color);
    background: var(--c);
    border: 1px solid var(--c);
    border-radius: var(--r-sm);
    white-space: nowrap;
    vertical-align: middle;
}
.badge-primary { --c: var(--primary); }
.badge-success { --c: var(--success); }
.badge-info    { --c: var(--info); }
.badge-warning { --c: var(--warning); color: #1a1400; }
.badge-danger  { --c: var(--danger); }
.badge-secondary { --c: var(--secondary); }

.badge-soft    { background: color-mix(in srgb, var(--c) 18%, transparent); border-color: transparent; color: var(--c) !important; }
.badge-outline { background: transparent; color: var(--c) !important; }
.badge-pill    { border-radius: var(--r-pill); padding: 3px 10px; }
.badge-upper   { text-transform: uppercase; }
.badge-lg      { font-size: var(--fs-sm); padding: 5px 12px; }

/* Point de statut devant le texte */
.badge-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-dot:not(.badge-soft):not(.badge-outline)::before { background: var(--on-color); }

/* Compteur rond (ex. notifications) */
.badge-count { min-width: 20px; height: 20px; padding: 0 6px; justify-content: center; border-radius: var(--r-pill); font-size: 11px; }

/* Pastille simple */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--secondary)); vertical-align: middle; }
.dot-success { --c: var(--success); } .dot-info { --c: var(--info); }
.dot-warning { --c: var(--warning); } .dot-danger { --c: var(--danger); }
.dot-pulse { box-shadow: 0 0 0 0 var(--c); animation: pulse 1.6s infinite; }

/* Étiquette amovible (filtres) */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 32px; padding: 0 6px 0 12px;
    font-size: var(--fs-sm); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill);
}
.chip button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--surface-3); color: var(--text-muted); cursor: pointer; font-size: 11px; }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }


/* ---------------------------------------------------------
   7. ALERTES / TOASTS
   .alert + .alert-success .alert-info .alert-warning .alert-danger
   --------------------------------------------------------- */
.alert {
    --c: var(--info);
    display: flex; align-items: flex-start; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: color-mix(in srgb, var(--c) 13%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
    border-left: 4px solid var(--c);
    border-radius: var(--r-md);
    color: var(--text);
    font-size: var(--fs-sm);
}
.alert > i:first-child { color: var(--c); font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { display: block; font-weight: 650; font-size: var(--fs-md); margin-bottom: 2px; color: var(--c); }
.alert p:last-child { margin-bottom: 0; }
.alert-close { margin: -6px -8px -6px 0; width: 32px; height: 32px; border: 0; background: none; color: var(--text-muted); cursor: pointer; border-radius: var(--r-sm); font-size: 15px; flex-shrink: 0; }
.alert-close:hover { background: var(--surface-3); color: var(--text); }
.alert-success { --c: var(--success); }
.alert-info    { --c: var(--info); }
.alert-warning { --c: var(--warning); }
.alert-danger  { --c: var(--danger); }
.alert-solid { background: var(--c); color: var(--on-color); border-color: var(--c); }
.alert-solid > i:first-child, .alert-solid .alert-title, .alert-solid .alert-close { color: inherit; }
.alert-warning.alert-solid { color: #1a1400; }

/* Bandeau en haut de page */
.banner { border-radius: 0; border-left: 0; border-right: 0; }

/* Toasts (petits messages temporaires) — voir moba.js : Moba.toast() */
.toast-zone {
    position: fixed; z-index: 200; left: 50%; transform: translateX(-50%);
    top: calc(12px + env(safe-area-inset-top));
    width: min(420px, calc(100% - 24px));
    display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none;
}
.toast {
    --c: var(--info);
    pointer-events: auto;
    display: flex; align-items: center; gap: var(--sp-3);
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--c);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--fs-sm);
    animation: toast-in .25s ease;
}
.toast i { color: var(--c); font-size: 18px; }
.toast.is-leaving { animation: toast-out .2s ease forwards; }
.toast-success { --c: var(--success); } .toast-info { --c: var(--info); }
.toast-warning { --c: var(--warning); } .toast-danger { --c: var(--danger); }


/* ---------------------------------------------------------
   8. FORMULAIRES
   .field > label + .input / .select / .textarea + .help
   États : .is-valid / .is-invalid sur .field
   --------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); min-width: 0; }
.label, .field > label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.label .req, .field > label .req { color: var(--danger); }
.help { font-size: var(--fs-xs); color: var(--text-faint); }

.input, .select, .textarea {
    width: 100%;
    min-height: var(--touch);
    padding: 10px 12px;
    font: inherit; font-size: var(--fs-md);
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    -webkit-appearance: none; appearance: none;
    transition: border-color var(--speed), box-shadow var(--speed);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.input:disabled, .select:disabled, .textarea:disabled { opacity: .5; }
.input[readonly] { background: transparent; border-style: dashed; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.select {
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a1a1a8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.input-sm { min-height: 36px; padding: 6px 10px; }
input[type="date"].input, input[type="time"].input { display: flex; align-items: center; }
input[type="number"].input { font-variant-numeric: tabular-nums; }

/* Validation */
.field.is-valid   .input, .field.is-valid   .select, .field.is-valid   .textarea { border-color: var(--success); }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--danger); }
.field.is-valid   .help { color: var(--success); }
.field.is-invalid .help { color: var(--danger); }
.field.is-warning .input { border-color: var(--warning); }
.field.is-warning .help  { color: var(--warning); }

/* Champ avec icône / bouton intégré */
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
.input-icon > .input-clear {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; border: 0; background: none; color: var(--text-faint); cursor: pointer; border-radius: 50%;
}
.input-icon > .input:placeholder-shown ~ .input-clear { display: none; }
.input-icon:has(.input-clear) > .input { padding-right: 42px; }

/* Champ avec préfixe / suffixe : <div class="input-group"><span>€</span><input class="input"></div> */
.input-group { display: flex; }
.input-group > .input, .input-group > .select { border-radius: 0; flex: 1; min-width: 0; }
.input-group > :first-child { border-top-left-radius: var(--r-md); border-bottom-left-radius: var(--r-md); }
.input-group > :last-child  { border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.input-group > .addon {
    display: flex; align-items: center; padding: 0 12px;
    background: var(--surface-3); border: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap;
}
.input-group > * + * { margin-left: -1px; }
.input-group > .btn { border-radius: 0; }
.input-group > .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }

/* Quantité − 1 + */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.stepper button { width: var(--touch); border: 0; background: var(--surface-3); color: var(--text); font-size: 18px; cursor: pointer; }
.stepper button:active { background: var(--border-strong); }
.stepper input { width: 64px; text-align: center; border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-lg); font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.stepper input:focus { outline: none; }

/* Cases à cocher, boutons radio, interrupteur */
.check { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--touch); cursor: pointer; font-size: var(--fs-md); }
.check input {
    -webkit-appearance: none; appearance: none; flex-shrink: 0;
    width: 22px; height: 22px; margin: 0;
    background: var(--surface-2); border: 2px solid var(--border-strong); border-radius: 6px;
    display: grid; place-content: center; cursor: pointer;
    transition: background var(--speed), border-color var(--speed);
}
.check input[type="radio"] { border-radius: 50%; }
.check input::before { content: ""; width: 10px; height: 10px; transform: scale(0); transition: transform .12s; background: var(--on-color); }
.check input[type="checkbox"]::before { clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
.check input[type="radio"]::before { border-radius: 50%; }
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::before { transform: scale(1); }
.check input:disabled { opacity: .45; }
.check input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--touch); cursor: pointer; }
.switch input {
    -webkit-appearance: none; appearance: none; flex-shrink: 0; margin: 0;
    position: relative; width: 51px; height: 31px; border-radius: 31px;
    background: var(--surface-3); border: 1px solid var(--border); cursor: pointer;
    transition: background var(--speed);
}
.switch input::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 25px; height: 25px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.3); transition: transform var(--speed);
}
.switch input:checked { background: var(--success); border-color: var(--success); }
.switch input:checked::after { transform: translateX(20px); }

/* Curseur */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--surface-3); border-radius: 6px; outline: none; accent-color: var(--primary); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); box-shadow: var(--shadow-sm); }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }

/* Envoi de photos / fichiers */
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
    padding: var(--sp-5); text-align: center; cursor: pointer;
    border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
    color: var(--text-muted); background: var(--surface-2);
    transition: border-color var(--speed), background var(--speed);
}
.dropzone i { font-size: 28px; color: var(--primary); }
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { display: none; }

.fieldset { border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); margin: 0 0 var(--sp-4); }
.fieldset legend { padding: 0 var(--sp-2); font-weight: 650; color: var(--text-muted); font-size: var(--fs-sm); }
.form-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 480px) { .form-actions > .btn { flex: 1; } }


/* ---------------------------------------------------------
   9. BARRES DE PROGRESSION / SPINNER
   <div class="progress progress-success"><div class="progress-bar" style="width:60%"></div></div>
   --------------------------------------------------------- */
.progress {
    --c: var(--primary);
    height: 10px; width: 100%;
    background: var(--surface-3);
    border-radius: var(--r-pill);
    overflow: hidden;
}
.progress-bar {
    height: 100%; background: var(--c); border-radius: inherit;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: var(--on-color);
    transition: width .4s ease;
}
.progress-sm { height: 5px; }
.progress-lg { height: 20px; }
.progress-success { --c: var(--success); }
.progress-info    { --c: var(--info); }
.progress-warning { --c: var(--warning); }
.progress-danger  { --c: var(--danger); }
.progress-striped .progress-bar {
    background-image: linear-gradient(45deg, rgba(255,255,255,.18) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.18) 75%, transparent 75%);
    background-size: 16px 16px;
}
.progress-animated .progress-bar { animation: stripes .8s linear infinite; }
.progress-indeterminate .progress-bar { width: 35% !important; animation: indeterminate 1.3s ease-in-out infinite; }
.progress-label { display: flex; justify-content: space-between; font-size: var(--fs-sm); margin-bottom: 6px; }
.progress-label span:last-child { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Anneau de progression : <div class="ring" style="--p:72">72%</div> */
.ring {
    --c: var(--primary); --size: 72px;
    width: var(--size); height: var(--size); border-radius: 50%;
    display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm);
    background: radial-gradient(closest-side, var(--surface) 78%, transparent 80% 100%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0);
}
.ring-success { --c: var(--success); } .ring-warning { --c: var(--warning); } .ring-danger { --c: var(--danger); }

/* Étapes (ex. suivi d'intervention) */
.steps { display: flex; list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { flex: 1; position: relative; text-align: center; font-size: var(--fs-xs); color: var(--text-faint); counter-increment: step; }
.steps li::before {
    content: counter(step); display: grid; place-items: center; margin: 0 auto 6px;
    width: 30px; height: 30px; border-radius: 50%; position: relative; z-index: 1;
    background: var(--surface-3); color: var(--text-muted); font-weight: 700; font-size: var(--fs-sm);
}
.steps li + li::after { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--surface-3); }
.steps li.done, .steps li.current { color: var(--text); }
.steps li.done::before { content: "✓"; background: var(--success); color: var(--on-color); }
.steps li.current::before { background: var(--primary); color: var(--on-color); box-shadow: 0 0 0 4px var(--primary-soft); }
.steps li.done + li::after, .steps li.done + li.current::after { background: var(--success); }

/* Spinner */
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--surface-3); border-top-color: var(--c, var(--primary)); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

/* Squelette de chargement */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); min-height: 14px; }


/* ---------------------------------------------------------
   10. TABLEAUX
   <div class="table-wrap"><table class="table">…</table></div>
   .table-striped  .table-hover  .table-compact
   .table-cards : se transforme en cartes sur iPhone (data-label sur chaque <td>)
   --------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-striped tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table-compact th, .table-compact td { padding: 7px 10px; }
.table tr.row-success { box-shadow: inset 3px 0 0 var(--success); }
.table tr.row-warning { box-shadow: inset 3px 0 0 var(--warning); }
.table tr.row-danger  { box-shadow: inset 3px 0 0 var(--danger); }
.table tr.is-selected { background: var(--primary-soft) !important; }

@media (max-width: 640px) {
    .table-cards { border: 0; background: none; overflow: visible; }
    .table-cards thead { display: none; }
    .table-cards tbody { display: flex; flex-direction: column; gap: var(--sp-2); }
    .table-cards tr { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 6px 0; }
    .table-cards td { display: block; padding: 7px 14px; border: 0; text-align: right; overflow: hidden; }
    .table-cards td::before { content: attr(data-label); float: left; margin-right: var(--sp-3); padding-top: 2px; color: var(--text-muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; text-align: left; }
    .table-cards td:not([data-label])::before { display: none; }
    .table-cards td.num { text-align: right; }
}


/* ---------------------------------------------------------
   11. PANELS (cartes)
   .panel > .panel-header + .panel-body + .panel-footer
   Couleur : .panel-success .panel-info .panel-warning .panel-danger
   --------------------------------------------------------- */
.panel {
    --c: var(--border);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.panel-header { display: flex; align-items: center; gap: var(--sp-2); padding: 12px var(--sp-4); border-bottom: 1px solid var(--border); font-weight: 650; }
.panel-header i { color: var(--c); }
.panel-header .panel-actions { margin-left: auto; display: flex; gap: var(--sp-1); }
.panel-body { padding: var(--sp-4); }
.panel-body > :last-child { margin-bottom: 0; }
.panel-footer { padding: 10px var(--sp-4); border-top: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-muted); display: flex; gap: var(--sp-2); justify-content: flex-end; align-items: center; }
.panel-primary { --c: var(--primary); } .panel-success { --c: var(--success); } .panel-info { --c: var(--info); }
.panel-warning { --c: var(--warning); } .panel-danger { --c: var(--danger); }
.panel[class*="panel-"]:not(.panel-flat) { border-top: 3px solid var(--c); }
.panel-filled .panel-header { background: color-mix(in srgb, var(--c) 15%, var(--surface)); color: var(--c); }

/* Carte cliquable (ex. tuiles de l'accueil) */
.tile {
    display: flex; flex-direction: column; gap: var(--sp-2);
    padding: var(--sp-4); color: var(--text); text-decoration: none !important;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    transition: transform var(--speed), border-color var(--speed), background var(--speed);
}
.tile > i { font-size: 28px; color: var(--primary); }
.tile h3 { margin: 0; font-size: var(--fs-md); }
.tile p  { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.tile:hover  { border-color: var(--primary); background: var(--surface-2); }
.tile:active { transform: scale(.98); }

/* Chiffre clé */
.stat { padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.stat-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-trend { font-size: var(--fs-sm); font-weight: 600; }
.stat-trend.up { color: var(--success); } .stat-trend.down { color: var(--danger); }


/* ---------------------------------------------------------
   12. LISTES (list group, style réglages iPhone)
   <div class="list"> <a class="list-item">…</a> </div>
   --------------------------------------------------------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.list-title { padding: var(--sp-4) var(--sp-4) 6px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.list-item {
    display: flex; align-items: center; gap: var(--sp-3);
    min-height: 52px; padding: 10px var(--sp-4);
    color: var(--text); text-decoration: none !important;
    border-bottom: 1px solid var(--border);
    background: none; width: 100%; font: inherit; text-align: left; border-left: 0; border-right: 0; border-top: 0;
}
.list-item:last-child { border-bottom: 0; }
a.list-item, button.list-item, label.list-item { cursor: pointer; }
a.list-item:hover, button.list-item:hover, label.list-item:hover { background: var(--surface-2); }
a.list-item:active, button.list-item:active { background: var(--surface-3); }
.list-item.active { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.list-item.disabled { opacity: .45; pointer-events: none; }
.list-icon {
    --c: var(--primary);
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px;
    display: grid; place-items: center; font-size: 15px;
    background: var(--c); color: var(--on-color);
}
.list-icon.success { --c: var(--success); } .list-icon.info { --c: var(--info); }
.list-icon.warning { --c: var(--warning); } .list-icon.danger { --c: var(--danger); } .list-icon.secondary { --c: var(--secondary); }
.list-text { flex: 1; min-width: 0; }
.list-text strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-text small  { display: block; color: var(--text-muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap; display: flex; align-items: center; gap: var(--sp-2); }
.list-chevron::after { content: "\f054"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 12px; color: var(--text-faint); margin-left: var(--sp-2); }
.list-flush { border: 0; border-radius: 0; background: none; }
.list-flush .list-item { padding-left: 0; padding-right: 0; }


/* ---------------------------------------------------------
   13. ONGLETS, ACCORDÉON, FENÊTRE (MODAL)
   --------------------------------------------------------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    position: relative; padding: 0 var(--sp-4); min-height: var(--touch);
    display: inline-flex; align-items: center; gap: var(--sp-2);
    border: 0; background: none; color: var(--text-muted); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tab.active { color: var(--primary); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.tab-panel { padding-top: var(--sp-4); }
.tab-panel:not(.active) { display: none; }

/* Accordéon : <details class="accordion"><summary>Titre</summary><div>…</div></details> */
.accordion { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.accordion + .accordion { margin-top: var(--sp-2); }
.accordion summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--sp-2);
    min-height: 52px; padding: 0 var(--sp-4); font-weight: 600;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-left: auto; font-size: 12px; color: var(--text-faint); transition: transform var(--speed); }
.accordion[open] summary::after { transform: rotate(180deg); }
.accordion[open] summary { border-bottom: 1px solid var(--border); }
.accordion > div { padding: var(--sp-4); color: var(--text-muted); font-size: var(--fs-sm); }

/* Fenêtre : <dialog class="modal"> … </dialog>  (ouverture : Moba.open('#id')) */
.modal {
    width: min(480px, calc(100% - 24px));
    max-height: calc(100dvh - 48px);
    padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .2s ease; }
.modal-header { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4); border-bottom: 1px solid var(--border); font-weight: 650; font-size: var(--fs-lg); }
.modal-header .btn { margin-left: auto; }
.modal-body { padding: var(--sp-4); overflow-y: auto; }
.modal-footer { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
@media (max-width: 480px) { .modal-footer > .btn { flex: 1; } }

/* Variante « feuille » qui monte du bas (iPhone) */
.modal.sheet {
    width: 100%; max-width: 640px; margin: auto auto 0; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
}
.modal.sheet[open] { animation: sheet-in .25s ease; }
.modal.sheet::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 5px; background: var(--border-strong); margin: 8px auto 0; }


/* ---------------------------------------------------------
   14. DIVERS
   --------------------------------------------------------- */
.avatar {
    --size: 40px;
    width: var(--size); height: var(--size); border-radius: 50%; flex-shrink: 0;
    display: inline-grid; place-items: center; overflow: hidden;
    background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: calc(var(--size) * .4);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --size: 30px; } .avatar-lg { --size: 56px; }

.empty-state { text-align: center; padding: var(--sp-6) var(--sp-4); color: var(--text-muted); }
.empty-state > i { font-size: 40px; color: var(--text-faint); margin-bottom: var(--sp-3); }
.empty-state h3 { color: var(--text); }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; padding: 0; margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--text-faint); }
.breadcrumb li:last-child { color: var(--text); }

.pagination { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 40px; height: 40px; padding: 0 10px; display: grid; place-items: center;
    border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface);
    color: var(--text); text-decoration: none; font-size: var(--fs-sm); font-weight: 600;
}
.pagination a:hover { background: var(--surface-2); }
.pagination .active { background: var(--primary); border-color: var(--primary); color: var(--on-color); }
.pagination .disabled { opacity: .4; pointer-events: none; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--sp-4); font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 600; }

/* Bulle d'aide : <span class="tip" data-tip="Texte">?</span> */
.tip { position: relative; cursor: help; border-bottom: 1px dotted var(--text-muted); }
.tip:hover::after, .tip:focus::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    padding: 6px 10px; border-radius: var(--r-sm); background: var(--text); color: var(--bg);
    font-size: var(--fs-xs); white-space: nowrap; z-index: 10; box-shadow: var(--shadow-md);
}

/* Code-barres / référence mise en valeur */
.ref { font-family: var(--font-mono); font-weight: 700; letter-spacing: .04em; background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: var(--r-sm); }


/* ---------------------------------------------------------
   15. EN-TÊTE ET PIED DE PAGE COMMUNS — commun/php/nav.php
   En-tête : [maison]  [logo MOBA]  [thème] [déconnexion]
   Pied de page fixe : chargement, erreurs, état de la page.
   Le titre et les boutons de chaque page restent dans la page,
   sous l'en-tête (ils ne collent plus en haut).
   --------------------------------------------------------- */
:root { --mhead-h: 0px; --mfoot-h: 0px; }
.has-mhead { --mhead-h: calc(52px + env(safe-area-inset-top)); }
.has-mfoot { --mfoot-h: calc(30px + env(safe-area-inset-bottom)); }

.mhead {
    position: sticky; top: 0; z-index: 60;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    width: 100%; align-self: stretch; flex-shrink: 0;
    height: var(--mhead-h);
    padding: env(safe-area-inset-top) max(var(--sp-2), env(safe-area-inset-right)) 0 max(var(--sp-2), env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    font-family: var(--font);
}
.mhead-right { justify-self: end; display: flex; gap: 2px; }
.mhead-btn {
    width: var(--touch); height: var(--touch);
    display: inline-flex; align-items: center; justify-content: center;
    margin: 0; padding: 0; border: 0; border-radius: var(--r-md);
    background: transparent; color: var(--text-muted);
    font-size: 18px; text-decoration: none; cursor: pointer;
    transition: background var(--speed), color var(--speed);
}
.mhead-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.mhead-btn[aria-current="page"] { color: var(--primary); }
.mhead-btn:focus-visible, .mhead-logo:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.mhead-danger:hover { color: var(--danger); }
.mhead-logo { display: block; border-radius: var(--r-sm); }
.mhead-logo img { display: block; height: 28px; width: auto; }
/* Logo bleu foncé : en blanc sur le thème sombre */
:root:not([data-theme="light"]) .mhead-logo img { filter: brightness(0) invert(1); }

.mfoot {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    height: var(--mfoot-h);
    display: flex; align-items: center; gap: var(--sp-2);
    padding: 0 max(var(--sp-3), env(safe-area-inset-right)) env(safe-area-inset-bottom) max(var(--sp-3), env(safe-area-inset-left));
    background: var(--surface); border-top: 1px solid var(--border);
    color: var(--text-muted); font: 500 12px/1.2 var(--font); text-align: left;
    transition: background var(--speed), color var(--speed);
}
.mfoot-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.mfoot-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mfoot-time { flex-shrink: 0; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.mfoot.is-loading .mfoot-dot { background: var(--primary); animation: mfoot-blink 1s ease-in-out infinite; }
.mfoot.is-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); cursor: pointer; }
.mfoot.is-error .mfoot-dot { background: var(--danger); }
.mfoot.is-offline { color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.mfoot.is-offline .mfoot-dot { background: var(--warning); }
/* Contexte de la page (à droite) : ex. « FR3005131 · 3 pièces » */
.mfoot-ctx { flex: 0 1 auto; max-width: 55%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
.mfoot-ctx:empty { display: none; }
.mfoot.is-error .mfoot-ctx, .mfoot.is-offline .mfoot-ctx { display: none; }   /* l'erreur passe en premier */
.mfoot-ctx:not(:empty) + .mfoot-time::before { content: "· "; }
/* Journal (admin) : toucher le pied de page */
.mfoot-log {
    position: fixed; z-index: 56; left: 0; right: 0; bottom: var(--mfoot-h);
    max-height: 50vh; overflow-y: auto;
    padding: var(--sp-3) max(var(--sp-3), env(safe-area-inset-right)) var(--sp-3) max(var(--sp-3), env(safe-area-inset-left));
    background: var(--surface); border-top: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
    font: 13px/1.4 var(--font); color: var(--text);
}
.mfoot-log[hidden] { display: none; }
.mfoot-log-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.mfoot-log-srv { flex: 1; min-width: 0; color: var(--text-muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mfoot-log ol { margin: 0; padding: 0; list-style: none; }
.mfoot-log li { padding: 6px 0; border-top: 1px solid var(--border); color: var(--danger); word-break: break-word; }
.mfoot-log li b { color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.mfoot-log li.is-empty { color: var(--text-muted); }
.mfoot-spacer { height: var(--mfoot-h); }
@keyframes mfoot-blink { 50% { opacity: .25; } }

/* ---- Pages : titre de page sous l'en-tête, rien sous le pied de page ---- */
.has-mhead .topbar { position: static; padding-top: 0; min-height: 52px; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.has-mhead .app-header { position: relative; }   /* étiquettes : plus collant, mais garde son liseré bleu (::after) attaché au titre */
.has-mhead .label-panel { top: calc(var(--mhead-h) + 16px); }                 /* étiquettes (grand écran) */
.has-mhead .col-output { top: calc(var(--mhead-h) + 20px); }                  /* service (grand écran) */
.has-mhead .search-bar { top: var(--mhead-h); }                               /* recherche, clients */
.has-mhead #app { height: calc(100dvh - var(--mhead-h) - var(--mfoot-h)); padding-top: 0; } /* scan, sortie */
.has-mhead .toast-zone { top: calc(var(--mhead-h) + 8px); }
.has-mfoot .bottom { bottom: var(--mfoot-h); padding-bottom: var(--sp-2); }   /* barres d'action en bas */
.has-mfoot .fab { bottom: calc(20px + var(--mfoot-h)); }
.has-mfoot .tabbar { bottom: var(--mfoot-h); padding-bottom: 6px; }

@media print { .mhead, .mfoot, .mfoot-spacer { display: none !important; } }


/* ---------------------------------------------------------
   ANIMATIONS
   --------------------------------------------------------- */
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes stripes   { from { background-position: 16px 0; } to { background-position: 0 0; } }
@keyframes indeterminate { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
@keyframes shimmer   { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse     { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes modal-in  { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sheet-in  { from { transform: translateY(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================
   16. Champs à remplir : fond clair partout (16/11/2026)
   ---------------------------------------------------------
   Thème sombre : fond GRIS CLAIR · thème clair : fond BLANC.
   Texte saisi : noir, un peu gras. Exemple (placeholder) : gris, en italique,
   pour bien voir la différence entre « à remplir » et « rempli ».
   « !important » pour passer devant les styles propres à chaque page
   (stock-camion/style.css, etiquettes/style.css…).
   Pour revenir en arrière : supprimer cette section.
   ========================================================= */
:root {
    --field-bg:      #d9d9df;   /* thème sombre : gris clair            */
    --field-text:    #111114;
    --field-muted:   #7a7a84;   /* exemple (placeholder), icônes        */
    --field-border:  #b4b4bd;
    --field-off:     #b9b9c1;   /* champ désactivé / lecture seule      */
}
[data-theme="light"] {
    --field-bg:      #ffffff;
    --field-muted:   #9a9aa4;
    --field-border:  #c4c4cc;
    --field-off:     #ececf0;
}
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=hidden]):not([type=button]):not([type=submit]):not([type=reset]),
select, textarea {
    background-color: var(--field-bg) !important;
    color: var(--field-text) !important;
    -webkit-text-fill-color: var(--field-text);   /* iPhone : couleur du texte saisi */
    border-color: var(--field-border);
    color-scheme: light;                          /* calendrier, flèches, croix en clair */
    caret-color: var(--primary);
}
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=hidden]):not([type=button]):not([type=submit]):not([type=reset]),
select, textarea { font-weight: 550; }
input::placeholder, textarea::placeholder { color: var(--field-muted) !important; -webkit-text-fill-color: var(--field-muted); opacity: 1; font-style: italic; font-weight: 400; }
input:focus, select:focus, textarea:focus { border-color: var(--primary) !important; }
input[readonly]:not([type=checkbox]):not([type=radio]), input:disabled, select:disabled, textarea:disabled,
.input[readonly] { background-color: var(--field-off) !important; opacity: 1; }
select option { background: #fff; color: var(--field-text); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e6e78' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.input-icon > i, .input-icon > .input-clear { color: var(--field-muted); z-index: 1; }
