/* Prototype marque blanche — habillé avec le Design system générique (Figma).
   Palette : Primary 500→100, Secondary (lavandes claires), Tertiary (violets doux).
   Boutons : primaire marine #12005A (hover lavande), CTA en dégradé réservé aux
   actions exceptionnelles. Cartes blanches très arrondies sur fond lavande. */

:root {
  /* Tokens du design system */
  --primary-500: #12005a;
  --primary-400: #40279c;
  --primary-300: #6f52cd;
  --primary-200: #a88fee;
  --primary-100: #d3c5f6;
  --secondary-500: #e5d9fd;
  --secondary-400: #ece2fd;
  --secondary-300: #f1e8fe;
  --secondary-200: #f6f0fe;
  --secondary-100: #fbf7fe;
  --tertiary-400: #9b83e3;
  --tertiary-300: #b69ff1;
  --tertiary-200: #d2c1fa;
  --tertiary-100: #e9e0fc;
  /* Fin du dégradé assombrie (#c93bd9 → #a82fb8) : le texte blanc y passe
     de 4,11:1 (échec) à 5,1:1. --magenta garde la teinte vive pour les
     usages non textuels (pastilles, liserés). */
  --cta: linear-gradient(100deg, #7c3aed 0%, #a82fb8 100%);
  --inactif: #c9c5d2;

  --magenta: #c93bd9;

  /* Rôles. Le fond quitte le violet : la scène est un studio photo produit
     (blanc chaud), le violet redevient la couleur de la marque et de
     l'interaction — comme le bleu chez Apple. */
  --fond: #f2f0ed;
  --carte: #ffffff;
  --trait: var(--secondary-400);
  --texte: #241b47;
  --texte-doux: #6a6382;
  --ombre: 0 10px 30px rgba(18, 0, 90, 0.12);
  --ombre-douce: 0 2px 8px rgba(18, 0, 90, 0.06);
  --rayon: 22px;
  --largeur-prix: 268px; /* réservé en bas à droite par le badge de prix */

  /* Le rouge est RÉSERVÉ aux vraies erreurs (échec d'envoi, suppression).
     Il ne qualifie jamais un niveau de conception : standard / adapté /
     sur-mesure décrivent un chemin de fabrication, pas une réussite. */
  --erreur: #c0392b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  color: var(--texte);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- En-tête ---- */

header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  background: var(--carte);
  z-index: 20;
}
/* Filet dégradé : signe la marque en haut de l'écran */
header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--cta);
}
.marque { display: flex; align-items: center; gap: 12px; }
.marque h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--primary-500);
  letter-spacing: 0.2px;
}
.badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--primary-400);
  background: linear-gradient(120deg, var(--secondary-300), var(--tertiary-100));
  border: 1px solid var(--tertiary-200);
  border-radius: 999px;
  padding: 3px 12px;
}
.actions-entete { display: flex; align-items: center; gap: 8px; }
.bouton-icone-entete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--primary-100);
  background: var(--carte);
  color: var(--primary-400);
  cursor: pointer;
  transition: all 0.15s;
}
.bouton-icone-entete svg { width: 20px; height: 20px; }
.bouton-icone-entete:hover { background: var(--secondary-400); border-color: var(--tertiary-300); }

/* ---- Niveau de conception ----
   standard → adapté → sur mesure : la profondeur d'intervention du bureau
   d'études, pas un verdict. Encodé par une icône + un libellé explicite + une
   intensité de violet croissante. Le sur-mesure reçoit le dégradé que le design
   system réserve à l'exceptionnel : c'est le savoir-faire signature, pas une
   alerte. Jamais de couleur seule : le libellé est toujours écrit. */

.niveau {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 12px 4px 9px;
  white-space: nowrap;
}
.niveau svg { width: 14px; height: 14px; flex: none; }
.niveau.standard {
  background: var(--secondary-400);
  color: var(--primary-400);
  box-shadow: inset 0 0 0 1px var(--primary-100);
}
.niveau.adapte {
  background: var(--tertiary-200);
  color: var(--primary-500);
  box-shadow: inset 0 0 0 1px var(--tertiary-400);
}
.niveau.sur_mesure {
  background: var(--cta);
  color: #fff;
  box-shadow: 0 2px 10px rgba(201, 59, 217, 0.3);
}

/* Version compacte, pour les listes de modules */
.niveau.mini { font-size: 10px; padding: 2px 9px 2px 7px; gap: 4px; }
.niveau.mini svg { width: 11px; height: 11px; }

/* ---- Scène ---- */

main { position: relative; flex: 1; min-height: 0; background: var(--fond); }
/* Studio photo produit : lumière qui descend, horizon chaud */
#vue3d {
  position: absolute;
  inset: 0;
  background: linear-gradient(#fdfdfc 0%, #f4f2ee 52%, #e9e6e0 100%);
}
#vue3d canvas { display: block; }

/* Plan technique 2D : fond blanc, dessin centré dans la zone libre */
#vue-plan-2d {
  position: absolute;
  inset: 0;
  background: #ffffff;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 40px 40px;
  padding-left: calc(var(--decalage, 0px) + 40px);
  padding-right: calc(var(--decalage-droit, 0px) + 40px);
}
#vue-plan-2d svg { width: 100%; height: 100%; }
.message-plan { font-size: 14px; color: var(--texte-doux); text-align: center; }

#invite {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 384px; /* à droite du panneau ancré */
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#invite p {
  position: relative;
  text-align: center;
  font-size: 15px;
  line-height: 1.65;
  color: var(--primary-500);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  padding: 22px 32px;
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  margin: 0 20px;
  overflow: hidden;
}
/* Liseré dégradé en haut de la carte d'invite */
#invite p::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--cta);
}

/* ---- Écran de démarrage (pattern KPlanner) ---- */

#modal-demarrage {
  position: fixed;
  inset: 0;
  background: rgba(18, 0, 90, 0.28);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.boite-demarrage {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 26px 28px 28px;
  width: 640px;
  max-width: calc(100vw - 40px);
}
.boite-demarrage h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--texte);
  margin: 0 0 20px;
}
.choix-demarrage { display: flex; gap: 14px; }
.choix-demarrage button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font: inherit;
  padding: 26px 18px 22px;
  background: var(--carte);
  border: 1px solid var(--secondary-500);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.choix-demarrage button:hover {
  border-color: var(--tertiary-400);
  box-shadow: 0 6px 18px rgba(64, 39, 156, 0.18);
  transform: translateY(-1px);
}
.choix-demarrage svg { width: 34px; height: 34px; color: var(--primary-300); margin-bottom: 6px; }
.choix-demarrage strong { font-size: 14px; font-weight: 600; color: var(--primary-500); }
.choix-demarrage span { font-size: 11.5px; color: var(--texte-doux); }

/* Deuxième écran de la modale : les 4 catégories en cartes visuelles, 2 × 2 */
.entete-etape-demarrage { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.entete-etape-demarrage h2 { margin: 0; }

#grille-categories-demarrage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.carte-categorie {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  font: inherit;
  text-align: left;
  padding: 0 0 13px;
  background: var(--carte);
  border: 1px solid var(--secondary-500);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s;
}
.carte-categorie:hover {
  border-color: var(--tertiary-400);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(64, 39, 156, 0.16);
}
/* Zone visuelle : pictogramme sur un dégradé lavande doux */
.carte-categorie .visuel-categorie {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px 0 9px;
  background: linear-gradient(135deg, var(--secondary-200), var(--tertiary-100));
  border-bottom: 1px solid var(--secondary-400);
}
.visuel-categorie svg { width: 112px; height: 64px; }
.carte-categorie strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary-500);
  padding: 10px 15px 0;
}
.carte-categorie .desc-categorie {
  font-size: 11px;
  line-height: 1.5;
  color: var(--texte-doux);
  padding: 0 15px;
}

/* ---- Toast ---- */

/* Messages sans bouton d'origine (import 3D…) : même style translucide, en bas */
#toast {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 6px 18px rgba(18, 0, 90, 0.12);
  color: var(--primary-500);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 10px;
  z-index: 15;
  max-width: 80%;
  text-align: center;
}

/* ---- Barre d'outils du planner ---- */

#barre-outils {
  position: absolute;
  top: 14px;
  left: calc((100% + var(--decalage, 0px) - var(--decalage-droit, 0px)) / 2); /* centré dans la zone libre */
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--carte);
  border-radius: 12px;
  box-shadow: var(--ombre);
  padding: 6px;
  z-index: 12;
}
#barre-outils button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--primary-400);
  cursor: pointer;
  transition: all 0.12s;
}
#barre-outils button svg { width: 19px; height: 19px; }
#barre-outils button:hover:not(:disabled) { background: var(--secondary-300); }
#barre-outils button.actif { background: var(--secondary-400); color: var(--primary-500); box-shadow: inset 0 0 0 1px var(--primary-200); }
#barre-outils button:disabled { color: var(--inactif); cursor: default; }
#barre-outils .separateur { width: 1px; height: 20px; background: var(--secondary-500); margin: 0 4px; }

/* Bulle de description : sous le bouton utilisé, blanc translucide + flou */
#info-bulle {
  position: fixed;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 6px 18px rgba(18, 0, 90, 0.12);
  color: var(--primary-500);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 60;
}

/* ---- Boutons flottants (ouvrir panneau, cahier des charges) ---- */

.bouton-flottant {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--secondary-400);
  border-radius: 13px;
  background: var(--carte);
  color: var(--primary-400);
  cursor: pointer;
  box-shadow: var(--ombre);
  transition: all 0.12s;
  z-index: 12;
}
.bouton-flottant svg { width: 21px; height: 21px; }
.bouton-flottant:hover { border-color: var(--tertiary-300); background: var(--secondary-100); }

#boutons-ouverture {
  position: absolute;
  left: 16px;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 12;
}
#boutons-ouverture .bouton-flottant { position: static; }
.bouton-flottant:disabled { color: var(--inactif); cursor: default; }
.bouton-flottant:disabled:hover { border-color: var(--secondary-400); background: var(--carte); }
#bouton-cdc-flottant { right: 16px; top: 14px; }

/* Fenêtre étroite : le CDC descend sous la barre d'outils pour ne pas la chevaucher */
@media (max-width: 1100px) {
  #bouton-cdc-flottant { top: 70px; }
}
.point {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--carte);
}
/* Pastille du bouton flottant : ramp violet → magenta (intensité de conception) */
.point.standard { background: var(--primary-200); }
.point.adapte { background: var(--tertiary-400); }
.point.sur_mesure { background: var(--magenta); box-shadow: 0 0 0 3px rgba(201, 59, 217, 0.2); }

/* ---- Commutateur de vue 2D/3D ---- */

#commutateur-vue {
  position: absolute;
  bottom: 18px;
  /* Centré dans la bande libre : entre les panneaux ET à gauche du prix */
  left: calc((100% + var(--decalage, 0px) - var(--decalage-droit, 0px) - var(--largeur-prix) - 32px) / 2);
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: var(--carte);
  border-radius: 999px;
  box-shadow: var(--ombre);
  padding: 5px;
  z-index: 12;
}
#commutateur-vue button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-400);
  border: none;
  background: none;
  border-radius: 999px;
  padding: 7px 18px;
  cursor: pointer;
  transition: all 0.12s;
}
#commutateur-vue button:hover:not(.actif) { background: var(--secondary-300); }
#commutateur-vue button.actif { background: var(--primary-500); color: #fff; }

/* ---- Panneau projets ---- */

#panneau-projets {
  position: fixed;
  top: 62px;
  right: 20px;
  width: 340px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  background: var(--carte);
  border-radius: 16px;
  box-shadow: var(--ombre);
  z-index: 40;
  overflow: hidden;
}
.projet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--secondary-500);
  border-radius: 12px;
  margin-bottom: 8px;
}
.projet-item .infos-projet { flex: 1; min-width: 0; }
.projet-item .nom-projet {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.projet-item .date-projet { font-size: 11px; color: var(--texte-doux); }
.projet-item button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.projet-item .ouvrir-projet { background: var(--primary-500); color: #fff; border: none; }
.projet-item .ouvrir-projet:hover { background: var(--secondary-400); color: var(--primary-300); }
.projet-item .supprimer-projet { background: none; border: 1px solid var(--secondary-500); color: var(--texte-doux); }
.projet-item .supprimer-projet:hover { border-color: var(--erreur); color: var(--erreur); }
.projets-vide { font-size: 12.5px; color: var(--texte-doux); text-align: center; padding: 18px 10px; }

/* ---- Panneaux flottants ---- */

/* Panneaux ANCRÉS : pleine hauteur, séparés de la scène par un filet —
   l'outil a un cadre, seule la scène respire. Le flottant reste réservé
   au contextuel (carte d'édition, bulles). */
aside {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--carte);
  overflow: hidden;
  z-index: 14; /* au-dessus de la barre d'outils : un panneau ouvert a la priorité */
}
#panneau-gauche { left: 0; width: 384px; border-right: 1px solid var(--trait); }

/* Transition configuration → discussion : fondu recouvrant tout le panneau gauche */
#transition-parcours {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--carte);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
#transition-parcours.visible { opacity: 1; }
#transition-parcours svg {
  width: 40px;
  height: 40px;
  padding: 12px;
  color: #fff;
  background: var(--cta);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
}
#transition-parcours p { margin: 0; font-size: 15px; font-weight: 700; color: var(--primary-500); }
#transition-parcours span { font-size: 12.5px; color: var(--texte-doux); }

/* Onglets Configuration / Discussion en tête du panneau gauche */
.onglets-panneau {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 0;
  background: linear-gradient(180deg, var(--secondary-200), var(--carte));
  border-bottom: 1px solid var(--secondary-400);
}
.onglet {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--texte-doux);
  background: none;
  border: none;
  padding: 8px 12px 11px;
  cursor: pointer;
  transition: color 0.12s;
}
.onglet svg { width: 17px; height: 17px; }
.onglet:hover:not(:disabled) { color: var(--primary-400); }
.onglet.actif { color: var(--primary-500); }
/* Soulignement en dégradé : rappelle le filet du header */
.onglet.actif::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2.5px;
  border-radius: 3px 3px 0 0;
  background: var(--cta);
}
.onglet:disabled { color: var(--inactif); cursor: default; }
.onglets-panneau .bouton-icone { margin-left: auto; margin-bottom: 8px; }
.onglets-panneau .bouton-icone svg { width: 15px; height: 15px; }
#panneau-droit { right: 0; width: 380px; border-left: 1px solid var(--trait); }

#vue-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.entete-panneau {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: linear-gradient(180deg, var(--secondary-100), var(--carte));
  border-bottom: 1px solid var(--secondary-400);
}
.entete-panneau h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-500);
  margin: 0;
  flex: 1;
}
.bouton-icone {
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--secondary-400);
  background: none;
  cursor: pointer;
  color: var(--primary-300);
}
.bouton-icone:hover { background: var(--secondary-400); border-color: var(--tertiary-300); }
.lien-discret {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-300);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.lien-discret:hover { text-decoration: underline; }

.corps-panneau { flex: 1; overflow-y: auto; padding: 14px; }

/* ---- Configuration : choix de catégorie (premier écran du parcours) ---- */

#grille-produits { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }

.carte-produit {
  display: flex;
  flex-direction: column;
  font: inherit;
  text-align: left;
  background: var(--carte);
  border: 1px solid var(--secondary-500);
  border-radius: 16px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.15s;
}
.carte-produit:hover:not(:disabled) {
  border-color: var(--tertiary-400);
  box-shadow: 0 6px 18px rgba(64, 39, 156, 0.18);
  transform: translateY(-1px);
}
.carte-produit:disabled { cursor: default; }
.carte-produit:disabled .infos { opacity: 0.55; }
.carte-produit img {
  width: 100%;
  aspect-ratio: 22 / 15;
  object-fit: contain;
  background: var(--secondary-200);
  border-bottom: 1px solid var(--secondary-400);
  padding: 8px;
}
.carte-produit .infos { padding: 10px 12px 12px; }
.carte-produit h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--primary-500); }
.carte-produit p { margin: 0; font-size: 11px; line-height: 1.5; color: var(--texte-doux); }
.carte-produit .mention {
  display: inline-block;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary-300);
  background: var(--secondary-300);
  border-radius: 999px;
  padding: 2px 9px;
}

/* ---- Parcours guidé (les cases bleues du logigramme, en clics) ---- */

#vue-parcours { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Fiche des réponses : une seule carte, des filets fins, zéro perte d'espace.
   L'action « modifier » apparaît au survol de sa ligne (ou au clavier). */
.fiche-reponses {
  background: var(--carte);
  border: 1px solid var(--secondary-400);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--ombre-douce);
}
.ligne-reponse {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
}
.ligne-reponse + .ligne-reponse { border-top: 1px solid var(--secondary-200); }
.ligne-reponse:hover { background: var(--secondary-100); }
.cle-reponse { flex: none; font-size: 12px; color: var(--texte-doux); }
.valeur-reponse {
  flex: 1;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-500);
  font-variant-numeric: tabular-nums;
}
.ligne-reponse .modifier-etape {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: -4px 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--primary-300);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
}
.ligne-reponse .modifier-etape svg { width: 13px; height: 13px; }
.ligne-reponse:hover .modifier-etape,
.ligne-reponse .modifier-etape:focus-visible { opacity: 1; }
.ligne-reponse .modifier-etape:hover { background: var(--secondary-400); }

.etape-courante { margin-top: 14px; }
.etape-courante h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-500);
}
.etape-courante h3 svg { width: 18px; height: 18px; flex: none; color: var(--tertiary-400); }
.etape-courante .aide-etape { margin: 0 0 12px; font-size: 12px; color: var(--texte-doux); }
.etape-courante .aide-etape strong { color: var(--primary-400); }

/* Titre du parcours : pictogramme de la catégorie + nom */
#titre-parcours { display: flex; align-items: center; gap: 9px; }
.picto-titre { display: flex; flex: none; }
.picto-titre svg { width: 38px; height: 23px; }

/* Libellés des sous-sections d'une étape (composition : ruban / modules / angles) */
.libelle-section-etape {
  margin: 13px 0 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-400); /* contraste 8,48:1 — tertiary-400 échouait à 3,11:1 */
}
.libelle-section-etape:first-of-type { margin-top: 2px; }
.carte-ajout:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }

.option-parcours {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  font: inherit;
  text-align: left;
  padding: 13px 15px;
  margin-bottom: 8px;
  background: var(--carte);
  border: 1px solid var(--secondary-500);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.13s;
}
.option-parcours { transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s, background 0.15s; }
.option-parcours:hover {
  border-color: var(--tertiary-300);
  background: var(--secondary-100);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(64, 39, 156, 0.1);
}
.option-parcours.choisie {
  border-color: var(--primary-400);
  background: var(--secondary-300);
  position: relative;
}
/* Coche de sélection : l'état choisi se voit sans lire */
.option-parcours.choisie::after {
  content: '✓';
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 21px;
  height: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--cta);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.option-parcours strong { font-size: 13.5px; font-weight: 600; color: var(--primary-500); }
.option-parcours span { font-size: 11.5px; color: var(--texte-doux); }
/* Option qui bascule le projet en sur-mesure : dégradé de valorisation
   (savoir-faire bureau d'études), pas une couleur d'alerte */
.option-parcours .badge-option {
  align-self: flex-start;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
  background: var(--cta);
  border-radius: 999px;
  padding: 3px 9px;
}

.saisie-parcours { display: flex; gap: 8px; margin-bottom: 10px; }
.saisie-parcours input {
  flex: 1;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--primary-100);
  border-radius: 10px;
  padding: 10px 12px;
}
.saisie-parcours input:focus { outline: 2px solid var(--primary-300); border-color: transparent; }

.bouton-parcours {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--cta);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}
.bouton-parcours:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.32);
}
.bouton-parcours:active { transform: translateY(0) scale(0.985); box-shadow: none; }
.bouton-parcours:disabled { background: var(--inactif); cursor: default; filter: none; transform: none; box-shadow: none; }
.bouton-parcours.secondaire {
  background: var(--carte);
  color: var(--primary-400);
  border: 1px solid var(--primary-100);
}
.bouton-parcours.secondaire:hover { background: var(--secondary-300); }

.preconisation-etape {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  color: var(--primary-500);
  background: var(--secondary-100);
  border: 1px solid var(--primary-200);
  border-radius: 10px;
  padding: 10px 13px;
  margin-bottom: 10px;
  cursor: pointer;
}
.preconisation-etape:hover { background: var(--secondary-300); }

/* Composeur de modules (droit/brisé) */
/* Cartes d'ajout du composeur : chaque module dessiné proportionnellement,
   les angles en biseau — on voit ce qu'on ajoute avant de cliquer */
.cartes-ajout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.carte-ajout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font: inherit;
  padding: 12px 6px 9px;
  background: var(--carte);
  border: 1px solid var(--secondary-500);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.13s;
}
.carte-ajout:hover {
  border-color: var(--tertiary-400);
  transform: translateY(-1px);
  box-shadow: var(--ombre-douce);
}
.carte-ajout .mini-module {
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(160deg, var(--primary-400), var(--primary-300));
  margin-bottom: 5px;
}
.carte-ajout .mini-angle {
  width: 22px;
  height: 18px;
  background: var(--tertiary-300);
  border-radius: 2px;
  margin-bottom: 5px;
}
.carte-ajout .mini-angle.int { clip-path: polygon(0 0, 100% 0, 100% 100%); }
.carte-ajout .mini-angle.ext { clip-path: polygon(0 0, 100% 0, 0 100%); }
.carte-ajout strong { font-size: 12px; font-weight: 600; color: var(--primary-500); }
.carte-ajout .sous-carte { font-size: 10px; color: var(--texte-doux); }

/* Le ruban du composeur : on GLISSE un segment pour le déplacer, la poubelle
   (centrée au survol, donc jamais rognée par l'overflow) retire l'élément */
.ruban-composeur {
  margin-bottom: 10px;
  background: var(--secondary-200);
  border-radius: 12px;
  padding: 4px;
}
/* overflow visible : la pastille de suppression déborde du coin du segment.
   Sélecteur à double classe : la règle de base du ruban (overflow: hidden,
   définie plus loin dans la feuille) perdrait sinon face à celle-ci. */
.ruban-composition.ruban-composeur .segment { position: relative; cursor: grab; overflow: visible; }
.ruban-composeur .segment:hover { filter: brightness(1.1); }
.ruban-composeur .segment.en-deplacement { opacity: 0.4; }
/* Cible de dépôt : un liseré magenta du côté où l'élément va s'insérer */
.ruban-composeur .segment.cible-gauche { box-shadow: inset 4px 0 0 var(--magenta); }
.ruban-composeur .segment.cible-droite { box-shadow: inset -4px 0 0 var(--magenta); }
.ruban-composeur .segment.angle.cible-gauche::before { box-shadow: none; filter: brightness(0.8); }
/* Pastille de suppression en coin, comme sur les raccords à l'origine */
.ruban-composeur .retirer-segment {
  position: absolute;
  top: -10px;
  right: -9px;
  /* opacity (et non display:none) : un élément non affiché n'est pas
     focalisable au clavier — la suppression devenait souris seulement */
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: var(--primary-500);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(18, 0, 90, 0.3);
}
.ruban-composeur .retirer-segment svg { width: 14px; height: 14px; }
/* Au survol de la pastille : seule l'ICÔNE passe en rouge (le fond ne bouge pas) */
.ruban-composeur .retirer-segment:hover svg { color: #ff6b5e; }
.ruban-composeur .segment:hover .retirer-segment,
.ruban-composeur .retirer-segment:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.total-composeur { font-size: 12px; color: var(--texte-doux); margin-bottom: 10px; }

.fin-parcours {
  margin-top: 12px;
  padding: 10px 4px;
  font-size: 12px;
  color: var(--texte-doux);
  text-align: center;
}

/* ---- Chat ---- */

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Chaque message est une ligne : avatar (assistant) + bulle */
.ligne-bulle { display: flex; align-items: flex-end; gap: 8px; }
.ligne-bulle.utilisateur { justify-content: flex-end; }
.avatar-bulle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--cta);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}
.avatar-bulle svg { width: 15px; height: 15px; }

.bulle {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.bulle.utilisateur {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary-400), var(--primary-300));
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 12px rgba(64, 39, 156, 0.22);
}
.bulle.assistant {
  align-self: flex-start;
  background: var(--secondary-200);
  border: 1px solid var(--secondary-500);
  color: var(--texte);
  border-bottom-left-radius: 4px;
  box-shadow: var(--ombre-douce);
}
.bulle.erreur { background: #fdecea; border-color: #f5c6c0; color: var(--erreur); }

/* Indicateur de chargement : trois points animés, le classique "en cours de traitement" */
.points-chargement { display: inline-flex; align-items: center; gap: 4px; height: 14px; padding: 2px 4px; }
.points-chargement span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-300);
  animation: rebond-points 1.1s ease-in-out infinite;
}
.points-chargement span:nth-child(2) { animation-delay: 0.15s; }
.points-chargement span:nth-child(3) { animation-delay: 0.3s; }
@keyframes rebond-points {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

#formulaire-chat {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--secondary-400);
}
#champ-message {
  flex: 1;
  font: inherit;
  font-size: 13px;
  color: var(--texte);
  border: 1px solid var(--primary-100);
  border-radius: 10px;
  padding: 9px 12px;
  resize: none;
}
#champ-message::placeholder { color: var(--texte-doux); }
#champ-message:focus { outline: 2px solid var(--primary-300); border-color: transparent; }

/* Bouton primaire du design system : défaut marine, hover lavande, actif violet clair */
#bouton-envoyer {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  background: var(--primary-500);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  transition: all 0.15s;
}
#bouton-envoyer { background: var(--cta); border-radius: 12px; transition: transform 0.12s, box-shadow 0.15s, filter 0.15s; }
#bouton-envoyer:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(124, 58, 237, 0.32); }
#bouton-envoyer:active { transform: scale(0.985); box-shadow: none; }
#bouton-envoyer:disabled { background: var(--inactif); color: #fff; cursor: wait; }

/* ---- Cahier des charges ----
   Pensé comme une fiche produit, pas comme un tableau : une identité en tête,
   les chiffres clés en grand, la composition dessinée, et l'article ERP présenté
   comme le livrable qu'il est. */

#recap { font-size: 13px; }

/* Hero : l'identité du projet, avec son niveau de conception */
.hero-cdc {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-400) 62%, #5b34b8 100%);
  color: #fff;
  box-shadow: 0 8px 22px rgba(18, 0, 90, 0.22);
}
.hero-cdc.sur_mesure { background: var(--cta); box-shadow: 0 8px 22px rgba(201, 59, 217, 0.3); }
/* Halo décoratif : donne de la profondeur au bloc */
.hero-cdc::after {
  content: '';
  position: absolute;
  right: -34px;
  top: -46px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}
.hero-cdc .categorie-hero {
  position: relative;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  opacity: 0.72;
}
.hero-cdc h3 {
  position: relative;
  margin: 5px 0 11px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}
/* Dans le hero, le badge s'aligne sur le fond translucide */
.hero-cdc .niveau {
  position: relative;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* Chiffres clés */
.tuiles-cdc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}
.tuile {
  background: var(--secondary-200);
  border: 1px solid var(--secondary-400);
  border-radius: 14px;
  padding: 10px 12px;
}
.tuile .valeur-tuile {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-500);
  line-height: 1.15;
}
.tuile .valeur-tuile small { font-size: 11px; font-weight: 600; color: var(--primary-300); }
.tuile .libelle-tuile {
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-400); /* contraste AA : voir libelle-section-etape */
}

/* Titres de section : icône + filet dégradé */
#recap h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 20px 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-300);
}
#recap h4 svg { width: 14px; height: 14px; flex: none; color: var(--tertiary-400); }
#recap h4::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--secondary-500), transparent);
}

/* Lignes clé/valeur regroupées en une carte propre (plus de pointillés) */
.bloc-lignes {
  background: var(--carte);
  border: 1px solid var(--secondary-400);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--ombre-douce);
}
.ligne-recap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 13px;
}
.ligne-recap + .ligne-recap { border-top: 1px solid var(--secondary-300); }
.ligne-recap .cle { font-size: 12px; color: var(--texte-doux); }
.ligne-recap .valeur { text-align: right; font-weight: 600; color: var(--primary-500); }

/* Ruban de composition : les modules dessinés à l'échelle, dans l'ordre de pose */
.ruban-composition {
  display: flex;
  gap: 4px;
  height: 38px;
  margin-bottom: 10px;
}
.ruban-composition .segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(160deg, var(--primary-400), var(--primary-300));
  overflow: hidden;
  white-space: nowrap;
}
/* Un raccord d'angle = un triangle orienté dans son sens (comme sa carte
   d'ajout). Le triangle est dessiné en ::before pour ne pas rogner le ✕
   de suppression, qui dépasse du segment au survol dans le composeur. */
.ruban-composition .segment.angle {
  position: relative;
  flex: none;
  width: 26px;
  background: none;
  overflow: visible;
}
.ruban-composition .segment.angle::before {
  content: '';
  position: absolute;
  inset: 3px 1px;
  background: var(--tertiary-300);
}
.ruban-composition .segment.angle.int::before { clip-path: polygon(0 0, 100% 0, 100% 100%); }
.ruban-composition .segment.angle.ext::before { clip-path: polygon(0 0, 100% 0, 0 100%); }

/* Article ERP : présenté comme le livrable, style « ticket » */
.ticket-erp {
  background: var(--secondary-100);
  border: 1px dashed var(--primary-200);
  border-radius: 16px;
  padding: 14px;
}
.ticket-erp .type-article {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--primary-400); /* contraste AA : voir libelle-section-etape */
}
.ticket-erp .designation-article {
  margin: 6px 0 11px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--primary-500);
}
.mention-prix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--carte);
  color: var(--primary-400);
  box-shadow: inset 0 0 0 1px var(--primary-100);
}
.mention-prix svg { width: 13px; height: 13px; }
.mention-prix.be { background: var(--cta); color: #fff; box-shadow: none; }
.commentaire-article {
  margin-top: 9px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--texte-doux);
}

/* Cartes d'information : inférences à confirmer, notes pour le bureau d'études */
.carte-info {
  position: relative;
  background: var(--secondary-100);
  border: 1px solid var(--secondary-400);
  border-radius: 14px;
  padding: 11px 13px 11px 16px;
  margin-bottom: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--primary-500);
}
.carte-info::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--tertiary-400);
}
.carte-info.be::before { background: var(--magenta); }
.carte-info .justif { margin-top: 4px; font-size: 11.5px; color: var(--texte-doux); }

/* ---- Vue technique (JSON replié, sombre Primary-500) ---- */

/* ---- Carte d'édition directe (clic sur un module de la scène 3D) ---- */

#carte-selection {
  position: fixed;
  z-index: 30;
  width: 280px;
  background: var(--carte);
  border: 1px solid var(--secondary-400);
  border-radius: 16px;
  box-shadow: var(--ombre);
  padding: 13px 15px 15px;
}
.entete-carte-selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.entete-carte-selection strong { font-size: 13px; color: var(--primary-500); }
.entete-carte-selection button {
  font: inherit;
  font-size: 12px;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid var(--secondary-400);
  background: none;
  color: var(--primary-300);
  cursor: pointer;
}
.entete-carte-selection button:hover { background: var(--secondary-400); }
.libelle-carte {
  margin: 9px 0 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-400); /* contraste AA : voir libelle-section-etape */
}
.chips-paliers { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-palier {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--secondary-500);
  background: var(--carte);
  color: var(--primary-500);
  cursor: pointer;
  transition: all 0.12s;
}
.chip-palier:hover { border-color: var(--tertiary-400); }
.chip-palier.actif { background: var(--primary-400); border-color: var(--primary-400); color: #fff; }
.actions-selection { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.actions-selection button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--primary-100);
  background: var(--secondary-100);
  color: var(--primary-400);
  cursor: pointer;
  transition: all 0.12s;
}
.actions-selection button:hover:not(:disabled) { background: var(--secondary-400); }
.actions-selection button:disabled { color: var(--inactif); border-color: var(--secondary-400); cursor: default; }
.actions-selection button.danger:hover:not(:disabled) {
  border-color: var(--erreur);
  color: var(--erreur);
  background: #fdecea;
}
.saisie-carte { display: flex; gap: 6px; }
.saisie-carte input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--primary-100);
  border-radius: 9px;
}

/* (Le ruban du CDC est purement visuel : pas d'interaction au clic) */

/* ---- Confirmation « Nouveau projet » ---- */

.popover-confirmation {
  position: fixed;
  z-index: 60;
  width: 300px;
  background: var(--carte);
  border: 1px solid var(--secondary-400);
  border-radius: 16px;
  box-shadow: var(--ombre);
  padding: 15px 16px;
}
.popover-confirmation p {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--texte);
}
.boutons-confirmation { display: flex; gap: 8px; }
.boutons-confirmation .bouton-parcours { flex: 1; }

/* Le menu « Ajouter ici » (poignée +) : la grille de cartes a besoin de place */
#carte-selection.large { width: 350px; }
#carte-selection .cartes-ajout { margin: 2px 0 0; }

/* ================= Accessibilité (audit WCAG 2.1 AA) ================= */

/* Focus visible sur TOUT ce qui se pilote au clavier. :focus-visible ne
   s'affiche qu'au clavier : la souris ne déclenche pas de contour. */
:focus-visible {
  outline: 2px solid var(--primary-400);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Sur les fonds violets foncés, un contour marine serait invisible */
.bouton-parcours:focus-visible,
#bouton-envoyer:focus-visible,
.chip-palier.actif:focus-visible,
.ruban-composeur .segment:focus-visible,
.retirer-segment:focus-visible,
.hero-cdc :focus-visible,
#confirmer-nouveau:focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 4px var(--primary-300);
}

/* Texte réservé aux lecteurs d'écran (étiquettes, états, équivalents) */
.pour-lecteur-ecran {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Segments du ruban : focalisables, donc ils doivent montrer leur sélection */
.ruban-composeur .segment[aria-current="true"] {
  box-shadow: inset 0 0 0 2px var(--magenta);
}

/* Boutons de déplacement clavier d'un segment (alternative au glisser-déposer) */
.actions-ruban {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 11.5px;
  color: var(--texte-doux);
}
.actions-ruban button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--primary-100);
  border-radius: 7px;
  background: var(--carte);
  color: var(--primary-400);
  cursor: pointer;
}
.actions-ruban button:hover:not(:disabled) { background: var(--secondary-400); }
.actions-ruban button:disabled { color: var(--inactif); border-color: var(--secondary-400); cursor: default; }

/* Redistribution (WCAG 1.4.10) : sous 900 px utiles, un seul panneau à la fois.
   Les deux se chevauchaient de 132 px à 200 % de zoom. */
@media (max-width: 900px) {
  #panneau-gauche, #panneau-droit {
    width: auto;
    left: 0;
    right: 0;
    max-width: none;
  }
  #panneau-droit { z-index: 16; }
  #invite { left: 0; }
}

/* Respect de « moins d'animations » (réglage système) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  /* Les points d'attente gardent leur sens sans bouger */
  .points-chargement span { opacity: 1; }
  #transition-parcours { transition: none; }
}

/* ================= Direction « beau jouet » ================= */

/* Rail d'étapes : la progression se voit d'un coup d'œil et se clique */
.rail-etapes {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 2px 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--secondary-300);
}
.point-etape {
  flex: 1;
  height: 7px;
  border: none;
  border-radius: 999px;
  background: var(--secondary-400);
  padding: 0;
  transition: background 0.25s, transform 0.15s;
}
.point-etape.fait { background: var(--primary-300); cursor: pointer; }
button.point-etape.fait:hover { background: var(--primary-400); transform: scaleY(1.6); }
.point-etape.courant {
  background: var(--cta);
  box-shadow: 0 0 0 3px var(--secondary-300);
}
.compte-etapes {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary-400);
}

/* Les millimètres sont la matière du produit : ils passent en héros.
   (chiffres tabulaires : les cotes s'alignent en colonnes) */
.carte-ajout strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.total-composeur {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-500);
  font-variant-numeric: tabular-nums;
}
.etape-faite .valeur-etape { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ligne-recap .valeur { font-variant-numeric: tabular-nums; }
.chips-paliers .chip-palier { font-variant-numeric: tabular-nums; }

/* =========================================================================
   Ajouts du 20/08/2026 — retours Florent
   (vue en coupe, prix permanent, modules hybrides, dossier bureau d'études)
   ========================================================================= */

/* ---- Vue en coupe : même traitement que le plan de dessus ---- */

#vue-coupe {
  position: absolute;
  inset: 0;
  background: #ffffff;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px 76px;
  padding-left: calc(var(--decalage, 0px) + 40px);
  padding-right: calc(var(--decalage-droit, 0px) + 40px);
}
#vue-coupe svg { width: 100%; height: 100%; min-height: 0; }

/* Sélecteur de module à couper (étal hybride : chaque module est réglé à part) */
.selecteur-coupe {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.selecteur-coupe span { font-size: 11.5px; font-weight: 600; color: var(--texte-doux); margin-right: 4px; }
.selecteur-coupe button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-400);
  background: var(--secondary-300);
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.12s;
}
.selecteur-coupe button:hover:not(.actif) { background: var(--secondary-500); }
.selecteur-coupe button.actif { background: var(--primary-500); color: #fff; }

/* ---- Étal courbe : croquis d'intention à la place du rendu 3D ---- */

#vue-dossier-be {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 40px 76px;
  padding-left: calc(var(--decalage, 0px) + 40px);
  padding-right: calc(var(--decalage-droit, 0px) + 40px);
}
#vue-dossier-be svg { width: 100%; height: 100%; }

/* Le cahier des charges, replié dans le panneau de droite */
.dossier-be { margin-top: 14px; border-top: 1px solid var(--trait); padding-top: 12px; }
.dossier-be summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-400);
  list-style: none;
}
.dossier-be summary::-webkit-details-marker { display: none; }
.dossier-be summary::before { content: '▸ '; }
.dossier-be[open] summary::before { content: '▾ '; }
.dossier-be summary:hover { color: var(--primary-500); }
.dossier-be pre {
  margin: 10px 0 0;
  padding: 14px 16px;
  background: var(--secondary-100);
  border: 1px solid var(--trait);
  border-radius: 12px;
  font: 11.5px/1.65 ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  color: var(--texte);
  max-height: 340px;
  overflow: auto;
}

/* ---- Le prix, toujours visible en bas à droite ---- */

#badge-prix {
  position: absolute;
  right: calc(var(--decalage-droit, 0px) + 16px);
  bottom: 16px;
  z-index: 14;
  width: var(--largeur-prix);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
#bascule-prix {
  font: inherit;
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "libelle delta chevron" "montant delta chevron";
  align-items: center;
  gap: 0 10px;
  text-align: left;
  background: var(--carte);
  border: none;
  border-radius: 18px;
  box-shadow: var(--ombre);
  padding: 12px 14px 12px 16px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.12s;
}
#bascule-prix:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(18, 0, 90, 0.16); }
#badge-prix .libelle-prix {
  grid-area: libelle;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--texte-doux);
}
#badge-prix .montant-prix {
  grid-area: montant;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-500);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
/* « Chiffrage bureau d'études » : une mention, pas un montant */
#badge-prix .montant-prix.mention { font-size: 13px; font-weight: 600; line-height: 1.35; }
#badge-prix.be #bascule-prix { background: linear-gradient(180deg, #fff 0%, var(--tertiary-100) 100%); }
#badge-prix .delta-prix {
  grid-area: delta;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
#badge-prix .delta-prix.hausse { color: #7a1f6b; background: #f9e6f6; }
#badge-prix .delta-prix.baisse { color: #1c5b46; background: #e2f4ec; }
/* L'écart pulse une fois : c'est LUI que le commercial doit voir bouger */
#badge-prix .delta-prix.anime { animation: pulse-delta 0.75s ease-out; }
@keyframes pulse-delta {
  0% { transform: scale(0.82); opacity: 0; }
  40% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #badge-prix .delta-prix.anime { animation: none; }
}
#badge-prix .chevron-prix { grid-area: chevron; width: 16px; height: 16px; color: var(--primary-300); }
#bascule-prix[aria-expanded="true"] .chevron-prix { transform: rotate(180deg); }

#detail-prix {
  order: -1; /* le détail s'ouvre AU-DESSUS du badge : il ne le pousse pas hors écran */
  margin-bottom: 8px;
  background: var(--carte);
  border-radius: 18px;
  box-shadow: var(--ombre);
  padding: 14px 16px;
  max-height: 46vh;
  overflow: auto;
}
.ligne-prix {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 11.5px;
  padding: 5px 0;
  border-bottom: 1px solid var(--secondary-300);
  color: var(--texte-doux);
}
.ligne-prix b { color: var(--texte); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ligne-prix.total { border-bottom: none; font-weight: 700; color: var(--primary-500); padding-top: 9px; }
.ligne-prix.total b { color: var(--primary-500); }
.note-prix { margin: 10px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--texte-doux); }

/* ---- Alerte d'option (ex. vitre > 300 mm en service avant) ---- */

.option-parcours.avec-alerte { border-color: var(--tertiary-300); }
.alerte-option {
  display: block;
  margin-top: 6px;
  padding: 7px 9px;
  background: #fdf1fa;
  border-left: 3px solid var(--magenta);
  border-radius: 6px;
  font-size: 11px !important;
  line-height: 1.45;
  color: #7a1f6b !important;
}

/* ---- Aide d'étape, saisie libre ---- */

.aide-etape {
  margin: -4px 0 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--texte-doux);
}
.saisie-texte-etape {
  width: 100%;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 11px 13px;
  border: 1px solid var(--trait);
  border-radius: 14px;
  background: var(--secondary-100);
  resize: vertical;
  margin-bottom: 10px;
  color: var(--texte);
}
.saisie-texte-etape:focus { outline: 2px solid var(--primary-300); border-color: transparent; }

/* ---- Réglage des modules hybrides (service + régime, module par module) ---- */

.reglages-modules { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.carte-module {
  background: var(--secondary-100);
  border: 1px solid var(--trait);
  border-radius: 16px;
  padding: 11px 13px 13px;
}
.nom-module {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-400);
  margin-bottom: 8px;
}
.segmente { display: flex; gap: 4px; margin-top: 5px; }
.segmente button {
  flex: 1;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary-400);
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: 999px;
  padding: 6px 4px;
  cursor: pointer;
  transition: all 0.12s;
}
.segmente button:hover:not(.actif) { background: var(--secondary-300); }
.segmente button.actif { background: var(--primary-500); border-color: var(--primary-500); color: #fff; }

/* ---- Livrables (fin du cahier des charges) ---- */

.grille-livrables { display: flex; flex-direction: column; gap: 8px; }
.carte-livrable {
  font: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: 14px;
  padding: 11px 14px;
  cursor: pointer;
  transition: all 0.13s;
}
.carte-livrable:hover {
  border-color: var(--primary-200);
  background: var(--secondary-100);
  transform: translateY(-1px);
  box-shadow: var(--ombre-douce);
}
.carte-livrable strong { font-size: 13px; font-weight: 600; color: var(--primary-500); }
.carte-livrable span { font-size: 11px; color: var(--texte-doux); }

/* Écran étroit : le badge de prix se recentre pour ne pas couvrir les outils */
@media (max-width: 900px) {
  #badge-prix { width: calc(100% - 32px); left: 16px; right: 16px; }
  /* Le badge prend toute la largeur : le commutateur passe au-dessus de lui */
  #commutateur-vue {
    bottom: 90px;
    left: calc((100% + var(--decalage, 0px)) / 2);
  }
  #detail-prix { max-height: 34vh; }
}
