/* Invoice document (admin preview, drawer, client portal, print) */
.iv-doc { position: relative; background: #fff; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 14px; line-height: 1.5; }
.iv-head { display: flex; justify-content: space-between; gap: 24px; padding: 36px 40px 28px; border-bottom: 1px solid #e2e8f0; }
.iv-logo img { height: 74px; width: auto; max-width: 260px; object-fit: contain; }
.iv-from { text-align: right; color: #334155; }
.iv-title { font-size: 2rem; font-weight: 300; letter-spacing: 1px; color: #0a2540; line-height: 1.1; margin-bottom: 8px; }
.iv-bizname { font-weight: 700; color: #0f172a; }
.iv-gap { margin-top: 8px; }
.iv-meta { display: flex; justify-content: space-between; gap: 24px; padding: 28px 40px; flex-wrap: wrap; }
.iv-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.8px; color: #64748b; font-weight: 600; margin-bottom: 4px; }
.iv-strong { font-weight: 700; }
.iv-billto { color: #334155; min-width: 220px; }
.iv-facts { border-collapse: collapse; }
.iv-facts th { text-align: right; padding: 3px 14px 3px 0; font-weight: 600; color: #0f172a; white-space: nowrap; }
.iv-facts td { padding: 3px 0; color: #334155; }
.iv-facts .iv-due th, .iv-facts .iv-due td { background: #f1f5f9; padding: 8px 12px; font-weight: 700; color: #0f172a; }
.iv-items { width: 100%; border-collapse: collapse; }
.iv-items thead th { background: #0a2540; color: #fff; text-align: left; padding: 14px 40px 14px 12px; font-size: 0.85rem; font-weight: 600; }
.iv-items thead th:first-child { padding-left: 40px; }
.iv-items th.r, .iv-items td.r { text-align: right; }
.iv-items tbody td { padding: 14px 12px; vertical-align: top; border-bottom: 1px solid #eef2f7; }
.iv-items tbody td:first-child { padding-left: 40px; }
.iv-items tbody td:last-child, .iv-items thead th:last-child { padding-right: 40px; }
.iv-desc { color: #64748b; font-size: 0.88rem; }
.iv-totals { display: flex; justify-content: flex-end; padding: 18px 40px 8px; }
.iv-totals table { border-collapse: collapse; min-width: 320px; }
.iv-totals th { text-align: right; padding: 5px 20px 5px 0; font-weight: 600; color: #334155; }
.iv-totals td { text-align: right; padding: 5px 0; min-width: 100px; }
.iv-totals .iv-grand th, .iv-totals .iv-grand td { border-top: 2px solid #cbd5e1; padding-top: 12px; font-weight: 800; color: #0f172a; font-size: 1.05rem; }
.iv-totals .iv-paidrow td, .iv-totals .iv-paidrow th { color: #047857; }
.iv-notes { padding: 12px 40px 36px; color: #475569; font-size: 0.9rem; }
.iv-stamp { position: absolute; top: 120px; right: 60px; transform: rotate(-12deg); font-weight: 900; font-size: 2.4rem; letter-spacing: 4px;
  padding: 2px 18px; border: 4px solid currentColor; border-radius: 10px; opacity: 0.18; pointer-events: none; }
.iv-stamp--paid { color: #059669; } .iv-stamp--void { color: #dc2626; } .iv-stamp--draft { color: #64748b; }
.iv-void .iv-items tbody td, .iv-void .iv-totals td { text-decoration: line-through; color: #94a3b8; }

@media (max-width: 640px) {
  .iv-head, .iv-meta { padding-left: 20px; padding-right: 20px; }
  .iv-head { flex-direction: column; }
  .iv-from { text-align: left; }
  .iv-items thead th:first-child, .iv-items tbody td:first-child { padding-left: 20px; }
  .iv-items thead th:last-child, .iv-items tbody td:last-child { padding-right: 20px; }
  .iv-items thead th, .iv-items tbody td { padding-left: 6px; padding-right: 6px; font-size: 0.85rem; }
  .iv-totals, .iv-notes { padding-left: 20px; padding-right: 20px; }
  .iv-totals table { min-width: 0; width: 100%; }
  .iv-stamp { font-size: 1.6rem; top: 100px; right: 20px; }
}

/* Print / Save as PDF: only the invoice is printed */
.iv-print-root { display: none; }
@media print {
  body.iv-printing > *:not(.iv-print-root) { display: none !important; }
  body.iv-printing .iv-print-root { display: block !important; }
  body.iv-printing { background: #fff !important; }
  .iv-doc { border: 0; border-radius: 0; box-shadow: none; }
  .iv-items thead th, .iv-facts .iv-due th, .iv-facts .iv-due td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 12mm; }
}
