```mermaid
---
title: 0.超级密码设置与使用流程
---
flowchart TD
    Start((开始))
    --> Login[使用超级管理员账号登录]

    Login --> IsSuperAdmin{是否为超级管理员?}
    IsSuperAdmin -->|是| HasAccess[拥有操作权限]
    IsSuperAdmin -->|否| NoPermission[无权限，流程终止]

    HasAccess --> EnterSuperAdminPage[进入超级密码设置页面]
    EnterSuperAdminPage --> CheckStatus[查询超级密码是否已设置]
    CheckStatus --> ChooseAction{选择操作}

    subgraph PasswordSettingFlow[超级密码设置流程]
        ChooseAction -->|首次设置| FirstSet[输入新密码与确认密码]
        ChooseAction -->|重置密码（可随时）| ResetPassword[输入新密码与确认密码]

        FirstSet --> ValidateInput{密码是否通过校验?}
        ResetPassword --> ValidateInput

        ValidateInput -->|否| InputInvalid[提示错误并重新输入]
        InputInvalid --> FirstSet

        ValidateInput -->|是| SavePassword[保存超级密码]
        SavePassword --> SetSuccess[超级密码设置成功]

        SetSuccess -.->|后续可随时重置| ChooseAction
    end

    subgraph PasswordUseFlow[超级密码使用流程-代理线下充值确认]
        CreateOfflineOrder[创建代理线下充值订单]
        CreateOfflineOrder --> ConfirmOperatorCheck{确认操作者是否超级管理员?}

        ConfirmOperatorCheck -->|否| NoPermission
        ConfirmOperatorCheck -->|是| InputSuperPassword[输入超级密码进行二次确认]

        InputSuperPassword --> VerifyPassword{超级密码校验是否通过?}
        VerifyPassword -->|否| VerifyFail[校验失败，禁止确认到账]
        VerifyFail --> InputSuperPassword

        VerifyPassword -->|是| ConfirmOfflineRecharge[确认线下充值到账]
        ConfirmOfflineRecharge --> UpdateRechargeStatus[系统完成充值入账并更新记录]
        UpdateRechargeStatus --> RechargeSuccess[线下充值确认成功]
    end

    SetSuccess -.-> CreateOfflineOrder
    RechargeSuccess --> End([流程结束])

    %% ==================== 样式美化 ====================
    style Start fill:#90EE90,stroke:#2E7D32,stroke-width:2px
    style End fill:#FF9999,stroke:#C62828,stroke-width:2px
    style NoPermission fill:#FFCDD2,stroke:#D32F2F
    style HasAccess fill:#C8E6C9,stroke:#388E3C
    style InputInvalid fill:#FFCCBC,stroke:#E64A19
    style VerifyFail fill:#FFCCBC,stroke:#E64A19

    classDef decision fill:#FFF3E0,stroke:#F57C00,stroke-width:2px
    class IsSuperAdmin,ChooseAction,ValidateInput,ConfirmOperatorCheck,VerifyPassword decision
```
