.document, .document * { box-sizing: border-box; }
/* Contrat généré dans le navigateur (remplace le PDF produit par l'ancien serveur PHP).
   Les règles ci-dessous neutralisent les styles généraux de style.css à l'intérieur du document. */
.document p, .document h2, .document h3 { padding: 0; line-height: 1.4; font-family: Arial, Helvetica, sans-serif; color: #222; }
.document li { background: none; font-weight: normal; list-style: disc; padding: 0; line-height: 1.4; }
.document img { padding: 0 !important; float: none !important; }

/* =========================================================
   Contrat généré (aperçu écran + impression A4)
   ========================================================= */
#zone-document { padding: 25px 0 40px; overflow-x: auto; }
.barre-document { width: 210mm; margin: 0 auto 25px; text-align: right; }
.barre-document a { display: inline-block; margin-left: 10px; }
.barre-document--bas { margin: 0 auto 10px; text-align: center; }

.document { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; line-height: 1.4; color: #222; }
.document .page {
  width: 210mm; min-height: 297mm; margin: 0 auto 10mm; padding: 12mm 16mm 9mm;
  background: #fff; box-shadow: 0 4px 24px rgba(0, 0, 0, .12);
  display: flex; flex-direction: column;
}
.document .page__corps { flex: 1; }
.document p { margin: 0 0 2.6mm; text-align: justify; }
.document .vert { color: #91ba00; }
.document .rouge { color: #d40000; }
.document .gras { font-weight: 700; }
.document .centre { text-align: center; }
.document .droite { text-align: right; }
.document .souligne { text-decoration: underline; }
.document .petit { font-size: 7.5pt; }
.document .nowrap { white-space: nowrap; }

.doc-entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 6mm; margin-bottom: 7mm; }
.doc-entete__logo { width: 38mm; height: auto; }
.doc-entete__coord { text-align: right; font-size: 8pt; color: #8a8a8a; }
.doc-entete__coord p { margin: 0 0 1mm; text-align: right; }
.doc-bandeau {
  background: #91ba00; color: #fff; font-weight: 700; font-size: 12pt; text-align: center;
  padding: 2mm; margin-bottom: 5mm; letter-spacing: .03em;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.doc-article {
  font-size: 10pt; font-weight: 700; text-decoration: underline; text-align: center;
  margin: 5mm 0 3mm; color: #222;
}
.doc-identite { width: 100%; border-collapse: collapse; margin: 1mm 0 3mm; }
.doc-identite td { padding: .8mm 0; vertical-align: top; width: 50%; }
.doc-identite--annexe td:first-child { width: 40%; }
.doc-identite--annexe td { padding: 1.5mm 0; }
.retrait { padding-left: 10mm; }
.doc-option { display: flex; align-items: center; gap: 5mm; margin: 2mm 0 3mm; }
.doc-option strong { flex: 1; }
.doc-option__choix { color: #d40000; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 1.5mm; }
.doc-case {
  display: inline-flex; align-items: center; justify-content: center; width: 4.5mm; height: 4.5mm;
  border: 1px solid #d40000; color: #d40000; font-weight: 700; font-size: 9pt; line-height: 1; vertical-align: middle;
}
.doc-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; margin-top: 5mm; min-height: 32mm; }
.doc-signatures > div { min-height: 55mm; } /* place réservée aux signatures */
.doc-mention { margin: 4mm 0 0; border-top: 1px solid #ddd; padding-top: 2mm; }
.doc-titre-annexe { font-size: 11pt; text-decoration: underline; text-align: center; margin: 8mm 0 8mm; color: #222; }
.doc-liste { margin: 0 0 5mm; padding-left: 6mm; }
/* Encadré « Important » de la page de virement */
.document .doc-important { border: 1px solid #c27421; background: #fdf1e3; color: #333; padding: 3mm 4mm; margin: 3mm 0 4mm; font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.document .doc-important strong { color: #c27421; }
.doc-virement { border: 1px solid #91ba00; margin: 2mm 0 3mm; }
.doc-virement td { padding: 2mm 4mm; }
.doc-virement td:first-child { width: 35%; color: #575757; }
.doc-liste li { margin-bottom: 3mm; }

.doc-procuration-titre { display: grid; grid-template-columns: 56mm 1fr 30mm; align-items: center; gap: 4mm; margin: 4mm 0 4mm; }
.doc-procuration-titre img { width: 52mm; height: auto; }
.doc-procuration-titre strong { font-size: 14pt; white-space: nowrap; }
.doc-procuration-num { background: #ececed; font-size: 14pt; font-weight: 700; padding: 2mm 3mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-cadre { width: 100%; border: 2px solid #333; border-collapse: collapse; margin-bottom: 3mm; }
.doc-cadre td { padding: 1.8mm 2mm; vertical-align: top; width: 25%; }
.doc-cadre td.lib { text-align: right; }
.doc-cadre--poste { border-width: 1px; background: #ececed; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-cadre--poste td { width: 35%; }
.doc-cadre--poste td.timbre { width: 30%; background: #fff; }

.page__pied { display: flex; align-items: center; gap: 4mm; border-top: 1px solid #e5e5e5; padding-top: 2.5mm; margin-top: 4mm; }
.page__pied p { margin: 0; text-align: right; font-size: 7.5pt; color: #575757; flex: 1; }
.doc-pied__logo { width: 15mm; height: auto; }

/* ---------- Impression : seul le dossier est imprimé ---------- */
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  #container, .signature, .barre-document { display: none !important; }
  /* Sur le site, le contrat se consulte mais ne s'imprime pas : seule la liste des pièces sort. */
  body.mode-document .document .page:not(.page--imprimable) { display: none !important; }
  body.mode-document { background: #fff !important; margin: 0; }
  #zone-document { padding: 0 !important; overflow: visible; }
  .document .page {
    margin: 0; box-shadow: none; width: 210mm; height: 297mm; min-height: 0; overflow: hidden;
    break-after: page; page-break-after: always;
  }
  .document .page:last-child { break-after: auto; page-break-after: auto; }
}
