
        /* --- COLOUR PALETTE --- */
        :root {
            --red-bg: #b71c1c;     
            --blue-bg: #0d47a1;    
            --purple-bg: #4a148c;  
            --pink-bg: #880e4f;    
            --green-bg: #1b5e20;   
            --orange-bg: #e65100;  
            --black-bg: #212121;   
            --teal-bg: #006064;    
            --yellow-bg: #fbc02d;  
            --grey-header: #333333; 
        }

        * {
            box-sizing: border-box;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
        }

        body {
            font-family: 'Inter', system-ui, -apple-system, sans-serif;
            margin: 0;
            background-color: #555;
            counter-reset: page-counter;
        }

        /* --- PRINT BUTTON --- */
        .print-btn {
            position: fixed;
            top: 20px;
            right: 20px;
            background-color: white;
            color: #333;
            border: 2px solid #333;
            padding: 10px 20px;
            font-weight: bold;
            cursor: pointer;
            z-index: 9999;
            border-radius: 6px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        }
        .print-btn:hover { background-color: #eee; }

        /* --- A4 PAGE CONTAINER --- */
        .page {
            width: 210mm;
            height: 297mm;
            background: white;
            margin: 20px auto;
            position: relative;
            display: flex;
            overflow: hidden;
            page-break-after: always;
            box-shadow: 0 0 15px rgba(0,0,0,0.5);
            counter-increment: page-counter;
        }
        .page::after {
            content: counter(page-counter);
            position: absolute;
            bottom: 4mm;
            left: 50%;
            transform: translateX(-50%);
            font-size: 8.5pt;
            font-weight: 700;
            color: #999;
            z-index: 10;
            background: white;
            padding: 0 6px;
        }
        /* Hide page number on title page */
        .page.title-page::after { content: none; }
        /* Hide page number on debrief page */
        .page.debrief-page::after { content: none; }

        /* --- TITLE PAGE (PG 1) --- */
        .title-page {
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
            background: linear-gradient(135deg, #ffffff 0%, #f0f2f5 100%);
            padding: 20mm;
            border: 12px solid var(--blue-bg);
        }
        .tp-logo { width: 160px; margin-bottom: 20mm; }
        .tp-main-title { font-size: 65pt; font-weight: 900; color: var(--blue-bg); line-height: 0.9; margin-bottom: 5mm; letter-spacing: -2px; }
        .tp-subtitle { font-size: 22pt; font-weight: 300; color: var(--red-bg); letter-spacing: 4px; margin-bottom: 25mm; text-transform: uppercase; }
        .tp-edition { font-size: 16pt; font-weight: 700; border: 3px solid #333; padding: 10px 40px; display: inline-block; margin-bottom: 5mm; color: #333; }
        .tp-version { font-size: 10pt; font-weight: 600; color: #666; margin-bottom: 30mm; font-family: monospace; }

        /* Adult Disclaimer Box */
        .adult-disclaimer {
            background: #b71c1c;
            color: #ffffff;
            border: 4px solid #000000;
            padding: 10px 15px;
            text-align: center;
            font-weight: 900;
            font-size: 1.1em;
            text-transform: uppercase;
            margin: 15px 0;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
            letter-spacing: 1px;
        }

        /* --- GUIDE PAGE (PG 2) --- */
        .guide-page { flex-direction: column; padding: 15mm; }
        .gp-header { font-size: 24pt; font-weight: 800; border-bottom: 4px solid #333; margin-bottom: 6mm; text-transform: uppercase; }
        .gp-section { margin-bottom: 6mm; }
        .gp-title { font-size: 14pt; font-weight: 700; color: var(--blue-bg); margin-bottom: 2mm; display: flex; align-items: center; gap: 10px; }
        .gp-text { font-size: 11pt; line-height: 1.4; color: #444; }
        .gp-box { background: #fff3e0; padding: 15px; border-radius: 6px; border-left: 8px solid var(--red-bg); margin-top: auto; font-size: 10.5pt; color: #d84315; font-weight: bold; }

        /* Glossary Grid (FLEXBOX FIX) */
        .abbrev-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 6px 15px;
            font-size: 9.5pt;
            color: #444;
            background: #f9f9f9;
            padding: 15px;
            border-radius: 6px;
            border: 1px solid #eee;
        }
        .abbrev-item { 
            width: calc(50% - 7.5px); 
            display: flex; 
            justify-content: space-between; 
            border-bottom: 1px dashed #ddd; 
            padding-bottom: 2px; 
        }
        .abbrev-item strong { color: var(--blue-bg); margin-right: 10px; min-width: 60px;}

        /* --- CONTENTS PAGE (PG 3) --- */
        .contents-page { flex-direction: column; padding: 15mm; }
        /* Flexbox Fix for PDF columns */
        .toc-grid { display: flex; flex-direction: row; gap: 10mm; width: 100%; align-items: flex-start; }
        .toc-column { flex: 1; display: flex; flex-direction: column; width: calc(50% - 5mm); }
        .toc-group { margin-bottom: 8mm; page-break-inside: avoid; }
        .toc-header { font-size: 12pt; font-weight: 800; color: white; padding: 4px 10px; margin-bottom: 4px; border-radius: 4px; text-transform: uppercase; }
        .toc-list { list-style: none; padding: 0; margin: 0; }
        .toc-item { font-size: 10.5pt; padding: 4px 0; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; color: #333; }
        .toc-item span:last-child { font-weight: 600; color: #666; }

        /* --- COMMON LAYOUT (PAGES 4+) --- */
        .side-strip { width: 14mm; height: 100%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 2; }
        .side-strip span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 900; letter-spacing: 3px; font-size: 11pt; white-space: nowrap; color: white; text-transform: uppercase; }

        .page > .side-strip:first-child { border-right: 1px solid #ccc; border-left: none; }
        .page > .side-strip:last-child { border-left: 1px solid #ccc; border-right: none; }

        .content-area { flex: 1; padding: 8mm 10mm; display: flex; flex-direction: column; background-color: #fdfdfd; height: 100%; }

        /* Headers */
        .main-header { position: relative; color: white; text-align: center; padding: 6px; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60px; border: 1px solid rgba(0,0,0,0.1); margin-bottom: 4mm; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
        .logo-img { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); height: 35px; width: auto; }
        .main-header h1 { margin: 0; font-size: 16pt; text-transform: uppercase; line-height: 1; font-weight: 900; }
        .main-header h2 { margin: 2px 0 0 0; font-size: 9pt; font-weight: 700; background-color: rgba(0,0,0,0.25); padding: 2px 10px; border-radius: 3px; }

        /* --- WALKTHROUGH (PAGE A) STYLES --- */
        .wt-layout { display: flex; flex-direction: column; height: 100%; width: 100%; }
        /* Flexbox Fix for Layout overlapping */
        .wt-grid { display: flex; flex-direction: row; gap: 6mm; flex-grow: 1; margin-bottom: 0; width: 100%; }
        .wt-col { display: flex; flex-direction: column; gap: 4mm; flex: 1; width: calc(50% - 3mm); }
        .wt-box { border: 1px solid #ccc; border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.05); page-break-inside: avoid; }
        .wt-box-header { background: #eee; color: #333; padding: 6px 10px; font-weight: 800; font-size: 10pt; border-bottom: 1px solid #ccc; text-transform: uppercase; letter-spacing: 0.5px; }
        .wt-box-content { padding: 10px; font-size: 9pt; line-height: 1.4; flex-grow: 1; color: #222; }

        /* Checklists */
        .checklist-item { display: flex; align-items: flex-start; margin-bottom: 6px; font-weight: 500; border-bottom: 1px dashed #eee; padding-bottom: 4px; page-break-inside: avoid; }
        .checklist-item:last-child { border-bottom: none; }
        .checkbox { width: 14px; height: 14px; border: 2px solid #555; margin-right: 8px; flex-shrink: 0; border-radius: 3px; background: white; display: inline-block; }
        .checkbox.checked { background-color: var(--blue-bg); border-color: var(--blue-bg); position: relative; }
        .checkbox.checked::after { content: '✔'; color: white; position: absolute; top: -3px; left: 2px; font-size: 10pt; }

        /* Numbered Lists (FIXED PDF POSITIONING BUG) */
        .step-list { counter-reset: step; list-style: none; padding: 0; margin: 0; }
        .step-list li { position: relative; padding-left: 22px; margin-bottom: 8px; font-size: 9.5pt; }
        .step-list li::before { counter-increment: step; content: counter(step) ". "; font-weight: 900; color: var(--blue-bg); position: absolute; left: 0; top: 0; min-width: 18px; text-align: right; }

        /* --- DIAGRAMS --- */
        .diagram-container {
            margin: 8px 0;
            text-align: center;
            background: #fafafa;
            border: 1px solid #eee;
            padding: 8px;
            border-radius: 4px;
            page-break-inside: avoid;
        }
        .diagram-img {
            max-width: 100%;
            max-height: 340px;
            height: auto;
            object-fit: contain;
            border-radius: 3px;
            display: block;
            margin: 0 auto;
            border: 1px solid #ddd;
        }
        /* Wide multi-panel diagrams sit at the foot of the Action page and take the space left over */
        .content-area:has(.diagram-wide) > *:not(.diagram-wide) { flex-shrink: 0; }
        .diagram-wide { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
        .diagram-wide .diagram-img { flex: 1 1 0; min-height: 0; max-height: 105mm; width: 100%; }
        .diagram-caption {
            font-size: 8pt;
            color: #666;
            margin-top: 4px;
            font-weight: 600;            
            font-style: italic;
        }

        /* --- FLOWCHART (PAGE B) STYLES --- */
        .section { 
            background: white; 
            border: 1px solid #e0e0e0; 
            border-left: 6px solid var(--grey-header);
            border-radius: 4px; 
            margin-bottom: 3mm; 
            box-shadow: 0 2px 4px rgba(0,0,0,0.08); 
            display: flex; 
            flex-direction: column; 
            overflow: hidden;
            page-break-inside: avoid;
        }

        .section-header { 
            display: flex; 
            align-items: center; 
            gap: 10px; 
            padding: 4px 10px; 
            background-color: var(--grey-header); 
            color: white; 
        }

        .step-critical .section-header { background-color: var(--red-bg); }
        .step-critical { border-left-color: var(--red-bg); }

        .step-warning { border: 2px solid var(--red-bg); background-color: #ffebee; }
        .step-warning .section-content { color: #b71c1c; font-weight: bold; }

        .icon-box { 
            width: 22px; height: 22px; 
            background: rgba(255,255,255,0.2); 
            border-radius: 50%; 
            display: flex; align-items: center; justify-content: center; 
            font-size: 10pt; font-weight: bold; flex-shrink: 0; 
        }

        .section-title { font-size: 11pt; font-weight: 800; text-transform: uppercase; line-height: 1; letter-spacing: 0.5px; }

        .section-content { 
            padding: 6px 12px 6px 32px; 
            font-size: 10pt; 
            font-weight: 500; 
            line-height: 1.3; 
            color: #222; 
        }

        .section-content ul { margin: 2px 0; padding: 0; list-style: none; }
        .section-content li { margin-bottom: 3px; position: relative; padding-left: 16px; }
        .section-content li::before { content: "•"; position: absolute; left: 0; top: 0; color: #555; font-weight: bold; font-size: 1.2em; line-height: 0.8; }

        .pro-tip {
            margin-top: 4px;
            font-size: 8.5pt;
            background: #e3f2fd;
            color: #0d47a1;
            padding: 3px 6px;
            border-radius: 3px;
            border-left: 3px solid #0d47a1;
        }

        /* Failure / Plan B Box */
        .plan-b-box {
            background: #ffebee;
            border-left: 4px solid #d32f2f;
            padding: 6px 10px;
            margin-top: 4px;
            font-size: 9pt;
            color: #b71c1c;
            page-break-inside: avoid;
        }
        .plan-b-title {
            font-weight: 800;
            text-transform: uppercase;
            font-size: 0.9em;
            margin-bottom: 2px;
        }

        /* Badges */
        .halo-badge {
            background: white;
            color: black;
            font-size: 0.6em;
            padding: 2px 8px;
            border-radius: 4px;
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.2);
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .da-badge {
            background: #b71c1c;
            color: white;
            font-size: 0.6em;
            padding: 2px 8px;
            border-radius: 4px;
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.2);
            display: inline-flex;
            align-items: center;
            gap: 4px;
            margin-top: 5px;
        }

        .drug-badge {
            background: #ffebee;
            color: #c62828;
            border: 1px solid #c62828;
            font-size: 0.7em;
            padding: 2px 6px;
            border-radius: 4px;
            margin-left: 6px;
            font-weight: 800;
            text-transform: uppercase;
            display: inline-block;
            vertical-align: middle;
            line-height: 1.2;
        }

        /* Drug Doses (FIXED OVERLAP BUG) */
        .dose { 
            background-color: #ffebee; 
            border: 1px solid #d32f2f; 
            color: #b71c1c; 
            padding: 1px 4px; 
            border-radius: 3px; 
            font-weight: 900; 
            font-family: monospace; 
            font-size: 1.05em; 
            display: inline-block; 
            line-height: 1;
        }

        /* Stop Criteria Box */
        .stop-box {
            background: #212121;
            color: white;
            padding: 8px;
            border-radius: 4px;
            margin-top: 6px;
            font-size: 9pt;
            text-align: center;
            page-break-inside: avoid;
        }

        /* Storage Location Box */
        .storage-box {
            border: 4px solid #b71c1c;
            background: #fff3e0;
            padding: 10px;
            border-radius: 4px;
            margin-top: 10px;
            text-align: center;
            page-break-inside: avoid;
        }
        .storage-header {
            font-weight: 900;
            color: #b71c1c;
            text-transform: uppercase;
            font-size: 1.1em;
            margin-bottom: 4px;
        }
        .storage-text {
            font-size: 10pt;
            font-weight: 800;
            color: #000;
        }

        /* Footer & References */
        .footer-spacer { margin-top: auto; }
        .footer-email {
            font-size: 8pt;
            color: #777;
            text-align: center;
            margin-top: 4px;
            font-style: italic;
        }
        .ref-bar { 
            text-align: center; 
            padding: 4px; 
            font-size: 7.5pt; 
            color: #555; 
            border-top: 1px solid #eee; 
            margin-top: 2px; 
            font-weight: 600; 
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            page-break-inside: avoid;
        }
        .ref-qr {
            width: 55px;
            height: 55px;
            margin-top: 2px;
            border: 1px solid #ddd;
            padding: 2px;
            background: white;
        }
        .ref-link-text {
            text-decoration: none;
            color: #0d47a1;
        }

        /* Hot Debrief Page */
        .debrief-page {
            background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 20mm;
        }
        .debrief-card {
            background: white;
            padding: 10mm;
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
            border-top: 10px solid #2e7d32;
            width: 100%;
            max-width: 160mm;
            page-break-inside: avoid;
        }
        .toc-icon { margin-right: 5px; font-size: 0.9em; }

        /* Print Media Query (UPDATED FOR PERFECT A4 FIT) */
        @media print {
            @page {
                size: A4;
                margin: 0;
            }
            body { 
                background: none; 
                margin: 0; 
                padding: 0;
            }
            .print-btn { 
                display: none; 
            }
            .page { 
                margin: 0; 
                box-shadow: none; 
                page-break-after: always; 
                width: 210mm; 
                height: 297mm;
                border: none;
            }
            .page:last-child { 
                page-break-after: auto; 
            }
        }

        /* Theme Borders */
        .theme-pink .section { border-left-color: var(--pink-bg); }
        .theme-red .section { border-left-color: var(--red-bg); }
        .theme-blue .section { border-left-color: var(--blue-bg); }
        .theme-purple .section { border-left-color: var(--purple-bg); }
        .theme-green .section { border-left-color: var(--green-bg); }
        .theme-teal .section { border-left-color: var(--teal-bg); }
        .theme-orange .section { border-left-color: var(--orange-bg); }
        .theme-yellow .section { border-left-color: var(--yellow-bg); }

        /* Screen only: on narrow screens the fixed-width A4 pages scroll sideways
           inside this wrapper, so the whole browser page no longer scrolls sideways */
        @media screen {
            .pages-scroll { overflow-x: auto; }
        }
    