motif-design 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/bin/install.js +724 -0
  4. package/core/references/context-engine.md +190 -0
  5. package/core/references/design-inputs.md +421 -0
  6. package/core/references/runtime-adapters.md +180 -0
  7. package/core/references/state-machine.md +124 -0
  8. package/core/references/verticals/ecommerce.md +251 -0
  9. package/core/references/verticals/fintech.md +226 -0
  10. package/core/references/verticals/health.md +235 -0
  11. package/core/references/verticals/saas.md +248 -0
  12. package/core/templates/STATE-TEMPLATE.md +28 -0
  13. package/core/templates/SUMMARY-TEMPLATE.md +21 -0
  14. package/core/templates/VERTICAL-TEMPLATE.md +144 -0
  15. package/core/templates/token-showcase-template.html +946 -0
  16. package/core/workflows/compose-screen.md +163 -0
  17. package/core/workflows/evolve.md +64 -0
  18. package/core/workflows/fix.md +64 -0
  19. package/core/workflows/generate-system.md +336 -0
  20. package/core/workflows/quick.md +23 -0
  21. package/core/workflows/research.md +233 -0
  22. package/core/workflows/review.md +126 -0
  23. package/package.json +26 -0
  24. package/runtimes/claude-code/CLAUDE-MD-SNIPPET.md +34 -0
  25. package/runtimes/claude-code/agents/motif-design-reviewer.md +207 -0
  26. package/runtimes/claude-code/agents/motif-fix-agent.md +119 -0
  27. package/runtimes/claude-code/agents/motif-researcher.md +100 -0
  28. package/runtimes/claude-code/agents/motif-screen-composer.md +157 -0
  29. package/runtimes/claude-code/agents/motif-system-architect.md +120 -0
  30. package/runtimes/claude-code/commands/motif/compose.md +7 -0
  31. package/runtimes/claude-code/commands/motif/evolve.md +6 -0
  32. package/runtimes/claude-code/commands/motif/fix.md +7 -0
  33. package/runtimes/claude-code/commands/motif/help.md +29 -0
  34. package/runtimes/claude-code/commands/motif/init.md +229 -0
  35. package/runtimes/claude-code/commands/motif/progress.md +11 -0
  36. package/runtimes/claude-code/commands/motif/quick.md +7 -0
  37. package/runtimes/claude-code/commands/motif/research.md +4 -0
  38. package/runtimes/claude-code/commands/motif/review.md +7 -0
  39. package/runtimes/claude-code/commands/motif/system.md +4 -0
  40. package/runtimes/claude-code/hooks/motif-aria-check.js +164 -0
  41. package/runtimes/claude-code/hooks/motif-context-monitor.js +40 -0
  42. package/runtimes/claude-code/hooks/motif-font-check.js +192 -0
  43. package/runtimes/claude-code/hooks/motif-token-check.js +221 -0
  44. package/runtimes/cursor/README.md +24 -0
  45. package/runtimes/gemini/README.md +13 -0
  46. package/runtimes/opencode/README.md +28 -0
  47. package/scripts/contrast-checker.js +114 -0
  48. package/scripts/token-counter.js +107 -0
@@ -0,0 +1,226 @@
1
+ # Fintech Design Intelligence
2
+
3
+ ## Core Design Principle
4
+ **Trust is the product.** Users are handing you their money — every pixel either builds or erodes confidence. The UI must feel secure, precise, and in control before it can feel beautiful.
5
+
6
+ ## Navigation Patterns
7
+
8
+ ### Standard Models
9
+ - **Mobile:** Bottom tab bar, 4-5 items. Home/Dashboard, Activity/Transactions, Send/Pay, Cards/Assets, Profile/Settings. Primary action (Send) should be a prominent center tab or floating action.
10
+ - **Desktop:** Persistent left sidebar, 240px collapsed to 64px icon-only. Grouped: Overview, Accounts, Transfers, Cards, Settings. Top bar for search + notifications + profile.
11
+ - **Action sheets:** Bottom sheets for quick actions (send, request, scan QR). Half-sheet for simple actions, full-sheet for forms requiring input.
12
+
13
+ ### Vertical-Specific Rules
14
+ - "Send money" or primary CTA: reachable within 1 tap from any screen
15
+ - Transaction detail: accessible via tap on any transaction row — no hunting
16
+ - Settings/Security: prominent placement signals you take security seriously
17
+ - Search: support searching by amount, recipient, date, reference number
18
+
19
+ ## Color System
20
+
21
+ ### Palette A: Institutional Trust (Blue-Teal)
22
+ | Token | Light Mode | Dark Mode | Usage |
23
+ |---|---|---|---|
24
+ | primary-50 | #ECFDF5 | #064E3B | Subtle backgrounds |
25
+ | primary-100 | #D1FAE5 | #065F46 | Hover states on light |
26
+ | primary-200 | #A7F3D0 | #047857 | Borders, dividers |
27
+ | primary-300 | #6EE7B7 | #059669 | Icons, decorative |
28
+ | primary-400 | #34D399 | #10B981 | Secondary actions |
29
+ | primary-500 | #10B981 | #34D399 | Primary actions, brand |
30
+ | primary-600 | #059669 | #6EE7B7 | Hover on primary |
31
+ | primary-700 | #047857 | #A7F3D0 | Active/pressed |
32
+ | primary-800 | #065F46 | #D1FAE5 | Text on light bg |
33
+ | primary-900 | #064E3B | #ECFDF5 | Headings |
34
+ | surface-primary | #FFFFFF | #0F172A | Main background |
35
+ | surface-secondary | #F8FAFC | #1E293B | Cards |
36
+ | surface-tertiary | #F1F5F9 | #334155 | Nested elements |
37
+ | text-primary | #0F172A | #F1F5F9 | Body text (14.5:1 ✓ AAA) |
38
+ | text-secondary | #475569 | #94A3B8 | Supporting (5.9:1 ✓ AA) |
39
+
40
+ ### Palette B: Crypto Dark Premium
41
+ | Token | Light Mode | Dark Mode | Usage |
42
+ |---|---|---|---|
43
+ | primary-500 | #8B5CF6 | #A78BFA | Brand accent |
44
+ | surface-primary | #FAFAF9 | #09090B | Main background |
45
+ | surface-secondary | #F5F5F4 | #18181B | Cards |
46
+ | text-primary | #1C1917 | #FAFAF9 | Body (15.4:1 ✓ AAA) |
47
+ | text-secondary | #57534E | #A8A29E | Supporting (5.2:1 ✓ AA) |
48
+
49
+ ### Semantic Colors
50
+ | Semantic | Hex (Light) | Hex (Dark) | Fintech Meaning |
51
+ |---|---|---|---|
52
+ | Success | #16A34A | #4ADE80 | Transaction complete, money received, positive P&L |
53
+ | Error | #DC2626 | #F87171 | Transaction failed, payment declined, negative P&L |
54
+ | Warning | #D97706 | #FBBF24 | Pending, processing, needs action |
55
+ | Info | #2563EB | #60A5FA | Informational, neutral notification |
56
+
57
+ ### Color Anti-Patterns
58
+ - ❌ Bright gradients as primary backgrounds (looks unserious for money)
59
+ - ❌ Red as brand color in Western markets (anxiety-inducing for finance)
60
+ - ❌ More than 3 accent colors competing (cognitive overload scanning numbers)
61
+ - ❌ Low-saturation grays for transaction status (must be instantly scannable)
62
+ - ❌ Neon colors for financial data (eye strain during extended portfolio monitoring)
63
+
64
+ ## Typography
65
+
66
+ ### Pairing A: Modern Geometric
67
+ - **Display:** Plus Jakarta Sans 700 at -0.02em — confident, geometric, contemporary
68
+ - **Body:** Plus Jakarta Sans 400/500 at 0em — clean readability, professional
69
+ - **Numbers:** JetBrains Mono 500 with `font-variant-numeric: tabular-nums` — perfect column alignment, clear at small sizes
70
+
71
+ ### Pairing B: Humanist Professional
72
+ - **Display:** DM Sans 700 at -0.015em — approachable yet authoritative
73
+ - **Body:** Source Sans 3 400/500 at 0em — designed for UI, excellent at 14px
74
+ - **Numbers:** IBM Plex Mono 500 with `tabular-nums` — IBM heritage signals institutional reliability
75
+
76
+ ### Type Scale
77
+ | Token | Size | Line Height | Fintech Usage |
78
+ |---|---|---|---|
79
+ | text-xs | 0.75rem (12px) | 1.4 | Timestamps, badges, fine print, exchange rates |
80
+ | text-sm | 0.875rem (14px) | 1.45 | Transaction descriptions, labels, nav items |
81
+ | text-base | 1rem (16px) | 1.5 | Body copy, form inputs, list items |
82
+ | text-lg | 1.125rem (18px) | 1.45 | Section headings, card titles |
83
+ | text-xl | 1.25rem (20px) | 1.35 | Page subtitles, feature headers |
84
+ | text-2xl | 1.5rem (24px) | 1.3 | Account balance secondary |
85
+ | text-3xl | 1.875rem (30px) | 1.2 | Account balance primary, hero numbers |
86
+
87
+ ### Typography Rules
88
+ - ALL monetary values: --font-mono with tabular-nums. Non-negotiable.
89
+ - Currency symbols: 80% of number size, --weight-medium (not bold)
90
+ - Decimals in portfolio views: --text-secondary color (de-emphasized when cents don't matter)
91
+ - Percentage changes: color-coded (success/error) AND include ▲/▼ arrow — never color alone
92
+
93
+ ### Typography Anti-Patterns
94
+ - ❌ Decorative/script fonts anywhere (undermines trust)
95
+ - ❌ Proportional figures in financial tables (misalignment destroys scanability)
96
+ - ❌ ALL CAPS for large numbers (harder to parse quickly)
97
+ - ❌ Bold weight for all numbers (reduces the hierarchy between primary balance and detail amounts)
98
+
99
+ ## Spacing & Density
100
+
101
+ ### Recommended Density: Comfortable-Dense
102
+ Users need enough data to make decisions without excessive scrolling, but not so dense that numbers blur together.
103
+
104
+ ### Concrete Values
105
+ | Context | Value | Token |
106
+ |---|---|---|
107
+ | Card internal padding | 16-20px | --space-4 to --space-5 |
108
+ | Transaction row height | 64px | — |
109
+ | Transaction row padding | 12px 16px | --space-3 --space-4 |
110
+ | Section gap | 24-32px | --space-6 to --space-8 |
111
+ | Form field gap | 16px | --space-4 |
112
+ | Button padding | 12px 20px | --space-3 --space-5 |
113
+ | Touch target minimum | 48×48px | — |
114
+ | Bottom tab bar height | 56-64px | — |
115
+
116
+ ## Component Specifications
117
+
118
+ ### TransactionRow
119
+ ```xml
120
+ <component name="TransactionRow" category="data-display">
121
+ <description>Single transaction in a list. Most-viewed component in any fintech app.</description>
122
+ <structure>
123
+ Row: [MerchantIcon 40×40] [Description + Subtitle stack] [Amount right-aligned]
124
+ Description: --font-body --text-sm --weight-medium --text-primary
125
+ Subtitle: --font-body --text-xs --text-secondary (date, category, reference)
126
+ Amount: --font-mono --text-sm --weight-semibold, right-aligned
127
+ Positive amount: --color-success
128
+ Negative amount: --text-primary (NOT red — red is for errors, not spending)
129
+ Status chip: 6px radius, semantic color bg at 10% opacity, text at full
130
+ </structure>
131
+ <dimensions>
132
+ height: 64px, padding: --space-3 --space-4, gap: --space-3
133
+ Merchant icon: 40×40px, --radius-full (circular), --surface-secondary bg
134
+ </dimensions>
135
+ <states>
136
+ hover: --surface-secondary background
137
+ pressed: --surface-tertiary background, scale(0.99)
138
+ pending: amount in --color-warning, pulsing status chip
139
+ </states>
140
+ <tap-target>Full row, not just the amount</tap-target>
141
+ </component>
142
+ ```
143
+
144
+ ### BalanceCard
145
+ ```xml
146
+ <component name="BalanceCard" category="data-display">
147
+ <description>Primary balance display. Usually the largest element on the dashboard.</description>
148
+ <structure>
149
+ Label: "Total Balance" or account name, --text-xs --weight-medium --text-secondary uppercase tracking-wider
150
+ Amount: --font-mono --text-3xl --weight-bold --text-primary, tabular-nums
151
+ Change: --text-sm, color-coded (success/error), includes ▲/▼ + percentage + absolute value
152
+ Subtext: "Updated just now" or time period, --text-xs --text-tertiary
153
+ </structure>
154
+ <dimensions>
155
+ padding: --space-6, border-radius: --radius-lg
156
+ background: --surface-secondary or subtle gradient using primary-50
157
+ </dimensions>
158
+ </component>
159
+ ```
160
+
161
+ ### StatusChip
162
+ ```xml
163
+ <component name="StatusChip" category="indicator">
164
+ <description>Transaction/payment status indicator.</description>
165
+ <variants>
166
+ completed: bg success at 10% opacity, text success, "Completed"
167
+ pending: bg warning at 10% opacity, text warning, "Pending"
168
+ failed: bg error at 10% opacity, text error, "Failed"
169
+ processing: bg info at 10% opacity, text info, animated pulse
170
+ </variants>
171
+ <dimensions>
172
+ padding: --space-1 --space-2, border-radius: --radius-sm
173
+ font: --text-xs --weight-medium
174
+ </dimensions>
175
+ </component>
176
+ ```
177
+
178
+ ## Interaction Patterns
179
+
180
+ ### Transaction Confirmation Flow
181
+ 1. User enters amount + recipient → show clear summary
182
+ 2. Summary screen: amount (large), recipient (with verification badge), fees itemized, total
183
+ 3. "Confirm" button with biometric/PIN
184
+ 4. Processing state (skeleton or spinner with "Processing...")
185
+ 5. Success screen: checkmark animation (300ms), reference number, "Share receipt" + "Done"
186
+ - ❌ NEVER one-tap sending without confirmation
187
+ - ❌ NEVER hide fees until the last step
188
+
189
+ ### States
190
+ **Loading:** Skeleton screens with shimmer (left-to-right, 1.5s cycle). Match the density of the expected content. For transaction lists, show 5-7 skeleton rows.
191
+ **Empty:** First-time: "Welcome! Send your first payment to get started →". No-results: "No transactions this month" with suggested action. Never just blank space.
192
+ **Error:** Transaction errors MUST show: what happened, reference number, "Your funds are safe", retry or contact support. Network errors: "Connection lost — your data is safe. Retrying..."
193
+
194
+ ### Motion
195
+ **Appropriate:** Balance count-up (500ms ease-out), transaction success checkmark (300ms), pull-to-refresh, card number reveal flip, chart data transition (400ms).
196
+ **Inappropriate:** ❌ Bouncy/playful springs, ❌ slow page transitions (users check balance frequently), ❌ confetti/particles (except maybe first transaction, briefly), ❌ decorative animations that delay task completion.
197
+
198
+ ## Accessibility Specifics
199
+ - Financial figures: minimum 14px, monospaced, sufficient contrast for extended reading
200
+ - Color-blind safety: never convey gain/loss by color alone — always include ▲/▼ arrows
201
+ - Biometric prompts: always offer PIN/password fallback
202
+ - Transaction confirmations: must work with screen readers (announce amount, recipient, status)
203
+
204
+ ## Border Radius
205
+ | Token | Value | Reasoning |
206
+ |---|---|---|
207
+ | radius-sm | 4px | Chips, badges, small elements — crisp but not sharp |
208
+ | radius-md | 8px | Buttons, inputs, cards — modern without being playful |
209
+ | radius-lg | 12px | Large cards, modals — approachable but professional |
210
+ | radius-xl | 16px | Hero cards, bottom sheets — soft for primary containers |
211
+
212
+ ## Shadow Style
213
+ | Token | Value | Usage |
214
+ |---|---|---|
215
+ | shadow-sm | 0 1px 2px rgba(0,0,0,0.05) | Subtle card elevation |
216
+ | shadow-md | 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05) | Elevated cards, dropdowns |
217
+ | shadow-lg | 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04) | Modals, popovers |
218
+
219
+ ## Crypto-Specific Additions
220
+ - Always show BOTH crypto amount AND fiat equivalent
221
+ - Network/chain indicator on all addresses (tiny chip: "TRC-20", "ERC-20", "SOL")
222
+ - Gas/network fee estimation before confirmation
223
+ - Wallet addresses: first 6 + last 4 chars, monospaced, with copy button
224
+ - QR code generation for receive addresses
225
+ - Real-time price with "Updated Xs ago" timestamp
226
+ - Portfolio donut chart: max 5 segments visible, "Other" bucket for remainder
@@ -0,0 +1,235 @@
1
+ # Health Design Intelligence
2
+
3
+ ## Core Design Principle
4
+ **Care and clarity are the product.** Users are managing their health -- every element must feel supportive, trustworthy, and never anxiety-inducing. The UI should empower users with clear data while maintaining warmth that encourages daily engagement without clinical coldness.
5
+
6
+ ## Navigation Patterns
7
+
8
+ ### Standard Models
9
+ - **Mobile:** Bottom tab bar, 5 items. Today, Metrics, Log (prominent center), Insights, Profile. Primary logging action should be a raised center tab or floating action button for one-tap access.
10
+ - **Desktop:** Persistent left sidebar, 240px collapsed to 64px icon-only. Grouped by health category: Vitals, Activity, Nutrition, Medications, Mental Health. Top bar for search + notifications + profile.
11
+ - **Action sheets:** Bottom sheets for quick logging (mood, water, symptom). Half-sheet for single-entry logging, full-sheet for detailed entries requiring multiple fields.
12
+
13
+ ### Vertical-Specific Rules
14
+ - Primary logging action: reachable within 1 tap from any screen
15
+ - Metric detail: accessible via tap on any metric card -- no hunting through menus
16
+ - Medication reminders: prominent placement in Today view, never buried in settings
17
+ - Search: support searching by metric type, date range, symptom keyword, medication name
18
+
19
+ ## Color System
20
+
21
+ ### Palette A: Calming Nature (Green-Teal)
22
+ | Token | Light Mode | Dark Mode | Usage |
23
+ |---|---|---|---|
24
+ | primary-50 | #ECFDF5 | #064E3B | Subtle backgrounds, metric card tints |
25
+ | primary-100 | #D1FAE5 | #065F46 | Hover states on light surfaces |
26
+ | primary-200 | #A7F3D0 | #047857 | Borders, progress ring tracks |
27
+ | primary-300 | #6EE7B7 | #059669 | Icons, decorative elements |
28
+ | primary-400 | #34D399 | #10B981 | Secondary actions, sparkline |
29
+ | primary-500 | #10B981 | #34D399 | Primary actions, brand (HSL 155, 84%, 40%) |
30
+ | primary-600 | #059669 | #6EE7B7 | Hover on primary buttons |
31
+ | primary-700 | #047857 | #A7F3D0 | Active/pressed states |
32
+ | primary-800 | #065F46 | #D1FAE5 | Text on light backgrounds |
33
+ | primary-900 | #064E3B | #ECFDF5 | Headings, high-emphasis text |
34
+ | surface-primary | #FEFDFB | #0F1A14 | Main background (warm white) |
35
+ | surface-secondary | #F7FAF8 | #1A2B22 | Cards, metric containers |
36
+ | surface-tertiary | #EFF5F1 | #2A3D32 | Nested elements, input fields |
37
+ | text-primary | #1A2E22 | #EFF5F1 | Body text (12.8:1 AAA) |
38
+ | text-secondary | #4A6354 | #8FAA9A | Supporting text (5.7:1 AA) |
39
+
40
+ ### Palette B: Warm Wellness (Coral-Pink)
41
+ | Token | Light Mode | Dark Mode | Usage |
42
+ |---|---|---|---|
43
+ | primary-500 | #E8655A | #F0908A | Brand accent (HSL 5, 76%, 63%) |
44
+ | surface-primary | #FFFBFA | #1A0F0E | Main background (warm cream) |
45
+ | surface-secondary | #FFF5F3 | #2B1C1A | Cards |
46
+ | text-primary | #2D1512 | #FFF5F3 | Body (13.1:1 AAA) |
47
+ | text-secondary | #6B4A45 | #BF9490 | Supporting (5.4:1 AA) |
48
+
49
+ ### Semantic Colors
50
+ | Semantic | Hex (Light) | Hex (Dark) | Health Meaning |
51
+ |---|---|---|---|
52
+ | Success | #16A34A | #4ADE80 | Goal achieved, healthy range, medication taken |
53
+ | Error | #DC2626 | #F87171 | Critical reading, missed medication, alert threshold |
54
+ | Warning | #D97706 | #FBBF24 | Approaching limit, needs attention, pending check-in |
55
+ | Info | #2563EB | #60A5FA | New insight available, educational content, sync complete |
56
+
57
+ ### Color Anti-Patterns
58
+ - :x: Clinical white without warmth (feels institutional, not caring)
59
+ - :x: Harsh red for non-critical health data (induces unnecessary anxiety)
60
+ - :x: High-saturation neon colors (feels gamified, undermines medical credibility)
61
+ - :x: Competing accent colors in health data visualizations (obscures trends)
62
+ - :x: Dark/moody backgrounds for health data (reduces readability of critical metrics)
63
+
64
+ ## Typography
65
+
66
+ ### Pairing A: Warm Authority
67
+ - **Display:** Fraunces 700 at -0.02em -- warm serif with optical sizing, conveys credibility and approachability
68
+ - **Body:** Nunito 400/500 at 0em -- rounded sans-serif, friendly and highly legible at all sizes
69
+ - **Numbers:** IBM Plex Mono 500 with `font-variant-numeric: tabular-nums` -- clear metric alignment, clinical precision
70
+
71
+ ### Pairing B: Modern Wellness
72
+ - **Display:** Outfit 700 at -0.015em -- geometric sans with soft curves, feels contemporary and clean
73
+ - **Body:** DM Sans 400/500 at 0em -- open apertures, excellent readability at 14-16px body sizes
74
+ - **Numbers:** IBM Plex Mono 500 with `tabular-nums` -- consistent metric column alignment
75
+
76
+ ### Type Scale
77
+ | Token | Size | Line Height | Health Usage |
78
+ |---|---|---|---|
79
+ | text-xs | 0.75rem (12px) | 1.4 | Timestamps, units, normal range labels, source attribution |
80
+ | text-sm | 0.875rem (14px) | 1.45 | Metric descriptions, log details, nav items, form labels |
81
+ | text-base | 1rem (16px) | 1.5 | Body copy, log entries, form inputs (minimum body size) |
82
+ | text-lg | 1.125rem (18px) | 1.45 | Section headings, card titles, insight headers |
83
+ | text-xl | 1.25rem (20px) | 1.35 | Page subtitles, goal summaries |
84
+ | text-2xl | 1.5rem (24px) | 1.3 | Daily summary values, secondary metrics |
85
+ | text-3xl | 1.875rem (30px) | 1.2 | Primary health metric display, hero numbers |
86
+
87
+ ### Typography Rules
88
+ - ALL health metric values: --font-mono with tabular-nums. Non-negotiable for data alignment.
89
+ - Units displayed at 80% of number size (e.g., "bpm", "mg/dL"), --weight-medium
90
+ - Trend indicators: ALWAYS include arrows (up-arrow/down-arrow) alongside color -- never color alone
91
+ - Normal range labels: --text-xs --text-secondary, positioned below or beside the metric value
92
+
93
+ ### Typography Anti-Patterns
94
+ - :x: Decorative or script fonts anywhere (undermines medical credibility)
95
+ - :x: Ultra-thin weights below 400 (readability fails for older users, a key health demographic)
96
+ - :x: ALL CAPS for metric labels (harder to scan quickly in data-dense views)
97
+ - :x: Proportional figures in health data tables (column misalignment destroys scanability)
98
+
99
+ ## Spacing & Density
100
+
101
+ ### Recommended Density: Comfortable
102
+ Health data needs breathing room to avoid feeling overwhelming. Users should never feel bombarded by numbers.
103
+
104
+ ### Concrete Values
105
+ | Context | Value | Token |
106
+ |---|---|---|
107
+ | Card internal padding | 20-24px | --space-5 to --space-6 |
108
+ | Metric card height | 80-96px | -- |
109
+ | Section gap | 24-32px | --space-6 to --space-8 |
110
+ | Form field gap | 16px | --space-4 |
111
+ | Button padding | 12px 24px | --space-3 --space-6 |
112
+ | Touch target minimum | 48x48px | -- |
113
+ | Log entry row height | 64-72px | -- |
114
+
115
+ ## Component Specifications
116
+
117
+ ### MetricCard
118
+ ```xml
119
+ <component name="MetricCard" category="data-display">
120
+ <description>Health metric with current value, trend, and context. The primary data display in any health app.</description>
121
+ <structure>
122
+ Card: [MetricIcon 32x32] [Label + Value stack] [Trend + Sparkline right-aligned]
123
+ Label: --font-body --text-sm --weight-medium --text-secondary
124
+ Value: --font-mono --text-2xl --weight-bold --text-primary, tabular-nums
125
+ Unit: --font-mono --text-sm --weight-medium --text-secondary (80% of value size)
126
+ Trend arrow: --text-sm, color-coded (success/error) with directional arrow
127
+ Sparkline: 64x24px, --color-primary-400 stroke, no fill
128
+ Normal range: --text-xs --text-secondary, bar indicator below value
129
+ </structure>
130
+ <dimensions>
131
+ height: 80-96px, padding: --space-5 --space-5, gap: --space-3
132
+ Metric icon: 32x32px, --radius-md, --surface-tertiary bg, --color-primary-500 icon
133
+ </dimensions>
134
+ <states>
135
+ default: --surface-secondary background, --shadow-sm
136
+ hover: --shadow-md, scale(1.01)
137
+ pressed: --surface-tertiary background, scale(0.99)
138
+ alert: --color-error border-left 3px, pulsing icon
139
+ </states>
140
+ <tap-target>Full card, opens metric detail view</tap-target>
141
+ </component>
142
+ ```
143
+
144
+ ### ProgressRing
145
+ ```xml
146
+ <component name="ProgressRing" category="data-display">
147
+ <description>Circular progress for daily goals. Steps, water intake, medication adherence.</description>
148
+ <structure>
149
+ Ring: SVG circle, stroke-dasharray for progress, --color-primary-500 fill stroke
150
+ Track: --surface-tertiary stroke at 20% opacity
151
+ Center: --font-mono --text-xl --weight-bold current value, --text-xs label below
152
+ Label: goal name --text-sm --weight-medium --text-secondary below ring
153
+ </structure>
154
+ <dimensions>
155
+ Single ring: 96x96px, stroke-width: 8px
156
+ Compact ring: 64x64px, stroke-width: 6px
157
+ Multiple rings: concentric, 8px gap between rings, max 3 rings
158
+ </dimensions>
159
+ <states>
160
+ in-progress: --color-primary-400 stroke, percentage visible in center
161
+ complete: --color-success stroke, checkmark replaces percentage, subtle scale pulse
162
+ missed: --color-error stroke at 40% opacity, "Missed" label in center
163
+ </states>
164
+ </component>
165
+ ```
166
+
167
+ ### LogEntry
168
+ ```xml
169
+ <component name="LogEntry" category="data-display">
170
+ <description>Single health event in a timeline. Meals, workouts, symptoms, medications.</description>
171
+ <structure>
172
+ Row: [CategoryIcon 36x36] [Title + Details stack] [Timestamp right-aligned]
173
+ Title: --font-body --text-base --weight-medium --text-primary (e.g., "Morning Walk")
174
+ Details: --font-body --text-sm --text-secondary (e.g., "32 min, 2.1 km, 187 cal")
175
+ Timestamp: --font-mono --text-xs --text-secondary right-aligned (e.g., "8:32 AM")
176
+ Category icon: colored by type (activity=primary, nutrition=warning, medication=info)
177
+ </structure>
178
+ <dimensions>
179
+ height: 64-72px, padding: --space-4 --space-5, gap: --space-3
180
+ Category icon: 36x36px, --radius-md, semantic color bg at 10% opacity
181
+ </dimensions>
182
+ <states>
183
+ default: transparent background, --border-primary bottom border 1px
184
+ hover: --surface-secondary background
185
+ editing: --surface-tertiary background, inline edit fields visible
186
+ </states>
187
+ <tap-target>Full row, opens entry detail/edit view</tap-target>
188
+ </component>
189
+ ```
190
+
191
+ ## Interaction Patterns
192
+
193
+ ### Core Flows
194
+ 1. **Logging a health metric:** Quick-log via FAB or center tab -> select metric type -> enter value (large numeric keypad) -> optional note -> save with confirmation animation. Under 5 seconds for repeat entries.
195
+ 2. **Viewing trend data:** Tap metric card -> detail view with 7/30/90-day chart -> tap data points for specifics -> pinch to zoom timeframe. Always show normal range bands on charts.
196
+ 3. **Setting a health goal:** Profile or Insights -> "Set Goal" -> choose metric -> set target value -> set frequency (daily/weekly) -> confirmation with ProgressRing preview.
197
+
198
+ ### States
199
+ **Loading:** Skeleton screens with shimmer (left-to-right, 1.5s cycle). Metric cards show shimmer blocks matching value + sparkline layout. Progress rings show track without fill.
200
+ **Empty:** First-time: "Welcome! Log your first health entry to start tracking your progress." with friendly illustration. No-results: "No entries for this day -- tap + to add one." Never blank space.
201
+ **Error:** Reassuring tone always. "We could not save your entry -- your data is safe locally. We will retry automatically." Sync errors: "Offline -- your logs are saved and will sync when you are back online."
202
+
203
+ ### Motion
204
+ **Appropriate:** Progress ring fill animation (600ms ease-out), metric count-up (400ms), sparkline draw (500ms staggered), card entrance (200ms fade-up), goal complete celebration (subtle confetti, 800ms, once).
205
+ **Inappropriate:** :x: Bouncy/playful springs on health data (trivializes serious metrics), :x: fast aggressive transitions (creates urgency around health data), :x: gamification effects like combo streaks or level-ups (health is not a game), :x: shake animations on missed goals (punitive, discouraging).
206
+
207
+ ## Accessibility Specifics
208
+ - Minimum body font size: 16px (--text-base) -- health apps skew toward older demographics
209
+ - Color-blind safe metric ranges: use pattern fills or labels in addition to green/yellow/red bands -- never color alone
210
+ - Screen reader: announce metric values with units and trend direction (e.g., "Heart rate 72 beats per minute, down 3 from yesterday")
211
+ - Medication reminders: support visual notification + audio alert + haptic feedback -- users may have impaired vision or hearing
212
+ - Touch targets: strict 48x48px minimum -- no exceptions for health-critical actions like medication confirmation
213
+ - High contrast mode: all metric values must maintain 7:1 contrast ratio minimum (AAA)
214
+
215
+ ## Border Radius
216
+ | Token | Value | Reasoning |
217
+ |---|---|---|
218
+ | radius-sm | 6px | Chips, badges, small elements -- softer than fintech, friendlier feel |
219
+ | radius-md | 12px | Buttons, inputs, metric cards -- rounded enough to feel caring, not clinical |
220
+ | radius-lg | 16px | Large cards, modals -- approachable, warm container feel |
221
+ | radius-xl | 20px | Hero cards, bottom sheets -- soft, inviting primary containers |
222
+
223
+ ## Shadow Style
224
+ | Token | Value | Usage |
225
+ |---|---|---|
226
+ | shadow-sm | 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03) | Subtle metric card elevation |
227
+ | shadow-md | 0 4px 16px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03) | Elevated cards, active states |
228
+ | shadow-lg | 0 8px 32px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.03) | Modals, popovers, overlays |
229
+
230
+ ## Health-Specific Additions
231
+ - **Medication reminders:** Persistent banner in Today view when medication is due. Dismiss requires explicit "Taken" or "Skip" -- no passive dismissal. Show next dose countdown.
232
+ - **Normal range indicators:** Green/yellow/red bands on metric charts with labeled thresholds (e.g., "Normal: 60-100 bpm"). Bands use pattern fills for color-blind users.
233
+ - **HIPAA-awareness:** No PHI (Protected Health Information) in push notification previews -- show "Health update available" not "Blood pressure 140/90." Lock screen shows only app icon and generic message.
234
+ - **Date/time formatting:** Medical events use 24h or 12h per user preference. Always show day-of-week for medication schedules. Relative time for recent entries ("2h ago"), absolute for older ("Mar 1, 8:30 AM").
235
+ - **Wearable data sync:** Sync status indicator in header (last synced time, connection status). Distinguish between manual entries and device-synced data with subtle source badge. Handle sync conflicts gracefully -- prefer device data, flag manual overrides.