/* Tampilan dokumen A4. Hanya memakai warna hex dan properti yang didukung html2canvas
   (hindari object-fit, color-mix, dan oklch di file ini). */

.sheet {
  position: relative;
  box-sizing: border-box;
  width: 210mm;
  height: 297mm;
  overflow: hidden;
  background: #ffffff;
  color: #1c1e23;
  font-family: 'Plus Jakarta Sans Variable', 'Segoe UI', Arial, sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
}
.sheet * { box-sizing: border-box; }
.sheet img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; }

.d-body { padding: 44px 48px 12px; }
.d-block { padding-bottom: 24px; }

.d-head { display: flex; justify-content: space-between; align-items: flex-start; }
.d-from { min-width: 0; max-width: 380px; }
.d-logo { height: 60px; max-width: 220px; margin-bottom: 10px; display: flex; align-items: center; }
.d-mono {
  width: 60px; height: 60px; border-radius: 12px;
  background: var(--d-accent); color: var(--d-on);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px;
}
.d-brandname { font-size: 16px; font-weight: 700; line-height: 1.3; }
.d-tagline { font-size: 12px; color: #5d626c; }

.d-title { text-align: right; flex-shrink: 0; }
.d-titletext { font-size: 28px; font-weight: 800; line-height: 1.15; color: var(--d-accent); }
.d-number { font-size: 13px; font-weight: 600; color: #3a3e47; margin-top: 4px; }
.d-tag {
  display: inline-block; vertical-align: middle; margin-left: 10px;
  padding: 3px 8px; border: 1px solid currentColor; border-radius: 4px;
  font-size: 10px; font-weight: 700; color: #6b7079;
}

.d-meta {
  display: flex; gap: 24px;
  border-top: 2px solid var(--d-accent);
  padding-top: 16px;
}
.d-to { flex: 1.15; min-width: 0; }
.d-from2 { flex: 1.15; min-width: 0; }
.d-dates { flex: 0.7; min-width: 0; }
.d-toname { font-size: 14px; font-weight: 700; line-height: 1.35; margin-bottom: 2px; word-break: break-word; }

.d-label { font-size: 10px; font-weight: 700; color: #6b7079; margin-bottom: 3px; }
.d-label-gap { margin-top: 10px; }
.d-small { font-size: 12px; color: #3a3e47; word-break: break-word; }
.d-strong { font-weight: 600; color: #1c1e23; }
.d-italic { font-style: italic; }
.d-faint { color: #a0a4ac; font-weight: 400; }

.d-cont {
  display: flex; justify-content: space-between; gap: 16px;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 2px solid var(--d-accent);
  font-size: 12px; color: #3a3e47;
}

.d-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin-bottom: 20px; }
.d-table th {
  padding: 9px 10px; background: var(--d-tint);
  font-size: 10.5px; font-weight: 700; color: #3a3e47; text-align: left;
}
.d-table td {
  padding: 10px; vertical-align: top;
  border-bottom: 1px solid #e7e8eb;
  font-size: 12px; color: #2a2d33;
}
.d-c-no { width: 38px; color: #6b7079; }
.d-table td.d-c-no { color: #6b7079; }
.d-c-qty { width: 80px; }
.d-c-price { width: 112px; text-align: right; }
.d-c-amt { width: 124px; text-align: right; }
.d-table th.d-c-price, .d-table th.d-c-amt { text-align: right; }
.d-table td.d-c-amt { font-weight: 600; color: #1c1e23; }
.d-item { word-break: break-word; }
.d-table .d-sumrow td { background: var(--d-tint); font-weight: 700; color: #1c1e23; border-bottom: 0; }
.d-table .d-sumrow td.d-c-desc { text-align: right; }

.d-summary { display: flex; justify-content: space-between; gap: 32px; }
.d-notes { flex: 1; min-width: 0; }
.d-totals { position: relative; width: 280px; flex-shrink: 0; }
.d-tline { display: flex; justify-content: space-between; gap: 12px; padding: 5px 10px; font-size: 12px; color: #3a3e47; }
.d-tline span:last-child { font-weight: 600; color: #1c1e23; }
.d-grand {
  margin-top: 4px; padding: 10px; border-radius: 6px;
  background: var(--d-accent); color: var(--d-on);
  font-size: 14px; font-weight: 700;
}
.d-grand span:last-child { color: var(--d-on); font-weight: 800; }
.d-due { border-bottom: 1px solid var(--d-line); font-weight: 700; color: #1c1e23; }
.d-paidstamp {
  margin: 12px auto 0; width: 112px;
  padding: 5px 0; text-align: center;
  border: 2.5px solid #15803d; border-radius: 6px; color: #15803d;
  font-size: 18px; font-weight: 800;
  transform: rotate(-6deg);
}

.d-pay { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; }
.d-payinfo { flex: 1; min-width: 0; }
.d-payrow { display: flex; gap: 20px; align-items: flex-start; }
.d-banks { flex: 1; min-width: 0; }
.d-bank { margin-bottom: 7px; }
.d-qris { width: 104px; height: 104px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.d-sign { width: 180px; flex-shrink: 0; text-align: center; }
.d-stamp { height: 76px; margin: 4px 0; display: flex; align-items: center; justify-content: center; }

.d-footer {
  position: absolute; left: 48px; right: 48px; bottom: 22px;
  display: flex; justify-content: space-between; gap: 16px;
  padding-top: 8px; border-top: 1px solid #e7e8eb;
  font-size: 10px; color: #6b7079;
}

/* Template "Tegas": kepala dokumen berwarna penuh */
.d-band .d-body { padding-top: 0; }
.d-band .d-head {
  margin: 0 -48px 24px; padding: 34px 48px 26px;
  background: var(--d-accent); color: var(--d-on);
}
.d-band .d-brandname, .d-band .d-titletext, .d-band .d-number, .d-band .d-tag { color: var(--d-on); }
.d-band .d-tagline { color: var(--d-on); }
/* Harus display:flex, bukan inline-flex: html2canvas menggambar latar inline-flex di atas gambarnya. */
.d-band .d-logo { height: 56px; width: fit-content; padding: 6px; background: #ffffff; border-radius: 10px; }
.d-band .d-mono { width: 44px; height: 44px; font-size: 17px; border-radius: 8px; }
.d-band .d-meta { border-top: 0; padding-top: 0; }
.d-band .d-cont { margin-top: 36px; }

/* Lembar bantu untuk mengukur tinggi dan untuk ekspor; tidak terlihat oleh pengguna */
.d-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; }
.d-export { position: fixed; left: -10000px; top: 0; }

#print-root { display: none; }

@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #ffffff !important; margin: 0; padding: 0; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .sheet {
    height: 296.6mm;
    break-after: page;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .sheet:last-child { break-after: auto; }
}
