# Smart Enterprise CRM Execution Prompt

Act as a senior Laravel CRM architect, product designer, database engineer, QA
lead, and bilingual UX reviewer. The goal is not to add screens; the goal is to
turn every visible CRM area into real business capability for a large company.

## Product rule

Every sidebar item and every Add/Edit/View action must be backed by:

- A real route, controller, model, migration, request validation, and Blade view.
- Server-side permission checks and branch isolation.
- A deterministic reference generator where records need human-facing numbers.
- Feature tests for create, read, invalid cross-branch access, and invalid related
  IDs.
- English and Arabic labels.

Never leave placeholder modules, dead links, `href="#"`, fake metrics, or buttons
that do not complete a workflow.

## Differentiating intelligence

Build explainable intelligence before external AI integrations. The first smart
layer must calculate record health using visible signals:

- Missing owner.
- Missing email or phone.
- Missing company relationship.
- Missing next action or follow-up.
- Missing decision maker under a company.
- Unqualified high-value leads.
- Stale records with no recent activity.

Show the score and recommended next action inside the record page. Keep the logic
deterministic and testable. Later, this can be extended into AI summaries,
duplicate detection, next-best-action, forecast risk, account coverage gaps, and
customer health scoring.

## Current execution order

1. Repair navigation and mobile menu behavior.
2. Replace generic Contacts with full CRUD and company linking.
3. Add Smart Assistant scoring to Companies and Contacts.
4. Move Leads to collision-safe references and branch-safe owner validation.
5. Implement lead conversion into Company, Contact, and Opportunity inside a
   transaction.
6. Replace Opportunities placeholder with pipeline CRUD and stage history.
7. Add Activities as the universal task/call/meeting/reminder layer.
8. Add customer timeline, audit log, and reports based on real data.

## Acceptance gate

After every slice, run migrations, automated tests, and asset build. A slice is
not complete until the user can open the sidebar item, click Add, save a valid
record, see it in the list, open details, edit it, and be blocked from another
branch's records.
