%%{init: {'themeVariables': {'fontSize': '26px'}}}%%
flowchart LR
    L1["1.<br/>Authentication"]
    L2["2.<br/>Identity + Role"]
    L3["3.<br/>Capability"]
    L4["4.<br/>Agent Grant"]
    L5["5.<br/>Execution Mode"]

    subgraph OUT[" "]
        direction TB
        APPROVE["Human<br/>review"]
        EXEC["Execute<br/>+ log"]
        LOG["Reject<br/>+ log"]
        APPROVE -->|approved| EXEC
        APPROVE -->|rejected| LOG
    end

    L1 --> L2 --> L3 --> L4 --> L5
    L5 -->|immediate| EXEC
    L5 -->|proposal| APPROVE

    classDef layer fill:#dbeafe,stroke:#1e3a5f,color:#0f172a,stroke-width:1.5px
    classDef success fill:#dcfce7,stroke:#166534,color:#0f172a,stroke-width:1.5px
    classDef warning fill:#fef3c7,stroke:#92400e,color:#0f172a,stroke-width:1.5px
    classDef danger fill:#fee2e2,stroke:#b91c1c,color:#0f172a,stroke-width:1.5px

    class L1,L2,L3,L4,L5 layer
    class EXEC success
    class APPROVE warning
    class LOG danger
