The issue is that you are using classDef end but then using class Z1,Z2,Z3,Z4,Z5,Z6,Z7 terminus; instead of class Z1,Z2,Z3,Z4,Z5,Z6,Z7 end;.
You should be consistent in your class definition and usage. Here is the corrected code:
graph TD
%% Define Nodes with clear labels
subgraph "Phase 1: Application Intake & Initial Fingerprint Submission"
A["1.1 Applicant/Agency Submits Application <br/> (Experience Cloud Portal)"] --> B{"1.1 System Creates Applicant Profile <br/> (Public Sector Solutions)"};
B --> C["1.2 Applicant Receives Live Scan Instructions <br/> (Experience Cloud Portal / Email)"];
C --> D["1.2 Applicant Goes to Live Scan Center <br/> (External Action)"];
end
subgraph "Phase 2: Fingerprint Results & Initial System Processing"
D --> E{"2.1 Fingerprint Results Received by CPMS <br/> (MuleSoft Integration)"};
E --> F{"2.1 System Attaches Results to Profile <br/> (Salesforce Automation)"};
F --> G{"2.1 Auto-Run AARS Check <br/> (MuleSoft Integration)"};
G --|"No AARS Match
& No Criminal History"|--> H["2.2 Auto-Clear Case <br/> (Agentforce / Flow)"];
H --> I["2.2 Auto-Generate & Deliver Clearance Letter <br/> (DocuSign Gen / Digital Engagement)"];
H --> J["2.2 Update Case Status: 'Cleared to Work' <br/> (Salesforce Flow)"];
G --|"Full/Partial AARS Match"|--> K["2.3 Assign to Registry Research Unit (RRU) <br/> (Service Cloud Queue)"];
F --|"Fingerprints Rejected by DOJ/FBI"|--> P["2.4 Auto-Generate Rejection Notice & Instructions <br/> (DocuSign Gen / Digital Engagement)"];
P --> Q["2.4 Applicant Resubmits Fingerprints (Back to Phase 1/D)"];
F --|"Criminal History Found
& No AARS Match"|--> L["2.3 Interpret Criminal History & Sort Case Type <br/> (Agentforce / Flow)"];
L --> M["2.3 Assign to Relevant Case Processing Unit <br/> (Service Cloud Queue)"];
end
subgraph "Phase 3: Case Processing Workflows (Analyst-Driven Decision Making)"
J --> Z1("Case Concluded (Cleared)");
K --> N["3.3 RRU Analyst Reviews AARS Match <br/> (AARS Integration)"];
M --> O["3.2 Analyst Reviews Case <br/> (Standard Exemption/CACI)"];
N --> P1{"3.3 Decision: True AARS Match?"};
O --> P2{"3.2 Investigation & Legal Review"};
P1 --|"No True Match
& No Criminal History"|--> I1["Auto-Clear & Letter (via 2.2 I)"];
P1 --|"No True Match
& With Criminal History"|--> M1["Assign to Case Processing Unit (via 2.3 M)"];
P1 --|"True Match"|--> N1["3.3 Review Prior Admin Action & Determine Status"];
P2 --|"Legal Recommends Clearance"|--> I2["Clearance Letter (via 3.2 I)"];
P2 --|"Legal Recommends Negative Outcome"|--> O1["3.2 Statement of Facts Workflow <br/> (Salesforce Approvals / Flow)"];
N1 --> R1["3.3 Send AARS Outcome Letter"];
O1 --> S1["3.2 Generate Legal Case Tracking # & Update LCTS <br/> (MuleSoft Integration)"];
S1 --> T1["3.2 Send Decision Letter (Negative)"];
R1 --> Z2("Case Concluded (AARS Decision)");
T1 --> Z3("Case Concluded (Negative Decision)");
M --|"DSS Clearance/Simplified"|--> U["3.1 Analyst Auto-Generates Clearance Letter"];
U --> V["3.1 Update Status: 'Cleared to Work'"];
V --> Z4("Case Concluded (DSS/Simplified)");
M --|"Mixed Case"|--> W["3.4 Assign to Multiple Units for Parallel Review"];
W --> X{"3.4 Compile Final Decision <br/> (Complex Logic)"};
X --|"Clearance"|--> V1["Update Status: 'Cleared to Work' (via 3.1 V)"];
X --|"Negative"|--> T11["Send Decision Letter (Negative) (via 3.2 T1)"];
M --|"Conditional Exemption"|--> Y["3.5 Set Up Conditional Approval"];
Y --> Y1["Transfer Conditions with Exemption"];
Y1 --> Z5("Case Concluded (Conditional)");
M --|"Transfer Exemption"|--> Z["3.6 Process Transfer Request"];
Z --> Z_1["Apply Transfer Rules & Notify"];
Z_1 --> Z6("Case Concluded (Transfer)");
M --|"IHSS Workflow"|--> Z_2["3.7 IHSS Application Review & Decision"];
Z_2 --> Z_3["Generate IHSS Outcome Letter"];
Z_3 --> Z7("Case Concluded (IHSS)");
end
%% Legend
classDef subprocess fill:#f9f,stroke:#333,stroke-width:2px;
classDef decision fill:#ccf,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
classDef external fill:#afa,stroke:#333,stroke-width:2px;
classDef system fill:#ddf,stroke:#333,stroke-width:2px;
classDef end fill:#ffb,stroke:#333,stroke-width:2px,font-weight:bold;
class A,B,C,E,F,G,H,I,J,K,L,M,N,O,P,P1,P2,N1,O1,S1,U,V,W,X,Y,Y1,Z,Z_1,Z_2,Z_3,R1,T1,I1,M1,I2,V1,T11 system;
class D external;
class Z1,Z2,Z3,Z4,Z5,Z6,Z7 end;