/* Shared Beleg print geometry — the @page + paged.js-safe break rules used
   by BOTH the browser-print path (loaded via a media="print" <link> in
   app/layout.tsx) AND paged.js (passed to the Previewer in beleg-paged-preview.tsx).
   Keeping the @page + break rules in a single file makes the on-screen paged.js
   preview and the actual browser print break 1:1 by construction.

   IMPORTANT — this file does NOT host EITHER per-page footer mechanism. The two
   footer feeds are kept isolated, each in its own file:
     * NATIVE browser print → public/beleg-print-native.css (the display:table /
       table-footer-group running footer; loaded via a media="print" <link>).
     * paged.js screen preview → public/beleg-print-paged.css (the
       position:running(belegFooter) + @bottom-center running element; passed to
       the Previewer ALONGSIDE this file).
   This file carries NEITHER — it must stay safe for both feeds: the native
   display:table switch would collapse the paged.js preview to one page
   (Stefan-Bug 2026-06-08), and a paged.js running rule would be inert / wrong in
   native print. So both footer position rules live OUT of here. Everything in
   THIS file is safe for paged.js AND native print to apply.

   GoBD (Commit 1, supersedes the 2026-06-07 Schritt-0-Lock): break-inside:avoid now
   applies to ALL Belege (no festgeschrieben carve-out). The original scope assumed
   the browser's NATIVE break engine could diverge between a festgeschriebenes
   invoice's issue + its reprint, so it left festgeschriebene Belege on the browser's
   existing pagination. Under the deterministic paged.js chunker — which both the
   on-screen preview AND the standalone print route now use — the issue + reprint go
   through the identical pagination (the invoice reprints from its immutable snapshot
   through the SAME chunker), so „keep the issued page breaks" holds by construction
   and the carve-out is meaningless. All Belege get the clean break-inside:avoid. */

@page {
  size: A4;
  /* Extra BOTTOM margin reserves space for the per-page Brieffuß. Both footer
     feeds render the band in this bottom band: native print via
     table-footer-group (beleg-print-native.css), paged.js via the @bottom-center
     running element (beleg-print-paged.css). */
  margin: 18mm 18mm 30mm;
}

/* NB: this file carries NO per-page footer position rule. The paged.js running
   footer (position:running + @bottom-center) lives in public/beleg-print-paged.css;
   the native table-footer-group footer lives in public/beleg-print-native.css.
   Keeping both OUT of here keeps this shared geometry safe for both feeds. */

/* Repeat the position-table column header on every page (print + paged.js). */
thead {
  display: table-header-group;
}

/* Never cut a position row across a page break — ALL Belege (Commit 1, Stefan-
   LOCKED). Under paged.js' deterministic chunker the festgeschrieben carve-out is
   meaningless: a festgeschriebenes invoice reprints from its immutable snapshot
   through the SAME paged.js pagination, so „keep the issued page breaks" already
   holds by construction (the breaks ARE the paged.js breaks, both at issue and at
   reprint). The earlier `:not([data-festgeschrieben])` scope assumed the browser's
   native break engine could diverge between issue + reprint; it cannot under the
   deterministic chunker, so all invoices now get the clean break-inside:avoid. The
   data-festgeschrieben attribute on the <article> is inert after this change
   (Commit 2 cleanup). */
article tbody tr {
  break-inside: avoid;
}

/* paged.js SCREEN preview only: flow the fixed-A4 <article> inside paged.js' @page
   boxes (mirrors the browser-print Tailwind reset print:w-auto / p-0 / min-h-0) and
   give the discrete A4 sheets paper chrome. Inert in browser print — no .pagedjs_*
   elements exist there. */
.pagedjs_pages article {
  width: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.pagedjs_page {
  background: #fff;
  margin: 0 auto 18px;
  /* Border + a symmetric soft shadow so the sheet's edges — incl. the TOP edge —
     read against the page-coloured surface (design-ref Briefpapier-Umrandung). */
  border: 1px solid rgba(20, 16, 28, 0.13);
  box-shadow: 0 1px 14px rgba(20, 16, 28, 0.12);
}
