/* print-r2.css - what every phase-2 style (r2-*: ฉ r2-cards, ก r2-minimal, ช r2-formal; N-127 and the owner's later pick) shares: the
   owner's 2026-10-10 fixes that hold in every direction and the engine-side guards; the look of each is its own file
   (print-r2-<style>.css). Every rule under .paper[data-theme^=r2-], so modern / classic / formal print exactly as before.
   Loaded from index.html after print.css and before the styles' own files: a rule here, its print.css twin and a style's own rule all
   weigh the same, the later file wins - print.css < print-r2.css < print-r2-<style>.css.
   Hooks line C's C-2 writes (each style's file may restyle them):
     --title-from / --title-max on .paper (sheet(), from STYLE_DEFS[*].title)   the style's title size and the room it may take
     --title-pt on .paper    the title's size, measured to stay on one line within --title-max (--title-from without the hook)
     .p-title-2              a title still too long at 14pt: its part after the "/" on a line of its own
     .p-msub                 the credit term under the due date, on its own line
     .p-payrow (.has-qr .is-paid) > .p-paytitle + .p-payfields (dl > div > dt dd) + .p-payqr    the full-width payment row
     .p-lth / .p-len         a label in Thai / in English (one of them alone in a one-language document) */

.paper[data-theme^=r2-]{border-top:0}
/* a free layout (FD-2a) draws the accent edge over its top - no r2 style has one */
.paper[data-theme^=r2-].p-free::before{display:none}

/* min-width:0 on every grid / flex cell: a .p-keep (nowrap) piece or a long name would otherwise widen its cell past the page */
.paper[data-theme^=r2-] .p-head,.paper[data-theme^=r2-] .p-head.no-logo{grid-template-columns:minmax(0,1fr) auto}
.paper[data-theme^=r2-] .p-head>*,.paper[data-theme^=r2-] .p-co,.paper[data-theme^=r2-] .p-parties>*,.paper[data-theme^=r2-] .p-summary>*{min-width:0}

/* the title on one line at the hook's size; a title still too long breaks only after its "/" */
.paper[data-theme^=r2-] .p-title{white-space:nowrap;letter-spacing:0}
.paper[data-theme^=r2-] .p-title-2{display:block}

/* owner 2026-10-10: a facts label never wraps, a value may; the credit term on its own line. Two languages: each label stays whole and
   the English goes under the Thai only when the value needs the room (E-4: "ใบกำกับเดิมเลขที่ Original tax invoice no." beside an
   unbreakable number pushed the card 1.3 mm wide) - the label's parts are flex items, so the second line starts at the edge, no " · " */
.paper[data-theme^=r2-] .p-infocard--meta .p-mrow .k{flex:0 1 auto;min-width:min-content;display:flex;flex-wrap:wrap;align-items:baseline;column-gap:1.2mm;white-space:nowrap}
.paper[data-theme^=r2-] .p-infocard--meta .p-mrow .k .p-lth+.p-len::before{content:none}
.paper[data-theme^=r2-] .p-infocard--meta .p-mrow .v{min-width:min-content}
/* a label over its part is never under 8pt (print.css draws these 7.5pt; E-4 found the notes' "หมายเหตุ") */
.paper[data-theme^=r2-] :is(.p-meta,.p-party,.p-note,.p-notes) .k{font-size:8pt}
/* C-9: the buyer's English name under the Thai one, small (as the seller's .p-co-en) - only in a document with English */
.paper[data-theme^=r2-] .p-party-en{display:block;font:600 8pt/1.4 'Inter',sans-serif;letter-spacing:.04em;color:var(--muted)}
.paper[data-theme^=r2-] .p-msub{display:block;font-weight:400;font-size:8pt}

/* the first note goes beside the item's name (a compact row); a second one still takes its own line */
.paper[data-theme^=r2-] .p-items td b+small{display:inline;margin-left:2mm}

/* owner 2026-10-10: the payment row - full width, label : value pairs, the account number unbroken, a 20 mm QR with its caption beside it */
.paper[data-theme^=r2-] .p-payrow{display:grid;grid-template-columns:minmax(0,1fr);gap:3mm 6mm;align-items:center;font-size:8.5pt;break-inside:avoid}
.paper[data-theme^=r2-] .p-payrow.has-qr{grid-template-columns:minmax(0,1fr) auto}
.paper[data-theme^=r2-] .p-paytitle{display:block;font-weight:700}
.paper[data-theme^=r2-] .p-payfields{margin:.8mm 0 0;display:grid;gap:.5mm}
.paper[data-theme^=r2-] .p-payfields>div{display:grid;grid-template-columns:24mm minmax(0,1fr);gap:2mm}
.paper[data-theme^=r2-] .p-payfields dt{white-space:nowrap;color:var(--muted);font-weight:400}
.paper[data-theme^=r2-] .p-payfields dd{margin:0}
.paper[data-theme^=r2-] .p-payrow .p-payqr{margin:0;flex-direction:row;align-items:center;gap:3mm}
.paper[data-theme^=r2-] .p-payrow .p-payqr figcaption{width:50mm;font-size:8pt;line-height:1.45}

/* a label in one language or two: the English after the Thai, quieter, the "·" only when both are there - one language leaves nothing over */
.paper[data-theme^=r2-] .p-len{color:var(--muted);font-size:max(8pt,.9em);font-weight:inherit}
.paper[data-theme^=r2-] .p-lth+.p-len::before{content:" · "}

/* two languages in a narrow place (E-4, the debit note in two languages: "ปรับด้วยใบลดหนี้/ใบเพิ่มหนี้ก่อนหน้า · Adjusted by earlier ..."
   broke over three lines): a totals line keeps the Thai and the English each whole, the English under the Thai only when both do not fit
   (always under made a long delivery note in two languages 303.7 mm, past its sheet); a signature's role always has its English under it */
.paper[data-theme^=r2-] .p-sum .l{display:flex;flex-wrap:wrap;align-items:baseline;align-content:flex-start;column-gap:1.2mm}
.paper[data-theme^=r2-] .p-sum{align-items:baseline}   /* each figure on its label's first line (a flex label sat the figure lower) */
.paper[data-theme^=r2-] .p-signs>div>span .p-len{display:block}
.paper[data-theme^=r2-] :is(.p-sum .l,.p-signs>div>span) .p-len{line-height:1.25}
.paper[data-theme^=r2-] :is(.p-sum .l,.p-signs>div>span) .p-lth+.p-len::before{content:none}

/* the footer stays one line: a long company name ends in "…" (the header carries it whole) */
.paper[data-theme^=r2-] .p-foot{left:var(--side);right:var(--side);bottom:6mm;gap:6mm;font-size:8pt}
.paper[data-theme^=r2-] .p-foot>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
