/* Pagination only. Everything else about the document is in invoice.css, so the preview and
   the PDF differ in exactly one thing: how the paper breaks.

   Page SIZE and MARGINS are deliberately absent. Measured on 2026-08-24 against wkhtmltopdf
   0.12.6 (patched qt): @page size and margin are ignored outright -- a Letter stylesheet
   produced a 595x842 pt page, which is A4. They are renderer options instead, in
   Pdf::Renderer::OPTIONS, where they actually take effect. */
@media print {
  .invoice { border: none; border-radius: 0; padding: 0; }

  table.inv { page-break-inside: auto; }
  table.inv tr { page-break-inside: avoid; page-break-after: auto; }
  table.inv thead { display: table-header-group; }

  /* The figures, the reason for them and the footer are ONE UNIT. page-break-inside on each
     block separately keeps each block whole and says nothing about keeping them together, so
     the N/A tax lines could stay on sheet 1 while the reason explaining them lands alone on
     sheet 2. The chain of page-break-before avoids is what binds them.

     .inv-foot needs its own avoid, and only since 2026-08-25: before the reason line existed,
     .inv-sum's page-break-after was the whole chain. The reason line now sits BETWEEN the
     summary and the footer, so that after-avoid no longer reaches .inv-foot -- and the footer
     carries the TPS/TVQ registration numbers. Without this the footer can orphan onto its own
     sheet, and ONLY on an invoice where relief was claimed.

     page-break-before is the property app/services/pdf/renderer.rb records as measured working
     against wkhtmltopdf; page-break-after is not, which is the second reason not to lean on it. */
  /* One box, kept whole. Measured 2026-08-26 against a 43-line itemized invoice: with the
     avoid-chain alone the footer orphaned onto its own sheet. */
  .inv-tail { page-break-inside: avoid; }
  .inv-sum, .inv-exempt, .inv-thanks, .inv-foot { page-break-inside: avoid; }
  .inv-sum { page-break-before: avoid; page-break-after: avoid; }
  .inv-exempt { page-break-before: avoid; }
  /* Added 2026-08-27 with the courtesy line, and it is the same defect the .inv-exempt note above
     records: .inv-thanks now sits between .inv-exempt and .inv-foot, so the chain has a new link
     and it needs its own avoid or the footer -- which carries the TPS/TVQ registration numbers --
     can orphan again. */
  .inv-thanks { page-break-before: avoid; }
  .inv-foot { page-break-before: avoid; }
}
