create management protocol for all the types of shock

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
I now have comprehensive information from multiple authoritative textbooks. Let me compile this into a complete management protocol document.

Management Protocol for All Types of Shock

Based on: Mulholland & Greenfield's Surgery (7e), Barash Clinical Anesthesia (9e), Rosen's Emergency Medicine, Sabiston Textbook of Surgery, Tintinalli's Emergency Medicine

Overview: Classification of Shock

Shock is defined as inadequate tissue oxygen delivery relative to demand, resulting in cellular hypoxia and organ dysfunction. The Weil-Shubin classification (1971) divides shock into four categories:
TypeCardiac OutputSVRPAOPCVPSvO2
Hypovolemic
Cardiogenic (LV)N/↑
Cardiogenic (RV)N/↓
Obstructive (tamponade/PE)
Distributive (early)↑/N/↓NN/↑N/↑
Distributive (late)NN
SVR = systemic vascular resistance; PAOP = pulmonary artery occlusion pressure; CVP = central venous pressure; SvO2 = mixed venous O2 saturation

Universal Initial Assessment (All Shock Types)

Immediate actions (first 5-10 minutes):
  1. Airway - secure and protect; intubate if GCS <8 or unable to protect airway
  2. Breathing - supplemental O2; target SpO2 >94%; consider early mechanical ventilation
  3. Circulation - 2 large-bore IV lines; attach cardiac monitor; 12-lead ECG
  4. Rapid assessment - HR, BP (both arms), RR, SpO2, temp, capillary refill, mental status
  5. Point-of-care ultrasound (POCUS) - essential to differentiate shock type (cardiac function, IVC collapsibility, lung sliding, pericardial fluid)
Labs (all types):
  • CBC, BMP, LFTs, coagulation panel (PT/INR/aPTT)
  • Lactate (arterial or venous) - target clearance ≥10% per 2 hours
  • ABG, blood type and crossmatch
  • Blood cultures x2 (before antibiotics if infection suspected)
  • Troponin, BNP/NT-proBNP
Monitoring targets (endpoints of resuscitation):
  • MAP ≥65 mmHg (≥80 in neurogenic shock)
  • Urine output ≥0.5 mL/kg/hr
  • Lactate normalization (<2 mmol/L)
  • ScvO2 >70% (via central venous catheter)
  • SOFA score improvement

1. HYPOVOLEMIC SHOCK

Pathophysiology

Reduction in circulating intravascular volume preventing adequate cardiac output. Most common type in surgical practice. Requires >20% loss of circulating volume.

Causes

  • Hemorrhagic: trauma, GI bleed, ruptured AAA, ectopic pregnancy, postpartum hemorrhage
  • Non-hemorrhagic: burns, pancreatitis, GI losses (vomiting/diarrhea), renal losses (DI, adrenal crisis), third-spacing

ATLS Classification (Hemorrhagic Shock)

ClassBlood LossHRSBPRRUO (mL/hr)Mental Status
I<15% (<750 mL)<100Normal14-20>30Normal
II15-30% (750-1500 mL)100-120Normal20-3020-30Anxious
III30-40% (1500-2000 mL)120-14030-405-15Confused
IV>40% (>2000 mL)>140Very ↓>35<5Lethargic/comatose

Management Protocol

Step 1 - Stop the source
  • Surgical control of bleeding (hemorrhage control takes priority over resuscitation in penetrating trauma)
  • Tourniquet for extremity hemorrhage
  • Pressurize wound with direct pressure or hemostatic gauze
Step 2 - Fluid resuscitation
  • Class I-II: Crystalloid (Lactated Ringer's preferred over normal saline - balanced solutions reduce hyperchloremic acidosis). 1-2 L bolus IV; reassess.
  • Class III: Crystalloid + packed red blood cells (pRBCs). Balanced crystalloids (LR) preferred.
  • Class IV (hemorrhagic): Damage Control Resuscitation (DCR):
    • 1:1:1 ratio of pRBCs : FFP : platelets
    • Permissive hypotension (target SBP 80-90 mmHg) until surgical hemorrhage control in penetrating trauma - avoid in TBI
    • Tranexamic acid (TXA) 1 g IV over 10 min, then 1 g over 8 hrs - give within 3 hours of injury
    • Avoid excessive crystalloid (associated with coagulopathy, hypothermia, acidosis - "lethal triad")
  • Non-hemorrhagic: Crystalloid resuscitation; address underlying electrolyte abnormality (gastric vs. colonic losses differ)
Step 3 - Vasopressors (if fluid-refractory)
  • Norepinephrine 0.01-3 mcg/kg/min (first-line if MAP persistently <65 despite fluid)
  • Vasopressors in hemorrhagic shock increase mortality - use sparingly and only after adequate volume replacement
Step 4 - Monitor
  • Urine output (Foley catheter)
  • Serial lactate q2h
  • Hgb/Hct, ionized calcium (hypocalcemia with massive transfusion)
  • Temperature - keep warm; hypothermia worsens coagulopathy
  • Calcium chloride 1 g IV per 4 units pRBC (for massive transfusion)

2. CARDIOGENIC SHOCK

Pathophysiology

Decreased cardiac output despite adequate preload, with resulting tissue hypoperfusion. The heart fails as a pump.

Causes

  • Myocardial: Anterior wall MI (most common), non-ischemic cardiomyopathy, myocarditis, toxin/drug-induced (beta-blockers, CCBs, TCAs, anthracyclines), metabolic (hypocalcemia, hypophosphatemia, acidosis)
  • Valvular: ruptured papillary muscle, acute MR, acute AS/AR
  • Arrhythmic: VT/VF, complete heart block, severe bradycardia

Diagnosis

  • Clinical: pulmonary rales, S3 gallop, JVD, pink frothy sputum, bilateral infiltrates on CXR
  • Echo: reduced EF, wall motion abnormalities, valvular pathology
  • Labs: elevated troponin, BNP; low ScvO2; rising lactate
  • Hemodynamics: CI <2.2 L/min/m², PAOP >18 mmHg, MAP <65 mmHg

Management Protocol

Step 1 - Identify and treat the cause immediately
  • Ischemic/STEMI: Emergent PCI (primary reperfusion is the most important intervention). Fibrinolysis if PCI unavailable within 120 min.
  • Arrhythmia: Cardioversion/defibrillation for VT/VF; pacing for complete heart block
  • Mechanical complication (papillary rupture, VSD): Urgent surgical repair
  • Non-ischemic decompensated HF: Beta-blockers and diuresis have an increasing role
Step 2 - Hemodynamic support
  • Fluid: Cautious fluid challenge (250 mL bolus); avoid aggressive loading (worsens pulmonary edema). Give only if PAOP/CVP low or patient appears volume-depleted.
  • Vasopressors/Inotropes:
    • Norepinephrine 0.01-0.5 mcg/kg/min - first-line vasopressor (maintains MAP, less arrhythmogenic than dopamine)
    • Dobutamine 2-20 mcg/kg/min - add for inotropic support when CI is low and MAP acceptable
    • Epinephrine - avoid if possible; associated with poor short-term survival in cardiogenic shock
    • Vasopressin - second-line vasopressor; reduces catecholamine requirements
  • Vasodilators (only in non-hypotensive patients): Nitroglycerin or sodium nitroprusside IV - reduce preload/afterload; contraindicated if SBP <90 mmHg
Step 3 - Mechanical circulatory support (MCS)
  • Intra-aortic balloon pump (IABP): Reduces afterload, augments diastolic coronary perfusion. Used as bridge to PCI/surgery. Note: IABP-SHOCK II trial showed no mortality benefit over medical therapy alone.
  • Impella (axial flow pump): Greater hemodynamic support than IABP; increasingly used as bridge to recovery or transplant
  • VA-ECMO: For refractory cardiogenic shock; provides full cardiopulmonary bypass
Step 4 - Supportive care
  • Diuresis (furosemide) once hemodynamically stable to reduce pulmonary congestion
  • Intubation and mechanical ventilation if severe respiratory distress (reduces work of breathing and myocardial O2 demand)
  • Avoid beta-blockers acutely in ischemic cardiogenic shock
  • Avoid aggressive diuresis in RV infarction (RV is preload-dependent)
  • For RV infarction: IV fluids cautiously, norepinephrine, avoid nitrates (reduce RV preload), maintain AV synchrony

3. DISTRIBUTIVE SHOCK

Distributive shock results from inappropriate vasodilation and redistribution of blood flow, reducing effective perfusion despite normal or elevated cardiac output. Subtypes: septic, anaphylactic, neurogenic, endocrine.

3a. SEPTIC SHOCK

Definition (Sepsis-3)

Sepsis = suspected infection + SOFA score increase ≥2. Septic shock = sepsis + vasopressor requirement + lactate >2 mmol/L.

Management Protocol

Hour 1 Bundle (CMS SEP-1):
  1. Measure lactate; remeasure if initial >2 mmol/L
  2. Blood cultures x2 before antibiotics
  3. Broad-spectrum antibiotics within 1 hour
  4. 30 mL/kg IV crystalloid for hypotension or lactate ≥4 mmol/L
  5. Vasopressors if MAP <65 mmHg despite fluid resuscitation
Antibiotics (within 1 hour - do NOT delay for cultures):
  • Empirical broad-spectrum coverage: piperacillin-tazobactam OR meropenem/imipenem (if high resistance risk)
  • Add vancomycin if MRSA suspected (IV catheter infection, known colonization)
  • Add antifungals if Candida risk factors (prolonged ICU, immunocompromised, TPN)
  • De-escalate based on culture results (48-72 hrs)
  • Duration: typically 7-10 days; shorter courses acceptable if clinically improved
Source control:
  • Drain abscesses, remove infected catheters, debride infected tissue
  • Surgical intervention within 6-12 hours if indicated (perforated viscus, necrotizing fasciitis)
Fluid resuscitation:
  • 30 mL/kg balanced crystalloid (LR preferred over NS - reduces hyperchloremia and AKI)
  • Reassess after each bolus with clinical exam, POCUS, pulse pressure variation
  • Albumin 20-25% may be considered in patients who have received large crystalloid volumes
  • Avoid starches (HES) - associated with increased AKI and mortality
Vasopressors:
  • Norepinephrine: first-line, 0.01-3 mcg/kg/min via central venous catheter (or IO if no central access)
  • Vasopressin 0.03-0.04 units/min: add to reduce norepinephrine dose (reduces catecholamine toxicity); second-line
  • Epinephrine: third-line or when bradycardia coexists
  • Dopamine: no longer recommended as first-line; associated with more arrhythmias
  • Angiotensin II (Giapreza): for refractory vasodilatory shock
Corticosteroids:
  • Hydrocortisone 200 mg/day IV (continuous infusion or 50 mg q6h) if shock refractory to norepinephrine >0.25 mcg/kg/min for >4 hours
  • Do NOT use dexamethasone (lacks mineralocorticoid effect)
  • Taper when vasopressors weaned
Glucose control:
  • Target blood glucose 140-180 mg/dL
  • Avoid tight glucose control (<110 mg/dL) - associated with hypoglycemia and harm
Organ support:
  • Lung-protective ventilation if ARDS: TV 6 mL/kg ideal body weight, plateau pressure <30 cmH2O
  • Prone positioning for P/F ratio <150
  • Renal replacement therapy if refractory AKI with volume overload, acidosis, or hyperkalemia
Monitoring endpoints:
  • Lactate clearance ≥10% per 2 hours (target <2 mmol/L)
  • ScvO2 >70%
  • MAP ≥65 mmHg
  • Urine output ≥0.5 mL/kg/hr

3b. ANAPHYLACTIC SHOCK

Triggers

Food (nuts, shellfish), insect stings, medications (penicillin, NSAIDs, contrast dye, muscle relaxants), latex.

Diagnosis

Anaphylaxis is likely if ANY of the following after allergen exposure:
  • Skin/mucosal symptoms (urticaria, angioedema, flushing) PLUS respiratory compromise OR hypotension
  • Two or more organ systems involved after allergen exposure
  • Hypotension alone after known allergen exposure

Management Protocol

Step 1 - Epinephrine (FIRST LINE - no absolute contraindications)
  • IM epinephrine 0.3-0.5 mg (1:1000) in the anterolateral thigh - repeat every 5-15 min as needed (2-3 doses)
  • If refractory or cardiovascular collapse: IV epinephrine 0.1-0.2 mg (1:10,000) slow IV push; then continuous infusion 0.1-1 mcg/kg/min
  • Glucagon 1-2 mg IV/IM (for patients on beta-blockers who fail to respond to epinephrine - overcomes beta-blockade)
Step 2 - Position and airway
  • Supine with legs elevated (improves venous return)
  • Supplemental O2 via non-rebreather mask; prepare for early intubation (angioedema can progress rapidly)
  • Cricothyrotomy tray at bedside if laryngeal edema severe
Step 3 - IV fluids
  • 1-2 L crystalloid IV rapidly for hypotension
  • Large volumes may be needed due to massive capillary leak
Step 4 - Second-line agents (DO NOT replace or precede epinephrine)
  • H1 antihistamine: Diphenhydramine 25-50 mg IV (for urticaria/pruritus - does NOT prevent shock)
  • H2 antihistamine: Ranitidine or famotidine IV (complementary)
  • Corticosteroids: Methylprednisolone 125 mg IV or hydrocortisone 200 mg IV (prevent biphasic reaction, onset delayed 4-6 hrs)
  • Bronchodilator: Salbutamol/albuterol nebulization for bronchospasm
Step 5 - Observation and discharge
  • Observe minimum 4-6 hours (biphasic reactions in 5-20% of patients, occurring up to 72 hrs)
  • Admit for: refractory hypotension, airway involvement, unknown trigger, IV epinephrine used
  • Discharge: prescribe 2 self-injectable epinephrine devices (EpiPen), oral antihistamine, oral steroid course, allergist referral
  • Medic alert bracelet

3c. NEUROGENIC SHOCK

Pathophysiology

Loss of sympathetic tone from spinal cord injury (typically T6 and above), causing vasodilation and relative bradycardia (unlike other shock states where tachycardia predominates). Distinguishes from spinal shock (loss of reflexes - a neurological, not hemodynamic, phenomenon).

Diagnosis

  • Classic triad: Hypotension + bradycardia + hypothermia
  • Must be differentiated from hemorrhagic shock (also common in trauma patients with SCI)
  • POCUS: normal/hyperdynamic cardiac function, non-collapsing IVC

Management Protocol

Step 1 - Spinal immobilization and neuroprotection
  • Immobilize cervical spine
  • Methylprednisolone: no longer routinely recommended (controversial; consider only within 8 hrs of injury per NASCIS-2 if institutional protocol)
  • Maintain MAP 85-90 mmHg (higher target than other shock states to optimize spinal cord perfusion)
Step 2 - Fluid resuscitation
  • Isotonic crystalloid to restore circulating volume
  • Avoid over-resuscitation (patients may develop pulmonary edema without sympathetic tone)
Step 3 - Vasopressors (first-line in neurogenic shock)
  • Norepinephrine or phenylephrine (alpha-1 agonists) - preferred; restore vascular tone
  • Dopamine - useful if bradycardia is significant (has both alpha and beta-1 effects)
  • Atropine 0.5-1 mg IV for symptomatic bradycardia; may need temporary transvenous pacing for refractory cases
Step 4 - Temperature management
  • External warming (patients are poikilothermic below level of injury)
Step 5 - Monitoring
  • MAP target 85-90 mmHg x 5-7 days to optimize cord perfusion
  • Foley catheter (bladder dysfunction)
  • Bowel care (paralytic ileus common)
  • DVT prophylaxis (early, given high clot risk)

3d. ENDOCRINE/ADRENAL CRISIS SHOCK

Causes

Primary adrenal insufficiency (Addison's, bilateral adrenal hemorrhage/infarction), abrupt steroid withdrawal, pituitary apoplexy.

Diagnosis

Refractory vasodilatory shock unresponsive to fluids/vasopressors + hyponatremia + hyperkalemia + hypoglycemia + eosinophilia; low morning cortisol (<3 mcg/dL); poor response to ACTH stimulation test.

Management Protocol

  1. Do not wait for lab confirmation - treat empirically if clinical suspicion high
  2. Hydrocortisone 100 mg IV bolus, then 50 mg IV q6h or 200 mg/day continuous infusion
  3. Dextrose-containing fluid (D5NS or D5LR) - correct hypoglycemia
  4. 1-2 L isotonic saline rapidly (correct hypovolemia and hyponatremia cautiously)
  5. Vasopressors as needed (typically respond to steroids within 1-2 hrs)
  6. Identify and treat precipitating cause (infection, surgery, trauma)

4. OBSTRUCTIVE SHOCK

Pathophysiology

Mechanical obstruction to blood flow preventing adequate cardiac output. Includes: tension pneumothorax, cardiac tamponade, massive pulmonary embolism, and severe pulmonary hypertension.

Hemodynamic Pattern

Low CO, high CVP/PAOP, high SVR - similar to cardiogenic shock, but the problem is mechanical, not pump failure.

4a. TENSION PNEUMOTHORAX

Diagnosis (clinical - DO NOT wait for CXR)

  • Absent breath sounds unilaterally + tracheal deviation (late sign)
  • Severe respiratory distress + hypotension + JVD
  • POCUS: absent lung sliding on affected side; M-mode "barcode sign"

Management

  1. Immediate needle decompression - 2nd intercostal space, midclavicular line (or 4th-5th ICS, anterior axillary line if obese) - 14G angiocath, minimum 8 cm length
  2. Definitive treatment: chest tube thoracostomy - 4th or 5th ICS, anterior axillary line; 28-32Fr tube (trauma); or finger thoracostomy in cardiac arrest
  3. Bilateral decompressions in traumatic arrest before thoracotomy
  4. No time for imaging - treat clinically

4b. CARDIAC TAMPONADE

Diagnosis

  • Beck's triad: Hypotension + JVD + muffled heart sounds (classic but only present in 10-40%)
  • Pulsus paradoxus >10 mmHg (exaggerated fall in SBP with inspiration)
  • ECG: electrical alternans, low voltage, sinus tachycardia
  • POCUS (diagnostic gold standard): Pericardial effusion + RV collapse in diastole + IVC dilation without respiratory variation; swinging heart

Management

  1. Aggressive IV fluids to maintain preload while preparing for drainage
  2. Pericardiocentesis (emergency or guided by echo):
    • Subxiphoid approach; aspirate 10-20 mL can restore hemodynamics dramatically
    • Echo-guided preferred if time allows (reduces complications)
  3. Surgical pericardiotomy/window if: traumatic tamponade (clotted blood), recurrent tamponade, hemopericardium
  4. Emergency thoracotomy in traumatic cardiac arrest with tamponade
  5. Avoid positive pressure ventilation if possible (reduces venous return)
  6. Avoid vasodilators and diuretics (both worsen preload)
  7. Maintain heart rate (tachycardia is compensatory - do not give beta-blockers)

4c. MASSIVE PULMONARY EMBOLISM

Diagnosis

PE with hemodynamic instability: SBP <90 mmHg or vasopressor requirement + evidence of RV dysfunction.
  • POCUS: RV enlargement (RV:LV ratio >0.9), septal bowing (D-sign), McConnell's sign, dilated IVC
  • CT-PA (if stable enough): filling defect in main/bilateral PAs + RV strain
  • ECG: S1Q3T3, new RBBB, sinus tachycardia

Management

  1. Anticoagulation immediately (unless absolute contraindication): UFH 80 units/kg IV bolus, then 18 units/kg/hr infusion
  2. Systemic thrombolysis (first-line reperfusion for massive PE):
    • Alteplase (tPA) 100 mg IV over 2 hrs (or 0.6 mg/kg over 15 min in cardiac arrest)
    • Contraindications: active bleeding, recent stroke, prior intracranial surgery, pregnancy
  3. Surgical embolectomy: If thrombolysis is contraindicated or fails; requires cardiopulmonary bypass
  4. Catheter-directed thrombolysis/thrombectomy (CDTT): For sub-massive PE or when systemic lysis is contraindicated; reduced dose tPA delivered directly into clot
  5. Supportive care:
    • Cautious IV fluids (RV is dilated and failing; excessive fluids cause septal shift and LV compromise)
    • Vasopressors: norepinephrine first-line; vasopressin as adjunct
    • Avoid dobutamine alone (may cause systemic vasodilation)
    • Intubation: use carefully (positive pressure ventilation decreases venous return and can precipitate arrest)
    • VA-ECMO: bridge to surgical embolectomy in refractory cases

Vasopressor/Inotrope Quick Reference

DrugMechanismDosePrimary Use
Norepinephrineα1 > β10.01-3 mcg/kg/minFirst-line all shock types except anaphylaxis
Epinephrineα1, β1, β20.01-1 mcg/kg/minAnaphylaxis (IM first), refractory septic shock
VasopressinV1 receptors0.03-0.04 units/minSecond-line adjunct to NE in septic/distributive
Dobutamineβ1 > β22-20 mcg/kg/minCardiogenic shock (add-on for inotropic support)
Phenylephrineα1 only0.5-9 mcg/kg/minNeurogenic shock; tachycardia with vasodilation
DopamineD1, β1, α1 (dose-dependent)5-20 mcg/kg/minNo longer first-line; use if bradycardia present
Angiotensin IIAT1 receptors20-40 ng/kg/minRefractory vasodilatory shock

Monitoring and Endpoints of Resuscitation

ParameterTarget
MAP≥65 mmHg (≥85-90 in neurogenic)
Urine output≥0.5 mL/kg/hr
Lactate<2 mmol/L; ≥10% clearance per 2 hrs
ScvO2>70%
Blood glucose140-180 mg/dL
Temperature≥36°C (normothermia)
pH7.35-7.45
Ionized Ca2+>1.1 mmol/L (especially with massive transfusion)

SOFA Score (Sepsis Severity Assessment)

SystemScore 01234
Respiratory PaO2/FiO2>400301-400201-300101-200≤100
CardiovascularMAP >70MAP <70 (no vasopressor)Dopa ≤5 or any dobutamineDopa >5 or NE ≤0.1NE >0.1 or any vasopressin
Coagulation (plt ×10⁹/L)>150100-14950-9920-49<20
Renal Cr (mg/dL)<1.21.2-1.92.0-3.43.5-4.9>5
Liver bili (mg/dL)<1.21.2-1.92.0-5.96.0-11.9>12
Neuro (GCS)1513-1410-126-9<6

Differential Diagnosis by POCUS

FindingMost Likely Type
Hyperdynamic heart, small IVCDistributive (septic/anaphylactic/neurogenic)
Dilated, poor LV function, B-lines on lungCardiogenic
Small heart, small IVC, no effusionHypovolemic
Pericardial effusion + RV diastolic collapseTamponade (obstructive)
RV enlargement, D-sign, no effusionPE (obstructive)
Absent lung sliding unilaterallyTension pneumothorax (obstructive)

Sources: Mulholland & Greenfield's Surgery 7e | Barash Clinical Anesthesia 9e | Rosen's Emergency Medicine | Sabiston Textbook of Surgery | Tintinalli's Emergency Medicine | Greenfield Surgery: Scientific Principles and Practice

Create a decision tree flowchart to differentiate shock types using POCUS findings

Reading File
Reading File
Running Command

ls -la /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/shock-pocus-flowchart

Writing File

~/shock-pocus-flowchart/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "POCUS-Based Shock Differentiation Decision Tree";
pres.author = "Orris Medical";

// ─── Color Palette ───────────────────────────────────────────────────────────
const C = {
  bg:         "0B1C2E",  // deep navy
  bgLight:    "122640",  // panel navy
  white:      "FFFFFF",
  accent:     "00C9B1",  // teal
  accentDark: "009E8C",  // darker teal
  yellow:     "F5C518",  // gold
  orange:     "FF7043",  // alert orange
  red:        "EF5350",  // danger red
  green:      "66BB6A",  // positive green
  purple:     "AB47BC",  // purple
  blue:       "42A5F5",  // sky blue
  pink:       "EC407A",  // pink
  grey:       "90A4AE",  // steel grey
  greyDark:   "546E7A",  // dark grey
  lineColor:  "00C9B1",  // connector teal
  boxText:    "0B1C2E",  // dark text inside light boxes
  dimWhite:   "B0BEC5",  // muted white
};

// ─── Helpers ─────────────────────────────────────────────────────────────────

function titleSlide(slide) {
  // Full background
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.bg } });
  // Accent stripe
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.12, fill: { color: C.accent } });
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 7.38, w: 13.3, h: 0.12, fill: { color: C.accent } });
  // Left bar
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 7.5, fill: { color: C.accent } });

  // Icon circle
  slide.addShape(pres.ShapeType.ellipse, { x: 1.1, y: 1.4, w: 1.6, h: 1.6, fill: { color: C.accent }, line: { color: C.accent } });
  slide.addText("🔊", { x: 1.1, y: 1.4, w: 1.6, h: 1.6, fontSize: 36, align: "center", valign: "middle" });

  slide.addText("POCUS-Based Shock", {
    x: 2.9, y: 1.4, w: 9.8, h: 0.85,
    fontSize: 44, bold: true, color: C.white, fontFace: "Calibri", align: "left",
  });
  slide.addText("Differentiation Protocol", {
    x: 2.9, y: 2.2, w: 9.8, h: 0.75,
    fontSize: 38, bold: false, color: C.accent, fontFace: "Calibri", align: "left",
  });

  slide.addShape(pres.ShapeType.rect, { x: 2.9, y: 3.08, w: 9.8, h: 0.04, fill: { color: C.greyDark } });

  slide.addText("Point-of-Care Ultrasound · Decision Tree · All Shock Types", {
    x: 2.9, y: 3.2, w: 9.8, h: 0.5,
    fontSize: 16, color: C.dimWhite, fontFace: "Calibri", align: "left", italic: true,
  });

  // Badges
  const badges = ["Hypovolemic", "Cardiogenic", "Distributive", "Obstructive"];
  const bColors = [C.blue, C.red, C.orange, C.purple];
  badges.forEach((b, i) => {
    slide.addShape(pres.ShapeType.roundRect, {
      x: 2.9 + i * 2.52, y: 3.95, w: 2.3, h: 0.5,
      fill: { color: bColors[i] }, line: { color: bColors[i] }, rectRadius: 0.12,
    });
    slide.addText(b, {
      x: 2.9 + i * 2.52, y: 3.95, w: 2.3, h: 0.5,
      fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle",
    });
  });

  slide.addText("Slide through the decision tree to identify shock type using echo, lung, and IVC windows.", {
    x: 2.9, y: 4.65, w: 9.8, h: 0.5,
    fontSize: 13, color: C.grey, fontFace: "Calibri", align: "left",
  });

  slide.addText("Based on: Rosen's Emergency Medicine · Barash Clinical Anesthesia 9e · ACEP POCUS Guidelines", {
    x: 0.4, y: 7.1, w: 12.5, h: 0.3,
    fontSize: 10, color: C.greyDark, align: "left",
  });
}

// Generic slide background
function applyBg(slide) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.bg } });
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.08, fill: { color: C.accent } });
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.1, h: 7.5,  fill: { color: C.accent } });
}

// Slide header bar
function addHeader(slide, title, subtitle) {
  slide.addShape(pres.ShapeType.rect, { x: 0.1, y: 0.12, w: 13.2, h: 0.7, fill: { color: C.bgLight } });
  slide.addText(title, {
    x: 0.25, y: 0.12, w: 9, h: 0.7,
    fontSize: 22, bold: true, color: C.accent, fontFace: "Calibri", valign: "middle",
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 9.3, y: 0.12, w: 3.85, h: 0.7,
      fontSize: 11, color: C.grey, fontFace: "Calibri", valign: "middle", align: "right", italic: true,
    });
  }
}

// Draw a decision node box (question)
function qBox(slide, x, y, w, h, text, color) {
  color = color || C.accent;
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w, h,
    fill: { color: color }, line: { color: color, width: 0 }, rectRadius: 0.1,
  });
  slide.addText(text, {
    x, y, w, h,
    fontSize: 11, bold: true, color: C.boxText, align: "center", valign: "middle",
    fontFace: "Calibri", margin: 4,
  });
}

// Outcome/diagnosis box
function diagBox(slide, x, y, w, h, title, sub, color) {
  color = color || C.blue;
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w, h,
    fill: { color: color }, line: { color: color, width: 0 }, rectRadius: 0.12,
  });
  slide.addText(title, {
    x, y: y + 0.02, w, h: h * 0.52,
    fontSize: 12, bold: true, color: C.white, align: "center", valign: "bottom",
    fontFace: "Calibri",
  });
  if (sub) {
    slide.addText(sub, {
      x, y: y + h * 0.52, w, h: h * 0.46,
      fontSize: 9, color: C.white, align: "center", valign: "top",
      fontFace: "Calibri", italic: true,
    });
  }
}

// Arrow / connector line
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.accent, width: 1.5, endArrowType: "open" },
  });
}

// Label along a connector
function label(slide, x, y, text, color) {
  slide.addText(text, {
    x, y, w: 0.7, h: 0.24,
    fontSize: 8, bold: true, color: color || C.yellow, align: "center",
  });
}

// ─── SLIDE 1: Title ───────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  titleSlide(s);
}

// ─── SLIDE 2: Overview – 3-Window POCUS Protocol ──────────────────────────────
{
  const s = pres.addSlide();
  applyBg(s);
  addHeader(s, "3-Window POCUS Protocol for Undifferentiated Shock", "Step-by-step ultrasound assessment");

  // Three window panels
  const panels = [
    {
      icon: "❤️", title: "CARDIAC WINDOW",
      sub: "Subxiphoid or Parasternal Long Axis",
      points: [
        "LV contractility (EF normal/reduced/hyperdynamic?)",
        "RV size (RV:LV ratio >0.9 = RV strain)",
        "Pericardial effusion present?",
        "Wall motion abnormalities?",
      ],
      color: C.red,
    },
    {
      icon: "💧", title: "IVC WINDOW",
      sub: "Subcostal, long axis, 2 cm from RA junction",
      points: [
        "IVC diameter: Small (<1.5 cm) / Normal / Dilated (>2.1 cm)",
        "Collapsibility Index (CI): >50% = volume responsive",
        "CI <50% + dilated IVC = elevated CVP",
        "Non-collapsible IVC = obstructive or cardiogenic",
      ],
      color: C.blue,
    },
    {
      icon: "🫁", title: "LUNG WINDOW",
      sub: "Anterior zones bilateral (2nd ICS MCL)",
      points: [
        "B-lines (≥3 per zone) = pulmonary edema/ARDS",
        "Absent lung sliding = pneumothorax (check both sides)",
        "Barcode sign on M-mode = absent sliding",
        "A-lines bilateral = normal or hypovolemia",
      ],
      color: C.green,
    },
  ];

  panels.forEach((p, i) => {
    const x = 0.35 + i * 4.32;
    // Panel background
    slide_panel(s, x, 1.0, 4.1, 5.9, p, i);
  });

  // Footer note
  s.addText("Always perform all 3 windows. Findings are integrated — no single window is diagnostic in isolation.", {
    x: 0.3, y: 7.1, w: 12.7, h: 0.3,
    fontSize: 10, color: C.grey, align: "center", italic: true,
  });

  function slide_panel(slide, x, y, w, h, p, idx) {
    slide.addShape(pres.ShapeType.roundRect, {
      x, y, w, h,
      fill: { color: C.bgLight }, line: { color: p.color, width: 2 }, rectRadius: 0.15,
    });
    // Header band
    slide.addShape(pres.ShapeType.roundRect, {
      x, y, w, h: 1.0,
      fill: { color: p.color }, line: { color: p.color }, rectRadius: 0.15,
    });
    // Square off bottom of header band
    slide.addShape(pres.ShapeType.rect, {
      x, y: y + 0.7, w, h: 0.3,
      fill: { color: p.color }, line: { color: p.color },
    });
    slide.addText(p.icon, { x, y: y + 0.06, w, h: 0.5, fontSize: 26, align: "center" });
    slide.addText(p.title, {
      x, y: y + 0.5, w, h: 0.45,
      fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle",
    });
    slide.addText(p.sub, {
      x: x + 0.1, y: y + 1.05, w: w - 0.2, h: 0.38,
      fontSize: 9, color: p.color, align: "center", italic: true,
    });
    // Bullet points
    const items = p.points.map((pt, j) => ({
      text: pt,
      options: { bullet: { type: "bullet" }, breakLine: j < p.points.length - 1, fontSize: 10, color: C.dimWhite },
    }));
    slide.addText(items, {
      x: x + 0.15, y: y + 1.48, w: w - 0.3, h: h - 1.6,
      fontFace: "Calibri", valign: "top",
    });
  }
}

// ─── SLIDE 3: Master Decision Tree ────────────────────────────────────────────
{
  const s = pres.addSlide();
  applyBg(s);
  addHeader(s, "Master Decision Tree  —  POCUS Shock Differentiation", "All 4 shock categories");

  // Start node
  s.addShape(pres.ShapeType.ellipse, { x: 5.4, y: 0.9, w: 2.5, h: 0.65, fill: { color: C.accent }, line: { color: C.accent } });
  s.addText("UNDIFFERENTIATED SHOCK", { x: 5.4, y: 0.9, w: 2.5, h: 0.65, fontSize: 9, bold: true, color: C.boxText, align: "center", valign: "middle" });

  // Arrow down from start
  arrow(s, 6.65, 1.55, 6.65, 2.0);

  // Q1 – Cardiac view
  qBox(s, 5.1, 2.0, 3.1, 0.65, "Q1: Is there a PERICARDIAL EFFUSION\n+ RV diastolic collapse?", C.accent);

  // YES → Tamponade
  arrow(s, 5.1, 2.32, 3.9, 2.32);
  label(s, 4.3, 2.1, "YES", C.yellow);
  diagBox(s, 2.45, 1.95, 1.45, 0.78, "CARDIAC\nTAMPONADE", "Obstructive", C.purple);

  // NO arrow down
  arrow(s, 6.65, 2.65, 6.65, 3.1);
  label(s, 6.72, 2.74, "NO", C.orange);

  // Q2 – Lung sliding
  qBox(s, 5.1, 3.1, 3.1, 0.65, "Q2: Is there ABSENT LUNG SLIDING\n(+ barcode sign on M-mode)?", C.accent);

  // YES → Tension PTX
  arrow(s, 5.1, 3.42, 3.9, 3.42);
  label(s, 4.3, 3.22, "YES", C.yellow);
  diagBox(s, 2.45, 3.05, 1.45, 0.78, "TENSION\nPNEUMOTHORAX", "Obstructive", C.purple);

  // NO arrow down
  arrow(s, 6.65, 3.75, 6.65, 4.2);
  label(s, 6.72, 3.84, "NO", C.orange);

  // Q3 – RV strain
  qBox(s, 5.1, 4.2, 3.1, 0.65, "Q3: RV:LV ratio >0.9 + D-sign\n+ non-collapsible IVC?", C.accent);

  // YES → PE
  arrow(s, 5.1, 4.52, 3.9, 4.52);
  label(s, 4.3, 4.32, "YES", C.yellow);
  diagBox(s, 2.45, 4.15, 1.45, 0.78, "MASSIVE\nPULM. EMBOLISM", "Obstructive", C.purple);

  // NO arrow down
  arrow(s, 6.65, 4.85, 6.65, 5.3);
  label(s, 6.72, 4.94, "NO", C.orange);

  // Q4 – LV function
  qBox(s, 5.1, 5.3, 3.1, 0.65, "Q4: Is LV function SEVERELY REDUCED\n(EF <30%) + dilated/congested?", C.accent);

  // YES → Cardiogenic
  arrow(s, 5.1, 5.62, 3.9, 5.62);
  label(s, 4.3, 5.42, "YES", C.yellow);
  diagBox(s, 2.45, 5.25, 1.45, 0.78, "CARDIOGENIC\nSHOCK", "Low CO, high PAOP", C.red);

  // NO arrow down
  arrow(s, 6.65, 5.95, 6.65, 6.38);
  label(s, 6.72, 6.04, "NO", C.orange);

  // Q5 – IVC collapsibility
  qBox(s, 5.1, 6.38, 3.1, 0.65, "Q5: Is the IVC SMALL + COLLAPSIBLE\n(CI >50%, IVC <1.5 cm)?", C.accent);

  // YES → Hypovolemic
  arrow(s, 5.1, 6.7, 3.9, 6.7);
  label(s, 4.3, 6.5, "YES", C.yellow);
  diagBox(s, 2.45, 6.33, 1.45, 0.78, "HYPOVOLEMIC\nSHOCK", "Hemorrhage/Fluid loss", C.blue);

  // NO → Distributive
  arrow(s, 8.2, 6.7, 9.4, 6.7);
  label(s, 8.5, 6.5, "NO", C.orange);
  diagBox(s, 9.4, 6.33, 1.6, 0.78, "DISTRIBUTIVE\nSHOCK", "Septic/Anaph/Neurogen.", C.orange);

  // Legend panel
  s.addShape(pres.ShapeType.roundRect, {
    x: 10.55, y: 1.1, w: 2.5, h: 3.8,
    fill: { color: C.bgLight }, line: { color: C.greyDark }, rectRadius: 0.1,
  });
  s.addText("LEGEND", {
    x: 10.55, y: 1.12, w: 2.5, h: 0.35,
    fontSize: 11, bold: true, color: C.accent, align: "center",
  });

  const legendItems = [
    { color: C.accent,  label: "Decision question" },
    { color: C.purple,  label: "Obstructive shock" },
    { color: C.red,     label: "Cardiogenic shock" },
    { color: C.blue,    label: "Hypovolemic shock" },
    { color: C.orange,  label: "Distributive shock" },
    { color: C.yellow,  label: "YES branch" },
  ];
  legendItems.forEach((li, i) => {
    s.addShape(pres.ShapeType.roundRect, {
      x: 10.7, y: 1.55 + i * 0.55, w: 0.28, h: 0.28,
      fill: { color: li.color }, line: { color: li.color }, rectRadius: 0.04,
    });
    s.addText(li.label, {
      x: 11.05, y: 1.55 + i * 0.55, w: 1.9, h: 0.28,
      fontSize: 9.5, color: C.dimWhite, valign: "middle",
    });
  });
}

// ─── SLIDE 4: Branch A – Obstructive Shock Drill-Down ─────────────────────────
{
  const s = pres.addSlide();
  applyBg(s);
  addHeader(s, "Obstructive Shock  —  POCUS Drill-Down", "Tamponade · Tension PTX · Massive PE");

  // Obstructive header
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.2, y: 0.95, w: 12.9, h: 0.55,
    fill: { color: C.purple }, line: { color: C.purple }, rectRadius: 0.1,
  });
  s.addText("🚨  OBSTRUCTIVE SHOCK PATHWAY  —  3 Life-Threatening Causes", {
    x: 0.2, y: 0.95, w: 12.9, h: 0.55,
    fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle",
  });

  // ── TAMPONADE COLUMN ──────────────────────────────────────────────────────
  const col = (i) => 0.25 + i * 4.38;
  const colW = 4.1;

  // Column headers
  const colData = [
    { title: "CARDIAC TAMPONADE", icon: "❤️", color: C.red },
    { title: "TENSION PNEUMOTHORAX", icon: "🫁", color: C.green },
    { title: "MASSIVE PULM. EMBOLISM", icon: "🩸", color: C.pink },
  ];
  colData.forEach((c, i) => {
    s.addShape(pres.ShapeType.roundRect, {
      x: col(i), y: 1.6, w: colW, h: 0.5,
      fill: { color: c.color }, line: { color: c.color }, rectRadius: 0.1,
    });
    s.addText(`${c.icon}  ${c.title}`, {
      x: col(i), y: 1.6, w: colW, h: 0.5,
      fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle",
    });
  });

  // Row 1: POCUS Findings
  const rows = [
    {
      label: "POCUS FINDINGS",
      items: [
        "• Pericardial effusion (any size)\n• RV diastolic collapse\n• RA systolic collapse\n• IVC dilated, non-collapsible\n• Swinging heart (large effusion)\n• Electrical alternans on ECG",
        "• Absent lung sliding on affected side\n• Barcode sign (M-mode)\n• No B-lines on affected side\n• Lung point (pathognomonic)\n• Contralateral tracheal shift (late)\n• Clinical: JVD + absent breath sounds",
        "• RV:LV ratio >0.9 (4-chamber view)\n• D-sign (septal bowing toward LV)\n• McConnell's sign (akinetic RV free wall,\n  preserved apical motion)\n• IVC dilated, non-collapsible\n• No pericardial effusion",
      ],
    },
    {
      label: "KEY DIFFERENTIATOR",
      items: [
        "Pericardial fluid + RV collapse\nin diastole is diagnostic",
        "Absent lung sliding ipsilateral.\nLung point = definitive.",
        "RV dilation + McConnell's sign.\nNo effusion.",
      ],
    },
    {
      label: "IMMEDIATE ACTION",
      items: [
        "Pericardiocentesis\n(subxiphoid route)\nFluid bolus as bridge",
        "Needle decompression\n2nd ICS MCL STAT\n→ Chest tube to follow",
        "UFH anticoagulation\nSystemic thrombolysis\n(tPA 100 mg over 2h)",
      ],
    },
    {
      label: "DO NOT",
      items: [
        "Do NOT give diuretics\nDo NOT give vasodilators\nDo NOT IPPV until drained",
        "Do NOT delay for CXR\nTreat on clinical suspicion",
        "Cautious IVF (RV dilated)\nDo NOT over-resuscitate",
      ],
    },
  ];

  const rowH = [1.45, 0.62, 0.78, 0.58];
  const rowColors = [C.bgLight, "1A3A5C", "1A3A5C", "2C1A1A"];
  let rowY = 2.18;
  rows.forEach((row, ri) => {
    // Row label
    s.addShape(pres.ShapeType.rect, {
      x: 0.25, y: rowY, w: 12.8, h: rowH[ri],
      fill: { color: rowColors[ri] }, line: { color: C.greyDark },
    });
    s.addText(row.label, {
      x: 0.28, y: rowY, w: 12.75, h: 0.26,
      fontSize: 9, bold: true, color: C.accent, align: "left",
    });
    row.items.forEach((item, ci) => {
      s.addText(item, {
        x: col(ci) + 0.08, y: rowY + 0.26, w: colW - 0.16, h: rowH[ri] - 0.26,
        fontSize: 9.5, color: C.dimWhite, valign: "top", fontFace: "Calibri",
      });
    });
    rowY += rowH[ri] + 0.02;
  });

  // Footer
  s.addText("All obstructive shock types: Low CO · High CVP/PAOP · High SVR — differentiated by POCUS window findings above.", {
    x: 0.3, y: 7.15, w: 12.7, h: 0.27,
    fontSize: 9.5, color: C.grey, align: "center", italic: true,
  });
}

// ─── SLIDE 5: Cardiogenic Shock Drill-Down ─────────────────────────────────────
{
  const s = pres.addSlide();
  applyBg(s);
  addHeader(s, "Cardiogenic Shock  —  POCUS Findings & Subtypes", "LV Failure · RV Failure · Mechanical Complication");

  // Red header bar
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.2, y: 0.95, w: 12.9, h: 0.52,
    fill: { color: C.red }, line: { color: C.red }, rectRadius: 0.1,
  });
  s.addText("❤️  CARDIOGENIC SHOCK  —  Low CO · High PAOP · High SVR · Low SvO₂", {
    x: 0.2, y: 0.95, w: 12.9, h: 0.52,
    fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle",
  });

  // Flow: entry → Q branches
  // Entry box
  qBox(s, 4.65, 1.55, 4.0, 0.55, "LV Function Severely Reduced?\n(EF <30%, dilated LV)", C.accent);

  // Arrow YES
  arrow(s, 4.65, 1.82, 3.35, 1.82);
  label(s, 3.7, 1.62, "YES", C.yellow);

  // Box: LV failure confirmed
  s.addShape(pres.ShapeType.roundRect, {
    x: 1.0, y: 1.55, w: 2.3, h: 0.55,
    fill: { color: C.red }, line: { color: C.red }, rectRadius: 0.1,
  });
  s.addText("LV CARDIOGENIC\nSHOCK CONFIRMED", {
    x: 1.0, y: 1.55, w: 2.3, h: 0.55,
    fontSize: 10, bold: true, color: C.white, align: "center", valign: "middle",
  });

  // Arrow NO
  arrow(s, 8.65, 1.82, 9.95, 1.82);
  label(s, 9.15, 1.62, "NO", C.orange);

  // Is RV enlarged?
  qBox(s, 9.95, 1.55, 3.1, 0.55, "RV enlarged (>2/3 LV)?\n+ RV dysfunction?", C.accent);

  // YES → RV failure
  arrow(s, 11.5, 2.1, 11.5, 2.55);
  label(s, 11.56, 2.2, "YES", C.yellow);
  s.addShape(pres.ShapeType.roundRect, {
    x: 10.0, y: 2.55, w: 2.9, h: 0.55,
    fill: { color: C.orange }, line: { color: C.orange }, rectRadius: 0.1,
  });
  s.addText("RV CARDIOGENIC\nSHOCK (RV MI / PE)", {
    x: 10.0, y: 2.55, w: 2.9, h: 0.55,
    fontSize: 10, bold: true, color: C.white, align: "center", valign: "middle",
  });

  // Lung B-lines sub-question
  arrow(s, 2.15, 2.1, 2.15, 2.55);
  qBox(s, 0.75, 2.55, 2.85, 0.55, "B-lines bilateral?\n(Pulmonary edema)", C.accentDark);
  arrow(s, 2.15, 3.1, 2.15, 3.5);

  s.addShape(pres.ShapeType.roundRect, {
    x: 0.75, y: 3.5, w: 2.85, h: 0.55,
    fill: { color: C.blue }, line: { color: C.blue }, rectRadius: 0.1,
  });
  s.addText("Acute Pulmonary Edema\n(Flash Pulm. Edema)", {
    x: 0.75, y: 3.5, w: 2.85, h: 0.55,
    fontSize: 10, bold: true, color: C.white, align: "center", valign: "middle",
  });

  // ── POCUS Findings Table ─────────────────────────────────────────────────
  s.addShape(pres.ShapeType.rect, {
    x: 0.2, y: 4.18, w: 12.9, h: 0.38,
    fill: { color: C.bgLight }, line: { color: C.greyDark },
  });
  s.addText("CARDIOGENIC SHOCK  —  POCUS FINDINGS SUMMARY", {
    x: 0.2, y: 4.18, w: 12.9, h: 0.38,
    fontSize: 11, bold: true, color: C.accent, align: "center", valign: "middle",
  });

  const cgHeaders = ["ECHO Window", "LV Cardiogenic", "RV Cardiogenic", "Hyperdynamic (Distributive - rule out)"];
  const cgRows = [
    ["LV Function",     "EF <30%, dilated LV, WMA",             "Normal or mildly reduced",       "Hyperdynamic, EF >70%"],
    ["RV Size",         "Normal or mildly enlarged",             "RV:LV >0.9, D-sign, McConnell's","Normal or small"],
    ["Pericardium",     "No effusion (unless post-MI rupture)",  "No effusion",                    "No effusion"],
    ["IVC",             "Dilated, non-collapsible",              "Dilated, non-collapsible",       "Collapsible if early sepsis"],
    ["Lung",            "Bilateral B-lines (pulm. edema)",       "A-lines (clear lungs if RV MI)", "A-lines or B-lines"],
    ["Valves",          "Check for acute MR, VSD (post-MI)",     "TR, pulm HTN features",          "Normal"],
  ];

  const colWs = [1.9, 3.3, 3.3, 4.2];
  const colXs = [0.25, 2.18, 5.52, 8.85];
  const rowHh = 0.38;

  cgHeaders.forEach((h, ci) => {
    s.addShape(pres.ShapeType.rect, {
      x: colXs[ci], y: 4.6, w: colWs[ci], h: 0.35,
      fill: { color: C.greyDark }, line: { color: C.bg },
    });
    s.addText(h, {
      x: colXs[ci], y: 4.6, w: colWs[ci], h: 0.35,
      fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle",
    });
  });

  cgRows.forEach((row, ri) => {
    const rowBg = ri % 2 === 0 ? C.bgLight : C.bg;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, {
        x: colXs[ci], y: 4.97 + ri * rowHh, w: colWs[ci], h: rowHh,
        fill: { color: ci === 0 ? C.greyDark : rowBg }, line: { color: C.greyDark },
      });
      s.addText(cell, {
        x: colXs[ci] + 0.05, y: 4.97 + ri * rowHh, w: colWs[ci] - 0.1, h: rowHh,
        fontSize: ci === 0 ? 9 : 8.5,
        bold: ci === 0,
        color: ci === 0 ? C.accent : C.dimWhite,
        valign: "middle", fontFace: "Calibri",
      });
    });
  });
}

// ─── SLIDE 6: Hypovolemic vs Distributive ──────────────────────────────────────
{
  const s = pres.addSlide();
  applyBg(s);
  addHeader(s, "Hypovolemic vs Distributive Shock  —  POCUS Differentiation", "IVC + Cardiac + Lung Windows");

  // Shared banner
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.2, y: 0.94, w: 12.9, h: 0.5,
    fill: { color: C.bgLight }, line: { color: C.greyDark }, rectRadius: 0.1,
  });
  s.addText("Both have hyperdynamic/normal LV  ·  Differentiated by IVC size, collapsibility, and clinical context", {
    x: 0.2, y: 0.94, w: 12.9, h: 0.5,
    fontSize: 12, color: C.dimWhite, align: "center", valign: "middle", italic: true,
  });

  // Left: Hypovolemic
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.25, y: 1.54, w: 6.05, h: 5.6,
    fill: { color: C.bgLight }, line: { color: C.blue, width: 2 }, rectRadius: 0.15,
  });
  s.addShape(pres.ShapeType.roundRect, {
    x: 0.25, y: 1.54, w: 6.05, h: 0.55,
    fill: { color: C.blue }, line: { color: C.blue }, rectRadius: 0.15,
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0.25, y: 1.84, w: 6.05, h: 0.25,
    fill: { color: C.blue }, line: { color: C.blue },
  });
  s.addText("💧  HYPOVOLEMIC SHOCK", {
    x: 0.25, y: 1.54, w: 6.05, h: 0.55,
    fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle",
  });

  const hypoRows = [
    ["IVC Size",           "SMALL  (<1.5 cm diameter)"],
    ["IVC Collapsibility", "MARKED  (CI >50%)  ✓"],
    ["LV Size/Function",   "Small LV cavity, hyperdynamic EF"],
    ["LV Wall Motion",     "Normal — no WMA"],
    ["Lung Windows",       "A-lines (no pulmonary edema)"],
    ["RV Size",            "Normal or small"],
    ["Pericardium",        "No effusion"],
    ["Clinical Context",   "Trauma, hemorrhage, vomiting,\ndiarrhea, burns, third-spacing"],
    ["Fluid Response",     "Rapid improvement with IVF bolus"],
  ];

  hypoRows.forEach(([k, v], i) => {
    const yy = 2.2 + i * 0.52;
    s.addText(k + ":", {
      x: 0.4, y: yy, w: 2.1, h: 0.45,
      fontSize: 9.5, bold: true, color: C.accent, valign: "middle",
    });
    s.addText(v, {
      x: 2.52, y: yy, w: 3.6, h: 0.45,
      fontSize: 9.5, color: C.dimWhite, valign: "middle",
    });
  });

  // Right: Distributive
  s.addShape(pres.ShapeType.roundRect, {
    x: 6.95, y: 1.54, w: 6.1, h: 5.6,
    fill: { color: C.bgLight }, line: { color: C.orange, width: 2 }, rectRadius: 0.15,
  });
  s.addShape(pres.ShapeType.roundRect, {
    x: 6.95, y: 1.54, w: 6.1, h: 0.55,
    fill: { color: C.orange }, line: { color: C.orange }, rectRadius: 0.15,
  });
  s.addShape(pres.ShapeType.rect, {
    x: 6.95, y: 1.84, w: 6.1, h: 0.25,
    fill: { color: C.orange }, line: { color: C.orange },
  });
  s.addText("🔥  DISTRIBUTIVE SHOCK", {
    x: 6.95, y: 1.54, w: 6.1, h: 0.55,
    fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle",
  });

  const distRows = [
    ["IVC Size",           "VARIABLE  (often normal/small early)"],
    ["IVC Collapsibility", "VARIABLE or HIGH (after resuscitation: normal)"],
    ["LV Size/Function",   "HYPERDYNAMIC  EF >65–70%  ⚡"],
    ["LV Wall Motion",     "Normal, hyperdynamic — global"],
    ["Lung Windows",       "A-lines early; B-lines if ARDS develops"],
    ["RV Size",            "Normal (unless sepsis-induced RV dysfxn)"],
    ["Pericardium",        "No effusion"],
    ["Clinical Context",   "Fever, infection (sepsis), rash/allergen\n(anaphylaxis), SCI (neurogenic)"],
    ["Vasopressor Need",   "Often high-dose NE required despite\nadequate volume"],
  ];

  distRows.forEach(([k, v], i) => {
    const yy = 2.2 + i * 0.52;
    s.addText(k + ":", {
      x: 7.1, y: yy, w: 2.2, h: 0.45,
      fontSize: 9.5, bold: true, color: C.orange, valign: "middle",
    });
    s.addText(v, {
      x: 9.32, y: yy, w: 3.6, h: 0.45,
      fontSize: 9.5, color: C.dimWhite, valign: "middle",
    });
  });

  // VS divider
  s.addShape(pres.ShapeType.ellipse, {
    x: 6.15, y: 3.88, w: 0.8, h: 0.8,
    fill: { color: C.accent }, line: { color: C.accent },
  });
  s.addText("VS", { x: 6.15, y: 3.88, w: 0.8, h: 0.8, fontSize: 13, bold: true, color: C.boxText, align: "center", valign: "middle" });
}

// ─── SLIDE 7: Distributive Subtypes ───────────────────────────────────────────
{
  const s = pres.addSlide();
  applyBg(s);
  addHeader(s, "Distributive Shock Subtypes  —  POCUS + Clinical Clues", "Septic · Anaphylactic · Neurogenic · Adrenal");

  s.addShape(pres.ShapeType.roundRect, {
    x: 0.2, y: 0.94, w: 12.9, h: 0.45,
    fill: { color: C.orange }, line: { color: C.orange }, rectRadius: 0.1,
  });
  s.addText("🔥  All distributive subtypes share: Hyperdynamic LV · Low/Normal IVC · Vasoplegic state — differentiated by clinical triggers", {
    x: 0.2, y: 0.94, w: 12.9, h: 0.45,
    fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle",
  });

  const subtypes = [
    {
      icon: "🦠", title: "SEPTIC SHOCK",
      color: C.red,
      echo: "Hyperdynamic LV (early)\nSeptic cardiomyopathy (late): reduced EF",
      ivc: "Variable; small early; normal/dilated after resuscitation",
      lung: "A-lines early; B-lines/consolidation if pneumonia or ARDS",
      extra: "Clinical triggers: Fever >38.3°C or <36°C, tachycardia, hypotension. Lactate >2 mmol/L. Source: lung, abdomen, UTI, line.",
      action: "Blood cultures → broad-spectrum ABx within 1h → 30 mL/kg IVF → NE if MAP <65",
    },
    {
      icon: "⚠️", title: "ANAPHYLACTIC SHOCK",
      color: C.yellow,
      echo: "Hyperdynamic LV. High CO. May see Takotsubo-like pattern (rare). No structural abnormality.",
      ivc: "Small, collapsible IVC (massive capillary leak + vasodilation)",
      lung: "B-lines may appear if bronchospasm + ARDS. Airway edema on soft tissue views.",
      extra: "Clinical triggers: Allergen exposure (food, drug, sting). Urticaria, angioedema, bronchospasm. Rapid onset (<30 min).",
      action: "IM Epinephrine 0.3–0.5 mg (1:1000) STAT → IVF → Diphenhydramine + Steroids",
    },
    {
      icon: "🫀", title: "NEUROGENIC SHOCK",
      color: C.green,
      echo: "Normal or hyperdynamic LV. Normal valves. No effusion. Bradycardia on tracing.",
      ivc: "Variable; often small-normal; responds to IVF",
      lung: "Normal (A-lines). Watch for aspiration if cervical SCI.",
      extra: "Clinical: SCI ≥T6, hypotension + BRADYCARDIA (key!). Skin warm and dry (vasodilation without catecholamines). Poikilothermic.",
      action: "IVF resuscitation → Norepinephrine/Phenylephrine → Atropine for bradycardia. MAP target ≥85 mmHg.",
    },
    {
      icon: "💊", title: "ADRENAL/ENDOCRINE SHOCK",
      color: C.purple,
      echo: "Normal LV function. Occasionally mildly reduced contractility (steroid-responsive).",
      ivc: "Small/collapsible (hypovolemia from aldosterone deficiency causing Na/water loss)",
      lung: "Normal (A-lines). No pulmonary edema.",
      extra: "Clinical: Hypotension refractory to IVF + vasopressors. Hyponatremia, hyperkalemia, hypoglycemia. Eosinophilia. Prior steroid use.",
      action: "Hydrocortisone 100 mg IV bolus → D5NS → Do NOT wait for cortisol result if hemodynamically unstable",
    },
  ];

  subtypes.forEach((sub, i) => {
    const x = 0.2 + i * 3.28;
    const w = 3.1;

    // Card background
    s.addShape(pres.ShapeType.roundRect, {
      x, y: 1.48, w, h: 5.75,
      fill: { color: C.bgLight }, line: { color: sub.color, width: 2 }, rectRadius: 0.12,
    });
    // Card header
    s.addShape(pres.ShapeType.roundRect, {
      x, y: 1.48, w, h: 0.58,
      fill: { color: sub.color }, line: { color: sub.color }, rectRadius: 0.12,
    });
    s.addShape(pres.ShapeType.rect, { x, y: 1.78, w, h: 0.28, fill: { color: sub.color }, line: { color: sub.color } });
    s.addText(`${sub.icon}  ${sub.title}`, {
      x, y: 1.48, w, h: 0.58,
      fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle",
    });

    const sections = [
      { label: "ECHO", val: sub.echo },
      { label: "IVC", val: sub.ivc },
      { label: "LUNG", val: sub.lung },
      { label: "TRIGGERS", val: sub.extra },
      { label: "ACTION", val: sub.action },
    ];

    let sy = 2.14;
    sections.forEach((sec) => {
      s.addText(sec.label, {
        x: x + 0.08, y: sy, w: w - 0.16, h: 0.24,
        fontSize: 8.5, bold: true, color: sub.color,
      });
      sy += 0.22;
      const textH = sec.label === "TRIGGERS" || sec.label === "ACTION" ? 0.72 : 0.55;
      s.addText(sec.val, {
        x: x + 0.08, y: sy, w: w - 0.16, h: textH,
        fontSize: 8.5, color: C.dimWhite, valign: "top", fontFace: "Calibri",
      });
      sy += textH + 0.04;
    });
  });
}

// ─── SLIDE 8: Quick Reference Summary Card ────────────────────────────────────
{
  const s = pres.addSlide();
  applyBg(s);
  addHeader(s, "Quick Reference  —  POCUS Shock Summary Card", "Bedside reference · All 4 categories");

  // Big table
  const headers = ["SHOCK TYPE", "CARDIAC ECHO", "IVC", "LUNG", "KEY CLUE", "1st ACTION"];
  const tableData = [
    {
      type: "HYPOVOLEMIC", tc: C.blue,
      echo: "Small LV\nHyperdynamic EF",
      ivc: "Small (<1.5 cm)\nCollapsible >50%",
      lung: "A-lines\n(normal)",
      clue: "Trauma, hemorrhage,\ndehydration history",
      action: "Crystalloid/Blood\n30 mL/kg IVF bolus",
    },
    {
      type: "CARDIOGENIC\n(LV)", tc: C.red,
      echo: "Dilated LV\nEF <30%\nWall motion abnl.",
      ivc: "Dilated\nNon-collapsible",
      lung: "B-lines bilateral\n(pulm. edema)",
      clue: "Chest pain, JVD,\nS3, rales, troponin ↑",
      action: "Identify cause\nPCI if STEMI\nNE + Dobutamine",
    },
    {
      type: "CARDIOGENIC\n(RV)", tc: "C06000",
      echo: "RV:LV >0.9\nD-sign\nMcConnell's sign",
      ivc: "Dilated\nNon-collapsible",
      lung: "A-lines\n(clear)",
      clue: "DVT risk, hypoxia,\nSinus tachycardia\nright heart strain ECG",
      action: "UFH → tPA if massive\nCaution with IVF\nNE vasopressor",
    },
    {
      type: "CARDIAC\nTAMPONADE", tc: C.purple,
      echo: "Pericardial effusion\nRV diastolic collapse\nSwinging heart",
      ivc: "Dilated\nNon-collapsible",
      lung: "A-lines\n(normal)",
      clue: "Beck's triad: JVD\n+ muffled sounds\n+ hypotension. Electrical alternans.",
      action: "Pericardiocentesis\nSTAT + IV fluids\nas bridge",
    },
    {
      type: "TENSION PTX", tc: C.green,
      echo: "Hyperdynamic LV\n(RV compressed)",
      ivc: "Variable",
      lung: "ABSENT sliding\nBarcode M-mode\nLung point present",
      clue: "Unilateral: no breath\nsounds + tracheal\ndeviation (late sign)",
      action: "Needle decompression\n2nd ICS MCL\nNO imaging delay",
    },
    {
      type: "SEPTIC\n(Distributive)", tc: C.orange,
      echo: "Hyperdynamic EF\n(early)\nReduced EF (late)",
      ivc: "Small early\nVariable after IVF",
      lung: "A-lines early\nB-lines if ARDS",
      clue: "Fever, infection\nsource. Lactate >2.\nWarm extremities.",
      action: "Cultures → ABx\n→ 30 mL/kg IVF\n→ NE if MAP <65",
    },
    {
      type: "ANAPHYLACTIC\n(Distributive)", tc: C.yellow,
      echo: "Hyperdynamic EF\nHigh CO",
      ivc: "Small + collapsible\n(capillary leak)",
      lung: "B-lines if severe\nbronchospasm/ARDS",
      clue: "Allergen exposure\nUrticaria, angioedema,\nbronchospasm",
      action: "Epinephrine IM\n0.3 mg (1:1000)\nSTAT + IVF",
    },
    {
      type: "NEUROGENIC\n(Distributive)", tc: "2E7D32",
      echo: "Normal or hyper-\ndynamic. No WMA.",
      ivc: "Small-normal\nResponds to IVF",
      lung: "A-lines (normal)\nWatch for aspiration",
      clue: "SCI ≥T6: BRADYCARDIA\n+ hypotension + warm\n dry skin",
      action: "IVF + NE/Phenylephrine\nAtropine if bradycardia\nMAP target ≥85",
    },
  ];

  const cw = [1.42, 2.1, 1.62, 1.62, 2.38, 2.38];
  const cx = [0.18, 1.62, 3.74, 5.38, 7.02, 9.42];

  // Header row
  headers.forEach((h, ci) => {
    s.addShape(pres.ShapeType.rect, {
      x: cx[ci], y: 1.05, w: cw[ci], h: 0.38,
      fill: { color: C.accent }, line: { color: C.bg },
    });
    s.addText(h, {
      x: cx[ci], y: 1.05, w: cw[ci], h: 0.38,
      fontSize: 9.5, bold: true, color: C.boxText, align: "center", valign: "middle",
    });
  });

  tableData.forEach((row, ri) => {
    const rh = 0.74;
    const ry = 1.45 + ri * rh;
    const rowBg = ri % 2 === 0 ? C.bgLight : "0F2236";

    // Type cell
    s.addShape(pres.ShapeType.rect, {
      x: cx[0], y: ry, w: cw[0], h: rh,
      fill: { color: row.tc }, line: { color: C.bg },
    });
    s.addText(row.type, {
      x: cx[0], y: ry, w: cw[0], h: rh,
      fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle",
    });

    const cells = [row.echo, row.ivc, row.lung, row.clue, row.action];
    cells.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, {
        x: cx[ci + 1], y: ry, w: cw[ci + 1], h: rh,
        fill: { color: rowBg }, line: { color: C.greyDark },
      });
      s.addText(cell, {
        x: cx[ci + 1] + 0.05, y: ry + 0.02, w: cw[ci + 1] - 0.1, h: rh - 0.04,
        fontSize: 8.5, color: C.dimWhite, valign: "middle", fontFace: "Calibri",
      });
    });
  });

  // Footer
  s.addText("POCUS findings must always be interpreted with full clinical context. No single finding is pathognomonic.", {
    x: 0.18, y: 7.2, w: 12.9, h: 0.26,
    fontSize: 9, color: C.grey, align: "center", italic: true,
  });
}

// ─── SLIDE 9: Closing / Key Pearls ────────────────────────────────────────────
{
  const s = pres.addSlide();
  applyBg(s);

  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.bg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 7.5, fill: { color: C.accent } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.12, fill: { color: C.accent } });

  s.addText("Key POCUS Pearls  —  Do Not Miss", {
    x: 0.4, y: 0.2, w: 12.5, h: 0.7,
    fontSize: 26, bold: true, color: C.accent, fontFace: "Calibri",
  });

  const pearls = [
    { icon: "1", color: C.red,    text: "TAMPONADE: RV diastolic collapse is the most sensitive echo sign — even a small effusion can cause tamponade if rapid accumulation." },
    { icon: "2", color: C.green,  text: "TENSION PTX: Treat on CLINICAL grounds BEFORE imaging. Needle decompression saves lives in seconds. Absent lung sliding = act now." },
    { icon: "3", color: C.blue,   text: "HYPOVOLEMIA vs DISTRIBUTIVE: Small + collapsible IVC with hyperdynamic LV appears in both. History and lactate distinguish them." },
    { icon: "4", color: C.orange, text: "SEPTIC SHOCK: Look for septic cardiomyopathy (reduced EF) late in sepsis — the LV can fail after initial hyperdynamic phase." },
    { icon: "5", color: C.pink,   text: "MASSIVE PE: McConnell's sign (akinetic RV free wall, spared apex) has high specificity for PE. D-sign = septal shift = obstructive." },
    { icon: "6", color: C.purple, text: "NEUROGENIC SHOCK: The only shock with BRADYCARDIA. Warm skin + bradycardia + SCI history = neurogenic until proven otherwise." },
    { icon: "7", color: C.yellow, text: "MIXED SHOCK: Always possible — e.g. sepsis + cardiac tamponade in cancer; trauma hemorrhage + myocardial contusion. Reassess after each intervention." },
  ];

  pearls.forEach((p, i) => {
    s.addShape(pres.ShapeType.ellipse, {
      x: 0.35, y: 1.08 + i * 0.84, w: 0.42, h: 0.42,
      fill: { color: p.color }, line: { color: p.color },
    });
    s.addText(p.icon, {
      x: 0.35, y: 1.08 + i * 0.84, w: 0.42, h: 0.42,
      fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle",
    });
    s.addText(p.text, {
      x: 0.88, y: 1.07 + i * 0.84, w: 12.0, h: 0.44,
      fontSize: 11, color: C.dimWhite, valign: "middle", fontFace: "Calibri",
    });
  });

  s.addText("Sources: Rosen's Emergency Medicine 9e  ·  Barash Clinical Anesthesia 9e  ·  Mulholland & Greenfield's Surgery 7e  ·  ACEP POCUS Guidelines", {
    x: 0.4, y: 7.1, w: 12.5, h: 0.3,
    fontSize: 9, color: C.greyDark, align: "center",
  });
}

// ─── Write file ───────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/shock-pocus-flowchart/POCUS_Shock_Decision_Tree.pptx" })
  .then(() => console.log("✅ DONE: POCUS_Shock_Decision_Tree.pptx"))
  .catch(err => { console.error("ERROR:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/shock-pocus-flowchart && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/shock-pocus-flowchart/

Your decision tree flowchart is ready:

POCUS Shock Decision Tree

Presentation · PPTX

(414 KB, 9 slides)

What's Inside

The presentation uses a deep navy + teal color scheme with color-coded shock types throughout:
SlideContent
1Title slide
23-Window POCUS Protocol - Cardiac, IVC, and Lung window assessment
3Master Decision Tree - 5-question sequential flowchart: pericardial effusion → absent lung sliding → RV:LV ratio → LV function → IVC collapsibility → diagnosis
4Obstructive Shock Drill-Down - Tamponade vs Tension PTX vs Massive PE side-by-side with POCUS findings, differentiators, and immediate actions
5Cardiogenic Shock Drill-Down - LV vs RV cardiogenic with full comparison table
6Hypovolemic vs Distributive - Head-to-head panel comparison (IVC, echo, lung, fluid response)
7Distributive Subtypes - Septic, Anaphylactic, Neurogenic, Adrenal - individual cards with ECHO/IVC/Lung/Triggers/Action
8Quick Reference Summary Card - Full 8-row × 6-column bedside reference table
97 Key POCUS Pearls - Must-not-miss clinical tips

Core decision logic on Slide 3:
  1. Pericardial effusion + RV collapse? → Tamponade
  2. Absent lung sliding (barcode sign)? → Tension PTX
  3. RV:LV >0.9 + D-sign + non-collapsible IVC? → Massive PE
  4. EF <30% + dilated LV? → Cardiogenic shock
  5. IVC small + collapsible (CI >50%)? → Hypovolemic; otherwise → Distributive
This is a shared conversation. Sign in to Orris to start your own chat.