/* =============================================================================
   EstimBat -- systeme de design
   Palette issue de la maquette : olive, sable, ocre, orange, brique.
   ============================================================================= */

:root {
  /* Marque */
  --olive-900: #2E2A10;
  --olive-700: #47410F;
  --olive-600: #585123;
  --olive-500: #6E6633;
  --sable-300: #EEC170;
  --sable-200: #F5DCA8;
  --sable-100: #FAEDD3;
  --ocre-500:  #F2A65A;
  --orange-600:#F58549;
  --orange-700:#E06A2C;
  --brique-700:#772F1A;

  /* Neutres chauds */
  --fond:      #FBF8F3;
  --surface:   #FFFFFF;
  --surface-2: #F6F1E8;
  --bord:      #EAE1D2;
  --bord-fort: #DCCFB8;
  --texte:     #262212;
  --texte-2:   #5C5540;
  --texte-3:   #8C8367;

  /* Semantique */
  --succes:    #2F7A4F;
  --alerte:    #B4801A;
  --erreur:    #B03A28;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --ombre-1: 0 1px 2px rgba(46, 42, 16, .05), 0 1px 3px rgba(46, 42, 16, .04);
  --ombre-2: 0 2px 4px rgba(46, 42, 16, .05), 0 8px 20px rgba(46, 42, 16, .07);
  --ombre-3: 0 12px 32px rgba(46, 42, 16, .12);

  --lat: 248px;
  --police: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --chiffres: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p  { margin: 0; }

/* Les chiffres s'alignent en colonne : indispensable dans un devis. */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

a { color: var(--orange-700); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--sable-200); color: var(--olive-900); }

:focus-visible {
  outline: 2px solid var(--orange-600);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =============================================================================
   COQUILLE -- barre laterale (bureau) / navigation basse (mobile)
   ============================================================================= */

.coquille { display: flex; min-height: 100vh; }

.lateral {
  width: var(--lat);
  flex: 0 0 var(--lat);
  background: linear-gradient(170deg, var(--olive-600) 0%, var(--olive-900) 100%);
  color: #F3EEDF;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
}

/* La marque est un lien vers le tableau de bord, mais elle ne doit pas EN AVOIR
   L'AIR : la regle globale « a:hover { text-decoration: underline } » est plus
   specifique que « .marque », et soulignait tout le titre au survol.
   Aucun effet sur le bloc : seul le curseur signale le lien. */
.marque {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px;
  text-decoration: none; color: inherit; border-radius: var(--r-md);
}
.marque:hover, .marque:focus { text-decoration: none; }
.marque:focus-visible { outline: 2px solid var(--sable-300); outline-offset: 2px; }
.marque__logo {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--sable-300), var(--ocre-500));
  border-radius: 10px;
  color: var(--olive-900);
}
.marque__nom { font-weight: 700; font-size: 1.1rem; letter-spacing: -.02em; color: #FFF; }
.marque__nom em { font-style: normal; color: var(--sable-300); }
.marque__bl { font-size: .68rem; color: #A8A088; letter-spacing: .04em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__lien {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: #CFC7B0;
  font-size: .92rem; font-weight: 500;
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.nav__lien:hover { background: rgba(255,255,255,.07); color: #FFF; text-decoration: none; }
.nav__lien.actif { background: rgba(238,193,112,.16); color: var(--sable-300); font-weight: 600; }
.nav__lien svg { flex: none; opacity: .9; }

.lateral__pied {
  margin-top: auto;
  padding: 12px;
  font-size: .74rem;
  color: #948C74;
  border-top: 1px solid rgba(255,255,255,.09);
  line-height: 1.45;
}

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.entete {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px;
  background: rgba(251,248,243,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bord);
  position: sticky; top: 0; z-index: 20;
}
.entete__titre { flex: 1; min-width: 0; }
.entete__titre p { color: var(--texte-3); font-size: .85rem; margin-top: 2px; }

.contenu { padding: 26px 28px 90px; max-width: 1180px; width: 100%; }

/* Navigation basse -- mobile uniquement */
.nav-basse { display: none; }

/* =============================================================================
   COMPOSANTS
   ============================================================================= */

.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--r-lg);
  box-shadow: var(--ombre-1);
}
.carte__tete {
  padding: 16px 20px;
  border-bottom: 1px solid var(--bord);
  display: flex; align-items: center; gap: 12px;
}
.carte__tete h2, .carte__tete h3 { flex: 1; min-width: 0; }
.carte__corps { padding: 20px; }
.carte__corps--serre { padding: 12px 20px; }

.grille { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer;
  transition: transform .08s, box-shadow .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn--primaire {
  background: linear-gradient(160deg, var(--orange-600), var(--orange-700));
  color: #FFF;
  box-shadow: 0 1px 2px rgba(224,106,44,.3), 0 4px 12px rgba(224,106,44,.22);
}
.btn--primaire:hover:not(:disabled) { box-shadow: 0 2px 4px rgba(224,106,44,.3), 0 8px 20px rgba(224,106,44,.3); }

.btn--secondaire { background: var(--surface); border-color: var(--bord-fort); color: var(--texte); }
.btn--secondaire:hover:not(:disabled) { background: var(--surface-2); border-color: var(--olive-500); }

.btn--fantome { background: transparent; color: var(--texte-2); }
.btn--fantome:hover:not(:disabled) { background: var(--surface-2); color: var(--texte); }

.btn--danger { background: transparent; color: var(--erreur); border-color: transparent; }
.btn--danger:hover:not(:disabled) { background: #FBEDEA; }

.btn--petit { padding: 6px 12px; font-size: .84rem; border-radius: var(--r-sm); }
.btn--bloc { width: 100%; }

/* --- Champs --- */
.champ { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.champ > label { font-size: .82rem; font-weight: 600; color: var(--texte-2); }
.champ__aide { font-size: .76rem; color: var(--texte-3); }

.saisie, select.saisie {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bord-fort);
  border-radius: var(--r-md);
  background: var(--surface);
  font: inherit; color: var(--texte);
  transition: border-color .15s, box-shadow .15s;
}
.saisie:focus {
  outline: none;
  border-color: var(--orange-600);
  box-shadow: 0 0 0 3px rgba(245,133,73,.16);
}
.saisie::placeholder { color: #B5AC93; }
select.saisie { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235C5540' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}

/* Saisie numerique : clavier direct, pas de steppers penibles sur mobile. */
.saisie--nombre { text-align: right; font-variant-numeric: tabular-nums; padding-right: 44px; }
.champ--unite { position: relative; }
.champ--unite .unite {
  position: absolute; right: 12px; bottom: 11px;
  font-size: .82rem; color: var(--texte-3); pointer-events: none;
}

/* --- Etiquettes --- */
.etiq {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 100px;
  font-size: .74rem; font-weight: 600; letter-spacing: .01em;
  background: var(--surface-2); color: var(--texte-2);
  border: 1px solid var(--bord);
}
.etiq--ambre  { background: var(--sable-100); color: #7A5A12; border-color: var(--sable-200); }
.etiq--orange { background: #FDEEE3; color: var(--brique-700); border-color: #F8DCC6; }
.etiq--vert   { background: #E9F4ED; color: var(--succes); border-color: #CFE7DA; }
.etiq--olive  { background: #EFEDE0; color: var(--olive-600); border-color: #E0DCC6; }

/* --- Statistiques --- */
.stat { padding: 16px 18px; }
.stat__lib { font-size: .8rem; color: var(--texte-3); font-weight: 500; }
.stat__val { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; margin-top: 4px;
             font-variant-numeric: tabular-nums; }
.stat__pied { font-size: .76rem; color: var(--texte-3); margin-top: 2px; }

/* --- Grandes portes d'entree --- */
.porte {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 20px; border-radius: var(--r-lg);
  border: 1px solid var(--bord); background: var(--surface);
  cursor: pointer; text-align: left; width: 100%; font: inherit;
  transition: transform .12s, box-shadow .18s, border-color .18s;
}
.porte:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); border-color: var(--bord-fort); }
.porte__icone {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-md);
  display: grid; place-items: center;
}
.porte--express .porte__icone { background: linear-gradient(150deg, var(--sable-300), var(--ocre-500)); color: var(--olive-900); }
.porte--complet .porte__icone { background: linear-gradient(150deg, var(--olive-600), var(--olive-900)); color: var(--sable-300); }
.porte__t { font-weight: 650; font-size: 1.02rem; }
.porte__d { font-size: .85rem; color: var(--texte-2); margin-top: 3px; line-height: 1.45; }
.porte__m { font-size: .76rem; color: var(--texte-3); margin-top: 8px; display: flex; gap: 6px; align-items: center; }

/* --- Tableaux --- */
.tableau-enveloppe { overflow-x: auto; }
table.tableau { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.tableau th {
  text-align: left; font-weight: 600; font-size: .76rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--texte-3);
  padding: 10px 12px; border-bottom: 1px solid var(--bord); white-space: nowrap;
}
table.tableau td { padding: 11px 12px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
table.tableau tr:last-child td { border-bottom: 0; }
table.tableau .droite, table.tableau th.droite { text-align: right; font-variant-numeric: tabular-nums; }
table.tableau tbody tr.cliquable { cursor: pointer; }
table.tableau tbody tr.cliquable:hover { background: var(--surface-2); }
table.tableau tr.detail td { background: var(--surface-2); padding: 0; }

/* --- Barres de repartition --- */
.barre { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center;
         padding: 9px 0; border-bottom: 1px solid var(--surface-2); }
.barre:last-child { border-bottom: 0; }
.barre__lib { font-size: .89rem; font-weight: 500; }
.barre__val { font-size: .89rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.barre__piste { grid-column: 1 / -1; height: 6px; border-radius: 100px; background: var(--surface-2); overflow: hidden; }
.barre__jauge { height: 100%; border-radius: 100px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.barre__pct { grid-column: 1 / -1; font-size: .74rem; color: var(--texte-3); }

/* --- Fourchette : l'affichage principal du resultat --- */
.fourchette {
  background: linear-gradient(155deg, var(--olive-600) 0%, var(--olive-900) 100%);
  color: #FFF; border-radius: var(--r-xl); padding: 26px 28px;
  box-shadow: var(--ombre-3);
}
.fourchette__lib { font-size: .8rem; color: var(--sable-300); text-transform: uppercase;
                   letter-spacing: .07em; font-weight: 600; }
.fourchette__val { font-size: 2.5rem; font-weight: 750; letter-spacing: -.035em; margin: 8px 0 2px;
                   font-variant-numeric: tabular-nums; }
.fourchette__val .dev { font-size: 1.1rem; font-weight: 600; color: var(--sable-300); margin-left: 8px; }
/* La plage min -- retenu -- max. Le JS produit .plage__* ; ces regles
   manquaient, et les trois bornes se collaient les unes aux autres :
   « 152 100estimation retenue185 900 ». */
.plage { margin-top: 16px; }
.plage__barre {
  position: relative; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(255,255,255,.14), rgba(238,193,112,.45));
}
.plage__repere {
  position: absolute; top: 50%; width: 12px; height: 12px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--sable-300);
  box-shadow: 0 0 0 3px rgba(46,42,16,.55), 0 1px 4px rgba(0,0,0,.35);
}
.plage__bornes {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-top: 9px; font-size: .82rem; color: #D9D2BC;
}
.plage__milieu {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .07em;
  color: #A79E85; font-variant-numeric: normal; white-space: nowrap;
}
.fourchette__lettres { font-size: .82rem; color: #A79E85; margin-top: 10px; font-style: italic; }
.fourchette__reserve {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14);
  font-size: .78rem; color: #BDB49A; line-height: 1.5;
}

/* --- Barre de total permanente : le chiffre bouge des la premiere saisie --- */
.total-direct {
  position: fixed; left: var(--lat); right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--bord-fort);
  box-shadow: 0 -4px 20px rgba(46,42,16,.07);
}
.total-direct__lib { font-size: .78rem; color: var(--texte-3); font-weight: 600;
                     text-transform: uppercase; letter-spacing: .05em; }
.total-direct__val { font-size: 1.4rem; font-weight: 750; letter-spacing: -.03em;
                     font-variant-numeric: tabular-nums; }
.total-direct__val .dev { font-size: .82rem; color: var(--texte-3); margin-left: 5px; font-weight: 600; }
.total-direct__plage { font-size: .78rem; color: var(--texte-3); font-variant-numeric: tabular-nums; }
.total-direct__actions { margin-left: auto; display: flex; gap: 8px; }
.total-direct.charge .total-direct__val { opacity: .45; }

/* --- Etapes de l'assistant --- */
.etapes { display: flex; align-items: center; gap: 0; padding: 4px 0 20px; }
.etape { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.etape__pastille {
  width: 27px; height: 27px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .8rem; font-weight: 700;
  background: var(--surface-2); color: var(--texte-3);
  border: 1px solid var(--bord-fort);
}
.etape__lib { font-size: .84rem; color: var(--texte-3); font-weight: 500; white-space: nowrap; }
.etape__trait { flex: 1; height: 1px; background: var(--bord-fort); margin: 0 10px; min-width: 12px; }
.etape.faite .etape__pastille { background: var(--olive-600); color: var(--sable-300); border-color: var(--olive-600); }
.etape.faite .etape__lib { color: var(--texte-2); }
.etape.active .etape__pastille {
  background: linear-gradient(160deg, var(--orange-600), var(--orange-700)); color: #FFF;
  border-color: transparent; box-shadow: 0 0 0 4px rgba(245,133,73,.16);
}
.etape.active .etape__lib { color: var(--texte); font-weight: 650; }

/* --- Lignes de pieces / postes --- */
.ligne-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border: 1px solid var(--bord); border-radius: var(--r-md);
  background: var(--surface); margin-bottom: 9px;
}
.ligne-item:hover { border-color: var(--bord-fort); }
.ligne-item__icone { width: 34px; height: 34px; flex: none; border-radius: var(--r-sm);
  background: var(--surface-2); display: grid; place-items: center; color: var(--olive-600); }
.ligne-item__corps { flex: 1; min-width: 0; }
.ligne-item__t { font-weight: 600; font-size: .93rem; }
.ligne-item__d { font-size: .81rem; color: var(--texte-3); margin-top: 1px; font-variant-numeric: tabular-nums; }
.ligne-item__actions { display: flex; gap: 3px; }

.vide {
  text-align: center; padding: 34px 20px; color: var(--texte-3);
  border: 1px dashed var(--bord-fort); border-radius: var(--r-md); background: var(--surface-2);
}
.vide strong { display: block; color: var(--texte-2); margin-bottom: 4px; font-size: .95rem; }
.vide p { font-size: .85rem; line-height: 1.5; }

/* --- Presets de pieces : diviser le temps de saisie par trois --- */
.presets { display: flex; flex-wrap: wrap; gap: 7px; }
.preset {
  padding: 6px 12px; border-radius: 100px; border: 1px solid var(--bord-fort);
  background: var(--surface); font: inherit; font-size: .82rem; font-weight: 500;
  cursor: pointer; color: var(--texte-2); transition: all .14s;
}
.preset:hover { background: var(--sable-100); border-color: var(--sable-300); color: var(--olive-700); }

/* --- « Pourquoi ce chiffre ? » --- */
.pourquoi { padding: 14px 16px; font-size: .85rem; }
.pourquoi__formule {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .8rem; color: var(--olive-700);
  background: var(--sable-100); border: 1px solid var(--sable-200);
  padding: 9px 12px; border-radius: var(--r-sm); margin-bottom: 12px;
  overflow-x: auto; white-space: nowrap;
}
.pourquoi__t { font-size: .76rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--texte-3); margin-bottom: 6px; }
.pourquoi__prov { display: flex; flex-direction: column; gap: 4px; }
.pourquoi__prov div { display: flex; justify-content: space-between; gap: 14px;
  padding: 4px 0; border-bottom: 1px dotted var(--bord); }
.pourquoi__prov div:last-child { border-bottom: 0; }
.pourquoi__prov span:last-child { font-variant-numeric: tabular-nums; color: var(--texte-2); white-space: nowrap; }

/* --- Onglets --- */
.onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--bord); margin-bottom: 18px;
           overflow-x: auto; }
.onglet {
  padding: 10px 16px; border: 0; background: none; font: inherit; font-size: .9rem; font-weight: 550;
  color: var(--texte-3); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
}
.onglet:hover { color: var(--texte); }
.onglet.actif { color: var(--brique-700); border-bottom-color: var(--orange-600); font-weight: 650; }

/* --- Divers --- */
.alerte {
  display: flex; gap: 11px; padding: 12px 15px; border-radius: var(--r-md);
  font-size: .86rem; line-height: 1.5; border: 1px solid;
}
.alerte--info   { background: var(--sable-100); border-color: var(--sable-200); color: #6B4E0E; }
.alerte--erreur { background: #FBEDEA; border-color: #F0D2CC; color: var(--brique-700); }
.alerte svg { flex: none; margin-top: 1px; }

.rangee { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pousse { margin-left: auto; }
.muet { color: var(--texte-3); }
.petit { font-size: .82rem; }
.mt8{margin-top:8px} .mt12{margin-top:12px} .mt16{margin-top:16px} .mt24{margin-top:24px}
.mb8{margin-bottom:8px} .mb12{margin-bottom:12px} .mb16{margin-bottom:16px} .mb24{margin-bottom:24px}

.chargement { display: inline-block; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--bord-fort); border-top-color: var(--orange-600);
  animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

.apparait { animation: apparait .28s cubic-bezier(.2,.8,.2,1); }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =============================================================================
   RESPONSIVE -- concu mobile d'abord dans l'usage : la saisie se fait sur
   chantier, au telephone.
   ============================================================================= */

@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 860px) {
  :root { --lat: 0px; }

  .lateral { display: none; }
  .contenu { padding: 18px 16px 150px; }
  .entete { padding: 14px 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }

  h1 { font-size: 1.3rem; }
  .fourchette { padding: 20px; border-radius: var(--r-lg); }
  .fourchette__val { font-size: 2rem; }
  .plage__bornes { font-size: .76rem; gap: 8px; }
  .plage__milieu { font-size: .62rem; letter-spacing: .05em; }

  /* Les libelles d'etapes prennent trop de place : on ne garde que l'active. */
  .etape__lib { display: none; }
  .etape.active .etape__lib { display: block; }
  .etapes { padding-bottom: 16px; }

  .total-direct { left: 0; bottom: 62px; padding: 10px 16px; }
  .total-direct__plage { display: none; }
  .total-direct__val { font-size: 1.2rem; }
  .total-direct__actions .btn { padding: 8px 14px; font-size: .86rem; }

  .nav-basse {
    display: flex; align-items: flex-end; justify-content: space-around;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: 62px; padding: 0 6px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--bord);
  }
  .nav-basse__lien {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 2px; border: 0; background: none; font: inherit;
    font-size: .68rem; font-weight: 550; color: var(--texte-3); cursor: pointer;
  }
  .nav-basse__lien.actif { color: var(--brique-700); }
  .nav-basse__lien.actif svg { color: var(--orange-600); }

  /* Le « + » central, comme sur la maquette. */
  .nav-basse__plus {
    flex: none; width: 52px; height: 52px; margin-bottom: 16px; border-radius: 50%;
    background: linear-gradient(160deg, var(--orange-600), var(--orange-700));
    color: #FFF; border: 3px solid var(--fond);
    display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 4px 14px rgba(224,106,44,.4);
  }

  /* Cible tactile confortable partout. */
  .btn { min-height: 44px; }
  .saisie { padding: 12px; font-size: 16px; }  /* 16px : evite le zoom iOS */
  .ligne-item { padding: 12px; }

  table.tableau { font-size: .84rem; }
  table.tableau th, table.tableau td { padding: 9px 8px; }
}

@media (max-width: 420px) {
  .porte { flex-direction: column; gap: 12px; }
  .stat__val { font-size: 1.35rem; }
}

@media print {
  .lateral, .nav-basse, .total-direct, .entete, .onglets, .btn { display: none !important; }
  .contenu { padding: 0; max-width: none; }
  .carte { box-shadow: none; break-inside: avoid; }
  .fourchette { background: none !important; color: #000 !important; border: 2px solid #000; }
  .fourchette__lib, .fourchette__reserve, .plage__bornes { color: #333 !important; }
  .plage__milieu { color: #666 !important; }
  .plage__barre { background: #DDD !important; }
  .plage__repere { background: #000 !important; box-shadow: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* -----------------------------------------------------------------------------
   Confinement horizontal.
   Un enfant de flex/grid a min-width:auto par defaut : il refuse de retrecir
   sous la taille de son contenu et fait deborder la page entiere. Les tableaux
   et la barre d'onglets doivent defiler DANS leur conteneur, jamais entrainer
   le document.
   ----------------------------------------------------------------------------- */
.grille > *,
.principal,
.carte,
.carte__corps,
.entete__titre { min-width: 0; }

.etapes { overflow: hidden; }
.etape { min-width: 0; }
.etape__lib { overflow: hidden; text-overflow: ellipsis; }

.tableau-enveloppe { max-width: 100%; }
.onglets { max-width: 100%; -webkit-overflow-scrolling: touch; }

.ligne-item__corps, .porte > div { min-width: 0; }
.ligne-item__t, .ligne-item__d { overflow-wrap: anywhere; }

/* =============================================================================
   AUTHENTIFICATION
   ============================================================================= */

.auth {
  min-height: 60vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px 0 40px;
}
.auth__carte {
  width: 100%; max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--r-xl);
  box-shadow: var(--ombre-2);
  padding: 28px;
}
.auth__marque { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth__carte .grille { gap: 14px; }
.auth__carte .onglets { margin-bottom: 20px; }

/* Le code de recuperation : gros, monospace, impossible a manquer.
   C'est la seule fois ou il est visible. */
.code-recup {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 1.35rem; font-weight: 700; letter-spacing: .09em;
  text-align: center; color: var(--brique-700);
  background: var(--sable-100);
  border: 2px dashed var(--sable-300);
  border-radius: var(--r-md);
  padding: 18px 12px;
  user-select: all;              /* un clic selectionne tout */
  overflow-wrap: anywhere;
}

/* Bandeau de compte dans la barre laterale */
.compte {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 14px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.07);
}
.compte__pastille {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: linear-gradient(145deg, var(--sable-300), var(--ocre-500));
  color: var(--olive-900);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.compte__corps { flex: 1; min-width: 0; }
.compte__nom { font-size: .88rem; font-weight: 600; color: #FFF;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compte__role { font-size: .72rem; color: #A8A088; }

@media (max-width: 860px) {
  .auth { min-height: 50vh; padding: 8px 0 40px; }
  .auth__carte { padding: 20px; border-radius: var(--r-lg); }
  .code-recup { font-size: 1.1rem; letter-spacing: .06em; }
}

/* Barre d'export : le moment ou l'estimation quitte l'ecran. */
.exports {
  margin-top: 16px; padding: 16px 18px;
  border: 1px solid var(--sable-200); border-radius: var(--r-lg);
  background: var(--sable-100);
}
.exports__t {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: .82rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #7A5A12;
}
.exports .rangee { gap: 10px; }
@media (max-width: 560px) {
  .exports .rangee { flex-direction: column; align-items: stretch; }
  .exports .btn { width: 100%; }
}
@media print { .exports { display: none; } }

/* =============================================================================
   PROFIL PROFESSIONNEL
   ============================================================================= */

.depot {
  border: 2px dashed var(--bord-fort); border-radius: var(--r-md);
  background: var(--surface-2);
  min-height: 130px; padding: 16px;
  display: grid; place-items: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.depot:hover, .depot--survol { border-color: var(--orange-600); background: var(--sable-100); }
.depot--rempli { background: var(--surface); border-style: solid; }
.depot__vide { text-align: center; color: var(--texte-3); }
.depot__apercu { max-width: 100%; max-height: 110px; object-fit: contain; }

textarea.saisie { resize: vertical; min-height: 84px; font: inherit; line-height: 1.5; }
.saisie:disabled { background: var(--surface-2); color: var(--texte-3); cursor: not-allowed; }

/* Apercu de l'en-tete de devis : meme hierarchie que le document imprime. */
.apercu {
  border: 1px solid var(--bord); border-radius: var(--r-md);
  background: #FFF; padding: 16px;
}
.apercu__tete {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding-bottom: 10px; border-bottom: 2px solid var(--olive-600);
}
.apercu__marque { display: flex; align-items: center; gap: 9px; }
.apercu__pastille {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--sable-300), var(--ocre-500));
  color: var(--olive-900); font-weight: 800; font-size: .82rem;
}
.apercu__logo { max-width: 190px; max-height: 62px; object-fit: contain; }
.apercu__bloc {
  margin-top: 14px; border: 1px solid var(--bord); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: .88rem;
}
.apercu__t {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texte-3); font-weight: 700; margin-bottom: 3px;
}

/* =============================================================================
   COMPARAISON DE VARIANTES
   ============================================================================= */

.comparaisons { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
.comparaison {
  text-align: left; padding: 15px 16px; border-radius: var(--r-md);
  border: 1px solid var(--bord); background: var(--surface);
  font: inherit; cursor: pointer;
  transition: transform .12s, box-shadow .18s, border-color .18s;
}
.comparaison:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); border-color: var(--ocre-500); }
.comparaison__t { font-weight: 650; font-size: .95rem; }
.comparaison__d { font-size: .82rem; color: var(--texte-2); margin-top: 4px; line-height: 1.45; }
.comparaison__n {
  display: flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: .76rem; color: var(--texte-3);
}

/* Les colonnes de variantes : une lecture cote a cote, pas un tableau. */
.colonnes { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 12px; }
.colonne {
  padding: 16px 14px; border-radius: var(--r-md);
  border: 1px solid var(--bord); background: var(--surface-2);
  min-width: 0;
}
.colonne--ref   { background: var(--sable-100); border-color: var(--sable-200); }
.colonne--mieux { border-color: var(--succes); box-shadow: 0 0 0 2px rgba(47,122,79,.14); }
.colonne__nom {
  font-weight: 650; font-size: .92rem; display: flex; align-items: center;
  gap: 6px; flex-wrap: wrap; min-height: 2.6em;
}
.colonne__val { font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em;
                font-variant-numeric: tabular-nums; margin-top: 6px; }
.colonne__dev { font-size: .72rem; color: var(--texte-3); font-weight: 600; }
.colonne__ecart { margin-top: 8px; font-size: .88rem; font-weight: 650;
                  font-variant-numeric: tabular-nums; }
.colonne__ecart.hausse { color: var(--erreur); }
.colonne__ecart.baisse { color: var(--succes); }
.colonne__diff {
  margin-top: 10px; padding-top: 9px; border-top: 1px dotted var(--bord-fort);
  font-size: .78rem; color: var(--texte-2); line-height: 1.5; overflow-wrap: anywhere;
}

/* Le montant le plus bas d'une ligne, discretement signale. */
table.tableau td.mieux { color: var(--succes); font-weight: 650; }

@media (max-width: 860px) {
  .colonnes { grid-template-columns: 1fr; }
  .colonne__nom { min-height: 0; }
}

/* =============================================================================
   DIALOGUE MODAL
   ============================================================================= */

.voile {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(38, 34, 18, .45);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 20px;
  overflow-y: auto;
}
.dialogue {
  width: 100%; max-width: 460px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--ombre-3);
  padding: 24px;
}
.dialogue h2 { font-size: 1.15rem; }
.dialogue .ligne-item { align-items: flex-start; }

@media (max-width: 560px) {
  .voile { padding: 12px; align-items: flex-start; }
  .dialogue { padding: 18px; border-radius: var(--r-lg); }
}

/* Ecarts colores dans les tableaux de versions. */
table.tableau td.hausse { color: var(--erreur); }
table.tableau td.baisse { color: var(--succes); }

/* =============================================================================
   Releve sur plan
   La scene occupe la largeur ; les listes passent dessous, en deux colonnes qui
   se replient sur telephone.
   ============================================================================= */
.plan { width: 100%; }
.plan__tete { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.plan__tete h2 { margin: 0 0 2px; }
.plan__tete > button { margin-left: auto; }

.plan__outils {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--bord); border-radius: var(--r-md);
}
.plan__modes { display: flex; gap: 4px; flex-wrap: wrap; min-width: 0; }
.plan__aide { margin: 0 0 10px; min-height: 18px; }

.plan__scene {
  border: 1px solid var(--bord-fort); border-radius: var(--r-md);
  overflow: hidden; background: var(--surface-2); min-width: 0;
}
/* touch-action: none -- sans quoi le navigateur mobile fait defiler la page
   au lieu de laisser tracer. */
.plan__toile { display: block; touch-action: none; cursor: crosshair; }

.plan__bas {
  display: grid; grid-template-columns: 1fr 300px; gap: 18px; margin-top: 16px;
}
.plan__colonne { min-width: 0; }
.plan__colonne h3 {
  margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texte-3); font-weight: 700;
}
.plan__liste { display: grid; gap: 6px; max-height: 240px; overflow-y: auto; }
.plan__piece {
  display: grid; grid-template-columns: 24px 1fr 110px auto 32px;
  align-items: center; gap: 8px; min-width: 0;
}
.plan__piece .saisie { padding: 6px 8px; font-size: .9rem; }
.plan__pastille {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--orange-700); color: #FFF;
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
}
.plan__dim { white-space: nowrap; color: var(--texte-2); }

.plan__resume {
  background: var(--surface-2); border: 1px solid var(--bord);
  border-radius: var(--r-md); padding: 12px;
}
.plan__stat {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 5px 0; border-bottom: 1px dashed var(--bord);
}
.plan__stat:last-of-type { border-bottom: 0; }

.plan__actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px;
  padding-top: 14px; border-top: 1px solid var(--bord);
}

/* Liste des plans joints, dans l'etape Niveaux. */
.plans { display: grid; gap: 8px; }
.plan-item {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 8px 10px; background: var(--surface-2);
  border: 1px solid var(--bord); border-radius: var(--r-sm);
}
.plan-item__nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 820px) {
  .plan__bas { grid-template-columns: 1fr; }
  .plan__piece { grid-template-columns: 24px 1fr 32px; }
  .plan__piece select, .plan__dim { grid-column: 2 / 4; }
}

/* Message d'erreur du moteur dans la barre de total. Contrairement a la plage,
   il reste visible sur telephone : une saisie incoherente doit se lire partout. */
.total-direct__souci {
  font-size: .8rem; color: var(--erreur); font-weight: 600;
  max-width: 62ch; line-height: 1.35;
}
@media (max-width: 720px) {
  .total-direct__souci { font-size: .74rem; max-width: none; }
}

/* =============================================================================
   Prix releves pour un projet
   Le champ reste discret tant qu'il porte le prix du marche, et se signale des
   qu'il porte celui d'un fournisseur : c'est ce qui explique un ecart de devis.
   ============================================================================= */
.prix__cellule { display: flex; align-items: center; gap: 6px; justify-content: flex-end; min-width: 0; }
.prix__saisie {
  width: 96px; padding: 6px 8px; text-align: right;
  font-variant-numeric: tabular-nums; font-size: .88rem;
  background: transparent; border-color: transparent;
}
.prix__saisie:hover { border-color: var(--bord-fort); background: var(--surface); }
.prix__saisie:focus { border-color: var(--orange-600); background: var(--surface); }
.prix__saisie--perso {
  border-color: var(--sable-300); background: var(--sable-100);
  font-weight: 650; color: var(--brique-700);
}
.prix__cellule .etiq { white-space: nowrap; }
.prix__marque { color: var(--brique-700); font-weight: 700; margin-left: 2px; }
.prix__note { margin: 8px 12px 12px; }

@media (max-width: 720px) {
  .prix__saisie { width: 78px; }
  .prix__cellule .etiq { display: none; }
}

/* Champ de mot de passe : l'oeil se pose dans le champ, pas a cote — sur un
   telephone, chaque pixel de largeur compte. */
.mdp { position: relative; display: block; }
.mdp .saisie { width: 100%; padding-right: 42px; }
.mdp__oeil {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--texte-3); cursor: pointer;
}
.mdp__oeil:hover { color: var(--texte); background: var(--surface-2); }
.mdp__oeil:focus-visible { outline: 2px solid var(--orange-600); outline-offset: 1px; }

/* =============================================================================
   Installation sur l'appareil
   ============================================================================= */

.pwa { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px; }
.pwa__icone { flex: none; line-height: 0; }
.pwa__icone img { border-radius: 11px; display: block; }
.pwa__corps { flex: 1; min-width: 0; }
.pwa__t { font-weight: 650; margin-bottom: 3px; }
.pwa__d { color: var(--texte-2); font-size: .9rem; margin-bottom: 12px; }
.pwa__etapes {
  margin: 0; padding-left: 18px;
  color: var(--texte-2); font-size: .9rem; line-height: 1.65;
}
.pwa__etapes strong { color: var(--texte); }

@media (max-width: 560px) {
  .pwa { gap: 12px; }
  .pwa__icone img { width: 36px; height: 36px; }
}
