/* DP3 (Claude, 28/10/2026) : espace de contrôle des pièces d un dossier importé d une demande partenaire (employee-espace.js).
   Toutes les règles sont sous .lc-esp-on (posée sur le volet consommation tant que le dossier importé est actif) : les autres parcours
   et le dossier saisi directement gardent leur présentation. Palette et police du simulateur (variables de style.css). */
.lc-esp-on .lc-esp[hidden], .lc-esp-on .lc-esp-article [hidden] { display: none !important; }
.lc-esp { box-sizing: border-box; margin: 14px 0 12px; padding: 16px; border: 1px solid #dfe7f1; border-radius: 16px; background: #f5f9fd; font-family: Arial, Helvetica, sans-serif; color: #213c67; }
.lc-esp-tete h4 { margin: 0 0 4px; color: #0a3d62; font-size: 17px; }
.lc-esp-tete p { margin: 0 0 12px; color: #72829a; font-size: 13px; line-height: 1.45; }
.lc-esp-pieces { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.lc-esp-piece { position: relative; display: flex; flex-direction: column; gap: 5px; min-width: 0; min-height: 132px; padding: 11px 12px 12px; border: 1px solid #dfe7f1; border-radius: 13px; background: #fff; color: #213c67; font: inherit; text-align: left; cursor: pointer; box-shadow: 0 6px 18px rgba(7, 34, 61, .05); transition: border-color .15s ease, box-shadow .15s ease; }
.lc-esp-piece:hover { border-color: #9fdde3; box-shadow: 0 8px 22px rgba(7, 34, 61, .09); }
.lc-esp-piece:focus-visible, .lc-esp-onglet:focus-visible, .lc-esp-outils-btn:focus-visible, .lc-esp-lien:focus-visible, .lc-esp-btn:focus-visible, .lc-esp-article [data-esp-ligne]:focus-visible { outline: 3px solid rgba(23, 196, 208, .45); outline-offset: 2px; }
.lc-esp-piece.is-courante { border: 2px solid #17c4d0; padding: 10px 11px 11px; background: #fff; box-shadow: 0 10px 26px rgba(10, 143, 151, .16); }
.lc-esp-piece-haut { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.lc-esp-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; background: #e7fafc; color: #0a8f97; }
.lc-esp-recue { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.lc-esp-recue.is-ok { background: #e8f6ef; color: #1a8f63; }
.lc-esp-recue.is-ko { background: #fdf0ee; color: #b3261e; }
.lc-esp-piece-titre { color: #0a3d62; font-size: 14px; line-height: 1.25; }
.lc-esp-piece-meta { color: #72829a; font-size: 11.5px; line-height: 1.35; }
.lc-esp-piece-bas { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: auto; font-size: 12px; }
.lc-esp-reste { color: #263d5f; font-weight: 700; }
.lc-esp-piece.is-fait .lc-esp-reste { color: #1a8f63; }
.lc-esp-piece.is-manque .lc-esp-reste, .lc-esp-piece.is-echec .lc-esp-reste { color: #b3261e; }
.lc-esp-ratio { color: #72829a; font-variant-numeric: tabular-nums; }
.lc-esp-barre { display: block; height: 5px; border-radius: 999px; background: #dfe7f1; overflow: hidden; }
.lc-esp-barre span { display: block; height: 100%; border-radius: 999px; background: #17c4d0; }
.lc-esp-piece.is-fait .lc-esp-barre span { background: #1a8f63; }
.lc-esp-piece-cat { color: #b3261e; font-size: 11px; }
.lc-esp-bilan { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid #dfe7f1; border-radius: 12px; background: #fff; font-size: 12.5px; color: #263d5f; }
.lc-esp-bilan-titre { color: #0a3d62; font-size: 14px; }
.lc-esp-cat { padding: 2px 9px; border-radius: 999px; background: #f5f9fd; border: 1px solid #dfe7f1; white-space: nowrap; }
.lc-esp-cat.is-auto { background: #e7fafc; border-color: #bdeef2; color: #0a8f97; }
.lc-esp-cat.is-agent { background: #e8f6ef; border-color: #bfe3d2; color: #1a8f63; }
.lc-esp-cat.is-disc { background: #fdf0ee; border-color: #f0c9c4; color: #b3261e; }
.lc-esp-cat.is-clar { background: #fff; border-color: #17c4d0; color: #0a3d62; }
.lc-esp-ecarts { flex-basis: 100%; color: #263d5f; line-height: 1.5; }
.lc-esp-lien { padding: 0; border: 0; background: none; color: #0a8f97; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* une seule pièce ouverte */
.lc-esp-on .lc-doc-cartes[data-espace-actif] > article.lc-doc-carte:not(.is-esp-courante) { display: none; }
.lc-esp-on .lc-esp-article.is-esp-courante { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-auto-flow: row dense; column-gap: 16px; row-gap: 0; align-items: start; }
.lc-esp-on .lc-esp-article.is-esp-courante > * { grid-column: 1 / -1; min-width: 0; margin-top: 0; }
.lc-esp-on .lc-esp-article > [data-esp-zone="tete"] { grid-row: 1; margin-bottom: 10px; }
.lc-esp-on .lc-esp-article > [data-esp-zone="pap"] { grid-row: 2; }
.lc-esp-on .lc-esp-article > [data-esp-zone="onglets"] { grid-row: 3; }
.lc-esp-on .lc-esp-article > [data-esp-zone="decl"] { grid-row: 4; }
.lc-esp-on .lc-esp-article > [data-esp-zone="doc"] { grid-column: 1; grid-row: 5 / span 14; }
.lc-esp-on .lc-esp-article > [data-esp-zone="donnees"], .lc-esp-on .lc-esp-article > [data-esp-zone="att"] { grid-column: 2; order: 1; margin-bottom: 10px; }
.lc-esp-on .lc-esp-article > [data-esp-zone="outil"], .lc-esp-on .lc-esp-article > [data-esp-zone="piece"] { order: 2; margin-bottom: 10px; }
.lc-esp-on .lc-esp-article > [data-esp-zone="pied"] { order: 3; }
.lc-esp-on .lc-esp-article[data-espace-onglet="donnees"] > [data-esp-zone="att"] { display: none; }
.lc-esp-on .lc-esp-article[data-espace-onglet="attestations"] > [data-esp-zone="donnees"] { display: none; }
.lc-esp-on .lc-esp-article[data-espace-outils="ferme"] > [data-esp-zone="outil"] { display: none; }
.lc-esp-on .lc-esp-article[data-espace-outils="ferme"]:not([data-esp-sans-piece]) > [data-esp-zone="piece"] { display: none; }
.lc-esp-on .lc-esp-article[data-esp-sans-piece] > [data-esp-zone="doc"] { display: none; }
.lc-esp-on .lc-esp-article[data-esp-sans-piece] > [data-esp-zone="donnees"], .lc-esp-on .lc-esp-article[data-esp-sans-piece] > [data-esp-zone="att"] { grid-column: 1 / -1; }
.lc-esp-on .lc-esp-article[data-esp-sans-piece] > [data-esp-zone="piece"] { grid-row: 5; margin-bottom: 10px; }

/* en-tête de la pièce : son nom et ses états restent ceux du simulateur */
.lc-esp-on .lc-esp-article > header.lc-doc-tete h4 { font-size: 18px; }

/* Papitcho */
.lc-esp-pap { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; padding: 14px 16px; border: 1px solid #bdeef2; border-radius: 16px; background: linear-gradient(135deg, #fff 0%, #e7fafc 100%); }
.lc-esp-pap-perso { flex: none; width: 64px; }
.lc-esp-pap .lc-pap-visuel.lc-esp-pap-visuel { width: 64px; height: 128px; object-fit: contain; }
.lc-esp-pap-bulle { position: relative; flex: 1 1 auto; min-width: 0; padding: 10px 14px; border: 1px solid #dfe7f1; border-radius: 14px; background: #fff; box-shadow: 0 6px 16px rgba(7, 34, 61, .06); }
.lc-esp-pap-bulle::before { content: ""; position: absolute; left: -7px; top: 26px; width: 12px; height: 12px; border-left: 1px solid #dfe7f1; border-bottom: 1px solid #dfe7f1; background: #fff; transform: rotate(45deg); }
.lc-esp-pap-entete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.lc-esp-pap-id { color: #0a3d62; font-size: 13px; }
.lc-esp-pap-id strong { font-size: 14px; }
.lc-esp-pap-etat { padding: 3px 10px; border-radius: 999px; background: #f5f9fd; border: 1px solid #dfe7f1; color: #263d5f; font-size: 11.5px; font-weight: 700; }
.lc-esp-pap-etat.is-trouve { background: #e7fafc; border-color: #9fdde3; color: #0a8f97; }
.lc-esp-pap-etat.is-fini { background: #e8f6ef; border-color: #bfe3d2; color: #1a8f63; }
.lc-esp-pap-etat.is-alerte { background: #fff6e5; border-color: #f2a20c; color: #8a5a00; }
.lc-esp-pap-etat.is-cours { background: #e7fafc; border-color: #17c4d0; color: #0a8f97; }
.lc-esp-pap-doc { margin: 6px 0 2px; color: #72829a; font-size: 12px; overflow-wrap: anywhere; }
.lc-esp-pap-doc strong { color: #263d5f; }
.lc-esp-pap-msg { margin: 4px 0; color: #213c67; font-size: 13.5px; line-height: 1.5; }
.lc-esp-pap-donnee { margin: 8px 0 4px; padding: 8px 10px; border-left: 3px solid #17c4d0; border-radius: 0 10px 10px 0; background: #f5f9fd; font-size: 13px; line-height: 1.5; color: #213c67; overflow-wrap: anywhere; }
.lc-esp-pap-donnee p { margin: 0; }
.lc-esp-pap-donnee.is-doute, .lc-esp-pap-donnee.is-absent { border-left-color: #f2a20c; background: #fffaf0; }
.lc-esp-pap-donnee.is-ecart { border-left-color: #b3261e; background: #fdf6f5; }
.lc-esp-pap-donnee.is-decision { border-left-color: #1a8f63; background: #f3faf6; }
.lc-esp-tag { display: inline-block; margin-right: 4px; padding: 1px 7px; border-radius: 999px; background: #e7fafc; color: #0a8f97; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.lc-esp-tag.is-decl { background: #eef1f6; color: #263d5f; }
.lc-esp-pap-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lc-esp-pap-note { margin: 8px 0 0; color: #72829a; font-size: 11.5px; line-height: 1.4; }
@media (prefers-reduced-motion: no-preference) {
  .lc-esp-pap.is-maj .lc-esp-pap-bulle { animation: lcEspBulle .35s ease-out; }
  .lc-esp-pap-etat.is-cours { animation: lcEspPulse 1.6s ease-in-out infinite; }
  .lc-esp-barre span { transition: width .3s ease-out; }
}
@keyframes lcEspBulle { from { opacity: .35; } to { opacity: 1; } }
@keyframes lcEspPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* onglets et outils */
.lc-esp-onglets { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 6px; margin: 2px 0 10px; border-bottom: 1px solid #dfe7f1; }
.lc-esp-onglet { min-height: 42px; padding: 9px 14px; border: 0; border-bottom: 3px solid transparent; background: none; color: #72829a; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.lc-esp-onglet[aria-selected="true"] { border-bottom-color: #17c4d0; color: #0a3d62; }
.lc-esp-compte { margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: #f5f9fd; border: 1px solid #dfe7f1; color: #263d5f; font-size: 11.5px; }
.lc-esp-onglet[aria-selected="true"] .lc-esp-compte { background: #e7fafc; border-color: #9fdde3; color: #0a8f97; }
.lc-esp-outils-btn { margin-left: auto; min-height: 36px; margin-bottom: 4px; padding: 6px 12px; border: 1px solid #dfe7f1; border-radius: 999px; background: #fff; color: #263d5f; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.lc-esp-outils-btn[aria-expanded="true"] { border-color: #17c4d0; color: #0a8f97; }

/* déclarations du partenaire en synthèse (la grille verrouillée passe dans les outils) */
.lc-esp-decl { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #dfe7f1; border-radius: 12px; background: #fff; }
.lc-esp-decl-titre { margin: 0 0 6px; color: #72829a; font-size: 12px; line-height: 1.45; }
.lc-esp-decl-liste { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 6px 14px; margin: 0; }
.lc-esp-decl-ligne { min-width: 0; }
.lc-esp-decl-ligne dt { color: #72829a; font-size: 11.5px; }
.lc-esp-decl-ligne dd { margin: 1px 0 0; color: #0a3d62; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.lc-esp-decl-note { display: block; color: #72829a; font-size: 11px; font-weight: 400; }

/* panneau document (vraie page rendue par lecture.js) */
.lc-esp-doc { box-sizing: border-box; contain: size; min-height: 560px; margin-bottom: 10px; }
.lc-esp-doc-collant { position: sticky; top: 10px; box-sizing: border-box; max-height: calc(100vh - 20px); overflow: auto; padding: 10px 12px; border: 1px solid #dfe7f1; border-radius: 14px; background: #fff; box-shadow: 0 6px 18px rgba(7, 34, 61, .05); }
.lc-esp-doc-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: #0a3d62; font-size: 13px; overflow-wrap: anywhere; }
.lc-esp-doc[data-page-etat="affichee"] .lc-esp-doc-collant { border-color: #9fdde3; }
.lc-esp-doc[data-page-etat="echec"] .lc-esp-doc-collant, .lc-esp-doc[data-page-etat="perimee"] .lc-esp-doc-collant { border-color: #f0c9c4; }
.lc-esp-doc-corps { min-height: 200px; }
.lc-esp-doc-corps img { display: block; max-width: 100%; height: auto; border: 1px solid #dfe7f1; border-radius: 6px; }
.lc-esp-doc-vide { margin: 30px 10px; padding: 24px 16px; border: 1px dashed #c8d6e5; border-radius: 12px; color: #72829a; font-size: 13px; line-height: 1.5; text-align: center; }
.lc-esp-doc .lc-page-extrait { margin: 0 0 6px; padding: 6px 8px; border-left: 3px solid #17c4d0; background: #f5f9fd; font-size: 12.5px; }
.lc-esp-doc .lc-page-note { margin: 6px 0 0; color: #72829a; font-size: 11.5px; }

/* données : liste courte, une carte dépliée */
.lc-esp-on .lc-esp-article > .lc-doc-lecture { margin-top: 0; }
.lc-esp-on .lc-esp-article[data-espace-outils="ferme"] .lc-doc-lecture .lc-lecture-tete,
.lc-esp-on .lc-esp-article[data-espace-outils="ferme"] .lc-doc-lecture .lc-lecture-details,
.lc-esp-on .lc-esp-article[data-espace-outils="ferme"] .lc-doc-lecture .lc-lecture-technique,
.lc-esp-on .lc-esp-article[data-espace-outils="ferme"] .lc-doc-lecture .lc-lecture-bilan,
.lc-esp-on .lc-esp-article[data-espace-outils="ferme"] .lc-doc-lecture [data-dp2-aide],
.lc-esp-on .lc-esp-article[data-espace-outils="ferme"] .lc-doc-lecture [data-dp2-note] { display: none; }
.lc-esp-on .lc-esp-article .lc-emp-cc.is-dp2 > .lc-emp-cc-titre { margin: 0 0 8px; font-size: 14px; }
.lc-esp-on .lc-esp-article .lc-dp2-carte { margin: 0 0 6px; border-radius: 12px; }
.lc-esp-on .lc-esp-article .lc-dp2-carte.is-esp-replie .lc-revue > :not(.lc-emp-cc-tete) { display: none; }
.lc-esp-on .lc-esp-article .lc-dp2-carte.is-esp-replie { background: #fff; }
.lc-esp-on .lc-esp-article .lc-dp2-carte.is-esp-replie .lc-revue { padding-top: 6px; padding-bottom: 6px; }
.lc-esp-on .lc-esp-article .lc-dp2-carte.is-esp-replie .lc-emp-cc-tete { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.lc-esp-on .lc-esp-article .lc-dp2-carte.is-esp-replie .lc-emp-cc-tete::after { content: "Ouvrir"; margin-left: auto; color: #0a8f97; font-size: 12px; font-weight: 700; }
.lc-esp-on .lc-esp-article .lc-dp2-carte.is-esp-active { border: 2px solid #17c4d0; box-shadow: 0 8px 22px rgba(10, 143, 151, .12); }
.lc-esp-on .lc-esp-article .lc-dp2-carte .lc-dp2-btn[disabled] { opacity: .45; }

/* attestations dans la pièce */
.lc-esp-att-intro { padding: 10px 12px; border: 1px solid #dfe7f1; border-radius: 12px; background: #fff; font-size: 13px; color: #213c67; }
.lc-esp-att-titre { margin: 0 0 6px; color: #0a3d62; font-size: 14px; }
.lc-esp-att-etats { margin: 0 0 6px; padding: 0; list-style: none; }
.lc-esp-att-etats li { margin: 3px 0; line-height: 1.45; overflow-wrap: anywhere; }
.lc-esp-att-note { margin: 6px 0 0; color: #263d5f; font-size: 12.5px; line-height: 1.5; }

.lc-esp-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid #dfe7f1; color: #72829a; font-size: 12px; }

/* écran moyen : bandeau des pièces en deux lignes */
@media (max-width: 1240px) { .lc-esp-pieces { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* écran étroit : une colonne ; la page s ouvre dans la fenêtre existante (lecture.js) */
@media (max-width: 1099px) {
  .lc-esp-on .lc-esp-article.is-esp-courante { display: flex; flex-direction: column; }
  .lc-esp-on .lc-esp-article > [data-esp-zone="doc"] { display: none; }
  .lc-esp-on .lc-esp-article > [data-esp-zone="tete"] { order: -4; }
  .lc-esp-on .lc-esp-article > [data-esp-zone="pap"] { order: -3; }
  .lc-esp-on .lc-esp-article > [data-esp-zone="onglets"] { order: -2; }
  .lc-esp-on .lc-esp-article > [data-esp-zone="decl"] { order: -1; }
}
@media (max-width: 700px) {
  .lc-esp { padding: 12px; }
  .lc-esp-pieces { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lc-esp-piece { min-height: 0; }
  .lc-esp-pap { padding: 10px; gap: 8px; }
  .lc-esp-pap-perso { width: 40px; }
  .lc-esp-pap .lc-pap-visuel.lc-esp-pap-visuel { width: 40px; height: 80px; }
  .lc-esp-outils-btn { margin-left: 0; }
  .lc-esp-onglet { padding: 8px 8px; font-size: 13px; }
}
@media (max-width: 380px) { .lc-esp-pieces { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .lc-esp-piece, .lc-esp-barre span { transition: none; } }
/* le cadre coloré de la lecture (état global de la pièce) est porté par les cartes ; pas de second cadre autour de la liste */
.lc-esp-on .lc-esp-article > .lc-doc-lecture, .lc-esp-on .lc-esp-article > .lc-doc-lecture > .lc-lecture-resultat { padding: 0; border: 0; background: transparent; box-shadow: none; }
.lc-esp-on .lc-esp-article .lc-emp-cc.is-dp2 { margin-top: 0; }
.lc-esp-doc { overflow: clip; min-height: min(calc(100vh - 20px), 880px); }
.lc-esp-pap-maj { margin: 6px 0 2px; padding: 6px 10px; border-radius: 10px; background: #e8f6ef; color: #145f45; font-size: 12.5px; line-height: 1.45; }
.lc-esp-doc:not([data-page-etat]) { min-height: 300px; }
/* R12 et R18 : dans l espace, l état de la pièce se lit dans le bandeau des pièces et chez Papitcho (mêmes faits) ; l ancienne pastille de lecture
   (« Écarts à vérifier ») reste dans le simulateur mais n est pas répétée en tête de la pièce */
.lc-esp-on .lc-esp-article > header.lc-doc-tete [data-piece-lecture-etat] { display: none; }
/* R21-R22 : résultat groupé de la préqualification d un dossier importé (consommation.js, htmlResultatGroupes) */
.lc-res-groupes h5, .lc-res-groupes h4 { margin: 14px 0 6px; color: #0a3d62; font-size: 14.5px; }
.lc-res-groupes ul { margin: 0 0 6px; padding-left: 20px; }
.lc-res-groupes li { margin: 4px 0; line-height: 1.5; }
.lc-res-groupe.is-reel h5, .lc-res-groupe.is-reel h4 { color: #b3261e; }
.lc-res-lien { display: inline-flex; align-items: center; min-height: 30px; margin-left: 6px; padding: 3px 12px; border: 1px solid #9fdde3; border-radius: 999px; background: #e7fafc; color: #0a8f97; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; vertical-align: middle; }
.lc-res-lien:hover { background: #d6f5f8; }
.lc-res-lien:focus-visible { outline: 3px solid rgba(23, 196, 208, .45); outline-offset: 2px; }
