/* Miel in Pot — feuille de style unique. Palette relevée sur le logo. */

:root {
  --vert: #2f5233;
  --vert-clair: #7da453;
  --vert-pale: #eef3e9;
  --miel: #f5b222;
  --ambre: #b07d18;
  --creme: #fdfbf5;
  --blanc: #ffffff;
  --texte: #2b2b26;
  --texte-doux: #6b6b60;
  --bordure: #e6e1d4;
  --erreur: #b3261e;
  --alerte: #b96a12;

  --rayon: 14px;
  --ombre: 0 1px 2px rgba(47, 82, 51, 0.05), 0 8px 24px rgba(47, 82, 51, 0.07);
  --serif: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

/* Les règles de mise en page (display: flex/grid) l'emportent sinon sur le
   display:none implicite de [hidden], et les blocs masqués restent visibles. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--creme);
  color: var(--texte);
  font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

h1, h2, h3 { font-family: var(--serif); color: var(--vert); font-weight: 600; margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 2.9rem); letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
a { color: var(--vert); }

/* ---------- Structure ---------- */

.page { max-width: 720px; margin: 0 auto; padding: 3rem 1.25rem 4rem; }
.page--large { max-width: 1240px; }

.carte {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 1.75rem;
}

/* ---------- Accueil ---------- */

.entete { text-align: center; margin-bottom: 2.5rem; }
.logo {
  width: min(260px, 70%);
  height: auto;
  display: block;
  margin: 0 auto 0.5rem;
  /* Le logo est fourni sur fond blanc : le fondre dans le crème de la page. */
  mix-blend-mode: multiply;
}

.accroche {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ambre);
  font-size: 1.05rem;
  margin: 0;
}

.filet {
  width: 64px;
  height: 3px;
  background: var(--miel);
  border: 0;
  border-radius: 2px;
  margin: 1.25rem auto;
}

.intro { text-align: center; color: var(--texte-doux); max-width: 56ch; margin: 0 auto 2rem; }
.intro strong { color: var(--texte); font-weight: 600; }

.atouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding: 0;
  list-style: none;
}

.atout {
  background: var(--vert-pale);
  border-radius: var(--rayon);
  padding: 1.1rem 0.75rem;
  text-align: center;
}
.atout__icone { font-size: 1.6rem; line-height: 1; display: block; margin-bottom: 0.4rem; }
.atout__titre { font-weight: 600; color: var(--vert); display: block; font-size: 0.95rem; }
.atout__detail { color: var(--texte-doux); font-size: 0.83rem; }

/* ---------- Formulaires ---------- */

.champs { display: grid; gap: 1rem; }
.champs--duo { grid-template-columns: 1fr 1fr; }

.champ { display: flex; flex-direction: column; gap: 0.35rem; }

.champ label { font-size: 0.85rem; font-weight: 600; color: var(--vert); }
.champ .requis { color: var(--miel); }
.champ .aide { font-size: 0.78rem; color: var(--texte-doux); font-weight: 400; }

input, select {
  font: inherit;
  color: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--bordure);
  border-radius: 9px;
  background: var(--blanc);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--vert-clair);
  box-shadow: 0 0 0 3px rgba(125, 164, 83, 0.2);
}
input[aria-invalid='true'] { border-color: var(--erreur); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%232f5233' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.erreur-champ { color: var(--erreur); font-size: 0.78rem; min-height: 1.1em; }

/* Piège à robots : invisible pour l'utilisateur, rempli par les bots. */
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Retour sur le déplacement (page 1) ---------- */

.deplacement {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
  background: var(--vert-pale);
  color: var(--texte-doux);
}
.deplacement[hidden] { display: none; }
.deplacement--succes { color: var(--vert); }
.deplacement--alerte { background: #fdf4e3; color: var(--alerte); }

/* ---------- Boutons ---------- */

.bouton {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.bouton:disabled { opacity: 0.45; cursor: not-allowed; }
.bouton:not(:disabled):hover { transform: translateY(-1px); }

.bouton--principal { background: var(--vert); color: var(--blanc); width: 100%; }
.bouton--principal:not(:disabled):hover { background: #264226; }

.bouton--miel { background: var(--miel); color: #4a3200; width: 100%; font-size: 1.05rem; }
.bouton--miel:not(:disabled):hover { background: #e6a40f; }

.bouton--fantome {
  background: transparent;
  color: var(--vert);
  border: 1px solid var(--bordure);
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}

/* Accès au détail du calcul : discret, sous l'action principale. */
.bouton--detail {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.supprimer {
  background: transparent;
  border: 1px solid transparent;
  color: var(--texte-doux);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  padding: 0 0.5rem;
  align-self: center;
}
.supprimer:hover { color: var(--erreur); border-color: var(--bordure); }
.supprimer[hidden] { display: none !important; }

/* ---------- Bandeau page 2 ---------- */

.bandeau {
  background: var(--vert);
  color: #dfe8d9;
  padding: 0.7rem 1.25rem;
}
.bandeau__contenu {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.bandeau__logo { height: 34px; width: auto; background: var(--blanc); border-radius: 6px; padding: 3px 6px; }
.bandeau__client { font-weight: 600; color: var(--blanc); }
.bandeau__trajet { font-size: 0.85rem; opacity: 0.85; }
.bandeau__lien { margin-left: auto; color: var(--miel); font-size: 0.85rem; text-decoration: none; }
.bandeau__lien:hover { text-decoration: underline; }

/* ---------- Simulateur ---------- */

.simulateur { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }

.bloc { margin-bottom: 1.5rem; }
.bloc:last-child { margin-bottom: 0; }
.bloc__titre { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.9rem; }
.bloc__numero {
  background: var(--miel);
  color: #4a3200;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}

.lignes { display: grid; gap: 0.6rem; }

.ligne {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.6rem;
  align-items: end;
}
.ligne--vide .supprimer { visibility: hidden; }

/* ---------- Jauge de cohérence ---------- */

.jauge { margin-top: 1.1rem; }
.jauge__piste {
  height: 8px;
  background: var(--vert-pale);
  border-radius: 999px;
  overflow: hidden;
}
.jauge__barre {
  height: 100%;
  width: 0;
  background: var(--vert-clair);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.jauge__texte { font-size: 0.85rem; color: var(--texte-doux); margin-top: 0.45rem; }
.jauge--complet .jauge__barre { background: var(--vert); }
.jauge--complet .jauge__texte { color: var(--vert); font-weight: 600; }
.jauge--depassement .jauge__barre { background: var(--alerte); }
.jauge--depassement .jauge__texte { color: var(--alerte); font-weight: 600; }

/* ---------- Tableau ---------- */

.tableau-enveloppe { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  background: var(--vert);
  color: var(--blanc);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 0.7rem;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}
thead th:first-child { text-align: left; border-radius: 8px 0 0 0; }
thead th:last-child { border-radius: 0 8px 0 0; }
tbody td { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--bordure); text-align: right; }
tbody td:first-child { text-align: left; font-weight: 600; color: var(--vert); }
tbody tr:nth-child(even) { background: #fbfaf6; }
.cellule-vide { text-align: center !important; color: var(--texte-doux); font-style: italic; padding: 2rem 0.7rem !important; font-weight: 400 !important; }

/* ---------- Totaux ---------- */

.totaux { margin-top: 1.25rem; }
.totaux[hidden] { display: none; }

.total-ligne {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  font-size: 0.92rem;
  color: var(--texte-doux);
}
.total-ligne dt { margin: 0; }
.total-ligne dd { margin: 0; font-variant-numeric: tabular-nums; color: var(--texte); }
.total-ligne--fort { border-top: 1px solid var(--bordure); margin-top: 0.4rem; padding-top: 0.7rem; }
.total-ligne--deplacement dt, .total-ligne--deplacement dd { color: var(--ambre); }
.total-ligne--deplacement dd { font-weight: 600; }
.total-ligne--fort dt, .total-ligne--fort dd { color: var(--vert); font-weight: 700; font-size: 1rem; }

.total-ttc {
  background: var(--vert-pale);
  border-radius: var(--rayon);
  padding: 1rem 1.1rem;
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.total-ttc__libelle { font-weight: 600; color: var(--vert); }
.total-ttc__valeur {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ambre);
  font-variant-numeric: tabular-nums;
}

.duree {
  margin-top: 0.8rem;
  font-size: 0.88rem;
  color: var(--texte-doux);
  text-align: center;
}

/* ---------- Page de détail ---------- */

.bloc-detail { margin-bottom: 1.5rem; }
.bloc-detail:last-of-type { margin-bottom: 0; }

.sous-titre {
  font-size: 0.95rem;
  color: var(--vert);
  margin: 1.5rem 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--miel);
  display: inline-block;
}
.bloc-detail > .sous-titre:first-of-type { margin-top: 0.5rem; }

.note {
  font-size: 0.83rem;
  color: var(--texte-doux);
  line-height: 1.55;
  margin: 0.6rem 0 0;
}
.note--alerte {
  background: #fdf4e3;
  color: var(--alerte);
  border-radius: 9px;
  padding: 0.6rem 0.8rem;
}

.formule {
  background: #f6f4ec;
  border: 1px solid var(--bordure);
  border-left: 3px solid var(--miel);
  border-radius: 9px;
  padding: 1rem 1.1rem;
  margin: 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.75;
  color: var(--texte);
  white-space: pre;
}

/* Tableaux « étapes » : libellé, opération posée, résultat. */
.table-etapes td { vertical-align: top; }
.table-etapes td:first-child { white-space: nowrap; }
.table-etapes .operation {
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--texte-doux);
}
.table-etapes .resultat { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-etapes .etape--fort td { background: var(--vert-pale); font-weight: 700; }
.table-etapes .etape--fort td:first-child,
.table-etapes .etape--fort .resultat { color: var(--vert); }

td.unite { text-align: left; color: var(--texte-doux); font-size: 0.83rem; }

/* ---------- Messages ---------- */

.message { border-radius: 10px; padding: 0.8rem 1rem; font-size: 0.9rem; margin-top: 1rem; }
.message[hidden] { display: none; }
.message--succes { background: var(--vert-pale); color: var(--vert); }
.message--erreur { background: #fdecea; color: var(--erreur); }
.message--info { background: #fdf4e3; color: var(--alerte); }

.mention {
  font-size: 0.76rem;
  color: var(--texte-doux);
  text-align: center;
  margin-top: 1.25rem;
  line-height: 1.5;
}

.pied { text-align: center; color: var(--texte-doux); font-size: 0.8rem; padding: 2rem 1rem; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .simulateur { grid-template-columns: 1fr; }
  .page { padding-top: 2rem; }
}

@media (max-width: 560px) {
  .atouts { grid-template-columns: 1fr; }
  .champs--duo { grid-template-columns: 1fr; }
  .carte { padding: 1.25rem; }
  .ligne { grid-template-columns: 1fr 1fr auto; gap: 0.4rem; }
  .total-ttc { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
}

/* ---------- Édition des tarifs ---------- */

.barre-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1rem 0 0.4rem;
}
.bouton--compact { width: auto; padding: 0.55rem 1.1rem; font-size: 0.88rem; }

.cellule-saisie { text-align: right !important; }

.champ-tarif, .champ-vente {
  width: 8rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.88rem;
  text-align: right;
  border-radius: 7px;
  border: 1px solid var(--bordure);
  background: #fffdf7;
  font-variant-numeric: tabular-nums;
}
.champ-tarif:focus, .champ-vente:focus {
  background: var(--blanc);
  border-color: var(--vert-clair);
  box-shadow: 0 0 0 3px rgba(125, 164, 83, 0.2);
  outline: none;
}
.champ-vente { border-color: var(--miel); }

/* ---------- Synthèse et colonnes ---------- */

.colonnes-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 0.5rem;
}

.synthese { margin: 0 0 1rem; }
.synthese__ligne {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--bordure);
  font-size: 0.92rem;
}
.synthese__ligne dt { margin: 0; color: var(--texte-doux); }
.synthese__ligne dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.synthese__ligne--fort dt, .synthese__ligne--fort dd {
  color: var(--vert);
  font-size: 1.05rem;
  font-weight: 700;
}
.synthese__ligne--fort.negatif dt, .synthese__ligne--fort.negatif dd { color: var(--erreur); }

td.part { color: var(--ambre); font-weight: 600; }
.negatif { color: var(--erreur) !important; }

/* ---------- Graphiques ---------- */

.graphique { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }
.graphique svg { max-width: 100%; height: auto; }

.legende { list-style: none; margin: 0; padding: 0; width: 100%; }
.legende__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0;
  font-size: 0.85rem;
}
.legende__pastille {
  width: 11px; height: 11px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.legende__libelle { color: var(--texte-doux); }
.legende__valeur { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.legende--horizontale { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.2rem 1rem; }
.legende--horizontale .legende__item { padding: 0; }

.barres {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 0.8rem;
  overflow-x: auto;
  padding-top: 1.4rem;
}
.barre-groupe { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.barre-groupe__barres { display: flex; align-items: flex-end; gap: 4px; }
.barre-groupe__libelle { font-size: 0.82rem; color: var(--vert); font-weight: 600; white-space: nowrap; }
.barre-colonne { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.barre { width: 26px; border-radius: 4px 4px 0 0; display: block; }
.barre-valeur {
  font-size: 0.66rem;
  color: var(--texte-doux);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-bottom: 3px;
}

/* ---------- Jauge coût / gain ---------- */

.jauge-part { margin-top: 0.6rem; }
.jauge-part__piste {
  height: 22px;
  background: var(--vert-pale);
  border-radius: 999px;
  overflow: hidden;
}
.jauge-part__barre { height: 100%; border-radius: 999px; transition: width 0.25s ease; }
.jauge-part__legende {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--texte-doux);
  margin-top: 0.4rem;
}

@media (max-width: 900px) {
  .colonnes-detail { grid-template-columns: 1fr; }
}
