/* Sadid Pishfactor – print document styles */

@page {
	size: A4 portrait;
	margin: 0;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
}

body {
	background: #e8ecf1;
	font-family: Tahoma, "IRANSansX", "Vazirmatn", "Segoe UI", sans-serif;
	color: #1c2733;
	font-size: 10pt;
	line-height: 1.65;
	direction: rtl;
	-webkit-print-color-adjust: exact;
	print-color-adjust: exact;
}

/* Toolbar (screen only) */
#spf-toolbar {
	position: fixed;
	top: 14px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 8px;
	z-index: 50;
	padding: 8px;
	background: #ffffff;
	border: 1px solid #d3dae3;
	border-radius: 10px;
	box-shadow: 0 6px 24px rgba(20, 40, 70, 0.14);
}

#spf-toolbar button,
#spf-toolbar a {
	display: inline-block;
	padding: 8px 18px;
	border-radius: 8px;
	font-family: inherit;
	font-size: 9.5pt;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
}

.spf-print-btn {
	background: #17324d;
	color: #ffffff;
}

.spf-print-btn:hover {
	background: #0f2438;
}

.spf-back-btn {
	background: #f2f5f9;
	color: #17324d;
	border-color: #d3dae3 !important;
}

/* Source blocks used by the paginator (measured off-screen) */
#spf-src {
	position: absolute;
	top: 0;
	right: -4000mm;
	width: 210mm;
	visibility: hidden;
}

/* A4 sheet */
#spf-pages {
	padding: 24mm 0 10mm;
}

.page {
	position: relative;
	width: 210mm;
	height: 296.6mm;
	background: #ffffff;
	margin: 0 auto 10mm;
	box-shadow: 0 3px 18px rgba(20, 40, 70, 0.16);
	overflow: hidden;
}

.page-inner {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	padding: 9mm 11mm 11mm;
}

.page-flow {
	flex: 0 0 auto;
	min-height: 0;
}

.page-foot {
	position: absolute;
	left: 11mm;
	right: 11mm;
	bottom: 5mm;
	display: flex;
	justify-content: space-between;
	border-top: 1px solid #dce2ea;
	padding-top: 1.4mm;
	font-size: 7.5pt;
	color: #6d7885;
}

/* Masthead */
.doc-head {
	display: flex;
	justify-content: space-between;
	align-items: stretch;
	gap: 6mm;
	border-bottom: 2.2pt solid #17324d;
	padding-bottom: 3mm;
}

.doc-brand {
	flex: 1 1 auto;
}

.doc-logo {
	max-height: 15mm;
	max-width: 42mm;
	display: block;
	margin-bottom: 1.5mm;
}

.brand-name {
	font-size: 15pt;
	font-weight: 700;
	color: #17324d;
	letter-spacing: -0.2pt;
}

.brand-sub {
	font-size: 9pt;
	color: #6d7885;
	margin-top: 0.8mm;
}

.doc-id {
	flex: 0 0 52mm;
	border: 1.2pt solid #17324d;
	border-radius: 2mm;
	padding: 2.2mm 3mm;
	background: #f6f8fb;
}

.doc-id-title {
	font-size: 11pt;
	font-weight: 700;
	color: #17324d;
	text-align: center;
	border-bottom: 1px solid #d5dce6;
	padding-bottom: 1mm;
	margin-bottom: 1.4mm;
}

.doc-id-row {
	display: flex;
	justify-content: space-between;
	font-size: 8.8pt;
	padding: 0.4mm 0;
}

.doc-id-row span {
	color: #6d7885;
}

/* Parties */
.parties {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4mm;
	margin-top: 3.5mm;
}

.party {
	border: 0.9pt solid #cfd6e0;
	border-radius: 2mm;
	overflow: hidden;
}

.party h3 {
	margin: 0;
	padding: 1.6mm 3mm;
	background: #17324d;
	color: #ffffff;
	font-size: 9.3pt;
	font-weight: 700;
}

.prow {
	display: flex;
	padding: 0.9mm 3mm;
	border-top: 1px solid #e6eaf0;
	font-size: 8.6pt;
}

.prow:first-of-type {
	border-top: 0;
}

.plbl {
	flex: 0 0 32mm;
	color: #6d7885;
}

.pval {
	flex: 1 1 auto;
	font-weight: 600;
	word-break: break-word;
}

/* Items */
.items-title {
	margin-top: 4mm;
	padding: 1.6mm 3mm;
	background: #eef2f7;
	border: 0.9pt solid #cfd6e0;
	border-bottom: 0;
	font-weight: 700;
	font-size: 9.3pt;
	color: #17324d;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 4mm;
}

.items-title .tax-note {
	font-weight: 600;
	font-size: 8.3pt;
	color: #6d7885;
}

.items-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	font-size: 8.8pt;
}

.items-table th {
	background: #17324d;
	color: #ffffff;
	font-size: 8.5pt;
	font-weight: 700;
	text-align: center;
	padding: 2mm 1.4mm;
	border: 0.9pt solid #17324d;
}

.items-table td {
	border: 0.9pt solid #cfd6e0;
	padding: 1.5mm 1.4mm;
	vertical-align: top;
	word-break: break-word;
}

.items-table .i-row {
	width: 9mm;
	text-align: center;
}

.items-table .i-title {
	width: auto;
}

.items-table .i-qty {
	width: 13mm;
	text-align: center;
}

.items-table .i-unit {
	width: 16mm;
	text-align: center;
}

.items-table .i-price {
	width: 25mm;
	text-align: left;
	direction: ltr;
}

.items-table .i-disc {
	width: 21mm;
	text-align: left;
	direction: ltr;
}

.items-table .i-total {
	width: 25mm;
	text-align: left;
	direction: ltr;
}

.items-table .i-tax {
	width: 24mm;
	text-align: left;
	direction: ltr;
}

.items-table tbody tr:nth-child(even) td {
	background: #f8fafc;
}

/* Continuation header on pages 2+ */
.cont-head {
	border-bottom: 1.4pt solid #17324d;
	padding-bottom: 2mm;
	margin-bottom: 3mm;
}

.cont-line {
	display: flex;
	justify-content: space-between;
	font-size: 8.2pt;
	color: #6d7885;
}

.cont-brand {
	font-weight: 700;
	color: #17324d;
}

.cont-title {
	font-size: 10pt;
	font-weight: 700;
	color: #17324d;
	margin-top: 1.2mm;
}

/* Summary */
.summary {
	display: flex;
	gap: 4mm;
	align-items: flex-end;
	margin-top: 3mm;
}

.summary-words {
	flex: 1 1 auto;
	border: 0.9pt solid #cfd6e0;
	border-radius: 2mm;
	background: #f6f8fb;
	padding: 2mm 3mm;
	font-size: 9pt;
}

.sw-lbl {
	color: #6d7885;
	display: block;
	font-size: 8.3pt;
	margin-bottom: 0.6mm;
}

.sw-val {
	font-weight: 700;
	color: #17324d;
}

.totals {
	flex: 0 0 72mm;
	border-collapse: collapse;
	font-size: 8.9pt;
}

.totals td {
	border: 0.9pt solid #cfd6e0;
	padding: 1.2mm 2.6mm;
}

.totals td:first-child {
	background: #f6f8fb;
	color: #46566a;
}

.totals td:last-child {
	text-align: left;
	direction: ltr;
	width: 32mm;
}

.totals tr.grand td {
	background: #17324d;
	color: #ffffff;
	font-weight: 700;
	font-size: 9.4pt;
}

/* Terms, notes, signatures */
.terms {
	display: grid;
	grid-template-columns: 1fr 1.6fr;
	gap: 3mm;
	margin-top: 3.5mm;
}

.term-box {
	border: 0.9pt solid #cfd6e0;
	border-radius: 2mm;
	padding: 2mm 3mm;
	min-height: 12mm;
	font-size: 8.8pt;
}

.term-lbl {
	display: block;
	color: #6d7885;
	font-size: 8.2pt;
	margin-bottom: 0.6mm;
}

.signs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4mm;
	margin-top: 4mm;
}

.sign-box {
	border: 0.9pt dashed #9aa7b7;
	border-radius: 2mm;
	height: 20mm;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding-bottom: 2mm;
	font-size: 8.6pt;
	color: #6d7885;
}

/* Print */
@media print {
	html,
	body {
		background: #ffffff;
	}

	#spf-toolbar,
	#spf-src {
		display: none !important;
	}

	#spf-pages {
		padding: 0;
	}

	.page {
		margin: 0;
		box-shadow: none;
		break-after: page;
		page-break-after: always;
	}

	.page:last-child {
		break-after: auto;
		page-break-after: auto;
	}
}
