flowchart TD
    subgraph "Stage 1: Isolated Analysis"
        subgraph "Stage 1A: Job Analysis"
            A1[Job Description Input] --> A2[Job Analysis LLM]
            A2 --> A3[Job Requirements JSON]
        end
        
        subgraph "Stage 1B: Candidate Analysis"
            B1[Resume & Context Input] --> B2[Candidate Analysis LLM]
            B2 --> B3[Candidate Qualifications JSON]
        end
        
        subgraph "Stage 1C: Mapping Analysis"
            C1[Job Requirements JSON] --> C2[Candidate Qualifications JSON]
            C2 --> C3[Mapping Analysis LLM]
            C3 --> C4[Skills Mapping JSON]
        end
    end
    
    subgraph "Stage 2: Resume Generation"
        D1[Skills Mapping JSON] --> D2[Original Resume Reference]
        D2 --> D3[Resume Generation LLM]
        D3 --> D4[Tailored Resume Draft]
    end
    
    subgraph "Stage 3: Verification"
        E1[Skills Mapping JSON] --> E2[Original Materials]
        E2 --> E3[Tailored Resume Draft]
        E3 --> E4[Verification LLM]
        E4 --> E5{Verification Check}
        E5 -->|PASS| E6[Approved Resume]
        E5 -->|FAIL| E7[Correction Instructions]
        E7 --> D3
    end
    
    A3 --> C1
    B3 --> C2
    C4 --> D1
    D4 --> E3
    
    style A2 fill:#f9d77e,stroke:#333,stroke-width:2px
    style B2 fill:#f9d77e,stroke:#333,stroke-width:2px
    style C3 fill:#f9d77e,stroke:#333,stroke-width:2px
    style D3 fill:#f9d77e,stroke:#333,stroke-width:2px
    style E4 fill:#f9d77e,stroke:#333,stroke-width:2px
    style E5 fill:#a3e4d7,stroke:#333,stroke-width:2px
    style E6 fill:#aed6f1,stroke:#333,stroke-width:2px
    style E7 fill:#f5b7b1,stroke:#333,stroke-width:2px