# Dashboard Design Standard
**Scope:** every screen in `backoffice-template` and every client project forked from it.
**Status:** authoritative. Where this document and a component disagree, the component is wrong.
**Basis:** the `ui-ux-pro-max` design-intelligence skill, whose database matches an MLM back-office to
its **Data-Dense Dashboard** style — _multiple charts/widgets, data tables, KPI cards, minimal
padding, grid layout, maximum data visibility_, rated ⚡ excellent performance / ✓ WCAG AA.
**Current client: babyboo.my** — baby & maternity retail, competing against Medela, Momcozy,
Kinderkraft and Hamilton. The audience is sleep-deprived, time-poor, highly selective parents, so
every decision is ranked **clarity → speed → trust**, in that order. The register is warm and
reassuring rather than clinical: a cream page instead of white, warm neutrals instead of grey, and a
generous radius so **nothing on screen has a sharp edge**. Density stays — this is still an operator
tool — but softened.
Two of the skill's raw recommendations are **deliberately rejected**, and must not be reintroduced:
| Rejected | Why |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Dark-first palette (`#020617` bg) | CoLink `PRODUCT.md` lists "dark terminal aesthetic" as an anti-reference for admin staff working in daylit offices. We ship light-default with a full dark option. |
| `Fira Code` as heading font | Monospace headings read as developer-tooling. Wrong register for non-technical association staff. Monospace is reserved for numerals. |
---
## 1. Principles
1. **Clarity over cleverness.** Every screen makes the next action obvious. Navigation, labels and
hierarchy exist to guide, not to impress.
2. **Context awareness.** Admins and members have different jobs. Orient each to what matters without
making them hunt.
3. **Earned polish.** Refinement comes from precision — consistent spacing, deliberate colour,
purposeful motion — never from decoration piled on top.
4. **Progressive disclosure.** Surface the common task immediately; keep advanced options reachable
but out of the way. Not every edge case is a first-class element.
5. **Trustworthy by default.** This software handles money and personal data. Communicate reliability
through consistency, clear feedback, and explicit confirmation of destructive actions.
**Anti-references** — if a screen starts resembling these, stop: generic SaaS-blue admin template;
cluttered legacy ERP (microscopic labels, toolbar overload, modal-on-modal); dark code-editor UI;
anything that feels clinical, sterile or hard-edged.
**Tone for babyboo.my.** Warm, safe, calm. Rounded corners everywhere — `--radius` is 1rem and even
the derived `sm` size is 12px. Badges are pills. Avatars and brand marks are circles. No square
chips, no hairline-sharp dividers, no cold greys: neutrals are warm-tinted throughout. A tired parent
scanning this at 3am should find it soft to look at and obvious to operate.
---
## 2. Tokens
All colour lives as plain CSS custom properties in `app/globals.css` — `:root` is light, `.dark` is
dark — mapped into Tailwind by `tailwind.config.ts` (through `color-mix`, so opacity modifiers work).
**No component may contain a colour literal.** Re-skinning a client = editing those two blocks,
nothing else. Every colour token needs a value in both blocks. `scripts/check-contrast.py` reads the
same file. (These tokens used to live in `src/styles/_variables.scss`; references to that file below
are historical.)
The palette is CoLink's: indigo primary, pink accent.
| Token | Light | Dark | Use |
| ---------------------- | --------- | --------- | ----------------------------------------------- |
| `--background` | `#FDFBF7` | `#17120F` | Page canvas — warm cream, not white |
| `--foreground` | `#121212` | `#F8F4EF` | Body text (client-specified) |
| `--card` | `#FFFFFF` | `#211A16` | Widget/table surface |
| `--primary` | `#6E3E17` | `#D9A05B` | Brand, primary action, active nav |
| `--primary-foreground` | `#FFFFFF` | `#241A10` | Text on primary |
| `--accent` | `#F2BC57` | `#F2BC57` | Brand gold — **fill only**, always with `--accent-foreground` |
| `--accent-foreground` | `#3A2410` | `#241A10` | Text/glyphs sitting on an accent fill |
| `--accent-strong` | `#9A6212` | `#F2BC57` | The accent family as **text, icon or stroke** |
| `--muted` | `#F7F2EA` | `#2E251F` | Subtle fills, table stripes |
| `--muted-foreground` | `#6F5B48` | `#BCA994` | Secondary text — **floor value, never lighter** |
| `--positive` | `#1B6E3E` | `#6FCF97` | Gains, paid, active |
| `--negative` | `#B3261E` | `#F08A82` | Losses, suspended, errors |
| `--warning` | `#8F5200` | `#F0B94A` | Pending, inactive |
| `--border` | `#EDE4D8` | `#332A23` | Dividers only — decorative, deliberately subtle |
| `--input` | `#8D7761` | `#7A6A5C` | Form-control boundaries — **must** clear 3:1 |
| `--ring` | `#6E3E17` | `#D9A05B` | Focus ring |
| `--radius` | `1rem` | — | `lg`; `md` = −2px, `sm` = −4px. Generous by brief |
| `--table-head` | `#F7D99A` | `#4A3A1A` | Data-table header row (soft gold; full `--accent` is too low for dusty-blue text, 4.0:1) |
| `--table-head-foreground` | `#3E5C7A` | `#DBE7F2` | Header text, incl. sortable headers (5.1:1 / 8.8:1); sorted column = arrow + bold |
| `--table-radius` | `calc(var(--radius) - 4px)` = 12px | — | Data-table frames (`rounded-table`), tighter than cards (20px) for dense data — added 2026-10-23 |
| `--contrast` | `#4F7396` | `#9DB8D2` | Dusty blue (added 2026-10-23): icon/stroke for kinds, never status or a primary action |
| `--contrast-foreground`| `#3E5C7A` | `#DBE7F2` | Text on a `--contrast-soft` pill (5.8:1 / 10.7:1) |
| `--contrast-soft` | `#E4ECF3` | `#22303D` | Fill of a category pill |
**Category pills (added 2026-10-23).** A *kind* — order type, fulfilment mode — is not a *state*,
so it never borrows the status tones. `Badge` has three category tones: `contrast` (dusty blue),
`teal` (`--chart-2`) and `violet` (`--chart-4`), each a 10% tint with its own text colour (all ≥ 4.5:1,
verified by `check-contrast.py`), plus `neutral`. Sales listing: Web / Delivery = contrast, Event =
violet, Outlet / Pickup = teal, Counter / Take now = neutral (`ORDER_TYPE_TONE`, `FULFILMENT_TONE`).
The pill always carries its label. The same tones colour each channel everywhere: dashboard Revenue-by-channel bars and the Reports
Channel column use `channelTone` (NORMAL = contrast, EVENT = violet, OUTLET = teal) and
`CATEGORY_TONE_COLOR` (`--contrast`, `--chart-4`, `--chart-2`, `--muted-foreground`). The dashboard
revenue trend is drawn in `--contrast`, top-earner bars in `--chart-2`, and the Reports totals strip
sits on `--contrast-soft`.
**Brand pattern.** `.giraffe-spots` (in `app/globals.css`, artwork `--giraffe-motif`) turns an element
into the giraffe-coat pattern via a mask, coloured by `--giraffe-patch` (default `--accent`). Used on
the login brand panel as a brown coat (`--giraffe-patch: var(--primary)`) at 14% over `--accent` — dark `--accent-foreground` text stays ≥ 7.0:1 on a patch. Decorative; elsewhere only where the owner specifies.
**The brand gold is a fill, never a colour.** `#F2BC57` measures **1.73:1 against white**, so on a
light surface it can never carry text, a thin indicator line, or a chart series — it would be
invisible. It is only ever a filled surface with `--accent-foreground` on top (8.41:1). Anything in
the accent family that has to *carry meaning* — an icon glyph, a sparkline stroke, an active
indicator bar — uses `--accent-strong` (5.08:1). This is why the accent is absent from the chart
ramp, and why the contrast script checks `accent-strong` strictly while exempting `accent` itself.
Dark `--primary` is a lightened tint of the brand brown: `#6E3E17` is too dark to read as a surface
against an espresso background, so dark mode inverts the relationship and puts dark text on gold-brown.
**Borders are two-tier, and this is deliberate.** A divider between table rows is decoration and is
exempt from contrast minimums, so `--border` stays light. The boundary of a control the user has to
_find and operate_ is a UI component under WCAG 1.4.11 and needs ≥3:1 — hence `--input` is visibly
darker. Using `--border` on an input is a violation.
Every pair above is verified by `python3 scripts/check-contrast.py`, which reads the Sass maps
directly and exits non-zero on any regression. Run it after touching the palette.
### Chart series
Five categorical series, each ≥3:1 against its card surface. Assign **by index, never by meaning** —
`--chart-1` is not "revenue".
| Token | Light | Dark |
| ----------- | --------- | --------- |
| `--chart-1` | `#6E3E17` | `#D9A05B` |
| `--chart-2` | `#1F6F6B` | `#5FC9C0` |
| `--chart-3` | `#A15C00` | `#F0B94A` |
| `--chart-4` | `#7B5AC6` | `#B49BF0` |
| `--chart-5` | `#A63D5B` | `#E88AA5` |
Adjacent hues can converge under colour-vision deficiency. Any chart relying on more than three
series **must** carry value labels or a legend — colour is never the sole channel.
### Typography
Loaded via `next/font/google` in `app/layout.tsx` (self-hosted at build, no runtime CSS `@import`).
| Role | Family | Rules |
| --------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| Headings | **DM Sans** 500/600/700 | Owner decision 2026-09-29 (replaces Google Sans). Tight tracking, `text-balance` on multi-word titles |
| Body / UI | **Inter** 400/500 | **≥16px**, line-height 1.5–1.75, max 65–75 chars per line |
| Numerals | **Inter** + `tnum` | **Every** currency figure, ID, percentage and table number, via `.tabular`. Inter's own tabular figures keep columns aligned and digits stable. |
| Code editors | System monospace | Code editors (email HTML) may use a monospace font. Owner-approved exception to the no-monospace rule. |
Two families. Monospace only for code editors (the email-template HTML body); never for headings, labels or numerals. Numerals ride the body font because Inter ships true tabular figures, so
columns still align — and monospace digits read technical, which is the wrong register for a
parenting brand. It also removes a font request, which serves the speed priority.
`src/styles/index.scss` carries a commented `@font-face` block if Google Sans needs to be self-hosted
(offline builds, or a licensed variant); drop the woff2 files into `public/fonts/` and uncomment. DM
Sans covers the gap if the family fails to load — do not substitute a lookalike and call it Google
Sans.
### Density & spacing
8pt scale (`--space-1` = 4px … `--space-10` = 40px). Data-dense means **tight, not cramped**:
| Element | Value |
| ---------------- | ------------------------------------------ |
| Table row height | 36px |
| Card padding | 16px (12px on ≤768px) |
| Grid gutter | 16px |
| Section gap | 24px |
| Control height | 36px (touch target padded to **≥44×44px**) |
### Z-index scale
Defined once, in the `$z` map in `src/styles/_variables.scss`:
`10` sticky table header row · `30` app header · `40` sidebar + dropdown/popover · `45` mobile
sidebar overlay · `50` dialog/toast. No other values, and no bare numbers in components.
---
## 3. Layout
12-column grid, `max-w-[1600px]`, gutters 16px. One consistent container width across all
screens — never mix.
```
┌──────────┬──────────────────────────────────────────────┐
│ SIDEBAR │ HEADER breadcrumbs · theme · user │
│ 272px ├──────────────────────────────────────────────┤
│ (76px │ CONTENT max-w-1600, p-16 │
│ collapsed)│ │
└──────────┴──────────────────────────────────────────────┘
```
Breakpoints: **375 / 768 / 1024 / 1440**. Sidebar becomes an off-canvas sheet below 1024px. Content
must never scroll horizontally — wide tables scroll inside their own `overflow-x-auto` container.
---
## 4. Navigation
The renderer supports up to **three levels** (`MAX_NAV_DEPTH`), and refuses to render deeper rather
than silently nesting forever.
**Two levels remains the default for production IA.** A third level buys grouping at the cost of
hiding things behind two clicks, so it earns its place only when it groups *filters over one
collection* — `Members → By rank → Diamond` — where the parent is a facet name and nothing is
reachable only from there. It does not earn its place when it buries **distinct destinations**; those
belong at level one or two, or on the page itself. If a third level is the only way to fit the nav
in, the nav is too big.
The current tree exercises all three levels deliberately, so the pattern is proven rather than
theoretical — see the backend contract note below.
- Every second-level entry must resolve to a **real view** — a route, or a filter the target page
already reads from the URL. No decorative parents, no dead links.
- A group whose section contains the current route **opens itself**; it does not trap the user in
whatever they last opened by hand.
- Active state is carried by `aria-current="page"` plus a primary fill and an `--accent` indicator
bar — three signals, not colour alone.
- Second-level entries that differ only by query string must distinguish themselves by it. "All
members" must not claim to be current when `?status=suspended` is applied.
- **Collapsed rail:** labels are hidden, `title` supplies the name, and clicking a group expands the
rail and opens that group in one action rather than doing nothing.
- **Below `lg`:** the rail becomes an overlay drawer — closes on navigation, on overlay click and on
Escape, locks body scroll while open, and is `aria-hidden` when shut so its links stay out of the
tab order.
- Collapsed state persists per browser; it is a workspace preference, not app state.
**Deeper levels inherit every rule above.** Specifically: a group opens itself when *anything at any
depth beneath it* is current (so the whole chain to the active entry unfolds), sibling groups stay
shut, and an unfiltered "All …" entry stops being current as soon as any descendant's filter key
appears in the URL — including keys introduced two levels down.
### Backend contract
`src/components/app/nav-config.ts` is plain serialisable data — `label`, `to`, `children`,
`isDefault` — with the icon as the only client-side concern. A menu endpoint can return this shape
verbatim. `nav-config.test.ts` encodes the invariants such an endpoint must satisfy: every node is a
leaf with a target *or* a group with children and never both, depth never exceeds the cap, every leaf
resolves to a real route, targets are unique, and a group carries at most one `isDefault` entry.
---
## 5. KPI tile
The dashboard's top row. Each tile answers _what is it, how big, which direction_.
```
┌────────────────────────────────┐
│ TOTAL SALES ▲ +12.4%│ label: 12px uppercase muted, tracking-wide
│ RM 486,250.00 │ value: 28px Fira Code tabular, foreground
│ ╭─╮ │ delta: arrow + explicit sign + %, positive/negative
│ ╰─╯╲╱╰──╱╰─ vs last month │ sparkline: 12 pts, --chart-1, no axes
└────────────────────────────────┘
```
Rules:
- Delta carries **three** redundant signals: colour, arrow glyph, and an explicit `+`/`−` sign.
Colour alone fails colourblind users and fails WCAG 1.4.1.
- Always state the comparison basis in words ("vs last month"). A bare percentage is unreadable.
- A delta of exactly 0 renders neutral (`--muted-foreground`), not green.
- Sparklines are decorative: no axes, no gridlines, no tooltip, `aria-hidden="true"`. The number is
the accessible content.
- Never more than 6 tiles. Beyond that nothing is prominent.
---
## 6. Charts
Match the chart to the data question — from the skill's chart database:
| Question | Chart | Notes |
| ------------------ | ------------------ | -------------------------------------------------------------------------------- |
| Trend over time | **Line** | Primary series `--chart-1`, 2px stroke. Optional 20%-opacity fill. |
| Compare categories | **Horizontal bar** | **Sorted descending**, value label on each bar. Highest-value insight per pixel. |
| Cumulative growth | **Area** | Single series, 20% fill, no stacking beyond 3 series. |
| Share of total | **Bar, not pie** | Pie only for ≤3 slices where the total genuinely matters. |
Implementation — Recharts through shadcn's `chart` wrapper, so theming is automatic in both modes:
```tsx