/* public/print.css */
@media print {
  /* Page */
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; }

  /* Hide only marked UI */
  .no-print, .no-print * { display: none !important; }

  /* Ensure preview prints as a normal flow block */
  #preview { display: block !important; }

  /* The printable sheet */
  #preview .sheet {
    width: 210mm;                 /* exact A4 width */
    box-sizing: border-box;       /* padding included in height calc */
    padding: 14mm;
    margin: 0 auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    min-height: auto !important;  /* don't force extra pages */
  }

  /* Repeat table header/footer on each page */
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }

  /* Avoid awkward splits */
  tr, td, th, img, .avoid-break { break-inside: avoid; page-break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }

  /* Better color fidelity */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
