Closing won: AR invoice + journal entry auto-post

When you flip an Opportunity to stage "Closed Won," Turtini automatically creates an AR invoice and a balanced journal entry. No double entry — close the deal, and the accounting side is recorded the same second.

What happens on Closed Won:
1. An AR invoice is created in `arInvoices` with status `sent`
• Invoice number is auto-assigned in the format `AR-000123` (per-org sequence)
• Issued date = today; due date = today + 30 days (your terms)
• Single line item using the opportunity name + amount
2. A balanced journal entry is posted to the GL
• DR 1100 (Accounts Receivable) for the opportunity amount
• CR 4000 (Revenue — Services) for the same amount
• If `4000` is missing, Turtini falls back to the first active revenue account in your chart whose code starts with `4`
3. `arInvoiceId` + `accountingPostedAt` are stamped back on the opportunity for idempotency
4. An "AR Invoice ... auto-created on Closed Won" event lands on the opportunity timeline

What sources this works for:
The trigger fires regardless of how the opportunity got there:
• Native CRM (manual create or scanned quote)
• Salesforce sync (real-time CDC or scheduled)
• HubSpot sync (scheduled)
• Dynamics or Zoho sync (scheduled)
• Wally tool calls (`opportunity_updateStage`)

If a synced opportunity is marked won upstream, the next sync into Turtini moves the stage to Closed Won and the AR post follows on its own.

Idempotency — re-saving doesn't double-post:
The trigger short-circuits if:
• Stage was already Closed Won before this save (no `not-CW → CW` transition)
• `arInvoiceId` is already set on the opportunity
• `orgId` is missing
• `amountQuote` is zero or missing
• `orgs/{orgId}.modules.accounting` is not enabled

This means you can re-save a Closed Won opportunity all day without triggering another invoice. To actually re-issue, manually create a new AR invoice in Accounting.

What if Closed Won is wrong?
Flip the stage back. The auto-post does NOT auto-reverse — that would be too easy to abuse. To unwind:
1. Move the opportunity back to your prior stage (Propose, Negotiation, etc.)
2. Go to Accounting → AR → find the auto-created invoice (search by `AR-000xxx` or by the opportunity name in the memo) → void or delete it
3. The GL entry follows the AR doc lifecycle — voiding the invoice reverses the GL post
4. Clear `arInvoiceId` on the opportunity if you want the auto-post to re-fire on the next Closed Won

What this is NOT:
• A revenue recognition engine. The single GL entry is cash-basis style. For ASC 606 or any deferred-revenue treatment, post the deferred entries from Accounting and the auto-post becomes the trigger, not the final state.
• A Salesforce/HubSpot writeback. The AR invoice exists in Turtini; nothing is pushed back to the upstream CRM.
• An invoice send. The AR invoice is `status: sent` from a ledger standpoint, but no email goes out until you click "Email invoice" in Accounting → AR.

Audit trail:
The activity timeline on the opportunity shows the auto-AR with the invoice number + GL entry id. The AR invoice itself carries `sourceOpportunityId` so you can reverse-link. The journal entry references `sourceType: 'ar'` and `sourceId: {arInvoiceId}`.