html,
body {
	min-height: 100%;
}

body {
	font-family: Vazirmatn, Tahoma, sans-serif;
	background: #f8fafc;
	color: #0f172a;
}

input,
button,
select,
textarea {
	font: inherit;
}

a {
	color: inherit;
	text-decoration: none;
}

.print-root {
	min-height: 100vh;
	padding: 24px;
	background:
		radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 36%),
		radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.08), transparent 28%),
		#f8fafc;
}

.print-header {
	max-width: 1120px;
	margin: 0 auto 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.print-back,
.print-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	padding: 10px 16px;
	font-weight: 700;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.print-back {
	background: rgba(255, 255, 255, 0.85);
	border: 1px solid #dbe3ef;
	color: #0f172a;
}

.print-btn {
	border: 0;
	background: linear-gradient(135deg, #2563eb, #0f766e);
	color: #fff;
	box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.print-back:hover,
.print-btn:hover {
	transform: translateY(-1px);
}

.print-doc {
	max-width: 1120px;
	margin: 0 auto;
	padding: 28px;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid #e2e8f0;
	border-radius: 24px;
	box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.print-title {
	margin-bottom: 24px;
}

.print-title h1 {
	margin: 0 0 8px;
	font-size: 28px;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: #020617;
}

.print-title .meta {
	margin: 0;
	color: #64748b;
	font-size: 14px;
}

.labels {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 16px;
}

.label-card {
	position: relative;
	min-height: 180px;
	padding: 20px 18px 18px;
	border: 1px solid #cbd5e1;
	border-radius: 18px;
	background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
	overflow: hidden;
}

.label-card::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(37, 99, 235, 0.03), transparent 42%);
	pointer-events: none;
}

.label-no {
	position: absolute;
	top: 14px;
	left: 14px;
	width: 30px;
	height: 30px;
	border-radius: 999px;
	display: grid;
	place-items: center;
	background: #1d4ed8;
	color: #fff;
	font-weight: 800;
	font-size: 13px;
}

/* ---------- Ruled shipping label (خط‌کشی‌شده) ---------- */

.label-box {
	position: relative;
	z-index: 1;
	width: 100%;
	margin-top: 22px;
	background: #fff;
	border: 1.5px dashed #334155;
	border-radius: 6px;
	color: #0f172a;
	font-family: Vazirmatn, Tahoma, sans-serif;
	font-size: 13.5px;
	line-height: 1.8;
	overflow: hidden;
}

.lb-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	border-bottom: 1.5px dashed #334155;
}

.lb-sender {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-weight: 600;
}

.lb-logo {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.lb-logo img {
	display: block;
	width: 110px;
	height: auto;
}

.lb-receiver {
	padding: 10px 12px;
	border-bottom: 1.5px dashed #334155;
	font-weight: 600;
}

.lb-meta {
	display: flex;
	border-bottom: 1px solid #334155;
}

.lb-cell {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	padding: 8px 12px;
	font-weight: 600;
}

.lb-cell + .lb-cell {
	border-right: 1px solid #334155;
}

.lb-items {
	padding: 8px 12px;
	font-weight: 600;
}

.lb-k {
	font-weight: 800;
}

.lb-name {
	font-weight: 800;
}

.lb-num {
	font-weight: 800;
	letter-spacing: 0.4px;
	direction: ltr;
	unicode-bidi: embed;
}

@page {
	size: 50mm 100mm;
	margin: 0;
}

@media print {
	html,
	body {
		width: 50mm;
		margin: 0;
		padding: 0;
		background: #fff;
	}

	.no-print {
		display: none !important;
	}

	/* هدر و فوتر لایهٔ اصلی سایت در خروجی چاپ لیبل نیایند */
	body > header,
	body > footer {
		display: none !important;
	}

	body {
		min-height: auto !important;
		display: block !important;
	}

	.print-root {
		padding: 0;
		background: #fff;
	}

	.print-doc {
		max-width: none;
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		background: #fff;
	}

	.print-title,
	.label-no {
		display: none !important;
	}

	.labels {
		display: block;
	}

	.label-card {
		box-sizing: border-box;
		width: 50mm;
		height: 100mm;
		padding: 1.5mm;
		border: 0;
		border-radius: 0;
		background: #fff;
		overflow: hidden;
		display: block;
		position: relative;
		break-inside: avoid;
		page-break-inside: avoid;
		break-after: page;
		page-break-after: always;
	}

	.label-card:last-child {
		break-after: auto;
		page-break-after: auto;
	}

	.label-card::before {
		display: none;
	}

	.label-box {
		margin-top: 0;
		position: absolute;
		top: 50%;
		left: 50%;
		width: 97mm;
		height: 47mm;
		transform: translate(-50%, -50%) rotate(90deg);
		transform-origin: center center;
		display: flex;
		flex-direction: column;
		border-color: #000;
		border-radius: 0;
		font-size: 8.5pt;
		line-height: 1.45;
	}

	.lb-head {
		flex: 0 0 auto;
		padding: 1mm 2mm;
		border-bottom-color: #000;
	}

	.lb-sender {
		gap: 0;
	}

	.lb-logo img {
		width: 20mm;
	}

	.lb-receiver {
		flex: 1 1 auto;
		padding: 1mm 2mm;
		border-bottom-color: #000;
	}

	.lb-meta {
		flex: 0 0 auto;
		border-bottom-color: #000;
	}

	.lb-cell {
		padding: 0.6mm 2mm;
	}

	.lb-cell + .lb-cell {
		border-right-color: #000;
	}

	.lb-items {
		flex: 0 0 auto;
		padding: 0.6mm 2mm;
	}
}