:root {
  --conifere: #1E3A2B; --sapin: #2C5A40; --feuille: #9CC59A; --sauge: #E6EEE3;
  --papier: #FBFCF9; --encre: #17211B; --gris: #5E6B63; --trait: #D8E0D5;
  --rouge: #B3261E; --rouge-pale: #FBEAE8; --stock: #2F7A3C;
  --rayon: 10px;
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  color: var(--encre); background: var(--papier);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--papier); font-size: 16px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #E0A526; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- en-tête et recherche */
.tete { background: var(--conifere); color: #fff; position: sticky; top: 0; z-index: 5; }
.tete-int { max-width: 1280px; margin: 0 auto; padding: 14px 16px 16px; }
.ligne1 { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.marque { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.marque img { width: 28px; height: 28px; }
.compte { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .92rem; color: #D9E6D7; }
.lien { background: none; border: 0; color: #fff; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px; }
.barre { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.champ { flex: 1 1 420px; position: relative; }
.champ input { width: 100%; height: 56px; border-radius: var(--rayon); border: 0; padding: 0 52px 0 18px; font-size: 1.2rem;
  background: #fff; color: var(--encre); }
.champ input::placeholder { color: #7D8A82; }
.effacer { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border: 0; border-radius: 8px; background: var(--sauge);
  cursor: pointer; font-size: 1.3rem; line-height: 1; color: var(--conifere); }
.filtre { display: flex; align-items: center; gap: 8px; padding: 0 6px; color: #E4EDE2; user-select: none; }
.filtre input { width: 20px; height: 20px; accent-color: var(--feuille); }

/* ---- contenu */
main { max-width: 1280px; margin: 0 auto; padding: 18px 16px 60px; }
.etat { color: var(--gris); margin: 4px 0 16px; min-height: 1.4em; }
.accueil { max-width: 62ch; margin: 28px 0; }
.accueil h1 { font-size: 1.6rem; margin: 0 0 8px; color: var(--conifere); }
.accueil p { margin: 0 0 18px; }
.dates { border-collapse: collapse; font-size: .95rem; }
.dates td { padding: 4px 18px 4px 0; border-bottom: 1px solid var(--trait); }
.dates td:last-child { color: var(--gris); font-variant-numeric: tabular-nums; }

.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 16px; }
.carte { background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; display: flex; flex-direction: column;
  cursor: pointer; text-align: left; padding: 0; }
.carte:hover { border-color: var(--sapin); }
.carte.douteux { border: 2px solid var(--rouge); }
.vignette { aspect-ratio: 1; background: #fff; display: grid; place-items: center; border-bottom: 1px solid var(--trait); position: relative; }
.vignette img { width: 100%; height: 100%; object-fit: contain; }
.sans-photo { color: #9AA59E; font-size: .9rem; }
.nbph { position: absolute; right: 6px; bottom: 6px; background: rgba(30,58,43,.85); color: #fff; font-size: .75rem; padding: 1px 7px; border-radius: 20px; }
.texte { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.desc { font-weight: 700; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sous { color: var(--gris); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avertir { color: var(--rouge); font-size: .8rem; font-weight: 700; }
.disc { color: var(--gris); font-size: .8rem; font-style: italic; }

/* bande d'inventaire : l'élément signature */
.bande { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--trait); }
.case { text-align: center; padding: 5px 0 6px; font-variant-numeric: tabular-nums; border-right: 1px solid var(--trait); }
.case:last-child { border-right: 0; }
.case b { display: block; font-size: .68rem; color: var(--gris); font-weight: 400; }
.case span { font-size: .9rem; font-weight: 700; }
.case.nd span { color: #A7B0AA; font-weight: 400; font-size: .78rem; }
.case.zero span { color: #8B958F; font-weight: 400; }
.case.plus span { color: var(--stock); }
.case.neg span { color: var(--rouge); }
.case.moi { background: var(--sauge); }
.case.moi b { color: var(--conifere); font-weight: 700; }

.plus-btn { display: block; margin: 26px auto 0; height: 48px; padding: 0 28px; border-radius: var(--rayon); border: 1px solid var(--sapin);
  background: #fff; color: var(--conifere); font-weight: 700; cursor: pointer; }

/* ---- fiche */
dialog { border: 0; padding: 0; width: min(980px, 100vw); max-height: 100dvh; border-radius: 14px; background: var(--papier); color: var(--encre); }
dialog::backdrop { background: rgba(23,33,27,.55); }
.fiche { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.galerie { background: #fff; padding: 16px; border-right: 1px solid var(--trait); }
.grande { aspect-ratio: 1; display: grid; place-items: center; }
.grande img { max-width: 100%; max-height: 100%; object-fit: contain; }
.vignettes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.vignettes button { width: 58px; height: 58px; padding: 2px; border: 1px solid var(--trait); border-radius: 6px; background: #fff; cursor: pointer; }
.vignettes button[aria-current="true"] { border: 2px solid var(--sapin); }
.vignettes img { width: 100%; height: 100%; object-fit: contain; }
.infos { padding: 20px 22px 24px; overflow: auto; max-height: 100dvh; }
.infos h2 { font-size: 1.3rem; margin: 0 0 4px; padding-right: 40px; line-height: 1.25; }
.infos .en { color: var(--gris); margin: 0 0 14px; }
.fermer { position: absolute; top: 10px; right: 10px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--sauge);
  font-size: 1.4rem; cursor: pointer; color: var(--conifere); }
.note { background: var(--rouge-pale); border-left: 4px solid var(--rouge); padding: 10px 12px; margin: 0 0 16px; font-size: .92rem; }
.note strong { color: var(--rouge); display: block; }
dl.codes { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 18px; }
dl.codes dt { color: var(--gris); }
dl.codes dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; word-break: break-all; }
table.inv { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.inv th { text-align: left; font-weight: 400; color: var(--gris); font-size: .85rem; border-bottom: 2px solid var(--conifere); padding: 6px 6px; }
table.inv td { padding: 9px 6px; border-bottom: 1px solid var(--trait); vertical-align: top; }
table.inv td.n { text-align: right; }
table.inv tr.moi td { background: var(--sauge); }
table.inv .nd { color: #A7B0AA; }
table.inv small { display: block; color: var(--gris); font-size: .75rem; }

/* ---- connexion */
.connexion { min-height: 100dvh; display: grid; place-items: center; background: var(--conifere); padding: 16px; }
.boite { background: var(--papier); border-radius: 14px; padding: 28px 26px; width: min(400px, 100%); }
.boite h1 { font-size: 1.35rem; margin: 10px 0 4px; color: var(--conifere); }
.boite p { margin: 0 0 20px; color: var(--gris); }
.boite label { display: block; font-weight: 700; margin: 14px 0 6px; }
.boite select, .boite input { width: 100%; height: 50px; border: 1px solid #BCC7BE; border-radius: 8px; padding: 0 12px; background: #fff; }
.boite button { margin-top: 22px; width: 100%; height: 52px; border: 0; border-radius: 8px; background: var(--sapin); color: #fff; font-weight: 700; cursor: pointer; }
.erreur { color: var(--rouge); margin-top: 12px; min-height: 1.4em; font-weight: 700; }

@media (max-width: 760px) {
  .fiche { grid-template-columns: 1fr; }
  .galerie { border-right: 0; border-bottom: 1px solid var(--trait); }
  dialog { border-radius: 0; height: 100dvh; max-width: 100vw; margin: 0; }
  .infos { max-height: none; }
  .grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .champ input { height: 52px; font-size: 1.1rem; }
  .compte span { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: monte .18s ease-out; }
  @keyframes monte { from { transform: translateY(14px); opacity: 0; } }
}
.champ input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
table.inv td:nth-child(2) { white-space: nowrap; }
@media (max-width: 760px) { table.inv th, table.inv td { padding-left: 4px; padding-right: 4px; } }
