# Kognai citizen app: design system and clickable prototype

A design system and a static, clickable prototype for the Kognai citizen app's main screens: first run, citizen lobby, chat with your citizen, the services hub (learn, create, earn), credits and wallet, settings. Mobile first, accessible, light and dark, English and Arabic (right to left).

Built for the Kognai LAX bundle "Citizen app: frontend design and UI/UX" (job 7b146022). MIT licensed.

**Open it:** [prototype/index.html](prototype/index.html). Live copy: https://agentgate-source.pages.dev/citizen-app-design/demo/prototype/index.html

## What is inside

| Path | What it is |
|---|---|
| `tokens/tokens.json` | `{color: {light, dark}, type, space, radius}`. Each theme has bg, surface, surface-2, text, text-muted, primary, on-primary, border, danger, success and focus as #rrggbb, from the citizen brand: terracotta, charcoal, cream. |
| `tokens/tokens.css` | The same values as CSS custom properties (`--color-text` and so on): light by default, dark under `prefers-color-scheme: dark` and under `[data-theme="dark"]` (and `[data-theme="light"]` to force light). Generated by `scripts/tokens_css.py`. |
| `prototype/index.html` | Links every screen in both languages and the design system. |
| `prototype/design-system.html` | The tokens (colour swatches for both themes, type scale, space, radius) and every component: buttons, fields, switches, chat bubbles, tiles, chips, avatar, bottom navigation. |
| `prototype/*.html` | first-run, lobby, chat, services, wallet, settings in English. |
| `prototype/ar/*.html` | The same six in Arabic, each with `<html lang="ar" dir="rtl">`. |
| `prototype/assets/` | `app.css` (components, every colour and size from the tokens, logical properties so the layout mirrors in right to left), `theme.js` (light, dark or follow the system, kept on the device), `citizen.svg`. |
| `scripts/build.py` | Builds all 14 pages from one set of screens and an English and an Arabic string table, so both languages always have the same controls. |
| `docs/REVIEW.md` | The script and record sheet for the review by the Founder with three test users (A6). |

Text people see uses Latin digits only (also in Arabic) and no long dashes.

## Tests

```
npm test             # node:test, no dependency, no network
npm run test:layout  # optional: renders all 14 pages at 360 px in light and dark with headless Chrome (Playwright)
```

| Test | Acceptance item |
|---|---|
| A1 | Both themes have every required token as #rrggbb; text and text-muted on bg and on surface, on-primary on primary and danger on bg are each at least 4.5 to 1 in light and dark (plus the extra pairs the components use: links, chips, danger on surface); tokens.css holds the same values for light, the media query and `[data-theme="dark"]` |
| A2 | Every screen exists in English and Arabic; the Arabic pages are `lang="ar" dir="rtl"` and written in Arabic, with the same controls; no physical left or right in the components |
| A3 | Every page has the viewport meta and uses tokens.css; the components hold no raw colour; no fixed width over 360 px. `test:layout` checks for no horizontal scroll at 360 px in both themes and saves screenshots |
| A4 | Every page is reachable from index.html; no local link or anchor is broken; each screen links to the screens it leads to |
| A5 | Images have alt text, every control has a label, every page sets its language, buttons and links have names, icons are hidden from screen readers, skip link; Latin digits and no long dashes |
| A6 | The review by the Founder with three test users happens at M2 (script in docs/REVIEW.md). The record goes into `docs/review-record.json`; setting `founderSignedOff` to true turns the A6 test from todo into a check of the record (three testers, tasks 1 to 5, a change for every task that needed help) |

## Rebuild

```
npm run build
```
