/* The A4 bill. mm and pt throughout so the preview and the paper are the same drawing. */
.sheet {
  --ink: #111110; --ink-2: #555350; --rule: #111110; --soft: #dcdad5; --hair: .5pt;
  position: relative; box-sizing: border-box; width: 210mm; min-height: 297mm;
  display: flex; flex-direction: column; padding: 10mm 16mm 11mm;
  background: #fff; color: var(--ink); font: 300 9.5pt/1.5 Jost, system-ui, sans-serif;
  font-variant-numeric: tabular-nums lining-nums; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.sheet p, .sheet h1, .sheet dl { margin: 0; }

/* print layout (print.js): block flow, page margins from @page, the sign-off pushed down by a measured gap */
.sheet.for-print { display: block; min-height: 0; padding-block: 0; }
.sheet.for-print .sheet-end { margin-top: var(--end-gap, 7mm); padding-top: 7mm; break-before: avoid; }

.sheet-head { display: flex; justify-content: center; }
/* the whole logo, 46 mm wide; height fixed so the layout never jumps while it loads */
.lockup { display: block; width: 46mm; height: 50.12mm; }

.label { font: 500 8pt/1.4 Jost, sans-serif; color: var(--ink-2); }

.sheet-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; margin-top: 6mm; padding-bottom: 3mm; border-bottom: var(--hair) solid var(--rule); }
.doc-title { font: 400 30pt/1 "Instrument Serif", Georgia, serif; letter-spacing: -.01em; }
.meta-list { display: grid; grid-template-columns: auto auto; column-gap: 5mm; text-align: right; }
.meta-list dt { font: 500 8pt/1.7 Jost, sans-serif; color: var(--ink-2); }
.meta-list dd { margin: 0; font: 400 9.5pt/1.5 Jost, sans-serif; }

.parties { display: flex; gap: 12mm; margin-top: 6mm; }
.parties .party { flex: 1 1 0; }
.party .label { margin-bottom: 1.2mm; }
.party-name { font: 400 17pt/1.15 "Instrument Serif", Georgia, serif; margin-bottom: 1mm !important; }
.party .addr { white-space: pre-line; }
.declare { margin-top: 3mm !important; font-size: 8.5pt; color: var(--ink-2); }

.items { width: 100%; border-collapse: collapse; margin-top: 7mm; }
.items th { font: 500 8pt/1.4 Jost, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); text-align: left; padding: 0 0 2mm; border-bottom: var(--hair) solid var(--rule); }
.items td { padding: 2.4mm 0; border-bottom: .35pt solid var(--soft); vertical-align: top; }
.items .n { text-align: right; white-space: nowrap; padding-left: 5mm; }
.items .idx { width: 8mm; color: var(--ink-2); }
.items .hsn { width: 16mm; } .items .qty { width: 16mm; } .items .rate { width: 27mm; } .items .gstp { width: 12mm; } .items .amt { width: 29mm; }
.item-desc { display: block; font-weight: 400; font-size: 10pt; }
.item-detail { display: block; color: var(--ink-2); font-size: 8.5pt; }
.uqc { font-size: 8pt; color: var(--ink-2); }
.items tr { break-inside: avoid; }

.sums { display: flex; gap: 12mm; margin-top: 5mm; break-inside: avoid; }
.sums-left { flex: 1 1 auto; }
.sums-left .label { margin: 1.2mm 0 1mm; }
.words { font-size: 9pt; line-height: 1.45; }
.totals { flex: none; width: 72mm; border-collapse: collapse; }
.totals td { padding: .55mm 0; }
.totals .amt { text-align: right; white-space: nowrap; }
.totals .grand td { border-top: var(--hair) solid var(--rule); padding-top: 3mm; vertical-align: bottom; font-weight: 400; }
.totals .grand td:first-child { padding-bottom: 1.2mm; }
.totals .grand .amt { font: 400 21pt/1 "Instrument Serif", Georgia, serif; }
.totals .due td { font-weight: 500; padding-top: 2mm; }

.pay { margin-top: 5mm; }
.paid-mark { display: inline-block; border: .6pt solid var(--ink); padding: 1mm 3mm .8mm; font: 500 8.5pt/1.4 Jost, sans-serif; }
.pay-scan { display: flex; align-items: center; gap: 4mm; }
.pay-qr { width: 24mm; height: 24mm; }
.pay-scan p { display: grid; gap: .6mm; }
.pay-amt { font: 400 14pt/1.1 "Instrument Serif", Georgia, serif; }
.pay-vpa { font-size: 8.5pt; color: var(--ink-2); }

/* the sign-off and the footer travel together and sit at the foot of the sheet */
.sheet-end { margin-top: auto; padding-top: 7mm; break-inside: avoid; }
.closing { display: flex; gap: 12mm; align-items: flex-end; }
.note { flex: 1 1 auto; font: italic 400 14pt/1.3 "Instrument Serif", Georgia, serif; }
.note.is-long { font: 300 9.5pt/1.5 Jost, sans-serif; }
.sign { flex: none; width: 58mm; text-align: center; }
.sign .who { font: 400 9.5pt/1.4 Jost, sans-serif; }
.sign .line { margin-top: 12mm !important; padding-top: 1.5mm; border-top: var(--hair) solid var(--rule); font: 500 8pt/1.4 Jost, sans-serif; color: var(--ink-2); }

.sheet-foot { padding-top: 8mm; text-align: center; }
.foot-rule { display: flex; align-items: center; gap: 4mm; }
.foot-rule::before, .foot-rule::after { content: ""; flex: 1; border-top: var(--hair) solid var(--rule); }
.foot-rule img { width: 11mm; }
.foot-contact { margin-top: 3mm !important; font: 300 9pt/1.6 Jost, sans-serif; letter-spacing: .03em; white-space: pre; }

/* paper that already carries the letterhead: keep the spaces, print only the bill */
.sheet.is-preprinted :is(.lockup, .foot-rule, .foot-contact) { visibility: hidden; }
