/* A4 document — mirrors the Sna Innovations quotation template */
.page { --navy:#211C50; --maroon:#89181A; --ink:#1f1f2b; --muted:#5b5b6b; --line:#d9d7e6; --tint:#f4f3fa;
  position: relative; width: 210mm; min-height: 297mm; padding: 11mm 14mm 16mm; background: #fff; color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif; font-size: 9.3pt; line-height: 1.36; overflow: hidden;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.page, .page * { box-sizing: border-box; } /* the page itself too: exactly 210 × 297 mm including its margins, on screen and in PDFs */
/* The app's own heading style (font, letter-spacing) must not leak into documents shown inside the app,
   or the on-screen preview is laid out differently from the PDF. */
.page h1, .page h2, .page h3 { font-family: inherit; letter-spacing: normal; }
.page .watermark { position: absolute; left: 50%; top: 52%; width: 160mm; transform: translate(-50%, -50%); opacity: .09; z-index: 0; pointer-events: none; }
.page .content { position: relative; z-index: 1; }
.page .topbar { position: absolute; top: 0; left: 0; right: 0; height: 4mm; background: linear-gradient(90deg, var(--navy), var(--maroon)); }
.page .bottombar { position: absolute; bottom: 0; left: 0; right: 0; height: 2.5mm; background: linear-gradient(90deg, var(--navy), var(--maroon)); }
.page header { display: flex; justify-content: space-between; align-items: center; gap: 6mm; border-bottom: 1.5px solid var(--navy); padding-bottom: 3mm; }
.page .brand { display: flex; align-items: center; gap: 4mm; }
.page .brand img { width: 20mm; height: 20mm; }
.page .brand h1 { font-size: 15pt; color: var(--navy); margin: 0; }
.page .brand .former { font-size: 8.5pt; color: var(--maroon); font-style: italic; }
.page .brand .addr { font-size: 8.5pt; color: var(--muted); margin-top: 1mm; }
.page .brand .addr.ids { display: flex; flex-wrap: wrap; column-gap: 3.5mm; row-gap: .2mm; margin-top: .6mm; font-size: 8pt; }
.page .brand .addr.ids b { color: var(--ink); font-weight: 600; }
.page .doc { text-align: right; flex-shrink: 0; }
.page .doc .tag { font-size: 17pt; font-weight: 700; color: var(--maroon); letter-spacing: 2px; white-space: nowrap; }
.page .doc table { margin-left: auto; margin-top: 1.5mm; font-size: 8.5pt; border-collapse: collapse; }
.page .doc td { padding: .3mm 0 .3mm 3mm; }
.page .doc td:first-child { color: var(--muted); }
.page .meta { display: flex; justify-content: space-between; gap: 6mm; margin: 3mm 0 2mm; }
.page .meta .box { flex: 1; }
.page .label { font-size: 7.5pt; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.page .meta .val { font-weight: 600; color: var(--navy); font-size: 10pt; }
.page h2 { font-size: 10.5pt; color: var(--navy); margin: 3mm 0 1.4mm; padding-left: 2.5mm; border-left: 3px solid var(--maroon); }
.page table.items { width: 100%; border-collapse: collapse; font-size: 8.8pt; }
.page table.items th { background: var(--navy); color: #fff; text-align: left; padding: 1.7mm 2mm; font-weight: 600; }
.page table.items td { padding: 1.3mm 2mm; border-bottom: 1px solid var(--line); vertical-align: top; background: rgba(255,255,255,.75); }
.page table.items tr { page-break-inside: avoid; }
.page .num { text-align: right; white-space: nowrap; }
.page .sub { color: var(--muted); font-size: 8.4pt; }
.page .sumrow { display: flex; gap: 8mm; justify-content: space-between; align-items: flex-start; margin-top: 2.5mm; page-break-inside: avoid; }
.page .words { flex: 1; padding-top: 1mm; font-weight: 600; color: var(--navy); }
.page table.tot { width: 78mm; border-collapse: collapse; font-size: 9pt; }
.page table.tot td { padding: .9mm 2mm; border-bottom: 1px solid var(--line); }
.page table.tot tr.grand td { background: var(--tint); font-weight: 700; color: var(--navy); border-bottom: 2px solid var(--navy); font-size: 10pt; }
/* advance / payments received under the grand total */
.page table.tot tr.adv-h td { padding-top: 2.2mm; font-size: 7.6pt; font-weight: 700; letter-spacing: .25mm; text-transform: uppercase; color: var(--maroon, #6d1a2a); border-bottom: 0; }
.page table.tot tr.adv td { color: #2f6b3a; }
.page table.tot tr.adv td:first-child { padding-left: 3.5mm; }
.page table.tot tr.adv .sub { color: #6b6880; font-size: 7.6pt; }
.page table.tot tr.adv-t td { font-weight: 700; color: #2f6b3a; }
.page table.tot tr.grand.bal td { background: #1e1a4f; color: #fff; border-bottom-color: #1e1a4f; }
.page .paybox { display: flex; gap: 5mm; margin-top: 4mm; page-break-inside: avoid; }
.page .bank { flex: 1; background: var(--tint); border-radius: 1.5mm; padding: 2.5mm 3.5mm; }
.page .bank table { border-collapse: collapse; margin-top: 1mm; }
.page .bank td { padding: .3mm 4mm .3mm 0; }
.page .bank td:first-child { color: var(--muted); }
.page .qr { width: 44mm; border: 1px solid var(--line); border-radius: 1.5mm; padding: 2mm; text-align: center; font-size: 8.5pt; }
.page .qr svg { width: 34mm; height: 34mm; display: block; margin: 0 auto 1mm; }
.page ul { padding-left: 4.5mm; margin: 0; }
.page li { margin: .3mm 0; }
.page .text { font-size: 9pt; }
.page .sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 10mm; font-size: 9pt; page-break-inside: avoid; }
.page .refline { margin: 1mm 0 2mm; padding: 1.8mm 3mm; background: var(--tint); border-left: 3px solid var(--maroon); border-radius: 0 1.5mm 1.5mm 0; font-size: 8.8pt; color: var(--ink); }
.page .refline b { color: var(--navy); }
.page .pterms { display: flex; flex-wrap: wrap; gap: 2mm; margin-top: 1mm; page-break-inside: avoid; }
.page .pterms .step { flex: 1 1 40mm; background: var(--tint); border-top: 2.5px solid var(--navy); padding: 1.4mm 2.2mm; font-size: 8.4pt; }
.page .pterms .step:nth-child(even) { border-top-color: var(--maroon); }
.page .pterms .step b { display: block; color: var(--navy); font-size: 8.8pt; }
.page .qrs { display: flex; flex-wrap: wrap; gap: 3mm; margin-top: 1.5mm; page-break-inside: avoid; }
.page .qrs .qr { width: 36mm; font-size: 7.6pt; padding: 1.5mm; }
.page .qrs .qr svg { width: 24mm; height: 24mm; }
.page .signbox { display: flex; flex-direction: column; align-items: center; }
.page .sigimg { width: 40mm; height: 16mm; object-fit: contain; margin-bottom: -2mm; } /* fixed box: page layout is measured before the image loads */
.page .sign:has(.sigimg) { margin-top: 3mm; }
.page .sign .line { border-top: 1px solid var(--ink); width: 58mm; padding-top: 1.2mm; text-align: center; }
/* delivery challan: receiver's acknowledgement */
.page .rcvbox { width: 82mm; border: 1px solid var(--line); border-radius: 1.5mm; padding: 2.2mm 3mm; background: rgba(255,255,255,.8); }
.page .rcvbox .rcvsig { display: block; width: 52mm; height: 17mm; object-fit: contain; margin: 1mm 0 -1mm; }
.page .rcvbox .rcvblank { height: 16mm; }
.page .rcvbox .line { width: 56mm; text-align: left; font-size: 8pt; color: var(--muted); }
.page .rcvbox table { border-collapse: collapse; margin-top: 1.2mm; font-size: 8.6pt; width: 100%; }
.page .rcvbox td { padding: .5mm 0; vertical-align: bottom; }
.page .rcvbox td:first-child { color: var(--muted); width: 22mm; }
.page .rcvbox .fill { display: inline-block; width: 100%; border-bottom: 1px dotted var(--muted); height: 3.6mm; }
.page .cancel-stamp { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.page .cancel-stamp span { display: block; transform: rotate(-32deg); font: 800 78pt "Segoe UI", Arial, sans-serif; letter-spacing: 4mm; line-height: 1;
  color: rgba(200,16,30,.3); border: 2mm solid rgba(200,16,30,.3); border-radius: 6mm; padding: 5mm 10mm 5mm 14mm; white-space: nowrap; }
.page .cancel-note { margin: 1mm 0 2mm; padding: 1.8mm 3mm; background: #fdecee; border-left: 3px solid #c8101e; border-radius: 0 1.5mm 1.5mm 0; font-size: 8.8pt; color: #8a0f19; }
/* ---------- company letterhead (js/portal-letters.js) ---------- */
.page.lh { --gold: #a8874f; padding: 13mm 18mm 26mm; font-family: "Segoe UI", Arial, sans-serif; font-size: 10.2pt; line-height: 1.62; color: #1f1f2b; }
.lh-band { position: absolute; left: 0; right: 0; top: 0; height: 3mm; background: linear-gradient(90deg, #1e1a4f 0%, #2d1f5e 45%, #6d1a2a 100%); }
.lh-band::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1.2mm; height: .35mm; background: var(--gold); opacity: .8; }
.lh-band.bottom { top: auto; bottom: 0; height: 2.2mm; }
.lh-band.bottom::after { bottom: auto; top: -1.2mm; }
.lh-ring { position: absolute; border-radius: 50%; pointer-events: none; }
.page.lh header.lh-head { border: 0; padding-bottom: 0; }
.lh-ring.r1 { width: 36mm; height: 36mm; right: -18mm; top: -18mm; background: linear-gradient(225deg, rgba(30,26,79,.07), rgba(109,26,42,.04)); border: .4mm solid rgba(30,26,79,.12); }
.lh-ring.r2 { width: 52mm; height: 52mm; right: -26mm; top: -26mm; border: .45mm dashed rgba(109,26,42,.2); }
.lh-ring.r3 { width: 68mm; height: 68mm; right: -34mm; top: -34mm; border: .3mm solid rgba(30,26,79,.08); }
.lh-mark { position: absolute; left: 50%; top: 55%; width: 128mm; transform: translate(-50%, -50%); opacity: .08; pointer-events: none; }
.lh-head { display: flex; justify-content: space-between; align-items: center; gap: 8mm; padding-top: 5mm; }
.lh-contact { padding-top: 3mm; }
.lh-brand { display: flex; align-items: center; gap: 4.5mm; }
.lh-brand img { width: 19mm; height: 19mm; }
.lh-name { white-space: nowrap; font-size: 18pt; font-weight: 700; line-height: 1; color: #1e1a4f; letter-spacing: .5mm; text-transform: uppercase; }
.lh-pvt { margin-top: 1.4mm; font-size: 7.4pt; font-weight: 600; letter-spacing: 1.6mm; text-transform: uppercase; color: #6d1a2a; }
.lh-former { margin-top: 1.2mm; font-style: italic; font-size: 8.5pt; color: #89181A; }
.lh-contact { text-align: right; font-size: 7.6pt; line-height: 1.6; color: #55526a; }
.lh-web { font-weight: 600; color: #6d1a2a; letter-spacing: .2mm; }
.lh-contact span { font-weight: 600; color: #1e1a4f; letter-spacing: .3mm; }
.lh-contact i, .lh-foot i { display: inline-block; width: 1.2mm; height: 1.2mm; margin: 0 2mm .4mm; border-radius: 50%; background: var(--gold); vertical-align: middle; }
.lh-rule { display: flex; align-items: center; gap: 2.5mm; margin: 5mm 0 0; }
.lh-rule span { flex: 1; height: .45mm; background: linear-gradient(90deg, #1e1a4f, rgba(30,26,79,.25)); }
.lh-rule span:last-child { background: linear-gradient(90deg, rgba(109,26,42,.25), #6d1a2a); }
.lh-rule b { width: 2.4mm; height: 2.4mm; transform: rotate(45deg); background: var(--gold); flex-shrink: 0; }
.lh-foot { position: absolute; left: 18mm; right: 18mm; bottom: 7mm; text-align: center; font-size: 7.2pt; letter-spacing: .25mm; color: #6b6878; }
.lh-foot-rule { height: .3mm; margin-bottom: 2.4mm; background: linear-gradient(90deg, rgba(168,135,79,0), var(--gold) 20%, var(--gold) 80%, rgba(168,135,79,0)); }

.page.lh .lt-meta { display: flex; justify-content: space-between; margin-top: 7mm; font-size: 8.8pt; color: #55526a; letter-spacing: .2mm; }
.page.lh .lt-title { text-align: center; border: 0; padding: 0; margin: 9mm 0 8mm; font-size: 15.5pt; font-weight: 700;
  letter-spacing: 1mm; text-transform: uppercase; color: #1e1a4f; }
.page.lh .lt-title::after { content: ""; display: block; width: 26mm; height: .5mm; margin: 2.6mm auto 0; background: linear-gradient(90deg, #1e1a4f, var(--gold), #6d1a2a); }
.page.lh .lt-body p { margin: 0 0 4mm; text-align: justify; }
.page.lh .lt-body b { color: #1e1a4f; }
/* Text size picked in the letter editor: whole letter (lh-sz-*) and selected words (lt-sz-*) */
.page.lh { --lt-fs: 10.2pt; }
.page.lh.lh-sz-large { --lt-fs: 11.4pt; }
.page.lh.lh-sz-xl { --lt-fs: 12.6pt; }
.page.lh .lt-body, .page.lh .lt-to, .page.lh .lt-subj { font-size: var(--lt-fs); }
.page.lh .lt-body i { font-style: italic; }
.page.lh .lt-sz-small { font-size: .85em; }
.page.lh .lt-sz-large { font-size: 1.22em; line-height: 1.45; }
.page.lh .lt-sz-xl { font-size: 1.5em; line-height: 1.35; }
.page.lh .lt-body u { text-decoration-thickness: .25mm; text-underline-offset: .7mm; }
.page.lh .lt-al-center, .page.lh .lt-al-right { display: block; }
.page.lh .lt-al-center { text-align: center; }
.page.lh .lt-al-right { text-align: right; }
/* list points: the label hangs to the left of the text; sub-points step in */
.page.lh .lt-li { display: flex; gap: 2.4mm; margin: 0 0 1.6mm calc(4mm + var(--lvl, 0) * 7mm); text-align: justify; }
.page.lh .lt-li.lt-li-end { margin-bottom: 3.2mm; }
.page.lh .lt-mk { flex: 0 0 auto; min-width: 5.5mm; font-weight: 600; color: #1e1a4f; font-variant-numeric: tabular-nums; }
.page.lh .lt-li-t { flex: 1 1 auto; min-width: 0; }
.page.lh .lt-body p.lt-lead { margin-bottom: 2mm; }
.page.lh .lt-hr { border: 0; height: .3mm; margin: 2mm 0 5mm; background: linear-gradient(90deg, transparent, #a8874f 15%, #1e1a4f 50%, #a8874f 85%, transparent); }
.page.lh .lt-pb { height: 0; margin: 0; }
/* tables in a letter */
.page.lh .lt-tbl { width: 100%; border-collapse: collapse; margin: 1mm 0 4.5mm; font-size: .94em; line-height: 1.45; text-align: left; }
.page.lh .lt-tbl th, .page.lh .lt-tbl td { border: .25mm solid #cfcbe0; padding: 1.5mm 2.4mm; vertical-align: top; }
.page.lh .lt-tbl th { background: #1e1a4f; color: #fff; font-weight: 600; border-color: #1e1a4f; }
.page.lh .lt-tbl th b { color: #fff; }
.page.lh .lt-tbl tbody tr:nth-child(even) td { background: rgba(30,26,79,.035); }
.page.lh .lt-tbl .al-r { text-align: right; font-variant-numeric: tabular-nums; }
.page.lh .lt-tbl .al-c { text-align: center; }
.page.lh .lt-after { margin-top: 6mm; font-size: 8.8pt; line-height: 1.55; color: #3a3850; }
.page.lh .lt-after b { color: #1e1a4f; }
.page.lh .lt-to { margin-bottom: 6mm; line-height: 1.55; }
.page.lh .lt-subj { margin-bottom: 6mm; }
.page.lh .lt-concern { text-align: center; font-weight: 600; letter-spacing: .9mm; text-transform: uppercase; margin-bottom: 7mm; color: #1e1a4f; font-size: 9pt; }
.page.lh .lt-care { padding: 3mm 4mm; background: rgba(30,26,79,.035); border-left: .7mm solid var(--gold); border-radius: 0 1.5mm 1.5mm 0; font-size: 9pt; }
.page.lh .lt-sign { margin-top: 12mm; display: inline-flex; flex-direction: column; align-items: flex-start; page-break-inside: avoid; }
.page.lh .lt-sign .sigimg { width: 42mm; height: auto; margin: 2mm 0 -1mm; }
.page.lh .lt-sign .sig-space { height: 16mm; }
.page.lh .lt-sign .line { border-top: .3mm solid #23212e; width: 64mm; padding-top: 1.4mm; line-height: 1.45; }
.page.lh .lt-sign .line span { font-size: 8.4pt; color: #55526a; letter-spacing: .2mm; }
.page footer { position: absolute; left: 14mm; right: 14mm; bottom: 5mm; text-align: center; font-size: 7.5pt; color: var(--muted); display: flex; justify-content: center; gap: 4mm; }

/* ---------- documents laid out into A4 pages (PRINT.layout) ---------- */
.page.docpage.laid { height: 297mm; min-height: 297mm; }
/* tighter spacing, tried before shrinking or splitting */
.page.compact header { padding-bottom: 2.2mm; }
.page.compact .meta { margin: 2.2mm 0 1.4mm; }
.page.compact h2 { margin: 2.2mm 0 1.1mm; }
.page.compact table.items th { padding: 1.3mm 2mm; }
.page.compact table.items td { padding: 1mm 2mm; }
.page.compact .sumrow { margin-top: 1.8mm; }
.page.compact .paybox { margin-top: 2.4mm; }
.page.compact .refline, .page.compact .cancel-note { margin: .6mm 0 1.4mm; }
.page.compact .sign { margin-top: 5mm; }
.page.compact .sign:has(.sigimg) { margin-top: 1mm; }
/* gentle shrink: the content is scaled but stays full width, so it re-wraps */
.page.scaled .content { width: calc((210mm - 28mm) / var(--k, 1)); transform: scale(var(--k, 1)); transform-origin: top left; }
/* several pages: page number in the footer, our signature at the bottom of every page */
.page .pg-no { font-weight: 700; color: var(--navy); white-space: nowrap; letter-spacing: .2mm; }
.page .pg-no:empty { display: none; }
.page.paged footer { justify-content: space-between; text-align: left; }
.page .pg-sign { position: absolute; right: 14mm; bottom: 11mm; z-index: 2; font-size: 9pt; }
.page .pg-sign .sigimg { margin-bottom: -2mm; }
.page .pg-cont { margin-top: 2mm; text-align: right; font-size: 8pt; color: var(--muted); font-style: italic; }

@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  .side, .noprint, .hint, .toast, #login, #splash, #bg-canvas, .bg-veil, .modal { display: none !important; }
  #app { display: block; animation: none; }
  main > * { animation: none !important; }
  main { padding: 0 !important; }
  .sheet { overflow: visible; padding: 0; }
  .sheet .page { box-shadow: none; margin: 0; overflow: visible; }
  .sheet .page.laid { overflow: hidden; break-after: page; page-break-after: always; }
  .sheet .page.laid:last-child { break-after: auto; page-break-after: auto; }
}

/* letterhead header: same company block as the bills on the left, GSTIN and website on the right */
.page.lh .lh-contact { font-size: 8.5pt; line-height: 1.7; color: var(--muted); flex-shrink: 0; padding-top: 0; }
.page.lh .lh-contact b { color: var(--navy); }
.page.lh .lh-web { font-weight: 600; color: var(--maroon); }
.page.lh .brand .addr { max-width: 112mm; }

/* letterhead pages are exactly A4; longer letters continue on new pages (LETTERS.paginate) */
.page.lh { height: 297mm; min-height: 297mm; }
.page.lh .lh-pageno { margin-top: 1.4mm; font-size: 7.4pt; letter-spacing: .3mm; color: var(--navy); font-weight: 600; }
.page.lh.lh-cont .lt-body { margin-top: 7mm; }

/* slightly tighter letter spacing so a standard HR letter fits on one A4 page */
.page.lh .lt-meta { margin-top: 5mm; }
.page.lh .lt-title { margin: 6.5mm 0 6mm; }
.page.lh .lt-to, .page.lh .lt-subj { margin-bottom: 4.5mm; }
.page.lh .lt-body p { margin-bottom: 3.2mm; }
.page.lh .lt-sign { margin-top: 7mm; }

/* one-page HR letters that are too long: text and spacing shrink by --fit (set by LETTERS.paginate) */
.page.lh.lh-fit .lt-body, .page.lh.lh-fit .lt-to, .page.lh.lh-fit .lt-subj { font-size: calc(var(--lt-fs) * var(--fit)); line-height: calc(1.62 * (0.4 + 0.6 * var(--fit))); }
.page.lh.lh-fit .lt-sign, .page.lh.lh-fit .lt-meta { font-size: calc(10.2pt * var(--fit)); line-height: calc(1.62 * (0.4 + 0.6 * var(--fit))); }
.page.lh.lh-fit .lt-care { font-size: calc(9pt * var(--fit)); padding: calc(3mm * var(--fit)) 4mm; }
.page.lh.lh-fit .lt-body p { margin-bottom: calc(3.2mm * var(--fit)); }
.page.lh.lh-fit .lt-title { font-size: calc(15.5pt * (0.5 + 0.5 * var(--fit))); margin: calc(6.5mm * var(--fit)) 0 calc(6mm * var(--fit)); }
.page.lh.lh-fit .lt-to, .page.lh.lh-fit .lt-subj { margin-bottom: calc(4.5mm * var(--fit)); }
.page.lh.lh-fit .lt-meta { margin-top: calc(5mm * var(--fit)); }
.page.lh.lh-fit .lt-sign { margin-top: calc(7mm * var(--fit)); }
.page.lh.lh-fit .lt-sign .sigimg { width: calc(42mm * (0.5 + 0.5 * var(--fit))); }
