Looking at the monorepo containing two separate Flutter applications in 
- mobile-apps/client-app
- mobile-apps/staff-app
, and I want to configure Codemagic so both apps can be built and distributed to Firebase App Distribution.

Please do the following:
1. propose the best layout for Codemagic workflows.
2. Create three separate pipelines for each application:
   * Development (dev)
   * Staging (stage)
   * Production (prod)
3. Each pipeline must:
   * Build the correct Flutter app inside the monorepo.
   * Use the correct Firebase App Distribution credentials for each environment.
   * Push the built artifacts (Android + iOS if applicable) to the appropriate Firebase App Distribution app.
   * Include environment-specific values (e.g., env variables, bundle IDs, keystore/certs, build flavors).
   * Allow triggering pipelines manually.
4. Generate a complete codemagic.yaml example with:
   * Separate workflows for:
      * `client_app_dev`, `client_app_staging`, `client_app_prod`
      * `client_app_dev`, `client_app_staging`, `client_app_prod`
   * All required steps (install Flutter/Java/Xcode, pub get, build runner if needed, building APK/AAB/IPA, uploading to Firebase App Distribution, etc.).
   * Example Firebase App IDs, release notes, tester groups, service accounts.
   * Proper use of Codemagic encrypted variables.
   * Best practices for monorepo path handling.
5. Add a short explanation of:
   * How each pipeline works
   * How to trigger builds
   * How to update environment variables for Firebase
6. Output the final result as:
   * A complete `codemagic.yaml`
   * A brief guide on integrating it with a monorepo
   * Notes on debugging, caching, and CI/CD optimization
   