# UAE Property Strategy Tool. Master Prompt.

Generate an interactive UAE property investment strategy tool as a single self-contained HTML file.

The tool has two parts: a **form** and a **generated output**.

---

## Form (four sections)

1. **About You.** Name, age, nationality, employment status, UAE residency status (pill selector: UAE Resident / Non-Resident / Planning to Relocate), and an open text field for goals and context.

2. **Capital & Capacity.** Available capital today (AED), monthly investing capacity (AED), existing UAE properties owned, existing mortgage debt.

3. **Goals & Strategy.** Target portfolio value (AED), investment timeline (years), primary goal (pill selector: Capital Appreciation / Rental Income / Balanced), risk appetite (pill selector: Conservative / Moderate / Aggressive), strategy preference (pill selector: Off-Plan Focused / Ready Properties / Mixed).

4. **Your Market Assumptions.** Six sliders the user controls entirely: annual capital appreciation %, gross rental yield %, off-plan launch-to-handover gain %, mortgage interest rate %, booking deposit %, and transaction fees %. No market data is hardcoded. All projections derive purely from the user's slider inputs.

Below the form is a **Generate My Strategy** button. On click, the tool computes and renders:

- A **summary strip** of four stat cards (total capital, LTV rate based on residency, portfolio target, leverage multiple required).
- A **3-phase roadmap** with dynamically generated text and bullet points drawn from the user's actual input values, not template copy.
- A **year-by-year projection table** (Year, Cumulative Cash Invested, Properties Held, Gross Portfolio Value, Mortgage Balance, Net Equity, Estimated Rental Income) computed by a JavaScript simulation model that correctly times off-plan handovers, equity release via mortgage, and reinvestment cycles.

---

## Projection Model. Calculation Rules.

The JavaScript simulation must follow these rules precisely. Each rule addresses a specific bug to avoid.

### Payment plan structure (per property)

- **Year 0 (booking):** investor pays `bookingPct% + feesPct%` of purchase price from available cash.
- **Years 1 to N minus 1 (construction):** investor pays `5% of purchase price per year` in instalments, deducted from that year's monthly savings before any surplus is added to cash.
- **Year N (handover):** remaining developer balance (`= 100% minus bookingPct% minus 5% times construction years`) is settled via a bank mortgage. Mortgage = handover value times LTV. Cash released = mortgage minus remaining developer balance.

### Off-plan appreciation. No double-counting.

- Off-plan properties are **held at purchase price** in the model until handover. Do not apply annual growth during construction.
- `offPlanGain%` is applied **once only**, at the handover event: `handoverValue = purchasePrice times (1 + offPlanGain/100)`.
- Annual growth (`annualGrowth%`) applies **only to completed properties**, starting the year after handover, compounding each year: `value *= (1 + growth/100)`.

### Monthly savings. Net of instalment obligations.

- Each year, the cash added from savings = `max(monthly times 12 minus active construction instalments, 0)`.
- Active construction instalments = sum of `purchasePrice times 5%` for each property currently under construction (bought but not yet handed over).
- `cumulativeInvested` tracks total gross savings committed (`capital + monthly times 12 times year`) regardless of where the cash went. This is the investor's total cash outlay.

### New property acquisition. Dual affordability constraint.

When deciding whether and how large a new purchase is, apply both constraints and take the minimum:

- **Deposit constraint:** `maxByDeposit = deployableCash / (bookingPct% + feesPct%)`.
- **Income constraint:** `maxByIncome = freeMonthlySavingsPA / 5%` where free savings = `monthly times 12 minus existing instalment obligations`.
- Only proceed if the resulting property value is greater than or equal to AED 400,000.
- Always maintain a minimum AED 50,000 cash reserve. Never buy if doing so would breach the reserve.
- Cap simultaneous off-plan properties under construction at 2.

### Net equity. Accounts for all outstanding obligations.

`Net Equity = Gross Portfolio Value minus Bank Mortgages minus Remaining Developer Balances`

Remaining developer balance per off-plan property:

- `paidFraction = bookingPct% + 5% times min(yearsSincePurchase, constructionYears minus 1)`
- `remainingDevBalance = purchasePrice times max(1 minus paidFraction, handoverBalancePct)`
- This balance reaches zero at handover (replaced by the bank mortgage).

The **Mortgage Balance** column in the table shows bank mortgages only. Net Equity uses total debt (mortgages plus developer balances). A table footnote explains the difference.

---

## Design System

- **Background:** `#E8DFD0` (cream), `#DDD4C5` (card fill), `#D0C5B2` (alternate rows).
- **Headings:** Instrument Serif (Google Fonts). Section titles, phase titles, output header.
- **Body:** Satoshi (Fontshare). All paragraph and label text.
- **Data:** JetBrains Mono (Google Fonts). All numbers, table cells, range values, form labels, toolbar.
- **Accent:** `#3E1F1F` (burgundy). Key italic phrases (`<em class="k">`), borders, range thumbs, phase card left border, generate button.
- Pill selectors styled as mono-font toggle buttons. Selected state fills burgundy.
- Range sliders styled with a burgundy thumb and live value display.

---

## Behaviour

- Output section hidden on load. Appears and scrolls into view after Generate is clicked.
- All phase text and projection numbers update from inputs on each generation.
- Residency status automatically sets LTV (75% resident, 50% non-resident).
- No external API calls, no hardcoded market data, no clipboard export required.
