/* ==========================================================================
   V2-36 · les écrans des modèles d'actes et du choix des documents, 2026-09-28.
   Othmane : « éditer un template, c'est pris par la moitié de la page ;
   déposer un template pareil ; choisir quel document générer pareil ».

   Chargée en dernier. Une règle de la refonte (`refonte.css`, lot 4) fait de
   tout formulaire posé dans la page une carte de 680 pixels : les écrans d'ici
   posent leur contenu dans `.ac-ecran`, qu'elle n'atteint pas, et l'éditeur
   la défait. Les couleurs sont celles de la charte, rien en dur.
   ========================================================================== */

/* ---- 1. L'éditeur d'un modèle et le texte d'un acte : toute la largeur ---- */
main.page.editeur-modele > form {
  max-width: none !important; width: 100% !important; padding: 0 !important; border: 0 !important;
  border-radius: 0 !important; background: transparent !important; display: block !important; gap: 0 !important;
}
:root { --ac-bureau: #EAEAE5; --ac-feuille: 794px; }

/* L'éditeur d'un modèle se pose comme le texte d'un acte : la feuille au
   format d'une page, centrée sur le bureau gris, le panneau des champs à
   droite. La barre tient en deux rangées : l'objet et les gestes, puis les
   réglages. */
main.page.editeur-modele:has(.ed-plan) { background: var(--ac-bureau); }
main.page.editeur-modele .ed-plan .ed-zone { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0 80px; }
main.page.editeur-modele .ed-plan .ed-zone > * { width: var(--ac-feuille); max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; box-sizing: border-box; }
main.page.editeur-modele .ed-plan .ed-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--mz-encre-douce); }
main.page.editeur-modele .ed-plan .ed-note.ed-bilan { background: var(--mz-surface); border: 1px solid var(--mz-trait); border-radius: 12px; padding: 12px 14px; color: var(--mz-encre); }
main.page.editeur-modele .ed-plan .ed-feuille {
  min-height: 1123px; padding: 80px 76px 96px; border: 0; border-radius: 2px; background: #fff;
  box-shadow: 0 1px 3px rgba(28, 26, 22, .08), 0 22px 48px -24px rgba(28, 26, 22, .32);
  transition: box-shadow .2s var(--fondu);
}
main.page.editeur-modele .ed-plan .ed-feuille:focus-within { box-shadow: 0 0 0 2px var(--mz-vert-trait), 0 22px 48px -24px rgba(28, 26, 22, .32); }
main.page.editeur-modele .ed-plan .ed-zone > p:has(#ajout-para) { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
main.page.editeur-modele .ed-panneau { box-shadow: 0 1px 3px rgba(28, 26, 22, .06), 0 18px 40px -28px rgba(28, 26, 22, .28); border-radius: 14px; }

/* La barre : l'objet et les gestes en haut, les réglages dessous. */
main.page.editeur-modele:has(.ed-plan) .ed-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-top: 12px; padding-bottom: 12px; }
main.page.editeur-modele:has(.ed-plan) .ed-barre > * { order: 4; }
main.page.editeur-modele:has(.ed-plan) .ed-barre > :is(.ed-retour, .ed-version, .ed-portee-acte),
main.page.editeur-modele:has(.ed-plan) .ed-barre > label.ed-reglage:has(#nom) { order: 0; }
main.page.editeur-modele:has(.ed-plan) .ed-barre > .ed-espace { order: 1; }
main.page.editeur-modele:has(.ed-plan) .ed-barre > :is(button, .btn, span.ed-version:last-child) { order: 2; }
main.page.editeur-modele:has(.ed-plan) .ed-barre::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
main.page.editeur-modele:has(.ed-plan) .ed-barre #nom { width: 340px !important; max-width: 40vw; font-size: 16px !important; border-color: transparent; background: transparent; padding-left: 8px; transition: border-color .15s, background .15s; }
main.page.editeur-modele:has(.ed-plan) .ed-barre #nom:is(:hover, :focus) { border-color: var(--mz-trait-fort); background: var(--mz-surface); }
main.page.editeur-modele:has(.ed-plan) .ed-barre .ed-reglage { font-size: 12.5px; color: var(--mz-encre-tenue); gap: 8px; }
main.page.editeur-modele:has(.ed-plan) .ed-barre .ed-reglage :is(input[type=text], select) { width: 200px; height: 34px; font-size: 13.5px; box-sizing: border-box; }
main.page.editeur-modele:has(.ed-plan) .ed-barre .ed-reglage + .ed-reglage { padding-left: 14px; border-left: 1px solid var(--mz-trait); }

/* Ce qui arrive se pose en fondu, jamais plus de quatre dixièmes. */
main.page.editeur-modele .ed-feuille { animation: ac-monte .36s var(--fondu) backwards; }
main.page.editeur-modele .ed-panneau { animation: ac-glisse .36s var(--fondu) .06s backwards; }
@keyframes ac-monte { from { opacity: 0; transform: translateY(10px); } }
@keyframes ac-glisse { from { opacity: 0; transform: translateX(14px); } }
@media (prefers-reduced-motion: reduce) { main.page.editeur-modele :is(.ed-feuille, .ed-panneau) { animation: none; } }
@media (max-width: 900px) {
  main.page.editeur-modele .ed-plan .ed-feuille { padding: 36px 24px; min-height: 0; }
  main.page.editeur-modele:has(.ed-plan) .ed-barre #nom { width: 100% !important; max-width: none; }
  main.page.editeur-modele:has(.ed-plan) .ed-barre .ed-reglage + .ed-reglage { padding-left: 0; border-left: 0; }
}
main.page.editeur-modele:has(.ed-plan) .ed-panneau { top: 148px; margin-top: 24px; height: calc(100dvh - 172px); }

/* ---- 2. Les écrans du choix : générer un acte, les documents, le dépôt ----
   Le contenu vit dans `.ac-ecran`. Un seul cadre par liste, une ligne par
   document ; le résumé et le geste à droite, qui restent en vue. */
main.page.actes-v2 { gap: 0; }
.ac-ecran { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding-top: 22px; animation: ac-fondu .24s ease both; }
@keyframes ac-fondu { from { opacity: 0; } }
.ac-ecran > .ariane { margin: 0; }
.ac-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ac-tete h1 { font-size: var(--t-titre); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 0 6px 0 0; }
.ac-tete p { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--mz-encre-douce); }

.ac-choix { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin: 0; }
.ac-liste {
  background: var(--mz-surface); border: 1px solid var(--mz-trait); border-radius: 14px;
  padding: 6px 0 10px; min-width: 0; display: flex; flex-direction: column;
}
.ac-cadre-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 18px; flex-wrap: wrap; padding: 14px 20px 10px; }
.ac-cadre-tete h2 { margin: 0; font-size: 12px; font-weight: 600; color: var(--mz-encre-tenue); }
.ac-legende { font-size: 13px; color: var(--mz-encre-tenue); line-height: 1.45; max-width: 62ch; }
.ac-sous-titre { font-size: 13px; color: var(--mz-encre-tenue); padding: 0 20px 6px; }
.ac-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--mz-encre-douce); }
.ac-liste > .ac-note { padding: 12px 20px 4px; }
.ac-vide { margin: 0; padding: 18px 20px; font-size: 14px; color: var(--mz-encre-douce); }

/* La recherche, pour le document libre. */
.ac-filtre { display: flex; align-items: center; gap: 8px; margin: 0 20px 10px; padding: 0 12px; height: 40px;
  border: 1px solid var(--mz-trait-fort); border-radius: 10px; background: var(--mz-surface); color: var(--mz-encre-tenue);
  transition: border-color .15s, box-shadow .15s; }
.ac-filtre:focus-within { border-color: var(--mz-vert); box-shadow: 0 0 0 3px var(--mz-vert-clair); color: var(--mz-vert); }
.ac-filtre input { flex: 1; border: 0 !important; outline: 0; background: transparent; font: inherit; font-size: 14px; color: var(--mz-encre); height: 100%; padding: 0; box-shadow: none !important; max-width: none !important; }

/* Une ligne par document. La case à gauche, le nom, puis ses puces. */
.ac-docs { display: flex; flex-direction: column; margin: 0; padding: 0; border: 0; border-radius: 0 !important; min-width: 0; }
.ac-docs:disabled { opacity: .45; }
.ac-docs:disabled .ac-doc { cursor: default; }
.ac-doc {
  position: relative; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 48px;
  padding: 10px 20px; border-top: 1px solid var(--mz-trait); cursor: pointer; font-size: 14.5px; color: var(--mz-encre);
  transition: background .15s ease; animation: ac-monte .3s var(--fondu) backwards; animation-delay: calc(min(var(--i, 0), 14) * 18ms);
}
.ac-doc:hover { background: var(--mz-survol-doux); }
main.page.actes-v2 .ac-doc, main.page.actes-v2 .ac-doc-nom { font-weight: 400; }
main.page.actes-v2 .ac-doc input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--mz-vert); cursor: inherit; }
.ac-doc-nom { flex: 1 1 240px; min-width: 0; line-height: 1.4; }
.ac-doc:has(input:checked:not([value=""])) { background: var(--mz-vert-clair); }
.ac-doc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--mz-vert); transform: scaleY(0); transition: transform .2s var(--fondu); }
.ac-doc:has(input:checked:not([value=""]))::before { transform: scaleY(1); }
.ac-doc:has(input:focus-visible) { outline: 2px solid var(--mz-vert); outline-offset: -2px; }
.ac-doc[hidden], .ac-famille[hidden] { display: none; }

/* Un acte à plusieurs cas : un seul au choix, les cas en retrait. */
.ac-famille { margin: 0; padding: 0; border: 0; border-top: 1px solid var(--mz-trait); min-width: 0; animation: ac-monte .3s var(--fondu) backwards; animation-delay: calc(min(var(--i, 0), 14) * 18ms); }
.ac-famille-tete { display: flex; align-items: baseline; gap: 8px; padding: 12px 20px 4px; font-size: 14.5px; font-weight: 600; color: var(--mz-encre); }
.ac-famille-tete small { font-size: 12px; font-weight: 400; color: var(--mz-encre-tenue); }
.ac-famille .ac-option { border-top: 0; min-height: 42px; padding-left: 44px; font-size: 14px; }
.ac-famille .ac-aucun .ac-doc-nom { color: var(--mz-encre-tenue); }

/* L'approbation : deux façons de faire, en cartes. */
.ac-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; padding: 0 20px 14px; }
.ac-mode {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--mz-trait-fort); border-radius: 12px;
  background: var(--mz-surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
.ac-mode:hover { border-color: var(--mz-encre-tenue); }
.ac-mode input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--mz-vert); }
.ac-mode > span { display: flex; flex-direction: column; gap: 3px; }
.ac-mode b { font-size: 14.5px; font-weight: 600; }
.ac-mode small { font-size: 13px; font-weight: 400; line-height: 1.45; color: var(--mz-encre-douce); }
.ac-mode:has(input:checked) { border-color: var(--mz-vert); background: var(--mz-vert-clair); box-shadow: 0 0 0 1px var(--mz-vert) inset; }
.ac-liste .documents-a-la-carte { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--mz-trait); }
.ac-liste .documents-a-la-carte > .ac-sous-titre { grid-column: 1 / -1; margin: 0; padding: 12px 20px 8px; }
.ac-liste .documents-a-la-carte .ac-doc:nth-of-type(odd) { border-right: 1px solid var(--mz-trait); }

/* Le résumé : il suit la page, le geste reste en vue. */
.ac-resume {
  position: sticky; top: 20px; display: flex; flex-direction: column; gap: 0; min-width: 0;
  background: var(--mz-surface); border: 1px solid var(--mz-trait); border-radius: 14px; overflow: hidden;
  animation: ac-glisse .36s var(--fondu) .05s backwards;
}
.ac-bloc { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; }
.ac-bloc + .ac-bloc, .ac-gestes + .ac-bloc { border-top: 1px solid var(--mz-trait); }
.ac-bloc h3 { margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--mz-encre-tenue); }
.ac-bloc h3:first-child { margin-top: 0; }
.ac-bloc ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.65; color: var(--mz-encre); }
.ac-compte { margin: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--mz-encre-douce); }
.ac-nombre { font-size: 30px; font-weight: 600; letter-spacing: -.02em; color: var(--mz-encre); font-variant-numeric: tabular-nums; display: inline-block; }
.ac-nombre:empty { display: none; }
.ac-compte.ac-zero .ac-nombre { color: var(--mz-encre-tenue); }
.ac-compte.ac-zero [data-compte-mot] { color: var(--mz-ambre); }
.ac-eclat { animation: ac-eclat .38s var(--fondu); }
@keyframes ac-eclat { 0% { transform: scale(1); } 35% { transform: scale(1.18); color: var(--mz-vert); } 100% { transform: scale(1); } }
.ac-champ { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--mz-encre-douce); }
.ac-champ input { width: 100%; box-sizing: border-box; height: 38px; font-size: 14px; }
.ac-gestes { display: flex; gap: 8px; padding: 0 20px 18px; }
.ac-gestes .btn-plein { flex: 1; }

@keyframes ac-monte { from { opacity: 0; transform: translateY(6px); } }
@keyframes ac-glisse { from { opacity: 0; transform: translateX(14px); } }
@media (prefers-reduced-motion: reduce) { .ac-ecran, .ac-doc, .ac-famille, .ac-resume, .ac-eclat { animation: none !important; } }
@media (max-width: 1080px) {
  .ac-choix { grid-template-columns: minmax(0, 1fr); }
  .ac-resume { position: static; }
  .ac-liste .documents-a-la-carte { grid-template-columns: minmax(0, 1fr); }
  .ac-liste .documents-a-la-carte .ac-doc { border-right: 0 !important; border-top: 1px solid var(--mz-trait) !important; }
}

/* « Générer un acte » : la liste des actes, dans le même cadre. */
.ac-ecran > .na-tete { padding: 4px 0 2px; }
.ac-ecran > .liste-sur { margin: 6px 2px -8px; }
.ac-ecran .acte-ligne { transition: border-color .15s, box-shadow .2s var(--fondu), transform .2s var(--fondu); }
.ac-ecran a.acte-ligne:hover { border-color: var(--mz-trait-fort); box-shadow: 0 10px 24px -18px rgba(28, 26, 22, .35); transform: translateY(-1px); }
.ac-ecran a.acte-ligne:hover .acte-chevron { transform: translateX(3px); color: var(--mz-vert); }
.ac-ecran .acte-chevron { transition: transform .2s var(--fondu), color .15s; }

/* Déposer un Word : la zone à gauche, sur la hauteur ; les réglages à droite. */
main.page.actes-v2 form.ac-depot {
  display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 0 !important; padding: 0 !important;
  max-width: none !important; overflow: hidden; align-items: stretch !important;
}
.ac-depot-gauche { display: flex; flex-direction: column; gap: 18px; padding: 24px 26px; background: var(--mz-survol-doux); border-right: 1px solid var(--mz-trait); min-width: 0; }
.ac-depot-droite { display: flex; flex-direction: column; gap: 22px; padding: 24px 26px; min-width: 0; }
.ac-depot-gauche .bloc-q { flex: 1 1 auto; }
main.page.actes-v2 .ac-depot-gauche .depot-zone { flex: 1 1 auto; min-height: 260px; justify-content: center; background: var(--mz-surface) !important; }
main.page.actes-v2 .ac-depot-gauche .depot-zone:is(:hover, .survol) { background: var(--mz-vert-clair) !important; }
.ac-depot-gauche .depot-rond { width: 52px !important; height: 52px !important; }
.depot-zone [hidden] { display: none !important; }
.ac-depot-droite .gestes-form { margin-top: auto; padding-top: 4px; }
.ac-etapes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: etape; }
.ac-etapes li { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; counter-increment: etape; animation: ac-monte .32s var(--fondu) backwards; animation-delay: calc(120ms + var(--i, 0) * 60ms); }
.ac-etapes li::before { content: counter(etape); grid-row: span 2; width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; background: var(--mz-surface); border: 1px solid var(--mz-trait-fort); font-size: 12px; font-weight: 600; color: var(--mz-vert); }
.ac-etapes b { font-size: 14px; font-weight: 600; color: var(--mz-encre); }
.ac-etapes span { font-size: 13px; line-height: 1.45; color: var(--mz-encre-douce); }
@media (max-width: 1080px) {
  main.page.actes-v2 form.ac-depot { grid-template-columns: minmax(0, 1fr); }
  .ac-depot-gauche { border-right: 0; border-bottom: 1px solid var(--mz-trait); }
  main.page.actes-v2 .ac-depot-gauche .depot-zone { min-height: 180px; }
}

/* ---- 3. La liste des modèles ----
   Les filtres tiennent sur une ligne et défilent dans leur cadre ; le tableau
   n'a qu'un bord, celui de son cadre. */
main.page.modeles-v2 .tdb-chapeau { flex-wrap: wrap; row-gap: 4px; }
.modeles-chapeau { order: 9; flex-basis: 100%; max-width: none !important; margin: 0; font-size: 14px; color: var(--mz-encre-douce); }
main.page.modeles-v2 .tdb-filtres {
  flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
}
main.page.modeles-v2 .tdb-filtres::-webkit-scrollbar { display: none; }
main.page.modeles-v2 .tdb-filtres .pastille { flex: none; white-space: nowrap; }
main.page.modeles-v2 .cadre-tdb .cadre-table { border: 0 !important; border-radius: 0 !important; background: transparent !important; }
main.page.modeles-v2 .cadre-tdb { margin-top: 0 !important; animation: ac-monte .3s var(--fondu) backwards; }
main.page.modeles-v2 .cadre-tdb:nth-of-type(2) { animation-delay: 40ms; }
main.page.modeles-v2 .cadre-tdb:nth-of-type(n+3) { animation-delay: 80ms; }
