/* ============================================================
   ATELIER FABLE — Feuille de style du backoffice
   ============================================================ */
:root {
  --ivoire: #faf6ef; --creme: #f3ecdf; --brun: #2e2620; --brun-doux: #5c5046;
  --or: #b08d57; --or-clair: #d3b787; --blanc: #fffdf9;
  --vert: #4a6741; --rouge: #9c4a3a; --bleu: #44557e;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', 'Segoe UI', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--sans); font-weight: 300; background: var(--ivoire); color: var(--brun); font-size: 15px; line-height: 1.6; }
a { color: var(--or); text-decoration: none; }
a:hover { color: var(--brun); }
h1 { font-family: var(--serif); font-weight: 500; font-size: 1.9rem; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; margin: 1.4rem 0 .7rem; }

/* ---------- Page de connexion ---------- */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--brun); }
.boite-login { background: var(--ivoire); padding: 3rem 2.6rem; width: 380px; max-width: 92vw; }
.boite-login h1 { text-align: center; }
.boite-login .sous-titre { text-align: center; font-size: .75rem; text-transform: uppercase; letter-spacing: .26em; color: var(--or); margin-bottom: 1.8rem; }
.boite-login label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; margin: 1rem 0 .3rem; color: var(--brun-doux); }
.boite-login input { width: 100%; padding: .7rem .8rem; border: 1px solid rgba(176,141,87,.5); background: var(--blanc); font-family: var(--sans); }
.boite-login .btn { width: 100%; margin-top: 1.6rem; }
.retour-site { text-align: center; margin-top: 1.2rem; font-size: .85rem; }

/* ---------- Agencement général ---------- */
.agencement { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.lateral { background: var(--brun); color: var(--creme); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lateral-marque { padding: 1.4rem 1.5rem 1rem; border-bottom: 1px solid rgba(243,236,223,.12); }
.lateral-marque a { font-family: var(--serif); font-size: 1.4rem; color: var(--or-clair); }
.lateral-marque span { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .3em; color: rgba(243,236,223,.5); }
.lateral-marque-ligne { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.nav-tout { background: none; border: none; padding: 0; margin: 0; cursor: pointer; font-family: var(--sans); font-size: 1rem; line-height: 1; color: rgba(243,236,223,.4); transition: transform .2s ease, color .2s ease; }
.nav-tout:hover { color: var(--or-clair); }
.nav-tout.deplie { transform: rotate(180deg); color: rgba(243,236,223,.6); }
.lateral-nav { flex: 1; padding: .8rem 0; }
.nav-groupe { border-bottom: 1px solid rgba(243,236,223,.06); }
.nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: .24em; color: rgba(243,236,223,.4); padding: 1rem 1.5rem .55rem; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.nav-section::-webkit-details-marker { display: none; }
.nav-section::after { content: '⌄'; font-size: 1em; line-height: 1; opacity: .55; transition: transform .2s ease; }
.nav-groupe[open] > .nav-section { color: rgba(243,236,223,.6); }
.nav-groupe[open] > .nav-section::after { transform: rotate(180deg); }
.nav-section:hover { color: var(--or-clair); }
.lateral-nav a { display: block; padding: .42rem 1.5rem; color: var(--creme); font-size: .92rem; border-left: 3px solid transparent; }
.lateral-nav a:hover { background: rgba(176,141,87,.15); color: var(--or-clair); }
.lateral-nav a.actif { border-color: var(--or); background: rgba(176,141,87,.18); color: var(--or-clair); }
.lateral-nav .ico { display: inline-block; width: 1.4em; opacity: .75; }
.nav-sous-menu { background: rgba(0,0,0,.14); padding: .2rem 0 .35rem; }
.lateral-nav .nav-sous-menu a { padding: .32rem 1.5rem .32rem 3.1rem; font-size: .84rem; color: rgba(243,236,223,.72); }
.lateral-nav .nav-sous-menu a::before { content: '·'; margin-left: -.9rem; margin-right: .5rem; opacity: .5; }
.lateral-nav .nav-sous-menu a:hover { color: var(--or-clair); }
.lateral-nav .nav-sous-menu a.actif { border-color: var(--or); background: rgba(176,141,87,.22); color: var(--or-clair); }
.lateral-pied { padding: 1.1rem 1.5rem; border-top: 1px solid rgba(243,236,223,.12); font-size: .8rem; display: grid; gap: .25rem; }
.lateral-pied span { color: rgba(243,236,223,.6); }
.contenu-admin { padding: 2rem 2.4rem 4rem; }

/* ---------- Composants ---------- */
.entete-module { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.4rem; }
.compteur { font-family: var(--sans); font-size: .85rem; background: var(--creme); color: var(--brun-doux); padding: .15rem .6rem; border-radius: 1em; vertical-align: middle; }
.compteur-somme { position: relative; background: rgba(176,141,87,.16); color: var(--or); }
.compteur-somme:has(.infobulle) { cursor: help; }
.infobulle { position: absolute; top: calc(100% + .55rem); left: 50%; transform: translateX(-50%); z-index: 30; padding: .6rem .85rem; background: var(--brun); color: var(--creme); font-family: var(--sans); font-size: .82rem; font-weight: 300; line-height: 1.5; text-align: left; white-space: nowrap; box-shadow: 0 8px 24px rgba(46,38,32,.28); opacity: 0; visibility: hidden; transition: opacity .15s ease; }
.infobulle::before { content: ''; position: absolute; bottom: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-bottom-color: var(--brun); }
.compteur-somme:hover .infobulle, .compteur-somme:focus .infobulle { opacity: 1; visibility: visible; }
.infobulle-ligne { display: flex; justify-content: space-between; gap: 1.8rem; }
.infobulle-ligne + .infobulle-ligne { margin-top: .2rem; }
.infobulle-ligne small { color: rgba(243,236,223,.55); }
.actions-entete { display: flex; gap: .8rem; align-items: center; }
.recherche { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.recherche input { padding: .55rem .9rem; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); font-family: var(--sans); min-width: 220px; }
.recherche select { padding: .55rem .7rem; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); font-family: var(--sans); color: var(--brun); cursor: pointer; }
.intro-module { color: var(--brun-doux); margin-bottom: 1.2rem; max-width: 760px; }
.btn { display: inline-block; padding: .55rem 1.3rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; border: 1px solid var(--or); color: var(--or); background: transparent; cursor: pointer; font-family: var(--sans); }
.btn:hover { background: var(--or); color: var(--blanc); }
.btn-or { background: var(--or); color: var(--blanc); }
.btn-or:hover { background: var(--brun); border-color: var(--brun); }
.btn-petit { padding: .25rem .7rem; font-size: .72rem; }
.carte { background: var(--blanc); border: 1px solid rgba(176,141,87,.25); padding: 1.4rem 1.6rem; margin-bottom: 1.4rem; overflow-x: auto; }

/* ---------- Tableaux ---------- */
.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--brun-doux); padding: .5rem .7rem; border-bottom: 2px solid var(--creme); }
.tableau td { padding: .55rem .7rem; border-bottom: 1px solid var(--creme); vertical-align: middle; }
.tableau tr:hover td { background: var(--ivoire); }
.tableau .col-actions { text-align: right; white-space: nowrap; }
.tableau .col-actions a { margin-left: .55rem; font-size: 1rem; }
.tableau .col-actions .suppr { color: var(--rouge); }
.vide { text-align: center; color: var(--brun-doux); padding: 2rem !important; }
.mini-vignette { width: 44px; height: 44px; object-fit: cover; }

/* Ligne de total en pied de tableau */
.tableau .ligne-total td { border-top: 2px solid var(--creme); border-bottom: none; background: var(--ivoire); }
.tableau .ligne-total:hover td { background: var(--ivoire); }
.titre-sous-liste { font-size: 1rem; margin: 1.6rem 0 .6rem; color: var(--brun-doux); }
.carte > .titre-sous-liste:first-child { margin-top: 0; }

/* Entêtes triables */
.tableau th .tri { color: inherit; text-decoration: none; display: inline-flex; gap: .25em; align-items: center; white-space: nowrap; }
.tableau th .tri:hover { color: var(--or); }
.tableau th.tri-actif { color: var(--or); }
/* Tri sans rechargement (livre de compte) : un bouton, mais rendu comme le lien */
.tableau th button.tri { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
/* Filtre posé dans l'en-tête d'une colonne : lisible, donc hors de la casse et
   de l'interlettrage des titres de colonnes. */
.tableau th .filtre-colonne { display: block; margin-top: .3rem; max-width: 100%; padding: .15rem .3rem;
  font-family: var(--sans); font-size: .72rem; font-weight: 300; text-transform: none; letter-spacing: 0;
  color: var(--brun-doux); background: var(--blanc); border: 1px solid rgba(176,141,87,.4); cursor: pointer; }
.tableau th .filtre-colonne:focus { outline: 1px solid var(--or); }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: 1.2rem; font-family: var(--sans); font-size: .85rem; }
.pagination .page { padding: .35rem .7rem; border: 1px solid rgba(176,141,87,.4); color: var(--brun-doux); text-decoration: none; border-radius: .2rem; }
.pagination a.page:hover { border-color: var(--or); color: var(--or); }
.pagination .page-actif { background: var(--or); color: var(--blanc); border-color: var(--or); font-weight: 600; }
.pagination .page.inactif { opacity: .4; pointer-events: none; }
.pagination button.page { background: none; font: inherit; cursor: pointer; }
.pagination .pages-liste { display: flex; flex-wrap: wrap; gap: .35rem; }
.pagination .page-ellipse { padding: .35rem .2rem; color: var(--brun-doux); }
.pagination .page-info { display: flex; align-items: center; gap: .5rem; margin-left: auto; color: var(--brun-doux); }
.pagination .par-page { display: flex; align-items: center; gap: .35rem; }
.pagination .par-page select { padding: .2rem 1.3rem .2rem .4rem; font-size: .85rem; }

/* ---------- Filtres en cases, au-dessus d'une liste ---------- */
.filtres-cases {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem;
  margin-bottom: 1.1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--creme);
  font-family: var(--sans); font-size: .85rem;
}
.filtres-cases .filtres-libelle {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--brun-doux); margin-right: .25rem;
}
.filtres-cases .case-filtre {
  display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .85rem;
  border: 1px solid rgba(176,141,87,.3); border-radius: 2rem;
  background: var(--blanc); color: var(--brun); cursor: pointer; user-select: none;
}
.filtres-cases .case-filtre:hover { border-color: var(--or); }
.filtres-cases .case-filtre.actif { border-color: var(--or); background: rgba(176,141,87,.14); color: var(--or); }
.filtres-cases .case-filtre input { width: auto; margin: 0; cursor: pointer; }
.filtres-cases .filtres-raz { margin-left: .3rem; color: var(--brun-doux); font-size: .82rem; text-decoration: none; }
.filtres-cases .filtres-raz:hover { color: var(--or); }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; padding: .18rem .6rem; border-radius: 2px; }
.badge-vert { background: #e8efe3; color: var(--vert); }
.badge-rouge { background: #f3e2dd; color: var(--rouge); }
.badge-jaune { background: #f0ead9; color: #8a6d2f; }
.badge-bleu { background: #e5e8ef; color: var(--bleu); }
.badge-gris { background: var(--creme); color: var(--brun-doux); }

/* ---------- Formulaires ---------- */
.formulaire { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.6rem; }
.champ label { display: block; font-size: .76rem; text-transform: uppercase; letter-spacing: .14em; color: var(--brun-doux); margin-bottom: .3rem; }
.champ input[type=text], .champ input[type=number], .champ input[type=date], .champ input[type=email],
.champ input[type=password], .champ input[type=datetime-local], .champ select, .champ textarea {
  width: 100%; padding: .6rem .8rem; border: 1px solid rgba(176,141,87,.4);
  background: var(--blanc); font-family: var(--sans); font-size: .92rem; color: var(--brun);
}
.champ textarea { resize: vertical; }
.champ small { color: var(--brun-doux); font-size: .78rem; }
.champ-large, .champ-textarea { grid-column: 1 / -1; }
.apercu-image { max-width: 160px; margin-top: .5rem; border: 1px solid var(--creme); }
.apercu-images { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.apercu-images:empty { display: none; }
.apercu-images img { height: 150px; width: auto; max-width: 320px; object-fit: cover; border: 1px solid var(--creme); border-radius: 4px; }
.apercu-document { display: inline-block; margin-top: .5rem; font-size: .84rem; color: var(--or); word-break: break-all; }
.apercu-document:hover { text-decoration: underline; }

/* Formulaire en onglets : c'est le panneau visible qui porte la grille à deux
   colonnes, le <form> n'étant plus qu'un empilement de panneaux. */
.formulaire-onglets { display: block; }
.onglets-formulaire button {
  padding: .55rem 1.2rem; font-family: var(--sans); font-size: .85rem; color: var(--brun-doux);
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer;
}
.onglets-formulaire button:hover { color: var(--brun); }
.onglets-formulaire button.actif { color: var(--or); border-color: var(--or); }
.panneau-onglet { display: none; grid-template-columns: 1fr 1fr; gap: 1rem 1.6rem; }
.panneau-onglet.actif { display: grid; }
.formulaire-onglets .barre-enregistrer {
  margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--creme);
}

/* Bandeau de synthèse des coûts (fiche pièce) */
.conso-synthese {
  border: 1px solid rgba(176,141,87,.35); border-radius: 6px;
  padding: 1rem 1.1rem; background: rgba(243,236,223,.4);
}
.conso-synthese .synthese-ligne {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.4rem; margin-bottom: .6rem;
}
.conso-synthese .synthese-bloc { display: inline-flex; flex-direction: column; gap: .15rem; }
.conso-synthese .synthese-libelle {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--brun-doux);
}
.conso-synthese .synthese-bloc strong { font-size: 1.05rem; font-weight: 500; }
.conso-synthese .synthese-resultat strong { color: var(--or); font-size: 1.25rem; }
.conso-synthese .synthese-op { color: var(--brun-doux); font-size: 1.1rem; align-self: flex-end; }

/* Cases à cocher réunies en une seule ligne d'options */
.champ-cases .cases-groupe { display: flex; flex-wrap: wrap; gap: .5rem .6rem; }
.champ-cases .case-option {
  display: inline-flex; align-items: center; gap: .45rem; margin: 0;
  padding: .35rem .8rem; border: 1px solid rgba(176,141,87,.3); border-radius: 2rem;
  background: var(--blanc); cursor: pointer; user-select: none;
  font-size: .85rem; text-transform: none; letter-spacing: normal; color: var(--brun);
}
.champ-cases .case-option:hover { border-color: var(--or); }
.champ-cases .case-option input { width: auto; margin: 0; }

/* ---------- Flash ---------- */
.flash { padding: .8rem 1.2rem; margin-bottom: 1.2rem; font-size: .9rem; }
.flash-ok { background: #e8efe3; color: #41502f; border-left: 3px solid #7a9468; }
.flash-warn { background: #f0ead9; color: #6d5526; border-left: 3px solid #c0a052; }
.flash-erreur { background: #f3e2dd; color: #6d3326; border-left: 3px solid var(--rouge); }

/* ---------- Tableau de bord ---------- */
.grille-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.2rem; margin-bottom: 1.6rem; }
.stat { background: var(--blanc); border: 1px solid rgba(176,141,87,.25); padding: 1.2rem 1.4rem; }
.stat .valeur { font-family: var(--serif); font-size: 2.1rem; color: var(--or); line-height: 1.1; }
.stat .libelle { font-size: .74rem; text-transform: uppercase; letter-spacing: .16em; color: var(--brun-doux); }
.stat.alerte { border-left: 4px solid var(--rouge); }
.stat.alerte .valeur { color: var(--rouge); }
/* Les trois colonnes sont portées par la liste, pas par la ligne : les libellés
   prennent la place qu'il leur faut (une seule ligne chacun) tout en restant
   alignés d'une ligne à l'autre, et la barre se contente du reste. */
.barres { display: grid; grid-template-columns: max-content minmax(48px, 1fr) max-content; gap: .45rem .8rem; align-items: center; font-size: .85rem; }
.barre-ligne { display: contents; }
.barre-libelle { white-space: nowrap; }
.barres > .vide { grid-column: 1 / -1; }
.barre-fond { background: var(--creme); height: 14px; }
.barre-rempli { background: var(--or); height: 100%; }

/* ---------- Onglets ---------- */
.onglets { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 2px solid var(--creme); margin-bottom: 1.4rem; }
.onglets a { padding: .55rem 1.2rem; font-size: .85rem; color: var(--brun-doux); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.onglets a.actif { color: var(--or); border-color: var(--or); font-weight: 400; }

/* ---------- Grille médiathèque ---------- */
.grille-medias { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.media-item { background: var(--blanc); border: 1px solid rgba(176,141,87,.25); padding: .5rem; font-size: .76rem; }
.media-item img { width: 100%; aspect-ratio: 1; object-fit: cover; margin-bottom: .4rem; }
.media-item code { display: block; word-break: break-all; color: var(--brun-doux); font-size: .68rem; }
.dossier-titre { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; margin: 1.6rem 0 .8rem; }

/* ---------- Médiathèque : outils d'en-tête & bascule de vue ---------- */
.entete-outils { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.vue-bascule { display: inline-flex; border: 1px solid var(--or); }
.vue-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .9rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--or); background: transparent; }
.vue-btn + .vue-btn { border-left: 1px solid rgba(176,141,87,.4); }
.vue-btn:hover { background: var(--creme); color: var(--or); }
.vue-btn.actif { background: var(--or); color: var(--blanc); }
.vue-btn svg { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.vue-btn.actif svg rect { fill: currentColor; stroke: none; }

/* ---------- Médiathèque : gestionnaire de fichiers (vues détails et fiches) ---------- */
.gf { display: grid; grid-template-columns: 250px 1fr; gap: 1.2rem; align-items: start; }
.gf-arbo { background: var(--blanc); border: 1px solid rgba(176,141,87,.25); padding: .6rem 0; }
.gf-arbo-titre { display: flex; align-items: center; gap: .4rem; font-size: .66rem; text-transform: uppercase; letter-spacing: .2em; color: var(--brun-doux); padding: .3rem 1rem .5rem; }
.gf-tout { margin-left: auto; background: none; border: none; padding: 0; cursor: pointer; font-family: var(--sans); font-size: .95rem; line-height: 1; color: var(--brun-doux); opacity: .55; transition: transform .2s ease, opacity .2s ease, color .2s ease; }
.gf-tout:hover { opacity: 1; color: var(--or); }
.gf-tout.deplie { transform: rotate(180deg); opacity: .9; }

/* Une branche = sa ligne (chevron + lien) puis, éventuellement, ses enfants.
   Le retrait est porté par --prof (profondeur), posé en style en ligne. */
.gf-ligne { display: flex; align-items: center; border-left: 3px solid transparent; padding-left: calc(var(--prof, 0) * .8rem); }
.gf-ligne:hover { background: var(--creme); }
.gf-ligne.actif { background: rgba(176,141,87,.15); border-color: var(--or); }
.gf-branche.ferme > .gf-enfants { display: none; }
.gf-chevron { flex: none; width: 1.15rem; height: 1.15rem; display: flex; align-items: center; justify-content: center; background: none; border: none; padding: 0; margin: 0; cursor: pointer; font-family: var(--sans); font-size: .6rem; line-height: 1; color: var(--brun-doux); transition: transform .15s ease, color .15s ease; }
.gf-chevron:hover { color: var(--or); }
.gf-branche.ferme > .gf-ligne > .gf-chevron { transform: rotate(-90deg); }
.gf-chevron-vide { cursor: default; }
.gf-noeud { display: flex; align-items: center; gap: .45rem; flex: 1; min-width: 0; padding: .35rem .8rem .35rem .15rem; font-size: .85rem; color: var(--brun); }
.gf-noeud:hover { color: var(--brun); }
.gf-noeud .gf-ico { font-size: .8em; opacity: .8; }
.gf-noeud .gf-nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-noeud .gf-nb { font-size: .7rem; color: var(--brun-doux); background: var(--creme); border-radius: 1em; padding: 0 .5rem; }
.gf-ligne.actif .gf-nb { background: var(--blanc); }
/* Branche ouverte : nombre de fichiers du dossier seul.
   Branche repliée : total, sous-dossiers masqués compris. */
.gf-nb-total { display: none; }
.gf-branche.ferme > .gf-ligne .gf-nb-direct { display: none; }
.gf-branche.ferme > .gf-ligne .gf-nb-total { display: inline; font-style: italic; }
.gf-panneau { min-width: 0; }
.gf-panneau .dossier-titre:first-child { margin-top: 0; }
.gf-mkdir { display: flex; gap: .3rem; padding: .6rem .8rem 0; margin-top: .4rem; border-top: 1px solid var(--creme); }
.gf-mkdir input { flex: 1; min-width: 0; padding: .35rem .5rem; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); font-family: var(--sans); font-size: .8rem; }
.gf-mkdir button { padding: .35rem .6rem; font-size: 1rem; line-height: 1; }
.gf-liste { background: var(--blanc); border: 1px solid rgba(176,141,87,.25); min-width: 0; overflow-x: auto; }
.gf-fil { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; padding: .8rem 1rem; border-bottom: 1px solid var(--creme); }
.gf-fil strong { font-family: var(--serif); font-size: 1.1rem; font-weight: 500; }
.gf-rmdir { margin-left: auto; font-size: .76rem; color: var(--rouge); }
.gf-rmdir:hover { color: var(--rouge); text-decoration: underline; }
.gf-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.gf-table th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: var(--brun-doux); font-weight: 400; padding: .5rem .8rem; border-bottom: 1px solid var(--creme); }
.gf-table td { padding: .5rem .8rem; border-bottom: 1px solid var(--creme); vertical-align: middle; }
.gf-table tr:hover td { background: var(--ivoire); }
.gf-vignette { width: 48px; }
.gf-vignette img { width: 40px; height: 40px; object-fit: cover; display: block; }
.gf-vignette .gf-doc { font-size: 1.6rem; }
.gf-nomfichier a { color: var(--brun); }
.gf-nomfichier a:hover { color: var(--or); }
.gf-nomfichier small { display: block; color: var(--brun-doux); font-size: .72rem; }
.gf-table code { color: var(--brun-doux); font-size: .72rem; cursor: pointer; word-break: break-all; }
.gf-actions { white-space: nowrap; }
.gf-actions { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; }
.gf-deplacer { display: inline; }
.gf-deplacer select { font-family: var(--sans); font-size: .72rem; padding: .22rem .3rem; max-width: 140px; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); color: var(--brun-doux); cursor: pointer; }
.gf-deplacer select:hover { border-color: var(--or); }
.gf-actions .suppr { color: var(--rouge); font-size: 1rem; }
.gf-upload { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .9rem 1rem; border-top: 1px solid var(--creme); background: var(--ivoire); }
.gf-liste .pagination { margin-top: 0; padding: .8rem 1rem; }

/* ---------- Sélecteur de médias (champs photo des formulaires) ---------- */
.ligne-media { display: flex; gap: .6rem; align-items: flex-start; }
.ligne-media input, .ligne-media textarea { flex: 1; }
.btn-parcourir {
  display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap;
  padding: .6rem 1.1rem; font-family: var(--sans); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--or); background: transparent; border: 1px solid var(--or);
  cursor: pointer; transition: all .25s;
}
.btn-parcourir:hover { background: var(--or); color: var(--blanc); }
.btn-parcourir svg {
  width: 1.05em; height: 1.05em; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.sm-dialog { border: 1px solid var(--or); background: var(--ivoire); padding: 0; width: min(880px, 92vw); }
.sm-dialog::backdrop { background: rgba(46, 38, 32, .55); }
.sm-entete { display: flex; gap: .8rem; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--creme); background: var(--blanc); }
.sm-entete strong { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; flex: 1; }
.sm-entete input, .sm-entete select { padding: .45rem .8rem; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); font-family: var(--sans); }
.sm-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .8rem; padding: 1.2rem; overflow-y: auto; max-height: 56vh; }
.sm-item { margin: 0; cursor: pointer; background: var(--blanc); border: 2px solid transparent; outline: 1px solid rgba(176,141,87,.25); padding: .35rem; }
.sm-item:hover { outline-color: var(--or); }
.sm-item.choisi { border-color: var(--or); background: var(--creme); }
.sm-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.sm-item .sm-doc { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; font-size: 2.4rem; background: var(--creme); color: var(--brun-doux); }
.sm-item figcaption { font-size: .68rem; color: var(--brun-doux); word-break: break-all; padding-top: .25rem; }
.sm-grille .vide { grid-column: 1 / -1; }
.sm-pagination { display: flex; gap: .8rem; align-items: center; justify-content: center; padding: .7rem 1.2rem; border-top: 1px solid var(--creme); background: var(--blanc); font-family: var(--sans); font-size: .82rem; }
.sm-pagination:empty { display: none; }
.sm-pagination .sm-pginfo { color: var(--brun-doux); }
.sm-pagination button[disabled] { opacity: .4; cursor: default; }
.sm-pied { display: flex; gap: 1rem; align-items: center; justify-content: flex-end; padding: .9rem 1.2rem; border-top: 1px solid var(--creme); background: var(--blanc); }
.sm-pied small { color: var(--brun-doux); margin-right: auto; }

/* ---------- Fenêtre « Ajouter à la médiathèque » ---------- */
.sm-dialog-etroit { width: min(480px, 92vw); }
.sm-ajout { display: grid; gap: .3rem; padding: 1.2rem; }
.sm-ajout label { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--brun-doux); }
.sm-ajout label + input { margin-bottom: .7rem; }
.sm-ajout input[type=text] { width: 100%; padding: .55rem .8rem; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); font-family: var(--sans); font-size: .9rem; color: var(--brun); }
.sm-ajout input[type=file] { font-family: var(--sans); font-size: .84rem; color: var(--brun-doux); }
.sm-ajout-msg { font-size: .84rem; color: var(--brun-doux); margin: 0; }
.sm-ajout-msg:empty { display: none; }
.sm-ajout-erreur { color: var(--rouge); }

/* ---------- Fenêtre « Xylothèque » (formulaire matière) ---------- */
.xy-rappel { margin-top: .4rem; justify-self: start; }
.xy-liste { display: grid; gap: .5rem; padding: 1.2rem; overflow-y: auto; max-height: 56vh; }
.xy-item {
  display: grid; grid-template-columns: 130px 1fr auto; gap: .9rem; align-items: center;
  width: 100%; text-align: left; padding: .5rem .7rem; cursor: pointer;
  background: var(--blanc); border: 1px solid rgba(176,141,87,.25); font-family: var(--sans);
}
.xy-item:hover { border-color: var(--or); background: var(--creme); }
/* Vignette large : le veinage d'une planche se lit mieux en bandeau qu'en carré. */
.xy-item img { width: 130px; height: 54px; object-fit: cover; display: block; }
.xy-vide { display: flex; align-items: center; justify-content: center; width: 130px; height: 54px; background: var(--creme); font-size: 1.5rem; }
.xy-texte { display: grid; gap: .1rem; min-width: 0; }
.xy-texte strong { font-family: var(--serif); font-size: 1.02rem; font-weight: 500; color: var(--brun); }
.xy-texte em { font-size: .78rem; color: var(--brun-doux); }
.xy-texte small { font-size: .72rem; color: var(--brun-doux); }
.xy-liste .vide { color: var(--brun-doux); text-align: center; padding: 2rem; }

/* ---------- Réapprovisionnement (bandeau d'alerte du stock) ----------
   L'icône PDF vit dans le bandeau : quand le stock repasse au-dessus des
   seuils, le bandeau disparaît et l'icône avec lui. */
.flash-reappro { display: flex; align-items: center; gap: 1rem; }
.flash-reappro span { flex: 1; }
.reappro-ico {
  flex: none; display: inline-flex; padding: .25rem; cursor: pointer;
  background: transparent; border: 1px solid currentColor; color: #8a6d2f; transition: all .25s;
}
.reappro-ico:hover { background: #8a6d2f; color: var(--blanc); }
.reappro-ico svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.reappro-ico svg text { fill: currentColor; stroke: none; font-family: var(--sans); font-size: 6.4px; font-weight: 500; letter-spacing: .2px; }

.reappro-fenetre { width: min(1080px, 96vw); }
.reappro-corps { padding: 1.4rem 1.5rem; overflow-y: auto; max-height: 72vh; background: var(--blanc); }

.reappro-entete { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.reappro-entete h2 { margin: 0; font-size: 1.5rem; font-weight: 500; }
.reappro-entete p { font-size: .84rem; color: var(--brun-doux); margin: .2rem 0 0; }
.reappro-logo { max-height: 62px; max-width: 200px; margin-bottom: .5rem; }
.reappro-titre { text-align: right; }
.reappro-titre p:first-child { font-family: var(--serif); font-size: 1.15rem; color: var(--brun); letter-spacing: .06em; line-height: 1.3; }

.reappro-groupe { margin-bottom: 2.2rem; break-inside: avoid; }
.reappro-fournisseur { display: grid; gap: .15rem; padding: .7rem .9rem; background: var(--ivoire); border-left: 3px solid var(--or); }
.reappro-fournisseur strong { font-family: var(--serif); font-size: 1.12rem; font-weight: 500; }
.reappro-fournisseur small { font-size: .78rem; color: var(--brun-doux); }
.reappro-tableau { margin-top: .5rem; }
.reappro-tableau th { white-space: nowrap; }
.reappro-tableau td small { display: block; font-size: .72rem; color: var(--brun-doux); }
.reappro-tableau .reappro-ref { font-family: var(--sans); font-size: .82rem; white-space: nowrap; }
/* Case laissée vide : la quantité se décide au moment de commander. */
.reappro-saisie { display: block; height: 1.5rem; min-width: 5rem; margin: 0 auto; border-bottom: 1px solid rgba(176,141,87,.55); }
.reappro-lien { margin-top: .5rem; font-size: .82rem; }
.reappro-doc .vide { color: var(--brun-doux); padding: 2rem 0; }

@media print {
  .reappro-doc { border: none; padding: 0; }
  .reappro-tableau tr:hover td { background: none; }
}

/* ---------- Éditeur de texte riche (js/editeur.js) ---------- */
.edt { position: relative; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); }
.edt-outils {
  display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-items: center;
  padding: .45rem .6rem; border-bottom: 1px solid var(--creme);
  background: var(--ivoire); position: sticky; top: 0; z-index: 3;
}
.edt-groupe { display: inline-flex; gap: .15rem; }
.edt-groupe + .edt-groupe { border-left: 1px solid rgba(176,141,87,.3); padding-left: .7rem; }
.edt-btn {
  min-width: 2rem; height: 2rem; padding: 0 .4rem; border: 1px solid transparent;
  background: transparent; color: var(--brun); font-family: var(--sans); font-size: .95rem;
  cursor: pointer; line-height: 1;
}
.edt-btn:hover { border-color: var(--or); color: var(--or); }
.edt-btn.actif { background: var(--creme); border-color: var(--or); color: var(--or); }
.edt-bloc { padding: .3rem .5rem; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); font-family: var(--sans); font-size: .85rem; cursor: pointer; }
.edt-zone {
  min-height: 320px; max-height: 70vh; overflow-y: auto; padding: 1.2rem 1.4rem;
  outline: none; font-size: 1rem; line-height: 1.65;
}
/* Typographie de la zone : miroir de .contenu-billet du site vitrine */
.edt-zone p { margin-bottom: 1.1rem; }
.edt-zone h2, .edt-zone h3 { font-family: var(--serif); font-weight: 500; margin: 1.4rem 0 .7rem; }
.edt-zone h2 { font-size: 1.55rem; }
.edt-zone h3 { font-size: 1.25rem; color: var(--brun-doux); }
.edt-zone ul, .edt-zone ol { margin: 0 0 1.1rem 1.5rem; }
.edt-zone blockquote {
  border-left: 3px solid var(--or); padding: .3rem 0 .3rem 1.2rem; margin: 0 0 1.1rem;
  font-family: var(--serif); font-size: 1.12rem; font-style: italic; color: var(--brun-doux);
}
.edt-zone hr { border: none; border-top: 1px solid var(--or-clair); margin: 1.6rem auto; width: 50%; }
.edt-zone a { text-decoration: underline; }
.edt-zone img { max-width: 100%; height: auto; display: block; margin: 1.2rem auto; cursor: pointer; }
.edt-zone img.img-gauche { float: left; max-width: 45%; margin: .3rem 1.4rem .8rem 0; }
.edt-zone img.img-droite { float: right; max-width: 45%; margin: .3rem 0 .8rem 1.4rem; }
.edt-zone img.img-pleine { width: 100%; }
.edt-zone .al-centre { text-align: center; }
.edt-zone .al-droite { text-align: right; }
.edt-zone img.edt-img-active { outline: 3px solid var(--or); outline-offset: 2px; }
.edt-palette {
  position: absolute; z-index: 4; display: flex; gap: .15rem;
  background: var(--brun); padding: .25rem; box-shadow: 0 3px 12px rgba(46,38,32,.35);
}
.edt-palette button {
  min-width: 1.9rem; height: 1.9rem; border: none; background: transparent;
  color: var(--creme); font-size: .95rem; cursor: pointer; line-height: 1;
}
.edt-palette button:hover { background: rgba(176,141,87,.4); color: var(--blanc); }
.edt-palette button { white-space: nowrap; padding: 0 .45rem; font-size: .8rem; }

/* Carte vidéo YouTube dans la zone d'édition (aperçu ; rendu public : style.css) */
.edt-zone .bloc-video {
  margin: 1.4rem auto; padding: .5rem; background: var(--blanc);
  border: 1px solid var(--or-clair); border-radius: 6px;
}
.edt-zone .bloc-video figcaption {
  font-family: var(--serif); font-size: 1.15rem; color: var(--brun);
  text-align: center; margin: .1rem 0 .5rem;
}
.edt-zone .bloc-video > a {
  position: relative; display: block; aspect-ratio: 16 / 9;
  overflow: hidden; border-radius: 4px; background: var(--brun); cursor: default;
}
.edt-zone .bloc-video > a img {
  width: 100%; height: 100%; object-fit: cover; margin: 0; cursor: default; float: none;
}
.edt-zone .bloc-video > a::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 42px; pointer-events: none;
  background: no-repeat center / contain
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 48"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.63 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="%23f00"/><path d="M45 24 27 14v20z" fill="%23fff"/></svg>');
}

/* Tableaux dans la zone d'édition */
.edt-zone table { border-collapse: collapse; width: 100%; margin: 0 0 1.1rem; }
.edt-zone th, .edt-zone td { border: 1px solid rgba(176,141,87,.45); padding: .45rem .7rem; vertical-align: top; text-align: left; }
.edt-zone th { background: var(--creme); font-family: var(--serif); font-weight: 500; font-size: 1.05rem; }
.edt-zone td p, .edt-zone th p { margin-bottom: 0; }

/* Menus déroulants de la barre d'outils (couleurs, tableau) */
.edt-menu { position: absolute; z-index: 5; background: var(--blanc); border: 1px solid var(--or); padding: .7rem; box-shadow: 0 4px 14px rgba(46,38,32,.25); }
.edt-menu-titre { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--brun-doux); margin-bottom: .5rem; white-space: nowrap; }
.edt-nuancier { display: grid; grid-template-columns: repeat(4, 1.5rem); gap: .35rem; }
.edt-nuancier button { width: 1.5rem; height: 1.5rem; border: 1px solid rgba(46,38,32,.2); cursor: pointer; padding: 0; }
.edt-nuancier button:hover { outline: 2px solid var(--or); }
.edt-nuancier .edt-sans-fond { background: linear-gradient(to top right, #fff 44%, var(--rouge) 47%, var(--rouge) 53%, #fff 56%); }
.edt-pipette { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; font-size: .8rem; color: var(--brun-doux); cursor: pointer; }
.edt-pipette input { width: 2.2rem; height: 1.6rem; padding: 0; border: 1px solid rgba(176,141,87,.4); background: none; cursor: pointer; }
.edt-grille-tableau { display: grid; gap: 3px; }
.edt-grille-tableau span { width: 1.1rem; height: 1.1rem; border: 1px solid rgba(176,141,87,.5); background: var(--blanc); cursor: pointer; }
.edt-grille-tableau span.sur { background: var(--or-clair); }

/* Icônes des boutons couleur / surlignage */
.edt-ico-couleur { border-bottom: 3px solid var(--rouge); padding: 0 .1rem; line-height: 1.1; display: inline-block; }
.edt-ico-fond { background: #f0ead9; padding: 0 .25rem; line-height: 1.2; display: inline-block; }

/* ---------- Impression (factures / certificats) ---------- */
@media print {
  .lateral, .entete-module .actions-entete, .non-imprimable { display: none !important; }
  .agencement { display: block; }
  .contenu-admin { padding: 0; }
  body { background: #fff; }
}

/* ---------- Partage sur les réseaux : cases du formulaire ----------
   Cadre autour de l'ensemble, cases alignées sur une seule ligne.
   Sélecteurs assez spécifiques pour battre « .champ label » (0,2,1),
   qui sinon force display:block + majuscules sur ces <label>. */
.champ-reseaux {
  border: 1px solid rgba(176,141,87,.35); border-radius: 6px;
  padding: 1rem 1.1rem; background: rgba(243,236,223,.4);
}
.champ-reseaux > small { display: block; margin-bottom: .75rem; }
.champ-reseaux .reseaux-cases {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
}
.champ-reseaux .reseaux-cases .reseau-case {
  display: inline-flex; align-items: center; gap: .4rem; margin: 0;
  padding: .32rem .75rem; border: 1px solid rgba(176,141,87,.3); border-radius: 2rem;
  background: var(--blanc); cursor: pointer; user-select: none;
  font-size: .85rem; font-weight: 400; text-transform: none; letter-spacing: normal;
  color: var(--brun); line-height: 1;
}
.champ-reseaux .reseaux-cases .reseau-case:hover { border-color: var(--or); }
.champ-reseaux .reseaux-cases .reseau-case--tous { background: var(--creme); font-weight: 500; }
.champ-reseaux .reseau-case input { width: auto; margin: 0; }
.champ-reseaux .reseau-case-ico { display: inline-flex; }
.champ-reseaux .reseau-case-ico svg { width: 1rem; height: 1rem; display: block; color: var(--brun-doux); }

/* ---------- Écran de partage assisté ---------- */
.carte-partage { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 1.6rem; align-items: start; }
.partage-apercu { display: flex; flex-direction: column; gap: .6rem; }
.partage-photo { width: 100%; border-radius: 4px; border: 1px solid rgba(176,141,87,.25); }
.partage-texte { display: flex; flex-direction: column; gap: .6rem; }
.partage-texte label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brun-doux); }
.partage-texte textarea {
  width: 100%; font-family: var(--sans); font-size: .9rem; line-height: 1.5;
  padding: .7rem .8rem; border: 1px solid rgba(176,141,87,.35); border-radius: 4px; resize: vertical;
}
.partage-copie { font-size: .82rem; color: var(--vert); }
.partage-reseaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.partage-reseau { display: flex; gap: .8rem; padding: .9rem 1rem; border: 1px solid rgba(176,141,87,.25); border-radius: 6px; background: var(--blanc); }
.partage-reseau-ico svg { width: 1.7rem; height: 1.7rem; display: block; color: var(--brun); }
.partage-reseau-corps { display: flex; flex-direction: column; gap: .45rem; }
.partage-reseau-corps small { color: var(--brun-doux); line-height: 1.4; }
.partage-reseau-corps .btn { align-self: flex-start; }

/* ---------- Page « L'Atelier » : plan des visuels ----------
   Les emplacements sont dessinés à leurs vraies proportions, et la mosaïque
   reprend le motif exact du site (grande case 2×2, case haute, case large) :
   on règle la page en la voyant, pas en remplissant des champs. */
.pa-intro { color: var(--brun-doux); max-width: 70ch; margin-bottom: 1.4rem; }
.pa-titre { font-size: 1.15rem; margin: 0 0 1rem; }
.pa-aide { display: block; color: var(--brun-doux); font-size: .78rem; margin-top: .5rem; }
.pa-barre { position: sticky; bottom: 0; padding: 1rem 0; background: linear-gradient(transparent, var(--ivoire) 40%); }

/* Un emplacement : cadre cliquable, photo en fond, étiquette et actions. */
.pa-emplacement {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--creme);
  border: 1px dashed rgba(176,141,87,.55);
  transition: border-color .25s, box-shadow .25s;
}
.pa-emplacement:hover, .pa-emplacement:focus-visible {
  border-color: var(--or); box-shadow: 0 6px 20px -10px rgba(46,38,32,.35); outline: none;
}
.pa-emplacement.est-rempli { border-style: solid; border-color: rgba(176,141,87,.5); }
.pa-emplacement img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pa-emplacement img[hidden] { display: none; }
/* Photo simplement suggérée (repli automatique du site) : on la montre en
   retrait pour qu'on ne la confonde pas avec un choix assumé. */
.pa-emplacement img.est-repli { opacity: .4; filter: grayscale(.5); }

.pa-hero { aspect-ratio: 16/5; }
.pa-portrait { aspect-ratio: 4/5; }

.pa-vide {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .16em; color: var(--brun-doux);
  pointer-events: none; text-align: center; padding: .5rem;
}
.pa-emplacement.est-rempli .pa-vide { display: none; }

.pa-etiquette {
  position: absolute; left: .5rem; top: .5rem;
  background: rgba(46,38,32,.78); color: var(--ivoire);
  font-size: .66rem; text-transform: uppercase; letter-spacing: .14em;
  padding: .2rem .55rem; pointer-events: none;
}
.pa-effacer {
  position: absolute; right: .4rem; top: .4rem;
  width: 1.5rem; height: 1.5rem; line-height: 1;
  background: rgba(46,38,32,.78); color: var(--ivoire);
  border: 0; cursor: pointer; font-size: .8rem;
  opacity: 0; transition: opacity .2s;
}
.pa-emplacement.est-rempli:hover .pa-effacer { opacity: 1; }

.pa-triptyque { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }

/* La mosaïque : le motif du site, en miniature. */
.pa-mosaique {
  display: grid; grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 8vw; gap: .6rem;
}
.pa-case:nth-child(1) { grid-column: span 2; grid-row: span 2; }
.pa-case:nth-child(4) { grid-row: span 2; }
.pa-case:nth-child(6) { grid-column: span 2; }
.pa-case { cursor: grab; }
.pa-case.est-en-vol { opacity: .35; cursor: grabbing; }
.pa-case.est-survolee { border-color: var(--or); border-style: solid; box-shadow: inset 0 0 0 2px var(--or); }

.pa-badge {
  position: absolute; left: .4rem; top: .4rem; max-width: calc(100% - .8rem);
  background: rgba(46,38,32,.78); color: var(--ivoire);
  font-size: .64rem; text-transform: uppercase; letter-spacing: .1em;
  padding: .18rem .5rem; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pa-badge--piece { background: rgba(176,141,87,.92); }

/* Les actions n'apparaissent qu'au survol : la grille doit d'abord se lire
   comme une mise en page, pas comme un formulaire. */
.pa-actions {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: .3rem; justify-content: center; flex-wrap: wrap;
  padding: .4rem; background: rgba(250,246,239,.94);
  opacity: 0; transform: translateY(100%);
  transition: opacity .25s, transform .25s;
}
.pa-case:hover .pa-actions, .pa-case:focus-within .pa-actions { opacity: 1; transform: none; }
.pa-actions .btn { padding: .2rem .55rem; font-size: .64rem; letter-spacing: .08em; }

#pa-pieces .sm-item { position: relative; }
#pa-pieces .sm-item figcaption small { color: var(--brun-doux); }
/* Statut de la pièce sur la vignette : la page montre un savoir-faire, une
   pièce vendue y a sa place — mais on doit savoir ce qu'on choisit. */
.pa-statut {
  position: absolute; left: .5rem; top: .5rem;
  font-size: .6rem; text-transform: uppercase; letter-spacing: .1em;
  padding: .12rem .4rem; background: var(--brun); color: var(--ivoire);
}
.pa-statut--disponible { background: #4a6741; }
.pa-statut--vendu { background: #8a4b4b; }
.pa-statut--reserve { background: #8a6d2f; }
.pa-statut--offert { background: #5c5046; }

/* ---------- Carrousel d'accueil ----------
   Six cases de même forme, au ratio des cartes de l'accueil (3/2), sur deux
   rangs de trois : on retrouve la grille du site tel qu'elle se lit. Le
   chrome des cases (cadre, badge, actions, glisser-déposer) est celui du plan
   de la page « L'Atelier » — .pa-emplacement et .pa-case. */
.ca-grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.ca-case { aspect-ratio: 3 / 2; }
/* Le rang compte : c'est l'ordre d'entrée des cartes dans l'animation de pile. */
.ca-rang {
  position: absolute; right: .4rem; bottom: .4rem;
  min-width: 1.4rem; text-align: center;
  background: rgba(46,38,32,.6); color: var(--ivoire);
  font-size: .68rem; padding: .1rem .35rem; pointer-events: none;
}
#ca-pieces .sm-item { position: relative; }
#ca-pieces .sm-item figcaption small { color: var(--brun-doux); }

/* ---------- Aperçu des photos d'une pièce (œil de la colonne Actions) ---------- */
.oeil {
  display: inline-block; vertical-align: -.2em; width: 1.05em; height: 1.05em;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
/* Pièce sans photo : l'œil reste en place, éteint — la colonne garde son
   alignement et les pièces à photographier se repèrent d'un coup d'œil. */
.tableau .col-actions .oeil-vide { margin-left: .55rem; color: var(--brun-doux); opacity: .4; }
.ap-dialog { width: min(960px, 94vw); }
.ap-scene { display: flex; align-items: center; gap: .6rem; padding: 1rem; background: var(--ivoire); }
.ap-scene a { flex: 1; min-width: 0; display: block; text-align: center; }
.ap-scene img { max-width: 100%; max-height: 62vh; object-fit: contain; background: var(--blanc); }
.ap-nav {
  flex: 0 0 auto; width: 2.4rem; height: 2.4rem; font-size: 1.6rem; line-height: 1;
  color: var(--or); background: var(--blanc); border: 1px solid var(--or); cursor: pointer;
}
.ap-nav:hover { background: var(--or); color: var(--blanc); }
.ap-vignettes {
  display: flex; gap: .5rem; overflow-x: auto;
  padding: .7rem 1.2rem; border-top: 1px solid var(--creme); background: var(--blanc);
}
.ap-vignettes img { width: 62px; height: 62px; object-fit: cover; cursor: pointer; outline: 1px solid rgba(176,141,87,.25); }
.ap-vignettes img.actif { outline: 2px solid var(--or); }
/* Une seule photo : ni flèches ni pellicule, il n'y a rien à faire défiler. */
.ap-dialog.ap-solo .ap-nav, .ap-dialog.ap-solo .ap-vignettes { display: none; }

/* ---------- Pièces d'une collection (œil de la colonne Actions) ---------- */
.col-dialog { width: min(1040px, 95vw); }
.col-corps { max-height: 74vh; overflow-y: auto; padding: 1rem 1.2rem; background: var(--ivoire); }
/* Couverture + description en tête : on sait de quelle collection on parle
   avant de lire le tableau. */
.col-resume { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .9rem; }
.col-couverture { flex: 0 0 auto; width: 120px; height: 120px; object-fit: cover; border: 1px solid var(--creme); }
.col-description { margin: 0 0 .4rem; color: var(--brun-doux); line-height: 1.5; }
.col-chiffres { margin: 0; font-size: .86rem; }
.col-corps .tableau { width: 100%; }
.col-vignette { width: 56px; }
.col-vignette .mini-vignette { display: block; }
.col-sans-photo { color: var(--brun-doux); opacity: .5; }
.col-prix { text-align: right; white-space: nowrap; }

/* ---------- Duplication d'une session de travail ---------- */
.tf-barre { display: flex; gap: .8rem; align-items: center; margin: .5rem 0 .6rem; }
.tf-barre input[type=search] { flex: 1; padding: .5rem .8rem; border: 1px solid rgba(176,141,87,.4); background: var(--blanc); font-family: var(--sans); }
.tf-compte { font-size: .78rem; color: var(--brun-doux); white-space: nowrap; }
/* Liste déroulante plutôt que grille : une pièce par ligne se pointe sans hésiter. */
.tf-pieces {
  display: grid; gap: .1rem; max-height: 34vh; overflow-y: auto;
  padding: .5rem .7rem; border: 1px solid rgba(176,141,87,.35); background: var(--blanc);
}
.tf-pieces .case-option { padding: .25rem 0; }
.tf-erreur { margin: .45rem 0 0; font-size: .82rem; color: var(--rouge); }
.tf-erreur:empty { display: none; }
.tf-reprise { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.tf-liste { display: grid; gap: .4rem; padding: 1rem 1.2rem; overflow-y: auto; max-height: 56vh; }
.tf-item {
  display: grid; grid-template-columns: 7rem 1fr auto; gap: .9rem; align-items: center;
  padding: .5rem .8rem; text-decoration: none; color: var(--brun);
  background: var(--blanc); border: 1px solid rgba(176,141,87,.25);
}
.tf-item:hover { border-color: var(--or); background: var(--creme); }
.tf-item-date { font-size: .8rem; color: var(--brun-doux); }
.tf-item-texte { display: grid; gap: .1rem; min-width: 0; }
.tf-item-texte strong { font-family: var(--serif); font-size: 1rem; font-weight: 500; }
.tf-item-texte strong:empty::before { content: 'Session sans libellé'; color: var(--brun-doux); }
.tf-item-texte small { font-size: .76rem; color: var(--brun-doux); }
.tf-item-duree { font-size: .82rem; color: var(--or); white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .ca-grille { grid-template-columns: repeat(2, 1fr); }
  .agencement { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; }
  .formulaire { grid-template-columns: 1fr; }
  .contenu-admin { padding: 1.2rem; }
  .gf { grid-template-columns: 1fr; }
  .carte-partage { grid-template-columns: 1fr; }
  .pa-triptyque { grid-template-columns: 1fr; }
  .pa-mosaique { grid-auto-rows: 22vw; }
  /* Sur petit écran le glisser-déposer n'est pas praticable : les boutons
     d'action restent visibles en permanence. */
  .pa-actions { opacity: 1; transform: none; }
}
