# DESIGN.md: building interfaces with Stingray

Stingray 1. The complete rules for any AI assistant or code generator that writes UI with Stingray.

Stingray is plain CSS classes, CSS custom properties and one classic script, made for the software corporate and office teams work in all day, above all IT, customer support and helpdesk: queues, tickets, conversations and reports. There is no React, Vue or npm package, no Tailwind, and no build step to use it.

## 0. How to read this file

- Stingray is a guideline with a small required core. Its rules come in three tiers (section 2):
  - **Required** rules keep a product accessible, themeable and consistent. Never break them, even for something "quick" or "temporary".
  - **Defaults** are the Stingray look. Follow them unless an allowed variation covers the case, or the product's `DESIGN-EXCEPTIONS.md` records the departure: the rule id, what the product does instead, and why (section 13).
  - **Allowed variations** (V1 to V5) are pre-approved latitude for app patterns and motion. Use them where they fit; they need no record.
- Inside a component entry (section 8), **MUST** and **MUST NOT** are that component's rules, **SHOULD** is its default, and **MAY** is allowed and not required.
- This file is a closed world. Every class, token, attribute, event, icon and function you may use is written here. The reference in section 16 is generated from the source and lists every token and every class that exists. **A name that is not in this file does not exist.**
- **Names that do not exist**, though other systems have them: `sg-badge`, `sg-modal`, `sg-alert`, `sg-chip-group`, `sg-grid`, `sg-container`, `sg-row`, `sg-col`, `sg-button--secondary`, `sg-button--ghost`, `sg-button--outline`, `--sg-color-primary`, `--sg-spacing-md`, `--sg-space-5`, `--sg-space-10`, `--sg-radius-lg`, `--sg-shadow-md`. Do not guess names by analogy; these do not exist.
- Classes that start with `docs-` belong to the documentation site. Never use them in a product.
- When a request needs something Stingray does not have, follow section 13, "Extending Stingray". Never invent a `sg-` name.
- Stingray wins over habits from other systems (Material, Bootstrap, Tailwind, Carbon). Where they differ, do what this file says.

## 1. Setup

Four files, in this order, in `<head>`:

```html
<link rel="stylesheet" href="tokens/tokens.css">
<link rel="stylesheet" href="css/icons.css">
<link rel="stylesheet" href="css/stingray.css">
<script src="js/stingray.js"></script>
```

The page skeleton of a product:

```html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Citizen records · Civil Registry</title>
  <link rel="stylesheet" href="tokens/tokens.css">
  <link rel="stylesheet" href="css/icons.css">
  <link rel="stylesheet" href="css/stingray.css">
  <script src="js/stingray.js"></script>
</head>
<body class="sg">
  <a class="sg-skip" href="#main">Skip to content</a>
  <header>…your product's bar…</header>
  <nav class="sg-nav" aria-label="Civil Registry">…</nav>
  <main id="main" tabindex="-1">
    <header class="sg-page-header"><h1 class="sg-page-header__title">Citizen records</h1></header>
  </main>
</body>
</html>
```

- `class="sg"` MUST go on `<body>`, never on `<html>`. The tokens are in rem, so the root font size stays the browser's and the whole grid scales with the person's text setting.
- `lang` MUST be set on `<html>`. Sorting, dates and number formatting read it.
- The script is a classic script in `<head>`, so the saved theme and density apply before first paint. MUST NOT use `type="module"`: modules do not load over `file://`.
- MUST NOT load fonts, icons or scripts from a CDN or any other site. Everything is vendored.
- The script wires everything on load. After inserting markup later, call `Stingray.init(container)`.
- A page with a time series (section 8.20) also loads `<script src="vendor/uplot/uPlot.iife.min.js"></script>`, vendored with Stingray. No other page needs it.
- **Content Security Policy.** Stingray works under `default-src 'self'; style-src 'self'; script-src 'self'`. That policy blocks inline `style` attributes, so set the four per-element custom properties (`--sg-meter-value`, `--sg-progress-value`, `--sg-skeleton-width`, `--sg-attachment-preview`) from script with `element.style.setProperty(…)`.
- **Phones.** With `viewport-fit=cover` in the viewport meta, toasts, the bulk action bar and drawers keep clear of the notch and the home indicator. Pad your own fixed bars with `env(safe-area-inset-*)` too.

## 2. Rules

Every rule has an id, so a review or an exception entry can cite it. Required rules come first, then the Defaults, then the variations that are already allowed.

### Required

Never broken. An exception entry cannot override these.

- **C1.** Color only from tokens: Stingray's semantic (`--sg-color-*`) and component tokens, or, under a recorded exception, the product's own prefixed tokens declared once with light and dark values (section 13). MUST NOT write hex, rgb, hsl, oklch or named colors in component or page CSS, and MUST NOT read a primitive color token (a color named by hue and step, like blue 600).
- **C6.** Color is never the only signal. Every status is a glyph, a word and a hue (`sg-status`). Every error adds a glyph and text. Every chart has a legend, labels and a table view. Presence is a glyph shape as well as a hue.
- **C9.** Links in text are underlined, always. Items whose whole shape is the target (navigation links, list rows, a linked card's title) are exempt.
- **C10.** Dark mode is its own tuned theme. MUST NOT build it with `filter: invert()` or by overriding tokens per theme.
- **T5.** Text sizes come only from the type styles (section 4). The smallest text anywhere is 12px, and the tokens hold text under 14px to 7:1 contrast.
- **S1.** 4pt grid. Every margin, padding and gap is one of the eight steps (4, 8, 12, 16, 24, 32, 48 or 64px), written as a `--sg-space-*` token or given by a layout helper.
- **S6.** Every pointer target is at least 24px. Never shrink component heights to fit.
- **D3.** Shadows only through `--sg-elevation-raised` (static surfaces), `--sg-elevation-overlay` (menus, toasts, popovers) and `--sg-elevation-modal` (dialogs, drawers). MUST NOT write `box-shadow` values.
- **M1.** Motion only from `--sg-motion-duration-*` and `--sg-motion-easing-*`. The durations are 0ms under reduced motion, so never hard-code a duration, and every loop stands still under reduced motion.
- **A1.** WCAG 2.2 AA is the floor for every page.
- **A2.** The focus ring is built in: 2px ink, 2px offset, never blue, at 7:1 or better on every surface. MUST NOT remove `outline`, and MUST NOT restyle `:focus-visible`.
- **A3.** Every icon-only button has an `aria-label` and a `data-sg-tip` with the same text. Decorative icons have `aria-hidden="true"`.
- **A4.** Every input has a visible `<label for>`. Placeholder text is never the label.
- **A5.** Composite components (grid, tabs, tree, list, segmented control, radio group) are one tab stop with arrow keys inside; so are the reply and options buttons of a thread. Keep the keyboard models the script provides; never add `tabindex` to their parts.
- **A6.** Nothing is reachable only by hover. Tooltips supplement visible text and never hold the only copy of information or any control.
- **A8.** Every page has one `<h1>`, one `<main>`, a skip link first in `<body>`, and a unique `aria-label` on every `<nav>`.
- **A9.** Navigation lists the same destinations at every width. A navigation that opens over the page (a drawer behind a menu button) is modal: Escape closes it, focus moves in and returns to its button, and the page behind is inert. `sg-drawer` already behaves this way. Never drop a destination because the window is narrow.
- **X1.** The product is called **Stingray**, and this release is **Stingray 1**. Never add a version tag after the name, and never call it a "design system" in its name.
- **X2.** Only the names in this file exist. Never invent a `sg-` class, token or attribute, and never restyle a `sg-` class; a product's own parts use its own prefix (section 13).
- **X3.** The setup in section 1 is required as written: the four files, `class="sg"` on `<body>`, `lang` on `<html>`, a classic script, and nothing loaded from another site.

### Defaults

The Stingray look. Each one says why it exists, so you can judge a departure. To depart, use an allowed variation below or record an exception (section 13).

**Color**

- **C2.** Blue means "you can act here", "this is selected" or "you are here", and nothing else. Headers, sidebars, top bars, banners, section backgrounds and decorative icons are never blue. *Why:* blue always follows the person's own thread, so people find every action and their place by its color.
- **C3.** Where you are is never solid blue. The current tab and step and the selected row take a light brand tint (`--sg-color-surface-current`), a short brand bar (`--sg-color-border-current`) and semibold ink. The current item in the side navigation is a raised pill with a short ink bar and semibold ink; the current breadcrumb is semibold ink. *Why:* a solid blue location reads as a button; a tint or a pill tells a place from an action, and the bar and the weight carry it without color (C6).
- **C4.** One `sg-button--primary` per view; a dialog or drawer is its own view. *Why:* the primary answers "what now?", and two answers are none. For split views, see V3.
- **C5.** Hue answers "who acts next?": blue is you, gray is someone else or nobody, green is done, amber is time at risk, red is time breached or an error. Pick a status by meaning, never by the color you want. *Why:* one meaning per hue across every product.
- **C7.** Feedback is a status bar, a glyph and a label, never a filled container, row or tag. The one exception is one `sg-banner--prominent` per page. *Why:* status fills tire the eye and fail in dark mode.
- **C8.** Neutrals are true gray, and Stingray's hues are the only ones. No tinted grays, pure black, pure white, gradients, blur (except while `sg-icon-swap` changes icon), glass, transparency effects or brand colors. *Why:* every hue keeps its meaning and its tested contrast.

**Type**

- **T1.** One family in two cuts. Atkinson Hyperlegible Next sets all interface text, through `.sg`. Atkinson Hyperlegible Mono sets code, logs and terminal output, through `<code>`, `<samp>`, `<pre>`, `sg-code`, `sg-code-block`, `sg-log` and `sg-mono`. Never declare `font-family`. *Why:* it was chosen for legibility, and the mono cut has the same letters on a fixed width, so columns of output line up.
- **T2.** Two weights: 400 and 600. Never 300, 500, 700, `bold` or `bolder`. *Why:* two weights are enough for hierarchy and survive low-quality screens.
- **T3.** No italics. Emphasis is weight 600, never italics, underline or color. *Why:* italics are harder to read, and underline means a link.
- **T4.** No uppercase text, except inside `sg-classification`. Sentence case everywhere. *Why:* capitals read slower and sound like shouting.
- **T6.** Numbers that stack in columns use `sg-num` (tabular figures); amounts are right-aligned with `sg-num-end`. *Why:* digits line up, so magnitudes compare at a glance.

**Space, shape and depth**

- **S2.** Prefer the named spacing roles (`--sg-space-inset-*`, `--sg-space-stack-*`, `--sg-space-inline-*`) when one fits. *Why:* they say why a value is used.
- **S3.** Heights are tokens; padding is derived. Never set a control or row height by hand: 28, 36 or 44px controls, 28, 36 or 48px rows. *Why:* density changes them all together.
- **S4.** Strokes are not spacing: borders are 1px (`--sg-stroke-hairline`), location markers and the focus ring are 2px (`--sg-stroke-rule`). Nothing is 3px or half a pixel. *Why:* two weights of line keep hierarchy clear.
- **S5.** Widths are layout, not spacing. Set field and column widths in `rem` in your own CSS classes (a postcode field is about 8rem, not full width). *Why:* a field's width hints at its answer.
- **S7.** No gap above 64px. More separation is a heading, a hairline or a new page. *Why:* big gaps break a dense page into islands.
- **D1.** Radius follows size, with exactly these tokens: `--sg-radius-mark` 3px (tags, kbd, checkboxes, inline code, small hover shapes), `--sg-radius-control` 4px (buttons, inputs, selects, tooltips, list rows), `--sg-radius-float` 8px (menus, popovers, toasts, banners, messages), `--sg-radius-container` 8px (panels, cards, table frames, charts, dialogs, drawers, code blocks), `--sg-radius-track` 6px (the segmented track only), `--sg-radius-round` (dots, avatars, the switch, meters, counts, slider thumbs). Nested corners are concentric: an outer radius is the inner radius plus the gap between them, which is why a menu (4px items, 4px padding) is 8px and the composer (4px controls, 8px around them) is 12px. Nothing is rounder than that except the round shapes, and buttons are never pills. Where the browser supports `corner-shape`, controls and surfaces get continuous corners at 1.8 times the radius, so each corner keeps its size. *Why:* corners that follow what they hold read as one family, and large corners on small surfaces read as bubbles.
- **D2.** The page is a near-white canvas (`--sg-color-surface-page`) holding white raised surfaces, one raised level per region. Never put a panel, a table frame or a card inside a panel. Group with space first, and draw a hairline only between the rows of one list or table. *Why:* stacked boxes and lines waste space, blur what belongs together and make a screen read like a wireframe. For cards, see V1.

**Motion, interaction and data**

- **M2.** Motion confirms a change and lasts at most 240ms. Nothing pulses, bounces, shimmers or scrolls by itself, and layout never animates. The loader (section 8.37) and a progress bar with no known end loop, on `--sg-motion-duration-loop`. A move between two places uses `--sg-motion-easing-move`, and an object that travels across the screen follows an arc. A list that arrives for the first time MAY bring in its first ten rows 30ms apart (`Stingray.stagger`), never on sort or filter. *Why:* motion that draws the eye on its own competes with the work. For live activity and large panels, see V4 and V5.
- **M3.** Nothing moves under the pointer. New rows wait behind a "N new, show them" control and never reorder a list on their own. *Why:* people click what was there a moment ago.
- **A7.** Data tables have no row hover and no zebra stripes; the selected row is the only fill a table row gets. *Why:* a table is read across, and hover fills flicker under a pointer at rest. For lists whose rows are controls, see V2.
- **N1.** Every aggregate (a stat, a chart, a total, a record diff) shows a provenance line: source, as-of time and sample size, or who, when and why. *Why:* a figure without a source cannot be trusted or checked.
- **N2.** Dates are "28 Sep 2026", times "14:02 UTC", ranges "1–24 of 214". Numbers are formatted with `Intl.NumberFormat` for the page language. Negative numbers use the true minus sign, U+2212. An age in a queue, a thread or an activity list may be relative ("5 minutes ago") through `data-sg-relative` on a `<time>`, which keeps the exact time in `datetime` and in the tooltip. *Why:* one unambiguous format in every product.

### Allowed variations

Pre-approved. Use them where they fit; they need no exception entry.

- **V1. Cards.** Peers that a person browses or compares at a glance (dashboards, galleries, boards) may be `sg-card`s in a `sg-cards` grid (section 8.28). A card is one raised level: never inside a panel or another card. Records a person scans in bulk stay in a table.
- **V2. Hover on interactive lists.** Rows that are each one control (an inbox, a conversation list, a picker) use `sg-list` (section 8.49), which has hover and pressed fills and the brand tint when selected. Data tables keep A7.
- **V3. One primary per pane.** In a split view where each pane is its own task (a list, a thread, details), each pane may have one primary button. The page still has one title.
- **V4. Live-activity loops.** Something happening now (someone typing, a recording, media playing, a live status) may loop, on `--sg-motion-duration-loop`. A loop shows activity, never draws attention to static content, and stands still under reduced motion.
- **V5. Large panels.** A drawer or another panel wider than about 20rem may move for up to 320ms, on `--sg-motion-duration-panel`.
- **V6. Chart libraries.** Any chart may come from a third-party library instead of `Stingray.chart()`'s own drawing, whenever the designer prefers it: a form Stingray does not draw, or a look Stingray's charts do not give. It is drawn inside the Stingray frame with `type: 'custom'` and colored from `Stingray.chartTheme()` (section 8.20). The library is vendored (X3) and listed in the product's notices.

Anything else that departs from a Default is an exception, recorded in the product's `DESIGN-EXCEPTIONS.md` (section 13).

## 3. Layout and spacing

### The page

A page opens with a page header (section 8.52). Work that moves between a list and one item, like an inbox or settings, is a split view (section 8.53). The layout around the page (a bar, the navigation, the main column) is the product's own CSS under its own prefix (section 13), built with Stingray parts such as `sg-nav`, `sg-drawer` and `sg-menu`.

- Page padding is 24px (`--sg-space-6`), and 16px (`--sg-space-4`) at 40rem or narrower.
- At 100rem (1600px) and up the content stops growing; extra width becomes margin, so lines and tables stay readable.
- At 40rem or narrower the page is one column. Tables scroll inside their own frame; nothing else scrolls sideways.

Scrollbars are styled by Stingray on every scrolling area inside `.sg` and on the page: an 8px rounded thumb in the control gray (3:1) on a clear track, thin in Firefox. Do not restyle them per component.

Media queries MUST use these widths in rem: 40rem, 60rem, 80rem and 100rem.

### Spacing between parts

Use the layout helpers for these gaps; they already hold the right token.

| Between | Gap | Write |
|---|---|---|
| Label and control, control and help text | 4px | inside `sg-field` (automatic) |
| Breadcrumb, page title and page facts | 4px | inside `sg-page-header` (automatic) |
| Fields in a form | 16px | `sg-stack` |
| Toolbar, filter chips, table and pagination in one task area | 16px | `sg-stack` |
| Groups of fields, or regions of one section (stat strip, chart, table) | 24px | `sg-stack sg-stack--group` |
| Page sections that each have a heading | 32px | `sg-stack sg-stack--section` |
| Buttons side by side | 8px; 12px in a toolbar | `sg-cluster`, a dialog or drawer footer; `sg-toolbar` |
| Icon and its label | 8px (4px dense, 12px relaxed) | automatic inside components |
| Inside a panel | 16px padding | `sg-panel` (automatic) |
| Inside a dialog | 24px padding | automatic |
| Page padding | 24px, 16px at 40rem or narrower | your layout, with `--sg-space-6` and `--sg-space-4` |
| Cards in a grid | 16px | `sg-cards` (automatic) |
| Messages in a thread | 16px | `sg-thread` (automatic) |

The largest routine gap is 32px, between sections; 48 and 64px are for rare page-level offsets. More separation is a heading, a hairline or a new page, never more space.

### Density

Density sets row height, control height, text size, line height, cell padding, icon size and icon gap together. Set `data-density` on `<html>` or on any container; nested areas may differ. Standard is the default.

| | Dense | Standard | Relaxed |
|---|---|---|---|
| Controls (button, input, select, tab, menu item, nav item) | 28px | 36px | 44px |
| Table and key-value rows | 28px | 36px | 48px |
| Control and table text | 12/16 | 14/20 | 16/24 |
| Table cell padding (inline) | 8px | 12px | 16px |
| Icons in controls | 16px | 20px | 20px |
| Icon to label gap | 4px | 8px | 12px |
| Use for | Keyboard-driven queues, registries, audit logs | Everything else | Touch, long sessions, people who want more room |

Any table over 25 rows SHOULD offer all three densities. `sg-button--small` (28px) and `sg-button--large` (44px) keep their height in every density.

## 4. Typography

| Style | Class | Size / line / weight | Use for |
|---|---|---|---|
| hero | `sg-type-hero` | 48 / 56 / 400, tight | The one headline number of a view. At most one per view. |
| display | `sg-type-display` | 40 / 48 / 400, tight | Report and cover titles. |
| heading-1 | `sg-type-heading-1` | 32 / 40 / 400, tight | The page title, the `<h1>`. Also stat values. |
| heading-2 | `sg-type-heading-2` | 24 / 32 / 400, snug | Section headings, `<h2>`. |
| heading-3 | `sg-type-heading-3` | 20 / 28 / 600 | Headings inside a section, `<h3>`; drawer titles. |
| heading-4 | `sg-type-heading-4` | 16 / 24 / 600 | Panel titles (`sg-panel__title`), dialog titles, empty-state titles. |
| body-large | `sg-type-body-large` | 16 / 24 / 400 | Long-form reading (`sg-prose`). |
| body | `sg-type-body` | 14 / 20 / 400 | All UI text; the default of `.sg`. |
| body-strong | `sg-type-body-strong` | 14 / 20 / 600 | Field labels and emphasis. |
| label | `sg-type-label` | 12 / 16 / 600 | Table headers, tags, group headings, eyebrows. |
| caption | `sg-type-caption` | 12 / 16 / 400 | Help text, timestamps, provenance, meta. |

Headings 24px and up are regular weight with negative tracking (tight is -0.02em, snug -0.01em, applied by the class); size carries their rank. Headings under 24px are semibold, because at those sizes weight is what tells a heading from body text. Heading classes balance their lines, and body classes avoid a lone last word (`text-wrap: balance` and `pretty`).

- Heading levels follow the document outline; the class sets the look. An `<h2>` that should look like a panel title is `<h2 class="sg-panel__title">`. Never skip a heading level for looks.
- Numbers: tabular figures (`sg-num`) in columns and identifiers; proportional figures for big standalone numbers (stat values, hero). Units go in the column header ("Fee (BRL)"), not in every cell.

| Thing | Format | Never |
|---|---|---|
| Date | 28 Sep 2026 | 09/28/26, 28/09/2026 |
| Time | 14:02 UTC (24-hour, zone named) | 2:02pm |
| Date and time | 28 Sep 2026, 14:02 UTC | |
| Export or API value | 2026-09-28T14:02:00Z | |
| Range | 1–24 of 214 (en dash, "of" names the total) | 1-24/214 |
| Identifier | CR-20418, in `sg-num`, never wrapped | an image of an ID |
| Change | "Up 6.2% on August" | "+6.2%" alone |
| Negative | −45.00 (U+2212) | -45.00 |

## 5. Color

### Surfaces and what sits on them

| Surface | Token | Holds |
|---|---|---|
| Canvas | `--sg-color-surface-page` | The page. The shell's navigation and main area. |
| Sunken | `--sg-color-surface-sunken` | A tray one step below the page that holds raised surfaces, like a demo frame. Never a second page color. |
| Raised | `--sg-color-surface-raised` | Panels, table frames, charts, stat strips, the top bar, secondary buttons. One level only. |
| Overlay | `--sg-color-surface-overlay` | Menus, dialogs, drawers, toasts, the combobox list, the palette, the bulk bar. |
| Subtle | `--sg-color-surface-subtle` | Bands inside a raised surface: table headers, dialog footers. |
| Inset | `--sg-color-surface-inset` | Recessed wells: the segmented track, the dialog impact list, the toast stub. |
| Inverse | `--sg-color-surface-inverse` | Tooltips and the classification banner. |
| Field | `--sg-color-surface-field` | Inputs, selects, checkboxes, the upload zone. |
| Current | `--sg-color-surface-current` | The brand tint: the current page, tab and step, the selected row or item (C3), and your own outgoing messages. |
| Brand | `--sg-color-surface-brand` with `--sg-color-text-on-brand` | A small brand fill that asks to be looked at: the strong count. |
| Selected | `--sg-color-surface-selected` | A quiet gray: the active combobox and palette option, tags. |
| Overlay hover, pressed | `--sg-color-surface-overlay-hover`, `--sg-color-surface-overlay-pressed` | Menu items under the pointer or keyboard focus, and while pressed: clear steps above the overlay in both themes. |
| Item hover | `--sg-color-surface-item-hover`, `--sg-color-surface-item-pressed` | Hover and press on borderless items: tertiary buttons, navigation, pagination. One clear gray step in both themes. |
| Hover | `--sg-color-surface-hover` | Items under the pointer on a raised surface. |
| Pressed | `--sg-color-surface-pressed` | Items while pressed; the neutral count. |

Text roles: `--sg-color-text-primary` for body text and values, `--sg-color-text-secondary` for labels and legends, `--sg-color-text-tertiary` for help, time and meta, `--sg-color-text-disabled`, `--sg-color-text-inverse` on inverse surfaces, `--sg-color-text-link` and `--sg-color-text-link-hover` for links. Borders: `--sg-color-border-subtle` for hairlines inside surfaces, `--sg-color-border-default` for outlines of panels and menus, `--sg-color-border-control` for input boundaries (3:1), `--sg-color-border-control-hover`, `--sg-color-border-current` for the brand bar beside the current or selected item, `--sg-color-border-strong` for the side navigation's current marker and ink marks of what is done, `--sg-color-border-disabled`. Supporting icons use `--sg-color-icon-secondary`.

**Dark mode is deep with large lifts.** The dark canvas is `#151515`. Large containers (panels, tables, split panes) sit just above it at `#1c1c1c` with a hairline, so big areas stay calm; what people work with steps well above it: fields `#2c2c2c`, menus and hover `#333333`, selections `#383838` and the brand tint. Hairlines are a translucent white, so the same line reads on a panel, a field, a menu and a dialog. Solid fills (primary, danger, solid badges) keep 3:1 against the page; on panels and menus their label identifies them (WCAG 1.4.11). Chart marks and unlabelled shapes keep 3:1 on every surface.

**Avatar gradients.** Avatars take one of ten bright three-colour gradients (`--sg-color-avatar-1-from`, `-via` and `-to`, to `-10-`): a light base with two vivid blooms, and ink initials (`--sg-color-avatar-text`), the same in light and dark, every stop at 7:1 with the initials. A fine rim (`--sg-color-avatar-rim`) keeps the edge where a gradient fades to white. A gradient tells people apart and means nothing; it is never a status.

### Status vocabulary

| Class | Glyph | Meaning | Who acts next | Hue |
|---|---|---|---|---|
| `sg-status--open` | empty ring | Nothing has started | You | blue |
| `sg-status--progress` | ring with a play mark | Moving, and yours | You | blue |
| `sg-status--pending` | clock | Waiting on someone else | Someone else | gray |
| `sg-status--resolved` | filled circle with a check | Done | Nobody | green |
| `sg-status--closed` | archive box | Filed | Nobody | gray |
| `sg-status--risk` | filled triangle | Time is short | You, urgently | amber |
| `sg-status--breach` | filled octagon | Time has run out | You, now | red |
| `sg-status--info`, `sg-status--success`, `sg-status--warning`, `sg-status--error` | circle, check, triangle, octagon | Generic feedback states | | blue, green, amber, red |

The shapes are fixed: a circle means open or done, a triangle means at risk, an octagon means breached or error. A product-specific status maps to one of these meanings and keeps its own word: "Awaiting signature" is `sg-status--pending`.

### Charts

Charts use `Stingray.chart()`, which applies the chart palette. Each color does one job: categorical (identity; at most four series in one chart), ordinal (ranked stages), sequential (magnitude, one hue), diverging (blue and orange around a baseline, never red) or status (the feedback colors, with a glyph and a label). The default is emphasis: one blue series against gray context. More than four series fold into "Other", become small multiples, or become a table.

## 6. Icons

- Icons are MingCute masks: `<span class="sg-icon sg-icon--{name}" aria-hidden="true"></span>`. They take the text color (`currentColor`).
- Sizes: the default follows density (16, 20 or 20px); `sg-icon--small` is 16px, `sg-icon--medium` 20px, `sg-icon--large` 24px. No other sizes.
- `-line` icons are for actions and navigation; `-fill` icons are for status only.
- An icon never carries meaning alone: it sits beside a word, or its control has an `aria-label` and a `data-sg-tip`.
- Chevrons and arrows (`left-line`, `right-line`, `arrow-left-line`, `arrow-right-line`) flip in right-to-left text automatically.
- Only the vendored subset exists. Any other name renders nothing:

`search-line close-line menu-line more-1-line more-2-line up-line down-line left-line right-line arrow-up-line arrow-down-line arrow-left-line arrow-right-line external-link-line link-line home-3-line layout-left-line grid-line sun-line moon-line settings-3-line filter-2-line add-line check-line edit-2-line delete-2-line copy-2-line save-line download-2-line upload-2-line print-line share-2-line refresh-2-line sort-ascending-line sort-descending-line transfer-vertical-line eye-line eye-close-line loading-line check-circle-fill information-fill alert-fill alert-octagon-fill close-circle-fill round-line play-circle-line time-line archive-line pause-circle-line check-circle-line information-line alert-line alert-octagon-line lock-line unlock-line key-2-line shield-line safety-certificate-line fingerprint-line government-line idcard-line certificate-line safe-lock-line user-3-line group-line user-search-line ticket-line headphone-line mail-line chat-1-line phone-line calendar-line folder-line file-line document-line inbox-line history-line notification-line flag-1-line bookmark-line tag-line building-2-line server-line computer-line cloud-line wifi-line bug-line terminal-box-line code-line keyboard-line command-line storage-line chart-bar-line chart-line-line chart-pie-line dashboard-line list-check-line task-line report-line clipboard-line trending-up-line trending-down-line stopwatch-line book-2-line scale-line layers-line palette-line font-line ruler-line components-line target-line`

- To add one: put its MingCute name in `tools/icons.txt` and run `node tools/build.mjs --icons`. Never inline an SVG or use another icon set.

## 7. States

State is set with native attributes and ARIA; the CSS reads them. Never add a class for a state.

| State | Set with | Looks like |
|---|---|---|
| Disabled input | `disabled` | Subtle fill, disabled border and text |
| Disabled button, menu item, page link | `aria-disabled="true"` (keeps focus, so people can learn why) or `disabled` | Gray fill and text; a tertiary button stays flat |
| Read-only input | `readonly` | Subtle fill |
| Invalid input | `aria-invalid="true"`, plus a `sg-field__error` in `aria-describedby` | Doubled red border, glyph and message |
| Busy button | `aria-busy="true"` and a `sg-loader` first, or `Stingray.busy()` | The ring turns; clicks and keys are blocked |
| Selected row, tab, tree item | `aria-selected="true"` | The brand tint and a brand bar, or the tab's brand bar |
| Checked | `checked` | Blue box with a white mark |
| Current page, current step | `aria-current="page"`, `aria-current="step"` | In the side navigation a raised pill with an ink bar and semibold text; in pagination the brand tint and bar; the current step is a tinted marker with a brand ring |
| Expanded branch | `aria-expanded="true"` | Chevron turned |
| Meter state | `data-state="risk"` or `"breach"` | Amber or red fill |
| Progress result | `data-state="done"` or `"error"` on `sg-progress` | Green or red fill |
| Severity | `data-level="1"` to `"4"` | One to four bars |
| Loading table | `aria-busy="true"` on the table frame | Skeleton rows |
| Selected list row | `aria-current="true"` or `aria-selected="true"` on `sg-list__item` | The brand tint and a brand bar |
| Unread list row | `data-unread` on `sg-list__item` | Semibold title, preview in ink, a strong count |
| Avatar gradient | `data-color="1"` to `"10"` on `sg-avatar`, set by the script from the initials, or `"neutral"` | One of ten bright gradients with ink initials, the same in both themes, or flat gray |
| Narrow split view | `data-show="main"` on `sg-split`, set by `data-sg-split-show` | The main pane in place of the list |
| Presence | `data-presence="online"`, `"away"`, `"busy"` or `"offline"` on `sg-avatar` | A glyph on the avatar's corner |

The `is-hover`, `is-active`, `is-focus` and `is-selected` classes exist only to illustrate states in documentation. MUST NOT use them in a product.

**Loading and live data.**

- A first load shows skeleton rows shaped like the content, and only after 300ms. A refresh keeps the old data, says Updating in the provenance line and tints the cells that changed (`data-sg-changed`).
- An action the server almost always accepts shows its result at once. If the server refuses, put it back and say why in an error toast.
- A reversible action happens at once, with Undo in a toast (Ctrl+Z works too). Never ask first in a dialog.
- A save, send or create uses `Stingray.busy()`, so a second press does nothing, and sends an `Idempotency-Key` header, so a retry never makes a second copy. When it is done, a check shows for 600ms before the panel closes.

## 8. Components

Each entry gives what it is for, the exact classes, its measurements, the markup to copy, its behavior and its rules. Change the text, IDs and values in the markup; keep the structure, classes and ARIA.

### Actions and inputs

#### 8.1 Button

For an action that changes something. A link is for going somewhere.

- **Classes:** `sg-button`. Variants: `sg-button--primary` (the next step, blue fill, one per view); no modifier (secondary: raised fill, 1px default border, no shadow); `sg-button--tertiary` (transparent, link-colored label; cancel and low-emphasis actions); `sg-button--danger` (red fill, destructive or irreversible only). Sizes: `sg-button--small` (28px fixed), `sg-button--large` (44px fixed). `sg-button--icon`: square, icon only.
- **Measurements:** height = control height (28/36/44 by density); inline padding 12px (8px on the side of a leading icon); icon-to-label gap = density gap; radius 4px; 1px border; label 600 at the density text size. Small: 16px icon, 4px gap. Icon-only: as wide as it is tall.
- **States:** primary and danger fills darken on hover and again when pressed. The secondary button keeps its white fill in the light theme: hover darkens only its border (to the 3:1 control color) and pressing steps its fill one gray; in the dark theme its fill also steps lighter on hover. No button has a shadow. A tertiary button steps to a clear gray fill on hover (`--sg-color-surface-item-hover`) and one step darker when pressed, in both themes, and its label turns to the link-hover color. MUST NOT add a hover fill to a secondary button.

```html
<button class="sg-button sg-button--primary" type="button"><span class="sg-icon sg-icon--check-line" aria-hidden="true"></span>Approve record</button>
<button class="sg-button" type="button">Request changes</button>
<button class="sg-button sg-button--tertiary" type="button">Cancel</button>
<button class="sg-button sg-button--danger" type="button">Delete 3 records</button>
<button class="sg-button sg-button--icon" type="button" aria-label="More actions" data-sg-tip="More actions"><span class="sg-icon sg-icon--more-1-line" aria-hidden="true"></span></button>
<button class="sg-button sg-button--primary" type="button" aria-busy="true"><span class="sg-loader" aria-hidden="true"></span>Saving</button>
```

- MUST name the result as a verb and an object in sentence case: "Approve record", "Delete 3 records". Never "OK", "Yes" or "Submit".
- MUST confirm a danger button's action in a dialog.
- Icons go before the label, never after.
- SHOULD NOT disable a button to hide a problem: leave it enabled and explain on press, or use `aria-disabled="true"` so it stays focusable.
- An `<a>` MAY carry `sg-button` classes only when it navigates or downloads.
- **Busy:** `await Stingray.busy(button, save, { busy: 'Saving', done: 'Saved' })` blocks the button until `save` settles. After 300ms it shows the loader and the busy label; when done, a check and the done label for 600ms. The labels share one cell, so the width never changes. Close the panel after it resolves.
- **Split button:** `sg-button-group` joins an action to the icon button that opens a `sg-menu` of its variants. The two join with square inner corners and are the same variant: outlined buttons share the border between them, and filled ones are 1px apart. Give the icon button an `aria-label`.

```html
<div class="sg-button-group">
  <button class="sg-button sg-button--primary" type="button">Send reply</button>
  <button class="sg-button sg-button--primary sg-button--icon" type="button" popovertarget="mn-send" aria-label="More ways to send"><span class="sg-icon sg-icon--down-line" aria-hidden="true"></span></button>
</div>
<div id="mn-send" popover class="sg-menu" aria-label="Send and set the status">
  <button class="sg-menu__item" role="menuitem">Send and set to Pending</button>
  <button class="sg-menu__item" role="menuitem">Send and resolve</button>
</div>
```

#### 8.2 Link

- **Classes:** a plain `<a>` inside `.sg` is styled; `sg-link` styles a link that carries other classes or sits outside running text.
- **Measurements:** link color, a 1px underline 4px below the text; hover darkens it and thickens the underline to 2px.

```html
<a href="/policy">retention policy</a>
<a class="sg-link" href="https://example.gov" rel="noopener">Registry law<span class="sg-icon sg-icon--external-link-line sg-icon--small" aria-hidden="true"></span></a>
```

- MUST keep the underline, and use text that makes sense alone, never "click here". Use `external-link-line` for anything that leaves the product. There is no visited style.

#### 8.3 Field, text input and textarea

- **Classes:** `sg-field` (a column with 4px gaps), `sg-field__label` (14/20, 600), `sg-field__help` (12/16, tertiary), `sg-field__error` (12/16, 600, error text with a 16px octagon 8px from it), `sg-input` on `<input>` and `<textarea>`.
- **Measurements:** input height = control height; inline padding 12px; a light 1px border (`--sg-input-border`), the same on all four sides; radius 4px; field surface. Hover steps the border to the 3:1 control edge; focus draws an ink border and the ring; `aria-invalid="true"` doubles the border in red. Textarea: 8px block padding, at least 96px tall, resizes vertically only.

```html
<div class="sg-field">
  <label class="sg-field__label" for="f-name">Full name</label>
  <span class="sg-field__help" id="f-name-h">As it appears on the identity document.</span>
  <input class="sg-input" id="f-name" type="text" autocomplete="name" aria-describedby="f-name-h">
</div>

<div class="sg-field">
  <label class="sg-field__label" for="f-phone">Phone</label>
  <input class="sg-input" id="f-phone" type="tel" autocomplete="tel" aria-invalid="true" aria-describedby="f-phone-e">
  <span class="sg-field__error" id="f-phone-e"><span class="sg-icon sg-icon--alert-octagon-fill" aria-hidden="true"></span>Enter digits only after the prefix.</span>
</div>

<div class="sg-field">
  <label class="sg-field__label" for="f-reply">Reply to requester</label>
  <textarea class="sg-input" id="f-reply" rows="3"></textarea>
</div>
```

- MUST put a visible label above every input. Mark optional fields "(optional)"; never use a red asterisk.
- MUST use the right `type` and `autocomplete`, so autofill and mobile keyboards work.
- A one-time code is one field: `sg-input--code` with `autocomplete="one-time-code"` and `inputmode="numeric"`, so the phone offers the code it received. Never one box per digit.
- Width SHOULD match the expected length (S5).
- Validate on blur or submit, never on every keystroke. The error says what to do, never only "Invalid". With several errors on submit, move focus to an error banner that links to each field.
- MUST NOT use placeholder text as a label, or a field with only a bottom border.

#### 8.4 Input with an icon

- **Classes:** `sg-input-group`, `sg-input-group__icon`. The icon sits 12px from the start, and the text starts after it.

```html
<div class="sg-field">
  <label class="sg-field__label" for="q">Search records</label>
  <div class="sg-input-group">
    <span class="sg-input-group__icon sg-icon sg-icon--search-line" aria-hidden="true"></span>
    <input class="sg-input" id="q" type="search" data-sg-filter="#records">
  </div>
</div>
```

`data-sg-filter="#tableId"` makes the input a type-ahead filter for that table; `/` focuses it from anywhere on the page, and Escape clears it.

#### 8.5 Select

For one choice from about 4 to 15 options: a native `<select>` in a wrapper that draws the chevron.

```html
<div class="sg-field">
  <label class="sg-field__label" for="f-type">Request type</label>
  <div class="sg-select"><select class="sg-input" id="f-type"><option>Birth certificate</option><option>Marriage record</option></select></div>
</div>
```

- Fewer than 4 options: radios. More than about 15: a combobox. Order options as people expect, not alphabetically, when a natural order exists.

#### 8.6 Combobox

For one choice from more than about 15 options: a text field that filters a list as the person types.

- **Classes:** `sg-combobox` (with `data-sg-combobox`), `sg-combobox__list`, `sg-combobox__option`, `sg-combobox__meta`, `sg-combobox__footer`, `sg-combobox__count`; the script adds `sg-combobox__lead` and `sg-match`.
- **Measurements:** the field is a `sg-input` with a chevron. The list floats 4px below it at the same width (above, if there is no room), up to 16rem tall, with 4px padding, an 8px radius, the overlay surface and shadow. Options are at the control height, with 12px inline padding, 8px gaps and a 4px radius; a person's option starts with a 24px avatar. The active option is highlighted like a menu item (section 8.38): the gray step, a 1px edge one step further and the 2px brand bar. The chosen one is semibold with a 16px brand check. Groups (`role="group"` with `aria-label`) are labelled in 12/16 semibold tertiary text and hide when filtering leaves them empty. The chevron turns while the list is open.
- **Footer:** an optional `sg-combobox__footer`, last in the list and `aria-hidden="true"`: caption tertiary text on the subtle fill with a hairline above, 8px block and 12px inline padding, held at the bottom while the list scrolls. It holds `sg-combobox__count`, which the script fills from its `data-template` ("{n} people"; "{n} options" by default), and the keys.

```html
<div class="sg-field">
  <label class="sg-field__label" for="cb-agent">Assign to</label>
  <div class="sg-combobox" data-sg-combobox>
    <input class="sg-input" id="cb-agent" type="text" role="combobox" aria-controls="cb-agent-list" aria-autocomplete="list" autocomplete="off">
    <input type="hidden" name="agent">
    <div class="sg-combobox__list" id="cb-agent-list" role="listbox" aria-label="Agents" data-empty="No agent matches">
      <div role="group" aria-label="Suggested">
        <div class="sg-combobox__option" role="option" data-value="asouza"><span class="sg-avatar" aria-hidden="true">AS</span>Ana Souza<span class="sg-combobox__meta">Service desk</span></div>
      </div>
      <div role="group" aria-label="Everyone">
        <div class="sg-combobox__option" role="option" data-value="cmelo"><span class="sg-avatar" aria-hidden="true">CM</span>Carla Melo<span class="sg-combobox__meta">Access</span></div>
      </div>
      <div class="sg-combobox__footer" aria-hidden="true"><span class="sg-combobox__count" data-template="{n} people">6 people</span><span class="sg-cluster sg-cluster--tight"><kbd class="sg-kbd">↑</kbd><kbd class="sg-kbd">↓</kbd>move<kbd class="sg-kbd">Enter</kbd>pick</span></div>
    </div>
  </div>
</div>
```

- **Behavior:** typing filters and opens the list; Down opens it and moves; Up moves; Enter picks; Escape closes the list, then clears the field, and never closes an enclosing dialog while the list is open. Focus stays in the field. The number of results is announced. A pick fills the hidden input with `data-value` and fires `sg:change` with `{ value, label, option }`; when the option has an avatar, a copy (`sg-combobox__lead`) sits at the start of the field. Editing the text again clears the hidden value and the avatar. While the person types, the script wraps each option's own text in `sg-match` and the matching letters in a `<mark>` inside it: semibold, with a 2px underline in the brand color. Accents and case are ignored, as in the filter.
- Use `sg-combobox__meta` for a second fact when names repeat, and a group for the likely few, such as the people already on the ticket. MUST NOT open the list on focus alone.

#### 8.7 Date and date range

- **Date:** a native `<input class="sg-input" type="date">`. The browser supplies the calendar, typed entry and the display order; the value is always `YYYY-MM-DD`. Stingray draws the calendar glyph and tabular figures.
- **Range classes:** `sg-date-range` (a `<fieldset>` with `data-sg-date-range`), `sg-date-range__fields` (8px gaps; each input grows from 10rem), `sg-date-range__sep`, `sg-date-range__presets` (8px above, 4px gaps).

```html
<div class="sg-field">
  <label class="sg-field__label" for="dt-birth">Date of birth</label>
  <input class="sg-input" id="dt-birth" type="date" autocomplete="bday">
</div>

<fieldset class="sg-date-range" data-sg-date-range>
  <legend class="sg-field__label">Submitted</legend>
  <div class="sg-date-range__fields">
    <input class="sg-input" type="date" aria-label="From">
    <span class="sg-date-range__sep" aria-hidden="true">to</span>
    <input class="sg-input" type="date" aria-label="To">
  </div>
  <div class="sg-date-range__presets">
    <button class="sg-button sg-button--tertiary sg-button--small" type="button" data-sg-range="1">Today</button>
    <button class="sg-button sg-button--tertiary sg-button--small" type="button" data-sg-range="7">Last 7 days</button>
    <button class="sg-button sg-button--tertiary sg-button--small" type="button" data-sg-range="30">Last 30 days</button>
    <button class="sg-button sg-button--tertiary sg-button--small" type="button" data-sg-range="month">This month</button>
  </div>
</fieldset>
```

- **Behavior:** the end date can never fall before the start. `data-sg-range` is a number of days counting today, or `month`. Changes fire `sg:rangechange` with `{ from, to }`.
- MUST use `type="date"` for every date a person enters. MUST NOT build a calendar widget or use three selects.

#### 8.8 Checkbox and radio

- **Classes:** `sg-choice` (the label row, at least 24px tall), `sg-choice__input`, `sg-choice__label`.
- **Measurements:** a 16px box with a 1px control border and a 3px radius (round for a radio); checked is blue with a white mark; the gap to the label follows density.

```html
<fieldset class="sg-stack sg-stack--related">
  <legend class="sg-field__label">Notify me about</legend>
  <label class="sg-choice"><input class="sg-choice__input" type="checkbox" checked><span class="sg-choice__label">New tickets</span></label>
  <label class="sg-choice"><input class="sg-choice__input" type="checkbox"><span class="sg-choice__label">Escalations</span></label>
</fieldset>

<fieldset class="sg-stack sg-stack--related">
  <legend class="sg-field__label">Delivery</legend>
  <label class="sg-choice"><input class="sg-choice__input" type="radio" name="delivery" checked><span class="sg-choice__label">Email</span></label>
  <label class="sg-choice"><input class="sg-choice__input" type="radio" name="delivery"><span class="sg-choice__label">Post</span></label>
</fieldset>
```

- MUST wrap every group in `<fieldset>` and `<legend>`. Radios are for up to seven choices; more is a select. Set the indeterminate state in script: `input.indeterminate = true`.
- MUST NOT use a checkbox for something that takes effect at once (use a switch), or pre-check a consent box.

#### 8.9 Switch

For a setting that takes effect immediately.

- **Classes:** `sg-switch` (the label row, at least 24px tall), `sg-switch__input` with `role="switch"`.
- **Measurements:** a 32 × 20px round track and a 12px thumb; on is a blue track with a white thumb.

```html
<label class="sg-switch"><input class="sg-switch__input" type="checkbox" role="switch" checked><span>Auto-assign tickets: On</span></label>
```

- The label states the current value. MUST NOT use a switch in a form with a Save button; use a checkbox there.
- Held, the thumb stretches toward where it will go. While haptics are on (section 10), the script adds the `switch` attribute, so Safari on iPhone plays its own haptic.

#### 8.10 Segmented control

For two to five mutually exclusive views or ranges of the same data, on one line.

- **Classes:** `sg-segmented` (a `<fieldset>`), `sg-segmented__item` (a `<label>`), `sg-segmented__input` (a radio).
- **Measurements:** an inset track, as tall as a control, with 2px padding and gaps, a 1px subtle border and a 6px radius. Segments have 12px inline padding and a 4px radius. The selected segment is raised, with a 1px control border, a faint shadow and a semibold label.

```html
<fieldset class="sg-segmented">
  <legend class="sg-sr-only">Period</legend>
  <label class="sg-segmented__item" data-text="Week"><input class="sg-segmented__input" type="radio" name="period" checked>Week</label>
  <label class="sg-segmented__item" data-text="Month"><input class="sg-segmented__input" type="radio" name="period">Month</label>
  <label class="sg-segmented__item" data-text="Quarter"><input class="sg-segmented__input" type="radio" name="period">Quarter</label>
</fieldset>
```

- `data-text` repeats the label to reserve the semibold width; the script fills it if missing. Keep labels short so it never wraps.
- `sg-segmented--fill` stretches the track to the width of its container and shares it equally between the segments, as for a filter at the top of a panel.
- MUST NOT use it to navigate between pages (use tabs or links), or with more than five segments (use a select).

#### 8.11 File upload

For attaching documents to a record.

- **Classes:** `sg-upload` (with `data-sg-upload`), `sg-upload__zone`, `sg-upload__input`, `sg-upload__icon`, `sg-upload__action`, `sg-upload__list`, and for each file `sg-upload__file`, `sg-upload__name`, `sg-upload__size`.
- **Measurements:** the zone has 24px block and 16px inline padding, a 1px dashed control border, an 8px radius and the field surface, with a centered 24px icon and text 4px apart. Dragging a file over it draws a solid ink border on the selected fill. File rows hold an icon, the name, the size and a remove button; each is at least the control height, with 4px block padding and hairlines between rows.

```html
<div class="sg-field">
  <label class="sg-field__label" for="up-docs">Supporting documents</label>
  <span class="sg-field__help" id="up-docs-h">PDF, JPG or PNG, up to 10 MB each.</span>
  <div class="sg-upload" data-sg-upload data-max-size="10000000">
    <div class="sg-upload__zone">
      <input class="sg-upload__input" id="up-docs" type="file" multiple accept=".pdf,.jpg,.jpeg,.png" aria-describedby="up-docs-h">
      <span class="sg-upload__icon sg-icon sg-icon--upload-2-line" aria-hidden="true"></span>
      <span><span class="sg-upload__action">Choose files</span> or drop them here</span>
    </div>
    <ul class="sg-upload__list" aria-label="Attached files"></ul>
  </div>
</div>
```

- **Behavior:** the native input covers the whole zone, so click, drop and keyboard all reach it. The script renders the rows. Each pick adds to the list; a file over `data-max-size` (bytes) is listed with an error and left out of the input. Removing a file moves focus to the next remove button. Changes fire `sg:fileschange` with `{ files }`; the input always holds the kept files, so a plain form submit works.
- While a file uploads, append a `sg-progress__track` (section 8.35) to its `sg-upload__file` row; if it fails, append a `sg-field__error`. Both span the row under the name.
- MUST state the same limits in the help text as in `accept` and `data-max-size`. The zone MUST keep its visible "Choose files" text.

### Data and status

#### 8.12 Table and grid

- **Classes:** `sg-table-wrap` (the raised frame: 1px subtle border, 8px radius, faint shadow; it scrolls), `sg-table`, `sg-table--two-line`; cells `sg-table__select`, `sg-table__title`, `sg-table__meta`, `sg-table__truncate`; header button `sg-table__sort`; `sg-table__toggle`, `sg-table__expand` and `sg-table__detail` for rows that open; `sg-table--pin-first`.
- **Measurements:** row height and cell padding follow density (28/36/48px rows; 8/12/16px padding), with hairlines between rows. The header is sticky, in the subtle fill, semibold, with a darker hairline under it. The select column is 28px wide. A selected row gets the brand tint and a 4px brand bar inset 4px on its leading edge. Two-line rows grow with content, 8px above and below. `sg-table__truncate` stops at 16rem with an ellipsis.

```html
<div class="sg-table-wrap">
  <table class="sg-table" id="records" data-sg-grid data-selectable>
    <caption class="sg-sr-only">Citizen records</caption>
    <thead><tr>
      <th class="sg-table__select" scope="col"><label class="sg-choice"><input class="sg-choice__input" type="checkbox" data-sg-select-all aria-label="Select all"></label></th>
      <th scope="col" aria-sort="none"><button class="sg-table__sort" type="button">Record</button></th>
      <th scope="col">Citizen</th>
      <th scope="col">Status</th>
      <th scope="col" class="sg-num-end" aria-sort="none"><button class="sg-table__sort" type="button">Fee (BRL)</button></th>
    </tr></thead>
    <tbody>
      <tr>
        <td class="sg-table__select"><label class="sg-choice"><input class="sg-choice__input" type="checkbox" data-sg-row aria-label="Select CR-20418"></label></td>
        <td class="sg-num">CR-20418</td>
        <td>Maria Lúcia Oliveira</td>
        <td><span class="sg-status sg-status--open">Open</span></td>
        <td class="sg-num-end sg-num" data-sort="45">45.00</td>
      </tr>
    </tbody>
  </table>
</div>
```

A two-line cell, on a `sg-table sg-table--two-line`: `<td><span class="sg-table__title">VPN drops every 20 minutes</span><span class="sg-table__meta">TK-5102 · Helena Prado · 13:12</span></td>`.

- **Variants:** a static table (no attributes) for reading and printing; `data-sg-grid` for work queues; `data-selectable` adds row selection for bulk actions.
- **Keyboard (grid):** Tab enters at the last active cell and leaves on the next press; arrows move; Home and End go to the row ends, and with Ctrl to the grid ends; Page Up and Page Down move ten rows; Space selects the row; Shift with Up or Down extends; Ctrl+A selects every visible row; Enter opens the record (`sg:activate` with `{ row }`), sorts on a header, or activates a control in the cell; Alt+Left and Alt+Right resize a `data-resizable` header.
- **Rows that open:** a first column of class `sg-table__toggle` holds a `sg-table__expand` button with `aria-expanded`, `aria-controls` and an `aria-label` ("Details for INC-4480"). The row after it is `<tr class="sg-table__detail" hidden>` with one cell spanning the table, on the subtle band with 12px block padding. Sorting and filtering keep the two together, and selection ignores detail rows.

```html
<tr>
  <td class="sg-table__toggle"><button class="sg-table__expand" type="button" aria-expanded="false" aria-controls="t-4480" aria-label="Details for INC-4480"></button></td>
  <td>INC-4480 · Payroll portal rejects valid credentials</td><td>Otávio Campos</td>
</tr>
<tr class="sg-table__detail" id="t-4480" hidden><td colspan="3">Started after the password policy change on Monday.</td></tr>
```

- **Column chooser:** checkboxes inside an element with `data-sg-columns="#tickets"` (usually a `sg-popover`) show and hide the columns whose header has the matching `data-col`; each checkbox's `value` is that name. One column always stays, and a `disabled` checked box marks a column that cannot be hidden. Keyboard navigation skips hidden cells.

```html
<button class="sg-button sg-button--small" type="button" popovertarget="cols"><span class="sg-icon sg-icon--columns-3-line" aria-hidden="true"></span>Columns</button>
<div id="cols" popover class="sg-popover" aria-label="Columns" data-sg-columns="#tickets">
  <div class="sg-popover__body">
    <label class="sg-choice"><input class="sg-choice__input" type="checkbox" value="requester" checked><span class="sg-choice__label">Requester</span></label>
    <label class="sg-choice"><input class="sg-choice__input" type="checkbox" value="queue" checked><span class="sg-choice__label">Queue</span></label>
  </div>
</div>
<!-- in the table: <th scope="col" data-col="requester">Requester</th> -->
```

- **Column resize:** `data-resizable` on a `<th>` adds a handle on its trailing edge: drag it, or press Alt+Left or Alt+Right on the header cell (16px a press, 48px at least). After the first resize the table keeps exact column widths and cuts long cells with an ellipsis.
- **Pinned first column:** `sg-table--pin-first` keeps the first column in view while the table scrolls sideways; when the first column is the select or the toggle column, the one after it stays too.
- **Events:** `sg:selectionchange` `{ count }`, `sg:sort` `{ column, direction }`, `sg:filter` `{ visible, total }`, `sg:rowtoggle` `{ row, open }`, `sg:columnschange` `{ hidden }`, `sg:columnresize` `{ column, width }`.
- `data-sort` holds the raw value when the cell text is formatted. `data-sg-count-for="#records"` and `data-sg-selection-for="#records"` on any element show "{n} of {total}" and "{n} selected"; `data-template` changes the words.
- MUST name every table with a `<caption>` (it may be `sg-sr-only`) or an `aria-label`. Right-align numbers in tabular figures, with the unit in the header. Paginate work queues with stable page sizes.
- MUST NOT add zebra stripes, row hover, vertical rules, column reordering, or infinite scroll on a work queue.

#### 8.13 Bulk action bar

While rows of a grid are selected, a bar under the table shows how many and what can be done to all of them.

- **Classes:** `sg-bulkbar` (with `data-sg-bulk-for="#tableId"`), `sg-bulkbar__count`.
- **Measurements:** it sits 8px under the table and sticks 16px above the bottom of the window; padding 8px (16px at the start); 8px gaps; an 8px radius; the overlay surface and shadow. The count is semibold and pushes the actions to the end.

```html
<div class="sg-bulkbar" data-sg-bulk-for="#records" role="region" aria-label="Bulk actions" hidden>
  <span class="sg-bulkbar__count" data-sg-selection-for="#records" aria-live="polite"></span>
  <button class="sg-button sg-button--small" type="button"><span class="sg-icon sg-icon--user-3-line" aria-hidden="true"></span>Assign</button>
  <button class="sg-button sg-button--small" type="button"><span class="sg-icon sg-icon--check-line" aria-hidden="true"></span>Resolve</button>
  <button class="sg-button sg-button--tertiary sg-button--small" type="button" data-sg-clear-selection="#records">Clear selection</button>
</div>
```

- It works only with a table that has an `id`, `data-sg-grid` and `data-selectable`, and MUST come directly after that table's `sg-table-wrap`, never above the table. Clear selection returns focus to the grid.
- At most four actions; put the rest in a menu. Anything irreversible opens a dialog with the impact list.

#### 8.14 Filter chips

Every filter that narrows a list, shown above it.

- **Classes:** `sg-chips` (the group, with `data-sg-chips`), `sg-chip`, `sg-chip__label`, `sg-chip__key`, `sg-chip__remove`.
- **Measurements:** chips 8px apart. Each is 28px tall, with 8px start padding, a 1px default border, a 4px radius and the raised fill; the key is in secondary text. The remove button fills the chip's height (26px square, 3px radius, 16px icon).

```html
<div class="sg-chips" role="group" aria-label="Active filters" data-sg-chips="#filters-button">
  <span class="sg-chip" data-value="status:open"><span class="sg-chip__label"><span class="sg-chip__key">Status:</span>Open</span><button class="sg-chip__remove" type="button" aria-label="Remove filter: Status Open"><span class="sg-icon sg-icon--close-line" aria-hidden="true"></span></button></span>
  <span class="sg-chip" data-value="dept:registry"><span class="sg-chip__label"><span class="sg-chip__key">Department:</span>Registry</span><button class="sg-chip__remove" type="button" aria-label="Remove filter: Department Registry"><span class="sg-icon sg-icon--close-line" aria-hidden="true"></span></button></span>
  <button class="sg-button sg-button--tertiary sg-button--small" type="button" data-sg-chips-clear>Clear all</button>
</div>
```

- **Behavior:** a remove button, or Delete on a focused one, removes its chip and moves focus to the next chip; after the last, focus goes to the element named in `data-sg-chips` and the group hides. Events: `sg:chipremove` `{ value, label }` and `sg:chipsclear`.
- Each chip MUST show the field and the value ("Status: Open"). Chips show filters; they never choose them. MUST NOT color a chip.

#### 8.15 Record diff

What changed in a record, field by field.

- **Classes:** `sg-diff` on a `sg-table`, with `<del>` for the old value, `<ins>` for the new one, and `sg-diff__none` for "Empty".
- **Measurements:** rows grow with content, 8px above and below, top-aligned. The old value is struck through in secondary text; the new one is semibold ink.

```html
<div class="sg-stack sg-stack--related">
  <div class="sg-table-wrap"><table class="sg-table sg-diff">
    <caption class="sg-sr-only">Changes to CR-20418</caption>
    <thead><tr><th scope="col">Field</th><th scope="col">Before</th><th scope="col">After</th></tr></thead>
    <tbody>
      <tr><th scope="row">Surname</th><td><del>Oliveira</del></td><td><ins>Oliveira Santos</ins></td></tr>
      <tr><th scope="row">Middle name</th><td><span class="sg-diff__none">Empty</span></td><td><ins>Lúcia</ins></td></tr>
      <tr><th scope="row">Nickname</th><td><del>Malu</del></td><td><span class="sg-diff__none">Empty</span></td></tr>
    </tbody>
  </table></div>
  <p class="sg-provenance"><span>Changed by Ana Souza</span><span>28 Sep 2026, 14:02 UTC</span><span>Reason: court order 118/2026</span></p>
</div>
```

- Show only the changed fields, with the full record a link away, and always the provenance line (who, when, why). MUST NOT color added or removed values green or red, or diff characters inside names and identifiers.

#### 8.16 Status

- **Classes:** `sg-status` plus one meaning modifier (section 5). The class draws the glyph, at the control icon size, in the meaning color; the word stays in ink.

```html
<span class="sg-status sg-status--open">Open</span>
<span class="sg-status sg-status--risk">At risk</span>
```

- **Sizes:** `sg-status--small` has a 16px glyph, caption text and a 4px gap, for list rows and meta lines. `sg-status--large` has a 24px glyph, 16px text and an 8px gap, for a record's header. Without either, the glyph is the control icon size and follows the density.
- Write only the word; never add an icon. Wherever a record has a state, show its status with its word. MUST NOT color a row, a tag or text by status.

#### 8.17 Severity

An ordered level drawn as four bars (4px wide; 8, 12, 16 and 20px tall; 4px apart). Only the top two levels have hue.

```html
<span class="sg-cluster sg-cluster--tight"><span class="sg-severity" data-level="3" role="img" aria-label="Severity: High"><i></i><i></i><i></i><i></i></span> High</span>
```

- **Sizes:** `sg-severity--small` is 16px tall, with 2px bars 2px apart (4, 8, 12 and 16px), for list rows and meta lines. `sg-severity--large` is 24px tall, with 4px bars (12, 16, 20 and 24px), for a record's header. Set the word beside it in the matching text size.
- Levels: 1 Low, 2 Medium, 3 High, 4 Critical. MUST have `role="img"`, an `aria-label`, and the word beside it.

#### 8.18 Tag, avatar, count and key

- **Tag** `sg-tag`: a stable category (department, classification, type). 20px tall, 8px inline padding, no border, a 3px radius, the quiet gray fill, 12/16 semibold secondary text. Never a status, never colored.
- **Avatar** `sg-avatar`: ink initials in a 28px circle on one of ten gradients, with a fine inner rim. Each gradient is three colours (a light base and two vivid blooms, section 7), all light enough for ink initials to keep 7:1 on every stop, so it reads on a light and on a dark page and does not change with the theme. The script picks the gradient from the initials (`data-color="1"` to `"10"`), so a person keeps the same avatar everywhere; set it yourself from a person's id, or use `data-color="neutral"` for a system sender (flat gray). A photo, as an `<img>` inside, covers the gradient. The gradient tells people apart and means nothing.
- **Presence** `data-presence` on `sg-avatar`: whether a person can answer now. A 10px glyph in a 12px ring of the raised surface, 2px outside the avatar's end corner: online is a green check circle, away an amber clock, busy a red cross circle, offline a gray ring. The avatar gets `role="img"` and an `aria-label` with the name and the state. Use it for people expected to answer (agents, colleagues), never for customers.
- **Count** `sg-count`, `sg-count--strong`: a number beside a label. At least 20 × 20px, round, 4px inline padding, 12/16 semibold tabular. Neutral by default; strong (the brand fill, 7:1) for a count that asks to be looked at, such as unread messages. Exact up to 999, then "999+". Never red.
- **Key** `sg-kbd`: a keyboard key. At least 20px wide, 4px inline padding, a 1px border with a 2px bottom edge, a 3px radius, 12/16 semibold.

```html
<span class="sg-tag">Finance</span>
<span class="sg-avatar" aria-label="Ana Souza">AS</span>
<span class="sg-avatar" data-presence="away" role="img" aria-label="Ana Souza, away">AS</span>
<span class="sg-cluster sg-cluster--tight">My tickets <span class="sg-count">12</span></span>
<button class="sg-button sg-button--tertiary" type="button" aria-label="Notifications, 3 unread"><span class="sg-icon sg-icon--notification-line" aria-hidden="true"></span><span class="sg-count sg-count--strong">3</span></button>
<kbd class="sg-kbd">Esc</kbd>
```

- **Avatar group** `sg-avatar-group`: the people on one thing (watchers, participants, who else has it open). Avatars overlap by 4px, each ringed 2px in the surface behind them (`--sg-avatar-group-ring`, the raised surface by default; set it on the container for another surface). The last one, `sg-avatar sg-avatar-group__more` with `data-color="neutral"`, counts the people not shown. The group is decoration (`aria-hidden="true"`): a sentence beside it names the people, so two agents never answer one ticket unaware.

```html
<p class="sg-cluster"><span class="sg-avatar-group" aria-hidden="true"><span class="sg-avatar">BC</span><span class="sg-avatar">CM</span><span class="sg-avatar sg-avatar-group__more" data-color="neutral">+2</span></span>Bruno, Carla and 2 others are viewing this ticket</p>
```

#### 8.19 Stat strip

- **Classes:** `sg-stats` (the strip), `sg-stat`, `sg-stat--hero`, `sg-stat__label`, `sg-stat__value`, `sg-stat__delta` with `sg-stat__delta--good` or `sg-stat__delta--bad`, `sg-stat__trend`.
- **Measurements:** one raised strip with an 8px radius; cells at least 10rem wide with hairlines between them. Each cell has 16px padding and 4px gaps. The value is 32/40 semibold (48/56 for the hero). The delta is semibold with a 16px arrow 4px from the text. The trend is 28px tall.

```html
<div class="sg-stack sg-stack--related">
  <div class="sg-stats">
    <div class="sg-stat">
      <p class="sg-stat__label">Tickets resolved</p>
      <p class="sg-stat__value">1,284</p>
      <p class="sg-stat__delta sg-stat__delta--good"><span class="sg-icon sg-icon--trending-up-line sg-icon--small" aria-hidden="true"></span>Up 6.2% on August</p>
      <div class="sg-stat__trend" id="trend-resolved"></div>
    </div>
    <div class="sg-stat">
      <p class="sg-stat__label">Median response</p>
      <p class="sg-stat__value">42 min</p>
      <p class="sg-stat__delta sg-stat__delta--bad"><span class="sg-icon sg-icon--trending-up-line sg-icon--small" aria-hidden="true"></span>Up 8 min on August</p>
    </div>
  </div>
  <p class="sg-provenance"><span>Ticketing database</span><span>As of 28 Sep 2026, 14:02 UTC</span><span>n = 1,284</span></p>
</div>
<script>Stingray.spark(document.getElementById('trend-resolved'), [286, 301, 322, 298, 341]);</script>
```

- Stats sit in one strip, never a card per figure. Good and bad follow meaning, not direction: response time going up is bad. With no known direction, leave the delta neutral. Always name the comparison period. At most one hero per view, never above 48px. Every strip has a provenance line.

#### 8.20 Chart and sparkline

Charts are accessible SVG drawn by the script. MUST NOT draw charts by hand. Any chart may instead come from another library, inside the Stingray frame, when the designer prefers it (V6, "Charts from another library" below).

```html
<div id="weekly-chart"></div>
<script>
  const chart = Stingray.chart(document.getElementById('weekly-chart'), {
    type: 'bar',                        // 'bar' | 'hbar' | 'line' | 'histogram' | 'pie' | 'donut' | 'gauge' | 'heatmap' | 'custom'
    title: 'Tickets resolved per week',
    description: 'Number of tickets, September 2026.',
    categories: ['W36', 'W37', 'W38', 'W39', 'W40'],
    categoryLabel: 'Week',              // the first header of the table view
    series: [{ name: 'Resolved', data: [286, 301, 322, 298, 341] }],
    highlight: 4,                       // optional: one category in blue, the rest gray
    unit: 'tickets',
    provenance: ['Ticketing database', 'As of 28 Sep 2026, 14:02 UTC', 'n = 1,548'],
  });
  // chart.update(nextSpec); chart.loading(true); chart.setTexture(true); chart.destroy();
</script>
```

- Every chart gets a title, a description, a legend for two or more series, selective direct labels, a keyboard and hover readout, provenance and a "View as table" button. Optional: `format: (v) => string`, and `labels: 'all'` or `'none'`.
- **Readout:** pointing at a mark, or the arrow keys, opens a card beside it, on the menu surface with an 8px radius. Its header has `categoryLabel` in the mono cut over the category; each series has a row with its line key, its name and its value; a footer band holds the share of a pie or donut part or, with `total: true`, the sum of the series. Set `total` only when the series add up. On a line chart a dot marks each line at that point. A heatmap also takes `seriesLabel`, the name of its rows. The gauge has no readout: its number is printed.
- The chart draws its own raised frame. Inside a panel, drop the frame so surfaces do not nest: `host.querySelector('.sg-chart').classList.add('sg-chart--bare')`.
- Choose the form by the job: one value is a stat; magnitude across categories is a bar or horizontal bar; a trend over time is a line; ordered stages are a horizontal bar; parts of one whole are a donut or pie; one value against a range is a gauge; how values spread is a histogram; two categories crossed are a heatmap. MUST NOT use a dual axis or more than four series; past four, use "Other", small multiples or a table.
- **Pie and donut** (`type: 'pie'` or `'donut'`): `categories` and one series. Four parts at most; the rest fold into one gray part named by `other` ("Other"). The legend sits beside the plot with each part's value and share, and a donut, a thin ring about a sixth of its radius, prints the total in its middle. MUST NOT use one to compare close values (use bars) or for two parts (use a stat or the meter).
- **Gauge** (`type: 'gauge'`): one `value` on a range (`min` and `max`, 0 to 100 unless set), drawn as a 12px half-circle track with round ends, filled in the series color from the start. The number sits in the middle, over a caption: `label`, or the target when there is no label. `target` adds a 2px ink tick across the track. `change: { text, direction: 'up' | 'down', tone: 'good' | 'bad' }` adds a chip over the number with a trend glyph; the tone colors only the glyph. In a table row or a card, use the meter (section 8.21).
- **Histogram** (`type: 'histogram'`): raw `values`, which the script bins (`bins` or `binWidth` to steer), or `edges` with `counts`. `binUnit` labels the bins and `valueLabel` names what is counted. Bars sit 2px apart and the axis labels the bin edges.
- **Heatmap** (`type: 'heatmap'`): each series is a row and each category a column; `null` is an empty cell. A cell takes one of seven steps of one hue between `min` (0 unless set) and `max` (the largest value unless set), with the scale in the legend. `valueLabel` names the value in the readout. Arrow keys move by cell.
- `Stingray.spark(element, values)` draws a trend with no axes, beside a stat.

**Charts from another library (V6).** A product MAY draw any chart with a third-party library, whenever the designer prefers it to the script's own drawing: for a form the script does not draw (a scatter, a stacked area, thousands of points with zoom, a flow, a map) or for a look it does not give. The choice of library, form and mark design is the designer's. Stingray keeps the frame, the title, the description, the legend, the provenance and the table view; the library draws the marks.

```js
Stingray.chart(el, {
  type: 'custom',
  title: 'Resolution time against reopen rate',
  description: 'One dot per queue, September 2026.',
  series: [{ name: 'Queues' }],              // Stingray's legend, in the order of theme.series
  table: { head: ['Queue', 'Hours to resolve', 'Reopened (%)'], rows: [['Access', 4.2, 3.1], ['Network', 9.8, 6.4]] },
  provenance: ['Ticketing database', 'As of 28 Sep 2026, 14:02 UTC', 'n = 12 queues'],
  render(container, theme, { width }) {      // draws from scratch; returns its cleanup
    const chart = echarts.init(container, null, { width, height: 240 });
    chart.setOption({
      animationDuration: theme.duration,
      textStyle: { fontFamily: theme.font.family, fontSize: theme.font.size, color: theme.label },
      color: theme.series, legend: { show: false }, title: { show: false },
      xAxis: { axisLine: { lineStyle: { color: theme.axis } }, splitLine: { lineStyle: { color: theme.grid } } },
      yAxis: { axisLine: { show: false }, splitLine: { lineStyle: { color: theme.grid } } },
      tooltip: { backgroundColor: theme.tooltip.background, borderColor: theme.tooltip.border, textStyle: { color: theme.tooltip.text } },
      series: [{ type: 'scatter', symbolSize: 8, data: [[4.2, 3.1], [9.8, 6.4]] }],
    });
    return () => chart.dispose();
  },
});
```

- **Behavior:** `render(container, theme, { width })` runs on the first draw, on resize, and when the theme or density changes, after the function it returned last time. The container is `sg-chart__canvas`, at least 240px tall (`height` sets it), with `role="img"` named by the title and description. `table: { head, rows }` sets the table view when `categories` and `series` do not fit the data; otherwise the table is built from them. There is no Stingray readout: style the library's tooltip from `theme.tooltip`.
- **`Stingray.chartTheme(element)`** returns the chart tokens as plain values, read at that element so a `data-theme` container gets its own: `series` (the eight categorical colors, in order; the first four are the ones validated together in one chart), `context`, `ordinal` (5), `sequential` (7), `positive`, `negative`, `background`, `gap`, `grid`, `axis`, `label`, `value`, `legend`, `tooltip` (`background`, `border`, `text`, `name`), `font` (`family`, `mono`, `size` in px, `weight`, `strong`) and `duration` (ms; 0 under reduced motion).
- What still holds, because these are Required rules: every color, font and duration the library uses comes from `theme` (C1, M1), never a typed value; the chart keeps its legend, labels and table view (C6); nothing moves under reduced motion (M1); and the page stays WCAG 2.2 AA (A1). Turn off the library's own title, legend and watermark, since the frame already has them. The built-in chart defaults (the forms above, the mark specs, the four-series cap, no dual axis) are the designer's call for a library chart.
- The library MUST be vendored with the product, as a classic script beside the page or a dependency the product's build bundles, never loaded from another site (X3), and listed in the product's notices.

**Time series.** `Stingray.timeseries(element, spec)` is a monitoring chart in the manner of Grafana's time series panel, built on this path with uPlot, which Stingray vendors in `vendor/uplot/` (MIT). Load `vendor/uplot/uPlot.iife.min.js` on the pages that use it, as a classic script; Stingray needs no other stylesheet for it.

```js
Stingray.timeseries(el, {
  title: 'Response time, p95',
  description: 'Per minute, 28 Sep 2026.',
  time: [1790553600000, 1790553660000],           // milliseconds; shown in UTC
  series: [{ name: 'mail-gateway', data: [118, 121] }, { name: 'vpn-edge', data: [84, null] }],   // null is a gap
  unit: 'ms',
  format: (v) => Math.round(v).toString(),
  provenance: ['Prometheus', 'As of 28 Sep 2026, 23:59 UTC', '1,440 samples per service'],
  // height: 280 (the plot), fill: false (lines without the fading fill)
});
```

- **Look:** 1.5px lines in the categorical colors over a fill that fades from 24% of the line color to nothing at the baseline; hairline grid; the value axis from 0; time ticks in 24-hour UTC ("14:00"), the day ("28 Sep") at midnight and when ticks are days apart.
- **Readout:** a dashed hairline follows the pointer, a dot marks each line, and the Stingray readout card lists every shown series at that time under "UTC" and the full date and time.
- **Zoom:** drag across the plot to zoom the time axis; double-click or "Reset zoom" (shown while zoomed) goes back.
- **Legend:** a table under the plot with the mean, max and last value of each series, the unit in the headers. Each name is a button (`aria-pressed`): a click shows only that series and a second click shows all; Ctrl or Cmd with a click adds or removes one. One series always stays shown.
- **Access:** the plot is an image named by the title and description; the values are in "View as table", one row per timestamp. Zoom and hidden series survive a theme, density or width change. It returns the same object as `Stingray.chart()`.
- **Classes:** `sg-timeseries__plot`, `sg-timeseries__reset`, `sg-timeseries__legend`, `sg-timeseries__toggle`, drawn by the script; never write them by hand.

#### 8.21 Meter

A ratio against a limit, such as SLA time used: neutral, then amber at risk, then red when breached.

- **Classes:** `sg-meter` (4px tall, round), `sg-meter--large` (8px), `sg-meter__fill`; `data-state="risk"` or `"breach"`; the width comes from `--sg-meter-value`.

```html
<div class="sg-stack sg-stack--related">
  <p class="sg-cluster"><span class="sg-status sg-status--risk">At risk</span><span class="sg-num">00:14:00 left</span></p>
  <div class="sg-meter sg-meter--large" data-state="risk" role="meter" aria-label="SLA time used" aria-valuemin="0" aria-valuemax="100" aria-valuenow="78" style="--sg-meter-value: 78%"><span class="sg-meter__fill"></span></div>
</div>
```

- Keep `aria-valuenow` and `--sg-meter-value` in step. A countdown is never a live region; announce a change of state once (`Stingray.announce`).

#### 8.22 Timeline

A ticket's history as a feed: who did what, in order. Each event sits on a hairline rail, marked by the person who acted, or by an icon when the system did, with a small glyph for the kind of event. It reads as one sentence with the time at the end, and what was written opens below it as a card.

- **Classes:** `sg-timeline` (an `<ol>`, one per day), `sg-timeline__day`, `sg-timeline__item` (with `data-kind`), `sg-timeline__item--minor`, `sg-timeline__marker`, `sg-timeline__marker--done`, `sg-timeline__kind`, `sg-timeline__kind--reply`, `sg-timeline__kind--note`, `sg-timeline__line`, `sg-timeline__card`, `sg-timeline__card--note`, `sg-timeline__foot`, `sg-timeline__change`, `sg-timeline__group`.
- **Measurements:** the marker is a 28px avatar, or a 16px icon centered in 28px. The kind glyph is a 16px circle on the avatar's corner, 8px past its edges, with a 2px ring in the surface color. The rail is 1px, centered under the marker, and runs from 8px below it to 4px above the next event. Text starts 12px after the marker, its first line centered on it, with the time in caption size at the line's end. Events are 24px apart, minor ones 16px. A card has 12px padding, a 1px subtle border and an 8px radius. Day headings are caption size and semibold, 12px above their list and 24px below the day before.

```html
<h4 class="sg-timeline__day">Today</h4>
<ol class="sg-timeline">
  <li class="sg-timeline__item" data-kind="reply">
    <span class="sg-timeline__marker"><span class="sg-avatar" aria-hidden="true">AS</span><span class="sg-timeline__kind sg-timeline__kind--reply"><span class="sg-icon sg-icon--send-plane-line" aria-hidden="true"></span></span></span>
    <p class="sg-timeline__line"><span><b>Ana Souza</b> replied to Maria</span><time datetime="2026-09-28T14:20">14:20</time></p>
    <div class="sg-timeline__card"><p>Sign in again and it should work.</p><p class="sg-timeline__foot"><span class="sg-icon sg-icon--check-circle-line" aria-hidden="true"></span>Delivered by email</p></div>
  </li>
  <li class="sg-timeline__item" data-kind="change">
    <span class="sg-timeline__marker"><span class="sg-avatar" aria-hidden="true">AS</span><span class="sg-timeline__kind"><span class="sg-icon sg-icon--edit-2-line" aria-hidden="true"></span></span></span>
    <p class="sg-timeline__line"><span><b>Ana Souza</b> changed the status <span class="sg-timeline__change"><span class="sg-status sg-status--open">Open</span><span class="sg-icon sg-icon--arrow-right-line" role="img" aria-label="to"></span><span class="sg-status sg-status--progress">In progress</span></span></span><time datetime="2026-09-28T14:05">14:05</time></p>
  </li>
  <li class="sg-timeline__item sg-timeline__item--minor" data-kind="change">
    <span class="sg-timeline__marker"><span class="sg-icon sg-icon--robot-line" aria-hidden="true"></span></span>
    <details class="sg-timeline__group">
      <summary class="sg-timeline__line"><span><b>Automation</b> made 2 changes</span><time datetime="2026-09-28T13:51">13:51</time></summary>
      <ul>
        <li>Priority <span class="sg-timeline__change">Normal<span class="sg-icon sg-icon--arrow-right-line" role="img" aria-label="to"></span><b>High</b></span></li>
        <li>Queue <span class="sg-timeline__change">Service desk<span class="sg-icon sg-icon--arrow-right-line" role="img" aria-label="to"></span><b>Access</b></span></li>
      </ul>
    </details>
  </li>
</ol>
```

- **Markers:** an event a person made has their avatar (section 8.18) and a kind glyph: `--reply` on the brand tint for a public reply, `--note` on the note tint for an internal note, and the plain glyph for the rest, such as a change, an assignment or an email. An event the system made has an icon instead, and `sg-timeline__item--minor` makes it quieter: caption size and secondary text. `sg-timeline__marker--done` turns its icon green, for a target that was met.
- **What was written:** a reply, a note or an email opens below its sentence in `sg-timeline__card`, with `--note` for a note. Attachments go in the card as tiles (section 8.64). `sg-timeline__foot` ends a card with its delivery state.
- **Changes:** `sg-timeline__change` holds the old value, an arrow named "to", and the new value; a status shows as a `sg-status` chip. Changes one actor made at once fold into `sg-timeline__group`, a native `<details>` whose summary counts them.
- **Days and order:** one list per day, after a `sg-timeline__day` heading: "Today", "Yesterday", then the date. Times are absolute; the heading gives the day. Newest first when people act on the latest; oldest first for an audit narrative.
- **Filter:** a segmented control with `data-sg-timeline-filter`, whose value points at the element holding the days, shows one kind of event. Its radios have the value `all` or a `data-kind` value. Events of other kinds hide, and a day with nothing left hides with its heading. It fires `sg:timelinefilter` `{ kind, visible }` on that element; show an empty state when `visible` is 0. `sg-segmented--fill` gives the control the full width of the panel.
- MUST write each event as a sentence that names who did what, because the avatars, glyphs and colors are hidden from assistive technology. MUST NOT use the timeline for the steps of a process: use the stepper (section 8.44).

#### 8.23 Key-value list

The details of one record: a secondary label and a primary value per row, at the density row height, with 8px inline padding and hairlines between rows. The label column is 8 to 12rem wide.

```html
<dl class="sg-kv">
  <dt>Full name</dt><dd>Maria Lúcia Oliveira</dd>
  <dt>Citizen ID</dt><dd class="sg-num">418 220 017</dd>
  <dt>Status</dt><dd><span class="sg-status sg-status--open">Open</span></dd>
</dl>
```

- **Edit in place:** a value people change often sits in a `sg-edit` with `data-sg-edit`: a `sg-edit__view` button (the value in `sg-edit__value`, then a 16px pencil) and its control, `sg-edit__control`, which is a `sg-input` or a `sg-select` wrapper. The view is at least 24px tall with 8px inline padding and steps to the item hover fill; the control is at least 10rem wide. A press swaps to the control; Enter or leaving it saves, Escape cancels, and a pick from a select with the pointer saves at once. It fires `sg:edit` `{ name, value, previous }` before the value changes: call `preventDefault()` to refuse, and the old value stays.

```html
<dt>Assignee</dt>
<dd><span class="sg-edit" data-sg-edit data-name="assignee">
  <button class="sg-edit__view" type="button"><span class="sg-edit__value">Tomás Melo</span><span class="sg-icon sg-icon--edit-2-line" aria-hidden="true"></span></button>
  <div class="sg-select sg-edit__control"><select class="sg-input" aria-label="Assignee"><option>Ana Souza</option><option selected>Tomás Melo</option></select></div>
</span></dd>
```

#### 8.24 Provenance line

The source, the as-of time and the sample size, in one caption line (12/16, tertiary) with a middle dot between parts. It goes under every stat, chart and total, in this order.

```html
<p class="sg-provenance"><span>Ticketing database</span><span>As of 28 Sep 2026, 14:02 UTC</span><span>n = 1,284</span></p>
```

- Data older than one hour when a view opens gets a warning banner above it.
- **Updating:** while fresh data loads, keep the old figures on screen and add `<span class="sg-loader" aria-hidden="true"></span><span>Updating</span>` to the line. Mark each cell that changed with `data-sg-changed`: it is tinted for a moment, and the mark clears itself.

#### 8.25 Empty state

What is missing and one way forward: a 24px glyph, a 16/24 title, one line (at most 28rem) and one button. Centered, with 32px block and 16px inline padding and 8px gaps. No illustration.

```html
<div class="sg-empty">
  <span class="sg-empty__icon sg-icon sg-icon--search-line" aria-hidden="true"></span>
  <p class="sg-empty__title">No records match "nowak"</p>
  <p class="sg-empty__text">The filter is applied to 214 records. Clear it to see them all.</p>
  <button class="sg-button" type="button">Clear filter</button>
</div>
```

#### 8.26 Code and prose

- `sg-code`: inline code, with 4px inline padding, a 1px border and a 3px radius. `sg-code-block`: a `<pre>` with 16px padding, an 8px radius, tabs for indentation, in Atkinson Hyperlegible Mono (T1). `sg-mono` puts the same face on anything compared character by character: a hash, an address, a key. It is dark in both themes, with its own palette (`--sg-color-code-*`): light text, quieter comments, one blue for literals. Anything laid over a block, such as a copy button, sits inside a `data-theme="dark"` wrapper so it takes dark colors too.
- `sg-prose`: long-form text at 16/24, at most 70 characters a line. Blocks are 16px apart; an `<h2>` has 32px above it, an `<h3>` or `<h4>` 24px; lists are indented 24px.

```html
<p>Run <code class="sg-code">node tools/build.mjs</code>.</p>
<article class="sg-prose"><h2>Retention policy</h2><p>Records are kept for 25 years.</p></article>
```

### Containers and feedback

#### 8.27 Panel

The only static container: the raised surface, a 1px subtle border, an 8px radius, a faint shadow and 16px padding. `sg-panel--flush` removes the padding and clips its content, for a list edge to edge. `sg-panel__title` is 16/24 semibold with 8px below.

```html
<section class="sg-panel" aria-labelledby="p-citizen">
  <h2 class="sg-panel__title" id="p-citizen">Citizen</h2>
  <dl class="sg-kv">…</dl>
</section>
```

- MUST NOT nest a panel, card, table frame, chart frame or stat strip inside a panel. A chart in a panel uses `sg-chart--bare`; an accordion uses `sg-accordion--flush`.

#### 8.28 Card and card grid

One item among peers that a person browses or compares at a glance: an office, a report, a saved view (V1).

- **Classes:** `sg-cards` (the grid, on a `<ul>`), `sg-card` (on each `<li>`, or an `<article>`), `sg-card--link`, `sg-card--note` (an internal note in a thread, section 8.50), `sg-card--reply` (a quoted message, sections 8.50 and 8.62), `sg-card__media`, `sg-card__title`, `sg-card__meta`, `sg-card__body`, `sg-card__footer`.
- **Measurements:** the grid fills the row with columns at least 16rem wide, 16px apart. A card is the raised surface: a 1px subtle border, an 8px radius, the raised shadow and 16px padding, with 8px between its parts. The title is heading 4 in ink; the meta is caption text in tertiary. Media runs to the card's edges at 16:9, above the title. The body grows, so the footers of a row line up; the footer is a row with 8px gaps. A linked card darkens its border and underlines its title on hover, and draws the focus ring around the whole card.

```html
<ul class="sg-cards" aria-label="Registry offices">
  <li class="sg-card sg-card--link">
    <h3 class="sg-card__title"><a href="/offices/1">1st Registry Office</a></h3>
    <p class="sg-card__meta">Centro · 14 staff</p>
    <p class="sg-card__body">Births, marriages and deaths for the central districts.</p>
    <div class="sg-card__footer"><span class="sg-status sg-status--open">Open</span><span class="sg-toolbar__spacer"></span><button class="sg-button sg-button--tertiary sg-button--small" type="button">Queue</button></div>
  </li>
</ul>
```

- In `sg-card--link` the title's link covers the card; buttons in the footer stay separate targets. Every card in a grid has the same parts in the same order.
- MUST NOT put a card inside a panel or another card; the one exception is a note card in a thread. Use the stat strip, not a card per figure, and a table for records a person scans in bulk.

#### 8.29 Choosing feedback

| Feedback | Use when | Stays | Interrupts | Announced as |
|---|---|---|---|---|
| Field error | One input is wrong or needs explaining | Until fixed | No | The field's description |
| Banner | Something about the page or its data needs attention, and stays true | Until resolved or dismissed | No | `status`, or `alert` for errors |
| Prominent banner | An incident affecting everyone; once per page | Until the incident ends | No | `alert` |
| Toast | A routine action succeeded and can be undone | 8 seconds, paused on hover and focus | No | `status` |
| Progress bar | A job takes more than about two seconds | Until the job ends | No | `progressbar` with its value |
| Dialog | A decision that cannot be undone, or input that cannot wait | Until answered | Yes | A dialog with a title |

Escalate from field to banner to dialog. A toast is only for confirmations, never for an error that needs action.

#### 8.30 Banner

- **Classes:** `sg-banner` with `sg-banner--info`, `--success`, `--warning` or `--error`, and `sg-banner--prominent` for the solid form; parts `sg-banner__icon`, `sg-banner__body`, `sg-banner__title`, `sg-banner__actions`.
- **Measurements:** the raised surface, a 1px subtle border, an 8px radius, 16px padding (20px at the start, after a 4px status bar clipped by the corner) and a 12px gap. A 20px glyph in the status color; the title is semibold ink, the body secondary text, the actions 8px below. Prominent fills the banner (warning amber, error red) and drops the bar; it goes only with warning or error.

```html
<div class="sg-banner sg-banner--warning" role="status">
  <span class="sg-banner__icon sg-icon sg-icon--alert-fill" aria-hidden="true"></span>
  <div class="sg-banner__body">
    <p class="sg-banner__title">Data is 3 hours old</p>
    <p>The last sync finished at 11:02 UTC. Figures may be behind.</p>
    <p class="sg-banner__actions"><button class="sg-button sg-button--small" type="button">Refresh data</button></p>
  </div>
</div>
```

- Glyphs: info `information-fill`, success `check-circle-fill`, warning `alert-fill`, error `alert-octagon-fill`. Use `role="alert"` only for errors and incidents, `role="status"` otherwise.
- The title says what happened; one sentence says what it means or what to do. At most two banners stacked; one prominent banner per page. Never auto-dismiss a banner.

#### 8.31 Classification banner

A full-width ink bar stating the classification of an official view: at least 24px tall, 16px inline padding, 12/16 semibold uppercase with letter spacing, and a 16px lock glyph. It is the only uppercase text in the system and is never color-coded.

```html
<a class="sg-skip" href="#main">Skip to content</a>
<div class="sg-classification" role="region" aria-label="Classification"><span class="sg-icon sg-icon--lock-line" aria-hidden="true"></span>Official · Internal use only</div>
<header>…your product's bar…</header>
```

- On an official view it comes right after the skip link, above everything else, across the full width. Outside the header and main landmarks it MUST carry `role="region"` and `aria-label="Classification"`, so it is announced and never orphaned. It prints on every page.

#### 8.32 Toast

A transient confirmation, drawn by the script as a receipt: a 64px stub with the status glyph and the time, a dashed perforation, then what happened. The region sits 16px from the bottom-end corner and is up to 25rem wide.

```js
Stingray.toast({ title: 'CR-20418 approved', message: 'It moved to the ready queue.', status: 'success', action: { label: 'Undo', onClick: undoApproval, undo: true } });
```

- With `undo: true`, Ctrl+Z (Cmd+Z) presses the newest Undo, except in a text field.

- It returns `{ dismiss }`. Info and success dismiss after 8 seconds (`timeout` in ms overrides it; 0 keeps the toast); the timer pauses on hover and focus. Warning and error stay until closed.
- Name what changed and to which record. One toast per action; replace, never stack. MUST NOT write `sg-toast` markup by hand, or use a toast for an error that needs action.

#### 8.33 Dialog

A native `<dialog>` opened modally: the page behind is inert, Escape closes it, and focus returns to its opener.

- **Classes:** `sg-dialog` with `sg-dialog--danger`, `--warning` or `--info`; parts `sg-dialog__header`, `__emblem`, `__title`, `__body`, `__impact`, `__footer`, `__keys`.
- **Measurements:** up to 30rem wide (with 1rem to spare on each side of a small screen), an 8px radius, the overlay surface, the modal shadow and a scrim behind. Header: 24px padding (8px below), 12px gap, a 24px emblem, a 16/24 title. Body: 24px padding; with an emblem it lines up with the title. Impact list: an inset well with an 8px radius, rows of 8 × 12px padding with hairlines, identifiers semibold in tabular figures. Footer: 12 × 24px padding, the subtle fill, a hairline above, 8px gaps, the keys hint at the start.

```html
<button class="sg-button sg-button--danger" type="button" data-sg-dialog-open="#dlg-delete">Delete 3 records</button>
<dialog class="sg-dialog sg-dialog--danger" id="dlg-delete" aria-labelledby="dlg-delete-t">
  <div class="sg-dialog__header">
    <span class="sg-dialog__emblem sg-icon sg-icon--alert-octagon-fill" aria-hidden="true"></span>
    <h2 class="sg-dialog__title" id="dlg-delete-t">Delete 3 records?</h2>
    <button class="sg-button sg-button--tertiary sg-button--icon sg-button--small" type="button" aria-label="Close" data-sg-dialog-close><span class="sg-icon sg-icon--close-line" aria-hidden="true"></span></button>
  </div>
  <div class="sg-dialog__body">
    <p>They are removed from every queue. This cannot be undone.</p>
    <ul class="sg-dialog__impact">
      <li><span class="sg-num">CR-20418</span><span>Maria Lúcia Oliveira</span></li>
      <li><span class="sg-num">CR-20419</span><span>João Pedro Andrade</span></li>
    </ul>
  </div>
  <div class="sg-dialog__footer">
    <span class="sg-dialog__keys"><kbd class="sg-kbd">Esc</kbd> cancels</span>
    <button class="sg-button" type="button" data-sg-dialog-close>Cancel</button>
    <button class="sg-button sg-button--danger" type="button" data-sg-dialog-close>Delete 3 records</button>
  </div>
</dialog>
```

- Emblems: danger `alert-octagon-fill`, warning `alert-fill`, info `information-fill`.
- The title repeats the action as a question. The impact list shows exactly what changes. Buttons are named for their result, Cancel on the left and the action on the right. Enter is never the default on a destructive dialog.
- Add `data-sg-dismissible` (a click outside closes) only to informational dialogs, never with unsaved input or a destructive choice.
- MUST NOT use a dialog for a routine reversible action, nest dialogs, or open one from a timer.

#### 8.34 Drawer

A panel that slides in from the edge and keeps the page in view: record details beside a list, filters beside results, a short form. A native `<dialog>`, opened and closed with the dialog's attributes.

- **Classes:** `sg-drawer` with `sg-drawer--small` (320px), `sg-drawer--large` (640px) and `sg-drawer--start` (from the start edge); the default is 480px. Parts: `sg-drawer__header`, `__heading`, `__eyebrow`, `__title`, `__subtitle`, `__actions`, `__position`, `__sep`, `__body`, `__section-title`, `__keys`, `__footer`.
- **Measurements:** it floats 8px from the window edges, full height, with an 8px radius, the overlay surface and the modal shadow. Header: 16px padding (24px at the start, 12px at the end) and a 12px gap; the eyebrow is 12/16 semibold tertiary, the title 20/28, the subtitle 4px below in secondary text; actions are 4px apart; the separator is 1 × 16px. Body: 8px padding above and 24px on the other sides, children 24px apart; section titles 12/16 semibold tertiary with 8px below. Footer: 16 × 24px padding, 8px gaps. The header and footer hairlines appear only while the body scrolls under them.

```html
<button class="sg-button" type="button" data-sg-dialog-open="#drw-record">Open CR-20418</button>
<dialog class="sg-drawer" id="drw-record" aria-labelledby="drw-record-t" data-sg-dismissible>
  <div class="sg-drawer__header">
    <div class="sg-drawer__heading">
      <p class="sg-drawer__eyebrow">Citizen record</p>
      <h2 class="sg-drawer__title sg-num" id="drw-record-t" tabindex="-1" autofocus>CR-20418</h2>
      <p class="sg-drawer__subtitle">Marriage record, submitted 28 Sep at 08:00</p>
    </div>
    <div class="sg-drawer__actions">
      <span class="sg-drawer__position">1 of 3</span>
      <button class="sg-button sg-button--tertiary sg-button--icon sg-button--small" type="button" aria-label="Previous record" data-sg-tip="Previous record"><span class="sg-icon sg-icon--up-line" aria-hidden="true"></span></button>
      <button class="sg-button sg-button--tertiary sg-button--icon sg-button--small" type="button" aria-label="Next record" data-sg-tip="Next record"><span class="sg-icon sg-icon--down-line" aria-hidden="true"></span></button>
      <span class="sg-drawer__sep" aria-hidden="true"></span>
      <button class="sg-button sg-button--tertiary sg-button--icon sg-button--small" type="button" aria-label="Close" data-sg-dialog-close><span class="sg-icon sg-icon--close-line" aria-hidden="true"></span></button>
    </div>
  </div>
  <div class="sg-drawer__body">
    <section><h3 class="sg-drawer__section-title">Details</h3><dl class="sg-kv">…</dl></section>
    <section><h3 class="sg-drawer__section-title">Activity</h3><ol class="sg-timeline">…</ol></section>
  </div>
  <div class="sg-drawer__footer">
    <span class="sg-drawer__keys"><kbd class="sg-kbd">Esc</kbd> closes</span>
    <button class="sg-button" type="button">Request changes</button>
    <button class="sg-button sg-button--primary" type="button">Approve</button>
  </div>
</dialog>
```

- The title has `tabindex="-1"` and `autofocus`, so focus lands on it. Use start and small for filters and navigation, the default for record details, large for tables and two-column forms. Leave out `data-sg-dismissible` when the drawer holds a form.

#### 8.35 Progress bar

How far a job has got: the label names the job, and the count says how much is done.

- **Classes:** `sg-progress` (with `data-state="done"` or `"error"` at the end), `sg-progress__head`, `sg-progress__label` (semibold), `sg-progress__value` (secondary, tabular), `sg-progress__track` (4px, round, `role="progressbar"`), `sg-progress__fill` (ink). The head and the track are 8px apart.

```html
<div class="sg-progress">
  <div class="sg-progress__head"><span class="sg-progress__label" id="pg-import">Importing records</span><span class="sg-progress__value">428 of 1,200</span></div>
  <div class="sg-progress__track" role="progressbar" aria-labelledby="pg-import" aria-valuemin="0" aria-valuemax="1200" aria-valuenow="428" aria-valuetext="428 of 1,200 records" style="--sg-progress-value: 35.7%"><span class="sg-progress__fill"></span></div>
</div>
```

- Set the fill with `--sg-progress-value` (a percentage) and keep `aria-valuenow` and `aria-valuetext` in step. While the end is unknown, leave out `aria-valuenow`: a short fill travels the track (a still gray bar under reduced motion). On failure, add `data-state="error"` and a `sg-field__error` under the track.
- Prefer a count ("428 of 1,200") to a percentage. Nothing under two seconds gets a progress bar: set the button to `aria-busy="true"` instead.

#### 8.36 Skeleton

Still, neutral bars (12px tall, 3px radius) that hold the shape of rows while a table loads for the first time. The width comes from `--sg-skeleton-width`. They never pulse.

```html
<div class="sg-table-wrap" aria-busy="true">
  <table class="sg-table" aria-label="Citizen records, loading">
    <thead><tr><th scope="col">Record</th><th scope="col">Citizen</th></tr></thead>
    <tbody><tr><td><span class="sg-skeleton" style="--sg-skeleton-width: 5rem"></span></td><td><span class="sg-skeleton" style="--sg-skeleton-width: 10rem"></span></td></tr></tbody>
  </table>
</div>
<p class="sg-sr-only" role="status">Loading citizen records</p>
```

- They appear only after 300ms (`--sg-motion-wait`), so a fast load never flashes them.
- First load only. Later loads keep the old rows in place until the new ones arrive (section 8.24, Updating). Never skeleton a whole page: show the frame, and load each region in place.

#### 8.37 Loader

For waiting with no count to show: a ring that turns. The manta is the Stingray site's own page loader; products use the ring.

- **Classes:** `sg-loader`, an empty element; `sg-loader--large` for a region.
- **Measurements:** the size of an icon where it sits (16px dense, 20px otherwise, 24px as `sg-empty__icon`), or 48px large. A 2px ring (4px large) in the brand blue, or in the text color inside a button: the track at 20% and a quarter arc with round ends at full strength. One turn takes `--sg-motion-spin` (0.8s), at a steady speed. Under reduced motion it turns at half speed rather than stopping, because a ring that stops looks stuck.

```html
<button class="sg-button sg-button--primary" type="button" aria-busy="true"><span class="sg-loader" aria-hidden="true"></span>Saving</button>

<p class="sg-cluster" role="status"><span class="sg-loader" aria-hidden="true"></span>Loading 214 records</p>

<div class="sg-empty" role="status">
  <span class="sg-empty__icon sg-loader sg-loader--large" aria-hidden="true"></span>
  <p class="sg-empty__title">Loading the monthly report</p>
</div>
```

- In a button, the loader goes first, with `aria-busy="true"` on the button and a label that says what is happening ("Saving"). Standalone, it is decoration: put the words beside it in a `role="status"` element.
- Use a progress bar when there is a count, and skeleton rows for the first load of a table. At most one loader in view.

#### 8.38 Menu

Three to eight actions on one object, opened from a button, from an item of another menu (a submenu) or at the pointer (a context menu). Built on the Popover API.

- **Classes:** `sg-menu` (with `popover`), `sg-menu__item`, `sg-menu__item--danger`, `sg-menu__divider`, `sg-menu__shortcut`, `sg-menu__text`, `sg-menu__description`, `sg-menu__header`, `sg-menu__context`, `sg-menu__title`.
- **Measurements:** at least 12rem wide, 4px padding, an 8px radius, the overlay surface and shadow; it opens 4px below its button (above, if there is no room). `data-side` and `data-align` on the menu choose another side or alignment, as on a popover (section 8.54): `data-align="end"` suits a button at the end of a row. Items are at the control height, with 12px inline padding, 8px gaps, a 4px radius (the menu's 8px minus its 4px padding) and a 1px edge that shows only on the highlight. Icons are secondary. The highlight (hover, keyboard focus, an open submenu) is one clear gray step (`--sg-color-surface-overlay-hover`) edged one step further (`--sg-color-border-overlay-hover`), with a 2px brand bar 4px in from the start, 8px from the top and bottom: the bar Stingray uses for "you are here". Pressed is one more gray step. On the highlight the icon, the shortcut and the description turn ink. A disabled item never highlights.
- **Shortcut:** a key cap at the end of the item: 12/16 semibold secondary text, 4px inline padding, at least 20px wide, a 1px border with a 2px bottom edge and a 3px radius on the subtle fill; a chord is one `sg-menu__shortcut` per key, 4px apart. When the product binds the key, put `aria-keyshortcuts` on the item.
- **Header:** `sg-menu__header` first in the menu names what the actions apply to: `sg-menu__context` (the ID, in the mono cut, semibold ink) over `sg-menu__title` (caption, tertiary, cut with an ellipsis), with 8px block and 12px inline padding and a hairline under it. It is `aria-hidden="true"`; the menu's `aria-label` says the same ("Actions for INC-4480").
- **Description:** a second line in caption tertiary text, in `sg-menu__text` with the label: why an item is off, or what a vague action does. The item gains 8px block padding.
- **Destructive:** `sg-menu__item--danger` is red text with a red icon. On the highlight its label turns ink, because red text falls under 7:1 on the gray step, and the red stays on the icon.

```html
<button class="sg-button" type="button" popovertarget="mn-record"><span class="sg-icon sg-icon--more-1-line" aria-hidden="true"></span>Actions</button>
<div id="mn-record" popover class="sg-menu" aria-label="Actions for INC-4480">
  <div class="sg-menu__header" aria-hidden="true"><span class="sg-menu__context">INC-4480</span><span class="sg-menu__title">Payroll portal rejects valid credentials</span></div>
  <button class="sg-menu__item" role="menuitem" aria-keyshortcuts="M"><span class="sg-icon sg-icon--user-3-line" aria-hidden="true"></span>Assign to me<kbd class="sg-menu__shortcut" aria-hidden="true">M</kbd></button>
  <button class="sg-menu__item" role="menuitem"><span class="sg-icon sg-icon--link-line" aria-hidden="true"></span>Copy link</button>
  <hr class="sg-menu__divider">
  <button class="sg-menu__item" role="menuitem" aria-disabled="true"><span class="sg-icon sg-icon--git-merge-line" aria-hidden="true"></span><span class="sg-menu__text">Merge into a ticket<span class="sg-menu__description">Open tickets only</span></span></button>
  <button class="sg-menu__item sg-menu__item--danger" role="menuitem"><span class="sg-icon sg-icon--delete-2-line" aria-hidden="true"></span>Delete ticket</button>
</div>
```

- **Behavior:** focus moves to the first item; Up, Down, Home, End and a letter move; Escape closes it and returns focus to the button; Tab closes it. A pick fires `sg:menuselect` `{ item, target }`. `data-sg-menu="#mn-record"` on the button MAY replace `popovertarget`.
- **Submenu:** put a `sg-menu` with `popover` inside its parent menu, right after the item that opens it, and give that item `popovertarget`. The script adds the chevron, `aria-haspopup` and `aria-expanded`. The submenu opens 4px beside the menu, its first item level with the item that opened it, and flips to the other side when there is no room. It opens after 120ms of pointing, or with Right or Enter. While the pointer heads from its item toward it, crossing other items does not close it; Left or Escape closes it and focus returns to its item. A pick in it closes both menus. One level only.

```html
<button class="sg-menu__item" role="menuitem" popovertarget="mn-queue"><span class="sg-icon sg-icon--transfer-vertical-line" aria-hidden="true"></span>Move to queue</button>
<div id="mn-queue" popover class="sg-menu" aria-label="Queues">
  <button class="sg-menu__item" role="menuitem">Front desk</button>
  <button class="sg-menu__item" role="menuitem">Certificates</button>
</div>
```

- **Context menu:** `data-sg-context="#mn-row"` on an area (a list, a grid, a canvas) opens that menu at the pointer on a right-click, or under the focused element on Shift+F10 or the menu key. `sg:menuselect` then carries `target`, the element that was clicked; focus returns to it on close.
- MUST NOT hide the primary action in a menu, put navigation in one, or make an item red unless it deletes or removes. Every action in a context menu MUST also be reachable another way, because a right-click is hard to discover.

#### 8.39 Tooltip

A short supplement to something already visible, written as `data-sg-tip="Text"` on the control. The script draws it on the inverse surface (caption text, 4 × 8px padding, a 4px radius, at most 20rem wide) 8px from the control, after 400ms of hover or at once on focus. Escape dismisses it.

```html
<button class="sg-button sg-button--icon" type="button" aria-label="Export as CSV" data-sg-tip="Export as CSV"><span class="sg-icon sg-icon--download-2-line" aria-hidden="true"></span></button>
```

- `data-sg-tip-key="E"` adds the control's shortcut as a key cap; put `aria-keyshortcuts` on the control too.
- It is never the only copy of information, and never holds a link or a button. MUST NOT write `sg-tooltip` markup by hand.

### Navigation

#### 8.40 Breadcrumb

The path to the current page, at the top of the page, on pages more than one level deep. Ancestors are links; the current page is semibold ink text with `aria-current="page"`. Separators are 16px chevrons with 4px on each side.

```html
<nav class="sg-breadcrumb" aria-label="Breadcrumb"><ol><li><a href="/">Civil Registry</a></li><li><a href="/requests">Requests</a></li><li aria-current="page">Citizen records</li></ol></nav>
```

#### 8.41 Side navigation

A grouped list of places, each with an icon and a word.

- **Classes:** `sg-nav`, `sg-nav__heading`, `sg-nav__list`, `sg-nav__link`, `sg-nav__text`.
- **Measurements:** headings are 12/16 semibold tertiary, 16px above and 4px below, with 12px inline padding. Links are at the control height, with 12px inline padding and a 4px radius; hover is one clear gray step (`--sg-color-surface-item-hover`) in both themes. The current link is a raised pill with a 1px subtle border, a faint shadow, semibold text, and a 2px ink bar 4px from its leading edge. A `sg-count` sits at the end.

```html
<nav class="sg-nav" aria-label="Civil Registry">
  <p class="sg-nav__heading" id="nav-work">Work</p>
  <ul class="sg-nav__list" aria-labelledby="nav-work">
    <li><a class="sg-nav__link" href="/records" aria-current="page"><span class="sg-icon sg-icon--group-line" aria-hidden="true"></span><span class="sg-nav__text">Citizen records</span><span class="sg-count">12</span></a></li>
    <li><a class="sg-nav__link" href="/desk"><span class="sg-icon sg-icon--ticket-line" aria-hidden="true"></span><span class="sg-nav__text">Service desk</span></a></li>
  </ul>
</nav>
```

- At most seven items per group, and at most two tiers: deeper levels are tabs in the page or a tree. MUST NOT make a blue current item, or an icon-only navigation: the words are the navigation.

#### 8.42 Tabs

Panels of one object, switched in place.

- **Classes:** `sg-tabs` (the tablist: 4px gaps, a hairline under it), `sg-tab`, `sg-tabpanel` (16px block padding), inside a `data-sg-tabs` wrapper.
- **Measurements:** tabs are at the control height, with 12px inline padding and 4px top corners; hover has the selected fill. The selected tab is semibold ink with a 2px round-ended brand bar inset 12px. Its width is reserved, so selecting never shifts its neighbors. The new panel fades in over 160ms.

```html
<div data-sg-tabs>
  <div class="sg-tabs" role="tablist" aria-label="Ticket">
    <button class="sg-tab" role="tab" id="tab-act" aria-controls="pnl-act" aria-selected="true">Activity</button>
    <button class="sg-tab" role="tab" id="tab-det" aria-controls="pnl-det" aria-selected="false">Details</button>
  </div>
  <div class="sg-tabpanel" role="tabpanel" id="pnl-act" aria-labelledby="tab-act">…</div>
  <div class="sg-tabpanel" role="tabpanel" id="pnl-det" aria-labelledby="tab-det" hidden>…</div>
</div>
```

- **Keyboard:** one tab stop; Left and Right move and select; Home and End jump.
- **Tabs that close**, for a workspace with several tickets open: put `<span class="sg-tab__close" aria-hidden="true"></span>` last inside the tab. It is a 16px cross in a 24px target at the end of the tab. A click on it, Delete on the focused tab or a middle click closes the tab and removes its panel; the tab beside it takes the selection and the focus. It fires `sg:tabclose` `{ tab, panel }` first: call `preventDefault()` to keep the tab, for example when a reply is unsent. Tabs added to the tablist later work without another call; one added with `aria-selected="true"` is selected.

```html
<button class="sg-tab" role="tab" id="t-4480" aria-controls="p-4480" aria-selected="true">INC-4480<span class="sg-tab__close" aria-hidden="true"></span></button>
```
- Two to six tabs with short nouns. MUST NOT use tabs to go to other pages, or to hide required steps.

#### 8.43 Tree view

A hierarchy deeper than two levels: departments, folders, case types.

- **Classes:** `sg-tree` (with `role="tree"` and `data-sg-tree`), `sg-tree__item`, `sg-tree__toggle`, `sg-tree__label`.
- **Measurements:** rows are at the control height, with 8px inline padding plus 24px per level, 8px gaps and a 4px radius; hover has the hover fill. The selected row has the brand tint, semibold text and a 2px brand bar 4px from its leading edge. The toggle is a 16px chevron that turns when open. Each open branch draws a 1px guide line in the default border color, under its parent's chevron, so the levels read at a glance. A `sg-count` sits at the end.

```html
<ul class="sg-tree" role="tree" aria-label="Departments" data-sg-tree>
  <li role="treeitem" aria-expanded="true">
    <div class="sg-tree__item"><span class="sg-tree__toggle" aria-hidden="true"></span><span class="sg-icon sg-icon--building-2-line" aria-hidden="true"></span><span class="sg-tree__label">Registry office</span><span class="sg-count">214</span></div>
    <ul role="group">
      <li role="treeitem" aria-selected="true"><div class="sg-tree__item"><span class="sg-tree__toggle" aria-hidden="true"></span><span class="sg-icon sg-icon--folder-line" aria-hidden="true"></span><span class="sg-tree__label">Births</span></div></li>
      <li role="treeitem"><div class="sg-tree__item"><span class="sg-tree__toggle" aria-hidden="true"></span><span class="sg-icon sg-icon--folder-line" aria-hidden="true"></span><span class="sg-tree__label">Deaths</span></div></li>
    </ul>
  </li>
</ul>
```

- **Keyboard:** one tab stop; Up and Down move; Right opens a branch, then steps into it; Left closes it, then steps out to the parent; Home, End and a letter jump; Enter or Space selects. Events: `sg:treeselect` `{ item, label }` and `sg:treetoggle` `{ item, open }`.
- Every row keeps its toggle span, leaves included, so labels line up. MUST NOT put links or buttons inside rows. Two levels are grouped navigation, not a tree.

#### 8.44 Stepper

Where a person is in a task of three to six steps.

- **Classes:** `sg-stepper` (a `<nav>`), `sg-stepper__list`, `sg-stepper__step` (with `data-state="done"` or `aria-current="step"`), `sg-stepper__link`, `sg-stepper__marker`, `sg-stepper__text`, `sg-stepper__label`, `sg-stepper__meta`.
- **Measurements:** 24px round markers holding a number (12/16 semibold) with a 1px border; steps and their parts 8px apart; a 1px line, at least 16px long, joins each step to the next. Done: an ink border, a 16px check, the label underlined as a link, and an ink line after it. Current: the brand tint with a 2px brand ring, the number in ink, and a semibold label. Ahead: outlined, with a secondary label. When the stepper is narrower than 36rem, the steps stack and the lines go.

```html
<nav class="sg-stepper" aria-label="Registration progress">
  <ol class="sg-stepper__list">
    <li class="sg-stepper__step" data-state="done"><a class="sg-stepper__link" href="#citizen"><span class="sg-stepper__marker"><span class="sg-icon sg-icon--check-line" aria-hidden="true"></span></span><span class="sg-stepper__text"><span class="sg-stepper__label">Citizen<span class="sg-sr-only">, done</span></span></span></a></li>
    <li class="sg-stepper__step" aria-current="step"><span class="sg-stepper__marker">2</span><span class="sg-stepper__text"><span class="sg-stepper__label">Fees</span><span class="sg-stepper__meta">2 fields left</span></span></li>
    <li class="sg-stepper__step"><span class="sg-stepper__marker">3</span><span class="sg-stepper__text"><span class="sg-stepper__label">Review</span></span></li>
  </ol>
</nav>
```

- Steps are nouns. The last step reviews everything before it is saved. Done steps link back; steps ahead never link. Two steps are one page with two sections.

#### 8.45 Accordion

Sections of a long record, opened one at a time. It is native `<details>`: Enter and Space work, and find-in-page opens the section it finds.

- **Classes:** `sg-accordion`, `sg-accordion--flush`, `sg-accordion__item` (on `<details>`), `sg-accordion__summary` (on `<summary>`), `sg-accordion__meta`, `sg-accordion__body`.
- **Measurements:** one raised surface with an 8px radius and hairlines between sections. Summaries are at least 44px tall, with 8 × 16px padding and a 12px gap, semibold, and a 20px chevron that turns when open; meta sits at the end in caption text. The body has 16px padding on the sides and below. Flush drops the frame and the inline padding, for use inside a panel or drawer.

```html
<div class="sg-accordion">
  <details class="sg-accordion__item" name="record" open>
    <summary class="sg-accordion__summary">Citizen<span class="sg-accordion__meta">4 fields</span></summary>
    <div class="sg-accordion__body"><dl class="sg-kv">…</dl></div>
  </details>
  <details class="sg-accordion__item" name="record">
    <summary class="sg-accordion__summary">Documents<span class="sg-accordion__meta">2 files</span></summary>
    <div class="sg-accordion__body">…</div>
  </details>
</div>
```

- A shared `name` keeps one section open at a time. The first section starts open. Summaries say what is inside. MUST NOT hide required fields in a closed section, or nest accordions.

#### 8.46 Pagination

Fixed pages of a stable size, with the range in words.

- **Classes:** `sg-pagination` (12px gaps), `sg-pagination__range` (pushes the pages to the end), `sg-pagination__list` (4px gaps), `sg-pagination__item`.
- **Measurements:** items are square at the control height, with 8px inline padding and a 4px radius. The current page is semibold ink on the brand tint, with a 2px brand bar 4px above its bottom edge.

```html
<nav class="sg-pagination" aria-label="Pagination">
  <p class="sg-pagination__range">Showing 1–24 of 214</p>
  <ul class="sg-pagination__list">
    <li><a class="sg-pagination__item" href="?page=1" aria-current="page" aria-label="Page 1, current">1</a></li>
    <li><a class="sg-pagination__item" href="?page=2" aria-label="Page 2">2</a></li>
    <li><a class="sg-pagination__item" href="?page=2">Next</a></li>
  </ul>
</nav>
```

- Page sizes of 25, 50 or 100, chosen by the person. MUST NOT use "load more" or infinite scroll on work people act on in order.

#### 8.47 Command palette

Jump to any record or run any action by typing its name.

- **Classes:** `sg-palette` (a `<dialog>` with `data-sg-palette`), `sg-palette__search`, `sg-palette__list`, `sg-palette__option`, `sg-palette__meta`, `sg-palette__empty`, `sg-palette__footer`.
- **Measurements:** up to 40rem wide and 32rem tall, 12% from the top of the window, with an 8px radius, the overlay surface and the modal shadow. The search row has 12px padding and a hairline under it. The list has 8px padding, and groups are 8px apart, each labeled in 12/16 semibold tertiary text. Options are at least 44px tall, with 12px inline padding, 12px gaps and a 4px radius; the active one is highlighted like a menu item, with a 1px edge and the brand bar, and the typed letters are underlined (`sg-match`). The footer is caption text on the subtle fill, hidden under 30rem.

```html
<dialog class="sg-palette" id="palette" aria-label="Search and commands" data-sg-palette data-sg-dismissible>
  <div class="sg-palette__search"><div class="sg-input-group"><span class="sg-input-group__icon sg-icon sg-icon--search-line" aria-hidden="true"></span><input class="sg-input" type="text" role="combobox" aria-label="Search records and commands" aria-controls="palette-list" aria-autocomplete="list" autocomplete="off" placeholder="Search records and commands" autofocus></div></div>
  <div class="sg-palette__list" id="palette-list" role="listbox" aria-label="Results">
    <div role="group" aria-label="Records">
      <div class="sg-palette__option" role="option" data-value="CR-20418"><span class="sg-icon sg-icon--file-line" aria-hidden="true"></span>CR-20418 Maria Lúcia Oliveira<span class="sg-palette__meta">Open</span></div>
    </div>
    <div role="group" aria-label="Actions">
      <div class="sg-palette__option" role="option" data-value="new-record"><span class="sg-icon sg-icon--add-line" aria-hidden="true"></span>New citizen record</div>
    </div>
    <div role="group" aria-label="Go to">
      <div class="sg-palette__option" role="option" data-href="/reports"><span class="sg-icon sg-icon--chart-bar-line" aria-hidden="true"></span>Reports<span class="sg-palette__meta">Page</span></div>
    </div>
  </div>
  <p class="sg-palette__empty" hidden></p>
  <div class="sg-palette__footer" aria-hidden="true"><span><kbd class="sg-kbd">↑</kbd><kbd class="sg-kbd">↓</kbd>Move</span><span><kbd class="sg-kbd">Enter</kbd>Run</span><span><kbd class="sg-kbd">Esc</kbd>Close</span></div>
</dialog>
```

- **Behavior:** Ctrl+K or Cmd+K opens the first palette on the page, as does any `data-sg-dialog-open="#palette"`. Typing filters, and empty groups hide; Up, Down, Page Up and Page Down move; Enter runs; Escape closes and returns focus. An option with `data-href` navigates. Every pick fires `sg:command` `{ option, value, label }` on the dialog.
- Groups come in a fixed order: records, actions, places. Group names come from `aria-label`. Here the placeholder repeats the accessible name; it never replaces a label. Every action in the palette MUST also exist on screen, and a destructive one still opens its confirming dialog. Past about 50 results, search on the server and replace the options.

#### 8.48 Skip link and landmarks

`<a class="sg-skip" href="#main">Skip to content</a>` is the first element in `<body>`, hidden until focused. Every page has one `<h1>`, one `<main>`, and a unique `aria-label` on each `<nav>`.

### Messaging and lists

#### 8.49 List

Rows that are each one control: an inbox, a conversation list, a picker (V2). For records compared column by column, use a table.

- **Classes:** `sg-list` (on a `<ul>`), `sg-list--plain` (no hairlines between rows), `sg-list__item` (a link or a button inside each `<li>`), `sg-list__body`, `sg-list__title`, `sg-list__meta`, `sg-list__preview`. A `sg-avatar` may lead the row, and a `sg-count` may end the body.
- **Measurements:** items are at least the control height, with 8 × 12px padding, 12px between the avatar and the body, and a 4px radius. The body has two lines: the title (cut with an ellipsis) with the meta at the end in tertiary caption text, then the preview in secondary caption text with the count at the end. Hover is one clear gray step (`--sg-list-item-hover`), pressed one step darker. The selected item takes the brand tint and a 2px brand bar 4px from its leading edge. An unread item has a semibold title, its preview in ink and a strong count. Rows are separated by hairlines; `sg-list--plain` leaves them out, as an inbox usually does.

```html
<ul class="sg-list" data-sg-list aria-label="Open conversations">
  <li><a class="sg-list__item" href="/c/20418" aria-current="true">
    <span class="sg-avatar" data-presence="online" role="img" aria-label="Maria Lúcia Oliveira, online">ML</span>
    <span class="sg-list__body"><span class="sg-list__title">Maria Lúcia Oliveira</span><span class="sg-list__meta">14:02</span><span class="sg-list__preview">Can I pick up the certificate tomorrow?</span></span>
  </a></li>
  <li><a class="sg-list__item" href="/c/20419" data-unread>
    <span class="sg-avatar" data-presence="away" role="img" aria-label="João Pedro Andrade, away">JP</span>
    <span class="sg-list__body"><span class="sg-list__title">João Pedro Andrade</span><span class="sg-list__meta">13:48</span><span class="sg-list__preview">The fee was charged twice.</span><span class="sg-count sg-count--strong" aria-label="2 unread">2</span></span>
  </a></li>
</ul>
```

- `data-sg-list` makes the list one tab stop: Up and Down move between items, Home and End jump to the ends, and Tab leaves. Items added later join automatically.
- Mark the open item with `aria-current="true"` when items are links, or `aria-selected="true"` when they select in place. Mark unread items with `data-unread` and give the count an `aria-label` ("2 unread").
- MUST NOT reorder or insert rows while the pointer is over the list (M3): new conversations wait behind a "N new, show them" control.

#### 8.50 Thread and message

A conversation in time order: inbound messages on the raised surface, outbound on the brand tint (`--sg-color-surface-current`) at the end side.

- **Classes:** `sg-thread`, `sg-thread--list`, `sg-thread__divider`, `sg-message`, `sg-message--out`, `sg-message--continued`, `sg-message__reply`, `sg-message__head`, `sg-message__author`, `sg-message__time`, `sg-message__body`, `sg-message__attachments`, `sg-message__status`.
- **Measurements:** messages are 16px apart. A message is the avatar and a column up to 36rem wide, 12px apart; the head (author semibold, time in tertiary caption text) sits 4px above the body. The body has 8 × 12px padding and an 8px radius; inbound has a 1px subtle border on the raised surface, outbound the brand tint. A divider is tertiary caption text between two hairlines. The status is caption text with a 16px glyph: gray while sent or delivered, green once read (`data-state="read"`). A continued message sits 4px under the one before and hides the repeated avatar and head.

```html
<div class="sg-thread" role="log" aria-live="polite" aria-label="Conversation with Maria Lúcia Oliveira">
  <p class="sg-thread__divider">Today</p>
  <div class="sg-message">
    <span class="sg-avatar" aria-hidden="true">ML</span>
    <p class="sg-message__head"><span class="sg-message__author">Maria Lúcia Oliveira</span><span class="sg-message__time">13:58</span></p>
    <div class="sg-message__body"><p>Is my daughter's birth certificate ready?</p></div>
  </div>
  <div class="sg-message sg-message--continued">
    <span class="sg-avatar" aria-hidden="true">ML</span>
    <p class="sg-message__head"><span class="sg-message__author">Maria Lúcia Oliveira</span><span class="sg-message__time">14:02</span></p>
    <div class="sg-message__body"><p>Can I pick it up tomorrow?</p></div>
  </div>
  <div class="sg-message sg-message--out">
    <span class="sg-avatar" aria-hidden="true">AS</span>
    <p class="sg-message__head"><span class="sg-message__author">Ana Souza</span><span class="sg-message__time">14:04</span></p>
    <div class="sg-message__body"><p>Yes, from 08:00 at the front desk.</p></div>
    <p class="sg-message__status" data-state="read"><span class="sg-icon sg-icon--check-circle-fill" aria-hidden="true"></span>Read</p>
  </div>
</div>
```

- **List style:** `sg-thread--list` on the same markup stacks every message as a full-width row with no bubbles, for long messages, transcripts and an assistant's answers. Each row has 16px padding and a hairline above; the avatar and a column up to 46rem are centered in it; the other party's rows sit on the subtle band (`--sg-message-list-band`) and yours on the surface. A continued message joins the row above, 8px under it. In a `sg-split` pane the thread runs edge to edge.
- **Internal note:** text only the team sees is a card in the thread, not a message: `sg-card sg-card--note`. It takes the note tint (`--sg-color-surface-note`) with a 1px amber outline, no shadow and 12px by 16px padding, and it spans the thread; in the list style it sits in the centered column. Its first line holds the title (the words "Internal note" with the eye-close glyph, in semibold body text), the meta at the end (who wrote it and when) and, last, the button that opens its options. The text follows in ink. It MUST keep the words and the glyph, so it never depends on color.

```html
<div class="sg-card sg-card--note" data-sg-note>
  <p class="sg-card__title"><span class="sg-icon sg-icon--eye-close-line" aria-hidden="true"></span>Internal note</p>
  <p class="sg-card__meta">Ana Souza · <time datetime="2026-09-28T13:50:00Z" data-sg-relative>13:50</time></p>
  <button class="sg-button sg-button--tertiary sg-button--icon sg-button--small" type="button" popovertarget="nt-1" aria-label="Options for the note from Ana Souza" data-sg-tip="Options"><span class="sg-icon sg-icon--more-1-line" aria-hidden="true"></span></button>
  <div class="sg-card__body"><p>Finance confirmed the duplicate charge.</p></div>
  <div id="nt-1" popover class="sg-menu" data-align="end" aria-label="Note options">
    <button class="sg-menu__item" role="menuitem" data-sg-note-action="edit"><span class="sg-icon sg-icon--edit-2-line" aria-hidden="true"></span>Edit</button>
    <button class="sg-menu__item" role="menuitem" data-sg-note-action="pin"><span class="sg-icon sg-icon--pin-line" aria-hidden="true"></span>Pin</button>
    <button class="sg-menu__item" role="menuitem" data-sg-note-action="copy"><span class="sg-icon sg-icon--copy-2-line" aria-hidden="true"></span>Copy text</button>
    <hr class="sg-menu__divider">
    <button class="sg-menu__item" role="menuitem" data-sg-note-action="delete"><span class="sg-icon sg-icon--delete-2-line" aria-hidden="true"></span>Delete</button>
  </div>
</div>
```

- **Note options:** with `data-sg-note` on the card, each item of its menu says what it does in `data-sg-note-action`:
  - `edit` swaps the text for a field as tall as the note, with Save and Cancel under it. Save or Ctrl+Enter keeps the change and adds "Edited" to the meta; Cancel or Escape drops it. An empty note is not saved.
  - `pin` sets `data-pinned` on the card: it gains a "Pinned" tag and the raised shadow, and stays 8px under the top of the thread's scroll area while the thread scrolls under it. The item then reads "Unpin". Pin one note in a conversation.
  - `copy` copies the text.
  - `delete` removes the card and moves focus to the options of the next note, or the one before, or to the thread.
  - Any other name is the product's own action: it only fires the event.
- Each option fires `sg:noteaction` first, with `{ action }` and, for an edit, `value` and `previous`; for a pin, `pinned`; for a copy, `value`. Call `preventDefault()` to refuse. Save the change in that event, and after a delete offer Undo in a toast. Show only the options the person may use, and always show the button: never on hover alone. The words the script writes can be changed on the card (`data-pinned-label`, `data-edited-label`, `data-edit-label`, `data-save-text`, `data-cancel-text`) and on the pin item (`data-pin-text`, `data-unpin-text`).

- **Replying to one message:** a message can hold a reply button, last inside its body: a small tertiary icon button with `sg-message__reply` and `data-sg-reply`, named for the message. It sits 4px beside the bubble (after an inbound one, before an outbound one), shows on hover and on keyboard focus, and is always shown where there is no hover. The bubble leaves room for it. The reply quotes the message in a reply card, `sg-card sg-card--reply`, first inside its body: the subtle band with a 2px brand bar at the start, a 4px radius and 4px by 12px padding; the author in semibold caption text, then one line of the message, cut with an ellipsis. With `sg-card--link` its title links to the message's `id`, and the message it points at takes a 2px brand ring. A bubble that holds a quote is at least 16rem wide.

```html
<div class="sg-message" id="m-2">
  <span class="sg-avatar" aria-hidden="true">ML</span>
  <p class="sg-message__head"><span class="sg-message__author">Maria Lúcia Oliveira</span><span class="sg-message__time">14:02</span></p>
  <div class="sg-message__body">
    <p>It says my certificate has expired.</p>
    <button class="sg-button sg-button--tertiary sg-button--icon sg-button--small sg-message__reply" type="button" data-sg-reply aria-label="Reply to Maria, 14:02" data-sg-tip="Reply"><span class="sg-icon sg-icon--back-line" aria-hidden="true"></span></button>
  </div>
</div>
<div class="sg-message sg-message--out" id="m-3">
  <span class="sg-avatar" aria-hidden="true">AS</span>
  <p class="sg-message__head"><span class="sg-message__author">Ana Souza</span><span class="sg-message__time">14:04</span></p>
  <div class="sg-message__body">
    <div class="sg-card sg-card--reply sg-card--link"><p class="sg-card__title"><a href="#m-2">Maria Lúcia Oliveira</a></p><p class="sg-card__body">It says my certificate has expired.</p></div>
    <p>I have issued a new one.</p>
  </div>
</div>
```

- **Keyboard:** the reply buttons and the note options of a thread are one tab stop, which starts at the latest; Up and Down move between them, Home and End jump.
- The thread is `role="log"` with `aria-live="polite"`, so each new message is read once. Keep the head in continued messages: it is hidden, and still names the author for screen readers.
- Delivery states are words: Sent, Delivered, Read. Attachments are `sg-tag`s or links in `sg-message__attachments`.
- MUST NOT color messages by person or channel, or scroll the thread while someone is reading back: show a "New messages" control instead.
- Replies are written in a composer (section 8.62), whose send button may be its pane's primary (V3).

#### 8.51 Typing indicator

Who is typing, in words, after three small dots that rise in turn (V4).

- **Classes:** `sg-typing`, `sg-typing__dots` with three empty `<i>`.
- **Measurements:** 4px dots, 4px apart, in the secondary icon color, 8px before tertiary caption text. One cycle takes `--sg-motion-duration-loop`; under reduced motion the dots stand still.

```html
<p class="sg-typing" role="status"><span class="sg-typing__dots" aria-hidden="true"><i></i><i></i><i></i></span>Maria is typing</p>
```

- Put it outside the thread's log, in its own status region, and remove it when the message arrives. For several people, write the number: "3 people are typing".

### Page layout

#### 8.52 Page header

The top of every page: where it sits, what it is, what can be done with it, and facts about it.

- **Classes:** `sg-page-header` (on a `<header>`), `sg-page-header__title` (the `<h1>`), `sg-page-header__actions`, `sg-page-header__meta`. An optional `sg-breadcrumb` goes first and optional `sg-tabs` last.
- **Measurements:** a wrapping row: the breadcrumb, the meta and the tabs take full lines; the title (heading 1, 32/40 regular with tight tracking, in ink) and the actions share a line, 16px apart, until the title would be narrower than 16rem, when the actions move under it. Lines are 4px apart. Actions are 8px apart. The meta is body text in secondary, its facts 16px apart. Tabs sit 12px below.

```html
<div data-sg-tabs>
  <header class="sg-page-header">
    <nav class="sg-breadcrumb" aria-label="Breadcrumb"><ol><li><a href="/records">Citizen records</a></li><li aria-current="page">CR-20418</li></ol></nav>
    <h1 class="sg-page-header__title">Maria Lúcia Oliveira</h1>
    <div class="sg-page-header__actions">
      <button class="sg-button" type="button"><span class="sg-icon sg-icon--edit-2-line" aria-hidden="true"></span>Edit</button>
      <button class="sg-button sg-button--primary" type="button">Approve record</button>
    </div>
    <p class="sg-page-header__meta"><span class="sg-status sg-status--pending">Pending</span><span class="sg-num">CR-20418</span><span>Updated 28 Sep 2026, 14:02 UTC by Ana Souza</span></p>
    <div class="sg-tabs" role="tablist" aria-label="Record">…Summary, Documents, History…</div>
  </header>
  <div class="sg-tabpanel" role="tabpanel" id="pnl-summary" aria-labelledby="tab-summary">…</div>
</div>
```

- At most three visible actions, the primary last; the rest go in a menu behind a More actions button. Actions that affect one section belong in that section.
- The meta holds facts a person checks before acting: status, identifier, owner, last change. With tabs, wrap the header and the panels in one `data-sg-tabs`.
- MUST NOT put a second page title in the first panel, or tabs that go to other pages.

#### 8.53 Split view

Panes side by side in one raised frame, for work that moves between a list and one item: an inbox, a queue, settings.

- **Classes:** `sg-split`, `sg-split__list`, `sg-split__main`, `sg-split__main--canvas`, `sg-split__aside`, and in each pane `sg-split__head`, `sg-split__body` and `sg-split__foot`. `sg-split__back` is the back button in the main pane's head.
- **Measurements:** the frame is one raised surface: a 1px subtle border, an 8px radius and the raised shadow, at least 24rem tall. The list pane is 20rem wide, the details pane (`sg-split__aside`) 18rem, and the main pane takes the rest; hairlines divide them. A head is at least 48px tall, with 8 × 16px padding, 12px gaps and a hairline under it; its title is heading 4 (16/24), so a pane is named one step above the rows in it. A body scrolls on its own, with 16px padding (8px in the list pane). A foot has 12 × 16px padding and a hairline above. `sg-split__main--canvas` puts the main pane on the page canvas, for raised items like messages. The split measures its own width: below 64rem the details pane hides and the list narrows to 18rem; below 40rem one pane shows at a time, the list until `data-show="main"`, and the back button appears. Give it a height in your layout and each pane scrolls on its own.

```html
<main id="main" tabindex="-1">
  <header class="sg-page-header"><h1 class="sg-page-header__title">Inbox</h1></header>
  <div class="sg-split">
    <section class="sg-split__list" aria-labelledby="h-open">
      <div class="sg-split__head"><h2 class="sg-type-heading-4" id="h-open">Open</h2><span class="sg-count">24</span></div>
      <div class="sg-split__body">
        <ul class="sg-list" data-sg-list aria-label="Open conversations">
          <li><a class="sg-list__item" href="/c/20418" data-sg-split-show="main" aria-current="true">…</a></li>
        </ul>
      </div>
    </section>
    <section class="sg-split__main sg-split__main--canvas" aria-labelledby="h-thread">
      <div class="sg-split__head">
        <button class="sg-button sg-button--tertiary sg-button--icon sg-split__back" type="button" data-sg-split-show="list" aria-label="Back to conversations" data-sg-tip="Back to conversations"><span class="sg-icon sg-icon--arrow-left-line" aria-hidden="true"></span></button>
        <h2 class="sg-type-heading-4" id="h-thread">Maria Lúcia Oliveira</h2>
      </div>
      <div class="sg-split__body">…the thread…</div>
      <form class="sg-split__foot">…the composer, with Send…</form>
    </section>
    <aside class="sg-split__aside" aria-labelledby="h-details">
      <div class="sg-split__head"><h2 class="sg-type-heading-4" id="h-details">Details</h2></div>
      <div class="sg-split__body"><dl class="sg-kv">…</dl></div>
    </aside>
  </div>
</main>
```

- **Behavior:** a click on any element with `data-sg-split-show="main"` or `"list"` sets `data-show` on the split and fires `sg:splitchange` with `{ show }`. When that pane was hidden (a narrow split), focus moves to the heading of the pane that opens, and back to the item that opened it. Items link to the item's own address; a script that opens the item in place cancels the link's navigation, so the browser does not move focus after it.
- Each pane may have one primary button (V3). Details in the aside also need another way in, like a drawer, since the aside hides below 64rem.
- MUST NOT put panels or cards inside a pane (group with headings and hairlines), use more than three panes, or use a split for a single table.

### Overlays and controls

#### 8.54 Popover

A small non-modal panel beside the button that opened it: filters, a quick edit, the breakdown of a number.

- **Classes:** `sg-popover` (with `popover`), `sg-popover__header`, `sg-popover__title`, `sg-popover__body`, `sg-popover__meta`, `sg-popover__footer`.
- **Measurements:** up to 22rem wide, the overlay surface, a 1px subtle border, an 8px radius and the overlay shadow, 8px from its button. The header has 12px padding (16px at the start) and holds the body-strong title and an optional small close button. The body has 12 × 16px padding. The footer has 12 × 16px padding, a hairline above and the actions at the end.

```html
<button class="sg-button" type="button" popovertarget="pp-filters"><span class="sg-icon sg-icon--filter-2-line" aria-hidden="true"></span>Filters</button>
<div id="pp-filters" popover class="sg-popover" data-side="end" aria-labelledby="pp-filters-title">
  <div class="sg-popover__header">
    <p class="sg-popover__title" id="pp-filters-title">Filter requests</p>
    <button class="sg-button sg-button--icon sg-button--tertiary sg-button--small" type="button" popovertarget="pp-filters" popovertargetaction="hide" aria-label="Close"><span class="sg-icon sg-icon--close-line" aria-hidden="true"></span></button>
  </div>
  <div class="sg-popover__body">
    <label class="sg-choice"><input class="sg-choice__input" type="checkbox" checked><span class="sg-choice__label">Open</span></label>
  </div>
  <div class="sg-popover__footer">
    <button class="sg-button sg-button--tertiary" type="button" popovertarget="pp-filters" popovertargetaction="hide">Cancel</button>
    <button class="sg-button sg-button--primary" type="button">Apply</button>
  </div>
</div>
```

- **Placement:** `data-side` is `bottom` (the default), `top`, `start` or `end`; start and end follow the writing direction. `data-align` is `start` (the default), `center` or `end`. When the side has no room it flips to the opposite side; when neither side beside the button has room, as on a phone, it drops below. It follows its button when the page scrolls.
- **Behavior:** the script gives it `role="dialog"` and the button `aria-expanded` and `aria-controls`. Focus moves to its first control (or the element with `autofocus`) and returns to the button on close. A click outside or Escape closes it; the page stays usable. Events: `sg:popoveropen`, `sg:popoverclose`.
- MUST NOT hold a long form or anything that must be finished (use a dialog or a drawer), or open a popover from inside a popover.

#### 8.55 Hover card

A preview of a person or a record on a link, shown after 500ms of hover or 300ms after keyboard focus.

- **Classes:** `sg-hovercard` (with `popover="manual"`), `sg-hovercard__head`; the title and meta reuse `sg-popover__title` and `sg-popover__meta`.
- **Measurements:** 20rem wide, 16px padding, the popover surface, border, radius and shadow, 8px under the link. The head is an avatar beside the title and meta, 12px apart, with 12px below it.

```html
<a href="/people/ana-souza" data-sg-hovercard="#hc-ana">Ana Beatriz Souza</a>
<div id="hc-ana" popover="manual" class="sg-hovercard">
  <div class="sg-hovercard__head"><span class="sg-avatar" aria-hidden="true">AB</span><div><p class="sg-popover__title">Ana Beatriz Souza</p><p class="sg-popover__meta">Registrar · 1st Registry Office</p></div></div>
  <dl class="sg-kv"><dt>Open requests</dt><dd>12</dd><dt>Due today</dt><dd>3</dd></dl>
</div>
```

- **Behavior:** the pointer can move into the card; it closes 300ms after the pointer leaves both, on Escape, or when focus moves elsewhere. `data-side` and `data-align` work as on a popover.
- It only repeats what the link leads to, because touch and screen-reader users never see it. MUST NOT put the only copy of information, or the only way to an action, in a hover card.

#### 8.56 Slider and range

A value inside known limits, picked by feel: volume, a threshold, a price band. A native `<input type="range">`.

- **Classes:** `sg-slider`, `sg-slider--range` (two thumbs), `sg-slider__track`, `sg-slider__input`, `sg-slider__value`.
- **Measurements:** at the control height; a 4px round track in the default border color, the brand fill up to the value, and a 16px round thumb with a 2px brand ring, the raised surface and the raised shadow. The value sits 12px after the track in secondary text with tabular figures. Disabled: the fill and the ring turn to the disabled border color.

```html
<div class="sg-field">
  <label class="sg-field__label" for="volume">Playback volume</label>
  <div class="sg-slider">
    <div class="sg-slider__track"><input class="sg-slider__input" type="range" id="volume" min="0" max="100" value="60"></div>
    <output class="sg-slider__value" for="volume" data-unit="%">60%</output>
  </div>
</div>
<div class="sg-field">
  <span class="sg-field__label" id="fee-label">Fee (BRL)</span>
  <div class="sg-slider sg-slider--range" role="group" aria-labelledby="fee-label">
    <div class="sg-slider__track">
      <input class="sg-slider__input" type="range" min="0" max="500" step="5" value="40" aria-label="Minimum fee">
      <input class="sg-slider__input" type="range" min="0" max="500" step="5" value="320" aria-label="Maximum fee">
    </div>
    <output class="sg-slider__value">40 – 320</output>
  </div>
</div>
```

- **Behavior:** the keys are the platform's (arrows, Page Up and Down, Home, End). The script paints the fill, writes the value into the output with `data-unit`, and sets `aria-valuetext` with the unit. The two thumbs of a range never cross. Listen to the native `input` and `change` events.
- Always show the value. MUST NOT use a slider for an exact amount someone will type: use a field, or put one beside the slider.

### Audio and voice

#### 8.57 Audio player and voice note

A recording with a play button, a waveform you can seek and the time. `sg-audio--compact` is the voice note inside a message.

- **Classes:** `sg-audio`, `sg-audio--compact`, `sg-audio__play`, `sg-audio__wave`, `sg-audio__time`. The script adds `sg-audio__bar` and `sg-audio__seek`.
- **Measurements:** a row with 12px gaps (8px compact). The play button is a `sg-button--icon` (`sg-button--small` in a message). The waveform is 28px tall (24px compact), at least 6rem wide (8rem compact), with round bars up to 4px wide, 2px apart, spread across its width, in the default border color, turning brand as they play. Without peaks it is a 4px round track with a brand fill. The time is caption text in secondary with tabular figures.

```html
<div class="sg-audio" role="group" aria-label="Call recording, CR-20418">
  <audio src="/recordings/cr-20418.mp3" controls preload="metadata"></audio>
  <button class="sg-button sg-button--icon sg-audio__play" type="button" aria-label="Play"><span class="sg-icon sg-icon--play-line" aria-hidden="true"></span></button>
  <div class="sg-audio__wave" data-peaks=".12,.46,.57,.88,.83,.92,.92,.36,.42,.17,.46,.41"></div>
  <span class="sg-audio__time">0:00 / 0:42</span>
</div>
```

- **Behavior:** without the script the native player shows; with it, `controls` is removed and the row takes over. Play becomes Pause while it plays, and starting one recording pauses any other. The waveform is a range input named "Position": the arrows seek by a second and its `aria-valuetext` reads "0:12 of 0:42". The compact time shows the length until it plays, then the time played.
- `data-peaks` is a comma list of numbers from 0 to 1, one per bar, measured once by the server (about 48 for a player, 32 for a voice note). MUST NOT invent peaks; leave the attribute out and the plain track shows. MUST NOT autoplay.

#### 8.58 Voice input

Records from the microphone after the person presses the button, with the live level.

- **Classes:** `sg-voice`, `sg-voice__button`, `sg-voice__label`, `sg-voice__level`, `sg-voice__time`. The script adds `sg-voice__bar`.
- **Measurements:** a row with 12px gaps. While recording, 24 round level bars in brand, 6rem wide and 24px tall, show the last two seconds, and the time in caption text follows an 8px red dot that blinks.

```html
<div class="sg-voice">
  <button class="sg-button sg-voice__button" type="button"><span class="sg-icon sg-icon--mic-line" aria-hidden="true"></span><span class="sg-voice__label">Record voice note</span></button>
  <div class="sg-voice__level" aria-hidden="true"></div>
  <span class="sg-voice__time">0:00</span>
</div>
```

- **Behavior:** the first press asks for the microphone. While recording, the label reads "Stop recording", the mic icon becomes a stop icon, and "Recording" is announced. Pressing again stops it, announces the length, and fires `sg:voicestop` with `{ blob, duration }`. Also `sg:voicestart` `{ stream }`, `sg:voicelevel` `{ level }` (0 to 1, about 12 times a second) and `sg:voiceerror` `{ error }`, after which a message says how to allow the microphone.
- MUST NOT ask for the microphone before the press, or record without the label, the dot and the time.

#### 8.59 Agent orb

What a voice agent is doing: idle, listening, thinking or talking.

- **Classes:** `sg-orb`, `sg-orb--large` (96px; the default is 48px). The state is `data-state="idle"`, `"listening"`, `"thinking"` or `"talking"`.
- **Measurements:** flat round discs: the brand core at half the size inside the current-tint halo, and a 2px brand ring. Idle, the core breathes; listening, the ring grows with the level; thinking, the ring ripples outward; talking, the core pulses. With reduced motion every state is still.

```html
<div class="sg-cluster">
  <span class="sg-orb" data-state="listening" aria-hidden="true"></span>
  <p role="status">Listening</p>
</div>
```

- **Behavior:** `Stingray.level(orb, value)` sets the level from 0 to 1, for example from `sg:voicelevel`.
- The state MUST be written beside the orb, because motion and color alone leave people out. MUST NOT draw the orb with gradients, blur or glow.

#### 8.60 Thinking text

A short status while an agent works: "Thinking", "Searching records".

- **Classes:** `sg-shimmer`.
- **Measurements:** the text's own size, in tertiary; each letter brightens to primary in turn, one cycle every 1.4s. With reduced motion it stays tertiary.

```html
<p class="sg-shimmer">Searching records…</p>
```

- **Behavior:** the script splits the letters for the wave and keeps one plain copy for screen readers. Put it in a `role="status"` region when the change of state should be announced.
- Keep it to a few words. MUST NOT use it for loading content that has a known length: use a progress bar.

### Helpdesk and IT

#### 8.61 SLA timer

How long until a reply or a resolution is due, in the status vocabulary: a glyph, an optional label and the time.

- **Classes:** `sg-sla`, `sg-sla__label`, `sg-sla__time`. The state is `data-state`: `ok`, `risk`, `breach`, `paused` or `met`.
- **Measurements:** an inline row with the density gap: a glyph at the control icon size, the label in tertiary caption text, then the time in tabular figures. Glyph and color follow the state: a gray clock on track, the amber triangle at risk, the red octagon and semibold text once breached, a gray pause mark while stopped, the green check when met.

```html
<span class="sg-sla" data-sg-sla data-due="2026-09-28T16:00:00Z" data-start="2026-09-28T12:00:00Z" role="timer"><span class="sg-sla__label">First reply</span><span class="sg-sla__time"></span></span>
<span class="sg-sla" data-state="met" role="timer"><span class="sg-sla__label">First reply</span><span class="sg-sla__time">Met in 12m</span></span>
```

- **Behavior:** with `data-sg-sla` and `data-due` the script writes the time ("2h 14m left", "6m overdue"; seconds only in the last minute) and sets the state: breach once due, risk in the last quarter of the span from `data-start`, or within `data-risk` seconds. It fires `sg:slachange` `{ state }` on each change. `data-announce` also announces the change; put it only on the person's own tickets. `data-left` and `data-overdue` change the words, with `{t}` for the time. `paused` and `met` are set by the product and never tick.
- **Sizes:** `sg-sla--small` and `sg-sla--large`, measured as for status (section 8.16).
- MUST keep the words; the color and the glyph alone are not the state. A ticket with two targets shows two timers, each with its label.

#### 8.62 Composer

Where an agent writes a reply or an internal note. It has the shape of the box in a chat assistant: the text on top, and one row under it for the tools, the toggles and the send button.

- **Classes:** `sg-composer` (with `data-sg-composer`), `sg-composer__hint`, `sg-composer__attachments`, `sg-composer__input`, `sg-composer__bar`, `sg-composer__tools`, `sg-composer__toggle`.
- **Measurements:** one box on the field surface with a 1px border, a 12px radius (the 4px of its controls plus the 8px around them) and the raised shadow, and no rules inside it. The text has 12px block and 16px inline padding, takes its resting height from `rows`, grows with its content to 16rem, and has no border of its own: the focus ring goes around the whole box. Attachments are tiles above the text (section 8.64), 12px apart. The bar sits 8px from the sides and the bottom of the box, with 8px gaps: the tools first (small tertiary icon buttons 4px apart), then the toggles, and the send action at the end, a primary icon button. A toggle is not a button but a plain label as tall as a small control: a 16px icon, its words in secondary text, and a small tag that says on or off (the words come from `data-on` and `data-off`); when it is on, the tag takes the brand tint. In note mode the box takes the note tint and the hint line shows first in the box.

```html
<form class="sg-composer" data-sg-composer action="/tickets/4480/reply">
  <p class="sg-composer__hint"><span class="sg-icon sg-icon--eye-close-line" aria-hidden="true"></span>Only the team sees this note</p>
  <div class="sg-composer__attachments"></div>
  <input type="file" multiple hidden>
  <textarea class="sg-composer__input" rows="2" aria-label="Reply to Otávio Campos" data-reply-label="Reply to Otávio Campos" data-note-label="Internal note about Otávio Campos" data-reply-placeholder="Write a reply" data-note-placeholder="Write a note for the team" placeholder="Write a reply"></textarea>
  <div class="sg-composer__bar">
    <div class="sg-composer__tools" role="group" aria-label="Attachments and tools">
      <button class="sg-button sg-button--tertiary sg-button--icon sg-button--small" type="button" data-sg-composer-attach aria-label="Attach a file" data-sg-tip="Attach a file"><span class="sg-icon sg-icon--attachment-line" aria-hidden="true"></span></button>
    </div>
    <label class="sg-composer__toggle" data-on="on" data-off="off"><input type="checkbox" name="mode" value="note" data-sg-composer-mode><span class="sg-icon sg-icon--eye-close-line" aria-hidden="true"></span>Internal note</label>
    <label class="sg-composer__toggle" data-on="on" data-off="off"><input type="checkbox" name="signed" checked data-sg-composer-sign><span class="sg-icon sg-icon--signature-line" aria-hidden="true"></span>Sign as Ana Souza</label>
    <button class="sg-button sg-button--primary sg-button--icon" type="button" data-sg-composer-send aria-label="Send reply" data-sg-tip="Send reply" data-reply-text="Send reply" data-note-text="Add note"><span class="sg-icon sg-icon--arrow-up-line" aria-hidden="true"></span></button>
  </div>
</form>
```

- **Mode:** the checkbox with `data-sg-composer-mode` and `value="note"` turns note mode on. It sets `data-mode` on the composer (`reply` or `note`), swaps the text's label and placeholder and the send button's name from their `data-reply-*` and `data-note-*` attributes, and fires `sg:composermode` `{ mode }`. A pair of radios with the values `reply` and `note` works the same way.
- **Signature:** the checkbox with `data-sg-composer-sign` decides whether a reply carries the agent's name. It is on by default and its label says the name ("Sign as Ana Souza"), so the agent sees what the customer will see; turning it off sends the reply unsigned. The product adds the name to what it sends. The toggle hides in note mode, because a note never reaches the customer. In the thread, a reply that went without a name says so in its status line ("Sent unsigned").
- **Sending:** the send button (`data-sg-composer-send`) is `aria-disabled` until there is text or an attachment; pressed while empty, it moves focus to the text and announces why. It, or Ctrl+Enter in the text, fires `sg:composersubmit` `{ mode, value, signed, replyTo, files }` and then clears the text and the files: call `preventDefault()` to keep it, for example when sending fails. `signed` is left out for a note, and when the composer has no signature toggle; `replyTo` is there only while a message is being answered, and `files` only when some are attached.
- **Reply card:** give `data-sg-composer` the thread as its value (`data-sg-composer="#messages"`) and the composer answers that thread's reply buttons (section 8.50). Pressing one puts a reply card first in the box, 8px from its edges: "Replying to" and the author, one line of the message, and a small close button at its end. Focus moves to the text, which is described by the card. The button, or Escape in the text, cancels the reply; sending clears it. `replyTo` in the event is the message element. `data-reply-title` (with `{name}`) and `data-reply-cancel` on the composer change the words.
- **Files:** a button with `data-sg-composer-attach` opens the composer's `<input type="file" hidden>`. Each file picked, or pasted into the text, becomes an attachment tile in `sg-composer__attachments`, and `files` in the event carries the `File` objects. The tile's round button removes it. Previews are object URLs, so a content security policy needs `blob:` in `img-src` and `media-src`.
- The other tools are ordinary buttons: the product inserts the saved reply or the emoji. To send and set a status in one step, join the send button to a menu as a split button (section 8.1). The bar's last item is pushed to the end, so the send action comes last in it. In the foot of a split pane the composer stands alone: the foot drops its rule.
- MUST keep the hint line in note mode, and `data-on` and `data-off` on each toggle: the tint alone is not the state. MUST NOT add a rule or another bar inside the box, or show tools the product does not support.

#### 8.63 Log viewer

Output from a job, a deploy or a device.

- **Classes:** `sg-log` (with `data-sg-log`), `sg-log__lines`, `sg-log__line`, `sg-log__time`, `sg-log__level`, `sg-log__text`. The script adds `sg-log__latest`.
- **Measurements:** the dark code block (dark in both themes, an 8px radius) in the mono cut at 12/16. The lines scroll inside it, up to 24rem tall. A line is three columns 12px apart with 16px inline padding: the time in the comment color, the level word 5 characters wide, then the text, which wraps. `data-level="warn"` makes the level word amber and semibold; `data-level="error"` makes the word and the text red, the word semibold.

```html
<div class="sg-log" data-sg-log>
  <div class="sg-log__lines" role="log" aria-live="off" aria-label="Deploy log, mail gateway" tabindex="0">
    <div class="sg-log__line" data-level="info"><span class="sg-log__time">14:02:11</span><span class="sg-log__level">info</span><span class="sg-log__text">Starting deploy of mail-gateway 4.18.2</span></div>
    <div class="sg-log__line" data-level="error"><span class="sg-log__time">14:02:33</span><span class="sg-log__level">error</span><span class="sg-log__text">TLS handshake failed for relay 10.20.4.17:25</span></div>
  </div>
</div>
```

- **Behavior:** append lines to `sg-log__lines`. The log follows them only while the reader is at the end; scrolled up, it stays still and a "New lines" button jumps back (M3). `data-latest` on `sg-log` changes the button's words.
- Keep `aria-live="off"` on a busy log and announce only what matters, such as the result. Write the level as a word in the product's own case; it is data, so T4 does not apply. MUST NOT use a log for records: that is a table.

#### 8.64 Attachment

A file on a message: in the composer before it is sent, and under the message after.

- **Classes:** `sg-attachment`, `sg-attachment--video`, `sg-attachment__thumb`, `sg-attachment__body`, `sg-attachment__name`, `sg-attachment__meta`, `sg-attachment__remove`.
- **Measurements:** a tile on the subtle band with a 1px subtle border, an 8px radius and 4px padding (12px at the end). The preview is a 44px square with a 4px radius, the tile's radius minus the padding around it. Beside it, 8px away: the name in semibold, cut with an ellipsis at 12rem, over the type and the size in tertiary caption text. An image or a video fills the preview; a video adds a 20px play mark; a document shows a 20px icon and nothing else. The remove button is a 24px round mark on the start corner, 8px outside the tile.

```html
<div class="sg-composer__attachments">
  <div class="sg-attachment">
    <span class="sg-attachment__thumb"><img src="/files/router-error.png" alt=""></span>
    <span class="sg-attachment__body"><span class="sg-attachment__name">router-error.png</span><span class="sg-attachment__meta">PNG · 284 kB</span></span>
    <button class="sg-attachment__remove" type="button" aria-label="Remove router-error.png"></button>
  </div>
  <div class="sg-attachment sg-attachment--video">
    <span class="sg-attachment__thumb"><video src="/files/screen-recording.mp4" muted preload="metadata"></video></span>
    <span class="sg-attachment__body"><span class="sg-attachment__name">screen-recording.mp4</span><span class="sg-attachment__meta">MP4 · 4.2 MB</span></span>
    <button class="sg-attachment__remove" type="button" aria-label="Remove screen-recording.mp4"></button>
  </div>
  <div class="sg-attachment">
    <span class="sg-attachment__thumb"><span class="sg-icon sg-icon--pdf-line" aria-hidden="true"></span></span>
    <span class="sg-attachment__body"><span class="sg-attachment__name">statement-sep.pdf</span><span class="sg-attachment__meta">PDF · 96 kB</span></span>
    <button class="sg-attachment__remove" type="button" aria-label="Remove statement-sep.pdf"></button>
  </div>
</div>
```

- The composer writes these tiles itself for files it is given (section 8.62). Icons by kind: `sg-icon--pdf-line`, `sg-icon--file-zip-line`, `sg-icon--file-code-line`, and `sg-icon--document-line` for anything else. A video's preview is a `<video>`, or an `<img>` of its first frame.
- In a sent message, put the same tiles in `sg-message__attachments`, inside the body or under it, without the remove button.
- A picture from the server can show a tiny preview first: set `--sg-attachment-preview` on the thumb to a 16px image or a decoded BlurHash (`url(…)`). The picture fades in over it once loaded.
- MUST name the file in the remove button's label. MUST NOT show a preview for a document, or a tile with no size.

### Layout helpers

| Class | Does |
|---|---|
| `sg-stack` | A column with 16px gaps (`--sg-space-stack-field`) |
| `sg-stack--related` | 4px gaps: label and control, breadcrumb and title |
| `sg-stack--group` | 24px gaps: groups of fields, regions of a section |
| `sg-stack--section` | 32px gaps: page sections |
| `sg-cluster` | A wrapping row with 8px gaps, centered vertically |
| `sg-cluster--tight` | 4px gaps: an icon or a status beside a word |
| `sg-cluster--loose` | 16px gaps |
| `sg-toolbar` | A wrapping row of controls: 8px between rows, 12px between items |
| `sg-toolbar__spacer` | Pushes everything after it to the end of the toolbar |
| `sg-sr-only` | Hidden visually, read by screen readers |
| `sg-no-print` | Hidden when printing |

There is no grid framework. A list beside the item it opens is a split view (section 8.53); other page-level columns are your own CSS grid with Stingray gaps (section 13).

## 9. Page recipes

Copy the recipe that fits the page. They put every gap on the grid and every surface on one level.

### A list page (a work queue or registry)

```html
<main id="main" tabindex="-1">
  <div class="sg-stack sg-stack--group">
    <header class="sg-page-header">
      <nav class="sg-breadcrumb" aria-label="Breadcrumb"><ol><li><a href="/">Civil Registry</a></li><li aria-current="page">Citizen records</li></ol></nav>
      <h1 class="sg-page-header__title">Citizen records</h1>
      <div class="sg-page-header__actions"><button class="sg-button sg-button--primary" type="button"><span class="sg-icon sg-icon--add-line" aria-hidden="true"></span>New record</button></div>
    </header>
    <section class="sg-stack" aria-label="Records">
      <div class="sg-toolbar" role="group" aria-label="Filters">
        <div class="sg-input-group"><span class="sg-input-group__icon sg-icon sg-icon--search-line" aria-hidden="true"></span><input class="sg-input" type="search" aria-label="Filter records" data-sg-filter="#records"></div>
        <button class="sg-button" type="button" id="filters-button" data-sg-dialog-open="#filters"><span class="sg-icon sg-icon--filter-2-line" aria-hidden="true"></span>Filters</button>
        <span class="sg-toolbar__spacer"></span>
        <span data-sg-count-for="#records" aria-live="polite"></span>
      </div>
      <div class="sg-chips" role="group" aria-label="Active filters" data-sg-chips="#filters-button">…</div>
      <div>
        <div class="sg-table-wrap"><table class="sg-table" id="records" data-sg-grid data-selectable>…</table></div>
        <div class="sg-bulkbar" data-sg-bulk-for="#records" role="region" aria-label="Bulk actions" hidden>…</div>
      </div>
      <nav class="sg-pagination" aria-label="Pagination">…</nav>
    </section>
  </div>
  <dialog class="sg-drawer sg-drawer--start sg-drawer--small" id="filters" aria-labelledby="filters-t">…filter fields; a footer with "Clear" and "Show 24 records"…</dialog>
</main>
```

Record details open in a default drawer beside the list; Enter on a row fires `sg:activate`.

**Saved views.** A queue people filter the same way every day gets named views: a `sg-select` (or `sg-tabs` with a `sg-count` in each) first in the toolbar, such as "My open tickets", "Unassigned" and "Breaching today". Choosing one sets the filters and the chips; a "Save view" button beside the chips keeps the current filters under a name. Columns people arrange (the column chooser and resizing, section 8.12) are part of the view.

### A record page

```html
<main id="main" tabindex="-1">
  <div data-sg-tabs>
    <header class="sg-page-header">
      <nav class="sg-breadcrumb" aria-label="Breadcrumb">…</nav>
      <h1 class="sg-page-header__title sg-num">CR-20418</h1>
      <div class="sg-page-header__actions">
        <button class="sg-button" type="button">Request changes</button>
        <button class="sg-button sg-button--primary" type="button">Approve record</button>
      </div>
      <p class="sg-page-header__meta"><span class="sg-status sg-status--open">Open</span><span>Birth certificate</span><span>Updated 28 Sep 2026, 14:02 UTC</span></p>
      <div class="sg-tabs" role="tablist" aria-label="Record">…Summary, Documents, History…</div>
    </header>
    <div class="sg-tabpanel" role="tabpanel" id="pnl-summary" aria-labelledby="tab-summary">
      <div class="sg-stack sg-stack--group">
        <section class="sg-panel" aria-labelledby="h-citizen"><h2 class="sg-panel__title" id="h-citizen">Citizen</h2><dl class="sg-kv">…</dl></section>
        <section class="sg-panel" aria-labelledby="h-activity"><h2 class="sg-panel__title" id="h-activity">Activity</h2><ol class="sg-timeline">…</ol></section>
      </div>
    </div>
  </div>
</main>
```

### A form page

```html
<main id="main" tabindex="-1">
  <div class="sg-stack sg-stack--group">
    <header class="sg-page-header">
      <nav class="sg-breadcrumb" aria-label="Breadcrumb">…</nav>
      <h1 class="sg-page-header__title">Register a birth</h1>
      <p class="sg-page-header__meta"><span>Draft saved 30 Sep 2026, 10:41 UTC</span></p>
    </header>
    <nav class="sg-stepper" aria-label="Registration progress">…</nav>
    <form class="sg-stack sg-stack--group" novalidate>
      <section class="sg-panel" aria-labelledby="h-child">
        <h2 class="sg-panel__title" id="h-child">Child</h2>
        <div class="sg-stack">
          <div class="sg-field">…Full name…</div>
          <div class="sg-field">…Date of birth…</div>
          <fieldset class="sg-stack sg-stack--related">…Sex, as radios…</fieldset>
        </div>
      </section>
      <div class="sg-toolbar">
        <span class="sg-toolbar__spacer"></span>
        <button class="sg-button sg-button--tertiary" type="button">Save draft</button>
        <button class="sg-button" type="button">Back</button>
        <button class="sg-button sg-button--primary" type="submit">Continue to documents</button>
      </div>
    </form>
  </div>
</main>
```

On submit with errors, put a `sg-banner--error` with `role="alert"` above the form, listing each error as a link to its field, and move focus to it.

### A split page (an inbox, a queue, settings)

```html
<main id="main" tabindex="-1">
  <header class="sg-page-header">
    <h1 class="sg-page-header__title">Settings</h1>
    <p class="sg-page-header__meta"><span>Changes apply to your account only</span></p>
  </header>
  <div class="sg-split">
    <section class="sg-split__list" aria-label="Settings sections">
      <div class="sg-split__body"><nav class="sg-nav" aria-label="Settings sections">…links with data-sg-split-show="main"…</nav></div>
    </section>
    <section class="sg-split__main" aria-labelledby="h-profile">
      <div class="sg-split__head">…the back button…<h2 class="sg-type-heading-4" id="h-profile">Profile</h2></div>
      <form class="sg-split__body" id="profile-form">…groups of fields, each under an h3…</form>
      <div class="sg-split__foot sg-toolbar"><span class="sg-toolbar__spacer"></span><button class="sg-button" type="reset" form="profile-form">Discard changes</button><button class="sg-button sg-button--primary" type="submit" form="profile-form">Save changes</button></div>
    </section>
  </div>
</main>
```

Give the split the height your layout leaves under the header (for example with flex), and each pane scrolls on its own; without one it is at least 24rem tall.

### A ticket page (a record, its conversation and the reply)

```html
<main id="main" tabindex="-1">
  <div class="sg-stack sg-stack--group">
    <header class="sg-page-header">
      <nav class="sg-breadcrumb" aria-label="Breadcrumb"><ol><li><a href="/tickets">Tickets</a></li><li aria-current="page">INC-4480</li></ol></nav>
      <h1 class="sg-page-header__title">Payroll portal rejects valid credentials</h1>
      <div class="sg-page-header__actions"><button class="sg-button" type="button">Escalate</button></div>
      <p class="sg-page-header__meta"><span class="sg-status sg-status--progress">In progress</span><span class="sg-sla" data-sg-sla data-due="2026-09-28T18:00:00Z" data-start="2026-09-28T14:00:00Z" role="timer"><span class="sg-sla__label">Resolution</span><span class="sg-sla__time"></span></span></p>
    </header>
    <p class="sg-cluster"><span class="sg-avatar-group" aria-hidden="true"><span class="sg-avatar">BC</span><span class="sg-avatar">CM</span></span>Bruno and Carla are viewing this ticket</p>
    <div class="sg-thread" role="log" aria-live="polite" aria-label="Conversation with Otávio Campos">…messages and internal notes (section 8.50)…</div>
    <form class="sg-composer" data-sg-composer>…the composer (section 8.62)…</form>
    <section class="sg-panel" aria-labelledby="details-h">
      <h2 class="sg-panel__title" id="details-h">Details</h2>
      <dl class="sg-kv">…fields, the changeable ones as sg-edit (section 8.23)…</dl>
    </section>
  </div>
</main>
```

On a wide screen the details sit beside the conversation: use a split view (section 8.53) with the thread and composer in the main pane and the details in the aside. A workspace with several tickets open puts each in a closable tab (section 8.42).

### A dashboard or report

```html
<main id="main" tabindex="-1">
  <div class="sg-stack sg-stack--section">
    <header class="sg-page-header">
      <nav class="sg-breadcrumb" aria-label="Breadcrumb">…</nav>
      <h1 class="sg-page-header__title">Monthly report</h1>
      <div class="sg-page-header__actions">
        <fieldset class="sg-segmented">…Month, Quarter, Year…</fieldset>
        <button class="sg-button" type="button"><span class="sg-icon sg-icon--download-2-line" aria-hidden="true"></span>Export CSV</button>
      </div>
    </header>
    <section class="sg-stack" aria-labelledby="h-volume">
      <h2 class="sg-type-heading-2" id="h-volume">Volume</h2>
      <div class="sg-stack sg-stack--related"><div class="sg-stats">…</div><p class="sg-provenance">…</p></div>
      <div class="report-charts"><div id="chart-weekly"></div><div id="chart-channel"></div></div>
    </section>
  </div>
</main>
```

```css
/* report: two charts side by side from 960px; no Stingray layout component places charts in columns */
.report-charts { display: grid; gap: var(--sg-space-6); }
@media (min-width: 60rem) { .report-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
```

An official report puts a `sg-classification` banner right after the skip link.

## 10. Theme, density and behavior

**Theme.** Light and dark follow the operating system. Force one with `data-theme="light"` or `data-theme="dark"` on `<html>` or on any container. Printing always uses the light theme.

**Density.** `data-density="dense"`, `"standard"` (the default) or `"relaxed"` on `<html>` or any container (section 3).

**Haptics.** A short tap when a switch flips, a swipe will dismiss, or `Stingray.busy()` is done. A page cannot read the phone's haptics setting, so the phone applies its own: Safari on iPhone plays the native switch haptic only with System Haptics on, and Android vibrates only as its settings allow. Products MUST offer a "Haptic feedback" switch in their settings that calls `Stingray.haptics.set(on)`; the choice is saved like the theme.

**Behavior attributes.** The HTML works without JavaScript; the script adds keyboard models and state.

| Attribute | On | Does |
|---|---|---|
| `data-sg-dialog-open="#id"` | a button | Opens that dialog, drawer or palette; focus returns to the button on close |
| `data-sg-dialog-close` | a button inside a dialog | Closes it |
| `data-sg-dismissible` | a `<dialog>` | A click on the backdrop closes it |
| `data-sg-grid` | a `<table>` | Keyboard grid and sorting |
| `data-selectable` | a grid | Row selection |
| `data-sg-select-all`, `data-sg-row` | checkboxes in a grid | Select all, select one row |
| `data-sg-filter="#tableId"` | an input | Type-ahead filter of that table; `/` focuses it |
| `data-sg-count-for="#tableId"`, `data-sg-selection-for="#tableId"` | any element | Live "{n} of {total}" and "{n} selected"; `data-template` changes the words |
| `data-sg-bulk-for="#tableId"` | `sg-bulkbar` | Shown while rows of that grid are selected |
| `data-sg-clear-selection="#tableId"` | a button | Clears the selection and returns focus to the grid |
| `data-sg-tabs` | the tabs wrapper | Tab keyboard model |
| `data-sg-menu="#id"` | a button | Opens that menu; an alternative to `popovertarget` |
| `data-sg-context="#id"` | any area | Opens that menu at the pointer on right-click, Shift+F10 or the menu key |
| `data-sg-columns="#tableId"` | a container of checkboxes | Shows and hides the columns named by `data-col` on the headers |
| `data-col`, `data-resizable` | a `<th>` | The column's name for the chooser; a header that can be resized |
| `data-sg-sla` with `data-due`, and `data-start` or `data-risk` | `sg-sla` | Counts down, sets the state; `data-announce` also announces changes |
| `data-sg-relative` | `<time datetime>` | Shows the age ("5 minutes ago"); the exact time stays in the tooltip |
| `data-sg-edit` with `data-name` | `sg-edit` | Edit in place: Enter or leaving saves, Escape cancels |
| `data-sg-composer`, `data-sg-composer-mode`, `data-sg-composer-sign`, `data-sg-composer-send` | `sg-composer`, its note toggle, its signature toggle, its send button | Reply or note mode, a signed or unsigned reply, a text that grows, Ctrl+Enter sends. With a thread's selector as its value, `data-sg-composer` answers that thread's reply buttons |
| `data-sg-reply` | the reply button in a message | Starts a reply to that message in the thread's composer |
| `data-sg-composer-attach` | a button in `sg-composer` | Opens the composer's file input; each file becomes an attachment tile |
| `data-sg-note`, `data-sg-note-action` | `sg-card--note`, the items of its menu | The note's options: `edit`, `pin`, `copy`, `delete`, or a name of the product's own |
| `data-sg-log` | `sg-log` | Follows new lines while the reader is at the end |
| `data-side`, `data-align` | `sg-popover`, `sg-hovercard`, `sg-menu` | Where it opens: `top`, `bottom`, `start` or `end`, aligned `start`, `center` or `end` |
| `data-sg-hovercard="#id"` | a link | Shows that hover card on hover and focus |
| `data-unit` | `sg-slider__value` | The unit written after the value, and read in `aria-valuetext` |
| `data-peaks` | `sg-audio__wave` | Waveform bars, numbers from 0 to 1 |
| `data-state` | `sg-orb` | `idle`, `listening`, `thinking` or `talking` |
| `data-sg-tip="Text"`, `data-sg-tip-key="E"` | any control | Tooltip on hover and focus, with the shortcut as a key cap |
| `data-sg-changed` | a cell or any element | Tints it for a moment, then removes itself |
| `data-sg-combobox` | `sg-combobox` | Filtering list, arrow keys, Enter picks |
| `data-sg-date-range`, `data-sg-range` | `sg-date-range`, preset buttons | Keeps the end after the start; presets fill both dates |
| `data-sg-upload` with `data-max-size` | `sg-upload` | File list, adding picks, size check |
| `data-sg-chips="#id"`, `data-sg-chips-clear` | `sg-chips`, a button | Removes chips and moves focus |
| `data-sg-tree` | `sg-tree` | Tree keyboard model and single selection |
| `data-sg-palette` | `sg-palette` | Palette behavior; Ctrl+K or Cmd+K opens it |
| `data-sg-list` | `sg-list` | One tab stop; Up, Down, Home and End move |
| `data-sg-split-show="main"` or `"list"` | an item or button inside `sg-split` | Shows that pane on a narrow split and moves focus into it |

**JavaScript API** (`window.Stingray`). No other functions exist.

```js
Stingray.init(root)                        // wire behaviors inside markup inserted after load
Stingray.toast({ title, message, status: 'info' | 'success' | 'warning' | 'error', action: { label, onClick, undo }, timeout })   // returns { dismiss }
Stingray.busy(button, work, { busy, done })   // blocks the button until work settles; resolves with its result
Stingray.stagger(list)                     // brings in the first ten children one after another, on first load only
Stingray.chart(element, spec)              // returns { update(spec), loading(bool), setTexture(bool), destroy() }
Stingray.chartTheme(element)               // the chart tokens as plain values, for a library inside type: 'custom'
Stingray.timeseries(element, spec)         // a Grafana-style time series on vendored uPlot; returns what chart() returns
Stingray.spark(element, values)            // a trend with no axes
Stingray.theme.get() / .set('light' | 'dark' | 'system') / .effective()
Stingray.density.get() / .set('dense' | 'standard' | 'relaxed')
Stingray.haptics.get() / .set(true | false) / .tap()
Stingray.announce(message)                 // a polite screen-reader announcement
Stingray.level(element, value)             // a live level from 0 to 1, read by the agent orb
```

**Events.** All bubble, and all start with `sg:`.

| Event | Fired on | Detail |
|---|---|---|
| `sg:selectionchange` | a grid | `{ count }` |
| `sg:activate` | a grid | `{ row }`: Enter on a row |
| `sg:sort` | a grid | `{ column, direction }` |
| `sg:filter` | a grid | `{ visible, total }` |
| `sg:menuselect` | a menu | `{ item, target }`: `target` is what a context menu opened on |
| `sg:popoveropen`, `sg:popoverclose` | a popover | none |
| `sg:rowtoggle`, `sg:columnschange`, `sg:columnresize` | a grid | `{ row, open }`, `{ hidden }`, `{ column, width }` |
| `sg:tabclose` | the tabs wrapper | `{ tab, panel }`; cancel it to keep the tab |
| `sg:slachange` | `sg-sla` | `{ state }` |
| `sg:edit` | `sg-edit` | `{ name, value, previous }`; cancel it to refuse the change |
| `sg:composermode`, `sg:composersubmit` | `sg-composer` | `{ mode }`, `{ mode, value, signed, replyTo, files }`; cancel the submit to keep the text and the files |
| `sg:noteaction` | `sg-card--note` | `{ action }`, with `value` and `previous` for an edit, `pinned` for a pin, `value` for a copy; cancel it to refuse |
| `sg:voicestart`, `sg:voicelevel`, `sg:voicestop`, `sg:voiceerror` | `sg-voice` | `{ stream }`, `{ level }`, `{ blob, duration }`, `{ error }` |
| `sg:change` | a combobox | `{ value, label, option }` |
| `sg:rangechange` | a date range | `{ from, to }` |
| `sg:fileschange` | an upload | `{ files }` |
| `sg:chipremove`, `sg:chipsclear` | a chips group | `{ value, label }`, none |
| `sg:treeselect`, `sg:treetoggle` | a tree | `{ item, label }`, `{ item, open }` |
| `sg:command` | a palette | `{ option, value, label }` |
| `sg:splitchange` | `sg-split` | `{ show }` |
| `sg:themechange`, `sg:densitychange`, `sg:hapticschange` | `<html>` | `{ theme }`, `{ density }`, `{ on }` |

## 11. Content and copy

- Sentence case everywhere: "New record", never "New Record" or "NEW RECORD".
- Buttons name their result: a verb and an object, with a count when they act on many ("Approve 3 records").
- Say what happened, then what to do: "3 records could not be saved. The citizen ID is missing. Add it to each marked record and save again."
- Confirmations are plain: "3 records approved." No exclamation marks, no "Oops", no "Success!", no emoji.
- Name the comparison period for every change: "Up 6.2% on August".
- Use the formats in section 4, and let `Intl.NumberFormat` and `Intl.DateTimeFormat` handle digits and separators for the page language.
- Write "Empty" for a value that does not exist, never a dash alone.

## 12. Choosing a component

| Need | Use | Not |
|---|---|---|
| The next step on a view | one `sg-button--primary` | several primaries |
| Go somewhere | a link | a button |
| One choice of 2 to 7, all visible | radios | a select |
| One choice of about 4 to 15 | `sg-select` | radios |
| One choice of more than about 15 | `sg-combobox` | a long select |
| A date, or a from–to range | `type="date"`, `sg-date-range` | a calendar widget, three selects |
| An on/off setting that applies at once | `sg-switch` | a checkbox |
| Two to five views of the same data | `sg-segmented` | buttons that look selected |
| Sections of one object, compared in turn | `sg-tabs` | a segmented control |
| Attach documents | `sg-upload` | a bare file input |
| Many records to act on | a grid with `data-selectable` | cards |
| Act on several selected rows | `sg-bulkbar` under the table | a toolbar that appears above the rows |
| Show which filters narrow a list | `sg-chips` | a sentence, or nothing |
| A record's state | `sg-status` | `sg-tag`, colored text |
| Time left until a reply or a resolution is due | `sg-sla` | a red date, a bare countdown |
| Change one field of a record where it sits | `sg-edit` in a `sg-kv` | an "Edit" page for one value |
| Who else is on this ticket | `sg-avatar-group` beside a sentence | avatars with no names anywhere |
| How old something is | `<time data-sg-relative>` | a hand-written "5 min ago" that never updates |
| Output from a job or a device | `sg-log` | a `<pre>` that jumps while someone reads |
| A hash, an address, a key, a command | `sg-mono` or `sg-code` | interface text in a proportional face |
| A stable category | `sg-tag` | `sg-status` |
| The details of one record | `sg-kv` in a `sg-panel` | a two-column table |
| What changed in a record | `sg-diff` with a provenance line | green and red highlights |
| One headline figure, or a few | `sg-stats` | a chart with one bar |
| A trend or a comparison | `Stingray.chart()` | a hand-drawn SVG |
| A metric over time with many points: latency, load, errors per minute | `Stingray.timeseries()` | a line chart with a category per minute |
| A chart Stingray does not draw, or a look the designer prefers to Stingray's | a vendored library in `Stingray.chart()` with `type: 'custom'` and `Stingray.chartTheme()` | the library's own frame, legend and colors |
| A ratio against a limit | `sg-meter` | a progress bar |
| A job longer than about two seconds | `sg-progress` | a spinner with no count |
| Waiting with no count to show | `sg-loader` | a spinning icon |
| A table loading for the first time | `sg-skeleton` rows | a blank frame or a spinner |
| Nothing to show | `sg-empty` with one way out | a blank table |
| A condition on the whole page | `sg-banner` | a toast |
| An incident affecting everyone | `sg-banner--prominent`, once | several prominent banners |
| A reversible action succeeded | `Stingray.toast()` with Undo | a dialog |
| Confirm an irreversible action | `sg-dialog--danger` with the impact list | a toast |
| Details beside a list, filters beside results | `sg-drawer` | a new page, a dialog |
| Three to eight actions on one object | `sg-menu` | a row of many buttons |
| A choice that leads to its own short list | a submenu | a second menu button beside the first |
| Shortcuts on a row or a canvas | a context menu, `data-sg-context`, with the same actions elsewhere | a right-click as the only way |
| A few fields or facts tied to one button | `sg-popover` | a dialog for three checkboxes |
| A preview of a person or record on a link | `sg-hovercard` | a tooltip with a link in it |
| A value inside known limits, picked by feel | `sg-slider`; `sg-slider--range` for a band | a field with spin buttons |
| Play a recording | `sg-audio` | a bare `<audio controls>` in a styled page |
| A recording in a message | `sg-audio--compact` | a file attachment |
| Record from the microphone | `sg-voice` | a recording that starts on page load |
| What a voice agent is doing | `sg-orb` with the state in words | an animated gradient |
| An agent is working, no count to show | `sg-shimmer` | a loader beside the reply |
| A task in three to six steps | `sg-stepper` | tabs |
| Long record sections read one at a time | `sg-accordion` | nested panels |
| A hierarchy deeper than two levels | `sg-tree` | indented links |
| Jump to any record or action by name | `sg-palette` | a menu with every command |
| The top of a page: title, actions, facts | `sg-page-header` | a heading and a toolbar built by hand |
| A list beside the item it opens: an inbox, settings | `sg-split` | two panels side by side, a custom grid |
| Peers to browse at a glance: offices, reports, saved views | `sg-cards` of `sg-card` | a table, a panel per item |
| Rows that are each one control: an inbox, a picker | `sg-list` with `data-sg-list` | a table with row hover |
| A transcript, long messages, an assistant's answers | `sg-thread sg-thread--list` | bubbles stretched to full width |
| A note only the team sees | a `sg-card--note` in the thread | a message bubble in another color |
| A file on a message | `sg-attachment`: a preview, the name and the size | a bare file name, or a preview of a document |
| Answer one message in particular | the reply button on the message and the reply card (`sg-card--reply`) | the quoted text pasted into the reply |
| Change, pin or remove a note | the options menu on the note card (`data-sg-note`) | buttons that show only on hover |
| Send a reply without the agent's name | the signature toggle in `sg-composer` | a setting on a profile page |
| Write a reply or a note | `sg-composer` | a bare textarea and a button |
| An action with a few variants | a split button: `sg-button-group` with a `sg-menu` | three buttons in a row |
| Several tickets open at once | `sg-tabs` with `sg-tab__close` | a new browser window per ticket |
| A wide queue | `sg-table--pin-first`, a column chooser, resizable headers | a table cut off at the window edge |
| Two more facts about a row | an expandable row | a dialog |
| A conversation | `sg-thread` of `sg-message` | a table of messages, bubbles colored per person |
| Whether a person can answer now | `data-presence` on `sg-avatar` | a colored dot alone |
| Someone is typing | `sg-typing` | a loader |

## 13. Extending Stingray for one product

A product will need things Stingray does not ship: a page layout, a domain widget, a product-specific chart, sometimes a departure from a Default. You MAY build them, within these limits.

**You MAY:**

- Write page layout (CSS grid, flex, widths, breakpoints in rem) in your own CSS.
- Create a product component when no Stingray component covers the need.
- Set a component token on a container to adapt a component in one place, as long as the value is another Stingray token: `.orders-queue { --sg-button-tertiary-icon: var(--sg-color-text-primary); }`.
- Add MingCute icons through `tools/icons.txt`.
- Add product statuses by mapping each to one of the existing meanings, with its own word.

**Every extension MUST:**

1. Use its own prefix, the product's short name (`orders-`, `reg-`), never `sg-`. The `sg-` namespace belongs to Stingray.
2. Read only Stingray tokens: semantic colors, the spacing steps, the radius tiers, type tokens, elevation and motion. No raw values of any kind, except layout widths and breakpoints.
3. Obey every Required rule in section 2, and follow the Defaults unless an allowed variation applies or the product records an exception.
4. Work in light and dark and in all three densities, with no extra code per theme.
5. Be built from Stingray parts where they exist. A "record summary card" is a `sg-kv` in a `sg-panel`, not a new box with new borders.
6. Carry a one-line comment above its CSS saying why no Stingray component fits.

**You MUST NOT, even in an extension:**

- Restyle a `sg-` class, or use `!important` or deep selectors against one.
- Write a raw color, shadow or duration in component or page CSS.
- Edit `tokens/tokens.css`, or this file's generated section, by hand. A new token goes in `tokens/tokens.json` with a `$description` of 30 or more characters, then `node tools/build.mjs`, which must pass.

```css
/* orders: a two-pane layout, list left and preview right; no Stingray layout component covers it */
.orders-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(20rem, 1fr);
  gap: var(--sg-space-6);
}
@media (max-width: 60rem) { .orders-layout { grid-template-columns: minmax(0, 1fr); } }
```

### Recording an exception

A Default may not fit a product: channels that people know by their brand colors, a second font for a legal document. Depart from it on purpose and in writing. Keep a `DESIGN-EXCEPTIONS.md` beside the product's code, with one row per departure: the rule id, what the product does instead, and why. Before adding a row, check the allowed variations (V1 to V5): what they cover needs no entry. Required rules cannot have entries.

```markdown
# DESIGN-EXCEPTIONS.md: Helpdesk

Departures from Stingray's Defaults. Everything else follows DESIGN.md.

| Rule | What Helpdesk does instead | Why |
|---|---|---|
| C8 | Each channel's glyph (WhatsApp, email, SMS) is in its brand color, from product tokens `--helpdesk-channel-*` declared once with light and dark values, each 3:1 on its surface. Only the 16px glyph; never a fill, a row or text. | Agents triage by channel at a glance, and customers know the brand colors. The channel's name is always beside the glyph (C6). |
```

- A color the product adds is a token with its prefix (`--helpdesk-channel-whatsapp`), declared once in the product's own CSS with a light and a dark value, and read everywhere else by name (C1). Check it at 3:1 against the surface it sits on, or 4.5:1 for text.
- An entry covers one rule in one place. "C8, everywhere" is not an exception; it is a different design.
- An assistant that departs from a Default adds the row itself, and says so in one line.

## 14. When unsure

- If you are unsure how to lay out a page, start from the closest recipe in section 9.
- If a class, token, attribute, event, icon or function is not in this file, it does not exist. Say so, and use the closest listed one or build a prefixed extension under section 13.
- Never fill a gap with a value that "looks right". A made-up token fails silently and renders wrong.
- If a request conflicts with a Required rule, follow the rule and state in one line which one applies.
- If a request conflicts with a Default ("make the header blue", "add a zebra table"), check the allowed variations first. If none covers it, follow the Default and name it, unless the person asks for the departure or the product's `DESIGN-EXCEPTIONS.md` already records it; then do it, and add or cite the row.
- If two rules seem to conflict, the order is: Required rules, then the product's recorded exceptions, then the Defaults and allowed variations, then the component rules in section 8.

## 15. Check before you output

**Required**

- [ ] Four files linked; `class="sg"` on `<body>`; `lang` on `<html>`; the skip link first; one `<h1>`, one `<main>`, a label on every `<nav>`.
- [ ] Every `sg-` class appears in section 16; every other class has the product prefix; no `sg-` class is restyled.
- [ ] No hex, rgb or named colors, no primitive color tokens, no `box-shadow` values and no hard-coded durations.
- [ ] Every margin, padding and gap is a `--sg-space-*` token or comes from a layout helper.
- [ ] Every status has its word; every icon-only button has `aria-label` and `data-sg-tip`; every input has a visible label; links in text are underlined.
- [ ] Composite widgets keep one tab stop; nothing is reachable only by hover; every loop stands still under reduced motion.
- [ ] Every destination is reachable at every width, and a navigation that opens over the page is modal (A9).
- [ ] Works in light and dark and in all three densities without extra code.

**Defaults** (each departure is an allowed variation, or has a row in `DESIGN-EXCEPTIONS.md`)

- [ ] Every page opens with `sg-page-header`; blue only for actions, selection and location; the current location never solid blue.
- [ ] At most two tiers of navigation.
- [ ] One primary button per view (or per pane, V3), every button named for its result.
- [ ] No `font-family`; weights 400 and 600 only; no italics; no uppercase outside the classification banner.
- [ ] No nested raised surfaces; cards only in `sg-cards` (V1); groups divided by space, hairlines only between rows; no row hover or zebra stripes in data tables; no gap above 64px.
- [ ] Every stat, chart and record diff has a provenance line.
- [ ] Dates use `type="date"`; long lists use `sg-combobox`; transitions at most 240ms (320ms for large panels); only live activity loops.

## 16. Reference

Everything below is generated by `node tools/build.mjs` from `tokens/tokens.json` and `css/stingray.css`. It is exact: use these values and names as written.

<!-- generated:start -->
<!-- Generated by tools/build.mjs from tokens/tokens.json and css/stingray.css. Do not edit by hand: run node tools/build.mjs. -->

### Color tokens (semantic)

Read these in product CSS. Values are light and dark; "same" means one value for both themes.

| Token | Light | Dark | Use |
|---|---|---|---|
| `--sg-color-action-primary` | #0759e6 | #296be7 | Fill of the primary button: one per view. |
| `--sg-color-action-primary-hover` | #0143b5 | #0759e6 | Primary button fill under the pointer. |
| `--sg-color-action-primary-pressed` | #043388 | #0143b5 | Primary button fill while pressed. |
| `--sg-color-action-on-primary` | #ffffff | same | Label on primary and danger buttons. |
| `--sg-color-action-danger` | #d63330 | same | Fill of buttons that delete or cannot be undone. |
| `--sg-color-action-danger-hover` | #9f000e | same | Danger button fill under the pointer. |
| `--sg-color-action-danger-pressed` | #7a0008 | same | Danger button fill while pressed. |
| `--sg-color-action-disabled` | #efefef | #383838 | Fill of a disabled button of any kind. |
| `--sg-color-action-on-disabled` | #858585 | same | Label on a disabled button of any kind. |
| `--sg-color-text-primary` | #171717 | #f2f2f2 | Body text, headings and values. |
| `--sg-color-text-secondary` | #333333 | #cdcdcd | Labels, secondary values and legends. |
| `--sg-color-text-tertiary` | #4d4d4d | #c2c2c2 | Help text, timestamps and axis labels. |
| `--sg-color-text-disabled` | #858585 | same | Text and labels of disabled controls. |
| `--sg-color-text-inverse` | #ffffff | #151515 | Text on tooltips and the classification banner. |
| `--sg-color-text-link` | #0143b5 | #c5daff | Links, which are always underlined as well. |
| `--sg-color-text-link-hover` | #043388 | #e1ecff | Link text while the pointer is over it. |
| `--sg-color-text-on-brand` | #ffffff | #151515 | Text on the brand fill: white in light, near-black in dark, 7:1 either way. |
| `--sg-color-icon-secondary` | #6e6e6e | #9a9a9a | Decorative and supporting icons, 3:1 or better on every surface. Also the 'nobody needs to act' status glyph. |
| `--sg-color-surface-page` | #fdfdfd | #151515 | The page canvas behind everything. |
| `--sg-color-surface-sunken` | #f3f3f3 | #0e0e0e | A tray one step below the page that holds raised surfaces, such as the demo frames in the docs. Darker than the canvas in both themes, so it reads as lower, like Atlassian's sunken surface. Rejects: using it as a second page color. |
| `--sg-color-surface-raised` | #ffffff | #1c1c1c | Panels, tables and charts: one level above the page. |
| `--sg-color-surface-field` | #ffffff | #2c2c2c | Fill of inputs, selects, checkboxes and switches: white in light, and one step above the dim canvas in dark, as in DeepSeek. |
| `--sg-color-surface-inset` | #efefef | #0e0e0e | Recessed wells, like the segmented-control track. |
| `--sg-color-surface-subtle` | #f7f7f7 | #333333 | Bands inside a panel: table headers, code, toolbars. |
| `--sg-color-surface-overlay` | #ffffff | #333333 | Menus, dialogs, drawers and toasts. |
| `--sg-color-surface-inverse` | #171717 | #f2f2f2 | Tooltips and the classification banner. |
| `--sg-color-surface-hover` | #f7f7f7 | #333333 | Items under the pointer on a raised surface. |
| `--sg-color-surface-pressed` | #e2e2e2 | #444444 | Items and buttons while they are pressed. |
| `--sg-color-surface-item-hover` | #e2e2e2 | #383838 | Hover on borderless items (tertiary buttons, navigation, pagination): one clear gray step in both themes. Rejects: the 50 step, which vanishes against the light canvas. |
| `--sg-color-surface-item-pressed` | #d6d6d6 | #444444 | Borderless items while pressed: one step past their hover fill, in both themes. |
| `--sg-color-surface-overlay-hover` | #e2e2e2 | #444444 | Items on an overlay (menu, submenu, context menu) under the pointer or keyboard focus: one clear step above the overlay in both themes. Rejects: the selected fill, which sits too close to a dark overlay to be seen. |
| `--sg-color-surface-overlay-pressed` | #d6d6d6 | #505050 | Items on an overlay while pressed: one more step past their hover, so the press is seen. |
| `--sg-color-surface-raised-hover` | #ffffff | #333333 | A raised control under the pointer. Unchanged in light, where the darker border alone says hover; one step lighter in dark, where a border change is too faint. |
| `--sg-color-surface-raised-pressed` | #efefef | #444444 | A raised control while pressed. One gray step in light, where a button has no shadow to lose; two steps lighter in dark. |
| `--sg-color-surface-selected` | #efefef | #383838 | A quiet gray fill: hover on menus and options, tags. The selected item itself takes the brand tint, current. |
| `--sg-color-surface-current` | #e1ecff | #1d2535 | The current page, tab and step, and the selected row or item: a light tint of the brand. A location is tinted; an action is solid. |
| `--sg-color-surface-note` | #fff0d3 | #3e2d15 | Internal notes: text only the team sees, as a card in a thread or in a composer. An amber tint, always with the words 'Internal note' and a glyph, so it is never told by color alone. Rejects: using it for warnings, which have the banner. |
| `--sg-color-surface-brand` | #0143b5 | #a0c2fe | A small brand fill that asks to be looked at: the strong count. Carries 12px text at 7:1 in both themes. |
| `--sg-color-surface-scrim` | rgba(23, 23, 23, 0.56) | rgba(0, 0, 0, 0.72) | Dims the page behind a dialog or drawer. |
| `--sg-color-surface-transparent` | transparent | same | For controls that take the surface they sit on. |
| `--sg-color-border-subtle` | #e2e2e2 | rgba(255, 255, 255, 0.12) | Row dividers and hairlines. In dark it is a translucent white, so the same line reads on the page, on a panel and on a menu or a dialog. Rejects: one solid dark step, which vanishes on the overlay surface. |
| `--sg-color-border-default` | #c8c8c8 | #444444 | Outlines of panels, menus and chart axes. |
| `--sg-color-border-control` | #858585 | same | Boundaries of inputs, checkboxes and selects. |
| `--sg-color-border-control-hover` | #333333 | #cdcdcd | Control boundaries under the pointer. |
| `--sg-color-border-strong` | #171717 | #cdcdcd | Ink marks: the current item in the side navigation and done steps. |
| `--sg-color-border-current` | #0759e6 | #669cfe | The short brand bar beside the current or selected item: 3:1 or better on the tint, the canvas and raised surfaces. |
| `--sg-color-border-overlay-hover` | #c8c8c8 | #5c5c5c | The edge of an item highlighted on an overlay (a menu, a combobox list, the command palette): one step out from its fill, so the highlight reads as a shape. Decorative; the brand bar beside it carries the state. |
| `--sg-color-border-note` | #fed098 | #6c4401 | The outline of an internal-note card: one step deeper than the note tint, so the card keeps an edge on any surface. Decorative: the words and the glyph say what it is. |
| `--sg-color-border-disabled` | #c8c8c8 | #444444 | Boundaries of disabled controls. |
| `--sg-color-focus-ring` | #171717 | #f2f2f2 | The focus ring on every focusable element. |
| `--sg-color-focus-ring-inverse` | #ffffff | #151515 | The focus ring on inverse surfaces. |
| `--sg-color-code-background` | #1c1c1c | same | The code block fill: the dark raised step, in both themes. |
| `--sg-color-code-border` | #383838 | same | The code block edge: one step off its fill, so the frame reads in dark mode too. |
| `--sg-color-code-text` | #f2f2f2 | same | Code text on the dark block, the dark theme primary text step. |
| `--sg-color-code-comment` | #c2c2c2 | same | Comments in code, the dark theme tertiary step: quieter, still 7:1. |
| `--sg-color-code-literal` | #a0c2fe | same | Strings and numbers in code: the one hue, the dark theme link step. |
| `--sg-color-code-warning` | #ffb755 | same | Warning lines in a log, on the dark block in both themes: amber, with the word WARN. |
| `--sg-color-code-error` | #ffb2a8 | same | Error lines in a log, on the dark block in both themes: red, with the word ERROR. |
| `--sg-color-feedback-success-icon` | #008442 | #6bdb8f | Success icons and status bars. |
| `--sg-color-feedback-success-text` | #01592b | #9fefb5 | Text of inline success messages. |
| `--sg-color-feedback-success-solid` | #008442 | same | Fill of solid success badges and banners. |
| `--sg-color-feedback-success-on-solid` | #ffffff | same | Label on a solid success fill. |
| `--sg-color-feedback-warning-icon` | #b5770a | #ffb755 | Warning icons and status bars. |
| `--sg-color-feedback-warning-text` | #6c4401 | #fed098 | Text of inline warning messages. |
| `--sg-color-feedback-warning-solid` | #ffb755 | same | Fill of the prominent warning banner. |
| `--sg-color-feedback-warning-on-solid` | #171717 | same | Label on a solid warning fill. Always dark. |
| `--sg-color-feedback-error-icon` | #d63330 | #ffb2a8 | Error icons and status bars in banners. |
| `--sg-color-feedback-error-text` | #9f000e | #fecbc4 | Text of inline error messages. |
| `--sg-color-feedback-error-solid` | #d63330 | same | Fill of the prominent error banner and counters. |
| `--sg-color-feedback-error-on-solid` | #ffffff | same | Label on a solid error fill. Always white. |
| `--sg-color-feedback-error-tint` | #fef1ef | #3b1f1e | A destructive item under the pointer or focus: a red wash, so it never highlights like the items around it. |
| `--sg-color-feedback-error-tint-pressed` | #fde6e2 | #4d2523 | A destructive item while pressed: one step more. |
| `--sg-color-feedback-info-icon` | #0759e6 | #a0c2fe | Information icons and status bars. |
| `--sg-color-feedback-info-text` | #0143b5 | #c5daff | Text of inline information messages. |
| `--sg-color-feedback-info-solid` | #0759e6 | #296be7 | Fill of solid information badges. |
| `--sg-color-feedback-info-on-solid` | #ffffff | same | Label on a solid information fill. |
| `--sg-color-avatar-1-from` | #faf1dc | same | Avatar 1 (sunrise) base: the cream the gradient rests on. |
| `--sg-color-avatar-1-via` | #ffbc64 | same | Avatar 1 (sunrise) first bloom: an amber that glows from one side. |
| `--sg-color-avatar-1-to` | #ff81b6 | same | Avatar 1 (sunrise) second bloom: a pink that glows from another. |
| `--sg-color-avatar-2-from` | #eeedfb | same | Avatar 2 (mist) base: the lavender white the gradient rests on. |
| `--sg-color-avatar-2-via` | #96a2fe | same | Avatar 2 (mist) first bloom: a periwinkle that glows from one side. |
| `--sg-color-avatar-2-to` | #feb8df | same | Avatar 2 (mist) second bloom: a rose that glows from another. |
| `--sg-color-avatar-3-from` | #6ddbff | same | Avatar 3 (holo) base: the sky the gradient rests on. |
| `--sg-color-avatar-3-via` | #ff8acf | same | Avatar 3 (holo) first bloom: a pink that glows from one side. |
| `--sg-color-avatar-3-to` | #ffd16b | same | Avatar 3 (holo) second bloom: an amber that glows from another. |
| `--sg-color-avatar-4-from` | #e5f0fc | same | Avatar 4 (prism) base: the cool white the gradient rests on. |
| `--sg-color-avatar-4-via` | #f08bf6 | same | Avatar 4 (prism) first bloom: an orchid that glows from one side. |
| `--sg-color-avatar-4-to` | #44f5c0 | same | Avatar 4 (prism) second bloom: an aqua green that glows from another. |
| `--sg-color-avatar-5-from` | #fef2f1 | same | Avatar 5 (coral) base: the blush white the gradient rests on. |
| `--sg-color-avatar-5-via` | #ff7e77 | same | Avatar 5 (coral) first bloom: a coral that glows from one side. |
| `--sg-color-avatar-5-to` | #febebd | same | Avatar 5 (coral) second bloom: a salmon that glows from another. |
| `--sg-color-avatar-6-from` | #faea89 | same | Avatar 6 (candy) base: the lemon the gradient rests on. |
| `--sg-color-avatar-6-via` | #ff7997 | same | Avatar 6 (candy) first bloom: a hot pink that glows from one side. |
| `--sg-color-avatar-6-to` | #5de8f6 | same | Avatar 6 (candy) second bloom: an aqua that glows from another. |
| `--sg-color-avatar-7-from` | #e8fbeb | same | Avatar 7 (mint) base: the mint white the gradient rests on. |
| `--sg-color-avatar-7-via` | #3bf998 | same | Avatar 7 (mint) first bloom: a neon mint that glows from one side. |
| `--sg-color-avatar-7-to` | #5ff3de | same | Avatar 7 (mint) second bloom: an aqua that glows from another. |
| `--sg-color-avatar-8-from` | #f5e9fe | same | Avatar 8 (lilac) base: the pale lilac the gradient rests on. |
| `--sg-color-avatar-8-via` | #bb91ff | same | Avatar 8 (lilac) first bloom: a violet that glows from one side. |
| `--sg-color-avatar-8-to` | #85d2fe | same | Avatar 8 (lilac) second bloom: a sky that glows from another. |
| `--sg-color-avatar-9-from` | #f7f0c2 | same | Avatar 9 (peach) base: the pale lemon the gradient rests on. |
| `--sg-color-avatar-9-via` | #ffa666 | same | Avatar 9 (peach) first bloom: an orange that glows from one side. |
| `--sg-color-avatar-9-to` | #ff8fb4 | same | Avatar 9 (peach) second bloom: a pink that glows from another. |
| `--sg-color-avatar-10-from` | #cefae9 | same | Avatar 10 (lagoon) base: the pale mint the gradient rests on. |
| `--sg-color-avatar-10-via` | #3fe4ec | same | Avatar 10 (lagoon) first bloom: an aqua that glows from one side. |
| `--sg-color-avatar-10-to` | #8ea5fe | same | Avatar 10 (lagoon) second bloom: a periwinkle that glows from another. |
| `--sg-color-avatar-text` | #171717 | same | Initials on an avatar gradient: ink in both themes, 7:1 on every stop. |
| `--sg-color-avatar-rim` | rgba(23, 23, 23, 0.12) | same | A fine rim inside an avatar, so a gradient that fades to white keeps its edge on a light page. |
| `--sg-color-status-act` | #0759e6 | #a0c2fe | The person looking at the screen must act (open, in progress). |
| `--sg-color-status-idle` | #6e6e6e | #9a9a9a | Nobody needs to act: waiting on a third party, or closed. |
| `--sg-color-status-done` | #008442 | #6bdb8f | Finished: green, the one 'nothing left to do' hue, always with the check-circle glyph. Rejects: green for 'active', the common 'go' reading. |
| `--sg-color-status-risk` | #b5770a | #ffb755 | Time or SLA at risk: amber, always with the triangle glyph. Rejects: amber for 'pending', which would spend the warning hue on the normal case. |
| `--sg-color-status-breach` | #d63330 | #ffb2a8 | Time or SLA breached: red, always with the octagon glyph. Red never means anything gentler than breach or error. |
| `--sg-color-severity-critical` | #d63330 | #ffb2a8 | Four of four bars in red: the top of the ordinal scale, sharing the error hue so severity and breach read as one family of alarm. |
| `--sg-color-severity-high` | #b5770a | #ffb755 | Three of four bars in amber. Rejects: orange, a third alarm hue too close to both red and amber. |
| `--sg-color-severity-medium` | #6e6e6e | #9a9a9a | Two bars, neutral. Rejects: yellow for medium, which spends hue on the normal case. |
| `--sg-color-severity-low` | #6e6e6e | #9a9a9a | One of four bars, neutral. Low and medium share a color and differ by bar count, so the ordinal scale never depends on hue. |
| `--sg-color-severity-track` | #c8c8c8 | #444444 | The unfilled bars, so the total of four is always visible. |

### Data visualization colors

Charts drawn by `Stingray.chart()` already use these. Read them only for a product-specific chart, under "Extending Stingray", with the same rules.

| Token | Light | Dark | Use |
|---|---|---|---|
| `--sg-color-data-categorical-1` | #0759e6 | #669cfe | Slot 1 is the brand blue: the default and the only series in single-series charts. |
| `--sg-color-data-categorical-2` | #eb6834 | #d95926 | Slot 2, orange: the warm counterpart to blue, so the first two series separate in grayscale and under color-blindness. Rejects: red, reserved for error. |
| `--sg-color-data-categorical-3` | #1baf7a | #199e70 | Slot 3, aqua: a green-cyan that separates from orange by lightness under color-blindness. Below 3:1 on white, so it always has direct labels and a table view. |
| `--sg-color-data-categorical-4` | #eda100 | #c98500 | Slot 4: the last slot Stingray allows in one chart. Series 3 and 4 are below 3:1 on white, so they always carry direct labels and a table view. |
| `--sg-color-data-categorical-5` | #e87ba4 | #d55181 | Slot 5 (token ceiling; not used in charts). |
| `--sg-color-data-categorical-6` | #008300 | same | Slot 6, green: identical in both modes because it already sits inside both lightness bands. Token ceiling; unused in charts. |
| `--sg-color-data-categorical-7` | #4a3aa7 | #9085e9 | Slot 7, violet: the deep, cool counterpart to slot 5. Token ceiling; unused in charts. |
| `--sg-color-data-categorical-8` | #e34948 | #e66767 | Slot 8, red: last in the order so it is rarely seen, and never for a series that means 'bad' (that uses status tokens). Token ceiling. |
| `--sg-color-data-sequential-1` | #e1ecff | #08265d | Lowest magnitude. The scale flips in dark so 'low' recedes toward the surface in both themes. |
| `--sg-color-data-sequential-2` | #c5daff | #043388 | Step 2 of 7 (blue 200 on light): about .07 lighter than step 3, so the low end of a heatmap still separates cell by cell. |
| `--sg-color-data-sequential-3` | #a0c2fe | #0143b5 | Step 3 of 7 (blue 300 on light): the last step that clears 1.8:1 on white, so it still reads as a filled cell rather than a gap. |
| `--sg-color-data-sequential-4` | #669cfe | #296be7 | Step 4 of 7, the midpoint: blue 400 on light, blue 500 on dark. Sequential has no neutral middle; that is what diverging is for. |
| `--sg-color-data-sequential-5` | #296be7 | #669cfe | Step 5 of 7: blue 500 on light, 400 on dark. Rejects: the brand step (600), which sits only .04 lightness from 500 and would merge with it. |
| `--sg-color-data-sequential-6` | #0143b5 | #a0c2fe | Step 6 of 7. Skips 600 because 500 and 600 are only .04 apart in lightness. |
| `--sg-color-data-sequential-7` | #08265d | #c5daff | Highest magnitude: blue 900 on light, blue 200 on dark. The highest value is always the strongest mark against the page. |
| `--sg-color-data-ordinal-1` | #669cfe | #0143b5 | Stage 1, the lowest rank: blue 400 on light (2.7:1 on white, over the 2:1 ordinal floor). Rejects: a paler first stage, which recedes into the page. |
| `--sg-color-data-ordinal-2` | #0759e6 | #296be7 | Stage 2: the brand blue on light, so the first strong step of an ordinal chart is the brand color. |
| `--sg-color-data-ordinal-3` | #0143b5 | #669cfe | Stage 3: blue 700, at least .06 lightness from both neighbors so adjacent stages never blur. |
| `--sg-color-data-ordinal-4` | #043388 | #a0c2fe | Stage 4: blue 800, chosen over 900 to keep the darkest step free for stage 5. |
| `--sg-color-data-ordinal-5` | #08265d | #c5daff | Stage 5, the highest rank: blue 900 on light, blue 200 on dark. The scale flips in dark so rank still reads as prominence. |
| `--sg-color-data-diverging-positive` | #0759e6 | #669cfe | Above the baseline: the brand blue, so the cool arm is always the 'more' side. Rejects: green, which implies good. |
| `--sg-color-data-diverging-negative` | #eb6834 | #d95926 | Below the baseline. Rejects: red, which would read as 'bad' when the data only says 'lower'. |
| `--sg-color-data-context` | #858585 | same | Everything that is not the point: the de-emphasized series in an emphasis chart, and 'Other'. 3:1 or better so it stays a mark, not a ghost. |
| `--sg-color-data-grid` | #e2e2e2 | rgba(255, 255, 255, 0.12) | Gridlines: solid 1px hairlines, one step off the surface. Rejects: dashed grids, which read as thresholds. |
| `--sg-color-data-axis` | #c8c8c8 | #444444 | Baseline and axis rule: the default border, one visible step above gridlines, so the zero line is findable without competing with data. Rejects: ink axes, which outweigh thin marks. |
| `--sg-color-data-texture-ink` | #171717 | #f2f2f2 | Hatch lines at 45 and 135 degrees over a series color, used only in print, forced-colors mode and when a viewer turns texture on. Darkens on light, lightens on dark. |

### Spacing

The eight steps of the 4pt grid, and the named spacing roles built from them. Nothing else is a legal gap, margin or padding.

| Token | Value | Use |
|---|---|---|
| `--sg-space-0` | 0px | Touching. Table cells share hairlines rather than gaps. |
| `--sg-space-1` | 4px | The atom of the grid: icon-to-label in dense UI, label-to-control. Nothing smaller exists. Rejects: 2px half-steps, which invite optical fudging and break the strict grid. |
| `--sg-space-2` | 8px | Default gap between related controls; table cell padding. Rejects: 6px, off-grid. |
| `--sg-space-3` | 12px | Control side padding. The one odd multiple: 8 is tight and 16 loose for a 36px control. Rejects: 10px and 14px. |
| `--sg-space-4` | 16px | Panel padding and the gap between form fields. Rejects: 20px, which is neither a control gap nor a section gap. |
| `--sg-space-6` | 24px | Dialog padding and the gap between field groups. |
| `--sg-space-8` | 32px | Gap between sections on a page. Rejects: 40px. |
| `--sg-space-12` | 48px | Major separation and page top offset. |
| `--sg-space-16` | 64px | The maximum. Beyond this, space is compensating for missing structure: add a rule, regroup, or reflow. Rejects: 80, 96 and 160px steps. |
| `--sg-space-inset-control` | 12px | Horizontal padding of buttons, inputs and selects. |
| `--sg-space-inset-cell` | 8px | Table cell padding (dense uses the density token). |
| `--sg-space-inset-panel` | 16px | Padding of panels, banners, toasts and menus. |
| `--sg-space-inset-dialog` | 24px | Padding of dialogs: the largest inset, because dialogs interrupt. |
| `--sg-space-stack-related` | 4px | Label to control, control to help text. |
| `--sg-space-stack-field` | 16px | Gap between form fields (16px): enough that a label attaches unambiguously to its own control, tight enough that a form fits one screen. Rejects: 24px between fields. |
| `--sg-space-stack-group` | 24px | Between groups of fields or paragraphs in a panel. |
| `--sg-space-stack-section` | 32px | Gap between page sections (32px), the largest routine gap. Larger separation is a rule or a new page, not more space. |
| `--sg-space-inline-tight` | 4px | Between an icon and dense text. |
| `--sg-space-inline-icon` | 8px | Between an icon and its label. |
| `--sg-space-inline-control` | 8px | Gap between adjacent buttons (8px): keeps dense 28px controls from sharing a hit area. |

### Size, radius, stroke and focus

| Token | Value | Use |
|---|---|---|
| `--sg-size-16` | 16px | Icon beside 12px text; status glyph; checkbox box. |
| `--sg-size-20` | 20px | Default icon; tag height; switch track height. |
| `--sg-size-24` | 24px | Large icon, classification banner height, and the minimum pointer target (WCAG 2.5.8 AA). |
| `--sg-size-28` | 28px | Dense row and small control. 4px above the 24px minimum so 4px-spaced dense controls never share a target. |
| `--sg-size-36` | 36px | Standard row and control height: a 20px line with 8px above and below, all on the grid. Rejects: 32px, which leaves a 14px label 6px of air, and 40px, which shows about 10% fewer rows per screen. |
| `--sg-size-44` | 44px | Relaxed control: the 44px touch target (WCAG 2.5.5 AAA). |
| `--sg-size-48` | 48px | Relaxed row height: a 24px line with 12px above and below. Rejects: 56px rows, which cost another 14% of the rows on screen for no gain (44px already meets WCAG 2.5.5). |
| `--sg-size-icon-small` | 16px | Beside 12px text; status glyphs. |
| `--sg-size-icon-medium` | 20px | Default icon size (20px), matched to 14px text with a 20px line, so an icon never grows the line box. Rejects: 24px inline icons. |
| `--sg-size-icon-large` | 24px | Large icon (24px) for empty states, headers and the classification glyph: the size MingCute icons are drawn on, so strokes are never resampled. |
| `--sg-size-target-minimum` | 24px | The smallest pointer target anywhere (WCAG 2.5.8 AA). |
| `--sg-size-control-small` | 28px | Fixed small control, independent of density. |
| `--sg-size-control-large` | 44px | Fixed large control: the touch target. |
| `--sg-size-tag` | 20px | Tag and small badge height (20px): a 12px label on a 16px line with the remaining 4px split evenly. Rejects: 24px tags, which read as buttons. |
| `--sg-radius-mark` | 3px | Tag, kbd, checkbox, inline code, and the hover shape of a tab, nav item or menu item: small things get a small corner. Rejects: one radius for everything. |
| `--sg-radius-control` | 4px | Button, input, select and the segmented thumb. Rejects: 8px on every control, and square corners, which read as dated. |
| `--sg-radius-float` | 8px | Menu, popover, toast, banner, chart tip and message bubble: the control radius plus the 4px padding of a menu, so an item in its corner is concentric with it. Rejects: 12px, which read as a bubble on a small surface. |
| `--sg-radius-container` | 8px | Panel, card, table frame, code block, dialog, drawer and stat strip: the same radius as a floating surface, twice a control's. Rejects: square containers, and 16px, which wasted corners in dense views. |
| `--sg-radius-track` | 6px | The segmented track: the control radius plus the 2px inset, so the thumb stays concentric. Rejects: the float radius, which leaves a gap at the thumb's corners. |
| `--sg-radius-round` | 9999px | Dots, avatars, the switch and meter tracks: the fully round shapes, because their meaning is a point, a person or a level. Rejects: pill buttons. |
| `--sg-stroke-hairline` | 1px | Dividers and control borders at 1px: the thinnest line that renders identically at every device pixel ratio. Rejects: 0.5px hairlines. |
| `--sg-stroke-rule` | 2px | Tab and nav location markers, and the focus ring. |
| `--sg-focus-width` | 2px | 2px: WCAG 2.4.13 minimum thickness. |
| `--sg-focus-offset` | 2px | 2px gap so the ring never merges with a filled control. |

### Type styles

Each style is three tokens: `--sg-type-{style}-size`, `-line` and `-weight`, and one class: `sg-type-{style}`.

| Style | Size / line / weight | Use |
|---|---|---|
| `hero` | 48px / 56px / 400 / -0.02em | The hero figure, one per view, at 48/56 regular with tight tracking. |
| `display` | 40px / 48px / 400 / -0.02em | Report and cover titles at 40/48 regular with tight tracking: size carries the hierarchy, so weight can stay calm. Rejects: weights under 400, which thin out on low-DPI screens and in print. |
| `heading-1` | 32px / 40px / 400 / -0.02em | Page title in product and stat values, at 32/40 regular with tight tracking. |
| `heading-2` | 24px / 32px / 600 / -0.01em | Section headings at 24/32 regular with snug tracking. Rejects: a heading the same size as a stat value; section titles must be quieter than the data. |
| `heading-3` | 20px / 28px / 600 | Headings inside a section and drawer titles at 20/28: the smallest size that still reads as a heading above 14px body text. Rejects: small uppercase headings. |
| `heading-4` | 16px / 24px / 600 | Panel titles, dialog titles and empty-state titles at 16/24. |
| `body-large` | 16px / 24px / 400 | Long-form prose at 16/24: the 1.5 ratio WCAG 1.4.12 tests, and comfortable to about 70 characters a line. Rejects: 18px prose in a data product. |
| `body` | 14px / 20px / 400 | Default UI text at 14/20: dense enough for a full table, large enough to hold 7:1. Rejects: 13px, which needs its own line height, and 16px as the UI default. |
| `body-strong` | 14px / 20px / 600 | Field labels and emphasis at 14/20 semibold. Emphasis is weight only. Rejects: italics, underline and color. |
| `label` | 12px / 16px / 600 / 0.01em | Table headers, tags, group headings. |
| `caption` | 12px / 16px / 400 / 0.01em | Help text, meta and provenance at 12/16 regular. Never below 12px and always 7:1. Rejects: the 10 to 11px captions of legal print. |

### Density

Set `data-density` on `<html>` or any container. Standard is the default. These tokens change together; never set them one by one.

| Token | Dense | Standard | Relaxed |
|---|---|---|---|
| `--sg-density-row-height` | 28px | 36px | 48px |
| `--sg-density-control-height` | 28px | 36px | 44px |
| `--sg-density-font-size` | 12px | 14px | 16px |
| `--sg-density-line-height` | 16px | 20px | 24px |
| `--sg-density-cell-x` | 8px | 12px | 16px |
| `--sg-density-icon-size` | 16px | 20px | 20px |
| `--sg-density-gap` | 4px | 8px | 12px |

### Elevation, motion and layers

Motion durations resolve to 0ms under `prefers-reduced-motion`.

| Token | Light | Dark | Use |
|---|---|---|---|
| `--sg-elevation-raised` | 0 0 1px 0 rgba(23, 23, 23, 0.06), 0 1px 2px 0 rgba(23, 23, 23, 0.05) | inset 0 1px 0 0 rgba(255, 255, 255, 0.04), 0 0 1px 0 rgba(0, 0, 0, 0.32), 0 1px 2px 0 rgba(0, 0, 0, 0.24) | Panels, table frames, chart frames and secondary buttons: static surfaces one step above the canvas. Rejects: a heavier shadow on something that never moves. |
| `--sg-elevation-overlay` | 0 0 1px 0 rgba(23, 23, 23, 0.08), 0 4px 12px 0 rgba(23, 23, 23, 0.08) | inset 0 1px 0 0 rgba(255, 255, 255, 0.05), 0 0 1px 0 rgba(0, 0, 0, 0.40), 0 4px 12px 0 rgba(0, 0, 0, 0.32) | Menus, popovers, toasts: things that float over content and can cover it. |
| `--sg-elevation-modal` | 0 0 1px 0 rgba(23, 23, 23, 0.08), 0 12px 32px 0 rgba(23, 23, 23, 0.12) | inset 0 1px 0 0 rgba(255, 255, 255, 0.05), 0 0 1px 0 rgba(0, 0, 0, 0.40), 0 12px 32px 0 rgba(0, 0, 0, 0.44) | Dialogs: the only level-3 surface, heavier and wider than overlay so a modal reads as an interruption. Rejects: colored shadows. |
| `--sg-motion-duration-state` | 100ms | same | Hover, press and focus feedback use the fast duration. Rejects: animating color changes on data, which is distracting in a table. |
| `--sg-motion-duration-reveal` | 160ms | same | Menus, tabs and disclosure use the base duration: long enough to see the origin, short enough never to be waited on. |
| `--sg-motion-duration-overlay` | 240ms | same | Dialogs and scrims use the slow duration, the longest a transition takes. Rejects: page transitions. |
| `--sg-motion-duration-panel` | 320ms | same | Large panels that move or resize: a drawer, a side panel. The only transition allowed past 240ms. |
| `--sg-motion-duration-loop` | 1400ms | same | One cycle of a live-activity loop: typing, recording, playing media, the loader. It becomes 0ms under reduced motion, so the loop stops. |
| `--sg-motion-duration-stagger` | 30ms | same | The delay between rows of a list that arrives for the first time. Never on sort or filter. |
| `--sg-motion-wait` | 300ms | same | The pause before a skeleton or a busy label shows; a done label holds for twice this. Not motion, so reduced motion keeps it. |
| `--sg-motion-spin` | 800ms | same | One turn of the loader ring. It sits outside the durations on purpose: under reduced motion they drop to zero, but a ring that stops looks stuck, so the loader turns at half speed instead. |
| `--sg-motion-fade` | 100ms | same | The cross-fade that replaces movement under reduced motion: an overlay fades in where it would have slid or grown. It sits outside the durations on purpose, so reduced motion still says something appeared instead of popping it in. Opacity only. |
| `--sg-motion-easing-enter` | cubic-bezier(0.2, 0, 0, 1) | same | Elements entering decelerate into place, so the move ends gently and nothing appears to overshoot. Rejects: springs and bounce. |
| `--sg-motion-easing-exit` | cubic-bezier(0.4, 0, 1, 1) | same | Elements leaving accelerate away so dismissal feels immediate. Rejects: symmetric easing, which makes closing feel as slow as opening. |
| `--sg-motion-easing-move` | cubic-bezier(0.45, 0, 0.55, 1) | same | Elements that move from one place to another on screen: a switch knob, a thumb, an indicator. |
| `--sg-layer-sticky` | 100 | same | Sticky table headers and bars. |
| `--sg-layer-overlay` | 200 | same | Overlays that are not in the top layer, above sticky bars. Rejects: z-index competition between components. |
| `--sg-layer-toast` | 300 | same | The toast region sits above sticky bars and overlays so a confirmation is never buried. |
| `--sg-layer-tooltip` | 400 | same | Tooltips are the topmost layer: they explain something already visible, so nothing may cover them. |

### Breakpoints

CSS custom properties cannot be used in media queries, so write these values in `rem`, or use `@include sg-breakpoint-up(md)` from `tokens/_tokens.scss`.

| Name | Width | rem |
|---|---|---|
| sm | 640px | 40rem |
| md | 960px | 60rem |
| lg | 1280px | 80rem |
| xl | 1600px | 100rem |

### Component tokens

Every component reads only its own tokens, each an alias of a semantic token. Set one on a container to adapt a component in one place, always to another Stingray token (see "Extending Stingray"). Format: `--sg-{component}-{name}` = the semantic token it aliases.

- **page**: `background`=`--sg-color-surface-page`, `text`=`--sg-color-text-primary`
- **focus**: `ring`=`--sg-color-focus-ring`
- **panel**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `shadow`=`--sg-elevation-raised`
- **link**: `text`=`--sg-color-text-link`, `text-hover`=`--sg-color-text-link-hover`
- **control**: `height`=`--sg-density-control-height`, `height-small`=`--sg-size-control-small`, `height-large`=`--sg-size-control-large`, `padding-x`=`--sg-space-inset-control`, `gap`=`--sg-density-gap`, `icon-size`=`--sg-density-icon-size`, `radius`=`--sg-radius-control`, `border-width`=`--sg-stroke-hairline`, `font-size`=`--sg-density-font-size`, `line-height`=`--sg-density-line-height`
- **button**: `primary-background`=`--sg-color-action-primary`, `primary-background-hover`=`--sg-color-action-primary-hover`, `primary-background-pressed`=`--sg-color-action-primary-pressed`, `primary-text`=`--sg-color-action-on-primary`, `secondary-background`=`--sg-color-surface-raised`, `secondary-background-hover`=`--sg-color-surface-raised-hover`, `secondary-background-pressed`=`--sg-color-surface-raised-pressed`, `secondary-border`=`--sg-color-border-default`, `secondary-border-hover`=`--sg-color-border-control`, `secondary-text`=`--sg-color-text-primary`, `tertiary-background`=`--sg-color-surface-transparent`, `tertiary-background-hover`=`--sg-color-surface-item-hover`, `tertiary-background-pressed`=`--sg-color-surface-item-pressed`, `tertiary-text`=`--sg-color-text-link`, `tertiary-text-hover`=`--sg-color-text-link-hover`, `tertiary-icon`=`--sg-color-text-secondary`, `tertiary-icon-hover`=`--sg-color-text-primary`, `danger-background`=`--sg-color-action-danger`, `danger-background-hover`=`--sg-color-action-danger-hover`, `danger-background-pressed`=`--sg-color-action-danger-pressed`, `danger-text`=`--sg-color-action-on-primary`, `disabled-background`=`--sg-color-action-disabled`, `disabled-border`=`--sg-color-border-disabled`, `disabled-text`=`--sg-color-action-on-disabled`
- **input**: `background`=`--sg-color-surface-field`, `background-readonly`=`--sg-color-surface-subtle`, `background-disabled`=`--sg-color-surface-subtle`, `text`=`--sg-color-text-primary`, `text-disabled`=`--sg-color-text-disabled`, `placeholder`=`--sg-color-text-tertiary`, `border`=`--sg-color-border-default`, `border-hover`=`--sg-color-border-control`, `border-focus`=`--sg-color-focus-ring`, `border-error`=`--sg-color-feedback-error-icon`, `border-disabled`=`--sg-color-border-disabled`, `label`=`--sg-color-text-primary`, `help`=`--sg-color-text-tertiary`, `error-text`=`--sg-color-feedback-error-text`, `error-icon`=`--sg-color-feedback-error-icon`
- **choice**: `border`=`--sg-color-border-control`, `border-hover`=`--sg-color-border-control-hover`, `background`=`--sg-color-surface-field`, `background-checked`=`--sg-color-action-primary`, `border-checked`=`--sg-color-action-primary`, `mark`=`--sg-color-action-on-primary`, `background-disabled`=`--sg-color-surface-subtle`, `border-disabled`=`--sg-color-border-disabled`, `mark-disabled`=`--sg-color-text-disabled`, `label`=`--sg-color-text-primary`, `label-disabled`=`--sg-color-text-disabled`
- **switch**: `background`=`--sg-color-surface-field`, `track`=`--sg-color-border-control`, `track-checked`=`--sg-color-action-primary`, `thumb`=`--sg-color-action-on-primary`, `track-disabled`=`--sg-color-action-disabled`, `thumb-disabled`=`--sg-color-text-disabled`
- **tag**: `background`=`--sg-color-surface-selected`, `text`=`--sg-color-text-secondary`
- **status**: `act`=`--sg-color-status-act`, `idle`=`--sg-color-status-idle`, `done`=`--sg-color-status-done`, `risk`=`--sg-color-status-risk`, `breach`=`--sg-color-status-breach`, `text`=`--sg-color-text-primary`
- **severity**: `critical`=`--sg-color-severity-critical`, `high`=`--sg-color-severity-high`, `medium`=`--sg-color-severity-medium`, `low`=`--sg-color-severity-low`, `track`=`--sg-color-severity-track`
- **avatar**: `background`=`--sg-color-surface-item-hover`, `text`=`--sg-color-text-secondary`, `gradient-text`=`--sg-color-avatar-text`, `rim`=`--sg-color-avatar-rim`, `gradient-1-from`=`--sg-color-avatar-1-from`, `gradient-1-via`=`--sg-color-avatar-1-via`, `gradient-1-to`=`--sg-color-avatar-1-to`, `gradient-2-from`=`--sg-color-avatar-2-from`, `gradient-2-via`=`--sg-color-avatar-2-via`, `gradient-2-to`=`--sg-color-avatar-2-to`, `gradient-3-from`=`--sg-color-avatar-3-from`, `gradient-3-via`=`--sg-color-avatar-3-via`, `gradient-3-to`=`--sg-color-avatar-3-to`, `gradient-4-from`=`--sg-color-avatar-4-from`, `gradient-4-via`=`--sg-color-avatar-4-via`, `gradient-4-to`=`--sg-color-avatar-4-to`, `gradient-5-from`=`--sg-color-avatar-5-from`, `gradient-5-via`=`--sg-color-avatar-5-via`, `gradient-5-to`=`--sg-color-avatar-5-to`, `gradient-6-from`=`--sg-color-avatar-6-from`, `gradient-6-via`=`--sg-color-avatar-6-via`, `gradient-6-to`=`--sg-color-avatar-6-to`, `gradient-7-from`=`--sg-color-avatar-7-from`, `gradient-7-via`=`--sg-color-avatar-7-via`, `gradient-7-to`=`--sg-color-avatar-7-to`, `gradient-8-from`=`--sg-color-avatar-8-from`, `gradient-8-via`=`--sg-color-avatar-8-via`, `gradient-8-to`=`--sg-color-avatar-8-to`, `gradient-9-from`=`--sg-color-avatar-9-from`, `gradient-9-via`=`--sg-color-avatar-9-via`, `gradient-9-to`=`--sg-color-avatar-9-to`, `gradient-10-from`=`--sg-color-avatar-10-from`, `gradient-10-via`=`--sg-color-avatar-10-via`, `gradient-10-to`=`--sg-color-avatar-10-to`
- **kbd**: `background`=`--sg-color-surface-subtle`, `border`=`--sg-color-border-default`, `text`=`--sg-color-text-primary`
- **banner**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-subtle`, `title`=`--sg-color-text-primary`, `text`=`--sg-color-text-secondary`, `rule-neutral`=`--sg-color-border-strong`, `info`=`--sg-color-feedback-info-icon`, `success`=`--sg-color-feedback-success-icon`, `warning`=`--sg-color-feedback-warning-icon`, `error`=`--sg-color-feedback-error-icon`, `solid-warning`=`--sg-color-feedback-warning-solid`, `solid-error`=`--sg-color-feedback-error-solid`, `on-solid-warning`=`--sg-color-feedback-warning-on-solid`, `on-solid-error`=`--sg-color-feedback-error-on-solid`
- **classification**: `background`=`--sg-color-surface-inverse`, `text`=`--sg-color-text-inverse`, `ring`=`--sg-color-focus-ring-inverse`
- **toast**: `background`=`--sg-color-surface-overlay`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `stub-background`=`--sg-color-surface-inset`, `perforation`=`--sg-color-border-default`, `time`=`--sg-color-text-tertiary`, `rule-neutral`=`--sg-color-border-strong`, `info`=`--sg-color-feedback-info-icon`, `success`=`--sg-color-feedback-success-icon`, `warning`=`--sg-color-feedback-warning-icon`, `error`=`--sg-color-feedback-error-icon`, `shadow`=`--sg-elevation-overlay`
- **dialog**: `background`=`--sg-color-surface-overlay`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `well`=`--sg-color-surface-inset`, `footer-background`=`--sg-color-surface-subtle`, `keys`=`--sg-color-text-secondary`, `info`=`--sg-color-feedback-info-icon`, `warning`=`--sg-color-feedback-warning-icon`, `error`=`--sg-color-feedback-error-icon`, `scrim`=`--sg-color-surface-scrim`, `shadow`=`--sg-elevation-modal`
- **drawer**: `background`=`--sg-color-surface-overlay`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `meta`=`--sg-color-text-secondary`, `label`=`--sg-color-text-tertiary`, `divider`=`--sg-color-border-subtle`, `scrim`=`--sg-color-surface-scrim`, `shadow`=`--sg-elevation-modal`
- **menu**: `background`=`--sg-color-surface-overlay`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `text-disabled`=`--sg-color-text-disabled`, `icon`=`--sg-color-icon-secondary`, `item-hover`=`--sg-color-surface-overlay-hover`, `item-pressed`=`--sg-color-surface-overlay-pressed`, `item-hover-border`=`--sg-color-border-overlay-hover`, `indicator`=`--sg-color-border-current`, `danger`=`--sg-color-feedback-error-text`, `danger-icon`=`--sg-color-feedback-error-icon`, `danger-hover`=`--sg-color-feedback-error-tint`, `danger-pressed`=`--sg-color-feedback-error-tint-pressed`, `danger-indicator`=`--sg-color-feedback-error-icon`, `description`=`--sg-color-text-tertiary`, `header`=`--sg-color-text-primary`, `header-meta`=`--sg-color-text-tertiary`, `divider`=`--sg-color-border-subtle`, `shortcut`=`--sg-color-text-secondary`, `shortcut-hover`=`--sg-color-text-primary`, `shortcut-background`=`--sg-color-surface-subtle`, `shortcut-border`=`--sg-color-border-default`, `shortcut-border-hover`=`--sg-color-border-control`, `submenu`=`--sg-color-icon-secondary`, `shadow`=`--sg-elevation-overlay`
- **tooltip**: `background`=`--sg-color-surface-inverse`, `text`=`--sg-color-text-inverse`
- **tabs**: `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-secondary`, `text-hover`=`--sg-color-text-primary`, `text-selected`=`--sg-color-text-primary`, `indicator`=`--sg-color-border-current`, `item-hover`=`--sg-color-surface-selected`, `close`=`--sg-color-icon-secondary`, `close-hover`=`--sg-color-surface-item-pressed`, `close-hover-icon`=`--sg-color-text-primary`
- **segmented**: `background`=`--sg-color-surface-inset`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-secondary`, `text-hover`=`--sg-color-text-primary`, `selected-background`=`--sg-color-surface-raised`, `selected-border`=`--sg-color-border-control`, `selected-text`=`--sg-color-text-primary`, `selected-shadow`=`--sg-elevation-raised`
- **table**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-subtle`, `header-background`=`--sg-color-surface-subtle`, `header-text`=`--sg-color-text-secondary`, `header-border`=`--sg-color-border-default`, `changed`=`--sg-color-surface-selected`, `row-divider`=`--sg-color-border-subtle`, `row-selected`=`--sg-color-surface-current`, `text`=`--sg-color-text-primary`, `text-secondary`=`--sg-color-text-secondary`, `selection-bar`=`--sg-color-border-current`, `sort-icon`=`--sg-color-icon-secondary`, `sort-icon-active`=`--sg-color-text-primary`, `expand-icon`=`--sg-color-icon-secondary`, `detail-background`=`--sg-color-surface-subtle`, `resizer`=`--sg-color-border-control`, `pin-border`=`--sg-color-border-default`, `shadow`=`--sg-elevation-raised`, `row-height`=`--sg-density-row-height`, `cell-x`=`--sg-density-cell-x`, `font-size`=`--sg-density-font-size`, `line-height`=`--sg-density-line-height`
- **pagination**: `text`=`--sg-color-text-link`, `text-current`=`--sg-color-text-primary`, `background-current`=`--sg-color-surface-current`, `indicator`=`--sg-color-border-current`, `text-disabled`=`--sg-color-text-disabled`
- **breadcrumb**: `text`=`--sg-color-text-link`, `text-current`=`--sg-color-text-primary`, `separator`=`--sg-color-icon-secondary`
- **nav**: `text`=`--sg-color-text-secondary`, `text-current`=`--sg-color-text-primary`, `item-hover`=`--sg-color-surface-item-hover`, `current-background`=`--sg-color-surface-raised`, `current-border`=`--sg-color-border-subtle`, `indicator`=`--sg-color-border-strong`, `heading`=`--sg-color-text-tertiary`, `current-shadow`=`--sg-elevation-raised`
- **stat**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-subtle`, `label`=`--sg-color-text-secondary`, `value`=`--sg-color-text-primary`, `delta-good`=`--sg-color-feedback-success-text`, `delta-bad`=`--sg-color-feedback-error-text`, `delta-neutral`=`--sg-color-text-secondary`, `divider`=`--sg-color-border-subtle`, `shadow`=`--sg-elevation-raised`
- **meter**: `track`=`--sg-color-border-subtle`, `fill`=`--sg-color-icon-secondary`, `fill-risk`=`--sg-color-status-risk`, `fill-breach`=`--sg-color-feedback-error-solid`
- **timeline**: `line`=`--sg-color-border-default`, `text`=`--sg-color-text-primary`, `meta`=`--sg-color-text-tertiary`, `minor`=`--sg-color-text-secondary`, `icon`=`--sg-color-icon-secondary`, `done`=`--sg-color-status-done`, `kind-background`=`--sg-color-surface-raised`, `kind-border`=`--sg-color-border-default`, `kind-ring`=`--sg-color-surface-raised`, `kind-reply-background`=`--sg-color-surface-current`, `kind-reply-icon`=`--sg-color-border-current`, `kind-note-background`=`--sg-color-surface-note`, `kind-note-border`=`--sg-color-border-note`, `kind-note-icon`=`--sg-color-feedback-warning-icon`, `card-background`=`--sg-color-surface-raised`, `card-border`=`--sg-color-border-subtle`, `note-background`=`--sg-color-surface-note`, `note-border`=`--sg-color-border-note`, `chip-background`=`--sg-color-surface-subtle`, `chip-border`=`--sg-color-border-subtle`, `rule`=`--sg-color-border-subtle`
- **kv**: `label`=`--sg-color-text-secondary`, `value`=`--sg-color-text-primary`, `divider`=`--sg-color-border-subtle`, `edit-hover`=`--sg-color-surface-item-hover`, `edit-icon`=`--sg-color-icon-secondary`
- **provenance**: `text`=`--sg-color-text-tertiary`, `separator`=`--sg-color-icon-secondary`
- **chart**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-subtle`, `shadow`=`--sg-elevation-raised`, `axis`=`--sg-color-data-axis`, `grid`=`--sg-color-data-grid`, `label`=`--sg-color-text-tertiary`, `value`=`--sg-color-text-primary`, `legend`=`--sg-color-text-secondary`, `context`=`--sg-color-data-context`, `gap`=`--sg-color-surface-raised`, `track`=`--sg-color-border-subtle`, `chip-background`=`--sg-color-surface-subtle`, `chip-border`=`--sg-color-border-subtle`, `chip-icon`=`--sg-color-icon-secondary`, `good`=`--sg-color-feedback-success-icon`, `bad`=`--sg-color-feedback-error-icon`, `tip-background`=`--sg-color-surface-overlay`, `tip-border`=`--sg-color-border-subtle`, `tip-text`=`--sg-color-text-primary`, `tip-context`=`--sg-color-text-tertiary`, `tip-name`=`--sg-color-text-secondary`, `tip-divider`=`--sg-color-border-subtle`, `tip-foot-background`=`--sg-color-surface-subtle`, `tip-shadow`=`--sg-elevation-overlay`, `texture-ink`=`--sg-color-data-texture-ink`, `series-1`=`--sg-color-data-categorical-1`, `series-2`=`--sg-color-data-categorical-2`, `series-3`=`--sg-color-data-categorical-3`, `series-4`=`--sg-color-data-categorical-4`, `series-5`=`--sg-color-data-categorical-5`, `series-6`=`--sg-color-data-categorical-6`, `series-7`=`--sg-color-data-categorical-7`, `series-8`=`--sg-color-data-categorical-8`, `seq-1`=`--sg-color-data-sequential-1`, `seq-2`=`--sg-color-data-sequential-2`, `seq-3`=`--sg-color-data-sequential-3`, `seq-4`=`--sg-color-data-sequential-4`, `seq-5`=`--sg-color-data-sequential-5`, `seq-6`=`--sg-color-data-sequential-6`, `seq-7`=`--sg-color-data-sequential-7`, `ord-1`=`--sg-color-data-ordinal-1`, `ord-2`=`--sg-color-data-ordinal-2`, `ord-3`=`--sg-color-data-ordinal-3`, `ord-4`=`--sg-color-data-ordinal-4`, `ord-5`=`--sg-color-data-ordinal-5`, `positive`=`--sg-color-data-diverging-positive`, `negative`=`--sg-color-data-diverging-negative`
- **loader**: `color`=`--sg-color-border-current`
- **empty**: `icon`=`--sg-color-icon-secondary`, `title`=`--sg-color-text-primary`, `text`=`--sg-color-text-secondary`
- **code**: `background`=`--sg-color-surface-selected`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`
- **code-block**: `background`=`--sg-color-code-background`, `border`=`--sg-color-code-border`, `text`=`--sg-color-code-text`, `comment`=`--sg-color-code-comment`, `literal`=`--sg-color-code-literal`
- **combobox**: `background`=`--sg-color-surface-overlay`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `meta`=`--sg-color-text-tertiary`, `meta-active`=`--sg-color-text-primary`, `group`=`--sg-color-text-tertiary`, `option-active`=`--sg-color-surface-overlay-hover`, `option-active-border`=`--sg-color-border-overlay-hover`, `indicator`=`--sg-color-border-current`, `match`=`--sg-color-border-current`, `check`=`--sg-color-border-current`, `empty`=`--sg-color-text-secondary`, `footer-background`=`--sg-color-surface-subtle`, `footer-border`=`--sg-color-border-subtle`, `footer-text`=`--sg-color-text-tertiary`, `shadow`=`--sg-elevation-overlay`
- **upload**: `background`=`--sg-color-surface-field`, `border`=`--sg-color-border-control`, `border-hover`=`--sg-color-border-control-hover`, `border-drop`=`--sg-color-border-strong`, `background-drop`=`--sg-color-surface-selected`, `icon`=`--sg-color-icon-secondary`, `text`=`--sg-color-text-secondary`, `action`=`--sg-color-text-link`, `file-text`=`--sg-color-text-primary`, `file-meta`=`--sg-color-text-tertiary`, `file-divider`=`--sg-color-border-subtle`
- **stepper**: `marker-border`=`--sg-color-border-default`, `marker-text`=`--sg-color-text-tertiary`, `marker-current`=`--sg-color-surface-current`, `marker-current-border`=`--sg-color-border-current`, `marker-current-text`=`--sg-color-text-primary`, `marker-done-border`=`--sg-color-border-strong`, `marker-done-icon`=`--sg-color-text-primary`, `label`=`--sg-color-text-secondary`, `label-current`=`--sg-color-text-primary`, `meta`=`--sg-color-text-tertiary`, `line`=`--sg-color-border-default`, `line-done`=`--sg-color-border-strong`
- **bulkbar**: `background`=`--sg-color-surface-overlay`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `shadow`=`--sg-elevation-overlay`
- **chip**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-default`, `text`=`--sg-color-text-primary`, `key`=`--sg-color-text-secondary`, `remove`=`--sg-color-icon-secondary`, `remove-hover`=`--sg-color-surface-selected`
- **accordion**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-subtle`, `divider`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `meta`=`--sg-color-text-tertiary`, `icon`=`--sg-color-icon-secondary`, `summary-hover`=`--sg-color-surface-hover`, `shadow`=`--sg-elevation-raised`
- **diff**: `before`=`--sg-color-text-secondary`, `after`=`--sg-color-text-primary`, `none`=`--sg-color-text-tertiary`
- **scrollbar**: `thumb`=`--sg-color-border-control`, `thumb-hover`=`--sg-color-icon-secondary`
- **count**: `background`=`--sg-color-surface-pressed`, `text`=`--sg-color-text-primary`, `strong-background`=`--sg-color-surface-brand`, `strong-text`=`--sg-color-text-on-brand`
- **progress**: `track`=`--sg-color-border-subtle`, `fill`=`--sg-color-text-primary`, `fill-done`=`--sg-color-feedback-success-icon`, `fill-error`=`--sg-color-feedback-error-icon`, `busy`=`--sg-color-icon-secondary`, `label`=`--sg-color-text-primary`, `count`=`--sg-color-text-secondary`
- **skeleton**: `fill`=`--sg-color-border-subtle`
- **palette**: `background`=`--sg-color-surface-overlay`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `meta`=`--sg-color-text-tertiary`, `group`=`--sg-color-text-tertiary`, `icon`=`--sg-color-icon-secondary`, `meta-active`=`--sg-color-text-primary`, `option-active`=`--sg-color-surface-overlay-hover`, `option-active-border`=`--sg-color-border-overlay-hover`, `indicator`=`--sg-color-border-current`, `match`=`--sg-color-border-current`, `divider`=`--sg-color-border-subtle`, `footer-background`=`--sg-color-surface-subtle`, `scrim`=`--sg-color-surface-scrim`, `shadow`=`--sg-elevation-modal`
- **tree**: `text`=`--sg-color-text-primary`, `toggle`=`--sg-color-icon-secondary`, `icon`=`--sg-color-icon-secondary`, `item-hover`=`--sg-color-surface-item-hover`, `item-selected`=`--sg-color-surface-current`, `selection-bar`=`--sg-color-border-current`, `guide`=`--sg-color-border-default`
- **list**: `title`=`--sg-color-text-primary`, `preview`=`--sg-color-text-secondary`, `meta`=`--sg-color-text-tertiary`, `item-hover`=`--sg-color-surface-item-hover`, `item-pressed`=`--sg-color-surface-item-pressed`, `item-selected`=`--sg-color-surface-current`, `selection-bar`=`--sg-color-border-current`, `divider`=`--sg-color-border-subtle`
- **card**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-subtle`, `border-hover`=`--sg-color-border-control`, `title`=`--sg-color-text-primary`, `meta`=`--sg-color-text-tertiary`, `text`=`--sg-color-text-secondary`, `divider`=`--sg-color-border-subtle`, `note-background`=`--sg-color-surface-note`, `note-border`=`--sg-color-border-note`, `note-text`=`--sg-color-text-primary`, `note-meta`=`--sg-color-text-secondary`, `reply-background`=`--sg-color-surface-subtle`, `reply-bar`=`--sg-color-border-current`, `reply-title`=`--sg-color-text-primary`, `reply-text`=`--sg-color-text-secondary`, `shadow`=`--sg-elevation-raised`
- **message**: `in-background`=`--sg-color-surface-raised`, `in-border`=`--sg-color-border-subtle`, `out-background`=`--sg-color-surface-current`, `text`=`--sg-color-text-primary`, `author`=`--sg-color-text-primary`, `meta`=`--sg-color-text-tertiary`, `status`=`--sg-color-icon-secondary`, `status-read`=`--sg-color-status-done`, `divider`=`--sg-color-border-subtle`, `divider-text`=`--sg-color-text-tertiary`, `list-band`=`--sg-color-surface-subtle`, `target`=`--sg-color-border-current`
- **presence**: `online`=`--sg-color-status-done`, `away`=`--sg-color-status-risk`, `busy`=`--sg-color-status-breach`, `offline`=`--sg-color-status-idle`, `ring`=`--sg-color-surface-raised`
- **typing**: `dot`=`--sg-color-icon-secondary`, `text`=`--sg-color-text-tertiary`
- **page-header**: `title`=`--sg-color-text-primary`, `meta`=`--sg-color-text-secondary`
- **split**: `background`=`--sg-color-surface-raised`, `border`=`--sg-color-border-subtle`, `divider`=`--sg-color-border-subtle`, `canvas`=`--sg-color-surface-page`, `shadow`=`--sg-elevation-raised`
- **popover**: `background`=`--sg-color-surface-overlay`, `border`=`--sg-color-border-subtle`, `text`=`--sg-color-text-primary`, `meta`=`--sg-color-text-secondary`, `divider`=`--sg-color-border-subtle`, `shadow`=`--sg-elevation-overlay`
- **slider**: `track`=`--sg-color-border-default`, `fill`=`--sg-color-action-primary`, `thumb`=`--sg-color-surface-raised`, `thumb-border`=`--sg-color-action-primary`, `disabled`=`--sg-color-border-disabled`, `value`=`--sg-color-text-secondary`, `thumb-shadow`=`--sg-elevation-raised`
- **audio**: `bar`=`--sg-color-border-default`, `bar-played`=`--sg-color-action-primary`, `time`=`--sg-color-text-secondary`
- **voice**: `level`=`--sg-color-action-primary`, `recording`=`--sg-color-feedback-error-solid`, `time`=`--sg-color-text-secondary`
- **orb**: `core`=`--sg-color-action-primary`, `halo`=`--sg-color-surface-current`, `ring`=`--sg-color-border-current`
- **shimmer**: `text`=`--sg-color-text-tertiary`, `peak`=`--sg-color-text-primary`
- **sla**: `text`=`--sg-color-text-primary`, `label`=`--sg-color-text-tertiary`, `ok`=`--sg-color-status-idle`, `risk`=`--sg-color-status-risk`, `breach`=`--sg-color-status-breach`, `met`=`--sg-color-status-done`, `paused`=`--sg-color-status-idle`
- **composer**: `background`=`--sg-color-surface-field`, `border`=`--sg-color-border-default`, `text`=`--sg-color-text-primary`, `placeholder`=`--sg-color-text-tertiary`, `note-background`=`--sg-color-surface-note`, `toggle-text`=`--sg-color-text-secondary`, `toggle-text-hover`=`--sg-color-text-primary`, `shadow`=`--sg-elevation-raised`
- **attachment**: `background`=`--sg-color-surface-subtle`, `border`=`--sg-color-border-subtle`, `name`=`--sg-color-text-primary`, `meta`=`--sg-color-text-tertiary`, `thumb-background`=`--sg-color-surface-selected`, `icon`=`--sg-color-icon-secondary`, `play-background`=`--sg-color-surface-inverse`, `play-icon`=`--sg-color-text-inverse`, `remove-background`=`--sg-color-surface-raised`, `remove-border`=`--sg-color-border-control`, `remove-icon`=`--sg-color-text-primary`, `remove-hover`=`--sg-color-surface-item-hover`
- **avatar-group**: `ring`=`--sg-color-surface-raised`, `more-background`=`--sg-color-surface-item-hover`, `more-text`=`--sg-color-text-primary`
- **log**: `background`=`--sg-color-code-background`, `border`=`--sg-color-code-border`, `text`=`--sg-color-code-text`, `time`=`--sg-color-code-comment`, `warning`=`--sg-color-code-warning`, `error`=`--sg-color-code-error`, `line-hover`=`--sg-color-code-border`

### Class index

Every class css/stingray.css defines, 443 in all, plus `sg` on `<body>` and `sg-icon--{name}` for each icon in section 6. Parts are `__part`, variants are `--variant`. A class not in this list does not exist.

- `sg`: the root class, on `<body>` only
- `sg-accordion`: `--flush` `__body` `__item` `__meta` `__summary`
- `sg-attachment`: `--video` `__body` `__meta` `__name` `__remove` `__thumb`
- `sg-audio`: `--compact` `__bar` `__play` `__seek` `__time` `__wave` `__wave--rail`
- `sg-avatar`
- `sg-avatar-group`: `__more`
- `sg-banner`: `--error` `--info` `--prominent` `--success` `--warning` `__actions` `__body` `__icon` `__title`
- `sg-breadcrumb`
- `sg-bulkbar`: `__count`
- `sg-button`: `--danger` `--icon` `--large` `--primary` `--small` `--tertiary` `__states`
- `sg-button-group`
- `sg-card`: `--link` `--note` `--reply` `__body` `__footer` `__media` `__meta` `__title`
- `sg-cards`
- `sg-chart`: `--bare` `--part` `__arc` `__area` `__axis` `__canvas` `__caption` `__cell` `__cell--empty` `__center` `__change` `__cross` `__desc` `__dot` `__figure` `__foot` `__grid` `__head` `__hit` `__key` `__key-value` `__legend` `__line` `__mark` `__plot` `__ramp` `__slice` `__svg` `__swatch` `__swatch--line` `__swatch-svg` `__target` `__tex-base` `__tex-ink` `__tick` `__tip` `__tip-context` `__tip-foot` `__tip-head` `__tip-key` `__tip-name` `__tip-row` `__tip-rows` `__tip-title` `__tip-value` `__title` `__total` `__track` `__value` (drawn by stingray.js; never write this markup by hand)
- `sg-chip`: `__key` `__label` `__remove`
- `sg-chips`
- `sg-choice`: `--locked` `__input` `__label`
- `sg-classification`
- `sg-cluster`: `--loose` `--tight`
- `sg-code`: `__comment` `__keyword` `__literal`
- `sg-code-block`
- `sg-combobox`: `__count` `__footer` `__lead` `__list` `__meta` `__option`
- `sg-composer`: `__attachments` `__bar` `__hint` `__input` `__toggle` `__tools`
- `sg-count`: `--strong`
- `sg-date-range`: `__fields` `__presets` `__sep`
- `sg-dialog`: `--danger` `--info` `--warning` `__body` `__emblem` `__footer` `__header` `__impact` `__keys` `__title`
- `sg-diff`: `__none`
- `sg-drawer`: `--large` `--small` `--start` `__actions` `__body` `__eyebrow` `__footer` `__header` `__heading` `__keys` `__position` `__section-title` `__sep` `__subtitle` `__title`
- `sg-edit`: `__control` `__value` `__view`
- `sg-empty`: `__icon` `__text` `__title`
- `sg-field`: `__error` `__help` `__label`
- `sg-hovercard`: `__head`
- `sg-icon`: `--small` `--medium` `--large`
- `sg-icon-swap`
- `sg-input`: `--code`
- `sg-input-group`: `__icon`
- `sg-kbd`
- `sg-kv`
- `sg-link`
- `sg-list`: `--plain` `__body` `__item` `__meta` `__preview` `__title`
- `sg-loader`: `--large`
- `sg-log`: `__latest` `__level` `__line` `__lines` `__text` `__time`
- `sg-match`
- `sg-menu`: `__context` `__description` `__divider` `__header` `__item` `__item--danger` `__shortcut` `__text` `__title`
- `sg-message`: `--continued` `--out` `__attachments` `__author` `__body` `__head` `__reply` `__status` `__time`
- `sg-meter`: `--large` `__fill`
- `sg-mono`
- `sg-nav`: `__heading` `__link` `__list` `__text`
- `sg-no-print`
- `sg-num`
- `sg-num-end`
- `sg-orb`: `--large`
- `sg-page-header`: `__actions` `__meta` `__title`
- `sg-pagination`: `__item` `__list` `__range`
- `sg-palette`: `__empty` `__footer` `__list` `__meta` `__option` `__search`
- `sg-panel`: `--flush` `__title`
- `sg-popover`: `__body` `__footer` `__header` `__meta` `__title`
- `sg-progress`: `__fill` `__head` `__label` `__track` `__value`
- `sg-prose`
- `sg-provenance`
- `sg-segmented`: `--fill` `__input` `__item`
- `sg-select`
- `sg-severity`: `--large` `--small`
- `sg-shimmer`
- `sg-skeleton`
- `sg-skip`
- `sg-sla`: `--large` `--small` `__label` `__time`
- `sg-slider`: `--range` `__input` `__track` `__value`
- `sg-spark` (drawn by stingray.js; never write this markup by hand)
- `sg-split`: `__aside` `__back` `__body` `__foot` `__head` `__list` `__main` `__main--canvas`
- `sg-sr-only`
- `sg-stack`: `--group` `--related` `--section`
- `sg-stat`: `--hero` `__delta` `__delta--bad` `__delta--good` `__label` `__trend` `__value`
- `sg-stats`
- `sg-status`: `--breach` `--closed` `--error` `--info` `--large` `--open` `--pending` `--progress` `--resolved` `--risk` `--small` `--success` `--warning`
- `sg-stepper`: `__label` `__link` `__list` `__marker` `__meta` `__step` `__text`
- `sg-switch`: `__input`
- `sg-tab`: `__close`
- `sg-table`: `--pin-first` `--two-line` `__detail` `__expand` `__meta` `__resizer` `__select` `__sort` `__title` `__toggle` `__truncate`
- `sg-table-wrap`
- `sg-tabpanel`
- `sg-tabs`
- `sg-tag`
- `sg-thread`: `--list` `__divider`
- `sg-timeline`: `__card` `__card--note` `__change` `__day` `__foot` `__group` `__item` `__item--minor` `__kind` `__kind--note` `__kind--reply` `__line` `__marker` `__marker--done`
- `sg-timeseries`: `__legend` `__plot` `__reset` `__toggle`
- `sg-toast`: `--error` `--info` `--success` `--warning` `__actions` `__body` `__close` `__icon` `__msg` `__stub` `__time` `__timer` `__title` (drawn by stingray.js; never write this markup by hand)
- `sg-toast-region` (drawn by stingray.js; never write this markup by hand)
- `sg-toolbar`: `__spacer`
- `sg-tooltip`: `__key` (drawn by stingray.js; never write this markup by hand)
- `sg-tree`: `__item` `__label` `__toggle`
- `sg-type-body`
- `sg-type-body-large`
- `sg-type-body-strong`
- `sg-type-caption`
- `sg-type-display`
- `sg-type-heading-1`
- `sg-type-heading-2`
- `sg-type-heading-3`
- `sg-type-heading-4`
- `sg-type-hero`
- `sg-type-label`
- `sg-typing`: `__dots`
- `sg-upload`: `__action` `__file` `__icon` `__input` `__list` `__name` `__size` `__zone`
- `sg-voice`: `__bar` `__button` `__label` `__level` `__time`

<!-- generated:end -->
