/* ===========================================================
   PRINT / PDF — faithful single-page replica of the official
   PvPI ADR Reporting Form (Version 1.4).

   Single-page method: at print time the JS moves #adrr-print-area
   to be a direct child of <body> and adds .adrr-printing. We then
   DISPLAY:NONE every other body child (not visibility:hidden — that
   left the long form's height behind and produced blank pages).
   =========================================================== */
@media print {

	@page { size: A4 portrait; margin: 7mm; }

	body.adrr-printing > *:not(#adrr-print-area) { display: none !important; }

	body.adrr-printing #adrr-print-area {
		display: block !important;
		position: static !important; left: auto !important; top: auto !important;
		width: 100% !important; height: auto !important; overflow: visible !important;
		margin: 0 !important; padding: 0 !important;
		color: #000; font-family: Arial, Helvetica, sans-serif;
	}

	.pf-sheet { width: 100%; }

	.pf-grid, .pf-inner, .pf-hdr, .pf-med, .pf-act {
		width: 100%; border-collapse: collapse; table-layout: fixed;
	}
	.pf-grid > tbody > tr > td, .pf-inner td, .pf-med th, .pf-med td, .pf-act th, .pf-act td {
		border: 0.5pt solid #000;
	}

	/* ---- Header ---- */
	.pf-hdr td { border: none; vertical-align: middle; }
	.pf-emblem { width: 16mm; text-align: center; }
	.pf-em1 { font-weight: 800; font-size: 11pt; border: 1pt solid #000; border-radius: 2pt; padding: 1pt 0; }
	.pf-em2 { font-size: 7pt; font-weight: 700; margin-top: 1pt; }
	.pf-hc { text-align: center; padding: 0 3mm; }
	.pf-h1 { font-weight: 800; font-size: 11pt; }
	.pf-h2 { font-size: 7.4pt; font-weight: 600; }
	.pf-h3 { font-size: 6.8pt; }
	.pf-h4 { font-size: 6.8pt; font-weight: 700; }
	.pf-ver { width: 26mm; text-align: right; font-size: 7pt; font-weight: 700; vertical-align: top; }
	.pf-ref { color: #b00; }

	/* ---- Section bars (red headers) ---- */
	.pf-secbar {
		background: #c00000 !important; color: #fff !important;
		font-weight: 800; font-size: 7.6pt; padding: 1.2mm 2mm;
		-webkit-print-color-adjust: exact; print-color-adjust: exact;
		border: 0.5pt solid #000;
	}
	.pf-secbar.pf-thin { font-size: 7pt; }
	.pf-half { width: 50%; }
	td.pf-secbar { text-align: left; }
	tr > td.pf-half:first-child { font-size: 7.6pt; font-weight: 700; padding: 1.2mm 2mm; }

	/* ---- Two-column body ---- */
	.pf-body > tbody > tr > td.pf-col { width: 50%; vertical-align: top; padding: 0; }
	.pf-col { vertical-align: top; }
	.pf-inner td { padding: 1mm 1.5mm; font-size: 7.4pt; vertical-align: top; }
	.pf-inner td.pf-k { width: 42%; font-weight: 700; background: #f0f0f0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
	.pf-amc td.pf-k { background: #eaeaea; }

	.pf-box { border: 0.5pt solid #000; padding: 1.2mm 2mm; font-size: 7.4pt; min-height: 9mm; }
	.pf-box.pf-sm { min-height: 0; }
	.pf-box.pf-fill { min-height: 18mm; }
	.pf-cb { display: inline-block; font-size: 7pt; margin: 0 4mm 0.5mm 0; white-space: nowrap; }

	/* ---- Medication grid (C) ---- */
	.pf-med th, .pf-med td, .pf-act th, .pf-act td {
		font-size: 6.2pt; padding: 0.8mm 0.6mm; text-align: center; vertical-align: top;
		word-wrap: break-word; overflow-wrap: anywhere;
	}
	.pf-mh th, .pf-mh2 th {
		background: #e6e6e6 !important; font-weight: 700;
		-webkit-print-color-adjust: exact; print-color-adjust: exact;
	}
	.pf-med td.pf-l, .pf-act td.pf-l { text-align: left; }
	.pf-rn { width: 5mm; font-weight: 700; background: #f3f3f3; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
	.pf-tk { font-size: 8pt; }
	.pf-med th:nth-child(1) { width: 5mm; }
	.pf-med th:nth-child(2) { width: 22mm; }
	.pf-med th:nth-child(9), .pf-med th:nth-child(10) { width: 13mm; }

	/* keep on one page */
	.pf-sheet, .pf-grid, .pf-med, .pf-act, tr { page-break-inside: avoid !important; break-inside: avoid !important; }
}

/* keep the print area invisible on screen */
#adrr-print-area { position: absolute; left: -9999px; top: 0; width: 0; height: 0; overflow: hidden; }
