/* ============================================================================
   Démo « Le devis qui reste vivant » — styles propres à cette démo.

   Deux objets à l'écran : l'assistant de saisie (le produit), puis le classeur
   qui en sort (un faux Excel, assumé comme tel). Le second n'apparaît qu'au
   dernier acte, et c'est lui qui porte la démonstration : une barre de formule
   qui montre =C13*E13 au lieu d'un montant.
   ========================================================================== */

.demo__scene { display: grid; gap: var(--sp-2); align-content: start; }

/* ---------------------------------------------------------- Assistant --- */
.assistant { background: var(--blanc); border-radius: var(--r-xl); box-shadow: var(--ombre-m); overflow: hidden; }
.assistant__tete {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2);
  flex-wrap: wrap; padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--ligne);
}
.assistant__chantier { font-family: var(--titre); font-size: var(--t-lg); font-weight: 700; color: var(--encre); }
.assistant__nature { margin-top: 2px; font-size: var(--t-sm); color: var(--acier); }

.sauvegarde {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--t-sm); font-weight: 500; color: var(--acier);
  transition: color var(--moyen) linear;
}
.sauvegarde__point {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ligne);
  transition: background var(--moyen) linear;
}
.sauvegarde.est-sale { color: var(--attention); }
.sauvegarde.est-sale .sauvegarde__point { background: var(--attention); }
.sauvegarde.est-en-cours { color: var(--bleu); }
.sauvegarde.est-en-cours .sauvegarde__point { background: var(--bleu); animation: kit-pouls 1s infinite; }
.sauvegarde.est-fait { color: var(--valide); }
.sauvegarde.est-fait .sauvegarde__point { background: var(--valide); }

/* Rail d'étapes */
.rail { display: flex; gap: 2px; overflow-x: auto; padding: 10px var(--sp-3) 0; }
.rail button {
  flex: 0 0 auto; padding: 9px 14px;
  border-bottom: 3px solid transparent; border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: var(--t-md); color: var(--acier); white-space: nowrap;
  transition: color var(--vite) linear, border-color var(--vite) linear, background var(--vite) linear;
}
.rail button:hover:not(:disabled) { color: var(--bleu-fonce); background: var(--voile); }
.rail button.est-courante { color: var(--bleu-fonce); font-weight: 600; border-bottom-color: var(--bleu); }
.rail button.est-faite { color: var(--valide); }
.rail button:disabled { opacity: .4; cursor: not-allowed; }
.rail__note {
  padding: 7px var(--sp-3) 0; font-size: var(--t-xs); color: var(--acier);
  border-bottom: 1px solid var(--ligne); padding-bottom: 10px;
}

.assistant__corps { padding: var(--sp-3); }
.etape__titre { font-family: var(--titre); font-size: var(--t-xl); font-weight: 700; color: var(--encre); }
.etape__aide { margin-top: 5px; font-size: var(--t-md); color: var(--ardoise); max-width: 66ch; line-height: 1.55; }
.etape__grille { margin-top: var(--sp-3); display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: var(--sp-3); align-items: start; }

/* Boutons de pièces prédéfinies */
.predefinies { display: flex; flex-wrap: wrap; gap: 8px; }
.predefinies button {
  padding: 10px 15px; border: 1px solid var(--ligne); border-radius: var(--r-md);
  background: var(--blanc); font-size: var(--t-md); font-weight: 500; color: var(--ardoise);
  box-shadow: var(--ombre-s);
  transition: border-color var(--vite) linear, color var(--vite) linear, transform var(--vite) linear;
}
.predefinies button:hover { border-color: var(--bleu); color: var(--bleu-fonce); }
.predefinies button:active { transform: translateY(1px); }

/* Liste des pièces */
.pieces { display: grid; gap: 7px; }
.piece {
  display: grid; grid-template-columns: minmax(0, 1fr) 118px;
  gap: 12px; align-items: center;
  padding: 11px 13px; border: 1px solid var(--ligne); border-radius: var(--r-md);
  background: var(--blanc);
  animation: kit-entre .35s var(--sortie) both;
}
.piece__nom { font-size: var(--t-md); font-weight: 600; color: var(--encre); }
.piece__nom.vient-de-changer { animation: dv-renomme 1.3s var(--sortie); }
@keyframes dv-renomme {
  0%, 45% { background: var(--bleu-ciel); box-shadow: 0 0 0 5px var(--bleu-ciel); border-radius: 4px; }
  100%    { background: transparent;      box-shadow: 0 0 0 5px transparent; }
}
.piece__surface { display: flex; align-items: center; gap: 6px; }
.piece__surface input {
  width: 74px; padding: 6px 9px; border: 1px solid var(--ligne); border-radius: var(--r-sm);
  font-family: var(--mono); font-size: var(--t-sm); text-align: right;
}
.piece__surface input:focus { outline: none; border-color: var(--bleu); box-shadow: var(--ombre-focus); }
.piece__surface span { font-size: var(--t-xs); color: var(--acier); }
.pieces__vide { padding: var(--sp-3); text-align: center; color: var(--acier); font-size: var(--t-md); }

/* ------------------------------------------------------- Bloc de cotes --- */
.bloc-cotes { border: 1px solid var(--ligne); border-radius: var(--r-lg); overflow: hidden; margin-bottom: var(--sp-2); }
.bloc-cotes__tete {
  padding: 10px 14px; background: var(--voile); border-bottom: 1px solid var(--ligne);
  font-family: var(--titre); font-size: var(--t-md); font-weight: 700; color: var(--encre);
}
.cote {
  display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 92px) 118px;
  gap: 10px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--ligne);
  font-size: var(--t-sm);
}
.cote:last-child { border-bottom: 0; }
.cote__libelle { color: var(--ardoise); min-width: 0; }
.cote input {
  width: 100%; padding: 7px 9px; border: 1px solid var(--ligne); border-radius: var(--r-sm);
  font-family: var(--mono); font-size: var(--t-sm); text-align: right;
  transition: border-color var(--vite) linear, background var(--vite) linear;
}
.cote input:focus { outline: none; border-color: var(--bleu); box-shadow: var(--ombre-focus); }
.cote input[readonly] { background: var(--brume); color: var(--acier); cursor: default; }
.cote input.vient-de-se-remplir { animation: dv-remplit 1.5s var(--sortie); }
@keyframes dv-remplit {
  0%, 50% { background: var(--bleu-ciel); border-color: var(--bleu); }
  100%    { background: var(--blanc);     border-color: var(--ligne); }
}
.cote__volume {
  font-family: var(--mono); font-size: var(--t-md); font-weight: 700;
  color: var(--valide); text-align: right;
}
.cote__volume:empty::before { content: "—"; color: var(--acier); font-weight: 400; }
.cote__entete { font-size: var(--t-xs); color: var(--acier); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 0; }
.cote__entete span { text-align: right; }
.cote__entete span:first-child { text-align: left; }
.bloc-cotes__pied {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 11px 14px; background: var(--valide-fond);
  font-size: var(--t-md); font-weight: 600; color: var(--valide);
}
.bloc-cotes__pied span:last-child { font-family: var(--mono); }

.explication {
  margin-top: var(--sp-2); padding: 11px 13px;
  background: var(--bleu-ciel); border-radius: var(--r-md);
  font-size: var(--t-sm); color: var(--bleu-fonce); line-height: 1.55;
  animation: kit-entre .4s var(--sortie) both;
}
.explication--reserve { background: var(--voile); color: var(--ardoise); border-left: 3px solid var(--acier); }

/* ------------------------------------------------ Tableau électricité --- */
.elec { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.elec th {
  text-align: left; padding: 9px 10px; font-size: var(--t-xs); color: var(--acier);
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--ligne);
}
.elec th.chiffre, .elec td.chiffre { text-align: right; font-family: var(--mono); }
.elec td { padding: 8px 10px; border-bottom: 1px solid var(--ligne); color: var(--ardoise); }
.elec tr.est-piece td {
  background: var(--voile); font-family: var(--titre); font-weight: 700; color: var(--encre);
  font-size: var(--t-sm);
}
.elec tr.vient-de-naitre { animation: kit-entre .3s var(--sortie) both; }

.recap { display: grid; gap: var(--sp-2); max-width: 620px; }
.recap__ligne {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 13px; border-radius: var(--r-md); background: var(--voile);
  font-size: var(--t-md); color: var(--ardoise);
}
.recap__ligne b { font-family: var(--mono); color: var(--encre); }

/* -------------------------------------------------------- Le classeur --- */
.classeur {
  background: var(--blanc); border-radius: var(--r-xl); box-shadow: var(--ombre-l);
  overflow: hidden; border: 1px solid var(--ligne);
  animation: kit-entre .5s var(--sortie) both;
}
.classeur__tete {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 12px var(--sp-3); background: var(--bleu-nuit); color: var(--texte-nuit);
}
.classeur__fichier { font-family: var(--mono); font-size: var(--t-md); font-weight: 500; }
.classeur__mention { font-size: var(--t-xs); color: var(--texte-nuit-doux); }

.formule {
  display: flex; align-items: center; gap: 10px;
  padding: 9px var(--sp-2); border-bottom: 1px solid var(--ligne); background: var(--brume);
}
.formule__cellule {
  flex: 0 0 auto; min-width: 96px; padding: 5px 9px;
  background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--r-xs);
  font-family: var(--mono); font-size: var(--t-sm); color: var(--ardoise); text-align: center;
}
.formule__fx { flex: 0 0 auto; font-family: var(--mono); font-style: italic; color: var(--acier); font-size: var(--t-sm); }
.formule__valeur {
  flex: 1 1 auto; min-width: 0; padding: 5px 10px;
  background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--r-xs);
  font-family: var(--mono); font-size: var(--t-sm); color: var(--bleu-fonce);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.formule__valeur.est-formule { color: var(--bleu); font-weight: 600; }
.formule__saisie {
  flex: 1 1 auto; min-width: 0; padding: 5px 10px;
  border: 1px solid var(--bleu); border-radius: var(--r-xs); box-shadow: var(--ombre-focus);
  font-family: var(--mono); font-size: var(--t-sm);
}
.formule__saisie:focus { outline: none; }

.classeur__grille { max-height: 430px; overflow: auto; }
.feuille { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.feuille th, .feuille td {
  border: 1px solid var(--ligne); padding: 5px 8px; white-space: nowrap;
  font-family: var(--mono); font-size: var(--t-xs); color: var(--ardoise);
}
.feuille thead th, .feuille td.rang {
  background: var(--brume); color: var(--acier); text-align: center; font-weight: 500;
  position: sticky; top: 0; z-index: 2;
}
.feuille td.rang { position: sticky; left: 0; top: auto; z-index: 1; width: 38px; }
.feuille td.cel { cursor: cell; }
.feuille td.cel:hover { background: var(--bleu-ciel); }
.feuille td.est-choisie { outline: 2px solid var(--bleu); outline-offset: -2px; background: var(--bleu-ciel); }
.feuille td.txt { font-family: var(--texte); font-size: var(--t-sm); color: var(--encre); white-space: normal; min-width: 210px; }
.feuille td.num { text-align: right; }
.feuille tr.bloc td { background: var(--voile); font-family: var(--titre); font-weight: 700; color: var(--encre); }
.feuille tr.total td { background: var(--valide-fond); font-weight: 700; color: var(--valide); }
.feuille tr.stotal td { font-weight: 700; color: var(--encre); }
.feuille td.a-change { animation: dv-recalcule 1.6s var(--sortie); }
@keyframes dv-recalcule {
  0%, 40% { background: var(--attention-fond); color: var(--attention); font-weight: 700; }
  100%    { background: transparent; }
}
.feuille td.modifiable { background: #FFFDF3; box-shadow: inset 0 0 0 1px var(--attention); cursor: text; }

.classeur__onglets {
  display: flex; gap: 2px; overflow-x: auto;
  padding: 8px var(--sp-2); background: var(--brume); border-top: 1px solid var(--ligne);
}
.classeur__onglets button {
  flex: 0 0 auto; padding: 7px 13px; border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: var(--t-sm); color: var(--acier); white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.classeur__onglets button:hover { background: var(--blanc); color: var(--bleu-fonce); }
.classeur__onglets button.est-courant {
  background: var(--blanc); color: var(--bleu-fonce); font-weight: 600; border-bottom-color: var(--bleu);
}
.classeur__note {
  padding: 11px var(--sp-3); background: var(--attention-fond); color: var(--attention);
  font-size: var(--t-sm); line-height: 1.55;
  animation: kit-entre .35s var(--sortie) both;
}

.classeur__vide { padding: var(--sp-5) var(--sp-3); text-align: center; color: var(--acier); font-size: var(--t-md); }

/* ---------------------------------------------------------- Responsive --- */
@media (max-width: 900px) {
  .etape__grille { grid-template-columns: minmax(0, 1fr); }
  .cote { grid-template-columns: minmax(0, 1fr) repeat(2, 1fr); }
  .cote__volume { grid-column: 1 / -1; text-align: left; }
  .cote__entete { display: none; }
}
@media (max-width: 620px) {
  .assistant__corps { padding: var(--sp-2); }
  .piece { grid-template-columns: minmax(0, 1fr); }
  .formule__cellule { min-width: 74px; }
}
