flowchart TD
    subgraph "App Initialization"
        A[main.dart] --> B(KrowApp);
        B --> C{MaterialApp.router};
        C --> D[Initial Route: /];
    end

    subgraph "Authentication Flow"
        D --> E(SplashRoute);
        E --> F{SplashRedirectGuard};
        F -- Authenticated --> G(HomeRoute);
        F -- Unauthenticated/Error --> H(SignInFlowRoute);
    end

    subgraph "Sign-In/Welcome Flow"
        H --> I[WelcomeRoute];
        I --> J[SignInRoute];
        J --> K[ResetPassRoute];
        L[Deeplink with oobCode] --> M[EnterNewPassRoute];
        J -- Forgot Password --> K;
        I -- Sign In --> J;
    end

    subgraph "Main Application (Home)"
        G --> G_Tabs((Bottom Navigation));
        G_Tabs -- Events --> Events;
        G_Tabs -- Invoices --> Invoices;
        G_Tabs -- Notifications --> Notifications;
        G_Tabs -- Profile --> Profile;
        G_Tabs -- Create Event --> CreateEvent;
    end

    subgraph "Events Flow"
        Events[EventsFlow] --> Events_List(EventsListMainRoute);
        Events_List --> Events_Event_Details(EventDetailsRoute);
        Events_Event_Details --> Events_Assigned_Staff(AssignedStaffRoute);
        Events_Assigned_Staff --> Events_Clock_Manual(ClockManualRoute);
        Events_Event_Details --> Events_Rate_Staff(RateStaffRoute);
    end

    subgraph "Create Event Flow"
        CreateEvent[CreateEventFlow] --> Create_Event_Edit(CreateEventRoute);
        Create_Event_Edit --> Create_Event_Preview(EventDetailsRoute);
    end

    subgraph "Invoice Flow"
        Invoices[InvoiceFlow] --> Invoice_List(InvoicesListMainRoute);
        Invoice_List --> Invoice_Details(InvoiceDetailsRoute);
        Invoice_Details --> Invoice_Event_Details(EventDetailsRoute);
    end

    subgraph "Notifications Flow"
        Notifications[NotificationFlow] --> Notification_List(NotificationsListRoute);
        Notification_List --> Notification_Details(NotificationDetailsRoute);
    end

    subgraph "Profile Flow"
        Profile[ProfileFlow] --> Profile_Preview(ProfilePreviewRoute);
        Profile_Preview --> Profile_Edit(PersonalInfoRoute);
    end

    style F fill:#f9f,stroke:#333,stroke-width:2px
    style G fill:#bbf,stroke:#333,stroke-width:2px
    style H fill:#bbf,stroke:#333,stroke-width:2px
    style L fill:#f9f,stroke:#333,stroke-width:2px
