/* Hesabam 2.1.6 - public invoice, print, export and selectable typography */
.hesabam-invoice-page{
  --hesabam-accent:#2563eb;
  --hesabam-accent-2:#7c3aed;
  --hesabam-surface:#fff;
  --hesabam-bg:#eef3f9;
  --hesabam-text:#0f172a;
  --hesabam-muted:#64748b;
  --hesabam-border:#dfe7f1;
  --hesabam-radius:24px;
  --hesabam-font-scale:100%;
  margin:0;
  min-height:100vh;
  padding:24px;
  box-sizing:border-box;
  background:
    radial-gradient(circle at 12% 4%,rgba(37,99,235,.10),transparent 26%),
    radial-gradient(circle at 92% 8%,rgba(124,58,237,.08),transparent 24%),
    var(--hesabam-bg);
  color:var(--hesabam-text);
  font-family:var(--hesabam-invoice-font-family,'Hesabam Vazir',Vazir,Tahoma,Arial,sans-serif);
  font-size:var(--hesabam-font-scale);
  line-height:1.8;
}
.hesabam-invoice-page *{box-sizing:border-box;font-family:inherit}
.hesabam-invoice-shell{width:min(1120px,100%);margin:0 auto}
.hesabam-invoice-actions{
  position:sticky;top:14px;z-index:50;display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin:0 auto 16px;padding:11px 12px;border:1px solid rgba(219,228,238,.95);border-radius:20px;
  background:rgba(255,255,255,.94);box-shadow:0 18px 50px rgba(15,23,42,.12);backdrop-filter:blur(14px)
}
.hesabam-invoice-actions__title{display:flex;align-items:center;gap:10px;min-width:0}
.hesabam-invoice-actions__title strong{display:block;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hesabam-invoice-actions__title small{display:block;color:var(--hesabam-muted);font-size:11px}
.hesabam-invoice-actions__icon{width:38px;height:38px;border-radius:13px;display:grid;place-items:center;background:linear-gradient(135deg,var(--hesabam-accent),var(--hesabam-accent-2));color:#fff;font-size:18px;flex:0 0 auto}
.hesabam-invoice-actions__buttons{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.hesabam-invoice-action{
  appearance:none;border:1px solid #dbe4ee;border-radius:13px;min-height:40px;padding:7px 13px;background:#fff;color:#1e293b;
  text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:7px;cursor:pointer;font-weight:800;font-size:12px;
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease,background .18s ease
}
.hesabam-invoice-action:hover{transform:translateY(-1px);border-color:#93c5fd;box-shadow:0 9px 24px rgba(37,99,235,.13);color:#1d4ed8}
.hesabam-invoice-action.is-primary{border-color:transparent;background:linear-gradient(135deg,var(--hesabam-accent),var(--hesabam-accent-2));color:#fff;box-shadow:0 10px 24px rgba(37,99,235,.22)}
.hesabam-invoice-action.is-success{border-color:transparent;background:linear-gradient(135deg,#16a34a,#059669);color:#fff}
.hesabam-invoice-action[disabled]{opacity:.55;cursor:wait;transform:none}
.hesabam-invoice-paper{
  width:100%;min-height:297mm;margin:0 auto;background:var(--hesabam-surface);color:var(--hesabam-text);
  border:1px solid var(--hesabam-border);border-radius:var(--hesabam-radius);overflow:hidden;
  box-shadow:0 28px 80px rgba(15,23,42,.14);isolation:isolate
}
.hesabam-invoice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;padding:24px}
.hesabam-invoice-page[data-layout="stack"] .hesabam-invoice-grid{grid-template-columns:1fr}
.hesabam-invoice-page[data-layout="magazine"] .hesabam-invoice-grid{grid-template-columns:1.35fr .65fr}
.hesabam-invoice-block{min-width:0;background:#fff;border:1px solid var(--hesabam-border);border-radius:calc(var(--hesabam-radius) - 7px);padding:16px;box-shadow:0 7px 24px rgba(15,23,42,.045)}
.hesabam-invoice-block.is-full{grid-column:1/-1}.hesabam-invoice-block.is-half{grid-column:auto}
.hesabam-invoice-block h2,.hesabam-invoice-block h3{margin:0;color:var(--hesabam-text)}
.hesabam-invoice-block h3{font-size:14px;margin-bottom:12px;display:flex;align-items:center;gap:8px}
.hesabam-invoice-block h3:before{content:"";width:5px;height:18px;border-radius:99px;background:linear-gradient(180deg,var(--hesabam-accent),var(--hesabam-accent-2));flex:0 0 auto}
.hesabam-invoice-header{
  position:relative;overflow:hidden;display:flex;align-items:flex-start;justify-content:space-between;gap:20px;
  min-height:154px;padding:25px;color:#fff;border:none;box-shadow:none;background:linear-gradient(135deg,var(--hesabam-accent),var(--hesabam-accent-2))
}
.hesabam-invoice-page[data-header-style="solid"] .hesabam-invoice-header{background:var(--hesabam-accent)}
.hesabam-invoice-page[data-header-style="outline"] .hesabam-invoice-header{background:#fff;color:var(--hesabam-text);border:2px solid var(--hesabam-accent)}
.hesabam-invoice-header:before,.hesabam-invoice-header:after{content:"";position:absolute;border-radius:50%;background:rgba(255,255,255,.10)}
.hesabam-invoice-header:before{width:220px;height:220px;left:-90px;top:-130px}.hesabam-invoice-header:after{width:130px;height:130px;right:34%;bottom:-92px}
.hesabam-invoice-brand,.hesabam-invoice-document{position:relative;z-index:2}
.hesabam-invoice-brand{display:flex;align-items:center;gap:16px;min-width:0}
.hesabam-invoice-logo{width:82px;height:82px;object-fit:contain;background:#fff;border-radius:20px;padding:7px;box-shadow:0 12px 30px rgba(15,23,42,.16);flex:0 0 auto}
.hesabam-invoice-brand h1{margin:0;font-size:26px;color:inherit;line-height:1.35}
.hesabam-invoice-brand p{margin:7px 0 0;opacity:.88;font-size:13px}
.hesabam-invoice-document{text-align:left;min-width:190px}
.hesabam-invoice-document__type{display:inline-flex;padding:6px 11px;border-radius:999px;background:rgba(255,255,255,.16);border:1px solid rgba(255,255,255,.24);font-size:11px;font-weight:900}
[data-header-style="outline"] .hesabam-invoice-document__type{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
.hesabam-invoice-document__number{display:block;margin-top:10px;font-size:22px;font-weight:950;direction:ltr;letter-spacing:.4px}
.hesabam-invoice-document__status{display:inline-flex;margin-top:8px;padding:5px 10px;border-radius:10px;background:rgba(15,23,42,.18);font-size:11px;font-weight:800}
[data-header-style="outline"] .hesabam-invoice-document__status{background:#f1f5f9;color:#334155}
.hesabam-invoice-qr{display:inline-flex;margin-top:10px;padding:6px;background:#fff;border-radius:12px}.hesabam-invoice-qr img{display:block;width:82px;height:82px}
.hesabam-info-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.hesabam-info-item{padding:11px 12px;border:1px solid #e6edf5;border-radius:13px;background:#f8fafc;min-width:0;overflow-wrap:anywhere}
.hesabam-info-item.is-wide{grid-column:1/-1}.hesabam-info-item span{display:block;color:var(--hesabam-muted);font-size:10px;margin-bottom:3px}.hesabam-info-item strong{font-size:12px;color:#1e293b}
.hesabam-invoice-table-wrap{width:100%;overflow:hidden;border:1px solid #e3eaf2;border-radius:15px}
.hesabam-invoice-table{width:100%;border-collapse:collapse;table-layout:auto}
.hesabam-invoice-table th,.hesabam-invoice-table td{padding:11px 10px;text-align:right;border-bottom:1px solid #e9eef5;vertical-align:middle;font-size:12px}
.hesabam-invoice-table th{background:#f1f5f9;color:#334155;font-weight:900;white-space:nowrap}.hesabam-invoice-table tbody tr:last-child td{border-bottom:0}.hesabam-invoice-table tbody tr:nth-child(even){background:#fbfdff}
.hesabam-invoice-table .is-number{direction:ltr;text-align:left;white-space:nowrap;font-variant-numeric:tabular-nums}.hesabam-invoice-table .item-title{font-weight:800;color:#0f172a}.hesabam-invoice-table .item-sku{display:block;margin-top:3px;color:var(--hesabam-muted);font-size:9px;direction:ltr;text-align:right}
.hesabam-invoice-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.hesabam-invoice-summary__item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 12px;border:1px solid #e3eaf2;border-radius:13px;background:#f8fafc}
.hesabam-invoice-summary__item span{color:var(--hesabam-muted);font-size:10px}.hesabam-invoice-summary__item strong{font-size:13px;white-space:nowrap;direction:ltr}
.hesabam-invoice-summary__item.is-total{grid-column:1/-1;padding:15px 16px;color:#fff;border:0;background:linear-gradient(135deg,var(--hesabam-accent),var(--hesabam-accent-2));box-shadow:0 12px 28px rgba(37,99,235,.20)}
.hesabam-invoice-summary__item.is-total span,.hesabam-invoice-summary__item.is-total strong{color:#fff}.hesabam-invoice-summary__item.is-total strong{font-size:19px}
.hesabam-invoice-summary__item.is-paid{background:#ecfdf5;border-color:#bbf7d0}.hesabam-invoice-summary__item.is-due{background:#fff7ed;border-color:#fed7aa}
.hesabam-invoice-note{padding:14px 15px;border:1px solid #dfe7f1;border-radius:14px;background:#f8fafc;color:#334155;white-space:pre-line;overflow-wrap:anywhere}
.hesabam-payment-list{display:grid;gap:9px}.hesabam-payment-row{display:grid;grid-template-columns:1.1fr 1fr 1.3fr 1fr;gap:9px;padding:10px;border:1px solid #e2e8f0;border-radius:13px;background:#f8fafc}.hesabam-payment-row span{display:block;color:var(--hesabam-muted);font-size:9px}.hesabam-payment-row strong{font-size:11px;overflow-wrap:anywhere}
.hesabam-invoice-stamp-wrap{text-align:left}.hesabam-invoice-stamp{max-width:190px;max-height:120px;object-fit:contain}
.hesabam-invoice-footer{padding:17px 24px;text-align:center;color:var(--hesabam-muted);background:#f8fafc;border-top:1px solid var(--hesabam-border);font-size:11px}
.hesabam-invoice-toast{position:fixed;left:20px;bottom:20px;z-index:9999;max-width:min(390px,calc(100vw - 40px));padding:12px 15px;border-radius:14px;background:#0f172a;color:#fff;box-shadow:0 18px 50px rgba(15,23,42,.25);font-size:12px;opacity:0;transform:translateY(12px);pointer-events:none;transition:.2s ease}.hesabam-invoice-toast.is-visible{opacity:1;transform:none}.hesabam-invoice-toast.is-error{background:#991b1b}
.hesabam-export-clone{position:fixed!important;left:-100000px!important;top:0!important;width:1120px!important;max-width:none!important;margin:0!important;z-index:-1!important;box-shadow:none!important;border-radius:0!important}
.hesabam-export-clone .hesabam-invoice-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.hesabam-export-clone .hesabam-invoice-block.is-half{grid-column:auto!important}.hesabam-export-clone .hesabam-payment-row{grid-template-columns:1.1fr 1fr 1.3fr 1fr!important}
.hesabam-invoice-page.is-exporting .hesabam-invoice-actions{opacity:.6;pointer-events:none}.hesabam-invoice-page.is-exporting{cursor:progress}
.hesabam-customer-invoices{font-family:var(--hesabam-invoice-font-family,'Hesabam Vazir',Vazir,Tahoma,Arial,sans-serif)!important}.hesabam-customer-invoices .hesabam-shortcode-table{font-family:inherit}.hesabam-invoice-mini-actions{display:flex;gap:6px;flex-wrap:wrap}.hesabam-invoice-mini-actions a{font-family:inherit!important}
@media(max-width:820px){
  .hesabam-invoice-page{padding:10px}.hesabam-invoice-actions{position:relative;top:0;display:block;padding:11px}.hesabam-invoice-actions__buttons{margin-top:10px;justify-content:flex-start}.hesabam-invoice-action{flex:1 1 120px}
  .hesabam-invoice-paper{min-height:0;border-radius:18px}.hesabam-invoice-grid,.hesabam-invoice-page[data-layout="magazine"] .hesabam-invoice-grid{grid-template-columns:1fr;padding:12px;gap:11px}.hesabam-invoice-block.is-half{grid-column:1/-1}.hesabam-invoice-block{padding:13px}
  .hesabam-invoice-header{min-height:0;display:block;padding:20px}.hesabam-invoice-document{text-align:right;margin-top:18px;min-width:0}.hesabam-invoice-brand h1{font-size:21px}.hesabam-invoice-logo{width:66px;height:66px}.hesabam-invoice-qr{position:absolute;left:17px;bottom:17px}.hesabam-invoice-qr img{width:64px;height:64px}
  .hesabam-info-grid,.hesabam-invoice-summary{grid-template-columns:1fr}.hesabam-info-item.is-wide,.hesabam-invoice-summary__item.is-total{grid-column:1}
  .hesabam-invoice-table-wrap{border:0;overflow:visible}.hesabam-invoice-table,.hesabam-invoice-table thead,.hesabam-invoice-table tbody,.hesabam-invoice-table tr,.hesabam-invoice-table th,.hesabam-invoice-table td{display:block;width:100%}.hesabam-invoice-table thead{display:none}.hesabam-invoice-table tr{margin-bottom:10px;border:1px solid #e3eaf2;border-radius:14px;overflow:hidden;background:#fff!important}.hesabam-invoice-table td{display:flex;align-items:center;justify-content:space-between;gap:10px;text-align:left;border-bottom:1px dashed #e5e7eb;padding:9px 11px}.hesabam-invoice-table td:last-child{border-bottom:0}.hesabam-invoice-table td:before{content:attr(data-label);color:var(--hesabam-muted);font-size:10px;font-weight:800;text-align:right}.hesabam-invoice-table td:first-child{display:block;text-align:right}.hesabam-invoice-table td:first-child:before{display:block;margin-bottom:5px}.hesabam-invoice-table .is-number{text-align:left}
  .hesabam-payment-row{grid-template-columns:1fr 1fr}.hesabam-invoice-footer{padding:14px}
}
@media print{
  @page{size:A4 portrait;margin:8mm}
  html,body{background:#fff!important}.hesabam-invoice-page{padding:0!important;background:#fff!important;font-size:90%!important;-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}
  .hesabam-invoice-actions,.hesabam-invoice-toast,[data-export-ignore]{display:none!important}.hesabam-invoice-shell{width:100%!important;max-width:none!important}.hesabam-invoice-paper{min-height:0;border:0!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}
  .hesabam-invoice-grid{padding:8mm!important;gap:4mm!important}.hesabam-invoice-block{break-inside:avoid;page-break-inside:avoid;box-shadow:none!important}.hesabam-invoice-table tr{break-inside:avoid;page-break-inside:avoid}.hesabam-invoice-header{break-inside:avoid;page-break-inside:avoid}
}

/* Template variations selected in Hesabam invoice designer */
.hesabam-template-modern-pro .hesabam-invoice-paper{background:linear-gradient(180deg,#fff 0,#fbfdff 100%)}
.hesabam-template-modern-pro .hesabam-invoice-block:not(.hesabam-invoice-header){background:linear-gradient(145deg,#fff,#fbfdff)}
.hesabam-template-glass{--hesabam-border:rgba(255,255,255,.68)}
.hesabam-template-glass .hesabam-invoice-paper{background:rgba(255,255,255,.78);backdrop-filter:blur(24px);border-color:rgba(255,255,255,.92)}
.hesabam-template-glass .hesabam-invoice-block:not(.hesabam-invoice-header){background:rgba(255,255,255,.72);backdrop-filter:blur(16px);border-color:rgba(203,213,225,.55)}
.hesabam-template-glass .hesabam-info-item,.hesabam-template-glass .hesabam-invoice-summary__item,.hesabam-template-glass .hesabam-payment-row{background:rgba(248,250,252,.72)}
.hesabam-template-executive{--hesabam-radius:10px}
.hesabam-template-executive .hesabam-invoice-paper{border-top:7px solid var(--hesabam-accent);box-shadow:0 22px 60px rgba(15,23,42,.11)}
.hesabam-template-executive .hesabam-invoice-header{border-radius:0;background:#fff;color:var(--hesabam-text);border-bottom:2px solid var(--hesabam-accent)}
.hesabam-template-executive .hesabam-invoice-header:before,.hesabam-template-executive .hesabam-invoice-header:after{display:none}
.hesabam-template-executive .hesabam-invoice-document__type{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
.hesabam-template-executive .hesabam-invoice-document__status{background:#f1f5f9;color:#334155}
.hesabam-template-executive .hesabam-invoice-block:not(.hesabam-invoice-header){box-shadow:none;border-radius:8px}
.hesabam-template-executive .hesabam-invoice-table th{background:var(--hesabam-accent);color:#fff}
.hesabam-template-executive .hesabam-invoice-summary__item.is-total{border-radius:7px}


/* Hesabam 2.1.8 — decorative layers never block invoice actions. */
.hesabam-invoice-page:before,.hesabam-invoice-page:after,.hesabam-invoice-paper:before,.hesabam-invoice-paper:after,.hesabam-invoice-header:before,.hesabam-invoice-header:after{pointer-events:none!important}
.hesabam-invoice-actions,.hesabam-invoice-actions *{position:relative;z-index:100}
.hesabam-invoice-action{pointer-events:auto!important;touch-action:manipulation}

/* Hesabam 2.2.35 — Iranian formal / tabular invoice */
.hesabam-template-formal-iran{background:#eef2f7;color:#111827}
.hesabam-template-formal-iran .hesabam-invoice-shell{max-width:1500px}
.hesabam-formal-invoice{width:100%;max-width:1480px;margin:0 auto;background:#fff;border:1.5px solid #111827;border-radius:0;box-shadow:0 18px 55px rgba(15,23,42,.10);overflow:hidden;color:#111827;page:hesabamFormalInvoice}
.hesabam-formal-titlebar{display:grid;grid-template-columns:180px minmax(0,1fr) 220px;align-items:start;min-height:104px;border-bottom:1.5px solid #111827;background:#fff}
.hesabam-formal-title-side{padding:13px 15px;min-height:104px;font-size:12px;line-height:1.9}.hesabam-formal-title-side.is-left{text-align:right}.hesabam-formal-title-side.is-right{display:flex;align-items:center;justify-content:flex-start}.hesabam-formal-title-center{text-align:center;padding:14px 10px}.hesabam-formal-title-center h1{margin:0;font-size:28px;font-weight:950;line-height:1.6;color:#111827}.hesabam-formal-doc-meta{display:flex;align-items:center;justify-content:center;gap:18px;flex-wrap:wrap;font-size:11px;margin-top:3px}.hesabam-formal-doc-meta b{font-weight:900}.hesabam-formal-logo{display:block;max-width:128px;max-height:72px;object-fit:contain}.hesabam-formal-qr{display:block;width:48px;height:48px;margin-top:5px;margin-right:auto;background:#fff}
.hesabam-formal-party{margin:0;padding:0}.hesabam-formal-party h2{margin:0;padding:7px 10px;text-align:center;background:#dedede;border-bottom:1.5px solid #111827;color:#111827;font-size:16px;font-weight:950;line-height:1.4}.hesabam-formal-party-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-bottom:1.5px solid #111827}.hesabam-formal-field{display:flex;align-items:flex-start;gap:6px;min-height:42px;padding:7px 11px;border-left:1px solid #6b7280;line-height:1.8;font-size:12px;overflow-wrap:anywhere}.hesabam-formal-field:nth-child(3n){border-left:0}.hesabam-formal-field b{font-weight:950;white-space:nowrap}.hesabam-formal-field span{font-weight:700}.hesabam-formal-field.is-wide{grid-column:1/-1;border-top:1px solid #9ca3af;border-left:0}
.hesabam-formal-items-wrap{width:100%;overflow-x:auto}.hesabam-formal-items{width:100%;min-width:1160px;border-collapse:collapse;table-layout:fixed}.hesabam-formal-items col.c-row{width:4%}.hesabam-formal-items col.c-title{width:26%}.hesabam-formal-items col.c-qty{width:6%}.hesabam-formal-items col.c-unit{width:7%}.hesabam-formal-items col.c-price{width:9%}.hesabam-formal-items col.c-money{width:9.6%}.hesabam-formal-items th,.hesabam-formal-items td{border-left:1px solid #374151;border-bottom:1px solid #374151;padding:7px 5px;text-align:center;vertical-align:middle;font-size:10.5px;line-height:1.55}.hesabam-formal-items th:last-child,.hesabam-formal-items td:last-child{border-left:0}.hesabam-formal-items thead th{background:#dedede;font-weight:950;color:#111827}.hesabam-formal-items tbody td{font-weight:700}.hesabam-formal-items td.is-title{text-align:right;padding-right:8px}.hesabam-formal-items td.is-title strong{display:block;font-size:11px}.hesabam-formal-items td.is-title small{display:block;margin-top:2px;color:#4b5563;font-size:8.5px}.hesabam-formal-items .is-number{direction:ltr;white-space:nowrap;font-variant-numeric:tabular-nums}.hesabam-formal-items .hesabam-formal-sum th{background:#f5f5f5;font-weight:950}.hesabam-formal-items .hesabam-formal-sum th:not(:first-child){direction:ltr;white-space:nowrap}
.hesabam-formal-line{min-height:39px;padding:8px 12px;border-bottom:1px solid #374151;font-size:12px;line-height:1.8}.hesabam-formal-line b{font-weight:950}.hesabam-formal-final{display:grid;grid-template-columns:minmax(0,1fr) 220px;min-height:48px;border-bottom:1px solid #374151}.hesabam-formal-final span,.hesabam-formal-final strong{display:flex;align-items:center;padding:9px 12px;font-size:13px;font-weight:950}.hesabam-formal-final strong{justify-content:center;border-right:1px solid #374151;direction:ltr;white-space:nowrap}.hesabam-formal-pay-summary{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid #374151}.hesabam-formal-pay-summary>div{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;min-height:40px}.hesabam-formal-pay-summary>div+div{border-right:1px solid #374151}.hesabam-formal-pay-summary span{font-size:11px;font-weight:800}.hesabam-formal-pay-summary strong{direction:ltr;white-space:nowrap;font-size:12px}
.hesabam-formal-notes,.hesabam-formal-payment{min-height:56px;padding:8px 12px;border-bottom:1px solid #374151;line-height:1.9;font-size:11px}.hesabam-formal-notes>b,.hesabam-formal-payment>b{display:block;font-size:12px;font-weight:950}.hesabam-formal-payment span{display:block}.hesabam-formal-signatures{display:grid;grid-template-columns:1fr 1fr;min-height:116px;border-bottom:1px solid #374151}.hesabam-formal-signatures>div{position:relative;display:flex;justify-content:center;align-items:flex-start;padding:12px;font-size:16px;font-weight:950}.hesabam-formal-signatures>div+div{border-right:1px solid #374151}.hesabam-formal-signatures img{position:absolute;left:18px;bottom:8px;max-width:160px;max-height:82px;object-fit:contain}.hesabam-formal-bank-footer{padding:10px 14px;text-align:center;font-size:12px;font-weight:900;line-height:1.9;background:#fafafa;white-space:pre-line}
.hesabam-template-formal-iran .hesabam-invoice-actions{max-width:1480px}
@media(max-width:900px){.hesabam-formal-titlebar{grid-template-columns:1fr}.hesabam-formal-title-side,.hesabam-formal-title-center{min-height:0;text-align:center}.hesabam-formal-title-side.is-right{justify-content:center}.hesabam-formal-qr{margin:5px auto 0}.hesabam-formal-party-grid{grid-template-columns:1fr}.hesabam-formal-field,.hesabam-formal-field:nth-child(3n){border-left:0;border-top:1px solid #d1d5db}.hesabam-formal-field:first-child{border-top:0}.hesabam-formal-field.is-wide{grid-column:1}.hesabam-formal-final{grid-template-columns:1fr}.hesabam-formal-final strong{border-right:0;border-top:1px solid #374151}.hesabam-formal-pay-summary{grid-template-columns:1fr}.hesabam-formal-pay-summary>div+div{border-right:0;border-top:1px solid #374151}.hesabam-formal-signatures{grid-template-columns:1fr}.hesabam-formal-signatures>div+div{border-right:0;border-top:1px solid #374151}}
@media print{
  @page hesabamFormalInvoice{size:A4 landscape;margin:6mm}
  .hesabam-template-formal-iran .hesabam-invoice-shell{max-width:none!important}
  .hesabam-formal-invoice{width:100%!important;max-width:none!important;border:1px solid #111827!important;box-shadow:none!important;page:hesabamFormalInvoice}
  .hesabam-formal-titlebar{grid-template-columns:150px minmax(0,1fr) 190px;min-height:82px}.hesabam-formal-title-side{min-height:82px;padding:8px 10px}.hesabam-formal-title-center{padding:8px}.hesabam-formal-title-center h1{font-size:22px}
  .hesabam-formal-party h2{font-size:13px;padding:4px 8px}.hesabam-formal-field{min-height:31px;padding:4px 7px;font-size:9.5px;line-height:1.5}
  .hesabam-formal-items{min-width:0}.hesabam-formal-items th,.hesabam-formal-items td{font-size:8px;padding:4px 3px;line-height:1.4}.hesabam-formal-items td.is-title strong{font-size:8.5px}.hesabam-formal-items td.is-title small{font-size:7px}
  .hesabam-formal-line{min-height:28px;padding:4px 8px;font-size:9px}.hesabam-formal-final{min-height:32px;grid-template-columns:minmax(0,1fr) 170px}.hesabam-formal-final span,.hesabam-formal-final strong{padding:4px 8px;font-size:9.5px}.hesabam-formal-pay-summary>div{min-height:28px;padding:4px 8px}.hesabam-formal-pay-summary span,.hesabam-formal-pay-summary strong{font-size:8.5px}.hesabam-formal-notes,.hesabam-formal-payment{min-height:34px;padding:4px 8px;font-size:8.5px}.hesabam-formal-signatures{min-height:72px}.hesabam-formal-signatures>div{font-size:11px;padding:7px}.hesabam-formal-signatures img{max-width:115px;max-height:52px}.hesabam-formal-bank-footer{padding:5px 8px;font-size:8.5px}
  .hesabam-formal-titlebar,.hesabam-formal-party,.hesabam-formal-line,.hesabam-formal-final,.hesabam-formal-pay-summary,.hesabam-formal-notes,.hesabam-formal-payment,.hesabam-formal-signatures,.hesabam-formal-bank-footer{break-inside:avoid;page-break-inside:avoid}.hesabam-formal-items tr{break-inside:avoid;page-break-inside:avoid}
}

.hesabam-invoice-page.is-embedded{padding:0!important;background:#fff!important}.hesabam-invoice-page.is-embedded .hesabam-invoice-shell{max-width:none!important;padding:0!important}.hesabam-invoice-page.is-embedded .hesabam-invoice-actions{display:none!important}
.hesabam-formal-invoice.hesabam-export-clone{width:1480px!important;max-width:1480px!important}

/* Formal legal party columns: mirrors common Iranian printed invoice layouts. */
.hesabam-formal-party-grid{grid-template-columns:repeat(3,minmax(0,1fr));align-items:stretch}
.hesabam-formal-party-col{min-width:0;border-left:1px solid #6b7280}
.hesabam-formal-party-col:last-child{border-left:0}
.hesabam-formal-party-col .hesabam-formal-field{min-height:34px;border:0;border-bottom:0;padding:4px 9px;line-height:1.65}
.hesabam-formal-party-col .hesabam-formal-field.is-wide{grid-column:auto;border:0}
@media(max-width:900px){.hesabam-formal-party-grid{grid-template-columns:1fr}.hesabam-formal-party-col{border-left:0;border-bottom:1px solid #9ca3af}.hesabam-formal-party-col:last-child{border-bottom:0}.hesabam-formal-party-col .hesabam-formal-field{border-top:0!important}}
@media print{.hesabam-formal-party-col .hesabam-formal-field{min-height:24px;padding:2px 6px;font-size:8.8px;line-height:1.45}}
/* Formal template must use landscape proportions rather than inheriting the portrait card canvas. */
.hesabam-template-formal-iran .hesabam-invoice-shell{width:min(1500px,100%);max-width:1500px}
.hesabam-formal-invoice{min-height:0}
@media print{.hesabam-template-formal-iran .hesabam-invoice-shell{width:100%!important}.hesabam-formal-invoice{min-height:0!important}}

/* Hesabam 2.2.36 — configurable formal invoice builder */
.hesabam-formal-invoice{
  --hf-border:#111827;--hf-border-w:1.2px;--hf-section-bg:#dedede;--hf-table-head-bg:#dedede;
  --hf-font-size:10px;--hf-title-size:24px;--hf-row-height:30px;--hf-sign-height:100px;--hf-page-padding:8mm;
  border:var(--hf-border-w) solid var(--hf-border);font-size:var(--hf-font-size)
}
.hesabam-formal-titlebar{border-bottom:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-title-center h1{font-size:var(--hf-title-size)}
.hesabam-formal-party h2{background:var(--hf-section-bg);border-bottom:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-party-grid{border-bottom:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-party-col{border-left:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-field{font-size:calc(var(--hf-font-size) + 1px);min-height:calc(var(--hf-row-height) + 2px)}
.hesabam-formal-items{min-width:0}
.hesabam-formal-items th,.hesabam-formal-items td{font-size:var(--hf-font-size);min-height:var(--hf-row-height);height:var(--hf-row-height);border-left:var(--hf-border-w) solid var(--hf-border);border-bottom:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-items thead th{background:var(--hf-table-head-bg)}
.hesabam-formal-items .hesabam-formal-sum th{background:#f7f7f7}
.hesabam-formal-line,.hesabam-formal-final,.hesabam-formal-pay-summary,.hesabam-formal-notes,.hesabam-formal-payment,.hesabam-formal-signatures,.hesabam-formal-bank-footer{border-color:var(--hf-border)}
.hesabam-formal-signatures{min-height:var(--hf-sign-height)}
.hesabam-formal-invoice:not(.is-compact) .hesabam-formal-field{padding:8px 11px;line-height:1.9}
.hesabam-formal-invoice:not(.is-compact) .hesabam-formal-items th,.hesabam-formal-invoice:not(.is-compact) .hesabam-formal-items td{padding:9px 6px}
.hesabam-formal-invoice[data-paper="A5"]{max-width:1000px}
@media print{
  .hesabam-formal-invoice{border:var(--hf-border-w) solid var(--hf-border)!important;font-size:var(--hf-font-size)!important}
  .hesabam-formal-title-center h1{font-size:var(--hf-title-size)!important}
  .hesabam-formal-party h2{background:var(--hf-section-bg)!important;border-color:var(--hf-border)!important}
  .hesabam-formal-field{font-size:var(--hf-font-size)!important;min-height:var(--hf-row-height)!important}
  .hesabam-formal-items th,.hesabam-formal-items td{font-size:var(--hf-font-size)!important;min-height:var(--hf-row-height)!important;height:var(--hf-row-height)!important;border-color:var(--hf-border)!important}
  .hesabam-formal-items thead th{background:var(--hf-table-head-bg)!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .hesabam-formal-signatures{min-height:var(--hf-sign-height)!important}
}

/* Hesabam 2.2.37 — exact classic Iranian reference invoice */
.hesabam-formal-layout-reference{
  --hf-border:#242424;--hf-border-w:1px;--hf-section-bg:#dedede;--hf-table-head-bg:#dedede;
  --hf-font-size:10.5px;--hf-title-size:27px;--hf-row-height:31px;--hf-sign-height:92px;
  width:100%;max-width:1480px;margin:0 auto;background:#fff;color:#111827;
  border:0!important;box-shadow:none!important;overflow:visible!important;border-radius:0!important
}
.hesabam-formal-layout-reference .hesabam-formal-titlebar{
  position:relative;display:block;min-height:94px;background:#fff;border:0!important
}
.hesabam-formal-layout-reference .hesabam-formal-title-center{padding:6px 190px 0;text-align:center}
.hesabam-formal-layout-reference .hesabam-formal-title-center h1{margin:0;font-size:var(--hf-title-size);font-weight:950;line-height:1.45;color:#050505}
.hesabam-formal-layout-reference .hesabam-formal-doc-meta{margin-top:2px;font-size:calc(var(--hf-font-size) + 1px)}
.hesabam-formal-layout-reference .hesabam-formal-title-side{position:absolute;top:0;min-height:0;padding:0;background:transparent;font-size:calc(var(--hf-font-size) + 1.5px);font-weight:800;line-height:1.8}
.hesabam-formal-layout-reference .hesabam-formal-title-side.is-right{right:10px;display:flex;align-items:flex-start;justify-content:flex-start}
.hesabam-formal-layout-reference .hesabam-formal-title-side.is-left{left:12px;top:auto;bottom:8px;text-align:right}
.hesabam-formal-layout-reference .hesabam-formal-logo{max-width:120px;max-height:64px}
.hesabam-formal-layout-reference .hesabam-formal-qr{width:42px;height:42px;margin:4px 0 0}
.hesabam-formal-layout-reference .hesabam-formal-frame{border:var(--hf-border-w) solid var(--hf-border);overflow:hidden;background:#fff}
.hesabam-formal-layout-reference .hesabam-formal-party{margin:0;padding:0}
.hesabam-formal-layout-reference .hesabam-formal-party h2{
  height:34px;display:flex;align-items:center;justify-content:center;margin:0;padding:0 8px;
  background:var(--hf-section-bg);border:0;border-bottom:var(--hf-border-w) solid var(--hf-border);
  color:#111;font-size:calc(var(--hf-font-size) + 3.5px);font-weight:950;line-height:1
}
.hesabam-formal-layout-reference .hesabam-formal-party-reference{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(3,minmax(25px,auto));
  min-height:96px;padding:8px 5px 7px;align-items:center;border-bottom:var(--hf-border-w) solid var(--hf-border);direction:ltr
}
.hesabam-formal-layout-reference .hesabam-formal-party-reference .hesabam-formal-field{
  min-width:0;min-height:0;padding:0 7px;border:0!important;display:flex;align-items:center;gap:5px;
  font-size:calc(var(--hf-font-size) + 1.5px);line-height:1.55;white-space:nowrap;overflow:visible;direction:rtl
}
.hesabam-formal-layout-reference .hesabam-formal-party-reference .hesabam-formal-field b{font-weight:950;white-space:nowrap}
.hesabam-formal-layout-reference .hesabam-formal-party-reference .hesabam-formal-field span{font-weight:720;min-width:0;overflow-wrap:anywhere}
/* Physical grid is left-to-right; semantic positions reproduce the supplied form. */
.hesabam-formal-layout-reference .hesabam-formal-pos-economic_code{grid-column:1;grid-row:1}
.hesabam-formal-layout-reference .hesabam-formal-pos-email{grid-column:1;grid-row:2}
.hesabam-formal-layout-reference .hesabam-formal-pos-postal_code{grid-column:1;grid-row:3}
.hesabam-formal-layout-reference .hesabam-formal-pos-national_id{grid-column:2;grid-row:1}
.hesabam-formal-layout-reference .hesabam-formal-pos-branch_code{grid-column:2;grid-row:2}
.hesabam-formal-layout-reference .hesabam-formal-pos-registration_no{grid-column:2;grid-row:3}
.hesabam-formal-layout-reference .hesabam-formal-pos-fax{grid-column:3;grid-row:3}
.hesabam-formal-layout-reference .hesabam-formal-pos-mobile{grid-column:3;grid-row:2}
.hesabam-formal-layout-reference .hesabam-formal-pos-name{grid-column:4;grid-row:1}
.hesabam-formal-layout-reference .hesabam-formal-pos-address{grid-column:4;grid-row:2}
.hesabam-formal-layout-reference .hesabam-formal-pos-phone{grid-column:4;grid-row:3}

.hesabam-formal-layout-reference .hesabam-formal-items-wrap{overflow:visible;width:100%}
.hesabam-formal-layout-reference .hesabam-formal-items{width:100%;min-width:0;border-collapse:collapse;table-layout:fixed;direction:rtl}
.hesabam-formal-layout-reference .hesabam-formal-items th,
.hesabam-formal-layout-reference .hesabam-formal-items td{
  height:var(--hf-row-height);min-height:var(--hf-row-height);padding:4px 4px;
  border:0;border-left:var(--hf-border-w) solid var(--hf-border);border-bottom:var(--hf-border-w) solid var(--hf-border);
  text-align:center;vertical-align:middle;font-size:var(--hf-font-size);font-weight:700;line-height:1.35;color:#111
}
.hesabam-formal-layout-reference .hesabam-formal-items th:last-child,
.hesabam-formal-layout-reference .hesabam-formal-items td:last-child{border-left:0}
.hesabam-formal-layout-reference .hesabam-formal-items thead th{height:52px;background:var(--hf-table-head-bg);font-weight:950;white-space:normal}
.hesabam-formal-layout-reference .hesabam-formal-items tbody td{height:31px}
.hesabam-formal-layout-reference .hesabam-formal-items td.is-title{text-align:right;padding-right:8px;font-weight:800}
.hesabam-formal-layout-reference .hesabam-formal-items .is-number{direction:ltr;white-space:nowrap;font-variant-numeric:tabular-nums}
.hesabam-formal-layout-reference .hesabam-formal-items .hesabam-formal-sum th{height:30px;background:#fff;font-weight:900}
.hesabam-formal-layout-reference .hesabam-formal-summary-group{margin:0;padding:0}
.hesabam-formal-layout-reference .hesabam-formal-line{
  min-height:31px;padding:5px 8px;border:0;border-bottom:var(--hf-border-w) solid var(--hf-border);
  display:flex;align-items:center;font-size:calc(var(--hf-font-size) + 1px);line-height:1.55;font-weight:750
}
.hesabam-formal-layout-reference .hesabam-formal-line:nth-child(2){min-height:43px;align-items:flex-start;padding-top:9px}
.hesabam-formal-layout-reference .hesabam-formal-line b{font-weight:950}
.hesabam-formal-layout-reference .hesabam-formal-final{
  position:relative;display:grid;grid-template-columns:10% 90%;grid-template-rows:1fr;direction:ltr;
  min-height:42px;border:0;border-bottom:var(--hf-border-w) solid var(--hf-border)
}
.hesabam-formal-layout-reference .hesabam-formal-final strong{
  grid-column:1;grid-row:1;display:flex;align-items:center;justify-content:center;padding:5px 6px;
  border:0;border-right:var(--hf-border-w) solid var(--hf-border);font-size:calc(var(--hf-font-size) + 1px);font-weight:750;direction:ltr;white-space:nowrap
}
.hesabam-formal-layout-reference .hesabam-formal-final span{
  grid-column:2;grid-row:1;display:flex;align-items:center;justify-content:flex-start;padding:5px 10px;
  font-size:calc(var(--hf-font-size) + 1.5px);font-weight:950;direction:rtl
}
.hesabam-formal-layout-reference .hesabam-formal-pay-summary{border:0;border-bottom:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-layout-reference .hesabam-formal-pay-summary>div{min-height:31px;padding:5px 8px}
.hesabam-formal-layout-reference .hesabam-formal-notes,
.hesabam-formal-layout-reference .hesabam-formal-payment{
  min-height:58px;padding:6px 10px;border:0;border-bottom:var(--hf-border-w) solid var(--hf-border);
  font-size:calc(var(--hf-font-size) + .5px);line-height:1.75;background:#fff
}
.hesabam-formal-layout-reference .hesabam-formal-notes>b,
.hesabam-formal-layout-reference .hesabam-formal-payment>b{font-size:calc(var(--hf-font-size) + 1.5px);font-weight:950}
.hesabam-formal-layout-reference .hesabam-formal-notes>div{padding-right:52px;color:#444}
.hesabam-formal-layout-reference .hesabam-formal-signatures{
  display:grid;grid-template-columns:1fr 1fr;min-height:var(--hf-sign-height);border:0;background:#fff
}
.hesabam-formal-layout-reference .hesabam-formal-signatures>div{position:relative;display:flex;justify-content:center;align-items:flex-start;padding:10px;font-size:calc(var(--hf-font-size) + 4px);font-weight:950}
.hesabam-formal-layout-reference .hesabam-formal-signatures>div+div{border-right:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-layout-reference .hesabam-formal-signatures img{position:absolute;left:15px;bottom:6px;max-width:140px;max-height:68px;object-fit:contain}
.hesabam-formal-layout-reference .hesabam-formal-bank-footer{
  padding:10px 10px 0;text-align:center;font-size:calc(var(--hf-font-size) + 3px);font-weight:950;line-height:1.6;
  background:#fff;border:0!important;white-space:pre-line;color:#111
}

@media(max-width:900px){
  .hesabam-formal-layout-reference{min-width:980px;transform-origin:top right}
  .hesabam-template-formal-iran .hesabam-invoice-shell{overflow-x:auto}
  .hesabam-formal-layout-reference .hesabam-formal-party-reference{grid-template-columns:repeat(4,minmax(0,1fr))}
  .hesabam-formal-layout-reference .hesabam-formal-signatures{grid-template-columns:1fr 1fr}
}
@media print{
  .hesabam-formal-layout-reference{width:100%!important;max-width:none!important;border:0!important;box-shadow:none!important;font-size:var(--hf-font-size)!important}
  .hesabam-formal-layout-reference .hesabam-formal-titlebar{min-height:62px!important;border:0!important}
  .hesabam-formal-layout-reference .hesabam-formal-title-center{padding-top:2px}
  .hesabam-formal-layout-reference .hesabam-formal-title-center h1{font-size:var(--hf-title-size)!important}
  .hesabam-formal-layout-reference .hesabam-formal-party-reference .hesabam-formal-field{font-size:var(--hf-font-size)!important;min-height:0!important}
  .hesabam-formal-layout-reference .hesabam-formal-party h2{font-size:calc(var(--hf-font-size) + 2px)!important}
  .hesabam-formal-layout-reference .hesabam-formal-items th,.hesabam-formal-layout-reference .hesabam-formal-items td{font-size:var(--hf-font-size)!important;border-color:var(--hf-border)!important}
  .hesabam-formal-layout-reference .hesabam-formal-items thead th{background:var(--hf-table-head-bg)!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .hesabam-formal-layout-reference .hesabam-formal-party h2{background:var(--hf-section-bg)!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .hesabam-formal-layout-reference .hesabam-formal-frame{border-color:var(--hf-border)!important}
  .hesabam-formal-layout-reference .hesabam-formal-bank-footer{font-size:calc(var(--hf-font-size) + 2px)!important}
}
.hesabam-formal-layout-reference .hesabam-formal-title-side{font-size:calc(var(--hf-font-size) + 6px)}
.hesabam-formal-layout-reference .hesabam-formal-party h2{height:37px;font-size:calc(var(--hf-font-size) + 6px)}
.hesabam-formal-layout-reference .hesabam-formal-party-reference .hesabam-formal-field{font-size:calc(var(--hf-font-size) + 4px)}
.hesabam-formal-layout-reference .hesabam-formal-items thead th{height:60px}
.hesabam-formal-layout-reference .hesabam-formal-items tbody td{height:37px}
.hesabam-formal-layout-reference .hesabam-formal-items .hesabam-formal-sum th{height:32px}
.hesabam-formal-layout-reference .hesabam-formal-line{font-size:calc(var(--hf-font-size) + 2px)}
.hesabam-formal-layout-reference .hesabam-formal-final{min-height:48px}
.hesabam-formal-layout-reference .hesabam-formal-final span{font-size:calc(var(--hf-font-size) + 3px)}
.hesabam-formal-layout-reference .hesabam-formal-final strong{font-size:calc(var(--hf-font-size) + 2px)}
.hesabam-formal-layout-reference .hesabam-formal-notes,.hesabam-formal-layout-reference .hesabam-formal-payment{min-height:68px;font-size:calc(var(--hf-font-size) + 1.5px)}
.hesabam-formal-layout-reference .hesabam-formal-notes>b,.hesabam-formal-layout-reference .hesabam-formal-payment>b{font-size:calc(var(--hf-font-size) + 3px)}
.hesabam-formal-layout-reference .hesabam-formal-signatures>div{font-size:calc(var(--hf-font-size) + 6px)}
.hesabam-formal-layout-reference .hesabam-formal-bank-footer{font-size:calc(var(--hf-font-size) + 6px)}

/* 2.2.37 — official/reference form is intentionally plain white like the supplied sample. */
.hesabam-template-formal-iran{
  background:#fff!important;
  background-image:none!important;
}
.hesabam-template-formal-iran .hesabam-invoice-shell{
  background:#fff!important;
}

/* Hesabam 2.2.38 — saved formal templates, tax invoice, A5 and receipt */
.hesabam-formal-style-tax .hesabam-formal-title-center h1{font-size:calc(var(--hf-title-size) - 2px)}
.hesabam-formal-tax-meta{margin:0;padding:0;border-bottom:var(--hf-border-w) solid var(--hf-border);background:#fff}
.hesabam-formal-tax-meta h2{height:32px;margin:0;display:flex;align-items:center;justify-content:center;background:var(--hf-section-bg);font-size:calc(var(--hf-font-size) + 3px);font-weight:950;border-bottom:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-tax-meta-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));direction:rtl}
.hesabam-formal-tax-meta-grid>div{min-height:38px;padding:6px 8px;display:flex;align-items:center;gap:6px;border-left:var(--hf-border-w) solid var(--hf-border);border-bottom:var(--hf-border-w) solid var(--hf-border)}
.hesabam-formal-tax-meta-grid>div:nth-child(3n){border-left:0}.hesabam-formal-tax-meta-grid>div:nth-last-child(-n+3){border-bottom:0}
.hesabam-formal-tax-meta-grid span{font-size:calc(var(--hf-font-size) - .5px);color:#4b5563}.hesabam-formal-tax-meta-grid strong{font-size:var(--hf-font-size);font-weight:900;overflow-wrap:anywhere}
.hesabam-formal-style-minimal{--hf-section-bg:#f5f5f5;--hf-table-head-bg:#f5f5f5}
.hesabam-formal-style-minimal .hesabam-formal-party h2,.hesabam-formal-style-minimal .hesabam-formal-items thead th{font-weight:850}
.hesabam-formal-style-minimal .hesabam-formal-title-center h1{font-weight:850}

.hesabam-formal-invoice.is-paper-a5{max-width:900px}
.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-titlebar{min-height:74px}
.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-title-center{padding-inline:120px}
.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-party-reference{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:auto;direction:rtl;padding:6px}
.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-party-reference .hesabam-formal-field{grid-column:auto!important;grid-row:auto!important;white-space:normal;min-height:26px}
.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-items thead th{height:auto;min-height:38px;font-size:calc(var(--hf-font-size) - .5px);padding:4px 2px}
.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-items th,.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-items td{padding:3px 2px}
.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-final{grid-template-columns:26% 74%}

.hesabam-formal-receipt{width:100%;max-width:760px;margin:0 auto;background:#fff;color:#111;border:1px solid #222;border-radius:0!important;box-shadow:none!important;overflow:hidden;font-size:var(--hf-font-size)}
.hesabam-receipt-head{display:grid;grid-template-columns:76px 1fr;gap:12px;align-items:center;padding:14px 16px;border-bottom:1px solid #222;text-align:center}
.hesabam-receipt-head img{width:64px;height:64px;object-fit:contain}.hesabam-receipt-head h1{margin:0 0 4px;font-size:var(--hf-title-size);font-weight:950}.hesabam-receipt-head strong{font-size:calc(var(--hf-font-size) + 2px)}
.hesabam-receipt-meta{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid #222}.hesabam-receipt-meta>div{min-height:44px;padding:7px 10px;display:flex;align-items:center;justify-content:space-between;gap:10px;border-left:1px solid #222;border-bottom:1px solid #222}.hesabam-receipt-meta>div:nth-child(2n){border-left:0}.hesabam-receipt-meta>div:nth-last-child(-n+2){border-bottom:0}.hesabam-receipt-meta span{color:#555}.hesabam-receipt-meta b{font-weight:900}
.hesabam-receipt-items{width:100%;border-collapse:collapse;table-layout:fixed}.hesabam-receipt-items th,.hesabam-receipt-items td{border-left:1px solid #222;border-bottom:1px solid #222;padding:7px 6px;text-align:center;vertical-align:middle}.hesabam-receipt-items th:last-child,.hesabam-receipt-items td:last-child{border-left:0}.hesabam-receipt-items th{background:var(--hf-table-head-bg);font-weight:950}.hesabam-receipt-items th:first-child,.hesabam-receipt-items td:first-child{text-align:right;width:44%}
.hesabam-receipt-total{display:flex;align-items:center;justify-content:space-between;padding:9px 12px;border-bottom:1px solid #222;font-size:calc(var(--hf-font-size) + 2px);font-weight:950}.hesabam-receipt-pay-grid{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid #222}.hesabam-receipt-pay-grid>div{padding:8px 10px;display:flex;justify-content:space-between;gap:10px;border-left:1px solid #222}.hesabam-receipt-pay-grid>div:last-child{border-left:0}.hesabam-receipt-pay-grid span{color:#555}.hesabam-receipt-pay-grid strong{font-weight:950}
.hesabam-receipt-payments{padding:10px 12px;border-bottom:1px solid #222;line-height:1.9}.hesabam-receipt-payments>b{display:block;margin-bottom:4px}.hesabam-receipt-signatures{display:grid;grid-template-columns:1fr 1fr;min-height:var(--hf-sign-height);border-bottom:1px solid #222}.hesabam-receipt-signatures>div{position:relative;padding:10px;text-align:center;font-weight:900}.hesabam-receipt-signatures>div+div{border-right:1px solid #222}.hesabam-receipt-signatures img{position:absolute;left:10px;bottom:5px;max-width:120px;max-height:58px;object-fit:contain}.hesabam-receipt-footer{padding:9px 12px;text-align:center;display:flex;flex-direction:column;gap:3px}.hesabam-receipt-footer small{color:#666}

@media(max-width:680px){.hesabam-formal-tax-meta-grid{grid-template-columns:1fr 1fr}.hesabam-formal-tax-meta-grid>div:nth-child(3n){border-left:var(--hf-border-w) solid var(--hf-border)}.hesabam-formal-tax-meta-grid>div:nth-child(2n){border-left:0}.hesabam-formal-invoice.is-paper-a5 .hesabam-formal-party-reference{grid-template-columns:1fr}.hesabam-receipt-meta{grid-template-columns:1fr}.hesabam-receipt-meta>div{border-left:0}.hesabam-receipt-pay-grid{grid-template-columns:1fr}.hesabam-receipt-pay-grid>div{border-left:0;border-bottom:1px solid #222}.hesabam-receipt-pay-grid>div:last-child{border-bottom:0}}
@media print{.hesabam-formal-tax-meta h2,.hesabam-formal-tax-meta-grid>div,.hesabam-receipt-items th{-webkit-print-color-adjust:exact;print-color-adjust:exact}.hesabam-formal-receipt{border-color:#111!important}}

/* 2.2.38 receipt export/page-size hardening: do not inherit the A4 min-height. */
.hesabam-formal-receipt{min-height:0!important}
.hesabam-formal-receipt.hesabam-export-clone{width:760px!important;max-width:760px!important;min-height:0!important}
@media print{.hesabam-formal-receipt{min-height:0!important;box-shadow:none!important}}
/* Compact A5 party blocks use two columns; the third logical group spans the row. */
.hesabam-formal-invoice.is-paper-a5.hesabam-formal-layout-columns .hesabam-formal-party-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.hesabam-formal-invoice.is-paper-a5.hesabam-formal-layout-columns .hesabam-formal-party-col:nth-child(3){grid-column:1/-1;border-left:0;border-top:var(--hf-border-w) solid var(--hf-border)}
.hesabam-receipt-items th.is-title,.hesabam-receipt-items td.is-title{text-align:right}


/* Hesabam 2.2.41 — modern invoice collection
   These styles intentionally break away from the old corporate grid: rounded
   cards, spacious sections, strong branded headers and highlighted totals. */
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"]{
  --hf-accent:#4f46e5;--hf-accent-2:#06b6d4;--hf-surface:#fff;--hf-page-bg:#f8fafc;--hf-text:#0f172a;
  max-width:1260px;padding:18px;background:var(--hf-page-bg);color:var(--hf-text);border:0!important;border-radius:26px!important;
  box-shadow:0 28px 80px rgba(15,23,42,.14)!important;overflow:visible!important
}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-titlebar{
  min-height:132px;margin:0 0 16px;border:0!important;border-radius:22px;padding:6px;overflow:hidden;box-shadow:0 14px 36px rgba(15,23,42,.12)
}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-title-side,
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-title-center{min-height:118px;padding:18px 20px;display:flex;flex-direction:column;justify-content:center}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-title-side.is-right{align-items:flex-start}.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-title-side.is-left{align-items:flex-start}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-title-center h1{font-size:var(--hf-title-size);font-weight:950;letter-spacing:-.6px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-doc-meta{margin-top:7px;gap:9px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-doc-meta span{padding:5px 10px;border-radius:999px;font-size:calc(var(--hf-font-size) - .2px)}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-logo{max-width:142px;max-height:80px;filter:drop-shadow(0 5px 12px rgba(15,23,42,.12))}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-qr{width:58px;height:58px;border-radius:10px;padding:4px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-frame{display:flex;flex-direction:column;gap:14px;border:0!important;background:transparent!important;overflow:visible!important}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-party,
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-items-wrap,
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-summary-group,
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-notes,
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-payment,
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-signatures{
  background:var(--hf-surface);border:1px solid var(--hf-border);border-radius:18px;box-shadow:0 8px 24px rgba(15,23,42,.055);overflow:hidden
}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-party h2{padding:11px 16px;text-align:right;border:0!important;background:var(--hf-section-bg);font-size:calc(var(--hf-font-size) + 2px);color:var(--hf-text)}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-party-grid{border:0!important;padding:8px;gap:6px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-party-col{border:0!important;display:flex;flex-direction:column;gap:5px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-field{border:0!important;border-radius:11px;background:var(--hf-section-bg);padding:8px 10px;min-height:38px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-field b{color:#64748b}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-items{border-collapse:separate;border-spacing:0;overflow:hidden;border-radius:18px;min-width:0}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-items th,.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-items td{border:0!important;border-bottom:1px solid var(--hf-border)!important;padding:9px 8px;height:var(--hf-row-height)}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-items thead th{background:var(--hf-accent)!important;color:#fff;font-weight:900}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-items tbody tr:nth-child(even) td{background:var(--hf-page-bg)}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-items .hesabam-formal-sum th{background:var(--hf-section-bg)!important;color:var(--hf-text);border-bottom:0!important}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-summary-group{padding:10px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-line{border:0!important;border-radius:11px;background:var(--hf-page-bg);margin-bottom:7px;padding:9px 11px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-final{border:0!important;border-radius:15px;overflow:hidden;min-height:56px;background:linear-gradient(135deg,var(--hf-accent),var(--hf-accent-2));color:#fff}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-final strong{border:0!important;background:rgba(255,255,255,.13);font-size:calc(var(--hf-font-size) + 3px)}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-final span{font-size:calc(var(--hf-font-size) + 2px)}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-pay-summary{border:0!important;margin-top:8px;gap:8px;background:transparent}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-pay-summary>div{border:0!important;border-radius:12px;background:var(--hf-page-bg);padding:10px 12px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-notes,.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-payment{border:1px solid var(--hf-border)!important;min-height:70px;padding:13px 15px}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-signatures{border:1px solid var(--hf-border)!important;min-height:var(--hf-sign-height);gap:1px;background:var(--hf-border)}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-signatures>div{background:var(--hf-surface);border:0!important;border-radius:0;padding:16px;color:var(--hf-text)}
.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-bank-footer{margin-top:14px;padding:12px 16px;border:0!important;border-radius:14px;background:var(--hf-surface);box-shadow:0 8px 24px rgba(15,23,42,.05);color:var(--hf-text)}

/* Gradient — bold SaaS / ecommerce look */
.hesabam-formal-style-modern-gradient .hesabam-formal-titlebar{background:linear-gradient(125deg,var(--hf-accent) 0%,var(--hf-accent-2) 100%);color:#fff}
.hesabam-formal-style-modern-gradient .hesabam-formal-title-center h1,.hesabam-formal-style-modern-gradient .hesabam-formal-titlebar b{color:#fff}.hesabam-formal-style-modern-gradient .hesabam-formal-doc-meta span{background:rgba(255,255,255,.14);color:#fff}.hesabam-formal-style-modern-gradient .hesabam-formal-qr{background:#fff}

/* Glass — translucent cards on a soft violet canvas */
.hesabam-formal-style-modern-glass{background:linear-gradient(145deg,var(--hf-page-bg),#ffffff)!important}
.hesabam-formal-style-modern-glass .hesabam-formal-titlebar{background:linear-gradient(135deg,var(--hf-accent),var(--hf-accent-2));color:#fff;box-shadow:0 18px 44px rgba(124,58,237,.22)}
.hesabam-formal-style-modern-glass .hesabam-formal-title-center h1,.hesabam-formal-style-modern-glass .hesabam-formal-titlebar b{color:#fff}.hesabam-formal-style-modern-glass .hesabam-formal-doc-meta span{background:rgba(255,255,255,.18)}
.hesabam-formal-style-modern-glass .hesabam-formal-party,.hesabam-formal-style-modern-glass .hesabam-formal-items-wrap,.hesabam-formal-style-modern-glass .hesabam-formal-summary-group,.hesabam-formal-style-modern-glass .hesabam-formal-notes,.hesabam-formal-style-modern-glass .hesabam-formal-payment,.hesabam-formal-style-modern-glass .hesabam-formal-signatures{background:rgba(255,255,255,.76);backdrop-filter:blur(18px);box-shadow:0 12px 32px rgba(76,29,149,.08)}

/* Dark Premium — dark hero, crisp bright accounting cards */
.hesabam-formal-style-modern-dark{background:#e8eef5!important}.hesabam-formal-style-modern-dark .hesabam-formal-titlebar{background:linear-gradient(125deg,#020617 0%,var(--hf-accent) 52%,var(--hf-accent-2) 145%);color:#fff}.hesabam-formal-style-modern-dark .hesabam-formal-title-center h1,.hesabam-formal-style-modern-dark .hesabam-formal-titlebar b{color:#fff}.hesabam-formal-style-modern-dark .hesabam-formal-doc-meta span{background:rgba(20,184,166,.14);border:1px solid rgba(45,212,191,.2)}.hesabam-formal-style-modern-dark .hesabam-formal-items thead th{background:#0f172a!important}.hesabam-formal-style-modern-dark .hesabam-formal-final{background:linear-gradient(125deg,#0f172a,var(--hf-accent-2))}

/* Iranian teal — turquoise with restrained gold accents */
.hesabam-formal-style-modern-teal .hesabam-formal-titlebar{background:linear-gradient(110deg,#064e3b,var(--hf-accent));color:#fff;position:relative}.hesabam-formal-style-modern-teal .hesabam-formal-titlebar:after{content:'';position:absolute;left:0;right:0;bottom:0;height:5px;background:linear-gradient(90deg,var(--hf-accent-2),#f5d46b,var(--hf-accent-2))}.hesabam-formal-style-modern-teal .hesabam-formal-title-center h1,.hesabam-formal-style-modern-teal .hesabam-formal-titlebar b{color:#fff}.hesabam-formal-style-modern-teal .hesabam-formal-doc-meta span{background:rgba(255,255,255,.12)}.hesabam-formal-style-modern-teal .hesabam-formal-final{background:linear-gradient(120deg,var(--hf-accent),#0d9488)}.hesabam-formal-style-modern-teal .hesabam-formal-summary-group{border-top:4px solid var(--hf-accent-2)}

/* Pop — energetic retail / creator brand look */
.hesabam-formal-style-modern-pop .hesabam-formal-titlebar{background:linear-gradient(125deg,var(--hf-accent),#f43f5e 45%,var(--hf-accent-2));color:#fff;transform:translateZ(0)}.hesabam-formal-style-modern-pop .hesabam-formal-title-center h1,.hesabam-formal-style-modern-pop .hesabam-formal-titlebar b{color:#fff}.hesabam-formal-style-modern-pop .hesabam-formal-doc-meta span{background:rgba(255,255,255,.16)}.hesabam-formal-style-modern-pop .hesabam-formal-party:nth-of-type(1) h2{background:#fff1f2}.hesabam-formal-style-modern-pop .hesabam-formal-party:nth-of-type(2) h2{background:#fffbeb}.hesabam-formal-style-modern-pop .hesabam-formal-final{background:linear-gradient(120deg,var(--hf-accent),var(--hf-accent-2))}

@media(max-width:900px){
 .hesabam-formal-invoice[class*="hesabam-formal-style-modern-"]{padding:10px;border-radius:18px!important}.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-titlebar{grid-template-columns:1fr;min-height:0}.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-title-side,.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-title-center{min-height:0;align-items:center;text-align:center;padding:12px}.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-party-grid{grid-template-columns:1fr}
}
@media print{
 .hesabam-formal-invoice[class*="hesabam-formal-style-modern-"]{padding:5mm!important;border-radius:0!important;box-shadow:none!important;background:#fff!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 .hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-titlebar{box-shadow:none!important}
 .hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-party,.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-items-wrap,.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-summary-group,.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-notes,.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-payment,.hesabam-formal-invoice[class*="hesabam-formal-style-modern-"] .hesabam-formal-signatures{box-shadow:none!important;backdrop-filter:none!important}
}
