/* print-wht.css - the official RD 50 ทวิ form (print-wht.mjs), one A4 sheet per copy. Black on white only: a statutory
   certificate carries no company accent colour. Column proportions of the income table are measured off the RD's own
   form (approve_wh3_081156.pdf). The sheet has a fixed A4 height with overflow hidden - it is one page by definition
   (paginate.mjs leaves it alone and the page margin is 0). */
.paper.wht-form, #printArea .paper.wht-form {
  width: 210mm; height: 297mm; min-height: 297mm; box-sizing: border-box; overflow: hidden;
  margin: 0 auto; padding: 5mm 8mm 4mm; background: #fff; color: #000; border-top: 0; /* undo .paper's accent bar */
  display: flex; flex-direction: column; gap: 1mm;
  font: 400 9.5pt/1.3 'Sarabun', 'Noto Sans Thai', Tahoma, sans-serif; /* >=1.25: Thai tone marks clip at 1.0 */
}
.wht-form { break-after: page; }
.wht-form:last-of-type { break-after: auto; }
.wht-form b { font-weight: 700; }
.wht-form h1 { margin: 0; font-size: 15pt; font-weight: 700; line-height: 1.2; }

/* the copy line above the frame, with ใบแทน / the optional logo at its right */
.wf-top { display: flex; align-items: center; gap: 4mm; min-height: 6mm; }
.wf-copy { flex: 1; font-size: 10pt; }
.wf-replacement { border: .3mm solid #000; padding: 0 2mm; font-weight: 700; }
.wf-logo { max-height: 9mm; max-width: 30mm; object-fit: contain; }

/* every box keeps its natural height; the income table takes whatever is left (its empty wf-spacer row stretches), so
   the frame reaches the foot of the sheet the way the printed form does */
.wf-frame { flex: 1 0 auto; border: .35mm solid #000; padding: 1.8mm 2.2mm; display: flex; flex-direction: column; gap: 1.2mm; }
.wf-frame > * { flex: none; }
.wf-box { border: .3mm solid #000; border-radius: 2.2mm; padding: 1.2mm 2.4mm; }

.wf-titlerow { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 3mm; }
.wf-title { text-align: center; padding-left: 40mm; }
.wf-title div { font-size: 11pt; }
.wf-numblock { display: grid; gap: .8mm; font-size: 10pt; }
.wf-numblock .wf-fill { display: inline-block; min-width: 36mm; }

.wf-line { display: flex; align-items: baseline; gap: 1.5mm; flex-wrap: nowrap; }
.wf-line > b:not(.wf-grow), .wf-line > span:not(.wf-fill, .wf-tin) { flex: none; white-space: nowrap; } /* a label never breaks when the text beside it wraps */
.wf-grow { flex: 1 1 auto; min-width: 0; }
.wf-fill { border-bottom: .25mm dotted #000; padding: 0 1mm; min-height: 1.3em; overflow-wrap: anywhere; }
.wf-center { text-align: center; }
.wf-hint { font-size: 8pt; font-style: italic; margin: -.4mm 0 .2mm 7mm; }
.wf-tinlabel { white-space: nowrap; font-size: 9.5pt; }

/* TIN cells: each group a box split by dotted rules, groups joined by a dash, like the printed form */
.wf-tin { display: inline-flex; align-items: center; flex: none; }
.wf-tingroup { display: inline-flex; border: .25mm solid #000; height: 5mm; }
.wf-tingroup span { width: 3.9mm; display: flex; align-items: center; justify-content: center; border-left: .2mm dotted #000; font-size: 10pt; font-weight: 600; }
.wf-tingroup span:first-child { border-left: 0; }
.wf-tindash { padding: 0 .4mm; }

/* ลำดับที่ ... ในแบบ, and the 7 return-form checkboxes in two rows of four */
.wf-seqrow { display: grid; grid-template-columns: auto 1fr; gap: 4mm; align-items: start; margin-top: .6mm; }
.wf-seq { max-width: 66mm; }
.wf-seqbox { display: inline-block; border: .3mm solid #000; min-width: 22mm; height: 5.2mm; text-align: center; }
.wf-seq .wf-hint { margin-left: 0; }
.wf-forms { display: grid; grid-template-columns: repeat(4, auto); gap: 1.2mm 5mm; justify-content: start; padding-top: .6mm; }
.wf-chkitem { display: inline-flex; align-items: center; gap: 1.4mm; white-space: nowrap; }
.wf-chk { width: 3.8mm; height: 3.8mm; border: .3mm solid #000; flex: none; position: relative; }
.wf-chk.on::after { content: "✓"; position: absolute; inset: -1.2mm 0 0 .1mm; font: 700 11pt/1 'Sarabun', sans-serif; }

/* the income table */
.wf-frame > .wf-tablebox { flex: 1 0 auto; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.wf-income { flex: 1 0 auto; width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 9.5pt; }
.wf-income tr.wf-spacer { height: 100%; }
.wf-income tr.wf-spacer td { padding: 0; }
.wf-income col.c-lab { width: 55.6%; }
.wf-income col.c-date { width: 14.9%; }
.wf-income col.c-baht { width: 11.7%; }
.wf-income col.c-satang { width: 3%; }
.wf-income th { font-size: 10pt; font-weight: 700; line-height: 1.2; text-align: center; vertical-align: middle; padding: 1mm; border-bottom: .3mm solid #000; }
.wf-income th + th { border-left: .3mm solid #000; }
.wf-income td { padding: .1mm 1mm; vertical-align: bottom; line-height: 1.25; }
.wf-income td.wf-date, .wf-income td.wf-baht:nth-child(5) { border-left: .3mm solid #000; }
.wf-income td.wf-baht:nth-child(3) { border-left: .3mm solid #000; }
.wf-income td.wf-satang { border-left: .2mm solid #000; text-align: center; padding: .25mm .3mm; }
.wf-income td.wf-baht { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wf-income td.wf-date { text-align: center; white-space: nowrap; font-size: 9pt; }
.wf-income td.wf-fillcell { border-bottom: .25mm dotted #000; }
.wf-income .wf-lab { padding-left: 1.4mm; }
.wf-income tr.wf-lv1 .wf-lab { padding-left: 5.4mm; }
.wf-income tr.wf-lv2 .wf-lab { padding-left: 9mm; font-size: 9pt; }
.wf-income tr.wf-lv3 .wf-lab { padding-left: 13mm; font-size: 9pt; }
.wf-given { font-weight: 600; }
.wf-spec { display: inline-block; min-width: 55mm; }
.wf-income tfoot tr.wf-total td { border-top: .3mm solid #000; font-weight: 700; padding: .8mm 1mm; }
.wf-income tfoot tr.wf-total td:first-child { text-align: right; padding-right: 3mm; font-size: 10pt; }
.wf-income tfoot tr.wf-words td { padding: .8mm 1.4mm 1.2mm; }
.wf-wordslab { font-weight: 700; margin-right: 3mm; margin-left: 12mm; }
.wf-wordsbar { display: inline-block; width: 62%; background: #d9d9d9; padding: .3mm 2mm; font-weight: 600; text-align: center; }

.wf-funds { font-size: 8.6pt; }
.wf-funds .wf-amt { display: inline-block; min-width: 12mm; text-align: right; }
.wf-payer { display: flex; align-items: center; gap: 5mm; flex-wrap: wrap; }
.wf-payer .wf-note { display: inline-block; min-width: 30mm; }

.wf-bottom { display: grid; grid-template-columns: 41% 1fr; gap: 1.6mm; }
.wf-warn { display: flex; gap: 3mm; font-size: 9pt; line-height: 1.35; }
.wf-warn b { flex: none; }
.wf-cert { font-size: 9pt; }
.wf-certtext { text-align: center; }
.wf-signrow { display: flex; align-items: center; gap: 3mm; margin-top: .8mm; }
.wf-signcol { flex: 1; display: grid; gap: .6mm; }
.wf-dateline { justify-content: center; }
.wf-dateline .wf-fill { min-width: 15mm; }
.wf-seal { flex: none; width: 15mm; height: 15mm; border: .25mm solid #000; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 7pt; line-height: 1.2; }

.wf-footnote { display: flex; gap: 3mm; font-size: 8pt; line-height: 1.3; }
.wf-footnote span { flex: none; }
.wf-footnote ol { margin: 0; padding-left: 5mm; }
