## Purpose

Getting accurate guest data out of the system for caterers, venues, and record-keeping — filtered, Excel-safe for Bangla text, streamed at scale, and always audited.

## ADDED Requirements

### Requirement: Filtered CSV download (FR-5.1, FR-5.2, P0)
A "Download CSV" action on the dashboard and guest table SHALL export rows respecting the currently applied filters, with columns: `guest_id, full_name, email, phone, whatsapp, side, group_tags, event, status, party_size, adults, children, dietary_notes, message_to_couple, invited_via, invited_at, opened_at, responded_at, cancelled_at, last_reminder_sent_at, notes`.

#### Scenario: Filtered export
- **WHEN** the guest table is filtered to event=Walima, status=accepted and CSV is downloaded
- **THEN** the file contains only accepted Walima invitations with exactly the specified columns

### Requirement: Excel-safe encoding and naming (FR-5.3, FR-5.4, P0)
Exports SHALL be UTF-8 with BOM so Bangla names render correctly in Microsoft Excel, with filename `guests_{event}_{status}_{YYYY-MM-DD_HHmm}.csv`. CSV values are properly escaped (quotes, commas, newlines).

#### Scenario: Bangla names in Excel
- **WHEN** an export containing Bangla names is opened in Excel
- **THEN** the names render correctly (BOM present)

### Requirement: One-click preset exports (FR-5.5, P1)
The system SHALL offer one-click "Caterer list" (accepted only: name, party size, dietary notes) and "Full list" exports.

#### Scenario: Caterer list
- **WHEN** the admin clicks "Caterer list" for an event
- **THEN** the file contains only accepted guests with name, party size, and dietary notes

### Requirement: Streaming large exports (FR-5.6, P1)
Exports over 5,000 rows SHALL stream rather than buffering in memory.

#### Scenario: Large export
- **WHEN** an export of >5,000 rows is requested
- **THEN** the response streams progressively without exhausting server memory

### Requirement: Export auditing (FR-5.7, P0)
Every export SHALL write an audit log entry recording who exported, what filters, when, and the row count — this is personal data leaving the system. Export endpoints are auth-gated.

#### Scenario: Export logged
- **WHEN** any CSV export completes
- **THEN** an audit entry exists with admin identity, filter used, and row count

### Requirement: XLSX option (FR-5.8, P2)
The system SHALL offer an XLSX export variant of the same data.

#### Scenario: XLSX download
- **WHEN** the admin chooses XLSX format
- **THEN** an .xlsx file with the same columns is produced
