/* Amplify UI components, as plain CSS.
 *
 * A faithful port of the product app's component library (apps/web/app/components/ui/ +
 * components/empty-state.tsx + the .glass/.choice surfaces in globals.css) as it renders in the
 * DARK theme, so the marketing site can draw the same controls without reading the app repo.
 * Provenance, the Tailwind -> CSS translations and the "to update" procedure: design-system/SOURCE.md.
 * Every component on one page: /design-system/.
 *
 * Load AFTER /theme.css: every colour, radius, height and font here is a theme.css token. The one
 * token the app has that theme.css lacks is declared below (--ui-font-mono).
 *
 * Every class is prefixed `ui-` so nothing here collides with the site's own page classes.
 * Contracts other pages write to (do not rename): .ui-accordion/.ui-acc/.ui-acc-trigger/
 * .ui-acc-chev/.ui-acc-content, and .ui-btn + .ui-btn-{primary,secondary,tertiary,ghost,danger}
 * + .ui-btn-{sm,lg,icon}.
 */

:root {
  /* The app's labels, counters and credit amounts are Geist Mono (--font-geist-mono). theme.css has
     no mono token, and landing.css already uses --font-mono for something else, so it is namespaced. */
  --ui-font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Tailwind's default ease, used by every transition-* utility in the app. */
  --ui-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icons drawn with CSS masks: the shape comes from the SVG, the colour from a token. */
.ui-btn-spin,
.ui-select::after,
.ui-step-mark,
.ui-select-card::before {
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

@keyframes ui-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ui-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(200%);
  }
}

/* ---------------------------------------------------------------------------------------------
 * Surfaces (globals.css)
 * ------------------------------------------------------------------------------------------- */

/* .glass: the default panel. */
.ui-glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--gborder);
  box-shadow: var(--shadow-md);
}

/* .choice: one tile in a grid of them. Same glass, shallower shadow; selection on aria-pressed. */
.ui-choice {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--gborder);
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}
.ui-choice:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.ui-choice[aria-pressed="true"],
.ui-choice:has(input:checked) {
  border-color: var(--select);
  background: color-mix(in srgb, var(--select) 8%, transparent);
  box-shadow: var(--shadow-sm);
}

/* backdrop-filter makes a glass panel its own stacking context, so a help blurb opened inside it
   is trapped under later siblings. Lift the panel while its help is open. */
.ui-glass:has(details[open]),
.ui-glass:has(.ui-help:hover),
.ui-glass:has(.ui-help:focus-within),
.ui-card:has(.ui-help:hover),
.ui-card:has(.ui-help:focus-within),
.ui-acc:has(.ui-help:hover),
.ui-acc:has(.ui-help:focus-within) {
  position: relative;
  z-index: 30;
}

/* ---------------------------------------------------------------------------------------------
 * Button (button.tsx)
 * ------------------------------------------------------------------------------------------- */

.ui-btn {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h-md);
  margin: 0;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: var(--btn-weight);
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition-property: background-color, color, filter, transform, border-color;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-btn:active {
  transform: scale(0.985);
}
.ui-btn:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.ui-btn:disabled,
.ui-btn[aria-disabled="true"],
.ui-btn[data-loading],
.ui-btn.ui-btn-loading {
  pointer-events: none;
  cursor: default;
}

/* Sizes: sm 32, default 40, lg 48, plus round icon sizes. */
.ui-btn-sm {
  height: var(--h-sm);
  padding: 0 14px;
  font-size: 12.5px;
}
.ui-btn-lg {
  height: var(--h-lg);
  padding: 0 24px;
  font-size: 14px;
}
.ui-btn-icon {
  width: var(--h-md);
  height: var(--h-md);
  padding: 0;
}
.ui-btn-icon-sm {
  width: var(--h-sm);
  height: var(--h-sm);
  padding: 0;
}
/* Below 640px a label may wrap; the fixed height becomes a minimum so the second line has room. */
@media (max-width: 639px) {
  .ui-btn:not(.ui-btn-icon):not(.ui-btn-icon-sm) {
    white-space: normal;
    height: auto;
    min-height: var(--h-md);
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .ui-btn.ui-btn-sm:not(.ui-btn-icon):not(.ui-btn-icon-sm) {
    min-height: var(--h-sm);
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .ui-btn.ui-btn-lg:not(.ui-btn-icon):not(.ui-btn-icon-sm) {
    min-height: var(--h-lg);
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

/* Variants. */
.ui-btn-primary {
  background-color: var(--orange);
  background-image: var(--grad-primary);
  color: var(--on-orange);
}
.ui-btn-primary:hover {
  filter: brightness(1.07);
}

.ui-btn-secondary {
  border-color: var(--line-control);
  background-color: var(--btn2);
  color: var(--on-btn2);
  box-shadow: var(--shadow-xs);
}
.ui-btn-secondary:hover {
  filter: brightness(0.96);
}

.ui-btn-tertiary {
  border-color: var(--fill-edge);
  background-color: var(--fill);
  color: var(--ink);
}
.ui-btn-tertiary:hover {
  background-color: var(--fill-hover);
}

/* Ghost: Manrope 600, no surface until hovered. Default size uses 14px side padding. */
.ui-btn-ghost {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: normal;
  color: var(--slate2);
}
.ui-btn-ghost:not(.ui-btn-sm):not(.ui-btn-lg):not(.ui-btn-icon):not(.ui-btn-icon-sm) {
  padding-left: 14px;
  padding-right: 14px;
}
.ui-btn-ghost:hover {
  border-color: var(--fill-edge);
  background-color: var(--fill);
  color: var(--ink);
}

.ui-btn-danger {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background-color: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}
.ui-btn-danger:hover {
  background-color: color-mix(in srgb, var(--danger) 24%, transparent);
}

/* Danger's other half (Keep beside Skip). Not a second primary. */
.ui-btn-positive {
  border-color: color-mix(in srgb, var(--green) 40%, transparent);
  background-color: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green-ink);
}
.ui-btn-positive:hover {
  background-color: color-mix(in srgb, var(--green) 26%, transparent);
}

/* Disabled (not loading): a quiet fill and faint text rather than a faded colour. */
.ui-btn:is(:disabled, [aria-disabled="true"]):not([data-loading]):not(.ui-btn-loading) {
  color: var(--faint);
}
.ui-btn:is(.ui-btn-primary, .ui-btn-secondary, .ui-btn-danger, .ui-btn-positive):is(:disabled, [aria-disabled="true"]):not([data-loading]):not(.ui-btn-loading) {
  background-color: var(--fill);
  background-image: none;
  box-shadow: none;
  filter: none;
}
.ui-btn:is(.ui-btn-danger, .ui-btn-positive, .ui-btn-secondary):is(:disabled, [aria-disabled="true"]):not([data-loading]):not(.ui-btn-loading) {
  border-color: transparent;
}

/* Loading: keeps its own colour, a spinner takes the icon slot, the label stays put.
   <span class="ui-btn-spin" aria-hidden="true"></span> (or any svg with class ui-spin). */
.ui-btn-spin {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M21 12a9 9 0 1 1-6.219-8.56'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M21 12a9 9 0 1 1-6.219-8.56'/%3E%3C/svg%3E");
  animation: ui-spin 1s linear infinite;
}
.ui-spin {
  animation: ui-spin 1s linear infinite;
}

/* The price inside the button, after the label: "Generate ✦ 50". Label's own colour, size and
   weight, digits in mono. <span class="ui-btn-cost"><svg class="ui-credit-mark">…</svg>50</span> */
.ui-btn-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--ui-font-mono);
  font-weight: inherit;
  font-variant-numeric: tabular-nums;
}
.ui-btn .ui-btn-cost svg,
.ui-btn-cost .ui-credit-mark {
  width: 1em;
  height: 1em;
}

/* IconButton: always round, always on the glass fill, always named (aria-label + title). */
.ui-icon-btn {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--h-sm);
  height: var(--h-sm);
  margin: 0;
  padding: 0;
  border: 1px solid var(--fill-edge);
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--slate);
  cursor: pointer;
  text-decoration: none;
  transition-property: background-color, color, transform;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-icon-btn-md {
  width: var(--h-md);
  height: var(--h-md);
}
.ui-icon-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.ui-icon-btn:hover {
  background: var(--fill-hover);
}
.ui-icon-btn:active {
  transform: scale(0.985);
}
.ui-icon-btn:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-icon-btn[aria-pressed="true"] {
  background: var(--fill-lift);
  color: var(--ink);
}
.ui-icon-btn:disabled {
  pointer-events: none;
  color: var(--faint);
}

/* ---------------------------------------------------------------------------------------------
 * Credits (credits.tsx): the four-point spark and a mono number.
 * ------------------------------------------------------------------------------------------- */

.ui-credits {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--ui-font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--slate2);
}
.ui-credits .ui-credit-mark {
  width: 12px;
  height: 12px;
}
.ui-credits-md {
  font-size: 13px;
  line-height: inherit;
}
.ui-credits-md .ui-credit-mark {
  width: 14px;
  height: 14px;
}
.ui-credits-lg {
  font-size: 14px;
  line-height: 20px;
}
.ui-credits-lg .ui-credit-mark {
  width: 16px;
  height: 16px;
}
.ui-credits-ink {
  color: var(--ink);
}
.ui-credits-low {
  color: var(--danger);
}
.ui-credit-mark {
  flex-shrink: 0;
  fill: currentColor;
}

/* ---------------------------------------------------------------------------------------------
 * Accordion (accordion.tsx) as <details>/<summary>. Markup contract:
 *   <div class="ui-accordion"><details class="ui-acc">
 *     <summary class="ui-acc-trigger"><span>Q</span><svg class="ui-acc-chev" …/></summary>
 *     <div class="ui-acc-content"><p>A</p></div>
 *   </details></div>
 * ------------------------------------------------------------------------------------------- */

.ui-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  interpolate-size: allow-keywords;
}
.ui-acc {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--r-inner);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--gborder);
  box-shadow: var(--shadow-md);
}
.ui-acc-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 12px 18px;
  list-style: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
}
.ui-acc-trigger::-webkit-details-marker {
  display: none;
}
.ui-acc-trigger::marker {
  content: "";
}
.ui-acc-trigger:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: -2px;
  border-radius: var(--r-inner);
}
.ui-acc-chev {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--slate2);
  transition: transform 0.15s var(--ui-ease);
}
.ui-acc[open] > .ui-acc-trigger .ui-acc-chev {
  transform: rotate(180deg);
}
.ui-acc-content {
  padding: 0 18px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 20px;
  color: var(--slate2);
}
.ui-acc-content > :first-child {
  margin-top: 0;
}
.ui-acc-content > :last-child {
  margin-bottom: 0;
}
.ui-acc-content p {
  margin: 0 0 8px;
}
.ui-acc-content p:last-child {
  margin-bottom: 0;
}
.ui-acc-content ul,
.ui-acc-content ol {
  margin: 0 0 8px;
  padding-left: 20px;
}
.ui-acc-content a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink) 45%, transparent);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}
.ui-acc-content a:hover {
  text-decoration-color: var(--ink);
}
.ui-acc-content strong {
  color: var(--ink);
  font-weight: 600;
}
/* Smooth open (Chromium 131+): the app's accordion-down/up is 0.2s ease-out. Elsewhere it just
   opens, which is the native behaviour. */
.ui-acc::details-content {
  block-size: 0;
  overflow: hidden;
  transition:
    block-size 0.2s ease-out,
    content-visibility 0.2s ease-out allow-discrete;
}
.ui-acc[open]::details-content {
  block-size: auto;
}
@media (prefers-reduced-motion: reduce) {
  .ui-acc::details-content {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------------------------
 * Card (card.tsx)
 * ------------------------------------------------------------------------------------------- */

.ui-card {
  box-sizing: border-box;
  padding: 24px;
  border-radius: var(--r-card);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--gborder);
  box-shadow: var(--shadow-md);
}
.ui-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.ui-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 24px;
  font-weight: var(--heading-weight);
  letter-spacing: -0.015em;
  color: var(--ink);
}
.ui-card-desc {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--slate2);
}
.ui-card-footer {
  display: flex;
  align-items: center;
  margin-top: 16px;
}
/* A group inside a card: radius 16, the raised wash, the faint edge. Never nest one in another. */
.ui-card-inset {
  box-sizing: border-box;
  padding: 16px;
  border-radius: var(--r-inner);
  border: 1px solid var(--fill-edge);
  background: var(--raised);
}

/* ---------------------------------------------------------------------------------------------
 * Chip (chip.tsx): a filter or a quick pick. Off is glass, on is solid contrast.
 * <button class="ui-chip" aria-pressed="true|false"> or <label class="ui-chip"><input type=checkbox>…
 * ------------------------------------------------------------------------------------------- */

.ui-chip {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--h-sm);
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--fill-edge);
  border-radius: var(--r-pill);
  background: var(--fill);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--slate);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition-property: color, background-color, border-color;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-chip-md {
  height: var(--h-md);
  padding: 0 16px;
  font-size: 14px;
}
.ui-chip-lg {
  height: var(--h-lg);
  padding: 0 20px;
  font-size: 15px;
}
.ui-chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.ui-chip:hover {
  background: var(--fill-hover);
  color: var(--ink);
}
.ui-chip:focus-visible,
.ui-chip:has(input:focus-visible) {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-chip > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.ui-chip[aria-pressed="true"],
.ui-chip.is-selected,
.ui-chip:has(> input:checked) {
  border-color: transparent;
  background: var(--contrast);
  color: var(--on-contrast);
}
.ui-chip-dashed {
  border-style: dashed;
  border-color: var(--line-control);
  background: transparent;
  color: var(--slate2);
}
.ui-chip-dashed:hover {
  border-color: var(--slate2);
  background: transparent;
  color: var(--ink);
}
.ui-chip:disabled {
  pointer-events: none;
  opacity: 0.4;
}
.ui-chip-count {
  font-family: var(--ui-font-mono);
  font-size: 11px;
  font-weight: 500;
  opacity: 0.6;
}
.ui-chip .ui-chip-chev {
  margin-right: -2px;
  opacity: 0.7;
}
.ui-chip-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------------------------------------------
 * Badges (badge.tsx): StatusBadge, Tag, Counter, MediaBadge.
 * ------------------------------------------------------------------------------------------- */

/* StatusBadge: a tint, an edge, a dot and a word. An svg child replaces the dot. */
.ui-status {
  box-sizing: border-box;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--fill-edge);
  border-radius: var(--r-pill);
  background: var(--fill);
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--slate);
  white-space: nowrap;
}
.ui-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex-shrink: 0;
}
.ui-status:has(> svg)::before {
  display: none;
}
.ui-status svg {
  width: 12px;
  height: 12px;
}
.ui-status-success {
  border-color: color-mix(in srgb, var(--green) 35%, transparent);
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: var(--green-ink);
}
.ui-status-system {
  border-color: color-mix(in srgb, var(--teal) 35%, transparent);
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  color: var(--teal-ink);
}
.ui-status-danger {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.ui-status-neutral {
  border-color: var(--fill-edge);
  background: var(--fill);
  color: var(--slate);
}

/* Tag: a hashtag or a label, optionally removable with .ui-tag-remove. */
.ui-tag {
  box-sizing: border-box;
  display: inline-flex;
  flex-shrink: 0;
  min-width: 0;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--fill-edge);
  border-radius: var(--r-pill);
  background: var(--fill);
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--slate);
  white-space: nowrap;
}
.ui-tag:has(> .ui-tag-remove) {
  padding-right: 4px;
}
.ui-tag svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.ui-tag-remove {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.ui-tag-remove svg {
  width: 11px;
  height: 11px;
}
.ui-tag-remove:hover {
  background: var(--fill-hover);
  color: var(--ink);
}
.ui-tag-remove:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}

/* Counter: "07/30". Read-only, mono. */
.ui-counter {
  box-sizing: border-box;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  height: var(--h-sm);
  padding: 0 14px;
  border: 1px solid var(--fill-edge);
  border-radius: var(--r-pill);
  background: var(--fill);
  font-family: var(--ui-font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
}

/* MediaBadge: a label on somebody's photo. Scrim and white text in both themes (a photo has no theme). */
.ui-media-badge {
  box-sizing: border-box;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--scrim) 70%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-family: var(--ui-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------------------------
 * Fields (input.tsx FIELD_CLASSES, textarea.tsx, field.tsx, label.tsx, select.tsx)
 * ------------------------------------------------------------------------------------------- */

.ui-input,
.ui-textarea,
.ui-select > select {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: flex;
  width: 100%;
  height: var(--h-md);
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--line-control);
  border-radius: var(--r-ctl);
  background: var(--field);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
  transition-property: border-color, box-shadow;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-input::placeholder,
.ui-textarea::placeholder {
  font-weight: 400;
  color: var(--slate2);
  opacity: 1;
}
.ui-input:hover,
.ui-textarea:hover,
.ui-select > select:hover {
  border-color: color-mix(in srgb, var(--slate2) 60%, transparent);
}
.ui-input:focus-visible,
.ui-textarea:focus-visible,
.ui-select > select:focus-visible {
  outline: none;
  border-color: var(--contrast);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--contrast) 15%, transparent);
}
.ui-input[aria-invalid="true"],
.ui-textarea[aria-invalid="true"],
.ui-select > select[aria-invalid="true"] {
  border-color: var(--danger);
}
.ui-input[aria-invalid="true"]:focus-visible,
.ui-textarea[aria-invalid="true"]:focus-visible,
.ui-select > select[aria-invalid="true"]:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent);
}
.ui-input:disabled,
.ui-textarea:disabled,
.ui-select > select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.ui-textarea {
  height: auto;
  min-height: 96px;
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 22px;
  resize: vertical;
}

/* Field: label above, control, one line of help (or the error, which replaces it) below. */
.ui-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ui-field-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.ui-field-optional {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--slate2);
}
.ui-field-help,
.ui-field-error {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--slate2);
}
.ui-field-error {
  color: var(--danger);
}
/* Label (label.tsx): the plain one, for a control that is not in a Field. */
.ui-label {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
}

/* Select: the app draws a Radix dropdown; here it is a native <select> in the same skin.
   <span class="ui-select"><select>…</select></span>  (+ .ui-select-pill / .ui-select-compact) */
.ui-select {
  position: relative;
  display: block;
}
.ui-select > select {
  padding-right: 36px;
  cursor: pointer;
  text-overflow: ellipsis;
}
.ui-select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  pointer-events: none;
  background-color: var(--slate2);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.ui-select > select option {
  background: var(--surface-card);
  color: var(--ink);
}
/* A filter or sort above a list: the pill. */
.ui-select-pill {
  display: inline-block;
}
.ui-select-pill > select {
  width: auto;
  height: var(--h-sm);
  padding: 0 30px 0 12px;
  border-color: var(--fill-edge);
  border-radius: var(--r-pill);
  background: var(--fill);
  font-size: 13px;
  font-weight: 600;
}
.ui-select-pill > select:hover {
  border-color: var(--fill-edge);
  background: var(--fill-hover);
}
.ui-select-pill::after,
.ui-select-compact::after {
  right: 10px;
}
/* Inside a sentence or a tight panel. */
.ui-select-compact {
  display: inline-block;
}
.ui-select-compact > select {
  width: auto;
  height: var(--h-sm);
  padding: 0 30px 0 10px;
  font-size: 12px;
  font-weight: 600;
}
.ui-select-pill > select:focus-visible,
.ui-select-compact > select:focus-visible {
  box-shadow: 0 0 0 2px var(--contrast);
}

/* The menu every dropdown opens (select.tsx MENU_CLASSES), static: for a panel you show yourself. */
.ui-menu {
  box-sizing: border-box;
  min-width: 13rem;
  max-height: 22rem;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line-control);
  border-radius: var(--r-inner);
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
}
.ui-menu-label {
  padding: 6px 10px 4px;
  font-family: var(--ui-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate2);
}
/* A dropdown row (select.tsx MENU_ITEM_CLASSES): highlighted on hover/focus or [data-highlighted]. */
.ui-menu-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-ctl);
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
  cursor: pointer;
  outline: none;
}
.ui-menu-option:hover,
.ui-menu-option:focus-visible,
.ui-menu-option[data-highlighted] {
  background: var(--fill);
}
.ui-menu-option[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}
.ui-menu-option > svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.ui-menu-option > span {
  flex: 1;
  min-width: 0;
}

/* MenuItem (menu-item.tsx): an action row in a "more" menu. */
.ui-menu-item {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ui-ease);
}
.ui-menu-item:hover {
  background: var(--surface-1);
}
.ui-menu-item:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-menu-item > svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.ui-menu-item-danger {
  color: var(--danger);
}
.ui-menu-item .ui-credits {
  margin-left: auto;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  color: inherit;
  opacity: 0.7;
}
.ui-menu-item .ui-credits .ui-credit-mark {
  width: 1em;
  height: 1em;
}

/* ---------------------------------------------------------------------------------------------
 * Checkbox and radio (checkbox.tsx): 18px native inputs, on is solid contrast.
 * <input type="checkbox" class="ui-checkbox">  <input type="radio" class="ui-radio">
 * ------------------------------------------------------------------------------------------- */

.ui-checkbox,
.ui-radio {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--line-control);
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
  transition-property: color, background-color, border-color;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-checkbox {
  border-radius: 5px;
}
.ui-radio {
  border-radius: 999px;
}
.ui-checkbox::before,
.ui-radio::before {
  content: "";
  opacity: 0;
  background: var(--on-contrast);
}
/* lucide Check at 12px, stroke 3. */
.ui-checkbox::before {
  width: 12px;
  height: 12px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* lucide Minus for indeterminate (set .indeterminate in JS, or add .is-indeterminate). */
.ui-checkbox:indeterminate::before,
.ui-checkbox.is-indeterminate::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
}
.ui-radio::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}
.ui-checkbox:checked,
.ui-checkbox:indeterminate,
.ui-checkbox.is-indeterminate,
.ui-radio:checked {
  border-color: var(--contrast);
  background: var(--contrast);
}
.ui-checkbox:checked::before,
.ui-checkbox:indeterminate::before,
.ui-checkbox.is-indeterminate::before,
.ui-radio:checked::before {
  opacity: 1;
}
.ui-checkbox:focus-visible,
.ui-radio:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-checkbox:disabled,
.ui-radio:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
/* A control and its words in a row. */
.ui-check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
  cursor: pointer;
}
.ui-check-row:has(:disabled) {
  cursor: not-allowed;
  opacity: 0.7;
}

/* ---------------------------------------------------------------------------------------------
 * Switch (switch.tsx): 36 x 20, on is solid contrast.
 * <input type="checkbox" role="switch" class="ui-switch">
 * ------------------------------------------------------------------------------------------- */

.ui-switch {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  width: 36px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-control);
  border-radius: var(--r-pill);
  background: var(--fill-hover);
  cursor: pointer;
  vertical-align: middle;
  transition-property: color, background-color, border-color;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-switch::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--slate2);
  transform: translateX(2px);
  transition-property: transform, background-color;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-switch:checked {
  border-color: var(--contrast);
  background: var(--contrast);
}
.ui-switch:checked::before {
  background: var(--on-contrast);
  transform: translateX(18px);
}
.ui-switch:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-switch:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* ToggleRow (toggle-row.tsx): a setting's name, a line under it, the switch on the right. */
.ui-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.ui-toggle-row-label {
  display: block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ink);
}
.ui-toggle-row-hint {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: var(--slate);
}

/* ---------------------------------------------------------------------------------------------
 * Segmented control (segmented-control.tsx) and segmented tabs (tabs.tsx look="segmented").
 * CSS-only with a radio group:
 *   <div class="ui-seg" role="radiogroup" aria-label="…">
 *     <label class="ui-seg-item"><input type="radio" name="v" checked><span>Week</span></label>…
 * or buttons with aria-pressed / aria-selected / aria-checked="true" when JS drives it.
 * ------------------------------------------------------------------------------------------- */

.ui-seg,
.ui-tabs {
  box-sizing: border-box;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  min-height: var(--h-sm);
  padding: 2px;
  border: 1px solid var(--fill-edge);
  border-radius: var(--r-pill);
  background: var(--fill);
}
.ui-seg-md,
.ui-tabs {
  min-height: var(--h-md);
  padding: 3px;
}
.ui-tabs {
  flex-wrap: nowrap;
}
/* A stadium radius only reads as one on a single row: a grid drops to 14px. */
.ui-seg-cols-2,
.ui-seg-cols-3 {
  display: grid;
  width: 100%;
  border-radius: 14px;
}
.ui-seg-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ui-seg-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ui-seg-item,
.ui-tab {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: calc(var(--h-sm) - 6px);
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--slate);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition-property: color, background-color;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-seg-md .ui-seg-item {
  height: calc(var(--h-md) - 8px);
  padding: 0 14px;
}
.ui-tab {
  flex: 1;
  height: calc(var(--h-md) - 8px);
  padding: 0 16px;
  gap: 7px;
}
.ui-seg-item svg,
.ui-tab svg {
  width: 14px;
  height: 14px;
}
.ui-seg-item > input,
.ui-tab > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.ui-seg-item:hover,
.ui-tab:hover {
  color: var(--ink);
}
.ui-seg-item:is([aria-pressed="true"], [aria-checked="true"], [aria-selected="true"], .is-on, :has(> input:checked)),
.ui-tab:is([aria-pressed="true"], [aria-checked="true"], [aria-selected="true"], .is-on, :has(> input:checked)) {
  background: var(--fill-lift);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--fill-edge);
}
.ui-tab:is([aria-selected="true"], .is-on, :has(> input:checked)) {
  font-weight: 700;
}
/* Ring flush to the pill so the selected item never bulges out of the track. */
.ui-seg-item:focus-visible,
.ui-seg-item:has(> input:focus-visible),
.ui-tab:focus-visible,
.ui-tab:has(> input:focus-visible) {
  outline: 2px solid var(--contrast);
  outline-offset: 0;
}
/* A second, quieter line ("FREE", "5 each"): the item goes two lines tall. */
.ui-seg-item:has(.ui-seg-sub) {
  flex-direction: column;
  gap: 0;
  height: 40px;
  line-height: 16px;
}
.ui-seg-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--ui-font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.8;
}
.ui-tab-count {
  font-family: var(--ui-font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
}

/* Page tabs (tabs.tsx look="page"): words with an underline under the page title. */
.ui-page-tabs {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-soft);
  scrollbar-width: none;
}
.ui-page-tab {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: baseline;
  gap: 8px;
  height: 36px;
  margin: 0;
  padding: 6px 0 0;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--slate2);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s var(--ui-ease);
}
.ui-page-tab > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.ui-page-tab:hover {
  color: var(--ink);
}
.ui-page-tab:focus-visible,
.ui-page-tab:has(> input:focus-visible) {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-page-tab:is([aria-selected="true"], [aria-current="page"], .is-on, :has(> input:checked)) {
  color: var(--ink);
}
.ui-page-tab:is([aria-selected="true"], [aria-current="page"], .is-on, :has(> input:checked))::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 999px;
  background: var(--select);
}
.ui-tab-panel {
  margin-top: 16px;
}

/* ---------------------------------------------------------------------------------------------
 * Stepper (stepper.tsx): one field-shaped box, minus / count / plus. Needs JS to count.
 * ------------------------------------------------------------------------------------------- */

.ui-stepper {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: var(--h-md);
  padding: 0 4px;
  border: 1px solid var(--line-control);
  border-radius: var(--r-ctl);
  background: var(--field);
  transition-property: border-color, box-shadow;
  transition-duration: 0.15s;
}
.ui-stepper:focus-within {
  border-color: var(--contrast);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--contrast) 15%, transparent);
}
.ui-stepper-btn {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--slate);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.ui-stepper-btn svg {
  width: 14px;
  height: 14px;
}
.ui-stepper-btn:hover {
  background: var(--fill-hover);
  color: var(--ink);
}
.ui-stepper-btn:disabled {
  pointer-events: none;
  opacity: 0.35;
}
.ui-stepper-value {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 40px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--ui-font-mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: center;
}
.ui-stepper-value:focus-visible {
  outline: none;
}

/* ---------------------------------------------------------------------------------------------
 * Slider (slider.tsx) as a native range. Track 4 tall, teal range, 16px thumb with a teal ring.
 * The filled part reads --ui-val (a percentage): <input type=range class=ui-slider style="--ui-val:40%">.
 * Keeping it live as the thumb moves needs JS (or Firefox, which fills it natively).
 * ------------------------------------------------------------------------------------------- */

.ui-slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}
.ui-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--select) var(--ui-val, 0%), var(--fill-hover) var(--ui-val, 0%));
}
.ui-slider::-moz-range-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--fill-hover);
}
.ui-slider::-moz-range-progress {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--select);
}
.ui-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 2px solid var(--select);
  border-radius: 999px;
  background: var(--surface-card);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  transition: background-color 0.15s;
}
.ui-slider::-moz-range-thumb {
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  border: 2px solid var(--select);
  border-radius: 999px;
  background: var(--surface-card);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}
.ui-slider:focus-visible {
  outline: none;
}
.ui-slider:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-slider:focus-visible::-moz-range-thumb {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-slider:disabled {
  cursor: default;
  opacity: 0.5;
}

/* ---------------------------------------------------------------------------------------------
 * Progress (progress.tsx): the system working, so teal, 4 tall.
 * <div class="ui-progress" role="progressbar" aria-valuenow="40"><span style="width:40%"></span></div>
 * or <progress class="ui-progress" value="40" max="100">.
 * ------------------------------------------------------------------------------------------- */

.ui-progress {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--teal) 18%, transparent);
  color: var(--teal);
}
.ui-progress > span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--teal);
  transition: width 0.3s var(--ui-ease);
}
progress.ui-progress::-webkit-progress-bar {
  background: transparent;
}
progress.ui-progress::-webkit-progress-value {
  border-radius: var(--r-pill);
  background: var(--teal);
}
progress.ui-progress::-moz-progress-bar {
  border-radius: var(--r-pill);
  background: var(--teal);
}

/* StepTrack (step-track.tsx): one bar per step of a short dialog, named underneath. */
.ui-step-track {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ui-step-track > li {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--faint);
}
.ui-step-track > li::before {
  content: "";
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--fill-hover);
  transition: background-color 0.15s;
}
.ui-step-track > li.is-done {
  color: var(--slate2);
}
.ui-step-track > li.is-done::before {
  background: color-mix(in srgb, var(--contrast) 45%, transparent);
}
.ui-step-track > li[aria-current="step"] {
  color: var(--ink);
}
.ui-step-track > li[aria-current="step"]::before {
  background: var(--contrast);
}
.ui-step-track > li > span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ui-step-track svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------------------------
 * Skeleton (skeleton.tsx)
 * ------------------------------------------------------------------------------------------- */

.ui-skeleton {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--r-ctl);
  background: color-mix(in srgb, var(--slate2) 16%, transparent);
  box-shadow: 0 0 0 1px var(--line);
}
.ui-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translateX(-100%);
  background: linear-gradient(to right, transparent, var(--surface-3), transparent);
  animation: ui-shimmer 1.8s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .ui-skeleton::after {
    animation: none;
  }
}
/* SkeletonCard: a title and body lines inside a glass card. */
.ui-skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: var(--r-card);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--gborder);
  box-shadow: var(--shadow-md);
}

/* ---------------------------------------------------------------------------------------------
 * Help popover (help-popover.tsx): CSS only. Hover or focus reveals.
 *   <span class="ui-help">
 *     <span class="ui-help-trigger" tabindex="0" aria-label="What is X?"><svg …/></span>
 *     <span class="ui-help-panel" role="tooltip"><span class="ui-help-title">What is X?</span>…</span>
 *   </span>
 * Modifiers on .ui-help: .ui-help-right, .ui-help-above, .ui-help-stretch.
 * ------------------------------------------------------------------------------------------- */

.ui-help {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}
.ui-help-stretch {
  position: static;
}
.ui-help-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  color: var(--slate2);
  cursor: pointer;
  transition: color 0.15s;
}
.ui-help-trigger svg {
  width: 16px;
  height: 16px;
}
.ui-help-trigger:hover {
  color: var(--ink);
}
.ui-help-trigger:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-help-panel {
  box-sizing: border-box;
  position: absolute;
  z-index: 50;
  top: 36px;
  left: 0;
  display: block;
  width: 288px;
  max-width: min(18rem, 80vw);
  padding: 12px;
  border: 1px solid var(--gborder);
  border-radius: var(--r-ctl);
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  color: var(--slate);
  text-align: left;
  white-space: normal;
  letter-spacing: normal;
  text-transform: none;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.15s var(--ui-ease),
    visibility 0.15s var(--ui-ease);
}
.ui-help-right .ui-help-panel {
  left: auto;
  right: 0;
}
.ui-help-above .ui-help-panel {
  top: auto;
  bottom: 36px;
}
.ui-help-stretch .ui-help-panel {
  top: 100%;
  left: 0;
  right: 0;
  width: auto;
  max-width: none;
  margin-top: 6px;
}
.ui-help-stretch.ui-help-above .ui-help-panel {
  top: auto;
  bottom: 100%;
  margin: 0 0 6px;
}
.ui-help:hover .ui-help-panel,
.ui-help:focus-within .ui-help-panel {
  visibility: visible;
  opacity: 1;
}
.ui-help-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--ink);
}

/* ---------------------------------------------------------------------------------------------
 * Display parts (display.tsx): SectionLabel, Note, Banner, Avatar, AvatarStack, Steps, Stat.
 * ------------------------------------------------------------------------------------------- */

.ui-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 16px;
  margin: 0;
  font-family: var(--ui-font-mono);
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate2);
}
.ui-section-label-right {
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--faint);
}

/* Note: one inline remark, four tones. The icon carries the tone. */
.ui-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--slate2);
}
.ui-note > svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: var(--faint);
}
.ui-note-body {
  flex: 1;
  min-width: 0;
}
.ui-note-action {
  flex-shrink: 0;
  margin: -4px 0;
}
.ui-note-system,
.ui-note-system > svg {
  color: var(--teal-ink);
}
.ui-note-success {
  color: var(--slate);
}
.ui-note-success > svg {
  color: var(--green-ink);
}
.ui-note-danger {
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--r-inner);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--ink);
}
.ui-note-danger > svg {
  color: var(--danger);
}

/* Banner: the strip above a page's content for a workspace-wide state. Caution (orange) or danger. */
.ui-banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--orange) 25%, transparent);
  border-radius: var(--r-card);
  background: color-mix(in srgb, var(--orange) 8%, transparent);
  color: var(--ink);
}
@media (min-width: 640px) {
  .ui-banner {
    flex-direction: row;
    align-items: center;
  }
}
.ui-banner-danger {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
.ui-banner-main {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: flex-start;
  gap: 12px;
}
.ui-banner-main > svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--orange);
}
.ui-banner-danger .ui-banner-main > svg {
  color: var(--danger);
}
.ui-banner-title {
  display: block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}
.ui-banner-text {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.625;
  color: var(--slate);
}

/* Avatar: round at 24, 32 (default) or 40. Initials when there is no photo. */
.ui-avatar {
  box-sizing: border-box;
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  overflow: hidden;
  width: 32px;
  height: 32px;
  border: 1px solid var(--fill-edge);
  border-radius: 999px;
  background: var(--raised);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: var(--heading-weight);
  color: var(--slate);
}
.ui-avatar-24 {
  width: 24px;
  height: 24px;
  font-size: 9.5px;
}
.ui-avatar-40 {
  width: 40px;
  height: 40px;
  font-size: 13px;
}
.ui-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
}
.ui-avatar-stack {
  display: inline-flex;
  align-items: center;
}
.ui-avatar-stack > * {
  box-shadow: 0 0 0 2px var(--bg);
}
.ui-avatar-stack > * + * {
  margin-left: -8px;
}
.ui-avatar-more {
  border: 0;
  background: var(--fill-hover);
  font-family: var(--ui-font-mono);
  font-weight: 600;
}

/* Steps: done / now / next, each with a mono note.
   <ol class="ui-steps"><li class="is-done"><span class="ui-step-mark"></span><span>Label</span><span class="ui-step-meta">0:12</span></li>… */
.ui-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ui-steps > li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--faint);
}
.ui-steps > li > span:nth-child(2) {
  flex: 1;
}
.ui-steps > li.is-done {
  color: var(--slate);
}
.ui-steps > li.is-now,
.ui-steps > li[aria-current="step"] {
  font-weight: 600;
  color: var(--ink);
}
.ui-step-mark {
  box-sizing: border-box;
  display: block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--line-control);
  border-radius: 999px;
}
.is-done > .ui-step-mark {
  border: 0;
  border-radius: 0;
  background-color: var(--teal-ink);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.is-now > .ui-step-mark,
[aria-current="step"] > .ui-step-mark {
  border-color: color-mix(in srgb, var(--teal) 30%, transparent);
  border-top-color: var(--teal);
  animation: ui-spin 1s linear infinite;
}
.ui-step-meta {
  font-family: var(--ui-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Stat: a label, the value, how it moved. */
.ui-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ui-stat-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ui-stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 32px;
  font-weight: var(--heading-weight);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.ui-stat-delta {
  font-family: var(--ui-font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--slate2);
}
.ui-stat-up {
  color: var(--green-ink);
}
.ui-stat-down {
  color: var(--danger);
}

/* ---------------------------------------------------------------------------------------------
 * SelectableCard (selectable-card.tsx): a 2px edge in both states, teal and a tick when picked.
 * <button class="ui-select-card" aria-pressed="true"> or <label class="ui-select-card"><input type=radio>…
 * ------------------------------------------------------------------------------------------- */

.ui-select-card {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  position: relative;
  display: block;
  margin: 0;
  padding: 15px;
  border: 2px solid var(--line-soft);
  border-radius: var(--r-inner);
  background: var(--raised);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition-property: color, background-color, border-color;
  transition-duration: 0.15s;
  transition-timing-function: var(--ui-ease);
}
.ui-select-card-media {
  overflow: hidden;
  padding: 0;
  background: transparent;
}
.ui-select-card:hover {
  border-color: var(--line-control);
}
.ui-select-card:focus-visible,
.ui-select-card:has(> input:focus-visible) {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-select-card > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.ui-select-card:is([aria-pressed="true"], [aria-checked="true"], .is-selected, :has(> input:checked)) {
  border-color: var(--select);
}
/* The tick: a 20px teal disc (::after) with a 12px off-black check (::before) on it. */
.ui-select-card:is([aria-pressed="true"], [aria-checked="true"], .is-selected, :has(> input:checked))::after,
.ui-select-card:is([aria-pressed="true"], [aria-checked="true"], .is-selected, :has(> input:checked))::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
}
.ui-select-card:is([aria-pressed="true"], [aria-checked="true"], .is-selected, :has(> input:checked))::after {
  border-radius: 999px;
  background: var(--select);
}
.ui-select-card:is([aria-pressed="true"], [aria-checked="true"], .is-selected, :has(> input:checked))::before {
  z-index: 1;
  top: 14px;
  right: 14px;
  width: 12px;
  height: 12px;
  background-color: var(--on-select);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.ui-select-card:disabled,
.ui-select-card:has(> input:disabled) {
  cursor: not-allowed;
  opacity: 0.4;
}

/* ---------------------------------------------------------------------------------------------
 * Empty states (components/empty-state.tsx) and ErrorState (error-state.tsx).
 * ------------------------------------------------------------------------------------------- */

/* EmptyPanel: a centred glass card for a region with nothing in it, and the next step. */
.ui-empty-panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 40px 32px;
  border-radius: var(--r-card);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--gborder);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.ui-empty-panel-icon,
.ui-error-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border: 1px solid var(--fill-edge);
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--slate);
}
.ui-empty-panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 28px;
  font-weight: var(--heading-weight);
  letter-spacing: -0.015em;
  color: var(--ink);
}
.ui-empty-panel-body {
  max-width: 440px;
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--slate2);
}
.ui-empty-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

/* EmptyState: the thin strip whose whole card is the one way out. */
.ui-empty {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line-control);
  border-radius: var(--r-inner);
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ui-ease);
}
.ui-empty:hover {
  background: var(--fill);
}
.ui-empty:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}
.ui-empty-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  border: 1px solid var(--fill-edge);
  border-radius: 999px;
  background: var(--fill);
  color: var(--slate);
}
.ui-empty-icon svg {
  width: 16px;
  height: 16px;
}
.ui-empty-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ui-empty-title {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--ink);
}
.ui-empty-body {
  font-size: 12px;
  line-height: 16px;
  color: var(--slate2);
}
.ui-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--ink);
}
.ui-empty-cta svg {
  width: 13px;
  height: 13px;
}

/* ErrorState: glass, a danger-tinted circle, a Sora title, slate body, optional Try again. */
.ui-error-state {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  border-radius: var(--r-card);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--gborder);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.ui-error-state-icon {
  margin-bottom: 0;
  border: 0;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}
.ui-error-state-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  color: var(--ink);
}
.ui-error-state-body {
  max-width: 24rem;
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--slate);
}

/* ---------------------------------------------------------------------------------------------
 * Toast (toast.tsx, sonner classNames), static.
 * ------------------------------------------------------------------------------------------- */

.ui-toast {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border: 1px solid var(--line-control);
  border-radius: 22px;
  background: var(--surface-card);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.ui-toast-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}
.ui-toast-desc {
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: var(--slate2);
}
.ui-toast-action,
.ui-toast-cancel {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  height: 30px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.ui-toast-action {
  background: var(--contrast);
  color: var(--on-contrast);
}
.ui-toast-cancel {
  background: transparent;
  color: var(--slate2);
}
.ui-toast-action:focus-visible,
.ui-toast-cancel:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------------------------
 * Dialog and sheet surfaces (dialog.tsx, sheet.tsx). Static styles; on a <dialog> element the
 * browser does the centring and the backdrop. Opening one with showModal() needs JS.
 * ------------------------------------------------------------------------------------------- */

/* Dialog content is SOLID (surface-card), never glass: translucent over a blurred overlay is unreadable. */
.ui-dialog {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 512px;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  background: var(--surface-card);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}
dialog.ui-dialog {
  width: calc(100vw - 2rem);
}
dialog.ui-dialog:not([open]) {
  display: none;
}
dialog.ui-dialog::backdrop,
dialog.ui-sheet::backdrop {
  background: color-mix(in srgb, var(--scrim) 30%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
/* On a phone a modal dialog is a bottom sheet: full width, square bottom corners. */
@media (max-width: 639px) {
  dialog.ui-dialog:modal {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: auto 0 0;
    padding: 20px 20px max(1.25rem, env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
    border-radius: var(--r-card) var(--r-card) 0 0;
  }
}
.ui-dialog-header,
.ui-sheet-header {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  gap: 6px;
}
.ui-dialog-title,
.ui-sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  color: var(--ink);
}
.ui-dialog-desc,
.ui-sheet-desc {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--slate);
}
.ui-dialog-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  margin-right: -8px;
  padding-right: 8px;
}
.ui-dialog-footer {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
/* The corner X: 36px, slate, top right. */
.ui-dialog-close {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--slate);
  cursor: pointer;
  transition: color 0.15s;
}
.ui-dialog-close svg {
  width: 18px;
  height: 18px;
}
.ui-dialog-close:hover {
  color: var(--ink);
}
.ui-dialog-close:focus-visible {
  outline: 2px solid var(--contrast);
  outline-offset: 2px;
}

/* Sheet: glass, flex column, gap 16, padding 24. Right side by default, w 3/4 up to 384. */
.ui-sheet {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  width: 100%;
  padding: 24px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--gborder);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}
@media (min-width: 640px) {
  .ui-sheet {
    width: 75%;
    max-width: 384px;
  }
}
.ui-sheet-bottom {
  width: 100%;
  max-width: none;
  border-radius: var(--r-card) var(--r-card) 0 0;
}
dialog.ui-sheet {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: none;
}
dialog.ui-sheet:not([open]) {
  display: none;
}

/* Visually hidden, still read (sr-only). */
.ui-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 21 Nov: small uppercase labels in Geist Mono, like the home page */
.ui-media-badge,
.ui-menu-label,
.ui-section-label,
.ui-seg-sub,
.ui-step-meta{font-family:var(--font-mono)!important;font-weight:400!important;letter-spacing:.08em!important}
