# Colour & elevation

Role màu và tier shadow đang chạy trên Classic, AI Mode và Admin, kèm cặp contrast đã đo.

## Key rules

- Classic: đọc `--chatty-color-*` trong `.Avada-Faqs_Popup`; Dark chỉ bật khi `data-theme` là dark.
- AI Mode: Dark là rule gốc trên `.chatty-ai-mode`; Light ghi đè bằng `data-theme` light và dùng lại palette gốc, còn Dark ánh xạ text và surface sang `--vib-1` và `--bg-deep`.
- Admin: bảng body mô tả code hiện tại; Inbox mới theo Target literal Light/Dark, phase 1b chưa ship.
- Classic: shadow tier là `--chatty-shadow-1`, `--chatty-shadow-2`, `--chatty-shadow-3`; `--chatty-shadow-card-hover` là token riêng ngoài ba tier này.
- Giá trị trong body là code hiện tại; đề xuất sửa nằm ở Target.

## Where tokens live

| Surface | File | Scope root | Theme switch |
| --- | --- | --- | --- |
| Classic | PopupBody.scss | .Avada-Faqs_Popup | Light mặc định; data-theme dark gọi lại mixin với tham số dark |
| AI Mode | foundation.scss | .chatty-ai-mode | Dark là rule gốc; data-theme light gọi lại mixin với tham số light |
| Admin | \_surface.scss | .inbox-v2 | Chỉ một theme; mixin admin không có tham số theme |

## How to apply

| Surface | API / class | Example |
| --- | --- | --- |
| Classic | Sass mixin của chatty-ui | @include foundations.tokens(storefront) |
| Classic | Sass mixin cho Dark | @include foundations.tokens(storefront, dark) |
| AI Mode | Sass mixin cho Dark gốc | @include foundations.tokens(storefront, dark) |
| AI Mode | Sass mixin cho Light | @include foundations.tokens(storefront, light) |
| Admin | Sass mixin của chatty-ui | @include foundations.tokens(admin) |
| Admin | CSS var kèm fallback | background: var(--chatty-color-bg-surface-secondary, #f7f7f7); |

## Element map

| Element | Surface | Role/Token | Light | Dark |
| --- | --- | --- | --- | --- |
| Focus ring | Classic | --chatty-ring | var(`--faqsTextColor`, #303030) | var(`--faqsTextColor`, #eee) |
| Field ring | Classic | --chatty-field-ring | #c4c4c4 | #b0b0b0 |
| Form field border | Classic | --chatty-form-border | #8a8a8a | #b0b0b0 |
| Control accent | Classic | --chatty-control | #000000 | #ffffff |
| Error text | Classic | --chatty-error | #c63f4b | #ff9aa2 |
| Link | Classic | --chatty-link | var(`--faqsTextColor`, #303030) | var(`--faqsTextColor`, #eee) |
| Base surface | AI Mode | --bg-deep | #f6f4f0 | #131215 |
| Raised surface | AI Mode | --bg-elevated | #fbfaf7 | #1c1b1f |
| Glass tint regular | AI Mode | --glass-tint-regular | rgba(252, 251, 248, 0.88) | rgba(30, 29, 34, 0.84) |
| Glass tint clear | AI Mode | --glass-tint-clear | rgba(255, 255, 254, 0.88) | rgba(19, 18, 21, 0.84) |
| Glass edge | AI Mode | --glass-edge | rgba(20, 19, 24, 0.08) | rgba(255, 255, 255, 0.12) |
| Opaque glass fallback | AI Mode | --glass-solid-regular | rgba(250, 249, 246, 0.98) | rgba(24, 23, 28, 0.97) |
| Danger text | AI Mode | --danger-text | #b91c1c | #fca5a5 |
| Warning text | AI Mode | --warning-text | #8a5200 | #f2c98a |
| Message bubble fill | Admin | --chatty-color-bg-surface-secondary | #f7f7f7 | No Dark skin |
| Message bubble border | Admin | --chatty-color-border | #d4d4d4 | No Dark skin |
| Link in bubble | Admin | --chatty-color-text-link | #005bd3 | No Dark skin |
| Inline code fill | Admin | rgba(0, 0, 0, 0.06) | rgba(0, 0, 0, 0.06) | No Dark skin |

## Tokens

### Classic

#### Variables

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Text | --chatty-color-text | #303030 | #eee |
| Secondary text | --chatty-color-text-secondary | #616161 | #aaa |
| Disabled text | --chatty-color-text-disabled | #767676 | #999 |
| Link | --chatty-color-text-link | #303030 | #eee |
| Page background | --chatty-color-bg | #f1f1f1 | #121212 |
| Surface | --chatty-color-bg-surface | #fff | #1a1a1a |
| Raised surface | --chatty-color-bg-surface-raised | #fff | #282828 |
| Secondary surface | --chatty-color-bg-surface-secondary | #f7f7f7 | #282828 |
| Media surface | --chatty-color-bg-media | #f7f7f7 | #f7f7f7 |
| Border | --chatty-color-border | #e3e3e3 | #ffffff17 |
| Strong border | --chatty-color-border-strong | #8a8a8a | #aaa |
| Focus border | --chatty-color-border-focus | --chatty-ring → var(`--faqsTextColor`, #303030) | #eee |
| Accent | --chatty-color-accent | #303030 | #eee |
| On accent | --chatty-color-on-accent | #fff | #1a1a1a |
| Rating | --chatty-color-rating | #b77900 | #f5c542 |
| Muted rating | --chatty-color-rating-muted | #d9d9d9 | #6d7175 |
| Critical | --chatty-color-critical | #c5280c | #ff9a8a |
| Elevation tier 1 | --chatty-shadow-1 | 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.08) | 0 0 0 1px rgb(255 255 255 / 0.1), 0 1px 2px rgb(0 0 0 / 0.4) |
| Elevation tier 2 | --chatty-shadow-2 | 0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 8px 24px -8px rgb(0 0 0 / 0.28) | 0 0 0 1px rgb(255 255 255 / 0.12), 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 24px -8px rgb(0 0 0 / 0.7) |
| Elevation tier 3 | --chatty-shadow-3 | 0 0 0 1px rgb(0 0 0 / 0.07), 0 4px 8px rgb(0 0 0 / 0.06), 0 24px 56px -12px rgb(0 0 0 / 0.32) | 0 0 0 1px rgb(255 255 255 / 0.12), 0 4px 8px rgb(0 0 0 / 0.3), 0 24px 56px -12px rgb(0 0 0 / 0.72) |
| Card hover shadow | --chatty-shadow-card-hover | 0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 4px 12px -4px rgb(0 0 0 / 0.18) | 0 0 0 1px rgb(255 255 255 / 0.12), 0 2px 4px rgb(0 0 0 / 0.3), 0 4px 12px -4px rgb(0 0 0 / 0.54) |

### AI Mode

#### Variables

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Text | --chatty-color-text | #303030 | --vib-1 → rgba(255, 255, 255, 0.96) |
| Secondary text | --chatty-color-text-secondary | #616161 | --vib-2 → rgba(255, 255, 255, 0.74) |
| Disabled text | --chatty-color-text-disabled | #767676 | #999 |
| Link | --chatty-color-text-link | #303030 | --vib-1 → rgba(255, 255, 255, 0.96) |
| Page background | --chatty-color-bg | #f1f1f1 | #121212 |
| Surface | --chatty-color-bg-surface | #fff | --bg-deep → #131215 |
| Raised surface | --chatty-color-bg-surface-raised | #fff | --bg-elevated → #1c1b1f |
| Secondary surface | --chatty-color-bg-surface-secondary | #f7f7f7 | #282828 |
| Media surface | --chatty-color-bg-media | #f7f7f7 | #f7f7f7 |
| Border | --chatty-color-border | #e3e3e3 | --glass-edge → rgba(255, 255, 255, 0.12) |
| Strong border | --chatty-color-border-strong | #8a8a8a | #aaa |
| Focus border | --chatty-color-border-focus | #303030 | --vib-1 → rgba(255, 255, 255, 0.96) |
| Accent | --chatty-color-accent | #303030 | --accent → var(`--faqsBtnPopupColor`, #8b7be8) |
| On accent | --chatty-color-on-accent | #fff | --on-accent → var(`--faqsFloatBtnLabelColor`, #fff) |
| Rating | --chatty-color-rating | #b77900 | #f5c542 |
| Muted rating | --chatty-color-rating-muted | #d9d9d9 | #6d7175 |
| Critical | --chatty-color-critical | #c5280c | #ff9a8a |
| Elevation tier 1 | --chatty-shadow-1 | 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.08) | 0 0 0 1px rgb(255 255 255 / 0.1), 0 1px 2px rgb(0 0 0 / 0.4) |
| Elevation tier 2 | --chatty-shadow-2 | 0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 8px 24px -8px rgb(0 0 0 / 0.28) | 0 0 0 1px rgb(255 255 255 / 0.12), 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 24px -8px rgb(0 0 0 / 0.7) |
| Elevation tier 3 | --chatty-shadow-3 | 0 0 0 1px rgb(0 0 0 / 0.07), 0 4px 8px rgb(0 0 0 / 0.06), 0 24px 56px -12px rgb(0 0 0 / 0.32) | 0 0 0 1px rgb(255 255 255 / 0.12), 0 4px 8px rgb(0 0 0 / 0.3), 0 24px 56px -12px rgb(0 0 0 / 0.72) |
| Card hover shadow | --chatty-shadow-card-hover | 0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 4px 12px -4px rgb(0 0 0 / 0.18) | 0 0 0 1px rgb(255 255 255 / 0.12), 0 2px 4px rgb(0 0 0 / 0.3), 0 4px 12px -4px rgb(0 0 0 / 0.54) |

### Admin

#### Variables

| Part | Token | Light | Dark |
| --- | --- | --- | --- |
| Text | --chatty-color-text | --p-color-text; fallback #303030 | No Dark skin |
| Secondary text | --chatty-color-text-secondary | --p-color-text-secondary; fallback #616161 | No Dark skin |
| Disabled text | --chatty-color-text-disabled | --p-color-text-disabled; fallback #767676 | No Dark skin |
| Link | --chatty-color-text-link | --p-color-text-link; fallback #005bd3 | No Dark skin |
| Page background | --chatty-color-bg | --p-color-bg; fallback #f1f1f1 | No Dark skin |
| Surface | --chatty-color-bg-surface | --p-color-bg-surface; fallback #fff | No Dark skin |
| Raised surface | --chatty-color-bg-surface-raised | --p-color-bg-surface-raised; fallback #fff | No Dark skin |
| Secondary surface | --chatty-color-bg-surface-secondary | --p-color-bg-surface-secondary; fallback #f7f7f7 | No Dark skin |
| Media surface | --chatty-color-bg-media | #f7f7f7 | No Dark skin |
| Border | --chatty-color-border | --p-color-border; fallback #e3e3e3 | No Dark skin |
| Strong border | --chatty-color-border-strong | --p-color-border-strong; fallback #8a8a8a | No Dark skin |
| Focus border | --chatty-color-border-focus | --p-color-border-focus; fallback #005bd3 | No Dark skin |
| Accent | --chatty-color-accent | --p-color-accent; fallback #303030 | No Dark skin |
| On accent | --chatty-color-on-accent | --p-color-on-accent; fallback #fff | No Dark skin |
| Rating | --chatty-color-rating | --p-color-rating; fallback #b77900 | No Dark skin |
| Muted rating | --chatty-color-rating-muted | --p-color-rating-muted; fallback #d9d9d9 | No Dark skin |
| Critical | --chatty-color-critical | --p-color-critical; fallback #c5280c | No Dark skin |
| Elevation tier 1 | --chatty-shadow-1 | --p-shadow-100; fallback 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.08) | No Dark skin |
| Elevation tier 2 | --chatty-shadow-2 | --p-shadow-300; fallback 0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 8px 24px -8px rgb(0 0 0 / 0.28) | No Dark skin |
| Elevation tier 3 | --chatty-shadow-3 | --p-shadow-600; fallback 0 0 0 1px rgb(0 0 0 / 0.07), 0 4px 8px rgb(0 0 0 / 0.06), 0 24px 56px -12px rgb(0 0 0 / 0.32) | No Dark skin |

## Composed values

| Element | Surface | Light | Dark | Fallback |
| --- | --- | --- | --- | --- |
| Focus border | Classic | --chatty-color-border-focus = var(--chatty-ring) | #eee | var(`--faqsTextColor`, #303030) |
| Accent hover | AI Mode | --accent-deep: accent mixed 85% with black | Cùng biểu thức | --accent fallback #8b7be8 |
| Accent wash | AI Mode | --accent-tint: accent mixed 14% with transparent | Cùng biểu thức | --accent fallback #8b7be8 |
| Accent glow soft | AI Mode | --accent-glow-soft: accent mixed 18% with transparent | Cùng biểu thức | --accent fallback #8b7be8 |
| Accent glow strong | AI Mode | --accent-glow-strong: accent mixed 35% with transparent | Cùng biểu thức | --accent fallback #8b7be8 |
| Field focus halo | AI Mode | --focus-ring: accent mixed 25% with transparent | Cùng biểu thức | --accent fallback #8b7be8 |
| Warning fill | AI Mode | --warning-fill: warning mixed 16% with transparent | --warning-fill: warning mixed 14% with transparent | --warning #f0a030 |
| Elevation 1 alias | AI Mode | --shadow-1: var(--chatty-shadow-1) | Cùng alias | Không khai báo |
| Elevation 2 alias | AI Mode | --shadow-2: var(--chatty-shadow-2) | Cùng alias | Không khai báo |
| Elevation 3 alias | AI Mode | --shadow-float: var(--chatty-shadow-3) | Cùng alias | Không khai báo |
| Elevation tier 1 | Admin | --p-shadow-100 với fallback shadow storefront | No Dark skin | Shadow storefront tier 1 |
| Elevation tier 2 | Admin | --p-shadow-300 với fallback shadow storefront | No Dark skin | Shadow storefront tier 2 |
| Elevation tier 3 | Admin | --p-shadow-600 với fallback shadow storefront | No Dark skin | Shadow storefront tier 3 |

Example — Cặp text và surface lấy từ token Classic.

```jsx
import React from 'react';

export function Palette() {
  return (
    <div style={{display: 'grid', gap: 'var(--chatty-space-400)'}}>
      {['bg-surface', 'bg-surface-raised', 'bg-surface-secondary'].map(role => (
        <div key={role} data-swatch={role} style={{padding: 'var(--chatty-space-400)', background: `var(--chatty-color-${role})`, color: 'var(--chatty-color-text)'}}>
          <div className="chatty-type-body-medium">Primary text</div>
          <div className="chatty-type-body-small" style={{color: 'var(--chatty-color-text-secondary)'}}>Secondary text</div>
          <div className="chatty-type-body-small">{role}</div>
        </div>
      ))}
    </div>
  );
}
```

Example — Mẫu tier 0–3 theo token Classic.

```jsx
import React from 'react';

export function Elevation() {
  return (
    <div style={{display: 'grid', gap: 'var(--chatty-space-800)', padding: 'var(--chatty-space-600)'}}>
      {[0, 1, 2, 3].map(tier => (
        <div key={tier} data-tier={tier} className="chatty-type-body-medium" style={{padding: 'var(--chatty-space-400)', color: 'var(--chatty-color-text)', background: 'var(--chatty-color-bg-surface-raised)', boxShadow: tier ? `var(--chatty-shadow-${tier})` : 'none'}}>
          Tier {tier}
        </div>
      ))}
    </div>
  );
}
```

Example — Cặp text và surface lấy từ token AI Mode.

```jsx
import React from 'react';

export function Palette() {
  return (
    <div style={{display: 'grid', gap: 'var(--chatty-space-400)'}}>
      {['bg-surface', 'bg-surface-raised', 'bg-surface-secondary'].map(role => (
        <div key={role} data-swatch={role} style={{padding: 'var(--chatty-space-400)', background: `var(--chatty-color-${role})`, color: 'var(--chatty-color-text)'}}>
          <div className="chatty-type-body-medium">Primary text</div>
          <div className="chatty-type-body-small" style={{color: 'var(--chatty-color-text-secondary)'}}>Secondary text</div>
          <div className="chatty-type-body-small">{role}</div>
        </div>
      ))}
    </div>
  );
}
```

Example — Mẫu tier 0–3 theo token AI Mode.

```jsx
import React from 'react';

export function Elevation() {
  return (
    <div style={{display: 'grid', gap: 'var(--chatty-space-800)', padding: 'var(--chatty-space-600)'}}>
      {[0, 1, 2, 3].map(tier => (
        <div key={tier} data-tier={tier} className="chatty-type-body-medium" style={{padding: 'var(--chatty-space-400)', color: 'var(--chatty-color-text)', background: 'var(--chatty-color-bg-surface-raised)', boxShadow: tier ? `var(--chatty-shadow-${tier})` : 'none'}}>
          Tier {tier}
        </div>
      ))}
    </div>
  );
}
```

Example — Cặp text và surface lấy từ token Admin.

```jsx
import React from 'react';

export function Palette() {
  return (
    <div style={{display: 'grid', gap: 'var(--chatty-space-400)'}}>
      {['bg-surface', 'bg-surface-raised', 'bg-surface-secondary'].map(role => (
        <div key={role} data-swatch={role} style={{padding: 'var(--chatty-space-400)', background: `var(--chatty-color-${role})`, color: 'var(--chatty-color-text)'}}>
          <div className="chatty-type-body-medium">Primary text</div>
          <div className="chatty-type-body-small" style={{color: 'var(--chatty-color-text-secondary)'}}>Secondary text</div>
          <div className="chatty-type-body-small">{role}</div>
        </div>
      ))}
    </div>
  );
}
```

Example — Mẫu tier 0–3 theo token Admin.

```jsx
import React from 'react';

export function Elevation() {
  return (
    <div style={{display: 'grid', gap: 'var(--chatty-space-800)', padding: 'var(--chatty-space-600)'}}>
      {[0, 1, 2, 3].map(tier => (
        <div key={tier} data-tier={tier} className="chatty-type-body-medium" style={{padding: 'var(--chatty-space-400)', color: 'var(--chatty-color-text)', background: 'var(--chatty-color-bg-surface-raised)', boxShadow: tier ? `var(--chatty-shadow-${tier})` : 'none'}}>
          Tier {tier}
        </div>
      ))}
    </div>
  );
}
```

## Copy-paste export

### Classic

```css
.Avada-Faqs_Popup {
  --chatty-color-text: #303030;
  --chatty-color-text-secondary: #616161;
  --chatty-color-text-disabled: #767676;
  --chatty-color-text-link: #303030;
  --chatty-color-bg: #f1f1f1;
  --chatty-color-bg-surface: #fff;
  --chatty-color-bg-surface-raised: #fff;
  --chatty-color-bg-surface-secondary: #f7f7f7;
  --chatty-color-bg-media: #f7f7f7;
  --chatty-color-border: #e3e3e3;
  --chatty-color-border-strong: #8a8a8a;
  --chatty-color-border-focus: var(--chatty-ring);
  --chatty-color-accent: #303030;
  --chatty-color-on-accent: #fff;
  --chatty-color-rating: #b77900;
  --chatty-color-rating-muted: #d9d9d9;
  --chatty-color-critical: #c5280c;
  --chatty-shadow-1: 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.08);
  --chatty-shadow-2:
    0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 8px 24px -8px rgb(0 0 0 / 0.28);
  --chatty-shadow-3:
    0 0 0 1px rgb(0 0 0 / 0.07), 0 4px 8px rgb(0 0 0 / 0.06), 0 24px 56px -12px rgb(0 0 0 / 0.32);
  --chatty-shadow-card-hover:
    0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 4px 12px -4px rgb(0 0 0 / 0.18);
  --chatty-ring: var(--faqsTextColor, #303030);
  --chatty-error: #c63f4b;
  --chatty-link: var(--faqsTextColor, #303030);
  --chatty-field-ring: #c4c4c4;
  --chatty-form-border: #8a8a8a;
  --chatty-control: #000000;
}
.Avada-Faqs_Popup[data-theme="dark"] {
  --chatty-color-text: #eee;
  --chatty-color-text-secondary: #aaa;
  --chatty-color-text-disabled: #999;
  --chatty-color-text-link: #eee;
  --chatty-color-bg: #121212;
  --chatty-color-bg-surface: #1a1a1a;
  --chatty-color-bg-surface-raised: #282828;
  --chatty-color-bg-surface-secondary: #282828;
  --chatty-color-bg-media: #f7f7f7;
  --chatty-color-border: #ffffff17;
  --chatty-color-border-strong: #aaa;
  --chatty-color-border-focus: #eee;
  --chatty-color-accent: #eee;
  --chatty-color-on-accent: #1a1a1a;
  --chatty-color-rating: #f5c542;
  --chatty-color-rating-muted: #6d7175;
  --chatty-color-critical: #ff9a8a;
  --chatty-shadow-1: 0 0 0 1px rgb(255 255 255 / 0.1), 0 1px 2px rgb(0 0 0 / 0.4);
  --chatty-shadow-2:
    0 0 0 1px rgb(255 255 255 / 0.12), 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 24px -8px rgb(0 0 0 / 0.7);
  --chatty-shadow-3:
    0 0 0 1px rgb(255 255 255 / 0.12), 0 4px 8px rgb(0 0 0 / 0.3),
    0 24px 56px -12px rgb(0 0 0 / 0.72);
  --chatty-shadow-card-hover:
    0 0 0 1px rgb(255 255 255 / 0.12), 0 2px 4px rgb(0 0 0 / 0.3), 0 4px 12px -4px rgb(0 0 0 / 0.54);
  --chatty-ring: var(--faqsTextColor, #eee);
  --chatty-error: #ff9aa2;
  --chatty-link: var(--faqsTextColor, #eee);
  --chatty-field-ring: #b0b0b0;
  --chatty-form-border: #b0b0b0;
  --chatty-control: #ffffff;
}
```

### AI Mode

```css
.chatty-ai-mode {
  --bg-deep: #131215;
  --bg-elevated: #1c1b1f;
  --accent: var(--faqsBtnPopupColor, #8b7be8);
  --on-accent: var(--faqsFloatBtnLabelColor, #fff);
  --vib-1: rgba(255, 255, 255, 0.96);
  --vib-2: rgba(255, 255, 255, 0.74);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --chatty-color-text: var(--vib-1);
  --chatty-color-text-secondary: var(--vib-2);
  --chatty-color-text-disabled: #999;
  --chatty-color-text-link: var(--vib-1);
  --chatty-color-bg: #121212;
  --chatty-color-bg-surface: var(--bg-deep);
  --chatty-color-bg-surface-raised: var(--bg-elevated);
  --chatty-color-bg-surface-secondary: #282828;
  --chatty-color-bg-media: #f7f7f7;
  --chatty-color-border: var(--glass-edge);
  --chatty-color-border-strong: #aaa;
  --chatty-color-border-focus: var(--vib-1);
  --chatty-color-accent: var(--accent);
  --chatty-color-on-accent: var(--on-accent);
  --chatty-color-rating: #f5c542;
  --chatty-color-rating-muted: #6d7175;
  --chatty-color-critical: #ff9a8a;
  --chatty-shadow-1: 0 0 0 1px rgb(255 255 255 / 0.1), 0 1px 2px rgb(0 0 0 / 0.4);
  --chatty-shadow-2:
    0 0 0 1px rgb(255 255 255 / 0.12), 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 24px -8px rgb(0 0 0 / 0.7);
  --chatty-shadow-3:
    0 0 0 1px rgb(255 255 255 / 0.12), 0 4px 8px rgb(0 0 0 / 0.3),
    0 24px 56px -12px rgb(0 0 0 / 0.72);
  --chatty-shadow-card-hover:
    0 0 0 1px rgb(255 255 255 / 0.12), 0 2px 4px rgb(0 0 0 / 0.3), 0 4px 12px -4px rgb(0 0 0 / 0.54);
}
.chatty-ai-mode[data-theme="light"] {
  --bg-deep: #f6f4f0;
  --bg-elevated: #fbfaf7;
  --vib-1: rgba(20, 19, 24, 0.94);
  --vib-2: rgba(20, 19, 24, 0.74);
  --glass-edge: rgba(20, 19, 24, 0.08);
  --chatty-color-text: #303030;
  --chatty-color-text-secondary: #616161;
  --chatty-color-text-disabled: #767676;
  --chatty-color-text-link: #303030;
  --chatty-color-bg: #f1f1f1;
  --chatty-color-bg-surface: #fff;
  --chatty-color-bg-surface-raised: #fff;
  --chatty-color-bg-surface-secondary: #f7f7f7;
  --chatty-color-bg-media: #f7f7f7;
  --chatty-color-border: #e3e3e3;
  --chatty-color-border-strong: #8a8a8a;
  --chatty-color-border-focus: #303030;
  --chatty-color-accent: #303030;
  --chatty-color-on-accent: #fff;
  --chatty-color-rating: #b77900;
  --chatty-color-rating-muted: #d9d9d9;
  --chatty-color-critical: #c5280c;
  --chatty-shadow-1: 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.08);
  --chatty-shadow-2:
    0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 8px 24px -8px rgb(0 0 0 / 0.28);
  --chatty-shadow-3:
    0 0 0 1px rgb(0 0 0 / 0.07), 0 4px 8px rgb(0 0 0 / 0.06), 0 24px 56px -12px rgb(0 0 0 / 0.32);
  --chatty-shadow-card-hover:
    0 0 0 1px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.06), 0 4px 12px -4px rgb(0 0 0 / 0.18);
}
```

### Admin

```css
.inbox-v2 {
  --chatty-color-text: var(--p-color-text, #303030);
  --chatty-color-text-secondary: var(--p-color-text-secondary, #616161);
  --chatty-color-text-disabled: var(--p-color-text-disabled, #767676);
  --chatty-color-text-link: var(--p-color-text-link, #005bd3);
  --chatty-color-bg: var(--p-color-bg, #f1f1f1);
  --chatty-color-bg-surface: var(--p-color-bg-surface, #fff);
  --chatty-color-bg-surface-raised: var(--p-color-bg-surface-raised, #fff);
  --chatty-color-bg-surface-secondary: var(--p-color-bg-surface-secondary, #f7f7f7);
  --chatty-color-bg-media: #f7f7f7;
  --chatty-color-border: var(--p-color-border, #e3e3e3);
  --chatty-color-border-strong: var(--p-color-border-strong, #8a8a8a);
  --chatty-color-border-focus: var(--p-color-border-focus, #005bd3);
  --chatty-color-accent: var(--p-color-accent, #303030);
  --chatty-color-on-accent: var(--p-color-on-accent, #fff);
  --chatty-color-rating: var(--p-color-rating, #b77900);
  --chatty-color-rating-muted: var(--p-color-rating-muted, #d9d9d9);
  --chatty-color-critical: var(--p-color-critical, #c5280c);
  --chatty-shadow-1: var(--p-shadow-100, 0 0 0 1px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.08));
  --chatty-shadow-2: var(
    --p-shadow-300,
    0 0 0 1px rgb(0 0 0 / 0.06),
    0 2px 4px rgb(0 0 0 / 0.06),
    0 8px 24px -8px rgb(0 0 0 / 0.28)
  );
  --chatty-shadow-3: var(
    --p-shadow-600,
    0 0 0 1px rgb(0 0 0 / 0.07),
    0 4px 8px rgb(0 0 0 / 0.06),
    0 24px 56px -12px rgb(0 0 0 / 0.32)
  );
}
```

## Contrast matrix

| Surface | Pair | Light ratio | Dark ratio |
| --- | --- | --- | --- |
| Classic | --chatty-color-text / --chatty-color-bg-surface | Measured(#303030 / #ffffff = 13.20:1) | Measured(#eeeeee / #1a1a1a = 15.00:1) |
| Classic | --chatty-color-text-secondary / --chatty-color-bg-surface | Measured(#616161 / #ffffff = 6.19:1) | Measured(#aaaaaa / #1a1a1a = 7.49:1) |
| Classic | --chatty-color-text-disabled / --chatty-color-bg-surface | Measured(#767676 / #ffffff = 4.54:1) | Measured(#999999 / #1a1a1a = 6.11:1) |
| Classic | --chatty-color-border-strong / --chatty-color-bg-surface | Measured(#8a8a8a / #ffffff = 3.45:1) | Measured(#aaaaaa / #1a1a1a = 7.49:1) |
| Classic | --chatty-color-on-accent / --chatty-color-accent | Measured(#ffffff / #303030 = 13.20:1) | Measured(#1a1a1a / #eeeeee = 15.00:1) |
| Classic | --chatty-color-critical / --chatty-color-bg-surface | Measured(#c5280c / #ffffff = 5.70:1) | Measured(#ff9a8a / #1a1a1a = 8.49:1) |
| AI Mode | --chatty-color-text / --chatty-color-bg-surface | Measured(#303030 / #ffffff = 13.20:1) | Measured(rgba(255, 255, 255, 0.96) / #131215 = 17.20:1) |
| AI Mode | --chatty-color-text-secondary / --chatty-color-bg-surface | Measured(#616161 / #ffffff = 6.19:1) | Measured(rgba(255, 255, 255, 0.74) / #131215 = 10.42:1) |
| AI Mode | --chatty-color-on-accent / --chatty-color-accent | Measured(#ffffff / #303030 = 13.20:1) | Measured(#ffffff / #8b7be8 = 3.44:1) |
| AI Mode | --chatty-color-critical / --chatty-color-bg-surface | Measured(#c5280c / #ffffff = 5.70:1) | Measured(#ff9a8a / #131215 = 9.10:1) |
| Admin | --chatty-color-text / --chatty-color-bg-surface-secondary | Measured(#303030 / #f7f7f7 = 12.32:1) | No Dark skin |
| Admin | --chatty-color-text-link / --chatty-color-bg-surface-secondary | Measured(#005bd3 / #f7f7f7 = 5.70:1) | No Dark skin |

## Target

Giá trị thiết kế đối chiếu [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js), không phải màu đã ship của Inbox hiện tại. Tên token màu admin ghép prefix `--chatty-color-` với role trong cột Now dưới đây (ví dụ role `bg` thành `--chatty-color-bg`).

```target
| Surface | Now | Target | Source |
| --- | --- | --- | --- |
| Classic | --chatty-field-ring #c4c4c4 measures 1.60:1 on #f5f5f6 in Light; the source comment keeps it below 3:1 on purpose. | Not in code yet — build with the body values. Target a field ring of at least 3:1 against the field background in both themes. | [WCAG — non text contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html) |
| AI Mode | Dark fallback on-accent #ffffff on accent #8b7be8 measures 3.44:1. | Not in code yet — build with the body values. Target a fallback accent whose contrast with #ffffff is at least 4.5:1. | [Contrast](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html) |
| Classic · AI Mode | Role màu là biến riêng của từng surface, đọc qua class bên trong widget | Not available — new build follows Target. Token là API công khai: `tokens.css` sinh từ mixin `foundations.tokens` có sẵn, giữ nguyên tên role, 2 lớp: semantic `--chatty-color-bg-surface`, `--chatty-color-text`, `--chatty-color-border`, `--chatty-color-accent`, `--chatty-color-on-accent`, component `--chatty-<element>-*`; không có palette. `success` và `caution` là role mới trong `src/tokens/`, Light theo Polaris 2.0. Màu merchant `--faqs*` map sang semantic 1 lần ở gốc surface (`--faqsBtnPopupColor` → `--chatty-color-accent`); Light trên `:root, :host`, Dark dưới `[data-chatty-theme=dark]` ở tổ tiên; element không nạp token vào shadow root. | [MDN — Using CSS custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) |
| Admin | Màu inbox lấy từ class của `.inbox-v2` | Not available — new build follows Target. Màu admin: Inbox dùng literal light/dark admin-next trong token chatty-ui, không bọc var(--p-color-*, fallback). Primary Light #101010 trên #ffffff, Dark #fcfcfc trên #121212. Source _colour.scss còn wrapper; phase 1b phải gỡ trước khi chuyển component. Giữ giá trị 2.0; primary màu brand sẽ không đạt BFS 4.1.1. | [Shopify: Built for Shopify requirements](https://shopify.dev/docs/apps/launch/built-for-shopify/requirements) |
| Admin | Màu admin · bg — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#fff`; Dark `#121212`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-caution-secondary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.9167 .1785 98.00)`; Dark `#4f4700`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-critical — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.9470 .0300 20.50)`; Dark `#2f040b`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-info-secondary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.8637 .1018 216.95)`; Dark `#003a5a`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-inverse — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#1b1b1b`; Dark `#303030`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-secondary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#ebebeb`; Dark `#373737`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-success — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.9672 .0599 131.73)`; Dark `#014b40`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-success-secondary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.9053 .1942 133.49)`; Dark `#014b40`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-tertiary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#ddd`; Dark `#414141`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-fill-tertiary-hover — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#d0d0d0`; Dark `#585858`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-surface — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#fff`; Dark `#1a1a1a`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-surface-critical — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.9470 .0300 20.50)`; Dark `#5f0716`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-surface-secondary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#f7f7f7`; Dark `#282828`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-surface-secondary-selected — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#ebebeb`; Dark `#373737`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-surface-success — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.9672 .0599 131.73)`; Dark `#073630`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-surface-tertiary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#f2f2f2`; Dark `#2f2f2f`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · bg-surface-warning — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.9557 .0350 67.45)`; Dark `#412d00`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · border — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `rgba(221,221,221,1)`; Dark `#ffffff17`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · border-secondary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `rgba(242,242,242,1)`; Dark `#ffffff0f`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · border-tertiary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `rgba(192,192,192,1)`; Dark `#ffffff2e`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · border-warning — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.9316 .0545 67.18)`; Dark `#956f00`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · icon-secondary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#606060`; Dark `#aaa`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#101010`; Dark `#eee`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-brand-on-accent — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#fff`; Dark `#121212`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-caution — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.2708 .0638 90.28)`; Dark `#ffeb78`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-critical — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.2121 .0942 30.90)`; Dark `#f78086`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-info — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.2715 .0576 221.37)`; Dark `#a8d8ff`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-link — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.4840 .2413 262.80)`; Dark `#c5d0ff`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-link-inverse — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.7340 .1449 264.63)`; Dark `#c5d0ff`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-on-accent — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `#fff`; Dark `#121212`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-secondary — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `rgba(74,74,74,1)`; Dark `#aaa`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-success — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.2334 .0796 134.14)`; Dark `#2ced83`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
| Admin | Màu admin · text-warning — source hiện tại còn bọc Polaris | Not available — new build follows Target. Literal Light `oklch(.2475 .0726 51.49)`; Dark `#ffc879`. | [Polaris 2.0 runtime](https://cdn.shopify.com/shopifycloud/polaris-2.js) |
```

Example — Target: mẫu giá trị Inbox được duyệt; không phải implementation production.

```jsx
import React from 'react';
const radii = {"container": "20px", "dialog": "20px", "popover": "12px", "control": "10px", "element": "8px", "tag": "6px", "checkbox": "4px", "avatar": "clamp(6px, 30%, 12px)", "action": "9999px", "chat-control": ".5rem", "option-item": ".5rem", "kbd": ".25rem"};
const themes = {"light": {"--chatty-color-bg": "#fff", "--chatty-color-bg-fill-caution-secondary": "oklch(.9167 .1785 98.00)", "--chatty-color-bg-fill-critical": "oklch(.9470 .0300 20.50)", "--chatty-color-bg-fill-info-secondary": "oklch(.8637 .1018 216.95)", "--chatty-color-bg-fill-inverse": "#1b1b1b", "--chatty-color-bg-fill-secondary": "#ebebeb", "--chatty-color-bg-fill-success": "oklch(.9672 .0599 131.73)", "--chatty-color-bg-fill-success-secondary": "oklch(.9053 .1942 133.49)", "--chatty-color-bg-fill-tertiary": "#ddd", "--chatty-color-bg-fill-tertiary-hover": "#d0d0d0", "--chatty-color-bg-surface": "#fff", "--chatty-color-bg-surface-critical": "oklch(.9470 .0300 20.50)", "--chatty-color-bg-surface-secondary": "#f7f7f7", "--chatty-color-bg-surface-secondary-selected": "#ebebeb", "--chatty-color-bg-surface-success": "oklch(.9672 .0599 131.73)", "--chatty-color-bg-surface-tertiary": "#f2f2f2", "--chatty-color-bg-surface-warning": "oklch(.9557 .0350 67.45)", "--chatty-color-border": "rgba(221,221,221,1)", "--chatty-color-border-secondary": "rgba(242,242,242,1)", "--chatty-color-border-tertiary": "rgba(192,192,192,1)", "--chatty-color-border-warning": "oklch(.9316 .0545 67.18)", "--chatty-color-icon-secondary": "#606060", "--chatty-color-text": "#101010", "--chatty-color-text-brand-on-accent": "#fff", "--chatty-color-text-caution": "oklch(.2708 .0638 90.28)", "--chatty-color-text-critical": "oklch(.2121 .0942 30.90)", "--chatty-color-text-info": "oklch(.2715 .0576 221.37)", "--chatty-color-text-link": "oklch(.4840 .2413 262.80)", "--chatty-color-text-link-inverse": "oklch(.7340 .1449 264.63)", "--chatty-color-text-on-accent": "#fff", "--chatty-color-text-secondary": "rgba(74,74,74,1)", "--chatty-color-text-success": "oklch(.2334 .0796 134.14)", "--chatty-color-text-warning": "oklch(.2475 .0726 51.49)"}, "dark": {"--chatty-color-bg": "#121212", "--chatty-color-bg-fill-caution-secondary": "#4f4700", "--chatty-color-bg-fill-critical": "#2f040b", "--chatty-color-bg-fill-info-secondary": "#003a5a", "--chatty-color-bg-fill-inverse": "#303030", "--chatty-color-bg-fill-secondary": "#373737", "--chatty-color-bg-fill-success": "#014b40", "--chatty-color-bg-fill-success-secondary": "#014b40", "--chatty-color-bg-fill-tertiary": "#414141", "--chatty-color-bg-fill-tertiary-hover": "#585858", "--chatty-color-bg-surface": "#1a1a1a", "--chatty-color-bg-surface-critical": "#5f0716", "--chatty-color-bg-surface-secondary": "#282828", "--chatty-color-bg-surface-secondary-selected": "#373737", "--chatty-color-bg-surface-success": "#073630", "--chatty-color-bg-surface-tertiary": "#2f2f2f", "--chatty-color-bg-surface-warning": "#412d00", "--chatty-color-border": "#ffffff17", "--chatty-color-border-secondary": "#ffffff0f", "--chatty-color-border-tertiary": "#ffffff2e", "--chatty-color-border-warning": "#956f00", "--chatty-color-icon-secondary": "#aaa", "--chatty-color-text": "#eee", "--chatty-color-text-brand-on-accent": "#121212", "--chatty-color-text-caution": "#ffeb78", "--chatty-color-text-critical": "#f78086", "--chatty-color-text-info": "#a8d8ff", "--chatty-color-text-link": "#c5d0ff", "--chatty-color-text-link-inverse": "#c5d0ff", "--chatty-color-text-on-accent": "#121212", "--chatty-color-text-secondary": "#aaa", "--chatty-color-text-success": "#2ced83", "--chatty-color-text-warning": "#ffc879"}};
const frameStyle = {
 ...themes.light,
 ...Object.fromEntries(Object.entries(radii).map(([role,value])=>['--chatty-radius-'+role,value])),
 '--chatty-type-family':'ShopifyInter, ui-sans-serif, system-ui, sans-serif',
 '--chatty-type-weight-regular':400,'--chatty-type-weight-medium':500,'--chatty-type-weight-semibold':600,
 '--chatty-type-body-medium-size':'13px','--chatty-type-body-medium-line':'20px',
 '--chatty-type-button-label-size':'12px','--chatty-type-button-label-line':'16px',
 '--chatty-type-badge-label-size':'12px','--chatty-type-badge-label-line':'18px',
 fontFamily:'var(--chatty-type-family)',fontSize:'var(--chatty-type-body-medium-size)',lineHeight:'var(--chatty-type-body-medium-line)',fontWeight:'var(--chatty-type-weight-regular)',
 color:'var(--chatty-color-text)',background:'var(--chatty-color-bg-surface)',padding:16
};
const box = {border:'1px solid #888',background:'#f7f7f7',padding:12,color:'#101010',font:'inherit'};
function Target({children}) { return <div data-inbox-target style={frameStyle}><link rel="stylesheet" href="https://cdn.shopify.com/static/fonts/shopifyinter/v0/styles.css"/><p style={{marginTop:0}}>Target · design fixture · phase 1b chưa ship</p>{children}</div>; }
function RadiusSample({role,value}) {
 const style={...box,borderRadius:`var(--chatty-radius-${role})`};
 if(role==='checkbox')return <input aria-label="Checkbox radius sample" type="checkbox" style={{...style,appearance:'none',width:24,height:24,padding:0}}/>;
 if(role==='avatar')return <span role="img" aria-label="Avatar initials" style={{...style,width:36,height:36,padding:0,display:'grid',placeItems:'center'}}>AB</span>;
 if(role==='tag')return <span style={{...style,padding:'0 8px',display:'inline-block'}}>Status</span>;
 if(role==='kbd')return <kbd style={{...style,padding:'0 6px'}}>A</kbd>;
 if(['action','control','chat-control','option-item'].includes(role))return <button type="button" style={style}>Action</button>;
 if(role==='dialog')return <dialog open aria-label="Dialog radius sample" style={{...style,position:'static',margin:0}}>Dialog</dialog>;
 return <section aria-label={`${role} radius sample`} style={style}>{role}</section>;
}
export function Colours() {
 return <Target><div style={{display:'grid',gridTemplateColumns:'repeat(auto-fit,minmax(220px,1fr))',gap:16}}>{Object.entries(themes).map(([theme,tokens])=><section data-target-theme={theme} key={theme} style={{...tokens,background:'var(--chatty-color-bg-surface)',color:'var(--chatty-color-text)',padding:12,border:'1px solid #888'}}><h3 style={{fontSize:13,fontWeight:'var(--chatty-type-weight-medium)'}}>{theme}</h3>{Object.entries(tokens).map(([name,value])=><div key={name} data-colour-role={name} style={{display:'grid',gridTemplateColumns:'32px minmax(0,1fr)',gap:8,marginBottom:12}}><span aria-hidden="true" style={{background:`var(${name})`,border:'1px solid #888',height:32}}/><span style={{overflowWrap:'anywhere'}}>{name.replace('--chatty-color-','')}<br/>{value}</span></div>)}</section>)}</div></Target>;
}
```

Example — Target: kích thước admin và nút primary Light/Dark.

```jsx
import React from 'react';
const radii = {"container": "20px", "dialog": "20px", "popover": "12px", "control": "10px", "element": "8px", "tag": "6px", "checkbox": "4px", "avatar": "clamp(6px, 30%, 12px)", "action": "9999px", "chat-control": ".5rem", "option-item": ".5rem", "kbd": ".25rem"};
const themes = {"light": {"--chatty-color-bg": "#fff", "--chatty-color-bg-fill-caution-secondary": "oklch(.9167 .1785 98.00)", "--chatty-color-bg-fill-critical": "oklch(.9470 .0300 20.50)", "--chatty-color-bg-fill-info-secondary": "oklch(.8637 .1018 216.95)", "--chatty-color-bg-fill-inverse": "#1b1b1b", "--chatty-color-bg-fill-secondary": "#ebebeb", "--chatty-color-bg-fill-success": "oklch(.9672 .0599 131.73)", "--chatty-color-bg-fill-success-secondary": "oklch(.9053 .1942 133.49)", "--chatty-color-bg-fill-tertiary": "#ddd", "--chatty-color-bg-fill-tertiary-hover": "#d0d0d0", "--chatty-color-bg-surface": "#fff", "--chatty-color-bg-surface-critical": "oklch(.9470 .0300 20.50)", "--chatty-color-bg-surface-secondary": "#f7f7f7", "--chatty-color-bg-surface-secondary-selected": "#ebebeb", "--chatty-color-bg-surface-success": "oklch(.9672 .0599 131.73)", "--chatty-color-bg-surface-tertiary": "#f2f2f2", "--chatty-color-bg-surface-warning": "oklch(.9557 .0350 67.45)", "--chatty-color-border": "rgba(221,221,221,1)", "--chatty-color-border-secondary": "rgba(242,242,242,1)", "--chatty-color-border-tertiary": "rgba(192,192,192,1)", "--chatty-color-border-warning": "oklch(.9316 .0545 67.18)", "--chatty-color-icon-secondary": "#606060", "--chatty-color-text": "#101010", "--chatty-color-text-brand-on-accent": "#fff", "--chatty-color-text-caution": "oklch(.2708 .0638 90.28)", "--chatty-color-text-critical": "oklch(.2121 .0942 30.90)", "--chatty-color-text-info": "oklch(.2715 .0576 221.37)", "--chatty-color-text-link": "oklch(.4840 .2413 262.80)", "--chatty-color-text-link-inverse": "oklch(.7340 .1449 264.63)", "--chatty-color-text-on-accent": "#fff", "--chatty-color-text-secondary": "rgba(74,74,74,1)", "--chatty-color-text-success": "oklch(.2334 .0796 134.14)", "--chatty-color-text-warning": "oklch(.2475 .0726 51.49)"}, "dark": {"--chatty-color-bg": "#121212", "--chatty-color-bg-fill-caution-secondary": "#4f4700", "--chatty-color-bg-fill-critical": "#2f040b", "--chatty-color-bg-fill-info-secondary": "#003a5a", "--chatty-color-bg-fill-inverse": "#303030", "--chatty-color-bg-fill-secondary": "#373737", "--chatty-color-bg-fill-success": "#014b40", "--chatty-color-bg-fill-success-secondary": "#014b40", "--chatty-color-bg-fill-tertiary": "#414141", "--chatty-color-bg-fill-tertiary-hover": "#585858", "--chatty-color-bg-surface": "#1a1a1a", "--chatty-color-bg-surface-critical": "#5f0716", "--chatty-color-bg-surface-secondary": "#282828", "--chatty-color-bg-surface-secondary-selected": "#373737", "--chatty-color-bg-surface-success": "#073630", "--chatty-color-bg-surface-tertiary": "#2f2f2f", "--chatty-color-bg-surface-warning": "#412d00", "--chatty-color-border": "#ffffff17", "--chatty-color-border-secondary": "#ffffff0f", "--chatty-color-border-tertiary": "#ffffff2e", "--chatty-color-border-warning": "#956f00", "--chatty-color-icon-secondary": "#aaa", "--chatty-color-text": "#eee", "--chatty-color-text-brand-on-accent": "#121212", "--chatty-color-text-caution": "#ffeb78", "--chatty-color-text-critical": "#f78086", "--chatty-color-text-info": "#a8d8ff", "--chatty-color-text-link": "#c5d0ff", "--chatty-color-text-link-inverse": "#c5d0ff", "--chatty-color-text-on-accent": "#121212", "--chatty-color-text-secondary": "#aaa", "--chatty-color-text-success": "#2ced83", "--chatty-color-text-warning": "#ffc879"}};
const frameStyle = {
 ...themes.light,
 ...Object.fromEntries(Object.entries(radii).map(([role,value])=>['--chatty-radius-'+role,value])),
 '--chatty-type-family':'ShopifyInter, ui-sans-serif, system-ui, sans-serif',
 '--chatty-type-weight-regular':400,'--chatty-type-weight-medium':500,'--chatty-type-weight-semibold':600,
 '--chatty-type-body-medium-size':'13px','--chatty-type-body-medium-line':'20px',
 '--chatty-type-button-label-size':'12px','--chatty-type-button-label-line':'16px',
 '--chatty-type-badge-label-size':'12px','--chatty-type-badge-label-line':'18px',
 fontFamily:'var(--chatty-type-family)',fontSize:'var(--chatty-type-body-medium-size)',lineHeight:'var(--chatty-type-body-medium-line)',fontWeight:'var(--chatty-type-weight-regular)',
 color:'var(--chatty-color-text)',background:'var(--chatty-color-bg-surface)',padding:16
};
const box = {border:'1px solid #888',background:'#f7f7f7',padding:12,color:'#101010',font:'inherit'};
function Target({children}) { return <div data-inbox-target style={frameStyle}><link rel="stylesheet" href="https://cdn.shopify.com/static/fonts/shopifyinter/v0/styles.css"/><p style={{marginTop:0}}>Target · design fixture · phase 1b chưa ship</p>{children}</div>; }
function RadiusSample({role,value}) {
 const style={...box,borderRadius:`var(--chatty-radius-${role})`};
 if(role==='checkbox')return <input aria-label="Checkbox radius sample" type="checkbox" style={{...style,appearance:'none',width:24,height:24,padding:0}}/>;
 if(role==='avatar')return <span role="img" aria-label="Avatar initials" style={{...style,width:36,height:36,padding:0,display:'grid',placeItems:'center'}}>AB</span>;
 if(role==='tag')return <span style={{...style,padding:'0 8px',display:'inline-block'}}>Status</span>;
 if(role==='kbd')return <kbd style={{...style,padding:'0 6px'}}>A</kbd>;
 if(['action','control','chat-control','option-item'].includes(role))return <button type="button" style={style}>Action</button>;
 if(role==='dialog')return <dialog open aria-label="Dialog radius sample" style={{...style,position:'static',margin:0}}>Dialog</dialog>;
 return <section aria-label={`${role} radius sample`} style={style}>{role}</section>;
}
export function Buttons() {
 return <Target><div style={{display:'flex',gap:16,flexWrap:'wrap'}}>{['light','dark'].map(theme=><div key={theme} data-primary-theme={theme} style={{padding:16,background:theme==='dark'?'#1a1a1a':'#fff',color:theme==='dark'?'#eee':'#101010','--chatty-color-action-primary-bg':theme==='dark'?'#fcfcfc':'#101010','--chatty-color-action-primary-fg':theme==='dark'?'#121212':'#fff'}}><p>{theme} · Target</p><button data-admin-primary type="button" style={{font:'var(--chatty-type-weight-medium) var(--chatty-type-button-label-size)/var(--chatty-type-button-label-line) var(--chatty-type-family)',height:28,padding:'0 12px',borderRadius:'var(--chatty-radius-action)',border:0,background:'var(--chatty-color-action-primary-bg)',color:'var(--chatty-color-action-primary-fg)'}}>Assign to me <kbd style={{font:'inherit',borderRadius:'var(--chatty-radius-kbd)'}}>A</kbd></button><span data-admin-badge style={{display:'inline-flex',height:20,alignItems:'center',marginInlineStart:8,padding:'0 6px',fontSize:'var(--chatty-type-badge-label-size)',lineHeight:'var(--chatty-type-badge-label-line)',fontWeight:'var(--chatty-type-weight-medium)',borderRadius:'var(--chatty-radius-tag)',border:'1px solid currentColor'}}>Status</span></div>)}</div><p>BFS 4.1.1: nút chính đen/trắng; màu brand không đạt điều kiện. Giá trị 2.0, component chatty-ui.</p></Target>;
}
```


- [WCAG — non text contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html)
- [Contrast](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
- [MDN — :host](https://developer.mozilla.org/en-US/docs/Web/CSS/:host)
- [Shopify: Built for Shopify requirements](https://shopify.dev/docs/apps/launch/built-for-shopify/requirements)
