# BOQ Project-Specific Items Enhancement

## Summary

Enhance the Project-Specific Items tab in the `ItemSelector` component (used in BOQ create/edit) to support category-wise grouping with accordion view, Select All at global and category levels, and code sorting.

## Current State

- `ItemSelector` has two tabs: "Master Items" (flat table + category filter + global Select All) and "Project-Specific" (flat table, no categories, no Select All)
- Project-specific items in the selector lack category grouping, bulk selection, and code sorting
- `CategoryAccordion` component exists but is typed for master items (ProjectItem shape), not PS items

## Design

### Component Changes

#### `ItemSelector.tsx`
- **New prop:** `onSelectAllProjectItems(itemIds: string[])`
- **View toggle:** Flat / Category toggle within the Project-Specific tab
- **Flat View:** Existing table + global Select All checkbox in header + items sorted by code asc + category badge column
- **Accordion View:** 
  - Global "Select All (#) items" checkbox above category sections
  - Category sections sorted by display order, each with: expand/collapse header, per-category Select All, item count, selection count
  - Items within each section sorted by code ascending
  - No inline qty/rate editing (handled in Selected Items card below)

### Parent Page Changes

Both `boq/new/page.tsx` and `boq/[bundleId]/edit/page.tsx`:
- Add `handleSelectAllProjectItems` handler (parallel pattern to `handleSelectAllMasterItems`)
- Pass new handler to `ItemSelector`

### Files Modified

| File | Change |
|---|---|
| `src/components/items/item-selector.tsx` | ~+150 lines |
| `src/app/(dashboard)/boq/new/page.tsx` | ~+30 lines |
| `src/app/(dashboard)/boq/[bundleId]/edit/page.tsx` | ~+30 lines |

### Data Flow

```
Parent (BOQ page)
  |-- selectedProjectItems: Map<string, SelectedProjectItem>
  |-- onToggleProjectItem(item) -> toggle in map
  |-- onSelectAllProjectItems(ids) -> bulk add/remove from map
  |
  ItemSelector
    |-- Flat view: table with header checkbox -> selectAll
    |-- Accordion view: category sections with per-category checkboxes
    |-- Both views read from same selectedProjectItems map
```

### Selection Logic

- Global Select All: if all filtered items selected, deselect all; else select all unselected
- Category Select All: same logic scoped to that category's items
- Individual toggle: unchanged

### No Schema Changes

No database schema, router, or service layer changes needed. All changes are UI-only.
