Write a 30 marks answer for Postgraduate Anaesthesia exam on the topic of opiods

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
I now have comprehensive source material. Let me write the 30-mark postgraduate anaesthesia exam answer on opioids.

Opioids in Anaesthetic Practice

Introduction

Opioids are the cornerstone of intraoperative and perioperative analgesia. The term "opioid" broadly refers to any agent that binds to the orthosteric site of an opioid receptor family member, encompassing natural opiates (morphine, codeine), semi-synthetic agents (oxycodone, hydromorphone), fully synthetic agents (fentanyl, remifentanil, methadone), and endogenous peptides (enkephalins, endorphins, dynorphins). They remain the most potent analgesics available, though their use carries well-characterised risks that demand careful management.

1. Opioid Receptors (5 marks)

Receptor Classification

Opioid receptors are 7-transmembrane G protein-coupled receptors (GPCRs). Three classical receptor types exist:
ReceptorEndogenous LigandKey Clinical Effects
Mu (μ)β-Endorphin, enkephalinsSupraspinal and spinal analgesia, euphoria, respiratory depression, miosis, decreased GI motility, physical dependence
Kappa (κ)DynorphinsSpinal analgesia, sedation, dysphoria, psychotomimetic effects
Delta (δ)EnkephalinsSpinal analgesia, modulatory, possible mood effects
NOP/ORL1Nociceptin/orphanin FQModulation of pain, anxiety, stress
The mu receptor is primarily responsible for the pain-relieving actions and, importantly, also the unwanted effects of all clinically useful opioid analgesics (Goodman & Gilman's, p. 463). Opioid receptors belong to the class A (rhodopsin) GPCR family and share 55-58% sequence homology.

Signal Transduction

Opioid receptor activation couples to pertussis toxin-sensitive Gi/Go proteins. This leads to:
  • Inhibition of adenylate cyclase → reduced intracellular cAMP
  • Inhibition of voltage-dependent Ca2+ channels → reduced neurotransmitter release
  • Activation of inwardly rectifying K+ channels → membrane hyperpolarisation
  • Net effect: reduced neuronal excitability and inhibition of pain signal transmission
Long-term tolerance is associated with superactivation of adenylyl cyclase as a counterregulatory response to the sustained fall in cAMP (Miller's Anesthesia, p. 2691).

Endogenous Opioid Peptides

The three main precursor proteins are:
  1. Preproenkephalin - gives rise to methionine- and leucine-enkephalin (delta > mu)
  2. Preprodynorphin - gives rise to dynorphins (kappa-preferring)
  3. Proopiomelanocortin (POMC) - gives rise to β-endorphin (mu-preferring), ACTH, and MSH
Opioid peptides are distributed in CNS regions involved in pain processing (spinal cord dorsal horn, periaqueductal grey), affective behaviour (amygdala, limbic system), autonomic regulation (medulla), and neuroendocrine control (Miller's Anesthesia, p. 2690).

2. Individual Opioid Agents and Pharmacokinetics (8 marks)

Morphine

  • Prototype mu-agonist, naturally occurring phenanthrene alkaloid
  • Bioavailability: ~30% oral (extensive first-pass), ~100% IM/IV
  • Protein binding: ~35%, partially to albumin
  • Metabolism: Hepatic glucuronidation (primarily UGT2B7) to:
    • Morphine-6-glucuronide (M6G): Active full mu-agonist with analgesic and respiratory depressant properties - accumulates in renal failure, can cause loss of consciousness and severe respiratory depression in compromised renal function (Barash, p. 1548)
    • Morphine-3-glucuronide (M3G): Inactive at opioid receptors; accumulation implicated in opioid-induced hyperalgesia and neurological excitatory phenomena
  • Half-life: ~2-4 hours; M6G has a longer half-life
  • Special concern in renal failure: M6G accumulation prolongs respiratory depression; use with caution (Morgan & Mikhail, p. 1270)
  • Histamine release: Due to direct mast cell degranulation - can cause flushing, hypotension, bronchospasm; less common with slow IV administration

Fentanyl

  • Synthetic phenylpiperidine; ~100x more potent than morphine
  • Highly lipophilic - rapid onset (1-2 min IV), rapid redistribution
  • Protein binding: ~80-85% (α1-acid glycoprotein)
  • Metabolism: CYP3A4 hepatic metabolism → inactive norfentanyl; high hepatic extraction ratio (~1.5 L/min approaching liver blood flow)
  • Pharmacokinetics: Context-sensitive half-time increases significantly with prolonged infusion due to redistribution from peripheral compartments (fat, muscle)
  • Doses in practice: Induction co-induction: 1-5 mcg/kg; infusion: 0.5-5 mcg/kg/hr; neuraxial use
  • Reduces the MAC of volatile agents (e.g., 1.67 ng/mL plasma concentration reduces isoflurane MAC by ~50%), with a ceiling effect on MAC reduction - cannot be used as a sole anaesthetic (Miller's Anesthesia, p. 2718)

Remifentanil

  • Ultra-short-acting synthetic opioid; unique ester side chain
  • Metabolism: Plasma and tissue non-specific esterases (within erythrocytes) - NOT hepatic, NOT renal
  • Context-sensitive half-time: ~2 minutes regardless of infusion duration - the most rapidly acting opioid available
  • Clearance: 3-5 L/min, exceeding hepatic blood flow, confirming extrahepatic clearance
  • Plasma level falls by 50% within ~40 seconds after stopping infusion
  • Renal/hepatic failure: Pharmacokinetics unaffected
  • Administered as continuous infusion (typically 0.05-0.5 mcg/kg/min TCI or weight-based)
  • Concern: Profound analgesia intraoperatively followed by abrupt offset necessitates pre-emptive postoperative analgesia; associated with opioid-induced hyperalgesia at higher infusion rates (Barash, p. 1548)

Alfentanil

  • Intermediate-acting phenylpiperidine
  • Metabolism: CYP3A4 and CYP3A5 - polymorphic expression accounts for great interindividual variability in clearance
  • Smaller volume of distribution than fentanyl → faster onset of effect site equilibration
  • Used for short procedures, co-induction, and laryngoscopy attenuation

Sufentanil

  • ~5-10x more potent than fentanyl
  • High hepatic extraction ratio (clearance ~0.9 L/min)
  • Greater mu-receptor selectivity
  • Used in cardiac anaesthesia and high-dose opioid techniques; neuraxial use

Morphine Alternatives: Hydromorphone, Oxycodone, Codeine

  • Hydromorphone: 5-7x more potent than morphine; active metabolite hydromorphone-3-glucuronide can cause neuroexcitation; shorter duration
  • Codeine: Prodrug requiring CYP2D6 conversion to morphine; poor analgesic in slow metabolisers (~7-10% Caucasians); dangerous in ultra-rapid metabolisers (neonatal deaths reported)
  • Tramadol: Dual mechanism - weak mu-agonist + serotonin-norepinephrine reuptake inhibition; lowers seizure threshold; risk of serotonin syndrome

Methadone

  • Long-acting synthetic opioid; mu-agonist + NMDA receptor antagonism
  • Bioavailability: 60-95% oral; high lipophilicity
  • Metabolism: CYP2B6 (pharmacogenetically variable)
  • Long and unpredictable duration of action; associated with QTc prolongation (torsades de pointes risk at doses >100mg/day)
  • Useful perioperatively in opioid-dependent patients (Barash, p. 1548)

Buprenorphine

  • Partial mu-agonist / kappa-antagonist - ceiling effect on respiratory depression
  • Very high receptor affinity - difficult to reverse with naloxone (higher doses may be needed)
  • Long duration of action (~24-72 hours)
  • Used in opioid dependence (Suboxone when combined with naloxone) and chronic pain

Mixed Agonist-Antagonists (Pentazocine, Nalbuphine, Butorphanol)

  • Kappa-agonists / mu-antagonists or partial agonists
  • Ceiling effect on analgesia and respiratory depression
  • May precipitate withdrawal in opioid-dependent patients
  • Pentazocine: kappa activation causes dysphoria and psychotomimetic effects; increased cardiovascular work (unlike typical mu-agonists)

3. Pharmacological Effects by System (8 marks)

Central Nervous System

  • Analgesia: Supraspinal (PAG, rostroventral medulla), spinal (dorsal horn substantia gelatinosa), and peripheral (inflammatory states - immune cell-mediated opioid peptide release)
  • Sedation and altered consciousness: Opioids reduce consciousness through decreased cortical acetylcholine release (morphine injection to substantia innominata reduces prefrontal cortical acetylcholine). Not complete anaesthetics - MAC reduction is incomplete and demonstrates a ceiling effect
  • Euphoria/dysphoria: Mu-activation → euphoria (mesolimbic pathway); kappa-activation → dysphoria
  • Miosis: Stimulation of Edinger-Westphal nucleus (mu and kappa); does not habituate with tolerance; useful clinical sign of opioid effect
  • Nausea and vomiting: Direct stimulation of the chemoreceptor trigger zone (area postrema); vestibular sensitisation contributes - exacerbated by ambulation
  • Sleep disturbance: Opioids reduce deep (slow-wave) sleep, increase stage 2 sleep, inhibit REM sleep; associated with sleep-disordered breathing (central sleep apnea prevalence ~24% with chronic opioid therapy) (Miller's Anesthesia, p. 2719)

Respiratory System

  • Respiratory depression: Primary concern; mediated via mu-receptors in the brainstem (pre-Botzinger complex and parabrachial nucleus)
    • Opioids blunt the ventilatory response to hypercapnia and hypoxia
    • Reduced respiratory rate is the dominant effect; tidal volume also decreased
    • The CO2 response curve shifts right (increased PaCO2 threshold) and becomes less steep
    • High-dose rapid injection (e.g., remifentanil bolus) can cause apnoea without time for CO2 compensation (Barash, p. 1567)
  • Chest wall rigidity ("wooden chest syndrome"): High doses of potent synthetic opioids (fentanyl, remifentanil) cause thoracoabdominal muscle rigidity, impeding ventilation; managed with naloxone, succinylcholine, or neuromuscular blockade
  • Upper airway effects: Opioids suppress brainstem neurons maintaining upper airway tone and depress arousal reflexes → increased obstructive apnoeas perioperatively
  • Antitussive effect: Suppression of cough reflex at the medullary cough centre (codeine used clinically for this)

Cardiovascular System

  • Generally minimal direct cardiac effects at clinical doses in normovolaemic patients
  • Bradycardia: via central vagal stimulation (morphine, fentanyl)
  • Histamine-mediated vasodilation and hypotension: Morphine (direct mast cell degranulation); minimal with fentanyl/remifentanil
  • High-dose opioid anaesthesia (e.g., 50-100 mcg/kg fentanyl): haemodynamic stability maintained - basis for cardiac anaesthesia; however, still not sufficient as sole agent
  • Methadone: QTc prolongation - risk of torsades de pointes

Gastrointestinal System

  • Decreased GI motility: Opioids act on mu and delta receptors in the enteric nervous system and spinal cord → reduced peristalsis, delayed gastric emptying, decreased bowel sounds → opioid-induced constipation (does not habituate)
  • Sphincter of Oddi spasm: Biliary colic can be worsened; morphine more than fentanyl
  • Nausea/vomiting (see CNS above)
  • Peripherally acting mu-receptor antagonists (methylnaltrexone, naloxegol): treat opioid-induced constipation without reversing central analgesia

Urinary System

  • Increased urinary sphincter tone → urinary retention (especially with neuraxial opioids)
  • Reduced detrusor muscle contraction

Endocrine / Immune Effects

  • Suppression of hypothalamic-pituitary axis: reduced LH, FSH, testosterone, estrogen with chronic use
  • Immunosuppressive effects (especially mu-receptor mediated): reduced NK cell activity, impaired lymphocyte function - concern in chronic users and cancer patients

4. Opioid Tolerance and Opioid-Induced Hyperalgesia (3 marks)

Tolerance

  • Defined as the need for increasing doses to achieve the same analgesic effect
  • Mechanisms: receptor internalisation and downregulation, G-protein uncoupling, upregulation of cAMP pathway (adenylyl cyclase superactivation as counterregulatory response)
  • A118G polymorphism (most common SNP of the mu-opioid receptor gene) - asparagine to aspartate substitution at position 40 - associated with higher opioid requirements; meta-analysis of >4600 patients showed carriers had significantly higher analgesic requirements (Miller's Anesthesia, p. 2681-2682)

Opioid-Induced Hyperalgesia (OIH)

  • Paradoxical increase in pain sensitivity with continued opioid use
  • Distinct from tolerance - patients become more sensitive to nociceptive stimuli, not just less responsive to opioids
  • Mechanisms: NMDA receptor sensitisation, spinal dynorphin upregulation, activation of descending pain facilitatory pathways
  • Clinically seen with remifentanil infusions (especially >0.1 mcg/kg/min); may be attenuated with NMDA antagonists (ketamine, methadone) (Barash, p. 1536)

5. Opioid Antagonists and Reversal (3 marks)

Naloxone

  • Pure competitive mu (and to lesser extent kappa, delta) antagonist
  • Dose: 40-400 mcg IV (titrated); paediatric 10 mcg/kg
  • Duration: 30-90 minutes - shorter than most opioids → re-narcotisation is a risk; may require repeat dosing or infusion
  • Onset: ~1-2 minutes IV
  • Caution: Precipitates acute withdrawal in opioid-dependent patients; may cause pulmonary oedema, hypertension, tachycardia, and cardiovascular collapse through sympathetic surge - use smallest effective dose to restore ventilation without fully reversing analgesia

Naltrexone

  • Oral long-acting opioid antagonist; used in opioid dependence treatment and alcohol use disorder
  • High receptor affinity; duration ~24 hours

Methylnaltrexone / Naloxegol / Alvimopan

  • Peripherally restricted (do not cross the blood-brain barrier)
  • Reverse peripheral opioid effects (constipation, urinary retention) without reversing central analgesia

6. Opioids in Special Situations (3 marks)

Renal Failure

  • Morphine: Avoid or use with extreme caution - M6G accumulates and causes prolonged respiratory depression and loss of consciousness
  • Meperidine (pethidine): Avoid - normeperidine accumulation causes seizures
  • Fentanyl, alfentanil, sufentanil: Preferred; no significant active metabolite accumulation
  • Remifentanil: Ideal; esterase metabolism unaffected by renal function (Morgan & Mikhail, p. 1270)

Hepatic Failure

  • Morphine clearance reduced; accumulation likely
  • Fentanyl and sufentanil: high hepatic extraction ratio - clearance may be reduced in severe liver disease
  • Remifentanil: extrahepatic metabolism - unaffected by hepatic failure

Opioid-Dependent Patients and the Opioid Epidemic

  • Patients on long-term opioids have significantly higher intraoperative requirements
  • Pre-emptive multimodal analgesia with regional techniques, ketamine, NSAIDs, and gabapentinoids is essential
  • Abrupt opioid cessation perioperatively risks acute withdrawal; continue or convert baseline doses
  • Buprenorphine: partially agonises and blocks mu-receptors; if discontinued pre-operatively, patients lose tolerance protection; if continued, higher opioid doses needed intraoperatively

Obstetrics

  • Morphine and pethidine cross the placenta → neonatal respiratory depression
  • Fentanyl used intrathecally (typically 15-25 mcg) for spinal analgesia; neuraxial opioids preferred as they minimise systemic transfer
  • Remifentanil patient-controlled analgesia used in labour as alternative to epidural

Summary Table: Comparative Pharmacokinetics of Anaesthetic Opioids

DrugOnset (IV)DurationMetabolismActive MetaboliteContext-sensitive T½
Morphine3-5 min3-5 hrHepatic glucuronidationM6G (active!)Moderate increase
Fentanyl1-2 min30-60 minHepatic CYP3A4Norfentanyl (inactive)Increases markedly with infusion
Alfentanil<1 min10-20 minHepatic CYP3A4/3A5None activeModest increase
Sufentanil1-3 min30-60 minHepaticNone activeModerate increase
Remifentanil<1 min5-10 minPlasma/tissue esterasesNone active~2 min (constant)
Methadone5-10 min12-150 hrHepatic CYP2B6None activeN/A - oral dominant

Conclusion

Opioids in anaesthetic practice offer unparalleled analgesia by acting on mu, kappa, and delta GPCRs to reduce neuronal excitability and modulate pain at supraspinal, spinal, and peripheral levels. Their clinical utility must be balanced against their effects on the respiratory, GI, and CNS systems. Rational selection - choosing the opioid whose pharmacokinetic profile matches the surgical duration, adjusting for end-organ function, understanding tolerance and hyperalgesia, and employing antagonists judiciously - remains a core competency of postgraduate anaesthetic practice. The trend toward multimodal opioid-sparing techniques reflects growing recognition of these limitations, while the ongoing opioid epidemic highlights the broader societal consequences of this potent drug class.

Key References:
  • Miller's Anesthesia, 10th Edition (Elsevier, 2023) - Chapters 22 & 35
  • Barash, Cullen & Stoelting's Clinical Anesthesia, 9th Edition - Chapter 20
  • Morgan & Mikhail's Clinical Anesthesiology, 7th Edition - Chapter 11
  • Goodman & Gilman's Pharmacological Basis of Therapeutics - Chapter 23

Make it more intense with practical aspects and use and make a pdf

Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Running Command

ls -la /tmp/workspace/ 2>/dev/null && mkdir -p /tmp/workspace/opioids-exam

Writing File

~/opioids-exam/build_pdf.py

"""
Postgraduate Anaesthesia Exam Answer – Opioids (30 marks)
Built with ReportLab
"""

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY

# ── Output path ──────────────────────────────────────────────────────────────
OUT = "/tmp/workspace/opioids-exam/Opioids_PG_Anaesthesia_30marks.pdf"

# ── Colour palette ────────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#0D2B4E")
MID_BLUE    = colors.HexColor("#1A5276")
LIGHT_BLUE  = colors.HexColor("#D6EAF8")
ACCENT      = colors.HexColor("#C0392B")
PALE_GREY   = colors.HexColor("#F4F6F7")
MID_GREY    = colors.HexColor("#BDC3C7")
TBL_HEADER  = colors.HexColor("#1A5276")
TBL_ALT     = colors.HexColor("#EBF5FB")
WHITE       = colors.white
BLACK       = colors.black

# ── Document ──────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUT,
    pagesize=A4,
    leftMargin=2*cm, rightMargin=2*cm,
    topMargin=2.2*cm, bottomMargin=2.2*cm,
    title="Opioids – PG Anaesthesia Exam Answer",
    author="Orris AI",
    subject="Postgraduate Anaesthesia 30-mark Answer",
)

W = A4[0] - 4*cm   # usable width

# ── Styles ─────────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()

def PS(name, parent="Normal", **kw):
    return ParagraphStyle(name, parent=base[parent], **kw)

styles = {
    "cover_title": PS("cover_title", fontSize=26, fontName="Helvetica-Bold",
                      textColor=WHITE, alignment=TA_CENTER, leading=32),
    "cover_sub":   PS("cover_sub",   fontSize=13, fontName="Helvetica",
                      textColor=LIGHT_BLUE, alignment=TA_CENTER, leading=18),
    "cover_tag":   PS("cover_tag",   fontSize=10, fontName="Helvetica-Oblique",
                      textColor=MID_GREY, alignment=TA_CENTER),

    "h1":  PS("h1",  fontSize=13, fontName="Helvetica-Bold",
               textColor=WHITE, leading=18,
               spaceBefore=14, spaceAfter=4),
    "h2":  PS("h2",  fontSize=11, fontName="Helvetica-Bold",
               textColor=MID_BLUE, leading=15,
               spaceBefore=10, spaceAfter=3,
               borderPad=2),
    "h3":  PS("h3",  fontSize=10, fontName="Helvetica-Bold",
               textColor=ACCENT, leading=14,
               spaceBefore=7, spaceAfter=2),
    "body": PS("body", fontSize=9.5, fontName="Helvetica",
               leading=14, spaceBefore=3, spaceAfter=3,
               alignment=TA_JUSTIFY),
    "bullet": PS("bullet", fontSize=9.5, fontName="Helvetica",
                 leading=13, leftIndent=14, bulletIndent=4,
                 spaceBefore=2, spaceAfter=2, alignment=TA_JUSTIFY),
    "sub_bullet": PS("sub_bullet", fontSize=9, fontName="Helvetica",
                     leading=12, leftIndent=28, bulletIndent=18,
                     spaceBefore=1, spaceAfter=1),
    "clinical_box": PS("clinical_box", fontSize=9.2, fontName="Helvetica",
                        leading=14, leftIndent=8, rightIndent=8,
                        spaceBefore=2, spaceAfter=2,
                        textColor=DARK_BLUE, alignment=TA_JUSTIFY),
    "caption": PS("caption", fontSize=8, fontName="Helvetica-Oblique",
                  textColor=colors.HexColor("#7F8C8D"),
                  alignment=TA_CENTER, spaceBefore=2, spaceAfter=6),
    "ref":  PS("ref", fontSize=8, fontName="Helvetica-Oblique",
               textColor=colors.HexColor("#7F8C8D"),
               leading=11, spaceBefore=1),
    "mark_band": PS("mark_band", fontSize=9, fontName="Helvetica-Bold",
                    textColor=ACCENT, spaceBefore=0, spaceAfter=0),
}

# ── Helper flowables ───────────────────────────────────────────────────────────

def section_header(text, mark_hint=""):
    """Dark-blue banner for major section headings."""
    label = f"{text}  <font size='8' color='#{LIGHT_BLUE.hexval()[2:]}'>{mark_hint}</font>" if mark_hint else text
    tbl = Table([[Paragraph(label, styles["h1"])]], colWidths=[W])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
        ("ROWPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("BOX",        (0,0), (-1,-1), 0.5, MID_BLUE),
    ]))
    return tbl

def sub_header(text):
    return Paragraph(text, styles["h2"])

def h3(text):
    return Paragraph(text, styles["h3"])

def body(text):
    return Paragraph(text, styles["body"])

def bullet(text, level=1):
    s = styles["bullet"] if level == 1 else styles["sub_bullet"]
    return Paragraph(f"&#8226;&nbsp;{text}", s)

def spacer(h=4):
    return Spacer(1, h*mm)

def rule(color=MID_GREY, thickness=0.5):
    return HRFlowable(width="100%", thickness=thickness, color=color,
                      spaceAfter=3, spaceBefore=3)

def clinical_box(title, items):
    """Pale-blue inset box for clinical pearls / danger signs."""
    inner = []
    inner.append(Paragraph(f"<b>{title}</b>", styles["clinical_box"]))
    for i in items:
        inner.append(Paragraph(f"&#9658;&nbsp;{i}", styles["clinical_box"]))
    tbl = Table([[inner]], colWidths=[W - 8])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), LIGHT_BLUE),
        ("BOX",           (0,0), (-1,-1), 1.2, MID_BLUE),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ("RIGHTPADDING",  (0,0), (-1,-1), 8),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ]))
    return tbl

def danger_box(title, items):
    """Red-tinted warning box."""
    RED_LIGHT = colors.HexColor("#FADBD8")
    RED_BORDER = colors.HexColor("#C0392B")
    inner = []
    inner.append(Paragraph(f"<b>&#9888; {title}</b>",
                            ParagraphStyle("db", parent=styles["clinical_box"],
                                           textColor=RED_BORDER)))
    for i in items:
        inner.append(Paragraph(f"&#9679;&nbsp;{i}",
                                ParagraphStyle("dbi", parent=styles["clinical_box"],
                                               textColor=colors.HexColor("#641E16"))))
    tbl = Table([[inner]], colWidths=[W - 8])
    tbl.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), RED_LIGHT),
        ("BOX",           (0,0), (-1,-1), 1.5, RED_BORDER),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ("RIGHTPADDING",  (0,0), (-1,-1), 8),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ]))
    return tbl

def make_table(headers, rows, col_widths=None, alt=True):
    """Formatted data table."""
    if col_widths is None:
        col_widths = [W / len(headers)] * len(headers)

    header_style = ParagraphStyle("th", fontSize=9, fontName="Helvetica-Bold",
                                  textColor=WHITE, leading=12)
    cell_style   = ParagraphStyle("td", fontSize=8.5, fontName="Helvetica",
                                  textColor=DARK_BLUE, leading=12)

    data = [[Paragraph(h, header_style) for h in headers]]
    for ri, row in enumerate(rows):
        data.append([Paragraph(str(c), cell_style) for c in row])

    ts = [
        ("BACKGROUND",    (0,0), (-1,0),  TBL_HEADER),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, TBL_ALT] if alt else [WHITE]),
        ("GRID",          (0,0), (-1,-1), 0.4, MID_GREY),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("RIGHTPADDING",  (0,0), (-1,-1), 5),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ]
    t = Table(data, colWidths=col_widths)
    t.setStyle(TableStyle(ts))
    return t

# ═══════════════════════════════════════════════════════════════════════════════
# BUILD DOCUMENT
# ═══════════════════════════════════════════════════════════════════════════════
story = []

# ── COVER ─────────────────────────────────────────────────────────────────────
cover_bg = Table(
    [[Paragraph("OPIOIDS IN ANAESTHETIC PRACTICE", styles["cover_title"]),
      Paragraph("Postgraduate Anaesthesia Examination  •  30 Marks", styles["cover_sub"]),
      Spacer(1, 6*mm),
      Paragraph("Miller's Anesthesia 10e  •  Barash Clinical Anesthesia 9e  •  "
                "Morgan &amp; Mikhail 7e  •  Goodman &amp; Gilman", styles["cover_tag"]),
    ]],
    colWidths=[W]
)
# wrap in a single-cell table for background
wrapper = Table([[cover_bg]], colWidths=[W])
wrapper.setStyle(TableStyle([
    ("BACKGROUND",    (0,0),(-1,-1), DARK_BLUE),
    ("TOPPADDING",    (0,0),(-1,-1), 20),
    ("BOTTOMPADDING", (0,0),(-1,-1), 20),
    ("LEFTPADDING",   (0,0),(-1,-1), 10),
    ("RIGHTPADDING",  (0,0),(-1,-1), 10),
    ("BOX",           (0,0),(-1,-1), 2, MID_BLUE),
]))
story.append(wrapper)
story.append(spacer(8))

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 1 – OPIOID RECEPTORS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("1. OPIOID RECEPTORS & SIGNAL TRANSDUCTION", "[~5 marks]"))
story.append(spacer(3))

story.append(sub_header("1.1  Classification"))
story.append(body(
    "Opioid receptors are <b>7-transmembrane G protein-coupled receptors (GPCRs)</b> belonging to "
    "the class A (rhodopsin) subfamily, sharing 55–58% sequence homology. Four receptor subtypes "
    "exist: mu (μ), kappa (κ), delta (δ), and the nociceptin/orphanin FQ receptor (NOPr/ORL-1). "
    "The <b>mu receptor</b> mediates virtually all clinically important analgesia and adverse effects "
    "of currently used opioids."
))
story.append(spacer(3))

story.append(make_table(
    ["Receptor", "Endogenous Ligand", "Analgesia Site", "Key Effects", "Clinical Relevance"],
    [
        ["μ (Mu)", "β-Endorphin,\nEnkephalins", "Supraspinal +\nSpinal + Peripheral",
         "Analgesia, euphoria, resp. depression,\nmiosis, ↓GI motility, dependence",
         "Target of all clinical opioid analgesics"],
        ["κ (Kappa)", "Dynorphins", "Spinal", "Spinal analgesia, sedation,\ndysphoria, psychotomimesis",
         "Pentazocine, butorphanol; dysphoria\nlimits clinical use"],
        ["δ (Delta)", "Enkephalins", "Spinal + Peripheral", "Analgesia, mood modulation,\nreduced GI motility",
         "Modulates mu-receptor activity;\nnot yet clinical target"],
        ["NOPr/ORL-1", "Nociceptin\n(orphanin FQ)", "Supraspinal +\nSpinal", "Modulates pain,\nanxiety, stress response",
         "Cebranopadol (NOP/mu agonist)\nin development"],
    ],
    col_widths=[2.5*cm, 3*cm, 3*cm, 5*cm, 4.5*cm]
))
story.append(spacer(4))

story.append(sub_header("1.2  Signal Transduction Mechanism"))
story.append(body(
    "Opioid receptor activation couples to pertussis toxin-sensitive <b>G<sub>i</sub>/G<sub>o</sub> "
    "proteins</b>. The downstream cascade produces:"
))
for b_text in [
    "<b>Inhibition of adenylate cyclase</b> → reduced intracellular cAMP → decreased PKA activity",
    "<b>Inhibition of voltage-gated Ca²⁺ channels</b> → reduced neurotransmitter release at pre-synaptic terminals",
    "<b>Activation of inwardly rectifying K⁺ channels (GIRK)</b> → membrane hyperpolarisation → reduced neuronal firing",
    "Activation of MAP kinase pathways (ERK, JNK) → gene expression changes; linked to long-term tolerance",
]:
    story.append(bullet(b_text))

story.append(body(
    "Net result: <b>reduction in neuronal excitability</b> at supraspinal (PAG, RVM), spinal (dorsal horn), "
    "and peripheral (sensory afferents) levels, interrupting the pain transmission arc."
))
story.append(spacer(2))

story.append(clinical_box("Practical Point: Tolerance Mechanism", [
    "Long-term opioid exposure → superactivation of adenylyl cyclase (counterregulatory cAMP upregulation) "
    "→ acute withdrawal hyperactivation; explains withdrawal syndrome and dose escalation",
    "Receptor internalisation, G-protein uncoupling, and NMDA system sensitisation all contribute to tolerance",
]))
story.append(spacer(4))

story.append(sub_header("1.3  Endogenous Opioid Peptides"))
story.append(make_table(
    ["Precursor", "Key Peptides", "Receptor Preference", "CNS Locations"],
    [
        ["Preproenkephalin",  "Met-enkephalin, Leu-enkephalin", "δ > μ",  "Dorsal horn, limbic system, striatum"],
        ["Preprodynorphin",   "Dynorphin A & B, neo-endorphins", "κ",     "Spinal cord, hypothalamus, hippocampus"],
        ["POMC",              "β-Endorphin (+ ACTH, MSH)",      "μ",      "Hypothalamus, PAG, pituitary, limbic"],
    ],
    col_widths=[4*cm, 4.5*cm, 3.5*cm, 6*cm]
))
story.append(spacer(6))

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 2 – INDIVIDUAL AGENTS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("2. INDIVIDUAL OPIOID AGENTS: PHARMACOKINETICS & CLINICAL USE", "[~8 marks]"))
story.append(spacer(3))

story.append(sub_header("2.1  Comparative Pharmacokinetics Table"))
story.append(make_table(
    ["Drug", "Relative\nPotency", "Onset\n(IV)", "Duration", "Vd (L/kg)", "Protein\nBinding",
     "Metabolism", "Active\nMetabolite", "CSHT*"],
    [
        ["Morphine",     "1×",    "3–5 min",  "3–5 h",  "3–4",    "35%", "Hepatic glucuronidation\n(UGT2B7)", "M6G ⚠", "Moderate ↑"],
        ["Fentanyl",     "100×",  "1–2 min",  "30–60 min","4–6",  "84%", "Hepatic CYP3A4",         "Norfentanyl (inactive)", "Markedly ↑ with\nlong infusions"],
        ["Alfentanil",   "10–20×","<1 min",   "10–20 min","0.5",  "90%", "Hepatic CYP3A4/3A5",     "None active", "Modest ↑"],
        ["Sufentanil",   "500–1000×","1–3 min","30–60 min","2.5", "93%", "Hepatic CYP3A4",         "None active", "Moderate ↑"],
        ["Remifentanil", "100×",  "<1 min",   "5–10 min","0.4",  "70%", "Plasma/tissue esterases\n(non-hepatic)", "None",   "~2 min\n(CONSTANT)"],
        ["Methadone",    "~equal", "5–10 min", "12–150 h","3–8",  "85%", "Hepatic CYP2B6",         "None active", "N/A – oral"],
        ["Tramadol",     "~1/10", "15–30 min","4–6 h",  "3–4",    "20%", "Hepatic CYP2D6\n(prodrug)", "O-desmethyl (active)", "Moderate"],
    ],
    col_widths=[2.3*cm, 1.6*cm, 1.5*cm, 1.8*cm, 1.5*cm, 1.7*cm, 3.2*cm, 2.8*cm, 2.1*cm]
))
story.append(Paragraph("* CSHT = Context-Sensitive Half-Time (time for plasma concentration to fall 50% after stopping infusion)", styles["caption"]))
story.append(spacer(4))

story.append(sub_header("2.2  Morphine – Practical Considerations"))
for b_text in [
    "<b>Dose:</b> 0.05–0.1 mg/kg IV bolus; PCA: 1–2 mg bolus with 5–10 min lockout; infusion 0.5–5 mg/h",
    "<b>M6G accumulation:</b> Active full mu-agonist; renal failure → M6G builds up → profound, late-onset "
    "respiratory depression and loss of consciousness. Avoid in GFR &lt;30 mL/min",
    "<b>M3G:</b> No opioid activity but contributes to neuro-excitation (myoclonus, allodynia) in renal failure",
    "<b>Histamine release:</b> Direct mast cell degranulation (not IgE) → flushing, urticaria, hypotension, "
    "bronchospasm; minimised by slow IV injection",
    "<b>Biliary effects:</b> Sphincter of Oddi spasm – can worsen biliary colic and complicate ERCP; glucagon "
    "or naloxone can relieve this",
    "<b>Neuraxial use:</b> Intrathecal 0.1–0.3 mg; epidural 2–5 mg; delayed respiratory depression up to 24 h "
    "due to rostral CSF spread – requires prolonged monitoring",
]:
    story.append(bullet(b_text))
story.append(spacer(3))

story.append(danger_box("Morphine in Renal Failure", [
    "Morphine-6-glucuronide (M6G) accumulates rapidly when GFR <30 mL/min",
    "Can cause delayed loss of consciousness and respiratory arrest many hours after last dose",
    "Preferred alternatives: fentanyl, alfentanil, remifentanil (Morgan & Mikhail, p.1270)"
]))
story.append(spacer(4))

story.append(sub_header("2.3  Fentanyl – Practical Considerations"))
for b_text in [
    "<b>Induction supplementation:</b> 1–3 mcg/kg IV; attenuates haemodynamic response to laryngoscopy",
    "<b>Infusion (TIVA/balanced):</b> 1–5 mcg/kg/h; for cardiac surgery 50–100 mcg/kg total dose",
    "<b>Context-sensitive half-time warning:</b> After a 4-hour fentanyl infusion, the CSHT may be >200 min "
    "– plan postoperative analgesia accordingly and anticipate residual effect",
    "<b>Transdermal (Duragesic):</b> 25–100 mcg/h patches; 12–16 h to steady state; reservoir in skin – "
    "concentration continues rising for 24 h after removal",
    "<b>Neuraxial:</b> Intrathecal 10–25 mcg with local anaesthetic enhances block quality; epidural 1–2 mcg/mL "
    "in infusion; lipophilic → primarily spinal (not rostral spread); minimal delayed resp. depression",
    "<b>MAC reduction:</b> 1.67 ng/mL plasma concentration reduces isoflurane MAC by ~50%; ceiling effect – "
    "cannot replace volatile agent entirely",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("2.4  Remifentanil – Practical Considerations"))
for b_text in [
    "<b>Mechanism unique:</b> Methyl ester side-chain hydrolysed by <b>non-specific tissue and plasma "
    "esterases</b>; clearance 3–5 L/min (exceeds liver blood flow) – unaffected by renal or hepatic failure",
    "<b>CSHT ~2 min regardless of infusion duration</b> – the only opioid with this property; permits precise "
    "titration and rapid offset",
    "<b>TCI dosing (Minto model):</b> Induction 4–8 ng/mL effect-site; maintenance 2–6 ng/mL; "
    "spontaneous ventilation procedures 1–2 ng/mL",
    "<b>Weight-based:</b> Induction 0.5–1 mcg/kg over 30–60 sec; infusion 0.05–2 mcg/kg/min",
    "<b>Abrupt offset:</b> Pain scores spike within minutes of stopping – <b>must pre-empt with morphine "
    "(0.1–0.15 mg/kg) or other long-acting analgesic 20–30 min before end of surgery</b>",
    "<b>OIH risk:</b> High-dose remifentanil infusions (>0.3 mcg/kg/min) associated with post-operative "
    "hyperalgesia; co-administration of ketamine 0.25–0.5 mg/kg attenuates this",
    "<b>Cannot be given intrathecally or epidurally</b> – contains glycine (inhibitory neurotransmitter) "
    "as diluent → potential neurotoxicity",
    "<b>Muscle rigidity:</b> Rapid boluses of remifentanil cause thoracic rigidity; inject slowly or "
    "use neuromuscular blockade",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("2.5  Alfentanil & Sufentanil"))
story.append(body("<b>Alfentanil:</b>"))
for b_text in [
    "Low Vd + high protein binding → rapid equilibration with effect site; t½ke0 ~1 min",
    "Useful for short procedures; supplement for laryngoscopy: 10–20 mcg/kg; infusion 0.5–3 mcg/kg/min",
    "CYP3A4/3A5 metabolism → large interindividual variability; CYP3A inhibitors (erythromycin, azoles) "
    "dramatically prolong effect",
]:
    story.append(bullet(b_text))
story.append(body("<b>Sufentanil:</b>"))
for b_text in [
    "5–10× more potent than fentanyl; high mu-receptor selectivity",
    "Preferred for cardiac anaesthesia high-dose technique and neuraxial use (intrathecal 2.5–10 mcg)",
    "Haemodynamic stability; minimal histamine release; may be more analgesic in some patient subsets "
    "due to higher receptor affinity",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("2.6  Methadone"))
for b_text in [
    "Dual mechanism: <b>full mu-agonist + NMDA receptor antagonist</b> (useful for neuropathic pain and OIH prevention)",
    "Oral bioavailability 60–95%; active as perioperative IV analgesic (single intraoperative dose 0.1–0.3 mg/kg)",
    "<b>Long and unpredictable half-life (24–150 h)</b> – methadone-associated deaths from respiratory depression "
    "typically occur 3–5 days after starting or increasing dose",
    "<b>QTc prolongation</b> – risk of torsades de pointes, especially >100 mg/day oral or IV; ECG monitoring mandatory; "
    "avoid other QT-prolonging drugs",
    "CYP2B6 metabolism – significant drug interactions (e.g., rifampicin accelerates clearance → withdrawal)",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("2.7  Buprenorphine"))
for b_text in [
    "<b>Partial mu-agonist / kappa-antagonist</b>: ceiling effect on respiratory depression at high doses; "
    "ceiling effect on analgesia limits utility in severe acute pain",
    "Very high mu-receptor affinity (>morphine): may require 10–40× usual naloxone doses for reversal; "
    "standard doses ineffective",
    "Half-life 24–72 h; used for opioid use disorder (Suboxone = buprenorphine + naloxone)",
    "<b>Perioperative management:</b> Continue buprenorphine rather than stopping; supplement with higher "
    "doses of full mu-agonists for breakthrough pain intraoperatively",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("2.8  Codeine, Tramadol, Pethidine"))
story.append(make_table(
    ["Drug", "Mechanism", "Key Practical Points", "Avoid When"],
    [
        ["Codeine",   "Prodrug → morphine\nvia CYP2D6",
         "~10% of Caucasians are poor metabolisers (no effect);\nultra-rapid metabolisers at risk of toxicity;\nbanned post-tonsillectomy in children <18",
         "Paediatric airway surgery; CYP2D6 poor metabolisers;\nrenal failure (morphine metabolite accumulation)"],
        ["Tramadol",  "Weak μ-agonist +\nSNRI",
         "Dose: 1–2 mg/kg PO/IV; lowers seizure threshold;\nrisk of serotonin syndrome with SSRIs/MAOIs;\nnausea common (20–30%)",
         "Epilepsy; concurrent serotonergic drugs;\n<12 years (post-tonsillectomy)"],
        ["Pethidine\n(Meperidine)", "μ-agonist",
         "Metabolite norpethidine: neuro-excitatory (seizures,\nmyoclonus); accumulates in renal failure;\nused for post-op shivering 0.35 mg/kg IV",
         "Renal failure; concurrent MAOIs (hypertensive crisis);\n>72 h continuous use"],
    ],
    col_widths=[2.5*cm, 3.5*cm, 7.5*cm, 5*cm]
))
story.append(spacer(6))

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 3 – SYSTEMIC EFFECTS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("3. PHARMACOLOGICAL EFFECTS BY SYSTEM", "[~5 marks]"))
story.append(spacer(3))

story.append(sub_header("3.1  Respiratory System – The Critical System"))
story.append(body(
    "Respiratory depression is the most feared consequence of opioid use and the primary cause of "
    "opioid-related mortality. Opioids act on mu-receptors in the pre-Bötzinger complex (respiratory "
    "rhythm generator) and parabrachial nucleus."
))
story.append(spacer(2))

story.append(make_table(
    ["Effect", "Mechanism", "Clinical Implication"],
    [
        ["↓ Respiratory rate\n(dominant effect)", "Direct depression of brainstem respiratory neurons;\nblunted CO₂ ventilatory response curve",
         "PaCO₂ rises; response curve shifts right\nand decreases in slope"],
        ["Apnoea (rapid bolus)", "No time for CO₂ accumulation to stimulate\ncompensation; pre-Bötzinger neurons silenced",
         "Remifentanil/fentanyl rapid bolus;\nalways have airway equipment ready"],
        ["Thoracic rigidity\n('wooden chest')", "High-dose synthetic opioids → pharyngeal\nand thoracoabdominal muscle rigidity",
         "Manage: succinylcholine, NMBD,\nor small-dose naloxone (40 mcg IV)"],
        ["Upper airway\nobstruction", "Loss of upper airway tone (brainstem\nneurons + sedation); impaired arousal reflex",
         "Central + obstructive apnoeas;\nPulse oximetry on supplemental O₂\nmasks hypoventilation – monitor ETCO₂"],
        ["OIH hyperventilation", "Paradoxical pain sensitisation",
         "Seen after high-dose remifentanil;\ncountered with ketamine"],
    ],
    col_widths=[3*cm, 6*cm, 9*cm]
))
story.append(spacer(3))

story.append(danger_box("Monitoring Caution – Supplemental Oxygen", [
    "Pulse oximetry + supplemental O₂ masks early hypoventilation – SpO₂ may remain >95% despite PaCO₂ >80 mmHg",
    "MANDATORY: end-tidal CO₂ monitoring for all patients on opioid infusions in recovery or HDU",
    "Capnography is the only bedside monitor that detects opioid-induced hypoventilation before desaturation (Barash 9e, p.1568)"
]))
story.append(spacer(4))

story.append(sub_header("3.2  Cardiovascular System"))
for b_text in [
    "<b>Bradycardia:</b> Central vagal stimulation – morphine and fentanyl; profound with high-dose fentanyl "
    "(>10 mcg/kg); treat with atropine or glycopyrrolate",
    "<b>Vasodilation:</b> Morphine directly degranulates mast cells → histamine release → peripheral "
    "vasodilation, hypotension; fentanyl/remifentanil have minimal histamine effect",
    "<b>High-dose opioid anaesthesia:</b> 50–100 mcg/kg fentanyl provides haemodynamic stability in "
    "cardiac surgery (blunts sympathetic response to sternotomy); still requires supplemental volatile "
    "or propofol as opioids have a ceiling on MAC reduction",
    "<b>Methadone QTc:</b> Dose-dependent hERG channel block → torsades; ECG pre-operatively for all "
    "patients on >40 mg/day oral methadone",
    "<b>Intracranial effects:</b> Opioids do not directly increase ICP in normoventilated patients; "
    "respiratory depression → hypercapnia → cerebral vasodilation → ↑ICP; maintain PaCO₂ 35–40 mmHg",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("3.3  CNS Effects"))
for b_text in [
    "<b>Analgesia:</b> Supraspinal (PAG → RVM descending inhibition), spinal (Rexed lamina I, II – "
    "direct inhibition of substantia gelatinosa), peripheral (inflammatory states – immune cell "
    "β-endorphin release)",
    "<b>Miosis:</b> Stimulation of Edinger-Westphal nucleus; does not habituate with tolerance; "
    "useful clinical sign of opioid effect; bilateral fixed miosis with pinpoint pupils = opioid toxidrome",
    "<b>Nausea/Vomiting:</b> CTZ stimulation (area postrema, lacks blood-brain barrier) + vestibular "
    "sensitisation; worsened by movement; first-line: ondansetron, cyclizine; second-line: haloperidol",
    "<b>Sedation:</b> ↓ cortical ACh (morphine injection into substantia innominata reduces prefrontal ACh); "
    "reduces awareness but cannot provide complete anaesthesia",
    "<b>Euphoria/Dysphoria:</b> Mu → mesolimbic dopamine release → euphoria/reward (basis of addiction); "
    "Kappa → dysphoria (limits clinical utility of kappa agonists)",
    "<b>Sleep architecture:</b> ↓ slow-wave sleep, ↓ REM, ↑ stage 2; central sleep apnoea prevalence "
    "~24% in chronic opioid users",
    "<b>Antitussive:</b> Suppression of medullary cough centre; codeine classically used",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("3.4  Gastrointestinal System"))
for b_text in [
    "<b>Constipation:</b> Peripheral μ-receptors in enteric nervous system → ↓ peristalsis, ↑ segmental "
    "tone, ↓ intestinal secretions; <b>does NOT habituate with tolerance</b> – co-prescribe laxatives "
    "from day one of opioid therapy",
    "<b>Postoperative ileus (POI):</b> Opioids delay return of GI function after abdominal surgery; "
    "opioid-sparing techniques (epidural, regional, NSAIDs) reduce POI duration",
    "<b>Sphincter of Oddi spasm:</b> ↑ biliary pressure; morphine > fentanyl; can masquerade as "
    "biliary colic; glucagon 1 mg IV or naloxone reverses this",
    "<b>Delayed gastric emptying:</b> ↑ aspiration risk; relevant to emergency cases, labour analgesia, "
    "and patients on long-term opioids",
    "<b>Treatment for opioid-induced constipation:</b> methylnaltrexone (SC), naloxegol, or naldemedine – "
    "peripherally restricted antagonists; do not reverse central analgesia",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("3.5  Urinary & Endocrine Effects"))
for b_text in [
    "<b>Urinary retention:</b> ↑ urinary sphincter tone + ↓ detrusor contraction; especially with "
    "neuraxial opioids; treat with naloxone 40–80 mcg IV or bethanechol",
    "<b>HPG axis suppression (chronic use):</b> ↓ GnRH → ↓ LH, FSH → ↓ testosterone/oestrogen; "
    "opioid-induced hypogonadism; sexual dysfunction and osteoporosis in chronic pain patients",
    "<b>Antidiuretic effect:</b> ADH release potentiated (morphine); rare clinical significance",
    "<b>Immunosuppression:</b> Mu-receptor-mediated ↓ NK cell activity, impaired T-lymphocyte function; "
    "relevance in cancer pain management and high-dose perioperative opioids",
]:
    story.append(bullet(b_text))
story.append(spacer(6))

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 4 – TOLERANCE, OIH, SPECIAL POPULATIONS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("4. TOLERANCE, OIH, & GENETIC VARIATION", "[~4 marks]"))
story.append(spacer(3))

story.append(sub_header("4.1  Opioid Tolerance"))
story.append(body(
    "Tolerance is the requirement for increasing doses to produce the same effect. Several mechanisms operate "
    "at different timescales:"
))
story.append(make_table(
    ["Mechanism", "Time-course", "Clinical Significance"],
    [
        ["Receptor internalisation\n& downregulation", "Hours–days",
         "Reduced receptor availability; opioid rotation exploits incomplete cross-tolerance"],
        ["G-protein uncoupling\n(desensitisation)", "Minutes–hours",
         "Acute tolerance; relevant to intraoperative remifentanil"],
        ["cAMP superactivation\n(adenylyl cyclase upregulation)", "Days–weeks",
         "Physical dependence; withdrawal if stopped abruptly;\ndo not abruptly stop perioperatively"],
        ["NMDA receptor\nsensitisation", "Hours–days",
         "Contributes to both tolerance and OIH;\nketamine (0.25–0.5 mg/kg) attenuates"],
        ["Neuroinflammation\n(CXCL1/CXCL12 chemokines)", "Days–weeks",
         "Spinal glial cell activation; emerging target "
         "for adjunctive anti-neuroinflammatory treatment"],
    ],
    col_widths=[4.5*cm, 3*cm, 10.5*cm]
))
story.append(spacer(3))

story.append(clinical_box("Practical: Acute Opioid Tolerance (AOT) in Theatre", [
    "Remifentanil 0.3 mcg/kg/min (vs 0.1 mcg/kg/min) → significantly higher postoperative morphine requirements "
    "and pain scores (Miller's Anesthesia 10e, p.2744–2745)",
    "Strategy: use lowest effective remifentanil rate; add ketamine 0.25–0.5 mg/kg IV intraoperatively; "
    "give long-acting opioid (morphine 0.1 mg/kg) 20–30 min before emergence",
    "Propofol-based TIVA may attenuate remifentanil-induced OIH compared to sevoflurane (Miller 10e, p.2742)",
]))
story.append(spacer(4))

story.append(sub_header("4.2  Opioid-Induced Hyperalgesia (OIH)"))
story.append(body(
    "OIH is a paradoxical state where opioid treatment <b>increases</b> sensitivity to painful stimuli, distinct "
    "from tolerance (where analgesic effect diminishes). Patients become more sensitive to nociceptive stimuli, "
    "not just less opioid-responsive."
))
for b_text in [
    "<b>Mechanisms:</b> NMDA receptor sensitisation (spinal), spinal dynorphin upregulation → enhanced "
    "pronociceptive transmitter release, descending pain facilitatory pathway activation",
    "<b>Triggers:</b> High-dose remifentanil infusions most studied; all potent opioids capable; "
    "dose-dependent relationship established",
    "<b>Clinical clue:</b> Patient on opioid infusion complaining of diffuse hyperalgesia/allodynia beyond "
    "the surgical site; paradoxically worsened by opioid dose increase",
    "<b>Long-term consequence:</b> Intraoperative remifentanil dose predicts chronic thoracic pain at "
    "1 year after cardiac surgery; OIH links to development of chronic post-surgical pain",
]:
    story.append(bullet(b_text))
story.append(spacer(2))

story.append(make_table(
    ["Intervention", "Mechanism", "Evidence"],
    [
        ["Ketamine 0.25–0.5 mg/kg IV ±\ninfusion 0.1–0.2 mg/kg/h", "NMDA antagonist",
         "Prevents AOT and reduces OIH in RCTs; best evidence base (Miller 10e, p.2744)"],
        ["Magnesium sulfate 30 mg/kg\nat induction + 10 mg/kg/h", "NMDA antagonism\n(Mg blocks channel)",
         "RCT in thyroidectomy: prevented remifentanil-induced hyperalgesia"],
        ["Low-dose naloxone\n0.05 mcg/kg/h IV", "μ-receptor modulation\n(paradoxical anti-OIH)", "Reduced OIH after remifentanil 4 ng/mL in thyroid surgery"],
        ["COX-2 inhibitor\n(parecoxib)", "Blocks COX-2 in OIH pathway", "Prevented hyperalgesia after 30-min remifentanil infusion"],
        ["Propofol TIVA\n(vs sevoflurane)", "Unclear; possibly\npropofol's effects on\nspinal sensitisation", "Significantly less OIH vs sevoflurane in breast cancer surgery (Miller 10e, p.2742)"],
    ],
    col_widths=[4.5*cm, 4*cm, 9.5*cm]
))
story.append(spacer(4))

story.append(sub_header("4.3  Pharmacogenomics – A118G Polymorphism"))
story.append(body(
    "The <b>A118G SNP</b> of the OPRM1 gene (μ-opioid receptor) is the most clinically important "
    "pharmacogenetic variant in anaesthesia:"
))
for b_text in [
    "A-to-G substitution in exon 1 → asparagine to aspartate at position 40 (N40D)",
    "Meta-analysis of >4,600 patients: <b>A118G carriers require significantly higher opioid doses</b> "
    "postoperatively (Miller 10e, p.2681–82)",
    "Reduces analgesic response to M6G but does not significantly attenuate M6G-induced "
    "respiratory depression – clinically important dissociation",
    "Associated with susceptibility to opioid dependence/addiction in Asian populations (meta-analysis)",
    "Practical implication: do not dismiss inadequate analgesia as 'behavioural' – pharmacogenetics "
    "may explain higher requirements; titrate to effect",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("4.4  CYP2D6 Polymorphism – Codeine"))
story.append(make_table(
    ["Phenotype", "Frequency", "Clinical Impact"],
    [
        ["Poor metaboliser (PM)", "7–10% Caucasians", "No analgesia from codeine; frustration + dose escalation"],
        ["Ultra-rapid metaboliser (UM)", "1–3%; higher in NE Africa/Middle East", "Excessive morphine production → overdose, neonatal death (breastfeeding UM mothers)"],
        ["Normal metaboliser", "~85% population", "Expected analgesic response"],
    ],
    col_widths=[4*cm, 4*cm, 10*cm]
))
story.append(Paragraph("FDA/EMA: codeine contraindicated post-tonsillectomy/adenoidectomy in children <18 years", styles["caption"]))
story.append(spacer(6))

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 5 – ANTAGONISTS & REVERSAL
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("5. OPIOID ANTAGONISTS & REVERSAL", "[~3 marks]"))
story.append(spacer(3))

story.append(sub_header("5.1  Naloxone – Practical Reversal"))
for b_text in [
    "<b>Mechanism:</b> Pure competitive antagonist at μ, κ, δ receptors; highest affinity for μ",
    "<b>Dose:</b> Titrated 40 mcg IV increments every 2–3 min until adequate respiratory rate "
    "(>12 breaths/min) – goal is to restore ventilation, NOT fully reverse analgesia",
    "<b>Onset:</b> 1–2 min IV; <b>Duration:</b> 30–90 min",
    "<b>Re-narcotisation warning:</b> ALL clinical opioids outlast naloxone; patient must be observed "
    "for ≥2 h after reversal; infusion 2/3 of effective bolus dose per hour may be needed for "
    "long-acting opioids (e.g., sustained-release morphine, methadone)",
    "<b>Precipitation of acute withdrawal:</b> Massive sympathetic surge → hypertension, pulmonary "
    "oedema, VF, cardiac arrest – dose carefully in opioid-dependent patients",
    "<b>Buprenorphine reversal:</b> High receptor affinity means standard naloxone doses insufficient; "
    "use 10–40× normal doses (400 mcg–4 mg); may need naloxone infusion",
]:
    story.append(bullet(b_text))
story.append(spacer(3))

story.append(clinical_box("Naloxone Infusion Protocol", [
    "Calculate bolus dose required for effect, then give 2/3 of that dose as hourly infusion",
    "Dilute in 0.9% saline or 5% dextrose; typical infusion 0.4–2 mg/h for morphine overdose",
    "Monitor respiratory rate, consciousness, and pain score – re-emergence of pain is a sign of adequate reversal"
]))
story.append(spacer(4))

story.append(sub_header("5.2  Peripherally Restricted Antagonists"))
story.append(make_table(
    ["Drug", "Route", "Indication", "Dose", "Note"],
    [
        ["Methylnaltrexone", "SC", "Opioid-induced constipation\nin palliative care/chronic pain",
         "Weight-based: 8–12 mg SC\nevery other day", "Does NOT cross BBB; preserves central analgesia"],
        ["Naloxegol", "Oral", "OIC in chronic pain (non-cancer)", "25 mg OD",
         "Pegylated naloxol; FDA-approved; CYP3A4 substrate"],
        ["Alvimopan", "Oral", "Post-operative ileus prevention", "12 mg pre-op\n+ 12 mg BD ×7d",
         "Hospital use only; accelerates GI recovery after bowel surgery"],
        ["Naldemedine", "Oral", "OIC in chronic opioid use", "0.2 mg OD",
         "Most recent; good tolerability profile"],
    ],
    col_widths=[3*cm, 1.5*cm, 4.5*cm, 3.5*cm, 5.5*cm]
))
story.append(spacer(6))

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 6 – SPECIAL SITUATIONS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("6. OPIOIDS IN SPECIAL CLINICAL SITUATIONS", "[~5 marks]"))
story.append(spacer(3))

story.append(sub_header("6.1  Renal Failure"))
story.append(make_table(
    ["Opioid", "Renal Risk", "Recommendation"],
    [
        ["Morphine", "M6G & M3G accumulate → delayed resp. depression, LOC,\nneurological excitation; AVOID GFR <30",
         "Use fentanyl or remifentanil instead;\nif morphine must be used: reduce dose, extend intervals"],
        ["Pethidine", "Norpethidine accumulates → seizures, dysphoria,\nmyoclonus; half-life 14–48 h in renal failure",
         "AVOID completely in renal impairment;\ndo not use >48–72 h even in normal renal function"],
        ["Fentanyl", "Norfentanyl (inactive); moderate ↑ CSHT with\nprolonged infusions but no active metabolites",
         "Preferred agent for moderate-severe renal impairment;\nmonitor CSHT closely with infusions >2–3 h"],
        ["Remifentanil", "Esterase-mediated; completely unaffected by\nrenal (or hepatic) function",
         "First choice for infusions in renal failure;\nremember pre-emptive postoperative analgesia"],
        ["Alfentanil", "Minor renal excretion; minimal accumulation",
         "Acceptable choice; use with caution in\nGFR <10 mL/min"],
        ["Tramadol", "Active metabolite O-desmethyltramadol accumulates;\nrisk of seizures and serotonin syndrome",
         "REDUCE dose by 50% and extend to 12-hourly;\nAVOID if GFR <30 mL/min"],
    ],
    col_widths=[2.8*cm, 7.5*cm, 7.7*cm]
))
story.append(spacer(4))

story.append(sub_header("6.2  Hepatic Failure"))
for b_text in [
    "All hepatically-metabolised opioids (morphine, fentanyl, sufentanil, alfentanil) have reduced "
    "clearance in severe hepatic failure → prolonged effect; fentanyl and sufentanil's high extraction "
    "ratios may actually be maintained if residual hepatic blood flow preserved",
    "<b>Remifentanil:</b> Extrahepatic esterase metabolism completely unaffected by hepatic failure – "
    "ideal for critically ill patients with liver failure",
    "<b>Morphine:</b> ↓ glucuronidation capacity → ↑ bioavailability and t½; use with caution in Child-Pugh C",
    "Reduce protein binding: hypoalbuminaemia → ↑ free fraction → enhanced pharmacological effect "
    "even at 'normal' plasma concentrations",
    "Monitor for hepatic encephalopathy – opioids may precipitate or worsen encephalopathy in "
    "cirrhotic patients",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("6.3  Obstetrics"))
for b_text in [
    "All opioids cross the placenta via simple diffusion; ionisation and protein binding affect rate",
    "<b>Morphine/pethidine IM:</b> Avoid within 1–2 h of delivery; neonatal respiratory depression "
    "(treat with naloxone 0.01 mg/kg IM/IV to neonate)",
    "<b>Epidural opioids:</b> Fentanyl 50–100 mcg or sufentanil 10–20 mcg; lipophilic → minimal "
    "rostral spread; negligible systemic foetal transfer; combined spinal-epidural (CSE) technique "
    "for labour analgesia",
    "<b>Intrathecal:</b> Fentanyl 15–25 mcg or sufentanil 5 mcg added to local anaesthetic for spinal; "
    "enhances and extends block quality",
    "<b>Remifentanil PCA:</b> 0.2–0.4 mcg/kg bolus, 2 min lockout; effective labour analgesia "
    "alternative to epidural; requires 1:1 midwife ratio and SpO₂ monitoring – rapid onset/offset "
    "means apnoea risk at peak; MUST ensure bolus is patient-administered at contraction onset",
    "<b>GA for CS:</b> Fentanyl 1–2 mcg/kg acceptable at induction (neonatal effect transient); "
    "remifentanil 1 mcg/kg bolus blunts intubation response without prolonged neonatal effect",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("6.4  Paediatrics"))
for b_text in [
    "Neonates: ↑ BBB permeability, ↓ protein binding, ↓ hepatic metabolism → enhanced and prolonged "
    "effects; morphine infusions in NICU require careful dose adjustment",
    "Premature infants: immature respiratory centre → greater sensitivity to opioid-induced apnoea; "
    "monitor 12–24 h post-procedure",
    "Fentanyl dose: 1–4 mcg/kg IV (induction supplement); 0.5–2 mcg/kg/h infusion",
    "Codeine: CONTRAINDICATED in children <18 years post-tonsillectomy/adenoidectomy (FDA black box)",
    "Tramadol: contraindicated <12 years for routine pain; <18 years post-tonsillectomy",
]:
    story.append(bullet(b_text))
story.append(spacer(4))

story.append(sub_header("6.5  Opioid-Tolerant and Opioid-Dependent Patients"))
story.append(body(
    "This increasingly common perioperative scenario requires careful planning:"
))
for b_text in [
    "<b>Do NOT stop long-term opioids abruptly:</b> Acute withdrawal increases sympathetic activity, "
    "pain, and distress; convert oral opioid to IV equivalents perioperatively",
    "<b>Continue methadone at usual daily dose:</b> Methadone provides baseline opioid effect; "
    "supplement with additional mu-agonist for surgical pain; do NOT use agonist-antagonist "
    "drugs (pentazocine, nalbuphine) – will precipitate withdrawal",
    "<b>Buprenorphine patients:</b> Do not discontinue; supplement with high-dose full mu-agonists; "
    "titrate carefully as ceiling effect reduces respiratory depression safety margin when "
    "co-administering full agonists",
    "<b>Markedly increased intraoperative requirements:</b> Chronic users may need 3–5× normal dose; "
    "use regional techniques as primary modality wherever feasible",
    "<b>Multimodal opioid-sparing:</b> Regular paracetamol + NSAIDs + gabapentinoid + regional; "
    "reduces opioid requirements, risk of relapse, and facilitates discharge",
    "<b>Addiction medicine liaison:</b> Involve pre-operatively; brief intervention and referral "
    "at time of surgery may reduce long-term opioid prescribing",
]:
    story.append(bullet(b_text))
story.append(spacer(6))

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 7 – MULTIMODAL & OPIOID-SPARING
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("7. OPIOID-SPARING MULTIMODAL ANALGESIA & ERAS", "[Bonus context]"))
story.append(spacer(3))

story.append(body(
    "The opioid crisis and recognition of opioid adverse effects have driven the adoption of "
    "<b>opioid-sparing multimodal analgesia (MMA)</b> as the standard of care, codified in "
    "Enhanced Recovery After Surgery (ERAS) protocols."
))
story.append(spacer(3))

story.append(make_table(
    ["Agent / Technique", "Mechanism", "Opioid-Sparing Effect", "Practical Dose"],
    [
        ["Paracetamol (IV/PO)", "Central COX inhibition,\nendocannabinoid modulation",
         "15–20% opioid reduction", "1 g QDS (max 4 g/day;\n15 mg/kg if <50 kg)"],
        ["NSAIDs / COX-2 inhibitors", "Peripheral + central\nPG synthesis inhibition",
         "25–35% opioid reduction", "Ibuprofen 400 mg TDS;\nparecoxib 40 mg IV"],
        ["Ketamine", "NMDA antagonist;\nanti-OIH; anti-tolerance",
         "30–40% opioid reduction;\nparticularly in opioid-tolerant pts",
         "0.25–0.5 mg/kg IV sub-anaesthetic;\ninfusion 0.1–0.2 mg/kg/h"],
        ["Dexmedetomidine", "α2-agonist:\nspinal + supraspinal analgesia",
         "20–30% opioid reduction;\nminimal resp. depression",
         "0.2–0.7 mcg/kg/h infusion;\n0.5–1 mcg/kg loading dose"],
        ["Gabapentinoids\n(Pregabalin/Gabapentin)", "Voltage-gated Ca²⁺ channel\n(α2δ subunit) blockade",
         "20–30%; especially\nneuropathic pain component",
         "Pregabalin 75–150 mg BD;\ngabapentin 300 mg TDS"],
        ["Epidural (thoracic/lumbar)", "Local anaesthetic ± opioid;\ncentral neuroaxial block",
         "Near-complete in covered dermatomes;\nreduces POI, PONV, DVT",
         "0.125–0.25% bupivacaine +\nfentanyl 2 mcg/mL"],
        ["TAP / QL / ESP block", "Peripheral nerve block;\nsomatic trunk wall",
         "30–50% opioid reduction\nfor abdominal surgery",
         "Ropivacaine 0.2–0.375%\n20 mL each side"],
        ["Lidocaine infusion (IV)", "Systemic LA:\nspinal modulation,\nanti-inflammatory",
         "15–25%; reduces POI\nand chronic pain risk",
         "1.5 mg/kg bolus then\n1.5 mg/kg/h intraop"],
    ],
    col_widths=[3.5*cm, 3.5*cm, 4.5*cm, 6.5*cm]
))
story.append(spacer(6))

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 8 – NEURAXIAL OPIOIDS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("8. NEURAXIAL OPIOIDS – PRACTICAL GUIDE"))
story.append(spacer(3))

story.append(make_table(
    ["Drug", "IT Dose", "Epidural Dose", "Onset", "Duration", "Key Concern"],
    [
        ["Morphine",    "0.1–0.3 mg",      "2–5 mg",             "30–60 min", "12–24+ h",
         "Delayed resp. depression 6–24 h (rostral spread); 24 h monitoring mandatory"],
        ["Fentanyl",    "15–25 mcg",        "50–100 mcg bolus;\n1–2 mcg/mL infusion", "5–10 min", "2–4 h",
         "Lipophilic → minimal rostral spread; minimal delayed resp. depression"],
        ["Sufentanil",  "2.5–10 mcg",       "10–30 mcg bolus;\n0.5–1 mcg/mL infusion", "3–5 min",  "3–5 h",
         "Very lipophilic; same as fentanyl; enhanced sensory block"],
        ["Diamorphine", "0.2–0.4 mg",       "2–5 mg",             "15–30 min", "12–18 h",
         "Used in UK; intermediate lipophilicity; less rostral spread than morphine"],
        ["Hydromorphone","0.05–0.15 mg",    "1–1.5 mg",           "15–30 min", "10–20 h",
         "Moderate hydrophilicity; some delayed respiratory depression risk"],
    ],
    col_widths=[2.8*cm, 2.3*cm, 3.5*cm, 2*cm, 2*cm, 5.4*cm]
))
story.append(spacer(3))

story.append(danger_box("Neuraxial Morphine – Monitoring Requirements", [
    "Mandatory SpO₂ monitoring and respiratory rate observation every 1–2 h for 24 h post-IT morphine",
    "First respiratory depression episode may occur 6–12 h after injection when patient appears comfortable",
    "PONV is near-universal with neuraxial morphine – pre-emptive ondansetron 4–8 mg IV + dexamethasone 4–8 mg",
    "Urinary retention in ~30% of patients – insert urinary catheter or ensure easy access to catheterisation",
    "Have naloxone immediately available on ward; written reversal protocol must be in place",
]))
story.append(spacer(6))

# ══════════════════════════════════════════════════════════════════════════════
# CLOSING SUMMARY
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("SUMMARY & HIGH-YIELD EXAMINATION POINTS"))
story.append(spacer(3))

summary_points = [
    "Opioids act via Gi/Go-coupled GPCRs; μ-receptor mediates clinical analgesia AND adverse effects",
    "Remifentanil has a constant CSHT (~2 min) due to esterase hydrolysis; must pre-empt post-op pain",
    "Morphine is CONTRAINDICATED in severe renal failure due to M6G accumulation → delayed resp. depression",
    "Context-sensitive half-time of fentanyl increases markedly after prolonged infusions – plan recovery accordingly",
    "High-dose remifentanil (>0.3 mcg/kg/min) causes OIH → counter with ketamine 0.25–0.5 mg/kg IV",
    "Naloxone duration (30–90 min) is shorter than ALL clinical opioids → re-narcotisation is the rule, not the exception",
    "Buprenorphine requires 10–40× normal naloxone doses to reverse due to very high receptor affinity",
    "Codeine is a prodrug; AVOID in children <18 post-tonsillectomy; CYP2D6 genotype determines response",
    "A118G OPRM1 polymorphism → significantly higher opioid requirements; do not dismiss as behavioural",
    "Methadone: QTc prolongation → ECG all patients on >40 mg/day; drug interactions via CYP2B6 and CYP3A4",
    "Neuraxial morphine: 24 h monitoring mandatory; delayed resp. depression 6–12 h after IT injection",
    "Multimodal opioid-sparing (ERAS): paracetamol + NSAID + ketamine + regional reduces requirements 40–60%",
    "Supplemental oxygen on pulse oximetry MASKS opioid-induced hypoventilation – use capnography (ETCO₂)",
    "In opioid-dependent patients: NEVER use agonist-antagonists; continue methadone/buprenorphine perioperatively",
]

for i, pt in enumerate(summary_points, 1):
    story.append(Paragraph(f"<b>{i}.</b> {pt}", styles["bullet"]))

story.append(spacer(6))
story.append(rule(DARK_BLUE, 1))
story.append(spacer(3))

# References
story.append(sub_header("Key References"))
for ref in [
    "Miller RD et al. <i>Miller's Anesthesia</i>, 10th ed. (2023) — Chapters 22 (Opioid Pharmacology) & 35 (Pain)",
    "Barash PG et al. <i>Barash, Cullen & Stoelting's Clinical Anesthesia</i>, 9th ed. (2022) — Chapter 20 (Opioid PK/PD) & Chapter 55 (Perioperative Pain)",
    "Morgan GE, Mikhail MS. <i>Clinical Anesthesiology</i>, 7th ed. — Chapter 10 (Opioid Agonists & Antagonists)",
    "Brunton LL et al. <i>Goodman & Gilman's Pharmacological Basis of Therapeutics</i>, 14th ed. — Chapter 23 (Opioid Analgesics)",
    "Colvin LA, Bull F, Hales TG. Perioperative opioid analgesia — when is enough too much? <i>Lancet</i> 2019;393:1558–1568.",
]:
    story.append(Paragraph(ref, styles["ref"]))

story.append(spacer(4))
story.append(Paragraph(
    "Generated by Orris AI · Based on Miller's Anesthesia 10e, Barash 9e, Morgan &amp; Mikhail 7e, Goodman &amp; Gilman 14e",
    styles["caption"]
))

# ── Build ─────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF written to: {OUT}")
Running Command

cd /tmp/workspace/opioids-exam && python build_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/opioids-exam/Opioids_PG_Anaesthesia_30marks.pdf

Your PDF is ready - fully formatted, evidence-based, and loaded with practical anaesthesia content.

Opioids PG Anaesthesia 30marks

PDF Document · PDF


Here is what the PDF covers across 8 sections:
Section 1 - Receptors & Signal Transduction (~5 marks)
  • μ/κ/δ/NOPr receptor table with endogenous ligands, effects, and clinical relevance
  • Gi/Go signalling cascade (cAMP, K+ channels, Ca²+ channels), tolerance mechanisms
  • Endogenous peptide precursors (POMC, preproenkephalin, preprodynorphin)
Section 2 - Individual Agents (~8 marks)
  • Full comparative pharmacokinetics table (potency, Vd, protein binding, CSHT, metabolism, active metabolites)
  • Drug-by-drug: practical doses, intraop use, pitfalls (morphine in renal failure, fentanyl CSHT trap, remifentanil OIH/offset, alfentanil CYP variability, methadone QTc)
  • Danger boxes for morphine in renal failure and remifentanil acute tolerance
Section 3 - Systemic Effects (~5 marks)
  • Respiratory: pre-Bötzinger complex, wooden chest, capnography vs SpO₂ danger box, OIH
  • CVS: bradycardia, histamine release, high-dose cardiac technique, ICP effects
  • GI: enteric opioid receptors, Sphincter of Oddi, peripherally restricted antagonists
  • Urinary, endocrine, immunosuppression
Section 4 - Tolerance, OIH, Pharmacogenomics (~4 marks)
  • Five tolerance mechanisms table with clinical implications
  • OIH prevention table: ketamine, magnesium, COX-2 inhibitors, low-dose naloxone, propofol vs sevoflurane
  • A118G OPRM1 polymorphism and CYP2D6 codeine table
Section 5 - Antagonists (~3 marks)
  • Naloxone titration, re-narcotisation protocol, buprenorphine reversal doses
  • Peripherally restricted antagonists comparison table (methylnaltrexone, naloxegol, alvimopan)
Sections 6-8 - Special Situations, Multimodal Analgesia, Neuraxial Opioids (~5 marks)
  • Renal failure drug-by-drug table, obstetrics, paediatrics, opioid-dependent patients
  • ERAS/MMA opioid-sparing agents table with doses and % opioid reduction
  • Neuraxial opioids full comparison table + neuraxial morphine monitoring danger box
14 high-yield summary points for quick revision before the exam.
This is a shared conversation. Sign in to Orris to start your own chat.