/* Print layout of every report and document — modelled on the Hoofer printouts: a framed header, black-ruled tables with grey heads and totals,
   a sign-off line and «صفحه x از y» in the page margin. Loaded with media="print" only; the on-screen look is untouched. */
.print-only { display: none; }

@page { size: A4; margin: 10mm 9mm 14mm; @bottom-left { content: "صفحه " counter(page, persian) " از " counter(pages, persian); font: 9pt IRANSans, Tahoma, sans-serif; color: #333; } }

html, body, .app, .main, .content { background: #fff !important; color: #000 !important; min-height: 0 !important; height: auto !important; }
body, table, input, button, select, textarea { font-family: 'IRANSans', Tahoma, sans-serif !important; }
body { font-size: 10pt; }
.sidebar, .sidebar-backdrop, .topbar, .app-footer, .d-print-none, .alert, .pagination, .ph-pager, nav[aria-label] { display: none !important; }
.print-only { display: block !important; }
.main { margin: 0 !important; padding: 0 !important; }
.content { padding: 0 !important; }
.card { border: 0 !important; box-shadow: none !important; background: transparent !important; margin: 0 !important; }
.card-body, .card-footer, .card-header { padding: 0 !important; background: transparent !important; border: 0 !important; }
.table-responsive { overflow: visible !important; }
a, a:hover { color: #000 !important; text-decoration: none !important; }
.badge-soft { background: transparent !important; color: #000 !important; border: 0 !important; padding: 0 !important; }
.text-soft, .text-muted, .text-secondary { color: #333 !important; }

/* the manager's page: two widgets side by side, none cut in the middle of a page, the alerts (hidden everywhere else) written out */
.exec-grid { display: flex !important; flex-wrap: wrap; margin: 0 -1.5mm !important; }
.exec-grid > [class*="col-"] { flex: 0 0 auto !important; width: 50% !important; padding: 0 1.5mm 3mm !important; }
.exec-grid > .col-12 { width: 100% !important; }
.exec-widget { break-inside: avoid; page-break-inside: avoid; border: 1px solid #000 !important; padding: 2mm 3mm !important; }
.exec-widget .card-header { border-bottom: 1px solid #000 !important; margin-bottom: 2mm; padding-bottom: 1mm !important; }
.exec-widget .progress { border: 1px solid #000; background: #fff !important; }
.exec-widget .progress-bar { background: #555 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.exec-widget svg { max-height: 52mm !important; width: 100%; height: auto; }
.exec-widget .row { margin-left: 0 !important; margin-right: 0 !important; --tblr-gutter-y: 1.5mm; --bs-gutter-y: 1.5mm; --tblr-gutter-x: 2mm; --bs-gutter-x: 2mm; }
.exec-widget .mb-3, .exec-widget .mb-2 { margin-bottom: 1.5mm !important; }
.exec-alerts { margin: 0 0 3mm; padding: 2mm 4mm; border: 1px solid #000; }
.exec-alerts li { margin-bottom: .5mm; }

/* header box */
.print-head { border: 1.5px solid #000; padding: 4mm 5mm 3mm; margin-bottom: 3mm; page-break-inside: avoid; }
.print-head-title { text-align: center; font-size: 15pt; font-weight: 800; }
.print-head-company { text-align: center; font-size: 10pt; margin-top: 1mm; }
.print-head-meta { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 3mm; font-size: 9.5pt; line-height: 1.9; }
.print-head-period { text-align: center; }
.print-head-note { text-align: left; color: #333; }

/* tables */
table { width: 100% !important; border-collapse: collapse !important; font-size: 9pt; }
.table > :not(caption) > * > * { box-shadow: none !important; background: transparent !important; }
table th, table td { border: 1px solid #000 !important; padding: 1.2mm 1.8mm !important; vertical-align: middle; color: #000 !important; }
table thead th { background: #fff !important; font-weight: 800; text-align: center; border-bottom: 1.5px solid #000 !important; }
table tbody tr:nth-child(even) td { background: #f2f2f2 !important; }
table tfoot td, table tfoot th, table tr.table-total td, table tr.fw-bold td { background: #d9d9d9 !important; font-weight: 800; border-top: 1.5px solid #000 !important; }
table td.ltr, table .ltr { direction: ltr; unicode-bidi: plaintext; }
thead { display: table-header-group; }
tfoot { display: table-footer-group; }
tr { page-break-inside: avoid; }
.table-stack td::before { display: none !important; }

/* sign-off */
.print-sign { display: flex !important; justify-content: space-between; margin-top: 4mm; padding: 0 20mm 0 40mm; font-size: 10pt; }
.print-sign span { min-width: 45mm; }

/* ---- invoices (sale / purchase / return …) ---- */
.print-invoice { border: 1.5px solid #000; }
.print-invoice .pi-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 3mm 5mm; border-bottom: 1px solid #888; }
.print-invoice .pi-head .pi-title { flex: 1; text-align: center; font-size: 15pt; font-weight: 800; }
.print-invoice .pi-head .pi-title small { display: block; font-size: 9pt; font-weight: 400; margin-top: 1mm; }
.print-invoice .pi-head > div:not(.pi-title) { width: 55mm; font-size: 10pt; line-height: 1.9; }
.print-invoice .pi-head > div:last-child { text-align: left; }
.print-invoice .pi-party { display: flex; gap: 4mm; padding: 2.5mm 5mm; border-bottom: 1px solid #888; font-size: 9.5pt; line-height: 1.9; }
.print-invoice .pi-role { width: 20mm; font-weight: 800; font-size: 10.5pt; }
.print-invoice .pi-body { flex: 1; }
.print-invoice .pi-row { display: flex; gap: 4mm; }
.print-invoice .pi-row > span { flex: 1; }
.print-invoice .pi-row > .pi-name { flex: 2; font-weight: 800; }
.print-invoice table { border: 0; }
.print-invoice table th, .print-invoice table td { border-width: 1px !important; }
.print-invoice table tbody tr:nth-child(even) td { background: transparent !important; }
.print-invoice .pi-total td { font-weight: 800; background: transparent !important; border-top: 1.5px solid #000 !important; }
.print-invoice .pi-words { font-weight: 800; }
.print-invoice .pi-sign { display: flex; justify-content: space-around; margin-top: 18mm; font-weight: 800; }
.print-invoice .pi-notes { margin-top: 8mm; font-size: 9pt; }

/* ---- payslip ---- */
.print-slip { border: 1.5px solid #000; }
.print-slip .ps-head { padding: 3mm 5mm; border-bottom: 1px solid #000; }
.print-slip .ps-head .ps-company { text-align: center; font-size: 15pt; font-weight: 800; }
.print-slip .ps-head .ps-date { font-size: 10pt; }
.print-slip .ps-emp { display: flex; justify-content: space-between; gap: 6mm; padding: 4mm 5mm; border-bottom: 1px solid #000; font-size: 10pt; }
.print-slip table { border: 0; }
.print-slip .ps-pay td { font-weight: 800; background: transparent !important; border-top: 1.5px solid #000 !important; }

/* big on-screen headings inside reports are printed at table size */
table .fs-3, table .fs-4, table .h3, table .h4, .card .h3, .card .h4 { font-size: 10pt !important; }

/* document header details (journal / treasury / stock / cheque) */
.print-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1mm 6mm; margin-top: 3mm; padding-top: 2.5mm; border-top: 1px solid #888; font-size: 9.5pt; line-height: 1.8; }
.print-meta .wide { grid-column: 1 / -1; }
.print-meta .lbl { font-weight: 800; }

/* controls never print: buttons, filter bars, tick boxes, placeholders */
.btn, .icon-btn, button, .dropdown, .form-check, input[type="checkbox"], input[type="radio"], form[method="get"], .menu-toggle { display: none !important; }
::placeholder { color: transparent !important; }

/* batch printing (public/js/batch-print.js): only the stacked documents print, and EVERY document starts on a sheet of its own — never two documents on one sheet, so that the
   printed stack can be taken apart document by document (a long document goes on over its own next sheets; the next one still begins on a fresh sheet) */
body.batch-printing > *:not(#batch-root) { display: none !important; }
body.batch-printing #batch-root { display: block !important; }
.batch-doc { break-after: page; page-break-after: always; break-before: page; page-break-before: always; display: block !important; page: batchdoc; counter-reset: page 1; }
.batch-doc:first-child { break-before: auto; page-break-before: auto; }
.batch-doc:last-child { break-after: auto; page-break-after: auto; }
/* the sheets of a stacked document say «صفحه n» only: «از y» would count the whole stack */
@page batchdoc { size: A4; margin: 10mm 9mm 14mm; @bottom-left { content: "صفحه " counter(page, persian); font: 9pt IRANSans, Tahoma, sans-serif; color: #333; } }
