/* ----- Mise en page générale ----- */
body { font-family: system-ui, Arial, sans-serif; }
.container { max-width: 980px; }

.inv-wrap { background:#fff; padding:28px 32px; border:none }
/* ===== ENTÊTE v2 ===== */
.inv-header{
  display:grid; grid-template-columns:1fr 1fr; align-items:start;
  column-gap:24px; margin-bottom:10px;
}
.inv-logo img{ width:200px !important; height:auto !important; display:block; }
.inv-title{ text-align:right; }
.inv-title h1{ margin:0 0 6px; font-size:20px; font-weight:800; letter-spacing:.3px; }
.inv-title .meta{ font-size:14px; color:#555; line-height:1.5; }

/* Coupe 1 px en haut du logo si l'image a un filet intégré */
.inv-logo { overflow: hidden; }
.inv-logo img {
  display: block;
  margin-top: -1px;              /* ou clip-path: inset(1px 0 0 0); */
  width: 200px !important;
  height: auto !important;
}

/* Adresses sans encadré */
.addr-cols{ display:grid; grid-template-columns:1fr 1fr; gap:48px; margin-top:16px; }
.addr{ font-size:14px; }
.addr .name{ font-weight:700; margin-bottom:6px; }
.addr .lines{ white-space:pre-line; color:#222; }

/* Cache l'ancien bloc encadré s'il reste dans le HTML */
.inv-blocks{ display:none !important; }

/* Tableau lignes comme le PDF */
.table-inv { width:100%; border-collapse:collapse; margin-top:18px; }
.table-inv thead th {
  background:#f0f0f0; border-top:1px solid #d9d9d9; border-bottom:1px solid #d9d9d9;
  padding:8px; font-weight:700; font-size:13px;
}
.table-inv td { border-bottom:1px solid #eee; padding:8px; font-size:13px; }

/* Totaux avec "Net à payer" souligné et gras */
.totals { width:360px; margin-left:auto; margin-top:12px; }
.totals td, .totals th { padding:6px 8px; font-size:13px; }
.totals tr.net th, .totals tr.net td { font-weight:800; border-top:2px solid #222; }

/* Bloc infos bas de page : paiement groupé */
.inv-infos { display:grid; grid-template-columns: 1fr 1fr; gap:24px; margin-top:16px; }
.info-label { color:#555; width:160px; display:inline-block; font-size:13px; }
.info-item { font-size:13px; }
.info-item p { margin:0; }

/* Pied de page */
.inv-footer { margin-top:28px; text-align:center; font-size:12px; color:#333; }

/* Boutons top */
.top-actions { display:flex; gap:8px; margin-bottom:12px; }

/* --- Totaux à droite, "Net à payer" souligné --- */
.totals { width: 360px; margin-left: auto; margin-top: 12px; }
.totals table { width: 100%; border-collapse: collapse; }
.totals td, .totals th { padding: 6px 8px; font-size: 13px; text-align: right; }
.totals tr.net td { font-weight: 800; border-top: 2px solid #222; }

/* --- Bloc infos: étiquettes + valeurs, collé à gauche --- */
.info-grid { display: grid; grid-template-columns: 220px 1fr; gap: 8px 24px; margin-top: 14px; }
.info-grid .label { font-weight: 600; color: #555; text-align: left; font-size:12px;}
.info-grid .value { text-align: left; font-size:12px;}

/* --- Pied de page centré --- */
.inv-footer { margin-top: 24px; text-align: center; font-size: 12px; color: #333; }
.inv-footer .strong { font-weight: 700; }

/* Supprime tout bord/ombre autour de la facture et du header */
.inv-wrap,
.inv-header,
.inv-logo,
.inv-logo img {
  border: none !important;
  box-shadow: none !important;
}

/* Lignes "commentaire" dans le tableau */
.table-inv tr.comment-row td {
  background: transparent;
  border-bottom: none;
  padding-top: 6px;
  padding-bottom: 6px;
  font-style: italic;
  color: #555;
}


/* Impression A4 propre */

@media print {
  /* A4 + marges */
  @page { size: A4; margin: 0mm 0mm; }

  /* Le footer est fixé en bas de la page imprimée */
  .inv-footer {
    position: fixed;
    bottom: 10mm;          /* identique à la marge bas @page */
    left: 15mm;            /* identique à la marge gauche @page */
    right: 15mm;           /* identique à la marge droite @page */
    text-align: center;
  }

  /* On évite qu'il chevauche le contenu : réserve en bas */
  .inv-wrap { padding-bottom: 40mm !important; }

  /* Hygiène impression */
  .top-actions, .btn, .btn-group, [class*="btn-"] { display:none !important; }
  .inv-header, .addr-cols, .table-inv, .totals, .info-grid { page-break-inside: avoid; }
}
