/* €nerVigie : l'étiquette énergie comme système. Fond blanc, encre noire, rampe A–G réservée au classement. */
@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --encre: #161616;
  --encre-2: #4a4a46;        /* texte secondaire : 8.6:1 sur blanc */
  --encre-3: #6b6b66;        /* mentions : 5.3:1 sur blanc */
  --papier: #ffffff;
  --sol: #f1f2ee;
  --filet: #d6d7d1;
  /* Rampe de l'étiquette (classes A à G) */
  --A: #00a651; --B: #50b848; --C: #bfd730; --D: #fff200; --E: #fdb913; --F: #f37021; --G: #ed1c24;
  /* Versions lisibles en texte sur blanc pour « moins cher » / « plus cher » */
  --mieux: #00703c;
  --pire: #b3121b;
  --rayon: 0;
  --t1: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  --t2: 1.25rem;
  --gouttiere: clamp(16px, 4vw, 48px);
  font-family: 'Archivo', system-ui, sans-serif;
  color: var(--encre);
  background: var(--papier);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { scrollbar-color: var(--encre-3) var(--sol); }
[hidden] { display: none !important; }
body { margin: 0; background: var(--papier); line-height: 1.5; font-size: 16px; caret-color: var(--A); }
::selection { background: var(--D); color: var(--encre); }
:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }

/* ——— En-tête ——— */
.entete { background: var(--papier); border-bottom: 3px solid var(--encre); }
.entete-int { max-width: 1240px; margin: 0 auto; padding: 0 var(--gouttiere); height: 64px; display: flex; align-items: center; gap: 32px; }
.marque { font-weight: 800; font-stretch: 112%; font-size: 1.4rem; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.marque b { color: var(--A); font-weight: 800; }
.entete nav { display: flex; gap: 4px; margin-left: auto; }
.entete nav a { text-decoration: none; padding: 8px 12px; font-weight: 600; font-size: .95rem; color: var(--encre-2); border-bottom: 3px solid transparent; }
.entete nav a[aria-current="page"], .entete nav a:hover { color: var(--encre); border-bottom-color: var(--encre); }

.tete-resultat { margin-bottom: 24px; }
.tete-resultat h1 { font-size: var(--t1); font-weight: 800; font-stretch: 105%; letter-spacing: -0.02em; margin-bottom: 12px; }
.tete-resultat .actions { margin-top: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 32px var(--gouttiere) 80px; }
.intro { max-width: 62ch; margin-bottom: 28px; }
.intro h1 { font-size: var(--t1); font-weight: 800; font-stretch: 105%; letter-spacing: -0.02em; }
.intro p { color: var(--encre-2); margin-top: 10px; font-size: 1.05rem; }

/* ——— Panneaux : une feuille blanche cadrée comme une étiquette ——— */
.feuille { background: var(--papier); border: 1px solid var(--filet); padding: clamp(18px, 3vw, 28px); }
/* Le cadre noir de 3 px est réservé à l'objet étiquette */
.zone-etiquette { border: 3px solid var(--encre); overflow: hidden; }
.feuille + .feuille, .bloc + .bloc { margin-top: 24px; }
.feuille h2 { font-size: var(--t2); font-weight: 800; font-stretch: 105%; }
.feuille .sous { color: var(--encre-2); font-size: .95rem; margin-top: 4px; }
.note { color: var(--encre-3); font-size: .875rem; }

/* ——— L'étiquette : barres A–G en escalier ——— */
.etiquette { display: grid; gap: 6px; margin-top: 20px; }
.rang { display: grid; grid-template-columns: minmax(0, 1fr) minmax(108px, 36%); align-items: start; gap: 12px; min-height: 40px; }
.barre {
  width: calc(34% + var(--i, 0) * 11%); min-width: 92px; height: 40px; display: flex; align-items: center; gap: 10px;
  padding: 0 28px 0 12px; color: var(--encre); background: var(--c);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 0 100%);
}
.barre .lettre { font-weight: 800; font-size: 1.45rem; font-stretch: 112%; line-height: 1; }
a.barre { text-decoration: none; }
a.barre:hover .compte { text-decoration: underline; }
.barre .compte { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre.claire .lettre, .barre.claire .compte { color: var(--papier); }
.marques { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.fleche {
  display: inline-flex; align-items: center; height: 40px; padding: 0 14px 0 26px; font-weight: 700; font-size: .9rem; line-height: 1.1;
  background: var(--encre); color: var(--papier); white-space: nowrap;
  clip-path: polygon(18px 0, 100% 0, 100% 100%, 18px 100%, 0 50%);
}
.fleche .txt { display: inline-flex; gap: 8px; align-items: baseline; }
.fleche .num { font-weight: 800; }
.lettre-fleche { font-weight: 800; font-size: 1.2rem; font-stretch: 112%; margin-right: 10px; line-height: 1; }
/* État futur (échéance) : même flèche, contour pointillé dessiné en SVG ; on le lit par la forme, pas seulement par la couleur */
.fleche.future { position: relative; background: transparent; color: var(--encre); clip-path: none; isolation: isolate; }
.fleche.future .contour { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; overflow: visible; }
.fleche.future .contour polygon { fill: var(--papier); stroke: var(--encre); stroke-width: 2; stroke-dasharray: 6 4; }
.fleche.cible { background: var(--mieux); color: var(--papier); }
.pied-etiquette { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--encre); font-size: .85rem; color: var(--encre-2); }

/* Petite étiquette de classe dans les tableaux */
.cl { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 26px; padding-right: 8px; font-weight: 800; font-size: .95rem; background: var(--c); color: var(--encre); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.cl.claire { color: var(--papier); }

/* ——— Résumé « atteignable » ——— */
/* Bureau : étiquette puis offres à gauche, résumé collant à droite. Téléphone : étiquette, résumé, offres. */
.resultat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); grid-template-areas: "etiquette resume" "offres resume"; gap: 24px; align-items: start; }
.zone-etiquette { grid-area: etiquette; }
.resume { grid-area: resume; position: sticky; top: 16px; }
.zone-offres { grid-area: offres; }
.zone-offres > .feuille + .feuille { margin-top: 24px; }
.economie-libelle { font-weight: 600; margin-bottom: 4px; }
.resume .gros { font-size: clamp(2.4rem, 1.8rem + 2vw, 3.2rem); font-weight: 800; letter-spacing: -0.03em; color: var(--mieux); line-height: 1; margin: 12px 0 6px; }
.resume dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--filet); }
.resume dt { color: var(--encre-2); }
.resume dd { margin: 0; font-weight: 700; text-align: right; }
.resume dd.net { font-size: 1.15rem; }
.echeance { margin-top: 16px; padding: 14px 16px; background: var(--sol); border: 2px dashed var(--encre); }
.echeance strong { display: block; }

/* ——— Tableaux ——— */
.tableau { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-weight: 700; font-size: .8rem; color: var(--encre-2); padding: 10px 12px; border-bottom: 2px solid var(--encre); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--filet); vertical-align: top; }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.prix { font-weight: 700; font-size: 1.02rem; }
tr.vous td { background: var(--sol); }
.mini-cible { display: block; width: max-content; margin-top: 6px; padding: 2px 8px 2px 14px; font-size: .72rem; font-weight: 700; background: var(--mieux); color: var(--papier); clip-path: polygon(8px 0, 100% 0, 100% 100%, 8px 100%, 0 50%); }
.moins { color: var(--mieux); }
.plus { color: var(--pire); }
.offre b { display: block; }
td.offre { min-width: 200px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 6px; font-size: .8rem; }
.meta a { color: var(--encre-2); }
.meta .etat { white-space: normal; }
.offre small { display: block; color: var(--encre-3); font-size: .82rem; margin-top: 2px; }
.cout { color: var(--encre-2); }
.cout small { display: block; font-size: .78rem; color: var(--encre-3); }

/* États par la forme : plein = vérifié, pointillé = à vérifier, barré = non retenu */
.etat { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.etat::before { content: ""; width: 18px; border-top: 2px solid currentColor; }
.etat.verif::before { border-top-style: dashed; }
.etat.cond::before { border-top-style: dotted; border-top-width: 3px; }
.etat.ref { color: var(--encre-3); }
.etat.perime { color: var(--pire); }
.etat.perime::before { border-top-style: dashed; }

/* ——— Formulaire ——— */
.depot { display: grid; place-items: center; gap: 6px; text-align: center; padding: 28px 16px; border: 2px dashed var(--encre); background: var(--sol); cursor: pointer; }
.depot:hover, .depot:focus-within { background: #fffbd1; }
.depot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.depot strong { font-size: 1.05rem; }
.champs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 14px 18px; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .875rem; font-weight: 600; color: var(--encre-2); }
/* Dans une grille de champs, les cases de saisie s'alignent en bas, même si un libellé passe sur deux lignes */
.champs > label { justify-content: space-between; }
.unite { font-weight: 800; color: var(--encre); }
.aide { margin-top: 8px; max-width: 70ch; }
.sous-titre-prix { font-size: 1rem; font-weight: 800; margin-top: 24px; }
.saisie-ht { margin: 14px 0 0; padding: 10px 12px; background: var(--sol); }
.saisie-ht.case { margin-top: 14px; }
input, select { font: inherit; font-weight: 500; color: var(--encre); background: var(--papier); border: 2px solid var(--filet); border-radius: 0; padding: 9px 10px; min-height: 44px; }
input:hover, select:hover { border-color: var(--encre-3); }
input:focus, select:focus { outline: none; border-color: var(--encre); box-shadow: 0 0 0 3px var(--D); }
input::placeholder { color: var(--encre-3); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: var(--t2); font-weight: 800; font-stretch: 105%; padding: 0; float: left; width: 100%; }
legend + * { clear: both; }
fieldset.feuille { min-width: 0; }
.case { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--encre); font-weight: 500; font-size: .95rem; margin-top: 12px; }
.case input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--encre); flex: none; }
details.repli > summary { cursor: pointer; font-weight: 700; list-style: none; display: inline-flex; align-items: center; gap: 8px; }
details.repli > summary::-webkit-details-marker { display: none; }
details.repli > summary::before { content: ""; width: 9px; height: 9px; border-right: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg); transition: transform .2s; }
details.repli[open] > summary::before { transform: rotate(45deg); }

.bouton { font: inherit; font-weight: 700; font-size: 1rem; border: 0; border-radius: 0; padding: 12px 20px; min-height: 48px; background: var(--encre); color: var(--papier); cursor: pointer; }
.bouton:hover { background: #333; }
.bouton:disabled { opacity: .55; cursor: progress; }
.bouton.second { background: var(--papier); color: var(--encre); box-shadow: inset 0 0 0 2px var(--encre); }
.bouton.second:hover { background: var(--sol); }
.bouton.petit { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 20px; }

.message { padding: 12px 14px; border: 2px solid var(--encre); background: var(--papier); font-size: .95rem; margin-top: 12px; }
.message.alerte { border-color: var(--pire); color: var(--pire); }
.message.info { border-style: dashed; }

td small { display: block; }

/* ——— Responsive ——— */
/* Sur téléphone, chaque ligne d'offre devient une fiche : mêmes champs, même ordre */
@media (max-width: 680px) {
  table.offres thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.offres, table.offres tbody, table.offres tr { display: block; }
  table.offres tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--filet); }
  table.offres tr.vous { background: var(--sol); padding-inline: 8px; margin-inline: -8px; }
  table.offres tr.vous td { background: none; }
  table.offres td { border: 0; padding: 0; min-width: 0; }
  table.offres tr { grid-template-columns: 44px minmax(0, 1fr); }
  table.offres td:first-child { grid-row: span 4; }
  table.offres .mini-cible { display: none; }
  table.offres tr.reco::after { content: "Atteignable"; grid-column: 2; justify-self: start; margin-top: 4px; padding: 2px 8px 2px 14px; font-size: .72rem; font-weight: 700; background: var(--mieux); color: var(--papier); clip-path: polygon(8px 0, 100% 0, 100% 100%, 8px 100%, 0 50%); }
  table.offres td.offre { min-width: 0; }
  table.offres td.n { grid-column: 2; display: block; text-align: right; white-space: normal; }
  table.offres td.n::before { content: attr(data-l); float: left; font-weight: 600; font-size: .8rem; color: var(--encre-3); padding-top: 2px; }
  table.offres td.n > br { display: none; }
  table.offres td.n > span ~ span::before { content: " / "; color: var(--encre-3); font-weight: 400; }
  table.offres td.n small { clear: both; }
}
@media (max-width: 900px) {
  .resultat { grid-template-columns: minmax(0, 1fr); grid-template-areas: "etiquette" "resume" "offres"; }
  .resume { position: static; }
}
@media (max-width: 560px) {
  .entete-int { height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px 16px; padding-block: 10px; }
  .entete nav { margin-left: 0; }
  .rang { grid-template-columns: minmax(0, 1fr) 46%; gap: 8px; }
  .barre { height: 36px; min-width: 56px; width: calc(40% + var(--i, 0) * 10%); padding-right: 22px; }
  .barre .compte { display: none; }
  .marques { min-width: 0; }
  .fleche { height: auto; min-height: 40px; max-width: 100%; padding-block: 5px; white-space: normal; font-size: .78rem; }
  .fleche .txt { display: grid; gap: 0; line-height: 1.2; }
  .lettre-fleche { font-size: 1rem; margin-right: 8px; }
  td, th { padding: 10px 8px; }
}
