/* ====== Thème (sombre par défaut) ====== */
:root {
  --bg: #0b0e14;
  --bg2: #161b27;
  --bg3: #0f131c;
  --bord: #28304180;
  --txt: #e7ebf3;
  --txt2: #8a93a6;
  /* accent (surchargé par [data-accent]) */
  --accent: #6b8afd;
  --accent2: #9b6bfd;
  --accent-doux: var(--accent-doux);   /* anneaux de focus, fonds actifs */
  --accent-doux2: var(--accent-doux2);  /* badges, états */
  /* couleurs sémantiques */
  --rouge: #ff5c6c;
  --orange: #ffb454;
  --vert: #2fd39a;
  /* surfaces dérivées du thème */
  --btn: var(--btn);             /* bouton plein neutre + toast */
  --survol: var(--survol);        /* survol léger */
  --survol-fort: var(--survol-fort);
  --surface-douce: var(--surface-douce); /* puces, icônes, champs-pilule */
  --surface-douce2: var(--surface-douce2);
  --barre-bg: #0e1320cc;      /* barre du haut (floutée) */
  --modale-fond: #000a;       /* overlay des modales */
  --interrupteur-off: var(--interrupteur-off);
  --halo1: #1c2a4a55;         /* dégradés d'ambiance du fond */
  --halo2: #18203a55;
  /* encarts d'alerte */
  --avert-bg: #ffb45415; --avert-bord: #ffb45440; --avert-txt: #ffd9a0;
  --erreur-bg: #ff5c6c1a; --erreur-bord: #ff5c6c55; --erreur-txt: #ffb3bb;
  --rayon: 16px;
  --ombre: 0 10px 40px #0008;
  --taille-base: 100%;
  color-scheme: dark;
}

/* ====== Thème clair ====== */
[data-theme="clair"] {
  --bg: #f3f5fb;
  --bg2: #ffffff;
  --bg3: #eef1f7;
  --bord: #d6ddea;
  --txt: #1a2030;
  --txt2: #5d6781;
  --rouge: #e0394b;
  --orange: #b5730a;
  --vert: #14a074;
  --btn: #e6ebf5;
  --survol: #00000008;
  --survol-fort: #00000014;
  --surface-douce: #0000000a;
  --surface-douce2: #00000010;
  --barre-bg: #ffffffd0;
  --modale-fond: #1a203066;
  --interrupteur-off: #00000026;
  --halo1: #6b8afd12;
  --halo2: #9b6bfd0e;
  --avert-bg: #ffb4541f; --avert-bord: #ffb45466; --avert-txt: #8a5300;
  --erreur-bg: #ff5c6c1c; --erreur-bord: #ff5c6c66; --erreur-txt: #b00020;
  --ombre: 0 10px 30px #1a20301a;
  color-scheme: light;
}

/* ====== Couleurs d'accent ====== */
[data-accent="violet"]   { --accent: #9b6bfd; --accent2: #c06bfd; --accent-doux: #9b6bfd33; --accent-doux2: #9b6bfd18; }
[data-accent="emeraude"] { --accent: #2fd39a; --accent2: #34c0c0; --accent-doux: #2fd39a33; --accent-doux2: #2fd39a18; }
[data-accent="rose"]     { --accent: #ff6b9b; --accent2: #fd6bd0; --accent-doux: #ff6b9b33; --accent-doux2: #ff6b9b18; }
[data-accent="orange"]   { --accent: #ff9f45; --accent2: #ffb454; --accent-doux: #ff9f4533; --accent-doux2: #ff9f4518; }
[data-accent="cyan"]     { --accent: #3bc9db; --accent2: #4f9bff; --accent-doux: #3bc9db33; --accent-doux2: #3bc9db18; }

/* ====== Taille du texte ====== */
html { font-size: var(--taille-base); }
[data-taille="grande"] { --taille-base: 112.5%; }
[data-taille="enorme"] { --taille-base: 125%; }

/* ====== Accessibilité : focus clavier visible ====== */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:focus-visible, .mini:focus-visible, .nav-item:focus-visible, .menu-item:focus-visible,
.tag-pill:focus-visible, .gen-onglet:focus-visible, .interrupteur input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ====== Mouvement réduit (préférence utilisateur OU système) ====== */
html.sobre *, html.sobre *::before, html.sobre *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

* { box-sizing: border-box; }
/* L'attribut [hidden] doit toujours l'emporter sur les règles display: des composants */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--halo1) 0, transparent 60%),
    radial-gradient(1000px 500px at 0% 110%, var(--halo2) 0, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--txt);
  display: flex; flex-direction: column; min-height: 100vh;
}
#app { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { margin: 0 0 14px; font-size: 1.2rem; }

/* ====== Boutons ====== */
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; font-size: .92rem; font-weight: 600;
  cursor: pointer; transition: .15s; color: var(--txt); background: var(--btn); font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn-primaire { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-fantome { background: var(--survol); }
.btn-fantome:hover { background: var(--survol-fort); }
.btn.bloc { width: 100%; padding: 12px; margin-top: 8px; }
.mini {
  border: 0; background: var(--surface-douce); color: var(--txt); border-radius: 8px; cursor: pointer;
  width: 34px; height: 34px; font-size: 1rem; transition: .15s;
}
.mini:hover { background: var(--survol-fort); }

/* ====== Cartes & formulaires ====== */
.carte { background: var(--bg2); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 22px; box-shadow: var(--ombre); }
label { display: block; font-size: .82rem; color: var(--txt2); margin-bottom: 12px; }
input, textarea, select {
  width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--bord); background: var(--bg3); color: var(--txt);
  font-size: .95rem; font-family: inherit; outline: none; transition: .15s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
textarea { resize: vertical; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ====== Auth ====== */
.vue.centre { display: grid; place-items: center; padding: 40px 16px; }
.carte-auth { width: 100%; max-width: 400px; }
.marque-grande { font-size: 1.6rem; font-weight: 800; text-align: center; }
.sous-titre { text-align: center; color: var(--txt2); margin: 6px 0 22px; }
.bascule { text-align: center; color: var(--txt2); margin: 16px 0 0; font-size: .9rem; }
.avert { background: var(--avert-bg); border: 1px solid var(--avert-bord); color: var(--avert-txt); font-size: .8rem; padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; }
.erreur { background: var(--erreur-bg); border: 1px solid var(--erreur-bord); color: var(--erreur-txt); padding: 10px 12px; border-radius: 10px; font-size: .88rem; margin-top: 12px; }

/* barre de force */
.barre-force { height: 6px; background: var(--surface-douce); border-radius: 99px; overflow: hidden; margin: 2px 0 4px; }
.barre-force > div { height: 100%; width: 0; border-radius: 99px; transition: .25s; background: var(--txt2); }
.barre-force > div.faible { background: var(--rouge); }
.barre-force > div.moyen { background: var(--orange); }
.barre-force > div.fort { background: var(--vert); }
.force-txt { font-size: .76rem; color: var(--txt2); margin-bottom: 12px; min-height: 1em; }

/* ====== Dashboard : barre du haut ====== */
.barre {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--bord);
  background: var(--barre-bg); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10;
}
.marque { font-weight: 800; font-size: 1.15rem; }
.barre-actions { display: flex; align-items: center; gap: 10px; }
.salut { color: var(--txt2); font-size: .9rem; margin-right: 4px; }
.contenu { max-width: 1000px; margin: 0 auto; padding: 22px 16px 60px; }

/* ====== Cartes du haut ====== */
.grille-haut { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 14px; margin-bottom: 18px; }
.carte-profil { display: flex; align-items: center; gap: 16px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; color: #fff;
}
.profil-nom { font-weight: 700; font-size: 1.05rem; }
.profil-email { color: var(--txt2); font-size: .85rem; }
.profil-depuis { color: var(--txt2); font-size: .76rem; margin-top: 4px; }
.stat { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.stat-val { font-size: 2rem; font-weight: 800; }
.stat-lib { color: var(--txt2); font-size: .78rem; }
.anneau {
  --p: 0; width: 64px; height: 64px; border-radius: 50%; position: relative; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-douce2) 0);
}
.anneau::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--bg2); }
.anneau span { position: relative; font-weight: 700; font-size: .82rem; }
.carte-repartition { align-items: stretch; justify-content: center; gap: 8px; }
.rep { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--txt2); }
.rep b { margin-left: auto; color: var(--txt); }
.pastille { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.pastille.faible { background: var(--rouge); }
.pastille.moyen { background: var(--orange); }
.pastille.fort { background: var(--vert); }

/* ====== Déverrouillage ====== */
.panneau-verrou p { color: var(--txt2); font-size: .9rem; }
.ligne-form { display: flex; gap: 10px; margin-top: 12px; }
.ligne-form input { margin-top: 0; }

/* ====== Coffre v2 : disposition ====== */
.coffre-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.coffre-sidebar { padding: 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.coffre-main { padding: 18px; min-height: 60vh; }

/* Barre latérale */
.nav-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; color: var(--txt); padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: .9rem; font-family: inherit; }
.nav-item:hover { background: var(--survol); }
.nav-item.actif { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 600; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpt { font-size: .72rem; color: var(--txt2); background: var(--surface-douce2); padding: 1px 7px; border-radius: 99px; }
.nav-section { margin: 8px 0 2px; }
.nav-titre { display: flex; align-items: center; justify-content: space-between; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--txt2); padding: 6px 10px 2px; }
.nav-vide { font-size: .78rem; color: var(--txt2); padding: 2px 10px; }
.nav-outils { display: none; gap: 2px; margin-left: auto; }
.nav-item:hover .nav-outils { display: flex; }
.nav-outils .mini { width: 24px; height: 24px; font-size: .8rem; }
.nav-tags { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 8px; }
.tag-pill { background: var(--surface-douce2); color: var(--txt); border: 0; border-radius: 99px; padding: 3px 9px; font-size: .76rem; cursor: pointer; }
.tag-pill.actif { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }

/* Barre d'outils */
.coffre-barre { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.recherche-wrap { display: flex; gap: 6px; align-items: center; flex: 1; min-width: 180px; }
.recherche-wrap input { margin-top: 0; }
.coffre-barre-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.menu-ajouter { position: relative; }
.menu-deroulant { position: absolute; right: 0; top: 110%; background: var(--bg2); border: 1px solid var(--bord); border-radius: 12px; box-shadow: var(--ombre); padding: 6px; z-index: 30; min-width: 210px; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--txt); padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: .9rem; font-family: inherit; }
.menu-item:hover { background: var(--surface-douce); }
.coffre-titre-filtre { font-weight: 700; margin-bottom: 10px; color: var(--txt2); }

/* Liste / grille d'entrées */
.liste-entrees { display: flex; flex-direction: column; gap: 4px; }
.liste-entrees.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.entree { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; transition: .12s; cursor: pointer; }
.entree:hover { background: var(--bg3); }
.liste-entrees.dense .entree { padding: 5px 10px; }
.liste-entrees.grille .entree { flex-direction: column; align-items: stretch; text-align: center; background: var(--bg3); }
.liste-entrees.grille .entree-droite { justify-content: center; }
.entree-icone { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-douce); display: grid; place-items: center; font-weight: 700; color: var(--accent); flex: none; overflow: hidden; }
.liste-entrees.grille .entree-icone { margin: 0 auto; }
.entree-icone img { width: 24px; height: 24px; object-fit: contain; }
.entree-infos { flex: 1; min-width: 0; }
.entree-libelle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entree-identifiant { color: var(--txt2); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entree-badges { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.liste-entrees.grille .entree-badges { justify-content: center; }
.chip { font-size: .68rem; background: var(--surface-douce); color: var(--txt2); padding: 1px 8px; border-radius: 99px; }
.chip-warn { background: #ffb45422; color: var(--orange); }
.mini-fav { font-size: .8rem; }
.entree-droite { display: flex; align-items: center; gap: 8px; }
.entree-actions { display: flex; gap: 2px; }
.entree-actions .mini { width: 30px; height: 30px; }

.vide { text-align: center; color: var(--txt2); padding: 30px 10px; }
.vide .petit { font-size: .8rem; margin-top: 6px; }
.petit { font-size: .8rem; }
.pa-empreinte:not(.erreur):not(:empty) { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #8fa0b8; font-size: .78rem; margin: 8px 0 2px; letter-spacing: .4px; }
mark { background: #ffd86b; color: #000; border-radius: 2px; }
.toast-action { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; margin-left: 12px; font-family: inherit; font-size: .9rem; }

/* Modale large + détail */
.modale-large { max-width: 560px; }
.e-type-ligne { font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.cases-ligne { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 8px; }
.detail-entete { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.detail-entete h2 { margin: 0; flex: 1; }
.d-champ { margin-bottom: 12px; }
.d-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .4px; color: var(--txt2); margin-bottom: 3px; }
.d-valeur { display: flex; align-items: center; gap: 8px; word-break: break-word; }
.d-secret { font-family: ui-monospace, monospace; flex: 1; }
.d-notes { background: var(--bg3); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.d-notes h2, .d-notes h3, .d-notes h4 { margin: .4em 0 .2em; }
.d-notes a { color: var(--accent); }
.d-totp { margin-bottom: 12px; }
.totp-code { font-family: ui-monospace, monospace; font-size: 1.4rem; letter-spacing: 2px; color: var(--vert); }
.totp-jauge { font-size: .8rem; color: var(--txt2); }
.d-histo-ligne { display: flex; align-items: center; gap: 10px; padding: 4px 0; }

/* ====== Modales ====== */
.modale { position: fixed; inset: 0; background: var(--modale-fond); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modale[hidden] { display: none; }
.modale-contenu { width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; animation: pop .15s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modale-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.champ-mdp { display: flex; gap: 6px; align-items: center; }
.champ-mdp input { margin-top: 6px; }
.gen-sortie { display: flex; gap: 6px; margin-bottom: 16px; }
.gen-sortie input { font-family: ui-monospace, monospace; margin-top: 0; }
.gen-longueur { display: flex; align-items: center; gap: 10px; color: var(--txt); }
.gen-longueur input[type="range"] { flex: 1; margin-top: 0; }
.gen-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; }
.gen-options label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--txt); font-size: .88rem; }
.gen-options input { width: auto; margin: 0; }

/* ====== Toast & pied ====== */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--btn); border: 1px solid var(--bord); color: var(--txt);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--ombre); z-index: 100; font-size: .9rem;
}
.pied { text-align: center; color: var(--txt2); font-size: .78rem; padding: 18px; border-top: 1px solid var(--bord); }

/* ====== Connexion : case & 2FA ====== */
.case { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--txt2); margin: 4px 0 12px; }
.case input { width: auto; margin: 0; }

/* ====== Boutons danger ====== */
.btn-danger { background: linear-gradient(135deg, #ff5c6c, #d6334a); color: #fff; }

/* ====== Page Paramètres ====== */
.contenu-param { display: flex; flex-direction: column; gap: 16px; }
.bloc-param h2 { font-size: 1.05rem; }
.entete-bloc { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* ====== Administration ====== */
.admin-panneau { display: flex; flex-direction: column; gap: 14px; }
.grille-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.admin-stat { background: var(--bg2); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; text-align: center; }
.admin-stat .v { font-size: 1.8rem; font-weight: 800; }
.admin-stat .l { color: var(--txt2); font-size: .76rem; margin-top: 2px; }
.admin-liste-users .rangee { cursor: pointer; }
.admin-liste-users .rangee:hover { background: var(--bg3); }
.admin-widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.admin-widget { background: var(--bg2); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; cursor: grab; transition: border-color .15s, opacity .15s; }
.admin-widget:active { cursor: grabbing; }
.admin-widget.glisse { opacity: .4; }
.admin-widget.survol { border-color: var(--accent); }
.admin-widget h3 { margin: 0 0 10px; font-size: .9rem; color: var(--txt2); font-weight: 600; }
.admin-widget .kpi-grand { font-size: 2rem; font-weight: 800; line-height: 1; }
.admin-widget .kpi-sous { color: var(--txt2); font-size: .78rem; margin-top: 4px; }
.admin-widget .kpi-ligne { display: flex; justify-content: space-between; font-size: .85rem; padding: 3px 0; }
.kpi-barre { height: 8px; background: var(--surface-douce); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.kpi-barre > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; transition: width .3s; }

/* ====== Bandeau d'annonce global ====== */
.bandeau-annonce { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; font-size: .9rem; font-weight: 500; text-align: center; }
.bandeau-annonce.info { background: var(--accent-doux2); color: var(--accent); border-bottom: 1px solid var(--accent-doux); }
.bandeau-annonce.avertissement { background: #ffb4541f; color: var(--orange); border-bottom: 1px solid #ffb45455; }
.bandeau-annonce.maintenance { background: #ff5c6c1f; color: var(--rouge); border-bottom: 1px solid #ff5c6c55; }
.bandeau-annonce button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.05rem; line-height: 1; opacity: .65; padding: 0 4px; }
.bandeau-annonce button:hover { opacity: 1; }

/* ====== Métriques système (Admin → Système) ====== */
.metriques-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.metrique { background: var(--bg3); border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px; }
.metrique .m-titre { font-size: .72rem; color: var(--txt2); text-transform: uppercase; letter-spacing: .04em; }
.metrique .m-valeur { font-size: 1.5rem; font-weight: 700; margin: 4px 0; }
.metrique .m-detail { font-size: .78rem; color: var(--txt2); }
.jauge { height: 7px; background: var(--bord); border-radius: 99px; overflow: hidden; margin-top: 7px; }
.jauge > div { height: 100%; width: 0; border-radius: 99px; transition: width .5s, background .5s; }
.jauge.ok > div { background: linear-gradient(90deg, var(--vert), var(--accent)); }
.jauge.moyen > div { background: var(--orange); }
.jauge.haut > div { background: var(--rouge); }

/* ====== Overlay maintenance (non-admins) ====== */
.overlay-maintenance { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }

.choix-accent { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px var(--bord) inset; transition: transform .15s; }
.swatch:hover { transform: scale(1.12); }
.swatch.actif { border-color: var(--txt); }

/* ====== Liens Send (réception) ====== */
.env-secret { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; margin: 8px 0; }
.env-titre { margin: 4px 0 12px; }
#en-lien { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.reglage { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--bord); }
.reglage:first-of-type { border-top: 0; }
.reglage-titre { font-weight: 600; }
.reglage-desc { color: var(--txt2); font-size: .82rem; margin-top: 2px; }
.reglage-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ok-inline { color: var(--vert); font-size: .85rem; margin-left: 10px; }
.zone-danger { border-color: #ff5c6c55; }
.zone-danger h2 { color: var(--rouge); }

/* Interrupteur (toggle) */
.interrupteur { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.interrupteur input { opacity: 0; width: 0; height: 0; }
.interrupteur span { position: absolute; inset: 0; background: var(--interrupteur-off); border-radius: 99px; transition: .2s; cursor: pointer; }
.interrupteur span::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.interrupteur input:checked + span { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.interrupteur input:checked + span::before { transform: translateX(20px); }

/* Tableaux (historique, sessions, appareils) */
.tableau { display: flex; flex-direction: column; }
.rangee { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--bord); font-size: .88rem; flex-wrap: wrap; }
.rangee:first-child { border-top: 0; }
.rangee > span:first-child:not(.pastille) { min-width: 150px; font-weight: 500; }
.rangee .mini { margin-left: auto; }
.badge { font-size: .72rem; padding: 2px 9px; border-radius: 99px; }
.badge-ok { background: #2fd39a22; color: var(--vert); }
.badge-ko { background: #ff5c6c22; color: var(--rouge); }
#btn-revoquer-tous { margin-top: 12px; }

/* 2FA : QR + codes */
.qr-zone { display: flex; justify-content: center; margin: 10px 0; }
.qr-zone img { border-radius: 12px; background: #fff; padding: 8px; max-width: 220px; }
.codes { background: var(--bg3); border: 1px solid var(--bord); border-radius: 10px; padding: 14px; font-family: ui-monospace, monospace; font-size: 1rem; letter-spacing: 1px; line-height: 1.8; white-space: pre-wrap; text-align: center; }

/* ====== Générateur v2 ====== */
.gen-onglets { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.flux-temps-reel { max-height: 280px; overflow: auto; }
.flux-temps-reel .rangee.alerte > span:nth-child(2) { color: var(--rouge); font-weight: 600; }
.gen-onglet { flex: 1; background: var(--survol); border: 0; color: var(--txt2); padding: 9px; border-radius: 9px; cursor: pointer; font-family: inherit; font-weight: 600; }
.gen-onglet.actif { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.gen-masse { margin-top: 14px; border-top: 1px solid var(--bord); padding-top: 10px; }
.gen-masse summary { cursor: pointer; color: var(--txt2); font-size: .9rem; }
.gen-masse textarea { font-family: ui-monospace, monospace; margin: 10px 0; }

/* ====== Vue Santé ====== */
.sante-entete { display: flex; align-items: center; gap: 22px; }
.anneau-grand { width: 96px; height: 96px; }
.anneau-grand span { font-size: 1.3rem; font-weight: 800; }
.sante-resume-bloc { flex: 1; }
.sante-badge { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.sante-badge.badge-ok { color: var(--vert); }
.sante-badge.badge-warn { color: var(--orange); }
.grille-sante { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.carte-sante { cursor: pointer; transition: .12s; }
.carte-sante:hover { transform: translateY(-2px); border-color: var(--accent); }
.sante-rangee { gap: 12px; }
.sante-rangee-txt { flex: 1; }
.sante-rangee-txt > div:first-child { font-weight: 600; }
.hibp-resultat { margin-top: 12px; }

/* ====== Partages ====== */
.badge-nb { background: var(--rouge); color: #fff; border-radius: 99px; padding: 0 7px; font-size: .7rem; font-weight: 700; margin-left: 2px; }
.pt-btn { padding: 5px 12px; font-size: .82rem; margin-left: auto; }
.rangee .pt-btn + .mini { margin-left: 4px; }

/* ====== Indicateur de synchronisation ====== */
.sync-etat { font-size: .76rem; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.sync-etat.ajour { color: var(--vert); background: #2fd39a18; }
.sync-etat.synchro { color: var(--accent); background: var(--accent-doux2); }
.sync-etat.horsligne, .sync-etat.erreur { color: var(--orange); background: #ffb45418; }
#sync-empreinte { background: var(--surface-douce); padding: 1px 6px; border-radius: 5px; font-family: ui-monospace, monospace; }

/* ====== Responsive ====== */
@media (max-width: 860px) {
  .grille-haut { grid-template-columns: 1fr 1fr; }
  .carte-profil { grid-column: 1 / -1; }
  .coffre-layout { grid-template-columns: 1fr; }
  .coffre-sidebar { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .coffre-sidebar .nav-section { width: 100%; }
}
