/* ==========================================================================
   A4 document — faithful recreation of the Arcston Global quotation/invoice.
   All geometry is in points, measured from the original PDFs (595 × 842 pt).
   ========================================================================== */

.a4 {
  --doc-blue: #0070c0;
  --doc-link: #0563c1;
  --doc-head: #3d3d3d;      /* table header — dark grey, not black */
  --doc-box-head: #404040;
  --doc-line: #8f8f8f;      /* table & box borders — softer than pure black */
  --doc-shade: #d9d9d9;
  --doc-rule-blue: #85a3d9;
  --notes-size: 9pt;
  position: relative;
  width: 210mm;
  height: 297mm;
  background: #fff;
  color: #000;
  font-family: Arial, Arimo, "Liberation Sans", "Helvetica Neue", Helvetica, sans-serif;
  font-size: 9pt;
  line-height: 1.15;
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  text-rendering: geometricPrecision;
  font-kerning: normal;
}
.a4 * { box-sizing: border-box; }
.a4 sup { font-size: 62%; line-height: 0; vertical-align: 0.55em; }

/* ---------- letterhead ---------- */
.a4-head { position: absolute; left: 54pt; right: 54pt; top: 0; height: 130pt; }
.a4-head .ln { position: absolute; line-height: 1.117; white-space: nowrap; }
.a4-logo { position: absolute; left: 1pt; top: 36.5pt; width: 127pt; height: auto; display: block; }
.a4-addr1 { left: 0; top: 87.9pt; font-size: 8pt; }
.a4-addr2 { left: 0; top: 97pt; font-size: 8pt; }
.a4-cin   { left: 0; top: 107.6pt; font-size: 9pt; font-weight: 700; }
.a4-title { right: 4pt; top: 42.9pt; font-size: 14.4pt; font-weight: 700; color: var(--doc-blue); }
.a4-ref   { right: 4pt; top: 62.2pt; font-size: 10.2pt; font-weight: 700; }
.a4-date  { right: 4pt; top: 74.2pt; font-size: 10.2pt; }
.a4-phone { right: 4pt; top: 94.4pt; font-size: 9.1pt; }
.a4-email { right: 4pt; top: 105.2pt; font-size: 9.1pt; color: var(--doc-link); }
.a4-email.u { text-decoration: underline; text-underline-offset: 1.2pt; text-decoration-thickness: 0.5pt; }
.a4-rule {
  position: absolute; left: 0; right: 0; top: 125.3pt; height: 1pt;
  background: linear-gradient(90deg, #a5a5a5 0%, #a5a5a5 50%, #c4c4c4 63%, #dfdfdf 76%, #f4f4f4 88%, rgba(255,255,255,0) 100%);
}
.a4-rule.even { background: #a5a5a5; }

/* Compact letterhead (default) — same layout, ~33pt shorter */
.a4.hc .a4-logo  { top: 30pt; width: 104pt; }
.a4.hc .a4-addr1 { top: 71.5pt; font-size: 7.4pt; }
.a4.hc .a4-addr2 { top: 79.4pt; font-size: 7.4pt; }
.a4.hc .a4-cin   { top: 89.3pt; font-size: 8pt; }
.a4.hc .a4-title { top: 31pt; font-size: 12.6pt; }
.a4.hc .a4-ref   { top: 47.6pt; font-size: 9pt; }
.a4.hc .a4-date  { top: 58pt; font-size: 9pt; }
.a4.hc .a4-phone { top: 74.3pt; font-size: 8pt; }
.a4.hc .a4-email { top: 84.2pt; font-size: 8pt; }
.a4.hc .a4-rule  { top: 101pt; }
.a4.hc .a4-body  { top: 119pt; height: 657pt; }
.a4.hc .a4-body.cont { top: 121pt; height: 655pt; }

/* ---------- footer ---------- */
.a4-foot { position: absolute; left: 48.5pt; right: 48.5pt; top: 792.6pt; height: 0.9pt; background: var(--doc-rule-blue); }
.a4-pageno { position: absolute; right: 54pt; top: 799pt; font-size: 7.5pt; color: #7f7f7f; }

/* ---------- flowing body ---------- */
/* 1pt side padding keeps the outer table borders from being clipped (equal line weights) */
.a4-body { position: absolute; left: 53pt; width: 489pt; padding: 0 1pt; top: 152pt; height: 624pt; overflow: hidden; }
.a4-body.cont { top: 155pt; height: 621pt; }
.a4-body > :first-child { margin-top: 0 !important; }

/* Bill-to box */
.bt { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 4pt; }
.bt td { border: 0.75pt solid var(--doc-line); padding: var(--bt-pad, 5.8pt) 5.8pt; vertical-align: middle; font-size: 9pt; }
.bt .bt-main { padding: var(--bt-pad, 5.8pt) 5.8pt; vertical-align: middle; }
.bt-sal { font-size: 10pt; }
.bt-name { font-size: 10pt; font-weight: 700; }
.bt-addr { font-size: 9pt; white-space: pre-line; }
.bt-plain { font-size: 11pt; line-height: 1.16; transform: translateY(-12.5pt); }
.bt-plain .bt-sal, .bt-plain .bt-name, .bt-plain .bt-addr { font-size: 11pt; }
.bt-plain-meta { margin-top: 6pt; font-size: 9pt; }
.bt-plain-meta b { font-weight: 700; }

.items-label { font-size: 11pt; font-weight: 700; margin: 9pt 0 6.5pt; line-height: 1.117; }

/* Items table */
.it { width: 100%; border-collapse: collapse; table-layout: fixed; }
.it th, .it td { border: 0.75pt solid var(--doc-line); font-size: 9pt; padding: var(--row-pad, 4.4pt) 5pt; vertical-align: middle; overflow-wrap: anywhere; }
.it .c-sl, .it .c-hsn { padding-left: 3pt; padding-right: 3pt; }
.it thead th { white-space: nowrap; }
.it .d-plain { margin-top: 2pt; font-size: 8.5pt; font-style: italic; line-height: 1.13; }
.it thead th { background: var(--doc-head); color: #fff; font-weight: 700; height: 17pt; padding-top: 0; padding-bottom: 0; }
.it .c-sl { text-align: center; }
.it .c-desc { text-align: left; padding-left: 6pt; }
.it .c-hsn { text-align: center; }
.it .c-qty, .it .c-rate, .it .c-amt { text-align: right; }
.it .d-title { font-weight: 400; }
.it .d-title.has-sub { font-weight: 700; }
.it .d-sub { list-style: none; margin: 2pt 0 0; padding: 0; font-size: 8.5pt; font-style: italic; line-height: 1.13; }
.it .d-sub li { position: relative; padding-left: 18pt; }
.it .d-sub li > .mk { position: absolute; left: 0; top: 0; font-family: "Courier New", Courier, monospace; font-style: normal; font-size: 8.5pt; }
.it .opt-tag { font-style: italic; font-weight: 400; }
.it .d-note { font-size: 8.5pt; font-style: italic; margin-top: 1pt; white-space: pre-line; }
.it tr.opt td { color: #444; }
.it tr.tot td { background: var(--doc-shade); font-weight: 700; height: 17pt; padding-top: 0; padding-bottom: 0; text-align: right; }
.it tr.tot td.words { text-align: left; font-weight: 400; font-style: italic; padding-left: 6pt; }

.words-line { margin-top: 6pt; font-size: 9pt; }
.words-line b { font-weight: 700; }

/* Notes */
.notes { font-size: var(--notes-size); line-height: 1.28; }
.notes.justify .n-text, .notes.justify p { text-align: justify; }
.notes-title { font-weight: 700; font-style: italic; margin: 15pt 0 4.5pt; font-size: var(--notes-size); }
.n-item { display: grid; grid-template-columns: 18pt 1fr; margin-top: 5pt; }
.n-item:first-child { margin-top: 0; }
.n-num { font-weight: 400; }
.n-text p { margin: 0; }
.n-text p + p { margin-top: 3pt; }
.notes ul, .notes ol { margin: 2pt 0 0; padding: 0; list-style: none; }
.notes ul > li { position: relative; padding-left: 18pt; margin-left: 18pt; margin-top: 1.6pt; }
.notes ul > li > .mk { position: absolute; left: 0; font-family: "Courier New", Courier, monospace; }
.notes ol > li { position: relative; padding-left: 18pt; margin-top: 0.8pt; }
.notes ol > li > .mk { position: absolute; left: 0; }
.notes .n-para { margin-top: 5pt; }
.notes .bank-inline { margin-top: 5pt; line-height: 1.15; }
.notes .bank-inline .bi-intro { font-style: italic; }
.notes .bank-inline .bi-lines { white-space: pre-line; }
.notes .bank-inline.indent { padding-left: 18pt; }

/* Payment terms box */
.pay { margin-top: 27pt; border: 0.75pt solid var(--doc-line); }
.pay-h { background: var(--doc-box-head); color: #fff; text-align: center; font-weight: 700; font-size: 10pt; height: 17.5pt; line-height: 17.5pt; letter-spacing: 0.1pt; }
.pay-b { padding: 11pt 5.8pt 13pt; font-size: 9pt; line-height: 1.15; }
.pay-intro { font-style: italic; font-size: 8pt; margin-bottom: 4.5pt; }
.pay-lines { white-space: pre-line; }

/* Signature block */
.sign { margin-top: 30pt; font-size: 10pt; line-height: 1.3; break-inside: avoid; }
.sign.big-gap { margin-top: 70pt; }
.sign-area { position: relative; height: 74pt; width: 200pt; }
.sign-area.sig-only { height: 40pt; }
.sign-area img { position: absolute; display: block; mix-blend-mode: multiply; }
.sign-area .s-sig { left: -3pt; bottom: 6pt; width: 80pt; }
.sign-area.sig-only .s-sig { bottom: 2pt; }
.sign-area .s-stamp { left: 57pt; top: 0; width: 80pt; opacity: 0.95; }
.sign-area.stamp-only .s-stamp { left: 0; }
.sign-name { font-size: 11pt; font-weight: 700; margin-top: 2pt; }
.sign-desig { font-size: 10pt; }
.sign.no-area .sign-name { margin-top: 0; }

/* Watermark for drafts / cancelled */
.a4-wm { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.a4-wm span { transform: rotate(-32deg); font-size: 96pt; font-weight: 700; color: rgba(213, 31, 54, 0.07); letter-spacing: 8pt; }

/* Paid stamp */
.a4-paid { position: absolute; right: 64pt; top: 150pt; transform: rotate(-12deg); border: 2.5pt solid rgba(22, 128, 61, 0.8); color: rgba(22, 128, 61, 0.85);
  font-weight: 700; font-size: 20pt; padding: 2pt 10pt; border-radius: 4pt; letter-spacing: 2pt; }

/* ---------- print ---------- */
@page { size: A4; margin: 0; }
@media print {
  .a4 { break-after: page; page-break-after: always; box-shadow: none !important; margin: 0 !important; }
  .a4:last-child { break-after: auto; page-break-after: auto; }
}
