# Tokens

Colour roles with their live values and contrast.

## Foundations

All custom properties are prefixed `--rax-`; all classes `rax-`. No colour or font family is written anywhere outside `tokens.css`. Do not write raw colours in app code either; use the roles.

### Typography

| Token | Value | Use |
|---|---|---|
| `--rax-font` | Inter Variable, system sans fallback | All UI text |
| `--rax-mono` | Red Hat Mono (400, 500), system mono fallback | Code, IDs, keys, shortcuts only |
| `--rax-fs` | 0.9375rem (15px) | Body, controls, labels, table cells |
| `--rax-fs-sm` | 0.875rem (14px) | Secondary text, table headers, hints, badges |
| `--rax-fs-h` | 1.125rem (18px) | Panel titles |
| `--rax-fs-title` | 1.5rem (24px) | Page titles, stat values |

- Nothing renders below 14px.
- Line height 1.5 for text, 1.25 for headings.
- Weights: 400 body and cell values; 500 labels; 600 buttons, table headers, primary cell text, badges, active tab and nav item; 700 page title, panel title, stat value, empty-state title.
- Numbers in tables and stats use tabular figures in the UI font. Mono is never used for figures.
- No tracked capitals and no mono labels.
- Fonts are self-hosted through `@fontsource-variable/inter` and `@fontsource/red-hat-mono` and imported by `styles.css`. No third-party font CDN.

### Size and spacing

| Token | Default | Compact | Coarse pointer |
|---|---|---|---|
| `--rax-h-ctl` (control height) | 40px | 30px | 44px |
| `--rax-h-ctl-sm` | 32px | 26px | 40px |
| `--rax-px-ctl` (control side padding) | 16px | 12px | 16px |
| `--rax-row-h` (table row) | 48px | 34px | 48px |
| `--rax-cell-px` (table cell side padding) | 16px | 12px | 16px |

- Panel: head padding 16px 20px, body 20px, footer 16px 20px with a 12px gap.
- Field: 8px between label, control and hint. Forms: 20px between fields, one column.
- Key-value lists: 12px row gap, 24px column gap. Page: 24px between sections.
- Spacing follows a 4px scale; control internals may use 2px steps.

### Shape

- Radius: controls 6px (`--rax-r-ctl`), panels and dialogs 10px (`--rax-r-panel`), badges 4px (`--rax-r-badge`), checkbox 3px (`--rax-r-check`); switch and avatar are fully round.
- Borders are 1px with three roles: `--rax-line` for dividers and panel borders (structure), `--rax-line-strong` for emphasis lines, the segmented control outline and the neutral badge outline, `--rax-edge` for the outline of anything you can click or type into (at least 3:1 against its background).
- Flat. No shadows on in-flow elements. Floating layers (dialog, popover, menu, tooltip, toast) use `--rax-shadow-float` only. `--rax-scrim` is the dialog backdrop.

### Colour roles

| Role | Light | Dark |
|---|---|---|
| `--rax-bg` | oklch(0.968 0.005 h) | oklch(0 0 0) |
| `--rax-surface` | oklch(1 0 0) | oklch(0.10 0.004 h) |
| `--rax-surface-2` | oklch(0.958 0.006 h) | oklch(0.155 0.006 h) |
| `--rax-surface-3` | oklch(0.925 0.008 h) | oklch(0.20 0.008 h) |
| `--rax-line` | oklch(0.885 0.008 h) | oklch(0.25 0.008 h) |
| `--rax-line-strong` | oklch(0.80 0.01 h) | oklch(0.34 0.01 h) |
| `--rax-edge` | oklch(0.60 0.014 h) | oklch(0.55 0.012 h) |
| `--rax-ink` | oklch(0.19 0.02 h) | oklch(0.97 0.004 h) |
| `--rax-ink-2` | oklch(0.40 0.016 h) | oklch(0.80 0.01 h) |
| `--rax-ink-3` | oklch(0.48 0.014 h) | oklch(0.68 0.01 h) |
| `--rax-focus` | oklch(0.46 max(c, 0.08) h) | oklch(0.82 max(c, 0.06) h) |

Also: `--rax-accent`, `--rax-accent-ink`, `--rax-accent-soft`, `--rax-accent-line`, `--rax-accent-text` (accent text on the surface, 4.5:1), `--rax-warn-on` (text on a solid warn fill), the same four for `--rax-accent-2`, and the status roles `--rax-ok`, `--rax-warn`, `--rax-danger`, each with `-soft` (fill) and `-ink` (text on the soft fill, 4.5:1). Status glyphs are lucide icons (CircleCheck, TriangleAlert, OctagonMinus, Info, Circle), drawn solid: the shape is filled and the mark is cut out of it; idle is an empty ring. They appear in badges, alerts, toasts, timelines and field errors.

Contrast rules:

- Body text 4.5:1 minimum.
- Secondary text that carries meaning uses `--rax-ink-2` (7:1). `--rax-ink-3` (4.5:1) is for placeholders, empty-cell dashes and disabled hints only.
- Control outlines (`--rax-edge`) and the focus ring 3:1 minimum.
- Few colours: one accent (a second only when the brand needs it), three statuses, tinted neutrals. Status colour is never decorative.

### Motion and feedback

- Colour and border transitions are 100ms. `transform` and `opacity` are the only animated geometry. Never `transition: all`.
- Loading indicators appear only after 100ms, so fast responses never flash a spinner.
- Nothing animates for decoration. Under `prefers-reduced-motion: reduce` nothing travels and spinners are static.
- Focus: `outline: 2px solid var(--rax-focus); outline-offset: 2px` on `:focus-visible`, shown instantly. Inside tabs, nav, list rows and table rows the offset is `-2px` (inset).

### Tailwind bridge

With `@a31labs/rax/tailwind.css` imported, layout code can use `bg-surface`, `text-ink-2`, `border-line`, `rounded-panel` and the other mapped names. The bridge maps tokens only; components keep their own classes.

Page: https://rax.a31.at/foundations/tokens
