.doc-wrap { overflow-x: auto; }
.doc-page {
  --doc-color: #c99a4a;
  position: relative; background: #fff; color: #1b1b1b; width: 210mm; max-width: 100%; min-height: 297mm;
  margin: 0 auto; padding: 16mm 15mm 14mm; box-shadow: 0 2px 14px rgba(0,0,0,.12);
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column;
  border-top: 8px solid var(--doc-color);
}
.doc-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 2px solid var(--doc-color); padding-bottom: 12px; }
.doc-brand { display: flex; gap: 12px; align-items: center; }
.doc-logo { width: 64px; height: 64px; object-fit: contain; }
.doc-logo-fallback { width: 64px; height: 64px; background: var(--doc-color); color: #fff; font-weight: 800; font-size: 30px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.doc-company { font-size: 20px; font-weight: 800; }
.doc-tagline { color: #666; font-size: 12px; }
.doc-title { text-align: right; }
.doc-title h1 { font-size: 28px; letter-spacing: .08em; color: var(--doc-color); margin: 0 0 4px; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0; }
.doc-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #888; margin-bottom: 3px; }
.doc-strong { font-weight: 700; font-size: 15px; }
.doc-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.doc-table th { background: #111; color: #fff; text-align: left; padding: 7px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.doc-table td { padding: 8px; border-bottom: 1px solid #e8e3da; vertical-align: top; }
.doc-table .r { text-align: right; font-variant-numeric: tabular-nums; } .doc-table .num { width: 28px; color: #888; }
.doc-totals { margin: 12px 0 0 auto; width: 280px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 5px 8px; }
.doc-totals .grand { background: var(--doc-color); color: #fff; font-weight: 800; font-size: 15px; margin-top: 4px; border-radius: 4px; padding: 8px; }
.doc-info { margin-top: 16px; display: grid; gap: 6px; }
.doc-paynote, .doc-notes { background: #faf7f0; border-left: 3px solid var(--doc-color); padding: 8px 10px; }
.doc-sign { margin-top: auto; padding-top: 36px; display: flex; gap: 40px; align-items: flex-end; justify-content: space-between; }
.doc-sign > div { min-width: 180px; }
.sign-line { border-top: 1px solid #333; margin-bottom: 4px; width: 200px; }
.doc-qr { width: 78px; height: 78px; object-fit: contain; }
.doc-foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid #ddd; text-align: center; color: #777; font-size: 11px; }
.doc-stamp { position: absolute; top: 120px; right: 40px; transform: rotate(-14deg); font-size: 40px; font-weight: 900; letter-spacing: .1em; padding: 2px 16px; border: 4px solid; border-radius: 8px; opacity: .22; pointer-events: none; }
.stamp-paid { color: #2e7d32; } .stamp-void { color: #b3261e; }
.doc-page .small { font-size: 11px; color: #666; }

@media (max-width: 800px) { .doc-page { width: 210mm; } }
@media print {
  @page { size: A4; margin: 0; }
  .doc-wrap { overflow: visible; }
  .doc-page { box-shadow: none; width: 210mm; min-height: 297mm; margin: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
