/* =====================================================================
   BtoB.email : outils de la « note statistique »
   Complète css/site.css (mêmes jetons) pour la recherche sur mesure,
   les cartes des régions et les formulaires (contact, devis).
   Chargée seulement par ces pages.
   ===================================================================== */

/* ---------- Outil : critères à gauche, bon de commande collant à droite ---------- */
.outil { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 44px; align-items: start; }
.outil-criteres { min-width: 0; }

/* Un critère = une question numérotée, ouverte par un filet d'encre */
.critere { border: 0; border-top: 1px solid var(--encre); margin: 0 0 40px; padding: 14px 0 0; min-width: 0; }
.critere:last-child { margin-bottom: 0; }
.critere > legend { float: left; width: 100%; display: flex; align-items: baseline; gap: 10px; padding: 0; margin: 0 0 6px; font-family: var(--titre); font-weight: 700; font-size: 23px; line-height: 1.2; color: var(--encre); }
.critere > legend b { font-size: 27px; line-height: 1; color: var(--action); font-variant-numeric: tabular-nums; }
.critere > legend + * { clear: both; }
.critere-aide { color: var(--encre-2); font-size: 15.5px; margin: 0 0 16px; max-width: 66ch; }
.critere .champ { margin-bottom: 16px; }
.sous-titre { font-family: var(--texte); font-size: 14px; font-weight: 650; color: var(--encre-2); margin: 0 0 8px; }

/* Carte de sélection + régions entières */
.choix-zone { display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 28px; align-items: start; }
.carte--choix svg { max-height: 560px; }
.carte--choix path.dep { cursor: pointer; }
.carte--choix path.dep.choisi { fill: var(--surligneur); stroke: var(--encre); stroke-width: 1.4; paint-order: stroke; }
.carte--choix path.dep.choisi:focus-visible, .carte--choix path.dep.choisi.hl { stroke-width: 2.2; }
.carte--choix .dep-labels text.choisi { fill: var(--encre); }
.carte--choix .legende { margin-top: 10px; }
.regions-choix { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--filet); }
.regions-choix li { margin: 0; border-bottom: 1px solid var(--filet); break-inside: avoid; }
.regions-choix button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 40px; padding: 7px 8px; border: 0; border-radius: 0; background: none; color: var(--encre); font-size: 15px; line-height: 1.25; text-align: left; cursor: pointer; transition: background-color .12s ease-out; }
.regions-choix button:hover { background: var(--gris); }
.regions-choix button small { flex: none; color: var(--encre-3); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.regions-choix button[aria-pressed="true"] { background: var(--surligneur-pale); font-weight: 650; }
.regions-choix button[aria-pressed="true"] small { color: var(--encre); }
.ajout-dept { display: flex; gap: 8px; margin-top: 14px; max-width: 420px; }
.ajout-dept input { min-height: 44px; }
/* Bouton secondaire : button.btn (site.css) l'emporte sinon sur .btn--clair */
button.btn.btn--clair { background: #fff; color: var(--encre); border-color: var(--filet-fort); }
button.btn.btn--clair:hover { background: var(--gris); color: var(--encre); border-color: var(--encre-3); }
.ajout-dept .btn { flex: none; min-height: 44px; }

/* Puces des départements et activités retenus */
.puces { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.puces:empty { display: none; }
.puce { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 3px 3px 10px; border: 1px solid var(--filet-fort); border-radius: var(--rayon); background: #fff; font-size: 14.5px; line-height: 1.3; }
.puce b { font-family: var(--titre); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.puce small { color: var(--encre-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.puce button { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 3px; background: none; color: var(--encre-2); cursor: pointer; }
.puce button:hover { background: var(--gris-2); color: var(--encre); }
.puce button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* Champs alignés */
.champs-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.champs-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.facultatif { font-weight: 400; color: var(--encre-3); }
.cases { display: flex; flex-wrap: wrap; gap: 4px 28px; }
label.case { display: inline-flex; align-items: center; min-height: 44px; margin: 0; font-weight: 500; cursor: pointer; }
.ac-liste li b { font-family: var(--titre); font-weight: 700; color: var(--encre-2); flex: none; font-variant-numeric: tabular-nums; }
.ac-liste li span { flex: 1; min-width: 0; }

/* Résultat (bon de commande collant) */
.res-etat { margin: 0 0 12px; min-height: 2.9em; font-size: 15px; line-height: 1.45; color: var(--encre-2); }
.res-etat.pret { color: var(--action); font-weight: 650; }
.res-etat.erreur { color: var(--alerte); font-weight: 600; }
.res-n { margin: 0; font-family: var(--titre); font-weight: 700; font-size: 54px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums; color: var(--encre); overflow-wrap: anywhere; }
.res-n-lib { margin: 6px 0 14px; font-size: 15px; color: var(--encre-2); }
.res-details { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin: 0 0 16px; border-top: 1px solid var(--filet); font-size: 15px; }
.res-details dt, .res-details dd { margin: 0; padding: 6px 0; border-bottom: 1px solid var(--gris-2); }
.res-details dt { color: var(--encre-2); }
.res-details dd { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.res-prix { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 14px; }
.res-prix b { font-family: var(--titre); font-weight: 700; font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; }
.res-prix small { font-size: 14.5px; color: var(--encre-2); }
.commande.attente .res-n, .commande.attente .res-prix b, .commande.attente .res-details dd { opacity: .4; transition: opacity .15s ease-out; }
.commande.vide .res-n, .commande.vide .res-prix b { color: var(--encre-3); }
.res-complet, .res-min { margin: 0 0 14px; padding: 11px 13px; border-radius: var(--rayon); background: var(--gris); font-size: 14.5px; line-height: 1.45; color: var(--encre); }
.res-complet a { font-weight: 650; }
.res-refus { margin: 0 0 14px; padding: 11px 13px; border-radius: var(--rayon); background: var(--alerte-pale); color: #7A1A12; font-size: 14.5px; line-height: 1.45; font-weight: 600; }
.res-complet[hidden], .res-min[hidden], .res-refus[hidden] { display: none; }
.res-note { margin: 12px 0 0; font-size: 14px; color: var(--encre-2); }
.res-liens { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--filet); }
.lien-bouton { border: 0; background: none; padding: 4px 0; color: var(--action); font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; }
.lien-bouton:hover { color: var(--action-fort); text-decoration-thickness: 2px; }
.lien-bouton.ok { color: var(--encre); text-decoration: none; }
/* Bouton d'envoi désactivé : la règle de compatibilité input[type="submit"] de site.css l'emporte sinon sur .btn[disabled] */
input[type="submit"].btn[disabled], input[type="submit"].btn[disabled]:hover { background: var(--gris-2); border-color: var(--gris-2); color: var(--encre-3); cursor: not-allowed; }
.btn.inactif, a.btn.inactif { background: var(--gris-2); border-color: var(--gris-2); color: var(--encre-3); cursor: not-allowed; pointer-events: none; }

/* Barre mobile du compteur */
.re-barre { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: #fff; border-top: 1px solid var(--encre); }
.re-barre[hidden] { display: none; }
.re-barre b { display: block; font-family: var(--titre); font-weight: 700; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.re-barre span { display: block; font-size: 13px; color: var(--encre-2); }
.re-barre .btn { min-height: 44px; padding: 9px 14px; font-size: 15.5px; }
body.re-barre-visible { padding-bottom: 76px; }

/* Chiffres clés sur une seule ligne (3 éléments courts) au-dessus de 480 px */
@media (min-width: 481px) {
    .cc-ligne .cc .cc-grille { grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); row-gap: 0; }
    .cc-ligne .cc .cc-item { padding: 4px 18px 6px; border-top: 0; }
    .cc-ligne .cc .cc-item:first-child { border-left: 0; padding-left: 0; }
    .cc-ligne .cc .cc-item:nth-child(n+2) { border-left: 1px solid var(--filet); padding-left: 18px; }
}

/* Résultat validé (après « Voir l'aperçu ») */
.cc--5 .cc-item dd { font-size: clamp(1.7rem, 1.1rem + 1.3vw, 2.35rem); }
.criteres-resume { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--filet); font-size: 15.5px; }
.criteres-resume li { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--filet); color: var(--encre-2); }
.criteres-resume li strong { color: var(--encre); font-weight: 650; }
.commande--statique { position: static; }

/* ---------- Carte des régions (index des régions) ---------- */
.carte--regions path.dep { stroke-width: .5; }
.carte--regions path.dep[data-ok] { cursor: pointer; }
.carte--regions path.dep.rhl { fill: var(--surligneur); }
.carte--regions.pret path.dep { transition-duration: .15s; }
.carte--regions .dep-labels { display: none; }
.carte .reg-labels text { font-family: var(--titre); font-weight: 700; font-size: 23px; fill: var(--encre); text-anchor: middle; dominant-baseline: middle; pointer-events: none; paint-order: stroke; stroke: rgba(255, 255, 255, .8); stroke-width: 4.5px; stroke-linejoin: round; }

/* ---------- Fiche région ---------- */
.commande-compare { margin: 12px 0 0; font-size: 14.5px; color: var(--encre-2); }
.commande-compare b { color: var(--encre); }

/* ---------- Formulaires (contact, devis) ---------- */
.formulaire { min-width: 0; }
.captcha { display: grid; grid-template-columns: minmax(0, 1fr) 150px; align-items: center; gap: 8px 16px; margin: 4px 0 22px; padding: 16px; border-radius: var(--rayon); background: var(--gris); }
.captcha label { margin: 0; }
.captcha .champ-aide { grid-column: 1 / -1; margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.form-actions .note { margin: 0; }
.form-erreur { display: block; margin: 0 0 18px; }
.encadre-delai { margin: 0 0 4px; font-family: var(--titre); font-weight: 700; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.encadre .liste-liens { margin-top: 18px; }
.encadre .liste-liens a { padding: 12px 0; }
.lateral { position: sticky; top: calc(var(--et-h) + 20px); }

/* ---------- Adaptation ---------- */
@media (min-width: 1061px) {
    .re-barre { display: none !important; }
    body.re-barre-visible { padding-bottom: 0; }
}
@media (max-width: 1060px) {
    .outil { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .choix-zone { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .regions-choix { columns: 2 220px; column-gap: 24px; border-top: 0; }
    .regions-choix li:first-child, .regions-choix li { border-top: 0; }
    .lateral { position: static; }
}
@media (max-width: 700px) {
    .champs-2, .champs-3 { grid-template-columns: minmax(0, 1fr); }
    .critere > legend { font-size: 21px; }
    .res-n { font-size: 46px; }
    .captcha { grid-template-columns: minmax(0, 1fr); }
    .carte--regions + .legende, .carte--choix + .legende { margin-top: 8px; }
}
@media (max-width: 480px) {
    .regions-choix { columns: 1; }
    .ajout-dept { flex-wrap: wrap; }
    .ajout-dept .btn { width: 100%; }
}
@media print {
    .re-barre, .res-liens { display: none !important; }
}
