MobTranslate styleguide

Design tokens

318 named decisions from the actual component stylesheet. Search declarations, compare themes, inspect live values and export the tokens you need.

Token architecture

Primitive tokens hold raw values such as a palette shade or spacing step. Semantic tokens describe a role such as primary action, error or foreground. Component specifications record a particular recipe and its source bindings; the current JavaScript presets are not automatically overridable CSS custom properties. Prefer the narrowest meaningful role: a primary button uses a primary action token rather than a raw shade.

The rendered web system is defined in packages/ui/src/tokens/tokens.css. The catalogue below is generated with PostCSS before development and production builds. The TypeScript declarations, semantic palettes and source-bound component presets are now generated and checked against the same stylesheet. Imported objects remain authored snapshots; theme selection and local inherited overrides are read through live CSS. See Theming for the compiled-versus-rendered inspector.

A named decision and its adoption cost

A token pairs a stable name with a value or reference. It is most useful when a decision is reused, reviewed or expected to vary across themes/consumers. A token name does not itself establish that a choice is approved, accessible or appropriate for source content.

Adopt shared roles where the meaning is shared. Inventory existing overrides and users before introducing a layer; avoid turning every one-off layout measurement into a global public token. Record ownership, purpose, state coverage and migration impact alongside the value.

Names, classes and component specifications

Material uses a system prefix, ref/sys/comp class and descriptive purpose. This package uses actual CSS custom-property names and generated TypeScript objects; those namespaces are not automatic aliases for Material IDs. Keep names stable while values change, and treat renaming/removing a public name as an API migration.

Reference values provide options; system roles assign meaning for a context; component specifications connect parts and states to the chosen recipe. The Component Specifications inspector traces 19 actual presets/90 source-bound fields. Inspect enabled/hover/focus/pressed/disabled behavior and the actual rendered part rather than assuming every style has an independent token.

Contexts and alias graphs

Theme, instance scope, density, direction and device/content constraints can change the decision used by a component. This catalogue records light declarations and explicit dark overrides. It is not a universal catalogue of every media/state/instance rule. CSS inheritance and portal placement determine which context reaches a rendered element.

The reference disclosure follows parsed var() names conservatively, including fallback branches. Dependency inclusion adds matching declarations transitively and deduplicates them. Missing names may be supplied by another scope or a fallback; cycles need inspection. The graph preserves source relationships instead of inventing a resolved semantic mapping.

Live custom-property values resolve references through the page cascade but can retain units such as rem. They are not final element geometry or a global snapshot of every local override. Export theme chooses authored values, independently of the page theme.

Design-tool generation, mock-ups and handoff

The captured Material workflow starts from baseline tokens or generated theme styles, updates values/styles, applies those styles to mock-ups, swaps a selected design-kit component’s mapped styles and exports a platform format. Record tool/plugin version and format: a design-tool style, DSP package, CSS fragment and this filtered JSON catalogue are different artifacts.

For this workspace, agree on the existing role names and CSS source first. Map design styles to those roles, keep foreground/background and base/state treatments together, compare both themes, then make a reviewed stylesheet change and regenerate/check exports. No Figma plugin or native platform export runs automatically in this tool.

The JSON download records requested names, export theme and included source declarations. Dependency inclusion does not provide components, fonts, complete state rules or proof of contrast. Review the captured export at its destination, keep the source/version and mapping scope, and verify the actual consuming interface.

Token explorer

Light and dark columns show source declarations. Live values come from the current page’s computed stylesheet, so switching the page theme updates them. Changing Export theme changes copied CSS; it does not change the page theme.

Download filtered JSON

318 of 318 tokens.

318 declarations in this export. This is a filtered fragment; references may require the shared stylesheet.

Declared references for the current filter and export theme

The source graph preserves var() relationships. It does not evaluate the live cascade, CSS fallback selection, units or contrast. Export theme selects authored declarations independently of the page theme.

NameAuthored valueReferences
--breakpoint-2xl1536pxNo declared var() reference
--breakpoint-lg1024pxNo declared var() reference
--breakpoint-md768pxNo declared var() reference
--breakpoint-sm640pxNo declared var() reference
--breakpoint-xl1280pxNo declared var() reference
--color-accent#d97706No declared var() reference
--color-accent-active#92400eNo declared var() reference
--color-accent-foreground#1c1410No declared var() reference
--color-accent-hover#b45309No declared var() reference
--color-amber-100#fef3c7No declared var() reference
--color-amber-200#fde68aNo declared var() reference
--color-amber-300#fcd34dNo declared var() reference
--color-amber-400#fbbf24No declared var() reference
--color-amber-50#fffbebNo declared var() reference
--color-amber-500#f59e0bNo declared var() reference
--color-amber-600#d97706No declared var() reference
--color-amber-700#b45309No declared var() reference
--color-amber-800#92400eNo declared var() reference
--color-amber-900#78350fNo declared var() reference
--color-amber-950#451a03No declared var() reference
--color-background#faf8f5No declared var() reference
--color-blue-100#dbeafeNo declared var() reference
--color-blue-200#bfdbfeNo declared var() reference
--color-blue-300#93c5fdNo declared var() reference
--color-blue-400#60a5faNo declared var() reference
--color-blue-50#eff6ffNo declared var() reference
--color-blue-500#3b82f6No declared var() reference
--color-blue-600#2563ebNo declared var() reference
--color-blue-700#1d4ed8No declared var() reference
--color-blue-800#1e40afNo declared var() reference
--color-blue-900#1e3a8aNo declared var() reference
--color-blue-950#172554No declared var() reference
--color-border#ddd1bfNo declared var() reference
--color-card#ffffffNo declared var() reference
--color-card-foreground#2e2720No declared var() reference
--color-cyan-100#cffafeNo declared var() reference
--color-cyan-200#a5f3fcNo declared var() reference
--color-cyan-300#67e8f9No declared var() reference
--color-cyan-400#22d3eeNo declared var() reference
--color-cyan-50#ecfeffNo declared var() reference
--color-cyan-500#06b6d4No declared var() reference
--color-cyan-600#0891b2No declared var() reference
--color-cyan-700#0e7490No declared var() reference
--color-cyan-800#155e75No declared var() reference
--color-cyan-900#164e63No declared var() reference
--color-cyan-950#083344No declared var() reference
--color-destructive#b13518No declared var() reference
--color-destructive-active#792b1aNo declared var() reference
--color-destructive-foreground#faf8f5No declared var() reference
--color-destructive-hover#922f19No declared var() reference
--color-error#b13518No declared var() reference
--color-error-foreground#faf8f5No declared var() reference
--color-eucalyptus-100#e0ede5No declared var() reference
--color-eucalyptus-200#c3dbccNo declared var() reference
--color-eucalyptus-300#98c1a8No declared var() reference
--color-eucalyptus-400#6ba380No declared var() reference
--color-eucalyptus-50#f2f7f4No declared var() reference
--color-eucalyptus-500#4a8664No declared var() reference
--color-eucalyptus-600#386b4fNo declared var() reference
--color-eucalyptus-700#2e5641No declared var() reference
--color-eucalyptus-800#274536No declared var() reference
--color-eucalyptus-900#21392dNo declared var() reference
--color-eucalyptus-950#112019No declared var() reference
--color-foreground#2e2720No declared var() reference
--color-gray-100#f3f4f6No declared var() reference
--color-gray-200#e5e7ebNo declared var() reference
--color-gray-300#d1d5dbNo declared var() reference
--color-gray-400#9ca3afNo declared var() reference
--color-gray-50#f9fafbNo declared var() reference
--color-gray-500#6b7280No declared var() reference
--color-gray-600#4b5563No declared var() reference
--color-gray-700#374151No declared var() reference
--color-gray-800#1f2937No declared var() reference
--color-gray-900#111827No declared var() reference
--color-gray-950#030712No declared var() reference
--color-green-100#dcfce7No declared var() reference
--color-green-200#bbf7d0No declared var() reference
--color-green-300#86efacNo declared var() reference
--color-green-400#4ade80No declared var() reference
--color-green-50#f0fdf4No declared var() reference
--color-green-500#22c55eNo declared var() reference
--color-green-600#16a34aNo declared var() reference
--color-green-700#15803dNo declared var() reference
--color-green-800#166534No declared var() reference
--color-green-900#14532dNo declared var() reference
--color-green-950#052e16No declared var() reference
--color-info#3c5281No declared var() reference
--color-info-foreground#faf8f5No declared var() reference
--color-input#ddd1bfNo declared var() reference
--color-muted#f5f0eaNo declared var() reference
--color-muted-foreground#695746No declared var() reference
--color-muted-hover#ebe3d7No declared var() reference
--color-nightsky-100#dde4eeNo declared var() reference
--color-nightsky-200#c1cde0No declared var() reference
--color-nightsky-300#97abccNo declared var() reference
--color-nightsky-400#6b85b3No declared var() reference
--color-nightsky-50#f0f3f7No declared var() reference
--color-nightsky-500#4b679aNo declared var() reference
--color-nightsky-600#3c5281No declared var() reference
--color-nightsky-700#334369No declared var() reference
--color-nightsky-800#2d3a58No declared var() reference
--color-nightsky-900#1e2740No declared var() reference
--color-nightsky-950#151c2eNo declared var() reference
--color-ochre-100#faeadbNo declared var() reference
--color-ochre-200#f4d2b5No declared var() reference
--color-ochre-300#ecb485No declared var() reference
--color-ochre-400#e29455No declared var() reference
--color-ochre-50#fdf6f0No declared var() reference
--color-ochre-500#c9743aNo declared var() reference
--color-ochre-600#b45e2aNo declared var() reference
--color-ochre-700#964a22No declared var() reference
--color-ochre-800#7a3d20No declared var() reference
--color-ochre-900#65331dNo declared var() reference
--color-ochre-950#3a1a0eNo declared var() reference
--color-orange-100#ffedd5No declared var() reference
--color-orange-200#fed7aaNo declared var() reference
--color-orange-300#fdba74No declared var() reference
--color-orange-400#fb923cNo declared var() reference
--color-orange-50#fff7edNo declared var() reference
--color-orange-500#f97316No declared var() reference
--color-orange-600#ea580cNo declared var() reference
--color-orange-700#c2410cNo declared var() reference
--color-orange-800#9a3412No declared var() reference
--color-orange-900#7c2d12No declared var() reference
--color-orange-950#431407No declared var() reference
--color-pink-100#fce7f3No declared var() reference
--color-pink-200#fbcfe8No declared var() reference
--color-pink-300#f9a8d4No declared var() reference
--color-pink-400#f472b6No declared var() reference
--color-pink-50#fdf2f8No declared var() reference
--color-pink-500#ec4899No declared var() reference
--color-pink-600#db2777No declared var() reference
--color-pink-700#be185dNo declared var() reference
--color-pink-800#9d174dNo declared var() reference
--color-pink-900#831843No declared var() reference
--color-pink-950#500724No declared var() reference
--color-popover#ffffffNo declared var() reference
--color-popover-foreground#2e2720No declared var() reference
--color-primary#b45e2aNo declared var() reference
--color-primary-active#7a3d20No declared var() reference
--color-primary-foreground#fffdfbNo declared var() reference
--color-primary-hover#964a22No declared var() reference
--color-purple-100#f3e8ffNo declared var() reference
--color-purple-200#e9d5ffNo declared var() reference
--color-purple-300#d8b4feNo declared var() reference
--color-purple-400#c084fcNo declared var() reference
--color-purple-50#faf5ffNo declared var() reference
--color-purple-500#a855f7No declared var() reference
--color-purple-600#9333eaNo declared var() reference
--color-purple-700#7e22ceNo declared var() reference
--color-purple-800#6b21a8No declared var() reference
--color-purple-900#581c87No declared var() reference
--color-purple-950#3b0764No declared var() reference
--color-red-100#fee2e2No declared var() reference
--color-red-200#fecacaNo declared var() reference
--color-red-300#fca5a5No declared var() reference
--color-red-400#f87171No declared var() reference
--color-red-50#fef2f2No declared var() reference
--color-red-500#ef4444No declared var() reference
--color-red-600#dc2626No declared var() reference
--color-red-700#b91c1cNo declared var() reference
--color-red-800#991b1bNo declared var() reference
--color-red-900#7f1d1dNo declared var() reference
--color-red-950#450a0aNo declared var() reference
--color-ring#b45e2aNo declared var() reference
--color-sand-100#f5f0eaNo declared var() reference
--color-sand-200#ebe3d7No declared var() reference
--color-sand-300#ddd1bfNo declared var() reference
--color-sand-400#c9b89eNo declared var() reference
--color-sand-50#faf8f5No declared var() reference
--color-sand-500#b09a7bNo declared var() reference
--color-sand-600#9a8265No declared var() reference
--color-sand-700#806a52No declared var() reference
--color-sand-800#695746No declared var() reference
--color-sand-900#574a3cNo declared var() reference
--color-sand-950#2e2720No declared var() reference
--color-secondary#386b4fNo declared var() reference
--color-secondary-active#274536No declared var() reference
--color-secondary-foreground#faf8f5No declared var() reference
--color-secondary-hover#2e5641No declared var() reference
--color-slate-100#f1f5f9No declared var() reference
--color-slate-200#e2e8f0No declared var() reference
--color-slate-300#cbd5e1No declared var() reference
--color-slate-400#94a3b8No declared var() reference
--color-slate-50#f8fafcNo declared var() reference
--color-slate-500#64748bNo declared var() reference
--color-slate-600#475569No declared var() reference
--color-slate-700#334155No declared var() reference
--color-slate-800#1e293bNo declared var() reference
--color-slate-900#0f172aNo declared var() reference
--color-slate-950#020617No declared var() reference
--color-success#386b4fNo declared var() reference
--color-success-foreground#faf8f5No declared var() reference
--color-success-hover#2e5641No declared var() reference
--color-teal-100#ccfbf1No declared var() reference
--color-teal-200#99f6e4No declared var() reference
--color-teal-300#5eead4No declared var() reference
--color-teal-400#2dd4bfNo declared var() reference
--color-teal-50#f0fdfaNo declared var() reference
--color-teal-500#14b8a6No declared var() reference
--color-teal-600#0d9488No declared var() reference
--color-teal-700#0f766eNo declared var() reference
--color-teal-800#115e59No declared var() reference
--color-teal-900#134e4aNo declared var() reference
--color-teal-950#042f2eNo declared var() reference
--color-terracotta-100#fde3dbNo declared var() reference
--color-terracotta-200#fcc8b8No declared var() reference
--color-terracotta-300#f9a188No declared var() reference
--color-terracotta-400#f47556No declared var() reference
--color-terracotta-50#fef3f0No declared var() reference
--color-terracotta-500#e85a38No declared var() reference
--color-terracotta-600#d4421fNo declared var() reference
--color-terracotta-700#b13518No declared var() reference
--color-terracotta-800#922f19No declared var() reference
--color-terracotta-900#792b1aNo declared var() reference
--color-terracotta-950#42130aNo declared var() reference
--color-warning#d97706No declared var() reference
--color-warning-foreground#1c1410No declared var() reference
--color-zinc-100#f4f4f5No declared var() reference
--color-zinc-200#e4e4e7No declared var() reference
--color-zinc-300#d4d4d8No declared var() reference
--color-zinc-400#a1a1aaNo declared var() reference
--color-zinc-50#fafafaNo declared var() reference
--color-zinc-500#71717aNo declared var() reference
--color-zinc-600#52525bNo declared var() reference
--color-zinc-700#3f3f46No declared var() reference
--color-zinc-800#27272aNo declared var() reference
--color-zinc-900#18181bNo declared var() reference
--color-zinc-950#09090bNo declared var() reference
--container-2xl1536pxNo declared var() reference
--container-lg1024pxNo declared var() reference
--container-md768pxNo declared var() reference
--container-prose65chNo declared var() reference
--container-sm640pxNo declared var() reference
--container-xl1280pxNo declared var() reference
--duration-fast100msNo declared var() reference
--duration-instant0msNo declared var() reference
--duration-normal200msNo declared var() reference
--duration-slow300msNo declared var() reference
--duration-slower500msNo declared var() reference
--ease-bouncecubic-bezier(0.68, -0.55, 0.265, 1.55)No declared var() reference
--ease-defaultcubic-bezier(0.4, 0, 0.2, 1)No declared var() reference
--ease-incubic-bezier(0.4, 0, 1, 1)No declared var() reference
--ease-in-outcubic-bezier(0.4, 0, 0.2, 1)No declared var() reference
--ease-outcubic-bezier(0, 0, 0.2, 1)No declared var() reference
--font-display'Playfair Display', serifNo declared var() reference
--font-monoui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospaceNo declared var() reference
--font-sans'Inter', system-ui, sans-serifNo declared var() reference
--opacity-00%No declared var() reference
--opacity-1010%No declared var() reference
--opacity-100100%No declared var() reference
--opacity-2020%No declared var() reference
--opacity-2525%No declared var() reference
--opacity-3030%No declared var() reference
--opacity-4040%No declared var() reference
--opacity-55%No declared var() reference
--opacity-5050%No declared var() reference
--opacity-6060%No declared var() reference
--opacity-7070%No declared var() reference
--opacity-7575%No declared var() reference
--opacity-8080%No declared var() reference
--opacity-9090%No declared var() reference
--opacity-9595%No declared var() reference
--radiusvar(--radius-lg)--radius-lg
--radius-lg1remNo declared var() reference
--radius-2xl2remNo declared var() reference
--radius-full9999pxNo declared var() reference
--radius-md0.5remNo declared var() reference
--radius-none0pxNo declared var() reference
--radius-sm0.25remNo declared var() reference
--radius-xl1.5remNo declared var() reference
--ring-colorvar(--color-ring)--color-ring
--ring-offset2pxNo declared var() reference
--ring-width2pxNo declared var() reference
--shadow-2xl0 25px 50px -12px rgb(46 39 32 / 0.2)No declared var() reference
--shadow-lg0 10px 15px -3px rgb(46 39 32 / 0.08), 0 4px 6px -4px rgb(46 39 32 / 0.06)No declared var() reference
--shadow-md0 4px 6px -1px rgb(46 39 32 / 0.08), 0 2px 4px -2px rgb(46 39 32 / 0.06)No declared var() reference
--shadow-sm0 1px 3px 0 rgb(46 39 32 / 0.08), 0 1px 2px -1px rgb(46 39 32 / 0.06)No declared var() reference
--shadow-xl0 20px 25px -5px rgb(46 39 32 / 0.08), 0 8px 10px -6px rgb(46 39 32 / 0.06)No declared var() reference
--shadow-xs0 1px 2px 0 rgb(46 39 32 / 0.04)No declared var() reference
--spacing-00pxNo declared var() reference
--spacing-0-50.125remNo declared var() reference
--spacing-10.25remNo declared var() reference
--spacing-1-50.375remNo declared var() reference
--spacing-102.5remNo declared var() reference
--spacing-123remNo declared var() reference
--spacing-164remNo declared var() reference
--spacing-20.5remNo declared var() reference
--spacing-2-50.625remNo declared var() reference
--spacing-205remNo declared var() reference
--spacing-246remNo declared var() reference
--spacing-30.75remNo declared var() reference
--spacing-41remNo declared var() reference
--spacing-51.25remNo declared var() reference
--spacing-61.5remNo declared var() reference
--spacing-82remNo declared var() reference
--text-2xl1.5remNo declared var() reference
--text-3xl1.875remNo declared var() reference
--text-4xl2.25remNo declared var() reference
--text-5xl3remNo declared var() reference
--text-6xl3.75remNo declared var() reference
--text-base1remNo declared var() reference
--text-lg1.125remNo declared var() reference
--text-sm0.875remNo declared var() reference
--text-xl1.25remNo declared var() reference
--text-xs0.75remNo declared var() reference
--transition-colorscolor, background-color, border-color, text-decoration-color, fill, strokeNo declared var() reference
--transition-opacityopacityNo declared var() reference
--transition-shadowbox-shadowNo declared var() reference
--transition-transformtransformNo declared var() reference
--z-dropdown50No declared var() reference
--z-fixed200No declared var() reference
--z-modal400No declared var() reference
--z-modal-backdrop300No declared var() reference
--z-popover500No declared var() reference
--z-sticky100No declared var() reference
--z-toast700No declared var() reference
--z-tooltip600No declared var() reference
TokenLight declarationDark overrideLive valueCopy
--breakpoint-2xl1536pxInherits light declarationNot available in this render
--breakpoint-lg1024pxInherits light declarationNot available in this render
--breakpoint-md768pxInherits light declarationNot available in this render
--breakpoint-sm640pxInherits light declarationNot available in this render
--breakpoint-xl1280pxInherits light declarationNot available in this render
--color-accent#d97706#fbbf24Not available in this render
--color-accent-active#92400e#f59e0bNot available in this render
--color-accent-foreground#1c1410#1c1410Not available in this render
--color-accent-hover#b45309#fcd34dNot available in this render
--color-amber-100#fef3c7Inherits light declarationNot available in this render
--color-amber-200#fde68aInherits light declarationNot available in this render
--color-amber-300#fcd34dInherits light declarationNot available in this render
--color-amber-400#fbbf24Inherits light declarationNot available in this render
--color-amber-50#fffbebInherits light declarationNot available in this render
--color-amber-500#f59e0bInherits light declarationNot available in this render
--color-amber-600#d97706Inherits light declarationNot available in this render
--color-amber-700#b45309Inherits light declarationNot available in this render
--color-amber-800#92400eInherits light declarationNot available in this render
--color-amber-900#78350fInherits light declarationNot available in this render
--color-amber-950#451a03Inherits light declarationNot available in this render
--color-background#faf8f5#1c1410Not available in this render
--color-blue-100#dbeafeInherits light declarationNot available in this render
--color-blue-200#bfdbfeInherits light declarationNot available in this render
--color-blue-300#93c5fdInherits light declarationNot available in this render
--color-blue-400#60a5faInherits light declarationNot available in this render
--color-blue-50#eff6ffInherits light declarationNot available in this render
--color-blue-500#3b82f6Inherits light declarationNot available in this render
--color-blue-600#2563ebInherits light declarationNot available in this render
--color-blue-700#1d4ed8Inherits light declarationNot available in this render
--color-blue-800#1e40afInherits light declarationNot available in this render
--color-blue-900#1e3a8aInherits light declarationNot available in this render
--color-blue-950#172554Inherits light declarationNot available in this render
--color-border#ddd1bf#3a312bNot available in this render
--color-card#ffffff#241c17Not available in this render
--color-card-foreground#2e2720#f5f0eaNot available in this render
--color-cyan-100#cffafeInherits light declarationNot available in this render
--color-cyan-200#a5f3fcInherits light declarationNot available in this render
--color-cyan-300#67e8f9Inherits light declarationNot available in this render
--color-cyan-400#22d3eeInherits light declarationNot available in this render
--color-cyan-50#ecfeffInherits light declarationNot available in this render
--color-cyan-500#06b6d4Inherits light declarationNot available in this render
--color-cyan-600#0891b2Inherits light declarationNot available in this render
--color-cyan-700#0e7490Inherits light declarationNot available in this render
--color-cyan-800#155e75Inherits light declarationNot available in this render
--color-cyan-900#164e63Inherits light declarationNot available in this render
--color-cyan-950#083344Inherits light declarationNot available in this render
--color-destructive#b13518#f47556Not available in this render
--color-destructive-active#792b1a#e85a38Not available in this render
--color-destructive-foreground#faf8f5#1c1410Not available in this render
--color-destructive-hover#922f19#f9a188Not available in this render
--color-error#b13518#f47556Not available in this render
--color-error-foreground#faf8f5#1c1410Not available in this render
--color-eucalyptus-100#e0ede5Inherits light declarationNot available in this render
--color-eucalyptus-200#c3dbccInherits light declarationNot available in this render
--color-eucalyptus-300#98c1a8Inherits light declarationNot available in this render
--color-eucalyptus-400#6ba380Inherits light declarationNot available in this render
--color-eucalyptus-50#f2f7f4Inherits light declarationNot available in this render
--color-eucalyptus-500#4a8664Inherits light declarationNot available in this render
--color-eucalyptus-600#386b4fInherits light declarationNot available in this render
--color-eucalyptus-700#2e5641Inherits light declarationNot available in this render
--color-eucalyptus-800#274536Inherits light declarationNot available in this render
--color-eucalyptus-900#21392dInherits light declarationNot available in this render
--color-eucalyptus-950#112019Inherits light declarationNot available in this render
--color-foreground#2e2720#f5f0eaNot available in this render
--color-gray-100#f3f4f6Inherits light declarationNot available in this render
--color-gray-200#e5e7ebInherits light declarationNot available in this render
--color-gray-300#d1d5dbInherits light declarationNot available in this render
--color-gray-400#9ca3afInherits light declarationNot available in this render
--color-gray-50#f9fafbInherits light declarationNot available in this render
--color-gray-500#6b7280Inherits light declarationNot available in this render
--color-gray-600#4b5563Inherits light declarationNot available in this render
--color-gray-700#374151Inherits light declarationNot available in this render
--color-gray-800#1f2937Inherits light declarationNot available in this render
--color-gray-900#111827Inherits light declarationNot available in this render
--color-gray-950#030712Inherits light declarationNot available in this render
--color-green-100#dcfce7Inherits light declarationNot available in this render
--color-green-200#bbf7d0Inherits light declarationNot available in this render
--color-green-300#86efacInherits light declarationNot available in this render
--color-green-400#4ade80Inherits light declarationNot available in this render
--color-green-50#f0fdf4Inherits light declarationNot available in this render
--color-green-500#22c55eInherits light declarationNot available in this render
--color-green-600#16a34aInherits light declarationNot available in this render
--color-green-700#15803dInherits light declarationNot available in this render
--color-green-800#166534Inherits light declarationNot available in this render
--color-green-900#14532dInherits light declarationNot available in this render
--color-green-950#052e16Inherits light declarationNot available in this render
--color-info#3c5281#6b85b3Not available in this render
--color-info-foreground#faf8f5#1c1410Not available in this render
--color-input#ddd1bf#3a312bNot available in this render
--color-muted#f5f0ea#2a2320Not available in this render
--color-muted-foreground#695746#b09a7bNot available in this render
--color-muted-hover#ebe3d7#3a312bNot available in this render
--color-nightsky-100#dde4eeInherits light declarationNot available in this render
--color-nightsky-200#c1cde0Inherits light declarationNot available in this render
--color-nightsky-300#97abccInherits light declarationNot available in this render
--color-nightsky-400#6b85b3Inherits light declarationNot available in this render
--color-nightsky-50#f0f3f7Inherits light declarationNot available in this render
--color-nightsky-500#4b679aInherits light declarationNot available in this render
--color-nightsky-600#3c5281Inherits light declarationNot available in this render
--color-nightsky-700#334369Inherits light declarationNot available in this render
--color-nightsky-800#2d3a58Inherits light declarationNot available in this render
--color-nightsky-900#1e2740Inherits light declarationNot available in this render
--color-nightsky-950#151c2eInherits light declarationNot available in this render
--color-ochre-100#faeadbInherits light declarationNot available in this render
--color-ochre-200#f4d2b5Inherits light declarationNot available in this render
--color-ochre-300#ecb485Inherits light declarationNot available in this render
--color-ochre-400#e29455Inherits light declarationNot available in this render
--color-ochre-50#fdf6f0Inherits light declarationNot available in this render
--color-ochre-500#c9743aInherits light declarationNot available in this render
--color-ochre-600#b45e2aInherits light declarationNot available in this render
--color-ochre-700#964a22Inherits light declarationNot available in this render
--color-ochre-800#7a3d20Inherits light declarationNot available in this render
--color-ochre-900#65331dInherits light declarationNot available in this render
--color-ochre-950#3a1a0eInherits light declarationNot available in this render
--color-orange-100#ffedd5Inherits light declarationNot available in this render
--color-orange-200#fed7aaInherits light declarationNot available in this render
--color-orange-300#fdba74Inherits light declarationNot available in this render
--color-orange-400#fb923cInherits light declarationNot available in this render
--color-orange-50#fff7edInherits light declarationNot available in this render
--color-orange-500#f97316Inherits light declarationNot available in this render
--color-orange-600#ea580cInherits light declarationNot available in this render
--color-orange-700#c2410cInherits light declarationNot available in this render
--color-orange-800#9a3412Inherits light declarationNot available in this render
--color-orange-900#7c2d12Inherits light declarationNot available in this render
--color-orange-950#431407Inherits light declarationNot available in this render
--color-pink-100#fce7f3Inherits light declarationNot available in this render
--color-pink-200#fbcfe8Inherits light declarationNot available in this render
--color-pink-300#f9a8d4Inherits light declarationNot available in this render
--color-pink-400#f472b6Inherits light declarationNot available in this render
--color-pink-50#fdf2f8Inherits light declarationNot available in this render
--color-pink-500#ec4899Inherits light declarationNot available in this render
--color-pink-600#db2777Inherits light declarationNot available in this render
--color-pink-700#be185dInherits light declarationNot available in this render
--color-pink-800#9d174dInherits light declarationNot available in this render
--color-pink-900#831843Inherits light declarationNot available in this render
--color-pink-950#500724Inherits light declarationNot available in this render
--color-popover#ffffff#241c17Not available in this render
--color-popover-foreground#2e2720#f5f0eaNot available in this render
--color-primary#b45e2a#e29455Not available in this render
--color-primary-active#7a3d20#c9743aNot available in this render
--color-primary-foreground#fffdfb#1c1410Not available in this render
--color-primary-hover#964a22#ecb485Not available in this render
--color-purple-100#f3e8ffInherits light declarationNot available in this render
--color-purple-200#e9d5ffInherits light declarationNot available in this render
--color-purple-300#d8b4feInherits light declarationNot available in this render
--color-purple-400#c084fcInherits light declarationNot available in this render
--color-purple-50#faf5ffInherits light declarationNot available in this render
--color-purple-500#a855f7Inherits light declarationNot available in this render
--color-purple-600#9333eaInherits light declarationNot available in this render
--color-purple-700#7e22ceInherits light declarationNot available in this render
--color-purple-800#6b21a8Inherits light declarationNot available in this render
--color-purple-900#581c87Inherits light declarationNot available in this render
--color-purple-950#3b0764Inherits light declarationNot available in this render
--color-red-100#fee2e2Inherits light declarationNot available in this render
--color-red-200#fecacaInherits light declarationNot available in this render
--color-red-300#fca5a5Inherits light declarationNot available in this render
--color-red-400#f87171Inherits light declarationNot available in this render
--color-red-50#fef2f2Inherits light declarationNot available in this render
--color-red-500#ef4444Inherits light declarationNot available in this render
--color-red-600#dc2626Inherits light declarationNot available in this render
--color-red-700#b91c1cInherits light declarationNot available in this render
--color-red-800#991b1bInherits light declarationNot available in this render
--color-red-900#7f1d1dInherits light declarationNot available in this render
--color-red-950#450a0aInherits light declarationNot available in this render
--color-ring#b45e2a#e29455Not available in this render
--color-sand-100#f5f0eaInherits light declarationNot available in this render
--color-sand-200#ebe3d7Inherits light declarationNot available in this render
--color-sand-300#ddd1bfInherits light declarationNot available in this render
--color-sand-400#c9b89eInherits light declarationNot available in this render
--color-sand-50#faf8f5Inherits light declarationNot available in this render
--color-sand-500#b09a7bInherits light declarationNot available in this render
--color-sand-600#9a8265Inherits light declarationNot available in this render
--color-sand-700#806a52Inherits light declarationNot available in this render
--color-sand-800#695746Inherits light declarationNot available in this render
--color-sand-900#574a3cInherits light declarationNot available in this render
--color-sand-950#2e2720Inherits light declarationNot available in this render
--color-secondary#386b4f#6ba380Not available in this render
--color-secondary-active#274536#4a8664Not available in this render
--color-secondary-foreground#faf8f5#1c1410Not available in this render
--color-secondary-hover#2e5641#98c1a8Not available in this render
--color-slate-100#f1f5f9Inherits light declarationNot available in this render
--color-slate-200#e2e8f0Inherits light declarationNot available in this render
--color-slate-300#cbd5e1Inherits light declarationNot available in this render
--color-slate-400#94a3b8Inherits light declarationNot available in this render
--color-slate-50#f8fafcInherits light declarationNot available in this render
--color-slate-500#64748bInherits light declarationNot available in this render
--color-slate-600#475569Inherits light declarationNot available in this render
--color-slate-700#334155Inherits light declarationNot available in this render
--color-slate-800#1e293bInherits light declarationNot available in this render
--color-slate-900#0f172aInherits light declarationNot available in this render
--color-slate-950#020617Inherits light declarationNot available in this render
--color-success#386b4f#6ba380Not available in this render
--color-success-foreground#faf8f5#1c1410Not available in this render
--color-success-hover#2e5641#98c1a8Not available in this render
--color-teal-100#ccfbf1Inherits light declarationNot available in this render
--color-teal-200#99f6e4Inherits light declarationNot available in this render
--color-teal-300#5eead4Inherits light declarationNot available in this render
--color-teal-400#2dd4bfInherits light declarationNot available in this render
--color-teal-50#f0fdfaInherits light declarationNot available in this render
--color-teal-500#14b8a6Inherits light declarationNot available in this render
--color-teal-600#0d9488Inherits light declarationNot available in this render
--color-teal-700#0f766eInherits light declarationNot available in this render
--color-teal-800#115e59Inherits light declarationNot available in this render
--color-teal-900#134e4aInherits light declarationNot available in this render
--color-teal-950#042f2eInherits light declarationNot available in this render
--color-terracotta-100#fde3dbInherits light declarationNot available in this render
--color-terracotta-200#fcc8b8Inherits light declarationNot available in this render
--color-terracotta-300#f9a188Inherits light declarationNot available in this render
--color-terracotta-400#f47556Inherits light declarationNot available in this render
--color-terracotta-50#fef3f0Inherits light declarationNot available in this render
--color-terracotta-500#e85a38Inherits light declarationNot available in this render
--color-terracotta-600#d4421fInherits light declarationNot available in this render
--color-terracotta-700#b13518Inherits light declarationNot available in this render
--color-terracotta-800#922f19Inherits light declarationNot available in this render
--color-terracotta-900#792b1aInherits light declarationNot available in this render
--color-terracotta-950#42130aInherits light declarationNot available in this render
--color-warning#d97706#fbbf24Not available in this render
--color-warning-foreground#1c1410#1c1410Not available in this render
--color-zinc-100#f4f4f5Inherits light declarationNot available in this render
--color-zinc-200#e4e4e7Inherits light declarationNot available in this render
--color-zinc-300#d4d4d8Inherits light declarationNot available in this render
--color-zinc-400#a1a1aaInherits light declarationNot available in this render
--color-zinc-50#fafafaInherits light declarationNot available in this render
--color-zinc-500#71717aInherits light declarationNot available in this render
--color-zinc-600#52525bInherits light declarationNot available in this render
--color-zinc-700#3f3f46Inherits light declarationNot available in this render
--color-zinc-800#27272aInherits light declarationNot available in this render
--color-zinc-900#18181bInherits light declarationNot available in this render
--color-zinc-950#09090bInherits light declarationNot available in this render
--container-2xl1536pxInherits light declarationNot available in this render
--container-lg1024pxInherits light declarationNot available in this render
--container-md768pxInherits light declarationNot available in this render
--container-prose65chInherits light declarationNot available in this render
--container-sm640pxInherits light declarationNot available in this render
--container-xl1280pxInherits light declarationNot available in this render
--duration-fast100msInherits light declarationNot available in this render
--duration-instant0msInherits light declarationNot available in this render
--duration-normal200msInherits light declarationNot available in this render
--duration-slow300msInherits light declarationNot available in this render
--duration-slower500msInherits light declarationNot available in this render
--ease-bouncecubic-bezier(0.68, -0.55, 0.265, 1.55)Inherits light declarationNot available in this render
--ease-defaultcubic-bezier(0.4, 0, 0.2, 1)Inherits light declarationNot available in this render
--ease-incubic-bezier(0.4, 0, 1, 1)Inherits light declarationNot available in this render
--ease-in-outcubic-bezier(0.4, 0, 0.2, 1)Inherits light declarationNot available in this render
--ease-outcubic-bezier(0, 0, 0.2, 1)Inherits light declarationNot available in this render
--font-display'Playfair Display', serifInherits light declarationNot available in this render
--font-monoui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospaceInherits light declarationNot available in this render
--font-sans'Inter', system-ui, sans-serifInherits light declarationNot available in this render
--opacity-00%Inherits light declarationNot available in this render
--opacity-1010%Inherits light declarationNot available in this render
--opacity-100100%Inherits light declarationNot available in this render
--opacity-2020%Inherits light declarationNot available in this render
--opacity-2525%Inherits light declarationNot available in this render
--opacity-3030%Inherits light declarationNot available in this render
--opacity-4040%Inherits light declarationNot available in this render
--opacity-55%Inherits light declarationNot available in this render
--opacity-5050%Inherits light declarationNot available in this render
--opacity-6060%Inherits light declarationNot available in this render
--opacity-7070%Inherits light declarationNot available in this render
--opacity-7575%Inherits light declarationNot available in this render
--opacity-8080%Inherits light declarationNot available in this render
--opacity-9090%Inherits light declarationNot available in this render
--opacity-9595%Inherits light declarationNot available in this render
--radiusvar(--radius-lg)Inherits light declarationNot available in this render
--radius-2xl2remInherits light declarationNot available in this render
--radius-full9999pxInherits light declarationNot available in this render
--radius-lg1remInherits light declarationNot available in this render
--radius-md0.5remInherits light declarationNot available in this render
--radius-none0pxInherits light declarationNot available in this render
--radius-sm0.25remInherits light declarationNot available in this render
--radius-xl1.5remInherits light declarationNot available in this render
--ring-colorvar(--color-ring)Inherits light declarationNot available in this render
--ring-offset2pxInherits light declarationNot available in this render
--ring-width2pxInherits light declarationNot available in this render
--shadow-2xl0 25px 50px -12px rgb(46 39 32 / 0.2)0 25px 50px -12px rgb(0 0 0 / 0.5)Not available in this render
--shadow-lg0 10px 15px -3px rgb(46 39 32 / 0.08), 0 4px 6px -4px rgb(46 39 32 / 0.06)0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3)Not available in this render
--shadow-md0 4px 6px -1px rgb(46 39 32 / 0.08), 0 2px 4px -2px rgb(46 39 32 / 0.06)0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3)Not available in this render
--shadow-sm0 1px 3px 0 rgb(46 39 32 / 0.08), 0 1px 2px -1px rgb(46 39 32 / 0.06)0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3)Not available in this render
--shadow-xl0 20px 25px -5px rgb(46 39 32 / 0.08), 0 8px 10px -6px rgb(46 39 32 / 0.06)0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4)Not available in this render
--shadow-xs0 1px 2px 0 rgb(46 39 32 / 0.04)0 1px 2px 0 rgb(0 0 0 / 0.2)Not available in this render
--spacing-00pxInherits light declarationNot available in this render
--spacing-0-50.125remInherits light declarationNot available in this render
--spacing-10.25remInherits light declarationNot available in this render
--spacing-1-50.375remInherits light declarationNot available in this render
--spacing-102.5remInherits light declarationNot available in this render
--spacing-123remInherits light declarationNot available in this render
--spacing-164remInherits light declarationNot available in this render
--spacing-20.5remInherits light declarationNot available in this render
--spacing-2-50.625remInherits light declarationNot available in this render
--spacing-205remInherits light declarationNot available in this render
--spacing-246remInherits light declarationNot available in this render
--spacing-30.75remInherits light declarationNot available in this render
--spacing-41remInherits light declarationNot available in this render
--spacing-51.25remInherits light declarationNot available in this render
--spacing-61.5remInherits light declarationNot available in this render
--spacing-82remInherits light declarationNot available in this render
--text-2xl1.5remInherits light declarationNot available in this render
--text-3xl1.875remInherits light declarationNot available in this render
--text-4xl2.25remInherits light declarationNot available in this render
--text-5xl3remInherits light declarationNot available in this render
--text-6xl3.75remInherits light declarationNot available in this render
--text-base1remInherits light declarationNot available in this render
--text-lg1.125remInherits light declarationNot available in this render
--text-sm0.875remInherits light declarationNot available in this render
--text-xl1.25remInherits light declarationNot available in this render
--text-xs0.75remInherits light declarationNot available in this render
--transition-colorscolor, background-color, border-color, text-decoration-color, fill, strokeInherits light declarationNot available in this render
--transition-opacityopacityInherits light declarationNot available in this render
--transition-shadowbox-shadowInherits light declarationNot available in this render
--transition-transformtransformInherits light declarationNot available in this render
--z-dropdown50Inherits light declarationNot available in this render
--z-fixed200Inherits light declarationNot available in this render
--z-modal400Inherits light declarationNot available in this render
--z-modal-backdrop300Inherits light declarationNot available in this render
--z-popover500Inherits light declarationNot available in this render
--z-sticky100Inherits light declarationNot available in this render
--z-toast700Inherits light declarationNot available in this render
--z-tooltip600Inherits light declarationNot available in this render

Using tokens in code

css
.source-panel {
  color: var(--color-card-foreground);
  background: var(--color-card);
  padding: var(--spacing-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.source-panel a {
  color: var(--color-primary);
  transition: color var(--duration-fast) var(--ease-out);
}

Copying a declaration preserves var(...) references. Enable Include known alias dependencies to add their declared transitive references to CSS/JSON exports; otherwise the filtered fragment still needs the shared stylesheet. Missing external references, fallback branches and cycles require inspection rather than an assumed resolution. A token is a styling decision, not proof that every foreground/background combination is accessible.

Theme boundaries and overrides

The explicit .dark class overrides theme-dependent roles. Tokens without a dark override inherit their light declaration. A matching system-preference fallback applies before JavaScript initializes; explicit .light overrides that fallback. The page theme controls live values independently of the export selector.

css
/* A scoped role override inherits everything else. */
.campaign {
  --color-primary: #964a22;
  --color-primary-hover: #7a3d20;
  --color-primary-foreground: #fffdfb;
}

Change foreground and background as a pair. Check hover, active and focus states as well as the default. An override on an ordinary element may not reach a popup rendered through a portal; place shared theme overrides on the document root or provide the same scope to the portal.

Keeping the reference current

bash
pnpm --filter styleguide tokens:generate
pnpm --filter styleguide tokens:check
pnpm --filter styleguide typecheck
pnpm --filter styleguide build

Edit the shared stylesheet, then regenerate the catalogue. The check command compares generated content with the current CSS and fails if they drift. Builds generate the catalogue automatically. Review renamed or removed tokens as API changes because consumers may use those custom properties directly.

Compiled explorer and reference parser

tsx
'use client';

import { useEffect, useMemo, useState } from 'react';
import { Button } from '@mobtranslate/ui';
import catalogue from '../content/tokens.json';
import {inspectTokenGraph} from '../lib/token-references';
import './token-explorer.css';

export function TokenExplorer() {
  const [query, setQuery] = useState('');
  const [group, setGroup] = useState('all');
  const [theme, setTheme] = useState<'light' | 'dark'>('light');
  const [resolved, setResolved] = useState<Record<string, string>>({});
  const [status, setStatus] = useState('');
  const [dependencies,setDependencies]=useState(false);
  const groups = useMemo(() => [...new Set(catalogue.tokens.map((token) => token.name.slice(2).split('-')[0]))].sort(), []);

  useEffect(() => {
    const update = () => {
      const styles = getComputedStyle(document.documentElement);
      setResolved(Object.fromEntries(catalogue.tokens.map((token) => [token.name, styles.getPropertyValue(token.name).trim()])));
    };
    update();
    const observer = new MutationObserver(update);
    observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'style'] });
    return () => observer.disconnect();
  }, []);

  const tokens = catalogue.tokens.filter((token) =>
    (group === 'all' || token.name.slice(2).split('-')[0] === group) &&
    `${token.name} ${token.value} ${token.dark ?? ''}`.toLowerCase().includes(query.trim().toLowerCase())
  );
  const graph=inspectTokenGraph(catalogue.tokens,tokens.map(token=>token.name),theme);
  const exported=dependencies?graph.tokens:tokens;
  const css = `:root {\n${exported.map((token) => `  ${token.name}: ${theme === 'dark' ? token.dark ?? token.value : token.value};`).join('\n')}\n}`;

  const copy = async (value: string) => {
    try { await navigator.clipboard.writeText(value); setStatus('Copied to clipboard.'); }
    catch { setStatus('Clipboard unavailable. Select the token name and value to copy them manually.'); }
  };

  return <div className="token-explorer space-y-4">
    <div className="grid gap-4 sm:grid-cols-3">
      <label className="block">Search tokens<input className="mt-input w-full mt-2" data-token-query type="search" value={query} onChange={(event) => setQuery(event.target.value)} placeholder="Name or declared value" /></label>
      <label className="block">Token group<select className="mt-input w-full mt-2" value={group} onChange={(event) => setGroup(event.target.value)}><option value="all">All groups</option>{groups.map((name) => <option key={name} value={name}>{name}</option>)}</select></label>
      <label className="block">Export theme<select className="mt-input w-full mt-2" data-token-export-theme value={theme} onChange={(event) => setTheme(event.target.value as typeof theme)}><option value="light">Light declarations</option><option value="dark">Dark declarations</option></select></label>
    </div>
    <label className="flex gap-3 items-center min-h-11"><input data-token-dependencies type="checkbox" checked={dependencies} onChange={event=>setDependencies(event.target.checked)} />Include known alias dependencies in exports</label>
    <div className="flex flex-wrap gap-3 items-center">
      <Button data-token-copy variant="outline" onClick={() => copy(css)} disabled={!tokens.length}>Copy filtered CSS</Button>
      <a className="mt-btn mt-btn-outline mt-btn-md" href={`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify({ source: catalogue.source, theme, requested:tokens.map(token=>token.name), tokens:exported }, null, 2))}`} download="mobtranslate-tokens.json">Download filtered JSON</a>
      <Button variant="ghost" onClick={() => { setQuery(''); setGroup('all'); }}>Reset filters</Button>
    </div>
    <p data-token-status role="status" className="text-sm">{tokens.length} of {catalogue.tokens.length} tokens. {status}</p>
    <p data-token-export-scope>{exported.length} declarations in this export. {dependencies?'Known declared references, including fallback branches, are included.':'This is a filtered fragment; references may require the shared stylesheet.'} {graph.missing.length?`${graph.missing.length} referenced names are absent from this catalogue; external scope or fallback behavior needs inspection.`:''} {graph.cycles.length?`${graph.cycles.length} reference cycles found; inspect the actual CSS before adoption.`:''}</p>
    <details data-token-reference-details><summary className="min-h-11">Declared references for the current filter and export theme</summary>
      <p>The source graph preserves var() relationships. It does not evaluate the live cascade, CSS fallback selection, units or contrast. Export theme selects authored declarations independently of the page theme.</p>
      <div className="doc-table" role="region" aria-label="Declared token reference graph" tabIndex={0}><table><thead><tr><th scope="col">Name</th><th scope="col">Authored value</th><th scope="col">References</th></tr></thead><tbody>{graph.nodes.map(node=><tr key={node.name}><th scope="row">{node.name}</th><td>{node.value}</td><td>{node.references.join(', ')||'No declared var() reference'}</td></tr>)}</tbody></table></div>
      {graph.missing.length>0&&<p>Absent names: {graph.missing.join(', ')}</p>}{graph.cycles.map((cycle,index)=><p key={index}>Cycle: {cycle.join(' → ')}</p>)}
    </details>
    {!tokens.length ? <p>No tokens match. Try a shorter name or reset the filters.</p> :
      <div data-token-catalogue className="doc-table" tabIndex={0} role="region" aria-label="Scrollable token catalogue">
        <table><thead><tr><th scope="col">Token</th><th scope="col">Light declaration</th><th scope="col">Dark override</th><th scope="col">Live value</th><th scope="col">Copy</th></tr></thead><tbody>{tokens.map((token) => <tr key={token.name}>
          <th scope="row" className="font-mono whitespace-nowrap">{token.name}</th>
          <td className="font-mono">{token.value}</td>
          <td className="font-mono">{token.dark ?? 'Inherits light declaration'}</td>
          <td className="font-mono">{resolved[token.name] || 'Not available in this render'}</td>
          <td><button className="min-h-11 px-3 font-semibold" aria-label={`Copy ${token.name}`} onClick={() => copy(`${token.name}: ${theme === 'dark' ? token.dark ?? token.value : token.value};`)}>Copy</button></td>
        </tr>)}</tbody></table>
      </div>}
  </div>;
}

ts
import valueParser from 'postcss-value-parser';

export interface DeclaredToken {name:string;value:string;dark?:string|null}
export function references(value:string):string[]{
  const names=new Set<string>();
  valueParser(value).walk(node=>{
    if(node.type!=='function'||node.value.toLowerCase()!=='var')return;
    const first=node.nodes.find(part=>part.type!=='space'&&part.type!=='comment');
    if(first?.type==='word'&&first.value.startsWith('--'))names.add(first.value);
  });
  return [...names];
}
export function inspectTokenGraph(catalogue:DeclaredToken[],requested:string[],theme:'light'|'dark'){
  const byName=new Map(catalogue.map(token=>[token.name,token]));
  const nodes=new Map<string,{name:string;value:string;references:string[]}>();
  const missing=new Set<string>();const cycles:string[][]=[];const visited=new Set<string>();
  function visit(name:string,stack:string[]){
    const at=stack.indexOf(name);
    if(at>=0){cycles.push([...stack.slice(at),name]);return;}
    if(visited.has(name))return;
    const token=byName.get(name);if(!token){missing.add(name);return;}
    const value=theme==='dark'?token.dark??token.value:token.value;
    const refs=references(value);nodes.set(name,{name,value,references:refs});
    for(const ref of refs)visit(ref,[...stack,name]);
    visited.add(name);
  }
  for(const name of requested)visit(name,[]);
  return {tokens:catalogue.filter(token=>nodes.has(token.name)),nodes:[...nodes.values()],missing:[...missing],cycles};
}