/* La rubrique Mon coffre (assets/js/coffre.js), d'après la maquette
   `Mon coffre/mon_coffre.png`. Couleurs : variables de app.css et
   d'integrations.css (--in-*). */

.cf { --cf-vert-fonce: #1f7a14; --cf-vert: #2f9a1c; font-size: 0.9375rem; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.cf > .zone { display: flex; flex-direction: column; gap: 20px; }
.cf > .zone > * { margin: 0 !important; }
.cf h1, .cf h2, .cf p { margin: 0; }
.cf b { font-weight: 600; }
.cf-doux { color: var(--doux); line-height: 1.5; }
.cf [hidden] { display: none !important; }
.cf svg { display: inline-block; flex: none; }

/* L'en-tête : bandeau vert pâle, l'illustration du coffre à droite */
.cf-tete { position: relative; display: flex; align-items: center; gap: 32px; min-height: 164px; padding: 26px 40px 26px 44px; overflow: hidden;
  border-radius: 16px; background: linear-gradient(100deg, #f1faea 0%, #e6f6da 55%, #d9f0c9 100%); box-shadow: var(--ombre); }
:root[data-theme="sombre"] .cf-tete { background: linear-gradient(100deg, #12261a 0%, #163a20 60%, #1d4a26 100%); }
.cf-pic { position: relative; z-index: 1; flex: none; display: inline-grid; place-items: center; width: 98px; height: 98px; border-radius: 20px; color: #fff;
  background: linear-gradient(160deg, #4fbf22 0%, #237f14 100%); box-shadow: 0 10px 24px rgba(35, 127, 20, .28); }
.cf-tete-texte { position: relative; z-index: 1; flex: 1; min-width: 0; max-width: 60%; }
.cf-tete h1 { font-size: 2.25rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.cf-tete p { margin-top: 8px; font-size: 1.0625rem; color: var(--doux); }
.cf-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; margin-top: 14px !important; font-size: 0.9375rem !important; color: var(--texte) !important; }
.cf-meta > span { display: inline-flex; align-items: center; gap: 8px; }
.cf-meta i { font-style: normal; color: var(--doux); margin: 0 4px; }
.cf-illu { position: absolute; right: 8px; bottom: 0; z-index: 0; height: 100%; max-height: 200px; width: auto; max-width: 44%; object-fit: contain; object-position: right bottom; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 22%); mask-image: linear-gradient(90deg, transparent 0%, #000 22%); }

/* La barre d'actions */
.cf-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cf .btn { gap: 10px; font-weight: 500; }
.cf-barre .btn { min-height: 48px; padding: 0 22px; border-radius: 10px; font-size: 0.9375rem; }
.cf-barre .btn--plein, .cf-split-plus { background: linear-gradient(180deg, #2f8f1c, #1f7414); border: 0; color: #fff; font-weight: 600; }
.cf-barre .btn--plein:hover, .cf-split-plus:hover { background: linear-gradient(180deg, #2a8219, #1b6812); }
.cf-split { position: relative; display: inline-flex; }
.cf-split-main { cursor: pointer; border-radius: 10px 0 0 10px !important; }
.cf-split-plus { padding: 0 14px !important; border-radius: 0 10px 10px 0 !important; border-left: 1px solid rgba(255, 255, 255, .28) !important; }
.cf-barre-btn { background: var(--carte); border: 1px solid var(--bord); box-shadow: 0 1px 2px rgba(20, 33, 15, .04); }
.cf-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  color: #fff; background: var(--cf-vert); }
.cf-barre-info { flex: 1 1 100%; padding: 10px 14px; border-radius: 10px; color: var(--texte); background: var(--neutre); line-height: 1.5; }
.cf-barre-info a { color: var(--vert-fonce); font-weight: 600; }

/* Les menus */
.cf-menu { position: absolute; z-index: 30; min-width: 230px; padding: 6px; border: 1px solid var(--bord); border-radius: 12px; background: var(--carte);
  box-shadow: 0 12px 32px rgba(20, 33, 15, .16); display: flex; flex-direction: column; }
.cf-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--texte); font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer; white-space: nowrap; }
.cf-menu button:hover:not([disabled]) { background: var(--neutre); }
.cf-menu button[disabled] { opacity: .45; cursor: not-allowed; }
.cf-menu button.is-actif { color: var(--vert-fonce); font-weight: 600; }
.cf-menu svg { color: var(--doux); }
.cf-menu-titre { padding: 8px 12px 4px; font-size: 0.75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--doux); border-top: 1px solid var(--bord); margin-top: 4px; }
.cf-menu-danger { color: var(--in-rouge) !important; border-top: 1px solid var(--bord) !important; border-radius: 0 0 8px 8px !important; margin-top: 4px; }
.cf-menu-danger svg { color: var(--in-rouge); }
.cf-menu--ajout { top: calc(100% + 6px); left: 0; }
.cf-menu--doc { position: fixed; z-index: 60; max-height: 360px; overflow-y: auto; }
.cf-menu--dossier { position: fixed; z-index: 60; }

/* Les dépôts en cours */
.cf-depots { display: flex; flex-direction: column; gap: 8px; }
.cf-depot { padding: 12px 16px; border-radius: 12px; background: var(--carte); box-shadow: var(--ombre); }
.cf-depot--ko { color: var(--in-rouge); background: var(--in-rouge-fond); }
.cf-jauge { display: block; height: 6px; margin-top: 8px; border-radius: 999px; background: var(--neutre); overflow: hidden; }
.cf-jauge > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4fbf22, #237f14); }

/* Les chiffres */
.cf-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cf-kpi { display: flex; align-items: center; gap: 14px; padding: 16px 12px 16px 16px; min-width: 0; border: 1px solid transparent; font: inherit; color: var(--texte);
  text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.cf-kpi:hover { border-color: var(--bord); transform: translateY(-1px); }
.cf-kpi.is-actif { border-color: var(--cf-vert); }
.cf-kpi > svg:last-child { color: var(--doux); margin-left: auto; }
.cf-kpi-pic { flex: none; display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; }
.cf-kpi-pic svg { width: 24px; height: 24px; }
.cf-kpi-pic--vert { color: #239a1a; background: #e7f6dc; }
.cf-kpi-pic--orange { color: #e68a00; background: #fdf1dd; }
.cf-kpi-pic--violet { color: #8b3fe0; background: #f2e8fd; }
.cf-kpi-pic--bleu { color: #1f78e0; background: #e3effd; }
:root[data-theme="sombre"] .cf-kpi-pic--vert { background: var(--in-vert-fond); }
:root[data-theme="sombre"] .cf-kpi-pic--orange { background: var(--in-orange-fond); }
:root[data-theme="sombre"] .cf-kpi-pic--violet { background: var(--in-violet-fond); }
:root[data-theme="sombre"] .cf-kpi-pic--bleu { background: var(--in-bleu-fond); }
.cf-kpi-texte { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cf-kpi-texte b { font-size: 1.5rem; line-height: 1.15; font-weight: 700; white-space: nowrap; }
.cf-kpi-texte > span, .cf-kpi-texte small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-kpi-texte > span { font-size: 0.875rem; }
.cf-kpi-texte small { font-size: 0.75rem; }
.cf-kpi-s--vert { color: #2f9a1c; }
.cf-kpi-s--rouge { color: var(--rouge); }
.cf-kpi-s--doux { color: var(--doux); }
.cf-kpi-texte .cf-jauge { width: 100%; max-width: 140px; margin-top: 5px; }

/* Le corps : dossiers à gauche, documents à droite */
.cf-corps { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.cf-dossiers { display: flex; flex-direction: column; gap: 2px; padding: 22px 16px; }
.cf-dossiers h2 { display: flex; align-items: center; gap: 12px; padding: 0 0 10px 8px; font-size: 1.0625rem; font-weight: 600; }
.cf-dossiers h2 > span { flex: 1; }
.cf-dos-ajout { color: var(--vert-fonce) !important; background: #e7f6dc !important; }
:root[data-theme="sombre"] .cf-dos-ajout { background: var(--pastille) !important; color: var(--pastille-texte) !important; }
.cf-dos-liste { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.cf-dossiers h2 svg { color: var(--texte); }
.cf-dos-ligne { position: relative; display: flex; align-items: center; }
.cf-dos { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--texte); font: inherit; font-size: 0.9375rem; text-align: left; cursor: pointer; }
.cf-dos:hover { background: var(--neutre); }
.cf-dos.is-actif { background: #e7f6dc; color: #1f6a10; font-weight: 600; }
:root[data-theme="sombre"] .cf-dos.is-actif { background: var(--pastille); color: var(--pastille-texte); }
.cf-dos svg { color: var(--doux); }
.cf-dos.is-actif svg { color: currentColor; }
.cf-dos-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-dos small { min-width: 26px; text-align: center; color: var(--doux); font-size: 0.8125rem; }
.cf-dos.is-actif small { padding: 1px 8px; border-radius: 999px; color: #1f6a10; background: #fff; font-weight: 600; }
.cf-dos-ligne .cf-dos { padding-right: 40px; }
.cf-dos-menu { position: absolute; right: 2px; color: var(--doux) !important; }
.cf-dos-menu:hover { color: var(--texte) !important; }
.cf-auto { display: inline-grid; place-items: center; color: var(--in-violet); }
.cf-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 8px; padding: 10px; border-radius: 10px; background: var(--neutre); }
.cf-form .btn { padding: 7px 12px; }
.cf-form--danger { background: var(--in-rouge-fond); }
.cf-form--danger > span { flex: 1 1 100%; line-height: 1.4; }
.cf-form input { flex: 1 1 100%; padding: 9px 12px; border: 1px solid var(--champ-bord); border-radius: 10px; background: var(--champ); color: var(--texte); font: inherit; }

.cf-liste { padding: 22px 24px; }
.cf-liste-tete { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; border-bottom: 1px solid var(--bord); padding-bottom: 10px; }
.cf-onglets { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 22px; align-self: stretch; }
.cf-onglet { position: relative; display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 0 10px; border: 0; background: transparent; color: var(--doux);
  font: inherit; font-size: 1.0625rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cf-onglet:first-child { overflow: hidden; text-overflow: ellipsis; display: block; }
.cf-onglet.is-actif { color: var(--texte); }
.cf-onglet.is-actif::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px; background: var(--cf-vert); }
.cf-onglet-n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  color: var(--in-violet); background: var(--in-violet-fond); }
.cf-onglet-n--alerte { color: #fff; background: var(--in-rouge); }
.cf-cherche { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; min-width: 220px; border: 1px solid var(--champ-bord); border-radius: 10px;
  background: var(--champ); color: var(--doux); }
.cf-cherche input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--texte); font: inherit; }
.cf-vues { display: inline-flex; padding: 3px; border: 1px solid var(--bord); border-radius: 10px; }
.cf-vue { display: inline-grid; place-items: center; width: 40px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--doux); cursor: pointer; }
.cf-vue.is-actif { color: #1f7a14; background: #e7f6dc; }
:root[data-theme="sombre"] .cf-vue.is-actif { color: var(--pastille-texte); background: var(--pastille); }

.cf-table, .cf-grille { max-height: 620px; overflow-y: auto; }
.cf-tout { display: flex; align-items: center; gap: 8px; padding: 8px 4px; color: var(--doux); font-size: 0.8125rem; border-bottom: 1px solid var(--bord); }
.cf-ligne { display: grid; grid-template-columns: 28px minmax(0, 1fr) 150px 120px 44px; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--bord); }
.cf-ligne--confirme { grid-template-columns: minmax(0, 1fr) auto; color: var(--texte); background: var(--in-rouge-fond); border-radius: 10px; padding: 14px; }
.cf-confirme-actes { display: flex; gap: 8px; flex-wrap: wrap; }
.cf-choix { display: inline-grid; place-items: center; }
.cf-choix input, .cf-tout input { width: 17px; height: 17px; accent-color: var(--cf-vert); cursor: pointer; }
.cf-nom { display: flex; align-items: center; gap: 16px; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cf-nom > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cf-nom b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-nom:hover > span:not(.cf-fic) > b { color: var(--vert-fonce); }
.cf-fic b { color: #fff !important; }
.cf-nom small, .cf-quand small { color: var(--doux); font-size: 0.8125rem; }
.cf-quand { display: flex; flex-direction: column; gap: 3px; font-size: 0.875rem; }

/* L'icône d'un type de fichier : tuile pâle teintée, feuille et étiquette colorées */
.cf-fic { --fic: #6b7a66; --fic-fond: #eef2ea; position: relative; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px;
  border-radius: 10px; background: var(--fic-fond); color: var(--fic); }
.cf-fic svg { width: 24px; height: 29px; }
.cf-fic .cf-fic-feuille { fill: #fff; stroke: var(--fic); stroke-width: 1.8; stroke-linejoin: round; }
.cf-fic .cf-fic-pli { fill: none; stroke: var(--fic); stroke-width: 1.8; stroke-linejoin: round; }
.cf-fic b { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 1px 3px; border-radius: 3px; font-size: 0.5rem; font-weight: 800;
  line-height: 1.2; letter-spacing: .03em; color: #fff; background: var(--fic); }
.cf-fic--pdf { --fic: #e5322d; --fic-fond: #fde8e7; }
.cf-fic--doc { --fic: #1f6fe0; --fic-fond: #e4eefc; }
.cf-fic--img { --fic: #1f9a48; --fic-fond: #e2f5e8; }
.cf-fic--xls { --fic: #16804a; --fic-fond: #dff2e7; }
.cf-fic--ppt { --fic: #dc5a16; --fic-fond: #fcebdf; }
:root[data-theme="sombre"] .cf-fic { --fic-fond: var(--neutre); }
:root[data-theme="sombre"] .cf-fic .cf-fic-feuille { fill: var(--carte); }

/* Les pastilles d'état */
.cf-pastille { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.cf-pastille--neutre { color: var(--texte); background: var(--neutre); }
.cf-pastille--orange { color: #b45309; background: #fdf0dc; }
.cf-pastille--bleu { color: #1f62c4; background: #e5f0fc; }
.cf-pastille--vert { color: #1f7a14; background: #e4f5d8; }
.cf-pastille--rouge { color: var(--in-rouge); background: var(--in-rouge-fond); }
:root[data-theme="sombre"] .cf-pastille--orange { color: var(--in-orange); background: var(--in-orange-fond); }
:root[data-theme="sombre"] .cf-pastille--bleu { color: var(--in-bleu); background: var(--in-bleu-fond); }
:root[data-theme="sombre"] .cf-pastille--vert { color: var(--in-vert); background: var(--in-vert-fond); }

.cf-menu-ancre { position: relative; display: inline-flex; justify-content: flex-end; }
.cf-ico { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--texte); cursor: pointer; }
.cf-ico:hover { background: var(--neutre); }
.cf-danger { border-color: var(--in-rouge); color: var(--in-rouge); background: var(--carte); font-weight: 600; }
.cf-vide { padding: 22px 4px; }

/* La vue en grille */
.cf-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding-top: 6px; }
.cf-tuile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border: 1px solid var(--bord); border-radius: 12px; }
.cf-tuile .cf-choix { position: absolute; top: 12px; left: 12px; }
.cf-tuile .cf-menu-ancre { position: absolute; top: 6px; right: 6px; }
.cf-tuile-corps { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding: 14px 0 4px; border: 0; background: transparent; color: inherit;
  font: inherit; cursor: pointer; text-align: center; }
.cf-tuile-corps .cf-fic { width: 64px; height: 64px; border-radius: 14px; }
.cf-tuile-corps .cf-fic svg { width: 34px; height: 41px; }
.cf-tuile-corps .cf-fic b { bottom: 12px; font-size: 0.625rem; }
.cf-tuile-corps b { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-tuile-corps small { color: var(--doux); font-size: 0.8125rem; }

/* Le suivi de l'archivage (onglet de la carte des documents) */
.cf-suivi-note { display: flex; align-items: flex-start; gap: 8px; padding: 4px 4px 8px; font-size: 0.8125rem; }
.cf-suivi-note svg { color: var(--in-violet); margin-top: 2px; }
.cf-envoi { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--bord); }
.cf-envoi-nom { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cf-envoi-nom b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-envoi-nom small { color: var(--doux); font-size: 0.8125rem; overflow-wrap: anywhere; }
.cf-envoi-actes { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cf-envoi-actes .btn { padding: 7px 12px; white-space: nowrap; }
.cf-btn-doux { color: var(--doux); }
.cf-erreur { color: var(--in-rouge) !important; line-height: 1.4; }
.cf-envoi-note { grid-column: 2 / -1; margin-top: -6px; font-size: 0.8125rem; }

/* La réactivité : en cours, puis éclairé */
.cf-pastille--encours { color: var(--vert-fonce); background: #eef8e6; padding: 5px 12px; }
:root[data-theme="sombre"] .cf-pastille--encours { background: var(--pastille); color: var(--pastille-texte); }
.cf-pastille--encours .pa-mini { gap: 7px; }
.cf-pastille--encours .pa-comete--mini { width: 16px; height: 16px; }
.is-occupe.cf-ligne, .is-occupe.cf-envoi, .is-occupe.cf-tuile { position: relative; background-image: linear-gradient(100deg, transparent 0%, rgba(79, 191, 34, .10) 45%, transparent 90%);
  background-size: 220% 100%; animation: cf-balaye 1.4s linear infinite; }
.is-occupe .cf-nom, .is-occupe .cf-envoi-nom, .is-occupe .cf-fic { opacity: .7; }
.cf-dos.is-occupe { color: var(--doux); }
.cf-dos .pa-mini { color: var(--vert-fonce); font-size: 0.75rem; }
.cf-dos .pa-comete--mini { width: 15px; height: 15px; }
.cf-barre-btn.is-occupe { color: var(--vert-fonce); opacity: 1; cursor: progress; }
.cf-eclat { animation: cf-eclat 1.8s ease-out; }
@keyframes cf-balaye { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes cf-eclat { 0% { background-color: rgba(79, 191, 34, .28); } 100% { background-color: transparent; } }
@media (prefers-reduced-motion: reduce) {
  .is-occupe.cf-ligne, .is-occupe.cf-envoi, .is-occupe.cf-tuile { animation: none; background: rgba(79, 191, 34, .07); }
  .cf-eclat { animation-duration: .01s; }
}

/* La référence seule, la remise, le lien de partage */
.cf-pastille--sarcelle { color: #0f766e; background: #dcf3ef; }
.cf-pastille--violet { color: var(--in-violet); background: var(--in-violet-fond); }
:root[data-theme="sombre"] .cf-pastille--sarcelle { color: #5eead4; background: rgba(20, 184, 166, .16); }
.cf-nom--ref .cf-fic { opacity: .55; }
.cf-nom--ref b { font-weight: 500; }
.cf-remis-note { color: #0f766e !important; }
.cf-ligne--form { grid-template-columns: minmax(0, 1fr) !important; gap: 10px; padding: 14px; border-radius: 10px; background: var(--neutre); }
.cf-ligne--form input[type=url], .cf-ligne--form input[type=date] { padding: 9px 12px; border: 1px solid var(--champ-bord); border-radius: 10px; background: var(--champ); color: var(--texte); font: inherit; }
.cf-lien-t { display: flex; align-items: center; gap: 8px; color: var(--doux); font-size: 0.875rem; }
.cf-lien-date { display: flex; align-items: center; gap: 8px; color: var(--doux); font-size: 0.875rem; }
.cf-ligne--info { background: #eef8e6 !important; }
:root[data-theme="sombre"] .cf-ligne--info { background: var(--pastille) !important; }

/* Le glisser-déposer */
.cf-liste { position: relative; }
.cf-glisse .cf-liste.is-cible::after { content: attr(data-cf-glisse); position: absolute; inset: 8px; z-index: 20; display: grid; place-items: center; padding: 24px;
  border: 2px dashed var(--cf-vert); border-radius: 14px; background: rgba(239, 249, 232, .92); color: var(--vert-fonce); font-size: 1.0625rem; font-weight: 600;
  text-align: center; pointer-events: none; animation: cf-apparait .15s ease-out; }
:root[data-theme="sombre"] .cf-glisse .cf-liste.is-cible::after { background: rgba(18, 38, 26, .92); }
.cf-glisse .cf-dossiers { outline: 2px dashed transparent; }
.cf-dos.is-cible { background: #e7f6dc; color: #1f6a10; box-shadow: inset 0 0 0 2px var(--cf-vert); }
:root[data-theme="sombre"] .cf-dos.is-cible { background: var(--pastille); color: var(--pastille-texte); }
.cf-depose-vide { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; padding: 40px 20px; flex: 1 1 auto;
  border: 2px dashed var(--bord); border-radius: 14px; color: var(--doux); text-align: center; }
.cf-depose-vide svg { color: var(--cf-vert); margin-bottom: 4px; }
.cf-depose-vide b { color: var(--texte); font-weight: 600; max-width: 520px; }
.cf-depose-vide small { font-size: 0.8125rem; }
.cf-liste .cf-depots { margin: 4px 0 8px; }
.cf-depot .pa-mini { color: var(--vert-fonce); }
.cf-liste .cf-depot { box-shadow: none; border: 1px solid var(--bord); padding: 10px 14px; }
@keyframes cf-apparait { from { opacity: 0; } to { opacity: 1; } }

/* L'aperçu */
.cf-modale { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(10, 20, 8, .55); }
.cf-modale-boite { display: flex; flex-direction: column; width: min(980px, 100%); height: min(88vh, 920px); border-radius: 14px; background: var(--carte); overflow: hidden; }
.cf-modale-boite header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--bord); }
.cf-modale-boite iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.cf-modale-boite img { flex: 1; min-height: 0; object-fit: contain; max-width: 100%; margin: auto; }
.cf-modale-boite > p { padding: 24px; }

@media (min-width: 1100px) and (min-height: 620px) {
  .cf.cadre > .zone > * { flex: none; }
  .cf.cadre > .zone > .cf-corps { flex: 1 1 0; min-height: 300px; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
  .cf-dossiers { min-height: 0; overflow: hidden; }
  .cf-liste { display: flex; flex-direction: column; min-height: 0; }
  .cf-liste > .cf-table, .cf-liste > .cf-grille { flex: 1 1 0; min-height: 0; max-height: none; }
  .cf-liste > .cf-grille { align-content: start; }
}
@media (min-width: 1000px) and (max-height: 920px) {
  .cf-tete { min-height: 0; padding: 18px 32px 18px 30px; gap: 24px; }
  .cf-pic { width: 72px; height: 72px; border-radius: 18px; }
  .cf-pic svg { width: 34px; height: 34px; }
  .cf-tete h1 { font-size: 1.75rem; }
  .cf-tete p { margin-top: 4px; font-size: 0.9375rem; }
  .cf-meta { margin-top: 8px !important; }
  .cf-illu { max-height: 140px; }
  .cf-barre .btn { min-height: 44px; }
  .cf-kpi { padding: 12px 12px 12px 14px; }
  .cf-kpi-pic { width: 44px; height: 44px; }
  .cf-kpi-texte b { font-size: 1.375rem; }
  .cf > .zone { gap: 16px; }
  .cf-dossiers { padding: 18px 14px; }
  .cf-liste { padding: 16px 20px; }
}
@media (max-width: 1440px) {
  .cf-corps { grid-template-columns: 268px minmax(0, 1fr); }
  .cf-ligne { grid-template-columns: 24px minmax(0, 1fr) 124px 96px 40px; gap: 12px; }
  .cf-liste { padding: 20px; }
}
@media (max-width: 1240px) {
  .cf-kpi > svg:last-child { display: none; }
  .cf-cherche { min-width: 180px; }
}
@media (max-width: 900px) {
  .cf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .cf-corps { grid-template-columns: minmax(0, 1fr); }
  .cf-tete-texte { max-width: 70%; }
}
@media (max-width: 760px) {
  .cf { gap: 14px; }
  .cf-tete { flex-direction: column; align-items: flex-start; gap: 14px; padding: 22px 20px 120px; min-height: 0; }
  .cf-tete-texte { max-width: none; }
  .cf-tete h1 { font-size: 1.75rem; }
  .cf-pic { width: 64px; height: 64px; border-radius: 16px; }
  .cf-pic svg { width: 32px; height: 32px; }
  .cf-illu { height: 130px; max-width: 80%; right: 4px; }
  .cf-meta { gap: 6px 16px; }
  .cf-barre .btn { padding: 0 16px; }
  .cf-kpis { gap: 10px; }
  .cf-kpi { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .cf-kpi > svg:last-child { display: none; }
  .cf-kpi-pic { width: 44px; height: 44px; border-radius: 12px; }
  .cf-kpi-pic svg { width: 22px; height: 22px; }
  .cf-kpi-texte b { font-size: 1.375rem; }
  .cf-liste { padding: 16px; }
  .cf-cherche { min-width: 0; flex: 1 1 100%; order: 3; }
  .cf-ligne { grid-template-columns: 24px minmax(0, 1fr) 40px; row-gap: 8px; }
  .cf-ligne > span:nth-of-type(1) { grid-column: 2; grid-row: 2; }
  .cf-ligne .cf-quand { display: none; }
  .cf-ligne .cf-menu-ancre { grid-column: 3; grid-row: 1; }
  .cf-onglets { flex: 1 1 100%; gap: 16px; }
  .cf-onglet { font-size: 0.9375rem; }
  .cf-envoi { grid-template-columns: 44px minmax(0, 1fr); }
  .cf-envoi > span:nth-of-type(2), .cf-envoi-actes, .cf-envoi-note { grid-column: 2; justify-content: flex-start; margin-top: 0; }
}

/* --- La fiche d'un document (#coffre/<id>), d'après mon_coffre_details.png --- */
.fi-fil { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--doux); font-size: 0.9375rem; }
.fi-fil b { color: var(--vert-fonce); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-retour { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid var(--bord); border-radius: 10px;
  background: var(--carte); color: var(--texte); font-weight: 600; text-decoration: none; }
.fi-miette { display: inline-flex; align-items: center; gap: 6px; color: var(--doux); text-decoration: none; }
.fi-miette:hover { color: var(--texte); }

.fi-tete { display: flex; align-items: center; gap: 22px; padding: 18px 22px; border-radius: 16px; background: linear-gradient(100deg, #f1faea 0%, #e8f6dd 100%); box-shadow: var(--ombre); }
:root[data-theme="sombre"] .fi-tete { background: linear-gradient(100deg, #12261a 0%, #163a20 100%); }
.fi-fic { flex: none; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 16px; background: var(--carte); box-shadow: 0 6px 18px rgba(20, 33, 15, .08); }
.fi-fic .cf-fic { width: 64px; height: 64px; border-radius: 14px; }
.fi-fic .cf-fic svg { width: 34px; height: 41px; }
.fi-fic .cf-fic b { bottom: 12px; font-size: 0.625rem; }
.fi-tete-texte { flex: 1; min-width: 0; }
.fi-tete h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.fi-tete-texte p { margin-top: 4px; color: var(--doux); }
.fi-meta { font-size: 0.875rem; }
.fi-meta i { font-style: normal; margin: 0 8px; }
.fi-badge { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 12px; background: var(--carte); }
.fi-badge b { display: block; font-weight: 600; color: currentColor; }
.fi-badge small { display: block; color: var(--doux); font-size: 0.8125rem; }
.fi-badge--vert { color: #1f7a14; background: #e4f5d8; }
.fi-badge--bleu { color: #1f62c4; background: #e5f0fc; }
.fi-badge--sarcelle { color: #0f766e; background: #dcf3ef; }
.fi-badge--orange { color: #b45309; background: #fdf0dc; }
.fi-badge--rouge { color: var(--in-rouge); background: var(--in-rouge-fond); }
.fi-badge--violet { color: var(--in-violet); background: var(--in-violet-fond); }
:root[data-theme="sombre"] .fi-badge { background: var(--neutre); }
.fi-actes { display: flex; align-items: center; gap: 10px; }
.fi-actes .btn { min-height: 48px; padding: 0 20px; border-radius: 10px; font-weight: 600; }
.fi-prin { background: linear-gradient(180deg, #2f8f1c, #1f7414) !important; border: 0 !important; color: #fff !important; }
.fi-sec { background: var(--carte); border: 1px solid var(--bord); }
.fi-plus { width: 48px; padding: 0 !important; justify-content: center; background: var(--carte); border: 1px solid var(--bord); }
.fi-bandeau { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 12px 16px; border-radius: 12px; background: #eef8e6; }
.fi-bandeau--danger { margin-top: 0; background: var(--in-rouge-fond); }

.fi-corps { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; }
.fi-visu { display: flex; flex-direction: column; min-height: 520px; border-radius: 14px; overflow: hidden; background: #e9ece6; box-shadow: var(--ombre); }
:root[data-theme="sombre"] .fi-visu { background: #0d1510; }
.fi-barre { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #2b3530; color: #e6ece3; }
.fi-outil { display: inline-grid; place-items: center; width: 36px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.fi-outil:hover { background: rgba(255, 255, 255, .12); }
.fi-zoom, .fi-numero { min-width: 56px; text-align: center; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.fi-sep { width: 1px; height: 22px; margin: 0 6px; background: rgba(255, 255, 255, .22); }
.fi-barre-nom { flex: 1; min-width: 0; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; opacity: .7; text-align: center; }
.fi-page { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fi-lecteur { flex: 1; min-height: 0; display: flex; }
.fi-defile { flex: 1; min-height: 0; overflow: auto; background: #e9ece6; }
:root[data-theme="sombre"] .fi-defile { background: #0d1510; }
.fi-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px; min-width: min-content; }
.fi-feuille { background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .14); line-height: 0; }
.fi-defile--image { display: grid; place-items: center; padding: 20px; }
.fi-defile--image img { max-width: 100%; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .14); }
.fi-texte { margin: 20px; padding: 24px; background: #fff; color: #14210f; white-space: pre-wrap; overflow-wrap: anywhere; font: 0.875rem/1.55 ui-monospace, Consolas, monospace; box-shadow: 0 2px 10px rgba(0, 0, 0, .1); }
.fi-defile:fullscreen { background: #2b3530; }
.fi-vide { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 24px; text-align: center; color: var(--doux); }
.fi-vide .cf-fic { width: 72px; height: 72px; border-radius: 16px; }
.fi-vide .cf-fic svg { width: 38px; height: 46px; }
.fi-vide p { max-width: 420px; line-height: 1.5; }
.fi-jauge { width: 220px; }

.fi-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.fi-deux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.fi-carte { padding: 20px 22px; margin: 0; }
.fi-carte h2 { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 1.0625rem; font-weight: 600; }
.fi-carte h2 svg { color: var(--texte); }
.fi-ligne { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 7px 0; font-size: 0.9rem; }
.fi-ligne > span { color: var(--doux); }
.fi-ligne > div { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.fi-pastille { display: inline-block; padding: 3px 10px; border-radius: 8px; color: #1f62c4; background: #e5f0fc; font-size: 0.8125rem; font-weight: 600; }
.fi-code { font: 0.8125rem ui-monospace, Consolas, monospace; color: var(--texte); }
.fi-code--long { word-break: break-all; }
.fi-copier { width: 30px; height: 28px; }
.fi-etat { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.fi-etat--vert { color: #1f7a14; }
.fi-etat--rouge { color: var(--in-rouge); }
.fi-etat--neutre { color: var(--doux); }
.fi-details { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; padding: 10px; border: 1px solid var(--bord); border-radius: 10px; background: var(--carte); font-weight: 600; }
.fi-details-corps { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--bord); font-size: 0.8125rem; }
.fi-boutons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fi-boutons .btn { padding: 8px 14px; }
.fi-lien { display: inline-flex; align-items: center; gap: 6px; color: var(--vert-fonce); font-weight: 600; text-decoration: none; }
.fi-mini { padding: 2px 8px; border: 1px solid var(--bord); border-radius: 6px; background: transparent; color: var(--doux); font: inherit; font-size: 0.75rem; cursor: pointer; }
.fi-lien-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 12px; border-radius: 10px; background: var(--neutre); }
.fi-lien-form input[type=url], .fi-lien-form input[type=date] { padding: 9px 12px; border: 1px solid var(--champ-bord); border-radius: 10px; background: var(--champ); color: var(--texte); font: inherit; }
.fi-info { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px !important; padding: 12px 14px; border-radius: 10px; color: var(--texte); background: #eaf2fd; font-size: 0.8125rem; line-height: 1.5; }
.fi-info svg { color: #1f62c4; flex: none; margin-top: 1px; }
:root[data-theme="sombre"] .fi-info { background: var(--in-bleu-fond); }

.fi-hist { list-style: none; margin: 0; padding: 0 0 0 4px; }
.fi-hist li { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 0 0 16px; }
.fi-hist li:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 2px; width: 2px; background: var(--bord); }
.fi-h-pic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; }
.fi-h-pic--vert { color: #1f7a14; background: #e4f5d8; }
.fi-h-pic--bleu { color: #1f62c4; background: #e5f0fc; }
.fi-h-pic--sarcelle { color: #0f766e; background: #dcf3ef; }
.fi-h-pic--violet { color: var(--in-violet); background: var(--in-violet-fond); }
.fi-h-pic--rouge { color: var(--in-rouge); background: var(--in-rouge-fond); }
.fi-h-pic--neutre { color: var(--doux); background: var(--neutre); }
.fi-h-texte { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 7px; }
.fi-h-texte b { font-weight: 600; }
.fi-h-texte small { color: var(--doux); font-size: 0.8125rem; overflow-wrap: anywhere; }
.fi-h-quand { display: flex; flex-direction: column; align-items: flex-end; padding-top: 7px; font-size: 0.8125rem; color: var(--doux); font-variant-numeric: tabular-nums; }

/* Pleine hauteur : le lecteur et la colonne de droite descendent jusqu'en bas,
   chacun défile en lui-même. */
@media (min-width: 1100px) and (min-height: 620px) {
  .cf--fiche.cadre > .zone > * { flex: none; }
  .cf--fiche.cadre > .zone > .fi-corps { flex: 1 1 0; min-height: 360px; grid-template-rows: minmax(0, 1fr); }
  .fi-visu { min-height: 0; }
  .fi-col { min-height: 0; overflow-y: auto; padding-right: 4px; scrollbar-gutter: stable; }
}
@media (max-width: 1400px) {
  .fi-deux { grid-template-columns: minmax(0, 1fr); }
  .fi-tete { flex-wrap: wrap; }
  .fi-actes { margin-left: auto; }
}
@media (max-width: 1100px) {
  .fi-corps { grid-template-columns: minmax(0, 1fr); }
  .fi-visu { min-height: 70vh; }
}
@media (max-width: 760px) {
  .fi-tete { padding: 16px; gap: 14px; }
  .fi-fic { width: 64px; height: 64px; }
  .fi-tete h1 { font-size: 1.25rem; }
  .fi-badge, .fi-actes { flex: 1 1 100%; }
  .fi-actes .btn { flex: 1; }
  .fi-plus { flex: none !important; }
  .fi-ligne { grid-template-columns: 96px minmax(0, 1fr); }
  .fi-barre-nom { display: none; }
}

/* Dossiers : actions visibles sur chaque ligne, bouton « Nouveau dossier » */
.cf-dos-actes { position: absolute; right: 2px; display: none; gap: 0; padding-left: 4px; }
.cf-dos-ligne:hover .cf-dos-actes, .cf-dos-ligne:focus-within .cf-dos-actes, .cf-dos-ligne.is-sel .cf-dos-actes { display: flex; }
.cf-dos-ligne:hover .cf-dos, .cf-dos-ligne:focus-within .cf-dos, .cf-dos-ligne.is-sel .cf-dos { padding-right: 104px; }
@media (hover: none) {
  .cf-dos-actes { display: flex; }
  .cf-dos-ligne .cf-dos { padding-right: 104px; }
}
.cf-dos-actes .cf-ico { width: 32px; height: 32px; color: var(--doux); }
.cf-dos-actes .cf-ico:hover { color: var(--texte); background: var(--neutre); }
.cf-dos-actes .cf-ico--danger:hover { color: var(--in-rouge); background: var(--in-rouge-fond); }
.cf-dos-ligne .cf-dos small { margin-right: 2px; }
.cf-dos-nouveau { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 8px; padding: 10px; border: 1.5px dashed var(--bord);
  border-radius: 10px; background: transparent; color: var(--vert-fonce); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.cf-dos-nouveau:hover { border-color: var(--cf-vert); background: #f1faea; }
:root[data-theme="sombre"] .cf-dos-nouveau:hover { background: var(--pastille); }

/* Fiche : Archivage et partage / Historique en onglets */
.fi-onglets-carte { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.fi-onglets { display: flex; gap: 24px; padding: 0 22px; border-bottom: 1px solid var(--bord); flex: none; }
.fi-onglet { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 16px 0 14px; border: 0; background: transparent; color: var(--doux);
  font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.fi-onglet svg { color: currentColor; }
.fi-onglet.is-actif { color: var(--texte); }
.fi-onglet.is-actif::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px; background: var(--cf-vert); }
.fi-onglet-corps { padding: 14px 22px 18px; }
.fi-deux .fi-ligne { grid-template-columns: 92px minmax(0, 1fr); }
@media (min-width: 1100px) and (min-height: 620px) {
  .fi-col { overflow: hidden !important; padding-right: 0 !important; }
  .fi-deux { flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .fi-deux .fi-carte { padding: 16px 18px; }
  .fi-deux .fi-carte h2 { margin-bottom: 8px; }
  .fi-deux .fi-ligne { padding: 5px 0; font-size: 0.85rem; }
  .fi-onglets-carte { flex: 1 1 0; min-height: 200px; }
  .fi-onglet-corps { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
}

@media (min-width: 1100px) and (max-width: 1400px) {
  .fi-corps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fi-deux .fi-ligne { grid-template-columns: 78px minmax(0, 1fr); gap: 8px; font-size: 0.8125rem; }
  .fi-deux .fi-ligne small.cf-doux { display: none; }
  .fi-deux .fi-carte h2 { font-size: 1rem; gap: 10px; }
  .fi-tete h1 { font-size: 1.3rem; }
}
@media (min-width: 1100px) and (min-height: 620px) {
  .fi-onglets-carte { min-height: 140px; }
}

/* Glisser un document vers un dossier */
[data-cf-glisse] { cursor: grab; }
[data-cf-glisse]:active { cursor: grabbing; }
.is-tenu { opacity: .45; }
.cf-deplace .cf-dossiers { box-shadow: 0 0 0 2px rgba(79, 191, 34, .35), var(--ombre); }
.cf-deplace .cf-dos[data-v]:not([data-v="*"]) { outline: 1.5px dashed rgba(79, 191, 34, .45); outline-offset: -2px; }
.cf-deplace .cf-dos.is-cible { outline: 0; }
.cf-fantome { position: fixed; top: -100px; left: -100px; padding: 8px 14px; border-radius: 10px; background: #1f7414; color: #fff; font: 600 0.875rem/1.2 Montserrat, sans-serif;
  white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 8px 20px rgba(20, 33, 15, .25); }

/* En-tête de la fiche : le nom en haut, sur toute la largeur ; dessous, le
   dossier, la taille, la date, l'état et les actions. */
.fi-tete { align-items: center; flex-wrap: nowrap !important; }
.fi-tete-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.fi-tete-corps h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.fi-tete-bas { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.fi-tete-bas .fi-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; color: var(--doux); font-size: 0.9rem; }
.fi-meta-dos { display: inline-flex; align-items: center; gap: 6px; color: var(--texte); font-weight: 500; }
.fi-tete-bas .fi-badge { padding: 8px 14px; }
.fi-tete-bas .fi-actes { margin-left: 0; }
.fi-tete-bas .fi-actes .btn { min-height: 44px; }
@media (max-width: 1400px) { .fi-tete-corps h1 { font-size: 1.3rem; } }
@media (max-width: 760px) {
  .fi-tete { flex-wrap: wrap !important; align-items: flex-start; }
  .fi-tete-bas .fi-badge, .fi-tete-bas .fi-actes { flex: 1 1 100%; }
}

.fi-tete-droite { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-left: auto; }
@media (max-width: 760px) { .fi-tete-droite { flex: 1 1 100%; margin-left: 0; } }

/* --- Les partages : Mes partages (#coffre/partages) et Partager (#coffre/<id>/partager) --- */
.pg-tete { position: relative; display: flex; align-items: center; gap: 26px; padding: 22px 30px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(100deg, #f6f0fe 0%, #efe6fd 55%, #e7f6dc 100%); box-shadow: var(--ombre); }
:root[data-theme="sombre"] .pg-tete { background: linear-gradient(100deg, #1f1733 0%, #1d2a22 100%); }
.pg-tete::after { content: ""; position: absolute; right: -40px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(124, 58, 237, .16), transparent 70%); }
.pg-tete h1 { font-size: 1.875rem; font-weight: 700; }
.pg-tete p { margin-top: 6px !important; color: var(--doux); }
.pg-tete--simple { background: transparent; box-shadow: none; padding: 4px 4px 0; }
.pg-tete--simple::after { display: none; }
.pg-tete--simple h1 { font-size: 1.625rem; }
.pg-pic { flex: none; display: inline-grid; place-items: center; width: 84px; height: 84px; border-radius: 20px; color: #7c3aed; background: #efe5fd; box-shadow: 0 8px 20px rgba(124, 58, 237, .12); }
.pg-pic--vert { color: #1f7a14; background: #e4f5d8; box-shadow: none; width: 64px; height: 64px; }
.pg-tete--simple .pg-pic { width: 70px; height: 70px; }
:root[data-theme="sombre"] .pg-pic { background: var(--in-violet-fond); color: var(--in-violet); }
.pg-kpi { cursor: default; }
.pg-kpi:hover { transform: none; border-color: transparent; }

.pg-outils { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pg-filtres { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.pg-filtre { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px; border: 1px solid var(--bord); border-radius: 10px; background: var(--carte);
  color: var(--texte); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.pg-filtre span { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--neutre); font-size: 0.75rem; }
.pg-filtre.is-actif { color: #fff; border-color: transparent; background: linear-gradient(180deg, #2f8f1c, #1f7414); }
.pg-filtre.is-actif span { background: #fff; color: #1f7414; }
.pg-cherche { min-width: 260px; }

.pg-liste { display: flex; flex-direction: column; padding: 8px 18px 12px; margin: 0; }
.pg-entete, .pg-ligne { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.5fr) minmax(0, 1.3fr) 128px 104px 136px 96px 40px; gap: 14px; align-items: center; }
.pg-entete { padding: 12px 8px; border-bottom: 1px solid var(--bord); color: var(--doux); font-size: 0.8125rem; font-weight: 600; background: var(--neutre); border-radius: 10px 10px 0 0; }
.pg-ligne { position: relative; padding: 12px 8px; border-bottom: 1px solid var(--bord); font-size: 0.875rem; }
.pg-ligne .cf-fic { width: 38px; height: 38px; }
.pg-ligne .cf-fic svg { width: 21px; height: 25px; }
.pg-ligne .cf-fic b { bottom: 6px; font-size: 0.45rem; }
.pg-dest, .pg-exp, .pg-acces, .pg-cree { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pg-dest b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-dest small, .pg-exp small, .pg-acces small, .pg-cree small { color: var(--doux); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-motif { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-code-ligne { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 2px 0 0 !important; padding: 8px 12px; border-radius: 8px; background: var(--in-violet-fond);
  color: var(--in-violet); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.pg-ligne--confirme { grid-template-columns: minmax(0, 1fr) auto !important; }

.pp-corps { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.05fr) minmax(0, .95fr); gap: 20px; align-items: start; }
.pp-doc { display: flex; flex-direction: column; gap: 14px; padding: 16px; margin: 0; }
.pp-doc-tete { display: flex; align-items: center; gap: 14px; }
.pp-doc-tete b { display: block; font-size: 1.0625rem; }
.pp-doc-tete small { color: var(--doux); }
.pp-doc .fi-visu { min-height: 460px; }
.pp-form, .pp-apercu, .pp-recap { padding: 20px 22px; margin: 0; }
.pp-form h2, .pp-apercu h2, .pp-recap h2 { display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; font-size: 1.0625rem; font-weight: 600; }
.pp-form h2:not(:first-child) { margin-top: 20px; }
.pp-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.pp-mode { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 1px solid var(--bord); border-radius: 10px; background: var(--carte);
  color: var(--texte); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.pp-mode.is-actif { color: #fff; border-color: transparent; background: linear-gradient(180deg, #2f8f1c, #1f7414); }
.pp-champ { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; font-size: 0.875rem; }
.pp-champ > span { color: var(--texte); font-weight: 500; }
.pp-champ i { font-style: normal; color: var(--doux); font-weight: 400; }
.pp-champ input, .pp-champ select, .pp-champ textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--champ-bord); border-radius: 10px; background: var(--champ); color: var(--texte); font: inherit; }
.pp-champ textarea { resize: vertical; min-height: 76px; }
.pp-champ input:disabled { opacity: .6; }
.pp-deux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pp-case { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; font-size: 0.9rem; cursor: pointer; }
.pp-case input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--cf-vert); flex: none; }
.pp-case span { display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.pp-case small { color: var(--doux); font-weight: 400; font-size: 0.8rem; }
.pp-case:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.pp-creer { width: 100%; min-height: 52px; margin-top: 14px; border-radius: 12px; font-size: 1rem; font-weight: 700; justify-content: center;
  background: linear-gradient(180deg, #2f8f1c, #1f7414) !important; border: 0 !important; color: #fff !important; }
.pp-fait { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 40px 24px; }
.pp-fait h2 { justify-content: center; font-size: 1.375rem; margin: 0; }
.pp-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.pp-lien { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 10px; background: var(--neutre); color: var(--vert-fonce); }
.pp-lien input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--texte); font: 0.85rem ui-monospace, Consolas, monospace; }
.pp-lien .cf-doux { font-size: 0.85rem; }
.pp-code { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--in-violet-fond); color: var(--in-violet); text-align: center; }
.pp-code span { font-size: 0.8125rem; font-weight: 600; }
.pp-code b { font: 700 2rem/1.1 ui-monospace, Consolas, monospace; letter-spacing: .12em; }
.pp-code small { color: var(--texte); font-size: 0.8rem; line-height: 1.4; }
.pp-recap .fi-ligne { grid-template-columns: 130px minmax(0, 1fr); font-size: 0.875rem; }
.pp-recap .fi-ligne > div { flex-direction: column; align-items: flex-start; gap: 0; }
.pp-securise { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: #eef8e6; }
:root[data-theme="sombre"] .pp-securise { background: var(--pastille); }
.pp-securise p { display: flex; align-items: center; gap: 10px; color: #1f7a14; }
.pp-securise ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; }
.pp-securise li { display: flex; align-items: center; gap: 10px; }
.pp-securise li svg { color: #fff; background: #2f9a1c; border-radius: 50%; padding: 2px; }

.fi-sous { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--bord); }
.fi-sous h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 0.95rem; font-weight: 600; }
.fi-sous h3 svg { color: var(--in-violet); }
.fi-partage { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 0.875rem; }
.fi-partage span:last-child { display: flex; flex-direction: column; min-width: 0; }
.fi-partage small { color: var(--doux); }
.fi-partager { color: var(--in-violet) !important; }

@media (min-width: 1100px) and (min-height: 620px) {
  .cf--partages.cadre > .zone > * { flex: none; }
  .cf--partages.cadre > .zone > .pg-liste { flex: 1 1 0; min-height: 220px; }
  .pg-liste > .pg-table { flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto; }
  .cf--partager.cadre > .zone > * { flex: none; }
  .cf--partager.cadre > .zone > .pp-corps { flex: 1 1 0; min-height: 360px; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
  .pp-doc { min-height: 0; }
  .pp-doc .fi-visu { flex: 1; min-height: 0; }
  .pp-form, .pp-col { min-height: 0; overflow-y: auto; }
}
@media (max-width: 1400px) {
  .pg-entete, .pg-ligne { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1.4fr) minmax(0, 1fr) 112px 92px 150px 40px; }
  .pg-entete span:nth-child(7), .pg-ligne .pg-cree { display: none; }
  .pp-corps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pp-doc { display: none; }
}
@media (max-width: 1000px) {
  .pg-entete { display: none; }
  .pg-ligne { grid-template-columns: minmax(0, 1fr) auto 40px; }
  .pg-ligne .pg-motif, .pg-ligne .pg-acces, .pg-ligne .pg-exp { display: none; }
  .pg-ligne .pg-dest { grid-column: 1; }
  .pp-corps { grid-template-columns: minmax(0, 1fr); }
  .pg-tete { padding: 18px; gap: 16px; }
  .pg-pic { width: 60px; height: 60px; }
  .pg-tete h1 { font-size: 1.375rem; }
}

/* Partage : protection par code, par compte ProAdmin, ou lien seul */
.pp-protections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pp-prot { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border: 1px solid var(--bord); border-radius: 12px; cursor: pointer; background: var(--carte); }
.pp-prot input { position: absolute; opacity: 0; pointer-events: none; }
.pp-prot svg { color: var(--doux); }
.pp-prot b { font-size: 0.875rem; font-weight: 600; }
.pp-prot small { color: var(--doux); font-size: 0.75rem; line-height: 1.35; }
.pp-prot.is-actif { border-color: var(--cf-vert); box-shadow: inset 0 0 0 1px var(--cf-vert); background: #f3faee; }
.pp-prot.is-actif svg { color: var(--vert-fonce); }
:root[data-theme="sombre"] .pp-prot.is-actif { background: var(--pastille); }
.pp-prot:has(input:focus-visible) { outline: 2px solid var(--cf-vert); outline-offset: 2px; }
.pp-aide { margin: -2px 0 8px !important; color: var(--doux); font-size: 0.8125rem; }
.pp-compte { min-height: 8px; margin: 2px 0 8px; font-size: 0.875rem; }
.pp-compte .btn { padding: 7px 12px; }
.pp-compte-non { display: inline-flex; gap: 8px; align-items: flex-start; color: #b45309; line-height: 1.45; }
.pp-compte-non svg { flex: none; margin-top: 2px; }
.pp-compte-t { margin: 0 0 8px !important; }
.pp-code--compte { color: var(--vert-fonce); background: #eef8e6; }
.pp-code--compte b { font: 600 0.95rem/1.35 Montserrat, sans-serif; letter-spacing: 0; overflow-wrap: anywhere; }
:root[data-theme="sombre"] .pp-code--compte { background: var(--pastille); }
.pg-compte { display: inline-flex; align-items: center; gap: 4px; font-style: normal; color: var(--vert-fonce); font-weight: 600; }
@media (max-width: 760px) { .pp-protections { grid-template-columns: minmax(0, 1fr); } }

/* Les lignes de confirmation (supprimer, ne garder qu'une référence, lien) :
   leur propre mise en page, quelle que soit la grille des lignes de documents. */
.cf-ligne.cf-ligne--confirme { display: flex !important; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.cf-ligne.cf-ligne--confirme > span:first-child { flex: 1 1 320px; min-width: 0; line-height: 1.5; overflow-wrap: anywhere; }
.cf-ligne.cf-ligne--confirme .cf-confirme-actes { flex: none; }
.cf-ligne.cf-ligne--form { display: flex !important; flex-direction: column; align-items: stretch; }

/* La fenêtre de confirmation */
.md-fond { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(10, 20, 8, .45); backdrop-filter: blur(2px); animation: cf-apparait .15s ease-out; }
.md-boite { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 28px 22px;
  border-radius: 18px; background: var(--carte); box-shadow: 0 24px 60px rgba(0, 0, 0, .28); text-align: center; animation: md-entre .18s ease-out; }
.md-boite h2 { margin: 4px 0 0; font-size: 1.25rem; font-weight: 700; }
.md-boite p { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.md-pic { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; color: var(--vert-fonce); background: #e4f5d8; }
.md-pic--danger { color: var(--in-rouge); background: var(--in-rouge-fond); }
.md-liste { list-style: none; margin: 4px 0 0; padding: 8px; width: 100%; display: flex; flex-direction: column; gap: 4px; border-radius: 12px; background: var(--neutre); text-align: left; }
.md-liste li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 6px; font-size: 0.875rem; font-weight: 500; }
.md-liste li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-liste .cf-fic { width: 30px; height: 30px; border-radius: 8px; }
.md-liste .cf-fic svg { width: 16px; height: 20px; }
.md-liste .cf-fic b { bottom: 4px; font-size: 0.4rem; }
.md-reste { color: var(--doux); font-weight: 400 !important; justify-content: center; }
.md-actes { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.md-actes .btn { flex: 1; justify-content: center; min-height: 46px; border-radius: 12px; font-weight: 600; }
.md-danger { color: #fff !important; border: 0 !important; background: linear-gradient(180deg, #e0283f, #b8102a) !important; }
@keyframes md-entre { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* La barre de la sélection */
.cf-tout { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 44px; }
.cf-tout-case { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.cf-sel { margin: 4px 0; padding: 6px 10px !important; border-radius: 10px; border-bottom: 0 !important; background: #eef8e6; color: var(--texte) !important; font-weight: 600; }
:root[data-theme="sombre"] .cf-sel { background: var(--pastille); }
.cf-sel-actes { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.cf-sel-actes .btn { min-height: 34px; padding: 0 12px; font-size: 0.8125rem; background: var(--carte); }
.cf-sel-suppr { color: var(--in-rouge) !important; border-color: rgba(200, 16, 46, .35) !important; }
.cf-menu--sel { top: calc(100% + 4px); left: 0; z-index: 40; }

.md-calme, .md-calme .md-boite { animation: none !important; }
