/* ============================================================
   ENVIE 35 — Design System v6 (charte atelier, maquette validée 10/10/2026)
   - Une police : IBM Plex Sans (+ IBM Plex Mono pour ID / codes)
   - Contrastes relevés (texte secondaire ≥ 4.5:1 sur blanc)
   - Cibles tactiles ≥ 44 px (gants), texte ≥ 14 px
   - Une couleur + un libellé par orientation : classes .o-tag.o-*
   Les noms de variables v5 sont conservés (utilisés par envie-common.js).
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    /* Marque */
    --primary: #1a2e4a;          /* marine */
    --primary-light: #2a4566;
    --primary-dark: #0f1c2e;
    --navy: var(--primary);
    --orange: #ea580c;            /* accents, bordures, focus */
    --orange-light: #fff7ed;
    --orange-dark: #c2410c;       /* fond de bouton (texte blanc lisible) */
    --orange-vif: #fb923c;        /* sur fond marine uniquement */

    /* États */
    --green: #15803d;
    --green-light: #dcfce7;
    --green-dark: #166534;
    --red: #b91c1c;
    --red-light: #fee2e2;
    --amber: #b45309;
    --amber-light: #fef3c7;
    --blue: #1d4ed8;
    --blue-light: #dbeafe;
    --purple: #7e22ce;
    --purple-light: #f3e8ff;

    /* Neutres — 400/500 assombris pour la lisibilité en atelier */
    --gray-50: #f3f5f8;
    --gray-100: #eef2f6;
    --gray-200: #d5dbe3;
    --gray-300: #c2cbd7;
    --gray-400: #64748b;
    --gray-500: #475569;
    --gray-600: #334155;
    --gray-700: #1e293b;
    --gray-800: #16202e;
    --gray-900: #0f172a;
    --white: #ffffff;

    /* Orientations (texte / fond) */
    --o-brut: #334155;     --o-brut-bg: #eef2f6;
    --o-diag: #92400e;     --o-diag-bg: #fef3c7;
    --o-prod: #1e40af;     --o-prod-bg: #dbeafe;
    --o-cq: #166534;       --o-cq-bg: #dcfce7;
    --o-fap: #6b21a8;      --o-fap-bg: #f3e8ff;
    --o-mag: #115e59;      --o-mag-bg: #ccfbf1;
    --o-pdr: #44403c;      --o-pdr-bg: #e7e5e4;
    --o-demrecy: #991b1b;  --o-demrecy-bg: #fee2e2;
    --o-recycler: #ffffff; --o-recycler-bg: #991b1b;
    --o-vm: #ffffff;       --o-vm-bg: #44403c;

    /* Effets */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(15,28,46,0.06);
    --shadow: 0 2px 6px rgba(15,28,46,0.08);
    --shadow-lg: 0 8px 18px rgba(15,28,46,0.10);
    --shadow-xl: 0 18px 36px rgba(15,28,46,0.16);

    /* Typo */
    --font: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --transition: 0.15s ease;
    --tap: 44px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}
input, select, textarea, button { font-family: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

/* ============================================================
   BARRE UNIQUE (logo · scan · utilisateur · ANDON · menu)
   ============================================================ */
.topbar {
    position: sticky; top: 0; z-index: 1000;
    background: var(--primary);
    color: var(--white);
    min-height: 72px;
    display: flex; align-items: center; gap: 14px;
    padding: 10px 20px;
    flex-wrap: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.topbar-brand { font-weight: 700; font-size: 1.25rem; letter-spacing: 0.02em; white-space: nowrap; color: var(--white); text-decoration: none; }
.topbar-brand span { color: var(--orange-vif); }
.topbar-sub { font-size: 0.85rem; color: #c7d2e0; white-space: nowrap; }

.scan-bar {
    flex: 1 1 260px; min-width: 200px;
    display: flex; align-items: center; gap: 10px;
    height: 52px; padding: 0 8px 0 14px;
    background: var(--white);
    border: 3px solid var(--orange-vif);
    border-radius: 12px;
}
.scan-bar svg { flex: none; color: var(--primary); }
.scan-bar input {
    flex: 1; min-width: 0;
    border: none; outline: none; background: transparent;
    font-family: var(--mono); font-size: 1.1rem; font-weight: 500;
    color: var(--gray-800);
}
.scan-bar input::placeholder { color: var(--gray-400); font-family: var(--font); }
.scan-ok {
    height: 40px; padding: 0 16px; border: none; border-radius: 9px;
    background: var(--primary); color: var(--white); font-weight: 700; font-size: 0.95rem; cursor: pointer; flex: none;
}
.api-badge { font-size: 0.8rem; color: var(--gray-500); white-space: nowrap; }

.nav-right { display: flex; align-items: center; gap: 10px; flex: none; }
.nav-right #btnSignal { min-height: 48px; }
.nav-user { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; white-space: nowrap; }
#navUserName { font-weight: 600; font-size: 1rem; }
.nav-role-badge { font-size: 0.8rem; color: #c7d2e0; }

.topbar .btn { min-height: 48px; font-size: 1rem; }
.btn-andon { background: var(--red); color: var(--white); font-weight: 700; }
.btn-menu { background: rgba(255,255,255,0.06); color: var(--white); border: 2px solid rgba(255,255,255,0.6); border-radius: 10px; }
/* v8.53 — boutons de la barre encadrés. « .topbar » devant : sinon la règle .btn { border: none } (plus bas)
   l'emporte et aucun contour ne s'affiche (c'était déjà le cas du contour #4a6182). */
.topbar .btn-menu { border: 2px solid rgba(255,255,255,0.6); }
.topbar .btn-menu:hover { background: rgba(255,255,255,0.16); border-color: var(--white); }
.topbar .btn-menu:active { background: rgba(255,255,255,0.24); }

/* Menu déroulant */
.menu-panel {
    display: none;
    position: absolute; right: 16px; top: calc(100% + 6px);
    width: 320px; max-width: calc(100vw - 32px);
    max-height: calc(100vh - 100px); overflow-y: auto;
    background: var(--white); color: var(--gray-800);
    border-radius: var(--radius); box-shadow: var(--shadow-xl);
    padding: 8px; z-index: 1100;
}
.menu-panel.open { display: block; }
.menu-panel .menu-titre { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-500); padding: 10px 12px 4px; }
.menu-item, #envie-nav a {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: 48px; padding: 0 12px;
    background: none; border: none; border-radius: 10px;
    font-size: 1rem; font-weight: 600; color: var(--gray-800); text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover, #envie-nav a:hover { background: var(--gray-100); }
.menu-item svg, #envie-nav a svg { flex: none; color: var(--gray-500); }
.menu-item.danger { color: var(--red); }
#envie-nav { display: none; flex-direction: column; }
#envie-nav a.brand { display: none !important; }
#envie-nav a.active { color: var(--orange-dark); }
.menu-sep { height: 1px; background: var(--gray-200); margin: 6px 4px; }

/* ============================================================
   BOUTONS — 44 px minimum
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    min-height: var(--tap);
    padding: 0.5rem 1rem;
    border: none; border-radius: 10px;
    font-family: var(--font); font-weight: 600; font-size: 0.95rem;
    cursor: pointer; transition: background var(--transition), box-shadow var(--transition);
    white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-orange { background: var(--orange-dark); color: white; }
.btn-red { background: var(--red); color: white; }
.btn-green { background: var(--green-dark); color: white; }
.btn-blue { background: var(--blue); color: white; }
.btn-amber { background: var(--amber); color: white; }
.btn-outline { background: transparent; border: 2px solid rgba(255,255,255,0.35); color: white; }  /* fonds sombres */
.btn-secondary { background: #fff; border: 2px solid var(--gray-300); color: var(--gray-700); }  /* fonds clairs */
.btn-secondary-red { background: #fff; border: 2px solid var(--red); color: var(--red); }

/* ============================================================
   ÉCRANS / CONTENEURS
   ============================================================ */
.screen { display: none; }
.screen.active { display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.1rem;
    border: 2px solid var(--gray-200);
}

/* Étiquettes de champ : obligatoire / facultatif écrits en toutes lettres */
.req { font-weight: 500; color: var(--red); font-size: 0.85em; margin-left: 0.3em; }
.opt { font-weight: 500; color: var(--gray-500); font-size: 0.85em; margin-left: 0.3em; }

/* ============================================================
   ORIENTATIONS — une couleur + un libellé, partout
   ============================================================ */
.o-tag {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.3rem 0.8rem; border-radius: 999px;
    font-size: 0.85rem; font-weight: 700; white-space: nowrap; letter-spacing: 0.01em;
    color: var(--o-brut); background: var(--o-brut-bg);
}
.o-brut     { color: var(--o-brut);     background: var(--o-brut-bg); }
.o-diag     { color: var(--o-diag);     background: var(--o-diag-bg); }
.o-prod     { color: var(--o-prod);     background: var(--o-prod-bg); }
.o-cq       { color: var(--o-cq);       background: var(--o-cq-bg); }
.o-fap      { color: var(--o-fap);      background: var(--o-fap-bg); }
.o-mag      { color: var(--o-mag);      background: var(--o-mag-bg); }
.o-pdr      { color: var(--o-pdr);      background: var(--o-pdr-bg); }
.o-demrecy  { color: var(--o-demrecy);  background: var(--o-demrecy-bg); }
.o-recycler { color: var(--o-recycler); background: var(--o-recycler-bg); }
.o-vm       { color: var(--o-vm);       background: var(--o-vm-bg); }

/* Badges génériques */
.badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.25rem 0.7rem; border-radius: 999px;
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
}
.badge-green  { background: var(--o-cq-bg);   color: var(--o-cq); }
.badge-red    { background: var(--red-light); color: #991b1b; }
.badge-amber  { background: var(--o-diag-bg); color: var(--o-diag); }
.badge-blue   { background: var(--o-prod-bg); color: var(--o-prod); }
.badge-orange { background: var(--o-fap-bg);  color: var(--o-fap); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--radius); overflow: hidden; font-size: 0.95rem; }
thead tr { background: var(--primary); color: white; }
th, td { padding: 0.7rem 0.9rem; text-align: left; }
th { font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.8rem; }
td { border-bottom: 1px solid var(--gray-200); }
tbody tr:hover { background: var(--gray-100); }

/* ============================================================
   CONNEXION
   ============================================================ */
.login-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: calc(100vh - 72px); padding: 24px;
    background: var(--primary);
}
.login-inner { display: flex; align-items: center; justify-content: center; gap: 64px; flex-wrap: wrap; width: 100%; }
.login-intro { width: 330px; max-width: 100%; color: white; display: flex; flex-direction: column; gap: 12px; }
.login-intro h1 { font-size: 2.75rem; font-weight: 700; line-height: 1; letter-spacing: 0.02em; }
.login-intro h1 span { color: var(--orange-vif); }
.login-intro p { font-size: 1.05rem; color: #c7d2e0; line-height: 1.55; }
.login-intro strong { color: white; }
.pin-panel {
    background: white; border-radius: var(--radius-xl);
    padding: 28px; width: 400px; max-width: 100%;
    display: flex; flex-direction: column; gap: 18px;
}
.pin-label { font-size: 1.1rem; font-weight: 600; text-align: center; color: var(--gray-600); }
.pin-display { display: flex; justify-content: center; gap: 18px; min-height: 24px; }
.pin-dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--gray-400); transition: background 0.15s, border-color 0.15s; }
.pin-dot.filled { background: var(--primary); border-color: var(--primary); }
.pin-dot.error { background: var(--red); border-color: var(--red); animation: shake 0.4s ease; }
.pin-dot.pin-dot-4 { display: none; }          /* 4e point : seulement pour le code superviseur */
.pin-display.pin-4 .pin-dot-4 { display: block; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pin-keyboard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pin-key {
    min-height: 72px; border: none; border-radius: var(--radius);
    background: var(--gray-100); color: var(--gray-800);
    font-size: 1.75rem; font-weight: 600; cursor: pointer;
}
.pin-key:active { background: var(--orange-light); }
.pin-key.delete { background: white; border: 2px solid var(--gray-300); font-size: 1rem; color: var(--gray-600); }
.pin-error { min-height: 1.5em; text-align: center; font-weight: 600; color: var(--red); }

/* ============================================================
   ACCUEIL OPÉRATEUR
   ============================================================ */
.hub-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.hub-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.hub-aside { flex: 1 1 280px; display: flex; flex-direction: column; gap: 14px; }
.hub-aside:empty { display: none; }
.hub-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--gray-800); }
.hub-date { color: var(--gray-500); font-size: 1rem; }
.liste-titre { font-size: 1.35rem; font-weight: 700; color: var(--gray-800); }
.liste-titre span { color: var(--gray-500); font-weight: 500; }

.appareil-ligne {
    display: flex; flex-direction: column; gap: 8px;
    background: white; border: 2px solid var(--gray-200); border-radius: var(--radius);
    padding: 12px 16px; min-height: 76px; justify-content: center;
    cursor: pointer; transition: border-color var(--transition);
}
.appareil-ligne:hover { border-color: var(--primary-light); }
.appareil-ligne:active { background: var(--gray-100); }
.appareil-ligne.andon-alerte { border-color: var(--red); }
.appareil-ligne-row { display: flex; align-items: center; gap: 16px; width: 100%; }
.appareil-ligne-id { font-family: var(--mono); font-weight: 600; font-size: 1.15rem; color: var(--gray-800); min-width: 150px; }
.appareil-ligne-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appareil-ligne-desc { font-size: 1.05rem; font-weight: 600; color: var(--gray-800); }
.appareil-ligne-sub { font-size: 0.9rem; color: var(--gray-500); text-transform: uppercase; }
.appareil-ligne-duree { min-width: 64px; text-align: right; font-family: var(--mono); font-weight: 600; font-size: 1rem; color: var(--gray-600); }
.appareil-ligne-duree.moyen { color: var(--amber); }
.appareil-ligne-duree.long { color: var(--red); }
.appareil-ligne-fleche { color: var(--gray-500); font-size: 1.4rem; }
.appareil-ligne-alertes { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 166px; }
.alerte-chip { padding: 4px 12px; border-radius: 8px; background: var(--red-light); color: #991b1b; font-weight: 600; font-size: 0.9rem; }

.stat-card { background: white; border: 2px solid var(--gray-200); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.stat-titre { font-size: 0.85rem; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-grand { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat-grand b { font-size: 2.75rem; font-weight: 700; line-height: 1; }
.stat-grand span { font-size: 1.05rem; color: var(--gray-500); }
.stat-barre { height: 12px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.stat-barre > div { height: 100%; border-radius: 999px; transition: width 0.4s; }
.stat-phrase { padding: 10px 12px; border-radius: 10px; font-size: 0.95rem; font-weight: 600; line-height: 1.4; }
.stat-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat-grille b { display: block; font-size: 1.75rem; font-weight: 700; }
.stat-grille span { font-size: 0.9rem; color: var(--gray-500); }

/* Fiche appareil (après scan) */
.fiche-appareil {
    background: white; border-radius: var(--radius);
    padding: 1.1rem; border: 2px solid var(--gray-200);
    border-top: 6px solid var(--primary);
}
.fiche-appareil.diag { border-top-color: var(--o-diag); }
.fiche-appareil.prod { border-top-color: var(--o-prod); }
.fiche-appareil.cq { border-top-color: var(--o-cq); }
.fiche-appareil.fap { border-top-color: var(--o-fap); }
.fiche-id { font-family: var(--mono); font-size: 1.4rem; font-weight: 600; color: var(--gray-800); }
.fiche-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin: 0.8rem 0; }
.fiche-cell { background: var(--gray-50); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; min-width: 0; }
.fiche-cell-lbl { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.04em; }
.fiche-cell-val { font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }

/* Retour de scan : grand bandeau */
.scan-retour {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: var(--radius);
    font-weight: 700; font-size: 1.05rem;
}
.scan-retour.ok { background: var(--green-light); color: var(--green-dark); }
.scan-retour.ko { background: var(--red-light); color: #991b1b; }

/* ============================================================
   WORKFLOW
   ============================================================ */
.wf-back {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 48px; padding: 0 16px; margin-bottom: 14px;
    background: white; border: 2px solid var(--gray-300); border-radius: 10px;
    color: var(--gray-700); font-size: 1rem; font-weight: 600; cursor: pointer;
}
.wf-field { margin-bottom: 0.9rem; }
.wf-field label { display: block; font-size: 0.95rem; font-weight: 600; color: var(--gray-600); margin-bottom: 0.35rem; }
.wf-field input, .wf-field textarea, .wf-field select {
    width: 100%; min-height: 52px;
    padding: 0.7rem 0.9rem;
    border: 2px solid var(--gray-300); border-radius: 10px;
    font-family: var(--font); font-size: 1.05rem; color: var(--gray-800); background: white;
    outline: none;
}
.wf-field textarea { min-height: 88px; }
.wf-field input:focus, .wf-field textarea:focus, .wf-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,46,74,0.15); }

/* Barre d'étapes nommées (assistants DIAG / PROD) */
.wf-etapes { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; padding: 0; }
.wf-etapes li { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 500; color: var(--gray-500); }
.wf-etapes li::before { content: ''; display: block; height: 8px; border-radius: 999px; background: var(--gray-200); }
.wf-etapes li.fait::before { background: var(--gray-500); }
.wf-etapes li.encours { font-weight: 700; color: var(--primary); }
.wf-etapes li.encours::before { background: var(--primary); }
.wf-nav button { min-height: 56px; font-size: 1.05rem; padding: 0 1.4rem; }

/* Modales */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,28,46,0.55); z-index: 2000;
    align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white; border-radius: var(--radius-xl);
    padding: 1.5rem; width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl);
}

/* Toasts — plus grands, en haut, lisibles de loin */
#toastContainer {
    position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
    z-index: 3000; display: flex; flex-direction: column; gap: 0.5rem;
    pointer-events: none; width: min(560px, calc(100vw - 32px));
}
.toast {
    padding: 0.9rem 1.2rem; border-radius: var(--radius);
    font-size: 1.05rem; font-weight: 600; color: white;
    box-shadow: var(--shadow-lg); text-align: center;
    animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.toast.success { background: var(--green-dark); }
.toast.warn { background: var(--amber); }
.toast.error { background: var(--red); }
.toast.info { background: var(--primary); }

/* Chargement */
.loader { display: none; }
.loader.show { display: block; }
.spinner {
    width: 32px; height: 32px; margin: 0 auto;
    border: 3px solid var(--gray-200); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Grille d'orientation */
.orient-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.orient-btn {
    min-height: 56px; padding: 0.6rem 0.5rem;
    border-radius: var(--radius); border: 2px solid var(--gray-300); background: white;
    cursor: pointer; text-align: center;
    font-size: 0.95rem; font-weight: 600; color: var(--gray-700);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.orient-btn:hover { border-color: var(--primary-light); }
.orient-btn.sel { border-color: var(--primary) !important; background: var(--primary) !important; color: white !important; }

/* Onglets famille */
.famille-tabs { display: flex; gap: 0.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.famille-tabs:empty { display: none; }
.famille-tab {
    min-height: var(--tap); padding: 0 1rem; border-radius: 999px;
    border: 2px solid var(--gray-300); background: white; cursor: pointer;
    font-size: 0.95rem; font-weight: 600; color: var(--gray-700); white-space: nowrap;
}
.famille-tab.active { background: var(--primary); border-color: var(--primary); color: white; }

/* Pilotage / configuration */
.kpi-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.kpi-cell { background: white; border-radius: var(--radius); padding: 1rem; text-align: center; border: 2px solid var(--gray-200); }
.kpi-val { font-size: 1.9rem; font-weight: 700; color: var(--primary); }
.kpi-lbl { font-size: 0.9rem; color: var(--gray-500); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.dash-card { background: white; border-radius: var(--radius); padding: 1rem; border: 2px solid var(--gray-200); cursor: pointer; display: flex; align-items: center; gap: 0.75rem; min-height: 72px; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.config-card { background: white; border-radius: var(--radius); padding: 1rem; border: 2px solid var(--gray-200); cursor: pointer; }
.config-card:hover, .dash-card:hover { border-color: var(--primary-light); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
    .topbar-sub { display: none; }
}
@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; }
    .appareil-ligne-alertes { padding-left: 0; }
    .appareil-ligne-id { min-width: 0; }
}
@media (max-width: 640px) {
    .container { padding: 12px; }
    .topbar { padding: 8px 12px; gap: 8px; }
    .topbar-sub, .nav-user { display: none; }
    .scan-bar { order: 10; flex-basis: 100%; }
    .appareil-ligne-row { flex-wrap: wrap; gap: 8px 12px; }
    .wf-etapes li { font-size: 0.8rem; }
    .orient-grid { grid-template-columns: 1fr 1fr; }
    .fiche-grid { grid-template-columns: 1fr 1fr; }
}

/* ── v8.58 — Accueil superviseur : cartes d'étapes ── */
.sup-cartes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 1rem 0; }
.sup-carte { display: flex; flex-direction: column; text-align: left; font-family: inherit; color: var(--gray-800);
    background: #fff; border: 1px solid var(--gray-200); border-top: 4px solid var(--c, var(--primary));
    border-radius: 12px; padding: 12px 14px 10px; cursor: pointer; min-height: 190px;
    box-shadow: 0 1px 3px rgba(15,23,42,.06); transition: box-shadow .15s, transform .15s; }
.sup-carte:hover { box-shadow: 0 6px 18px rgba(15,23,42,.12); transform: translateY(-1px); }
.sup-carte:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.sup-carte-head { display: flex; align-items: center; justify-content: space-between; gap: 6px;
    font-size: 0.78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-600); }
.sup-alerte { font-size: 0.7rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--red);
    background: #fef2f2; border: 1px solid #fca5a5; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.sup-num { font-size: 2.6rem; font-weight: 800; line-height: 1.1; color: var(--c, var(--primary)); margin: 4px 0 8px;
    font-variant-numeric: tabular-nums; }
.sup-mini { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--gray-100); padding-top: 8px; margin-top: auto; }
.sup-ligne { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: baseline; font-size: 0.78rem; }
.sup-id { font-family: var(--mono, ui-monospace, monospace); font-weight: 700; color: var(--gray-700); }
.sup-mod { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gray-500); }
.sup-duree { font-weight: 700; color: var(--gray-500); font-variant-numeric: tabular-nums; }
.sup-duree.vieux { color: var(--red); }
.sup-vide { font-size: 0.78rem; color: var(--gray-400); }
.sup-skel { opacity: .6; cursor: default; }
@media (max-width: 900px) { .sup-cartes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .sup-cartes { grid-template-columns: 1fr; } .sup-carte { min-height: 0; } }
