/* Documents imprimés au format A4 (navigateur → imprimante ou PDF). */
@page { size: A4; margin: 14mm 12mm; }
:root { --ink: #15171C; --muted: #5B616E; --line: #C5CAD3; --primary: #1E56C8; }
* { box-sizing: border-box; }
body.a4-body { margin: 0; background: #ECEEF2; color: var(--ink); font: 10.5pt/1.4 'IBM Plex Sans', system-ui, sans-serif; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.a4-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; justify-content: center; padding: 14px; font: 400 14px 'IBM Plex Sans', sans-serif; }
.a4-actions label { display: inline-flex; align-items: center; gap: 6px; }
.a4-actions input:not([type="checkbox"]):not([type="hidden"]) { min-height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font: inherit; width: 8em; }
.a4-actions select { min-height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font: inherit; background: #FFFFFF; }
.a4-compte { font-weight: 600; }
.a4-vide { text-align: center; color: var(--muted); }
.btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #FFFFFF;
  color: var(--ink); font: 500 14px 'IBM Plex Sans', sans-serif; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.a4 { width: 210mm; min-height: 297mm; margin: 0 auto 24px; padding: 14mm 12mm; background: #FFFFFF; box-shadow: 0 8px 24px rgba(18,24,38,.15); display: flex; flex-direction: column; gap: 5mm; }
.a4-head { display: flex; justify-content: space-between; gap: 10mm; }
.a4-societe, .a4-adresse { display: flex; flex-direction: column; }
.a4-societe strong { font-size: 14pt; color: var(--primary); }
.a4-adresse { min-width: 80mm; padding: 4mm 5mm; border: 1px solid var(--line); border-radius: 2mm; margin-top: 8mm; }
.a4-adresse span:first-child { font-weight: 600; }
.a4-petit { font-size: 9pt; color: var(--muted); }
.a4-titre { margin: 2mm 0 0; font-size: 16pt; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2mm 5mm; }
.a4-marque { font-size: 11pt; letter-spacing: .08em; border: 1.5px solid currentColor; border-radius: 1.5mm; padding: 0.5mm 2mm; }
.a4-rouge { color: #B42318; }
.a4-entete { font-weight: 600; }
.a4 + .a4 { break-before: page; }
.a4-infos { display: flex; flex-wrap: wrap; gap: 2mm 8mm; margin: 0; }
.a4-infos div { display: flex; gap: 2mm; }
.a4-infos dt { color: var(--muted); }
.a4-infos dd { margin: 0; font-weight: 500; }
.a4-texte { margin: 0; }
.a4-lignes, .a4-tva { width: 100%; border-collapse: collapse; }
.a4-lignes th, .a4-tva th { text-align: left; font-weight: 600; font-size: 9pt; color: var(--muted); border-bottom: 1.5px solid var(--ink); padding: 1.5mm 1.5mm; }
.a4-lignes td, .a4-tva td { padding: 1.3mm 1.5mm; border-bottom: 0.5px solid #DCDFE5; vertical-align: top; }
.a4-lignes th.num, .a4-tva th.num { text-align: right; }
.a4-sous td { font-weight: 600; background: #F4F5F7; }
.a4-auto td { color: var(--muted); font-size: 9pt; }
.a4-pied { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; margin-top: 2mm; break-inside: avoid; }
.a4-tva { width: 90mm; }
.a4-totaux { display: grid; grid-template-columns: auto auto; gap: 1mm 8mm; margin: 0; min-width: 70mm; }
.a4-totaux dt { color: var(--muted); }
.a4-totaux dd { margin: 0; text-align: right; font-family: 'IBM Plex Mono', monospace; }
.a4-grand { font-weight: 700; color: var(--ink) !important; font-size: 12pt; }
.a4-paiement { display: flex; flex-wrap: wrap; gap: 3mm 10mm; margin: 0; padding: 3mm 4mm; border: 1px solid var(--line); border-radius: 2mm; break-inside: avoid; }
.a4-signature { margin-top: 6mm; height: 25mm; width: 80mm; border: 1px solid var(--line); border-radius: 2mm; padding: 2mm 3mm; color: var(--muted); font-size: 9pt; break-inside: avoid; }
.a4-mention { margin-top: auto; padding-top: 4mm; border-top: 1px solid var(--line); font-size: 8.5pt; color: var(--muted); }
.a4-cgv { font-size: 6.5pt; line-height: 1.3; color: var(--muted); column-count: 2; column-gap: 6mm; }

/* Lot H : raccourcis dans la barre, texte d'en-tête des factures (P6), note d'escompte sur la base TVA */
.a4-actions .btn { gap: 8px; }
.kbd { font-family: 'IBM Plex Mono', monospace; font-size: 11px; line-height: 16px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
.btn.primary .kbd { border-color: rgba(255,255,255,.5); }
.a4-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0; }
.a4-entete-facture { padding: 2mm 3mm; border-left: 1mm solid var(--primary); background: #F4F6FB; }
.a4-tva .a4-note td { font-size: 8.5pt; color: var(--muted); border-bottom: 0; }

/* Lot H : lettres de relance et relevés de compte (aussi recopiés dans les e-mails) */
.a4-lettre { gap: 4mm; }
.a4-lieu { margin: 0; text-align: right; }
.a4-lettre .a4-titre { margin-top: 0; }
.a4-h2 { margin: 2mm 0 0; font-size: 11.5pt; }
.a4-relance td.mono, .a4-relance td.num { white-space: nowrap; }
.a4-relance .a4-comm td { padding-top: 0; font-size: 8.5pt; color: var(--muted); }
.a4-relance tr:has(+ .a4-comm) td { border-bottom: 0; }
.a4-credit td { color: var(--muted); font-style: italic; }
.a4-echu td:nth-child(3) { color: #B42318; font-weight: 600; }
.a4-signature-lettre { margin: 6mm 0 0 auto; min-width: 70mm; text-align: left; }
.a4-niveau-3 .a4-titre { color: #B42318; }

@media screen and (max-width: 820px) {
  .a4 { width: 100%; min-height: 0; padding: 16px; }
  .a4-head, .a4-pied { flex-direction: column; }
  .a4-adresse, .a4-tva { min-width: 0; width: 100%; }
  .a4-lignes { display: block; overflow-x: auto; }
  .a4-actions .btn .kbd { display: none; }
  .a4-signature-lettre { margin-left: 0; }
}
@media print {
  body.a4-body { background: #FFFFFF; }
  .a4-entete-facture { background: none; }
  .no-print { display: none !important; }
  .a4 { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
}
