iBilik Capital Project 05 - Approval Workflow Full v1.0

Scope
-----
Deal Risk Ready -> Approval Submission -> Sequential Maker/Checker Approval -> APPROVED -> Financial Snapshot

Schema Freeze
-------------
No new tables.
No new columns.
No migration SQL.

Uses existing tables
--------------------
approval_authorities
approvals
deals
deal_status_history
deal_financial_snapshots
calculation_runs
calculation_outputs
calculation_golden_validations
waterfall_schedules
waterfall_schedule_lines
policy_exceptions
deal_scores
hard_gate_results
stress_tests
watchlist_cases
permission_catalog
audit_logs

New runtime components
----------------------
/src/Approval/ApprovalService.php
/deal/approval-center.php
/deal/approval-authorities.php
/deal/approval.php

Workflow rules
--------------
1. Only UNDERWRITING Deals can be submitted.
2. RiskService::decisionSummary must report ready_for_approval=true.
3. A confirmed formal UNDERWRITING/RECALC Formula run with Golden PASSED is mandatory.
4. At least one active Approval Authority must match the Deal requested amount.
5. Matching authorities become sequential approval steps.
6. Previous steps must be APPROVED before a later step can be decided.
7. A normal USER who created the Deal cannot approve the same Deal (Maker/Checker).
8. A normal USER must hold the approval authority's required permission code.
9. If an authority has no required permission, that authority is Super-Admin-only.
10. REJECT leaves the Deal in UNDERWRITING so it can be corrected and resubmitted.
11. Final approval re-checks Risk readiness before committing approval.
12. Final approval automatically changes Deal UNDERWRITING -> APPROVED.
13. Final approval creates an immutable deal_financial_snapshots record referencing the confirmed Formula run.
14. Deal master data, Product Terms and formal recalculation are locked while an approval cycle is pending.
15. PREVIEW calculation remains allowed during pending approval because it does not alter the submitted formal decision basis.

Approval Authority setup
------------------------
Super Admin opens /deal/approval-authorities.php.
Each authority defines:
- authority code
- Chinese name
- minimum amount
- maximum amount
- required permission code (optional; blank = Super Admin only)
- active/inactive

Overlapping authority ranges intentionally create multiple sequential steps.
This supports cumulative approval chains without adding schema.

Project boundary
----------------
Project 05 ends at Deal APPROVED + approved financial snapshot.
Deal ACTIVE is intentionally reserved for Project 06 Disbursement & Collection.
