# Mail stores (Zustand)

## Persisted (`debounced-json-storage` / `persist`)

- `mail-store` — read/star/important overrides, label edits, recent folder visits
- `mail-settings-store` — density, conversation mode, sort, display prefs
- `nav-store` — sidebar folder/label tree, disabled nav labels
- `account-store` — active account
- `scheduled-store` — scheduled send queue

## Ephemeral UI (session only)

- `mail-search-store` — search input, dropdown, filter chips before URL submit
- `mail-ui-store` — shell chrome: sidebar collapsed, mobile search overlay, folder unread badges

## Rules

- **URL is source of truth** for folder, inbox tab, page, open message (`useMailRoute` + `mail-url.ts`)
- **Search results** use query params on `/mail/search` (`SearchParams`); bar/overlay state syncs via `submitMailSearch` in `lib/mail-search/navigate.ts`
- Do not persist ephemeral UI unless product explicitly requires it
