```
Available tokens:
- `background` / `foreground`
- `primary` / `primary-foreground`
- `secondary` / `secondary-foreground`
- `muted` / `muted-foreground`
- `accent` / `accent-foreground`
- `destructive` / `destructive-foreground`
- `border` / `input` / `ring`
## `cn()` Utility
Use `cn()` (clsx + tailwind-merge) whenever classes are conditional or need to be overridable from a prop:
```tsx
import { cn } from "@/lib/utils";
```
## Focus States (A11y)
Every interactive element needs a visible focus state:
```tsx
className="focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
```
In Tailwind v4, `outline-hidden` hides the default outline but keeps it visible in forced-colors mode; `outline-none` sets `outline-style: none` and removes it there too. Tailwind v3 projects keep `outline-none`, which has the v4 `outline-hidden` behavior.
Screen-reader-only text: `
...`.
## Tailwind v4 Theme
Tailwind v4 uses CSS-based configuration. `tailwind.config.js` is deprecated. Add custom tokens via `@theme` in `app/globals.css`:
```css
@import "tailwindcss";
@theme {
--spacing-18: 4.5rem;
--color-brand-50: #...;
--color-brand-900: #...;
}
```
## Anti-Patterns
- **`@apply` in CSS files**: defeats utility-first intent. Use classes in JSX, or extract a component.
- **Hardcoded hex/rgb**: always go through the token system.
- **Desktop-first breakpoints**: `grid-cols-3 sm:grid-cols-1` reverses the mobile-first flow.
- **Nested overrides**: if you find yourself writing `lg:!bg-primary`, the component API is wrong; add a variant instead.
## Formatting
Follow whatever class-sorting convention the project's formatter enforces (Prettier + `prettier-plugin-tailwindcss`, Biome's `useSortedClasses`, or similar). Do not hand-reorder against the formatter.