/*
 * primitives.css — tokens, layout, typography, and surface primitives.
 *
 * Composable classes that should cover the vast majority of layout needs
 * without requiring new CSS. Color and spacing tokens come from tokens.css.
 * Font-size, radius, and transition timing tokens are defined in the
 * :root block below.
 *
 * See vault.css for DESIGN SYSTEM RULES and domain-class conventions.
 *
 * Load order (set in app/views/layouts/application.html.erb):
 *   1. tokens.css     — defines :root color/spacing/shadow tokens
 *   2. primitives.css  — this file (additional tokens + composable classes)
 *   3. components.css  — domain component classes
 *   ...area files
 *
 * Spacing values use calc(var(--spacing) * N). Font-size, border-radius,
 * and transition timing use the tokens defined below.
 *
 * Allowed multipliers for `calc(var(--spacing) * N)` on rhythm properties
 * (gap, padding, margin, inset): {1, 2, 4, 6, 8} = {4px, 8px, 16px, 24px, 32px}.
 * Snap up to the nearest stop when introducing new values; the one exception
 * is `* 2.5 → * 2` (tighten). Multipliers ≥ 11 are allowed for layout
 * dimensions (sidebar widths, max-widths, toggle geometry) but not for
 * rhythmic spacing. Internal-geometry exceptions (e.g. toggle slider/track
 * sizing, where one value must equal another minus a border) may keep
 * off-scale multipliers with a comment flagging the reason.
 */


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

/*
 * Design tokens for font-size, border-radius, and transition timing.
 * These supplement the --color-* and --spacing tokens from tokens.css.
 *
 * Font-size ladder: 10 steps from 0.625rem (--font-size-2xs, micro labels)
 * to 3rem (--font-size-5xl, hero headings). The scale matches Tailwind
 * class names 1:1: --font-size-sm = text-sm = 0.875rem, --font-size-xs =
 * text-xs = 0.75rem, etc. The app's default body text is --font-size-base
 * (1rem); secondary text is --font-size-sm (0.875rem); captions/labels
 * are --font-size-xs (0.75rem).
 *
 * Border-radius ladder: 7 steps. --radius-xs through --radius-xl match
 * Tailwind v4's built-in theme values (duplicated here so they survive
 * Phase 6 removal). --radius-pill uses an absurdly large value for
 * fully-rounded pill shapes.
 *
 * Transition timing: 3 speeds. Use as the timing portion of a transition
 * declaration: `transition: all var(--transition-timing-standard)`.
 */
:root {
  --font-size-2xs: 0.625rem;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;

  --radius-xs: 0.125rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-pill: 9999rem;

  --transition-timing-quick: 120ms ease;
  --transition-timing-standard: 150ms ease;
  --transition-timing-slow: 200ms ease-in-out;

  /* Page rhythm — horizontal padding used by .app-shell-content-padded and
   * .app-shell-navigation so the title bar and page content line up at the
   * same gutter. 48px is the desktop default; it is reduced on mobile via the
   * max-width overrides below this :root block. Off the --spacing scale because
   * it's a layout dimension, not rhythm. */
  --spacing-page-x: 3rem;

  /* Page rhythm — bottom padding used by .app-shell-content-padded. Deeper than
   * the horizontal gutter because the support chat launcher
   * (app/views/application/_hubspot_chat.html.erb) is fixed to the bottom-right
   * corner of the viewport, outside the document flow, and measures 100×96
   * collapsed. A page whose last element is a right-aligned action row — every
   * form's submit button — puts that button under the bubble once the page is
   * scrolled to the end unless the shell reserves the corner. 96px of launcher
   * plus a 16px gap. Same on mobile: the launcher keeps its size when the
   * horizontal gutter shrinks. */
  --spacing-page-bottom: calc(var(--spacing) * 28);

  /*
   * Semantic typography scale.
   *
   * Each step bundles four properties — font-size, line-height,
   * letter-spacing, font-weight — that should be applied together on a text
   * element. Use the role (display / h1 / h2 / h3 / lead / body / body-sm /
   * caption) when picking a step, not a raw pixel size.
   *
   *   display   page-defining hero headline
   *   h1        large section headline (page title on hero pages)
   *   h2        section heading
   *   h3        subsection / card heading
   *   lead      large intro paragraph; hero subtitle
   *   body      default body text
   *   body-sm   secondary body text
   *   caption   small labels (stat-card label, detail-row label, eyebrow)
   *
   * Headlines use clamp() so they scale fluidly from mobile to ultrawide
   * without per-breakpoint overrides. Component CSS may override individual
   * properties on the same selector when a specific layout calls for it
   * (e.g. StatCard tightens the h1 value to 2.25rem-3rem and 1.05 leading).
   *
   * The --font-size-* ladder above remains the low-level utility scale for
   * cases where only the size matters and the role is incidental — labels
   * inside a chrome element, micro text, etc. Prefer the --type-* roles
   * for any content-level text.
   */
  --type-display-size:           clamp(2.75rem, 6.5vw, 5.25rem);
  --type-display-line-height:    1.05;
  --type-display-letter-spacing: -0.04em;
  --type-display-weight:         600;

  --type-h1-size:           clamp(2.25rem, 4.5vw, 3.5rem);
  --type-h1-line-height:    1.08;
  --type-h1-letter-spacing: -0.03em;
  --type-h1-weight:         600;

  --type-h2-size:           clamp(1.75rem, 3vw, 2.5rem);
  --type-h2-line-height:    1.12;
  --type-h2-letter-spacing: -0.022em;
  --type-h2-weight:         600;

  --type-h3-size:           1.375rem;
  --type-h3-line-height:    1.25;
  --type-h3-letter-spacing: -0.012em;
  --type-h3-weight:         600;

  --type-lead-size:           clamp(1.125rem, 1.4vw, 1.375rem);
  --type-lead-line-height:    1.45;
  --type-lead-letter-spacing: -0.005em;
  --type-lead-weight:         400;

  --type-body-size:        1.0625rem;
  --type-body-line-height: 1.55;
  --type-body-weight:      400;

  --type-body-sm-size:        0.9375rem;
  --type-body-sm-line-height: 1.5;
  --type-body-sm-weight:      400;

  --type-caption-size:        0.8125rem;
  --type-caption-line-height: 1.4;
  --type-caption-weight:      400;
}

/* Mobile page gutters — shrink the shared page-x gutter so content isn't
 * squished on phones. Both .app-shell-content-padded and .app-shell-navigation
 * read --spacing-page-x, so header and content gutters stay aligned. The 40rem
 * rule comes second so it wins when both match (≤640px → 16px). */
@media (max-width: 48rem) {
  :root {
    --spacing-page-x: calc(var(--spacing) * 6); /* 24px */
  }
}

@media (max-width: 40rem) {
  :root {
    --spacing-page-x: calc(var(--spacing) * 4); /* 16px */
  }
}


/* ---------- Layout primitives ---------- */

/*
 * .stack — vertical flow with consistent gap between children.
 *
 *   .stack-sm  (8px)  — inline pairs and dense rhythm:
 *                       icon + label, avatar + name,
 *                       form label + input, checkbox rows.
 *   .stack     (16px) — component-level stacking:
 *                       list item rows, action button groups,
 *                       card internals, modal footers.
 *   .stack-lg  (24px) — section-level breathing room:
 *                       form sections, settings page body,
 *                       major visual breaks.
 *   .stack-xl  (32px) — major landing-page rows on the dashboard
 *                       (action items, milestones, quick actions,
 *                       stats, charts, recent items).
 *
 * If a layout wants a gap between these stops, pick the nearest size —
 * small drift is better than ad-hoc one-offs. Add a fifth size only
 * after at least two migrated areas independently want the same value.
 */
.stack {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 4);
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 2);
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 6);
}

.stack-xl {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 8);
}

/*
 * .stack-center — vertical flex, centered on both axes, no gap.
 *
 * Content flows top-to-bottom with both horizontal and vertical
 * centering inside the container. Use for:
 *   - Empty states (icon + message + optional CTA, dead-center)
 *   - Loading shells (spinner + text in a fixed-height card)
 *   - Placeholder surfaces where content must center regardless of
 *     wrapper height
 *
 * Intentionally alignment-only — no gap. Children that need rhythm
 * should carry their own margin, or compose .stack / .stack-sm onto
 * a nested wrapper. This keeps .stack-center orthogonal to the
 * stack-size ladder rather than multiplying it by 2.
 */
.stack-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/*
 * .row — horizontal flex that wraps, vertically centered (16px gap).
 *
 * Use for component-level horizontal layout: form field rows,
 * action rows, toolbar groupings. The horizontal counterpart to
 * .stack — same 16px rhythm, same "component-level" intent.
 *
 * .row-between adds justify-content: space-between.
 */
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 4);
}

.row-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 4);
}

/*
 * .row-end — row where children align to the end (right in LTR).
 * Useful for submit-button rows at the bottom of a form.
 */
.row-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: calc(var(--spacing) * 4);
}

/*
 * .row-nowrap — horizontal flex, center-aligned, no wrap (16px gap).
 *
 * Use when a horizontal group at the .row rhythm (16px) must stay on
 * one line at all container widths. Toolbars, action button clusters,
 * inline metadata rows, sticky headers, and section headers where
 * wrapping would break the visual grouping all want this primitive.
 *
 * Contrast with .row (wraps, same gap, same alignment — use when
 * wrapping is fine and items can flow to the next line) and .row-sm
 * (also nowrap, but 8px gap for tighter inline-pair rhythm).
 */
.row-nowrap {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 4);
}

/*
 * .cluster — horizontal flex for tag groups, button groups, pills
 * (8px gap). The horizontal counterpart to .stack-sm — tight,
 * inline-pair rhythm when the children are peers rather than a
 * stacked list.
 */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

/*
 * .row-sm — horizontal flex, center-aligned, no wrap (8px gap).
 * Use when an icon/label/badge pair must stay on one line at all
 * component widths. Contrast with .cluster (same gap, but wraps when
 * content overflows) and .row (wraps, same alignment, but 16px gap
 * for looser rhythm).
 */
.row-sm {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

/*
 * .switcher — row that collapses to stack below 30rem container width.
 * Classic Every Layout trick: flex-basis flip via calc.
 */
.switcher {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 4);
}

.switcher > * {
  flex-grow: 1;
  flex-basis: calc((30rem - 100%) * 999);
}

/*
 * .center — max-width container, horizontally centered,
 * with side padding so content doesn't hug the viewport.
 */
.center {
  max-width: 64rem;
  margin-inline: auto;
  padding-inline: calc(var(--spacing) * 4);
}

/*
 * .grid-auto — auto-fit grid with 16rem minimum column width.
 * Columns reflow responsively without media queries.
 */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: calc(var(--spacing) * 4);
}

/*
 * .grid-2 / .grid-3 — fixed-column grids with 16px gap.
 *
 * Use when the column count is an authored layout choice, not a
 * reflow behavior. Card-pair layouts, 2-up stat rows, 3-up summary
 * tiles, form sections with a fixed column count. Columns stay
 * equal-width via `repeat(N, minmax(0, 1fr))` — the minmax(0, ...)
 * lets children shrink below their intrinsic width when content
 * pushes wider than the column.
 *
 * Reach for .grid-auto instead when columns should reflow
 * responsively with the container width. If a layout wants 4+
 * columns, write a domain class — the primitive ladder stops at 3
 * to keep the set small.
 */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--spacing) * 4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--spacing) * 4);
}

/*
 * .box — padded container with rounded corners, subtle border,
 * and the primary surface background. Combine with .stack for
 * a card with vertically-flowing contents.
 */
.box {
  padding: calc(var(--spacing) * 6);
  border-radius: var(--radius-xl);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-subtle);
}


/* ---------- Typography ---------- */

.text-heading {
  color: var(--color-text-heading);
  font-weight: 600;
}

.text-body {
  color: var(--color-text-body);
}

.text-muted {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.text-accent {
  color: var(--color-accent);
}

.text-red {
  color: var(--color-text-danger);
}


/* ---------- Text utilities ---------- */

/*
 * .truncate — single-line text overflow with ellipsis.
 * Used heavily on table cells, file names, and list items across the app.
 * Replaces Tailwind's `truncate` utility.
 */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .text-right — right-aligned text.
 * Used on table header cells and data cells for numeric columns
 * (prices, counts, dates). Also usable on any block element.
 */
.text-right {
  text-align: right;
}


/* ---------- Surfaces ---------- */

.surface {
  background: var(--color-surface-primary);
  color: var(--color-text-body);
}

.surface-elevated {
  background: var(--color-surface-elevated);
  box-shadow: var(--shadow-card);
}

.border-subtle {
  border: 1px solid var(--color-border-subtle);
}

/*
 * .interactive-surface — adds hover background feedback and the shared keyboard
 * focus ring to clickable/tappable elements. Cursor changes to pointer on hover.
 *
 * Use on: list rows, dropdown items, card actions, nav links —
 * any element where hover is the ONLY interactive visual change.
 * Do NOT use when hover also changes color, border, or shadow — write
 * a dedicated :hover rule for those.
 *
 * The :focus-visible ring means anything wearing this class is keyboard-visible
 * for free; on a non-focusable host it simply never matches. Elements that run
 * full-bleed inside a clipping container should override it with an inset ring
 * so the ring isn't cut off (see .component-list-filter-option).
 *
 * NOTE: does NOT include a transition. If a fade-in is required,
 * keep the `transition` declaration on the base rule.
 */
.interactive-surface:hover {
  background: var(--color-surface-hover);
}

.interactive-surface {
  cursor: pointer;
}

.interactive-surface:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}


/* ---------- Dropzone primitives ---------- */

/*
 * .dropzone-surface — visual styling for a Dropzone.js file drop target.
 * Dashed border, centered column layout, padded interior. Place alongside
 * the Dropzone.js .dz-message / .dz-default classes.
 *
 * Covers the common pattern shared by vault, vendor_lists, client_dashboard,
 * and data_sources upload flows.
 *
 * The :hover rule improves affordance; cursor: pointer signals interactivity.
 * Both were present in data_sources and are good defaults for every dropzone.
 */
.dropzone-surface {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--spacing) * 8);
  border: 2px dashed var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface-primary);
  color: var(--color-text-heading);
  cursor: pointer;
}

.dropzone-surface:hover {
  border-color: var(--color-border-strong);
}

/*
 * Dropzone.js adds .dz-started to the wrapper once a file is accepted.
 * This app does not import Dropzone's own stylesheet, so without this
 * rule the drop target stays visible above the upload preview.
 */
.dropzone.dz-started .dropzone-surface {
  display: none;
}

/*
 * .dropzone-surface-persistent
 * Opt-out modifier for the .dz-started hide above: keeps the drop target
 * on screen after the first file is accepted, so the surface still reads
 * as "drop more here" for the rest of the session.
 *
 * Where used:
 *   - app/views/client_uploads/upload.html.erb (client upload dropbox)
 *
 * When to reuse: A multi-file dropzone where the drop target must stay
 *   visible so more files can be added.
 * When NOT to: Single-file dropzones — they want the default hide, which
 *   clears the target once the one file is queued.
 */
.dropzone.dz-started .dropzone-surface.dropzone-surface-persistent {
  display: flex;
}

/**
 * .dropzone-crop-button
 * Crop/confirm button overlaid on a dropzone image preview.
 * Positioned at the bottom of the preview, full width.
 *
 * Where used (JS classList.add):
 *   - app/javascript/controllers/dropzone_controller.js
 */
.dropzone-crop-button {
  position: absolute;
  inset-inline: 0;
  background: var(--color-blue-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  text-align: center;
  color: var(--color-text-inverted);
}


/* ---------- Upload primitives ---------- */

/*
 * .upload-icon — sizing and color for the cloud-upload icon inside a
 * dropzone. 4rem wide, brand-colored.
 */
.upload-icon {
  width: 4rem;
  margin-top: calc(var(--spacing) * 4);
  margin-bottom: calc(var(--spacing) * 4);
  color: var(--color-brand-primary);
}

/*
 * .upload-browse — accent "browse" link text inside dropzone instructions.
 * Brand-colored, underlines on hover.
 */
.upload-browse {
  color: var(--color-brand-primary);
  cursor: pointer;
}

.upload-browse:hover {
  text-decoration: underline;
}

/*
 * .upload-error — inline error panel shown when a file upload fails.
 * Red text on an elevated surface.
 */
.upload-error {
  position: relative;
  width: 100%;
  padding: calc(var(--spacing) * 4);
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-danger);
  background: var(--color-surface-elevated);
  border-radius: var(--radius-lg);
}

/*
 * .upload-spinner — centered spinner wrapper shown during upload processing.
 * Toggled via the .hidden utility by Stimulus controllers.
 */
.upload-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: calc(var(--spacing) * 8);
  color: var(--color-text-muted);
}

.upload-spinner-icon {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: calc(var(--spacing) * 4);
}


/* ---------- Upload preview primitives ---------- */

/*
 * .upload-details — outer wrapper for a Dropzone preview partial.
 * Provides vertical spacing and a positioning context.
 */
.upload-details {
  position: relative;
  margin-top: calc(var(--spacing) * 2);
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .upload-preview — file preview card shown inside a dropzone after a
 * file is selected. Contains filename, size, and progress bar.
 * Based on the shared _upload_details.html.erb partial style.
 */
.upload-preview {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 5);
  width: 100%;
  border-radius: var(--radius-2xl);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-body);
}

/*
 * .upload-preview-header — flex row: filename (truncated) + file size.
 */
.upload-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/*
 * .upload-preview-name — truncated filename display.
 */
.upload-preview-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .upload-preview-size — file size display, right-aligned.
 */
.upload-preview-size {
  flex: 1;
  white-space: nowrap;
  text-align: right;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .upload-preview-remove — clears the selected file from a dropzone that
 * takes one file, so a wrong pick can be undone without reloading the page.
 */
.upload-preview-remove {
  display: inline-flex;
  align-items: center;
  margin-left: calc(var(--spacing) * 3);
  color: var(--color-text-muted);
  cursor: pointer;
}
.upload-preview-remove:hover {
  color: var(--color-text-danger);
}

/* ---------- Visibility ---------- */

/*
 * .hidden — hides an element from layout.
 * Used extensively by Stimulus controllers for visibility toggling
 * (classList.toggle('hidden')). Do not remove or rename without
 * auditing app/javascript/controllers/ for all toggle sites.
 *
 * Uses !important because this is a state class that must always win
 * over component display values (flex, grid, block, etc.) regardless
 * of source order. Previously, Tailwind's layer ordering guaranteed
 * this; now we need !important to achieve the same effect.
 */
.hidden {
  display: none !important;
}

/*
 * .sr-only — visually hides an element while keeping it accessible
 * to screen readers. Used on form labels, close-button text, and
 * other elements that need to be announced but not seen.
 */
.sr-only {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/*
 * .antialiased — enables subpixel antialiasing for smoother text.
 * Applied to <body> in the application layout.
 */
.antialiased {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ---------- Animations ---------- */

/*
 * .spin — continuous rotation animation for spinner icons.
 * Applied to 'spinner-third' icons across loading states throughout
 * the app (buttons, tables, audiences, lists, uploads, etc.).
 */
.spin {
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/*
 * .rotate-collapsed — rotates an element -90deg.
 * Used by form_section_controller.js to collapse the chevron icon
 * when a section is folded. The controller toggles this class.
 */
.rotate-collapsed {
  transform: rotate(-90deg);
}

.rotate-90 {
  transform: rotate(90deg);
}

.rotate-180 {
  transform: rotate(180deg);
}


/* ---------- Icon sizing ---------- */

/*
 * Icon size ladder — sets both width and height to consistent square sizes.
 * Applied to IconComponent via the `class:` param and to inline SVGs.
 * Each size has a flex-shrink: 0 to prevent icons from collapsing in flex
 * containers.
 *
 * .icon-2xs (0.875rem / 14px) — small UI affordance icons
 * .icon-xs  (0.75rem / 12px) — smallest inline icons, chevrons, status dots
 * .icon-sm  (1rem / 16px)    — default inline icons in text, form fields
 * .icon-md  (1.25rem / 20px) — medium icons in buttons, nav items
 * .icon-lg  (1.5rem / 24px)  — larger icons in cards, empty states
 * .icon-xl  (2rem / 32px)    — hero icons, feature illustrations
 */
.icon-2xs {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  fill: currentColor;
}

.icon-xs {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
  fill: currentColor;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  fill: currentColor;
}

.icon-md {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  fill: currentColor;
}

.icon-lg {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  fill: currentColor;
}

.icon-xl {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  fill: currentColor;
}

/*
 * .icon-theme-light / .icon-theme-dark
 * The two files of a brand mark that can't be recolored (IconComponent
 * DARK_VARIANTS): the light-surface mark shows in the light theme, the
 * official dark-surface mark in the dark one. Only hides; the shown file keeps
 * whatever display its own classes give it.
 *
 * Where used: app/components/icon_component.rb
 * When to reuse: a brand mark whose owner supplies separate files per surface.
 * When NOT to use: icons that take currentColor; they follow the theme already.
 */
:root:not([data-theme="dark"]) .icon-theme-dark,
[data-theme="dark"] .icon-theme-light {
  display: none;
}

/*
 * Avatar sizing — fixed dimensions for user_avatar helper output.
 *
 * .avatar-sm  (1.25rem / 20px, initials at --font-size-sm) — compact inline avatars (autocompletes, task rows)
 * .avatar-md  (1.5rem / 24px) — standard inline avatars (team capacity tables)
 * .avatar-lg  (2rem / 32px)   — card-level avatars (member cards)
 */
.avatar-sm {
  width: 1.25rem;
  height: 1.25rem;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.avatar-md {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.avatar-lg {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}


/* ---------- Animation state classes ---------- */

/*
 * Dropdown animation — scale + opacity transition used by the animation
 * Stimulus controller (via stimulus-use's useTransition) on dropdown menus,
 * popovers, and select panels throughout the app.
 *
 * The animation controller reads class names from data-enter-active,
 * data-enter-from, data-enter-to, data-leave-active, data-leave-from,
 * data-leave-to attributes and applies/removes them during the transition
 * cycle. Each attribute value is a single class name (not a space-separated
 * list of Tailwind utilities).
 *
 * Components using this pattern:
 *   topbar, sidebar settings menu, list filter dropdown, data source dropdown,
 *   page size select, page header search, insights dropdown, status dropdown,
 *   audiences forms group/condition/geography/frontend dropdowns.
 */
.anim-dropdown-enter-active {
  transition: opacity 100ms cubic-bezier(0, 0, 0.2, 1), transform 100ms cubic-bezier(0, 0, 0.2, 1);
}

.anim-dropdown-enter-from {
  opacity: 0;
  transform: scale(0.95);
}

.anim-dropdown-enter-to {
  opacity: 1;
  transform: scale(1);
}

.anim-dropdown-leave-active {
  transition: opacity 75ms cubic-bezier(0.4, 0, 1, 1), transform 75ms cubic-bezier(0.4, 0, 1, 1);
}

.anim-dropdown-leave-from {
  opacity: 1;
  transform: scale(1);
}

.anim-dropdown-leave-to {
  opacity: 0;
  transform: scale(0.95);
}

/*
 * Sidebar slide animation — translateX transition for the mobile sidebar panel.
 * Panel slides in from -100% (off-screen left) to 0 on enter, and back out
 * on leave. 300ms ease-in-out matches the original Tailwind timing.
 *
 * Used by: sidebar_component.html.erb mobile panel element.
 */
.anim-sidebar-slide-enter-active {
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.anim-sidebar-slide-enter-from {
  transform: translateX(-100%);
}

.anim-sidebar-slide-enter-to {
  transform: translateX(0);
}

.anim-sidebar-slide-leave-active {
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.anim-sidebar-slide-leave-from {
  transform: translateX(0);
}

.anim-sidebar-slide-leave-to {
  transform: translateX(-100%);
}

/*
 * Sidebar fade animation — opacity transition for the mobile sidebar
 * backdrop and close button. 300ms linear matches the original Tailwind timing.
 *
 * Used by: sidebar_component.html.erb backdrop and close-button elements.
 */
.anim-sidebar-fade-enter-active {
  transition: opacity 300ms linear;
}

.anim-sidebar-fade-enter-from {
  opacity: 0;
}

.anim-sidebar-fade-enter-to {
  opacity: 1;
}

.anim-sidebar-fade-leave-active {
  transition: opacity 300ms linear;
}

.anim-sidebar-fade-leave-from {
  opacity: 1;
}

.anim-sidebar-fade-leave-to {
  opacity: 0;
}

/*
 * Sidebar overlay animation — transition timing only (no from/to state).
 * The overlay container uses this for its enter/leave transition timing
 * while its children (backdrop, panel, close button) handle their own
 * state transitions independently.
 *
 * Used by: sidebar_component.html.erb mobile overlay container.
 */
.anim-sidebar-overlay-enter-active {
  transition: all 300ms linear;
}

.anim-sidebar-overlay-leave-active {
  transition: all 300ms linear;
}

/*
 * .link-accent
 * Accent-colored text link with hover underline. Cross-area primitive for
 * inline links in auth pages, settings, footers, and back-navigation.
 *
 * Where used:
 *   - app/views/sessions/new.html.erb (sign-up and forgot-password links)
 *   - app/views/registrations/new.html.erb (sign-in link)
 *   - app/views/passwords/new.html.erb (sign-in link)
 *   - app/views/webhook_deliveries/show.html.erb (back link and webhook link)
 *
 * When to reuse: Any inline text link that should be accent-colored with
 *   hover underline.
 * When NOT to: Navigation items, button-styled links, or links that need
 *   different hover behavior — use component-level styling instead.
 */
.link-accent {
  color: var(--color-accent-strong);
  text-decoration: underline;
}

.link-accent:hover {
  color: var(--color-accent-strong-hover);
}

/* Inline text link, so the ring hugs the glyphs instead of a rectangular
 * input box — the smallest step on the radius ladder keeps it close to the
 * text rather than reading as a callout. Still the shared accent ring, not
 * a redefined color. */
.link-accent:focus-visible {
  outline: none;
  border-radius: var(--radius-xs);
  box-shadow: var(--focus-ring);
}
