/* ==== Embuild A4 letterhead + document layouts (shared by the editor preview and the archive view) ==== */
@page { size: A4 portrait; margin: 0; }

.a4-page {
  position: relative; width: 210mm; height: 297mm; flex: none; overflow: hidden; background: #fff;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.45);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  font-family: 'Inter','Segoe UI',Arial,sans-serif; color: #1f2937;
}
.lh-strip { position: absolute; left: 0; top: 0; width: 15mm; height: 100%; z-index: 0; }
.lh-strip .g { position: absolute; inset: 0; background: #235E3F; clip-path: polygon(0 0, 100% 0, 100% calc(297mm * .632), 0 calc(297mm * .615)); }
.lh-strip .r { position: absolute; inset: 0; background: #E12A2F; clip-path: polygon(0 calc(297mm * .615), 100% calc(297mm * .632), 100% 100%, 0 100%); }
.lh-logo { position: absolute; left: 31mm; top: 10.5mm; width: 44mm; z-index: 1; }
.lh-names { position: absolute; left: 28mm; right: 9mm; top: 33mm; z-index: 1; display: flex; justify-content: space-between; align-items: center;
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 15.5pt; line-height: 1; color: #1a1a1a; }
.lh-names .ar, .lh-foot .ar { font-family: 'Cairo', sans-serif; direction: rtl; }
.lh-rule { position: absolute; left: 28mm; right: 9mm; top: 45.5mm; height: 1.3mm; background: #1d1d1d; z-index: 1; }
.lh-wm { position: absolute; left: 34mm; top: 131mm; width: 147mm; opacity: .04; filter: grayscale(1); pointer-events: none; user-select: none; z-index: 0; }
.lh-foot { position: absolute; left: 21mm; right: 4mm; bottom: 3mm; z-index: 1; display: flex; justify-content: space-between; align-items: center;
  font-family: 'Poppins', sans-serif; font-size: 8.6pt; line-height: 1.3; color: #1a1a1a; }
.lh-foot .item { display: flex; align-items: center; gap: 2.6mm; }
.lh-foot .ico { width: 8mm; height: 8mm; background: #235E3F; display: grid; place-items: center; flex: none; }
.lh-foot .ico svg { width: 5mm; height: 5mm; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lh-foot .email { font-weight: 500; }
.lh-foot .addr { text-align: center; }
.lh-content { position: absolute; z-index: 1; left: 28mm; right: 9mm; top: 49mm; height: 229mm; font-size: 9pt; color: #1f2937; }
.lh-draft { position: absolute; z-index: 2; top: 120mm; left: 0; right: 0; text-align: center; font: 800 70pt 'Inter', sans-serif;
  color: rgba(225,42,47,.08); transform: rotate(-28deg); pointer-events: none; letter-spacing: .1em; }
.lh-pageno { position: absolute; z-index: 1; right: 9mm; bottom: 15mm; font-size: 7.5pt; color: #94a3b8; }

/* ---- shared document parts ---- */
.d-date { text-align: right; font-weight: 700; font-size: 10.5pt; margin: 0 -3mm 0 0; }
.d-date.u { text-decoration: underline; }
.d-date.left { text-align: left; margin: 0; }
.d-title { text-align: center; font-weight: 700; font-size: 19pt; margin: 3mm 0 2mm; }
.d-title.u { text-decoration: underline; }
.d-sub { text-align: center; font-weight: 700; font-size: 11pt; margin: 0 0 1mm; }
.d-trn { text-align: center; font-weight: 600; font-size: 10pt; margin: 0 0 6mm; }
.d-to { font-weight: 700; font-size: 10pt; line-height: 1.5; margin: 5mm 0 6mm; }
.d-project { font-weight: 700; font-size: 10.5pt; margin-bottom: 3mm; }
.d-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; margin: 4mm 0 6mm; font-size: 9.4pt; line-height: 1.55; }
.d-cols h5 { margin: 0 0 1.5mm; font-size: 9.5pt; letter-spacing: .04em; text-transform: uppercase; color: #235E3F; }
.d-cols .k { font-weight: 700; }
.d-box { border: 1px solid #e5e7eb; background: #f8fafc; border-radius: 1.5mm; padding: 3mm 3.5mm; }

table.dt { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8.8pt; }
table.dt th { background: #f8fafc; border: 1px solid #e5e7eb; padding: 2.2mm 2mm; font-weight: 700; color: #1f2937; text-align: left; line-height: 1.25; }
table.dt td { border: 1px solid #e5e7eb; padding: 2.4mm 2.2mm; vertical-align: middle; }
table.dt td.c-no { text-align: center; font-weight: 700; }
table.dt td.c-desc { vertical-align: top; color: #475569; line-height: 1.45; }
table.dt td.r, table.dt th.r { text-align: right; }
table.dt td.c { text-align: center; }
table.dt tr { break-inside: avoid; page-break-inside: avoid; }
table.dt .t { font-weight: 700; color: #1e293b; margin-bottom: .8mm; font-size: 9pt; }
table.dt ul { margin: .6mm 0 0; padding-left: 4.2mm; }
table.dt li { margin-bottom: .8mm; }
table.dt p { margin: .6mm 0 0; }
table.dt .n { display: flex; gap: 1.2mm; margin-top: .6mm; }
table.dt .n span:first-child { flex: none; }
table.dt tr.tot td { font-weight: 700; font-size: 10pt; color: #334155; border-top: 1px solid #d1d5db; }
table.dt tr.tot.grand td { color: #235E3F; }
table.dt tr.tot.less td { color: #b91c1c; }
table.dt .st-ok { color: #15803d; font-weight: 700; }
table.dt .st-wip { color: #b45309; font-weight: 700; }

table.kv { width: 100%; border-collapse: collapse; font-size: 9.4pt; margin: 2mm 0 6mm; }
table.kv td { border: 1px solid #e5e7eb; padding: 2.3mm 3mm; }
table.kv td.k { width: 34%; background: #f8fafc; font-weight: 700; }

.d-summary { margin-left: auto; width: 62%; margin-top: 6mm; font-size: 10pt; }
.d-summary .row { display: flex; justify-content: space-between; gap: 6mm; padding: 2.6mm 3mm; border-bottom: 1px solid #e5e7eb; }
.d-summary .row b { white-space: nowrap; }
.d-summary .row.hl { background: #f0fdf4; color: #235E3F; font-weight: 800; border-bottom: 2px solid #235E3F; }
.d-summary .row.sep { margin-top: 3mm; border-top: 1px solid #cbd5e1; }
.d-words { margin-top: 6mm; font-size: 9.6pt; line-height: 1.5; }
.d-words b { display: block; margin-bottom: 1mm; }
.d-terms { margin-top: 8mm; font-size: 10pt; line-height: 1.55; }
.d-terms .vat { margin: 0 0 6mm; }
.d-terms h4 { margin: 0 0 1.5mm; font-size: 10.5pt; font-weight: 700; }
.d-terms .pre { white-space: pre-line; margin: 0 0 6mm; }
.d-bank { margin-top: 6mm; font-size: 9pt; white-space: pre-line; border: 1px solid #e5e7eb; padding: 3mm; border-radius: 1.5mm; }
.d-sign { margin-top: 7mm; position: relative; }
table.dt td.r { white-space: nowrap; }
.d-sign img { height: 32mm; width: auto; max-width: 75mm; display: block; margin-left: 2mm; }
.d-sign .co { font-weight: 700; font-size: 10.5pt; margin-bottom: 2mm; }
.d-declaration h4 { font-size: 11pt; margin: 8mm 0 2mm; }
.d-declaration p { font-size: 10pt; line-height: 1.6; margin: 0; }
.d-approvals h4 { font-size: 11pt; margin: 9mm 0 3mm; }
.d-approvals .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; font-size: 9.6pt; line-height: 1.9; }
.d-approvals .cols h6 { margin: 0 0 1mm; font-size: 10pt; }
.d-approvals .stamp { height: 26mm; }
.d-approvals .stamp img { height: 25mm; width: auto; max-width: 62mm; }
.d-letter { font-size: 10.5pt; line-height: 1.7; }
.d-letter .ref { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6mm; }
.d-letter .subject { font-weight: 700; text-decoration: underline; margin: 4mm 0 5mm; }
.d-letter .body p { margin: 0 0 3.5mm; text-align: justify; }

@media print {
  html, body { background: #fff !important; margin: 0 !important; }
  .a4-page { box-shadow: none !important; margin: 0 !important; height: 296.5mm !important; break-after: page; page-break-after: always; }
  .a4-page:last-child { break-after: auto; page-break-after: auto; }
}
