flowchart TD
%% Styles
classDef admin fill:#eff6ff,stroke:#3b82f6,stroke-width:2px,color:#1e3a8a,font-weight:bold
classDef employee fill:#f0fdf4,stroke:#22c55e,stroke-width:2px,color:#14532d,font-weight:bold
classDef customer fill:#fdf4ff,stroke:#d946ef,stroke-width:2px,color:#701a75,font-weight:bold
classDef system fill:#fff7ed,stroke:#f97316,stroke-width:2px,color:#7c2d12,font-weight:bold
classDef default fill:#ffffff,stroke:#cbd5e1,color:#334155
subgraph ADMIN_PANEL [Admin Control Center]
Admin[Super Admin]:::admin
HR[Salary & Expenses System]:::admin
Stock[Inventory / Product Master]:::admin
end
subgraph EMP_MODULE [Employee / MR Module]
MR[Medical Rep / Employee]:::employee
Visit[Field Visits & Tracking]:::employee
end
subgraph B2B_MODULE [B2B / Customer Module]
Shop[Shop / Retailer]:::customer
Order[Order Placement]:::customer
end
subgraph SYS_MODULE [System Actions]
Invoice[Invoice Generation]:::system
Payment[Payment Gateway / Razorpay]:::system
end
%% Admin Connections
Admin -->|Creates / Manages| MR
Admin -->|Approves Onboarding| Shop
Admin -->|Updates Pricing/Qty| Stock
%% Employee Connections
MR -->|Onboards / Visits| Shop
MR -->|Logs Activity| Visit
Visit -->|Generates Data For| HR
%% Shop & Order Connections
Shop -->|Browses Products / Brands| Order
Stock -.->|Provides Pricing/Qty| Order
%% Order Processing
Order -->|Triggers| Invoice
Order -->|Deducts| Stock
Order -->|Requires| Payment
%% Post-Order Flow
Payment -->|Status Update| Invoice
Invoice -->|Visible To| Shop
Invoice -->|Monitored By| Admin
Payment -->|Reconciled By| HR
%% Salary Processing
HR -->|Disburses| Salary[Employee Salary]:::employee
MR -->|Receives| Salary