# Build brief (shared by every implementer)

App: "Shreeji Workflow", Laravel 13 + Filament 5.10 + Livewire 4 + Tailwind v4 (Vite). Production tracking for a jewellery workshop: orders → items → job cards → lots → stages, departments, vendors, attendance, reports, licensing.

## What to build
The owner approved a page-by-page design audit. It lives in a Claude Doc:
- container `{"kind":"project","id":"5e7b300e-ddb4-4066-b266-45d877db3ad3"}`, prose node `ec6e8d12-cb68`
- read it with `mcp__Claude_Docs__read(ref={"object":"node","id":"ec6e8d12-cb68"}, container=..., engine="prose", payload={"kind":"view"})` (follow `next` until complete) or `{"kind":"search","text":"<ID prefix>"}`.
- First read the two opening sections: "How this audit was done, and the rules every page follows" (colours, type, spacing, Excel-grade tables, components) and "Order stages: a better way to see them" (the item × stage grid, the department strip, the production grid, the route line). Every page must follow them.
- Then implement EVERY row of the sections assigned to you (IDs like OL-3, QUEUE-14). P0, P1 and P2 all approved.

## Already done for you (do not redo, do not fight it)
Committed foundation in `resources/css/app.css`, `app/Providers/Filament/AppPanelProvider.php`, `app/Support/UiDefaults.php`:
- Status colours: info = blue = in progress; warning = amber = waiting / on hold; danger = red = late / failed; success = green = ready / done; vendor = violet = at vendor; gray = neutral. Brand (primary) = orange, used only for primary buttons, active menu, links, focus. Never use primary or warning for "in progress".
- Breadcrumbs are off panel-wide (add a small "‹ Back to …" link on detail pages yourself where the audit asks).
- Compact page header, 36 px menu items, 40 px table rows (`.fi-ta-text` padding), outline badges, tables default to 50 per page with a labelled "Filters" button, primary buttons brand-700/white (light) and brand-500/near-black (dark).

## Rules
1. **Do not break logic.** Workflow actions (app/Actions/Workflow/*, TakeStage, CompleteStage, RollBackStage, VendorWork, Holds, auto-assign), permissions/policies, licence read-only mode and data writes must behave exactly as before unless a row explicitly asks for a behaviour change. Read the code before changing it. Prefer changing presentation.
2. **Own only your files** (listed in your task). Do NOT edit: `resources/css/app.css`, `resources/js/app.js`, `app/Providers/**`, `lang/**`, `composer.*`, `package*.json`, `config/**`, `routes/**`, migrations of other areas. If you need a change there (a route, a setting key, a translation, a migration), make it in a NEW file where possible (e.g. a new migration file named for your area) or describe it precisely in your final message. Page-specific styling goes in your Blade views as Tailwind utility classes (the Tailwind build scans resources/views and app/Filament).
3. Wrap every new user-facing string in `__()`; list the new strings in your final message (Hindi gets added centrally).
4. **Log everything that did not exist before** (new screen, column, button, setting, behaviour, permission, migration, computed number) in `docs/new-features/<your-area>.md` as a table: `| # | Feature | Where | Why (audit ID) | How it was tested |`. If writing that file is refused, put the table in your final message instead.
5. **Test sequentially.** For every new feature or behaviour change add Pest tests in `tests/Feature/<Area>RedesignTest.php` (tests use in-memory SQLite: see existing tests in tests/Feature for factories/seed helpers). Also re-run the FULL suite (`php vendor/bin/pest --compact`) before you finish; it must stay green (71 tests passed at baseline). Then check your pages visually (below) in light AND dark at 1366×768 and 390×844 and fix what looks wrong.
6. Keep queries efficient at 2-year volume (6,250 orders, 68,000 items, 413,000 lot stages): eager-load, aggregate in SQL, no N+1, paginate.
7. Commit your work on your branch with clear messages when done (`git add -A && git commit`).

## Setting up your worktree (vendor, node_modules and .env are not in git)
```
ln -s /home/claude/app/vendor vendor
ln -s /home/claude/app/node_modules node_modules
cp /home/claude/app/.env .env
mkdir -p storage/framework/{cache/data,sessions,views} storage/logs bootstrap/cache
npx vite build            # only needed for visual checks (public/build is not committed)
php artisan optimize:clear
```
Visual checks: start your own server on YOUR port (given in your task) against the shared MySQL test database (2 years of data; writes are fine):
`PHP_CLI_SERVER_WORKERS=4 php artisan serve --port=<PORT> --no-reload > /tmp/srv-<PORT>.log 2>&1 &` (run with run_in_background). Log in as owner `audit` / `audit12345` (test-only credentials for this local test server). Other test logins: supervisor `mock.cast.1`, worker `mock.pol.2`, dispatch `mock.pack.2`, all with password `mock-pass-2026`. Playwright is installed (`require('playwright')`, `chromium.launch()`); theme is chosen with `localStorage.setItem('theme','light'|'dark')` via addInitScript. Example script: /tmp/claude-0/t/shot.js (edit the port). Kill your server when done.

## Final message
Branch name and last commit; what you built per audit ID (one line each, mark any row you could not do and why); the new-features table; new strings; anything you need changed in files you don't own.
