/* Ajustements repris de Pay4Forest v0.17.5 (app/css/p4f.css, sans l'identité CAFI) et ajouts DSPA en fin de fichier. */
/* Les titres de champs EarthRanger sont longs : le sélecteur de colonne ne doit
   pas élargir la page sur téléphone. */
.toolbar select,.toolbar input[type=text]{max-width:100%;min-width:0;text-overflow:ellipsis}
/* La barre de filtres collante doit rester au-dessus des boutons PNG (1200)
   et des contrôles Leaflet (1000). */
.filters{z-index:1300}
.filters select{max-width:100%}
/* Identifiants cliquables ouvrant une fiche. */
a.idlink{color:var(--green-d);font-weight:600;text-decoration:underline dotted}
a.idlink:hover{color:var(--green)}
.synth-report{width:100%;margin:6px 0 10px}
.synth-report td,.synth-report th{overflow-wrap:anywhere}
@media print{.synth-report thead{display:table-header-group}.synth-report tr{break-inside:avoid}}

/* Bouton en attente (application ou démonstration en cours de chargement). */
.btn:disabled{opacity:.65;cursor:progress}
/* Photos : galerie et fiches */
.photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;margin:8px 0}
.photo-card{margin:0;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:#fff;display:flex;flex-direction:column}
.photo-card img{display:block;width:100%;height:150px;object-fit:cover;background:var(--green-l)}
.photo-empty{height:150px;display:flex;align-items:center;justify-content:center;text-align:center;padding:10px;font-size:12px;color:#6b7b80;background:repeating-linear-gradient(45deg,#f4f7f7,#f4f7f7 8px,#eaf0f0 8px,#eaf0f0 16px)}
.photo-card figcaption{padding:6px 8px;font-size:12px;line-height:1.35}
@media print{
  .photo-grid{grid-template-columns:repeat(3,1fr)}
  .photo-card{break-inside:avoid}
  .photo-card img{height:auto;max-height:7cm;object-fit:contain}
  .no-print{display:none!important}
}
/* Fiches en série : une par page */
.fiche-page+.fiche-page{border-top:2px solid var(--line);margin-top:16px;padding-top:14px}
.fiches-dialog{z-index:7000}
@media print{.fiche-page{break-after:page}.fiche-page:last-child{break-after:auto}.fiche-page+.fiche-page{border-top:none;margin-top:0;padding-top:0}}
/* Fiche bénéficiaire A4 : bandeau, identification, pièces, parcelles, pied
   de page ; les images gardent leurs proportions (object-fit: contain). */
.fiche-a4{background:#fff;color:#1f2d33;display:flex;flex-direction:column;gap:8px;padding:0 0 4px}
.a4-head{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;background:linear-gradient(90deg,#0E4150,#127773);
  color:#fff;padding:12px 16px;border-radius:8px;border-bottom:4px solid #5FA83F}
.a4-head h2{color:#fff!important;margin:2px 0!important;font-size:21px;letter-spacing:.2px}
.a4-kicker{text-transform:uppercase;letter-spacing:1.2px;font-size:10.5px;opacity:.85}
.a4-id{display:inline-block;background:rgba(255,255,255,.16);border-radius:4px;padding:1px 8px;font-family:ui-monospace,Consolas,monospace;font-size:12.5px}
.a4-brand{display:flex;flex-direction:column;align-items:flex-end;font-size:10.5px;line-height:1.35;opacity:.95;text-align:right}
.a4-brand b{font-size:14px;letter-spacing:.5px}
.a4-meta{margin:0 2px}
.a4-section h3{font-size:12px;text-transform:uppercase;letter-spacing:.8px;color:#0E4150;margin:0 0 5px;padding-left:8px;border-left:4px solid #1C9A96}
.a4-kv{display:grid;grid-template-columns:repeat(4,1fr);border:1px solid #d7e3e1;border-radius:6px;overflow:hidden}
.a4-kv>div{padding:5px 9px;border-right:1px solid #e6eeec;border-bottom:1px solid #e6eeec;display:flex;flex-direction:column;min-width:0}
.a4-kv>div:nth-child(4n){border-right:none}.a4-kv>div:nth-last-child(-n+4){border-bottom:none}
.a4-k{font-size:10px;color:#5b6f74;text-transform:uppercase;letter-spacing:.4px}
.a4-v{font-size:12.5px;font-weight:600;overflow-wrap:anywhere}
.a4-map{display:block;width:100%;height:100%;object-fit:contain}
.a4-photo{margin:0;border:1px solid #d7e3e1;border-radius:6px;overflow:hidden;background:#fff;display:flex;flex-direction:column}
.a4-photo img,.a4-photo .photo-empty,.a4-photo canvas{display:block;width:100%;height:210px;object-fit:contain;background:#f6f9f8}
.a4-photo figcaption{font-size:10.5px;padding:3px 7px;font-weight:600;color:#0E4150;border-top:1px solid #e6eeec;text-align:center}
.a4-docs{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.a4-parcel{border:1px solid #d7e3e1;border-radius:8px;padding:7px 8px 8px;margin-bottom:8px;background:#fbfdfc}
.a4-parcel:last-child{margin-bottom:0}
.a4-parcel-head{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
.a4-parcel-title{font-weight:700;color:#0E4150;font-size:13px}
.a4-badges{display:flex;gap:4px;flex-wrap:wrap}
.a4-badge{font-size:10.5px;padding:1px 7px;border-radius:10px;background:#E4F3F1;color:#0E4150;white-space:nowrap}
.a4-badge.a4-ok{background:#e3f1dc;color:#2f6a1c}.a4-badge.a4-check{background:#fbecd6;color:#8a5207}
.a4-badge.a4-block{background:#f8dcd8;color:#8f271d}.a4-badge.a4-na{background:#eceff0;color:#555}
.a4-parcel-info{font-size:10.5px;color:#5b6f74;margin:3px 0 6px}
.a4-parcel-row{display:grid;grid-template-columns:1.3fr 1.3fr .8fr;gap:6px}
.a4-parcel-row.a4-map-only{grid-template-columns:1fr 1fr}
.a4-stamp{font-size:10px;color:#5b6f74;margin:-4px 2px 0}
@media (max-width:700px){.a4-parcel-row,.a4-docs{grid-template-columns:1fr}.a4-kv{grid-template-columns:repeat(2,1fr)}.a4-head{flex-direction:column;align-items:flex-start}.a4-brand{align-items:flex-start;text-align:left}}
@media print{
  .app-footer{display:none!important}
  .ov-card{background:#fff!important}
  .fiche-a4{display:block;max-height:262mm;overflow:hidden;break-inside:avoid;font-size:10px}
  .fiche-a4>*+*{margin-top:6px}
  .a4-head,.a4-kv,.a4-badge,.a4-parcel,.a4-photo img,.a4-photo .photo-empty{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  /* hauteur des images : une parcelle, deux parcelles, page de suite (trois) */
  .a4-n1 .a4-docs .a4-photo img,.a4-n1 .a4-docs .a4-photo .photo-empty{height:60mm}
  .a4-n1 .a4-parcel-row .a4-photo img,.a4-n1 .a4-parcel-row .a4-photo .photo-empty,.a4-n1 .a4-parcel-row canvas{height:56mm}
  .a4-n2 .a4-docs .a4-photo img,.a4-n2 .a4-docs .a4-photo .photo-empty{height:44mm}
  .a4-n2 .a4-parcel-row .a4-photo img,.a4-n2 .a4-parcel-row .a4-photo .photo-empty,.a4-n2 .a4-parcel-row canvas{height:39mm}
  .a4-cont .a4-parcel-row .a4-photo img,.a4-cont .a4-parcel-row .a4-photo .photo-empty,.a4-cont .a4-parcel-row canvas{height:47mm}
  .fiche-a4 .a4-parcel{padding:5px 7px 6px;margin-bottom:6px}
}
/* Audit : une ligne par fiche, colonnes de défauts lisibles */
.audit-fiches td{vertical-align:top}
.audit-fiches td:nth-child(n+5):nth-child(-n+11){min-width:170px}
.audit-fiches td:nth-child(7){min-width:260px}
.audit-fiches td:nth-child(9){min-width:420px}
.audit-fiches td:nth-child(11){min-width:280px}
.base-search{flex:1;min-width:280px;padding:9px 12px;font-size:15px}
.dossier{border:1px solid var(--line);border-radius:8px;margin:6px 0;background:#fff}
.dossier>summary{cursor:pointer;padding:8px 10px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;list-style-position:inside}
.dossier[open]>summary{border-bottom:1px solid var(--line);background:#f6faf9}
.dossier-id{font-family:ui-monospace,Consolas,monospace;font-size:12.5px;background:#E4F3F1;border-radius:4px;padding:1px 6px}
.dossier-sev{font-size:11px;font-weight:700;border-radius:10px;padding:1px 8px;color:#fff;background:#7f8c8d}
.dossier-sev.dossier-b{background:#c0392b}.dossier-sev.dossier-i{background:#e08a1e}.dossier-sev.dossier-m{background:#caa915}
.dossier-wrap{margin:8px;max-height:none}
.dossier-compare th{text-align:left;white-space:nowrap;background:#f1f6f5}
.dossier-compare td{min-width:190px;vertical-align:top}
.dossier-bad{background:#fbe3e0;color:#8f271d;font-weight:700}
.dossier-attach{font-weight:400;font-size:11px;color:#8a5207;background:#fbecd6;border-radius:8px;padding:0 6px}
.dossier-f{font-size:12px;margin:2px 0;padding-left:6px;border-left:3px solid #7f8c8d}
.dossier-f.dossier-b{border-color:#c0392b}.dossier-f.dossier-i{border-color:#e08a1e}.dossier-f.dossier-m{border-color:#caa915}
.dossier-fix{color:#2f6a1c;font-size:11.5px}
.btn-mini{font-size:11px;padding:1px 6px;border:1px solid var(--line);border-radius:5px;background:#fff;cursor:pointer;text-decoration:none;color:var(--green-d)}
.sync-card{border-color:#1C9A96;background:#f2faf8}
.sync-card input[type=date]{margin-left:6px}
.dossier-namesakes td{background:#fffaf0}
.dossier-warn{font-weight:600;color:#8a5207;margin-bottom:2px}

/* ------------------------------------------------------------ DSPA --- */
.section-title{font-size:16px;color:var(--green-d);margin:22px 0 4px;border-bottom:2px solid var(--green-l);padding-bottom:4px}
.alert-row{display:flex;gap:6px;align-items:center;flex-wrap:wrap;padding:7px 10px;margin:4px 0;border:1px solid var(--line);border-left:4px solid #7f8c8d;border-radius:6px;background:#fff;font-size:13px}
.alert-row.sev-b{border-left-color:#c0392b}.alert-row.sev-i{border-left-color:#e08a1e}.alert-row.sev-m{border-left-color:#caa915}
.alert-row .btn-mini{margin-left:auto}
.audit-fiches td:nth-child(7){min-width:380px}
.audit-fiches td:nth-child(9){min-width:260px}
a.filecard:hover{border-color:var(--green)}
.report-preview h4,.ov-card .synth-section h4{margin:12px 0 4px;font-size:13px;color:var(--green-d)}
.synth-section{margin:14px 0}
@media print{.synth-section{break-inside:auto}.synth-section h3{break-after:avoid}}
