/* Comparateur de prix — ambre, crème, noir.
   Une seule couleur porte du sens : l'ambre signale ce qui chauffe (une hausse).
   Tout le reste est encre sur crème. */

:root {
  --encre:      #17130C;
  --encre-2:    #4A4136;
  --encre-3:    #857A68;
  --creme:      #F8F3E7;   /* fond de page */
  --creme-clair:#FDFBF5;   /* surfaces : cartes, chiffres, champs de saisie */
  --creme-2:    #F1EADA;   /* survol, fonds creux */
  --filet:      #E0D6C0;
  --ambre:      #B3700A;
  --ambre-vif:  #E5A02B;
  --ambre-voile:#F7E6C4;

  --rythme: 1.5rem;
  --rayon: 3px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--creme);
  color: var(--encre);
  font: 400 15px/1.55 "Archivo", system-ui, -apple-system, sans-serif;
  font-feature-settings: "ss01";
}

/* ---- typographie ---- */

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; }

a { color: var(--encre); text-decoration-color: var(--filet); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ambre); }

.num, td.num, .mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.eyebrow {
  font-size: .68rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--encre-3);
}

.sourdine { color: var(--encre-3); }
.petit { font-size: .8rem; }

/* ---- ossature ---- */

header.barre {
  position: sticky; top: 0; z-index: 20;
  background: var(--creme-clair);
  border-bottom: 1px solid var(--filet);
}

/* Étage 1 : où suis-je. Étage 2 : que puis-je faire ici.
   Avant, neuf liens partageaient une seule ligne et il fallait lire les
   petites capitales pour comprendre lequel appartenait à quoi. */
.barre-haut {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .6rem clamp(1rem, 4vw, 2.5rem);
}
.barre-bas {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: .5rem clamp(1rem, 4vw, 2.5rem);
  background: var(--creme-2); border-top: 1px solid var(--filet);
}
.barre-bas .ici {
  font-size: .62rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ambre); white-space: nowrap;
}

.marque { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.marque img { height: 40px; width: auto; display: block; }
.marque .nom {
  font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--encre-3); padding-left: .75rem; border-left: 1px solid var(--filet);
  line-height: 1.35;
}

.onglets { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.onglets a {
  padding: .42rem .8rem; border-radius: var(--rayon); text-decoration: none;
  font-size: .89rem; font-weight: 500; color: var(--encre-2); white-space: nowrap;
}
.onglets a:hover { background: var(--creme-2); color: var(--encre); }
.onglets a[aria-current="page"] { background: var(--encre); color: var(--creme); font-weight: 600; }

.sous-liens { display: flex; gap: 1.15rem; flex-wrap: wrap; }
.sous-liens a {
  text-decoration: none; font-size: .84rem; color: var(--encre-2);
  padding-bottom: 2px; white-space: nowrap;
}
.sous-liens a:hover { color: var(--encre); }
.sous-liens a[aria-current="page"] {
  color: var(--encre); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ambre-vif);
}

@media (max-width: 760px) {
  .barre-haut { gap: .8rem; padding: .5rem clamp(.85rem, 4vw, 2.5rem); flex-wrap: nowrap; }
  .marque img { height: 30px; }
  .marque .nom { display: none; }

  /* Les onglets tiennent sur une seule ligne qui défile : deux lignes de
     navigation mangeaient un tiers de l'écran avant le premier chiffre. */
  .onglets {
    margin-left: auto; flex-wrap: nowrap; overflow-x: auto; gap: .15rem;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .onglets::-webkit-scrollbar { display: none; }
  .onglets a { font-size: .82rem; padding: .4rem .6rem; }

  .barre-bas { padding: .45rem clamp(.85rem, 4vw, 2.5rem); overflow-x: auto; flex-wrap: nowrap;
               scrollbar-width: none; }
  .barre-bas::-webkit-scrollbar { display: none; }
  .sous-liens { flex-wrap: nowrap; }
}

main { max-width: 1080px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem) clamp(1rem, 4vw, 2.5rem) 5rem; }

.titre-page { margin-bottom: var(--rythme); }
.titre-page p { margin: .4rem 0 0; color: var(--encre-3); max-width: 62ch; }

section + section { margin-top: calc(var(--rythme) * 1.8); }

/* ---- chiffres clés ---- */

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--filet); border: 1px solid var(--filet); }
.chiffre { background: var(--creme-clair); padding: 1.1rem 1.2rem; }
.chiffre .valeur { font-family: "IBM Plex Mono", monospace; font-size: 1.5rem; font-weight: 500; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.chiffre .valeur.accent { color: var(--ambre); }
.chiffre .label { margin-top: .25rem; }

/* ---- tableaux ---- */

table { width: 100%; border-collapse: collapse; background: var(--creme-clair); }
thead th {
  text-align: left; padding: .5rem .7rem;
  font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--encre-3); border-bottom: 1px solid var(--encre);
  white-space: nowrap;
}
tbody td { padding: .62rem .7rem; border-bottom: 1px solid var(--filet); vertical-align: middle; }
tbody tr:hover { background: var(--creme-2); }
td.num, th.num { text-align: right; }
.designation { font-weight: 500; }
.code { font-size: .78rem; color: var(--encre-3); }

/* ---- jauge de variation : l'élément signature ----
   Un axe central. À droite, une barre ambre pleine : le prix monte.
   À gauche, un contour d'encre : il baisse. La longueur est la magnitude.

   L'axe et les bornes sont tracés : une barre sans repère ne dit ni son sens
   ni son maximum. La baisse garde son contour d'encre — la DA réserve l'ambre
   à ce qui chauffe — mais reçoit un voile d'encre à 7 % pour se lire comme une
   barre plutôt que comme une case vide. */

.jauge {
  position: relative; display: inline-block; vertical-align: middle;
  height: 18px; margin-right: .55rem; flex: 0 0 auto;
}
.jauge::before {                       /* l'axe central */
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: var(--encre-3);
}
.jauge::after {                        /* les bornes de l'échelle */
  content: ""; position: absolute; inset: 8px 0 8px 0;
  border-left: 1px solid var(--filet); border-right: 1px solid var(--filet);
}
.jauge b { position: absolute; top: 3px; height: 12px; display: block; }
.jauge b.hausse {
  left: 50%; background: var(--ambre-vif); border: 1px solid var(--ambre);
  min-width: 3px;
}
.jauge b.baisse {
  right: 50%; background: rgba(23, 19, 12, .07); border: 1px solid var(--encre-2);
  min-width: 3px;
}
.jauge b.nulle { left: 50%; width: 3px; background: var(--filet); }

.legende-jauge { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; margin: .5rem 0 0; }
.legende-jauge .jauge { margin-right: .15rem; }

.valeur-var {
  font-family: "IBM Plex Mono", monospace; font-size: .82rem;
  font-variant-numeric: tabular-nums; vertical-align: middle; white-space: nowrap;
}
.valeur-var.hausse { color: var(--ambre); font-weight: 500; }
.valeur-var.baisse { color: var(--encre-2); }

/* La colonne variation ne doit jamais se casser en deux lignes. */
td .jauge + .valeur-var { display: inline-block; min-width: 4.5em; }

/* ---- courbe ---- */

.courbe { width: 100%; height: 150px; background: var(--creme-clair); border: 1px solid var(--filet); }
.courbe polyline { fill: none; stroke: var(--ambre); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

/* ---- cartes & blocs ---- */

.bloc { border: 1px solid var(--filet); background: var(--creme-clair); padding: 1.25rem 1.35rem; }
.bloc + .bloc { margin-top: 1rem; }
.bloc.attention { border-left: 3px solid var(--ambre-vif); background: linear-gradient(90deg, var(--ambre-voile) 0 3px, var(--creme-clair) 3px); }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 720px) { .duo { grid-template-columns: 1fr; } }

/* ---- formulaires ---- */

label { display: block; font-size: .78rem; font-weight: 600; color: var(--encre-2); margin-bottom: .3rem; }
input, select {
  font: inherit; width: 100%; padding: .5rem .6rem;
  background: var(--creme-clair); color: var(--encre);
  border: 1px solid var(--filet); border-radius: var(--rayon);
}
input[type="number"] { font-family: "IBM Plex Mono", monospace; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ambre); outline-offset: 2px;
}
.champs { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.champs > div { flex: 1 1 140px; }

button, .bouton {
  font: inherit; font-weight: 600; font-size: .88rem;
  padding: .55rem 1.1rem; border-radius: var(--rayon); cursor: pointer;
  border: 1px solid var(--encre); background: var(--encre); color: var(--creme);
  text-decoration: none; display: inline-block;
}
button:hover, .bouton:hover { background: var(--encre-2); border-color: var(--encre-2); }
button.discret, .bouton.discret { background: transparent; color: var(--encre-2); border-color: var(--filet); }
button.discret:hover { background: var(--creme-2); color: var(--encre); }

.depot {
  border: 1px dashed var(--filet); background: var(--creme-clair);
  padding: 2.2rem 1.5rem; text-align: center; border-radius: var(--rayon);
}
.depot input[type="file"] { max-width: 420px; margin: .8rem auto 0; }

/* ---- états ---- */

.vide { border: 1px dashed var(--filet); background: var(--creme-clair); padding: 2.5rem 1.5rem; text-align: center; color: var(--encre-3); }
.vide strong { display: block; color: var(--encre); font-size: 1rem; margin-bottom: .35rem; }

.etiquette {
  display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .05em;
  padding: .12rem .45rem; border: 1px solid var(--filet); border-radius: 999px;
  color: var(--encre-2);
}
.etiquette.ok { border-color: var(--encre); }
.etiquette.alerte { border-color: var(--ambre); background: var(--ambre-voile); color: var(--ambre); }

/* ---- motion : une seule, à l'arrivée ---- */

main > * { animation: montee .38s cubic-bezier(.2,.7,.3,1) backwards; }
main > *:nth-child(2) { animation-delay: .05s; }
main > *:nth-child(3) { animation-delay: .1s; }
main > *:nth-child(4) { animation-delay: .15s; }

@keyframes montee { from { opacity: 0; transform: translateY(8px); } }

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


/* ---- scanner ---- */

.viseur {
  position: relative; width: 100%; aspect-ratio: 4/3; max-height: 340px;
  background: var(--encre); border: 1px solid var(--filet); overflow: hidden;
}
.viseur video { width: 100%; height: 100%; object-fit: cover; }
.viseur .mire {
  position: absolute; inset: 22% 12%; border: 2px solid var(--ambre-vif);
  border-radius: 4px; box-shadow: 0 0 0 100vmax rgba(23,19,12,.35);
}
.viseur .etat {
  position: absolute; left: 0; right: 0; bottom: 0; padding: .5rem .7rem;
  background: rgba(23,19,12,.8); color: var(--creme); font-size: .8rem;
}

/* ---- barres de part ---- */

.barre-part { height: 6px; background: var(--creme-clair); border: 1px solid var(--filet); }
.barre-part b { display: block; height: 100%; background: var(--ambre-vif); }
.barre-part.sourde b { background: var(--encre-2); }

.rang { font-family: "IBM Plex Mono", monospace; font-size: .78rem; color: var(--encre-3); }
tr.vital td { background: linear-gradient(90deg, var(--voile, #F7E6C4) 0 2px, transparent 2px); }

.vignette { width: 44px; height: 44px; object-fit: contain; background: var(--creme-clair); border: 1px solid var(--filet); }

.pied {
  border-top: 1px solid var(--filet); margin-top: 3.5rem; padding-top: 1rem;
  font-size: .74rem; color: var(--encre-3); line-height: 1.6;
}
.pied a { color: var(--encre-2); }

/* ---- tableau d'édition (section Données) ----
   Une ligne = un formulaire. Les champs sont posés dans les cellules et
   rattachés au <form> de la ligne par leur attribut `form` : pas de JS, et
   surtout pas de <form> imbriqué dans un <table>, que les navigateurs
   déplacent hors du tableau. */

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

/* Un tableau plus large que la place disponible défile dans sa boîte. Sur
   téléphone il devient une carte et n'a plus rien à faire défiler. */
.defilable { overflow-x: auto; }
table.edition { min-width: 980px; }
table.edition tbody td { padding: .5rem .55rem; vertical-align: top; }
table.edition input, table.edition select { padding: .35rem .45rem; font-size: .85rem; }
table.edition input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ambre); }
table.edition tbody tr:hover { background: transparent; }

/* Barre d'action collante : on corrige en bas de liste, on enregistre sans
   remonter chercher le bouton. */
.barre-action {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  margin-top: 1rem; padding: .9rem 1.1rem;
  background: var(--creme-clair); border: 1px solid var(--filet);
  box-shadow: 0 -6px 16px rgba(23, 19, 12, .06);
}

/* ---- la une du tableau de bord ----
   Un seul chiffre porte la page : ce que la dérive coûte. Les mesures de
   contexte l'accompagnent sans lui disputer la place. */

.une {
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 1px;
  background: var(--filet); border: 1px solid var(--filet);
}
.une-chiffre { background: var(--creme-clair); padding: 1.5rem 1.6rem; }
.une-chiffre .valeur-une {
  font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 500; letter-spacing: -.05em;
  line-height: 1.05; color: var(--ambre); margin: .3rem 0 .4rem;
}
.une-chiffre p { margin: 0; max-width: 42ch; }
.une-repere {
  background: var(--creme-clair); padding: 1.5rem 1.6rem;
  display: flex; flex-direction: column; justify-content: center; gap: .9rem;
}
.une-repere > div { display: flex; align-items: baseline; gap: .6rem; }
.une-repere .valeur-repere {
  font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums;
  font-size: 1.15rem; font-weight: 500; letter-spacing: -.03em;
  min-width: 5.5ch; text-align: right;
}
@media (max-width: 720px) { .une { grid-template-columns: 1fr; } }

/* ---- en-tête de section ---- */

.titre-section {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid var(--encre); padding-bottom: .45rem; flex-wrap: wrap;
}
.titre-section .petit { font-size: .8rem; }
button.petit, .bouton.petit { font-size: .78rem; padding: .35rem .7rem; }

/* ---- trois portes de même poids ---- */

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.trio .porte { display: flex; flex-direction: column; justify-content: space-between; gap: 1.2rem; }
.trio .porte .bouton { align-self: flex-start; }
@media (max-width: 860px) { .trio { grid-template-columns: 1fr; } }

section + .trio, .trio + section { margin-top: calc(var(--rythme) * 1.8); }

/* Les écrans de données portent des tableaux larges : ils méritent la place. */
main.large { max-width: 1440px; }


table.edition td.num, table.edition .depense { white-space: nowrap; }
table.edition .meta { font-size: .74rem; color: var(--encre-3); margin-top: .25rem; white-space: nowrap; }
table.edition input[name="designation"] { min-width: 260px; }

/* ---- repère sous un chiffre clé ----
   Un prix sans sa date ne dit rien : « 7,901 € » relevé la semaine dernière et
   relevé il y a dix-huit mois ne se lisent pas pareil. */

.chiffre .repere { font-size: .72rem; color: var(--encre-3); margin-top: .3rem; }

/* ---- survol de la trajectoire ---- */

.courbe-cadre { position: relative; }
.courbe-cadre .courbe { display: block; cursor: crosshair; }
.repere-x { stroke: var(--encre-3); stroke-width: 1; stroke-dasharray: 3 3; }
.repere-point { fill: var(--ambre); stroke: var(--creme-clair); stroke-width: 2; }
.infobulle {
  position: absolute; top: .5rem; transform: translateX(-50%);
  background: var(--encre); color: var(--creme);
  padding: .4rem .65rem; border-radius: var(--rayon);
  font-size: .82rem; line-height: 1.35; white-space: nowrap; pointer-events: none;
}
.infobulle .sourdine { color: var(--filet); }

/* ---- suggestions de recherche ----
   Le formulaire reste un vrai formulaire : sans JS, la recherche fonctionne
   comme avant, la liste ne s'affiche simplement jamais. */

.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  margin: 3px 0 0; padding: 0; list-style: none;
  max-height: 340px; overflow-y: auto;
  background: var(--creme-clair); border: 1px solid var(--filet);
  border-radius: var(--rayon); box-shadow: 0 10px 24px rgba(23, 19, 12, .1);
}
.suggestions li {
  display: grid; grid-template-columns: 4.5rem 1fr auto; gap: .1rem .7rem;
  align-items: baseline; padding: .5rem .8rem; cursor: pointer;
  border-bottom: 1px solid var(--filet);
}
.suggestions li:last-child { border-bottom: 0; }
.suggestions li.actif, .suggestions li:hover { background: var(--creme-2); }
.suggestions .type {
  grid-row: 1 / span 2; align-self: center;
  font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--encre-3);
}
.suggestions .libelle { font-weight: 500; }
.suggestions .chiffre { grid-column: 3; grid-row: 1; white-space: nowrap; }
.suggestions .detail { grid-column: 2 / span 2; font-size: .74rem; }
.suggestions mark { background: var(--ambre-voile); color: var(--encre); padding: 0 1px; }

/* La colonne variation ne se casse jamais en deux lignes. */
td.cellule-var { white-space: nowrap; }

.legende-jauge { gap: 1.1rem; }
.legende-jauge .cle { display: inline-flex; align-items: center; gap: .35rem; }

/* ---- marge dans le temps ----
   Deux traits et la zone qui les sépare : le coût matière monte, la ligne de
   vente ne bouge pas, et la marge se lit dans l'écart. */

.aire-marge { fill: var(--ambre-voile); opacity: .55; }
.ligne-vente { stroke: var(--encre); stroke-width: 1.5; stroke-dasharray: 5 4; }
.trait-legende { display: inline-block; width: 22px; height: 0; border-top-width: 2px; }
.trait-legende.vente { border-top: 2px dashed var(--encre); }
.trait-legende.cout { border-top: 2px solid var(--ambre); }

/* ---- rappel de sauvegarde ----
   En haut de tous les écrans, parce que le seul moment où on pense à
   sauvegarder est celui où on regarde autre chose. */

.rappel {
  background: var(--ambre-voile); border-bottom: 1px solid var(--ambre-vif);
  padding: .6rem clamp(1rem, 4vw, 2.5rem); font-size: .84rem; color: var(--encre);
}
.rappel strong { font-weight: 600; }
.rappel a { margin-left: .4rem; }

/* Deux actions par ligne : enregistrer, retirer. */
.actions-ligne { display: flex; gap: .4rem; justify-content: flex-end; }

/* ══════════════════════════════════════════════════════════════════════════
   Téléphone en portrait

   Un tableau de sept colonnes ne se lit pas sur 390 pixels, et le faire
   défiler latéralement revient à cacher la moitié de l'information. En dessous
   de 700 px, chaque ligne devient donc une carte : la première cellule fait le
   titre, les autres s'écrivent « intitulé … valeur ». Les intitulés viennent
   du <thead>, recopiés par le script de base.html.
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 700px) {
  body { font-size: 15px; }
  main { padding-left: 1rem; padding-right: 1rem; }
  h1 { font-size: 1.5rem; }
  .titre-page p { max-width: none; }

  /* Les désignations du grossiste sont des blocs insécables de quarante
     caractères — « BAND.CHARL.BISCUI.CUI.37X6 BE PC-CT34P » — sans espace où
     couper. Sans ça, un seul libellé fait déborder toute la page. */
  h1, h2, h3, .designation, .code, td, .meta { overflow-wrap: anywhere; }

  /* ---- tableaux en cartes ---- */
  table.en-cartes { background: transparent; }
  table.en-cartes thead { display: none; }
  table.en-cartes, table.en-cartes tbody, table.en-cartes tr, table.en-cartes td {
    display: block; width: auto; min-width: 0;
  }
  table.en-cartes tr {
    background: var(--creme-clair); border: 1px solid var(--filet);
    padding: .7rem .8rem; margin-bottom: .6rem;
  }
  table.en-cartes tbody tr:hover { background: var(--creme-clair); }
  table.en-cartes td {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 1rem; padding: .3rem 0; border-bottom: 0; text-align: right;
  }
  table.en-cartes td::before {
    content: attr(data-intitule);
    flex: 0 1 auto; text-align: left;
    font-size: .66rem; font-weight: 600; letter-spacing: .1em;
    text-transform: uppercase; color: var(--encre-3);
  }
  table.en-cartes td:not([data-intitule])::before,
  table.en-cartes td[data-intitule=""]::before { display: none; }

  /* La première cellule porte le nom : elle fait le titre de la carte. */
  table.en-cartes td:first-child {
    display: block; text-align: left; font-size: 1rem;
    padding: 0 0 .5rem; margin-bottom: .35rem;
    border-bottom: 1px solid var(--filet);
  }
  table.en-cartes td:first-child::before { display: none; }
  /* Une cellule de vignette vide ne doit pas ouvrir la carte sur un blanc. */
  table.en-cartes td:empty { display: none; }
  table.en-cartes td.num, table.en-cartes td.rang { text-align: right; }

  /* La jauge a une largeur fixe en pixels : sur 390 px elle poussait la
     cellule hors de l'écran. Elle se réduit ici, l'axe reste au centre. */
  table.en-cartes td.cellule-var { flex-wrap: wrap; white-space: normal; }
  table.en-cartes .jauge { width: auto !important; flex: 1 1 90px; max-width: 140px; margin-right: .5rem; }
  table.en-cartes .jauge b { max-width: 50%; }
  .legende-jauge .jauge { flex: 0 0 44px; width: 44px !important; }

  /* ---- édition : intitulé au-dessus, champ sur toute la largeur ----
     Un libellé de vingt caractères et un champ de saisie ne tiennent pas côte
     à côte sur 390 px : « DÉSIGNATION » se coupait en deux et l'article
     n'était plus lisible dans son propre champ. */
  .tableau-large, .defilable { overflow-x: visible; }
  table.edition { min-width: 0; }
  table.edition td {
    display: block; text-align: left; padding: .45rem 0 0;
  }
  table.edition td::before { display: block; margin-bottom: .2rem; }
  table.edition input, table.edition select {
    width: 100% !important; min-width: 0; max-width: none;
  }
  table.edition input[type="checkbox"] { width: 20px !important; height: 20px; }
  table.edition .meta { white-space: normal; text-align: left; }
  table.edition td.depense, table.edition td.dernier-prix {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: .8rem; white-space: normal;
  }
  table.edition td.depense::before, table.edition td.dernier-prix::before {
    display: inline; margin: 0; flex: 0 0 auto;
  }
  /*  Sur téléphone la cellule devient « intitulé à gauche, valeur à droite ».
      Le prix et sa légende doivent donc compter pour un seul bloc, sinon ils
      se rangent côte à côte et le montant se coupe en deux. */
  .dernier-prix .bloc-prix { text-align: right; }
  .dernier-prix .meta { text-align: right; }
  .actions-ligne { justify-content: flex-start; margin-top: .5rem; }

  /* ---- confort tactile ---- */
  button, .bouton { padding: .7rem 1.1rem; }
  button.petit, .bouton.petit { padding: .5rem .8rem; }
  input, select { padding: .6rem .6rem; font-size: 16px; }  /* 16px : pas de zoom iOS */
  .sous-liens { gap: .9rem 1.1rem; }
  .onglets a { padding: .5rem .7rem; }

  /* ---- blocs et graphiques ---- */
  .une { grid-template-columns: 1fr; }
  .une-chiffre, .une-repere { padding: 1.1rem 1.2rem; }
  .chiffres { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .courbe { height: 170px; }
  .titre-section { gap: .5rem; }
  .barre-action { padding: .8rem 1rem; }
  .suggestions li { grid-template-columns: 1fr auto; }
  .suggestions .type { grid-row: auto; grid-column: 1 / span 2; }
  .rappel { font-size: .78rem; padding: .5rem .85rem; line-height: 1.45; }
}

@media (max-width: 420px) {
  .chiffres { grid-template-columns: 1fr 1fr; }
  .trio { gap: .9rem; }
  main { padding-left: .85rem; padding-right: .85rem; }
}

/* Le dernier prix dans le tableau d'édition : le prix facturé en évidence,
   le reste en dessous — c'est le premier qu'on cherche du regard. */
.dernier-prix { white-space: nowrap; }
.dernier-prix .valeur-prix { font-size: .9rem; color: var(--encre); }
.dernier-prix .meta { text-align: right; }

/* ---------------------------------------------------------------- portail

   Le seul écran du site qui ne montre pas la navigation. Rien d'autre à y
   faire qu'entrer un code : tout ce qui n'y sert pas en a été retiré. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

body.portail {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: 1.5rem; background: var(--creme);
}

.portail-carte {
  width: 100%; max-width: 340px; text-align: center;
  background: var(--creme-clair); border: 1px solid var(--filet);
  padding: 2.2rem 1.6rem 1.8rem;
}

.portail-logo { height: 54px; width: auto; margin: 0 auto 1.4rem; display: block; }
.portail-carte h1 { font-size: 1.15rem; margin: 0 0 1.2rem; }
.portail-carte p { margin: 0 0 1.2rem; }

.portail-carte form { display: flex; flex-direction: column; gap: .7rem; }
.portail-carte input {
  width: 100%; text-align: center; font-size: 1.05rem;
  /* Assez d'espace entre les caractères pour compter ce qu'on a tapé sans
     avoir à dévoiler le code. */
  letter-spacing: .18em; padding: .75rem .6rem;
}
.portail-carte button { width: 100%; padding: .8rem; }

.portail-erreur {
  margin: 0 0 1rem; padding: .6rem .7rem; font-size: .85rem;
  color: var(--ambre); border-left: 3px solid var(--ambre-vif);
  background: var(--ambre-voile); text-align: left;
}

/* Le lien de sortie : présent, jamais dans le chemin de l'œil. */
.sortie { display: flex; align-items: center; gap: .9rem; flex: 0 0 auto; }
.sortie a {
  font-size: .78rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--encre-3); text-decoration: none; white-space: nowrap;
}
.sortie a:hover { color: var(--encre); text-decoration: underline; }
@media (max-width: 700px) {
  .sortie { gap: .6rem; }
  .sortie a { font-size: .7rem; }
}

/*  Un formulaire en colonne. `.champs` ne convient pas ici : il fait grandir
    chaque champ pour remplir la hauteur, ce qui creusait des trous entre les
    trois cases. */
.formulaire-etroit { display: flex; flex-direction: column; gap: 1rem; max-width: 380px; }
.formulaire-etroit > div { display: flex; flex-direction: column; }
.formulaire-etroit button { align-self: flex-start; margin-top: .3rem; }
