diff --git a/CLAUDE.md b/CLAUDE.md
index f886483..e4d5e79 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -378,6 +378,14 @@ git config user.email 'mikaels.claude.agent@efforting.tech'
---
+## UI structure
+
+See [`ui-structure.md`](ui-structure.md) for the full inventory of sections,
+widget patterns, dialogs, templates, and a taxonomy of primitives relevant to
+designing a higher-level UI representation.
+
+---
+
## Known limitations / planned rewrite notes
See [`future-plans.md`](future-plans.md) for full detail. Key points relevant
diff --git a/ui-structure.md b/ui-structure.md
new file mode 100644
index 0000000..fbd9458
--- /dev/null
+++ b/ui-structure.md
@@ -0,0 +1,362 @@
+# UI Structure
+
+Current UI inventory — sections, widgets, templates, and recurring patterns.
+Intended as a reference for the rewrite and for defining a higher-level UI
+representation.
+
+---
+
+## Navigation
+
+Top bar with 7 section buttons + a maintenance dropdown (⚙):
+
+| Button | Section | Default? |
+|--------|---------|----------|
+| Components | Split-pane list/detail | ✓ |
+| Inventory | Table | |
+| Fields | Table | |
+| Grids | Tabbed (Grids / Source images) + sub-views | |
+| Templates | Card list | |
+| Bins | Tabbed (Bins / Source images / Types) | |
+| Images | Admin list | |
+
+Maintenance dropdown (not a section):
+- Generate missing PDF thumbnails
+- Remove orphaned source image entries
+
+---
+
+## Sections
+
+### Components
+**Layout:** Resizable split-pane (width persisted in localStorage)
+
+**Left — master list:**
+- Search input (filters by name + field values)
+- Quick-add input (creates component inline)
+- List of `t-component-row` items (name + colored field-value badge tags)
+
+**Right — detail panel:**
+- Placeholder when nothing selected
+- When selected: name, description, Edit / Duplicate / Delete actions
+ - Fields block — name/value rows
+ - Images block — thumbnail gallery + upload button
+ - Files block — linked PDFs + file picker button
+ - Inventory block — location entries (each with edit/delete) + add button
+
+**Dialogs opened from here:** component edit, field create, inventory entry, file
+picker, confirm delete
+
+---
+
+### Inventory
+**Layout:** Toolbar + table
+
+- Filter: text search + location-type dropdown (All / Physical / BOM / Digital / Grid)
+- Table columns: Component | Type | Location/Ref | Qty | Notes | Actions (edit, delete)
+- Component name cells are links → `/components/:id`
+- Grid location cells link to the grid viewer at that cell
+- "+ Add entry" button in toolbar
+
+**Dialogs opened from here:** inventory entry edit/create, confirm delete
+
+---
+
+### Fields
+**Layout:** Toolbar + table
+
+- Table columns: Name | Unit | Description | Actions (edit, delete)
+- "+ Add field" button in toolbar
+
+**Dialogs opened from here:** field edit/create, confirm delete
+
+---
+
+### Templates
+**Layout:** Toolbar + card list
+
+- Cards show: name, formatter JS code (read-only `
`), edit/delete actions
+- "+ Add template" button
+- Live preview panel in the edit dialog
+
+**Dialogs opened from here:** template edit/create, confirm delete
+
+---
+
+### Grids
+**Layout:** Tabbed, plus three full-page sub-views (not dialogs)
+
+**Tab: Grids**
+- Grid cards (image grid preview, name, delete)
+- Draft cards (unprocessed setups, badge "Draft")
+- "+ New grid" button → wizard dialog
+
+**Tab: Source images**
+- Source image gallery (`t-source-card`)
+- "+ Upload" button
+
+**Sub-view: Panel manager** (replaces main content)
+- Editable grid of panel slots — each slot is a photo region
+- Header with grid name, Cancel / Process buttons
+
+**Sub-view: Grid setup** (replaces main content)
+- Canvas corner editor (`Grid_Setup` class) with pan/zoom
+- Right panel: cell size info, action buttons, progress
+
+**Sub-view: Grid viewer** (replaces main content)
+- Full grid of cell thumbnails
+- Click cell → cell inventory overlay (non-modal panel)
+- Header with Edit panels / Delete actions
+
+**Dialogs opened from here:** new grid wizard, source picker, confirm delete
+
+---
+
+### Bins
+**Layout:** Tabbed
+
+**Tab: Bins**
+- Gallery of `t-bin-card` items (processed image or "Not processed" indicator)
+- Click Edit (✎) → bin editor dialog
+
+**Tab: Source images**
+- Filtered source gallery (uses includes 'bin')
+- Each card has a "+ Bin" button to create a bin from that source
+
+**Tab: Types**
+- List of `t-bin-type-row` items (name, dimensions, description)
+- Edit / delete per row
+- "+ Add type" button
+
+**Dialogs opened from here:** bin editor, bin type edit/create, bin content
+add/edit, field create, confirm delete
+
+---
+
+### Images
+**Layout:** Admin list
+
+- One row per source image: thumbnail, filename, dimensions, uses checkboxes
+ (grid / bin, toggleable), delete button
+- Purpose: correct mislabeled source images
+
+---
+
+## Widget Patterns
+
+These are the recurring structural widgets across the app. Listing all instances
+makes the taxonomy visible and suggests what a higher-level UI DSL would need to
+express.
+
+---
+
+### Split pane (master/detail)
+A resizable two-column layout. Left = filterable list. Right = detail view of
+selected item, or a placeholder.
+
+| Instance | Left | Right |
+|----------|------|-------|
+| Components | Component list + search | Detail panel (fields, images, files, inventory) |
+
+Currently only one instance. The pattern is general enough to reuse for grids,
+bins, etc.
+
+---
+
+### Tabbed section
+A tab bar that switches between content panels within the same section. Tab state
+can be reflected in the URL (`/bins/sources`, `/grids/sources`).
+
+| Instance | Tabs |
+|----------|------|
+| Grids section | Grids \| Source images |
+| Bins section | Bins \| Source images \| Types |
+| Bin editor dialog | Fields \| Contents |
+
+---
+
+### Table view
+Toolbar (search/filter + action button) + `
` with rows and per-row
+edit/delete icon buttons.
+
+| Instance | Row content |
+|----------|-------------|
+| Inventory | Component, type badge, location ref, qty, notes |
+| Fields | Name, unit, description |
+
+---
+
+### Card gallery
+A wrapping grid of cards. Each card has a visual element (image or preview),
+a title, and action buttons.
+
+| Instance | Card type | Visual |
+|----------|-----------|--------|
+| Grid list | `t-grid-card` | Multi-thumbnail preview |
+| Bin gallery | `t-bin-card` | Processed image or placeholder |
+| Source image gallery | `t-source-card` | Photo thumbnail |
+| Template list | `t-template-card` | Formatter code `` |
+
+---
+
+### List row with actions
+A horizontal row with info spans on the left and icon buttons on the right. Used
+in data-table rows and standalone list elements.
+
+| Instance | Info shown |
+|----------|------------|
+| Inventory table rows | Component, type, location, qty, notes |
+| Field table rows | Name, unit, description |
+| Bin type rows | Name, dimensions, description |
+| Bin content rows | Name/component, qty, notes |
+| Image admin rows | Thumbnail, filename, dimensions, uses checkboxes |
+
+---
+
+### Field editor (dynamic rows)
+A list of label + text input + remove button rows, plus an "add field" dropdown
+and "New…" button. Shared across component edit, bin edit, and bin type edit via
+`build_field_editor()`.
+
+| Instance | Host |
+|----------|------|
+| Component edit dialog | `#c-field-rows` |
+| Bin editor — Fields tab | `#bin-field-rows` |
+| Bin type dialog | `#bt-field-rows` |
+
+---
+
+### Modal dialog
+`