Hi I have to make a ppt for my pediatrics department the topic is" approach to edema" .please refer standard textbook and modern articles and prepare a ppt with diagrams ,picture and flowcharts wherever necessary to make it professional and appealing to undergraduate students.i have attached a ppt based on same topic for reference,don't use the students name in first page of ppt I have given

Reading File
Reading File
Reading File
Running Command

cd /home/daytona/workspace/attachments/a7d4a989-4cd8-4dce-bf30-0a02a3bd9f95 && python -m markitdown "APPROACH TO EDEMA.pptx" 2>/dev/null | head -300

Finding Sources
Searching PubMed

"edema" AND "children" AND "approach"

Running Command

cd /home/daytona/workspace/attachments/a7d4a989-4cd8-4dce-bf30-0a02a3bd9f95 && python -m markitdown "APPROACH TO EDEMA.pptx" 2>/dev/null

Reading File
Reading File
Running Command

cd /home/daytona/workspace/attachments/a7d4a989-4cd8-4dce-bf30-0a02a3bd9f95 && python3 -c " import zipfile, os fname = 'APPROACH TO EDEMA.pptx' with zipfile.ZipFile(fname, 'r') as z: files = z.namelist() print('\n'.join(files[:30])) "

Reading File
Finding Sources
Running Command

cd /home/daytona/workspace/attachments/a7d4a989-4cd8-4dce-bf30-0a02a3bd9f95 && python3 -c " import zipfile, xml.etree.ElementTree as ET, re fname = 'APPROACH TO EDEMA.pptx' ns = {'a': 'http://schemas.openxmlformats.org/drawingml/2006/main', 'p': 'http://schemas.openxmlformats.org/presentationml/2006/main'} with zipfile.ZipFile(fname, 'r') as z: slides = sorted([f for f in z.namelist() if f.startswith('ppt/slides/slide') and f.endswith('.xml')]) for i, sl in enumerate(slides[:30], 1): xml_content = z.read(sl).decode('utf-8') root = ET.fromstring(xml_content) texts = [] for t in root.iter('{http://schemas.openxmlformats.org/drawingml/2006/main}t'): if t.text and t.text.strip(): texts.append(t.text.strip()) if texts: print(f'--- Slide {i}: {sl} ---') print(' | '.join(texts[:20])) print() "

Finding Sources
Searching the Web

approach to edema in children pediatrics clinical algorithm 2024

Running Command

cd /home/daytona/workspace/attachments/a7d4a989-4cd8-4dce-bf30-0a02a3bd9f95 && python3 -c " import zipfile, xml.etree.ElementTree as ET fname = 'APPROACH TO EDEMA.pptx' ns = {'a': 'http://schemas.openxmlformats.org/drawingml/2006/main'} with zipfile.ZipFile(fname, 'r') as z: slides = sorted([f for f in z.namelist() if f.startswith('ppt/slides/slide') and f.endswith('.xml')]) for i, sl in enumerate(slides, 1): xml_content = z.read(sl).decode('utf-8') root = ET.fromstring(xml_content) texts = [] for t in root.iter('{http://schemas.openxmlformats.org/drawingml/2006/main}t'): if t.text and t.text.strip(): texts.append(t.text.strip()) if texts: print(f'=== Slide {i} ===') print('\n'.join(texts)) print() " 2>/dev/null

Reading File
Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.

Have you prepared

Running Command

node /home/daytona/skills/shared/scripts/fetch_images.js \ "https://cdn.orris.care/cdss_images/ad507b144b4c48f573d9138a61bccc0bbe6ebb7b00e4b9592a0cedd842d26b6c.png" \ "https://cdn.orris.care/cdss_images/57d59928a0d18fe70096eaa731deab743dbd806ddcfd653528233c432b899179.png" 2>/dev/null | python3 -c " import sys, json data = json.load(sys.stdin) for d in data: print(d['url'][:60], '|', 'OK' if d.get('base64') else 'FAIL', '|', len(d.get('base64','')) if d.get('base64') else 0) "

Running Command

ls /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/edema-ppt

Writing File

~/edema-ppt/build.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// ── Fetch images ──────────────────────────────────────────────────────────────
const imgUrls = [
  "https://cdn.orris.care/cdss_images/ad507b144b4c48f573d9138a61bccc0bbe6ebb7b00e4b9592a0cedd842d26b6c.png", // edema pathways flowchart (Fig 3.3)
  "https://cdn.orris.care/cdss_images/57d59928a0d18fe70096eaa731deab743dbd806ddcfd653528233c432b899179.png", // nutmeg liver / histology
];
const imgs = JSON.parse(
  execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imgUrls.map((u) => `"${u}"`).join(" ")}`
  ).toString()
);
const edemaPathwayImg = imgs[0].base64;   // systemic edema pathways flowchart
const histologyImg    = imgs[1].base64;   // histology image

// ── Color Palette ─────────────────────────────────────────────────────────────
const C = {
  navy:      "0D2B55",   // dominant dark
  teal:      "1A7A8A",   // secondary
  sky:       "4DB6C8",   // accent light
  amber:     "F0A500",   // highlight / accent
  white:     "FFFFFF",
  lightBg:   "EBF5F8",
  midBg:     "D0ECF2",
  textDark:  "1C1C2E",
  textGray:  "4A5568",
  red:       "C0392B",
  green:     "1E8449",
  purple:    "6C3483",
  orange:    "E67E22",
};

const pres = new pptxgen();
pres.layout  = "LAYOUT_16x9";
pres.title   = "Approach to Edema – Pediatrics";
pres.author  = "Pediatrics Department";

// ══════════════════════════════════════════════════════════════════════════════
// HELPER FUNCTIONS
// ══════════════════════════════════════════════════════════════════════════════

function addSlideHeader(slide, title, subtitle = "") {
  // Dark header bar
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.navy } });
  slide.addText(title, {
    x: 0.25, y: 0, w: 9.5, h: 0.75,
    fontSize: 22, bold: true, color: C.white,
    valign: "middle", fontFace: "Calibri",
  });
  if (subtitle) {
    slide.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 0.32, fill: { color: C.teal } });
    slide.addText(subtitle, {
      x: 0.25, y: 0.75, w: 9.5, h: 0.32,
      fontSize: 12, color: C.white, italic: true, valign: "middle", fontFace: "Calibri",
    });
  }
  // bottom rule
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.45, w: 10, h: 0.18, fill: { color: C.teal } });
}

function addBullets(slide, items, opts = {}) {
  const { x = 0.35, y = 1.15, w = 9.3, h = 4.1, fontSize = 17, color = C.textDark, indent = 0.3 } = opts;
  const textArr = items.map((item, i) => {
    if (typeof item === "string") {
      return { text: item, options: { bullet: { indent }, breakLine: i < items.length - 1, fontSize, color, fontFace: "Calibri" } };
    }
    // object: {text, sub, bold, color}
    return { text: item.text, options: { bullet: { indent }, breakLine: i < items.length - 1, fontSize: item.fontSize || fontSize, bold: item.bold || false, color: item.color || color, fontFace: "Calibri" } };
  });
  slide.addText(textArr, { x, y, w, h, valign: "top" });
}

function box(slide, text, x, y, w, h, bgColor, textColor = C.white, fontSize = 13, bold = false) {
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w, h,
    fill: { color: bgColor },
    line: { color: C.navy, width: 1 },
    rectRadius: 0.08,
  });
  slide.addText(text, {
    x, y, w, h,
    align: "center", valign: "middle",
    fontSize, color: textColor,
    bold, fontFace: "Calibri",
    wrap: true,
  });
}

function arrow(slide, x1, y1, x2, y2) {
  slide.addShape(pres.ShapeType.line, {
    x: x1, y: y1, w: x2 - x1, h: y2 - y1,
    line: { color: C.navy, width: 1.5, endArrowType: "triangle" },
  });
}

function arrowDown(slide, x, y1, y2) {
  arrow(slide, x, y1, x, y2);
}

function sectionBadge(slide, label, color = C.teal) {
  slide.addShape(pres.ShapeType.roundRect, {
    x: 0.25, y: 1.1, w: 2.2, h: 0.38,
    fill: { color }, rectRadius: 0.12,
  });
  slide.addText(label, {
    x: 0.25, y: 1.1, w: 2.2, h: 0.38,
    align: "center", valign: "middle",
    fontSize: 11, color: C.white, bold: true, fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE SLIDE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  // Full dark background
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.navy } });
  // Accent strip
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 3.8, w: 10, h: 0.08, fill: { color: C.amber } });
  // Decorative circle
  sl.addShape(pres.ShapeType.ellipse, { x: 7.5, y: -0.5, w: 3.5, h: 3.5, fill: { color: C.teal }, line: { color: C.teal } });
  sl.addShape(pres.ShapeType.ellipse, { x: 7.8, y: -0.2, w: 3.0, h: 3.0, fill: { color: C.sky }, line: { color: C.sky } });

  sl.addText("APPROACH TO EDEMA", {
    x: 0.6, y: 1.2, w: 7, h: 1.1,
    fontSize: 38, bold: true, color: C.white, fontFace: "Calibri",
  });
  sl.addText("A Clinical Guide for Undergraduate Students", {
    x: 0.6, y: 2.35, w: 7, h: 0.55,
    fontSize: 18, color: C.sky, fontFace: "Calibri", italic: true,
  });
  sl.addShape(pres.ShapeType.rect, { x: 0.6, y: 2.95, w: 4.5, h: 0.05, fill: { color: C.amber } });
  sl.addText("Department of Pediatrics", {
    x: 0.6, y: 3.1, w: 5, h: 0.4,
    fontSize: 14, color: C.amber, fontFace: "Calibri",
  });
  sl.addText("Reference: Harrison's 22E • Robbins Pathology 10E • Nelson's Textbook of Pediatrics", {
    x: 0.6, y: 5.05, w: 9, h: 0.35,
    fontSize: 9, color: "AAAACC", fontFace: "Calibri", italic: true,
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW / CONTENTS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.lightBg } });
  addSlideHeader(sl, "Contents at a Glance");

  const topics = [
    ["01", "Definition & Terminology", C.navy],
    ["02", "Pathophysiology & Starling Forces", C.teal],
    ["03", "Classification of Edema", C.purple],
    ["04", "Causes in Children (Mnemonic)", C.orange],
    ["05", "Clinical Evaluation – History & Examination", C.green],
    ["06", "Investigation Approach", C.red],
    ["07", "Diagnostic Flowchart", C.navy],
    ["08", "Management Principles", C.teal],
    ["09", "Summary & Key Points", C.amber],
  ];

  topics.forEach(([num, label, color], i) => {
    const col = i < 5 ? 0 : 1;
    const row = i < 5 ? i : i - 5;
    const x = col === 0 ? 0.3 : 5.2;
    const y = 1.08 + row * 0.82;
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 4.6, h: 0.65, fill: { color }, rectRadius: 0.1 });
    sl.addText(`${num}`, { x, y, w: 0.7, h: 0.65, align: "center", valign: "middle", fontSize: 18, bold: true, color: C.white, fontFace: "Calibri" });
    sl.addText(label, { x: x + 0.75, y, w: 3.8, h: 0.65, valign: "middle", fontSize: 14, color: C.white, fontFace: "Calibri" });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — DEFINITION & TERMINOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.white } });
  addSlideHeader(sl, "Definition & Terminology");

  // Definition box
  sl.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 1.15, w: 9.4, h: 0.95, fill: { color: C.navy }, rectRadius: 0.1 });
  sl.addText([
    { text: "EDEMA", options: { bold: true, color: C.amber, fontSize: 17 } },
    { text: "  —  Abnormal accumulation of fluid in the interstitial space", options: { color: C.white, fontSize: 16 } },
  ], { x: 0.3, y: 1.15, w: 9.4, h: 0.95, align: "center", valign: "middle", fontFace: "Calibri" });

  // Key terms grid
  const terms = [
    ["Anasarca", "Severe generalized edema involving subcutaneous tissue + body cavities", C.teal],
    ["Hydrothorax", "Fluid in pleural cavity (pleural effusion)", C.purple],
    ["Hydropericardium", "Fluid in pericardial cavity", C.orange],
    ["Ascites / Hydroperitoneum", "Fluid in peritoneal cavity", C.green],
    ["Transudate", "Protein-poor fluid; low hydrostatic / low oncotic cause", C.red],
    ["Exudate", "Protein-rich fluid; increased vascular permeability (inflammation)", C.navy],
  ];

  terms.forEach(([term, def, color], i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.3 : 5.2;
    const y = 2.3 + row * 1.05;
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 4.6, h: 0.95, fill: { color: "F7FAFA" }, line: { color, width: 2 }, rectRadius: 0.08 });
    sl.addText(term, { x: x + 0.1, y: y + 0.04, w: 4.4, h: 0.35, fontSize: 13, bold: true, color, fontFace: "Calibri" });
    sl.addText(def,  { x: x + 0.1, y: y + 0.38, w: 4.4, h: 0.52, fontSize: 11, color: C.textDark, fontFace: "Calibri", wrap: true });
  });
  sl.addText("Source: Robbins & Kumar Basic Pathology 10e, Ch.3", { x: 0, y: 5.42, w: 10, h: 0.2, align: "right", fontSize: 8, color: C.textGray, fontFace: "Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — PATHOPHYSIOLOGY: STARLING FORCES
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.lightBg } });
  addSlideHeader(sl, "Pathophysiology — Starling Forces", "Fluid movement across the capillary wall");

  // Starling equation display
  sl.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 1.15, w: 9.4, h: 0.72, fill: { color: C.navy }, rectRadius: 0.08 });
  sl.addText("Net Filtration = Kf [ (Pc − Pi) − σ(πc − πi) ]", {
    x: 0.3, y: 1.15, w: 9.4, h: 0.72,
    align: "center", valign: "middle",
    fontSize: 18, bold: true, color: C.amber, fontFace: "Calibri",
  });

  // Left panel: forces
  sl.addShape(pres.ShapeType.rect, { x: 0.3, y: 2.0, w: 4.5, h: 3.25, fill: { color: C.white }, line: { color: C.teal, width: 1.5 } });
  sl.addText("Forces Governing Fluid Movement", { x: 0.3, y: 2.0, w: 4.5, h: 0.4, align: "center", valign: "middle", fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", fill: { color: C.teal } });

  const forces = [
    ["⬆ Capillary Hydrostatic Pressure (Pc)", "Pushes fluid OUT → favours filtration", C.red],
    ["⬆ Interstitial Osmotic Pressure (πi)", "Pulls fluid OUT → favours filtration", C.orange],
    ["⬆ Plasma Oncotic Pressure (πc)", "Pulls fluid IN → opposes filtration", C.green],
    ["⬆ Interstitial Hydrostatic Pressure (Pi)", "Pushes fluid IN → opposes filtration", C.teal],
  ];
  forces.forEach(([label, desc, color], i) => {
    const y = 2.48 + i * 0.68;
    sl.addShape(pres.ShapeType.roundRect, { x: 0.4, y, w: 4.3, h: 0.6, fill: { color: "FAFCFC" }, line: { color, width: 1.5 }, rectRadius: 0.06 });
    sl.addText(label, { x: 0.5, y: y + 0.02, w: 4.1, h: 0.28, fontSize: 10.5, bold: true, color, fontFace: "Calibri" });
    sl.addText(desc,  { x: 0.5, y: y + 0.3,  w: 4.1, h: 0.25, fontSize: 9.5, color: C.textGray, fontFace: "Calibri" });
  });

  // Right panel: causes of edema from Starling
  sl.addShape(pres.ShapeType.rect, { x: 5.2, y: 2.0, w: 4.5, h: 3.25, fill: { color: C.white }, line: { color: C.purple, width: 1.5 } });
  sl.addText("How Edema Forms", { x: 5.2, y: 2.0, w: 4.5, h: 0.4, align: "center", valign: "middle", fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", fill: { color: C.purple } });

  const mechanisms = [
    ["↑ Hydrostatic pressure", "CCF, venous obstruction", C.red],
    ["↓ Oncotic pressure", "Hypoalbuminemia (NS, liver, malnutrition)", C.orange],
    ["↑ Capillary permeability", "Inflammation, allergy, sepsis", C.purple],
    ["Lymphatic obstruction", "Lymphedema, filariasis, post-surgery", C.teal],
    ["Na⁺ & H₂O retention", "Renal failure, hyperaldosteronism", C.navy],
  ];
  mechanisms.forEach(([mech, example, color], i) => {
    const y = 2.48 + i * 0.55;
    sl.addShape(pres.ShapeType.roundRect, { x: 5.3, y, w: 4.3, h: 0.48, fill: { color: "FAFCFC" }, line: { color, width: 1.5 }, rectRadius: 0.06 });
    sl.addText(mech,    { x: 5.4, y: y + 0.02, w: 2.0, h: 0.44, fontSize: 10, bold: true, color, valign: "middle", fontFace: "Calibri" });
    sl.addText(example, { x: 7.4, y: y + 0.02, w: 2.15, h: 0.44, fontSize: 9, color: C.textGray, valign: "middle", fontFace: "Calibri", italic: true });
  });

  sl.addText("↑ Net filtration + lymphatic capacity exceeded → EDEMA", {
    x: 5.2, y: 5.25, w: 4.5, h: 0.3,
    align: "center", fontSize: 9, color: C.textDark, bold: true, fontFace: "Calibri",
  });
  sl.addText("Source: Robbins & Kumar 10e; Harrison's 22E", { x: 0, y: 5.42, w: 10, h: 0.2, align: "right", fontSize: 8, color: C.textGray, fontFace: "Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — EDEMA PATHWAYS FLOWCHART (TEXTBOOK FIGURE)
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.white } });
  addSlideHeader(sl, "Pathways to Systemic Edema — Textbook Figure", "Robbins & Kumar Basic Pathology 10e, Fig. 3.3");

  sl.addImage({ data: edemaPathwayImg, x: 0.5, y: 0.95, w: 5.8, h: 4.35 });

  // Annotation panel
  sl.addShape(pres.ShapeType.rect, { x: 6.6, y: 0.95, w: 3.15, h: 4.35, fill: { color: C.lightBg }, line: { color: C.teal, width: 1 } });
  sl.addText("Key Takeaways", { x: 6.6, y: 0.95, w: 3.15, h: 0.42, align: "center", valign: "middle", fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", fill: { color: C.teal } });

  const notes = [
    "Heart failure → ↓ cardiac output → ↑ venous pressure → edema",
    "Also activates RAAS → Na⁺/water retention → worsens edema",
    "Renal failure → direct Na⁺ retention → volume overload",
    "Liver failure / malnutrition / nephrotic syndrome → ↓ albumin → ↓ oncotic pressure",
    "All three converge on the same final pathway: interstitial fluid accumulation",
    "Lymphatic system acts as safety valve — when overwhelmed, edema develops",
  ];
  notes.forEach((n, i) => {
    sl.addShape(pres.ShapeType.roundRect, {
      x: 6.7, y: 1.45 + i * 0.58, w: 2.95, h: 0.5,
      fill: { color: i % 2 === 0 ? C.white : C.midBg },
      rectRadius: 0.05, line: { color: C.teal, width: 0.5 },
    });
    sl.addText(n, {
      x: 6.75, y: 1.45 + i * 0.58, w: 2.85, h: 0.5,
      fontSize: 8.5, color: C.textDark, valign: "middle", wrap: true, fontFace: "Calibri",
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — CLASSIFICATION: LOCALIZED vs GENERALIZED
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.lightBg } });
  addSlideHeader(sl, "Classification of Edema");

  // Central divider
  sl.addShape(pres.ShapeType.rect, { x: 4.85, y: 1.1, w: 0.3, h: 4.2, fill: { color: C.teal } });
  sl.addText("EDEMA", { x: 4.5, y: 1.1, w: 1.0, h: 0.45, align: "center", valign: "middle", fontSize: 14, bold: true, color: C.white, fontFace: "Calibri", fill: { color: C.teal } });

  // LEFT — LOCALIZED
  sl.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 1.15, w: 4.3, h: 0.55, fill: { color: C.red }, rectRadius: 0.08 });
  sl.addText("LOCALIZED", { x: 0.3, y: 1.15, w: 4.3, h: 0.55, align: "center", valign: "middle", fontSize: 16, bold: true, color: C.white, fontFace: "Calibri" });

  const localized = [
    ["Venous", "DVT, venous insufficiency"],
    ["Lymphatic", "Lymphedema, filariasis"],
    ["Inflammatory", "Cellulitis, abscess, insect bites"],
    ["Allergic (Angioedema)", "Urticaria, anaphylaxis"],
    ["Obstructive", "Superior vena cava syndrome"],
    ["Traumatic / Dependent", "Post-fracture, cast-related"],
  ];
  localized.forEach(([cause, ex], i) => {
    const y = 1.82 + i * 0.57;
    sl.addShape(pres.ShapeType.roundRect, { x: 0.3, y, w: 4.3, h: 0.5, fill: { color: i % 2 === 0 ? "FFF5F5" : "FFE8E8" }, line: { color: C.red, width: 1 }, rectRadius: 0.06 });
    sl.addText(cause, { x: 0.4, y: y + 0.02, w: 1.9, h: 0.46, fontSize: 11, bold: true, color: C.red, valign: "middle", fontFace: "Calibri" });
    sl.addText(ex,    { x: 2.3, y: y + 0.02, w: 2.2, h: 0.46, fontSize: 10, color: C.textGray, valign: "middle", italic: true, fontFace: "Calibri" });
  });

  // RIGHT — GENERALIZED
  sl.addShape(pres.ShapeType.roundRect, { x: 5.4, y: 1.15, w: 4.3, h: 0.55, fill: { color: C.navy }, rectRadius: 0.08 });
  sl.addText("GENERALIZED (ANASARCA)", { x: 5.4, y: 1.15, w: 4.3, h: 0.55, align: "center", valign: "middle", fontSize: 14, bold: true, color: C.white, fontFace: "Calibri" });

  const generalized = [
    ["Cardiac", "CCF — ↑ hydrostatic pressure"],
    ["Renal", "Nephrotic / Nephritic syndrome"],
    ["Hepatic", "Cirrhosis — ↓ albumin synthesis"],
    ["Nutritional", "Kwashiorkor — protein deficiency"],
    ["Endocrine", "Hypothyroidism (myxedema)"],
    ["Idiopathic", "Cyclic edema (adolescent girls)"],
  ];
  generalized.forEach(([cause, ex], i) => {
    const y = 1.82 + i * 0.57;
    sl.addShape(pres.ShapeType.roundRect, { x: 5.4, y, w: 4.3, h: 0.5, fill: { color: i % 2 === 0 ? "F0F4FF" : "E5EDFF" }, line: { color: C.navy, width: 1 }, rectRadius: 0.06 });
    sl.addText(cause, { x: 5.5, y: y + 0.02, w: 1.6, h: 0.46, fontSize: 11, bold: true, color: C.navy, valign: "middle", fontFace: "Calibri" });
    sl.addText(ex,    { x: 7.1, y: y + 0.02, w: 2.5, h: 0.46, fontSize: 10, color: C.textGray, valign: "middle", italic: true, fontFace: "Calibri" });
  });
  sl.addText("Source: Harrison's Principles of Internal Medicine 22E", { x: 0, y: 5.42, w: 10, h: 0.2, align: "right", fontSize: 8, color: C.textGray, fontFace: "Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — CAUSES IN CHILDREN (MNEMONIC)
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.white } });
  addSlideHeader(sl, "Causes of Edema in Children — Mnemonic: RENAL CHOP");

  const mnemonic = [
    ["R", "Renal", "Nephrotic syndrome (most common in children), Nephritic syndrome, AKI, CKD", C.red],
    ["E", "Endocrine", "Hypothyroidism (myxedema), Cushing syndrome (steroid-induced)", C.orange],
    ["N", "Nutritional", "Kwashiorkor, marasmus-kwashiorkor, malabsorption syndromes", C.teal],
    ["A", "Allergic/Angioedema", "Hereditary angioedema (C1-INH deficiency), drug reactions, anaphylaxis", C.purple],
    ["L", "Lymphatic/Local", "Primary lymphedema (Milroy disease), filariasis, post-surgical", C.green],
    ["C", "Cardiac", "Congenital heart disease with CCF, cardiomyopathy, constrictive pericarditis", C.navy],
    ["H", "Hepatic", "Neonatal hepatitis, biliary atresia, cirrhosis — ↓ albumin", C.orange],
    ["O", "Obstruction/Oncologic", "SVC syndrome, abdominal tumour (Wilms), venous obstruction", C.red],
    ["P", "Protein-losing", "Protein-losing enteropathy (PLE), inflammatory bowel disease", C.teal],
  ];

  mnemonic.forEach(([letter, category, detail, color], i) => {
    const col = i < 5 ? 0 : 1;
    const row = i < 5 ? i : i - 5;
    const x = col === 0 ? 0.25 : 5.15;
    const y = 1.1 + row * 0.88;

    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 0.55, h: 0.75, fill: { color }, rectRadius: 0.06 });
    sl.addText(letter, { x, y, w: 0.55, h: 0.75, align: "center", valign: "middle", fontSize: 22, bold: true, color: C.white, fontFace: "Calibri" });

    sl.addShape(pres.ShapeType.roundRect, { x: x + 0.6, y, w: 4.1, h: 0.75, fill: { color: "F9FAFB" }, line: { color, width: 1.2 }, rectRadius: 0.06 });
    sl.addText(category, { x: x + 0.7, y: y + 0.04, w: 3.9, h: 0.3, fontSize: 12, bold: true, color, fontFace: "Calibri" });
    sl.addText(detail,   { x: x + 0.7, y: y + 0.35, w: 3.9, h: 0.35, fontSize: 9.5, color: C.textGray, fontFace: "Calibri", wrap: true });
  });

  sl.addText("★ Most common cause of generalized edema in children = Nephrotic Syndrome", {
    x: 0.3, y: 5.28, w: 9.4, h: 0.28,
    align: "center", fontSize: 11, bold: true, color: C.red, fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — CLINICAL EVALUATION: HISTORY
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.lightBg } });
  addSlideHeader(sl, "Clinical Evaluation — History", "Key questions in a child presenting with edema");

  const historyItems = [
    { section: "Onset & Duration", icon: "⏱", color: C.teal, points: ["Sudden vs. gradual onset", "Intermittent (cyclic) vs. persistent", "Morning facial vs. evening leg edema"] },
    { section: "Puffiness Pattern", icon: "👁", color: C.navy, points: ["Periorbital edema on waking → Nephrotic", "Dependent pitting edema → Cardiac / Hepatic", "Non-pitting edema → Hypothyroid, lymphedema"] },
    { section: "Associated Symptoms", icon: "📋", color: C.purple, points: ["Haematuria / frothy urine → Renal", "Breathlessness / orthopnea → Cardiac", "Jaundice + ascites → Hepatic", "Diarrhea / malabsorption → Nutritional / PLE"] },
    { section: "Diet & Nutrition", icon: "🍽", color: C.orange, points: ["Protein intake, breastfeeding vs. weaning", "Malnutrition indicators — weight faltering", "Edematous malnutrition: Kwashiorkor"] },
    { section: "Past History", icon: "📁", color: C.red, points: ["Prior episodes, known kidney / heart disease", "Drug history: NSAIDs, steroids, Ca-channel blockers", "Family history: Hereditary angioedema, nephritis"] },
    { section: "Birth & Neonatal", icon: "🤱", color: C.green, points: ["Hydrops fetalis (immune/non-immune)", "Congenital heart disease, neonatal hepatitis", "Turner / Noonan syndrome (lymphedema)"] },
  ];

  historyItems.forEach((item, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.25 : 5.15;
    const y = 1.1 + row * 1.47;
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 4.6, h: 1.35, fill: { color: C.white }, line: { color: item.color, width: 2 }, rectRadius: 0.1 });
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 4.6, h: 0.42, fill: { color: item.color }, rectRadius: 0.1 });
    sl.addText(`${item.icon}  ${item.section}`, { x: x + 0.1, y, w: 4.4, h: 0.42, valign: "middle", fontSize: 12, bold: true, color: C.white, fontFace: "Calibri" });
    item.points.forEach((pt, j) => {
      sl.addText(`• ${pt}`, { x: x + 0.15, y: y + 0.46 + j * 0.29, w: 4.35, h: 0.28, fontSize: 10, color: C.textDark, fontFace: "Calibri" });
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — CLINICAL EVALUATION: EXAMINATION
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.white } });
  addSlideHeader(sl, "Clinical Evaluation — Physical Examination");

  // General section
  sl.addShape(pres.ShapeType.roundRect, { x: 0.25, y: 1.1, w: 9.5, h: 0.48, fill: { color: C.navy }, rectRadius: 0.08 });
  sl.addText("PITTING vs NON-PITTING: Press thumb over bony prominence for 5 sec — pit formation = pitting edema", {
    x: 0.3, y: 1.1, w: 9.4, h: 0.48, valign: "middle", fontSize: 12, color: C.amber, bold: true, fontFace: "Calibri", align: "center",
  });

  const examFindings = [
    {
      title: "FACE & HEAD",
      color: C.teal,
      items: ["Periorbital puffiness (morning) → Nephrotic syndrome", "Moon face → Cushing / steroid use", "Facial oedema + JVD → Cardiac failure / SVC syndrome"],
    },
    {
      title: "CHEST",
      color: C.purple,
      items: ["Pleural effusion: ↓ breath sounds, stony dull", "S3 gallop / murmur → CCF / congenital HD", "Pericardial rub / effusion → hydropericardium"],
    },
    {
      title: "ABDOMEN",
      color: C.orange,
      items: ["Ascites: shifting dullness, fluid thrill, puddle sign", "Hepatomegaly → CCF, hepatitis, storage disease", "Splenomegaly → Portal hypertension, malaria"],
    },
    {
      title: "EXTREMITIES",
      color: C.red,
      items: ["Pitting edema — grade 1–4 (depth & rebound time)", "Non-pitting: hypothyroidism, lymphedema", "Sacral edema in bedridden children"],
    },
    {
      title: "SKIN & NUTRITION",
      color: C.green,
      items: ["Flaky-paint rash, hair changes → Kwashiorkor", "Xanthomas, spider nevi → hepatic cause", "Pallor, jaundice, clubbing — comorbidities"],
    },
    {
      title: "VITALS & GROWTH",
      color: C.navy,
      items: ["BP: Hypertension → Nephritic / Renal cause", "Weight → Rapid gain = fluid retention", "Height-weight ratio, mid-arm circumference"],
    },
  ];

  examFindings.forEach((item, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.25 + col * 3.25;
    const y = 1.72 + row * 1.88;
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 3.05, h: 1.75, fill: { color: "FAFAFA" }, line: { color: item.color, width: 2 }, rectRadius: 0.1 });
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 3.05, h: 0.42, fill: { color: item.color }, rectRadius: 0.1 });
    sl.addText(item.title, { x: x + 0.05, y, w: 2.95, h: 0.42, align: "center", valign: "middle", fontSize: 11, bold: true, color: C.white, fontFace: "Calibri" });
    item.items.forEach((pt, j) => {
      sl.addText(`• ${pt}`, { x: x + 0.1, y: y + 0.46 + j * 0.42, w: 2.9, h: 0.4, fontSize: 9.5, color: C.textDark, fontFace: "Calibri", wrap: true });
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — INVESTIGATIONS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.lightBg } });
  addSlideHeader(sl, "Investigations — Step-wise Approach");

  // Tier labels
  const tiers = [
    {
      label: "TIER 1 — ALL CASES (Screening)",
      color: C.teal,
      tests: [
        ["Urine R/E + C/S", "Proteinuria (3+ → NS), hematuria, casts"],
        ["Urine protein:creatinine ratio", ">200 mg/mmol confirms significant proteinuria"],
        ["Serum albumin", "<2.5 g/dL → nephrotic; reflects oncotic status"],
        ["Serum electrolytes, urea, creatinine", "Renal function assessment"],
        ["CBC", "Anaemia, infection, eosinophilia"],
      ],
    },
    {
      label: "TIER 2 — DIRECTED BY CLINICAL CLUES",
      color: C.purple,
      tests: [
        ["LFTs + INR / PT", "Hepatic cause — ↓ albumin, ↑ PT"],
        ["Thyroid function (TSH, fT4)", "Myxedema — ↑ TSH, ↓ fT4"],
        ["Lipid profile", "Hyperlipidemia in nephrotic syndrome"],
        ["ASO titre, complement (C3, C4)", "Post-strep nephritis — ↓ C3"],
        ["Chest X-ray", "Cardiomegaly, pleural effusion, pulmonary edema"],
        ["Echocardiography", "CCF, congenital heart disease, pericardial effusion"],
      ],
    },
    {
      label: "TIER 3 — SPECIALIST WORKUP",
      color: C.navy,
      tests: [
        ["Renal biopsy", "When NS is atypical / steroid-resistant (>1 yr, hematuria, low C3)"],
        ["24-hr urine protein", ">40 mg/m²/hr confirms NS"],
        ["ANA, anti-dsDNA, ANCA", "Lupus nephritis, vasculitis"],
        ["Doppler USG abdomen/limbs", "Portal HTN, DVT, lymphatic obstruction"],
      ],
    },
  ];

  let ypos = 1.12;
  tiers.forEach((tier) => {
    sl.addShape(pres.ShapeType.roundRect, { x: 0.25, y: ypos, w: 9.5, h: 0.38, fill: { color: tier.color }, rectRadius: 0.07 });
    sl.addText(tier.label, { x: 0.35, y: ypos, w: 9.3, h: 0.38, valign: "middle", fontSize: 12, bold: true, color: C.white, fontFace: "Calibri" });
    ypos += 0.42;
    const rows = tier.tests;
    rows.forEach(([test, interp]) => {
      sl.addShape(pres.ShapeType.rect, { x: 0.25, y: ypos, w: 9.5, h: 0.34, fill: { color: "FAFCFC" }, line: { color: tier.color, width: 0.5 } });
      sl.addText(`• ${test}`, { x: 0.35, y: ypos, w: 3.5, h: 0.34, fontSize: 10, bold: true, color: tier.color, valign: "middle", fontFace: "Calibri" });
      sl.addText(interp, { x: 3.9, y: ypos, w: 5.7, h: 0.34, fontSize: 10, color: C.textDark, valign: "middle", fontFace: "Calibri", italic: true });
      ypos += 0.36;
    });
    ypos += 0.08;
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 11 — DIAGNOSTIC FLOWCHART
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.white } });
  addSlideHeader(sl, "Diagnostic Flowchart — Approach to Edema in Children", "Based on Harrison's 22E & Pediatric Nephrology Guidelines");

  // START box
  box(sl, "Child with EDEMA", 3.5, 0.88, 3.0, 0.5, C.navy, C.white, 13, true);
  arrowDown(sl, 5.0, 1.38, 1.68);

  // Step 1: Localized vs Generalized
  box(sl, "Localized or Generalized?", 3.1, 1.68, 3.8, 0.5, C.teal, C.white, 12, true);

  // Left branch — Localized
  sl.addShape(pres.ShapeType.line, { x: 3.1, y: 1.93, w: -1.6, h: 0, line: { color: C.red, width: 1.5, endArrowType: "triangle" } });
  sl.addText("Localized", { x: 1.0, y: 1.68, w: 1.5, h: 0.25, align: "center", fontSize: 9, color: C.red, fontFace: "Calibri", bold: true });
  box(sl, "Local cause\n(DVT, Cellulitis,\nAngioedema,\nLymphedema)", 0.25, 2.02, 2.3, 0.98, C.red, C.white, 9);

  // Right branch — Generalized
  sl.addShape(pres.ShapeType.line, { x: 6.9, y: 1.93, w: 1.6, h: 0, line: { color: C.navy, width: 1.5, endArrowType: "triangle" } });
  sl.addText("Generalized", { x: 7.0, y: 1.68, w: 1.8, h: 0.25, align: "center", fontSize: 9, color: C.navy, fontFace: "Calibri", bold: true });

  // Step 2a: check albumin
  box(sl, "Check Serum Albumin", 6.8, 2.02, 2.9, 0.48, C.teal, C.white, 11, true);
  arrowDown(sl, 8.25, 2.5, 2.85);

  // Low albumin branch
  sl.addShape(pres.ShapeType.line, { x: 6.8, y: 3.08, w: -1.5, h: 0, line: { color: C.orange, width: 1.5, endArrowType: "triangle" } });
  sl.addText("Low (<2.5)", { x: 4.9, y: 2.85, w: 1.8, h: 0.25, align: "center", fontSize: 9, color: C.orange, fontFace: "Calibri", bold: true });
  box(sl, "Hypoalbuminemia\n→ Nephrotic Syndrome\n→ Liver Disease\n→ Malnutrition", 3.1, 3.1, 2.3, 0.95, C.orange, C.white, 9);

  // Step 2b: proteinuria?
  arrowDown(sl, 8.25, 3.1, 3.42);
  box(sl, "Check Urine Protein", 6.8, 3.42, 2.9, 0.48, C.teal, C.white, 11, true);
  arrowDown(sl, 8.25, 3.9, 4.22);

  // Proteinuria heavy
  sl.addShape(pres.ShapeType.line, { x: 6.8, y: 4.46, w: -1.5, h: 0, line: { color: C.red, width: 1.5, endArrowType: "triangle" } });
  sl.addText("≥3+ / Nephrotic", { x: 4.8, y: 4.22, w: 2.0, h: 0.25, align: "center", fontSize: 9, color: C.red, fontFace: "Calibri", bold: true });
  box(sl, "NEPHROTIC\nSYNDROME\n(most common\nin children)", 3.1, 4.32, 2.3, 0.95, C.red, C.white, 9, true);

  // No heavy proteinuria
  arrowDown(sl, 8.25, 4.7, 5.0);
  box(sl, "Hematuria / ↓C3 / HTN?\n→ Nephritic Syndrome\nNo proteinuria + CCF?\n→ Cardiac cause", 6.8, 5.0, 2.9, 0.55, C.navy, C.white, 8.5);

  // Central step 3
  box(sl, "Check Renal Function\n(Urea, Cr, eGFR)", 3.5, 2.1, 2.5, 0.7, C.purple, C.white, 10);
  arrowDown(sl, 4.75, 2.8, 3.1);
  box(sl, "Oliguria / ↑Cr?\n→ Renal Failure\n(AKI / CKD)", 3.5, 3.1, 2.5, 0.7, C.purple, C.white, 10);

  sl.addText("Source: Harrison's Principles of Internal Medicine 22E; KDIGO Nephrotic Syndrome 2024", {
    x: 0, y: 5.42, w: 10, h: 0.2, align: "right", fontSize: 8, color: C.textGray, fontFace: "Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 12 — NEPHROTIC SYNDROME (most common cause — detail slide)
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.lightBg } });
  addSlideHeader(sl, "Spotlight: Nephrotic Syndrome — Most Common Cause in Children");

  // Triad box
  sl.addShape(pres.ShapeType.roundRect, { x: 0.25, y: 1.1, w: 9.5, h: 0.52, fill: { color: C.navy }, rectRadius: 0.08 });
  sl.addText("CLASSIC TETRAD:  Massive Proteinuria  •  Hypoalbuminemia  •  Generalized Edema  •  Hyperlipidemia / Lipiduria", {
    x: 0.3, y: 1.1, w: 9.4, h: 0.52, align: "center", valign: "middle", fontSize: 12, color: C.amber, bold: true, fontFace: "Calibri",
  });

  // Pathophysiology
  sl.addShape(pres.ShapeType.roundRect, { x: 0.25, y: 1.72, w: 4.6, h: 3.55, fill: { color: C.white }, line: { color: C.teal, width: 2 }, rectRadius: 0.1 });
  sl.addShape(pres.ShapeType.roundRect, { x: 0.25, y: 1.72, w: 4.6, h: 0.42, fill: { color: C.teal }, rectRadius: 0.1 });
  sl.addText("Pathophysiology of Edema in NS", { x: 0.3, y: 1.72, w: 4.5, h: 0.42, valign: "middle", fontSize: 12, bold: true, color: C.white, fontFace: "Calibri" });

  const pathSteps = [
    "Glomerular injury → ↑ permeability to albumin",
    "Massive urinary albumin loss (>40 mg/m²/hr)",
    "↓ Serum albumin → ↓ Plasma oncotic pressure",
    "Fluid shifts to interstitium → EDEMA",
    "↓ Effective circulating volume (Underfill)",
    "↑ RAAS activation → ↑ Na⁺ & H₂O retention",
    "Tubular Na⁺ reabsorption ↑ (Overfill component)",
    "Worsening edema — vicious cycle",
  ];
  pathSteps.forEach((step, i) => {
    const y = 2.22 + i * 0.38;
    sl.addShape(pres.ShapeType.roundRect, { x: 0.35, y, w: 0.35, h: 0.3, fill: { color: C.teal }, rectRadius: 0.04 });
    sl.addText(`${i + 1}`, { x: 0.35, y, w: 0.35, h: 0.3, align: "center", valign: "middle", fontSize: 10, color: C.white, bold: true, fontFace: "Calibri" });
    sl.addText(step, { x: 0.78, y, w: 4.0, h: 0.3, valign: "middle", fontSize: 10, color: C.textDark, fontFace: "Calibri" });
  });

  // Clinical features right panel
  sl.addShape(pres.ShapeType.roundRect, { x: 5.15, y: 1.72, w: 4.6, h: 1.62, fill: { color: C.white }, line: { color: C.red, width: 2 }, rectRadius: 0.1 });
  sl.addShape(pres.ShapeType.roundRect, { x: 5.15, y: 1.72, w: 4.6, h: 0.42, fill: { color: C.red }, rectRadius: 0.1 });
  sl.addText("Clinical Features in Children", { x: 5.2, y: 1.72, w: 4.5, h: 0.42, valign: "middle", fontSize: 12, bold: true, color: C.white, fontFace: "Calibri" });
  const clinFeats = [
    "Periorbital puffiness on waking (earliest sign)",
    "Scrotal / labial edema", "Ascites, pleural effusion",
    "Pallor, anorexia, irritability",
  ];
  clinFeats.forEach((f, i) => {
    sl.addText(`✓  ${f}`, { x: 5.25, y: 2.22 + i * 0.3, w: 4.4, h: 0.28, fontSize: 10.5, color: C.textDark, fontFace: "Calibri" });
  });

  // Criteria
  sl.addShape(pres.ShapeType.roundRect, { x: 5.15, y: 3.44, w: 4.6, h: 1.83, fill: { color: C.white }, line: { color: C.purple, width: 2 }, rectRadius: 0.1 });
  sl.addShape(pres.ShapeType.roundRect, { x: 5.15, y: 3.44, w: 4.6, h: 0.42, fill: { color: C.purple }, rectRadius: 0.1 });
  sl.addText("ISKDC Criteria for Remission / Relapse", { x: 5.2, y: 3.44, w: 4.5, h: 0.42, valign: "middle", fontSize: 11, bold: true, color: C.white, fontFace: "Calibri" });
  const criteria = [
    ["Remission", "Urine protein nil / trace for 3 consecutive days"],
    ["Relapse", "3+ or 4+ proteinuria for 3 consecutive days"],
    ["Frequent relapse", "≥2 relapses in 6 months of initial response"],
    ["Steroid dependent", "Relapse on/within 14 days of steroid withdrawal"],
  ];
  criteria.forEach(([term, def], i) => {
    sl.addText(term + ":", { x: 5.25, y: 3.94 + i * 0.32, w: 1.5, h: 0.3, fontSize: 9.5, bold: true, color: C.purple, fontFace: "Calibri" });
    sl.addText(def, { x: 6.8, y: 3.94 + i * 0.32, w: 2.85, h: 0.3, fontSize: 9.5, color: C.textDark, fontFace: "Calibri" });
  });
  sl.addText("Source: Nelson's Textbook of Pediatrics; KDIGO NS Guidelines 2024", { x: 0, y: 5.42, w: 10, h: 0.2, align: "right", fontSize: 8, color: C.textGray, fontFace: "Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 13 — UNDERFILL vs OVERFILL
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.white } });
  addSlideHeader(sl, "Underfill vs Overfill — Key Concept in Nephrotic Edema", "Critical for management decisions");

  sl.addShape(pres.ShapeType.roundRect, { x: 0.25, y: 1.05, w: 9.5, h: 0.5, fill: { color: C.navy }, rectRadius: 0.08 });
  sl.addText("⚠  Distinguishing Underfill vs Overfill determines whether IV albumin/diuretics are safe to use", {
    x: 0.3, y: 1.05, w: 9.4, h: 0.5, align: "center", valign: "middle", fontSize: 12, color: C.amber, fontFace: "Calibri", bold: true,
  });

  const cols = [
    {
      title: "UNDERFILL (Classic Hypothesis)",
      color: C.red,
      rows: [
        ["Mechanism", "↓ Albumin → ↓ Oncotic pressure → Fluid leaves vessels"],
        ["Circulating volume", "DECREASED"],
        ["RAAS activation", "Secondary (compensatory)"],
        ["Na excretion (FENa)", "LOW (<1%)"],
        ["BP", "Low / normal"],
        ["Pulse", "Tachycardia, poor perfusion"],
        ["Hematocrit", "ELEVATED (hemoconcentration)"],
        ["Risk", "AKI, hypovolemic shock"],
        ["Management", "IV albumin infusion, then furosemide"],
      ],
    },
    {
      title: "OVERFILL (Alternative Mechanism)",
      color: C.teal,
      rows: [
        ["Mechanism", "Primary renal Na⁺ retention → expanded blood volume"],
        ["Circulating volume", "INCREASED / NORMAL"],
        ["RAAS activation", "Suppressed"],
        ["Na excretion (FENa)", "LOW (primary tubular defect)"],
        ["BP", "Hypertension"],
        ["Pulse", "Normal"],
        ["Hematocrit", "LOW / NORMAL"],
        ["Risk", "Hypertension, pulmonary edema"],
        ["Management", "Diuretics alone (furosemide + spironolactone)"],
      ],
    },
  ];

  cols.forEach(({ title, color, rows }, ci) => {
    const x = ci === 0 ? 0.25 : 5.15;
    sl.addShape(pres.ShapeType.roundRect, { x, y: 1.65, w: 4.6, h: 0.42, fill: { color }, rectRadius: 0.08 });
    sl.addText(title, { x, y: 1.65, w: 4.6, h: 0.42, align: "center", valign: "middle", fontSize: 11.5, bold: true, color: C.white, fontFace: "Calibri" });
    rows.forEach(([label, val], ri) => {
      const y = 2.14 + ri * 0.36;
      sl.addShape(pres.ShapeType.rect, { x, y, w: 4.6, h: 0.34, fill: { color: ri % 2 === 0 ? "F7FAFB" : "EDFCFF" }, line: { color, width: 0.5 } });
      sl.addText(label, { x: x + 0.08, y, w: 1.5, h: 0.34, fontSize: 9.5, bold: true, color, valign: "middle", fontFace: "Calibri" });
      sl.addText(val,   { x: x + 1.6, y, w: 2.95, h: 0.34, fontSize: 9.5, color: C.textDark, valign: "middle", fontFace: "Calibri" });
    });
  });
  sl.addText("Source: Costanzo Physiology 7E; PMC — Pathophysiology of Edema in Childhood NS (2016)", { x: 0, y: 5.42, w: 10, h: 0.2, align: "right", fontSize: 8, color: C.textGray, fontFace: "Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 14 — MANAGEMENT PRINCIPLES
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.lightBg } });
  addSlideHeader(sl, "Management of Edema in Children — Principles");

  const principles = [
    {
      num: "1", title: "Treat the Underlying Cause", color: C.navy,
      points: ["Nephrotic Syndrome: Prednisolone 2 mg/kg/day (60 mg/m²/day) max 60 mg — 4 weeks, then alternate-day",
               "Cardiac failure: Furosemide IV + Spironolactone + ACE inhibitor",
               "Liver disease: Treat underlying cause + spironolactone for ascites",
               "Kwashiorkor: Nutritional rehabilitation — F-75 then F-100 WHO protocol"],
    },
    {
      num: "2", title: "Dietary Measures", color: C.teal,
      points: ["Na⁺ restriction: 35 mg/kg/day (1.5 mEq/kg/day) in all edematous states",
               "Fluid restriction: Guided by urine output + insensible losses",
               "Adequate protein intake (except in renal failure)"],
    },
    {
      num: "3", title: "Diuretics", color: C.purple,
      points: ["Furosemide: 1–2 mg/kg/dose; in NS: 0.5 mg/kg/dose q8–12h (underfill: after albumin)",
               "Spironolactone: 2–3 mg/kg/day — aldosterone antagonist, K-sparing",
               "Combination diuretics: Synergistic in refractory edema"],
    },
    {
      num: "4", title: "IV Albumin (Selected Cases)", color: C.orange,
      points: ["Indications: Severe hypoalbuminemia (<1.5 g/dL), shock, scrotal edema compromising skin",
               "20% human albumin 0.5–1 g/kg over 2–4 hrs → then IV furosemide",
               "Caution: Avoid in overfill — can worsen pulmonary edema"],
    },
  ];

  let y = 1.1;
  principles.forEach(({ num, title, color, points }) => {
    sl.addShape(pres.ShapeType.roundRect, { x: 0.25, y, w: 0.52, h: 1.15, fill: { color }, rectRadius: 0.08 });
    sl.addText(num, { x: 0.25, y, w: 0.52, h: 1.15, align: "center", valign: "middle", fontSize: 20, bold: true, color: C.white, fontFace: "Calibri" });
    sl.addShape(pres.ShapeType.roundRect, { x: 0.85, y, w: 8.9, h: 1.15, fill: { color: C.white }, line: { color, width: 1.5 }, rectRadius: 0.08 });
    sl.addText(title, { x: 0.95, y: y + 0.04, w: 8.7, h: 0.32, fontSize: 13, bold: true, color, fontFace: "Calibri" });
    points.forEach((pt, i) => {
      sl.addText(`• ${pt}`, { x: 0.95, y: y + 0.38 + i * 0.26, w: 8.7, h: 0.24, fontSize: 9.5, color: C.textDark, fontFace: "Calibri" });
    });
    y += 1.22;
  });
  sl.addText("Source: Nelson's Textbook of Pediatrics; KDIGO 2024; WHO Malnutrition Protocol", { x: 0, y: 5.42, w: 10, h: 0.2, align: "right", fontSize: 8, color: C.textGray, fontFace: "Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 15 — SPECIAL SITUATIONS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.white } });
  addSlideHeader(sl, "Special Situations & Red Flags");

  const special = [
    {
      title: "NEONATAL EDEMA",
      color: C.teal,
      items: [
        "Hydrops fetalis: Immune (Rh incompatibility) or Non-immune (cardiac, metabolic, chromosomal)",
        "Hypoproteinemia of prematurity",
        "Congenital nephrotic syndrome (Finnish type, NPHS1/NPHS2 mutations)",
        "Lymphedema: Turner syndrome, Noonan syndrome, Milroy disease",
      ],
    },
    {
      title: "HEREDITARY ANGIOEDEMA (HAE)",
      color: C.red,
      items: [
        "C1-inhibitor deficiency (Type I/II) — AD inheritance",
        "Non-pitting, non-pruritic, recurrent angioedema of skin/mucosa/GI",
        "Laryngeal edema can be life-threatening",
        "Rx: Icatibant (acute), tranexamic acid, FFP; prophylaxis: C1-INH concentrate",
      ],
    },
    {
      title: "RED FLAGS — URGENT EVALUATION",
      color: C.orange,
      items: [
        "Acute onset edema + hematuria + hypertension → Nephritic syndrome",
        "Scrotal edema + fever → Rule out epididymo-orchitis vs. edema",
        "Edema + respiratory distress → Cardiac failure / pulmonary edema",
        "Facial edema + proptosis → Orbital cellulitis / cavernous sinus thrombosis",
        "Sudden angioedema + urticaria + hypotension → Anaphylaxis — EMERGENCY",
      ],
    },
    {
      title: "STEROID-INDUCED EDEMA",
      color: C.purple,
      items: [
        "Common in children on prolonged steroid therapy (NS, IBD, JIA)",
        "Mechanism: Na⁺ retention via mineralocorticoid effect",
        "Management: Low Na⁺ diet; consider spironolactone; taper steroids if possible",
      ],
    },
  ];

  special.forEach((item, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = col === 0 ? 0.25 : 5.15;
    const y = 1.1 + row * 2.22;
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 4.6, h: 2.1, fill: { color: "FAFAFA" }, line: { color: item.color, width: 2 }, rectRadius: 0.1 });
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 4.6, h: 0.42, fill: { color: item.color }, rectRadius: 0.1 });
    sl.addText(item.title, { x: x + 0.1, y, w: 4.4, h: 0.42, valign: "middle", fontSize: 11, bold: true, color: C.white, fontFace: "Calibri" });
    item.items.forEach((pt, j) => {
      sl.addText(`• ${pt}`, { x: x + 0.1, y: y + 0.48 + j * 0.4, w: 4.4, h: 0.38, fontSize: 9.5, color: C.textDark, fontFace: "Calibri", wrap: true });
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 16 — SUMMARY & KEY POINTS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.navy } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0.75, w: 10, h: 0.06, fill: { color: C.amber } });
  sl.addText("KEY TAKEAWAYS", { x: 0.3, y: 0.1, w: 9.4, h: 0.65, fontSize: 26, bold: true, color: C.white, fontFace: "Calibri" });

  const keyPoints = [
    ["01", "Always ask: Localized or Generalized? This is the first clinical decision point in any child with edema.", C.sky],
    ["02", "Most common cause of generalized edema in children = Nephrotic Syndrome (Minimal Change Disease in <6 yr).", C.amber],
    ["03", "Check serum albumin early — hypoalbuminemia points to renal/hepatic/nutritional cause.", C.sky],
    ["04", "Distinguish Underfill vs Overfill before giving diuretics in Nephrotic Syndrome — wrong call → AKI.", C.amber],
    ["05", "Periorbital edema on waking + proteinuria + hypoalbuminemia + hyperlipidemia = Nephrotic tetrad.", C.sky],
    ["06", "Mnemonic RENAL CHOP covers the major causes of pediatric edema systematically.", C.amber],
    ["07", "Red flag: Acute onset + hematuria + HTN = Nephritic syndrome — requires urgent evaluation.", C.sky],
    ["08", "First-line Rx in Nephrotic: Prednisolone 60 mg/m²/day + Na restriction + furosemide if needed.", C.amber],
  ];

  keyPoints.forEach(([num, point, accent], i) => {
    const col = i < 4 ? 0 : 1;
    const row = i < 4 ? i : i - 4;
    const x = col === 0 ? 0.25 : 5.15;
    const y = 0.95 + row * 1.15;
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 4.6, h: 1.05, fill: { color: "1A3A6A" }, line: { color: accent, width: 1.5 }, rectRadius: 0.1 });
    sl.addShape(pres.ShapeType.roundRect, { x, y, w: 0.55, h: 1.05, fill: { color: accent }, rectRadius: 0.1 });
    sl.addText(num, { x, y, w: 0.55, h: 1.05, align: "center", valign: "middle", fontSize: 16, bold: true, color: C.navy, fontFace: "Calibri" });
    sl.addText(point, { x: x + 0.65, y: y + 0.1, w: 3.85, h: 0.85, fontSize: 10, color: C.white, fontFace: "Calibri", wrap: true, valign: "top" });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 17 — REFERENCES
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.63, fill: { color: C.lightBg } });
  addSlideHeader(sl, "References");

  const refs = [
    "1.  Kliegman RM et al. Nelson's Textbook of Pediatrics, 21st Edition. Elsevier, 2020.",
    "2.  Kumar V, Abbas AK et al. Robbins & Kumar Basic Pathology, 10th Edition. Elsevier, 2023.",
    "3.  Loscalzo J et al. Harrison's Principles of Internal Medicine, 22nd Edition. McGraw-Hill, 2025.",
    "4.  Costanzo LS. Physiology, 7th Edition (Board Review Series). Wolters Kluwer, 2022.",
    "5.  Johnson RJ, Floege J, Tonnessen TI. Comprehensive Clinical Nephrology, 7th Edition. Elsevier, 2023.",
    "6.  KDIGO Clinical Practice Guideline for Nephrotic Syndrome in Children. Public Review Draft, 2024.",
    "7.  Hisano S et al. Edema in Childhood. Pediatr Int. 1997;39(5):S100–104.",
    "8.  Bhatt GC et al. Pathophysiology, Evaluation, and Management of Edema in Childhood Nephrotic Syndrome. Front Pediatr. 2016;3:111. PMID:4707228",
    "9.  Koirala A et al. Etiology and management of edema: A review. Adv Kidney Dis Health. 2023;30(2):110. PMID:37042037.",
    "10. Gordillo R, Spitzer A. The Nephrotic Syndrome. Pediatrics in Review. 2009;30:94–105.",
  ];

  refs.forEach((ref, i) => {
    sl.addText(ref, {
      x: 0.35, y: 1.12 + i * 0.43, w: 9.3, h: 0.4,
      fontSize: 10.5, color: C.textDark, fontFace: "Calibri",
    });
    if (i < refs.length - 1) {
      sl.addShape(pres.ShapeType.line, { x: 0.35, y: 1.51 + i * 0.43, w: 9.3, h: 0, line: { color: "DDECEF", width: 0.5 } });
    }
  });
  sl.addShape(pres.ShapeType.roundRect, { x: 0.25, y: 5.27, w: 9.5, h: 0.3, fill: { color: C.teal }, rectRadius: 0.06 });
  sl.addText("Prepared by: Department of Pediatrics  |  For Undergraduate Medical Education", {
    x: 0.3, y: 5.27, w: 9.4, h: 0.3, align: "center", valign: "middle", fontSize: 10, color: C.white, fontFace: "Calibri",
  });
}

// ── Write file ─────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/edema-ppt/Approach_to_Edema_Pediatrics.pptx" })
  .then(() => console.log("SUCCESS: PPT saved."))
  .catch((e) => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/edema-ppt && node build.js 2>&1

Running Command

cd /home/daytona/workspace/edema-ppt && \ curl -s "https://cdn.orris.care/cdss_images/ad507b144b4c48f573d9138a61bccc0bbe6ebb7b00e4b9592a0cedd842d26b6c.png" -o edema_pathways.png && \ curl -s "https://cdn.orris.care/cdss_images/57d59928a0d18fe70096eaa731deab743dbd806ddcfd653528233c432b899179.png" -o histology.png && \ ls -lh *.png

Editing File

~/edema-ppt/build.js

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

cd /home/daytona/workspace/edema-ppt && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/edema-ppt/Approach_to_Edema_Pediatrics.pptx && echo "File exists and size looks good"

Editing File

~/edema-ppt/build.js

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

cd /home/daytona/workspace/edema-ppt && node build.js 2>&1 && ls -lh Approach_to_Edema_Pediatrics.pptx

Running Command

cd /home/daytona/workspace/edema-ppt && python3 -c " import zipfile with zipfile.ZipFile('Approach_to_Edema_Pediatrics.pptx') as z: slides = [f for f in z.namelist() if f.startswith('ppt/slides/slide') and f.endswith('.xml')] print(f'Total slides: {len(slides)}') print('Slides:', sorted(slides)) "

Your presentation is ready! Here is the download link:

Approach to Edema Pediatrics

Presentation · PPTX


What's inside — 17 slides

#SlideHighlights
1Title SlideDepartment of Pediatrics only — no student names; dark navy + amber design
2ContentsColour-coded 9-topic navigation panel
3Definition & TerminologyEdema, Anasarca, Ascites, Hydrothorax, Transudate vs Exudate — all in card grid
4Pathophysiology — Starling ForcesStarling equation displayed; two-panel layout — forces + mechanisms of edema
5Textbook Figure (Robbins 10e, Fig 3.3)Actual pathways flowchart from the textbook embedded, with annotated notes panel
6ClassificationSide-by-side Localized vs Generalized with colour-coded cause cards
7Causes in Children — Mnemonic: RENAL CHOPLetter-by-letter mnemonic with cause + examples, red-highlighted "most common = NS"
8History Taking6-section card grid — onset, pattern, symptoms, nutrition, past history, neonatal
9Physical Examination"Pitting vs Non-Pitting" banner + 6-organ examination cards
10Investigations — Tier 1/2/3Stepwise investigation table with interpretation
11Diagnostic FlowchartFull clinical algorithm — Localized → Generalized → Albumin → Urine protein → diagnosis
12Spotlight: Nephrotic SyndromeTetrad, pathophysiology cascade, clinical features, ISKDC criteria
13Underfill vs OverfillSide-by-side comparison table — critical management concept
14Management Principles4-step protocol — treat cause, diet, diuretics, IV albumin (with doses)
15Special Situations & Red FlagsNeonatal edema, HAE, steroid edema, emergency red flags
16Key Takeaways8 numbered amber/sky point cards on dark background
17References10 standard references — Harrison's 22E, Nelson's, Robbins 10E, KDIGO 2024, PubMed

Have you prepared

Yes! The presentation is fully ready. Here is your download link:

Approach to Edema Pediatrics

Presentation · PPTX

It contains 17 slides with a professional navy/teal/amber color scheme. Here's a quick summary of what's included:
SlidesContent
1-2Title (no student names) + Contents overview
3Definitions — Edema, Anasarca, Transudate vs Exudate
4Pathophysiology — Starling forces diagram
5Textbook figure from Robbins 10e (edema pathways flowchart)
6Classification — Localized vs Generalized
7Causes in children — Mnemonic: RENAL CHOP
8-9Clinical evaluation — History + Examination
10Investigations — Tier 1/2/3 stepwise approach
11Diagnostic flowchart (clinical algorithm)
12-13Nephrotic syndrome spotlight + Underfill vs Overfill
14Management principles with drug doses
15Special situations & Red flags
16Key Takeaways (8 points)
17References — Harrison's 22E, Nelson's, Robbins 10E, KDIGO 2024

Make this into 50 slide ppt less colour clutterfree

Writing File

~/edema-ppt/build2.js

/**
 * APPROACH TO EDEMA — PEDIATRICS
 * 50-slide PPT | Clean, minimal, 2-color palette
 * White background, Navy text, single Teal accent line per slide
 */
const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title  = "Approach to Edema – Pediatrics";

// ── PALETTE (minimal: white bg, navy text, one teal accent) ──────────────────
const NAVY  = "1B3A6B";
const TEAL  = "2E86AB";
const WHITE = "FFFFFF";
const LGRAY = "F4F6F8";
const MGRAY = "DDE3EA";
const DGRAY = "5A6474";
const BLACK = "1A1A2E";
const RED   = "C0392B";  // used sparingly for warnings only

// ── MASTER HELPERS ────────────────────────────────────────────────────────────

/** Standard slide: white bg + navy top bar + teal accent line */
function newSlide(title, subtitle) {
  const sl = pres.addSlide();
  // Full white background
  sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.63, fill:{color:WHITE} });
  // Navy header bar
  sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:0.72, fill:{color:NAVY} });
  sl.addText(title, {
    x:0.3, y:0, w:9.4, h:0.72,
    fontSize:20, bold:true, color:WHITE, fontFace:"Calibri", valign:"middle",
  });
  // Thin teal underline accent
  sl.addShape(pres.ShapeType.rect, { x:0, y:0.72, w:10, h:0.05, fill:{color:TEAL} });
  if (subtitle) {
    sl.addText(subtitle, {
      x:0.3, y:0.77, w:9.4, h:0.32,
      fontSize:11, color:TEAL, fontFace:"Calibri", italic:true,
    });
  }
  // Footer
  sl.addShape(pres.ShapeType.rect, { x:0, y:5.52, w:10, h:0.11, fill:{color:MGRAY} });
  sl.addText("Department of Pediatrics  |  Approach to Edema", {
    x:0.2, y:5.52, w:9.6, h:0.11,
    fontSize:7, color:DGRAY, fontFace:"Calibri", valign:"middle",
  });
  return sl;
}

/** Section divider slide */
function sectionSlide(num, title, subtitle) {
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.63, fill:{color:NAVY} });
  sl.addShape(pres.ShapeType.rect, { x:0, y:2.6, w:0.12, h:1.0, fill:{color:TEAL} });
  sl.addText(`Section ${num}`, { x:0.35, y:2.18, w:9, h:0.4, fontSize:14, color:TEAL, fontFace:"Calibri", italic:true });
  sl.addText(title, { x:0.35, y:2.55, w:9, h:0.85, fontSize:32, bold:true, color:WHITE, fontFace:"Calibri" });
  if (subtitle) sl.addText(subtitle, { x:0.35, y:3.42, w:9, h:0.4, fontSize:14, color:MGRAY, fontFace:"Calibri" });
  return sl;
}

/** Add plain bullet list to a slide */
function bullets(sl, items, opts={}) {
  const { x=0.35, y=1.15, w=9.3, h=4.1, fs=17, color=BLACK, indent=0.25 } = opts;
  const arr = items.map((item, i) => {
    const isLast = i === items.length - 1;
    if (typeof item === "string") {
      return { text: item, options: { bullet:{indent}, breakLine:!isLast, fontSize:fs, color, fontFace:"Calibri" }};
    }
    return { text: item.t, options: { bullet:{indent}, breakLine:!isLast, fontSize:item.fs||fs, bold:item.bold||false, color:item.c||color, fontFace:"Calibri" }};
  });
  sl.addText(arr, { x, y, w, h, valign:"top" });
}

/** Two-column layout helper */
function twoCol(sl, leftItems, rightItems, opts={}) {
  const { y=1.15, h=4.1, fs=15 } = opts;
  bullets(sl, leftItems, { x:0.35, y, w:4.5, h, fs });
  bullets(sl, rightItems, { x:5.2,  y, w:4.5, h, fs });
}

/** Simple labelled box */
function labelBox(sl, label, text, x, y, w, h, lc=TEAL) {
  sl.addShape(pres.ShapeType.rect, { x, y, w, h, fill:{color:LGRAY}, line:{color:MGRAY,width:1} });
  sl.addShape(pres.ShapeType.rect, { x, y, w, h:0.3, fill:{color:lc} });
  sl.addText(label, { x:x+0.08, y, w:w-0.1, h:0.3, fontSize:10, bold:true, color:WHITE, fontFace:"Calibri", valign:"middle" });
  sl.addText(text,  { x:x+0.1, y:y+0.33, w:w-0.2, h:h-0.38, fontSize:10, color:BLACK, fontFace:"Calibri", wrap:true, valign:"top" });
}

/** Flowchart box */
function fbox(sl, text, x, y, w, h, bg=LGRAY, tc=BLACK, fs=11, bold=false) {
  sl.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill:{color:bg}, line:{color:MGRAY,width:1}, rectRadius:0.07 });
  sl.addText(text, { x, y, w, h, align:"center", valign:"middle", fontSize:fs, color:tc, bold, fontFace:"Calibri", wrap:true });
}

/** Downward arrow */
function arrowD(sl, cx, y1, y2) {
  sl.addShape(pres.ShapeType.line, { x:cx, y:y1, w:0, h:y2-y1, line:{color:NAVY,width:1.2,endArrowType:"triangle"} });
}

/** Horizontal arrow right */
function arrowR(sl, x1, cy, x2) {
  sl.addShape(pres.ShapeType.line, { x:x1, y:cy, w:x2-x1, h:0, line:{color:NAVY,width:1.2,endArrowType:"triangle"} });
}

/** Horizontal arrow left */
function arrowL(sl, x1, cy, x2) {
  sl.addShape(pres.ShapeType.line, { x:x2, y:cy, w:x1-x2, h:0, line:{color:NAVY,width:1.2,endArrowType:"triangle"} });
}

/** Two-row table */
function table(sl, headers, rows, x, y, w, opts={}) {
  const colW = w / headers.length;
  const rh = opts.rh || 0.38;
  // Header row
  headers.forEach((h, i) => {
    sl.addShape(pres.ShapeType.rect, { x:x+i*colW, y, w:colW, h:rh, fill:{color:NAVY} });
    sl.addText(h, { x:x+i*colW+0.04, y, w:colW-0.08, h:rh, fontSize:10, bold:true, color:WHITE, fontFace:"Calibri", valign:"middle" });
  });
  // Data rows
  rows.forEach((row, ri) => {
    const ry = y + rh + ri * rh;
    row.forEach((cell, ci) => {
      sl.addShape(pres.ShapeType.rect, { x:x+ci*colW, y:ry, w:colW, h:rh, fill:{color:ri%2===0?WHITE:LGRAY}, line:{color:MGRAY,width:0.5} });
      sl.addText(cell, { x:x+ci*colW+0.04, y:ry, w:colW-0.08, h:rh, fontSize:9.5, color:BLACK, fontFace:"Calibri", valign:"middle" });
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.63, fill:{color:WHITE} });
  // Left accent bar
  sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.18, h:5.63, fill:{color:TEAL} });
  // Top rule
  sl.addShape(pres.ShapeType.rect, { x:0.18, y:1.5, w:9.6, h:0.04, fill:{color:MGRAY} });
  sl.addText("APPROACH TO EDEMA", {
    x:0.5, y:1.7, w:9, h:1.1,
    fontSize:42, bold:true, color:NAVY, fontFace:"Calibri",
  });
  sl.addText("A Comprehensive Clinical Guide for Undergraduate Students", {
    x:0.5, y:2.85, w:9, h:0.5,
    fontSize:16, color:TEAL, fontFace:"Calibri", italic:true,
  });
  // Bottom rule
  sl.addShape(pres.ShapeType.rect, { x:0.18, y:3.5, w:9.6, h:0.04, fill:{color:MGRAY} });
  sl.addText("Department of Pediatrics", {
    x:0.5, y:3.65, w:5, h:0.38,
    fontSize:13, color:NAVY, fontFace:"Calibri", bold:true,
  });
  sl.addText("References: Harrison's 22E  ·  Robbins & Kumar 10E  ·  Nelson's Textbook of Pediatrics  ·  KDIGO 2024", {
    x:0.5, y:5.2, w:9, h:0.3,
    fontSize:9, color:DGRAY, fontFace:"Calibri", italic:true,
  });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 2 — OVERVIEW / TABLE OF CONTENTS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Table of Contents");
  const topics = [
    "Section 1  —  Definition & Terminology  (Slides 4–5)",
    "Section 2  —  Pathophysiology & Starling Forces  (Slides 7–11)",
    "Section 3  —  Classification of Edema  (Slides 13–14)",
    "Section 4  —  Causes in Children  (Slides 16–20)",
    "Section 5  —  Clinical Evaluation: History  (Slides 22–24)",
    "Section 6  —  Clinical Evaluation: Examination  (Slides 25–27)",
    "Section 7  —  Investigations  (Slides 29–32)",
    "Section 8  —  Diagnostic Approach & Flowchart  (Slides 34–36)",
    "Section 9  —  Management Principles  (Slides 38–44)",
    "Section 10 —  Special Situations & Red Flags  (Slides 46–48)",
    "Section 11 —  Summary & References  (Slides 49–50)",
  ];
  bullets(sl, topics, { y:0.95, h:4.5, fs:15 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 3 — SECTION 1 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(1, "Definition & Terminology", "What is edema? Key vocabulary every clinician must know");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 4 — DEFINITION
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Definition of Edema");
  // Definition block
  sl.addShape(pres.ShapeType.rect, { x:0.35, y:0.95, w:9.3, h:0.85, fill:{color:LGRAY}, line:{color:TEAL,width:2} });
  sl.addText([
    { text:"EDEMA:  ", options:{ bold:true, color:NAVY, fontSize:17 } },
    { text:"Abnormal accumulation of fluid in the interstitial space (extracellular, extravascular compartment)", options:{ color:BLACK, fontSize:16 } },
  ], { x:0.45, y:0.95, w:9.1, h:0.85, valign:"middle", fontFace:"Calibri" });

  sl.addText("Body Fluid Distribution", { x:0.35, y:1.95, w:5, h:0.35, fontSize:13, bold:true, color:NAVY, fontFace:"Calibri" });
  const tbl = [
    ["Compartment","% Body Weight","Volume (70 kg adult)"],
    ["Total Body Water","60%","42 L"],
    ["Intracellular fluid","40%","28 L"],
    ["Extracellular fluid","20%","14 L"],
    ["— Interstitial fluid","15%","10.5 L"],
    ["— Plasma","5%","3.5 L"],
  ];
  table(sl, tbl[0], tbl.slice(1), 0.35, 2.32, 6.0);

  sl.addText("Normal fluid homeostasis:", { x:6.8, y:1.95, w:3, h:0.3, fontSize:12, bold:true, color:NAVY, fontFace:"Calibri" });
  bullets(sl, [
    "Fluid filtered at arteriolar end of capillary",
    "Most reabsorbed at venular end",
    "Residual ~2–4 L/day drained by lymphatics",
    "Net interstitial fluid = near zero in health",
    "Edema = lymphatic capacity exceeded",
  ], { x:6.8, y:2.25, w:3.0, h:3.0, fs:12 });
  sl.addText("Source: Robbins & Kumar Basic Pathology 10E, Ch.3", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 5 — TERMINOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Key Terminology");
  const terms = [
    ["Anasarca","Severe generalized edema — subcutaneous swelling + body cavity effusions"],
    ["Hydrothorax","Pleural effusion — fluid in pleural cavity"],
    ["Hydropericardium","Fluid in pericardial sac"],
    ["Ascites / Hydroperitoneum","Fluid in peritoneal cavity"],
    ["Transudate","Protein-poor fluid (protein <3 g/dL, LDH low); caused by ↑ hydrostatic or ↓ oncotic pressure"],
    ["Exudate","Protein-rich fluid (protein >3 g/dL, LDH high); caused by ↑ capillary permeability (inflammation)"],
    ["Pitting edema","Pit remains after finger pressure; reflects free fluid accumulation"],
    ["Non-pitting edema","No pit; fluid is bound (lymphedema, myxedema, lipedema)"],
  ];
  table(sl, ["Term","Definition / Clinical meaning"], terms, 0.35, 0.95, 9.3, {rh:0.48});
  sl.addText("Source: Harrison's Principles of Internal Medicine 22E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 6 — SECTION 2 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(2, "Pathophysiology", "Starling forces, mechanisms of edema formation");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 7 — STARLING FORCES EQUATION
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Starling Forces — The Equation");
  sl.addShape(pres.ShapeType.rect, { x:0.35, y:0.9, w:9.3, h:0.72, fill:{color:LGRAY}, line:{color:TEAL,width:2} });
  sl.addText("Net Filtration  =  Kf  ×  [ (Pc − Pi)  −  σ (πc − πi) ]", {
    x:0.4, y:0.9, w:9.2, h:0.72, align:"center", valign:"middle",
    fontSize:19, bold:true, color:NAVY, fontFace:"Calibri",
  });
  table(sl,
    ["Symbol","Full Name","Normal Value","Promotes"],
    [
      ["Pc","Capillary hydrostatic pressure","~32 mmHg (arteriolar end)","Filtration OUT"],
      ["Pi","Interstitial hydrostatic pressure","~−3 mmHg","Filtration OUT"],
      ["πc","Plasma colloid osmotic pressure","~25 mmHg","Reabsorption IN"],
      ["πi","Interstitial colloid osmotic pressure","~8 mmHg","Filtration OUT"],
      ["Kf","Filtration coefficient","Variable by capillary type","—"],
      ["σ","Reflection coefficient (protein permeability)","0–1","—"],
    ],
    0.35, 1.7, 9.3, {rh:0.46}
  );
  sl.addText("Normal: Net outward filtration ≈ Net inward osmosis → Lymphatics drain the small remainder → No edema", {
    x:0.35, y:5.3, w:9.3, h:0.25, fontSize:11, color:TEAL, bold:true, fontFace:"Calibri", align:"center",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 8 — MECHANISM 1: INCREASED HYDROSTATIC PRESSURE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Mechanism 1 — Increased Hydrostatic Pressure");
  bullets(sl, [
    { t:"Principle: ↑ Capillary hydrostatic pressure (Pc) pushes fluid outward into interstitium", bold:true, fs:16 },
    "",
    { t:"Causes:", bold:true, fs:15 },
    "    Venous outflow obstruction — DVT, venous insufficiency → localized edema",
    "    Congestive heart failure (CCF) — ↓ cardiac output → blood pools in venous system → ↑ Pc",
    "    Constrictive pericarditis, cor pulmonale",
    "    Portal hypertension (hepatic vein obstruction) → ascites",
    "    Fluid overload states — excessive IV fluids, renal failure",
    "",
    { t:"Key concept in CCF:", bold:true, fs:15 },
    "    ↓ Cardiac output → ↓ Renal perfusion → Activation of RAAS",
    "    → Na⁺ and water retention → ↑ blood volume → ↑ venous pressure → worsening edema",
    "    = Self-perpetuating vicious cycle",
  ], { y:0.9, h:4.5, fs:14 });
  sl.addText("Source: Robbins & Kumar 10E, Ch.3; Harrison's 22E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 9 — MECHANISM 2: REDUCED PLASMA ONCOTIC PRESSURE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Mechanism 2 — Reduced Plasma Oncotic Pressure");
  bullets(sl, [
    { t:"Principle: ↓ Plasma albumin → ↓ πc → Less reabsorption at venular end → Fluid stays in interstitium", bold:true, fs:15 },
    "",
    { t:"Albumin accounts for ~80% of plasma colloid osmotic pressure", bold:true, fs:14 },
    "",
    { t:"Causes of ↓ Serum Albumin:", bold:true, fs:15 },
    "    (A) Increased urinary loss  —  Nephrotic syndrome (glomerular leak of albumin)",
    "    (B) Decreased synthesis  —  Liver disease (cirrhosis, hepatitis, biliary atresia)",
    "    (C) Malnutrition  —  Protein deficiency; Kwashiorkor in children",
    "    (D) Protein-losing enteropathy  —  IBD, intestinal lymphangiectasia",
    "    (E) Burns, major trauma  —  Acute losses",
    "",
    { t:"Secondary effect:", bold:true, fs:14 },
    "    ↓ Effective circulating volume → RAAS activation → Na⁺/water retention → worsens edema",
    "    (Increasing salt/water does NOT fix the primary defect → cycle continues)",
  ], { y:0.9, h:4.5, fs:14 });
  sl.addText("Source: Robbins & Kumar 10E; Costanzo Physiology 7E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 10 — MECHANISM 3 & 4: CAPILLARY PERMEABILITY + LYMPHATIC OBSTRUCTION
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Mechanism 3 & 4 — Capillary Permeability & Lymphatic Obstruction");
  sl.addText("Mechanism 3 — Increased Capillary Permeability", { x:0.35, y:0.9, w:9.3, h:0.35, fontSize:14, bold:true, color:NAVY, fontFace:"Calibri" });
  sl.addShape(pres.ShapeType.rect, { x:0.35, y:0.9, w:9.3, h:0.04, fill:{color:TEAL} });
  bullets(sl, [
    "Inflammatory mediators (histamine, bradykinin, leukotrienes) widen inter-endothelial gaps",
    "Protein-rich exudate leaks out → ↑ interstitial oncotic pressure → draws more fluid out",
    "Causes: Cellulitis, insect bites, angioedema, sepsis, anaphylaxis, burns",
    "Exudate: protein >3 g/dL, LDH elevated (unlike transudate in hydrostatic/oncotic edema)",
  ], { y:1.32, h:1.85, fs:14 });
  sl.addText("Mechanism 4 — Lymphatic Obstruction", { x:0.35, y:3.22, w:9.3, h:0.35, fontSize:14, bold:true, color:NAVY, fontFace:"Calibri" });
  sl.addShape(pres.ShapeType.rect, { x:0.35, y:3.22, w:9.3, h:0.04, fill:{color:TEAL} });
  bullets(sl, [
    "Normal lymphatics drain 2–4 L/day of interstitial fluid back to circulation",
    "When lymphatics are blocked: fluid accumulates even with normal Starling forces",
    "Non-pitting edema — protein-rich fluid polymerizes and hardens the tissue",
    "Causes: Primary lymphedema (Milroy disease, Turner/Noonan syndrome), filariasis (Wuchereria bancrofti), post-surgery, malignancy",
  ], { y:3.62, h:1.75, fs:14 });
  sl.addText("Source: Robbins & Kumar 10E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 11 — MECHANISM 5: Na RETENTION + RAAS PATHWAY DIAGRAM
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Mechanism 5 — Sodium & Water Retention (RAAS)");
  bullets(sl, [
    { t:"Primary renal sodium retention — key in Nephrotic syndrome (overfill) and renal failure", bold:true, fs:15 },
    "",
    "Direct tubular Na⁺ avidity (nephrotic syndrome, glomerulonephritis)",
    "Aldosterone-driven — secondary to ↓ effective arterial blood volume (EABV)",
    "ADH (vasopressin) — stimulated by ↓ EABV → free water retention → dilutional hyponatremia",
  ], { y:0.9, h:1.9, fs:14 });

  // Simple RAAS flowchart
  const bx = (t, x, y, w=2.6, h=0.48, bg=LGRAY) => fbox(sl, t, x, y, w, h, bg, BLACK, 10.5);
  bx("↓ Effective Arterial\nBlood Volume (EABV)", 3.7, 2.85, 2.6, 0.55, MGRAY);
  arrowD(sl, 5.0, 3.4, 3.72);
  bx("↑ Renin release\n(juxtaglomerular apparatus)", 3.7, 3.72, 2.6, 0.5);
  arrowD(sl, 5.0, 4.22, 4.52);
  bx("Angiotensin I → II\n(ACE in lung)", 3.7, 4.52, 2.6, 0.5);

  // Angiotensin II branches
  arrowL(sl, 3.7, 4.77, 2.0);
  bx("Vasoconstriction\n(↑ BP)", 0.4, 4.52, 1.55, 0.5);
  arrowR(sl, 6.3, 4.77, 7.7);
  bx("↑ Aldosterone\n→ ↑ Na⁺ reabsorption", 7.7, 4.52, 1.85, 0.5);

  sl.addText("Result: ↑ ECF volume → ↑ venous hydrostatic pressure → EDEMA", {
    x:0.35, y:5.3, w:9.3, h:0.25, align:"center", fontSize:11, bold:true, color:TEAL, fontFace:"Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 12 — SECTION 3 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(3, "Classification of Edema", "Localised vs Generalised — first decision in clinical approach");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 13 — CLASSIFICATION: LOCALISED
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Classification — Localised Edema");
  sl.addText("Localised edema: Confined to one region or limb — caused by local factors", {
    x:0.35, y:0.88, w:9.3, h:0.35, fontSize:13, color:NAVY, fontFace:"Calibri", italic:true,
  });
  table(sl,
    ["Category","Examples","Key Distinguishing Feature"],
    [
      ["Venous obstruction","DVT, venous insufficiency, May-Thurner syndrome","Unilateral leg edema, dilated veins"],
      ["Lymphatic obstruction","Primary lymphedema (Milroy), filariasis, post-surgical","Non-pitting, progressively firm"],
      ["Inflammatory","Cellulitis, abscess, osteomyelitis, insect bite","Warm, red, tender, raised WBC"],
      ["Allergic / Angioedema","Urticaria, HAE, drug reaction, anaphylaxis","Rapid onset, non-pitting, pruritus"],
      ["Obstructive (vascular)","SVC syndrome, inferior vena cava obstruction","Bilateral facial/arm edema + collaterals"],
      ["Traumatic / Dependent","Post-fracture, cast-related, prolonged immobility","History of trauma or immobilisation"],
      ["Lipedema","Fat deposition in legs (girls/women)","Symmetric, spares feet, non-pitting"],
    ],
    0.35, 1.25, 9.3, {rh:0.48}
  );
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 14 — CLASSIFICATION: GENERALISED
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Classification — Generalised Edema");
  sl.addText("Generalised edema (Anasarca): Involves multiple regions; systemic cause must be identified", {
    x:0.35, y:0.88, w:9.3, h:0.35, fontSize:13, color:NAVY, fontFace:"Calibri", italic:true,
  });
  table(sl,
    ["System","Condition","Primary Mechanism"],
    [
      ["Renal","Nephrotic syndrome (most common in children)","↓ Oncotic pressure (albumin loss in urine)"],
      ["Renal","Nephritic syndrome, AKI, CKD","↑ Hydrostatic pressure (Na/water retention)"],
      ["Cardiac","CCF, congenital heart disease","↑ Venous hydrostatic pressure"],
      ["Hepatic","Cirrhosis, neonatal hepatitis, biliary atresia","↓ Albumin synthesis + portal hypertension"],
      ["Nutritional","Kwashiorkor, marasmus-kwashiorkor","↓ Protein intake → ↓ albumin"],
      ["Endocrine","Hypothyroidism (myxedema), Cushing syndrome","↑ Interstitial mucopolysaccharides / Na retention"],
      ["Protein-losing","Protein-losing enteropathy, IBD","↓ Protein absorption/loss via gut"],
      ["Idiopathic","Cyclic edema (adolescent females)","Unknown; possibly ↑ capillary permeability"],
    ],
    0.35, 1.25, 9.3, {rh:0.46}
  );
  sl.addText("★  In children <6 years: Nephrotic Syndrome (Minimal Change Disease) is the most common cause", {
    x:0.35, y:5.3, w:9.3, h:0.25, align:"center", fontSize:11, bold:true, color:TEAL, fontFace:"Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 15 — SECTION 4 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(4, "Causes in Children", "Age-based & system-based approach to pediatric edema");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 16 — MNEMONIC: RENAL CHOP
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Causes in Children — Mnemonic: RENAL CHOP");
  table(sl,
    ["Letter","System","Key Conditions"],
    [
      ["R","Renal","Nephrotic syndrome, Nephritic syndrome, AKI, CKD"],
      ["E","Endocrine","Hypothyroidism, Cushing syndrome, steroid-induced"],
      ["N","Nutritional","Kwashiorkor, marasmus-kwashiorkor, malabsorption"],
      ["A","Allergic / Angioedema","HAE (C1-INH deficiency), drug reactions, anaphylaxis"],
      ["L","Lymphatic / Local","Milroy disease, filariasis, Turner / Noonan syndrome"],
      ["C","Cardiac","CCF, congenital heart disease, cardiomyopathy, pericarditis"],
      ["H","Hepatic","Neonatal hepatitis, biliary atresia, cirrhosis"],
      ["O","Obstruction / Oncology","Wilms tumour, SVC syndrome, abdominal mass"],
      ["P","Protein-losing enteropathy","IBD, intestinal lymphangiectasia, coeliac disease"],
    ],
    0.35, 0.95, 9.3, {rh:0.48}
  );
  sl.addText("★  Most common cause in children:  Nephrotic syndrome  (Minimal Change Disease in <6 years)", {
    x:0.35, y:5.3, w:9.3, h:0.25, align:"center", fontSize:11, bold:true, color:TEAL, fontFace:"Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 17 — NEONATAL CAUSES
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Causes — Neonatal Edema");
  twoCol(sl, [
    { t:"Immune Hydrops Fetalis", bold:true, fs:15 },
    "Rh isoimmunization (anti-D, anti-c, anti-Kell)",
    "ABO incompatibility",
    "Mechanism: Fetal anaemia → ↓ oncotic pressure → anasarca",
    "",
    { t:"Non-Immune Hydrops Fetalis", bold:true, fs:15 },
    "Cardiac: Structural CHD, arrhythmias, cardiomyopathy",
    "Chromosomal: Turner (45,XO), Down, trisomy 18",
    "Metabolic: Gaucher, GM1 gangliosidosis",
    "Haematologic: Alpha-thalassaemia major",
    "Infectious: CMV, toxoplasma, syphilis, parvovirus B19",
    "Twin-twin transfusion syndrome",
  ],[
    { t:"Prematurity-related", bold:true, fs:15 },
    "Hypoproteinaemia of prematurity",
    "Respiratory distress syndrome — capillary leak",
    "Patent ductus arteriosus → CCF → edema",
    "",
    { t:"Syndromic / Genetic", bold:true, fs:15 },
    "Milroy disease — primary lymphedema (FLT4 mutation)",
    "Turner syndrome — pedal lymphedema at birth",
    "Noonan syndrome — lymphedema, pleural effusion",
    "",
    { t:"Congenital Nephrotic Syndrome", bold:true, fs:15 },
    "Finnish type: NPHS1 (nephrin) mutation",
    "Diffuse mesangial sclerosis: WT1 mutation",
    "Presents with massive proteinuria from birth",
  ], { y:0.95, fs:14 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 18 — NEPHROTIC SYNDROME OVERVIEW
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Nephrotic Syndrome — Overview");
  // Tetrad
  sl.addShape(pres.ShapeType.rect, { x:0.35, y:0.88, w:9.3, h:0.52, fill:{color:LGRAY}, line:{color:TEAL,width:1.5} });
  sl.addText("TETRAD:  Massive Proteinuria  +  Hypoalbuminaemia  +  Generalised Edema  +  Hyperlipidaemia / Lipiduria", {
    x:0.4, y:0.88, w:9.2, h:0.52, align:"center", valign:"middle",
    fontSize:13, bold:true, color:NAVY, fontFace:"Calibri",
  });
  table(sl,
    ["Type","Age","Proteinuria","Haematuria","BP","Complement","Steroid Response"],
    [
      ["Minimal Change (MCD)","1–8 yr (peak)","Massive","Absent","Normal","Normal","Excellent (>90%)"],
      ["FSGS","Older children","Massive","May occur","↑","Normal","Variable (30–40%)"],
      ["Membranous","Adolescents","Massive","Rare","Normal/↑","Normal","Poor"],
      ["Membranoproliferative","School age","Moderate-massive","Present","↑","↓C3","Poor"],
      ["Congenital NS (Finnish)","Birth–3 mo","Massive","Absent","Variable","Normal","None"],
    ],
    0.35, 1.48, 9.3, {rh:0.48}
  );
  bullets(sl, [
    { t:"Diagnostic criteria: Proteinuria >40 mg/m²/hr  OR  urine protein:creatinine ratio >200 mg/mmol  +  albumin <2.5 g/dL", bold:true, fs:13 },
  ], { y:4.9, h:0.4, fs:13 });
  sl.addText("Source: Nelson's Textbook of Pediatrics 21E; KDIGO 2024", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 19 — NEPHRITIC SYNDROME
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Nephritic Syndrome — Comparison");
  sl.addText("Nephritic Syndrome — the other major renal cause of edema", {
    x:0.35, y:0.88, w:9.3, h:0.3, fontSize:13, color:NAVY, italic:true, fontFace:"Calibri",
  });
  table(sl,
    ["Feature","Nephrotic Syndrome","Nephritic Syndrome"],
    [
      ["Proteinuria","Massive (>3.5 g/day adult; >40 mg/m²/hr child)","Mild–moderate (<2 g/day)"],
      ["Haematuria","Absent / microscopic","Present — smoky urine, RBC casts"],
      ["Hypertension","Absent (unless FSGS/MPGN)","Present — hallmark feature"],
      ["Edema","Periorbital, generalised","Periorbital, less severe"],
      ["Serum albumin","Low","Normal / mildly low"],
      ["Complement","Normal (MCD); ↓ in MPGN","↓C3 in PSGN, MPGN"],
      ["Oliguria","Absent","Common (GFR ↓)"],
      ["Mechanism","↓ Oncotic pressure","↑ Hydrostatic + Na retention"],
      ["Common causes in child","MCD, FSGS","Post-strep GN (PSGN), IgA nephropathy, MPGN"],
    ],
    0.35, 1.22, 9.3, {rh:0.44}
  );
  sl.addText("PSGN = Post-streptococcal glomerulonephritis; MPGN = Membranoproliferative GN; MCD = Minimal Change Disease", {
    x:0.35, y:5.3, w:9.3, h:0.25, fontSize:9, color:DGRAY, fontFace:"Calibri", italic:true,
  });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 20 — CARDIAC, HEPATIC, NUTRITIONAL CAUSES
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Other Important Causes in Children");
  twoCol(sl, [
    { t:"Cardiac Causes", bold:true, fs:15, c:NAVY },
    "Congestive heart failure secondary to:",
    "   • Congenital heart disease (VSD, PDA, AVSD)",
    "   • Cardiomyopathy (dilated, hypertrophic)",
    "   • Myocarditis, pericardial effusion",
    "   • Severe anaemia → high-output failure",
    "Clinical: Tachycardia, S3 gallop, hepatomegaly, basal crepitations",
    "",
    { t:"Hepatic Causes", bold:true, fs:15, c:NAVY },
    "Cirrhosis (biliary atresia, autoimmune hepatitis)",
    "Neonatal hepatitis, PFIC, Wilson's disease",
    "Mechanism: ↓ Albumin + Portal hypertension → Ascites",
    "Signs: Jaundice, spider naevi, caput medusae",
  ],[
    { t:"Nutritional Causes", bold:true, fs:15, c:NAVY },
    "Kwashiorkor — severe protein deficiency",
    "   • Edema + Growth failure + Skin changes",
    "   • 'Flaky paint' rash, sparse discoloured hair",
    "   • Hepatomegaly (fatty liver)",
    "   • Albumin severely low",
    "Marasmic-kwashiorkor: Combined",
    "Protein-losing enteropathy: IBD, coeliac",
    "",
    { t:"Endocrine Causes", bold:true, fs:15, c:NAVY },
    "Hypothyroidism: Non-pitting, periorbital, hoarse voice",
    "   • Mechanism: ↑ Mucopolysaccharides (myxedema)",
    "Cushing syndrome / steroid therapy: Na retention",
    "Diabetes mellitus: CCF, renal disease (late)",
  ], { y:0.95, fs:13 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 21 — SECTION 5 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(5, "Clinical Evaluation — History", "A structured history narrows the differential significantly");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 22 — HISTORY 1: ONSET, SITE, TIMING
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("History — Onset, Site & Temporal Pattern");
  twoCol(sl, [
    { t:"Onset", bold:true, fs:15 },
    "Sudden (<24 h): Angioedema, anaphylaxis, DVT",
    "Subacute (days): Nephrotic syndrome, CCF exacerbation",
    "Insidious (weeks): Nutritional, hypothyroid, chronic liver disease",
    "",
    { t:"Site of First Onset", bold:true, fs:15 },
    "Periorbital (face) on waking → Nephrotic syndrome",
    "Legs/ankles at end of day → Cardiac / venous",
    "Sacral (bedridden child) → Cardiac / renal",
    "Scrotal / labial → Nephrotic",
    "Generalised from birth → Congenital NS / Hydrops",
  ],[
    { t:"Temporal Pattern", bold:true, fs:15 },
    "Persistent and progressive → Renal, cardiac, hepatic",
    "Intermittent / cyclical → Cyclic edema, HAE",
    "Morning worse, improves by evening → Renal/hypoalbuminaemic",
    "Worsens by evening → Cardiac/venous (dependent)",
    "",
    { t:"Diurnal Pattern — Quick guide", bold:true, fs:15 },
    "Periorbital AM  ―  Nephrotic syndrome",
    "Dependent PM  ―  Cardiac / venous",
    "Non-diurnal  ―  Lymphatic / hypothyroid",
    "After eating / medication  ―  Allergic / drug-induced",
  ], { y:0.95, fs:14 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 23 — HISTORY 2: ASSOCIATED SYMPTOMS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("History — Associated Symptoms");
  table(sl,
    ["Symptom","Points Toward"],
    [
      ["Frothy / foamy urine","Proteinuria → Nephrotic syndrome"],
      ["Haematuria (smoky / brown urine)","Nephritic syndrome, IgA nephropathy, PSGN"],
      ["Breathlessness, orthopnoea, PND","Cardiac failure, pulmonary oedema"],
      ["Jaundice + abdominal swelling","Hepatic cause — cirrhosis, biliary atresia"],
      ["Diarrhoea, malabsorption, weight loss","Protein-losing enteropathy, coeliac, IBD"],
      ["Skin rash, urticaria, pruritus","Allergic / angioedema, SLE, vasculitis"],
      ["Constipation, cold intolerance, hoarse voice","Hypothyroidism"],
      ["Recent throat / skin infection (10–14 days ago)","Post-streptococcal GN (PSGN)"],
      ["Fever + tender limb","Cellulitis, osteomyelitis (localised edema)"],
      ["Weight gain (rapid, >1 kg/week)","Fluid retention — renal / cardiac"],
      ["Abdominal pain + swelling (recurrent)","Hereditary angioedema (HAE)"],
      ["Poor feeding, lethargy, neonatal onset","Congenital NS, Hydrops, cardiac CHD"],
    ],
    0.35, 0.95, 9.3, {rh:0.4}
  );
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 24 — HISTORY 3: PAST HISTORY, DRUGS, FAMILY, DIET
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("History — Past Medical, Drug, Family & Nutritional History");
  twoCol(sl, [
    { t:"Past Medical History", bold:true, fs:15 },
    "Prior episodes of edema — relapses suggest NS",
    "Known cardiac / renal / hepatic disease",
    "History of streptococcal infections (pharyngitis, impetigo)",
    "Recurrent abdominal pain / angioedema → HAE",
    "Recent hospitalisation / surgery / immobilisation",
    "Vaccinations — relevant for certain infections",
    "",
    { t:"Drug History", bold:true, fs:15 },
    "NSAIDs → Na retention, nephrotic-range proteinuria",
    "Calcium channel blockers (amlodipine) → peripheral edema",
    "Corticosteroids (chronic) → salt retention, Cushing",
    "Lithium, gold, penicillamine → membranous NS",
    "ACE inhibitors → angioedema (bradykinin-mediated)",
  ],[
    { t:"Family History", bold:true, fs:15 },
    "Hereditary angioedema (C1-INH deficiency) — AD",
    "Congenital nephrotic syndrome — AR (Finnish type)",
    "Alport syndrome — X-linked / AR nephritis",
    "Milroy lymphedema — AD (FLT4 mutation)",
    "Polycystic kidney disease",
    "Familial hypertriglyceridaemia, hyperlipidaemia",
    "",
    { t:"Nutritional History", bold:true, fs:15 },
    "Breastfeeding vs formula vs complementary foods",
    "Dietary protein intake — kwashiorkor risk in 6 m – 3 yr",
    "Recent illness with anorexia — acute malnutrition",
    "Mid-upper arm circumference (MUAC) — malnutrition screen",
  ], { y:0.95, fs:13.5 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 25 — SECTION 6 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(6, "Clinical Evaluation — Examination", "Systematic examination to localise cause and assess severity");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 26 — EXAMINATION: PITTING TEST + GENERAL
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Examination — General & Pitting Assessment");
  sl.addShape(pres.ShapeType.rect, { x:0.35, y:0.88, w:9.3, h:0.55, fill:{color:LGRAY}, line:{color:TEAL,width:1.5} });
  sl.addText("PITTING TEST: Press thumb firmly over bony prominence (tibia/sacrum) for 5 seconds. Pit formation = pitting edema (free fluid).", {
    x:0.45, y:0.88, w:9.1, h:0.55, valign:"middle", fontSize:12, bold:true, color:NAVY, fontFace:"Calibri",
  });
  table(sl,
    ["Grade","Pit Depth","Rebound Time","Clinical Significance"],
    [
      ["+1","2 mm","Rapid (<15 sec)","Mild edema"],
      ["+2","4 mm","15–30 sec","Moderate"],
      ["+3","6 mm","30–60 sec","Severe"],
      ["+4",">8 mm",">60 sec","Very severe / Anasarca"],
    ],
    0.35, 1.5, 7.0, {rh:0.44}
  );
  sl.addText("Non-Pitting Edema — Features", { x:7.65, y:1.5, w:2.0, h:0.38, fontSize:12, bold:true, color:NAVY, fontFace:"Calibri" });
  bullets(sl, [
    "No pit on pressure",
    "Rubbery / firm texture",
    "Protein-bound fluid",
    "Causes:",
    "• Lymphedema",
    "• Myxedema (hypothyroid)",
    "• Lipedema",
  ], { x:7.65, y:1.9, w:2.05, h:2.5, fs:11 });

  sl.addText("General Examination", { x:0.35, y:3.78, w:9.3, h:0.32, fontSize:13, bold:true, color:NAVY, fontFace:"Calibri" });
  bullets(sl, [
    "Nutritional status: weight, height, BMI, MUAC — faltering growth in NS / kwashiorkor",
    "Pallor (anaemia → CCF or renal failure)  |  Jaundice (hepatic cause)  |  Cyanosis (cardiac)",
    "Moon face / buffalo hump / striae → Cushing / prolonged steroid use",
    "Vital signs: BP (↑ in nephritic / renal failure), pulse (tachycardia in CCF / hypovolaemia), RR",
  ], { y:4.1, h:1.3, fs:13 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 27 — SYSTEMIC EXAMINATION FINDINGS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Examination — Systemic Findings by System");
  table(sl,
    ["System","Key Findings","Suggests"],
    [
      ["Face / Eyes","Periorbital puffiness (AM)","Nephrotic syndrome"],
      ["Face","Moon face, plethora, bruising","Cushing / steroid excess"],
      ["Face","Coarse facies, dry skin, macroglossia","Hypothyroidism"],
      ["Neck","Elevated JVP, hepatojugular reflux","Right heart failure"],
      ["Chest","Bilateral basal dullness, ↓ breath sounds","Pleural effusion"],
      ["Chest","S3 gallop, cardiomegaly, murmur","CCF / congenital HD"],
      ["Abdomen","Shifting dullness + fluid thrill","Ascites"],
      ["Abdomen","Hepatomegaly (smooth, tender)","CCF, hepatitis, storage"],
      ["Abdomen","Splenomegaly","Portal hypertension, malaria"],
      ["Genitalia","Scrotal / labial puffiness","Nephrotic syndrome"],
      ["Limbs","Bilateral pitting edema — legs","Cardiac / renal / hepatic"],
      ["Limbs","Unilateral non-pitting firm edema","Lymphedema"],
      ["Skin","Flaky-paint dermatosis, sparse hair","Kwashiorkor"],
      ["Skin","Urticaria + wheal/flare","Allergic angioedema"],
    ],
    0.35, 0.95, 9.3, {rh:0.35}
  );
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 28 — SECTION 7 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(7, "Investigations", "A structured step-wise investigative approach");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 29 — INVESTIGATIONS TIER 1
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Investigations — Tier 1 (All Cases)");
  sl.addText("Perform in EVERY child presenting with edema, regardless of suspected cause", {
    x:0.35, y:0.88, w:9.3, h:0.3, fontSize:13, color:NAVY, italic:true, fontFace:"Calibri",
  });
  table(sl,
    ["Investigation","What to Look For","Interpretation"],
    [
      ["Urine routine examination","Protein (dipstick), RBCs, casts, specific gravity","3–4+ protein → NS; RBC casts → nephritis"],
      ["Urine protein : creatinine ratio (UPCR)","Quantify proteinuria (spot urine, morning sample)",">200 mg/mmol = nephrotic range"],
      ["24-hour urine protein","Gold standard for proteinuria quantification",">40 mg/m²/hr = nephrotic range in children"],
      ["Serum albumin","Reflect oncotic status","<2.5 g/dL confirms hypoalbuminaemia"],
      ["Serum total protein","Overall protein status","Normal = ~6–8 g/dL"],
      ["Serum urea + creatinine","Renal function — calculate eGFR","↑ Creatinine → AKI/CKD"],
      ["Serum electrolytes","Na, K, Cl, HCO3","Hyponatraemia common in severe NS"],
      ["Complete blood count (CBC)","Anaemia, infection, eosinophilia","Eosinophilia → allergic/parasitic"],
      ["Blood pressure measurement","Hypertension → nephritic/renal failure","SBP >95th percentile for age"],
    ],
    0.35, 1.22, 9.3, {rh:0.44}
  );
  sl.addText("Source: KDIGO 2024; Nelson's Pediatrics 21E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 30 — INVESTIGATIONS TIER 2
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Investigations — Tier 2 (Directed by Clinical Clues)");
  table(sl,
    ["Investigation","Indication","Interpretation"],
    [
      ["Serum lipid profile","All NS patients","↑ Cholesterol + ↑ Triglycerides → nephrotic hyperlipidaemia"],
      ["Liver function tests (LFTs) + PT/INR","Suspected hepatic cause","↑ Bilirubin, ↓ albumin, ↑ transaminases, ↑ PT"],
      ["Thyroid function tests (TSH, fT4)","Non-pitting / hypothyroid features","↑ TSH, ↓ fT4 → hypothyroidism"],
      ["Serum complement C3, C4","Haematuria, low BP, ↑ creatinine","↓C3 in PSGN, MPGN, lupus nephritis"],
      ["ASO titre / Anti-DNase B","Recent throat/skin infection","↑ → Post-streptococcal GN"],
      ["Blood culture + CRP / ESR","Fever + localised edema","Cellulitis, sepsis, peritonitis"],
      ["Chest X-ray","Cardiac failure, pleural effusion","Cardiomegaly, bilateral pleural effusions, pulmonary oedema"],
      ["Electrocardiogram (ECG)","Palpitations, suspected cardiac cause","Arrhythmia, ventricular hypertrophy"],
      ["Echocardiography","CCF, suspected congenital HD","Structural defect, pericardial effusion, reduced EF"],
      ["Abdominal USG","Ascites, hepatomegaly, renal size","Renal echogenicity ↑ in CKD; small liver → cirrhosis"],
    ],
    0.35, 0.95, 9.3, {rh:0.43}
  );
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 31 — INVESTIGATIONS TIER 3
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Investigations — Tier 3 (Specialist / Secondary Workup)");
  table(sl,
    ["Investigation","Indication","Purpose"],
    [
      ["Renal biopsy","Steroid-resistant NS; atypical NS (<1 yr, >12 yr, haematuria, ↓C3, HTN)","Histological diagnosis: MCD vs FSGS vs membranous etc."],
      ["ANA, anti-dsDNA, ANCA","Systemic disease features, pubescent females","Lupus nephritis, ANCA vasculitis"],
      ["Serum C1-INH level + C4","Recurrent angioedema without urticaria","Hereditary angioedema (HAE) — ↓ C1-INH and C4"],
      ["Duplex Doppler — limb veins","Unilateral limb edema","Deep vein thrombosis (DVT) — hypercoagulable in NS"],
      ["Lymphoscintigraphy","Chronic non-pitting edema","Primary vs secondary lymphedema"],
      ["Genetic testing (NPHS1, NPHS2, WT1)","Congenital / infantile NS, family history","Finnish NS, Denys-Drash, Frasier syndrome"],
      ["Liver biopsy","Progressive hepatic disease","Cirrhosis staging, storage diseases, PFIC"],
      ["Cardiac catheterisation","Suspected constrictive pericarditis","Confirm haemodynamic compromise"],
      ["TORCH / VDRL serology","Neonatal hydrops","Congenital infection screen"],
    ],
    0.35, 0.95, 9.3, {rh:0.48}
  );
  sl.addText("NS = Nephrotic Syndrome; MCD = Minimal Change Disease; FSGS = Focal Segmental Glomerulosclerosis; PFIC = Progressive Familial Intrahepatic Cholestasis", {
    x:0.35, y:5.3, w:9.3, h:0.25, fontSize:8.5, color:DGRAY, italic:true, fontFace:"Calibri",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 32 — INTERPRETATION: KEY LAB PATTERNS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Lab Pattern Recognition at a Glance");
  table(sl,
    ["Pattern","Most Likely Diagnosis"],
    [
      ["↑↑↑ Proteinuria + ↓ Albumin + ↑ Cholesterol + Edema","Nephrotic Syndrome"],
      ["Haematuria + ↑ BP + ↓ C3 + 10–14 days post-infection","Post-streptococcal GN (Nephritic)"],
      ["↑ Urea/Creatinine + Oliguria + Haematuria + ↑ BP","Acute Kidney Injury (AKI)"],
      ["↓ Albumin + ↑ PT + ↑ Bilirubin + ↑ Transaminases","Hepatic failure / Cirrhosis"],
      ["Cardiomegaly on CXR + ↑ BNP + Bilateral effusions","Congestive Heart Failure"],
      ["↑ TSH + ↓ fT4 + Non-pitting edema + Dry skin","Hypothyroidism (Myxedema)"],
      ["↓ Albumin + Normal urine + Chronic diarrhoea + Malnutrition","Protein-losing enteropathy / Kwashiorkor"],
      ["↓ C1-INH + ↓ C4 + Recurrent angioedema (no urticaria)","Hereditary Angioedema (HAE)"],
      ["Periorbital puffiness + 3+ proteinuria + Hypoalbuminaemia + Normal BP + Normal C3","Minimal Change Disease (Nephrotic)"],
    ],
    0.35, 0.95, 9.3, {rh:0.48}
  );
  sl.addText("Source: Harrison's 22E; Nelson's 21E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 33 — SECTION 8 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(8, "Diagnostic Approach & Flowcharts", "Step-by-step clinical algorithms for pediatric edema");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 34 — DIAGNOSTIC ALGORITHM: STEP 1-2
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Diagnostic Algorithm — Step 1 & 2", "First decisions in any child presenting with edema");

  // Step 1
  fbox(sl, "Child presents with EDEMA", 3.2, 0.95, 3.6, 0.52, NAVY, WHITE, 13, true);
  arrowD(sl, 5.0, 1.47, 1.78);

  fbox(sl, "STEP 1\nLocalised or Generalised?", 3.2, 1.78, 3.6, 0.62, LGRAY, BLACK, 12, true);

  // Localised branch
  arrowL(sl, 3.2, 2.09, 1.5);
  sl.addText("Localised", { x:1.55, y:1.82, w:1.5, h:0.28, align:"center", fontSize:10, color:NAVY, bold:true, fontFace:"Calibri" });
  fbox(sl, "Identify local cause\n(DVT, cellulitis,\nlymphedema,\nangioedema)", 0.25, 2.2, 2.2, 0.9, LGRAY, BLACK, 10.5);

  // Generalised branch
  arrowR(sl, 6.8, 2.09, 8.35);
  sl.addText("Generalised", { x:6.8, y:1.82, w:1.5, h:0.28, align:"center", fontSize:10, color:NAVY, bold:true, fontFace:"Calibri" });

  arrowD(sl, 5.0, 2.4, 2.7);
  fbox(sl, "STEP 2\nCheck Serum Albumin", 3.2, 2.7, 3.6, 0.55, LGRAY, BLACK, 12, true);
  arrowD(sl, 5.0, 3.25, 3.55);

  // Low albumin
  arrowL(sl, 3.2, 3.82, 1.45);
  sl.addText("Low (<2.5 g/dL)", { x:1.45, y:3.55, w:1.7, h:0.28, align:"center", fontSize:10, color:NAVY, bold:true, fontFace:"Calibri" });
  fbox(sl, "Hypoalbuminaemia:\n→ Nephrotic Syndrome\n→ Liver disease\n→ Malnutrition / PLE", 0.25, 3.65, 2.2, 0.9, LGRAY, BLACK, 10.5);

  // Normal albumin
  arrowR(sl, 6.8, 3.82, 8.25);
  sl.addText("Normal", { x:6.8, y:3.55, w:1.5, h:0.28, align:"center", fontSize:10, color:NAVY, bold:true, fontFace:"Calibri" });
  fbox(sl, "Normal albumin:\n→ Cardiac edema\n→ Renal failure\n→ Hypothyroid", 7.55, 3.65, 2.2, 0.9, LGRAY, BLACK, 10.5);

  arrowD(sl, 5.0, 3.55, 3.85);
  fbox(sl, "STEP 3 →", 3.2, 3.85, 3.6, 0.42, MGRAY, NAVY, 11, true);
  sl.addText("Proceed to Slide 35", { x:3.2, y:4.28, w:3.6, h:0.3, align:"center", fontSize:10, color:DGRAY, italic:true, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 35 — DIAGNOSTIC ALGORITHM: STEP 3-5
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Diagnostic Algorithm — Step 3, 4 & 5", "Continuing the workup after Step 2");

  fbox(sl, "Generalised edema with Low Albumin\n→ Check Urine Protein", 3.0, 0.88, 4.0, 0.62, LGRAY, BLACK, 12, true);
  arrowD(sl, 5.0, 1.5, 1.82);

  // Massive proteinuria
  arrowL(sl, 3.0, 2.08, 1.2);
  sl.addText("Massive proteinuria\n(3–4+, UPCR >200)", { x:0.25, y:1.82, w:1.8, h:0.38, align:"center", fontSize:9, color:NAVY, bold:true, fontFace:"Calibri" });
  fbox(sl, "NEPHROTIC SYNDROME\n→ Check age, BP, C3, haematuria\n→ <6 yr, typical: Treat empirically (MCD)\n→ Atypical: Renal biopsy", 0.25, 2.2, 2.5, 1.0, LGRAY, BLACK, 10.5);

  fbox(sl, "Urine Protein & Haematuria", 3.4, 1.82, 3.2, 0.52, LGRAY, BLACK, 11, true);

  // Mild proteinuria + haematuria
  arrowR(sl, 6.6, 2.08, 7.8);
  sl.addText("Haematuria +\nMild proteinuria", { x:6.6, y:1.82, w:1.8, h:0.38, align:"center", fontSize:9, color:NAVY, bold:true, fontFace:"Calibri" });
  fbox(sl, "NEPHRITIC SYNDROME\n→ Check C3, ASO, BP\n→ PSGN: Low C3, ↑ ASO\n→ MPGN/Lupus: further workup", 7.25, 2.2, 2.5, 1.0, LGRAY, BLACK, 10.5);

  arrowD(sl, 5.0, 2.34, 2.64);
  fbox(sl, "Step 4 — Check Renal Function (Urea, Cr, eGFR)", 2.8, 2.64, 4.4, 0.52, LGRAY, BLACK, 11, true);
  arrowD(sl, 5.0, 3.16, 3.46);

  arrowL(sl, 2.8, 3.72, 1.2);
  sl.addText("↑ Creatinine /\nOliguria", { x:0.35, y:3.46, w:1.5, h:0.38, align:"center", fontSize:9, color:NAVY, bold:true, fontFace:"Calibri" });
  fbox(sl, "AKI / CKD\n→ Fluid balance\n→ Nephrology referral", 0.25, 3.88, 2.5, 0.7, LGRAY, BLACK, 10.5);

  fbox(sl, "Step 5 — Normal albumin + No/minimal proteinuria", 2.8, 3.46, 4.4, 0.52, LGRAY, BLACK, 11, true);
  arrowD(sl, 5.0, 3.98, 4.28);
  fbox(sl, "Consider: Cardiac (Echo, CXR, BNP)  |  Hepatic (LFT, USG)  |  Endocrine (TSH)  |  Lymphatic (Doppler)", 1.8, 4.28, 6.4, 0.68, LGRAY, BLACK, 11);
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 36 — TEXTBOOK FIGURE: SYSTEMIC EDEMA PATHWAYS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Textbook Figure — Pathways to Systemic Edema", "Robbins & Kumar Basic Pathology 10E, Figure 3.3");
  sl.addImage({ path:"/home/daytona/workspace/edema-ppt/edema_pathways.png", x:0.4, y:0.88, w:5.5, h:4.4 });
  sl.addText("Figure 3.3 — Mechanisms", { x:6.15, y:0.88, w:3.5, h:0.35, fontSize:12, bold:true, color:NAVY, fontFace:"Calibri" });
  bullets(sl, [
    "Heart failure: ↓ CO → venous pooling + RAAS",
    "Renal failure: direct Na⁺ retention",
    "Liver failure / Malnutrition / NS: ↓ albumin → ↓ oncotic pressure",
    "All three converge on ↑ interstitial fluid",
    "Lymphatics are the 'safety valve' — when overwhelmed, edema results",
    "Secondary hyperaldosteronism worsens all three",
    "Treatment targets: diuretics, albumin, treat primary disease",
  ], { x:6.15, y:1.25, w:3.5, h:4.0, fs:12 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 37 — SECTION 9 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(9, "Management", "Principles of edema management in children");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 38 — MANAGEMENT OVERVIEW
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Management — General Principles");
  bullets(sl, [
    { t:"Principle 1 — Treat the Underlying Cause", bold:true, fs:16, c:NAVY },
    "Edema is a symptom, not a diagnosis — treating only the fluid is insufficient",
    "Correct the primary defect: reduce proteinuria, improve cardiac output, restore nutrition",
    "",
    { t:"Principle 2 — Dietary Restriction", bold:true, fs:16, c:NAVY },
    "Na⁺ restriction: 35 mg/kg/day (≈1.5 mEq/kg/day) in all edematous states",
    "Fluid restriction: guided by urine output + insensible loss (not routinely needed if Na restricted)",
    "Adequate protein diet (except in uraemic patients with CKD)",
    "",
    { t:"Principle 3 — Monitor Fluid Status Closely", bold:true, fs:16, c:NAVY },
    "Daily weight — best indicator of fluid accumulation/loss (1 kg ≈ 1 litre)",
    "Urine output monitoring — target >1 mL/kg/hr",
    "Blood pressure, JVP, signs of under- or over-fill",
    "",
    { t:"Principle 4 — Pharmacological Support (targeted)", bold:true, fs:16, c:NAVY },
    "Diuretics, albumin infusion, disease-specific agents — see following slides",
  ], { y:0.9, h:4.5, fs:14 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 39 — DIURETICS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Management — Diuretics");
  table(sl,
    ["Drug","Class","Dose (Paediatric)","Site of Action","Key Points"],
    [
      ["Furosemide","Loop diuretic","1–2 mg/kg/dose IV/PO\nMax 6 mg/kg/day","Thick ascending loop of Henle","First-line; monitor electrolytes; resistance in hypoalbuminaemia"],
      ["Spironolactone","K⁺-sparing / Aldosterone antagonist","2–3 mg/kg/day in 2 divided doses","Collecting duct","Blocks RAAS; synergistic with furosemide; prevents K⁺ loss"],
      ["Hydrochlorothiazide","Thiazide","1–3 mg/kg/day PO","Distal convoluted tubule","Add-on for refractory edema; risk of hyponatraemia"],
      ["Metolazone","Thiazide-like","0.1–0.2 mg/kg/day","DCT","Powerful add-on before furosemide (within 30 min); monitor electrolytes closely"],
      ["Bumetanide","Loop diuretic","0.015–0.1 mg/kg/dose","Thick ascending loop","Alternative to furosemide; not widely available"],
    ],
    0.35, 0.95, 9.3, {rh:0.68}
  );
  bullets(sl, [
    { t:"Diuretic Resistance:", bold:true, fs:13 },
    "In NS: Low albumin binds furosemide → free drug ↓ → ↓ tubular secretion → give albumin first, then furosemide",
    "Strategies: ↑ dose, switch IV, add spironolactone/metolazone, IV albumin + furosemide combination",
  ], { y:4.68, h:0.8, fs:12 });
  sl.addText("Source: Nelson's 21E; Costanzo Physiology 7E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 40 — ALBUMIN INFUSION
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Management — Intravenous Albumin");
  sl.addText("IV albumin is NOT given routinely — reserve for selected indications only", {
    x:0.35, y:0.88, w:9.3, h:0.4, fontSize:13, color:NAVY, bold:true, italic:true, fontFace:"Calibri",
  });
  twoCol(sl, [
    { t:"Indications for IV Albumin", bold:true, fs:15 },
    "Serum albumin <1.5 g/dL (severe hypoalbuminaemia)",
    "Clinical evidence of hypovolaemia:",
    "   • Tachycardia + cold extremities",
    "   • Oliguria unresponsive to fluid",
    "   • Symptomatic hypotension",
    "Severe scrotal/labial oedema with skin breakdown",
    "Peritonitis risk (ascitic tension)",
    "",
    { t:"Protocol", bold:true, fs:15 },
    "20% Human Albumin Solution (HAS)",
    "Dose: 0.5–1 g/kg over 2–4 hours",
    "Followed immediately by IV furosemide 1–2 mg/kg",
    "(Furosemide given after albumin — once oncotic pressure restored)",
    "Repeat once daily if needed; reassess after 24 hrs",
  ],[
    { t:"Mechanism of Action", bold:true, fs:15 },
    "↑ Plasma oncotic pressure → Pulls interstitial fluid back into vasculature",
    "Restored intravascular volume → Improved renal perfusion",
    "Furosemide now reaches tubular lumen effectively (less protein binding)",
    "",
    { t:"Contraindications / Cautions", bold:true, fs:15, c:RED },
    "Overfill physiology (normal/high BP, no hypovolaemia signs)",
    "Pulmonary oedema risk if given without furosemide",
    "Allergy to albumin (rare)",
    "Monitor: BP, RR, SpO₂ during infusion",
    "",
    { t:"Monitoring", bold:true, fs:15 },
    "Urine output, daily weight, BP, serum albumin",
    "Electrolytes (Na, K) daily while on IV therapy",
  ], { y:1.35, fs:13 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 41 — NEPHROTIC SYNDROME TREATMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Management — Nephrotic Syndrome (Steroid Protocol)");
  sl.addText("First-line: Prednisolone (KDIGO 2024 / ISPN guidelines)", {
    x:0.35, y:0.88, w:9.3, h:0.32, fontSize:13, bold:true, color:NAVY, fontFace:"Calibri",
  });
  table(sl,
    ["Phase","Dose","Duration","Route"],
    [
      ["Initial (induction)","Prednisolone 2 mg/kg/day (max 60 mg/day) — daily","4 weeks","Oral"],
      ["Maintenance (tapering)","Prednisolone 1.5 mg/kg/alternate day (max 40 mg)","4 weeks then taper","Oral"],
      ["Total initial course","Minimum 12 weeks (newer evidence supports extended course to reduce relapse)","—","—"],
    ],
    0.35, 1.22, 9.3, {rh:0.52}
  );
  sl.addText("Response to Steroids", { x:0.35, y:2.82, w:9.3, h:0.32, fontSize:13, bold:true, color:NAVY, fontFace:"Calibri" });
  table(sl,
    ["Term","Definition"],
    [
      ["Remission","Urine protein nil/trace for 3 consecutive days"],
      ["Relapse","Protein ≥3+ for 3 consecutive days after remission"],
      ["Steroid sensitive","Complete remission within 4 weeks of prednisolone"],
      ["Steroid dependent","Relapse during or within 14 days of stopping steroids"],
      ["Frequent relapse","≥2 relapses within 6 months of initial response"],
      ["Steroid resistant","No remission after 8 weeks of full-dose prednisolone"],
    ],
    0.35, 3.15, 9.3, {rh:0.38}
  );
  sl.addText("Source: KDIGO Clinical Practice Guideline — Nephrotic Syndrome in Children 2024", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 42 — STEROID-RESISTANT / IMMUNOSUPPRESSIVE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Management — Steroid-Sparing & Immunosuppressive Agents");
  table(sl,
    ["Agent","Indication","Paediatric Dose","Key Side Effects"],
    [
      ["Cyclophosphamide","Frequent relapsing / steroid-dependent NS","2–2.5 mg/kg/day × 8–12 weeks","Haemorrhagic cystitis, gonadotoxicity, immunosuppression"],
      ["Mycophenolate mofetil (MMF)","Steroid-dependent / resistant","600 mg/m²/day in 2 doses","GI upset, teratogenic, neutropenia"],
      ["Calcineurin inhibitors:\nCyclosporine / Tacrolimus","Steroid-resistant; FSGS","Cyclosporine: 4–5 mg/kg/day\nTacrolimus: 0.1–0.15 mg/kg/day","Nephrotoxicity (monitor trough levels), hypertension, hirsutism"],
      ["Rituximab (anti-CD20)","Refractory steroid-dependent NS","375 mg/m² IV × 1–4 doses","Infusion reactions, immunosuppression, PML (rare)"],
      ["Levamisole","Frequently relapsing NS (low-resource settings)","2.5 mg/kg alternate day","Agranulcytosis, vasculitis — monitor CBC"],
    ],
    0.35, 0.95, 9.3, {rh:0.72}
  );
  bullets(sl, [
    { t:"Before any immunosuppressant: vaccinate (varicella, pneumococcus, influenza), screen for TB and viral hepatitis", bold:true, fs:12 },
    "Monitor blood counts, renal function, drug levels at defined intervals",
  ], { y:4.82, h:0.65, fs:12 });
  sl.addText("Source: KDIGO 2024; Nelson's 21E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 43 — CCF MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Management — Cardiac Oedema (CCF in Children)");
  twoCol(sl, [
    { t:"Immediate Stabilisation", bold:true, fs:15 },
    "Upright positioning (reduces preload)",
    "O₂ supplementation if SpO₂ <94%",
    "IV furosemide: 1–2 mg/kg stat — rapid diuresis",
    "Monitor ECG, urine output, electrolytes",
    "",
    { t:"Fluid Management", bold:true, fs:15 },
    "Fluid restriction: 70–80% of maintenance",
    "Daily weight monitoring",
    "Restrict Na⁺ intake",
    "",
    { t:"Digoxin (selected cases)", bold:true, fs:15 },
    "Improves cardiac contractility — SVT, dilated CM",
    "Therapeutic range: 0.8–2.0 ng/mL",
    "Monitor: ECG, K⁺, renal function",
  ],[
    { t:"ACE Inhibitors / ARBs", bold:true, fs:15 },
    "Enalapril: 0.1 mg/kg/day, max 0.5 mg/kg/day",
    "Reduces afterload + RAAS activation",
    "Caution: ↑ Creatinine, hyperkalaemia, cough",
    "",
    { t:"Beta-Blockers (chronic CCF)", bold:true, fs:15 },
    "Carvedilol / Metoprolol — improves remodelling",
    "Start low, go slow; avoid in acute decompensation",
    "",
    { t:"Treat Underlying Cause", bold:true, fs:15 },
    "Structural CHD → surgical/catheter intervention",
    "Myocarditis → IVIG, immunosuppression",
    "Arrhythmia → Antiarrhythmic + cardioversion",
    "Severe anaemia → Transfusion (slow, with diuretic)",
  ], { y:0.95, fs:13 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 44 — NUTRITIONAL EDEMA MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Management — Nutritional Oedema (Kwashiorkor)");
  sl.addText("WHO 10-Step Protocol for Severe Acute Malnutrition (SAM) with Oedema", {
    x:0.35, y:0.88, w:9.3, h:0.35, fontSize:13, bold:true, color:NAVY, fontFace:"Calibri",
  });
  table(sl,
    ["Phase","Step","Key Actions"],
    [
      ["Stabilisation","1. Hypoglycaemia","F-75 formula 100 mL/kg/day; glucose 10% if unconscious"],
      ["Stabilisation","2. Hypothermia","Warm environment, Kangaroo care, hat"],
      ["Stabilisation","3. Dehydration","Rehydrate with ReSoMal (low Na⁺) — 5 mL/kg every 30 min × 2 hr (NOT standard ORS)"],
      ["Stabilisation","4. Electrolytes","Potassium 3–4 mmol/kg/day, Magnesium 0.4–0.6 mmol/kg/day — NO diuretics initially"],
      ["Stabilisation","5. Infection","Ampicillin + Gentamicin empirically; add antimalarials in endemic areas"],
      ["Stabilisation","6. Micronutrients","Folic acid, zinc, copper, multivitamins — NO iron until weight gain phase"],
      ["Stabilisation","7. Initiate feeding","F-75 therapeutic milk — 100–135 kcal/kg/day; small frequent feeds"],
      ["Transition","8. Increase feeding","Transition to F-100 when edema resolving; appetite returns"],
      ["Rehabilitation","9. Catch-up growth","F-100 or RUTF — 150–220 kcal/kg/day; iron now introduced"],
      ["Follow-up","10. Sensory stimulation","Play therapy, emotional support, monitor at 1, 2, 4 weeks"],
    ],
    0.35, 1.25, 9.3, {rh:0.4}
  );
  sl.addText("Note: Diuretics are NOT used in kwashiorkor edema — treat nutritional deficit, edema resolves spontaneously", {
    x:0.35, y:5.3, w:9.3, h:0.25, align:"center", fontSize:11, bold:true, color:RED, fontFace:"Calibri",
  });
  sl.addText("Source: WHO 2013 Guideline — Updates on Management of Severe Acute Malnutrition", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 45 — SECTION 10 DIVIDER
// ══════════════════════════════════════════════════════════════════════════════
sectionSlide(10, "Special Situations & Red Flags", "Conditions requiring urgent recognition and targeted management");

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 46 — HEREDITARY ANGIOEDEMA + NEONATAL
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Special Situations — Hereditary Angioedema & Neonatal Edema");
  twoCol(sl, [
    { t:"Hereditary Angioedema (HAE)", bold:true, fs:15 },
    "C1-inhibitor (C1-INH) deficiency — Autosomal Dominant",
    "HAE Type I: ↓↓ C1-INH level (85%)",
    "HAE Type II: Normal level but dysfunctional C1-INH",
    "HAE Type III: Normal C1-INH, factor XII mutation (females)",
    "",
    { t:"Clinical features:", bold:true, fs:14 },
    "Recurrent non-pitting angioedema — face, extremities, genitalia",
    "Abdominal pain crises — bowel wall edema",
    "Laryngeal edema → life-threatening airway compromise",
    "NO urticaria (distinguishes from allergic angioedema)",
    "Labs: ↓ C4 (always low), ↓ C1-INH level",
    "",
    { t:"Treatment:", bold:true, fs:14 },
    "Acute: Icatibant (bradykinin receptor antagonist) or C1-INH concentrate",
    "Alternative: Fresh frozen plasma if above unavailable",
    "Prophylaxis: Tranexamic acid (children), attenuated androgens (adults)",
  ],[
    { t:"Neonatal Edema — Key Points", bold:true, fs:15 },
    "Hydrops fetalis: Skin edema + Ascites + Pleural effusion + Pericardial effusion",
    "",
    { t:"Immune hydrops:", bold:true, fs:14 },
    "Rh isoimmunisation (anti-D most common)",
    "Severe haemolytic anaemia → ↓ Oncotic pressure → Anasarca",
    "Rx: Intrauterine transfusion, exchange transfusion",
    "",
    { t:"Non-immune hydrops (NIHF — 90% of cases):", bold:true, fs:14 },
    "Cardiovascular (40%): Structural CHD, arrhythmia, cardiomyopathy",
    "Chromosomal (10–15%): Turner, Down, trisomy 18",
    "Haematological: Alpha-thal major, haemolytic anaemia",
    "Infectious: Parvovirus B19, CMV, toxoplasma, syphilis",
    "Metabolic: Lysosomal storage disorders",
    "Syndromic lymphedema: Turner (45,X), Noonan, Milroy",
  ], { y:0.95, fs:12.5 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 47 — UNDERFILL vs OVERFILL (CLINICAL GUIDE)
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Special Concept — Underfill vs Overfill in Nephrotic Syndrome", "This distinction determines whether IV albumin/diuretics are safe");
  sl.addShape(pres.ShapeType.rect, { x:0.35, y:0.85, w:9.3, h:0.45, fill:{color:LGRAY}, line:{color:TEAL,width:1.5} });
  sl.addText("⚠  Giving diuretics in an underfilled child → AKI.  Giving albumin in an overfilled child → Pulmonary oedema.", {
    x:0.4, y:0.85, w:9.2, h:0.45, align:"center", valign:"middle", fontSize:12, bold:true, color:NAVY, fontFace:"Calibri",
  });
  table(sl,
    ["Feature","Underfill (Classical)","Overfill (Overfilling)"],
    [
      ["Hypothesis","↓ Albumin → ↓ Oncotic pressure → Fluid leaves vessels","Primary renal Na⁺ retention → ↑ Blood volume"],
      ["Circulating volume","DECREASED","INCREASED / Normal"],
      ["RAAS status","Activated (compensatory)","Suppressed"],
      ["Blood pressure","Low / normal","ELEVATED"],
      ["Pulse","Tachycardia, cold peripheries","Normal"],
      ["Urine Na⁺ (spot)","LOW (<10 mEq/L)","Variable"],
      ["FENa","<1%","<1% (tubular defect)"],
      ["Haematocrit","HIGH (haemoconcentration)","Low / normal"],
      ["Serum renin/aldosterone","High","Low"],
      ["Management","IV albumin → then furosemide","Furosemide ± spironolactone alone"],
      ["Risk if mistreated","AKI, hypovolaemic shock","Pulmonary oedema, hypertensive crisis"],
    ],
    0.35, 1.35, 9.3, {rh:0.38}
  );
  sl.addText("Source: Bhatt GC et al. Front Pediatr. 2016;3:111 — Pathophysiology, Evaluation and Management of Edema in Childhood NS", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 48 — RED FLAGS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Red Flags — When to Act Urgently");
  table(sl,
    ["Red Flag Sign","Most Likely Emergency","Immediate Action"],
    [
      ["Stridor + facial / tongue angioedema","Laryngeal angioedema (HAE / anaphylaxis)","Adrenaline 0.01 mg/kg IM; Icatibant/C1-INH if HAE; secure airway"],
      ["Urticaria + angioedema + hypotension","Anaphylaxis","Adrenaline 0.01 mg/kg IM; IV fluids; steroids; antihistamine"],
      ["Oliguria + oedema + haematuria + ↑ BP","Nephritic syndrome / AKI","BP control; restrict fluids/K; nephrology referral"],
      ["Edema + severe respiratory distress","Pulmonary oedema / cardiac decompensation","Upright positioning; O₂; IV furosemide; echo"],
      ["Edema + abdominal distension + fever","Spontaneous bacterial peritonitis","Cultures; IV cefotaxime; albumin cover"],
      ["Scrotal edema + fever + tenderness","Fournier gangrene (rare) / severe cellulitis","Urgent surgical review; IV antibiotics"],
      ["Proptosis + periorbital edema + fever","Orbital cellulitis / cavernous sinus thrombosis","CT orbit; IV antibiotics; ophthalmology"],
      ["Edema + massive proteinuria + thrombosis","DVT / pulmonary embolism (NS hypercoagulability)","Doppler; heparin anticoagulation; critical care"],
    ],
    0.35, 0.95, 9.3, {rh:0.52}
  );
  sl.addText("Source: Nelson's 21E; Harrison's 22E", { x:0, y:5.42, w:10, h:0.12, align:"right", fontSize:8, color:DGRAY, fontFace:"Calibri" });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 49 — SUMMARY: KEY TAKEAWAYS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("Summary — Key Takeaways");
  bullets(sl, [
    { t:"1.  Always localise first — Localised vs Generalised edema is the primary decision point.", bold:true, fs:15 },
    "",
    { t:"2.  Check serum albumin early — hypoalbuminaemia shifts differential toward renal/hepatic/nutritional.", bold:true, fs:15 },
    "",
    { t:"3.  Most common cause in children = Nephrotic Syndrome (Minimal Change Disease in <6 years).", bold:true, fs:15 },
    "",
    { t:"4.  Distinguish Underfill vs Overfill in NS before giving diuretics — wrong decision → AKI or pulmonary oedema.", bold:true, fs:15 },
    "",
    { t:"5.  Mnemonic: RENAL CHOP — covers all major paediatric causes systematically.", bold:true, fs:15 },
    "",
    { t:"6.  Nephritic red flag: Haematuria + Hypertension + ↓C3 → Post-strep GN until proven otherwise.", bold:true, fs:15 },
    "",
    { t:"7.  Kwashiorkor: Do NOT give diuretics — treat the nutritional deficit with WHO F-75 → F-100 protocol.", bold:true, fs:15 },
    "",
    { t:"8.  HAE presenting as laryngeal edema is a medical emergency — Icatibant or C1-INH concentrate.", bold:true, fs:15 },
  ], { y:0.9, h:4.55, fs:14.5 });
}

// ══════════════════════════════════════════════════════════════════════════════
//  SLIDE 50 — REFERENCES
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = newSlide("References");
  const refs = [
    "1.  Kliegman RM, Stanton BF, St Geme JW et al. Nelson's Textbook of Pediatrics, 21st Edition. Elsevier, 2020.",
    "2.  Kumar V, Abbas AK, Aster JC. Robbins & Kumar Basic Pathology, 10th Edition. Elsevier, 2023.",
    "3.  Loscalzo J, Kasper DL, Fauci AS et al. Harrison's Principles of Internal Medicine, 22nd Edition. McGraw-Hill, 2025.",
    "4.  Costanzo LS. Physiology (Board Review Series), 7th Edition. Wolters Kluwer, 2022.",
    "5.  Johnson RJ, Floege J, Tonnessen TI. Comprehensive Clinical Nephrology, 7th Edition. Elsevier, 2023.",
    "6.  KDIGO Clinical Practice Guideline for Nephrotic Syndrome in Children. Public Review Draft, 2024.",
    "7.  Hisano S et al. Edema in Childhood. Pediatr Int. 1997;39(Suppl):S100–104.",
    "8.  Bhatt GC, Das RR. Pathophysiology, Evaluation, and Management of Edema in Childhood Nephrotic Syndrome. Front Pediatr. 2016;3:111. PMID: 26779481.",
    "9.  Gordillo R, Spitzer A. The Nephrotic Syndrome. Pediatrics in Review. 2009;30:94–105.",
    "10. WHO. Updates on the management of severe acute malnutrition in infants and children. Geneva: WHO, 2013.",
    "11. Koirala A et al. Etiology and management of edema: A review. Adv Kidney Dis Health. 2023;30(2):110. PMID: 37042037.",
  ];
  refs.forEach((ref, i) => {
    sl.addText(ref, { x:0.35, y:0.95 + i * 0.41, w:9.3, h:0.39, fontSize:10.5, color:BLACK, fontFace:"Calibri" });
    if (i < refs.length - 1) {
      sl.addShape(pres.ShapeType.rect, { x:0.35, y:0.95 + (i + 1) * 0.41 - 0.03, w:9.3, h:0.02, fill:{color:MGRAY} });
    }
  });
  sl.addShape(pres.ShapeType.rect, { x:0, y:5.45, w:10, h:0.18, fill:{color:NAVY} });
  sl.addText("Prepared for Undergraduate Medical Education  |  Department of Pediatrics", {
    x:0.3, y:5.45, w:9.4, h:0.18, align:"center", valign:"middle", fontSize:10, color:WHITE, fontFace:"Calibri",
  });
}

// ── SAVE ──────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/edema-ppt/Approach_to_Edema_50slides.pptx" })
  .then(() => console.log("SUCCESS: 50-slide PPT saved."))
  .catch((e) => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/edema-ppt && node build2.js 2>&1

Running Command

python3 -c " import zipfile with zipfile.ZipFile('/home/daytona/workspace/edema-ppt/Approach_to_Edema_50slides.pptx') as z: slides = [f for f in z.namelist() if f.startswith('ppt/slides/slide') and f.endswith('.xml')] print(f'Total slides: {len(slides)}') " && ls -lh /home/daytona/workspace/edema-ppt/Approach_to_Edema_50slides.pptx

Exactly 50 slides confirmed, 1.5MB. Here is your download:

Approach to Edema 50slides

Presentation · PPTX


Design changes from the previous version:

  • White background throughout - no color-filled slide backgrounds
  • One accent color per slide - single thin teal line under the header bar
  • Navy text + minimal gray - clean, clutter-free reading
  • Tables used wherever possible - data is structured, not scattered as bullets

Slide breakdown (50 slides across 11 sections):

SectionSlidesTopic
13–5Definition & Terminology
26–11Pathophysiology — Starling forces, all 5 mechanisms, RAAS
312–14Classification — Localised & Generalised
415–20Causes — Mnemonic RENAL CHOP, Neonatal, NS, Nephritic, Cardiac/Hepatic/Nutritional
521–24History — Onset, symptoms, drugs, family/nutrition
625–27Examination — Pitting grading, systemic findings table
728–32Investigations — Tier 1/2/3 + lab pattern recognition table
833–36Diagnostic flowcharts + textbook figure
937–44Management — Diuretics, albumin, NS steroids, CCF, Kwashiorkor (WHO)
1045–48Special situations — HAE, Neonatal, Underfill/Overfill, Red flags
1149–50Summary (8 key points) + References

Can you remove department of pediatrics wording from slides

Running Command

grep -n "Department of Pediatrics\|Pediatrics Department\|Department of Paediatrics" /home/daytona/workspace/edema-ppt/build2.js | head -30

Editing File

~/edema-ppt/build2.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/edema-ppt/build2.js'
Editing File

~/edema-ppt/build2.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/edema-ppt/build2.js'
Editing File

~/edema-ppt/build2.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/edema-ppt/build2.js'
Running Command

cd /home/daytona/workspace/edema-ppt && node build2.js 2>&1 && ls -lh Approach_to_Edema_50slides.pptx

Done. All three instances removed:
  • Slide footer (every slide) — changed to just "Approach to Edema"
  • Title slide — "Department of Pediatrics" text removed
  • Last slide (slide 50) — footer now reads "Prepared for Undergraduate Medical Education" only

Approach to Edema 50slides

Presentation · PPTX

Make a pdf file of the ppt with elaborate explanation so that I can study

Reading File

Is it over

Is it over

Is it over

Is it over

Error

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.