Skip to content

Self-improving AI Employees for everyone

docs(theme): hex + color-mix token migration notes; 64px square node

trohitgbba60447509f
diff --git a/CLAUDE.md b/CLAUDE.md
index c3d8d7f7..3cb2d573 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -12,7 +12,7 @@ This is a React Flow-based workflow automation platform implementing n8n-inspire
| **[Frontend Architecture](./docs-internal/frontend_architecture.md)** | Current frontend stack (React 19 + Vite + Tailwind v4 + shadcn/ui + Radix + RHF/zod + TanStack Query + Zustand). Tokens, primitives, forms, credentials exemplar, ownership boundary, `uiHints` catalogue. |
| **[UI Migration Plan](./docs-internal/ui_migration_plan.md)** | antd → shadcn/ui migration plan + completion log. Waves 1–10 done. Full frontend is schema-driven (backend SSOT); remaining DIY widget registry (ex-Phase 6) is the one deferred item. |
| **[Node Allowlist](./docs-internal/node_allowlist.md)** | Single-config UI visibility — `server/config/node_allowlist.json` controls which nodes / credential categories / skill folders show in the UI. Five lists with two enforcement tiers (mode-gated allowlist + absolute blocklist). `useNodeAllowlist` hook exposes `isVisible` / `isBlocked` / `isAllowed` / `isCredentialCategoryDisabled` / `isSkillFolderDisabled`. Adding a new disabled domain = single JSON edit, no code change. |
-| **[Theme System](./docs-internal/theme_system.md)** | 10-way visual theme system — 5 utopian (light, dark, renaissance, greek, edo, steampunk, atomic) + 5 dystopian (cyber, wasteland, rot, plague, surveillance) — driven by `<html data-theme>` + per-theme CSS files in `client/src/themes/`. Token taxonomy (surface / fg / border / accent / typography / motion), shadcn HSL-triplet bridge, action role tokens, decorative-layer wrappers (`.app-frame` / `.canvas-host` / `.modal-frame`), per-component decorative ornaments (panel textures + canvas decorations + node pseudo-element overlays + theme-specific keyframes), **canvas-node visual contract via `--node-color` CSS custom property** (no inline `background` / `border` on node components — base.css + per-theme CSS owns visuals; `NodeStyle` helper type at [types/NodeTypes.ts](./client/src/types/NodeTypes.ts) makes the inline custom-prop typecheck-clean), **`--node-pulse-color` separate from `--node-color`** so executing-node glow uses each theme's highest-contrast accent regardless of plugin accent (Cyber neon cyan, Surveillance REC red, Renaissance ultramarine, etc.), **`data-page-hidden` animation pause** (toggled by Dashboard's `visibilitychange` listener; base.css declares `html[data-page-hidden] *, *::before, *::after { animation-play-state: paused !important }` to prevent compositor stall on tab return), **per-theme icon glyph system** (290 SVGs across 29 keys × 10 themes via [themedGlyphs.ts](./client/src/assets/icons/themedGlyphs.ts) + theme-aware [NodeIcon.tsx](./client/src/assets/icons/NodeIcon.tsx)), **per-theme canvas-grid + custom cursors** via `--canvas-grid` / `--cursor-default` slots, **decorative HTML primitives** (`<SvgFilterDefs>` mounting `#ink-blot` / `#noise` / `#crt` filter IDs at app root, `<DropCap>` wrapper for Renaissance ornament rule), **parameter panel migrated to Tailwind tokens** (no `useAppTheme()` reads; section headers carry the display-typography triplet; raw `<Button>` swapped to `<ActionButton intent>`), **per-theme scrollbar webkit rules** in all 10 themes, 9-event WebAudio sound system (10 packs via `--sound-pack` token + `useSound()` hook + global hover delegate + sonner toast monkey-patch + `withSound()` HOC + `Sounds.unlock()` gesture-unlock for AudioContext autoplay-policy compliance), `@media (prefers-reduced-motion: reduce)` accessibility, 30 ms throttle on `type` / `hover`, migration recipe, anti-patterns. Read this before adding a new theme, migrating a component to the new contract, or adding a canvas-node component. |
+| **[Theme System](./docs-internal/theme_system.md)** | 10-way visual theme system — 5 utopian (light, dark, renaissance, greek, edo, steampunk, atomic) + 5 dystopian (cyber, wasteland, rot, plague, surveillance) — driven by `<html data-theme>` + per-theme CSS files in `client/src/themes/`. Token taxonomy (surface / fg / border / accent / typography / motion) in **hex + `color-mix()`**; `@theme inline` bridge maps `--color-X: var(--X)` (no `hsl()` wrapper); per-theme files own the colour hex, base.css owns the shared `--tint-*` alpha scale; action role tokens (incl. `-ink` readable text), per-theme `--pulse-keyframe` animation system + `.machina-*` helpers in `animations.css`, decorative-layer wrappers (`.app-frame` / `.canvas-host` / `.modal-frame`), per-component decorative ornaments (panel textures + canvas decorations + node pseudo-element overlays + theme-specific keyframes), **canvas-node visual contract via `--node-color` CSS custom property** (no inline `background` / `border` on node components — base.css + per-theme CSS owns visuals; `NodeStyle` helper type at [types/NodeTypes.ts](./client/src/types/NodeTypes.ts) makes the inline custom-prop typecheck-clean), **`--node-pulse-color` separate from `--node-color`** so executing-node glow uses each theme's highest-contrast accent regardless of plugin accent (Cyber neon cyan, Surveillance REC red, Renaissance ultramarine, etc.), **`data-page-hidden` animation pause** (toggled by Dashboard's `visibilitychange` listener; base.css declares `html[data-page-hidden] *, *::before, *::after { animation-play-state: paused !important }` to prevent compositor stall on tab return), **per-theme icon glyph system** (290 SVGs across 29 keys × 10 themes via [themedGlyphs.ts](./client/src/assets/icons/themedGlyphs.ts) + theme-aware [NodeIcon.tsx](./client/src/assets/icons/NodeIcon.tsx)), **per-theme canvas-grid + custom cursors** via `--canvas-grid` / `--cursor-default` slots, **decorative HTML primitives** (`<SvgFilterDefs>` mounting `#ink-blot` / `#noise` / `#crt` filter IDs at app root, `<DropCap>` wrapper for Renaissance ornament rule), **parameter panel migrated to Tailwind tokens** (no `useAppTheme()` reads; section headers carry the display-typography triplet; raw `<Button>` swapped to `<ActionButton intent>`), **per-theme scrollbar webkit rules** in all 10 themes, 9-event WebAudio sound system (10 packs via `--sound-pack` token + `useSound()` hook + global hover delegate + sonner toast monkey-patch + `withSound()` HOC + `Sounds.unlock()` gesture-unlock for AudioContext autoplay-policy compliance), `@media (prefers-reduced-motion: reduce)` accessibility, 30 ms throttle on `type` / `hover`, migration recipe, anti-patterns. Read this before adding a new theme, migrating a component to the new contract, or adding a canvas-node component. |
| **[Design System Bundle](./docs-internal/design-system/IMPLEMENTATION.md)** | Canonical, vendored design-system reference (extracted from this repo; see its `IMPLEMENTATION.md` for the contract). Tokens are **hex + `color-mix()`** (`tokens/{colors,typography,spacing,motion,fonts,base}.css`) — the format the live codebase standardizes on. Includes 34 reference components (`components/`, inline-style reference only — recreate in Tailwind/shadcn idioms), full-app UI kit (`ui_kits/machinaos/index.html`), and 12-theme docs (`guidelines/THEMES.md`, `reference/themes/`). Copy token values verbatim; do not re-derive by eye. Pairs with [Theme System](./docs-internal/theme_system.md). |
| **[Schema Source of Truth RFC](./docs-internal/schema_source_of_truth_rfc.md)** | Backend is SSOT for node schemas, visual metadata, handlers, palette metadata, icons. Plugin pattern: one `BaseNode` subclass in `server/nodes/<group>/<plugin>/__init__.py`. Wire format: `asset:<key>` / `<lib>:<brand>` / URL / emoji. Endpoint: `/api/schemas/nodes/{type}/spec.json`. Live invariant total via `pytest --collect-only`. |
| **[Plugin System (Wave 11)](./docs-internal/plugin_system.md)** | Class-based plugin-first architecture. `BaseNode` / `ActionNode` / `TriggerNode` / `ToolNode` + `@Operation` decorator. Pydantic `Params`/`Output`. Declarative `Routing` DSL + `Connection` facade (Nango pattern). 18 `Credential` subclasses live in each node folder's `_credentials.py` (or inline for single-use). `TaskQueue` constants route to Temporal worker pools. Plugins live across 9 queues (live count via `glob server/nodes/**/__init__.py`); handler bodies fully inlined (`services/handlers/` shrank 12.8K → 1.1K LOC across 16 → 4 files; only cross-cutting orchestration remains: `tools.py` AI-tool dispatch + agent delegation, `google_auth.py`, `triggers.py`). **Wave 11.H added "self-contained plugin folders"** — up to six generic registries (`ws_handler_registry`, `register_router`, `event_waiter.{register_filter_builder,register_trigger_precheck}`, `status_broadcaster.register_service_refresh`, `node_output_schemas.register_output_schema`) so rich plugins like telegram own their entire surface area without core-services edits. |
@@ -672,7 +672,7 @@ AI model nodes route through `SquareNode` via `Dashboard.tsx`'s `COMPONENT_BY_KI
### Theme System
-Single source of truth: [client/src/index.css](./client/src/index.css). All tokens are HSL channel triplets (no `hsl()` wrapper) so Tailwind composes alpha via `bg-primary/50`, `text-foreground/80`, etc.
+Token VALUES are **hex + `color-mix()`** (not HSL triplets) and live in the per-theme files: [light.css](./client/src/themes/light.css) / [dark.css](./client/src/themes/dark.css) own the shadcn + dracula + node + action colour hex; [base.css](./client/src/themes/base.css) owns the shared scale / chrome / shadow / type tokens **plus the `--tint-*` alpha scale — the single home for `color-mix` percentages** (consumers reference `var(--tint-X)`; skins keep only their bespoke decorative alphas inline). [index.css](./client/src/index.css) is **plumbing-only**: its `@theme inline` bridge maps `--color-X: var(--X)` (NO `hsl()` wrapper). Tailwind v4 still composes alpha (`bg-primary/50`, `text-foreground/80`) by wrapping any colour in `color-mix()`, so utilities work against hex. Action intents also expose an **`--action-X-ink`** readable-text variant (light: a darkened accent; dark: the raw accent) — `ActionButton` reads `text-action-X-ink`. The **animation system** — per-theme `--pulse-keyframe` / `--pulse-duration` / `--pulse-timing` tokens, the executing + trigger keyframes, and the `.machina-pulse` / `.machina-trigger-armed` / `.machina-bolt` / `.machina-crt` / `.machina-scanline` helpers — lives in [animations.css](./client/src/themes/animations.css); base.css's `.executing` rule reads `var(--pulse-keyframe)` so a theme switches its pulse by overriding one token. Trigger nodes show a distinct continuous `.machina-trigger-armed` "listening" heartbeat (waiting state) vs the one-shot execution pulse, with the ⚡ badge pulsing via `.machina-bolt`.
**Token tiers** (pick the most specific that fits):
@@ -682,10 +682,10 @@ Single source of truth: [client/src/index.css](./client/src/index.css). All toke
- `bg-node-X-soft` — tinted surface (cards, tinted backgrounds)
- `border-node-X-border` — tinted outline
Themes redefine these in their own scope without touching call sites. **Never use opacity arithmetic at the call site** (`bg-node-agent/10`); add a new `-soft` / `-border` variant if you need a different opacity.
-3. **Action role tokens** — `--action-run`, `--action-stop`, `--action-save`, `--action-config`, `--action-secret`, `--action-tools`. Same `base / -soft / -hover / -border` quartet as `--node-X` (e.g. `bg-action-run-soft text-action-run border-action-run-border`, plus `hover:bg-action-run-hover` for the hover state). Used for toolbar icon buttons, File menu items, and as the underlying tokens behind `<ActionButton>`'s `intent` variants. Themes redefine these without touching call sites. The `-hover` triplet means ActionButton no longer composes hover via opacity arithmetic.
+3. **Action role tokens** — `--action-run`, `--action-stop`, `--action-save`, `--action-config`, `--action-secret`, `--action-tools`. `base / -soft / -hover / -border / -ink` set (e.g. `bg-action-run-soft text-action-run-ink border-action-run-border`, plus `hover:bg-action-run-hover`). `-ink` is the readable label colour (light: darkened accent; dark: raw accent). Used for toolbar icon buttons, File menu items, and as the tokens behind `<ActionButton>`'s `intent` variants. Themes redefine these without touching call sites; ActionButton composes hover via `-hover` (no opacity arithmetic).
4. **Dracula raw accents** — `--dracula-green/purple/pink/cyan/red/orange/yellow`. Same value across light + dark themes. Used as the underlying palette that `--action-X` and `--node-X` reference; do not consume directly in components — go through the semantic role token instead.
-**Action buttons** — use [ActionButton](./client/src/components/ui/action-button.tsx) (CVA primitive with semantic `intent` variants: `run | stop | save | config | secret | tools`). Each intent reads the matching `--action-X` quartet (`-soft` for resting bg, `-hover` for hover bg, `-border` for outline, base for text). Disabled state is the shadcn-idiomatic `disabled:opacity-50` on the base class (one rule, all intents) — never per-token opacity arithmetic. Replaces the old `actionButtonStyle()` helper. Credential-modal panels (`OAuthConnect`, `EmailPanel`, `QrPairingPanel`, `ActionBar`) consume `<ActionButton>` directly; their `ActionDef` carries an `intent` key, not a free-form colour.
+**Action buttons** — use [ActionButton](./client/src/components/ui/action-button.tsx) (CVA primitive with semantic `intent` variants: `run | stop | save | config | secret | tools`). Each intent reads the matching `--action-X` set (`-soft` for resting bg, `-hover` for hover bg, `-border` for outline, `-ink` for the label text). Disabled state is the shadcn-idiomatic `disabled:opacity-50` on the base class (one rule, all intents) — never per-token opacity arithmetic. Replaces the old `actionButtonStyle()` helper. Credential-modal panels (`OAuthConnect`, `EmailPanel`, `QrPairingPanel`, `ActionBar`) consume `<ActionButton>` directly; their `ActionDef` carries an `intent` key, not a free-form colour.
**Canvas-wide animations** — [client/src/styles/canvasAnimations.ts](./client/src/styles/canvasAnimations.ts) owns the `@keyframes` + `.react-flow__edge.{status}` + `.react-flow__node.{status}` rules injected once into Dashboard's `<style>` tag. Three named groups (`KEYFRAMES`, `edgeStatusStyles`, `nodeStatusStyles`) -- adding a new keyframe or status visual is a single-file change. Per-node inline animations (border pulse on `isExecuting`, etc.) live in their components and read theme tokens directly. Light/dark distinction lives entirely in `theme.ts` — `buildCanvasStyles(colors)` is single-arg and the file ships zero hardcoded hex colours; `CanvasStatusColors` carries `edgeDefault | edgeSelected | edgeExecuting | edgeCompleted | edgeError | edgePending | edgeMemoryActive | edgeToolActive`. The `nodeGlow` keyframe consumes scoped `--node-glow` / `--node-glow-soft` vars so one keyframe serves both themes.
diff --git a/client/src/styles/theme.ts b/client/src/styles/theme.ts
index 4082b073..82cb8755 100644
--- a/client/src/styles/theme.ts
+++ b/client/src/styles/theme.ts
@@ -272,8 +272,8 @@ export const theme = {
// Node sizes (fixed per industry standard)
nodeSize: {
- square: '60px', // SquareNode
- squareIcon: '28px', // Icon inside square node
+ square: '64px', // SquareNode (design-system spec: 64px box)
+ squareIcon: '28px', // Icon inside square node (≈ 0.44 × box)
toolkitWidth: '120px', // ToolkitNode width (rectangular, wider)
toolkitHeight: '50px', // ToolkitNode height (shorter)
handle: '8px', // Connection handles
diff --git a/docs-internal/frontend_architecture.md b/docs-internal/frontend_architecture.md
index 52f18a2c..eec5c9b5 100644
--- a/docs-internal/frontend_architecture.md
+++ b/docs-internal/frontend_architecture.md
@@ -189,9 +189,9 @@ client/src/
## Tokens + theming
-The frontend ships **10 themes** organised utopian / dystopian: `light` · `dark` · `renaissance` · `greek` · `edo` · `steampunk` · `atomic` · `cyber` · `wasteland` · `rot` · `plague` · `surveillance`. Active theme is `<html data-theme="...">` set by `<ThemeProvider>` (see [contexts/ThemeContext.tsx](../client/src/contexts/ThemeContext.tsx)). Per-theme blocks live in [client/src/themes/](../client/src/themes/); shadcn-aliased HSL triplets in [src/index.css](../client/src/index.css). Full token contract, sound + decorative-layer wiring, and the 10-theme migration playbook in **[theme_system.md](./theme_system.md)** — read that before adding a theme or migrating a component.
+The frontend ships **10 themes** organised utopian / dystopian: `light` · `dark` · `renaissance` · `greek` · `edo` · `steampunk` · `atomic` · `cyber` · `wasteland` · `rot` · `plague` · `surveillance`. Active theme is `<html data-theme="...">` set by `<ThemeProvider>` (see [contexts/ThemeContext.tsx](../client/src/contexts/ThemeContext.tsx)). Per-theme blocks live in [client/src/themes/](../client/src/themes/) and own all colour VALUES as **hex + `color-mix()`** (never HSL triplets); [src/index.css](../client/src/index.css) is **plumbing-only** (the `@theme inline` `var()` bridge — no literal colours). Full token contract, sound + decorative-layer wiring, and the 12-theme migration playbook in **[theme_system.md](./theme_system.md)** — read that before adding a theme or migrating a component.
-Single source of truth for the bridge: [src/index.css](../client/src/index.css).
+The bridge ([src/index.css](../client/src/index.css)) maps each Tailwind colour token to a raw `var(--X)`.
```css
@import "tailwindcss";
@@ -200,67 +200,47 @@ Single source of truth for the bridge: [src/index.css](../client/src/index.css).
@plugin "@tailwindcss/typography";
@custom-variant dark (&:is(.dark *));
-:root, [data-theme="light"] {
- --background: 218 22% 97%;
- --foreground: 214 11% 12%;
- --primary: 221 83% 53%;
- --destructive: 0 74% 51%;
- --success: 161 94% 30%;
- --warning: 32 95% 44%;
- --info: 192 91% 36%;
- --border: 216 12% 84%;
- --radius: 0.5rem;
+/* Colour VALUES live in client/src/themes/*.css as hex + color-mix() — NOT here.
+ * light.css defines them on bare :root (global); dark.css + the 10 skins override. */
+:root, :root[data-theme="light"] { /* client/src/themes/light.css */
+ --background: #f5f7fa; --foreground: #1a1d21; --primary: #2563eb;
+ --destructive: #dc2626; --success: #059669; --border: #d1d5db; --radius: 0.5rem;
/* Dracula action palette, same across themes */
- --dracula-green: 135 94% 65%;
- --dracula-purple: 265 89% 78%;
- /* ...pink, cyan, red, orange, yellow */
-
- /* Node-type role tokens — base + soft (tinted bg) + border (tinted outline).
- * Themes redefine these in their own scope; call sites use bg-node-X /
- * bg-node-X-soft / border-node-X-border directly with no opacity arithmetic. */
- --node-agent: 265 89% 78%;
- --node-agent-soft: 265 89% 78% / 0.08;
- --node-agent-border: 265 89% 78% / 0.3;
- --node-model: 191 97% 77%; /* + -soft / -border */
- --node-skill: 135 94% 65%; /* + -soft / -border */
- --node-tool: 135 94% 65%; /* + -soft / -border */
- --node-trigger: 326 100% 74%; /* + -soft / -border */
- --node-workflow: 27 100% 71%; /* + -soft / -border */
+ --dracula-green: #50fa7b; --dracula-purple: #bd93f9; /* …pink, cyan, red, orange, yellow */
+
+ /* Node + action role tokens: color-mix over the dracula base + the shared
+ * --tint-* alpha scale (base.css). Call sites use bg-node-X / -soft /
+ * border-node-X-border + text-action-X-ink directly — no opacity arithmetic. */
+ --node-agent: var(--dracula-purple);
+ --node-agent-soft: color-mix(in srgb, var(--dracula-purple) var(--tint-soft), transparent);
+ --node-agent-border: color-mix(in srgb, var(--dracula-purple) var(--tint-border), transparent);
+ --action-run: var(--dracula-green);
+ --action-run-soft: color-mix(in srgb, var(--dracula-green) var(--tint-action-soft), transparent);
+ --action-run-ink: #15803d; /* readable label; dark themes use var(--action-run) */
}
-/* Dark + the 8 designed themes each ship their own per-theme block.
- * Every block redeclares the shadcn HSL triplets for the bridge AND
- * the new-contract tokens (--bg-app, --fg-default, --font-display,
- * --sound-pack, etc.) the migrated chrome consumes via Tailwind's
- * --color-bg-app etc. utilities. See client/src/themes/<name>.css for
- * the full 10-block set + theme_system.md for the contract. */
-[data-theme="dark"] {
- --background: 192 100% 11%; /* Solarized base03 */
- --foreground: 60 30% 96%; /* Dracula fg */
- --primary: 205 69% 49%; /* Solarized blue */
- --destructive: 1 71% 52%; /* Solarized red */
- /* ...etc */
+[data-theme="dark"] { /* client/src/themes/dark.css — colour-hex overrides */
+ --background: #002b36; /* Solarized base03 */
+ --foreground: #f8f8f2; /* Dracula fg */
+ --primary: #268bd2; /* Solarized blue */
+ /* …etc; node/action tokens inherit light.css's :root (identical in dark) + -ink overrides */
}
-@theme inline {
- --color-background: hsl(var(--background));
- --color-foreground: hsl(var(--foreground));
- --color-primary: hsl(var(--primary));
- --color-destructive: hsl(var(--destructive));
- --color-success: hsl(var(--success));
- --color-warning: hsl(var(--warning));
- --color-info: hsl(var(--info));
- --color-dracula-green: hsl(var(--dracula-green));
- /* ...etc */
+@theme inline { /* client/src/index.css — bridge ONLY, no values */
+ --color-background: var(--background); /* NO hsl() wrapper */
+ --color-primary: var(--primary);
+ --color-node-agent-soft: var(--node-agent-soft);
+ --color-action-run-ink: var(--action-run-ink);
+ /* …every --color-X maps a raw var(--X) */
}
```
Rules:
-1. **HSL triplets, no `hsl()` wrapper.** Tailwind composes alpha via `bg-primary/50`.
+1. **Hex + `color-mix()`; bridge maps `--color-X: var(--X)`** (no `hsl()` wrapper). Tailwind v4 still composes `/opacity` (`bg-primary/50`) via `color-mix` for any colour format.
2. **shadcn's variable names win** (`--background`, `--primary`, `--destructive`, etc.) so every shadcn-generated file resolves against our palette with no re-wiring.
3. Theme switches via `[data-theme="<name>"]` set by `<ThemeProvider>`. Themes whose backgrounds are dark (`dark`, `cyber`, `wasteland`, `rot`, `surveillance`, `steampunk`) also flip Tailwind's `.dark` class so legacy `dark:` variants resolve correctly. The 10-way `THEME_OVERRIDES` map in [hooks/useAppTheme.ts](../client/src/hooks/useAppTheme.ts) layers per-theme accents (primary, focus, action colours, edge palette) on top of `lightColors` / `darkColors` for canvas surfaces.
-4. `styles/theme.ts` exports `lightColors` / `darkColors` base packs + raw `dracula` / `solarized` palette constants. Consumed only by `useAppTheme` (overlay merge) and canvas node components for inline per-definition gradients. New code uses Tailwind classes (`bg-primary`, `bg-action-run-soft`, `bg-node-agent-soft`, `bg-bg-app`, `text-fg-default`) or `hsl(var(--...))` inline. Palette names (`text-dracula-green`) are forbidden in components — go through the matching `--action-X` or `--node-X` semantic role token.
+4. `styles/theme.ts` exports `lightColors` / `darkColors` base packs + raw `dracula` / `solarized` palette constants. Consumed only by `useAppTheme` (overlay merge) and canvas node components for inline per-definition gradients. New code uses Tailwind classes (`bg-primary`, `bg-action-run-soft`, `bg-node-agent-soft`, `bg-bg-app`, `text-fg-default`) or `var(--...)` inline. Palette names (`text-dracula-green`) are forbidden in components — go through the matching `--action-X` or `--node-X` semantic role token.
### Token tier — pick the most specific that fits
@@ -499,7 +479,7 @@ The DIY widget registry (RHF + zod + a tester+rank dispatch) is modeled on n8n's
## Theme + canvas chrome
-[index.css](../client/src/index.css) also styles React Flow, scrollbars, and dot grid against the CSS-var palette. No inline hex codes in theme-sensitive surfaces — everything references `hsl(var(--...))` so dark mode flips cleanly.
+[index.css](../client/src/index.css) also styles React Flow, scrollbars, and dot grid against the CSS-var palette. No inline hex codes in theme-sensitive surfaces — everything references `var(--...)` so themes flip cleanly.
## Build + dev
diff --git a/docs-internal/theme_system.md b/docs-internal/theme_system.md
index 38681077..fb22ba7b 100644
--- a/docs-internal/theme_system.md
+++ b/docs-internal/theme_system.md
@@ -14,27 +14,23 @@ This document is the playbook for working in the design system: token taxonomy,
## Architecture at a glance
```
-client/src/themes/
-├── base.css neutral defaults (space, radii, motion easings, sound pack hint)
-├── light.css :root + :root[data-theme="light"] — new contract values
-├── dark.css .dark + :root[data-theme="dark"] — new contract values
-├── renaissance.css :root[data-theme="renaissance"] — full palette + shadcn bridge
-├── greek.css :root[data-theme="greek"] — lapis + oxblood on marble
-├── edo.css :root[data-theme="edo"] — washi + sumi + vermillion
-├── steampunk.css :root[data-theme="steampunk"] — brass + copper on leather
-├── atomic.css :root[data-theme="atomic"] — atomic orange on cardstock
-├── cyber.css :root[data-theme="cyber"] — neon over void
-├── wasteland.css :root[data-theme="wasteland"] — ochre + radioactive scrap
-├── rot.css :root[data-theme="rot"] — moss bloom in crypt
-├── plague.css :root[data-theme="plague"] — woodcut quarantine
-└── surveillance.css :root[data-theme="surveillance"] — REC red + phosphor
-
-client/src/index.css
-├── @layer base :root — shadcn HSL-triplet tokens (light defaults) + dracula raw
-├── @layer base .dark — shadcn HSL-triplet tokens (dark overrides)
-└── @theme inline { … } — Tailwind v4 utility bindings for both contracts
- (--color-bg-app, --color-fg-default, --color-border-default,
- --font-display, --font-body, etc.)
+client/src/themes/ (colour VALUES are hex + color-mix(); never HSL triplets)
+├── base.css shared scalars: space / radii / chrome / shadow / type scale, motion
+│ easings, the --tint-* alpha scale (single home for color-mix %), node visuals
+├── light.css :root + :root[data-theme="light"] — light colour hex: shadcn + dracula
+│ + node + action (+ -ink); defined on bare :root so they apply globally
+├── dark.css .dark + :root[data-theme="dark"] — dark colour-hex overrides (+ -ink, shadows)
+├── renaissance.css :root[data-theme="renaissance"] — full palette (hex) + per-theme decorations
+├── greek / edo / steampunk / atomic / cyber / wasteland / rot / plague / surveillance .css
+└── animations.css per-theme --pulse-keyframe/-duration/-timing + executing/trigger keyframes
+ + .machina-* helpers (.machina-pulse / -trigger-armed / -bolt / -crt / -scanline)
+
+client/src/index.css PLUMBING ONLY — holds NO literal colour values:
+├── @layer base global resets only (*, html/body, #root) — token blocks moved to themes/
+└── @theme inline { … } Tailwind v4 bridge mapping --color-X: var(--X) (NO hsl() wrapper);
+ /opacity (bg-primary/50) composes via color-mix for any colour format
+
+client/tailwind.config.js second colour bridge — theme.extend.colors map var(--X) (no hsl() wrapper)
client/src/contexts/ThemeContext.tsx
├── ThemeName = 'light' | 'dark' | 'renaissance' | 'greek' | 'edo' | 'steampunk'
@@ -97,15 +93,15 @@ Surface hierarchy across themes; every theme assigns these in its `:root[data-th
| `tracking-[var(--type-tracking-display)]` | `--type-tracking-display` | Letter-spacing for display headings |
| `[text-transform:var(--type-uppercase)]` | `--type-uppercase` | Theme-driven uppercase / capitalize / none |
-**Note**: full-colour values, no HSL triplet, so alpha composition (`bg-bg-app/50`) does **not** work for these. Use the shadcn alias (`bg-background/50`) when you need alpha.
+**Note**: values are hex + `color-mix()`. Tailwind v4 composes `/opacity` via `color-mix` for any colour format, so `bg-bg-app/50` *does* work — but prefer a named token (`--bg-overlay`, a `-soft`/`-tint` variant) over ad-hoc surface alpha.
-### 2. shadcn semantic tokens (preserved for primitives + alpha-composed call sites)
+### 2. shadcn semantic tokens (preserved for primitives)
-Standard shadcn keys (`background`, `foreground`, `card`, `popover`, `primary`, `destructive`, `success`, `warning`, `info`, `border`, `input`, `ring`, etc.). Each theme's CSS file regenerates them as HSL triplets matching the same colour as the new-contract token, so existing utilities keep working. **Use these when you need `/50` alpha** (e.g., `bg-primary/10`, `text-foreground/80`).
+Standard shadcn keys (`background`, `foreground`, `card`, `popover`, `primary`, `destructive`, `success`, `warning`, `info`, `border`, `input`, `ring`, etc.). Each theme defines them as **hex** matching the new-contract colour, so shadcn primitives + generic chrome resolve against the active theme. `/opacity` works on these too (`bg-primary/10`, `text-foreground/80`) via v4 color-mix.
### 3. Action role tokens
-Six semantic intents: `run | stop | save | config | secret | tools`. Each exposes `base / -soft / -hover / -border` (see [client/src/index.css](../client/src/index.css)). Read via `<ActionButton intent="run">` or directly: `bg-action-run-soft text-action-run border-action-run-border`. Themes redefine these in their own block.
+Six semantic intents: `run | stop | save | config | secret | tools`. Each exposes `base / -soft / -hover / -border / -ink` — the colour-hex bases live in light.css/dark.css and the `-soft/-hover/-border` tints are `color-mix` over the base referencing the shared `var(--tint-action-*)` scale. `-ink` is the readable label colour (light: darkened accent; dark: raw accent). Read via `<ActionButton intent="run">` or directly: `bg-action-run-soft text-action-run-ink border-action-run-border`. Themes redefine these (or just override the `--tint-action-*` scalars) in their own block.
### 4. Node-type role tokens
@@ -179,20 +175,23 @@ Result by theme (display font / tracking / case):
--type-tracking-display: 0|0.10em|0.18em;
--radius-sm: …; --radius-md: …; --radius-lg: …; --radius-pill: …;
- /* Shadcn HSL-triplet bridge — same colours, HSL form */
- --background: H S% L%; --foreground: H S% L%;
- --card: H S% L%; --popover: H S% L%; --primary: H S% L%;
- --secondary: H S% L%; --muted: H S% L%; --accent: H S% L%;
- --destructive: H S% L%; --success: H S% L%; --warning: H S% L%; --info: H S% L%;
- --border: H S% L%; --input: H S% L%; --ring: H S% L%;
-
- /* Action role tokens — derive from theme semantic palette */
- --action-run: H S% L%; --action-run-soft: H S% L% / 0.18; …
- --action-stop: H S% L%; …
- --action-save: H S% L%; …
- --action-config: H S% L%; …
- --action-secret: H S% L%; …
- --action-tools: H S% L%; …
+ /* Shadcn bridge — same colours, HEX (not HSL triplets) */
+ --background: #rrggbb; --foreground: #rrggbb;
+ --card: #rrggbb; --popover: #rrggbb; --primary: #rrggbb;
+ --secondary: #rrggbb; --muted: #rrggbb; --accent: #rrggbb;
+ --destructive: #rrggbb; --success: #rrggbb; --warning: #rrggbb; --info: #rrggbb;
+ --border: #rrggbb; --input: #rrggbb; --ring: #rrggbb;
+
+ /* Action role tokens — base hex + color-mix tints over the shared
+ var(--tint-action-*) scale (override --tint-action-* here if the
+ theme wants stronger/weaker tints). -ink = readable label:
+ a darkened accent on light themes, var(--action-X) on dark. */
+ --action-run: #rrggbb;
+ --action-run-soft: color-mix(in srgb, var(--action-run) var(--tint-action-soft), transparent);
+ --action-run-hover: color-mix(in srgb, var(--action-run) var(--tint-action-hover), transparent);
+ --action-run-border: color-mix(in srgb, var(--action-run) var(--tint-action-border), transparent);
+ --action-run-ink: #rrggbb; /* or var(--action-run) on dark themes */
+ /* …repeat for stop / save / config / secret / tools */
}
```
2. Import it in [client/src/main.tsx](../client/src/main.tsx) **before** `index.css`.
@@ -202,6 +201,7 @@ Result by theme (display font / tracking / case):
6. **(Optional, canvas)** Add a `THEME_OVERRIDES` entry in [client/src/hooks/useAppTheme.ts](../client/src/hooks/useAppTheme.ts) so canvas selection rings, action buttons, and edge strokes pick up the theme's accents. Whichever keys you omit fall through to `lightColors` / `darkColors` (chosen by `DARK_BASE_THEMES`).
7. **(Optional, fonts)** If the theme uses Google Fonts not already loaded, append the family to the deferred-load `<link>` in [client/index.html](../client/index.html).
8. **(Optional, sound)** Pick one of the 10 existing `SoundPackName` values in `--sound-pack` (or add a new pack to [client/src/lib/sound.ts](../client/src/lib/sound.ts) and the `VALID_PACKS` set in [client/src/hooks/useSound.ts](../client/src/hooks/useSound.ts)).
+9. **(Optional, motion)** The theme inherits the default `node-pulse` executing glow and the `.machina-trigger-armed` trigger heartbeat automatically. For a bespoke executing pulse, add a `[data-theme="X"]` block in [client/src/themes/animations.css](../client/src/themes/animations.css) overriding `--pulse-keyframe` / `--pulse-duration` / `--pulse-timing` and define that keyframe there. Set the glow accent via `--node-pulse-color` in the theme's own block.
**No component code changes.** That is the contract.
@@ -209,7 +209,7 @@ Result by theme (display font / tracking / case):
1. **Theme-conditional logic in components.** No `if (theme === 'cyber')` branches. Visual differences live in the per-theme CSS file.
2. **Whole-store Zustand destructure.** Always `useAppStore((s) => s.x)`, never `{ x } = useAppStore()`.
-3. **Opacity arithmetic on new-contract tokens.** `bg-bg-app/10` does not work — they're full-colour. Add a new variant under `client/src/themes/<name>.css` if you need a different alpha, or fall back to the shadcn alias (`bg-background/10`).
+3. **Ad-hoc opacity arithmetic on role/surface tokens.** Don't inline alpha (`bg-bg-app/10`, `bg-node-agent/30`, `bg-action-run/25`). Tailwind v4 *can* now color-mix `/opacity` on hex tokens, but the discipline is to reference a NAMED token: add/define a `-soft` / `-hover` / `-border` variant, or a `--tint-*` step in base.css, and use it by name.
4. **Hardcoded colours.** No `bg-white`, `bg-black`, `text-gray-500`, `style={{ backgroundColor: '#fff' }}`. Use tokens.
5. **`useAppTheme()` in new files.** Allowed only for surfaces that need JS-side hex values Tailwind can't express: canvas node components (`AIAgentNode`, `SquareNode`, `TriggerNode`, `StartNode`, `ToolkitNode`, `TeamMonitorNode`, `GenericNode`), `EdgeConditionEditor`, and the Google Maps SDK consumers (`MapSelector`, `GoogleMapsPicker`, `MapsPreviewPanel`). Every other surface uses Tailwind + tokens. New themes contribute to `useAppTheme` via a `THEME_OVERRIDES` entry, never by importing `lightColors` / `darkColors` directly.
6. **Hand-rolled modal backdrops.** Use `<Modal>` from `client/src/components/ui/Modal.tsx`.
@@ -219,7 +219,7 @@ Result by theme (display font / tracking / case):
## What's done vs deferred
### Done
-- **`--node-pulse-color` contract** — executing-node glow color is independent of `--node-color` (the plugin accent). Each theme overrides `--node-pulse-color` to its highest-contrast accent (Cyber neon cyan, Surveillance REC red, Renaissance ultramarine `--lapis-bright`, Atomic turquoise, etc.) so the glow stays visible against any canvas background. Defined in [base.css](../client/src/themes/base.css) at `:root`, overridden in each per-theme file. The `node-pulse` keyframe consumes `var(--node-pulse-color)` for a triple-layer expanding box-shadow (12px ring + 32px mid halo + 56px outer atmospheric halo at peak). Themes that want a non-`node-pulse` animation (Cyber `cyber-pulse-exec`, Surveillance `surv-pulse-exec`, Renaissance `ren-pulse-exec`) bind their own box-shadow keyframe via `.sq-node[data-executing] .sq-node-box, .react-flow__node.executing .sq-node-box, .react-flow__node.executing .node`. **Never animate `opacity` on whole-node selectors** — it fades the node icon + content, not just the glow.
+- **`--node-pulse-color` contract** — executing-node glow color is independent of `--node-color` (the plugin accent). Each theme overrides `--node-pulse-color` to its highest-contrast accent (Cyber neon cyan, Surveillance REC red, Renaissance ultramarine `--lapis-bright`, Atomic turquoise, etc.) so the glow stays visible against any canvas background. Defined in [base.css](../client/src/themes/base.css) at `:root`, overridden in each per-theme file. The executing keyframes (`node-pulse` + per-theme `cyber-pulse-exec` / `surv-pulse-exec` / `ren-pulse-exec`) and the per-theme `--pulse-keyframe` / `--pulse-duration` / `--pulse-timing` tokens live in [animations.css](../client/src/themes/animations.css); base.css's `.sq-node[data-executing] .sq-node-box` / `.react-flow__node.executing .{sq-node-box,node}` rule reads `var(--pulse-keyframe, node-pulse)`, so a theme picks its pulse by overriding ONE token (Cyber → `cyber-pulse-exec`, Surveillance → `surv-pulse-exec`, Renaissance → `ren-pulse-exec`) — no high-specificity per-theme animation rule. `node-pulse` is a triple-layer expanding box-shadow (12px ring + 32px mid halo + 56px outer halo) consuming `var(--node-pulse-color)` + the shared `--tint-pulse-*` alphas. Trigger nodes use a separate continuous `.machina-trigger-armed` "listening" heartbeat (`trigger-listening` keyframe) while waiting, plus `.machina-bolt` on the ⚡ badge — distinct from the one-shot execution pulse. **Never animate `opacity` on whole-node selectors** — it fades the node icon + content, not just the glow.
- **`data-page-hidden` animation pause** — [Dashboard.tsx](../client/src/Dashboard.tsx) mounts a `visibilitychange` listener that toggles `data-page-hidden` on `<html>`; [base.css](../client/src/themes/base.css) declares `html[data-page-hidden] *, *::before, *::after { animation-play-state: paused !important; }`. Without this, paused CSS keyframes accumulate frames in the compositor queue while the tab is hidden; on tab return all 50+ executing nodes' triple-layer pulses + Cyber's full-viewport `cyber-flicker` / `cyber-roll` resume simultaneously, stalling the GPU compositor 100-200ms and blocking input dispatch (first-click-feels-frozen pattern). The unpause is deferred via `requestAnimationFrame` so input dispatch wins the frame before composite resumes.
- **Parameter panel theme contract** — MasterSkillEditor, OutputPanel, MiddleSection, ToolSchemaEditor, ParameterPanel removed `useAppTheme()`. Every surface renders against Tailwind tokens + new-contract CSS custom props. Section headers carry the display-typography triplet (`font-display tracking-[var(--type-tracking-display)] [text-transform:var(--type-uppercase)] text-fg-default`); action buttons use `<ActionButton intent="run|stop|save|config|tools">`; backgrounds use `bg-bg-elevated` / `bg-bg-panel` / `bg-bg-input` from the surface tier table above. EditableNodeLabel emits both `sq-node-label` and `node-label` classNames so per-theme typography rules fire under either topology. Per-theme scrollbar webkit rules (`::-webkit-scrollbar-thumb` etc.) declared in all 10 themes — gold (Renaissance), square-cornered (Atomic / Edo / Greek / Wasteland / Plague), metallic (Steampunk), phosphor (Rot), neon (Cyber), REC-red (Surveillance), shadcn neutral (Light / Dark).
- **Canvas-node class topology alignment** (W26) — TriggerNode, StartNode, ToolkitNode migrated from `.node` (rectangular spec-card) topology to `.sq-node` / `.sq-node-box` (square-icon node) topology so per-theme decorations (Steampunk brass rivets, Edo hanko seal, Surveillance REC LED, Renaissance gold emblem) reach them. Status pips, gear buttons, and React Flow handles on every node component now carry `.sq-node-pip` / `.sq-node-gear` / `.sq-node-handle.in/.out` (square nodes) or `.node-pip` / `.node-gear` / `.node-handle.in/.out` (rectangular nodes — AIAgentNode, GenericNode, TeamMonitorNode). Pip background is data-driven via `data-status="idle | executing | waiting | success | error"` — base.css picks the colour from shadcn semantic tokens; per-theme files override. Inline JS-computed `backgroundColor` / `border` / `animation` on these elements stripped — CSS owns visuals. Cyber's `.node-trigger` rule extended to dual-target both rectangular and square topologies (`.sq-node.node-trigger .sq-node-box`). Orphan `.node-output` rule removed. EditableNodeLabel now emits both `sq-node-label` and `node-label` classNames so per-theme typography rules fire. StartNode reads `nodeColor` from `definition?.defaults?.color` instead of hardcoded `theme.dracula.cyan`.
@@ -246,9 +246,9 @@ Result by theme (display font / tracking / case):
- **Canvas overlay packs** — [client/src/hooks/useAppTheme.ts](../client/src/hooks/useAppTheme.ts) extended from 2-way (`{light, dark}`) to 10-way: a `THEME_OVERRIDES` map applies a small overlay (primary, focus, focusRing, action colours, edge palette) on top of `lightColors` / `darkColors`. Existing call sites continue to read `theme.colors.X` and `theme.isDarkMode` unchanged; canvas selection rings, action buttons, and edge strokes pick up the active theme's accents under any of the 10 themes.
### Deferred (future PRs)
-- **`--*-soft` token family** — `--info-soft`, `--warning-soft`, `--danger-soft`, `--success-soft` are referenced across multiple theme rules (greek, atomic, wasteland, plague, action-deploy, chat-msg-user, wf-card.selected, cmdk-item.active, action-run) but never declared. W22 patched the four `.sq-node.selected .sq-node-box` references to inline alpha composition (`hsl(var(--info) / 0.25)` etc.); the broader pattern is tech debt. Centralise the family as alpha-composed pairs alongside their base tokens (e.g. `--info-soft: <hsl-triplet> / 0.18`) in [client/src/index.css](../client/src/index.css).
+- **`--*-soft` token family** — `--info-soft`, `--warning-soft`, `--danger-soft`, `--success-soft` are referenced across multiple theme rules (greek, atomic, wasteland, plague, action-deploy, chat-msg-user, wf-card.selected, cmdk-item.active, action-run) but never declared. the hex migration converted the inline alpha compositions to `color-mix(in srgb, var(--info) 25%, transparent)`; the broader undeclared-family pattern is still tech debt. Centralise the family as `color-mix` tokens alongside their base (e.g. `--info-soft: color-mix(in srgb, var(--info) 18%, transparent)`) in a theme/base file.
- **Edo / Steampunk / Atomic canvas-host pseudo-element decorations** — these themes' richer canvas overlays (Edo radial-gradient ink-wash mountain, Steampunk corner radial accents, Atomic dot constellation) are pseudo-element decorations rather than tileable `--canvas-grid` patterns; W24 ported the tileable layer only. Wire via `.canvas::before/::after` rules in a future pass if needed.
-- **Parameter panel internals** — `MiddleSection`, `MasterSkillEditor`, `ParameterRenderer` consume shadcn tokens through the bridge so they retint correctly, but their interior section headers don't yet carry the display-typography triplet. Apply the recipe (`font-display tracking-[var(--type-tracking-display)] text-fg-default [text-transform:var(--type-uppercase)]`) when next touched.
+- **Parameter panel internals** — RESOLVED: `ParameterRenderer`, `MiddleSection`, `MasterSkillEditor`, `ToolSchemaEditor` are fully on shadcn primitives + tokens (zero `useAppTheme` / `theme.colors`); section headers carry the display-typography triplet. The panel modal also picks up per-theme `.modal` / `.modal-head` / `.modal-title` decoration via `Modal.tsx`.
- **Credentials modal sub-panels** — `OAuthPanel`, `EmailPanel`, `ApiKeyPanel`, `QrPairingPanel` headers same pattern.
## Per-component decorations
@@ -296,7 +296,7 @@ The `.selected` co-class is bound to React Flow's `selected` prop on every canva
| plague | parchment | red X pattern (SVG) | nailed nail (`.sq-node-box::after`) | — |
| surveillance | solid | CCTV crosshair + REC label + phosphor scanlines | REC LED blink (`.sq-node-box::before`) | `surv-blink` |
-`var(--accent)` etc. handoff reads were wrapped to `hsl(var(--accent))` for shadcn-bridged tokens; theme-specific spot colours (`--gold`, `--crimson`, `--neon-magenta`, `--rec-red`) port verbatim as hex.
+Token reads use `var(--token)` directly (no `hsl()` wrapper) — every colour value is hex / `color-mix()`, including the shadcn-bridged tokens and theme spot colours (`--gold`, `--crimson`, `--neon-magenta`, `--rec-red`).
## Canvas-node visual contract (W21)
@@ -339,9 +339,9 @@ Both families share the same status-pip data contract:
<div className="sq-node-pip" data-status={pipStatus} /> // or className="node-pip"
```
-`pipStatus` is a string from the bucket `'idle' | 'executing' | 'waiting' | 'success' | 'error'`. base.css colors the pip per-status using `hsl(var(--success))` / `hsl(var(--destructive))` / `var(--node-color)` etc. Per-theme files override for material-specific identity.
+`pipStatus` is a string from the bucket `'idle' | 'executing' | 'waiting' | 'success' | 'error'`. base.css colors the pip per-status using `var(--success)` / `var(--destructive)` / `var(--node-color)` etc. Per-theme files override for material-specific identity.
-Execution-state animation: `data-executing={isExecuting ? '' : undefined}` on the outer wrapper. base.css binds `.sq-node[data-executing] .sq-node-box` and `.react-flow__node.executing .node` to the `node-pulse` keyframe.
+Execution-state animation: `data-executing={isExecuting ? '' : undefined}` on the outer wrapper. base.css binds `.sq-node[data-executing] .sq-node-box` and `.react-flow__node.executing .node` to `var(--pulse-keyframe, node-pulse)` (the theme-selected pulse; keyframes + per-theme `--pulse-keyframe` live in `animations.css`). Trigger nodes apply `.machina-trigger-armed` (continuous listening heartbeat) on the `waiting` state instead — distinct from the execution pulse — plus `.machina-bolt` on the ⚡ badge.
Selection state: `selected` co-class on the outer wrapper, driven by React Flow's `selected` prop.
@@ -465,9 +465,9 @@ cd client && npx eslint <files>
| File | Role |
|---|---|
-| [client/src/themes/base.css](../client/src/themes/base.css) | Neutral defaults |
-| [client/src/themes/light.css](../client/src/themes/light.css) | Light theme tokens |
-| [client/src/themes/dark.css](../client/src/themes/dark.css) | Dark theme tokens |
+| [client/src/themes/base.css](../client/src/themes/base.css) | Shared scalars (space / radii / chrome / shadow / type) + `--tint-*` alpha scale + node-visual contract |
+| [client/src/themes/light.css](../client/src/themes/light.css) | Light colour hex (shadcn + dracula + node + action + `-ink`); on bare `:root` so global |
+| [client/src/themes/dark.css](../client/src/themes/dark.css) | Dark colour-hex overrides (+ `-ink`, deeper shadows) |
| [client/src/themes/renaissance.css](../client/src/themes/renaissance.css) | Renaissance theme + bridge |
| [client/src/themes/greek.css](../client/src/themes/greek.css) | Greek theme + bridge |
| [client/src/themes/edo.css](../client/src/themes/edo.css) | Edo theme + bridge |
@@ -478,7 +478,9 @@ cd client && npx eslint <files>
| [client/src/themes/rot.css](../client/src/themes/rot.css) | Necromantic Rot theme + bridge |
| [client/src/themes/plague.css](../client/src/themes/plague.css) | Plague City theme + bridge |
| [client/src/themes/surveillance.css](../client/src/themes/surveillance.css) | Surveillance theme + bridge |
-| [client/src/index.css](../client/src/index.css) | shadcn HSL triplets + `@theme inline` Tailwind utilities |
+| [client/src/themes/animations.css](../client/src/themes/animations.css) | Per-theme `--pulse-keyframe` tokens + executing / trigger keyframes + `.machina-*` helpers |
+| [client/tailwind.config.js](../client/tailwind.config.js) | Colour bridge (`theme.extend.colors` → `var(--X)`, no `hsl()`) |
+| [client/src/index.css](../client/src/index.css) | Plumbing: global resets + `@theme inline` `var()` bridge (no literal colours) |
| [client/src/contexts/ThemeContext.tsx](../client/src/contexts/ThemeContext.tsx) | `<ThemeProvider>` + `useTheme()` (10-way) |
| [client/src/hooks/useAppTheme.ts](../client/src/hooks/useAppTheme.ts) | Canvas overlay packs (10 themes × Colors override) |
| [client/src/lib/sound.ts](../client/src/lib/sound.ts) | WebAudio engine — 10 sound packs, 9 events |
diff --git a/docs-internal/ui_migration_plan.md b/docs-internal/ui_migration_plan.md
index e4c3ee45..32b19187 100644
--- a/docs-internal/ui_migration_plan.md
+++ b/docs-internal/ui_migration_plan.md
@@ -345,7 +345,7 @@ The MachinaOs frontend was coupled to Ant Design (40 files, 187-line theme file,
2. **No owned layout wrappers.** Tailwind utility classes are the API. `<div className="flex flex-col gap-3">` is the answer, not `<Stack gap="3">`.
3. **No facade layers.** `import { toast } from 'sonner'` directly at call sites. No `lib/toast.ts` wrapper preserving antd's call shape.
4. **Library defaults beat invented abstractions.** Use shadcn's `Form` composition with `react-hook-form` + `zod` exactly as the docs show. Use `@jsonforms/react`'s built-in renderer registry, don't invent another.
-5. **Tokens are owned.** CSS vars are the one thing shadcn doesn't ship — they're our palette (Solarized + Dracula). One CSS file (`tokens.css`), exported as HSL triplets so Tailwind alpha composition works.
+5. **Tokens are owned.** CSS vars are the one thing shadcn doesn't ship — they're our palette (Solarized + Dracula), defined per-theme in `client/src/themes/*.css` as hex + `color-mix()`. The `@theme inline` bridge maps `--color-X: var(--X)` (no `hsl()` wrapper); Tailwind v4 composes `/opacity` via `color-mix`. (W1 shipped these as HSL triplets; a later wave migrated the whole system to hex + color-mix — see [theme_system.md](./theme_system.md).)
6. **Each phase ships independently.** App stays green; antd coexists until Phase 7.
## Codebase facts (from audit, 2026-04-13)