/* Registry design system, shared by the HTPL registry browse page
   (playground/build-registry.mjs, inlined at build time) and the registry
   dashboard (registry-dashboard/index.html, linked as a stylesheet).
   Plain CSS, no build step, no new runtime dependencies, no webfont
   fetch: the font stacks name Geist first and fall back to system faces,
   so the page renders identically offline.
 *
 * Tokens alias Halo (--htpl-ui-*) with a literal fallback, so this file
 * works standalone on the dashboard AND layered over Halo on the
 * registry page. Where Halo is loaded its value wins; where it is not,
 * the fallback is the same value. Do not edit the fallback literals
 * without editing ui/ui.css to match.
 *
 * Authority: Vercel Web Interface Guidelines
 * (https://github.com/vercel-labs/agent-skills/blob/main/skills/web-design-guidelines/references/command.md
 * and https://vercel.com/design/guidelines), Vercel writing guidelines
 * (https://raw.githubusercontent.com/vercel-labs/writing-guidelines/main/command.md),
 * Vercel DESIGN.md in voltagent/awesome-design-md, Taste Skill
 * (https://www.tasteskill.dev/). Rule conflicts are recorded in
 * docs/registry-design-notes.md; web-design-guidelines wins.
 *
 * Identity: Halo black-and-white. One palette (warm neutral + one dark
 * accent), no gradients, no emoji, no glass cards. The <> mark stays.
 * Colour is spent on data (badges, status text), never on decoration.
 */

/* ------------------------------------------------------------------ */
/* Tokens                                                              */
/* ------------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  /* Surfaces: canvas, canvas-soft, card. Vercel DESIGN.md surface
     ladder (canvas #ffffff, canvas-soft #fafafa); Halo values match. */
  --ds-bg: var(--htpl-ui-background, #ffffff);
  --ds-bg-soft: var(--htpl-ui-muted, #f4f4f5);
  --ds-card: var(--htpl-ui-card, #ffffff);

  /* Text: ink, body, mute. */
  --ds-fg: var(--htpl-ui-foreground, #0a0a0a);
  --ds-fg-body: #4d4d4d;
  --ds-fg-muted: var(--htpl-ui-muted-foreground, #71717a);

  /* One dark accent: near-black in light mode, near-white in dark mode. */
  --ds-primary: var(--htpl-ui-primary, #111111);
  --ds-on-primary: var(--htpl-ui-primary-foreground, #ffffff);

  /* Lines and inputs. */
  --ds-border: var(--htpl-ui-border, #e4e4e7);
  --ds-border-strong: #a1a1a1;
  --ds-input-border: var(--htpl-ui-input, #e4e4e7);

  /* Focus ring. Never remove it without a replacement. */
  --ds-ring: var(--htpl-ui-ring, #0a0a0a);

  /* Semantic colours. Status is always labelled in words as well as
     colour, so colour is never the only cue. */
  --ds-danger: var(--htpl-ui-destructive, #dc2626);
  --ds-danger-fg: var(--htpl-ui-destructive-foreground, #ffffff);
  --ds-danger-soft: #f7d4d6;
  --ds-warning: #f5a623;
  --ds-warning-soft: #ffefcf;
  --ds-success: #137333;

  /* Type. Geist named first (Vercel DESIGN.md); Inter then system
     faces are the substitutes. Mono carries code and technical labels. */
  --ds-font-sans: Geist, Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ds-font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;

  /* Type scale (Vercel DESIGN.md typography table, display sizes
     capped: this is a catalogue page, not a marketing hero). */
  --ds-text-display: 2rem;      /* 32px, section headline */
  --ds-text-title: 1.5rem;      /* 24px, card-cluster headline */
  --ds-text-body: 1rem;         /* 16px, default body */
  --ds-text-small: 0.875rem;    /* 14px, secondary body */
  --ds-text-caption: 0.75rem;   /* 12px, badge and footer labels */
  --ds-text-code: 0.8125rem;    /* 13px, inline code */

  /* Radii: nested, child <= parent (Vercel guidelines). Halo radius
     is 8px; inner surfaces step down to 6px. */
  --ds-radius: var(--htpl-ui-radius, 0.5rem); /* 8px */
  --ds-radius-inner: 0.375rem;                /* 6px */
  --ds-radius-pill: 9999px;

  /* Spacing: 4px base unit, multiples of 4 (Vercel DESIGN.md). */
  --ds-space-1: 0.25rem;  /* 4px */
  --ds-space-2: 0.5rem;   /* 8px */
  --ds-space-3: 0.75rem;  /* 12px */
  --ds-space-4: 1rem;     /* 16px */
  --ds-space-6: 1.5rem;   /* 24px */
  --ds-space-8: 2rem;     /* 32px */
  --ds-space-12: 3rem;    /* 48px */

  /* Layered shadows (Vercel guidelines): ambient + direct light,
     at least two layers, never one heavy drop shadow. */
  --ds-shadow-card: 0 1px 1px rgba(0, 0, 0, 0.05), 0 2px 2px rgba(0, 0, 0, 0.04);
  --ds-shadow-raised: 0 1px 1px rgba(0, 0, 0, 0.05), 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);

  /* Touch. */
  --ds-tap-highlight: rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ds-bg: var(--htpl-ui-background, #09090b);
    --ds-bg-soft: var(--htpl-ui-muted, #27272a);
    --ds-card: var(--htpl-ui-card, #09090b);
    --ds-fg: var(--htpl-ui-foreground, #fafafa);
    --ds-fg-body: #d4d4d8;
    --ds-fg-muted: var(--htpl-ui-muted-foreground, #a1a1aa);
    --ds-primary: var(--htpl-ui-primary, #fafafa);
    --ds-on-primary: var(--htpl-ui-primary-foreground, #09090b);
    --ds-border: var(--htpl-ui-border, #27272a);
    --ds-border-strong: #52525b;
    --ds-input-border: var(--htpl-ui-input, #27272a);
    --ds-ring: var(--htpl-ui-ring, #fafafa);
    --ds-danger: var(--htpl-ui-destructive, #ef4444);
    --ds-danger-soft: #450a0a;
    --ds-warning-soft: #451a03;
    --ds-success: #4ade80;
    --ds-shadow-card: 0 1px 1px rgba(0, 0, 0, 0.4), 0 2px 2px rgba(0, 0, 0, 0.3);
    --ds-shadow-raised: 0 1px 1px rgba(0, 0, 0, 0.4), 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --ds-tap-highlight: rgba(255, 255, 255, 0.12);
  }
}

/* Explicit theme override wins over the media query. */
[data-theme="dark"] {
  --ds-bg: #09090b;
  --ds-bg-soft: #27272a;
  --ds-card: #09090b;
  --ds-fg: #fafafa;
  --ds-fg-body: #d4d4d8;
  --ds-fg-muted: #a1a1aa;
  --ds-primary: #fafafa;
  --ds-on-primary: #09090b;
  --ds-border: #27272a;
  --ds-border-strong: #52525b;
  --ds-input-border: #27272a;
  --ds-ring: #fafafa;
  --ds-danger: #ef4444;
  --ds-danger-soft: #450a0a;
  --ds-warning-soft: #451a03;
  --ds-success: #4ade80;
}

[data-theme="light"] {
  --ds-bg: #ffffff;
  --ds-bg-soft: #f4f4f5;
  --ds-card: #ffffff;
  --ds-fg: #0a0a0a;
  --ds-fg-body: #4d4d4d;
  --ds-fg-muted: #71717a;
  --ds-primary: #111111;
  --ds-on-primary: #ffffff;
  --ds-border: #e4e4e7;
  --ds-border-strong: #a1a1a1;
  --ds-input-border: #e4e4e7;
  --ds-ring: #0a0a0a;
  --ds-danger: #dc2626;
  --ds-danger-soft: #f7d4d6;
  --ds-warning-soft: #ffefcf;
  --ds-success: #137333;
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

.ds-page,
body.ds-page {
  background-color: var(--ds-bg);
  color: var(--ds-fg);
}

html {
  -webkit-text-size-adjust: 100%;
}

/* Suppress desktop rubber-band bounce; keep coarse-pointer defaults
   so mobile pull-to-refresh still works. */
@media (pointer: fine) {
  html {
    overscroll-behavior: none;
  }
}

body {
  font-family: var(--ds-font-sans);
  line-height: 1.5;
}

/* Headings: balanced wrap, no widows; Title Case is a copy rule, not
   a transform, so code names and identifiers keep their own case. */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  letter-spacing: -0.02em;
  scroll-margin-top: 4.5rem;
}

[id] {
  scroll-margin-top: 4.5rem;
}

p {
  text-wrap: pretty;
}

/* Links and buttons: hover state, touch-action, tap highlight. */
a, button, input, select, textarea, summary {
  touch-action: manipulation;
  -webkit-tap-highlight-color: var(--ds-tap-highlight);
}

a {
  color: inherit;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Focus: visible ring on :focus-visible only. Never drop the
   outline without a replacement ring. Sticky headers must not cover the focused
   element: scroll-margin-top above handles anchored headings. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ds-ring);
  outline-offset: 2px;
}

/* Images: dimensions come from width/height attributes in the markup
   (no layout shift); CSS only keeps them inside their container. */
img {
  max-width: 100%;
  height: auto;
}

/* ------------------------------------------------------------------ */
/* Utilities                                                           */
/* ------------------------------------------------------------------ */

.ds-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link: hidden until keyboard focus, then visible. */
.ds-skip-link {
  position: absolute;
  left: var(--ds-space-4);
  top: -4rem;
  z-index: 100;
  padding: var(--ds-space-2) var(--ds-space-4);
  background-color: var(--ds-primary);
  color: var(--ds-on-primary);
  border-radius: var(--ds-radius-inner);
  font-weight: 500;
  text-decoration: none;
  transition: top 0.15s ease;
}

.ds-skip-link:focus-visible {
  top: var(--ds-space-2);
  outline-offset: 2px;
}

/* Tabular numbers for counts and comparisons. */
.ds-numeric {
  font-variant-numeric: tabular-nums;
}

/* Long content: truncate one line, clamp two or three lines, break
   long tokens. Flex children need min-width: 0 for truncation to work. */
.ds-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-clamp-2,
.ds-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ds-clamp-2 {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.ds-clamp-3 {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.ds-break-words {
  overflow-wrap: break-word;
  word-break: break-word;
}

.ds-min-w-0 {
  min-width: 0;
}

/* Eyebrow: mono technical label (Vercel DESIGN.md caption-mono). */
.ds-eyebrow {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-caption);
  line-height: 1.333;
  color: var(--ds-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Lead paragraph under a page headline. */
.ds-lead {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--ds-fg-body);
}

/* Container: centred, 72rem cap, 16px gutters on mobile, 24px desktop. */
.ds-container {
  width: 100%;
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--ds-space-4);
  padding-right: var(--ds-space-4);
  padding-left: max(var(--ds-space-4), env(safe-area-inset-left));
  padding-right: max(var(--ds-space-4), env(safe-area-inset-right));
}

@media (min-width: 768px) {
  .ds-container {
    padding-left: var(--ds-space-6);
    padding-right: var(--ds-space-6);
  }
}

/* ------------------------------------------------------------------ */
/* Layout: header, nav, footer                                         */
/* ------------------------------------------------------------------ */

.ds-promo {
  background-color: var(--ds-primary);
  color: var(--ds-on-primary);
  font-size: var(--ds-text-small);
}

.ds-promo a {
  color: inherit;
}

.ds-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--ds-bg);
  border-bottom: 1px solid var(--ds-border);
}

.ds-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-4);
  min-height: 4rem;
  padding-top: var(--ds-space-2);
  padding-bottom: var(--ds-space-2);
}

.ds-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-2);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: inherit;
  text-decoration: none;
  min-height: 2.75rem;
}

.ds-brand img {
  width: 2rem;
  height: 2rem;
  flex: none;
}

.ds-nav-list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  gap: var(--ds-space-6);
}

@media (min-width: 768px) {
  .ds-nav-list {
    display: flex;
  }
}

.ds-nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--ds-fg-body);
  text-decoration: none;
  font-size: var(--ds-text-small);
  font-weight: 500;
}

.ds-nav-list a:hover {
  color: var(--ds-fg);
  text-decoration: underline;
}

.ds-nav-list a[aria-current="page"] {
  color: var(--ds-fg);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.ds-footer {
  margin-top: var(--ds-space-8);
  padding: var(--ds-space-6) var(--ds-space-4);
  background-color: var(--ds-bg-soft);
  border-top: 1px solid var(--ds-border);
  font-size: var(--ds-text-small);
  color: var(--ds-fg-muted);
  text-align: center;
}

.ds-footer p {
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-2);
  min-height: 2.5rem;
  padding: 0 var(--ds-space-4);
  font: inherit;
  font-size: var(--ds-text-small);
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--ds-radius);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ds-btn-primary {
  background-color: var(--ds-primary);
  color: var(--ds-on-primary);
}

.ds-btn-primary:hover {
  opacity: 0.9;
}

.ds-btn-secondary {
  background-color: var(--ds-bg-soft);
  color: var(--ds-fg);
}

.ds-btn-secondary:hover {
  background-color: var(--ds-border);
}

.ds-btn-outline {
  background-color: transparent;
  border-color: var(--ds-input-border);
  color: var(--ds-fg);
}

.ds-btn-outline:hover {
  background-color: var(--ds-bg-soft);
}

.ds-btn-destructive {
  background-color: var(--ds-danger);
  color: var(--ds-danger-fg);
}

.ds-btn-destructive:hover {
  opacity: 0.9;
}

.ds-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 44px minimum touch target on coarse pointers. */
@media (pointer: coarse) {
  .ds-btn {
    min-height: 2.75rem;
  }
}

/* ------------------------------------------------------------------ */
/* Badges                                                              */
/* ------------------------------------------------------------------ */

.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-pill);
  font-size: var(--ds-text-caption);
  font-weight: 600;
  line-height: 1.333;
  white-space: nowrap;
}

.ds-badge-primary {
  background-color: var(--ds-primary);
  color: var(--ds-on-primary);
}

.ds-badge-secondary {
  background-color: var(--ds-bg-soft);
  color: var(--ds-fg-body);
}

.ds-badge-outline {
  background-color: transparent;
  border-color: var(--ds-input-border);
  color: var(--ds-fg);
}

.ds-badge-destructive {
  background-color: var(--ds-danger);
  color: var(--ds-danger-fg);
}

/* ------------------------------------------------------------------ */
/* Cards and the specimen catalogue                                    */
/* ------------------------------------------------------------------ */

/* Taste pattern 11, specimen catalogue: each gadget is one specimen,
   name first, aligned figures, quiet panel, no decoration. */
.ds-card {
  background-color: var(--ds-card);
  color: var(--ds-fg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ds-card:hover {
  border-color: var(--ds-border-strong);
  box-shadow: var(--ds-shadow-raised);
}

.ds-card-header {
  padding: var(--ds-space-6) var(--ds-space-6) 0;
}

.ds-card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-2);
  min-width: 0;
}

.ds-card-title .ds-truncate {
  flex: 1 1 auto;
}

.ds-card-body {
  padding: var(--ds-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-3);
}

.ds-card-body > * {
  margin: 0;
}

/* Gadget list: 1 column at 390px, 2 columns at 768px and up. Lists
   over 50 items get content-visibility so long pages stay fast. */
.ds-gadget-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ds-space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 768px) {
  .ds-gadget-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ds-gadget-list > li {
  min-width: 0;
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

/* ------------------------------------------------------------------ */
/* Code                                                                */
/* ------------------------------------------------------------------ */

.ds-code {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-code);
  background-color: var(--ds-bg-soft);
  padding: 0.1rem 0.3rem;
  border-radius: 0.25rem;
  overflow-wrap: break-word;
}

/* Install block: ink surface, nested radius (6px inside the 8px card). */
.ds-codeblock {
  background-color: var(--ds-primary);
  color: var(--ds-on-primary);
  border-radius: var(--ds-radius-inner);
  padding: var(--ds-space-4);
  overflow-x: auto;
}

.ds-codeblock pre,
.ds-codeblock code {
  background-color: transparent;
  color: inherit;
  margin: 0;
  padding: 0;
}

.ds-codeblock code {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-code);
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Forms (dashboard use first; the registry search uses the same)      */
/* ------------------------------------------------------------------ */

.ds-field {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
  margin: 0;
  min-width: 0;
}

.ds-label {
  display: block;
  font-weight: 600;
  font-size: var(--ds-text-small);
}

.ds-label small {
  font-weight: 400;
  color: var(--ds-fg-muted);
}

.ds-hint {
  font-size: var(--ds-text-small);
  color: var(--ds-fg-muted);
  margin: 0;
}

.ds-input,
.ds-select,
.ds-textarea {
  font: inherit;
  font-size: 1rem; /* 16px minimum on mobile: no iOS auto-zoom. */
  color: var(--ds-fg);
  background-color: var(--ds-bg);
  border: 1px solid var(--ds-input-border);
  border-radius: var(--ds-radius);
  width: 100%;
  min-height: 2.75rem; /* 44px touch target. */
}

.ds-input,
.ds-select {
  height: 2.75rem;
  padding: 0 var(--ds-space-3);
}

.ds-textarea {
  padding: var(--ds-space-2) var(--ds-space-3);
  min-height: 5rem;
  resize: vertical;
}

/* Native select needs explicit colours or Windows dark mode breaks. */
.ds-select {
  background-color: var(--ds-bg);
  color: var(--ds-fg);
}

.ds-input::placeholder,
.ds-textarea::placeholder {
  color: var(--ds-fg-muted);
}

.ds-input:disabled,
.ds-select:disabled,
.ds-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Error text sits next to its field and names the fix, not only the
   problem. Colour is never the only cue: the text carries the message. */
.ds-error {
  color: var(--ds-danger);
  font-size: var(--ds-text-small);
  font-weight: 500;
  margin: 0;
}

.ds-input[aria-invalid="true"],
.ds-select[aria-invalid="true"],
.ds-textarea[aria-invalid="true"] {
  border-color: var(--ds-danger);
}

/* Search row: input grows, button stays put. */
.ds-search {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-2);
  align-items: end;
}

.ds-search .ds-field {
  flex: 1 1 16rem;
}

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

.ds-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
}

.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ds-text-small);
  background-color: var(--ds-card);
  color: var(--ds-fg);
}

.ds-table caption {
  padding: var(--ds-space-3) var(--ds-space-4);
  font-weight: 600;
  text-align: left;
}

.ds-table th,
.ds-table td {
  padding: var(--ds-space-2) var(--ds-space-4);
  text-align: left;
  border-bottom: 1px solid var(--ds-border);
  vertical-align: top;
}

/* Header in mono caps (Vercel DESIGN.md ex-data-table-cell). */
.ds-table th {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-caption);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ds-fg-muted);
  background-color: var(--ds-bg-soft);
}

.ds-table tr:last-child td {
  border-bottom: 0;
}

.ds-table td .ds-numeric,
.ds-table th .ds-numeric {
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* Alerts, notices, empty states                                       */
/* ------------------------------------------------------------------ */

/* Notice: the 4-hour sync notice on the dashboard, and the static
   status note on the registry page. Border + text, not colour alone. */
.ds-notice {
  border: 1px solid var(--ds-border-strong);
  background-color: var(--ds-bg-soft);
  border-radius: var(--ds-radius);
  padding: var(--ds-space-3) var(--ds-space-4);
}

.ds-notice strong {
  display: block;
  margin-bottom: 0.25rem;
}

.ds-notice p {
  margin: 0;
}

.ds-alert {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  padding: var(--ds-space-4);
  background-color: var(--ds-card);
  color: var(--ds-fg);
}

.ds-alert-title {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.ds-alert p:last-child {
  margin-bottom: 0;
}

.ds-alert-destructive {
  border-color: var(--ds-danger);
  color: var(--ds-danger);
}

.ds-alert-destructive .ds-alert-title {
  color: var(--ds-danger);
}

/* Empty state (Vercel DESIGN.md ex-empty-state-card): generous
   padding on a soft surface, a heading, one next step, no dead end. */
.ds-empty {
  background-color: var(--ds-bg-soft);
  border: 1px solid var(--ds-border);
  border-radius: 0.75rem;
  padding: var(--ds-space-12) var(--ds-space-6);
  text-align: center;
}

.ds-empty h2,
.ds-empty h3 {
  margin-top: 0;
}

.ds-empty p {
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
  color: var(--ds-fg-body);
}

.ds-empty .ds-btn {
  margin-top: var(--ds-space-2);
}

/* Stat figures: aligned, tabular numbers (Taste quiet instrument). */
.ds-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-2) var(--ds-space-6);
  font-size: var(--ds-text-small);
  color: var(--ds-fg-muted);
  margin: 0;
}

.ds-stats strong {
  color: var(--ds-fg);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* Dashboard app shell (registry-dashboard/index.html only)            */
/* ------------------------------------------------------------------ */

/* The registry browse page inlines this file but uses none of the
   shell classes below; they are inert there. Shell decision (see
   docs/registry-dashboard-redesign-notes.md and
   registry-dashboard/redesign-spec.md): fixed 256px left sidebar
   on desktop, off-canvas drawer below 768px, no desktop collapse,
   no org switcher. All values reuse existing tokens; no new token,
   colour, or font is introduced here. */

[hidden] { display: none !important; }

/* Shell grid: 16rem sidebar + content. Below 768px the grid becomes
   a block and the sidebar turns into the drawer (mobile rules). */
.ds-shell {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  min-height: 100dvh;
}

.ds-shell-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.ds-shell-main > main {
  flex: 1 1 auto;
}

/* Sidebar: sticky full-height rail on desktop, own scroll. */
.ds-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--ds-bg);
  border-right: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
  padding: var(--ds-space-4) 0;
}

.ds-sidebar-brand {
  padding: 0 var(--ds-space-4) var(--ds-space-4);
  margin-bottom: var(--ds-space-2);
  border-bottom: 1px solid var(--ds-border);
}

.ds-sidebar-section {
  padding: 0 var(--ds-space-2);
  margin-top: var(--ds-space-4);
}

.ds-sidebar-section:first-child {
  margin-top: 0;
}

.ds-sidebar-section .ds-eyebrow {
  display: block;
  padding: 0 var(--ds-space-3);
  margin: 0 0 var(--ds-space-1);
}

.ds-sidebar-nav {
  list-style: none;
  margin: var(--ds-space-2) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* One sidebar link. Active state is background plus weight plus a
   left indicator bar, never colour alone. 44px tall on every device. */
.ds-nav-item {
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  min-height: 2.75rem;
  padding: var(--ds-space-2) var(--ds-space-3);
  border-radius: var(--ds-radius-inner);
  border-left: 2px solid transparent;
  color: var(--ds-fg-body);
  text-decoration: none;
  font-size: var(--ds-text-small);
  font-weight: 500;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.ds-nav-item:hover {
  background-color: var(--ds-bg-soft);
  color: var(--ds-fg);
}

.ds-nav-item[aria-current="page"] {
  background-color: var(--ds-bg-soft);
  color: var(--ds-fg);
  font-weight: 600;
  border-left-color: var(--ds-primary);
}

/* Pending-invites count on the My Invites item. Numeral only;
   hidden when the count is zero (the Overview card shows the zero). */
.ds-nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  padding: 0 0.375rem;
  border-radius: var(--ds-radius-pill);
  background-color: var(--ds-primary);
  color: var(--ds-on-primary);
  font-size: var(--ds-text-caption);
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Sidebar footer: account block pinned to the foot. Sign-in is a
   full-width button; signed in, the identity is a link to the
   Account view (sign-out lives only there, so the id stays unique). */
.ds-sidebar-footer {
  margin-top: auto;
  padding: var(--ds-space-4) var(--ds-space-4) 0;
  padding-bottom: calc(var(--ds-space-4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ds-border);
}

.ds-sidebar-footer .ds-btn {
  width: 100%;
}

.ds-sidebar-account {
  display: flex;
  align-items: center;
  gap: var(--ds-space-3);
  min-height: 2.75rem;
  padding: var(--ds-space-1) var(--ds-space-2);
  border-radius: var(--ds-radius-inner);
  color: inherit;
  text-decoration: none;
}

.ds-sidebar-account:hover {
  background-color: var(--ds-bg-soft);
}

.ds-sidebar-account img {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  flex: none;
}

.ds-sidebar-account-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.ds-sidebar-account-name {
  font-size: var(--ds-text-small);
  font-weight: 600;
}

.ds-sidebar-account-login {
  font-size: var(--ds-text-small);
  color: var(--ds-fg-muted);
}

/* Mobile top bar: menu button + brand, below 768px only. */
.ds-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: center;
  gap: var(--ds-space-2);
  min-height: 4rem;
  padding: 0 var(--ds-space-4);
  background-color: var(--ds-bg);
  border-bottom: 1px solid var(--ds-border);
}

/* Hamburger: three CSS bars, never an emoji or an image. */
.ds-menu-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border: 1px solid var(--ds-input-border);
  border-radius: var(--ds-radius);
  background-color: var(--ds-bg);
  color: var(--ds-fg);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ds-menu-btn:hover {
  background-color: var(--ds-bg-soft);
}

.ds-menu-btn-bar {
  display: block;
  width: 1rem;
  height: 2px;
  background-color: currentColor;
  border-radius: 1px;
}

/* Drawer overlay: covers content while the drawer is open, below
   768px only. Tapping it closes the drawer. */
.ds-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
}

/* View header: eyebrow, h1, lead, at most one primary action.
   The action sits at the right of the title row on desktop and
   wraps below the description on narrow screens. No absolute
   positioning. */
.ds-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ds-space-4);
  margin-bottom: var(--ds-space-6);
  padding-bottom: var(--ds-space-4);
  border-bottom: 1px solid var(--ds-border);
}

.ds-page-header-text {
  flex: 1 1 24rem;
  min-width: 0;
}

.ds-page-header-text .ds-eyebrow {
  margin: 0;
}

.ds-page-header-text h1 {
  margin: var(--ds-space-2) 0;
  font-size: var(--ds-text-display);
}

.ds-page-header-text .ds-lead {
  margin: 0;
}

.ds-page-header-actions {
  display: flex;
  gap: var(--ds-space-2);
  flex: none;
}

/* View wrapper: no visual style. Only one view is unhidden at a
   time; the [hidden] guard above owns that. */
.ds-view {
  /* No visual style. */
}

/* Overview stat row: 1 column at 390px, 2 at 768px, 4 at 1024px. */
.ds-stat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ds-space-4);
  margin-bottom: var(--ds-space-6);
}

@media (min-width: 768px) {
  .ds-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .ds-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* One stat card: a .ds-card with tighter padding. The "4 Hours"
   Sync value uses the same value style with text, not a numeral. */
.ds-stat-card {
  padding: var(--ds-space-4) var(--ds-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
}

.ds-stat-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.ds-stat-label {
  margin: 0;
  font-size: var(--ds-text-small);
  color: var(--ds-fg-muted);
}

.ds-stat-link {
  margin: 0;
  font-size: var(--ds-text-small);
}

/* Form card: a .ds-card capped at 40rem (the Builder C answer to
   "keep 640px or widen" stands: one visual column keeps labels
   next to inputs). The form inside keeps its column + gap layout;
   the card supplies border and padding. The Account view reuses
   this width for its account card. */
.ds-form-card {
  max-width: 40rem;
  padding: var(--ds-space-6);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ds-form-card h2,
.ds-form-card h3 {
  margin: 0;
}

/* Danger zone: destructive-action block at the foot of the org
   detail card. Holds delete-org-btn only. */
.ds-danger-zone {
  border: 1px solid var(--ds-danger);
  border-radius: var(--ds-radius);
  padding: var(--ds-space-4);
  margin-top: var(--ds-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  align-items: flex-start;
}

.ds-danger-zone h3 {
  margin: 0;
  color: var(--ds-danger);
  font-size: 1rem;
}

.ds-danger-zone p {
  margin: 0;
  font-size: var(--ds-text-small);
  color: var(--ds-fg-body);
}

/* Table refinements: row hover everywhere; the Actions column never
   wraps, scoped to the tables whose last column is Actions (My
   Gadgets, members, invites). The SHA-256 cell keeps wrapping its
   code; no nowrap is applied by column position. */
.ds-table tbody tr:hover {
  background-color: var(--ds-bg-soft);
}

#gadgets-list .ds-table td:last-child,
#org-detail .ds-table td:last-child {
  white-space: nowrap;
}

/* Mobile shell: the sidebar becomes an off-canvas drawer. It is
   NOT an icon-only collapsed rail on desktop: no desktop collapse
   toggle exists (see the spec). */
@media (max-width: 767px) {
  .ds-shell {
    display: block;
  }

  .ds-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 17.5rem;
    max-width: 85vw;
    height: auto;
    z-index: 50;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
    box-shadow: var(--ds-shadow-raised);
  }

  .ds-sidebar.ds-sidebar-open {
    transform: translateX(0);
    visibility: visible;
  }

  .ds-topbar {
    display: flex;
  }
}

@media (min-width: 768px) {
  .ds-drawer-overlay {
    display: none !important;
  }
}

/* Sign-in gate: the shell starts hidden in the markup and the
   sign-in screen is the default visible content. JS reveals the
   shell only after GET /me returns an account (see
   docs/registry-dashboard-gate-notes.md). While gated, the skip
   link is hidden: its target (#main) sits inside the hidden shell,
   and the sign-in screen is one card with nothing to skip past. */
body.ds-gated .ds-skip-link {
  display: none;
}

/* Centred auth screen: one card, brand, one clear action. Halo
   black-and-white, no new tokens, no new dependencies. */
.ds-signin {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--ds-space-6) var(--ds-space-4);
  padding-top: max(var(--ds-space-6), env(safe-area-inset-top));
  padding-bottom: max(var(--ds-space-6), env(safe-area-inset-bottom));
}

.ds-signin-card {
  width: 100%;
  max-width: 28rem;
  padding: var(--ds-space-8) var(--ds-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
  align-items: stretch;
}

.ds-signin-brand {
  display: flex;
  justify-content: center;
}

.ds-signin-card h1 {
  margin: 0;
  font-size: var(--ds-text-display);
  text-align: center;
}

.ds-signin-card .ds-lead {
  margin: 0;
  text-align: center;
}

.ds-signin-btn {
  width: 100%;
  min-height: 2.75rem;
}

.ds-signin-card .ds-hint {
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Motion                                                              */
/* ------------------------------------------------------------------ */

/* Transform and opacity only; never a blanket transition. Skeleton pulse
   stops under prefers-reduced-motion. */
.ds-skeleton {
  border-radius: var(--ds-radius);
  background-color: var(--ds-bg-soft);
  animation: ds-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes ds-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .ds-skeleton {
    animation: none;
  }

  .ds-skip-link,
  .ds-btn,
  .ds-card,
  .ds-sidebar,
  .ds-menu-btn,
  .ds-nav-item {
    transition: none;
  }
}
