Adrenal cortical insufficiency

Reading File
Finding Sources
Finding Sources
Searching PubMed

"adrenal insufficiency" AND diagnosis AND treatment

Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Loading Image
Loading Image
I now have extensive, authoritative content from multiple major textbooks. Here is the comprehensive response:

Adrenal Cortical Insufficiency

Classification

Adrenal cortical insufficiency is the failure of the adrenal cortex to produce adequate steroid hormones. It is classified into three major patterns:
Classification of adrenal insufficiency
TypeMechanismACTH Level
Primary (Addison disease)Adrenal gland itself failsHigh (loss of negative feedback)
SecondaryPituitary ACTH deficiencyLow or inappropriately normal
TertiaryHypothalamic CRH deficiencyLow
Key threshold: Clinical adrenal insufficiency does not appear until at least 90% of the adrenal cortex has been destroyed. - Frameworks for Internal Medicine

1. Primary Adrenal Insufficiency (Addison Disease)

Etiology

Autoimmune adrenalitis is the dominant cause (80-90% of cases in high-income countries). Autoantibodies against steroidogenic enzymes (21-hydroxylase, 17-hydroxylase) are detectable in the vast majority. It may occur in isolation or as part of polyglandular autoimmune syndromes:
  • APS-1 (rare, autosomal recessive, AIRE gene mutation): adrenalitis + hypoparathyroidism + mucocutaneous candidiasis + ectodermal dystrophy
  • APS-2 (more prevalent, starts 4th decade): adrenalitis + autoimmune thyroiditis ± type 1 diabetes
  • APS-4: adrenalitis + other autoimmune phenomena (gastritis, vitiligo, alopecia) without thyroiditis or T1D
Other causes include:
  • Tuberculosis: hematogenous spread; was the dominant cause historically and remains common in developing countries (up to one-third of cases there). Recent infection shows bilateral adrenal enlargement on imaging; older infection shows calcification and atrophy.
  • Fungal infections: Histoplasma, Coccidioides, Cryptococcus, Blastomyces, Paracoccidioides
  • HIV/AIDS: up to one-fifth of hospitalized AIDS patients; due to opportunistic infections (CMV), malignancies (Kaposi sarcoma), or drugs (ketoconazole, rifampin)
  • Bilateral adrenal hemorrhage: due to the adrenal gland's unique vascular anatomy (3 arteries in, 1 vein out - a "vascular dam"). Associated with anticoagulation, DIC, septicemia (Waterhouse-Friderichsen syndrome), critical illness surges in ACTH, and blunt trauma (right gland most common, compressed between liver and spine)
  • Infiltrative: lymphoma, amyloidosis, sarcoidosis, hemochromatosis, metastatic carcinoma (lung and breast most common)
  • Other: bilateral adrenalectomy (requires lifelong glucocorticoid + mineralocorticoid replacement), drugs inhibiting cortisol synthesis (ketoconazole) or accelerating its metabolism (phenytoin), adrenoleukodystrophy (X-linked, ABCD1 mutation - impaired peroxisomal β-oxidation of very long-chain fatty acids), congenital adrenal hypoplasia

Waterhouse-Friderichsen Syndrome

A catastrophic acute form characterized by:
  • Overwhelming bacterial septicemia - classically Neisseria meningitidis, also Rickettsia rickettsii, S. pneumoniae, Group A Strep, S. aureus
  • Rapidly progressive hypotension and shock
  • Widespread purpuric rash (DIC)
  • Massive bilateral adrenal hemorrhage
Diffuse purpuric rash in Waterhouse-Friderichsen syndrome
Diffuse purpuric rash in a patient with Waterhouse-Friderichsen syndrome. (Robbins Pathology, Fig. 24.47)

2. Secondary and Tertiary Adrenal Insufficiency

Secondary (pituitary): Any pituitary disease - tumors, infarction (Sheehan syndrome), hemorrhage/apoplexy, autoimmune hypophysitis (including checkpoint inhibitor-induced), radiation, granulomas (sarcoid, TB), or - most commonly - chronic exogenous glucocorticoid use suppressing ACTH.
Tertiary (hypothalamic): Hypothalamic disease with deficient CRH production.
Key distinctions from primary disease:
  • No hyperpigmentation (ACTH is low, not high) - skin may appear pale/alabaster
  • No hyperkalemia (aldosterone secretion is relatively preserved, as it is primarily regulated by the renin-angiotensin system, not ACTH)
  • ACTH levels are low or inappropriately normal

3. Pathophysiology and Clinical Features

Glucocorticoid (Cortisol) Deficiency

  • Inability to maintain blood glucose between meals (impaired gluconeogenesis)
  • Reduced protein and fat mobilization - generalized weakness
  • Inability to mount adequate stress response - even mild illness can be fatal
  • Loss of negative feedback on hypothalamus/pituitary → marked rise in ACTH and MSH → hyperpigmentation (especially lips, nipples, pressure areas, sun-exposed skin)
  • Increased ADH release → hyponatremia (mimics SIADH)
  • Mildly elevated TSH (normalizes with glucocorticoid replacement)

Mineralocorticoid (Aldosterone) Deficiency (primary only)

  • Impaired Na+ reabsorption → sodium wasting, hyponatremia, volume depletion
  • Impaired K+/H+ secretion → hyperkalemia and mild metabolic acidosis
  • Plasma volume falls, hematocrit rises, cardiac output falls → shock; death in 4 days to 2 weeks without treatment

Classic Clinical Presentation (Addison Disease)

  • Fatigue, weakness, weight loss, anorexia
  • Nausea, vomiting, abdominal pain
  • Hypotension (orthostatic)
  • Hyperpigmentation (primary AI only) - skin creases, buccal mucosa, pressure points, areolae
  • Hyponatremia (88% at presentation), hyperkalemia (40-50% in primary AI, not seen in secondary)
  • Eosinophilia (17% of patients)
  • Hypoglycemia (rare in adults)
  • Salt craving

4. Diagnosis

Initial Workup

TestFinding in Primary AIFinding in Secondary AI
Serum cortisol (8 AM)LowLow
Plasma ACTHElevatedLow/inappropriately normal
Serum Na+Low (88%)Low (can occur)
Serum K+High (40-50%)Normal
Plasma renin activityElevatedNormal
Serum aldosteroneLowNormal
21-hydroxylase antibodiesOften positiveNegative
Morning cortisol:
  • 18-20 mcg/dL: effectively excludes adrenal insufficiency
  • <3 mcg/dL: confirms adrenal insufficiency
  • Intermediate values require stimulation testing

Gold Standard: Short Cosyntropin (ACTH 1-24) Stimulation Test

  • Give 250 mcg cosyntropin IV at any time of day
  • Measure cortisol at 0 and 60 minutes
  • Normal response: peak cortisol >18-20 mcg/dL (cutoff varies slightly by lab/assay)
  • In primary disease: cortisol response is blunted (destroyed cortex cannot respond)
  • In long-standing secondary disease: also blunted (atrophic cortex); may be normal in recent-onset secondary AI
  • Dexamethasone does not cross-react with cortisol assays and can be given before testing if crisis is suspected

Additional Workup

  • Autoimmune AI: screen for associated conditions - hypothyroidism, type 1 diabetes, B12 deficiency, premature ovarian failure
  • Secondary AI confirmed: MRI of pituitary; evaluate other pituitary hormones
  • Mineralocorticoid status: measure simultaneous plasma renin activity and serum aldosterone

5. Treatment

Adrenal Crisis (Emergency)

Do not delay treatment for confirmatory testing when crisis is suspected.
  1. Hydrocortisone 100 mg IV bolus, then 200 mg/24 h (as 50 mg IV q6h, or continuous infusion)
    • Alternative: Dexamethasone 4 mg IV (preferred when cosyntropin stimulation test is still needed, as it does not interfere with cortisol assays)
  2. IV fluid resuscitation - normal saline (often 1 L/h initially)
  3. Pressor support and glucose as needed
  4. Identify and treat the precipitating cause (infection, trauma, surgery, medication withdrawal)

Chronic Maintenance Therapy

Glucocorticoid replacement (both primary and secondary AI):
  • Hydrocortisone 15-25 mg/day in 2-3 divided doses
  • Largest dose in the morning (mimics diurnal cortisol pattern; typically 2/3 AM, 1/3 afternoon)
Mineralocorticoid replacement (primary AI only, after confirming aldosterone deficiency):
  • Fludrocortisone (9-α-fluorohydrocortisone) 50-200 mcg/day
  • Dose titrated to blood pressure, serum Na+/K+, and plasma renin activity
DHEA supplementation:
  • 50 mg/day may be considered in women with primary AI who have impaired well-being or decreased libido despite adequate glucocorticoid and mineralocorticoid replacement

Sick Day Rules (Stress Dosing)

  • Minor illness/fever: double the usual daily hydrocortisone dose
  • Major illness/surgery: hydrocortisone 100 mg IV (perioperative "stress dose")
  • Patients should carry injectable hydrocortisone for emergencies and wear a medical alert bracelet
  • Strenuous physical activity, pregnancy, and febrile illness all warrant dose increases

6. Secondary AI: Special Considerations

  • The most common cause worldwide is exogenous glucocorticoid use (>20 mg prednisone equivalent/day for >5 days can suppress the HPA axis)
  • Immune checkpoint inhibitors (cancer immunotherapy) can cause either primary AI (adrenalitis) or secondary AI (hypophysitis)
  • Steroid tapering is required after chronic glucocorticoid use - no universally recommended protocol exists
  • Radiation to the hypothalamic-pituitary region causes central AI in up to 50% of patients (median time to onset: 5 years)

Recent Evidence (2024-2026)

A 2026 systematic review and meta-analysis in Eur J Intern Med (PMID 41521083) examined adrenal insufficiency following systemic glucocorticoid therapy, reinforcing the clinical significance of HPA axis suppression from exogenous steroids. A 2025 expert opinion paper in Inflamm Bowel Dis (PMID 40587340) addressed glucocorticoid-induced AI specifically in IBD patients, highlighting the need for structured screening in that population.

Sources:
  • Robbins & Cotran Pathologic Basis of Disease (Table 24.9, pp. 1035-1037)
  • Frameworks for Internal Medicine (pp. 98-103)
  • Harrison's Principles of Internal Medicine, 22E (Ch. 398)
  • Guyton & Hall Textbook of Medical Physiology (pp. 956-957)
  • Rosen's Emergency Medicine (Box 117.11)
  • Symptom to Diagnosis: An Evidence-Based Guide, 4E
  • Sabiston Textbook of Surgery, 21E

Give me all contacts in power point slide

Asking for Preferences
Asking for Preferences
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/adrenal-insufficiency-pptx && ls /home/daytona/workspace/adrenal-insufficiency-pptx

Writing File

~/adrenal-insufficiency-pptx/create_pptx.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Adrenal Cortical Insufficiency";
pres.author = "Orris Medical";

// ─── COLOUR PALETTE ───────────────────────────────────────────────────────────
const COL = {
  darkBg:    "1A2A3A",   // deep navy  – title/chapter slides
  midBg:     "223344",   // slightly lighter navy
  accent:    "E8722A",   // amber-orange accent
  accentDim: "C25E18",
  white:     "FFFFFF",
  offWhite:  "F0F4F8",
  textDark:  "1A2A3A",
  textMid:   "2E4057",
  textLight: "5A7A99",
  highlight: "2DA8D8",   // teal-blue highlight
  lightCard: "EAF3FA",
  green:     "2E8B57",
  red:       "C0392B",
  orange:    "E8722A",
};

// ─── HELPER FUNCTIONS ─────────────────────────────────────────────────────────
function addHeader(slide, title, subtitle) {
  // dark header bar
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 0.85,
    fill: { color: COL.darkBg }, line: { color: COL.darkBg }
  });
  // accent strip
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0.85, w: 10, h: 0.06,
    fill: { color: COL.accent }, line: { color: COL.accent }
  });
  slide.addText(title, {
    x: 0.25, y: 0.05, w: 9.5, h: 0.72,
    fontSize: 22, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 0.25, y: 0.8, w: 9.5, h: 0.35,
      fontSize: 11, color: COL.accent, valign: "top", margin: 0
    });
  }
}

function addCard(slide, x, y, w, h, color) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x, y, w, h,
    fill: { color: color || COL.lightCard },
    line: { color: "D0E4F0", pt: 0.75 },
    shadow: { type: "outer", color: "000000", blur: 4, offset: 2, angle: 135, opacity: 0.08 }
  });
}

function sectionTitle(pres, title, subtitle) {
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color: COL.darkBg }, line: { color: COL.darkBg }
  });
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 2.4, w: 10, h: 0.08,
    fill: { color: COL.accent }, line: { color: COL.accent }
  });
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 2.48, w: 10, h: 0.04,
    fill: { color: COL.highlight }, line: { color: COL.highlight }
  });
  sl.addText(title, {
    x: 0.5, y: 1.3, w: 9, h: 1.0,
    fontSize: 36, bold: true, color: COL.white, align: "center", valign: "middle"
  });
  if (subtitle) {
    sl.addText(subtitle, {
      x: 0.5, y: 2.55, w: 9, h: 0.7,
      fontSize: 16, color: COL.highlight, align: "center", italic: true
    });
  }
  return sl;
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE SLIDE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color: COL.darkBg }, line: { color: COL.darkBg }
  });
  // decorative circles
  sl.addShape(pres.shapes.OVAL, {
    x: 7.5, y: -0.8, w: 3.5, h: 3.5,
    fill: { color: COL.accent, transparency: 85 }, line: { color: COL.accent, transparency: 70 }
  });
  sl.addShape(pres.shapes.OVAL, {
    x: 8.2, y: 3.2, w: 2.5, h: 2.5,
    fill: { color: COL.highlight, transparency: 88 }, line: { color: COL.highlight, transparency: 75 }
  });
  // accent bar
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0.5, y: 1.8, w: 0.08, h: 1.9,
    fill: { color: COL.accent }, line: { color: COL.accent }
  });
  sl.addText("Adrenal Cortical", {
    x: 0.8, y: 1.6, w: 7.5, h: 0.85,
    fontSize: 40, bold: true, color: COL.white, valign: "middle"
  });
  sl.addText("Insufficiency", {
    x: 0.8, y: 2.4, w: 7.5, h: 0.85,
    fontSize: 40, bold: true, color: COL.accent, valign: "middle"
  });
  sl.addText("Classification  ·  Etiology  ·  Pathophysiology  ·  Clinical Features  ·  Diagnosis  ·  Treatment", {
    x: 0.8, y: 3.35, w: 8.2, h: 0.45,
    fontSize: 11, color: COL.highlight, italic: true, valign: "middle"
  });
  sl.addText("Based on Robbins Pathology · Harrison's · Guyton & Hall · Frameworks for Internal Medicine", {
    x: 0.3, y: 5.15, w: 9.4, h: 0.35,
    fontSize: 8.5, color: COL.textLight, align: "center"
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 – OVERVIEW / DEFINITION
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Overview & Definition", "Adrenal Cortical Insufficiency");

  addCard(sl, 0.25, 1.05, 9.5, 1.0, COL.lightCard);
  sl.addText("Adrenal cortical insufficiency is the failure of the adrenal cortex to produce adequate steroid hormones — cortisol and/or aldosterone — despite physiologic demand. Clinical manifestations appear only when ≥90% of the adrenal cortex is destroyed.", {
    x: 0.4, y: 1.1, w: 9.2, h: 0.9,
    fontSize: 12.5, color: COL.textDark, valign: "middle"
  });

  // 3 type cards
  const types = [
    { label: "PRIMARY", sub: "Adrenal gland fails", acth: "↑ ACTH (loss of\nneg. feedback)", color: "C0392B", bg: "FDF0EF" },
    { label: "SECONDARY", sub: "Pituitary ACTH deficiency", acth: "↓ ACTH", color: "2E7D9B", bg: "EAF6FB" },
    { label: "TERTIARY", sub: "Hypothalamic CRH deficiency", acth: "↓ CRH → ↓ ACTH", color: "2E8B57", bg: "EDF7F2" },
  ];
  types.forEach((t, i) => {
    const x = 0.25 + i * 3.2;
    addCard(sl, x, 2.2, 3.0, 2.8, t.bg);
    sl.addShape(pres.shapes.RECTANGLE, {
      x, y: 2.2, w: 3.0, h: 0.4,
      fill: { color: t.color }, line: { color: t.color }
    });
    sl.addText(t.label, {
      x, y: 2.2, w: 3.0, h: 0.4,
      fontSize: 13, bold: true, color: COL.white, align: "center", valign: "middle", margin: 0
    });
    sl.addText(t.sub, {
      x: x + 0.1, y: 2.7, w: 2.8, h: 0.5,
      fontSize: 11, color: t.color, bold: true, align: "center"
    });
    sl.addText(t.acth, {
      x: x + 0.1, y: 3.25, w: 2.8, h: 0.6,
      fontSize: 11, color: COL.textDark, align: "center", italic: true
    });
  });

  sl.addText("Key threshold: Clinical insufficiency does not appear until ≥ 90% of adrenal cortex is destroyed  (Frameworks for Internal Medicine)", {
    x: 0.25, y: 5.15, w: 9.5, h: 0.35,
    fontSize: 8.5, color: COL.textLight, italic: true
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SECTION BREAK
// ══════════════════════════════════════════════════════════════════════════════
sectionTitle(pres, "1. Primary Adrenal Insufficiency", "Addison Disease — Etiology & Pathogenesis");

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 – PRIMARY AI: CAUSES (AUTOIMMUNE + INFECTIOUS)
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Primary AI – Etiology (1/2)", "Autoimmune & Infectious Causes");

  // Autoimmune column
  addCard(sl, 0.2, 1.05, 4.6, 4.3, "FDF5F0");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0.2, y: 1.05, w: 4.6, h: 0.38,
    fill: { color: COL.accent }, line: { color: COL.accent }
  });
  sl.addText("AUTOIMMUNE  (80–90% in high-income countries)", {
    x: 0.22, y: 1.05, w: 4.56, h: 0.38,
    fontSize: 10.5, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const autoItems = [
    "Autoantibodies against 21-hydroxylase & 17-hydroxylase",
    "Isolated autoimmune adrenalitis (40% of autoimmune cases)",
    "APS-1 (AIRE gene): adrenalitis + hypoparathyroidism + mucocutaneous candidiasis + ectodermal dystrophy",
    "APS-2: adrenalitis + autoimmune thyroiditis ± T1DM (4th decade)",
    "APS-4: adrenalitis + vitiligo/alopecia/pernicious anemia, no thyroiditis",
    "Immune checkpoint inhibitor–induced adrenalitis (cancer immunotherapy)",
  ];
  sl.addText(autoItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < autoItems.length - 1 } })), {
    x: 0.35, y: 1.5, w: 4.3, h: 3.75,
    fontSize: 10, color: COL.textDark, valign: "top"
  });

  // Infectious column
  addCard(sl, 5.1, 1.05, 4.65, 4.3, "F0F5F0");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 5.1, y: 1.05, w: 4.65, h: 0.38,
    fill: { color: COL.green }, line: { color: COL.green }
  });
  sl.addText("INFECTIOUS", {
    x: 5.12, y: 1.05, w: 4.61, h: 0.38,
    fontSize: 10.5, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const infItems = [
    "Tuberculosis: hematogenous spread; up to 1/3 of cases in developing world (~15% in industrialised). Early: bilateral adrenal enlargement. Late: calcification & atrophy",
    "Fungal: Histoplasma, Coccidioides, Cryptococcus, Blastomyces, Paracoccidioides",
    "HIV/AIDS: up to 1 in 5 hospitalised AIDS patients — CMV infiltration, Kaposi sarcoma, drug-induced (ketoconazole, rifampin)",
    "Other bacteria: rare direct adrenal infection",
  ];
  sl.addText(infItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < infItems.length - 1 } })), {
    x: 5.25, y: 1.5, w: 4.35, h: 3.75,
    fontSize: 10, color: COL.textDark, valign: "top"
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 – PRIMARY AI: CAUSES (HEMORRHAGIC + INFILTRATIVE + OTHER)
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Primary AI – Etiology (2/2)", "Hemorrhagic, Infiltrative & Other Causes");

  // Hemorrhagic
  addCard(sl, 0.2, 1.0, 3.0, 4.4, "F5EEF8");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0.2, y: 1.0, w: 3.0, h: 0.38,
    fill: { color: "7D3C98" }, line: { color: "7D3C98" }
  });
  sl.addText("HEMORRHAGIC", {
    x: 0.22, y: 1.0, w: 2.96, h: 0.38,
    fontSize: 10, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const hemItems = [
    "Unique vascular anatomy: 3 arteries in, 1 vein out → 'vascular dam'",
    "Waterhouse-Friderichsen syndrome: N. meningitidis sepsis (also Rickettsia, S. pneumo, Strep A, S. aureus)",
    "Anticoagulation therapy / DIC",
    "Adrenal vein thrombosis",
    "Critical illness (ACTH surges overwhelm drainage)",
    "Blunt trauma: right adrenal (between liver & spine)"
  ];
  sl.addText(hemItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < hemItems.length - 1 } })), {
    x: 0.32, y: 1.45, w: 2.76, h: 3.85,
    fontSize: 9.5, color: COL.textDark, valign: "top"
  });

  // Infiltrative
  addCard(sl, 3.45, 1.0, 3.0, 4.4, "FEF9E7");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 3.45, y: 1.0, w: 3.0, h: 0.38,
    fill: { color: "B7950B" }, line: { color: "B7950B" }
  });
  sl.addText("INFILTRATIVE", {
    x: 3.47, y: 1.0, w: 2.96, h: 0.38,
    fontSize: 10, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const infitItems = [
    "Metastatic carcinoma (lung & breast most common; also GI, melanoma, lymphoma)",
    "Sarcoidosis",
    "Amyloidosis",
    "Hemochromatosis",
    "Lymphoma (elevated LDH + lymphadenopathy)"
  ];
  sl.addText(infitItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < infitItems.length - 1 } })), {
    x: 3.57, y: 1.45, w: 2.76, h: 3.85,
    fontSize: 9.5, color: COL.textDark, valign: "top"
  });

  // Other
  addCard(sl, 6.7, 1.0, 3.05, 4.4, "EAF6FB");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 6.7, y: 1.0, w: 3.05, h: 0.38,
    fill: { color: COL.highlight }, line: { color: COL.highlight }
  });
  sl.addText("OTHER", {
    x: 6.72, y: 1.0, w: 3.01, h: 0.38,
    fontSize: 10, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const otherItems = [
    "Bilateral adrenalectomy: lifelong glucocorticoid + mineralocorticoid replacement needed",
    "Adrenoleukodystrophy (ALD): X-linked, ABCD1 gene — impaired peroxisomal β-oxidation of very long-chain fatty acids",
    "Congenital adrenal hypoplasia (X-linked NR0B1 gene)",
    "Drugs: ketoconazole (inhibits cortisol synthesis), phenytoin (accelerates cortisol metabolism)",
    "External beam radiation to adrenals (rare)"
  ];
  sl.addText(otherItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < otherItems.length - 1 } })), {
    x: 6.82, y: 1.45, w: 2.81, h: 3.85,
    fontSize: 9.5, color: COL.textDark, valign: "top"
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 – WATERHOUSE-FRIDERICHSEN SYNDROME
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Waterhouse-Friderichsen Syndrome", "Acute Bilateral Adrenal Hemorrhage in Sepsis");

  addCard(sl, 0.2, 1.0, 9.6, 0.65, "F9EBEA");
  sl.addText("A catastrophic form of acute primary adrenal insufficiency caused by massive bilateral adrenal hemorrhage in the setting of overwhelming septicaemia", {
    x: 0.35, y: 1.05, w: 9.3, h: 0.55,
    fontSize: 11.5, color: COL.red, bold: true, valign: "middle"
  });

  const features = [
    ["Causative organisms", "N. meningitidis (classic), Rickettsia rickettsii, S. pneumoniae, Group A Strep, S. aureus"],
    ["Haemodynamic", "Overwhelming septicaemia → rapidly progressive hypotension → shock"],
    ["Skin findings", "Widespread purpura (DIC) — diffuse ecchymotic rash over face and body"],
    ["Adrenal pathology", "Adrenal glands converted to sacs of clotted blood; haemorrhage starts in medulla (near venous sinusoids) and spreads into cortex"],
    ["Histology", "Islands of recognisable cortical cells remaining within extensive haemorrhagic necrosis"],
    ["Population at risk", "More common in children; also asplenic patients"],
    ["Time course", "Death within hours to a few days without prompt treatment"],
  ];
  features.forEach(([label, text], i) => {
    const y = 1.75 + i * 0.52;
    sl.addShape(pres.shapes.RECTANGLE, {
      x: 0.2, y, w: 2.2, h: 0.44,
      fill: { color: COL.red }, line: { color: COL.red }
    });
    sl.addText(label, {
      x: 0.22, y, w: 2.16, h: 0.44,
      fontSize: 9.5, bold: true, color: COL.white, valign: "middle", margin: 4
    });
    addCard(sl, 2.45, y, 7.3, 0.44, "FFFFFF");
    sl.addText(text, {
      x: 2.55, y, w: 7.1, h: 0.44,
      fontSize: 9.5, color: COL.textDark, valign: "middle", margin: 4
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SECTION BREAK
// ══════════════════════════════════════════════════════════════════════════════
sectionTitle(pres, "2. Secondary & Tertiary AI", "Central Adrenal Insufficiency");

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 – SECONDARY AI
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Secondary & Tertiary Adrenal Insufficiency", "Central Causes — Inadequate ACTH/CRH Stimulation");

  // Key distinction box
  addCard(sl, 0.2, 1.05, 9.6, 0.6, "EAF6FB");
  sl.addText([
    { text: "Key distinctions from primary AI: ", options: { bold: true, color: COL.highlight } },
    { text: "No hyperpigmentation (ACTH low → alabaster skin)  |  No hyperkalemia (aldosterone preserved)  |  ACTH low or inappropriately normal", options: { color: COL.textDark } }
  ], { x: 0.35, y: 1.08, w: 9.3, h: 0.54, fontSize: 11, valign: "middle" });

  // Causes columns
  addCard(sl, 0.2, 1.78, 4.6, 3.6, "F0F5FA");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0.2, y: 1.78, w: 4.6, h: 0.38,
    fill: { color: "2E7D9B" }, line: { color: "2E7D9B" }
  });
  sl.addText("PITUITARY / SECONDARY", {
    x: 0.22, y: 1.78, w: 4.56, h: 0.38,
    fontSize: 10.5, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const pitItems = [
    "Pituitary tumours (adenomas, carcinoma)",
    "Pituitary apoplexy / Sheehan's syndrome",
    "Autoimmune hypophysitis (often associated with pregnancy; also checkpoint inhibitor–induced)",
    "Pituitary infiltration: TB, sarcoidosis, histiocytosis X",
    "Pituitary irradiation",
    "Metastases to pituitary",
    "Congenital isolated ACTH deficiency (TBX19/Tpit mutation)",
    "Combined pituitary hormone deficiency (PROP-1 mutation)",
  ];
  sl.addText(pitItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < pitItems.length - 1 } })), {
    x: 0.35, y: 2.22, w: 4.3, h: 3.1,
    fontSize: 9.5, color: COL.textDark, valign: "top"
  });

  addCard(sl, 5.1, 1.78, 4.65, 3.6, "FEF9E7");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 5.1, y: 1.78, w: 4.65, h: 0.38,
    fill: { color: "B7950B" }, line: { color: "B7950B" }
  });
  sl.addText("DRUG-INDUCED / TERTIARY", {
    x: 5.12, y: 1.78, w: 4.61, h: 0.38,
    fontSize: 10.5, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const drugItems = [
    "Chronic exogenous glucocorticoids (most common cause worldwide) — >20 mg prednisone equiv./day for >5 days suppresses HPA axis",
    "Immune checkpoint inhibitors: anti-CTLA-4, anti-PD-1/PD-L1 → hypophysitis or adrenalitis",
    "Opioids",
    "Interferon-alpha / ribavirin",
    "Megestrol acetate",
    "Radiation to hypothalamic-pituitary region: central AI in up to 50%; median onset 5 years",
    "Head trauma",
    "Hypothalamic disease (sarcoidosis, histiocytosis, germinoma)",
  ];
  sl.addText(drugItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < drugItems.length - 1 } })), {
    x: 5.25, y: 2.22, w: 4.35, h: 3.1,
    fontSize: 9.5, color: COL.textDark, valign: "top"
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SECTION BREAK
// ══════════════════════════════════════════════════════════════════════════════
sectionTitle(pres, "3. Pathophysiology & Clinical Features", "Glucocorticoid and Mineralocorticoid Deficiency");

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 – PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Pathophysiology", "Effects of Cortisol & Aldosterone Deficiency");

  // Cortisol deficiency
  addCard(sl, 0.2, 1.05, 4.65, 4.35, "FEF9E7");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0.2, y: 1.05, w: 4.65, h: 0.38,
    fill: { color: COL.accent }, line: { color: COL.accent }
  });
  sl.addText("CORTISOL DEFICIENCY", {
    x: 0.22, y: 1.05, w: 4.61, h: 0.38,
    fontSize: 11, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const cortItems = [
    "↓ Gluconeogenesis → hypoglycaemia (esp. fasting)",
    "↓ Protein & fat mobilisation → weakness, fatigue",
    "Loss of stress-response capacity → minor illness can be fatal",
    "↓ Cortisol → ↓ negative feedback → ↑↑ ACTH + ↑ MSH → hyperpigmentation (skin creases, mucosa, nipples, pressure areas)",
    "↓ Cortisol → ↑ ADH release → hyponatraemia (similar to SIADH picture)",
    "Mildly ↑ TSH (normalises with glucocorticoid replacement)",
    "Salt craving (secondary to volume depletion)"
  ];
  sl.addText(cortItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < cortItems.length - 1 } })), {
    x: 0.35, y: 1.5, w: 4.35, h: 3.8,
    fontSize: 10, color: COL.textDark, valign: "top"
  });

  // Aldosterone deficiency
  addCard(sl, 5.1, 1.05, 4.65, 4.35, "F0F5FA");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 5.1, y: 1.05, w: 4.65, h: 0.38,
    fill: { color: COL.highlight }, line: { color: COL.highlight }
  });
  sl.addText("ALDOSTERONE DEFICIENCY (primary AI only)", {
    x: 5.12, y: 1.05, w: 4.61, h: 0.38,
    fontSize: 11, bold: true, color: COL.white, valign: "middle", margin: 0
  });
  const aldItems = [
    "↓ Na+ reabsorption → sodium wasting, hypovolaemia, hyponatraemia",
    "↓ K+/H+ secretion → hyperkalaemia + mild metabolic acidosis",
    "↓ Plasma volume → ↑ haematocrit → ↓ CO → hypotension → shock",
    "Death in 4 days–2 weeks (untreated) after complete cessation of mineralocorticoid secretion",
    "Note: Aldosterone deficiency absent in secondary/tertiary AI (mineralocorticoid axis regulated by renin-angiotensin system, not ACTH)"
  ];
  sl.addText(aldItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < aldItems.length - 1 } })), {
    x: 5.25, y: 1.5, w: 4.35, h: 3.8,
    fontSize: 10, color: COL.textDark, valign: "top"
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 – CLINICAL FEATURES
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Clinical Features", "Addison Disease — Signs & Symptoms");

  const features = [
    { icon: "⚡", cat: "Constitutional", items: ["Fatigue, weakness (most common)", "Weight loss, anorexia", "Nausea, vomiting, abdominal pain"], col: "FDF5F0" },
    { icon: "💉", cat: "Cardiovascular", items: ["Hypotension (especially orthostatic)", "Salt craving", "Decreased cardiac output in crisis"], col: "F0F5FA" },
    { icon: "🎨", cat: "Skin (Primary AI only)", items: ["Hyperpigmentation (ACTH-driven)", "Skin creases, buccal mucosa, nipples", "Pressure points, sun-exposed areas", "Secondary AI: alabaster/pale skin"], col: "FEF9E7" },
    { icon: "🔬", cat: "Electrolytes", items: ["Hyponatraemia: 88% of patients", "Hyperkalaemia: 40–50% (primary AI)", "Mild metabolic acidosis", "Hypercalcaemia (rare)"], col: "F0F5EF" },
    { icon: "🩸", cat: "Haematological", items: ["Eosinophilia (17%)", "Elevated haematocrit (haemoconcentration)", "Anaemia possible"], col: "F9EBEA" },
    { icon: "🧪", cat: "Other Labs", items: ["Hypoglycaemia (rare in adults)", "Mildly elevated TSH (normalises)", "Urine Na ↑ (SIADH-like pattern)"], col: "F5EEF8" },
  ];

  features.forEach((f, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.2 + col * 3.25;
    const y = 1.05 + row * 2.2;
    addCard(sl, x, y, 3.05, 2.05, f.col);
    sl.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 3.05, h: 0.38,
      fill: { color: COL.darkBg }, line: { color: COL.darkBg }
    });
    sl.addText(`${f.cat}`, {
      x: x + 0.05, y, w: 2.95, h: 0.38,
      fontSize: 10, bold: true, color: COL.white, valign: "middle", margin: 4
    });
    sl.addText(f.items.map((t, ii) => ({ text: t, options: { bullet: true, breakLine: ii < f.items.length - 1 } })), {
      x: x + 0.1, y: y + 0.42, w: 2.85, h: 1.55,
      fontSize: 9.5, color: COL.textDark, valign: "top"
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SECTION BREAK
// ══════════════════════════════════════════════════════════════════════════════
sectionTitle(pres, "4. Diagnosis", "Laboratory & Dynamic Testing");

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 – DIAGNOSIS
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Diagnosis", "Laboratory Tests & Cosyntropin Stimulation");

  // Comparison table header
  const cols = [2.5, 3.5, 3.5];
  const colX = [0.2, 2.75, 6.3];
  const headers = ["TEST", "PRIMARY AI", "SECONDARY/TERTIARY AI"];
  const hColors = [COL.darkBg, COL.red, "2E7D9B"];

  headers.forEach((h, i) => {
    sl.addShape(pres.shapes.RECTANGLE, {
      x: colX[i], y: 1.05, w: cols[i] - 0.05, h: 0.38,
      fill: { color: hColors[i] }, line: { color: hColors[i] }
    });
    sl.addText(h, {
      x: colX[i], y: 1.05, w: cols[i] - 0.05, h: 0.38,
      fontSize: 10, bold: true, color: COL.white, align: "center", valign: "middle", margin: 0
    });
  });

  const rows = [
    ["Serum cortisol (8 AM)", "Low", "Low"],
    ["Plasma ACTH", "↑↑ ELEVATED", "↓ Low / inappropriately normal"],
    ["Serum Na+", "Low (88%)", "Low (can occur — SIADH-like)"],
    ["Serum K+", "High (40–50%)", "Normal"],
    ["Plasma renin activity", "Elevated", "Normal"],
    ["Serum aldosterone", "Low", "Normal"],
    ["21-OH antibodies", "Often positive", "Negative"],
    ["Skin color", "Hyperpigmentation", "Alabaster / pale"],
  ];

  rows.forEach((row, ri) => {
    const bg = ri % 2 === 0 ? "FFFFFF" : "F5F9FC";
    row.forEach((cell, ci) => {
      addCard(sl, colX[ci], 1.48 + ri * 0.44, cols[ci] - 0.05, 0.41, bg);
      const isHighlight = (ci === 1 && cell.includes("↑")) || (ci === 2 && cell.includes("↓"));
      sl.addText(cell, {
        x: colX[ci] + 0.05, y: 1.48 + ri * 0.44, w: cols[ci] - 0.15, h: 0.41,
        fontSize: 9.5,
        color: isHighlight ? COL.red : ci === 0 ? COL.textDark : COL.textMid,
        bold: isHighlight,
        valign: "middle", margin: 4
      });
    });
  });

  // Cosyntropin test note
  addCard(sl, 0.2, 5.08, 9.55, 0.42, "EAF6FB");
  sl.addText([
    { text: "Gold Standard: ", options: { bold: true, color: COL.highlight } },
    { text: "Short cosyntropin (ACTH 1-24) stimulation test — 250 µg IV, measure cortisol at 0 & 60 min. Normal response: peak cortisol >18–20 µg/dL. Blunted in primary AI (cortex destroyed); also blunted in long-standing secondary AI. Dexamethasone does not interfere with the cortisol assay.", options: { color: COL.textDark } }
  ], { x: 0.32, y: 5.1, w: 9.3, h: 0.38, fontSize: 9, valign: "middle" });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 – DIAGNOSIS ALGORITHM
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Diagnostic Algorithm & Additional Workup", "Stepwise Approach to Adrenal Insufficiency");

  // Cortisol thresholds
  addCard(sl, 0.2, 1.05, 9.55, 0.85, "F0F5FA");
  sl.addText("Morning serum cortisol thresholds:", {
    x: 0.35, y: 1.08, w: 3.0, h: 0.35,
    fontSize: 10.5, bold: true, color: COL.textDark
  });
  const thresh = [
    { label: "> 18–20 µg/dL", note: "AI effectively excluded", color: COL.green },
    { label: "3–18 µg/dL", note: "Indeterminate → proceed to cosyntropin stimulation test", color: COL.accent },
    { label: "< 3 µg/dL", note: "Confirms adrenal insufficiency", color: COL.red },
  ];
  thresh.forEach((t, i) => {
    sl.addShape(pres.shapes.RECTANGLE, {
      x: 0.25 + i * 3.2, y: 1.5, w: 3.0, h: 0.33,
      fill: { color: t.color }, line: { color: t.color }
    });
    sl.addText(`${t.label}  —  ${t.note}`, {
      x: 0.28 + i * 3.2, y: 1.5, w: 2.94, h: 0.33,
      fontSize: 9, color: COL.white, bold: true, valign: "middle", margin: 3
    });
  });

  // Workup sections
  const sections = [
    {
      title: "If PRIMARY AI confirmed:",
      color: COL.red,
      items: [
        "Check 21-hydroxylase antibodies (autoimmune screen)",
        "CT/MRI adrenals: enlargement (TB/fungal/metastases), calcification (old TB), bilateral haemorrhage",
        "Screen for associated autoimmune conditions: thyroid function, fasting glucose (T1DM), B12, FSH (premature ovarian failure)",
        "Plasma renin activity + serum aldosterone (to confirm mineralocorticoid deficiency)"
      ]
    },
    {
      title: "If SECONDARY/TERTIARY AI confirmed:",
      color: "2E7D9B",
      items: [
        "MRI pituitary/hypothalamus: tumours, apoplexy, infiltration, empty sella",
        "Evaluate other pituitary axes: TSH/FT4, LH/FSH, GH/IGF-1, prolactin",
        "Review medications: glucocorticoids, opioids, checkpoint inhibitors",
        "Insulin tolerance test (ITT) if pituitary MRI inconclusive (gold standard for GH + ACTH reserve)"
      ]
    }
  ];

  sections.forEach((sec, i) => {
    const y = 1.95;
    const x = 0.2 + i * 4.9;
    addCard(sl, x, y, 4.65, 3.4, "FFFFFF");
    sl.addShape(pres.shapes.RECTANGLE, {
      x, y, w: 4.65, h: 0.38,
      fill: { color: sec.color }, line: { color: sec.color }
    });
    sl.addText(sec.title, {
      x: x + 0.05, y, w: 4.55, h: 0.38,
      fontSize: 10, bold: true, color: COL.white, valign: "middle", margin: 3
    });
    sl.addText(sec.items.map((t, ii) => ({ text: t, options: { bullet: true, breakLine: ii < sec.items.length - 1 } })), {
      x: x + 0.12, y: y + 0.43, w: 4.4, h: 2.9,
      fontSize: 10, color: COL.textDark, valign: "top"
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SECTION BREAK
// ══════════════════════════════════════════════════════════════════════════════
sectionTitle(pres, "5. Treatment", "Replacement Therapy & Crisis Management");

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 11 – ADRENAL CRISIS MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Adrenal Crisis — Emergency Management", "Do NOT wait for confirmatory tests if crisis is suspected");

  addCard(sl, 0.2, 1.05, 9.55, 0.52, "F9EBEA");
  sl.addText("⚠  Treat IMMEDIATELY — do not delay for laboratory confirmation. Obtain blood for cortisol before treatment if possible without delaying care.", {
    x: 0.32, y: 1.08, w: 9.3, h: 0.46,
    fontSize: 11, bold: true, color: COL.red, valign: "middle"
  });

  const steps = [
    { step: "STEP 1", label: "Glucocorticoid", color: COL.red, detail: "Hydrocortisone 100 mg IV bolus immediately\nThen 200 mg/24 h — either 50 mg IV q6h or continuous infusion (critically ill)\nAlternative: Dexamethasone 4 mg IV (preferred if cosyntropin stimulation test still needed — does not cross-react with cortisol assay)" },
    { step: "STEP 2", label: "IV Fluid Resuscitation", color: "2E7D9B", detail: "Normal saline — often 1 L/h initially\nCorrects hypovolaemia, hypotension, and hyponatraemia\nMonitor electrolytes and urine output closely" },
    { step: "STEP 3", label: "Glucose & Electrolytes", color: COL.green, detail: "Administer IV dextrose if hypoglycaemia present\nMonitor serum Na+, K+, glucose closely\nHyperkalemia typically resolves with hydrocortisone + fluids" },
    { step: "STEP 4", label: "Identify & Treat Precipitant", color: "7D3C98", detail: "Infection (most common precipitant — blood cultures, CXR, urinalysis, broad-spectrum antibiotics as appropriate)\nTrauma, surgery, medication withdrawal\nMI, GI bleed, or any physiological stress" },
  ];

  steps.forEach((s, i) => {
    const y = 1.65 + i * 0.9;
    sl.addShape(pres.shapes.RECTANGLE, {
      x: 0.2, y, w: 1.4, h: 0.8,
      fill: { color: s.color }, line: { color: s.color }
    });
    sl.addText([
      { text: s.step + "\n", options: { bold: true, fontSize: 10, breakLine: true } },
      { text: s.label, options: { fontSize: 8.5 } }
    ], { x: 0.22, y, w: 1.36, h: 0.8, color: COL.white, align: "center", valign: "middle", margin: 2 });
    addCard(sl, 1.65, y, 8.1, 0.8, "FFFFFF");
    sl.addText(s.detail, {
      x: 1.75, y: y + 0.04, w: 7.9, h: 0.72,
      fontSize: 9.5, color: COL.textDark, valign: "middle", margin: 4
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 12 – CHRONIC MAINTENANCE THERAPY
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Chronic Maintenance Therapy", "Long-Term Hormone Replacement");

  // Three replacement cards
  const cards = [
    {
      title: "GLUCOCORTICOID\n(All types of AI)",
      color: COL.accent,
      items: [
        "Hydrocortisone 15–25 mg/day in 2–3 divided doses",
        "Largest dose in the morning (mimics diurnal rhythm)",
        "Typical split: 2/3 in AM, 1/3 in late afternoon",
        "Alternative: prednisolone 3–5 mg/day",
        "Goal: replace normal physiologic cortisol output"
      ]
    },
    {
      title: "MINERALOCORTICOID\n(Primary AI only)",
      color: COL.highlight,
      items: [
        "First confirm deficiency: elevated plasma renin activity + low/normal aldosterone",
        "Fludrocortisone (9-α-fluorohydrocortisone) 50–200 µg/day",
        "Monitor: blood pressure, serum Na+/K+, plasma renin activity",
        "Prevents Na+ wasting, volume depletion, hyperkalaemia"
      ]
    },
    {
      title: "DHEA\n(Selected women, Primary AI)",
      color: COL.green,
      items: [
        "50 mg/day orally",
        "Consider in women with primary AI who have impaired well-being or decreased libido despite adequate glucocorticoid + mineralocorticoid replacement",
        "Not routinely recommended for all patients"
      ]
    }
  ];

  cards.forEach((c, i) => {
    const x = 0.2 + i * 3.25;
    addCard(sl, x, 1.05, 3.1, 3.3, "FAFAFA");
    sl.addShape(pres.shapes.RECTANGLE, {
      x, y: 1.05, w: 3.1, h: 0.55,
      fill: { color: c.color }, line: { color: c.color }
    });
    sl.addText(c.title, {
      x: x + 0.05, y: 1.05, w: 3.0, h: 0.55,
      fontSize: 9.5, bold: true, color: COL.white, align: "center", valign: "middle"
    });
    sl.addText(c.items.map((t, ii) => ({ text: t, options: { bullet: true, breakLine: ii < c.items.length - 1 } })), {
      x: x + 0.12, y: 1.65, w: 2.86, h: 2.65,
      fontSize: 9.5, color: COL.textDark, valign: "top"
    });
  });

  // Sick-day rules
  addCard(sl, 0.2, 4.45, 9.55, 1.0, "FDF5F0");
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0.2, y: 4.45, w: 2.0, h: 1.0,
    fill: { color: COL.accent }, line: { color: COL.accent }
  });
  sl.addText("SICK DAY\nRULES", {
    x: 0.22, y: 4.45, w: 1.96, h: 1.0,
    fontSize: 10, bold: true, color: COL.white, align: "center", valign: "middle"
  });
  const sickDayItems = [
    "Minor illness / fever: double daily hydrocortisone dose",
    "Major illness / surgery: hydrocortisone 100 mg IV (stress dose)",
    "Vomiting / unable to take oral medication: inject hydrocortisone (patients should carry injectable kit)",
    "Strenuous exercise, pregnancy: increase dose accordingly",
    "Patients must wear a medical alert bracelet"
  ];
  sl.addText(sickDayItems.map((t, i) => ({ text: t, options: { bullet: true, breakLine: i < sickDayItems.length - 1 } })), {
    x: 2.3, y: 4.5, w: 7.3, h: 0.9,
    fontSize: 9.5, color: COL.textDark, valign: "middle"
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SECTION BREAK
// ══════════════════════════════════════════════════════════════════════════════
sectionTitle(pres, "6. Primary vs Secondary AI", "Key Differentiating Features at a Glance");

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 13 – COMPARISON TABLE
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.background = { color: COL.offWhite };
  addHeader(sl, "Primary vs Secondary AI — Summary Comparison", "Clinical, Biochemical, and Management Differences");

  const rowHeaders = ["Cause", "ACTH level", "Cortisol", "Aldosterone", "Skin", "Hyperkalaemia", "Hyponatraemia", "Main treatment"];
  const primaryData = [
    "Adrenal gland destruction",
    "↑↑ Markedly elevated",
    "Low",
    "Low (deficient)",
    "Hyperpigmentation (ACTH drives MSH)",
    "Yes (40–50%)",
    "Yes (88%)",
    "Hydrocortisone + Fludrocortisone"
  ];
  const secondaryData = [
    "Pituitary/hypothalamic disease, chronic steroid use",
    "↓ Low / inappropriately normal",
    "Low",
    "Normal (preserved)",
    "Alabaster / pale (no ACTH)",
    "No",
    "Yes (can occur via ADH mechanism)",
    "Hydrocortisone alone"
  ];

  const colX2 = [0.15, 3.2, 6.55];
  const colW2 = [3.0, 3.3, 3.3];
  const colHdrs = ["FEATURE", "PRIMARY AI", "SECONDARY AI"];
  const colColors = [COL.darkBg, COL.red, "2E7D9B"];

  colHdrs.forEach((h, i) => {
    sl.addShape(pres.shapes.RECTANGLE, {
      x: colX2[i], y: 1.05, w: colW2[i] - 0.05, h: 0.38,
      fill: { color: colColors[i] }, line: { color: colColors[i] }
    });
    sl.addText(h, {
      x: colX2[i], y: 1.05, w: colW2[i] - 0.05, h: 0.38,
      fontSize: 10, bold: true, color: COL.white, align: "center", valign: "middle", margin: 0
    });
  });

  rowHeaders.forEach((rh, ri) => {
    const y = 1.48 + ri * 0.5;
    const bg = ri % 2 === 0 ? "FFFFFF" : "F5F9FC";
    [rh, primaryData[ri], secondaryData[ri]].forEach((cell, ci) => {
      addCard(sl, colX2[ci], y, colW2[ci] - 0.05, 0.47, bg);
      sl.addText(cell, {
        x: colX2[ci] + 0.05, y, w: colW2[ci] - 0.15, h: 0.47,
        fontSize: 9.5, bold: ci === 0,
        color: ci === 0 ? COL.textDark : COL.textMid,
        valign: "middle", margin: 4
      });
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 14 – REFERENCES / SOURCES
// ══════════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 10, h: 5.625,
    fill: { color: COL.darkBg }, line: { color: COL.darkBg }
  });
  sl.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 1.1, w: 10, h: 0.06,
    fill: { color: COL.accent }, line: { color: COL.accent }
  });
  sl.addText("Sources & References", {
    x: 0.5, y: 0.2, w: 9, h: 0.8,
    fontSize: 28, bold: true, color: COL.white, align: "center"
  });

  const refs = [
    "Robbins & Cotran Pathologic Basis of Disease, 10th ed. — Table 24.9, Chapter 24 (Adrenal glands)",
    "Frameworks for Internal Medicine — Chapter 7 (Adrenal Insufficiency)",
    "Harrison's Principles of Internal Medicine, 22nd ed. (2025) — Chapter 398",
    "Guyton & Hall Textbook of Medical Physiology — Chapter 50 (Adrenocortical Hormones)",
    "Rosen's Emergency Medicine: Concepts & Clinical Practice — Chapter 117 (Hypoadrenalism)",
    "Symptom to Diagnosis: An Evidence-Based Guide, 4th ed.",
    "Sabiston Textbook of Surgery, 21st ed. — Chapter 75",
    "Bowley J et al. Adrenal insufficiency following systemic glucocorticoid therapy: a systematic review and meta-analysis. Eur J Intern Med. 2026 Apr. PMID 41521083",
    "Law CCY et al. Evaluation and management of glucocorticoid-induced adrenal insufficiency in IBD. Inflamm Bowel Dis. 2025. PMID 40587340"
  ];

  sl.addText(refs.map((r, i) => ({ text: r, options: { bullet: true, breakLine: i < refs.length - 1 } })), {
    x: 0.6, y: 1.25, w: 8.8, h: 4.1,
    fontSize: 10, color: COL.offWhite, valign: "top"
  });
}

// ── WRITE FILE ─────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/adrenal-insufficiency-pptx/Adrenal_Cortical_Insufficiency.pptx" })
  .then(() => console.log("✅ File written successfully"))
  .catch(err => { console.error("❌ Error:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/adrenal-insufficiency-pptx && node create_pptx.js

Running Command

ls -lh /home/daytona/workspace/adrenal-insufficiency-pptx/

Your PowerPoint is ready! Download it here:

Adrenal Cortical Insufficiency

Presentation · PPTX


What's inside (14 slides):

SlideContent
1Title slide — styled with navy/amber/teal palette
2Overview & Definition — 3 types (primary/secondary/tertiary) with key threshold
3Section break — Primary AI
4Etiology 1/2 — Autoimmune (APS-1, APS-2, APS-4) & Infectious (TB, fungal, HIV)
5Etiology 2/2 — Hemorrhagic, Infiltrative & Other (ALD, drugs, bilateral adrenalectomy)
6Waterhouse-Friderichsen Syndrome — organisms, DIC, adrenal haemorrhage
7Section break — Secondary & Tertiary AI
8Secondary AI — pituitary causes, drug-induced, checkpoint inhibitors
9Section break — Pathophysiology & Clinical Features
10Pathophysiology — cortisol vs aldosterone deficiency side-by-side
11Clinical Features — 6-card grid covering all symptoms and labs
12Diagnosis — comparison table (primary vs secondary) + cosyntropin test
13Diagnostic Algorithm — cortisol thresholds + workup by type
14Section break — Treatment
15Adrenal Crisis — 4-step emergency management protocol
16Chronic Therapy — glucocorticoid, mineralocorticoid, DHEA + sick-day rules
17Primary vs Secondary comparison — full summary table
18References — all source textbooks + 2025/2026 PubMed evidence
This is a shared conversation. Sign in to Orris to start your own chat.