/* ---------- Invoice document (PDF) templates ---------- */
.pdf {
  --accent: #163300;
  width: 612px; min-height: 792px;
  background: #fff; color: #2b2d2b;
  font-family: var(--font-ui);
  font-size: 11px; line-height: 1.5;
  padding: 44px 44px 36px;
  position: relative;
  display: flex; flex-direction: column;
}
.pdf * { box-sizing: border-box; }
.pdf h1 { margin: 0; font-size: 28px; line-height: 1; letter-spacing: -0.02em; font-weight: 800; color: var(--accent); }
.pdf-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.pdf-brand { display: flex; flex-direction: column; gap: 10px; }
.pdf-logo { width: 72px; height: 72px; object-fit: contain; object-position: left top; }
.pdf-biz-name { font-size: 15px; font-weight: 700; color: #0e0f0c; }
.pdf-small { color: #5e605e; white-space: pre-line; }
.pdf-title { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.pdf-meta { display: grid; grid-template-columns: auto auto; gap: 2px 14px; text-align: right; }
.pdf-meta span { color: #6a6c6a; }
.pdf-meta b { color: #0e0f0c; font-weight: 600; }
.pdf-parties { display: flex; justify-content: space-between; gap: 24px; margin: 28px 0 22px; }
.pdf-label { font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.pdf-client-name { font-size: 13px; font-weight: 700; color: #0e0f0c; }
.pdf-balance-box { text-align: right; }
.pdf-balance-box .amt { font-size: 22px; font-weight: 800; color: #0e0f0c; letter-spacing: -0.02em; }
.pdf-items { width: 100%; border-collapse: collapse; }
.pdf-items th { text-align: left; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 8px 8px; background: var(--accent); color: #fff; }
.pdf-items th.num, .pdf-items td.num { text-align: right; white-space: nowrap; }
.pdf-items td { padding: 10px 8px; border-bottom: 1px solid #e8ebe6; vertical-align: top; }
.pdf-items .desc { font-weight: 600; color: #0e0f0c; }
.pdf-items .det { color: #6a6c6a; white-space: pre-line; margin-top: 2px; }
.pdf-bottom { display: flex; justify-content: space-between; gap: 28px; margin-top: 18px; }
.pdf-left { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.pdf-totals { width: 230px; border-collapse: collapse; flex: none; align-self: flex-start; }
.pdf-totals td { padding: 5px 8px; }
.pdf-totals td:last-child { text-align: right; white-space: nowrap; color: #0e0f0c; }
.pdf-totals tr.tot td { font-weight: 700; border-top: 1px solid #d5d8d3; padding-top: 8px; }
.pdf-totals tr.bal td { background: var(--accent); color: #fff !important; font-weight: 700; font-size: 13px; padding: 9px 8px; }
.pdf-pay { display: flex; gap: 14px; align-items: flex-start; }
.pdf-qr { width: 78px; height: 78px; flex: none; }
.pdf-online { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pdf-online span { border: 1px solid #d5d8d3; border-radius: 99px; padding: 1px 8px; font-size: 9px; font-weight: 600; color: #454745; }
.pdf-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.pdf-photos figure { margin: 0; }
.pdf-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 4px; }
.pdf-photos figcaption { font-size: 9px; color: #6a6c6a; margin-top: 3px; }
.pdf-sigs { display: flex; gap: 40px; margin-top: 26px; }
.pdf-sig { width: 200px; }
.pdf-sig img { height: 48px; object-fit: contain; object-position: left bottom; }
.pdf-sig .sig-rule { border-top: 1px solid #454745; padding-top: 4px; color: #6a6c6a; font-size: 9px; }
.pdf-foot { margin-top: auto; padding-top: 24px; text-align: center; color: #868685; font-size: 9px; }
.pdf-stamp {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  border: 8px solid #1f7a2e; color: #1f7a2e;
  font-size: 96px; font-weight: 800; letter-spacing: .1em; line-height: 1;
  padding: 10px 36px; border-radius: 18px; opacity: .13;
  pointer-events: none;
}
.pdf-stamp.declined { border-color: #cb272f; color: #cb272f; }

/* Template: Modern — full-width colour band */
.tpl-modern { padding-top: 0; }
.tpl-modern .pdf-head { margin: 0 -44px; padding: 36px 44px 28px; background: var(--accent); color: #fff; }
.tpl-modern .pdf-head .pdf-biz-name, .tpl-modern .pdf-head h1, .tpl-modern .pdf-head .pdf-meta b { color: #fff; }
.tpl-modern .pdf-head .pdf-small, .tpl-modern .pdf-head .pdf-meta span { color: rgba(255,255,255,.78); }
.tpl-modern .pdf-logo { background: #fff; border-radius: 8px; padding: 6px; }

/* Template: Classic — ruled, restrained */
.tpl-classic h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: 0; color: #0e0f0c; font-size: 30px; }
.tpl-classic .pdf-head { border-bottom: 3px double var(--accent); padding-bottom: 18px; }
.tpl-classic .pdf-items th { background: none; color: var(--accent); border-bottom: 2px solid var(--accent); padding-left: 0; }
.tpl-classic .pdf-items td { padding-left: 0; }

/* Template: Bold — giant display title */
.tpl-bold h1 { font-family: var(--font-display); font-weight: 900; font-size: 64px; letter-spacing: -0.05em; line-height: .85; text-transform: uppercase; }
.tpl-bold .pdf-items th { background: #0e0f0c; }
.tpl-bold .pdf-totals tr.bal td { background: #0e0f0c; }
.tpl-bold .pdf-parties { border-top: 6px solid var(--accent); padding-top: 18px; }

/* Template: Minimal — monochrome, accent only on balance */
.tpl-minimal h1 { font-weight: 500; color: #0e0f0c; font-size: 22px; letter-spacing: .12em; text-transform: uppercase; }
.tpl-minimal .pdf-label { color: #868685; }
.tpl-minimal .pdf-items th { background: none; color: #868685; border-bottom: 1px solid #0e0f0c; padding-left: 0; }
.tpl-minimal .pdf-items td { padding-left: 0; }
.tpl-minimal .pdf-totals tr.bal td { background: none; color: var(--accent) !important; border-top: 2px solid var(--accent); font-size: 15px; }

/* Template: Corporate — side column */
.tpl-corporate { padding-left: 176px; }
.tpl-corporate::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 148px; background: var(--accent); }
.tpl-corporate .pdf-head { flex-direction: column-reverse; }
.tpl-corporate .pdf-brand { position: absolute; left: 20px; top: 44px; width: 110px; color: #fff; }
.tpl-corporate .pdf-brand .pdf-biz-name { color: #fff; font-size: 13px; }
.tpl-corporate .pdf-brand .pdf-small { color: rgba(255,255,255,.8); font-size: 9.5px; word-break: break-word; }
.tpl-corporate .pdf-logo { background: #fff; border-radius: 6px; padding: 4px; width: 64px; height: 64px; }
.tpl-corporate .pdf-title { text-align: left; align-items: flex-start; }
.tpl-corporate .pdf-meta { text-align: left; }
.tpl-corporate .pdf-totals { width: 200px; }

/* Template: Elegant — centred serif */
.tpl-elegant { font-family: Georgia, "Times New Roman", serif; }
.tpl-elegant .pdf-head { flex-direction: column; align-items: center; text-align: center; }
.tpl-elegant .pdf-brand { align-items: center; }
.tpl-elegant .pdf-logo { object-position: center; }
.tpl-elegant .pdf-title { align-items: center; text-align: center; }
.tpl-elegant h1 { font-family: Georgia, serif; font-weight: 400; font-style: italic; font-size: 34px; letter-spacing: 0; }
.tpl-elegant .pdf-meta { text-align: center; }
.tpl-elegant .pdf-items th { background: none; color: var(--accent); border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent); }
.tpl-elegant .pdf-totals tr.bal td { background: none; color: var(--accent) !important; border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent); }

/* ---------- Print: only the document ---------- */
#print-root { display: none; }
@media print {
  @page { size: letter; margin: 0; }
  body { background: #fff; }
  .stage { display: none !important; }
  #print-root { display: block !important; }
  #print-root .pdf { zoom: 1; width: 8.5in; min-height: 11in; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
