Create a presentation on compete interpretation of Endometrial biopsy and PAPs reports

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

ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty"

Running Command

mkdir -p /home/daytona/workspace/endometrial-pap-pptx

Writing File

~/endometrial-pap-pptx/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE";
pres.title = "Interpretation of Endometrial Biopsy and Pap Smear Reports";
pres.author = "Orris Medical Education";

// ─── COLOR PALETTE ───────────────────────────────────────────────────────────
const C = {
  navy:    "0D1B3E",   // dominant dark
  teal:    "1A7A7A",   // accent 1
  coral:   "C84B31",   // accent 2 (warnings / abnormal)
  gold:    "D4A017",   // highlight
  white:   "FFFFFF",
  offwhite:"F4F6FA",
  ltgray:  "DDE3EC",
  midgray: "8898A8",
  green:   "1E6B3C",   // normal / benign
  amber:   "C87800",   // intermediate
  red:     "A01010",   // malignant
};

// ─── REUSABLE HELPERS ────────────────────────────────────────────────────────
function addDarkSlide(pres) {
  const s = pres.addSlide();
  s.background = { color: C.navy };
  return s;
}
function addLightSlide(pres) {
  const s = pres.addSlide();
  s.background = { color: C.offwhite };
  return s;
}
function sectionBanner(slide, text, y = 0) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y, w: 13.3, h: 0.55, fill: { color: C.teal } });
  slide.addText(text, { x: 0.2, y: y + 0.05, w: 13, h: 0.45, fontSize: 15, bold: true, color: C.white, valign: "middle" });
}
function bullet(text, level = 0, bold = false, color = C.navy) {
  return { text, options: { bullet: { type: "bullet" }, indentLevel: level, bold, color, fontSize: 14, breakLine: true } };
}
function subbullet(text, color = C.navy) {
  return bullet(text, 1, false, color);
}
function label(text, color = C.white) {
  return { text, options: { bold: true, color, fontSize: 13, breakLine: true } };
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addDarkSlide(pres);
  // Decorative left bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.35, h: 7.5, fill: { color: C.teal } });
  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 0, w: 0.12, h: 7.5, fill: { color: C.coral } });

  s.addText("Complete Interpretation of", {
    x: 0.7, y: 1.6, w: 12, h: 0.6, fontSize: 22, color: C.gold, bold: false, italic: true
  });
  s.addText("Endometrial Biopsy\n& Pap Smear Reports", {
    x: 0.7, y: 2.2, w: 12, h: 2.0, fontSize: 38, bold: true, color: C.white, valign: "top"
  });
  s.addShape(pres.ShapeType.rect, { x: 0.7, y: 4.35, w: 5.5, h: 0.05, fill: { color: C.coral } });
  s.addText("A Comprehensive Clinical Reference for Gynecologic Pathology Reporting", {
    x: 0.7, y: 4.5, w: 11, h: 0.5, fontSize: 13, color: C.ltgray, italic: true
  });
  s.addText("Sources: Pfenninger & Fowler's Procedures for Primary Care | Symptom to Diagnosis 4e | Bailey & Love's Surgery 28e\nCreasy & Resnik's Maternal-Fetal Medicine | Tietz Textbook of Laboratory Medicine 7e", {
    x: 0.7, y: 6.5, w: 11.5, h: 0.8, fontSize: 10, color: C.midgray, italic: true
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 2 — TABLE OF CONTENTS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "OVERVIEW");
  s.addText("What This Presentation Covers", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  const topics = [
    ["PART 1", "Endometrial Biopsy", "Indications, procedure, specimen adequacy, histologic findings, and management pathways"],
    ["PART 2", "Pap Smear / Cervical Cytology", "Bethesda 2001 classification, squamous & glandular abnormalities, HPV co-testing"],
    ["PART 3", "Management Algorithms", "Step-by-step clinical follow-up for each result category"],
    ["PART 4", "Special Populations", "Pregnancy, Lynch syndrome, postmenopausal women"],
    ["PART 5", "Screening Guidelines", "USPSTF 2018, ASCCP 2019 updated guidelines"],
  ];

  topics.forEach(([num, title, desc], i) => {
    const y = 1.3 + i * 1.1;
    s.addShape(pres.ShapeType.rect, { x: 0.4, y, w: 1.2, h: 0.9, fill: { color: C.teal }, line: { type: "none" } });
    s.addText(num, { x: 0.4, y: y + 0.1, w: 1.2, h: 0.7, fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addShape(pres.ShapeType.rect, { x: 1.65, y, w: 10.8, h: 0.9, fill: { color: C.ltgray }, line: { type: "none" } });
    s.addText(title, { x: 1.8, y: y + 0.05, w: 10.5, h: 0.35, fontSize: 14, bold: true, color: C.navy });
    s.addText(desc, { x: 1.8, y: y + 0.42, w: 10.5, h: 0.4, fontSize: 11, color: C.midgray, italic: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 3 — ENDOMETRIAL BIOPSY: OVERVIEW & INDICATIONS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 1 — ENDOMETRIAL BIOPSY");
  s.addText("Indications for Endometrial Biopsy", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  // Left column - indications
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 6.1, h: 5.9, fill: { color: C.ltgray }, line: { type: "none" } });
  s.addText("Clinical Indications", { x: 0.5, y: 1.3, w: 5.7, h: 0.4, fontSize: 14, bold: true, color: C.teal });
  s.addText([
    bullet("Suspected endometrial pathology (abnormal uterine bleeding)"),
    bullet("Women >45 y with failed medical treatment"),
    bullet("Persistent intermenstrual bleeding"),
    bullet("Postmenopausal endometrial thickness >4 mm on ultrasound"),
    bullet("Premenopausal endometrial thickness >7 mm with PCOS"),
    bullet("Unscheduled bleeding on HRT (after first 3 months)"),
    bullet("Lynch syndrome — annual screening from age 35"),
    bullet("HNPCC family history screening"),
  ], { x: 0.5, y: 1.75, w: 5.8, h: 5.2, fontSize: 12, color: C.navy, valign: "top" });

  // Right column - risk factors
  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 1.25, w: 6.2, h: 2.9, fill: { color: C.navy }, line: { type: "none" } });
  s.addText("Risk Factors for Hyperplasia/Cancer", { x: 6.9, y: 1.3, w: 5.8, h: 0.4, fontSize: 13, bold: true, color: C.gold });
  s.addText([
    bullet("Age >50 years", 0, false, C.white),
    bullet("Atypical endometrial hyperplasia", 0, false, C.white),
    bullet("Chronic anovulation / PCOS", 0, false, C.white),
    bullet("Obesity (>50 lbs overweight: 3x risk)", 0, false, C.white),
    bullet("Nulliparity, late menopause (>55 y)", 0, false, C.white),
    bullet("Unopposed estrogen therapy", 0, false, C.white),
    bullet("Tamoxifen therapy", 0, false, C.white),
    bullet("Diabetes mellitus", 0, false, C.white),
  ], { x: 6.9, y: 1.75, w: 5.8, h: 3.2, fontSize: 12, color: C.white, valign: "top" });

  // Contraindications
  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 4.25, w: 6.2, h: 2.9, fill: { color: "#2A1010" }, line: { type: "none" } });
  s.addText("Contraindications", { x: 6.9, y: 4.3, w: 5.8, h: 0.4, fontSize: 13, bold: true, color: C.coral });
  s.addText([
    { text: "ABSOLUTE:", options: { bold: true, color: C.coral, fontSize: 12, breakLine: true } },
    subbullet("Pregnancy", C.white),
    subbullet("Bleeding diathesis / coagulopathy", C.white),
    { text: "RELATIVE:", options: { bold: true, color: C.amber, fontSize: 12, breakLine: true } },
    subbullet("Anticoagulant therapy", C.white),
    subbullet("Active vaginal/cervical/uterine infection", C.white),
    subbullet("Cervical stenosis, morbid obesity", C.white),
    subbullet("Significant uterine prolapse", C.white),
  ], { x: 6.9, y: 4.75, w: 5.8, h: 3.0, fontSize: 12, color: C.white, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 4 — EMB PROCEDURE & INSTRUMENTS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 1 — ENDOMETRIAL BIOPSY");
  s.addText("Procedure & Equipment", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  // Step-by-step boxes
  const steps = [
    { n: "1", title: "Patient Prep", body: "Perform bimanual exam to determine uterine position. Apply povidone-iodine. Consider NSAID premedication for pain." },
    { n: "2", title: "Speculum Insertion", body: "Large Graves speculum inserted. Cervix visualized and cleansed. Single-tooth tenaculum applied if needed." },
    { n: "3", title: "Sound the Uterus", body: "Uterine sound passed to assess cavity length and direction. Avoids perforation. Typical depth: 6-9 cm." },
    { n: "4", title: "Sampling Device", body: "Pipelle/Endocell (flexible plastic aspirator) most common. Creates suction as inner plunger is withdrawn while rotating." },
    { n: "5", title: "Specimen Handling", body: "Tissue placed in buffered formalin. Label containers. Send to pathology. Endocervical curette (Kevorkian) may be used concurrently." },
    { n: "6", title: "Post-Procedure", body: "Cramping expected. Spotting for 1-2 days normal. Advise to return if heavy bleeding, fever, or worsening pain." },
  ];

  steps.forEach((st, i) => {
    const col = i % 2 === 0 ? 0.3 : 6.7;
    const row = Math.floor(i / 2);
    const y = 1.25 + row * 2.0;
    s.addShape(pres.ShapeType.roundRect, { x: col, y, w: 6.2, h: 1.8, fill: { color: C.navy }, line: { type: "none" }, rectRadius: 0.1 });
    s.addShape(pres.ShapeType.rect, { x: col, y, w: 0.6, h: 1.8, fill: { color: C.teal }, line: { type: "none" } });
    s.addText(st.n, { x: col, y: y + 0.55, w: 0.6, h: 0.7, fontSize: 22, bold: true, color: C.white, align: "center" });
    s.addText(st.title, { x: col + 0.7, y: y + 0.1, w: 5.3, h: 0.4, fontSize: 13, bold: true, color: C.gold });
    s.addText(st.body, { x: col + 0.7, y: y + 0.5, w: 5.3, h: 1.1, fontSize: 11, color: C.ltgray, wrap: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 5 — EMB REPORT INTERPRETATION: SPECIMEN ADEQUACY & NORMAL
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 1 — INTERPRETING THE ENDOMETRIAL BIOPSY REPORT");
  s.addText("Specimen Adequacy, Normal & Pregnancy-Related Findings", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.navy
  });

  // Color-coded category boxes (4 boxes 2x2)
  const boxes = [
    {
      title: "INSUFFICIENT TISSUE", color: C.midgray, tcolor: C.white, y: 1.25, x: 0.3,
      items: [
        "Definition: Inadequate cellular material for diagnosis",
        "Causes: Cervical stenosis, atrophic endometrium, sampling error",
        "Management depends on clinical suspicion:",
        "  → Low suspicion: Observe or repeat EMB",
        "  → High suspicion: Saline-infusion sonography or hysteroscopy + D&C",
        "Note: Atrophic postmenopausal endometrium may not yield cells even when normal",
      ]
    },
    {
      title: "NORMAL FINDINGS", color: C.green, tcolor: C.white, y: 1.25, x: 6.7,
      items: [
        "Proliferative endometrium — estrogen-dominant phase; glands and stroma proliferating",
        "Secretory endometrium — progesterone effect; subnuclear vacuoles → luminal secretions",
        "Atrophic endometrium — postmenopausal; thin inactive glands, scant stroma",
        "Weakly proliferative / disordered proliferative — perimenopausal variant; no treatment unless symptomatic",
        "Clinical action: Reassure; treat underlying cause of bleeding if symptoms persist",
      ]
    },
    {
      title: "PREGNANCY-RELATED", color: C.amber, tcolor: C.white, y: 4.35, x: 0.3,
      items: [
        "Retained products of conception (RPOC) — villi ± trophoblast; manage with uterine evacuation",
        "Decidua only (no villi) — consider ectopic pregnancy or missed abortion; check serum hCG + ultrasound",
        "Arias-Stella reaction — hypersecretory glandular changes; benign, associated with intrauterine or ectopic pregnancy",
        "Gestational trophoblastic disease — molar villi; refer to oncology",
      ]
    },
    {
      title: "ENDOMETRITIS", color: C.coral, tcolor: C.white, y: 4.35, x: 6.7,
      items: [
        "Acute: Neutrophils in glands/stroma — usually associated with intrauterine device, abortion, or STI",
        "Chronic: Plasma cells in stroma (key finding) — associated with chlamydia, PID, TB",
        "Plasma cells = hallmark of chronic endometritis (not normally present in endometrium)",
        "Management: Treat the underlying infection (e.g., doxycycline ± metronidazole for PID)",
        "Granulomatous endometritis — consider TB; AFB stain + culture",
      ]
    },
  ];

  boxes.forEach(b => {
    s.addShape(pres.ShapeType.rect, { x: b.x, y: b.y, w: 6.2, h: 3.0, fill: { color: b.color }, line: { type: "none" } });
    s.addText(b.title, { x: b.x + 0.15, y: b.y + 0.08, w: 5.9, h: 0.4, fontSize: 13, bold: true, color: b.tcolor });
    b.items.forEach((item, idx) => {
      s.addText("• " + item, { x: b.x + 0.15, y: b.y + 0.5 + idx * 0.42, w: 5.9, h: 0.4, fontSize: 10.5, color: b.tcolor, wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 6 — EMB REPORT: HYPERPLASIA CLASSIFICATION
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addDarkSlide(pres);
  sectionBanner(s, "PART 1 — ENDOMETRIAL BIOPSY: HYPERPLASIA CLASSIFICATION");
  s.addText("WHO Classification of Endometrial Hyperplasia", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.white
  });

  // Header row
  const headers = ["Category", "Architecture", "Cytologic Atypia", "Cancer Risk", "Management"];
  const colW = [2.8, 2.0, 2.2, 1.8, 3.8];
  let xPos = 0.3;
  headers.forEach((h, i) => {
    s.addShape(pres.ShapeType.rect, { x: xPos, y: 1.25, w: colW[i], h: 0.45, fill: { color: C.teal }, line: { type: "none" } });
    s.addText(h, { x: xPos + 0.05, y: 1.25, w: colW[i] - 0.1, h: 0.45, fontSize: 11, bold: true, color: C.white, valign: "middle" });
    xPos += colW[i] + 0.05;
  });

  const rows = [
    ["Simple (Cystic)\nHyperplasia", "Cystic gland dilation;\nno complexity", "Absent", "<2%", "Reassure; progestin if persistent bleeding"],
    ["Complex (Adenomatous)\nHyperplasia", "Crowded glands;\nbranching; back-to-back", "Absent", "3-5%", "Progestational agents;\nrepeat biopsy in 3-6 months"],
    ["Simple Atypical\nHyperplasia", "Cystic dilation", "Present —\nnuclear rounding, prominent nucleoli", "8-15%", "Progestin therapy or consider hysterectomy;\nfrequent follow-up biopsies"],
    ["Complex Atypical\nHyperplasia", "Crowded / complex\nglands", "Present —\nnuclear atypia", "23-29%", "HYSTERECTOMY preferred; if fertility desired: high-dose progestin + close surveillance"],
    ["Endometrial\nIntraepithelial\nNeoplasia (EIN)", "Gland area > stroma;\nsite-specific architectural change", "Present", "40-60%\n(concurrent carcinoma\npossible)", "HYSTERECTOMY recommended;\noncology referral"],
  ];

  const rowColors = [C.green, "#1E4A6B", C.amber, "#8B3A00", C.red];

  rows.forEach((row, ri) => {
    let xp = 0.3;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, { x: xp, y: 1.75 + ri * 1.05, w: colW[ci], h: 1.0, fill: { color: rowColors[ri] }, line: { color: "000000", pt: 0.3 } });
      s.addText(cell, { x: xp + 0.05, y: 1.75 + ri * 1.05 + 0.05, w: colW[ci] - 0.1, h: 0.9, fontSize: 10, color: C.white, valign: "middle", wrap: true });
      xp += colW[ci] + 0.05;
    });
  });

  s.addText("Note: EIN (WHO 2014 / 2020) replaces 'complex atypical hyperplasia' in modern classification. Both terms may appear in pathology reports.", {
    x: 0.3, y: 7.0, w: 12.7, h: 0.35, fontSize: 9.5, italic: true, color: C.midgray
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 7 — EMB: ADENOCARCINOMA & OTHER MALIGNANCIES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 1 — ENDOMETRIAL BIOPSY: MALIGNANT FINDINGS");
  s.addText("Endometrial Carcinoma on Biopsy", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  // Left — types
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 6.1, h: 6.1, fill: { color: C.navy }, line: { type: "none" } });
  s.addText("Histologic Types", { x: 0.5, y: 1.35, w: 5.7, h: 0.4, fontSize: 14, bold: true, color: C.gold });

  const types = [
    ["Type I — Endometrioid Adenocarcinoma", "Most common (80%). Estrogen-related. Well-differentiated (G1/G2) better prognosis. Glandular pattern resembling normal endometrium."],
    ["Type II — Serous Carcinoma", "High grade, TP53 mutation, non-estrogen related. Papillary architecture. Psammoma bodies may be seen. Aggressive behaviour."],
    ["Type II — Clear Cell Carcinoma", "High grade. Hobnail cells, clear cytoplasm. Poor prognosis. Associated with Lynch syndrome."],
    ["Carcinosarcoma (MMMT)", "Mixed malignant mullerian tumor. Biphasic. Carcinoma + sarcoma. Highly aggressive; often Stage III/IV at diagnosis."],
    ["Grading (FIGO)", "G1: ≤5% solid non-squamous growth\nG2: 6-50% solid growth\nG3: >50% solid growth — highest risk"],
  ];

  types.forEach(([title, desc], i) => {
    s.addText(title, { x: 0.5, y: 1.85 + i * 1.05, w: 5.7, h: 0.35, fontSize: 12, bold: true, color: C.coral });
    s.addText(desc, { x: 0.5, y: 2.2 + i * 1.05, w: 5.7, h: 0.62, fontSize: 10.5, color: C.ltgray, wrap: true });
  });

  // Right — management
  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 1.25, w: 6.2, h: 6.1, fill: { color: "#FEF0E0" }, line: { type: "none" } });
  s.addText("Clinical Action When Carcinoma Found on EMB", { x: 6.9, y: 1.35, w: 5.8, h: 0.5, fontSize: 13, bold: true, color: C.red });

  const mgmt = [
    ["Immediate Steps", "Refer to gynecologic oncologist.\nComplete staging workup."],
    ["Imaging", "MRI pelvis for myometrial invasion depth & cervical extension.\nCT chest/abdomen/pelvis for nodal & distant spread."],
    ["Surgical Staging", "Total hysterectomy + bilateral salpingo-oophorectomy + pelvic washings ± lymph node dissection ± omentectomy."],
    ["Adjuvant Therapy", "Based on FIGO stage, grade, histotype:\n• Stage IA G1/G2: Observation\n• Stage IB / G3: Vaginal brachytherapy\n• Stage III/IV: External beam RT ± chemotherapy"],
    ["Fertility-Sparing", "Only for G1 endometrioid confined to endometrium:\nHigh-dose progestin (medroxyprogesterone 160-320 mg/d or megestrol)\nStrict surveillance every 3-6 months"],
  ];

  mgmt.forEach(([title, body], i) => {
    s.addShape(pres.ShapeType.rect, { x: 6.8, y: 1.85 + i * 1.05, w: 5.9, h: 1.0, fill: { color: C.ltgray }, line: { type: "none" } });
    s.addShape(pres.ShapeType.rect, { x: 6.8, y: 1.85 + i * 1.05, w: 0.08, h: 1.0, fill: { color: C.coral }, line: { type: "none" } });
    s.addText(title, { x: 7.0, y: 1.9 + i * 1.05, w: 5.5, h: 0.3, fontSize: 11, bold: true, color: C.red });
    s.addText(body, { x: 7.0, y: 2.2 + i * 1.05, w: 5.5, h: 0.62, fontSize: 10, color: C.navy, wrap: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 8 — EMB MANAGEMENT ALGORITHM (PREMENOPAUSAL)
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 1 — MANAGEMENT ALGORITHM AFTER ENDOMETRIAL BIOPSY");
  s.addText("Post-EMB Management Pathways", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  // Decision tree visual
  const branches = [
    { label: "Insufficient Tissue", col: C.midgray, x: 0.2, y: 1.25, action: "Repeat EMB or proceed to hysteroscopy + D&C if clinically indicated" },
    { label: "Normal Histology", col: C.green, x: 0.2, y: 2.35, action: "Treat underlying cause. Repeat EMB if symptoms persist after 3-6 months" },
    { label: "Endometritis", col: C.teal, x: 0.2, y: 3.45, action: "Targeted antibiotic therapy. Confirm eradication with follow-up biopsy if chronic" },
    { label: "Simple Hyperplasia (no atypia)", col: "#2B6E44", x: 0.2, y: 4.55, action: "Progestin therapy (medroxyprogesterone 10 mg × 12-14 d/month). Repeat EMB in 3-6 months" },
    { label: "Complex Hyperplasia (no atypia)", col: C.amber, x: 0.2, y: 5.65, action: "Progestin therapy. Repeat biopsy in 3-6 months. Follow-up mandatory" },
    { label: "Atypical Hyperplasia / EIN", col: "#A04000", x: 0.2, y: 6.75, action: "Hysterectomy recommended. Fertility-desired: high-dose progestin + frequent biopsies every 3 months + oncology consult" },
  ];

  branches.forEach(b => {
    s.addShape(pres.ShapeType.rect, { x: b.x, y: b.y, w: 3.8, h: 0.9, fill: { color: b.col }, line: { type: "none" } });
    s.addText(b.label, { x: b.x + 0.1, y: b.y + 0.15, w: 3.6, h: 0.6, fontSize: 11, bold: true, color: C.white, wrap: true, valign: "middle" });
    s.addShape(pres.ShapeType.line, { x: 4.05, y: b.y + 0.4, w: 0.5, h: 0, line: { color: b.col, pt: 2 } });
    s.addShape(pres.ShapeType.rect, { x: 4.6, y: b.y + 0.05, w: 8.4, h: 0.8, fill: { color: C.ltgray }, line: { type: "none" } });
    s.addShape(pres.ShapeType.rect, { x: 4.6, y: b.y + 0.05, w: 0.06, h: 0.8, fill: { color: b.col }, line: { type: "none" } });
    s.addText(b.action, { x: 4.75, y: b.y + 0.1, w: 8.1, h: 0.7, fontSize: 11, color: C.navy, wrap: true, valign: "middle" });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 9 — PAP SMEAR: OVERVIEW & TECHNIQUE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addDarkSlide(pres);
  sectionBanner(s, "PART 2 — PAP SMEAR / CERVICAL CYTOLOGY");
  s.addText("Overview, Technique & Specimen Adequacy", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.white
  });

  // Three columns
  const cols = [
    {
      title: "What Is a Pap Smear?",
      color: C.teal,
      x: 0.3,
      items: [
        "Cytologic examination of cervical exfoliated cells",
        "Introduced by Papanicolaou in 1941",
        "Targets the transformation zone (squamocolumnar junction)",
        "Screens for cervical precancers (CIN) and cancer",
        "Reduced cervical cancer incidence by 60-90% in screened populations",
        "Sensitivity for HSIL ~56%; Specificity ~97%",
        "Sensitivity for LSIL ~77%; Specificity ~80%",
      ]
    },
    {
      title: "Collection Techniques",
      color: "#1E4A8A",
      x: 4.55,
      items: [
        "CONVENTIONAL PAP: Cells spread directly on glass slide, fixed immediately by examiner",
        "LIQUID-BASED CYTOLOGY (LBC): Cells rinsed into liquid preservative vial (ThinPrep / SurePath). Lab processes the slide",
        "Same sensitivity & specificity as conventional",
        "LBC allows reflex HPV co-testing from same sample",
        "Brush (endocervical + ectocervical) improves adequacy",
        "Avoid during menses; no douching/intercourse 48h prior",
      ]
    },
    {
      title: "Specimen Adequacy",
      color: "#5A2080",
      x: 8.8,
      items: [
        "SATISFACTORY: ≥8,000-12,000 well-visualized squamous cells (LBC: ≥5,000)",
        "Transformation zone component: Endocervical cells or squamous metaplastic cells",
        "UNSATISFACTORY: Excessive blood/inflammation obscuring >75% cells, or too few cells",
        "Action for unsatisfactory: Repeat in 2-4 months",
        "Note TZ component absence: Acceptable if patient >40 y, but increases false-negative rate",
      ]
    },
  ];

  cols.forEach(col => {
    s.addShape(pres.ShapeType.rect, { x: col.x, y: 1.25, w: 4.15, h: 6.1, fill: { color: col.color }, line: { type: "none" } });
    s.addText(col.title, { x: col.x + 0.15, y: 1.3, w: 3.85, h: 0.45, fontSize: 13, bold: true, color: C.gold });
    col.items.forEach((item, idx) => {
      s.addText("• " + item, { x: col.x + 0.15, y: 1.85 + idx * 0.78, w: 3.85, h: 0.7, fontSize: 11, color: C.white, wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 10 — THE BETHESDA SYSTEM (2001) — OVERVIEW
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 2 — THE BETHESDA CLASSIFICATION SYSTEM (2001)");
  s.addText("Bethesda 2001: Complete Terminology for Cervical Cytology Reporting", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 18, bold: true, color: C.navy
  });

  // Left panel — complete hierarchy
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 5.9, h: 6.1, fill: { color: C.navy }, line: { type: "none" } });
  s.addText("Bethesda Classification Categories", { x: 0.5, y: 1.3, w: 5.5, h: 0.4, fontSize: 13, bold: true, color: C.gold });

  const categories = [
    { text: "1. Negative for Intraepithelial Lesion or Malignancy (NILM)", bold: true, color: C.green },
    { text: "   • Non-neoplastic findings (atrophy, reactive changes, organisms)", bold: false, color: C.ltgray },
    { text: "2. Epithelial Cell Abnormalities — SQUAMOUS", bold: true, color: C.amber },
    { text: "   • ASC-US — Atypical squamous cells of undetermined significance", bold: false, color: C.ltgray },
    { text: "   • ASC-H — Cannot exclude HSIL", bold: false, color: C.ltgray },
    { text: "   • LSIL — Low-grade squamous intraepithelial lesion (CIN 1 / HPV effect)", bold: false, color: C.ltgray },
    { text: "   • HSIL — High-grade squamous intraepithelial lesion (CIN 2 / CIN 3 / CIS)", bold: false, color: C.coral },
    { text: "   • Squamous cell carcinoma", bold: false, color: C.red },
    { text: "3. Epithelial Cell Abnormalities — GLANDULAR", bold: true, color: C.amber },
    { text: "   • AGC — Atypical glandular cells (endocervical / endometrial / NOS)", bold: false, color: C.ltgray },
    { text: "   • AGC-FN — Atypical glandular cells, favor neoplastic", bold: false, color: C.coral },
    { text: "   • AIS — Endocervical adenocarcinoma in situ", bold: false, color: C.coral },
    { text: "   • Adenocarcinoma (endocervical / endometrial / extrauterine / NOS)", bold: false, color: C.red },
    { text: "4. Other Malignancies", bold: true, color: C.red },
  ];

  categories.forEach((cat, i) => {
    s.addText(cat.text, { x: 0.45, y: 1.78 + i * 0.37, w: 5.65, h: 0.35, fontSize: 10.5, bold: cat.bold, color: cat.color, wrap: true });
  });

  // Right panel — CIN vs Bethesda table
  s.addShape(pres.ShapeType.rect, { x: 6.4, y: 1.25, w: 6.6, h: 3.1, fill: { color: C.offwhite }, line: { color: C.ltgray, pt: 1 } });
  s.addText("Bethesda ↔ Histologic (CIN) Correlation", { x: 6.55, y: 1.3, w: 6.2, h: 0.4, fontSize: 13, bold: true, color: C.teal });

  const corr = [
    ["Bethesda Cytology", "CIN Grade", "Dysplasia (Old)"],
    ["NILM", "—", "Normal"],
    ["ASC-US", "CIN 1 (if confirmed)", "Minimal dysplasia"],
    ["LSIL", "CIN 1", "Mild dysplasia"],
    ["HSIL", "CIN 2", "Moderate dysplasia"],
    ["HSIL", "CIN 3", "Severe dysplasia / CIS"],
    ["Squamous cell carcinoma", "Invasive", "Invasive carcinoma"],
  ];

  corr.forEach((row, ri) => {
    const bg = ri === 0 ? C.teal : (ri % 2 === 0 ? C.ltgray : C.white);
    const fc = ri === 0 ? C.white : C.navy;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, { x: 6.4 + ci * 2.2, y: 1.75 + ri * 0.38, w: 2.2, h: 0.38, fill: { color: bg }, line: { type: "none" } });
      s.addText(cell, { x: 6.45 + ci * 2.2, y: 1.78 + ri * 0.38, w: 2.1, h: 0.32, fontSize: 10.5, bold: ri === 0, color: fc, valign: "middle" });
    });
  });

  // CIN pathology box
  s.addShape(pres.ShapeType.rect, { x: 6.4, y: 4.45, w: 6.6, h: 2.9, fill: { color: C.navy }, line: { type: "none" } });
  s.addText("CIN Histologic Features", { x: 6.6, y: 4.52, w: 6.1, h: 0.4, fontSize: 13, bold: true, color: C.gold });
  const cinFeatures = [
    "CIN 1: HPV cytopathic effect (koilocytes), nuclear atypia in lower 1/3 of epithelium, maturation maintained",
    "CIN 2: Dysplastic cells in lower 2/3 of epithelium; mitoses in lower half",
    "CIN 3 / CIS: Full-thickness dysplasia; loss of maturation; abnormal mitoses throughout all layers",
    "Koilocyte: Hallmark of HPV — perinuclear cytoplasmic clearing + irregular hyperchromatic nucleus",
  ];
  cinFeatures.forEach((f, i) => {
    s.addText("• " + f, { x: 6.6, y: 5.02 + i * 0.55, w: 6.1, h: 0.5, fontSize: 11, color: C.ltgray, wrap: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 11 — SQUAMOUS CELL ABNORMALITIES IN DETAIL
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 2 — PAP SMEAR: SQUAMOUS CELL ABNORMALITIES");
  s.addText("Detailed Interpretation of Squamous Categories", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  const categories2 = [
    {
      title: "ASC-US", fullname: "Atypical Squamous Cells of Undetermined Significance", color: "#2B6E44", x: 0.3, y: 1.25,
      features: ["Cells with nuclear enlargement 2.5-3x normal; slight hyperchromasia", "Insufficient atypia to qualify as LSIL", "Most common abnormal Pap result (~5% of Paps)"],
      management: ["Age <25: Repeat Pap in 1 year", "Age ≥25: Reflex HPV testing (preferred) or Pap in 1 year", "If HPV+: Colposcopy", "If HPV-: Pap at 3 years"]
    },
    {
      title: "ASC-H", fullname: "Atypical Squamous Cells — Cannot Exclude HSIL", color: "#8B3A00", x: 6.7, y: 1.25,
      features: ["Small cells with high N:C ratio resembling HSIL but insufficient for diagnosis", "May represent immature squamous metaplasia, repair, or true HSIL", "~5-10% harbor CIN 2-3"],
      management: ["Colposcopy for ALL patients regardless of age or HPV status", "No option for repeat cytology — must proceed to colposcopy", "If no lesion at colposcopy: 6-month co-testing"]
    },
    {
      title: "LSIL", fullname: "Low-Grade Squamous Intraepithelial Lesion", color: "#1A5080", x: 0.3, y: 4.35,
      features: ["Koilocytes: clear perinuclear halo + irregular hyperchromatic nucleus (HPV effect)", "Nuclear enlargement >3x normal superficial cell nucleus", "Correlates with CIN 1 and productive HPV infection"],
      management: ["Age 21-24: Repeat Pap in 1 year", "Age ≥25: Colposcopy preferred", "HPV co-test if done: regardless of result — colposcopy", "Pregnancy: Colposcopy (defer treatment until postpartum)"]
    },
    {
      title: "HSIL", fullname: "High-Grade Squamous Intraepithelial Lesion", color: C.red, x: 6.7, y: 4.35,
      features: ["High N:C ratio, irregular nuclear membranes, hyperchromasia", "Scant cytoplasm; cells may be single or in syncytia", "Correlates with CIN 2 (moderate dysplasia) or CIN 3 / carcinoma in situ"],
      management: ["Immediate colposcopy mandatory", "If no lesion found: diagnostic excisional procedure (LEEP/cold knife cone)", "NEVER acceptable to just repeat Pap for HSIL", "If invasion suspected: immediate excision/biopsy"]
    },
  ];

  categories2.forEach(cat => {
    s.addShape(pres.ShapeType.rect, { x: cat.x, y: cat.y, w: 6.2, h: 2.9, fill: { color: cat.color }, line: { type: "none" } });
    s.addText(cat.title, { x: cat.x + 0.15, y: cat.y + 0.08, w: 2.5, h: 0.45, fontSize: 18, bold: true, color: C.white });
    s.addText(cat.fullname, { x: cat.x + 0.15, y: cat.y + 0.52, w: 5.8, h: 0.3, fontSize: 9.5, italic: true, color: C.ltgray });

    s.addShape(pres.ShapeType.rect, { x: cat.x + 0.1, y: cat.y + 0.88, w: 2.85, h: 1.9, fill: { color: "FFFFFF20" }, line: { type: "none" } });
    s.addText("Cytologic Features", { x: cat.x + 0.15, y: cat.y + 0.93, w: 2.75, h: 0.3, fontSize: 10, bold: true, color: C.gold });
    cat.features.forEach((f, i) => {
      s.addText("• " + f, { x: cat.x + 0.15, y: cat.y + 1.25 + i * 0.48, w: 2.75, h: 0.45, fontSize: 9.5, color: C.white, wrap: true });
    });

    s.addShape(pres.ShapeType.rect, { x: cat.x + 3.1, y: cat.y + 0.88, w: 2.9, h: 1.9, fill: { color: "FFFFFF20" }, line: { type: "none" } });
    s.addText("Management", { x: cat.x + 3.15, y: cat.y + 0.93, w: 2.8, h: 0.3, fontSize: 10, bold: true, color: C.gold });
    cat.management.forEach((m, i) => {
      s.addText("• " + m, { x: cat.x + 3.15, y: cat.y + 1.25 + i * 0.48, w: 2.8, h: 0.45, fontSize: 9.5, color: C.white, wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 12 — GLANDULAR CELL ABNORMALITIES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addDarkSlide(pres);
  sectionBanner(s, "PART 2 — PAP SMEAR: GLANDULAR CELL ABNORMALITIES (AGC)");
  s.addText("Atypical Glandular Cells — The Most Important Pap Finding", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.white
  });

  // Why AGC matters
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 12.7, h: 0.7, fill: { color: C.coral }, line: { type: "none" } });
  s.addText("⚠  AGC is associated with significant pathology in up to 25% of nonpregnant patients — including endometrial and endocervical carcinoma. Always warrants full evaluation.", {
    x: 0.5, y: 1.3, w: 12.3, h: 0.6, fontSize: 12, bold: true, color: C.white, valign: "middle"
  });

  // AGC subtypes table
  const agcData = [
    ["Category", "Description", "Associated Pathology", "Initial Work-up"],
    ["AGC-NOS\n(endocervical)", "Cells exceeding reactive changes but lacking definitive features of adenocarcinoma in situ", "Endocervical polyp, CIN, AIS, adenocarcinoma", "Colposcopy + endocervical curettage (ECC)"],
    ["AGC-NOS\n(endometrial)", "Cells with slight nuclear enlargement, mild chromatin abnormality", "Endometrial hyperplasia, polyp, carcinoma", "Colposcopy + ECC + endometrial sampling"],
    ["AGC-NOS\n(not otherwise specified)", "Origin uncertain", "Cervical, endometrial, ovarian, or tubal malignancy", "Colposcopy + ECC + endometrial sampling"],
    ["AGC Favor Neoplastic (AGC-FN)", "Qualitative or quantitative changes approaching AIS", "AIS, adenocarcinoma — higher risk than NOS", "Colposcopy + ECC + endometrial sampling; consider cone if no lesion"],
    ["AIS\n(Adenocarcinoma In Situ)", "Full cytologic criteria for AIS; mucin-depleted tall columnar cells with nuclear pseudostratification", "AIS with 48% harbor concurrent invasive disease", "Diagnostic excisional procedure (LEEP/cold knife cone) mandatory"],
    ["Adenocarcinoma", "Malignant glandular cells — endocervical, endometrial, or extrauterine pattern", "Invasive carcinoma", "Immediate referral to gynecologic oncologist"],
  ];

  const colWA = [2.2, 3.2, 2.8, 4.3];
  agcData.forEach((row, ri) => {
    const bg = ri === 0 ? C.teal : (ri % 2 === 0 ? "#1C2840" : "#243050");
    const tc = ri === 0 ? C.white : C.ltgray;
    let xp = 0.3;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, { x: xp, y: 2.05 + ri * 0.78, w: colWA[ci], h: 0.76, fill: { color: bg }, line: { color: "000000", pt: 0.2 } });
      s.addText(cell, { x: xp + 0.08, y: 2.1 + ri * 0.78, w: colWA[ci] - 0.16, h: 0.66, fontSize: ri === 0 ? 11 : 10, bold: ri === 0, color: tc, valign: "middle", wrap: true });
      xp += colWA[ci];
    });
  });

  s.addText("Key: ECC = Endocervical Curettage; AIS = Adenocarcinoma In Situ; NOS = Not Otherwise Specified", {
    x: 0.3, y: 7.1, w: 12.7, h: 0.3, fontSize: 9.5, italic: true, color: C.midgray
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 13 — NILM: NON-NEOPLASTIC FINDINGS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 2 — PAP SMEAR: NILM — NON-NEOPLASTIC FINDINGS");
  s.addText("Negative for Intraepithelial Lesion or Malignancy (NILM)", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.navy
  });

  // Green box for NILM
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.2, w: 12.7, h: 0.5, fill: { color: C.green }, line: { type: "none" } });
  s.addText("NILM = Normal result. No evidence of malignancy or precancerous change. May still include clinically significant incidental findings noted below.", {
    x: 0.5, y: 1.25, w: 12.3, h: 0.4, fontSize: 11, bold: true, color: C.white, valign: "middle"
  });

  const nilmCols = [
    {
      title: "Reactive / Reparative Changes",
      color: "#1E4A8A", x: 0.3, y: 1.8,
      items: [
        "Reactive cellular changes associated with inflammation (neutrophils, lymphocytes)",
        "Reparative changes — monolayer sheets, enlarged nuclei, prominent nucleoli; do NOT overinterpret as malignancy",
        "IUD-related changes — vacuolated cells, small glandular clusters; benign",
        "Radiation changes — cytomegaly, multinucleation, cytoplasmic vacuolation",
        "Post-radiation dysplasia: report separately if persists >6 months",
      ]
    },
    {
      title: "Hormonal Patterns",
      color: C.teal, x: 4.55, y: 1.8,
      items: [
        "Atrophy (postmenopausal) — parabasal cells predominate; may show nuclear enlargement mimicking HSIL; consider hormonal context",
        "Atrophy with inflammation — not to be confused with HSIL; clinical correlation needed",
        "Pregnancy effect — decidual cells, Arias-Stella reaction; benign",
        "Contraceptive effect — progestin effect on glandular cells",
      ]
    },
    {
      title: "Organisms Identified on Pap",
      color: "#5A2080", x: 8.8, y: 1.8,
      items: [
        "Trichomonas vaginalis — pear-shaped organisms with granular cytoplasm and eccentric nucleus",
        "Bacterial vaginosis (BV) — clue cells; shift in flora (Gardnerella/Mobiluncus)",
        "Candida sp. — pseudohyphae and budding yeast; often incidental",
        "Actinomyces — sulfur granule-like cotton-ball colonies (IUD users)",
        "HSV — multinucleation, nuclear molding, Cowdry A inclusions",
        "CMV — 'owl eye' intranuclear inclusions",
      ]
    },
  ];

  nilmCols.forEach(col => {
    s.addShape(pres.ShapeType.rect, { x: col.x, y: col.y, w: 4.15, h: 5.5, fill: { color: col.color }, line: { type: "none" } });
    s.addText(col.title, { x: col.x + 0.15, y: col.y + 0.1, w: 3.85, h: 0.45, fontSize: 13, bold: true, color: C.gold });
    col.items.forEach((item, idx) => {
      s.addText("• " + item, { x: col.x + 0.15, y: col.y + 0.65 + idx * 0.88, w: 3.85, h: 0.82, fontSize: 11, color: C.white, wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 14 — HPV TESTING & CO-TESTING
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 2 — HPV TESTING AND CO-TESTING STRATEGY");
  s.addText("HPV Co-Testing: Integration with Pap Smear Results", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  // HPV types box
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 4.2, h: 6.1, fill: { color: C.navy }, line: { type: "none" } });
  s.addText("HPV Genotypes", { x: 0.5, y: 1.3, w: 3.9, h: 0.4, fontSize: 14, bold: true, color: C.gold });
  const hpvTypes = [
    ["High-Risk (Oncogenic)", "16, 18, 31, 33, 45, 52, 58\n(14 total oncogenic types)", C.coral],
    ["HPV 16 & 18", "Responsible for ~70% of cervical cancers. HPV 16 — squamous carcinoma; HPV 18 — adenocarcinoma", C.amber],
    ["Low-Risk", "6, 11 — cause condylomata; not associated with cancer", C.green],
    ["Testing Methods", "HC2 (Hybrid Capture 2); Cobas 4800; Aptima HPV (E6/E7 mRNA); Cervista", C.teal],
    ["Primary HPV Test", "FDA approved for primary screening alone (age 25+). Reflex cytology if HPV+.", C.midgray],
  ];
  hpvTypes.forEach(([title, body, color], i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.4, y: 1.8 + i * 1.05, w: 4.0, h: 1.0, fill: { color }, line: { type: "none" } });
    s.addText(title, { x: 0.5, y: 1.85 + i * 1.05, w: 3.8, h: 0.3, fontSize: 11, bold: true, color: C.white });
    s.addText(body, { x: 0.5, y: 2.15 + i * 1.05, w: 3.8, h: 0.58, fontSize: 10.5, color: C.white, wrap: true });
  });

  // Co-testing results matrix
  s.addShape(pres.ShapeType.rect, { x: 4.7, y: 1.25, w: 8.3, h: 6.1, fill: { color: C.offwhite }, line: { type: "none" } });
  s.addText("Co-Testing Result Combinations & Management (Age ≥30)", { x: 4.9, y: 1.3, w: 8.0, h: 0.4, fontSize: 13, bold: true, color: C.teal });

  const coTestData = [
    ["Pap Result", "HPV Result", "Interpretation", "Action"],
    ["NILM", "Negative", "Low risk", "Repeat co-testing in 5 years"],
    ["NILM", "Positive (16/18)", "High-risk HPV despite normal cytology", "Colposcopy"],
    ["NILM", "Positive (other HR)", "Intermediate risk", "Repeat co-testing in 1 year"],
    ["ASC-US", "Negative", "Low risk", "Repeat co-testing in 3 years"],
    ["ASC-US", "Positive", "Moderate risk", "Colposcopy"],
    ["LSIL", "Any", "CIN 1 possible", "Colposcopy (age ≥25)"],
    ["HSIL", "Any", "CIN 2-3 / CIS likely", "Immediate colposcopy; LEEP if no lesion"],
    ["AGC", "Any", "Significant pathology possible", "Colposcopy + ECC + endometrial sampling"],
  ];

  const ctColW = [2.1, 1.8, 2.8, 2.5];
  coTestData.forEach((row, ri) => {
    const bg = ri === 0 ? C.teal : (ri % 2 === 0 ? C.ltgray : C.white);
    const tc = ri === 0 ? C.white : C.navy;
    let xp = 4.7;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, { x: xp, y: 1.75 + ri * 0.6, w: ctColW[ci], h: 0.58, fill: { color: bg }, line: { color: C.ltgray, pt: 0.3 } });
      s.addText(cell, { x: xp + 0.05, y: 1.78 + ri * 0.6, w: ctColW[ci] - 0.1, h: 0.5, fontSize: ri === 0 ? 11 : 10, bold: ri === 0, color: tc, valign: "middle", wrap: true });
      xp += ctColW[ci];
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 15 — SCREENING GUIDELINES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addDarkSlide(pres);
  sectionBanner(s, "PART 5 — CERVICAL CANCER SCREENING GUIDELINES");
  s.addText("USPSTF 2018 & ASCCP 2019 Recommendations", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.white
  });

  // Age-based timeline
  const ageGroups = [
    { age: "< 21 years", color: C.midgray, recommendation: "NO SCREENING — regardless of sexual activity onset" },
    { age: "21 – 24 years", color: "#1E6B3C", recommendation: "Cytology (Pap) alone every 3 years. No HPV testing (high false-positive rate). Abnormal results managed conservatively." },
    { age: "25 – 29 years", color: C.teal, recommendation: "Cytology every 3 years (preferred). OR\nHPV testing alone every 5 years. OR\nCo-testing (Pap + HPV) every 5 years." },
    { age: "30 – 65 years", color: "#1E4A8A", recommendation: "Any of three acceptable options:\n• Cytology alone every 3 years\n• HPV testing alone every 5 years (Grade A)\n• Co-testing every 5 years (Grade A)" },
    { age: "> 65 years", color: "#5A2080", recommendation: "STOP SCREENING if adequate prior screening (3 consecutive negative Pap OR 2 negative co-tests in past 10 years, most recent within 5 years). No history of CIN 2+." },
    { age: "Post-hysterectomy", color: "#3A1A1A", recommendation: "NO SCREENING for vaginal cuff cytology if hysterectomy for benign disease and no history of CIN 2 or higher." },
  ];

  ageGroups.forEach((ag, i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25 + i * 1.0, w: 2.5, h: 0.9, fill: { color: ag.color }, line: { type: "none" } });
    s.addText(ag.age, { x: 0.35, y: 1.3 + i * 1.0, w: 2.4, h: 0.8, fontSize: 13, bold: true, color: C.white, valign: "middle", align: "center" });
    s.addShape(pres.ShapeType.rect, { x: 2.85, y: 1.25 + i * 1.0, w: 10.15, h: 0.9, fill: { color: "#1A2A3A" }, line: { type: "none" } });
    s.addShape(pres.ShapeType.rect, { x: 2.85, y: 1.25 + i * 1.0, w: 0.06, h: 0.9, fill: { color: ag.color }, line: { type: "none" } });
    s.addText(ag.recommendation, { x: 3.0, y: 1.3 + i * 1.0, w: 9.9, h: 0.8, fontSize: 11, color: C.ltgray, valign: "middle", wrap: true });
  });

  s.addText("Source: USPSTF 2018 Grade A recommendations; ASCCP 2019 Updated Guidelines for Abnormal Cervical Cancer Screening Tests", {
    x: 0.3, y: 7.15, w: 12.7, h: 0.3, fontSize: 9.5, italic: true, color: C.midgray
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 16 — SPECIAL POPULATIONS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 4 — SPECIAL POPULATIONS");
  s.addText("Special Considerations in Specific Patient Groups", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  const specials = [
    {
      title: "Pregnancy",
      color: C.teal,
      x: 0.3, y: 1.25, w: 6.1, h: 2.8,
      items: [
        "Pap / cervical cytology screening continues as per non-pregnant schedule",
        "Endocervical curettage (ECC) — AVOID in pregnancy (risk of membrane rupture)",
        "Colposcopy safe, but biopsy deferred unless invasion suspected",
        "AGC in pregnancy: decidual cells / Arias-Stella can mimic AGC — interpret cautiously",
        "Cervical dysplasia rarely progresses in pregnancy; regression common postpartum",
        "Goal: Rule out invasive cancer; defer definitive treatment until after delivery",
        "Endometrial sampling also avoided in pregnancy",
      ]
    },
    {
      title: "Lynch Syndrome / HNPCC",
      color: "#8B3A00",
      x: 6.7, y: 1.25, w: 6.2, h: 2.8,
      items: [
        "Lifetime endometrial cancer risk up to 60% (vs 3% general population)",
        "Annual TVU + endometrial biopsy from age 35 (or 5 years before youngest affected relative)",
        "Mean age at diagnosis ~50 years (earlier than sporadic cases)",
        "Prophylactic hysterectomy + BSO discussed after childbearing complete",
        "DNA mismatch repair (MMR) gene testing: MLH1, MSH2, MSH6, PMS2",
        "5-year survival similar to sporadic cases despite younger age",
      ]
    },
    {
      title: "Postmenopausal Women",
      color: "#1A5080",
      x: 0.3, y: 4.15, w: 6.1, h: 2.8,
      items: [
        "Atrophic endometrium may not yield adequate EMB sample — not a failure",
        "TVU: endometrial stripe >4 mm warrants biopsy even if asymptomatic",
        "Postmenopausal bleeding (PMB): ALWAYS warrants investigation — 10% harbor carcinoma",
        "Pap smear: atrophic pattern with parabasal cells common; distinguish from HSIL by clinical context",
        "Hormonal priming (topical estrogen 2 weeks) may improve Pap adequacy in atrophic vaginitis",
        "Co-testing recommended until age 65 if no prior adequate screening",
      ]
    },
    {
      title: "Immunocompromised / HIV",
      color: "#4A0060",
      x: 6.7, y: 4.15, w: 6.2, h: 2.8,
      items: [
        "HIV-positive women: higher prevalence and persistence of HPV",
        "Higher risk of CIN progression and multifocal disease",
        "Screening: Pap every 12 months regardless of CD4 count (after 2 normal initial annual Paps, consider every 3 years if CD4 >200)",
        "HSIL more likely to progress in immunocompromised — treatment threshold lower",
        "Annual Pap recommended by most guidelines for HIV+",
        "Immunosuppression post-transplant: similar approach to HIV",
      ]
    },
  ];

  specials.forEach(sp => {
    s.addShape(pres.ShapeType.rect, { x: sp.x, y: sp.y, w: sp.w, h: sp.h, fill: { color: sp.color }, line: { type: "none" } });
    s.addText(sp.title, { x: sp.x + 0.15, y: sp.y + 0.1, w: sp.w - 0.3, h: 0.4, fontSize: 14, bold: true, color: C.gold });
    sp.items.forEach((item, idx) => {
      s.addText("• " + item, { x: sp.x + 0.15, y: sp.y + 0.55 + idx * 0.35, w: sp.w - 0.3, h: 0.33, fontSize: 10.5, color: C.white, wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 17 — COLPOSCOPY & FOLLOW-UP PROCEDURES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addLightSlide(pres);
  sectionBanner(s, "PART 3 — MANAGEMENT PROCEDURES");
  s.addText("Colposcopy, LEEP, and Cone Biopsy — When and How", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.navy
  });

  const procedures = [
    {
      proc: "COLPOSCOPY",
      icon: "🔬",
      color: C.teal,
      x: 0.3, y: 1.25,
      when: "ASC-US + HPV+, ASC-H (all), LSIL (age ≥25), HSIL, AGC (all), AIS",
      how: "Magnified visualization of cervix after 3-5% acetic acid application. Identify acetowhite areas, punctation, mosaic patterns, atypical vessels. Map transformation zone. Directed biopsy of most abnormal-appearing areas + ECC.",
      findings: "Acetowhite epithelium, coarse punctation/mosaic, abnormal vessels → highly suspicious for high-grade CIN or carcinoma."
    },
    {
      proc: "LEEP / LLETZ",
      icon: "⚡",
      color: "#8B3A00",
      x: 0.3, y: 3.55,
      when: "CIN 2-3 confirmed on colposcopy, HSIL with no visible lesion (diagnostic), AIS (therapeutic)",
      how: "Loop Electrosurgical Excision Procedure. Excises transformation zone with 5-8mm margin. Provides tissue for histologic diagnosis AND is therapeutic for CIN 2-3. Can be done in office under local anesthesia.",
      findings: "Pathology specimen graded for CIN severity and margin status. Clear margins reduce recurrence. Endocervical margin involvement → consider repeat excision or cone."
    },
    {
      proc: "COLD KNIFE CONE (CKC)",
      icon: "🔪",
      color: "#1A5080",
      x: 6.7, y: 1.25,
      when: "AIS (preferred over LEEP for glandular lesions), recurrent HSIL, HSIL with unsatisfactory colposcopy, suspected microinvasion",
      how: "Scalpel excision of cervical cone under general/regional anesthesia. Larger specimen, cleaner margins than LEEP (no thermal artifact). ECC always performed after cone.",
      findings: "Margin status critical — positive margins (especially endocervical) increase recurrence risk. Hysterectomy if margins positive in AIS."
    },
    {
      proc: "D&C / HYSTEROSCOPY",
      icon: "🏥",
      color: "#5A2080",
      x: 6.7, y: 3.55,
      when: "Inadequate EMB, abnormal uterine bleeding with inconclusive outpatient biopsy, atypical hyperplasia, suspected polyp/submucosal fibroid",
      how: "Hysteroscopy + directed biopsy (gold standard for intrauterine pathology) allows direct visualization and targeted sampling. D&C (dilation and curettage) is blind but useful when hysteroscopy unavailable.",
      findings: "Histology same as EMB. Hysteroscopy additionally visualizes polyps, fibroids, AVM, Asherman's. Essential if EMB yields 'insufficient' tissue in high-suspicion cases."
    },
  ];

  procedures.forEach(p => {
    const y = p.y;
    const x = p.x;
    s.addShape(pres.ShapeType.rect, { x, y, w: 6.2, h: 2.2, fill: { color: p.color }, line: { type: "none" } });
    s.addShape(pres.ShapeType.rect, { x, y, w: 6.2, h: 0.5, fill: { color: "FFFFFF30" }, line: { type: "none" } });
    s.addText(p.proc, { x: x + 0.15, y: y + 0.08, w: 5.7, h: 0.35, fontSize: 14, bold: true, color: C.white });
    s.addText("WHEN: " + p.when, { x: x + 0.15, y: y + 0.58, w: 5.85, h: 0.5, fontSize: 10, color: C.gold, wrap: true, bold: false });
    s.addText(p.how, { x: x + 0.15, y: y + 1.1, w: 5.85, h: 0.6, fontSize: 10, color: C.ltgray, wrap: true });
    s.addText("FINDINGS: " + p.findings, { x: x + 0.15, y: y + 1.72, w: 5.85, h: 0.42, fontSize: 9.5, color: C.white, wrap: true, italic: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 18 — QUICK REFERENCE SUMMARY TABLE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addDarkSlide(pres);
  sectionBanner(s, "QUICK REFERENCE SUMMARY");
  s.addText("At-a-Glance: Pap Smear & EMB Report Interpretation", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.white
  });

  const summaryRows = [
    ["Finding", "Risk Level", "Next Step", "Timeframe"],
    // PAP
    ["PAP: NILM", "✓ Low", "Routine screening per age guidelines", "Per schedule"],
    ["PAP: NILM + HPV 16/18+", "▲ High-intermediate", "Colposcopy", "Prompt"],
    ["PAP: ASC-US + HPV-", "✓ Low", "Repeat co-testing in 3 years", "3 years"],
    ["PAP: ASC-US + HPV+", "▲ Moderate", "Colposcopy", "3-6 months"],
    ["PAP: ASC-H", "▲ Moderate-high", "Colposcopy", "Prompt"],
    ["PAP: LSIL", "▲ Moderate", "Colposcopy (age ≥25)", "3-6 months"],
    ["PAP: HSIL", "⚠ High", "Colposcopy ± LEEP", "Urgent"],
    ["PAP: AGC (any)", "⚠ High", "Colposcopy + ECC + EMB", "Urgent"],
    ["PAP: AIS", "⚠ Very High", "Diagnostic cone biopsy", "Urgent"],
    // EMB
    ["EMB: Insufficient", "? Unknown", "Repeat EMB / D&C / hysteroscopy", "1-3 months"],
    ["EMB: Normal", "✓ Low", "Reassure; treat AUB cause", "Routine"],
    ["EMB: Simple hyperplasia", "✓ Low-intermediate", "Progestin therapy + follow-up EMB", "3-6 months"],
    ["EMB: Complex hyperplasia", "▲ Intermediate", "Progestin therapy + biopsy in 3-6 months", "3-6 months"],
    ["EMB: Atypical hyperplasia / EIN", "⚠ High", "Hysterectomy or high-dose progestin if fertility desired", "Urgent"],
    ["EMB: Adenocarcinoma", "⚠ Malignant", "Gynecologic oncology referral + staging", "Immediate"],
  ];

  const srColW = [3.2, 1.8, 4.5, 2.0];
  const srColors = {
    "✓": C.green,
    "▲": C.amber,
    "⚠": C.red,
    "?": C.midgray,
  };

  summaryRows.forEach((row, ri) => {
    const bg = ri === 0 ? C.teal : (
      row[1].startsWith("✓") ? "#1A3A1A" :
      row[1].startsWith("▲") ? "#3A2A00" :
      row[1].startsWith("⚠") ? "#3A0A00" : "#1A1A2A"
    );
    let xp = 0.3;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, { x: xp, y: 1.25 + ri * 0.4, w: srColW[ci], h: 0.38, fill: { color: bg }, line: { color: "000000", pt: 0.2 } });
      s.addText(cell, { x: xp + 0.05, y: 1.28 + ri * 0.4, w: srColW[ci] - 0.1, h: 0.32, fontSize: ri === 0 ? 11 : 9.5, bold: ri === 0 || ci === 0, color: ri === 0 ? C.white : C.ltgray, valign: "middle" });
      xp += srColW[ci];
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 19 — CLOSING / KEY TAKE-HOME POINTS
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = addDarkSlide(pres);
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.8, fill: { color: C.teal } });
  s.addText("KEY TAKE-HOME POINTS", { x: 0.4, y: 0.1, w: 12.5, h: 0.6, fontSize: 18, bold: true, color: C.white });

  const points = [
    ["EMB Findings", "Normal histology is reassuring but does not exclude pathology if symptoms persist. Atypical hyperplasia / EIN carries significant malignant potential — hysterectomy is the standard of care."],
    ["PAP: NILM is Not Always Trivial", "Always check HPV co-test result alongside NILM. NILM + HPV 16/18 positive still requires colposcopy."],
    ["AGC = Most Dangerous Pap Result", "Don't under-manage AGC. Up to 25% of nonpregnant patients with AGC have a significant pathology including endometrial carcinoma. Full workup mandatory."],
    ["HSIL = Urgent, Not Elective", "HSIL must not be managed with 'repeat Pap.' Colposcopy is mandatory and immediate LEEP is acceptable (see-and-treat approach)."],
    ["Screening Stops at 65", "Only if adequate prior screening documented. Inadequately screened women >65 should continue screening."],
    ["Pregnancy Modifies Management", "Defer treatment of CIN (except invasive cancer) until postpartum. Colposcopy is safe. ECC and EMB must be avoided."],
    ["Lynch Syndrome = Lifetime Risk Up to 60%", "Annual TVU + EMB from age 35. Discuss prophylactic hysterectomy after childbearing is complete."],
  ];

  points.forEach(([title, body], i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.9 + i * 0.89, w: 0.5, h: 0.78, fill: { color: C.coral }, line: { type: "none" } });
    s.addText(String(i + 1), { x: 0.3, y: 0.97 + i * 0.89, w: 0.5, h: 0.64, fontSize: 16, bold: true, color: C.white, align: "center" });
    s.addText(title + ": ", { x: 0.9, y: 0.97 + i * 0.89, w: 3.0, h: 0.64, fontSize: 11, bold: true, color: C.gold, wrap: true, valign: "top" });
    s.addText(body, { x: 3.7, y: 0.97 + i * 0.89, w: 9.3, h: 0.75, fontSize: 11, color: C.ltgray, wrap: true, valign: "top" });
  });

  s.addShape(pres.ShapeType.rect, { x: 0, y: 7.2, w: 13.3, h: 0.3, fill: { color: C.coral } });
  s.addText("Pfenninger & Fowler's Procedures | Symptom to Diagnosis 4e | Bailey & Love's Surgery 28e | Creasy & Resnik's MFM | Tietz Lab Medicine 7e", {
    x: 0.3, y: 7.22, w: 12.7, h: 0.24, fontSize: 8.5, color: C.white, italic: true
  });
}

// ─── WRITE FILE ──────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/endometrial-pap-pptx/Endometrial_Biopsy_and_Pap_Smear_Interpretation.pptx" })
  .then(() => console.log("SUCCESS: Presentation saved."))
  .catch(err => console.error("ERROR:", err));
Running Command

cd /home/daytona/workspace/endometrial-pap-pptx && node build.js 2>&1

Editing File

~/endometrial-pap-pptx/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/endometrial-pap-pptx/build.js'
Editing File

~/endometrial-pap-pptx/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/endometrial-pap-pptx/build.js'
Running Command

cd /home/daytona/workspace/endometrial-pap-pptx && node build.js 2>&1

Your presentation is ready. Download it here:

Endometrial Biopsy and Pap Smear Interpretation

Presentation · PPTX


What's Inside (19 Slides)

The deck uses a navy/teal/coral color palette with color-coded risk levels (green = normal/benign, amber = intermediate, red = malignant/urgent).

Part 1 - Endometrial Biopsy (Slides 3-8)

SlideContent
3Indications, risk factors, contraindications
4Step-by-step procedure & instruments (Pipelle, Kevorkian curette, etc.)
5Specimen adequacy, normal findings, pregnancy-related, endometritis
6WHO hyperplasia classification table (simple → complex → atypical → EIN) with cancer risk %
7Endometrial carcinoma - histologic types, FIGO grading, surgical staging, fertility-sparing options
8Color-coded management algorithm for all EMB result categories

Part 2 - Pap Smear / Cervical Cytology (Slides 9-14)

SlideContent
9Overview, conventional vs LBC technique, specimen adequacy criteria
10Complete Bethesda 2001 classification + Bethesda ↔ CIN correlation table
11ASC-US, ASC-H, LSIL, HSIL — cytologic features + management per category
12AGC (all subtypes) in a full table: NOS, favor neoplastic, AIS, adenocarcinoma
13NILM details: reactive changes, organisms (Trichomonas, BV, Candida, HSV, CMV)
14HPV co-testing matrix (9 combinations of Pap + HPV results with action steps)

Parts 3-5 (Slides 15-19)

  • Screening guidelines (USPSTF 2018 by age group, including when to stop)
  • Special populations: pregnancy, Lynch syndrome, postmenopausal, HIV/immunocompromised
  • Colposcopy, LEEP, cold knife cone, D&C/hysteroscopy - when and how
  • Quick-reference summary table (all 15 result categories at a glance)
  • 7 key take-home points closing slide
Sources: Pfenninger & Fowler's Procedures for Primary Care | Symptom to Diagnosis 4e | Bailey & Love's Surgery 28e | Creasy & Resnik's Maternal-Fetal Medicine | Tietz Textbook of Laboratory Medicine 7e

Create a second deck on colposcopy-guided biopsy interpretation

Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Writing File

~/endometrial-pap-pptx/build_colposcopy.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE";
pres.title = "Colposcopy-Guided Biopsy Interpretation";
pres.author = "Orris Medical Education";

// ─── COLOR PALETTE ───────────────────────────────────────────────────────────
const C = {
  darkpurple: "1A0A2E",  // dominant dark
  plum:       "4A1060",  // accent dark
  violet:     "7B2FA8",  // main accent
  lavender:   "A855D9",  // highlight accent
  coral:      "C84B31",  // warnings / high-grade
  gold:       "D4A017",  // highlight labels
  white:      "FFFFFF",
  offwhite:   "F5F0FA",
  ltpurple:   "E8D5F5",
  midgray:    "8898A8",
  ltgray:     "DDE3EC",
  green:      "1E6B3C",  // normal/benign
  amber:      "B07800",  // intermediate
  red:        "A01010",  // malignant/high-grade
  teal:       "1A7A7A",  // info boxes
  navy:       "0D1B3E",
};

// ─── HELPERS ────────────────────────────────────────────────────────────────
function darkSlide() {
  const s = pres.addSlide();
  s.background = { color: C.darkpurple };
  return s;
}
function lightSlide() {
  const s = pres.addSlide();
  s.background = { color: C.offwhite };
  return s;
}
function banner(slide, text) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.55, fill: { color: C.violet } });
  slide.addText(text, { x: 0.2, y: 0.06, w: 13, h: 0.44, fontSize: 14, bold: true, color: C.white, valign: "middle" });
}
function bullet(text, level = 0, bold = false, color = C.darkpurple) {
  return { text, options: { bullet: { type: "bullet" }, indentLevel: level, bold, color, fontSize: 13, breakLine: true } };
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════════
{
  const s = darkSlide();
  // Side decorative bars
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.4, h: 7.5, fill: { color: C.violet } });
  s.addShape(pres.ShapeType.rect, { x: 0.4, y: 0, w: 0.12, h: 7.5, fill: { color: C.coral } });

  s.addText("Complete Interpretation of", {
    x: 0.75, y: 1.5, w: 12, h: 0.6, fontSize: 20, color: C.gold, bold: false, italic: true
  });
  s.addText("Colposcopy-Guided\nCervical Biopsy Reports", {
    x: 0.75, y: 2.1, w: 12, h: 2.2, fontSize: 40, bold: true, color: C.white, valign: "top"
  });
  s.addShape(pres.ShapeType.rect, { x: 0.75, y: 4.4, w: 5.5, h: 0.06, fill: { color: C.coral } });
  s.addText("Colposcopic findings • Biopsy histology • LAST/Lower ANOGENITAL Standardized Terminology\nCIN grading • p16/Ki-67 biomarkers • ASCCP management algorithms", {
    x: 0.75, y: 4.55, w: 11.5, h: 0.7, fontSize: 12, color: C.ltgray, italic: true
  });
  s.addText("Sources: Berek & Novak's Gynecology | Robbins & Cotran Pathologic Basis of Disease\nPfenninger & Fowler's Procedures for Primary Care | Sabiston Textbook of Surgery 21e", {
    x: 0.75, y: 6.55, w: 11.5, h: 0.7, fontSize: 10, color: C.midgray, italic: true
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 2 — TABLE OF CONTENTS
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "OVERVIEW");
  s.addText("What This Presentation Covers", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.darkpurple
  });

  const parts = [
    ["PART 1", "Anatomy & The Transformation Zone", "SCJ, TZ types, ectropion — where disease begins"],
    ["PART 2", "The Colposcopy Procedure", "Technique, satisfactory vs unsatisfactory, acetic acid, Lugol's iodine"],
    ["PART 3", "Colposcopic Findings", "Acetowhite, punctation, mosaic, atypical vessels, leukoplakia — grading systems"],
    ["PART 4", "Biopsy Histology & LAST Terminology", "CIN 1/LSIL, CIN 2/HSIL, CIN 3, koilocytes, morphology, p16/Ki-67"],
    ["PART 5", "Natural History & Risk Stratification", "Regression/progression rates, HPV type, host factors"],
    ["PART 6", "Management Algorithms", "CIN 1, CIN 2, CIN 3, AIS, special populations, ASCCP 2019"],
    ["PART 7", "Treatment Modalities", "Cryotherapy, LEEP, cold knife cone, margins, surveillance"],
  ];

  parts.forEach(([num, title, desc], i) => {
    const y = 1.28 + i * 0.87;
    s.addShape(pres.ShapeType.rect, { x: 0.4, y, w: 1.2, h: 0.77, fill: { color: C.violet }, line: { type: "none" } });
    s.addText(num, { x: 0.4, y: y + 0.08, w: 1.2, h: 0.6, fontSize: 10, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addShape(pres.ShapeType.rect, { x: 1.65, y, w: 11.3, h: 0.77, fill: { color: C.ltpurple }, line: { type: "none" } });
    s.addText(title, { x: 1.8, y: y + 0.06, w: 11.0, h: 0.3, fontSize: 13, bold: true, color: C.darkpurple });
    s.addText(desc, { x: 1.8, y: y + 0.38, w: 11.0, h: 0.3, fontSize: 11, color: C.midgray, italic: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 3 — ANATOMY: TRANSFORMATION ZONE & SCJ
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "PART 1 — ANATOMY OF THE TRANSFORMATION ZONE");
  s.addText("The Squamocolumnar Junction & Transformation Zone", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.darkpurple
  });

  // Left anatomy text
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 6.1, h: 6.0, fill: { color: C.darkpurple }, line: { type: "none" } });
  s.addText("Key Anatomical Concepts", { x: 0.5, y: 1.32, w: 5.7, h: 0.4, fontSize: 14, bold: true, color: C.gold });

  const concepts = [
    ["Original SCJ", "Junction between original squamous (ectocervix) and columnar (endocervix) epithelium. Static — position determines TZ size."],
    ["Physiologic Ectropion / Ectopy", "Columnar epithelium extending onto ectocervix. Appears red, granular, friable. Normal variant — prominent in adolescence, pregnancy, OCP use."],
    ["New (Functional) SCJ", "Current junction between squamous and columnar epithelium. Located at the upper margin of the transformation zone. Must be fully visualized for a satisfactory colposcopy."],
    ["Transformation Zone (TZ)", "Area between original and functional SCJ. Site of squamous metaplasia — highest vulnerability to HPV-induced neoplasia. Nearly ALL CIN and cervical carcinomas arise here."],
    ["TZ Type (IFCPC 2011)", "Type 1: Fully ectocervical, completely visible\nType 2: Partly endocervical but fully visible\nType 3: Partly/fully endocervical, NOT fully visible → unsatisfactory colposcopy"],
    ["Metaplasia", "Replacement of columnar epithelium by squamous epithelium. Active zone of cell division → susceptibility to HPV. Immature metaplasia appears gray-white on acetic acid."],
  ];

  concepts.forEach(([title, body], i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.38, y: 1.82 + i * 0.88, w: 0.07, h: 0.75, fill: { color: C.lavender }, line: { type: "none" } });
    s.addText(title, { x: 0.55, y: 1.85 + i * 0.88, w: 5.5, h: 0.28, fontSize: 11.5, bold: true, color: C.lavender });
    s.addText(body, { x: 0.55, y: 2.14 + i * 0.88, w: 5.5, h: 0.48, fontSize: 10.5, color: C.ltgray, wrap: true });
  });

  // Right boxes — TZ types + clinical significance
  const tzTypes = [
    { type: "TZ TYPE 1", color: C.green, x: 6.7, y: 1.25, desc: "Ectocervical only\nEntirely visible on colposcopy\nAblatve treatment (cryotherapy) acceptable\nNo endocervical assessment needed", note: "MOST FAVORABLE" },
    { type: "TZ TYPE 2", color: C.amber, x: 6.7, y: 3.05, desc: "Extends into endocervical canal\nNew SCJ fully visible with aid of endocervical speculum\nAblation may be acceptable if entire TZ visualized\nECC recommended", note: "INTERMEDIATE" },
    { type: "TZ TYPE 3", color: C.coral, x: 6.7, y: 4.85, desc: "Extends into canal\nNew SCJ NOT fully visible\nSatisfactory colposcopy NOT possible\nDiagnostic excisional procedure (cone) required\nECC mandatory", note: "UNSATISFACTORY" },
  ];

  tzTypes.forEach(t => {
    s.addShape(pres.ShapeType.rect, { x: t.x, y: t.y, w: 6.2, h: 1.7, fill: { color: t.color }, line: { type: "none" } });
    s.addText(t.type, { x: t.x + 0.15, y: t.y + 0.1, w: 4.0, h: 0.4, fontSize: 16, bold: true, color: C.white });
    s.addText(t.note, { x: t.x + 4.2, y: t.y + 0.15, w: 1.8, h: 0.35, fontSize: 10, bold: true, color: C.white, align: "right" });
    s.addText(t.desc, { x: t.x + 0.15, y: t.y + 0.55, w: 5.85, h: 1.1, fontSize: 11, color: C.white, wrap: true });
  });

  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 6.6, w: 6.2, h: 0.65, fill: { color: C.teal }, line: { type: "none" } });
  s.addText("Clinical pearl: The SCJ migrates inward (into the canal) with age and menopause. In postmenopausal women TZ is almost always Type 3 — expect unsatisfactory colposcopy and plan for cone/ECC.", {
    x: 6.85, y: 6.65, w: 5.9, h: 0.55, fontSize: 10, color: C.white, wrap: true
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 4 — COLPOSCOPY PROCEDURE STEP-BY-STEP
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "PART 2 — THE COLPOSCOPY PROCEDURE");
  s.addText("Technique, Setup & Systematic Examination Protocol", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.darkpurple
  });

  const steps = [
    { n: "1", title: "Patient Prep & History", body: "Ideally mid-cycle (not menstruating). No intercourse / douching 24h prior. Review referral cytology, HPV result, prior biopsies. Informed consent. NSAID premedication." },
    { n: "2", title: "Initial Visualization (No Stain)", body: "Large Graves speculum. Survey cervix, vaginal walls. Identify any leukoplakia (white before acid — biopsy first). Assess discharge. Identify os & TZ type." },
    { n: "3", title: "3–5% Acetic Acid Application", body: "Saturate cotton ball / spray. Wait 60–90 seconds. Repeat ×2-3. Identify acetowhite areas, vascular patterns (punctation, mosaic, atypical vessels), cuffed gland openings." },
    { n: "4", title: "Systematic Quadrant Survey", body: "Examine 12→3→6→9 o'clock under colposcopic magnification. Use green filter to enhance vascular patterns. Map TZ type. Note whether entire SCJ is visible." },
    { n: "5", title: "Schiller / Lugol's Iodine Test", body: "Normal glycogenated squamous epithelium stains mahogany brown. Dysplastic / columnar / metaplastic cells = iodine-negative (mustard yellow). Define biopsy sites." },
    { n: "6", title: "Directed Biopsy", body: "Biopsy most acetowhite / most abnormal-appearing areas. At least 2 biopsies recommended (improves detection). Cervical biopsy forceps (Tischler, Burke). Mark 12 o'clock. Fix in formalin." },
    { n: "7", title: "Endocervical Curettage (ECC)", body: "Kevorkian curette or cytobrush. Essential if TZ not fully visible (Type 2/3), AGC on cytology, post-treatment surveillance, or discordant results. AVOID in pregnancy." },
    { n: "8", title: "Post-Procedure", body: "Monsel's solution (ferric subsulfate) or silver nitrate for hemostasis. Advise spotting ×1-3 days, pelvic rest ×7 days. Report: fever, heavy bleeding, purulent discharge." },
  ];

  steps.forEach((st, i) => {
    const col = i % 2 === 0 ? 0.3 : 6.75;
    const row = Math.floor(i / 2);
    const y = 1.25 + row * 1.55;
    s.addShape(pres.ShapeType.roundRect, { x: col, y, w: 6.25, h: 1.45, fill: { color: C.darkpurple }, line: { type: "none" }, rectRadius: 0.08 });
    s.addShape(pres.ShapeType.rect, { x: col, y, w: 0.55, h: 1.45, fill: { color: C.violet }, line: { type: "none" } });
    s.addText(st.n, { x: col, y: y + 0.43, w: 0.55, h: 0.6, fontSize: 22, bold: true, color: C.white, align: "center" });
    s.addText(st.title, { x: col + 0.65, y: y + 0.1, w: 5.4, h: 0.35, fontSize: 12, bold: true, color: C.gold });
    s.addText(st.body, { x: col + 0.65, y: y + 0.48, w: 5.4, h: 0.88, fontSize: 10.5, color: C.ltgray, wrap: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 5 — SATISFACTORY vs UNSATISFACTORY COLPOSCOPY
// ═══════════════════════════════════════════════════════════════════════
{
  const s = darkSlide();
  banner(s, "PART 2 — SATISFACTORY vs UNSATISFACTORY COLPOSCOPY");
  s.addText("Adequacy Assessment — The First and Most Critical Decision", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.white
  });

  // Two large boxes
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 6.1, h: 5.2, fill: { color: C.green }, line: { type: "none" } });
  s.addText("SATISFACTORY", { x: 0.5, y: 1.3, w: 5.7, h: 0.5, fontSize: 22, bold: true, color: C.white });
  s.addText("(Adequate Colposcopy)", { x: 0.5, y: 1.82, w: 5.7, h: 0.35, fontSize: 13, italic: true, color: C.white });

  const satItems = [
    "The entire squamocolumnar junction (new SCJ) is FULLY VISIBLE",
    "The entire transformation zone is visualized",
    "All acetowhite or iodine-negative lesions are completely identified and their borders seen",
    "TZ Type 1 or 2 confirmed",
    "Management: Directed biopsy ± ECC based on findings. Ablation (cryotherapy) acceptable for CIN 1-2 if all criteria met",
    "If cytology and colposcopy are discordant (e.g., HSIL cytology but no lesion seen), repeat colposcopy + multiple biopsies or proceed to diagnostic excision",
  ];
  satItems.forEach((item, i) => {
    s.addText("✓  " + item, { x: 0.5, y: 2.28 + i * 0.63, w: 5.7, h: 0.58, fontSize: 11.5, color: C.white, wrap: true });
  });

  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 1.25, w: 6.2, h: 5.2, fill: { color: C.coral }, line: { type: "none" } });
  s.addText("UNSATISFACTORY", { x: 6.9, y: 1.3, w: 5.8, h: 0.5, fontSize: 22, bold: true, color: C.white });
  s.addText("(Inadequate Colposcopy)", { x: 6.9, y: 1.82, w: 5.8, h: 0.35, fontSize: 13, italic: true, color: C.white });

  const unsatItems = [
    "Entire SCJ NOT visible (endocervical extension — TZ Type 3)",
    "Lesion extends into canal and upper border is not seen",
    "Severe inflammation / atrophy obscuring visualization",
    "Reason for unsatisfactory MUST be stated in the report",
    "Management: Diagnostic excisional procedure (LEEP / cold knife cone) is MANDATORY — ablation is NEVER acceptable",
    "ECC must accompany or precede excision",
    "Postmenopausal women: topical estrogen 2-4 weeks may improve visualization (maturation of atrophic epithelium)",
  ];
  unsatItems.forEach((item, i) => {
    s.addText("✗  " + item, { x: 6.9, y: 2.28 + i * 0.63, w: 5.8, h: 0.58, fontSize: 11.5, color: C.white, wrap: true });
  });

  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 6.55, w: 12.7, h: 0.75, fill: { color: C.violet }, line: { type: "none" } });
  s.addText("ASCCP Principle: Adequacy of colposcopy is the gatekeeper for ALL management decisions. When in doubt, perform diagnostic excision rather than observation.", {
    x: 0.5, y: 6.6, w: 12.3, h: 0.65, fontSize: 11, bold: true, color: C.white, valign: "middle"
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 6 — COLPOSCOPIC FINDINGS: ACETIC ACID & VASCULAR PATTERNS
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "PART 3 — COLPOSCOPIC FINDINGS: ACETOWHITE & VASCULAR PATTERNS");
  s.addText("Interpreting What You See — Systematic Finding Analysis", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.darkpurple
  });

  const findings = [
    {
      name: "ACETOWHITE EPITHELIUM",
      color: C.navy, x: 0.3, y: 1.25, w: 6.1, h: 2.15,
      mechanism: "Acetic acid coagulates nuclear protein → opaque white appearance. Degree inversely proportional to cytoplasmic glycogen.",
      significance: "Thin, faint, translucent AW: immature metaplasia or HPV effect (low grade)\nDense, thick, opaque AW with sharp borders: high-grade CIN\nCuffed gland openings within AW: deep CIN extending into crypts (high grade)",
      risk: "Grade"
    },
    {
      name: "LEUKOPLAKIA",
      color: "#2A5A3A", x: 6.7, y: 1.25, w: 6.2, h: 2.15,
      mechanism: "White plaque VISIBLE BEFORE acetic acid application. Represents surface keratinization (hyperkeratosis).",
      significance: "Biopsy mandatory — leukoplakia can overlie high-grade CIN or invasive cancer. Cannot reliably assess subepithelial changes until keratotic layer is removed on biopsy section.",
      risk: "Biopsy first"
    },
    {
      name: "PUNCTATION",
      color: "#5A2080", x: 0.3, y: 3.48, w: 6.1, h: 2.15,
      mechanism: "End-on view of capillary loops from columnar villi preserved within acetowhite area. Look like red dots on white background.",
      significance: "Fine punctation: CIN 1 or metaplasia (low-grade)\nCoarse punctation (irregular, widely spaced, caliber variation): CIN 2-3 or microinvasion\nAlways in association with acetowhite epithelium — punctation alone (outside AW) is insignificant",
      risk: "Coarse = high risk"
    },
    {
      name: "MOSAIC PATTERN",
      color: "#7B3010", x: 6.7, y: 3.48, w: 6.2, h: 2.15,
      mechanism: "Capillaries surrounding polygonal blocks of acetowhite epithelium — looks like tiles. Arises from coalescence of punctate vessels or gland-surrounding vessels.",
      significance: "Fine mosaic: CIN 1-2 (low to intermediate grade)\nCoarse mosaic (irregular tile size, wide intercapillary distance): CIN 2-3 or invasion\nCombination of coarse mosaic + coarse punctation = HIGH risk for CIN 3",
      risk: "Coarse = high risk"
    },
    {
      name: "ATYPICAL VESSELS",
      color: C.red, x: 0.3, y: 5.71, w: 6.1, h: 1.5,
      mechanism: "Irregular caliber vessels running parallel to surface: looped, branching, reticular, corkscrew patterns.",
      significance: "Highly predictive of INVASIVE cervical carcinoma. If atypical vessels identified: biopsy immediately, refer to gynecologic oncology.",
      risk: "⚠ INVASION"
    },
    {
      name: "IODINE / LUGOL'S TEST",
      color: C.teal, x: 6.7, y: 5.71, w: 6.2, h: 1.5,
      mechanism: "Iodine binds to glycogen in normal squamous epithelium → mahogany-brown stain. Dysplastic or columnar cells lack glycogen → yellow/mustard (iodine-negative).",
      significance: "Iodine-negative (yellow): dysplastic, columnar, or poorly glycogenated → biopsy\nIodine-positive (brown): normal squamous epithelium — no biopsy needed\nUsed to delineate biopsy/excision margins (remove all yellow areas)",
      risk: "Defines margins"
    },
  ];

  findings.forEach(f => {
    s.addShape(pres.ShapeType.rect, { x: f.x, y: f.y, w: f.w, h: f.h, fill: { color: f.color }, line: { type: "none" } });
    s.addText(f.name, { x: f.x + 0.15, y: f.y + 0.08, w: f.w - 0.3, h: 0.32, fontSize: 12, bold: true, color: C.gold });
    s.addText("Mechanism: " + f.mechanism, { x: f.x + 0.15, y: f.y + 0.43, w: f.w - 0.3, h: 0.58, fontSize: 10, color: C.ltgray, wrap: true, italic: true });
    s.addText("Significance: " + f.significance, { x: f.x + 0.15, y: f.y + 1.03, w: f.w - 0.3, h: 0.85, fontSize: 10, color: C.white, wrap: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 7 — COLPOSCOPIC GRADING SYSTEMS (REID / SWEDE / IFCPC)
// ═══════════════════════════════════════════════════════════════════════
{
  const s = darkSlide();
  banner(s, "PART 3 — COLPOSCOPIC GRADING SYSTEMS");
  s.addText("Reid Colposcopic Index & IFCPC 2011 Grading Terminology", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.white
  });

  // Reid Index table
  s.addText("Reid Colposcopic Index (RCI) — Score 0-8", { x: 0.3, y: 1.25, w: 8, h: 0.4, fontSize: 14, bold: true, color: C.gold });

  const reidHeaders = ["Feature", "0 Points", "1 Point", "2 Points"];
  const reidRows = [
    ["Acetowhite Color", "Shiny white; snow-white; indistinguishable from immature metaplasia", "Intermediate shade (dull, opaque)", "Dull, oyster white; dense, thick opacity"],
    ["Lesion Margin & Surface", "Feathered, jagged; satellite lesion; angular or flocculated; microcondylomatous or micropapillary surface", "Regular, smooth margins with uniform contour", "Straight-edged, distinct margins with dense AW; rolled, peeling edges"],
    ["Vessels", "Fine caliber; poorly formed; ill-defined patterns; fine punctation / fine mosaic / absence of vessels", "Absent vessels", "Coarse punctation; coarse mosaic; atypical vessels"],
    ["Iodine Staining", "Positive iodine uptake (mahogany brown)", "Partial iodine staining (variegated)", "Negative iodine uptake (mustard yellow)"],
  ];
  const rColW = [2.8, 3.0, 2.8, 3.5];
  reidHeaders.forEach((h, ci) => {
    let xp = 0.3 + rColW.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.ShapeType.rect, { x: xp, y: 1.72, w: rColW[ci], h: 0.4, fill: { color: C.violet }, line: { type: "none" } });
    s.addText(h, { x: xp + 0.05, y: 1.74, w: rColW[ci] - 0.1, h: 0.36, fontSize: 11, bold: true, color: C.white, valign: "middle" });
  });
  reidRows.forEach((row, ri) => {
    const bg = ri % 2 === 0 ? "#1C1040" : "#261450";
    row.forEach((cell, ci) => {
      let xp = 0.3 + rColW.slice(0, ci).reduce((a, b) => a + b, 0);
      s.addShape(pres.ShapeType.rect, { x: xp, y: 2.15 + ri * 0.72, w: rColW[ci], h: 0.7, fill: { color: bg }, line: { color: "333366", pt: 0.3 } });
      s.addText(cell, { x: xp + 0.05, y: 2.18 + ri * 0.72, w: rColW[ci] - 0.1, h: 0.64, fontSize: 9.5, color: C.ltgray, valign: "middle", wrap: true });
    });
  });

  // Score interpretation
  const scores = [
    { range: "RCI 0–2", interp: "CIN 1 / HPV", action: "Observation or ablation if persistent 12 months", color: C.green },
    { range: "RCI 3–4", interp: "CIN 1–2", action: "Biopsy; manage per histology", color: C.amber },
    { range: "RCI 5–8", interp: "CIN 2–3 likely", action: "Biopsy; excisional procedure", color: C.red },
  ];
  s.addText("Score Interpretation:", { x: 0.3, y: 5.08, w: 4, h: 0.35, fontSize: 13, bold: true, color: C.gold });
  scores.forEach((sc, i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.3 + i * 4.3, y: 5.5, w: 4.1, h: 1.2, fill: { color: sc.color }, line: { type: "none" } });
    s.addText(sc.range, { x: 0.5 + i * 4.3, y: 5.55, w: 3.7, h: 0.38, fontSize: 16, bold: true, color: C.white });
    s.addText(sc.interp, { x: 0.5 + i * 4.3, y: 5.95, w: 3.7, h: 0.3, fontSize: 12, color: C.white, bold: true });
    s.addText(sc.action, { x: 0.5 + i * 4.3, y: 6.3, w: 3.7, h: 0.35, fontSize: 10.5, color: C.white, italic: true });
  });

  s.addText("IFCPC 2011: Grade 1 (minor) = thin AW, irregular margins, fine vessels. Grade 2 (major) = dense AW, coarse vessels, sharp demarcation, cuffed glands. Both grades require biopsy; Grade 2 highly predictive of CIN 2+.", {
    x: 0.3, y: 6.85, w: 12.7, h: 0.55, fontSize: 10, italic: true, color: C.midgray, wrap: true
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 8 — BIOPSY REPORT: LAST TERMINOLOGY & HISTOLOGY
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "PART 4 — BIOPSY REPORT INTERPRETATION: LAST TERMINOLOGY");
  s.addText("Lower Anogenital Squamous Terminology (LAST / CAP-ASCCP 2012)", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 18, bold: true, color: C.darkpurple
  });

  // Terminology evolution box
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 12.7, h: 0.9, fill: { color: C.darkpurple }, line: { type: "none" } });
  s.addText("Terminology Evolution: Old Dysplasia → CIN → LAST Two-Tier System", { x: 0.5, y: 1.3, w: 12.0, h: 0.35, fontSize: 13, bold: true, color: C.gold });

  const termRow = ["Old Dysplasia", "CIN Grading", "LAST (2012) / WHO 5th Ed", "Bethesda Cytology"];
  const termData = [
    ["Mild dysplasia", "CIN 1", "LSIL (Low-Grade SIL)", "LSIL"],
    ["Moderate dysplasia", "CIN 2", "HSIL (may add 'CIN 2' in parentheses)", "HSIL"],
    ["Severe dysplasia", "CIN 3", "HSIL (may add 'CIN 3' in parentheses)", "HSIL"],
    ["Carcinoma in situ", "CIN 3", "HSIL (add 'CIN 3' or 'CIS')", "HSIL"],
  ];
  const tColW = [2.8, 2.5, 4.2, 3.0];
  termRow.forEach((h, ci) => {
    let xp = 0.3 + tColW.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.ShapeType.rect, { x: xp, y: 2.2, w: tColW[ci], h: 0.4, fill: { color: C.violet }, line: { type: "none" } });
    s.addText(h, { x: xp + 0.05, y: 2.22, w: tColW[ci] - 0.1, h: 0.36, fontSize: 10.5, bold: true, color: C.white, valign: "middle" });
  });
  termData.forEach((row, ri) => {
    const bg = ri % 2 === 0 ? C.ltpurple : C.white;
    row.forEach((cell, ci) => {
      let xp = 0.3 + tColW.slice(0, ci).reduce((a, b) => a + b, 0);
      s.addShape(pres.ShapeType.rect, { x: xp, y: 2.63 + ri * 0.42, w: tColW[ci], h: 0.4, fill: { color: bg }, line: { color: C.ltgray, pt: 0.3 } });
      s.addText(cell, { x: xp + 0.05, y: 2.66 + ri * 0.42, w: tColW[ci] - 0.1, h: 0.34, fontSize: 10.5, color: C.darkpurple, valign: "middle" });
    });
  });

  // Histologic features panels
  const histoPanels = [
    {
      grade: "LSIL (CIN 1)", color: C.green, x: 0.3, y: 4.45,
      features: [
        "Koilocytic atypia — HALLMARK of HPV infection",
        "Koilocyte: perinuclear cytoplasmic clearing (halo) + irregular, raisinoid hyperchromatic nucleus",
        "Dysplastic cells confined to LOWER 1/3 of epithelium (basal layer)",
        "Upper 2/3: retained maturation toward surface",
        "Binucleation and multinucleation common",
        "Mitoses present but confined to lower epithelium",
        "p16: negative or non-block (focal/patchy)",
        "Ki-67: elevated cells in upper 1/3 (should be negative normally)",
        "Represents PRODUCTIVE HPV infection — high viral replication, low oncogenic risk",
      ]
    },
    {
      grade: "HSIL (CIN 2)", color: C.amber, x: 6.7, y: 4.45,
      features: [
        "Dysplastic cells extend into UPPER 2/3 of epithelium (but not full thickness)",
        "Reduced maturation in upper half",
        "Increased N:C ratio, irregular nuclear membranes, hyperchromasia",
        "Mitoses in upper half of epithelium",
        "Loss of cell polarity in mid/upper layers",
        "p16: BLOCK-POSITIVE (strong, diffuse cytoplasmic and nuclear) — confirms HSIL",
        "Ki-67: elevated cells throughout all layers",
        "EQUIVOCAL CIN 2: If p16 negative → reclassify as LSIL (conserve, observe)\nIf p16 positive → HSIL (treat)",
        "CIN 2 is the management threshold — treatment generally indicated",
      ]
    },
  ];

  histoPanels.forEach(p => {
    s.addShape(pres.ShapeType.rect, { x: p.x, y: p.y, w: 6.2, h: 2.8, fill: { color: p.color }, line: { type: "none" } });
    s.addText(p.grade, { x: p.x + 0.15, y: p.y + 0.1, w: 5.7, h: 0.4, fontSize: 15, bold: true, color: C.white });
    p.features.forEach((feat, i) => {
      s.addText("• " + feat, { x: p.x + 0.15, y: p.y + 0.56 + i * 0.24, w: 5.7, h: 0.23, fontSize: 9.5, color: C.white, wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 9 — CIN 3 / HSIL HISTOLOGY + CARCINOMA FEATURES
// ═══════════════════════════════════════════════════════════════════════
{
  const s = darkSlide();
  banner(s, "PART 4 — HSIL (CIN 3) AND MICROINVASIVE CARCINOMA");
  s.addText("Full-Thickness Dysplasia to Early Invasion — Histologic Spectrum", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.white
  });

  // CIN 3 box
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 6.1, h: 5.5, fill: { color: "#3A0A00" }, line: { type: "none" } });
  s.addText("HSIL — CIN 3 / Carcinoma In Situ", { x: 0.5, y: 1.32, w: 5.7, h: 0.4, fontSize: 14, bold: true, color: C.coral });

  const cin3Features = [
    ["Full-Thickness Atypia", "Dysplastic cells involve the ENTIRE thickness of the epithelium (not just basal). No surface maturation whatsoever."],
    ["Nuclear Features", "Marked nuclear enlargement, pleomorphism, coarse irregularly distributed chromatin, prominent nucleoli. High N:C ratio throughout all layers."],
    ["Mitoses", "Abnormal mitotic figures (tripolar, quadripolar) throughout all layers including surface. This is key — abnormal mitoses in upper epithelium = CIN 3."],
    ["Koilocytes", "May be absent or sparse in CIN 3 (low HPV replication — integration into host genome predominates)."],
    ["p16 IHC", "STRONG block-positive staining throughout full epithelial thickness. Mandatory in any HSIL to confirm and in CIN 2 to triage."],
    ["Ki-67", "Diffusely positive (MIB-1) through all epithelial layers. Paired with p16 confirms HSIL."],
    ["Rag Sign", "Irregular, ragged colposcopic surface correlating to CIN 3. Cuffed gland openings indicate deep endocervical gland involvement."],
    ["Progression Risk", "30% persist, 60% progress to carcinoma without treatment. TREATMENT MANDATORY."],
  ];

  cin3Features.forEach(([title, body], i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.4, y: 1.83 + i * 0.6, w: 0.06, h: 0.5, fill: { color: C.coral }, line: { type: "none" } });
    s.addText(title, { x: 0.55, y: 1.87 + i * 0.6, w: 5.6, h: 0.22, fontSize: 11, bold: true, color: C.coral });
    s.addText(body, { x: 0.55, y: 2.1 + i * 0.6, w: 5.6, h: 0.3, fontSize: 10, color: C.ltgray, wrap: true });
  });

  // Right — invasion + staging
  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 1.25, w: 6.2, h: 2.5, fill: { color: "#1A0A3A" }, line: { type: "none" } });
  s.addText("Microinvasive Carcinoma (FIGO Stage IA)", { x: 6.9, y: 1.32, w: 5.8, h: 0.4, fontSize: 13, bold: true, color: C.lavender });

  const microinv = [
    "Histologic diagnosis only — cannot diagnose microinvasion at colposcopy",
    "Features: Irregular tongues of squamous cells breaking through basement membrane, surrounded by desmoplastic stroma. Angiolymphatic space invasion.",
    "FIGO IA1: Stromal invasion ≤3 mm depth, ≤7 mm horizontal spread",
    "FIGO IA2: Invasion 3-5 mm depth, ≤7 mm horizontal spread",
    "Requires cone biopsy with negative margins for definitive diagnosis",
    "Management IA1 (no LVSI): Simple trachelectomy or hysterectomy",
  ];
  microinv.forEach((item, i) => {
    s.addText("• " + item, { x: 6.9, y: 1.8 + i * 0.3, w: 5.8, h: 0.28, fontSize: 10.5, color: C.ltgray, wrap: true });
  });

  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 3.85, w: 6.2, h: 2.9, fill: { color: "#2A0A4A" }, line: { type: "none" } });
  s.addText("Biopsy Report — What to Look For", { x: 6.9, y: 3.92, w: 5.8, h: 0.4, fontSize: 13, bold: true, color: C.gold });

  const biopsyReport = [
    ["Diagnosis", "LSIL / HSIL / CIN grade (LAST preferred). Koilocytes noted."],
    ["Biomarkers", "p16 (block-positive = HSIL). Ki-67 pattern. Both mandatory for CIN 2."],
    ["Orientation", "Specimen orientation (12 o'clock suture). Biopsy site number."],
    ["Depth of Lesion", "Superficial / involving gland crypts / full thickness. Basement membrane intact vs breached."],
    ["Margins (Cone/LEEP)", "Ectocervical margin: positive / negative / close (< 1 mm). Endocervical margin: positive / negative (most critical). Deep margin."],
    ["Ancillary Findings", "Endocervical involvement, angiolymphatic space invasion, concurrent AIS."],
  ];

  biopsyReport.forEach(([label, body], i) => {
    s.addShape(pres.ShapeType.rect, { x: 6.75, y: 4.42 + i * 0.36, w: 5.9, h: 0.33, fill: { color: i % 2 === 0 ? "#1A0A3A" : "#321060" }, line: { type: "none" } });
    s.addText(label + ":", { x: 6.85, y: 4.45 + i * 0.36, w: 1.8, h: 0.28, fontSize: 10, bold: true, color: C.lavender, valign: "middle" });
    s.addText(body, { x: 8.65, y: 4.45 + i * 0.36, w: 3.95, h: 0.28, fontSize: 10, color: C.ltgray, valign: "middle", wrap: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 10 — P16 / KI-67 BIOMARKERS
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "PART 4 — p16 AND Ki-67 IMMUNOHISTOCHEMISTRY IN BIOPSY INTERPRETATION");
  s.addText("Biomarker-Guided Triage of Equivocal Cervical Biopsies", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.darkpurple
  });

  // p16 section
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 6.1, h: 5.5, fill: { color: C.darkpurple }, line: { type: "none" } });
  s.addText("p16 (CDKN2A) Immunohistochemistry", { x: 0.5, y: 1.32, w: 5.7, h: 0.4, fontSize: 14, bold: true, color: C.lavender });

  const p16data = [
    ["Mechanism", "p16 is a cyclin-dependent kinase inhibitor. Normally, pRb suppresses p16. HPV E7 protein inactivates pRb → p16 overexpressed. Block-positive p16 = HPV E7 is active = oncogenic transformation."],
    ["Block-Positive Pattern", "Strong, diffuse cytoplasmic AND nuclear staining throughout full thickness of epithelium (or at least 2/3). This is significant."],
    ["Non-Block Positive", "Focal, patchy, or basal-only staining. NOT considered block-positive. Seen in reactive/inflammatory changes, atrophy, immature metaplasia."],
    ["LSIL + Block p16", "Suggests HSIL risk. Consider upgrading to CIN 2-3. Consult pathologist. Excision rather than ablation."],
    ["CIN 2 + Block p16", "Confirms HSIL → treatment indicated (excision or ablation if TZ type 1-2 and satisfactory colposcopy)."],
    ["CIN 2 + Non-Block p16", "Reclassify as LSIL. Can manage conservatively (observe with co-testing at 1-3 years). Avoids overtreatment."],
    ["Indications", "Mandatory: Any CIN 2 diagnosis (to triage). Equivocal HSIL. Immature squamous metaplasia vs CIN. Atrophy vs HSIL (postmenopausal)."],
    ["Pitfall", "p16 positive in other cancers (oropharyngeal, endocervical, some vulvar). Interpret in context of HPV-driven pathology only."],
  ];

  p16data.forEach(([title, body], i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.4, y: 1.83 + i * 0.6, w: 0.07, h: 0.52, fill: { color: C.lavender }, line: { type: "none" } });
    s.addText(title, { x: 0.57, y: 1.87 + i * 0.6, w: 5.6, h: 0.22, fontSize: 11, bold: true, color: C.lavender });
    s.addText(body, { x: 0.57, y: 2.1 + i * 0.6, w: 5.6, h: 0.3, fontSize: 10, color: C.ltgray, wrap: true });
  });

  // Ki-67 section
  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 1.25, w: 6.2, h: 3.5, fill: { color: "#1A2A3A" }, line: { type: "none" } });
  s.addText("Ki-67 (MIB-1) Proliferation Marker", { x: 6.9, y: 1.32, w: 5.8, h: 0.4, fontSize: 14, bold: true, color: C.gold });

  const ki67data = [
    ["Normal Pattern", "Ki-67 positive cells confined to basal/parabasal layers only. Upper 2/3 of epithelium: Ki-67 negative."],
    ["LSIL (CIN 1)", "Ki-67 positive cells present in upper 1/3 (abnormal). Reflects HPV's ability to maintain proliferation in cells that should be differentiating."],
    ["HSIL (CIN 2-3)", "Ki-67 diffusely positive throughout all layers. Full-thickness proliferative activity. Correlates with degree of dysplasia."],
    ["CINtec PLUS", "Dual stain (p16 + Ki-67 on same cell). If both positive in same cell → highly predictive of CIN 2+ (99% specificity). Used in cervical cytology samples."],
    ["Interpretation", "Use Ki-67 alongside p16. Pattern must be interpreted in architectural context. Ki-67 alone insufficient — always combine with H&E morphology."],
  ];

  ki67data.forEach(([title, body], i) => {
    s.addText("▸ " + title + ":", { x: 6.9, y: 1.83 + i * 0.6, w: 5.8, h: 0.22, fontSize: 11, bold: true, color: C.gold });
    s.addText(body, { x: 6.9, y: 2.06 + i * 0.6, w: 5.8, h: 0.34, fontSize: 10.5, color: C.ltgray, wrap: true });
  });

  // Decision flowchart
  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 4.85, w: 6.2, h: 1.9, fill: { color: C.violet }, line: { type: "none" } });
  s.addText("p16 Triage Algorithm for CIN 2", { x: 6.9, y: 4.92, w: 5.8, h: 0.35, fontSize: 13, bold: true, color: C.white });
  s.addText("Biopsy shows CIN 2", { x: 6.9, y: 5.35, w: 5.8, h: 0.28, fontSize: 11, bold: true, color: C.gold });
  s.addText("↓", { x: 8.8, y: 5.63, w: 1.0, h: 0.25, fontSize: 14, bold: true, color: C.white, align: "center" });
  s.addText("p16 Block-Positive                          p16 Non-Block (Negative/Focal)", {
    x: 6.9, y: 5.9, w: 5.8, h: 0.25, fontSize: 10, color: C.white
  });
  s.addText("        ↓ HSIL confirmed → Treat                           ↓ Reclassify LSIL → Observe", {
    x: 6.9, y: 6.18, w: 5.8, h: 0.25, fontSize: 10, color: C.white
  });
  s.addText("Excision or ablation (if TZ1/2 + satisfactory colposcopy)     Co-testing at 1-3 years", {
    x: 6.9, y: 6.46, w: 5.8, h: 0.25, fontSize: 9.5, color: C.ltgray, italic: true
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 11 — NATURAL HISTORY & RISK STRATIFICATION
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "PART 5 — NATURAL HISTORY & RISK STRATIFICATION");
  s.addText("Regression, Persistence & Progression of CIN Lesions", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 20, bold: true, color: C.darkpurple
  });

  // Natural history table
  s.addText("2-Year Natural History (Robbins & Cotran / Berek & Novak)", { x: 0.4, y: 1.28, w: 12, h: 0.35, fontSize: 13, bold: true, color: C.violet });

  const nhHeaders = ["Lesion", "Regress", "Persist", "Progress to Next Grade", "Progress to Carcinoma"];
  const nhData = [
    ["LSIL (CIN 1)", "60%", "30%", "10% → HSIL", "<1%"],
    ["HSIL (CIN 2)", "40-60%", "20-30%", "20% → CIN 3", "~5%"],
    ["HSIL (CIN 3 / CIS)", "30%", "~60%", "—", "10-12% (2-10 years)"],
  ];
  const nhColW = [2.5, 1.8, 1.8, 3.0, 2.5];
  nhHeaders.forEach((h, ci) => {
    let xp = 0.3 + nhColW.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.ShapeType.rect, { x: xp, y: 1.68, w: nhColW[ci], h: 0.42, fill: { color: C.violet }, line: { type: "none" } });
    s.addText(h, { x: xp + 0.05, y: 1.7, w: nhColW[ci] - 0.1, h: 0.38, fontSize: 11, bold: true, color: C.white, valign: "middle" });
  });
  nhData.forEach((row, ri) => {
    const rowBg = ri === 0 ? "#1E6B3C" : ri === 1 ? "#B07800" : "#A01010";
    row.forEach((cell, ci) => {
      let xp = 0.3 + nhColW.slice(0, ci).reduce((a, b) => a + b, 0);
      s.addShape(pres.ShapeType.rect, { x: xp, y: 2.13 + ri * 0.5, w: nhColW[ci], h: 0.48, fill: { color: rowBg }, line: { color: "000000", pt: 0.2 } });
      s.addText(cell, { x: xp + 0.05, y: 2.16 + ri * 0.5, w: nhColW[ci] - 0.1, h: 0.42, fontSize: 11, bold: ci === 0, color: C.white, valign: "middle" });
    });
  });

  // Risk factors for progression
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.4, w: 6.1, h: 3.9, fill: { color: C.darkpurple }, line: { type: "none" } });
  s.addText("Factors Favoring PROGRESSION", { x: 0.5, y: 3.47, w: 5.7, h: 0.4, fontSize: 13, bold: true, color: C.coral });
  const progFactors = [
    "HPV 16 or 18 infection (high-risk types)",
    "Older age (>35 years) with persistent HPV",
    "Immunosuppression (HIV, transplant, steroids)",
    "High lesion grade at initial biopsy",
    "Persistent HPV positivity >12 months",
    "Smoking (2-4× increased risk)",
    "Multiple HPV type co-infection",
    "Positive ECC (endocervical extension)",
    "CIN 2 with block-positive p16 staining",
    "Large lesion (>2 quadrants of TZ)",
  ];
  progFactors.forEach((f, i) => {
    s.addText("↑  " + f, { x: 0.5, y: 3.97 + i * 0.32, w: 5.7, h: 0.3, fontSize: 11, color: C.ltgray, wrap: true });
  });

  // Factors favoring regression
  s.addShape(pres.ShapeType.rect, { x: 6.7, y: 3.4, w: 6.2, h: 3.9, fill: { color: "#1A3A1A" }, line: { type: "none" } });
  s.addText("Factors Favoring REGRESSION", { x: 6.9, y: 3.47, w: 5.8, h: 0.4, fontSize: 13, bold: true, color: C.green });
  const regFactors = [
    "Age <25 years (high spontaneous clearance rate)",
    "CIN 1 — 60-85% regress within 2 years",
    "Low-risk HPV types (HPV 6, 11, 31, 33)",
    "Short duration of HPV infection (<12 months)",
    "Intact immunity (no immunosuppression)",
    "HPV clearance on follow-up testing",
    "Single HPV type infection",
    "CIN 2 with non-block p16 staining",
    "Small lesion (<1 quadrant)",
    "Postpartum regression — CIN often regresses after delivery",
  ];
  regFactors.forEach((f, i) => {
    s.addText("↓  " + f, { x: 6.9, y: 3.97 + i * 0.32, w: 5.8, h: 0.3, fontSize: 11, color: C.ltgray, wrap: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 12 — MANAGEMENT ALGORITHMS BY CIN GRADE
// ═══════════════════════════════════════════════════════════════════════
{
  const s = darkSlide();
  banner(s, "PART 6 — MANAGEMENT ALGORITHMS BY HISTOLOGIC GRADE (ASCCP 2019)");
  s.addText("Management After Colposcopy-Directed Biopsy Results", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.white
  });

  const mgmtBlocks = [
    {
      grade: "LSIL (CIN 1)", color: C.green, x: 0.3, y: 1.25,
      principle: "Not a cancer precursor. 60-85% regress spontaneously within 2 years. Treatment NOT recommended for CIN 1 alone.",
      options: [
        "Observation with co-testing (Pap + HPV) at 12 and 24 months (preferred)",
        "If co-tests negative ×2: return to 3-year screening",
        "If any abnormal co-test: repeat colposcopy",
        "CIN 1 for 24 months with HSIL on cytology: excision acceptable",
        "CIN 1 for 24 months without HSIL cytology: continue surveillance OR ablation",
        "Ablation acceptable if TZ fully visible, no gland involvement on biopsy, negative ECC",
      ]
    },
    {
      grade: "HSIL (CIN 2)", color: C.amber, x: 0.3, y: 3.85,
      principle: "Treatment threshold. Significant progression risk. TREAT unless patient is pregnant or strongly desires fertility preservation.",
      options: [
        "Satisfactory colposcopy + TZ type 1-2: Ablation (cryotherapy) OR excision (LEEP) both acceptable",
        "Unsatisfactory colposcopy (TZ type 3): Diagnostic excision (LEEP or CKC) — MANDATORY",
        "CIN 2 with negative p16: May observe with co-testing every 6 months ×2 (shared decision-making)",
        "Young women (<25) seeking fertility: Observation with colposcopy q6 months acceptable for CIN 2 (not CIN 3)",
        "After treatment: co-test at 6 months. If negative: annual co-test ×3, then 3-year screening ×20 years.",
      ]
    },
    {
      grade: "HSIL (CIN 3 / CIS)", color: C.coral, x: 6.7, y: 1.25,
      principle: "Definitive treatment MANDATORY. Do not observe. 10-12% progress to carcinoma over 2-10 years.",
      options: [
        "Excisional procedure (LEEP preferred) — preserves fertility vs CKC",
        "Cold knife cone: preferred for AIS, positive ECC, recurrent CIN 3, or suspicion of microinvasion",
        "Hysterectomy: reserved for recurrent/persistent CIN 3 post-excision, positive margins on cone, or when childbearing complete",
        "Endocervical margin positive after excision: repeat excision or hysterectomy",
        "Post-treatment surveillance: Co-test at 6 months. HPV clearance is endpoint. Annual co-test ×3, then 3-year for 20 years.",
        "NEVER ablate without biopsy-confirmed diagnosis first",
      ]
    },
    {
      grade: "AIS (Adenocarcinoma In Situ)", color: C.red, x: 6.7, y: 3.85,
      principle: "High risk. 48% have concurrent invasive disease. Diagnostic excision (cone) mandatory for all. Hysterectomy is standard of care.",
      options: [
        "Diagnostic cold knife cone biopsy — 12 o'clock suture. ECC from residual canal.",
        "NEGATIVE margins on cone: hysterectomy strongly recommended (preferred). Skip lesions common → residual disease despite negative margins.",
        "If fertility desired + negative cone margins: Surveillance q6 months with co-test + ECC for 3 years, then consider hysterectomy",
        "POSITIVE margins: Re-excision or hysterectomy. Never observe positive-margin AIS.",
        "Post-conization surveillance: cytology + colposcopy + HPV + ECC at 6 months if NOT hysterectomy",
      ]
    },
  ];

  mgmtBlocks.forEach(b => {
    const h = b.x === 0.3 ? 2.5 : 2.5;
    s.addShape(pres.ShapeType.rect, { x: b.x, y: b.y, w: 6.2, h: 2.5, fill: { color: b.color }, line: { type: "none" } });
    s.addText(b.grade, { x: b.x + 0.15, y: b.y + 0.08, w: 5.7, h: 0.38, fontSize: 15, bold: true, color: C.white });
    s.addText(b.principle, { x: b.x + 0.15, y: b.y + 0.5, w: 5.7, h: 0.48, fontSize: 10, color: C.white, italic: true, wrap: true });
    b.options.forEach((opt, i) => {
      s.addText("• " + opt, { x: b.x + 0.15, y: b.y + 1.02 + i * 0.25, w: 5.7, h: 0.24, fontSize: 9.5, color: C.white, wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 13 — TREATMENT: CRYOTHERAPY VS LEEP VS CONE
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "PART 7 — TREATMENT MODALITIES COMPARED");
  s.addText("Cryotherapy vs LEEP vs Cold Knife Cone — Indications, Technique & Outcomes", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 18, bold: true, color: C.darkpurple
  });

  const treatments = [
    {
      name: "CRYOTHERAPY", subtitle: "Ablative — No Tissue for Histology",
      color: C.teal, x: 0.3, y: 1.25, w: 4.2,
      indication: "CIN 1 persisting >24 months, or CIN 2 with ALL criteria:",
      criteria: ["Small lesion (<75% ectocervix)", "Ectocervical only (entire lesion visible)", "Negative ECC", "No gland crypt involvement on biopsy", "TZ Type 1 only", "No suspicion of glandular lesion"],
      mechanism: "Freeze-thaw-freeze. Ice ball −20 to −30°C. Nitrous oxide (−89°C) or CO₂ (−65°C). Probe 5mm beyond lesion edge.",
      results: "CIN 1: 94% cure. CIN 2: 91% cure. CIN 3: 82% cure. Large lesions / gland involvement: failure up to 42%.",
      complications: "Watery discharge 2-3 weeks. Rare: bleeding, infection, cervical stenosis.",
      advantage: "Office-based, no anesthesia, inexpensive, no specimens."
    },
    {
      name: "LEEP / LLETZ", subtitle: "Excisional — Tissue for Histology",
      color: C.violet, x: 4.65, y: 1.25, w: 4.2,
      indication: "CIN 2-3 with satisfactory OR unsatisfactory colposcopy; CIN 1 failing 24 months observation; HSIL cytology after negative colposcopy; diagnostic ('see-and-treat')",
      criteria: ["Loop electrode 15-20mm width", "Width chosen to exceed lesion by 5-8mm", "Depth 7-8mm ectocervical", "Endocervical pass (top hat) for canal extension", "Must include SCJ in specimen"],
      mechanism: "High-frequency AC current. Cutting and coagulation simultaneously. Local anesthesia (cervical block). Specimens in formalin.",
      results: "CIN 2/3 clearance rate 90-95%. Recurrence 5-10% over 2 years. Positive margin → 3-6× increased recurrence risk.",
      complications: "Bleeding (primary + secondary), infection, cervical stenosis, preterm birth risk (2× increase for future pregnancies).",
      advantage: "Office-based under local, provides histology, therapeutic and diagnostic in one step."
    },
    {
      name: "COLD KNIFE CONE", subtitle: "Excisional — Gold Standard Margins",
      color: C.plum, x: 9.0, y: 1.25, w: 4.0,
      indication: "AIS (preferred), unsatisfactory LEEP margins, recurrent CIN 3, suspicion of microinvasion, large endocervical lesion, TZ Type 3 with HSIL",
      criteria: ["Scalpel (no thermal artifact)", "Shape: broad base (premenopausal) vs narrow apex (postmenopausal)", "12 o'clock suture orientation", "ECC from residual canal always after cone"],
      mechanism: "OR / GA or spinal. Lugol's to map lesion. Circumferential scalpel incision. Angle inward centrally. Measure specimen.",
      results: "Margin positive = 70% residual AIS in hysterectomy. Negative margin: residual disease still possible (skip lesions).",
      complications: "Cervical stenosis, incompetent cervix, preterm labor (higher risk than LEEP), hemorrhage.",
      advantage: "Best margin quality, best for glandular lesions, no thermal artifact affecting margin assessment."
    },
  ];

  treatments.forEach(t => {
    s.addShape(pres.ShapeType.rect, { x: t.x, y: t.y, w: t.w, h: 6.0, fill: { color: t.color }, line: { type: "none" } });
    s.addText(t.name, { x: t.x + 0.15, y: t.y + 0.1, w: t.w - 0.3, h: 0.38, fontSize: 14, bold: true, color: C.white });
    s.addText(t.subtitle, { x: t.x + 0.15, y: t.y + 0.5, w: t.w - 0.3, h: 0.28, fontSize: 10, italic: true, color: C.gold });

    const labels = ["Indication", "Criteria", "Technique", "Outcomes", "Complications", "Advantage"];
    const bodies = [t.indication, t.criteria.map(c => "• " + c).join("\n"), t.mechanism, t.results, t.complications, t.advantage];
    let yOff = 0.88;
    labels.forEach((lbl, i) => {
      s.addText(lbl + ":", { x: t.x + 0.15, y: t.y + yOff, w: t.w - 0.3, h: 0.22, fontSize: 10, bold: true, color: C.gold });
      yOff += 0.22;
      const lines = bodies[i].split("\n").length;
      const lineH = Math.min(0.78, lines * 0.2 + 0.1);
      s.addText(bodies[i], { x: t.x + 0.15, y: t.y + yOff, w: t.w - 0.3, h: lineH + 0.1, fontSize: 9.5, color: C.white, wrap: true });
      yOff += lineH + 0.18;
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 14 — MARGIN INTERPRETATION AND POST-TREATMENT SURVEILLANCE
// ═══════════════════════════════════════════════════════════════════════
{
  const s = darkSlide();
  banner(s, "PART 7 — MARGIN STATUS & POST-TREATMENT SURVEILLANCE");
  s.addText("Interpreting Excision Margins and Planning Follow-Up", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.white
  });

  // Margin types
  s.addText("Margin Interpretation (LEEP / Cone Specimen)", { x: 0.3, y: 1.25, w: 12.7, h: 0.4, fontSize: 14, bold: true, color: C.gold });

  const margins = [
    { type: "Clear (Negative) Margins", color: C.green, desc: "No dysplastic cells at any margin. Disease completely excised. Risk of residual disease: ~5-10% (depending on grade). Proceed to surveillance protocol." },
    { type: "Close Margins (<1 mm)", color: C.amber, desc: "Dysplastic cells present very close to but not at the inked margin. Risk of residual ~15-20%. Manage as positive margins in high-grade lesions. For CIN 1-2, surveillance acceptable." },
    { type: "Ectocervical Margin Positive", color: "#8B5A00", desc: "Dysplasia present at ectocervical margin. Risk of residual ~25-35%. For CIN 3: repeat co-test at 6 months. If positive: repeat excision or hysterectomy. For AIS: re-excision or hysterectomy." },
    { type: "Endocervical Margin Positive", color: C.coral, desc: "HIGHEST RISK margin. Disease extends into canal — lesion not fully excised. For CIN 3: repeat excision strongly recommended. For AIS: hysterectomy or re-excision mandatory." },
    { type: "Cannot Assess Margins (Fragmented)", color: C.midgray, desc: "Specimen fragmented — thermal artifact or multiple pieces prevent margin evaluation. Treat as positive margin. For CIN 3 or AIS: re-excision or hysterectomy." },
  ];

  margins.forEach((m, i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.73 + i * 0.85, w: 3.5, h: 0.78, fill: { color: m.color }, line: { type: "none" } });
    s.addText(m.type, { x: 0.45, y: 1.78 + i * 0.85, w: 3.2, h: 0.68, fontSize: 11, bold: true, color: C.white, valign: "middle", wrap: true });
    s.addShape(pres.ShapeType.rect, { x: 3.85, y: 1.73 + i * 0.85, w: 9.15, h: 0.78, fill: { color: "#1A1030" }, line: { type: "none" } });
    s.addShape(pres.ShapeType.rect, { x: 3.85, y: 1.73 + i * 0.85, w: 0.06, h: 0.78, fill: { color: m.color }, line: { type: "none" } });
    s.addText(m.desc, { x: 4.0, y: 1.78 + i * 0.85, w: 9.0, h: 0.68, fontSize: 11, color: C.ltgray, valign: "middle", wrap: true });
  });

  // Post-treatment surveillance
  s.addText("Post-Treatment Surveillance Protocol (ASCCP 2019)", { x: 0.3, y: 6.05, w: 12.7, h: 0.38, fontSize: 14, bold: true, color: C.gold });

  const surveillance = [
    { label: "6 months post-treatment", body: "Co-test (Pap + HPV). If BOTH negative → proceed to step 2." },
    { label: "12 months post-treatment", body: "Co-test again. If BOTH negative at 6 AND 12 months → annual co-testing." },
    { label: "Annual × 3 years", body: "Annual co-testing. If all negative → return to 3-year interval." },
    { label: "3-yearly × 20 years", body: "Co-test every 3 years for at least 20 years (even if >65 — treated CIN overrides standard stop-at-65 guideline)." },
  ];

  surveillance.forEach((sv, i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.3 + i * 3.25, y: 6.5, w: 3.1, h: 0.85, fill: { color: C.violet }, line: { type: "none" } });
    s.addText(sv.label, { x: 0.45 + i * 3.25, y: 6.55, w: 2.85, h: 0.3, fontSize: 10, bold: true, color: C.gold });
    s.addText(sv.body, { x: 0.45 + i * 3.25, y: 6.87, w: 2.85, h: 0.42, fontSize: 9.5, color: C.white, wrap: true });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 15 — DISCORDANT RESULTS (CYTOLOGY-HISTOLOGY MISMATCH)
// ═══════════════════════════════════════════════════════════════════════
{
  const s = lightSlide();
  banner(s, "CLINICAL PATHOLOGIC CORRELATION — DISCORDANT RESULTS");
  s.addText("When Cytology and Biopsy Don't Match — A Systematic Approach", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.darkpurple
  });

  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.25, w: 12.7, h: 0.75, fill: { color: C.violet }, line: { type: "none" } });
  s.addText("Principle (Berek & Novak's): Cytology, biopsy, and molecular testing results should be reviewed TOGETHER by pathologist and colposcopist. When cytology indicates a more significant lesion than histology, further evaluation is required.", {
    x: 0.5, y: 1.3, w: 12.3, h: 0.65, fontSize: 11, bold: true, color: C.white, valign: "middle", wrap: true
  });

  const scenarios = [
    {
      cytology: "HSIL", histology: "CIN 1 or Negative",
      color: C.coral, x: 0.3, y: 2.1,
      explanation: "Most common discordance. Causes: sampling error (biopsy missed the worst area), lesion located high in canal (not visible), regression, or false-positive cytology.",
      action: [
        "Review cytology and histology slides with pathologist",
        "Repeat colposcopy with multiple directed biopsies + ECC",
        "If second colposcopy also negative: diagnostic excisional procedure (LEEP / CKC) — mandatory",
        "Do NOT simply re-screen with Pap in 6 months for HSIL cytology",
        "NEVER accept 'no lesion' as final answer when HSIL cytology is present",
      ]
    },
    {
      cytology: "LSIL or ASC-US", histology: "CIN 3",
      color: "#7B2000", x: 0.3, y: 4.55,
      explanation: "Underestimated by cytology. Common if lesion is predominantly endocervical. Biopsy result takes precedence — manage per histology (CIN 3).",
      action: [
        "Biopsy result OVERRIDES cytology — manage as CIN 3",
        "Excision (LEEP or CKC) required",
        "Review cytology for missed features — quality audit",
      ]
    },
    {
      cytology: "AGC", histology: "Benign Endocervix",
      color: "#1A2A6A", x: 6.7, y: 2.1,
      explanation: "AGC may reflect endometrial pathology, not just cervical. Benign cervical biopsy does NOT exclude endometrial carcinoma, which is the major concern with AGC.",
      action: [
        "Add endometrial sampling (EMB or hysteroscopy) if not already done",
        "Review ECC findings carefully",
        "Consider repeat colposcopy if initial was unsatisfactory",
        "If all workup negative: co-test in 1 year",
        "Persistent AGC after negative workup: excision to exclude AIS",
      ]
    },
    {
      cytology: "ASC-H", histology: "Negative",
      color: "#2A4A1A", x: 6.7, y: 4.55,
      explanation: "ASC-H carries 5-10% risk of underlying CIN 2-3. Negative colposcopy does not exclude it. Lesion may be small, high-grade, and located in the canal.",
      action: [
        "Review cytology specimen for adequacy",
        "Repeat colposcopy with more thorough survey + ECC",
        "HPV 16/18 genotyping to risk-stratify",
        "If HPV 16/18 positive: proceed to excision",
        "If HPV negative: co-test at 1 year (ASCCP 2019)",
      ]
    },
  ];

  scenarios.forEach(sc => {
    s.addShape(pres.ShapeType.rect, { x: sc.x, y: sc.y, w: 6.2, h: 2.35, fill: { color: sc.color }, line: { type: "none" } });
    s.addText(`Cytology: ${sc.cytology}  ↔  Biopsy: ${sc.histology}`, { x: sc.x + 0.15, y: sc.y + 0.08, w: 5.7, h: 0.38, fontSize: 13, bold: true, color: C.gold });
    s.addText(sc.explanation, { x: sc.x + 0.15, y: sc.y + 0.5, w: 5.7, h: 0.42, fontSize: 10, italic: true, color: C.white, wrap: true });
    sc.action.forEach((a, i) => {
      s.addText("→ " + a, { x: sc.x + 0.15, y: sc.y + 0.98 + i * 0.27, w: 5.7, h: 0.25, fontSize: 10, color: C.white, wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 16 — QUICK REFERENCE TABLE
// ═══════════════════════════════════════════════════════════════════════
{
  const s = darkSlide();
  banner(s, "QUICK REFERENCE — COLPOSCOPY BIOPSY RESULTS AT A GLANCE");
  s.addText("Complete Summary Table: Finding → Histology → Management", {
    x: 0.4, y: 0.65, w: 12, h: 0.5, fontSize: 19, bold: true, color: C.white
  });

  const qrHeaders = ["Colposcopic Finding", "Expected Histology", "p16 / Ki-67", "Management", "Surveillance"];
  const qrData = [
    ["Normal / No lesion", "Normal squamous / Metaplasia", "Negative", "Return to screening per age protocol", "Per guidelines"],
    ["Thin acetowhite, fine vessels", "LSIL (CIN 1) / HPV effect", "Negative or focal", "Observe with co-test q12-24m", "Co-test ×2, then 3-year"],
    ["Dense AW, fine punctation", "LSIL (CIN 1) to HSIL (CIN 2)", "p16 block = HSIL", "Biopsy; treat if CIN 2+ or p16+", "Per treatment"],
    ["Dense AW, coarse punctation", "HSIL (CIN 2-3)", "Block-positive p16", "Excision (LEEP) or ablation if TZ1", "Co-test q6m, then annual ×3, 3-yr ×20y"],
    ["Coarse mosaic + AW", "HSIL (CIN 2-3)", "Block-positive p16", "Excision mandatory", "Co-test q6m post-treatment"],
    ["Atypical vessels", "Microinvasion / Invasive Ca", "N/A (biopsy urgent)", "Immediate biopsy; oncology referral", "Per oncology"],
    ["Leukoplakia", "CIN any grade / Keratinizing Ca", "Per biopsy result", "Biopsy FIRST then manage per grade", "Per result"],
    ["Iodine-negative without AW", "Metaplasia / CIN 1", "Usually negative", "Biopsy if any concern; otherwise co-test", "Per result"],
    ["CIN 1 (histology)", "LSIL", "Negative", "Observe 24 months; ablation if persists", "Co-test q12m"],
    ["CIN 2 (histology)", "HSIL — equivocal", "Determines treatment", "p16 block: treat; p16 negative: observe", "Per decision"],
    ["CIN 3 (histology)", "HSIL — definitive", "Block-positive", "Excision mandatory (LEEP or CKC)", "Long-term 20 years"],
    ["AIS (histology)", "Glandular HSIL", "Block-positive", "Diagnostic cone → hysterectomy", "Strict long-term"],
    ["Microinvasion (histology)", "FIGO IA", "Block-positive", "Gynecology oncology referral", "Per stage"],
  ];

  const qrColW = [2.8, 2.5, 1.8, 3.5, 2.2];
  qrHeaders.forEach((h, ci) => {
    let xp = 0.3 + qrColW.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.ShapeType.rect, { x: xp, y: 1.25, w: qrColW[ci], h: 0.4, fill: { color: C.violet }, line: { type: "none" } });
    s.addText(h, { x: xp + 0.04, y: 1.27, w: qrColW[ci] - 0.08, h: 0.36, fontSize: 10.5, bold: true, color: C.white, valign: "middle" });
  });

  qrData.forEach((row, ri) => {
    const riskLevel = ri <= 1 ? "#1A2A1A" : ri <= 3 ? "#2A1A00" : ri <= 7 ? "#2A0800" : ri <= 9 ? "#3A0800" : "#250040";
    row.forEach((cell, ci) => {
      let xp = 0.3 + qrColW.slice(0, ci).reduce((a, b) => a + b, 0);
      s.addShape(pres.ShapeType.rect, { x: xp, y: 1.68 + ri * 0.42, w: qrColW[ci], h: 0.4, fill: { color: riskLevel }, line: { color: "222244", pt: 0.2 } });
      s.addText(cell, { x: xp + 0.04, y: 1.71 + ri * 0.42, w: qrColW[ci] - 0.08, h: 0.36, fontSize: 9.5, color: C.ltgray, valign: "middle", wrap: true });
    });
  });
}

// ═══════════════════════════════════════════════════════════════════════
// SLIDE 17 — CLOSING / KEY TAKE-HOME POINTS
// ═══════════════════════════════════════════════════════════════════════
{
  const s = darkSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.8, fill: { color: C.violet } });
  s.addText("KEY TAKE-HOME POINTS", { x: 0.4, y: 0.1, w: 12.5, h: 0.6, fontSize: 18, bold: true, color: C.white });

  const points = [
    ["TZ Visibility = Gatekeeper", "Always establish TZ type (1/2/3) before management. Unsatisfactory colposcopy → diagnostic excision, not ablation, not observation."],
    ["Acetowhite Density Matters", "Thin/translucent AW = low-grade. Dense/opaque AW + coarse vascular patterns (punctation, mosaic) = CIN 2-3. Atypical vessels = invasive carcinoma until proven otherwise."],
    ["p16 Resolves CIN 2 Ambiguity", "For any CIN 2 diagnosis, p16 is mandatory. Block-positive → treat as HSIL. Non-block → reclassify as LSIL, observe. This avoids both overtreatment and undertreatment."],
    ["Never Ablate Without Histology", "Ablation (cryotherapy) is NEVER acceptable without biopsy-confirmed diagnosis. Always biopsy before any ablative treatment."],
    ["Discordant Results Demand Action", "HSIL cytology + negative biopsy is NOT reassuring. Repeat colposcopy + ECC. If still negative: diagnostic excision. Never accept discordance without resolution."],
    ["AIS Has Skip Lesions", "Even negative cone margins do not guarantee clearance of AIS. Hysterectomy is the recommended treatment. If fertility desired, strict surveillance with ECC every 6 months."],
    ["Surveillance is Long-Term", "Post-treatment surveillance for CIN 3 / AIS is 20 years (not 5, not 10). HPV clearance is the surveillance endpoint. Treated patients do NOT return to standard 3-year screening."],
  ];

  points.forEach(([title, body], i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.9 + i * 0.91, w: 0.5, h: 0.8, fill: { color: C.lavender }, line: { type: "none" } });
    s.addText(String(i + 1), { x: 0.3, y: 1.0 + i * 0.91, w: 0.5, h: 0.6, fontSize: 16, bold: true, color: C.white, align: "center" });
    s.addText(title + ": ", { x: 0.9, y: 0.97 + i * 0.91, w: 2.8, h: 0.75, fontSize: 11, bold: true, color: C.gold, wrap: true, valign: "top" });
    s.addText(body, { x: 3.55, y: 0.97 + i * 0.91, w: 9.5, h: 0.75, fontSize: 11, color: C.ltgray, wrap: true, valign: "top" });
  });

  s.addShape(pres.ShapeType.rect, { x: 0, y: 7.22, w: 13.3, h: 0.28, fill: { color: C.violet } });
  s.addText("Berek & Novak's Gynecology | Robbins & Cotran Pathologic Basis of Disease | Pfenninger & Fowler's Procedures for Primary Care | Sabiston Textbook of Surgery", {
    x: 0.3, y: 7.24, w: 12.7, h: 0.22, fontSize: 8.5, color: C.white, italic: true
  });
}

// ─── WRITE FILE ──────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/endometrial-pap-pptx/Colposcopy_Guided_Biopsy_Interpretation.pptx" })
  .then(() => console.log("SUCCESS: Colposcopy deck saved."))
  .catch(err => console.error("ERROR:", err));
Running Command

cd /home/daytona/workspace/endometrial-pap-pptx && node build_colposcopy.js 2>&1

Clean build with no warnings. Your second deck is ready:

Colposcopy Guided Biopsy Interpretation

Presentation · PPTX


What's Inside (17 Slides)

The deck uses a dark purple/violet/lavender palette to visually distinguish it from the first deck.

Slide-by-Slide Breakdown

SlideTopicKey Content
1Title
2Table of Contents7-part overview
3TZ AnatomySCJ, ectropion, TZ Types 1/2/3 (IFCPC 2011) with color-coded risk
4Procedure Steps8-step colposcopy protocol (prep → acetic acid → biopsy → ECC → hemostasis)
5Satisfactory vs UnsatisfactorySide-by-side comparison with ASCCP rule: unsatisfactory = excision, never ablation
6Colposcopic FindingsAcetowhite, leukoplakia, punctation, mosaic, atypical vessels, Lugol's — all with mechanism + significance
7Grading SystemsReid Colposcopic Index (4 criteria, score 0-8) + IFCPC Grade 1/2 terminology
8LAST TerminologyOld dysplasia → CIN → LAST two-tier table + CIN 1 and CIN 2 histologic features
9CIN 3 / MicroinvasionFull-thickness atypia features, rag sign, FIGO IA staging, biopsy report checklist
10p16 / Ki-67 BiomarkersMechanism, block-positive vs non-block, CIN 2 triage algorithm, CINtec PLUS
11Natural HistoryRegression/persistence/progression table (LSIL 60% regress; HSIL 10% → carcinoma) + risk factors for progression vs regression
12ASCCP Management AlgorithmsCIN 1, CIN 2, CIN 3, AIS — with fertility considerations
13Treatment ComparisonCryotherapy vs LEEP vs Cold Knife Cone — indications, technique, cure rates, complications
14Margins & SurveillanceAll 5 margin types + post-treatment 20-year surveillance protocol
15Discordant Results4 mismatch scenarios (HSIL cytology + negative biopsy, etc.) with systematic resolution
16Quick Reference Table13-row summary: colposcopic finding → histology → p16 → management
17Key Take-Home Points7 clinically critical rules
Sources: Berek & Novak's Gynecology | Robbins & Cotran Pathologic Basis of Disease | Pfenninger & Fowler's Procedures for Primary Care | Sabiston Textbook of Surgery
This is a shared conversation. Sign in to Orris to start your own chat.