/* Pergowood — interface d'administration. Aspect clair, sobre, accent vert Touschalets. */
:root {
  --fond: #f4f5f1; --surface: #ffffff; --encre: #1f261a; --gris: #5d6757; --ligne: #e1e6da; --ligne-forte: #c9d2bd;
  --vert: #8ab33f; --vert-fonce: #4a6b1c; --vert-pale: #f1f7e6;
  --ambre: #8a5a00; --ambre-pale: #fff4d9; --rouge: #a33a2a; --rouge-pale: #fbe8e4; --bleu: #2d5f8a; --bleu-pale: #e7f0f8;
  --rayon: 10px; --ombre: 0 1px 2px rgba(31,38,26,.06), 0 2px 8px rgba(31,38,26,.04);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--vert-fonce); }
h1 { font-size: 24px; line-height: 1.25; margin: 0; text-wrap: balance; }
h2 { font-size: 17px; margin: 0 0 10px; }
img { max-width: 100%; height: auto; }
.discret { color: var(--gris); }
.petit { font-size: 13px; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 3px solid var(--vert); outline-offset: 2px; }

/* En-tête */
.entete { background: var(--surface); border-bottom: 1px solid var(--ligne); position: sticky; top: 0; z-index: 5; }
.entete__in { max-width: 1280px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-left)); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.marque { font-weight: 700; text-decoration: none; color: var(--encre); display: inline-flex; align-items: center; gap: 8px; }
.marque__pastille { width: 14px; height: 14px; border-radius: 4px; background: var(--vert); }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--gris); padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.nav a:hover { background: var(--fond); color: var(--encre); }
.nav a[aria-current="page"] { background: var(--vert-pale); color: var(--vert-fonce); }
.compteur { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--vert); color: #1e2a0c; font-size: 12px; text-align: center; }
.deco { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.principal { max-width: 1280px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-left)) 48px; display: flex; flex-direction: column; gap: 18px; }
.pied { max-width: 1280px; margin: 0 auto; padding: 0 16px 24px; color: var(--gris); font-size: 12px; }

/* Éléments */
.carte { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 18px 20px; box-shadow: var(--ombre); }
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--ligne-forte);
  background: var(--surface); color: var(--encre); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.bouton:hover { border-color: var(--vert); }
.bouton--plein { background: var(--vert); border-color: var(--vert); color: #1e2a0c; }
.bouton--plein:hover { background: #7aa233; }
.bouton:disabled { opacity: .6; cursor: progress; }
.lien { background: none; border: 0; padding: 0; color: var(--vert-fonce); font: inherit; text-decoration: underline; cursor: pointer; }
.titre-page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { margin: 0; }
.meta { margin: 6px 0 0; color: var(--gris); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fil { margin: 0; font-size: 13px; color: var(--gris); }
.flash { padding: 10px 14px; border-radius: 8px; border: 1px solid; margin: 0; }
.flash ul { margin: 0; padding-left: 18px; }
.flash--ok { background: var(--vert-pale); border-color: #cfe2ad; color: #34501a; }
.flash--attention { background: var(--ambre-pale); border-color: #f0d79a; color: var(--ambre); }
.flash--erreur { background: var(--rouge-pale); border-color: #efc4bb; color: var(--rouge); }
.pastille { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--fond); color: var(--gris); border: 1px solid var(--ligne); }
.pastille--validee { background: var(--vert-pale); color: var(--vert-fonce); border-color: #cfe2ad; }
.pastille--envoyee { background: var(--bleu-pale); color: var(--bleu); border-color: #c8dbec; }
.pastille--modifiee { background: var(--ambre-pale); color: var(--ambre); border-color: #f0d79a; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--fond); color: var(--gris); border: 1px solid var(--ligne); }
.badge--ligne { background: #e3f3e6; color: #22673a; border-color: #bfe0c8; font-weight: 600; }
.ok { color: #22673a; } .ko { color: var(--rouge); }

/* Formulaires */
label { font-size: 14px; }
input:not([type="checkbox"]), select, textarea { font: inherit; color: var(--encre); background: var(--surface); border: 1px solid var(--ligne-forte); border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0; }
textarea { line-height: 1.5; resize: vertical; }
textarea[readonly] { background: var(--fond); color: var(--gris); }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--vert-fonce); vertical-align: -3px; }
.pile { display: flex; flex-direction: column; gap: 8px; }
.pile button { margin-top: 8px; }
.connexion { max-width: 420px; margin: 40px auto; display: flex; flex-direction: column; gap: 12px; }

/* Galerie */
.filtres { display: flex; flex-direction: column; gap: 10px; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { font: inherit; font-size: 14px; border: 1px solid var(--ligne-forte); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; color: var(--encre); }
.puce span { color: var(--gris); font-variant-numeric: tabular-nums; }
.puce[aria-pressed="true"] { background: var(--vert-pale); border-color: var(--vert); color: var(--vert-fonce); font-weight: 600; }
.filtres__ligne { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; }
.filtres__ligne label { display: flex; flex-direction: column; gap: 4px; color: var(--gris); font-size: 13px; }
.filtres__ligne select { width: auto; }
.recherche { flex: 1; min-width: 200px; }
.barre-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.barre-selection .bouton { margin-left: auto; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.vignette { position: relative; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre); }
.vignette:hover { border-color: var(--vert); }
.vignette__choix { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,.92); border-radius: 6px; padding: 4px 6px; z-index: 1; }
.vignette__lien { display: block; text-decoration: none; color: inherit; }
.vignette__lien img { display: block; width: 100%; aspect-ratio: 5 / 3; object-fit: cover; background: #eef0ec; }
.vignette__corps { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.vignette__ref { margin: 0; font-size: 12px; color: var(--gris); font-variant-numeric: tabular-nums; }
.vignette__nom { margin: 0; font-size: 15px; line-height: 1.3; }
.vignette__prix { margin: 0; font-weight: 700; color: var(--vert-fonce); }
.vignette__etat { display: flex; flex-wrap: wrap; gap: 4px; }
.vignette__comp { display: flex; align-items: center; gap: 8px; font-size: 12px; }
meter { width: 90px; height: 8px; }
.vide { text-align: center; color: var(--gris); padding: 30px; }

/* Onglets et fiche */
.onglets__barre { display: flex; gap: 2px; border-bottom: 1px solid var(--ligne); overflow-x: auto; }
.onglets__barre button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px; color: var(--gris); cursor: pointer; white-space: nowrap; }
.onglets__barre button[aria-selected="true"] { color: var(--encre); border-bottom-color: var(--vert); }
.panneau { background: var(--surface); border: 1px solid var(--ligne); border-top: 0; border-radius: 0 0 var(--rayon) var(--rayon); padding: 20px clamp(16px, 3vw, 28px); }
.apercu { display: flex; flex-direction: column; gap: 10px; }
.apercu__haut { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; margin-bottom: 18px; }
@media (max-width: 860px) { .apercu__haut { grid-template-columns: 1fr; } }
.apercu__images { display: flex; flex-direction: column; gap: 10px; }
.apercu__images img { border: 1px solid var(--ligne); border-radius: 8px; }
.apercu__achat { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.apercu__nom { font-size: 21px; font-weight: 700; margin: 0; }
.apercu__prix { font-size: 24px; font-weight: 700; color: var(--vert-fonce); margin: 0; }
.zone { margin: 8px 0 0; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--gris); border-bottom: 1px dashed var(--ligne-forte); padding-bottom: 3px; }
.plan { display: block; width: 100%; border: 1px solid var(--ligne); border-radius: 8px; margin-top: 10px; }
.historique { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.historique time { color: var(--gris); font-variant-numeric: tabular-nums; margin-right: 6px; }

/* Tableaux */
.defile { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th, .tableau td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--ligne); }
.tableau thead th { font-size: 12.5px; color: var(--gris); font-weight: 600; white-space: nowrap; }
.tableau tbody th { font-weight: 600; }
.tableau tr.groupe th { background: var(--fond); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gris); }
.tableau tr.attenue th, .tableau tr.attenue td { color: var(--gris); font-weight: 400; }
.etat { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.etat--confirme { color: #22673a; } .etat--a_confirmer { color: var(--ambre); } .etat--a_documenter { color: var(--rouge); }
.tableau--edition td { min-width: 150px; }
.tableau--edition td:first-of-type { min-width: 220px; }
.requis { color: var(--rouge); }
.tableau--diff tr.d-modifie td:nth-child(3) { background: var(--ambre-pale); }
.tableau--diff tr.d-ajoute td:nth-child(3) { background: var(--vert-pale); }
.tableau--diff tr.d-retire td { color: var(--gris); }
tr.diff > td { background: var(--fond); }

/* Édition */
.edition { display: flex; flex-direction: column; gap: 16px; }
.champs3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 18px; }
.champs3 label { display: flex; flex-direction: column; gap: 4px; }
.bloc-texte { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--ligne); }
.bloc-texte__tete { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }
.barre-enregistrer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--fond) 70%, rgba(244,245,241,0)); }

/* Envoi */
.envoi-pied { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 14px; }
.envoi-pied .bouton { margin-left: auto; }
progress { width: 180px; height: 10px; accent-color: var(--vert); }
.pagination { display: flex; gap: 10px; margin-top: 12px; }

@media (max-width: 700px) {
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; }
  .deco { margin-left: auto; }
}
@media (max-width: 600px) {
  h1 { font-size: 20px; }
  .deco .discret { display: none; }
  .barre-selection .bouton, .envoi-pied .bouton { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
