/* Invoice generator: the editable sheet (.iv-*) and the clean copy used for print and PDF (.ivp-*). */
.iv-tool{max-width:1000px;margin:0 auto 8px;color:#2d3748;font-size:15px;text-align:left}
.iv-tool *,.iv-tool *::before,.iv-tool *::after{box-sizing:border-box}
.iv-bar{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px 16px;margin-bottom:14px}
.iv-field{display:flex;flex-direction:column;gap:6px;margin:0;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#718096}
.iv-field select{height:46px;min-width:260px;max-width:100%;padding:0 12px;border:1px solid #d9dee8;border-radius:10px;background:#fff;color:#2d3748;font-size:15px;font-weight:400;letter-spacing:0;text-transform:none;cursor:pointer}
.iv-field select:focus{outline:0;border-color:#667eea;box-shadow:0 0 0 3px rgba(102,126,234,.2)}
.iv-actions{display:flex;flex-wrap:wrap;gap:10px}
.iv-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:46px;margin:0;padding:0 18px;border:1px solid #d9dee8;border-radius:10px;background:#fff;color:#2d3748;font-size:15px;font-weight:600;line-height:1;cursor:pointer;transition:border-color .15s,color .15s,box-shadow .15s,opacity .15s}
.iv-btn svg{width:18px;height:18px;flex:none}
.iv-btn:hover{border-color:#667eea;color:#5a67d8}
.iv-btn:focus-visible{outline:0;box-shadow:0 0 0 3px rgba(102,126,234,.3)}
.iv-btn.is-primary{border-color:transparent;background:linear-gradient(135deg,#667eea,#764ba2);color:#fff}
.iv-btn.is-primary:hover{color:#fff;box-shadow:0 6px 16px rgba(102,126,234,.35)}
.iv-btn:disabled{opacity:.6;cursor:progress}
.iv-msg{margin:0 0 12px;font-size:14px;color:#4a5568}
.iv-msg:empty{margin:0}
.iv-link{margin:0;padding:0;border:0;background:none;color:#5a67d8;font:inherit;font-weight:600;text-decoration:underline;cursor:pointer}

.iv-sheet{padding:44px 48px;border:1px solid #e6e9f0;border-radius:14px;background:#fff;box-shadow:0 10px 30px rgba(30,41,59,.08);font-size:14px;line-height:1.45}
.iv-in,.iv-lbl{display:block;width:100%;margin:0;padding:5px 7px;border:1px dashed transparent;border-radius:6px;background:transparent;color:inherit;font:inherit;line-height:1.45;transition:background .15s,border-color .15s}
.iv-in:hover,.iv-lbl:hover{border-color:#cbd2e1;background:#f8fafc}
.iv-in:focus,.iv-lbl:focus{outline:0;border:1px solid #667eea;background:#fffdf3}
.iv-in:placeholder-shown{border-color:#e2e7f0;background:#f8fafc}
.iv-in::placeholder{color:#a0aec0;opacity:1}
textarea.iv-in{min-height:34px;overflow:hidden;resize:none}
.iv-lbl{font-weight:600;color:#718096}

.iv-head{display:flex;justify-content:space-between;align-items:flex-start;gap:32px}
.iv-from{flex:1 1 auto;min-width:0;max-width:440px}
.iv-meta{flex:0 1 340px;min-width:0}
.iv-logo{position:relative;display:inline-block;margin:0 0 12px}
.iv-logo-add{display:inline-flex;align-items:center;gap:8px;height:64px;margin:0;padding:0 18px;border:1px dashed #cbd2e1;border-radius:10px;background:#f8fafc;color:#718096;font:inherit;font-weight:600;cursor:pointer}
.iv-logo-add:hover,.iv-logo-add:focus-visible{outline:0;border-color:#667eea;color:#5a67d8}
.iv-logo-add svg{width:20px;height:20px}
.iv-logo-img{display:block;max-width:220px;max-height:80px;cursor:pointer}
.iv-logo-del{position:absolute;top:-10px;right:-10px;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:50%;background:#e53e3e;color:#fff;cursor:pointer}
.iv-logo-del svg{width:14px;height:14px}
.iv-logo [hidden]{display:none}
.iv-company{font-size:19px;font-weight:700;color:#1a202c}
.iv-title{font-size:32px;font-weight:800;line-height:1.15;letter-spacing:.06em;text-transform:uppercase;text-align:right;color:#4c51bf}
.iv-kv{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);gap:4px 8px;align-items:center;margin-top:10px}
.iv-kv .iv-lbl{text-align:right}
.iv-kv input[type=date]{min-height:34px}
.iv-bill{max-width:440px;margin-top:30px}
.iv-cap{font-size:12px;letter-spacing:.08em;text-transform:uppercase}

.iv-items{margin-top:30px}
.iv-line{display:grid;grid-template-columns:minmax(0,1fr) 90px 130px 140px 30px;grid-template-areas:"d q p a x";gap:8px;align-items:start;padding:8px 10px;border-bottom:1px solid #edf0f5}
.iv-items-head{padding:6px 10px;border:0;border-radius:8px;background:#4c51bf}
.iv-items-head .iv-lbl{color:#fff;font-size:12px;letter-spacing:.06em;text-transform:uppercase}
.iv-items-head .iv-lbl:hover{border-color:rgba(255,255,255,.45);background:rgba(255,255,255,.12)}
.iv-items-head .iv-lbl:focus{border-color:#fff;background:rgba(255,255,255,.18)}
.iv-c-desc{grid-area:d}
.iv-c-qty{grid-area:q}
.iv-c-price{grid-area:p}
.iv-c-amount{grid-area:a}
.iv-line label{display:block;margin:0}
.iv-num,.iv-items-head .iv-c-qty,.iv-items-head .iv-c-price,.iv-items-head .iv-c-amount{text-align:right}
.iv-amount{display:block;padding:6px 7px;font-weight:600;color:#1a202c;text-align:right;white-space:nowrap}
.iv-mini{display:none}
.iv-del{grid-area:x;display:flex;align-items:center;justify-content:center;width:30px;height:30px;margin:2px 0 0;padding:0;border:0;border-radius:8px;background:transparent;color:#a0aec0;cursor:pointer}
.iv-del:hover,.iv-del:focus-visible{outline:0;background:#fff5f5;color:#e53e3e}
.iv-del svg{width:16px;height:16px}
.iv-add{display:inline-flex;align-items:center;gap:6px;margin:12px 0 0;padding:8px 12px;border:1px dashed #cbd2e1;border-radius:8px;background:#fff;color:#5a67d8;font:inherit;font-weight:600;cursor:pointer}
.iv-add:hover,.iv-add:focus-visible{outline:0;border-color:#667eea;background:#f5f7ff}
.iv-add svg{width:16px;height:16px}

.iv-bottom{display:flex;justify-content:space-between;align-items:flex-start;gap:32px;margin-top:24px}
.iv-notes{flex:1 1 auto;min-width:0;max-width:460px}
.iv-notes .iv-cap{margin-top:12px}
.iv-notes .iv-cap:first-child{margin-top:0}
.iv-totals{flex:0 1 400px;min-width:0}
.iv-t{display:grid;grid-template-columns:minmax(0,1fr) minmax(110px,auto);gap:8px;align-items:center;padding:2px 0}
.iv-t-l{display:flex;align-items:center;gap:4px;min-width:0}
.iv-t-l .iv-lbl{flex:1 1 auto;min-width:0}
.iv-pct{display:inline-flex;flex:none;align-items:center;gap:2px;font-weight:600;color:#718096}
.iv-pct .iv-in{width:64px}
.iv-v{display:block;padding:5px 7px;font-weight:600;color:#1a202c;text-align:right;white-space:nowrap}
.iv-money{text-align:right}
.iv-t.is-total{margin-top:6px;padding-top:8px;border-top:2px solid #2d3748}
.iv-t.is-total .iv-lbl,.iv-t.is-total .iv-v{font-size:18px;font-weight:800;color:#1a202c}
.iv-t.is-balance .iv-lbl,.iv-t.is-balance .iv-v{font-weight:700;color:#4c51bf}

.iv-foot{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:8px 24px;margin-top:14px}
.iv-note{flex:1 1 480px;margin:0;font-size:13px;color:#718096}
.iv-reset{font-size:13px;color:#e53e3e}

@media (max-width:640px){
  .iv-bar{align-items:stretch}
  .iv-field,.iv-field select{width:100%;min-width:0}
  .iv-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .iv-actions .is-primary{grid-column:1/-1}
  .iv-btn{padding:0 12px}
  .iv-sheet{padding:20px 14px;border-radius:12px}
  .iv-head,.iv-bottom{flex-direction:column;gap:18px}
  .iv-from,.iv-meta,.iv-bill,.iv-notes,.iv-totals{flex:none;width:100%;max-width:none}
  .iv-title{font-size:26px;text-align:left}
  .iv-kv .iv-lbl{text-align:left}
  .iv-items-head{display:none}
  .iv-line{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1.2fr) 30px;grid-template-areas:"d d d x" "q p a a";padding:10px 0}
  .iv-mini{display:block;padding:0 7px 2px;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#a0aec0;text-align:right}
  .iv-bottom .iv-totals{order:-1}
}

.ivp-root{display:none}
.ivp-root.is-render{display:block;position:fixed;top:0;left:0;z-index:-1;pointer-events:none;clip-path:inset(0 100% 100% 0)}
.ivp{box-sizing:border-box;width:794px;padding:56px 60px 48px;background:#fff;color:#1f2937;font:13px/1.5 "Helvetica Neue",Helvetica,Arial,sans-serif;letter-spacing:0;text-align:left}
.ivp *{box-sizing:border-box;margin:0;padding:0}
.ivp-head{display:flex;justify-content:space-between;align-items:flex-start;gap:32px}
.ivp-from{flex:1 1 auto;min-width:0}
.ivp-logo{display:block;max-width:220px;max-height:80px;margin-bottom:14px}
.ivp-company{margin-bottom:4px;font-size:18px;font-weight:700;color:#111827}
.ivp-pre{white-space:pre-wrap;overflow-wrap:anywhere}
.ivp-meta{flex:0 1 auto;max-width:46%;text-align:right}
.ivp-title{margin-bottom:12px;font-size:30px;font-weight:800;line-height:1.1;letter-spacing:.06em;text-transform:uppercase;color:#4c51bf;overflow-wrap:anywhere}
.ivp table{border-collapse:collapse;border-spacing:0}
.ivp th,.ivp td{border:0;vertical-align:top}
.ivp-kv{margin-left:auto}
.ivp-kv th{padding:2px 14px 2px 0;font-weight:600;color:#6b7280;text-align:right;white-space:nowrap}
.ivp-kv td{padding:2px 0;color:#111827;text-align:right}
.ivp-bill{max-width:60%;margin-top:34px}
.ivp-cap{margin-bottom:4px;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#6b7280}
.ivp-items{width:100%;margin-top:30px}
.ivp-items th{padding:9px 10px;background:#4c51bf;color:#fff;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;text-align:left}
/* Adjacent cell backgrounds leave hairline gaps when anti-aliased: the row background covers them in
   html2canvas, the same-colour collapsed border does in the browser's own print output. */
.ivp-items thead tr{background:#4c51bf}
.ivp-items th+th{border-left:2px solid #4c51bf}
.ivp-items td{padding:10px;border-bottom:1px solid #e5e7eb;color:#1f2937}
.ivp-items .n{text-align:right;white-space:nowrap}
.ivp-items tr{break-inside:avoid}
.ivp-sum{display:flex;justify-content:flex-end;margin-top:14px;break-inside:avoid}
.ivp-totals{min-width:300px}
.ivp-totals th{padding:5px 28px 5px 0;font-weight:400;color:#4b5563;text-align:left}
.ivp-totals td{padding:5px 0;color:#111827;text-align:right;white-space:nowrap}
.ivp-totals .ivp-grand th,.ivp-totals .ivp-grand td{padding-top:9px;border-top:2px solid #111827;font-size:16px;font-weight:800;color:#111827}
.ivp-totals .ivp-due th,.ivp-totals .ivp-due td{font-weight:700;color:#4c51bf}
.ivp-block{margin-top:26px;break-inside:avoid}

@page{size:A4;margin:12mm 0}
@media print{
  html.iv-printing body>*:not(.ivp-root){display:none!important}
  html.iv-printing body{width:auto!important;min-width:0!important;margin:0!important;padding:0!important;background:#fff!important}
  html.iv-printing .ivp-root{display:block!important;position:static!important;clip-path:none!important}
  html.iv-printing .ivp{width:auto;padding:0 16mm}
  .ivp,.ivp *{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
