@page { margin: 12mm 10mm; }
html, body { height: 100%; }
body {
    font-family: zerti_vazirmatn;
    font-size: 9pt;
    line-height: 1.6;
    color: #111;
    background: #fff;
}
* { box-sizing: border-box; }

.zpdf-page {
    width: 100%;
}

.zpdf-header {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    min-height: 108px;
}
.zpdf-header-layout {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.zpdf-header-meta-cell {
    width: 200px;
    max-width: 200px;
    vertical-align: middle;
    padding: 0;
}
.zpdf-header-center-cell {
    vertical-align: middle;
    text-align: center;
    padding: 0 8px;
}
.zpdf-header-logo-cell {
    width: 200px;
    max-width: 200px;
    vertical-align: middle;
    padding: 0;
}

.zpdf-logo {
    max-width: 100px;
    max-height: 100px;
    width: auto;
    height: auto;
    border-radius: 8px;
    display: inline-block;
    vertical-align: top;
}
.zpdf-title-stack {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
}
.zpdf-brand-name {
    font-size: 11.5pt;
    font-weight: 700;
    margin: 0 0 4px;
}
.zpdf-brand-sub { font-size: 8pt; color: #6b7280; margin: 2px 0 0; }

.zpdf-title {
    margin: 0;
    font-size: 14pt;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.zpdf-title-sub { font-size: 8pt; color: #6b7280; margin-top: 2px; }

.zpdf-meta {
    width: 200px;
    max-width: 200px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 5px 6px;
    background: #f8fafc;
    margin: 0;
    unicode-bidi: embed;
    box-sizing: border-box;
    overflow: hidden;
}
.zpdf-meta table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.zpdf-meta-row {
    padding: 2px 0;
    font-size: 7pt;
    line-height: 1.35;
    white-space: normal;
    word-wrap: break-word;
}
.zpdf-meta-label {
    color: #6b7280;
    font-weight: 700;
}
.zpdf-meta-value {
    font-weight: 400;
}
.zpdf-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 6.5pt;
    font-weight: 700;
    color: #fff;
    background: #16a34a;
}
.zpdf-badge--unpaid { background: #dc2626; }

.zpdf-sep { height: 2px; margin: 12px 0; background: #712cf9; border-radius: 1px; }

.zpdf-block {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    margin-top: 10px;
}
.zpdf-party {
    margin-top: 10px;
}
.zpdf-block-title {
    font-size: 8pt;
    font-weight: 800;
    color: #6b7280;
    margin: 0 0 6px;
}
.zpdf-party-body {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 10px;
    background: #f8fafc;
}
.zpdf-party-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.zpdf-party-cell {
    width: 33%;
    vertical-align: top;
    font-size: 8.5pt;
    line-height: 1.45;
}
.zpdf-party-cell--wide {
    width: 66%;
}
.zpdf-party-label {
    color: #6b7280;
    font-weight: 600;
}
.zpdf-party-value {
    color: #111;
    word-wrap: break-word;
}

.zpdf-items {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.zpdf-items th {
    background: #712cf9;
    color: #fff;
    font-size: 7.5pt;
    padding: 8px 6px;
    border-bottom: 1px solid #5b21b6;
    white-space: nowrap;
    text-align: center;
}
.zpdf-items td {
    padding: 7px 6px;
    font-size: 8pt;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
    vertical-align: middle;
}
.zpdf-items tr:nth-child(even) td { background: #f8fafc; }
.zpdf-items tr:last-child td { border-bottom: none; }
.zpdf-barcode-cell { padding: 4px 2px; }
.zpdf-barcode-wrap { text-align: center; line-height: 0; }
.zpdf-barcode-wrap img { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.zpdf-qrcode-wrap img { max-width: 56px; max-height: 56px; }
.t-center { text-align: center; }

.zpdf-totals-layout {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
}
.zpdf-totals-layout td {
    vertical-align: top;
    padding: 0;
}
.zpdf-totals-cell {
    width: 50%;
}
.zpdf-totals-spacer {
    width: 50%;
}
.zpdf-items-body {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}
.zpdf-totals-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    max-width: 16rem;
    box-sizing: border-box;
}
.zpdf-totals {
    width: 100%;
    box-sizing: border-box;
}
.zpdf-totals table {
    width: 100%;
    border-collapse: collapse;
}
.zpdf-totals td { padding: 3px 0; font-size: 8.5pt; }
.zpdf-totals .k { color: #6b7280; font-weight: 700; }
.zpdf-grand { border-top: 2px solid #712cf9; padding-top: 6px; margin-top: 4px; font-weight: 800; }
.zpdf-discount { color: #dc2626; }

.zpdf-footer-note {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    text-align: center;
    font-size: 8pt;
    color: #374151;
}
html[dir="rtl"] body {
    direction: rtl;
    unicode-bidi: bidi-override;
}
html[dir="rtl"] .zpdf-header-layout { direction: ltr; }
html[dir="rtl"] .zpdf-header-meta-cell { text-align: left; }
html[dir="rtl"] .zpdf-header-logo-cell { text-align: right; }
html[dir="rtl"] .zpdf-title-stack { direction: rtl; }
html[dir="rtl"] .zpdf-meta { direction: rtl; text-align: right; }
html[dir="rtl"] .zpdf-meta-row { direction: rtl; text-align: right; }
html[dir="rtl"] .zpdf-block-title { direction: rtl; text-align: right; }
html[dir="rtl"] .zpdf-party-grid { direction: rtl; }
html[dir="rtl"] .zpdf-party-cell { direction: rtl; text-align: right; padding: 4px 10px 4px 0; }
html[dir="rtl"] .zpdf-totals-layout { direction: ltr; }
html[dir="rtl"] .zpdf-totals-cell { text-align: left; }
html[dir="rtl"] .zpdf-totals { direction: rtl; text-align: right; }
html[dir="rtl"] .zpdf-totals table { direction: rtl; }
html[dir="rtl"] .zpdf-totals .k { text-align: right; }
html[dir="rtl"] .zpdf-totals .v { text-align: left; }

html[dir="ltr"] body {
    direction: ltr;
    unicode-bidi: normal;
}
html[dir="ltr"] .zpdf-header-layout { direction: rtl; }
html[dir="ltr"] .zpdf-header-meta-cell { text-align: right; }
html[dir="ltr"] .zpdf-header-logo-cell { text-align: left; }
html[dir="ltr"] .zpdf-title-stack { direction: ltr; }
html[dir="ltr"] .zpdf-meta { direction: ltr; text-align: left; }
html[dir="ltr"] .zpdf-meta-row { direction: ltr; text-align: left; }
html[dir="ltr"] .zpdf-block-title { direction: ltr; text-align: left; }
html[dir="ltr"] .zpdf-party-grid { direction: ltr; }
html[dir="ltr"] .zpdf-party-cell { direction: ltr; text-align: left; padding: 4px 0 4px 10px; }
html[dir="ltr"] .zpdf-totals-layout { direction: rtl; }
html[dir="ltr"] .zpdf-totals-cell { text-align: right; }
html[dir="ltr"] .zpdf-totals { direction: ltr; text-align: left; }
html[dir="ltr"] .zpdf-totals table { direction: ltr; }
html[dir="ltr"] .zpdf-totals .k { text-align: left; }
html[dir="ltr"] .zpdf-totals .v { text-align: right; }
