# F-103 — Implementer notes

## Scope
Batch of user-reported fixes: product editor layout, AI feedback, orders list,
category AI content + emoji/colors, log viewer sizing.

## Changes
- Backend:
  - `migrations/034_category_description_colors.js`: categories gain description, bg_color, text_color.
  - `src/shared/ai-content.ts`: shared generateWithModel + aiTextToHtml (plain text -> <p>/<ul>, sanitizes HTML) + settings loaders.
  - catalog generate-seo: AI description now requested/stored as formatted HTML (aiTextToHtml), SEO fields tag-stripped.
  - categories: description/bgColor/textColor in domain/repo/routes/serializer; new admin-only POST /categories/:id/generate-seo (fills empty description/seoTitle/seoDescription via configurable prompts).
  - store-settings: ai_category_description_prompt / ai_category_seo_title_prompt / ai_category_seo_description_prompt keys.
  - orders: GET /orders returns {items,total} with status/q/limit/offset; PgOrderRepository.search with parameterized SQL + LEFT JOIN identity_users for email search.
- Admin:
  - ProductEditor: slug first + disabled/auto, Nombre + ⭐ destacado on one row, Marca/Canal/Caducidad 3-col, AI-generation banner + button feedback.
  - Categories page: emoji picker grid, card color presets + bg/text color pickers with preview, description hint, AI generation with spinner feedback.
  - Settings IA tab: 3 new category prompt fields.
  - ServerLogViewer: max 200 lines; logs page fixed to viewport height with internal scrollbar.
  - api-client: orders list normalizes array|object; categoriesApi.generateSeo; StoreSettings fields; Category bgColor/textColor.
- Frontend/storefront:
  - formatRichText helper + .rich-text CSS; applied to all product description renders.
  - Categories pages/cards use bgColor/textColor inline styles with fallback to legacy tailwind color.
  - Category detail shows description; storefront product page uses formatted HTML; meta strips tags.

## Verification
- Backend typecheck/tests/build green; admin/frontend/storefront builds green.
- Migration 034 applied; services restarted healthy; orders search verified (total=1, state/q filters).
