/* =====================================================================
   Fact-X — mise en page et composants. Ne référence QUE des variables
   de thème (theme.css). Aucune couleur en dur ici.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transition: background .2s ease, color .2s ease;
}
a { color: var(--lien); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; font-weight: 700; }
h1 { font-size: 2.1rem; margin: 0 0 .5em; }
h2 { font-size: 1.5rem; margin: 1.8em 0 .6em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 .5em; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: "SF Mono", "JetBrains Mono", "Fira Code", Consolas, monospace; }

.contenu { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.section { padding: 40px 0; }
.muted { color: var(--texte-doux); }
.faible { color: var(--texte-faible); font-size: .9rem; }
.centre { text-align: center; }
.pile > * + * { margin-top: 14px; }

/* ---- En-tête / navigation ---------------------------------------- */
.entete {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bordure);
}
.entete .contenu { display: flex; align-items: center; gap: 18px; height: 62px; }
.marque { display: flex; align-items: center; gap: 10px; color: var(--or); font-weight: 800; letter-spacing: .3px; flex: none; }
.marque:hover { text-decoration: none; }
.marque svg { width: 30px; height: 30px; display: block; flex: none; }
/* Le nom ne se casse JAMAIS en deux lignes. */
.marque .nom { color: var(--texte); font-size: 1.2rem; white-space: nowrap; }
.marque .nom b { color: var(--or); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--texte-doux); padding: 7px 12px; border-radius: 8px;
  font-size: .95rem; font-weight: 600;
}
.nav a:hover { color: var(--texte); background: var(--fond-survol); text-decoration: none; }
.nav a.actif { color: var(--or); }
.outils { display: flex; align-items: center; gap: 6px; }

.bouton-icone {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 34px; border-radius: 8px;
  background: transparent; color: var(--texte-doux);
  border: 1px solid var(--bordure); cursor: pointer; font-size: .95rem;
}
.bouton-icone:hover { color: var(--or); border-color: var(--bordure-forte); background: var(--fond-survol); }

/* ---- Boutons ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 700; font-size: .98rem; cursor: pointer; transition: .15s;
  background: var(--fond-3); color: var(--texte);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-or { background: var(--or); color: var(--sur-or); }
.btn-or:hover { background: var(--or-vif); }
.btn-ligne { background: transparent; border-color: var(--bordure-forte); color: var(--texte); }
.btn-ligne:hover { border-color: var(--or); color: var(--or); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---- Hero (accueil) ---------------------------------------------- */
.hero { position: relative; border-bottom: 1px solid var(--bordure); overflow: hidden; }
.hero-media { position: absolute; inset: 0; background-size: cover; background-position: right center; background-image: url("/assets/banniere-nuit.png"); }
[data-theme="jour"] .hero-media { background-image: url("/assets/banniere-jour.png"); }
.hero-voile {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--fond) 8%, color-mix(in srgb, var(--fond) 75%, transparent) 46%, transparent 78%);
}
.hero .contenu { position: relative; padding: 82px 20px; }
.hero-bloc { max-width: 560px; }
.hero h1 { font-size: 2.6rem; }
.hero .accroche { font-size: 1.2rem; color: var(--texte-doux); }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.puces { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 20px; }
.puce { display: flex; align-items: center; gap: 8px; color: var(--texte-doux); font-size: .95rem; font-weight: 600; }
.puce::before { content: "✓"; color: var(--or); font-weight: 800; }

/* ---- Cartes / grilles -------------------------------------------- */
.grille { display: grid; gap: 18px; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.carte {
  background: var(--fond-2); border: 1px solid var(--bordure);
  border-radius: 14px; padding: 22px; box-shadow: var(--ombre);
}
.carte h3 { margin-top: 0; }
.carte .ico { font-size: 1.4rem; color: var(--or); }

/* ---- Tarifs ------------------------------------------------------- */
.prix-grille { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: stretch; }
.prix { display: flex; flex-direction: column; background: var(--fond-2); border: 1px solid var(--bordure); border-radius: 14px; padding: 22px; }
.prix.vedette { border-color: var(--or); box-shadow: 0 0 0 1px var(--or) inset; }
.prix .plan { font-weight: 800; color: var(--or); text-transform: uppercase; letter-spacing: .5px; font-size: .85rem; }
.prix .montant { font-size: 2rem; font-weight: 800; margin: 8px 0 2px; }
.prix .montant small { font-size: .9rem; font-weight: 600; color: var(--texte-doux); }
.prix ul { list-style: none; padding: 0; margin: 14px 0 18px; }
.prix li { padding: 6px 0; border-top: 1px solid var(--bordure); font-size: .93rem; color: var(--texte-doux); }
.prix .btn { margin-top: auto; }
.badge-offre { display: inline-block; margin-top: 8px; padding: 3px 9px; border-radius: 999px; background: var(--reserve-fond); color: var(--reserve); font-size: .78rem; font-weight: 700; }

/* ---- Formulaires -------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  background: var(--fond-3); border: 1px solid var(--bordure);
  color: var(--texte); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--or); border-color: var(--or); }
.champ-ligne { display: flex; gap: 8px; align-items: center; }

/* ---- Glisser-déposer (validateur) -------------------------------- */
.depot {
  border: 2px dashed var(--bordure-forte); border-radius: 16px;
  padding: 46px 20px; text-align: center; background: var(--fond-2);
  cursor: pointer; transition: .15s;
}
.depot:hover, .depot.survol { border-color: var(--or); background: var(--fond-survol); }
.depot .grand { font-size: 1.15rem; font-weight: 700; }
.depot .ico { font-size: 2.2rem; color: var(--or); }

.bandeau {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 10px 16px; border-radius: 10px; font-size: .9rem;
  background: var(--fond-3); color: var(--texte-doux); border: 1px solid var(--bordure);
}

/* ---- Rapport de validation --------------------------------------- */
.verdict { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 14px; border: 1px solid; margin: 6px 0 20px; }
.verdict .pastille { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.verdict .titre { font-weight: 800; font-size: 1.2rem; }
.verdict.ok       { background: var(--ok-fond);       border-color: var(--ok); }
.verdict.ok .pastille       { background: var(--ok); }        .verdict.ok .titre       { color: var(--ok); }
.verdict.reserve  { background: var(--reserve-fond);  border-color: var(--reserve); }
.verdict.reserve .pastille  { background: var(--reserve); }   .verdict.reserve .titre  { color: var(--reserve); }
.verdict.invalide { background: var(--invalide-fond); border-color: var(--invalide); }
.verdict.invalide .pastille { background: var(--invalide); }  .verdict.invalide .titre { color: var(--invalide); }

.etapes { display: grid; gap: 8px; margin: 16px 0; }
.etape { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--fond-2); border: 1px solid var(--bordure); border-radius: 10px; }
.etape .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; background: var(--fond-3); color: var(--texte-doux); flex: none; }
.etape .lib { font-weight: 600; }
.etape .statut { margin-left: auto; font-weight: 700; font-size: .85rem; }
.st-passed  { color: var(--ok); }
.st-warning { color: var(--reserve); }
.st-failed  { color: var(--invalide); }
.st-skipped, .st-unavailable { color: var(--texte-faible); }

.diag { padding: 14px 16px; border-left: 3px solid; border-radius: 8px; background: var(--fond-2); margin: 10px 0; }
.diag.error   { border-color: var(--invalide); }
.diag.warning { border-color: var(--reserve); }
.diag .code { font-size: .78rem; font-weight: 700; color: var(--texte-faible); }
.diag .clair { font-weight: 600; margin: 4px 0; }
.diag .tech { font-size: .85rem; color: var(--texte-doux); }

/* ---- Tables ------------------------------------------------------- */
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bordure); }
table.data th { color: var(--texte-doux); font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; }
table.data tr:hover td { background: var(--fond-survol); }
.pastille-rouge { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--invalide); margin-right: 6px; }
.etiquette { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--fond-3); color: var(--texte-doux); border: 1px solid var(--bordure); }
/* Un métier EN SERVICE se voit ; un métier À VENIR se lit sans se
   confondre avec lui — l'honnêteté doit être visible d'un coup d'œil. */
.etiquette.ok { color: var(--ok); border-color: var(--ok); }
.etiquette.attente { color: var(--texte-doux); border-style: dashed; }
.prix.en-attente { opacity: .72; border-style: dashed; }

/* ---- Code --------------------------------------------------------- */
pre.code { background: var(--fond-3); border: 1px solid var(--bordure); border-radius: 12px; padding: 16px; overflow: auto; font-size: .86rem; }
.onglets { display: flex; gap: 6px; margin-bottom: -1px; }
.onglet { padding: 7px 14px; border: 1px solid var(--bordure); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--fond-2); cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--texte-doux); }
.onglet.actif { color: var(--or); background: var(--fond-3); }

/* ---- Cléfield (espace client) ------------------------------------ */
.cle-box { display: flex; align-items: center; gap: 10px; background: var(--fond-3); border: 1px solid var(--bordure); border-radius: 10px; padding: 12px 14px; }
.cle-box .val { font-family: "SF Mono", monospace; font-size: .95rem; word-break: break-all; }
.jauge { height: 10px; border-radius: 999px; background: var(--fond-3); overflow: hidden; border: 1px solid var(--bordure); }
.jauge > span { display: block; height: 100%; background: var(--or); }
/* Jauge de consommation du cockpit : la couleur DIT l'état — or tant
   que ça va, ambre dès 80 %, rouge à 100 %. Le directeur repère un
   client qui sature sans lire un chiffre. */
.jauge-barre { display: block; height: 100%; background: var(--or); }
.jauge-barre.ok       { background: var(--ok); }
.jauge-barre.reserve  { background: var(--reserve); }
.jauge-barre.invalide { background: var(--invalide); }
.kpi { font-size: 1.8rem; font-weight: 800; color: var(--or); }

/* ---- Cockpit zones ------------------------------------------------ */
.zone { margin: 22px 0; }
.zone h2 { display: flex; align-items: center; gap: 10px; }
.compteur { background: var(--or); color: var(--sur-or); border-radius: 999px; padding: 1px 9px; font-size: .82rem; font-weight: 800; }
.alerte { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--bordure); background: var(--fond-2); margin: 8px 0; }
.alerte.haute { border-left: 3px solid var(--invalide); }
.alerte.moyenne { border-left: 3px solid var(--reserve); }
.reco { color: var(--texte-doux); font-size: .9rem; }

/* ---- Pied --------------------------------------------------------- */
.pied { border-top: 1px solid var(--bordure); margin-top: 40px; color: var(--texte-doux); font-size: .9rem; }
.pied .contenu { padding: 26px 20px; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.pied .liens { display: flex; gap: 16px; flex-wrap: wrap; margin-left: auto; }

/* ---- Boutons pays (validateur pays-conscient) ---------------------- */
.pays-boutons { display: flex; gap: 8px; flex-wrap: wrap; }
.pays-btn {
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--bordure-forte); background: var(--fond-2);
  color: var(--texte); font-size: .92rem; transition: border-color .15s, background .15s;
}
.pays-btn:hover { border-color: var(--or); }
.pays-btn.actif { border-color: var(--or); background: color-mix(in srgb, var(--or) 14%, var(--fond-2)); font-weight: 600; }

/* ---- Divers ------------------------------------------------------- */
.cache { display: none !important; }
.avis { padding: 12px 16px; border-radius: 10px; background: var(--reserve-fond); color: var(--reserve); font-size: .9rem; border: 1px solid var(--reserve); }
.erreur-boite { padding: 12px 16px; border-radius: 10px; background: var(--invalide-fond); color: var(--invalide); border: 1px solid var(--invalide); }
.tourne { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--bordure-forte); border-top-color: var(--or); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .g3, .g2, .prix-grille { grid-template-columns: 1fr; }
  .nav { display: none; }
  .nav.ouvert { display: flex; position: absolute; top: 62px; left: 0; right: 0; flex-direction: column; background: var(--fond-2); border-bottom: 1px solid var(--bordure); padding: 10px; }
  .hero h1 { font-size: 2rem; }
  .hero-voile { background: linear-gradient(180deg, color-mix(in srgb, var(--fond) 82%, transparent), var(--fond)); }
}

/* ---------------------------------------------------------------
   ZONE DE DANGER — la suppression de compte.
   Elle doit SE VOIR : encadrée, détachée du reste, aux couleurs du
   verdict « invalide » (les mêmes que le rouge des rapports — une
   seule grammaire de couleur dans toute la maison). Le bouton final
   est ÉTEINT tant que les trois verrous ne sont pas posés ; allumé,
   il est franchement rouge. Personne ne supprime son compte par
   accident. Aucune couleur en dur : tout vient de theme.css.
   --------------------------------------------------------------- */
.zone-danger {
  border: 1px solid var(--invalide);
  border-left: 4px solid var(--invalide);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--invalide-fond);
}
.zone-danger .danger-titre { margin: 0 0 8px; color: var(--invalide); }
.zone-danger ul { margin: 8px 0 12px; padding-left: 18px; }
.zone-danger li { margin-bottom: 4px; }
.btn-danger {
  background: var(--invalide); border: 1px solid var(--invalide);
  color: var(--fond); padding: 8px 18px; border-radius: 6px; cursor: pointer;
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.12); }
.btn-danger:disabled {
  background: transparent; color: var(--texte-faible);
  border-color: var(--bordure-forte); cursor: not-allowed; opacity: .6;
}

/* Les trois métiers, au-dessus du dépôt : même grammaire visuelle que
   les boutons pays — on ne réinvente pas un composant pour trois
   boutons. */
.bloc-metiers { margin: 0 0 18px; }

/* Liste des corrections faites par l'atelier — verte, une par ligne. */
ul.gestes { margin: 8px 0 4px; padding-left: 20px; }
ul.gestes li { margin-bottom: 4px; color: var(--ok); }

/* Champ mot de passe avec œil : le bouton se pose à droite du champ,
   sans couleur en dur — tout vient du thème. */
.champ-mdp { position: relative; }
.champ-mdp input { flex: 1; padding-right: 40px; }
.oeil {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 4px 6px; opacity: .7;
}
.oeil:hover, .oeil.actif { opacity: 1; }

/* QR code de la double authentification : fond blanc, coins arrondis,
   taille lisible. Le SVG vient du serveur. */
.qr-2fa { display:inline-block; background:#ffffff; padding:12px; border-radius:10px; margin:8px 0; max-width:100%; }
/* 320px : taille MESURÉE, pas choisie au hasard. En dessous, un module du
   QR tombe sous 5 px à l'écran et la lecture par caméra devient
   aléatoire (180px = 70 % d'échecs, 240px = 95 %, 320px = 100 %).
   Fond blanc pur imposé : un fond teinté fait échouer la détection en
   thème sombre. */
.qr-2fa svg { display:block; width:320px; height:320px; max-width:100%; height:auto; aspect-ratio:1; }
