/*
 * components.css — domain CSS classes for ViewComponents.
 *
 * ============================================================
 *  DESIGN SYSTEM RULES — read before adding any CSS to this file
 * ============================================================
 *
 *  1. VALUES
 *     Never hardcode colors or spacing. Always use var(--color-*) and
 *     calc(var(--spacing) * N). No #hex, no rgb(), no raw px/rem for
 *     color or spacing. Raw rem is OK for non-spacing, non-color
 *     dimensions (max-width, border-radius, font-size, breakpoints)
 *     when no token fits — but prefer tokens where they exist.
 *
 *  2. REACH FOR PRIMITIVES FIRST (see primitives.css)
 *       Layout?      Use .stack, .stack-sm, .stack-lg, .row, .row-between,
 *                    .cluster, .switcher, .center, .grid-auto, .box.
 *       Typography?  Use .text-heading, .text-body, .text-muted, .text-accent, .text-red.
 *       Surface/bg?  Use .surface, .surface-elevated, .border-subtle.
 *     If the markup can be expressed as primitives, STOP. Do not create
 *     a new class. Duplication is worse than an imperfect class name.
 *
 *  3. NEW CLASSES — NAMING
 *     All classes in this file are prefixed .component-*.
 *     Cross-area primitives live in primitives.css and stay unprefixed.
 *     Do NOT add new primitives from inside this file — discuss first.
 *
 *  4. DOCUMENT
 *     Every class gets a doc-comment block directly above it stating:
 *       - What the class represents
 *       - Where it's used (file paths)
 *       - When to reuse it
 *       - When NOT to use it (and what to use instead)
 *     This is the agent-legibility feature. Without it, agents can't
 *     tell when to reuse vs when to create.
 *
 *  5. NO NESTING beyond one level. No @apply. No utility-class soup.
 *     If you find yourself writing `.foo .bar .baz { ... }`, stop and
 *     rethink. Flat CSS only.
 *
 *  6. WHEN IN DOUBT, REUSE.
 *     An imperfect class name you can rename later is better than
 *     two classes that drift apart.
 *
 * ============================================================
 *
 */


/* ─── Prose (cross-component typography) ─── */

/*
 * .prose — rich text content rendering for authored Help content.
 * Replaces @tailwindcss/typography.
 *
 * Used by:
 *   - app/views/help/guide.html.erb
 *
 * Reuse when: rendering user-authored or CMS-generated HTML content
 *   that may contain paragraphs, lists, links, headings, or inline formatting.
 * Do NOT use for: structured UI content — use primitives and domain classes.
 */
.prose {
  font-size: var(--font-size-sm);
  line-height: 1.625;
  color: var(--color-text-body);
}

.prose p {
  margin-block: 1em;
}

.prose p:first-child {
  margin-block-start: 0;
}

.prose p:last-child {
  margin-block-end: 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-weight: 600;
  color: var(--color-text-heading);
  line-height: 1.3;
  margin-block: 1.5em 0.5em;
}

.prose h1:first-child,
.prose h2:first-child,
.prose h3:first-child,
.prose h4:first-child {
  margin-block-start: 0;
}

.prose h1 { font-size: var(--font-size-xl); }
.prose h2 { font-size: var(--font-size-lg); }
.prose h3 { font-size: var(--font-size-base); }
.prose h4 { font-size: var(--font-size-sm); }

.prose a {
  color: var(--color-accent);
  text-decoration: underline;
}

.prose a:hover {
  opacity: 0.8;
}

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

.prose ul,
.prose ol {
  padding-inline-start: 1.5em;
  margin-block: 1em;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose li {
  margin-block: 0.25em;
}

.prose img {
  max-width: 100%;
  border-radius: var(--radius-md);
}

.prose blockquote {
  border-inline-start: 0.25rem solid var(--color-border-themed);
  padding-inline-start: 1em;
  color: var(--color-text-muted);
  margin-block: 1em;
}

.prose hr {
  border: none;
  border-block-start: 0.0625rem solid var(--color-border-themed);
  margin-block: 2em;
}

.prose code {
  font-size: 0.875em;
  background: var(--color-surface-elevated);
  padding: 0.125em 0.25em;
  border-radius: var(--radius-xs);
}

.prose pre {
  background: var(--color-surface-elevated);
  padding: 1em;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-block: 1em;
}

.prose pre code {
  background: none;
  padding: 0;
}

/* ─── Chart empty state (cross-area) ─── */

/*
 * .chart-empty-state — centered message shown when a chart has no data.
 * Replaces the canvas and fills the parent container height.
 *
 * Used by (JS createElement):
 *   - app/javascript/controllers/dashboard/email_performance_chart_controller.js
 *   - app/javascript/controllers/email_campaigns/opens_clicks_chart_controller.js
 *   - app/javascript/controllers/email_campaigns/engagement_funnel_chart_controller.js
 *   - app/javascript/controllers/client_dashboard/ads_daily_chart_controller.js
 *
 * Reuse when: any Chart.js canvas needs a no-data fallback.
 * Do NOT use for: full-page empty states — use EmptyStateComponent.
 */
.chart-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ─── BaseErrorsComponent ─── */

/*
 * .component-base-error
 * Inline error message for model-level (base) validation errors.
 * Small red text with top margin, rendered inside forms to surface
 * errors not tied to a specific field.
 *
 * Used by: app/components/base_errors_component.html.erb
 * Reuse when: rendering base-level model errors in a form context.
 * Do NOT use for: field-level errors (handled by Forms::FieldComponent)
 * or form-wide error panels (use .vault-form-error-panel or equivalent).
 */
.component-base-error {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-danger);
}

/* ─── AuditActionLabelComponent ─── */

/*
 * .component-audit-label
 * Compact pill label showing an audit log action (create/update/destroy, or
 * impersonation start/stop).
 *
 * The action is meaning, not identity, so the label takes the same tint-plus-ink
 * recipe every other status label in the app takes: an 18% tint of the hue, a
 * 35% tint as the hairline, the hue's ink for the text. It used to be white on
 * a 400-level fill, which measured 1.74:1 (create) and 2.77:1 (destroy) on Cool
 * Paper; the recipe measures 6.43:1 at its low point in either theme.
 *
 * Used by: app/components/audit_action_label_component.html.erb
 * Reuse when: displaying audit action type in a log or history view.
 * Do NOT use for: general-purpose status badges (use BadgeComponent).
 */
.component-audit-label {
  display: inline-block;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-xs);
}

.component-audit-label-create {
  background: var(--theme-badge-green-bg);
  border: 1px solid var(--theme-badge-green-border);
  color: var(--theme-badge-green-text);
}

.component-audit-label-update {
  background: var(--theme-badge-blue-bg);
  border: 1px solid var(--theme-badge-blue-border);
  color: var(--theme-badge-blue-text);
}

.component-audit-label-destroy {
  background: var(--theme-badge-red-bg);
  border: 1px solid var(--theme-badge-red-border);
  color: var(--theme-badge-red-text);
}

.component-audit-label-impersonation {
  background: var(--theme-badge-purple-bg);
  border: 1px solid var(--theme-badge-purple-border);
  color: var(--theme-badge-purple-text);
}

/* ─── BadgeComponent ─── */

/*
 * .component-badge
 * Base layout and typography for inline status/label badges.
 * Pairs with a .badge-{color} class from application.css for
 * color-specific background, text, and border.
 *
 * Used by: app/components/badge_component.html.erb
 * Reuse when: rendering a BadgeComponent instance.
 * Do NOT use standalone without a .badge-{color} modifier.
 * Do NOT use for: audit action labels (use AuditActionLabelComponent).
 */
.component-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--badge-padding-block) var(--badge-padding-inline);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
}

/* ─── AvatarComponent ─── */

/*
 * .component-avatar-container
 * Relative-positioned wrapper around the avatar circle/image.
 * Provides positioning context for the discarded-user ban icon overlay.
 *
 * Used by: app/components/avatar_component.html.erb
 */
.component-avatar-container {
  position: relative;
}

/*
 * .component-avatar-circle
 * Round circle showing user initials when no profile picture is set.
 * Background color is applied via a .component-avatar-{color} modifier.
 *
 * Used by: app/components/avatar_component.html.erb
 * Reuse when: rendering a user's initials avatar.
 * Do NOT use for: profile picture avatars (use .component-avatar-image).
 */
.component-avatar-circle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
}

/*
 * .component-avatar-image
 * Round profile picture thumbnail. Sized to match .component-avatar-circle.
 *
 * Used by: app/components/avatar_component.html.erb
 * Reuse when: rendering a user's profile picture.
 */
.component-avatar-image {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-pill);
}

/*
 * .component-avatar-initials
 * Semibold initials inside the avatar disc, painted in the disc's own hue ink
 * (set by the .component-avatar-{color} modifier below).
 *
 * The disc used to be a solid 400-level hue carrying near-black initials. That
 * is a full-strength fill on Cool Paper, which the Presentation Strength Rule
 * rules out, and the blue disc measured 3.18:1 against those initials — below
 * AA. The deep face cannot rescue it either: green tops out at 3.30:1 and
 * yellow at 3.19:1 against --color-text-on-vivid. So the disc takes the same
 * tint-plus-ink recipe every badge in the app uses, which measures 5.43:1 at
 * its low point across both themes.
 *
 * Used by: app/components/avatar_component.html.erb
 */
.component-avatar-initials {
  color: var(--avatar-ink, var(--color-text-heading));
  font-weight: 600;
  line-height: 1;
}

/*
 * .component-avatar-ban-overlay
 * Absolute-positioned centered overlay for the ban icon on discarded users.
 *
 * Used by: app/components/avatar_component.html.erb
 */
.component-avatar-ban-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}

/*
 * .component-avatar-ban-icon
 * Ban icon sizing for the discarded-user overlay.
 *
 * Used by: app/components/avatar_component.html.erb
 */
.component-avatar-ban-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-text-danger);
}

/*
 * .component-avatar-placeholder
 * Fallback icon when no user is present (nil user).
 *
 * Used by: app/components/avatar_component.html.erb
 */
.component-avatar-placeholder {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-gray-200);
}

/* Avatar color variants — deterministic based on user initials hash. Each is
 * an 18% tint of its hue carrying that hue's ink; see .component-avatar-initials
 * above for why the disc is tinted rather than filled. Five hues still read as
 * five distinct people at 24px.
 *
 * --avatar-tone is the same identity hue at full presentation strength, for the
 * consumers of AvatarHelper.avatar_color_class that paint a mark rather than a
 * disc with initials on it — the client-rollup row dot is the one today. A dot
 * carries no text, so it answers to the 3:1 graphical bar and wants the mark
 * face; an 18% tint would all but disappear. */
.component-avatar-blue {
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  --avatar-ink: var(--color-status-text-blue);
  --avatar-tone: var(--color-accent);
}
.component-avatar-green {
  background: color-mix(in srgb, var(--color-green) 18%, transparent);
  --avatar-ink: var(--color-status-text-green);
  --avatar-tone: var(--color-green-mark);
}
.component-avatar-orange {
  background: color-mix(in srgb, var(--color-orange) 18%, transparent);
  --avatar-ink: var(--color-status-text-orange);
  --avatar-tone: var(--color-orange-mark);
}
.component-avatar-purple {
  background: color-mix(in srgb, var(--color-purple) 18%, transparent);
  --avatar-ink: var(--color-status-text-purple);
  --avatar-tone: var(--color-purple-mark);
}
.component-avatar-yellow {
  background: color-mix(in srgb, var(--color-yellow) 18%, transparent);
  --avatar-ink: var(--color-status-text-yellow);
  --avatar-tone: var(--color-yellow-mark);
}

/*
 * .component-avatar-discarded
 * Gray background with reduced opacity for discarded/deactivated users.
 *
 * Used by: app/components/avatar_component.html.erb
 */
.component-avatar-discarded {
  background: var(--color-gray-100);
  opacity: 0.25;
}

/*
 * .component-avatar-inline
 * Compact 20px avatar circle variant for dense inline contexts.
 * Overrides width/height/font-size while keeping all other
 * .component-avatar-circle styles (layout, radius, background).
 *
 * Used by: kanban card assignee chip, meetings attendee rows.
 * Reuse when: an avatar needs to sit inline with small text at ~20px.
 * Do NOT use for: default-size avatars (use .component-avatar-circle alone)
 * or 28px variants (use .component-avatar-inline-lg).
 */
.component-avatar-inline {
  width: 1.25rem;
  height: 1.25rem;
  font-size: var(--font-size-2xs);
}

/*
 * .component-avatar-inline-lg
 * 28px avatar circle variant, sized between the default (24px) and
 * the standalone profile header (40px+).
 *
 * Used by: meetings section card attendee row.
 * Reuse when: rendering a medium-sized initials avatar alongside
 * section headings.
 * Do NOT use for: inline chips (use .component-avatar-inline) or
 * default avatars (use .component-avatar-circle alone).
 */
.component-avatar-inline-lg {
  width: 1.75rem;
  height: 1.75rem;
  font-size: var(--font-size-xs);
}

/* ─── AvatarLinkComponent ─── */

.component-avatar-link {
  cursor: pointer;
}

/* ─── ButtonComponent ─── */

/*
 * .component-button
 * Base class for all button variants. Provides border, cursor, transition,
 * typography, and disabled states. Must be combined with a color class
 * (.component-button-{color}) and a size class (.component-button-{size}).
 *
 * Used by: app/components/button_component.html.erb
 * Reuse when: rendering a ButtonComponent instance.
 * Do NOT use for: non-component button styling — use ButtonComponent directly.
 */
.component-button {
  display: inline-block;
  cursor: pointer;
  font-weight: 500;
  line-height: 1.25rem;
  transition: background-color var(--motion-fast),
              border-color var(--motion-fast),
              color var(--motion-fast),
              opacity var(--motion-fast);
}

.component-button:focus {
  outline: none;
}

/* Every button variant gets the same accent-tinted ring on keyboard focus —
 * see docs/guides/design-system.md "Focus": reference var(--focus-ring), never
 * redefine it per variant. Mouse/touch focus stays chrome-free via the
 * outline:none above; :focus-visible layers the ring in for keyboard use. */
.component-button:focus-visible {
  box-shadow: var(--focus-ring);
}

.component-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Button sizes — pill-shaped, so paddings are wider than a squared button
 * would warrant. Halves on --spacing are intentional (the rhythm scale
 * supports them; the off-rhythm * 5 horizontal on md is intentional too,
 * matching the prototype's px-5 / py-2 button). */

.component-button-sm {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  font-size: var(--font-size-sm);
  line-height: 1rem;
}

.component-button-md {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 5);
  font-size: var(--font-size-sm);
}

.component-button-lg {
  padding: calc(var(--spacing) * 2.5) calc(var(--spacing) * 6);
  font-size: var(--font-size-sm);
}

.component-button-icon-only {
  padding: calc(var(--spacing) * 2);
}

/* Button icon layout */

/*
 * .component-button-with-icon
 * Applied when the button contains an icon (left, right, or loading spinner).
 * Switches from inline-block to inline-flex for icon+text alignment.
 *
 * Used by: app/components/button_component.html.erb (when has_icon_or_loading?)
 */
.component-button-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Button icon sizing — default (md/lg) */

.component-button-icon {
  width: 0.875rem;
  height: 0.875rem;
  margin-left: -0.125rem;
  margin-right: calc(var(--spacing) * 2);
}

.component-button-icon-right {
  width: 0.875rem;
  height: 0.875rem;
  margin-right: -0.125rem;
  margin-left: calc(var(--spacing) * 2);
}

/* Button icon sizing — small */

.component-button-icon-sm {
  width: 0.875rem;
  height: 0.875rem;
  margin-left: -0.125rem;
  margin-right: calc(var(--spacing) * 2);
}

.component-button-icon-right-sm {
  width: 0.875rem;
  height: 0.875rem;
  margin-right: -0.125rem;
  margin-left: calc(var(--spacing) * 2);
}

/* Button icon sizing — icon-only */

.component-button-icon-only-icon {
  width: 0.75rem;
  height: 0.75rem;
}

/* ── Button color variants ── */

.component-button-black {
  background: var(--color-gray-900);
  border: 1px solid var(--color-gray-800);
  color: var(--color-gray-100);
}
.component-button-black:hover { background: var(--color-gray-700); }
.component-button-black:active { background: var(--color-gray-700); color: var(--color-gray-200); }

.component-button-transparent-black {
  background: color-mix(in srgb, var(--color-black) 50%, transparent);
  border: 1px solid var(--color-white);
  color: var(--color-gray-100);
}
.component-button-transparent-black:hover { background: color-mix(in srgb, var(--color-gray-700) 50%, transparent); }
.component-button-transparent-black:active { background: color-mix(in srgb, var(--color-gray-700) 50%, transparent); color: var(--color-gray-200); }

.component-button-gray {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  color: var(--color-text-heading);
}
.component-button-gray:hover {
  background: var(--color-surface-elevated);
  border-color: var(--color-border-strong);
}
.component-button-gray:active {
  background: var(--color-surface-elevated);
  border-color: var(--color-border-strong);
}

/* Ghost is the quiet variant: no chrome at rest, so it recedes next to a real
 * CTA. It still has to read as a button under the cursor, so hover adds a
 * surface wash, a hairline border, and full-strength text rather than dimming
 * the label — fading an already-muted button on approach reads as disabled.
 * The transparent border at rest reserves the hover border's space and keeps
 * ghost the same box height as the bordered variants beside it. */
.component-button-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
}
/* The disabled guards are wrapped in :where() so they add no specificity: domain
 * stylesheets layer destructive tints on top of ghost (a red Remove, a red
 * Delete) with a plain `.their-class:hover`, and those have to keep winning on
 * load order the way they did before ghost grew a hover state. */
.component-button-ghost:hover:where(:not(:disabled)):where(:not([aria-disabled="true"])) {
  background: var(--color-surface-hover);
  border-color: var(--color-border-themed);
  color: var(--color-text-heading);
}
.component-button-ghost:active:where(:not(:disabled)):where(:not([aria-disabled="true"])) {
  background: var(--color-surface-elevated);
  border-color: var(--color-border-strong);
}
/* Focus ring comes from the base .component-button:focus-visible rule above —
 * ghost doesn't need its own; keeping one here would just duplicate it. */

.component-button-primary {
  background: var(--color-brand-primary);
  color: var(--color-text-inverted);
}
.component-button-primary:hover { background: color-mix(in srgb, var(--color-brand-primary) 90%, transparent); }
.component-button-primary:active { background: color-mix(in srgb, var(--color-brand-primary) 80%, transparent); }

/*
 * Hue-variant buttons — the tonal treatment, not a solid hue fill.
 *
 * These carry a label, and a full-strength hue cannot carry one. On Cool Paper
 * the deep face of green measures 3.30:1 against --color-text-on-vivid and
 * yellow 3.19:1, both under the 4.5:1 text bar; the 400-level bases these
 * variants used before were far worse (green/white was 1.74:1) and are banned
 * as light-mode fills by the Presentation Strength Rule besides. The one
 * pairing that clears everywhere is the house recipe — an 18% tint of the hue
 * carrying that hue's ink — measured 5.43:1 at its low point across both
 * themes and every card/page/well surface.
 *
 * The whole family takes it rather than only the hues that fail, so a purple
 * button and a green button beside each other read as one control type instead
 * of two. Hover deepens the tint to 28%, active to 35%; the geometry never
 * moves, per the button rules in DESIGN.md. The 1px hairline matches the
 * -black / -gray / -ghost siblings above, so heights stay identical.
 *
 * Primary CTAs stay VIA Blue on every page (the Module Identity Rule) — these
 * variants are for secondary, categorical actions.
 */
.component-button-blue,
.component-button-purple,
.component-button-orange,
.component-button-yellow,
.component-button-yellow-orange,
.component-button-green {
  background: color-mix(in srgb, var(--button-tone) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--button-tone) 35%, transparent);
  color: var(--button-ink);
}

.component-button-blue:hover,
.component-button-purple:hover,
.component-button-orange:hover,
.component-button-yellow:hover,
.component-button-yellow-orange:hover,
.component-button-green:hover {
  background: color-mix(in srgb, var(--button-tone) 28%, transparent);
}

.component-button-blue:active,
.component-button-purple:active,
.component-button-orange:active,
.component-button-yellow:active,
.component-button-yellow-orange:active,
.component-button-green:active {
  background: color-mix(in srgb, var(--button-tone) 35%, transparent);
}

.component-button-blue {
  --button-tone: var(--color-accent);
  --button-ink: var(--color-status-text-blue);
}

.component-button-purple {
  --button-tone: var(--color-purple);
  --button-ink: var(--color-status-text-purple);
}

.component-button-orange {
  --button-tone: var(--color-orange);
  --button-ink: var(--color-status-text-orange);
}

.component-button-yellow {
  --button-tone: var(--color-yellow);
  --button-ink: var(--color-status-text-yellow);
}

.component-button-yellow-orange {
  --button-tone: var(--color-yellow-orange);
  --button-ink: var(--color-status-text-yellow-orange);
}

.component-button-green {
  --button-tone: var(--color-green);
  --button-ink: var(--color-status-text-green);
}
/* Focus ring comes from the base .component-button:focus-visible rule above —
 * this used to redefine its own green-tinted ring; the design system's
 * focus-ring doctrine says reference var(--focus-ring), never redefine it. */

/* The two outline variants are the same hue at hairline strength. A border is
 * graphical, so it answers to the 3:1 bar, and the 400-level base misses it on
 * Cool Paper (yellow 1.67:1) — the presentation-strength face clears it in
 * both themes (3.19:1 light, 10.74:1 dark). */
.component-button-transparent-yellow {
  background: transparent;
  border: 1px solid var(--color-yellow-mark);
  color: var(--color-text-body);
}
.component-button-transparent-yellow:hover { opacity: 0.8; }
.component-button-transparent-yellow:active { opacity: 0.7; }

.component-button-transparent-yellow-orange {
  background: transparent;
  border: 1px solid var(--color-yellow-orange-mark);
  color: var(--color-text-body);
}
.component-button-transparent-yellow-orange:hover { opacity: 0.8; }
.component-button-transparent-yellow-orange:active { opacity: 0.7; }

/*
 * Destructive is the one variant that still commits to a fill, because DESIGN.md
 * specifies it that way: a quiet white-and-red outline at rest that fills red
 * with white text only on hover, so destruction announces itself before it
 * shouts. The fill is the presentation-strength face rather than the raw base —
 * red-mark carrying --color-text-on-vivid measures 4.83:1 on Cool Paper and
 * 7.02:1 on Studio Dark, where the old base/white pairing was 2.77:1.
 */
.component-button-red {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-red-mark);
  color: var(--color-text-danger);
}
.component-button-red:hover {
  background: var(--color-red-mark);
  color: var(--color-text-on-vivid);
}
.component-button-red:active {
  background: color-mix(in srgb, var(--color-red-mark) 85%, var(--color-text-heading));
  color: var(--color-text-on-vivid);
}
/* Focus ring comes from the base .component-button:focus-visible rule above —
 * see the .component-button-green note; same reconciliation applies here. */

/* ── Button rounded variants ── */

/*
 * .component-button-rounded-lg / -full / -none
 * Border-radius variants for ButtonComponent. Applied via the `rounded:`
 * param (default: :lg). Replaces the Tailwind `rounded-#{@rounded}`
 * interpolation that was generating `rounded-lg`, `rounded-full`, etc.
 *
 * Used by: app/components/button_component.rb (via #button_class)
 * Reuse when: never — these are applied automatically by ButtonComponent.
 * Do NOT use for: non-button border-radius — use --radius-* tokens directly.
 */
.component-button-rounded-lg {
  border-radius: var(--radius-lg);
}

.component-button-rounded-full {
  border-radius: var(--radius-pill);
}

.component-button-rounded-none {
  border-radius: 0;
}

/*
 * .component-button-full-width
 * Stretches a ButtonComponent to fill its container's width.
 * Applied via the `full_width: true` param.
 *
 * Used by: app/components/button_component.rb (via #button_class)
 * Reuse when: a button should span the full width of its container
 *   (e.g. auth forms, onboarding CTAs).
 * Do NOT use for: buttons that should be inline — omit the full_width param.
 */
.component-button-full-width {
  width: 100%;
  justify-content: center;
}

/* ─── Error Summary ─── */

/*
 * .component-error-summary
 * Accessible cross-field validation summary for forms that need more than
 * per-field error text.
 *
 * Used by: ErrorSummaryComponent
 * Reuse when: a form has multiple related validation errors to announce.
 * Do NOT use for: flash notices or a single field's inline error message.
 */
.component-error-summary {
  padding: calc(var(--spacing) * 4);
  border: 1px solid var(--color-red-mark);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-red) 8%, transparent);
  color: var(--color-text-danger);
  list-style-position: inside;
}

/* ─── Form Field (shared input base) ─── */

/*
 * .component-form-field
 * Base styling for text inputs, selects, and textareas across all form
 * components. Provides background, border, padding, typography, transition,
 * and focus/hover states. Replaces the FormHelper#field_classes Tailwind array.
 *
 * Used by: Forms::FieldComponent, Forms::DropdownFieldComponent,
 *          Forms::AccountAutocompleteComponent, Forms::TaskAutocompleteComponent,
 *          Forms::UserAutocompleteComponent (non-compact mode)
 * Reuse when: any form input needs the standard field appearance.
 * Do NOT use for: compact autocomplete search inputs (use .component-autocomplete-compact-search)
 * or checkbox/radio inputs (use their own component classes).
 */
.component-form-field {
  display: block;
  width: 100%;
  padding: var(--field-padding-block) var(--field-padding-inline);
  background: var(--color-surface-input);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  line-height: 1.25rem;
  color: var(--color-text-input);
  outline: none;
  box-shadow: none;
  transition: background-color var(--transition-timing-standard),
              border-color 150ms ease-in-out,
              color 150ms ease-in-out;
}
.component-form-field::placeholder {
  color: var(--color-text-muted);
}
.component-form-field:hover {
  background: var(--color-surface-elevated);
}
.component-form-field:focus {
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}
/* WebKit pads a date or time input's inner field row by a pixel above and
 * below, which set every date field 2px taller than the text fields beside
 * it (the SAN expiration next to the licensee name, the check date). */
.component-form-field::-webkit-datetime-edit,
.component-form-field::-webkit-datetime-edit-fields-wrapper {
  padding-block: 0;
}
/* Chrome paints its own slab behind an autofilled field, which leaves one
 * grey input sitting in a row of white ones on any address form. An inset
 * shadow taller than the field is the only way to cover it, and
 * -webkit-text-fill-color the only way to reclaim the text color. */
.component-form-field:-webkit-autofill,
.component-form-field:-webkit-autofill:hover,
.component-form-field:autofill {
  -webkit-text-fill-color: var(--color-text-input);
  caret-color: var(--color-text-input);
  box-shadow: 0 0 0 62.5rem var(--color-surface-input) inset;
}
.component-form-field:-webkit-autofill:focus,
.component-form-field:autofill:focus {
  box-shadow: var(--focus-ring), 0 0 0 62.5rem var(--color-surface-input) inset;
}

/*
 * .component-form-field:disabled
 * Inert state for every input, select, and textarea carrying the shared field
 * class: the surface drops to the page ground, the text and the select caret
 * mute, and the pointer is refused. A disabled field used to be pixel-identical
 * to an editable one, so the single control on a form an operator cannot change
 * looked exactly like the ones they can.
 *
 * The :hover pair is not redundant. The base :hover lifts the background to the
 * elevated surface, and on a dead control that lift is the one motion saying it
 * answers the pointer at all.
 *
 * -webkit-text-fill-color is what WebKit paints disabled input text with; given
 * `color` alone Safari keeps its own grey and the field reads a shade off from
 * every other muted value on the page.
 *
 * Used by: anything the browser reports as :disabled — Forms::FieldComponent and
 *          Forms::DropdownFieldComponent both take a `disabled:`, and several
 *          Stimulus controllers disable the fields they have hidden.
 * Do NOT use for: a value that is only temporarily uneditable and still has to
 * reach the server — a disabled input does not submit.
 */
.component-form-field:disabled {
  background: var(--color-surface-body);
  border-color: var(--color-border-themed);
  color: var(--color-text-muted);
  -webkit-text-fill-color: var(--color-text-muted);
  cursor: not-allowed;
}
.component-form-field:disabled:hover {
  background: var(--color-surface-body);
}

/*
 * .component-form-field-error
 * Error-state modifier for .component-form-field. Overrides border, text,
 * and placeholder colors to red and adds right padding for the error icon.
 *
 * Used by: Forms::FieldComponent, Forms::DropdownFieldComponent
 * Reuse when: a form field has validation errors.
 * Do NOT use standalone — always pair with .component-form-field.
 */
.component-form-field-error {
  border-color: var(--color-red-mark);
  color: var(--color-text-danger);
  padding-right: calc(var(--spacing) * 8);
}
.component-form-field-error::placeholder {
  color: var(--color-text-danger);
}
.component-form-field-error:focus {
  border-color: var(--color-red-mark);
  box-shadow: var(--focus-ring-error);
}

/*
 * select.component-form-field
 * Replaces the native browser select caret with a tokenized chevron rendered
 * as an inline SVG background. Mirrors the chevron used in
 * Forms::DropdownFieldComponent so any bare `<select>` carrying the shared
 * field class reads as one family with wrapped selects.
 *
 * The SVG inherits `currentColor`, so the caret tracks the field's text color
 * and themes correctly in light + dark mode without per-mode overrides.
 */
select.component-form-field {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: calc(var(--spacing) * 9);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 4.5 6 7.5 9 4.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right calc(var(--spacing) * 3) center;
  background-size: 0.75rem 0.75rem;
}

/*
 * .component-form-field-inline
 * Shrink-to-content modifier for .component-form-field and its
 * .component-form-dropdown-select-wrapper. Use when a form field
 * sits inline in a toolbar or filter row rather than as a
 * full-width form control.
 *
 * Reuse when: a filter <select> or inline input needs to size to
 * its content and sit next to other elements in a flex row.
 */
.component-form-field-inline {
  display: inline-block;
  width: auto;
}

/* ─── Forms::LabelComponent ─── */

/*
 * .component-form-label
 * Outer wrapper for a form label row. Provides flex layout, vertical alignment,
 * gap between label text and required asterisk, and bottom margin.
 *
 * Used by: app/components/forms/label_component.html.erb
 * Reuse when: rendering a Forms::LabelComponent.
 * Do NOT use for: standalone labels outside the form component system.
 */
.component-form-label {
  margin-bottom: var(--field-label-gap);
}

/*
 * .component-form-label-text
 * Typography wrapper for the label text and optional help text.
 * Sets the default body text color, medium weight, and small size.
 *
 * Used by: app/components/forms/label_component.html.erb
 * Reuse when: rendering label text inside a form label.
 * Do NOT use for: headings or non-label text.
 */
.component-form-label-text {
  font-weight: 500;
  font-size: var(--font-size-sm);
  line-height: 1.25rem;
  color: var(--color-text-body);
}

/*
 * .component-form-label-help
 * Help text below a label. Small, muted, with top margin.
 *
 * Used by: app/components/forms/label_component.html.erb
 * Reuse when: displaying help text under a label.
 * Do NOT use for: field-level help text below the input (use .component-form-field-help-text).
 */
.component-form-label-help {
  margin-top: calc(var(--spacing) * 1);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/*
 * .component-form-label-required-marker
 * Red monospace asterisk beside a required field's label.
 *
 * Used by: app/components/forms/label_component.html.erb
 * Reuse when: marking a field as required.
 * Do NOT use for: decorative asterisks or footnote markers, and do NOT apply
 *   to the wrapper — that's .component-form-label-required (wrapper modifier)
 *   which only owns the right-edge padding.
 */
.component-form-label-required-marker {
  font-family: monospace;
  font-size: var(--font-size-sm);
  color: var(--color-text-danger);
}

/* ─── Forms::Radio::ButtonComponent ─── */

/*
 * .component-radio-button
 * Base layout for a single radio button option rendered as a selectable tile.
 * The label wraps a hidden radio input and visible text. Pairs with a
 * .component-radio-selected-{color} or .component-radio-deselected class
 * for selected/deselected visual state (applied dynamically by Stimulus).
 *
 * Used by: app/components/forms/radio/button_component.html.erb
 * Reuse when: rendering a Forms::Radio::ButtonComponent instance.
 * Do NOT use for: standalone radio inputs or non-tile radio layouts.
 */
.component-radio-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  margin-top: calc(var(--spacing) * 1);
  margin-bottom: calc(var(--spacing) * 1);
  border-radius: var(--radius-xs);
  cursor: pointer;
}
@media (min-width: 40rem) {
  .component-radio-button { flex: 1; }
}
.component-radio-button:focus-within {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ─── Forms::CheckboxListComponent ─── */

/*
 * .component-checkbox-list-item
 * Label wrapper for a single checkbox row in a multi-select list.
 * Provides horizontal layout with gap, bottom padding, and pointer cursor.
 *
 * Used by: app/components/forms/checkbox_list_component.html.erb
 * Reuse when: a checkbox sits beside its own label text, whether in a
 *             Forms::CheckboxListComponent list or on its own.
 * Do NOT use for: toggle switches.
 */
.component-checkbox-list-item {
  display: flex;
  gap: calc(var(--spacing) * 2);
  padding-bottom: calc(var(--spacing) * 4);
  cursor: pointer;
}

/*
 * .component-checkbox-input
 * Styled checkbox input. Sets size, accent color, border radius,
 * and focus ring to match the design system.
 *
 * Used by: app/components/forms/checkbox_list_component.html.erb
 *          app/views/order_confirmations/new.html.erb
 * Reuse when: any checkbox input needs the standard styled appearance.
 * Do NOT use for: radio inputs or toggle switches.
 */
.component-checkbox-input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--color-brand-primary);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-gray-200);
  cursor: pointer;
  transition: background-color var(--transition-timing-standard);
}
/* Focus doctrine: the shared ring on keyboard focus, replacing the bespoke
 * 2px accent ring this checkbox used to draw for itself. */
.component-checkbox-input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ─── Forms::FormSectionComponent ─── */

/*
 * .component-form-section
 * Top-bordered collapsible section within a form. Provides border-top separator,
 * top padding, and top margin to visually break form groups.
 *
 * Used by: app/components/forms/form_section_component.html.erb
 * Reuse when: rendering a Forms::FormSectionComponent.
 * Do NOT use for: non-form content sections or standalone cards.
 */
.component-form-section {
  border-top: 1px solid var(--color-border-themed);
  padding-top: calc(var(--spacing) * 6);
  margin-top: calc(var(--spacing) * 6);
}

/*
 * .component-form-section-toggle
 * Button that toggles section collapse. Flex row with icon gap,
 * transparent background, no border, and pointer cursor.
 *
 * Used by: app/components/forms/form_section_component.html.erb (collapsible mode)
 * Reuse when: rendering the collapsible toggle button for a form section.
 * Do NOT use for: standalone disclosure toggles outside form sections.
 */
.component-form-section-toggle {
  margin-bottom: calc(var(--spacing) * 4);
  cursor: pointer;
  background: transparent;
  border: 0;
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-form-section-toggle:focus-visible {
  outline: none;
  border-radius: var(--radius-md);
  box-shadow: var(--focus-ring);
}

/*
 * .component-form-section-title
 * Heading for a form section. Small, semibold, heading-colored,
 * with bottom margin when used standalone (non-collapsible).
 *
 * Used by: app/components/forms/form_section_component.html.erb
 * Reuse when: titling a section in a form.
 * Do NOT use for: page-level or card-level headings.
 */
.component-form-section-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
  margin-bottom: calc(var(--spacing) * 4);
}
.component-form-section-toggle .component-form-section-title {
  margin-bottom: 0;
}

/*
 * .component-form-section-icon
 * Chevron icon in the collapsible section toggle. Small, muted color,
 * with transition for rotation animation.
 *
 * Used by: app/components/forms/form_section_component.html.erb (collapsible mode)
 * Reuse when: rendering the collapse indicator icon.
 * Do NOT use for: decorative icons or non-interactive chevrons.
 */
.component-form-section-icon {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--color-text-muted);
  transition: transform var(--transition-timing-slow);
}

/* ─── Forms::FieldComponent (shared field parts) ─── */

/*
 * .component-form-field-error-icon
 * Absolute-positioned container for the error exclamation icon inside a
 * field input. Sits at the right edge of the input, vertically centered,
 * and is non-interactive (pointer-events: none).
 *
 * Used by: app/components/forms/field_component.html.erb
 * Reuse when: positioning an error icon inside an input wrapper.
 * Do NOT use for: standalone error icons outside a form field.
 */
.component-form-field-error-icon {
  position: absolute;
  inset-block: 0;
  right: 0;
  padding-right: calc(var(--spacing) * 4);
  display: flex;
  align-items: center;
  pointer-events: none;
}

/*
 * .component-form-field-error-message
 * Inline error message below a field input. Red, small, medium weight.
 *
 * Used by: app/components/forms/field_component.html.erb,
 *          app/components/forms/dropdown_field_component.html.erb
 * Reuse when: displaying field-level validation errors.
 * Do NOT use for: base-level model errors (use .component-base-error).
 */
.component-form-field-error-message {
  margin-top: calc(var(--spacing) * 2);
  font-weight: 500;
  color: var(--color-text-danger);
}

/*
 * .component-form-field-help-text
 * Help/description text below a field input or dropdown. Small, muted.
 *
 * Used by: app/components/forms/field_component.html.erb,
 *          app/components/forms/dropdown_field_component.html.erb
 * Reuse when: displaying contextual help below a form field.
 * Do NOT use for: label-level help text (use .component-form-label-help).
 */
.component-form-field-help-text {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ─── Forms::DropdownFieldComponent ─── */

/*
 * .component-form-dropdown-icon
 * Chevron icon positioned absolutely over the select element.
 * Sits near the right edge, vertically centered.
 *
 * Used by: app/components/forms/dropdown_field_component.html.erb
 * Reuse when: rendering the dropdown indicator icon.
 * Do NOT use for: chevrons in other contexts (accordions, nav menus).
 */
.component-form-dropdown-icon {
  position: absolute;
  right: calc(var(--spacing) * 6);
  inset-block: 0;
  margin-block: auto;
  width: 1rem;
  height: 1rem;
  pointer-events: none;
  color: var(--color-text-muted);
}

/* ─── Forms::Radio::InputComponent (radio group) ─── */

/*
 * .component-radio-selected-primary
 * Selected state for a radio tile with the primary color.
 * Solid primary background, white text, matching border.
 *
 * Used by: app/components/forms/radio/button_component.html.erb
 *          (applied via Stimulus radio-input controller classList)
 * Reuse when: a radio tile in a Forms::Radio::InputComponent is selected.
 * Do NOT use for: non-radio selected states or checkbox highlights.
 */
.component-radio-selected-primary {
  background: var(--color-brand-primary);
  border: 1px solid var(--color-brand-primary);
  color: var(--color-text-inverted);
}
.component-radio-selected-primary:hover { background: var(--color-brand-primary); }

/*
 * .component-radio-selected-blue
 * Selected state for a radio tile with the blue color.
 */
.component-radio-selected-blue {
  background: var(--color-blue);
  border: 1px solid var(--color-blue);
  color: var(--color-text-inverted);
}
.component-radio-selected-blue:hover { background: var(--color-blue); }

/*
 * .component-radio-deselected
 * Deselected/default state for a radio tile. White background,
 * gray border, light gray hover.
 *
 * Used by: app/components/forms/radio/button_component.html.erb
 *          (applied via Stimulus radio-input controller classList)
 * Reuse when: a radio tile is not currently selected.
 * Do NOT use for: disabled radio states.
 */
.component-radio-deselected {
  background: var(--color-surface-input);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-heading);
}
.component-radio-deselected:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}

/*
 * .component-radio-none-selected-primary
 * Selected state for the "none" option with primary color. Text-only color.
 *
 * Used by: app/components/forms/radio/input_component.html.erb (none option label)
 * Reuse when: the "none" option in a radio group is selected.
 */
.component-radio-none-selected-primary { color: var(--color-brand-primary); }
.component-radio-none-selected-blue { color: var(--color-accent); }

/*
 * .component-radio-none-deselected
 * Deselected state for the "none" option. No visual styling applied.
 * Exists as a valid class name for the Stimulus classList API.
 *
 * Used by: app/components/forms/radio/input_component.html.erb (none option label)
 */
.component-radio-none-deselected {}

/*
 * .component-radio-none-label
 * Label for the "none" radio option. Selectable, rounded tile appearance
 * without the full tile styling.
 *
 * Used by: app/components/forms/radio/input_component.html.erb
 * Reuse when: rendering the "none" option in a radio group.
 * Do NOT use for: standard radio tile options (use .component-radio-button).
 */
.component-radio-none-label {
  user-select: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 4);
  line-height: 1.25;
}

/* ─── Forms::Radio::InputComponent layout ─── */

.component-radio-input-body {
  display: flex;
}

.component-radio-input-body-relative {
  position: relative;
}

.component-radio-input-extra-actions {
  position: absolute;
  top: calc(var(--spacing) * -6);
  right: calc(var(--spacing) * -6);
  width: 100%;
  display: flex;
  justify-content: flex-end;
  font-size: var(--font-size-xs);
}

.component-radio-input-extra-toggle {
  cursor: pointer;
}

.component-radio-input-extra-toggle:hover {
  color: var(--color-gray-400);
}

.component-radio-input-extra-row {
  display: flex;
  column-gap: calc(var(--spacing) * 2);
  user-select: none;
}

.component-radio-input-icon {
  margin-block: auto;
}

.component-radio-input-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}

.component-radio-input-option-cell {
  width: calc(var(--spacing) * 48);
  margin-right: calc(var(--spacing) * 2);
}

.component-radio-input-none-content {
  line-height: 1.25;
  display: flex;
}

.component-radio-input-none-text {
  font-weight: 600;
  margin-block: auto;
  padding-left: calc(var(--spacing) * 2);
}

.component-radio-input-label-row {
  display: flex;
}

.component-radio-button-content {
  padding-block: calc(var(--spacing) * 1);
  line-height: 1.25;
}

.component-radio-button-name {
  font-weight: 600;
}

/* ─── Forms::FieldComponent layout ─── */

.component-form-field-input-wrapper {
  position: relative;
}

.component-form-field-label-row {
  display: flex;
}

/* ─── Forms::LabelComponent spacing ─── */

.component-form-label-required {
  padding-right: calc(var(--spacing) * 6);
}

.component-form-label-optional {
  padding-right: calc(var(--spacing) * 8);
}

/* ─── Forms::DropdownFieldComponent ─── */

.component-form-dropdown-select-wrapper {
  position: relative;
}

/*
 * Matches the `select.component-form-field` specificity (0,0,1,1) so the
 * tokenized background-image chevron from that rule is properly cleared
 * here — `Forms::DropdownFieldComponent` and any inline reuse renders
 * its own IconComponent chevron instead.
 */
select.component-form-dropdown-select {
  margin-top: calc(var(--spacing) * 1);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: none;
}

select.component-form-dropdown-select.component-form-field-inline {
  margin-top: 0;
  padding-right: calc(var(--spacing) * 8);
}

.component-form-field-inline > .component-form-dropdown-icon {
  right: calc(var(--spacing) * 3);
}

/* ─── Forms::CheckboxListComponent ─── */

.component-checkbox-list-text {
  color: var(--color-text-body);
  user-select: none;
}

/* ─── ButtonGroupComponent ─── */

/*
 * .component-button-group
 * Horizontal flex container for a group of buttons with joined borders.
 * Buttons inside should use positional classes for border-radius.
 *
 * Used by: app/components/button_group_component.html.erb
 * Reuse when: rendering a ButtonGroupComponent.
 * Do NOT use for: standalone button layouts or toolbar button rows.
 */
.component-button-group {
  display: flex;
  align-items: center;
}

/*
 * .component-button-group-first / -middle / -last
 * Positional border-radius and border overrides for grouped buttons.
 * First button: left radius, no right radius, no right border.
 * Middle button(s): no radius, no right border.
 * Last button: right radius, no left radius.
 *
 * Used by: app/components/button_group_component.html.erb (via button_class method)
 * Reuse when: rendering buttons inside a ButtonGroupComponent.
 * Do NOT use for: standalone buttons.
 */
.component-button-group-first {
  border-radius: var(--radius-xs) 0 0 0.125rem;
  border-right: 0;
}
.component-button-group-middle {
  border-radius: 0;
  border-right: 0;
}
.component-button-group-last {
  border-radius: 0 0.125rem 0.125rem 0;
}

/* ─── Autocomplete Components (shared) ─── */

/*
 * .component-autocomplete-wrapper
 * Outer container for autocomplete form fields. Provides vertical margin.
 *
 * Used by: app/components/forms/account_autocomplete_component.html.erb,
 *          app/components/forms/task_autocomplete_component.html.erb,
 *          app/components/forms/user_autocomplete_component.html.erb (non-compact)
 * Reuse when: wrapping any autocomplete field.
 * Do NOT use for: standard text inputs or dropdowns.
 */
.component-autocomplete-wrapper {
  margin-top: calc(var(--spacing) * 2);
  margin-bottom: calc(var(--spacing) * 2);
}

/*
 * .component-autocomplete-selected-item
 * Row displaying a selected autocomplete value. Flex layout with space-between,
 * padding, rounded corners, and elevated background.
 *
 * Used by: account_autocomplete, task_autocomplete, user_autocomplete
 * Reuse when: showing a selected item that can be removed.
 * Do NOT use for: search suggestion rows (use .component-autocomplete-suggestion).
 */
.component-autocomplete-selected-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 4);
  background: var(--color-gray-100);
  border-radius: var(--radius-xs);
}

/*
 * .component-autocomplete-selected-item-sm
 * Compact variant of selected item for multi-select autocompletes (tasks).
 * Smaller padding and bottom margin for stacked items.
 *
 * Used by: app/components/forms/task_autocomplete_component.html.erb
 * Reuse when: displaying compact selected items in a multi-select autocomplete.
 */
.component-autocomplete-selected-item-sm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 2);
  background: var(--color-gray-100);
  border-radius: var(--radius-xs);
  margin-bottom: calc(var(--spacing) * 2);
}

/*
 * .component-autocomplete-selected-text
 * Text inside a selected autocomplete item. Dark, readable.
 *
 * Used by: account_autocomplete, task_autocomplete, user_autocomplete
 * Reuse when: displaying the name/title of a selected item.
 */
.component-autocomplete-selected-text {
  color: var(--color-gray-900);
}

/*
 * .component-autocomplete-selected-text-sm
 * Small text variant for compact selected items.
 *
 * Used by: app/components/forms/task_autocomplete_component.html.erb
 */
.component-autocomplete-selected-text-sm {
  font-size: var(--font-size-sm);
  color: var(--color-gray-900);
}

/*
 * .component-autocomplete-remove-btn
 * X button to remove a selected autocomplete value. Muted color with
 * accent hover state and pointer cursor.
 *
 * Used by: account_autocomplete, task_autocomplete, user_autocomplete
 * Reuse when: providing a remove action on a selected autocomplete item.
 * Do NOT use for: close buttons on modals or toasts.
 */
.component-autocomplete-remove-btn {
  color: var(--color-gray-400);
  cursor: pointer;
}
.component-autocomplete-remove-btn:hover {
  color: var(--color-brand-primary);
}

/*
 * .component-autocomplete-dropdown
 * Absolutely-positioned dropdown container for search suggestions.
 * Layered above content (z-10), full-width, scrollable, with shadow and border.
 *
 * Used by: account_autocomplete, task_autocomplete, user_autocomplete
 * Reuse when: rendering the suggestion dropdown in an autocomplete.
 * Do NOT use for: navigation dropdowns or select menus.
 */
.component-autocomplete-dropdown {
  position: absolute;
  z-index: 10;
  margin-top: calc(var(--spacing) * 1);
  width: 100%;
  background: var(--color-surface-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.25rem 0.375rem -0.25rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
  border: 1px solid var(--color-border-themed);
  max-height: 15rem;
  overflow: auto;
}

/*
 * .component-autocomplete-suggestion
 * Individual clickable suggestion in the autocomplete dropdown.
 * Full-width button with left-aligned text and hover highlight.
 *
 * Used by: account_autocomplete, task_autocomplete (via <template> elements)
 * Reuse when: rendering each suggestion row.
 * Do NOT use for: selected item rows.
 */
.component-autocomplete-suggestion {
  width: 100%;
  text-align: left;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  font-size: var(--font-size-sm);
  color: var(--color-gray-900);
  cursor: pointer;
}
.component-autocomplete-suggestion:hover {
  background: var(--color-gray-100);
}

/* Focus doctrine: the shared ring on keyboard focus. Inset so the ring is not
 * clipped by the dropdown panel's rounded overflow. */
.component-autocomplete-suggestion:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

/*
 * .component-autocomplete-no-results
 * "No results" message inside the dropdown. Centered, muted text.
 *
 * Used by: account_autocomplete, task_autocomplete, user_autocomplete
 * Reuse when: the autocomplete search yields no matches.
 */
.component-autocomplete-no-results {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
}

/* ─── Forms::UserAutocompleteComponent (compact mode) ─── */

/*
 * .component-autocomplete-compact-placeholder
 * Circular placeholder with "?" for unassigned user in compact mode.
 * Small circle, centered content, elevated background, bold monospace feel.
 *
 * Used by: app/components/forms/user_autocomplete_component.html.erb (compact mode)
 * Reuse when: showing an unassigned user placeholder in compact autocomplete.
 * Do NOT use for: avatar circles (use .component-avatar-circle).
 */
.component-autocomplete-compact-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: var(--font-size-xs);
  line-height: 1;
}

/*
 * .component-autocomplete-compact-assign-btn
 * Button to open the compact user autocomplete search. Muted text
 * with hover transition to heading color.
 *
 * Used by: app/components/forms/user_autocomplete_component.html.erb (compact mode)
 * Reuse when: rendering the assign/open button in compact autocomplete.
 */
.component-autocomplete-compact-assign-btn {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  color: var(--color-text-muted);
  cursor: pointer;
}
.component-autocomplete-compact-assign-btn:hover {
  color: var(--color-text-heading);
}

/*
 * .component-autocomplete-compact-selected
 * Wrapper for selected user display in compact mode. Flex row with gap,
 * group hover behavior for showing remove button.
 *
 * Used by: app/components/forms/user_autocomplete_component.html.erb (compact mode)
 * Reuse when: displaying a selected user in compact autocomplete.
 */
.component-autocomplete-compact-selected {
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  cursor: pointer;
}
.component-autocomplete-compact-selected::after {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 100%;
  width: calc(var(--spacing) * 4);
}

/*
 * .component-autocomplete-compact-remove
 * Remove button for compact selected user. Muted, becomes visible on
 * parent hover. Two variants: -floating (absolutely positioned beside
 * the pill so the avatar+name stay truly centered) and -inline
 * (stays in flow; hides with display: none and shifts layout on hover).
 *
 * Used by: app/components/forms/user_autocomplete_component.html.erb (compact mode)
 */
.component-autocomplete-compact-remove {
  color: var(--color-text-muted);
  cursor: pointer;
}
.component-autocomplete-compact-remove:hover {
  color: var(--color-text-heading);
}
.component-autocomplete-compact-remove-floating {
  position: absolute;
  right: calc(var(--spacing) * -4);
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  opacity: 0;
}
.component-autocomplete-compact-selected:hover .component-autocomplete-compact-remove-floating,
.component-autocomplete-compact-selected:focus-within .component-autocomplete-compact-remove-floating {
  opacity: 1;
}
.component-autocomplete-compact-remove-inline {
  display: none;
}
.component-autocomplete-compact-selected:hover .component-autocomplete-compact-remove-inline {
  display: block;
}

/*
 * .component-autocomplete-compact-search
 * Search input for compact user autocomplete. Smaller than the standard
 * .component-form-field — fixed width, smaller padding.
 *
 * Used by: app/components/forms/user_autocomplete_component.html.erb (compact mode)
 * Reuse when: rendering the search input in compact autocomplete.
 * Do NOT use for: standard form field inputs (use .component-form-field).
 */
.component-autocomplete-compact-search {
  font-size: var(--font-size-base);
  background: var(--color-surface-input);
  color: var(--color-text-input);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  width: 12rem;
  box-shadow: 0 0.0625rem 0.125rem 0 color-mix(in srgb, var(--color-gray-900) 5%, transparent);
}
.component-autocomplete-compact-search::placeholder {
  color: var(--color-text-muted);
}
.component-autocomplete-compact-search:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

/*
 * .component-autocomplete-compact-avatar
 * Small avatar circle for the compact selected user template.
 * Used in JS-cloned <template> elements where AvatarComponent is not available.
 *
 * Used by: app/components/forms/user_autocomplete_component.html.erb (selectedTemplate)
 */
.component-autocomplete-compact-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-pill);
  color: white;
  font-weight: 700;
  font-size: var(--font-size-xs);
  line-height: 1;
}

/* ─── Forms::UserAutocompleteComponent (non-compact mode) ─── */

/*
 * .component-autocomplete-user-selected
 * Selected user row in non-compact mode. Similar to .component-autocomplete-selected-item
 * but uses theme tokens for input-style background/border.
 *
 * Used by: app/components/forms/user_autocomplete_component.html.erb (non-compact)
 * Reuse when: displaying a selected user in full-size autocomplete.
 */
.component-autocomplete-user-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 4);
  background: var(--color-surface-input);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
}

/*
 * .component-autocomplete-user-remove
 * Remove button for non-compact selected user. Muted with accent hover.
 *
 * Used by: app/components/forms/user_autocomplete_component.html.erb (non-compact)
 */
.component-autocomplete-user-remove {
  margin-left: calc(var(--spacing) * 4);
  color: var(--color-text-muted);
  cursor: pointer;
}
.component-autocomplete-user-remove:hover {
  color: var(--color-accent);
}

.component-autocomplete-compact-root {
  position: relative;
}

.component-autocomplete-compact-row {
  display: flex;
  align-items: center;
}

.component-autocomplete-compact-name {
  font-size: var(--font-size-xs);
  color: var(--color-text-body);
}

.component-autocomplete-compact-unassigned-label {
  font-size: var(--font-size-xs);
}

.component-autocomplete-compact-panel {
  position: absolute;
  z-index: 10;
  margin-top: calc(var(--spacing) * 1);
}

.component-autocomplete-compact-panel-left { left: 0; }
.component-autocomplete-compact-panel-right { right: 0; }
.component-autocomplete-compact-panel-upward .component-autocomplete-dropdown {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: calc(var(--spacing) * 1);
}

.component-autocomplete-dropdown-body {
  padding-block: calc(var(--spacing) * 1);
}

.component-autocomplete-user-name-text {
  font-size: var(--font-size-xs);
  color: var(--color-text-input);
}

.component-autocomplete-search-root {
  position: relative;
}

/* ─── Forms::SearchableSelectComponent ─── */

/*
 * .component-searchable-select-control
 * Positioning context for the trigger button, its chevron, and the floating panel.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 * Reuse when: anchoring a searchable select's panel to its trigger.
 * Do NOT use for: native selects (use .component-form-dropdown-select-wrapper).
 */
.component-searchable-select-control {
  position: relative;
}

/*
 * .component-searchable-select-trigger
 * Button that stands in for a native <select>. Pairs with .component-form-field so it is
 * indistinguishable from a real dropdown, adding left alignment and room for the chevron.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 * Reuse when: a button must read as a form select.
 * Do NOT use standalone — always pair with .component-form-field.
 */
.component-searchable-select-trigger {
  margin-top: calc(var(--spacing) * 1);
  padding-right: calc(var(--spacing) * 8);
  text-align: left;
  cursor: pointer;
}

/*
 * .component-searchable-select-value
 * The current selection inside the trigger. Truncates rather than wrapping, so a long
 * template name can never change the field's height.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 */
.component-searchable-select-value {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/*
 * .component-searchable-select-panel
 * Floating panel holding the search box and the option list. Column layout so the search
 * row stays pinned while only the options scroll.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 * Reuse when: a dropdown needs a fixed header above scrolling content.
 * Do NOT use for: server-backed autocompletes (use .component-autocomplete-dropdown).
 */
.component-searchable-select-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  margin-top: calc(var(--spacing) * 1);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.25rem 0.375rem -0.25rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
  overflow: hidden;
}

/*
 * .component-searchable-select-search-row
 * Pinned search row at the top of the panel. Positioning context for its leading icon.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 */
.component-searchable-select-search-row {
  position: relative;
  border-bottom: 1px solid var(--color-border-themed);
}

/*
 * .component-searchable-select-search-icon
 * Magnifier sitting inside the left edge of the search input.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 */
.component-searchable-select-search-icon {
  position: absolute;
  left: calc(var(--spacing) * 3);
  inset-block: 0;
  margin-block: auto;
  width: 0.875rem;
  height: 0.875rem;
  pointer-events: none;
  color: var(--color-text-muted);
}

/*
 * .component-searchable-select-search
 * Filter input inside the panel. Borderless because the panel already frames it.
 *
 * The font-size floor is required: anything under 1rem makes iOS Safari zoom the page on
 * focus, which would fight the floating panel's position.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 */
.component-searchable-select-search {
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3) calc(var(--spacing) * 2) calc(var(--spacing) * 8);
  background: transparent;
  border: none;
  outline: none;
  font-size: max(var(--font-size-sm), var(--field-font-floor));
  color: var(--color-text-input);
}
.component-searchable-select-search::placeholder {
  color: var(--color-text-muted);
}
.component-searchable-select-search::-webkit-search-cancel-button {
  appearance: none;
}

/*
 * .component-searchable-select-options
 * Scrolling list of groups and options below the pinned search row.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 */
.component-searchable-select-options {
  max-height: 15rem;
  overflow-y: auto;
  padding-block: calc(var(--spacing) * 1);
}

/*
 * .component-searchable-select-group
 * Wraps one category's header and its options so the whole block can hide together when
 * everything under it filters out.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 */
.component-searchable-select-group {
  padding-top: calc(var(--spacing) * 1);
}

/*
 * .component-searchable-select-group-label
 * Category heading inside the option list. Sentence case, never uppercase.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 * Reuse when: labelling a group of options in a picker.
 * Do NOT use for: form field labels (use .component-form-label-text).
 */
.component-searchable-select-group-label {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 4);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

/*
 * .component-searchable-select-option
 * One selectable row. Pairs with .component-autocomplete-suggestion for the base row
 * styling, adding the stacked label/meta layout and keyboard + selected states.
 *
 * `data-active` tracks the keyboard cursor and `aria-selected` the committed choice, so
 * the two states can coexist on different rows.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 * Reuse when: rendering a two-line option row in a searchable select.
 * Do NOT use standalone — always pair with .component-autocomplete-suggestion.
 */
.component-searchable-select-option {
  display: block;
  /* .component-autocomplete-suggestion hardcodes --color-gray-900 for text and --color-gray-100
     for its hover background. Both are fixed light-mode values that break against a dark surface
     (invisible text, then a near-white bar under near-white text on hover), so re-anchor
     each to a themed token. Hover and the keyboard cursor share one surface so a moving mouse and
     the arrow keys never highlight two rows differently. */
  color: var(--color-text-input);
}
.component-searchable-select-option:hover,
.component-searchable-select-option[data-active='true'] {
  background: var(--color-surface-elevated);
}
.component-searchable-select-option[aria-selected='true'] .component-searchable-select-option-label {
  font-weight: 600;
  color: var(--color-accent);
}

/*
 * .component-searchable-select-option-label
 * Primary line of an option row.
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 */
.component-searchable-select-option-label {
  display: block;
}

/*
 * .component-searchable-select-option-meta
 * Secondary line under an option's name, carrying whatever distinguishes it from a
 * same-named sibling (subtask count, recurrence).
 *
 * Used by: app/components/forms/searchable_select_component.html.erb
 */
.component-searchable-select-option-meta {
  display: block;
  margin-top: calc(var(--spacing) * 0.5);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ─── Cards::CardComponent ─── */

/*
 * .component-card
 * Primary card container with themed border and shadow.
 * Provides surface background, padding, rounded corners, and card shadow.
 *
 * Used by: app/components/cards/card_component.html.erb
 * Reuse when: rendering a Cards::CardComponent.
 * Do NOT use for: generic padded boxes (use .box primitive) or elevated
 * surfaces without borders (use .surface-elevated primitive).
 */
.component-card {
  background: var(--color-surface-primary);
  padding: var(--card-padding);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border-themed);
  box-shadow: var(--shadow-card);
  transition: transform var(--motion-fast),
              box-shadow var(--motion-fast),
              border-color var(--motion-fast);
}

/*
 * .component-card-interactive
 * Modifier for cards that lead somewhere (an onClick / link target). Adds a
 * subtle hover lift — translateY(-2px) + heavier shadow — that signals
 * "this is a target." Apply alongside .component-card on any clickable card.
 *
 * Used by: any tile-style action card (e.g. QuickActionTile, DatabaseList
 *   image cards) and clickable Cards::CardComponent wrappers.
 * Reuse when: the card is clickable and there are not 10+ stacked rows —
 *   for long lists prefer the row hover pattern (no translateY).
 */
.component-card-interactive {
  cursor: pointer;
}

/* Hover lift targets the inner .component-card, not this outer wrapper.
 * The outer wrapper has no surface/radius, so a box-shadow on it leaks
 * past the inner card's rounded corners — see the meetings index hover
 * artifact before this rule changed. */
.component-card-interactive:hover > .component-card {
  transform: translateY(-0.125rem);
  box-shadow: var(--shadow-lg);
}

/*
 * .component-card-compact
 * Modifier for cards that hold tight list-row content (meeting summaries,
 * activity rows) rather than detail-page sections. Drops the canonical
 * --card-padding (28px) down to 20px so multi-row lists don't feel bloated.
 *
 * Apply on the OUTER wrapper alongside .component-card-interactive when
 * the rows are clickable: e.g.
 *   render Cards::CardComponent.new(class: 'component-card-interactive component-card-compact')
 *
 * Reuse rule: list-of-cards pages where each card is one record at a
 * glance. Don't use for primary detail-page cards — they earn the full
 * 28px padding.
 */
.component-card-compact > .component-card {
  padding: calc(var(--spacing) * 5);
}

/*
 * .component-card-title
 * Canonical heading inside a card. h3 typography, heading color, with
 * bottom margin to separate from card content. When the card uses the
 * title_actions slot, the title is wrapped in .component-card-title-row
 * which strips this margin and lays title + actions on one flex row.
 *
 * Used by: app/components/cards/card_component.html.erb
 * Reuse when: rendering a titled Cards::CardComponent — including from
 *   bespoke card markup that wants the canonical title look without
 *   the full Card wrapper. Don't define a parallel `*-title` class.
 */
.component-card-title {
  font-size: var(--type-h3-size);
  line-height: var(--type-h3-line-height);
  letter-spacing: var(--type-h3-letter-spacing);
  font-weight: var(--type-h3-weight);
  color: var(--color-text-heading);
}

/*
 * Margin-bottom only applies when the title is a direct child of the
 * card (standalone title at the top, no actions slot, no custom flex
 * header). Custom-header layouts (e.g. .component-dashboard-milestones-
 * header) nest the h3 inside their own flex row and handle spacing on
 * the header element itself, so the title doesn't inherit a stray
 * margin that pushes the row off-baseline.
 */
.component-card > .component-card-title {
  margin-bottom: calc(var(--spacing) * 6);
}

/*
 * .component-card-title-row
 * Wrapper when a Cards::CardComponent has both a title and the
 * title_actions slot. Lays them out on a single row, vertically
 * centered, with the actions anchored to the right. The wrapper takes
 * over the title's bottom margin so the inner title isn't doubly spaced.
 */
.component-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* The actions never shrink, so without wrapping a narrow viewport
   * squeezes the title into a multi-line stack instead of moving the
   * actions to their own row. */
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  margin-bottom: calc(var(--spacing) * 6);
}

.component-card-title-row .component-card-title {
  margin-bottom: 0;
}

/*
 * .component-card-heading / .component-card-description
 * The title group plus an optional one-line description directly under it
 * (Cards::CardComponent `description:`). With a description the row aligns
 * to the top so title actions sit level with the title, not the pair's middle.
 *
 * Used by: app/components/cards/card_component.html.erb
 * Reuse when: a card's title needs one muted line explaining its content.
 */
.component-card-heading {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1);
  min-width: 0;
}

.component-card-title-row:has(.component-card-description) {
  align-items: flex-start;
}

.component-card-description {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.component-card-title-actions {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  flex-shrink: 0;
}

/*
 * .component-card-help
 * Wraps the contextual help trigger rendered by the `help_slug:` option on
 * Cards::CardComponent. Groups the trigger button and the DrawerComponent
 * root div into a single flex item, so the drawer's empty (fixed-position)
 * div can't consume a .component-card-title-actions gap and shove the icon
 * off the right edge. The negative inline margin cancels the icon button's
 * own padding so the glyph optically aligns with the card's content edge.
 */
.component-card-help {
  display: flex;
  align-items: center;
  margin-inline-end: calc(var(--spacing) * -1);
}

/*
 * Corner help is quiet chrome, not a call to action: muted at rest so it
 * doesn't compete with the card title, accent on hover. Scoped here rather
 * than on .help-trigger-icon-only, which the settings mobile nav styles as
 * a bordered button.
 */
.component-card-help .help-trigger {
  color: var(--color-text-muted);
}

.component-card-help .help-trigger:hover {
  color: var(--color-accent);
}

/*
 * .component-card-title-group
 * Left half of .component-card-title-row when the card has a count
 * paired with its title. Lays the h3 and the count chip on a single
 * baseline-aligned row so the count reads as a quiet subtitle.
 */
.component-card-title-group {
  display: flex;
  align-items: baseline;
  gap: calc(var(--spacing) * 2);
  min-width: 0;
}

/*
 * .component-card-title-count
 * Muted count chip next to a card title (e.g. "2/5", "3", "4"). Use the
 * `count:` keyword on Cards::CardComponent to render it.
 */
.component-card-title-count {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ── Card size variants ── */

/*
 * .component-card-narrow / -medium / -wide
 * Max-width constraints applied to the outer wrapper div of
 * Cards::CardComponent via the `size:` param. Width only — they do not
 * center the card. Most in-app forms sit under a left-aligned page
 * header, so a sized card should align left with it by default; a page
 * that wants the card centered (a standalone splash screen, a wizard
 * step) declares that itself, e.g. by rendering the card inside
 * `.stack-center` or adding `margin-inline: auto` on its own domain class.
 *
 * A page's create/edit form is NOT a sized card: it renders an unsized
 * Cards::CardComponent that fills the content column, the same width as the
 * page header and tables around it. Sizes are for cards that are not a
 * page's form.
 *
 * :narrow (32rem) — settings panels, compact single-purpose cards.
 * :medium (36rem) — wider panels.
 * :wide (56rem)   — admin-level wide panels.
 *
 * Used by: app/components/cards/card_component.html.erb (outer wrapper)
 * Reuse when: constraining a card's max-width via the size: param.
 * Do NOT use for: non-card max-width — use area-specific domain classes.
 */
.component-card-narrow {
  max-width: 32rem;
}

.component-card-medium {
  max-width: 36rem;
}

.component-card-wide {
  max-width: 56rem;
}

/* ─── PageHeaderComponent ─── */

/*
 * .component-page-header
 * Inline page header (eyebrow → title + actions in one row → subtitle).
 * Replaces the old `.app-shell-navigation` markup (which only handled the
 * title + actions row). The component is rendered inside whatever container
 * already owns the page's horizontal padding — typically `.app-shell-content-padded`
 * or `.app-shell-navigation`'s wrapper — so the component itself only owns
 * vertical rhythm.
 *
 * Used by: app/components/page_header_component.html.erb
 * Reuse when: any page-level header with title + optional subtitle / actions.
 * Do NOT use for: section headers within a page (use a primitive heading)
 *   or topbar-style chrome (we don't have a topbar).
 */
.component-page-header {
  min-width: 0;
}

/* --page-header-title-size is set per variant rather than on the title itself
 * so a control that replaces the <h1> — EditableTitleComponent's rename input —
 * can size itself identically without duplicating the clamp. */
.component-page-header-default {
  --page-header-title-size: clamp(1.5rem, 2.2vw, 2rem);
  padding-top: calc(var(--spacing) * 10);
  padding-bottom: calc(var(--spacing) * 6);
}

.component-page-header-hero {
  --page-header-title-size: clamp(1.875rem, 2.8vw, 2.5rem);
  padding-top: calc(var(--spacing) * 12);
  padding-bottom: calc(var(--spacing) * 8);
}

/* Mobile page-header rhythm — tighten the vertical padding on small screens so
 * the header doesn't read top-heavy next to the reduced page gutters (see
 * --spacing-page-x in primitives.css). Two-step to match the gutter breakpoints. */
@media (max-width: 48rem) {
  .component-page-header-default {
    padding-top: calc(var(--spacing) * 8);    /* 32px */
    padding-bottom: calc(var(--spacing) * 5);  /* 20px */
  }

  .component-page-header-hero {
    padding-top: calc(var(--spacing) * 10);    /* 40px */
    padding-bottom: calc(var(--spacing) * 7);  /* 28px */
  }
}

@media (max-width: 40rem) {
  .component-page-header-default {
    padding-top: calc(var(--spacing) * 6);    /* 24px */
    padding-bottom: calc(var(--spacing) * 4);  /* 16px */
  }

  .component-page-header-hero {
    padding-top: calc(var(--spacing) * 8);    /* 32px */
    padding-bottom: calc(var(--spacing) * 6);  /* 24px */
  }
}

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

.component-page-header-title {
  min-width: 0;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--color-text-heading);
  font-size: var(--page-header-title-size);
  line-height: 1.1;
}

.component-page-header-actions {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
}

.component-page-header-subtitle {
  margin-top: calc(var(--spacing) * 3);
  color: var(--color-text-muted);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line-height);
  font-weight: var(--type-body-weight);
  max-width: 70ch;
}

.component-page-header-hero .component-page-header-subtitle {
  font-size: var(--type-lead-size);
  line-height: var(--type-lead-line-height);
  letter-spacing: var(--type-lead-letter-spacing);
  font-weight: var(--type-lead-weight);
}

/*
 * .component-page-header-compact
 * The compact hero (PageHeaderComponent `size: :compact`): a smaller title, a
 * 15px subtitle 8px under it capped at 60ch, and a title row that holds one
 * line on desktop with room for a 40px control. Used where the title shares
 * its row with a readout and several actions (the market dashboard).
 *
 * Used by: app/components/page_header_component.rb (size: :compact)
 * Reuse when: a hero whose title row carries a readout beside the actions.
 * Do NOT use for: the default hero; it keeps the larger lead subtitle.
 */
.component-page-header-compact {
  --page-header-title-size: clamp(1.75rem, 2.5vw, 2.25rem);
}

.component-page-header-compact .component-page-header-row {
  min-height: 2.5rem;
}

.component-page-header-compact .component-page-header-subtitle,
.component-page-header-hero.component-page-header-compact .component-page-header-subtitle {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line-height);
  letter-spacing: normal;
  font-weight: var(--type-body-sm-weight);
  max-width: 60ch;
}

@media (min-width: 64rem) {
  .component-page-header-compact .component-page-header-row {
    flex-wrap: nowrap;
  }
}

/* At phone widths the title/actions row wraps, which drops the buttons between
   the title and the subtitle: the page names itself, asks for a decision, then
   explains what it is. The row is dissolved so title, subtitle and actions
   order as siblings of the header and the sentence reads in order. Eyebrow and
   headline keep the ends; the meta variant already puts its title on its own
   row, so it only needs its position in the sequence. */
@media (max-width: 40rem) {
  .component-page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .component-page-header-row {
    display: contents;
  }

  /* Only the header's own title: an editable title's <h1> sits inside its own
     flex row beside the pencil, and ordering it there would move it after the
     pencil. */
  .component-page-header > .component-page-header-title,
  .component-page-header-row > .component-page-header-title {
    order: 1;
  }

  .component-page-header-subtitle,
  .component-page-header-meta-row {
    order: 2;
  }

  .component-page-header-row .component-page-header-actions {
    order: 3;
    margin-top: calc(var(--spacing) * 4);
  }

  .component-page-header-headline {
    order: 4;
  }
}

/*
 * .component-page-header-top / -split (the `aside` slot)
 * A detail header that carries a small card of its own beside the title: the
 * eyebrow and the actions share the top row, and the title, its meta line and
 * the card share the row below, the card at the right edge.
 *
 * The title column keeps a 20rem floor and the card is capped at 27rem; when
 * both can't fit the card wraps below the title rather than squeezing it.
 *
 * Used by: app/components/page_header_component.html.erb (audience show page)
 * Reuse when: a detail page states one standing fact about the record next to
 *   its title (a total, a status) and its actions would crowd that row.
 */
.component-page-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 4);
  flex-wrap: wrap;
}

.component-page-header-top .component-page-header-eyebrow {
  margin-bottom: 0;
}

.component-page-header-split {
  display: flex;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 8);
  margin-top: calc(var(--spacing) * 10);
}

.component-page-header-split--plain {
  margin-top: calc(var(--spacing) * 2);
}

.component-page-header-split-main {
  flex: 1 1 calc(var(--spacing) * 80);
  min-width: min(100%, calc(var(--spacing) * 80));
}

.component-page-header-split-main .component-page-header-title,
.component-page-header-split-main .component-editable-title-text,
.component-page-header-split .component-page-header-meta {
  overflow-wrap: anywhere;
}

.component-page-header-split .component-page-header-meta {
  margin-top: calc(var(--spacing) * 3);
}

.component-page-header-aside {
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(var(--spacing) * 108);
}

@media (max-width: 48rem) {
  .component-page-header-split {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: calc(var(--spacing) * 6);
    margin-top: calc(var(--spacing) * 6);
  }

  .component-page-header-split-main {
    flex-basis: auto;
  }

  .component-page-header-aside {
    max-width: none;
  }
}

/*
 * .component-page-header-headline (the `headline` slot)
 * A standing figure hung off the bottom of the header band — today the
 * dashboard's reach number. The slot owns the spacing so the header stays the
 * one place that decides the band's rhythm; the figure's own type lives with
 * its component.
 *
 * A header carrying one needs a wider gap below it than the 24px it puts
 * between its own parts, or the band reads as three evenly spaced lines
 * rather than as a band with a section after it.
 *
 * Used by: app/components/page_header_component.html.erb
 * Reuse when: any page fills the `headline` slot.
 */
.component-page-header-headline {
  margin-top: calc(var(--spacing) * 6);
}

.component-page-header:has(.component-page-header-headline) {
  padding-bottom: calc(var(--spacing) * 10);
}

@media (max-width: 48rem) {
  .component-page-header:has(.component-page-header-headline) {
    padding-bottom: calc(var(--spacing) * 8);
  }
}

@media (max-width: 40rem) {
  .component-page-header-headline {
    margin-top: calc(var(--spacing) * 4);
  }

  .component-page-header:has(.component-page-header-headline) {
    padding-bottom: calc(var(--spacing) * 6);
  }
}

/*
 * .component-page-header--band (opt in with the `page_header_band` helper)
 * A header composed as a band rather than as text at the top of the page.
 *
 * Two things come with it. Always: the page's content cap, centred, so the
 * header shares one column edge with the sections below it instead of running
 * to the width of the display. And, only when the header also fills the
 * `headline` slot, a surface — a card shell with the ambient accent wash
 * behind it, so the greeting, the standing figure and whatever chart sits
 * beside it read as one designed object.
 *
 * The surface is conditional because a header with nothing in the headline
 * slot is one line of text, and one line of text on a lit card is a banner
 * with nothing in it.
 *
 * Used by: app/views/dashboard/index.html.erb (via `page_header_band`)
 * Reuse when: a landing page's header carries a standing figure of its own.
 * Do NOT use for: ordinary section or detail headers — the plain header is
 *   still the default, and a page with two banded surfaces has none.
 */
.component-page-header--band {
  max-width: var(--dashboard-content-width);
  margin-inline: auto;
}

.component-page-header--band:has(.component-page-header-headline) {
  position: relative;
  isolation: isolate;
  margin-block: calc(var(--spacing) * 8);
  padding: calc(var(--spacing) * 8);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  background: var(--color-surface-primary);
  box-shadow: var(--shadow-sm);
}

/*
 * The band's atmosphere. Two soft accent-derived radials — a near one rising
 * out of the top-left corner behind the greeting and the figure, a far, fainter
 * one in the opposite corner so the light has a direction. This is the auth
 * backdrop's ambient-wash language brought inside a surface; it is not glass,
 * which stays licensed to the audience-visualization hero and nowhere else.
 *
 * Drawn on a pseudo-element under the content (z-index: -1 inside the band's
 * own stacking context) rather than as extra background layers on the band, so
 * the surface color and the wash can be reasoned about separately and the wash
 * can be dropped per theme without touching the card recipe.
 */
.component-page-header--band:has(.component-page-header-headline)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(ellipse 64% 132% at 2% -10%, var(--color-dashboard-hero-wash-near), transparent 70%),
    radial-gradient(ellipse 54% 120% at 98% 112%, var(--color-dashboard-hero-wash-far), transparent 68%);
}

/* Inside the band the greeting is the lead-in to the figure, not a page title
 * with something under it, so it groups tighter with what follows. */
.component-page-header--band .component-page-header-headline {
  margin-top: calc(var(--spacing) * 4);
}

@media (max-width: 48rem) {
  .component-page-header--band:has(.component-page-header-headline) {
    padding: calc(var(--spacing) * 6);
  }
}

/* At phone gutters the band's own padding is stacked on top of the page's, so
 * it steps down again — 24px inside 16px gutters already insets the figure
 * 40px from the edge of a 390px screen. */
@media (max-width: 40rem) {
  .component-page-header--band:has(.component-page-header-headline) {
    margin-block: calc(var(--spacing) * 6);
    padding: calc(var(--spacing) * 4);
  }
}

/*
 * .component-page-header--stack-actions (opt-in via `stack_header_actions`)
 * Mobile hero treatment for index pages: below 64rem the header stacks as
 * title → subtitle → full-width action(s). The action row is dissolved with
 * `display: contents` so title/subtitle/actions can be reordered as siblings
 * of the header (order 1/2/3). Only pages that opt in are affected.
 */
@media (max-width: 63.9375rem) {
  .component-page-header--stack-actions {
    display: flex;
    flex-direction: column;
  }

  .component-page-header--stack-actions .component-page-header-row {
    display: contents;
  }

  /* The sticky topbar names the page at this width, so a visible hero title
     would be the same word twice, 90px apart. It stays in the document for
     assistive tech and the outline — the topbar's copy is a div, not a heading. */
  .component-page-header--stack-actions .component-page-header-title {
    order: 1;
    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;
  }

  .component-page-header--stack-actions .component-page-header-subtitle { order: 2; }

  .component-page-header--stack-actions .component-page-header-actions {
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    gap: calc(var(--spacing) * 2);
    margin-top: calc(var(--spacing) * 4);
  }

  .component-page-header--stack-actions .component-page-header-actions .component-button {
    width: 100%;
  }

  /* Contextual "Need help?" link under the stacked CTAs: left-aligned with
     the buttons, body-size, and set off from the button block above it. */
  .component-page-header--stack-actions .component-page-header-actions .help-trigger-inline {
    align-self: flex-start;
    margin-top: calc(var(--spacing) * 3.5);
    gap: calc(var(--spacing) * 2);
    font-size: var(--font-size-base);
  }
}

/*
 * .component-page-header-meta-row
 * Detail-page hero variant: title gets its own row and the meta line
 * (e.g. "Consumer · Created 2026-03-01") shares a row below with the
 * actions cluster. Used when long titles would otherwise compete with
 * a wide button row for horizontal space.
 */
.component-page-header-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 6);
  flex-wrap: wrap;
  margin-top: calc(var(--spacing) * 4);
}

.component-page-header-meta {
  font-size: var(--type-body-size);
  line-height: var(--type-body-line-height);
  font-weight: var(--type-body-weight);
  color: var(--color-text-muted);
}

/*
 * .component-page-header-eyebrow
 * Breadcrumb-style label above the title on detail/builder pages — back-arrow
 * + module-colored icon + module name. The text reads as quiet secondary
 * copy; only the icon carries the module color, so the eyebrow recedes and
 * lets the title own the visual hierarchy. Hover underlines the whole link.
 */
.component-page-header-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-body);
  transition: color var(--motion-fast);
}

.component-page-header-eyebrow-link {
  cursor: pointer;
}

.component-page-header-eyebrow-link:hover {
  color: var(--color-text-heading);
  text-decoration: underline;
  text-underline-offset: 0.1875rem;
}

.component-page-header-eyebrow-arrow {
  width: 0.75rem;
  height: 0.75rem;
}

.component-page-header-eyebrow-icon {
  display: inline-flex;
  align-items: center;
  color: var(--page-header-eyebrow-color, var(--color-accent));
}

.component-page-header-eyebrow-icon-svg {
  width: 0.75rem;
  height: 0.75rem;
}


/* ─── EditableTitleComponent ─── */

/*
 * .component-editable-title
 * Turbo frame wrapping a page-header heading and its rename form. <turbo-frame>
 * is inline by default and this element is the flex child that stands in for
 * the <h1> in .component-page-header-row, so it has to declare its own box.
 *
 * Used by: app/components/editable_title_component.html.erb
 * Reuse when: nothing else — this is the component's own frame.
 * Do NOT use for: styling the heading itself (that stays
 *   .component-page-header-title so both variants' type scale still applies).
 */
.component-editable-title,
.component-editable-title-body {
  display: block;
  min-width: 0;
}

/*
 * .component-editable-title-display / -text / -trigger
 * Resting state: the heading plus a pencil that fades in on hover or keyboard
 * focus. The heading text is itself a button so the whole title is a click
 * target, but it's styled to disappear into the <h1> — the pencil is the only
 * visible affordance, and a text caret signals what clicking does.
 *
 * Used by: app/components/editable_title_component.html.erb
 * Reuse when: nothing else.
 * Do NOT use for: ordinary icon buttons in a header — those belong in the
 *   actions slot as a ghost ButtonComponent.
 */
.component-editable-title-display {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  min-width: 0;
}

.component-editable-title-text {
  min-width: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: text;
}

.component-editable-title-trigger,
.component-editable-title-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: calc(var(--spacing) * 2);
  border: 0;
  border-radius: var(--radius-lg);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--motion-fast), background-color var(--motion-fast), opacity var(--motion-fast);
}

.component-editable-title-trigger:hover,
.component-editable-title-action:hover {
  color: var(--color-text-heading);
  background-color: var(--color-surface-hover);
}

.component-editable-title-trigger {
  opacity: 0;
}

.component-editable-title-display:hover .component-editable-title-trigger,
.component-editable-title-display:focus-within .component-editable-title-trigger {
  opacity: 1;
}

/* Focus doctrine: the shared ring on keyboard focus. The trigger rests at
 * opacity 0, so it also has to reveal itself — a focused control that can't be
 * seen is the same as no focus indicator at all. */
.component-editable-title-trigger:focus-visible,
.component-editable-title-action:focus-visible {
  opacity: 1;
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Touch devices never fire hover, so the pencil would be permanently invisible
 * and the title would look like plain text. */
@media (hover: none) {
  .component-editable-title-trigger {
    opacity: 1;
  }
}

/*
 * .component-editable-title-form / -input
 * Editing state. The input mirrors the heading's type so the title doesn't
 * jump size when it turns into a field — it reads as the same text, now
 * editable. Width is capped so a long name doesn't push the save/cancel
 * controls off the row.
 *
 * Used by: app/components/editable_title_component.html.erb
 * Reuse when: nothing else.
 * Do NOT use for: regular form fields (use Forms::FieldComponent).
 */
.component-editable-title-form {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  min-width: 0;
}

.component-editable-title-input {
  /* The field's padding and border are pulled back out with negative margins
   * so its outer box matches the heading's line box exactly: the text keeps
   * its position and the rest of the page doesn't shift when the title flips
   * into edit mode. 0.0625rem is the 1px border. */
  --editable-title-inset-inline: calc(var(--spacing) * 2 + 0.0625rem);
  --editable-title-inset-block: calc(var(--spacing) * 1 + 0.0625rem);
  flex: 1 1 auto;
  min-width: 0;
  max-width: 32rem;
  font-size: var(--page-header-title-size);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.1;
  color: var(--color-text-input);
  background-color: var(--color-surface-input);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  margin-block: calc(-1 * var(--editable-title-inset-block));
  margin-inline-start: calc(-1 * var(--editable-title-inset-inline));
}

.component-editable-title-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

/*
 * .component-editable-title-error
 * Rejected-name message under the field. Matches .component-base-error so
 * inline validation reads the same here as it does inside a form.
 *
 * Used by: app/components/editable_title_component.html.erb
 * Reuse when: nothing else.
 * Do NOT use for: base model errors in forms (use .component-base-error).
 */
.component-editable-title-error {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-danger);
}


/* ─── FilterListComponent / FilterRowComponent ─── */

/*
 * .component-filter-list / .component-filter-row
 * Hairline-divided list of filter rules (audience/list details). Replaces
 * the gray-pill-per-row pattern that read like form inputs. Each row is a
 * three-column layout: field label, optional condition operator, then values.
 */
.component-filter-list {
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-subtle);
  overflow: hidden;
}

.component-filter-list > * + * {
  border-top: 1px solid var(--color-border-subtle);
}

.component-filter-row {
  display: flex;
  align-items: baseline;
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
}

.component-filter-row-field {
  flex-shrink: 0;
  width: 11rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-body);
}

.component-filter-row-condition {
  flex-shrink: 0;
  margin-right: calc(var(--spacing) * 3);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-filter-row-values {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
}


/* ─── DetailListComponent / DetailRowComponent ─── */

/*
 * .component-detail-list / .component-detail-row
 * Lightweight detail-page chrome (admin record views, "Details" panels).
 * Hairline-divided dl/dt/dd. Empty values render as a muted em-dash.
 */
.component-detail-list {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  overflow: hidden;
}

.component-detail-list-title {
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text-heading);
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-detail-list-body {
  margin: 0;
}

.component-detail-list-row {
  display: flex;
  align-items: baseline;
  gap: calc(var(--spacing) * 6);
  padding: 0.875rem calc(var(--spacing) * 6);
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-detail-list-row-last,
.component-detail-list-row:last-child {
  border-bottom: 0;
}

.component-detail-list-row-label {
  flex-shrink: 0;
  min-width: 10rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

.component-detail-list-row-value {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-heading);
}

.component-detail-list-row-empty {
  color: var(--color-text-muted);
}


/* ─── QuickActionTileComponent ─── */

/*
 * .component-quick-action-tile
 * Apple bento-style action card. Surface lit by its own module color with an
 * IconBadge at top-left and a corner arrow chip at top-right that fills with
 * that color on hover. The whole tile lifts on hover; the arrow chip
 * translates and inverts its color. Drives "this is a target" affordance.
 *
 * The module color is present at rest, not only on hover: a corner wash, a
 * tinted hairline, and a soft tinted ambient shadow under the tile. A grid of
 * tiles whose only color arrives under the cursor leaves the page white and
 * inert for every reader who has not moved the mouse yet, and these tiles are
 * the most affordance-rich thing on a dashboard. Hover then steps the same
 * three properties up rather than introducing them, so the tile answers the
 * pointer by getting warmer, not by lighting up from nothing.
 *
 * The three shares are custom properties so the dark theme can retune them
 * without restating the recipe — Studio Dark reads a wash by how much it
 * lightens the surface and nearly abandons shadows, so it needs more wash and
 * more border and less glow than Cool Paper does.
 *
 * Used by: app/components/quick_action_tile_component.html.erb
 * Reuse when: a small grid of high-affordance destinations (Dashboard
 *   Quick Actions, ServicesDashboard internal actions, UploadList Featured
 *   Tools). Do NOT use for: rows in a long list (row-hover pattern instead)
 *   or for primary CTAs (those stay as <Button variant="primary">).
 */
.component-quick-action-tile {
  --quick-action-rest-wash: 8%;
  --quick-action-rest-border: 26%;
  --quick-action-rest-glow: 24%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 6);
  background:
    radial-gradient(
      118% 96% at 0% 0%,
      color-mix(in srgb, var(--quick-action-color) var(--quick-action-rest-wash), transparent),
      transparent 64%
    ),
    var(--color-surface-primary);
  border: 1px solid color-mix(in srgb, var(--quick-action-color) var(--quick-action-rest-border), var(--color-border-themed));
  border-radius: var(--radius-2xl);
  box-shadow: 0 0.5rem 1.25rem -0.75rem color-mix(in srgb, var(--quick-action-color) var(--quick-action-rest-glow), transparent),
              var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  width: 100%;
  transition: transform var(--motion-fast),
              box-shadow var(--motion-fast),
              border-color var(--motion-fast);
}

/* :not(-disabled) so the disabled reset below still wins in dark mode — the
 * reset shares the base rule's specificity and would otherwise lose to this
 * two-class selector. */
[data-theme="dark"] .component-quick-action-tile:not(.component-quick-action-tile-disabled) {
  --quick-action-rest-wash: 12%;
  --quick-action-rest-border: 34%;
  --quick-action-rest-glow: 26%;
}

/* Hover is a step up from the rest state, not a switch-on: the same wash, a
 * fuller hairline, a deeper glow, and the 2px tile lift. */
:is(a, button).component-quick-action-tile:hover {
  transform: translateY(-0.125rem);
  border-color: color-mix(in srgb, var(--quick-action-color) 55%, transparent);
  box-shadow: 0 0.75rem 1.75rem -0.625rem color-mix(in srgb, var(--quick-action-color) 40%, transparent),
              0 0.125rem 0.375rem -0.125rem color-mix(in srgb, var(--quick-action-color) 24%, transparent);
}

/* Matches the :hover rule's specificity (the :is(a, button) prefix) so a tile
 * the pointer happens to be resting on still shows its focus ring when the
 * keyboard lands on it. Without the prefix the hover glow outranked this rule
 * and the ring disappeared for exactly the user who needs it.
 *
 * box-shadow is one property, so the ring has to restate the tile's resting
 * glow or a focused tile would drop out of the page while it is focused. */
:is(a, button).component-quick-action-tile:focus-visible {
  outline: none;
  border-color: var(--quick-action-color);
  box-shadow: 0 0.5rem 1.25rem -0.75rem color-mix(in srgb, var(--quick-action-color) var(--quick-action-rest-glow), transparent),
              var(--focus-ring);
}

/* A tile that leads nowhere carries no identity light. Zeroing the three
 * shares collapses the wash and the glow to nothing and returns the hairline
 * to the themed border, without restating the recipe. */
.component-quick-action-tile-disabled {
  --quick-action-rest-wash: 0%;
  --quick-action-rest-border: 0%;
  --quick-action-rest-glow: 0%;
  cursor: not-allowed;
}

/* Dim only the icon/arrow visual for the disabled state — dimming the whole tile
 * with opacity drops the label/description text below WCAG AA contrast. */
.component-quick-action-tile-disabled .component-quick-action-tile-top {
  opacity: 0.55;
}

.component-quick-action-tile-disabled .component-quick-action-tile-label {
  color: var(--color-text-muted);
}

.component-quick-action-tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: calc(var(--spacing) * 2);
  width: 100%;
}

.component-quick-action-tile-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 8);
  height: calc(var(--spacing) * 8);
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: background-color var(--motion-fast),
              color var(--motion-fast),
              transform var(--motion-fast);
}

:is(a, button).component-quick-action-tile:hover .component-quick-action-tile-arrow {
  background: var(--quick-action-color);
  color: var(--color-text-inverted);
  transform: translate(0.125rem, -0.125rem);
}

.component-quick-action-tile-arrow-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-quick-action-tile-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-quick-action-tile-description {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: calc(var(--spacing) * 1);
}


/* ─── IconBadgeComponent ─── */

/*
 * .component-icon-badge
 * Colored icon halo. Square container with a low-alpha tint of --icon-badge-color
 * as background, a slightly darker alpha as border, and the centered icon
 * rendered in that same color. Used wherever a module/identity color is
 * paired with an icon: StatCard top-right, sidebar active row, empty state,
 * quick action tile, list picker row, etc.
 *
 * Used by: app/components/icon_badge_component.html.erb
 * Reuse when: rendering an IconBadgeComponent.
 * Do NOT use for: bespoke icon containers — extend SIZES in the component
 *   or pass an integer size if a one-off pixel size is genuinely needed.
 */
.component-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--icon-badge-size);
  height: var(--icon-badge-size);
  border-radius: calc(var(--icon-badge-size) * 0.3);
  background: color-mix(in srgb, var(--icon-badge-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--icon-badge-color) 20%, transparent);
  color: var(--icon-badge-color);
}

.component-icon-badge-icon {
  width: var(--icon-badge-icon-size, calc(var(--icon-badge-size) * 0.45));
  height: var(--icon-badge-icon-size, calc(var(--icon-badge-size) * 0.45));
}


/* ─── EmptyStateComponent ─── */

/*
 * .component-empty-state-rich
 * Container for rich empty states with icon, title, and description.
 * Vertically centered flex column with generous padding and themed border.
 *
 * Used by: app/components/empty_state_component.html.erb (rich? branch)
 * Reuse when: rendering an EmptyStateComponent with icon and/or title.
 * Do NOT use for: simple text-only empty states (use .component-empty-state-simple).
 */
.component-empty-state-rich {
  padding-top: calc(var(--spacing) * 20);
  padding-bottom: calc(var(--spacing) * 20);
  /* Horizontal inset so the title/description don't sit flush against the
   * card edge when the card is narrow (mobile) — the description's max-width
   * is close to the card width at small sizes, leaving ~0 side gap otherwise. */
  padding-inline: calc(var(--spacing) * 6);
  text-align: center;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
}

/*
 * .component-empty-state-simple
 * Container for simple text-only empty states. Centered muted text
 * with generous padding and themed border.
 *
 * Used by: app/components/empty_state_component.html.erb (else branch)
 * Reuse when: rendering an EmptyStateComponent without icon or title.
 * Do NOT use for: rich empty states with icon/title (use .component-empty-state-rich).
 */
.component-empty-state-simple {
  text-align: center;
  padding: calc(var(--spacing) * 20);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
}

/*
 * .component-empty-state-rounded
 * Full border-radius modifier for standalone empty states (no header above).
 *
 * Used by: app/components/empty_state_component.html.erb (with_header: false)
 * Reuse when: rendering an empty state that is not preceded by a table/list header.
 */
.component-empty-state-rounded {
  border-radius: var(--radius-xl);
}

/*
 * .component-empty-state-with-header
 * Border-radius modifier for empty states inside a Tables::TableComponent
 * slot. The table's <thead> is not rendered when rows are empty, so the
 * empty state stands alone and rounds all four corners to match.
 *
 * Used by: app/components/empty_state_component.html.erb (with_header: true)
 * Reuse when: rendering an empty state inside a table's empty_state slot.
 */
.component-empty-state-with-header {
  border-radius: var(--radius-xl);
}

/*
 * .component-empty-state-borderless
 * Strips the surface fill + border from an EmptyStateComponent. Use
 * inside a parent card body where the outer card already provides the
 * surface and a nested border would read as a "card-in-card" artifact.
 *
 * Used by: app/components/empty_state_component.html.erb (bordered: false)
 * Reuse when: rendering an empty state inside another card.
 */
.component-empty-state-rich.component-empty-state-borderless,
.component-empty-state-simple.component-empty-state-borderless {
  background: transparent;
  border: none;
}

/*
 * .component-empty-state-compact
 * Trims the vertical padding for an empty state nested inside another card's
 * body. The 80px default is sized for an empty state that stands in for a
 * whole page; inside a dashboard card it makes the empty card taller than any
 * card holding real data, and because dashboard rows stretch to equal heights
 * the sibling card inherits that height as a hole in its own content.
 *
 * Used by: app/components/empty_state_component.html.erb (compact: true)
 * Reuse when: an EmptyStateComponent sits inside a parent card body.
 * Do NOT use for: page-level or table-level empty states, which own their
 *   surface and keep the generous default.
 */
.component-empty-state-rich.component-empty-state-compact {
  padding-top: calc(var(--spacing) * 6);
  padding-bottom: calc(var(--spacing) * 6);
}

.component-empty-state-simple.component-empty-state-compact {
  padding: calc(var(--spacing) * 6);
}

/* Inside a card there is room for the description on one line; the 22.5rem
 * cap is sized for a page-width empty state's narrow centered column. */
.component-empty-state-compact .component-empty-state-description {
  max-width: 40rem;
}

/*
 * .component-empty-state-icon-box
 * Square container for the empty state icon. Centered flex box with
 * themed border and rounded corners.
 *
 * Used by: app/components/empty_state_component.html.erb (rich? branch, when icon present)
 * Reuse when: rendering the icon container in a rich empty state.
 * Do NOT use for: standalone icon wrappers outside empty states.
 */
.component-empty-state-icon-box {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: calc(var(--spacing) * 4);
  border: 1px solid var(--color-border-themed);
  background: var(--color-surface-primary);
}

/*
 * .component-empty-state-icon
 * Icon sizing and color inside the empty state icon box.
 *
 * Used by: app/components/empty_state_component.html.erb (passed to IconComponent)
 * Reuse when: rendering the icon inside an empty state icon box.
 */
.component-empty-state-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-text-muted);
}

/*
 * .component-empty-state-title
 * Heading text for rich empty states. Base size, semibold, heading color.
 * Breaks mid-word when it has to, because a title can quote what the reader
 * typed — an unbroken search term would otherwise run out of the surface on a
 * phone.
 *
 * Used by: app/components/empty_state_component.html.erb (rich? branch)
 * Reuse when: rendering the title in a rich empty state.
 */
.component-empty-state-title {
  font-size: var(--type-h3-size);
  line-height: var(--type-h3-line-height);
  letter-spacing: var(--type-h3-letter-spacing);
  font-weight: var(--type-h3-weight);
  margin-bottom: calc(var(--spacing) * 1);
  color: var(--color-text-heading);
  overflow-wrap: anywhere;
}

/*
 * .component-empty-state-description
 * Description text below the empty state title. Body type, muted,
 * max-width constrained.
 *
 * Used by: app/components/empty_state_component.html.erb (rich? branch)
 * Reuse when: rendering the description in a rich empty state.
 */
.component-empty-state-description {
  font-size: var(--type-body-size);
  line-height: var(--type-body-line-height);
  font-weight: var(--type-body-weight);
  color: var(--color-text-muted);
  max-width: 22.5rem;
}

/*
 * .component-empty-state-actions
 * Container for optional action buttons/links below the empty state description.
 *
 * Used by: app/components/empty_state_component.html.erb (rich? branch, content slot)
 * Reuse when: rendering action buttons inside a rich empty state.
 */
.component-empty-state-actions {
  margin-top: calc(var(--spacing) * 6);
}

/* ─── SectionHeaderComponent ─── */

/*
 * .component-section-header
 * Bottom spacing for the section-header wrapper row.
 *
 * Used by: app/components/section_header_component.html.erb
 * Reuse when: only via SectionHeaderComponent — pair with .row-between primitive on the same element.
 * Do NOT use for: standalone elements; if you need a bare section title, use SectionHeaderComponent.
 */
.component-section-header {
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-section-header-title
 * Typography for the section-header title element (h2 or h3, semantic choice).
 *
 * Used by: app/components/section_header_component.html.erb
 * Reuse when: only via SectionHeaderComponent.
 * Do NOT use for: page-level h1 titles (use title helper) or card titles inside detail rows.
 */
.component-section-header-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
  margin: 0;
}

/*
 * .component-section-header-marker
 * Optional color chip before a section title, for sections that stand for a
 * named category (a client type, a service line) rather than being a one-off
 * heading. Decorative only — the title always names the category in text, so
 * the color never carries meaning on its own. Sized to the title's cap height.
 *
 * Used by: app/components/section_header_component.html.erb
 * Reuse when: only via SectionHeaderComponent's marker: option.
 * Do NOT use for: status or state (use BadgeComponent).
 */
.component-section-header-marker {
  flex-shrink: 0;
  width: calc(var(--spacing) * 0.75);
  height: calc(var(--spacing) * 3.5);
  border-radius: var(--radius-pill);
}

.component-section-header-marker-blue { background: var(--theme-badge-blue-text); }
.component-section-header-marker-purple { background: var(--theme-badge-purple-text); }
.component-section-header-marker-green { background: var(--theme-badge-green-text); }
.component-section-header-marker-orange { background: var(--theme-badge-orange-text); }
.component-section-header-marker-red { background: var(--theme-badge-red-text); }
.component-section-header-marker-yellow { background: var(--theme-badge-yellow-text); }
.component-section-header-marker-gray { background: var(--theme-badge-gray-text); }

/* ─── DetailComponent ─── */

/*
 * .component-detail-row
 * Inner content layout for standard-density detail rows.
 * Horizontal flex with name label and value side by side.
 *
 * Used by: app/components/detail_component.html.erb (standard mode)
 * Reuse when: rendering the inner content of a non-compact DetailComponent.
 * Do NOT use for: compact detail rows (use .component-detail-row-compact).
 */
.component-detail-row {
  display: flex;
  flex: 1;
  align-items: baseline;
}

/*
 * .component-detail-row-compact
 * Inner content layout for compact-density detail rows.
 * Horizontal flex with space-between alignment.
 *
 * Used by: app/components/detail_component.html.erb (compact_display: true)
 * Reuse when: rendering the inner content of a compact DetailComponent.
 * Do NOT use for: standard detail rows (use .component-detail-row).
 */
.component-detail-row-compact {
  display: flex;
  gap: calc(var(--spacing) * 1);
  justify-content: space-between;
}

/*
 * .component-detail-name
 * Name label for standard-density detail rows. Caption-size muted
 * weight-500 label paired with the value column to the right.
 * Fixed-width / no-shrink so values wrap instead of compressing
 * the label.
 *
 * Used by: app/components/detail_component.html.erb (standard mode)
 * Reuse when: rendering the name label in a non-compact DetailComponent.
 */
.component-detail-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  flex-shrink: 0;
  width: 13rem;
}

/*
 * .component-detail-name-compact
 * Name label for compact-density detail rows. Medium weight, body color,
 * 50% width for balanced two-column layout.
 *
 * Used by: app/components/detail_component.html.erb (compact_display: true)
 * Reuse when: rendering the name label in a compact DetailComponent.
 */
.component-detail-name-compact {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-body);
  width: 50%;
}

/*
 * .component-detail-value
 * Value column for standard-density detail rows. Primary-color sm
 * text — pairs with the muted caption label on the left so the
 * value reads as content.
 *
 * Used by: app/components/detail_component.html.erb (standard mode)
 * Reuse when: rendering the value content in a non-compact DetailComponent.
 */
.component-detail-value {
  font-size: var(--font-size-sm);
  color: var(--color-text-heading);
}

/*
 * On narrow (phone) viewports the fixed 13rem name label leaves too
 * little room for the value beside it, so the row overflows. Stack the
 * name above the value and let the label size to content instead.
 */
@media (max-width: 40rem) {
  .component-detail-row {
    flex-direction: column;
    align-items: stretch;
  }

  .component-detail-name {
    width: auto;
  }
}

/*
 * .component-detail-value-compact
 * Value column for compact-density detail rows. Body-colored text,
 * 50% width for balanced two-column layout.
 *
 * Used by: app/components/detail_component.html.erb (compact_display: true)
 * Reuse when: rendering the value content in a compact DetailComponent.
 */
.component-detail-value-compact {
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
  width: 50%;
}

/*
 * .component-detail-wrapper
 * Plain wrapper for standard-density detail rows (no link, no selection).
 * Content is flush with the parent edge so it aligns with a card title
 * above and any sibling interactive detail rows (whose content is also
 * flush, with the hover rect bleeding outward via negative margin).
 *
 * Used by: app/components/detail_component.html.erb (plain mode, standard density)
 * Reuse when: rendering a non-interactive, non-compact DetailComponent.
 */
.component-detail-wrapper {
  padding: calc(var(--spacing) * 2) 0;
}

/*
 * .component-detail-wrapper-compact
 * Plain wrapper for compact-density detail rows (no link, no selection).
 *
 * Used by: app/components/detail_component.html.erb (plain mode, compact_display: true)
 * Reuse when: rendering a non-interactive, compact DetailComponent.
 */
.component-detail-wrapper-compact {
  padding: calc(var(--spacing) * 1) 0;
  font-size: var(--font-size-sm);
  line-height: 1.25rem;
}

/*
 * .component-detail-link
 * Clickable detail row wrapper (url mode). Flex row with hover highlight.
 * Negative horizontal margin (-16px) plus matching padding (16px) keeps
 * content flush with the parent edge while letting the hover rectangle
 * bleed 16px outward into the enclosing card padding.
 *
 * Used by: app/components/detail_component.html.erb (url mode)
 * Reuse when: rendering a DetailComponent with a url parameter.
 * Do NOT use for: non-clickable detail rows or selection-button rows.
 */
.component-detail-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-left: calc(var(--spacing) * -4);
  margin-right: calc(var(--spacing) * -4);
  border-radius: var(--radius-lg);
  padding-left: calc(var(--spacing) * 4);
  padding-right: calc(var(--spacing) * 4);
  text-decoration: none;
  color: inherit;
}

/*
 * .component-detail-link-standard
 * Standard-density vertical padding for linked detail rows.
 *
 * Used by: app/components/detail_component.html.erb (url mode, standard density)
 */
.component-detail-link-standard {
  padding-top: calc(var(--spacing) * 2);
  padding-bottom: calc(var(--spacing) * 2);
}

/*
 * .component-detail-link-compact
 * Compact-density vertical padding and typography for linked detail rows.
 *
 * Used by: app/components/detail_component.html.erb (url mode, compact_display: true)
 */
.component-detail-link-compact {
  padding-top: calc(var(--spacing) * 1);
  padding-bottom: calc(var(--spacing) * 1);
  font-size: var(--font-size-sm);
  line-height: 1.25rem;
}

/*
 * .component-detail-link-chevron
 * Chevron icon in linked detail rows. Muted color, transitions to heading
 * color on parent link hover via descendant rule.
 *
 * Used by: app/components/detail_component.html.erb (passed to IconComponent in url mode)
 * Reuse when: rendering the navigation chevron in a linked DetailComponent.
 */
.component-detail-link-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
}
.component-detail-link:hover .component-detail-link-chevron {
  color: var(--color-text-heading);
}

/* ─── TabBarComponent ─── */

/*
 * .component-tab-bar
 * Outer container for a tab bar. Inline flex row with gap, padding,
 * rounded corners, quick-action surface background, and themed border.
 *
 * Used by: app/components/tab_bar_component.html.erb
 * Reuse when: rendering a TabBarComponent.
 * Do NOT use for: navigation bars or breadcrumbs (use app-shell CSS).
 */
.component-tab-bar {
  display: inline-flex;
  gap: calc(var(--spacing) * 1);
  padding: calc(var(--spacing) * 1);
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
}

/* Phones: a wide tab bar scrolls horizontally rather than pushing the page
 * past the viewport. Tabs keep their size; the pill track scrolls. */
@media (max-width: 40rem) {
  .component-tab-bar {
    max-width: 100%;
    overflow-x: auto;
  }

  .component-tab {
    flex-shrink: 0;
  }
}

/*
 * .component-tab
 * Shared base styling for individual tab links inside a tab bar.
 * Apple-style segmented control: pill-track wrapper, active tab gets a
 * white surface + subtle shadow so it lifts out of the track. Replaces the
 * previous solid-accent active state (which competed with primary buttons
 * for "act here" attention).
 *
 * Used by: app/components/tab_bar_component.html.erb
 * Reuse when: rendering tab links inside a TabBarComponent.
 * Do NOT use for: standalone links or buttons outside a tab bar.
 */
.component-tab {
  border: 0;
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 4);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: background-color var(--motion-fast),
              color var(--motion-fast),
              box-shadow var(--motion-fast);
  cursor: pointer;
  text-decoration: none;
}

/*
 * .component-tab-count
 * Muted count trailing a tab's label ("Overdue 12"), matching the count chip
 * beside a card title. Inline rather than a flex child so a tab with no count
 * keeps the exact box it had before counts existed.
 *
 * Used by: app/components/tab_bar_component.html.erb (the `count:` key on a tab)
 * Reuse when: a tab says how many records are behind it.
 * Do NOT use for: badges — render BadgeComponent.
 */
.component-tab-count {
  margin-left: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/*
 * .component-tab-with-icon / .component-tab-icon
 * A tab with an icon (the `icon:` key on a tab): a 13px glyph 6px before the
 * label, centered on it.
 *
 * Used by: app/components/tab_bar_component.html.erb
 */
.component-tab-with-icon {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
}

.component-tab-icon {
  width: 0.8125rem;
  height: 0.8125rem;
  flex-shrink: 0;
}

.component-tab-active {
  background: var(--color-surface-primary);
  color: var(--color-text-heading);
  box-shadow: var(--shadow-sm);
}

.component-tab-inactive {
  background: transparent;
  color: var(--color-text-muted);
}

.component-tab-inactive:hover {
  color: var(--color-text-heading);
}

/* Focus doctrine: the shared ring on keyboard focus. The active tab already
 * spends its box-shadow on the segmented-control lift, so it restates that
 * elevation and stacks the ring after it rather than replacing it. */
.component-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-tab-active:focus-visible {
  box-shadow: var(--shadow-sm), var(--focus-ring);
}

/* ─── ResourceList::ItemComponent ─── */

/*
 * .component-resource-list-item
 * Outer wrapper for a single item in a resource list. Provides flex layout,
 * rounded corners, surface background, themed border, and hover state
 * triggered when a descendant link is hovered.
 *
 * Used by: app/components/resource_list/item_component.html.erb
 * Reuse when: rendering a ResourceList::ItemComponent.
 * Do NOT use for: standalone cards or non-list items (use .component-card).
 */
.component-resource-list-item {
  display: flex;
  align-items: center;
  border-radius: var(--radius-2xl);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--motion-fast),
    border-color var(--motion-fast);
}

.component-resource-list-item:has(a:hover) {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}

/*
 * .component-resource-list-item-link
 * Clickable inner area of a resource list item. Flex layout with gap,
 * fills available width, left-only rounding (right side left open for
 * an actions slot).
 *
 * Used by: app/components/resource_list/item_component.html.erb (link? branch, actions present)
 * Reuse when: rendering a linked resource list item that has an actions slot.
 * Do NOT use for: non-linked items (use .component-resource-list-item-content).
 */
.component-resource-list-item-link {
  flex: 1;
  min-width: 0;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 5);
  border-radius: var(--radius-2xl) 0 0 var(--radius-2xl);
  text-decoration: none;
  color: inherit;
}

/*
 * .component-resource-list-item-link-full
 * Full-rounded variant of the item link, used when no actions slot is present.
 * The link spans the full width and rounds all corners.
 *
 * Used by: app/components/resource_list/item_component.html.erb (link? branch, no actions)
 * Reuse when: rendering a linked resource list item without actions.
 */
.component-resource-list-item-link-full {
  border-radius: var(--radius-2xl);
}

/* Focus doctrine: the shared ring on keyboard focus. The item's resting
 * elevation lives on the wrapper, not on this link, so there is nothing to
 * stack here — the ring traces the link's own (left-rounded) shape. */
.component-resource-list-item-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/*
 * .component-resource-list-item-content
 * Non-linked inner area of a resource list item. Same layout as the link
 * variant but without pointer cursor or hover behavior.
 *
 * Used by: app/components/resource_list/item_component.html.erb (non-link branch)
 * Reuse when: rendering a non-linked resource list item.
 * Do NOT use for: linked items (use .component-resource-list-item-link).
 */
.component-resource-list-item-content {
  flex: 1;
  min-width: 0;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 5);
}

/*
 * .component-resource-list-item-actions
 * Actions slot container inside a resource list item. Right-aligned flex
 * row for action buttons, with padding and non-shrinking layout.
 *
 * Used by: app/components/resource_list/item_component.html.erb (actions slot)
 * Reuse when: rendering action buttons inside a resource list item.
 * Do NOT use for: standalone button groups (use .cluster primitive).
 */
.component-resource-list-item-actions {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  flex-shrink: 0;
  padding-right: calc(var(--spacing) * 5);
}

/* ─── ResourceListComponent ─── */

/*
 * .component-resource-list-pagination
 * Wrapper for the pagination component below a resource list.
 * Adds top margin to separate from the items.
 *
 * Used by: app/components/resource_list_component.html.erb (paginated? branch)
 * Reuse when: rendering pagination below resource list items.
 * Do NOT use for: standalone pagination outside a resource list.
 */
.component-resource-list-pagination {
  margin-top: calc(var(--spacing) * 4);
}

/*
 * .component-resource-list-panel — panel variant of a resource list (opt in via
 *   ResourceListComponent panel: true). One bordered card holds flat,
 *   hairline-divided rows and an in-panel footer, replacing the default
 *   floating-card-per-row list. Mirrors the audiences/vault list panel.
 * .component-resource-list-panel-footer — wraps the pagination as a flush footer.
 *
 * Used by: app/components/resource_list_component.html.erb (panel? branch)
 */
.component-resource-list-panel {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
}

/* In panel mode each item is a flat hairline row, not a floating card. */
.component-resource-list-panel .component-resource-list-item {
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--transition-timing-standard);
}

.component-resource-list-panel .component-resource-list-item:has(a:hover) {
  box-shadow: none;
  border-color: var(--color-border-themed);
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-hover);
}

.component-resource-list-panel .component-resource-list-item-link,
.component-resource-list-panel .component-resource-list-item-link-full {
  border-radius: 0;
}

/* Round the panel's leading/trailing edges through its first/last children. */
.component-resource-list-panel > .component-resource-list-item:first-child {
  border-top-left-radius: var(--radius-2xl);
  border-top-right-radius: var(--radius-2xl);
}

.component-resource-list-panel > .component-resource-list-item:last-child {
  border-bottom: none;
  border-bottom-left-radius: var(--radius-2xl);
  border-bottom-right-radius: var(--radius-2xl);
}

/* Pagination reads as a flush footer; the last row's hairline is its top edge. */
.component-resource-list-panel-footer .component-pagination {
  background: transparent;
  border: none;
  border-radius: 0;
}

/*
 * .component-resource-list-search-controls
 * Flex row that lays out the search wrapper and the optional
 * "all / mine" scope pills side-by-side. Carries the bottom margin
 * that separates the controls from the list content below.
 *
 * Used by: app/components/resource_list_component.html.erb (searchable? branch)
 * Reuse when: rendering the search row of a ResourceListComponent.
 * Do NOT use for: standalone search inputs (build a dedicated component).
 */
.component-resource-list-search-controls {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-resource-list-search-wrapper
 * Relative-positioned container for the search input and its icons.
 * Stretches to fill the remaining width inside the controls row.
 *
 * Used by: app/components/resource_list_component.html.erb (searchable? branch)
 * Reuse when: rendering the search input of a ResourceListComponent.
 * Do NOT use for: standalone search inputs (build a dedicated component).
 */
.component-resource-list-search-wrapper {
  position: relative;
  flex: 1;
}

/*
 * .component-resource-list-search-input
 * Themed search text input. Full width, padded to accommodate left
 * magnifying-glass icon and right clear button, rounded, themed
 * background and border.
 *
 * Used by: app/components/resource_list_component.html.erb (search input)
 * Reuse when: rendering the search field of a ResourceListComponent.
 * Do NOT use for: form text inputs (use .component-form-field).
 */
.component-resource-list-search-input {
  width: 100%;
  padding: var(--field-padding-block) var(--search-padding-inline);
  border-radius: var(--radius-lg);
  font-size: max(var(--font-size-sm), var(--field-font-floor));
  outline: none;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  color: var(--color-text-body);
}

.component-resource-list-search-input::placeholder {
  color: var(--color-text-muted);
}

/*
 * .component-resource-list-search-icon
 * Absolute-positioned magnifying-glass icon inside the search wrapper.
 * Vertically centered on the left side of the input.
 *
 * Used by: app/components/resource_list_component.html.erb (search icon)
 * Reuse when: rendering the search icon of a ResourceListComponent.
 * Do NOT use for: icons outside the resource list search context.
 */
.component-resource-list-search-icon {
  position: absolute;
  left: calc(var(--spacing) * 4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
}

/*
 * .component-resource-list-search-clear
 * Absolute-positioned clear (xmark) link inside the search wrapper.
 * Vertically centered on the right side. Muted color with hover
 * transition to heading color.
 *
 * Used by: app/components/resource_list_component.html.erb (clear link, value present)
 * Reuse when: rendering the clear button of a ResourceListComponent search.
 * Do NOT use for: close buttons or dismiss actions outside resource list search.
 */
.component-resource-list-search-clear {
  position: absolute;
  right: calc(var(--spacing) * 4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  transition: color var(--transition-timing-standard);
  display: flex;
  align-items: center;
}

.component-resource-list-search-clear:hover {
  color: var(--color-text-heading);
}

/*
 * .component-resource-list-scope-pills
 * Segmented pill track holding the "all / mine" toggle buttons. Sits to
 * the right of the search wrapper. Acts as a single rounded-full track on
 * the elevated surface; the active button slides up onto a white surface
 * with a hairline shadow while the inactive button stays transparent.
 *
 * Used by: app/components/resource_list_component.html.erb (user_filter present)
 * Reuse when: rendering scope pills inside a ResourceListComponent search row.
 * Do NOT use for: scope pills outside a resource list; create a domain class
 *   for the owning surface instead.
 */
.component-resource-list-scope-pills {
  display: flex;
  flex-shrink: 0;
  gap: calc(var(--spacing) * 1);
  padding: calc(var(--spacing) * 1);
  background: var(--color-surface-elevated);
  border-radius: var(--radius-pill);
}

/*
 * .component-resource-list-pill
 * Inactive segment of the scope toggle track. Transparent fill, muted text;
 * hover lifts the text color toward heading without changing background.
 *
 * Used by: app/components/resource_list_component.html.erb (scope pill button)
 * Reuse when: rendering scope pills inside a ResourceListComponent search row.
 * Do NOT use for: pills outside a resource list (build a domain class).
 */
.component-resource-list-pill {
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 500;
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 4);
  transition:
    background var(--motion-fast),
    color var(--motion-fast),
    box-shadow var(--motion-fast);
}

.component-resource-list-pill:hover {
  color: var(--color-text-heading);
}

/*
 * .component-resource-list-pill-active
 * Active segment of the scope toggle track. White surface, heading text,
 * hairline shadow — reads as the selected option.
 *
 * Used by: app/components/resource_list_component.html.erb (active pill)
 * Reuse when: marking the currently selected scope pill.
 * Do NOT use for: standalone buttons (use a button variant).
 */
.component-resource-list-pill-active,
.component-resource-list-pill-active:hover {
  background: var(--color-surface-primary);
  color: var(--color-text-heading);
  box-shadow: var(--shadow-sm);
}

/* ─── ClientUploads::StatusComponent ─── */

/*
 * .component-client-upload-status
 * Inline status indicator for a client upload row. Shows a spinner
 * (waiting) or check (complete) icon followed by the status name.
 *
 * Used by: app/components/client_uploads/status_component.html.erb
 * Reuse when: rendering a client upload's current processing state.
 * Do NOT use for: generic file upload status elsewhere.
 */
.component-client-upload-status {
  display: inline-flex;
  align-items: center;
  line-height: 1.25rem;
}

/*
 * .component-client-upload-status-icon
 * Base sizing for the status icon (spinner or check) in the indicator.
 *
 * Used by: app/components/client_uploads/status_component.html.erb
 * Reuse when: sizing the icon inside a client upload status row.
 * Do NOT use for: icons outside this component.
 */
.component-client-upload-status-icon {
  width: 1rem;
  height: 1rem;
  margin-right: calc(var(--spacing) * 4);
}

/*
 * .component-client-upload-status-icon-waiting
 * Color modifier for the spinner icon while the upload is processing.
 *
 * Used by: app/components/client_uploads/status_component.html.erb
 * Reuse when: styling an in-progress upload's spinner icon.
 * Do NOT use for: non-upload spinners.
 */
.component-client-upload-status-icon-waiting {
  color: var(--color-text-muted);
}

/*
 * .component-client-upload-status-icon-complete
 * Color modifier for the check icon once the upload finishes.
 *
 * Used by: app/components/client_uploads/status_component.html.erb
 * Reuse when: styling a completed upload's check icon.
 * Do NOT use for: non-upload check marks.
 */
.component-client-upload-status-icon-complete {
  color: var(--color-text-success);
}

/*
 * .component-client-upload-status-count
 * Muted parenthetical file count trailing the status name once the
 * client has sent at least one file.
 *
 * Used by: app/components/client_uploads/status_component.html.erb
 * Reuse when: annotating a client upload status with its file count.
 * Do NOT use for: counts elsewhere — use a badge instead.
 */
.component-client-upload-status-count {
  margin-left: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ─── PurchaseOrders::CardComponent ─── */

/*
 * .component-purchase-order-completion
 * The completion page's two-column frame: the delivery form takes two thirds
 * of the width and the read-only reference rail takes the remaining third,
 * both starting at the same top edge so the form and the first rail card share
 * a line. Below 40rem there is no room for a rail beside a form, so the two
 * columns become one and every card runs the full width.
 *
 * Used by: app/views/core/purchase_order_completions/new.html.erb
 * Reuse when: a page pairs one working form with a narrower reference rail.
 * Do NOT use for: equal-weight column pairs (use .grid-2) or columns that
 * should reflow on their own content width (use .grid-auto).
 */
.component-purchase-order-completion {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;
  gap: calc(var(--spacing) * 4);
}

@media (max-width: 40rem) {
  .component-purchase-order-completion {
    grid-template-columns: minmax(0, 1fr);
  }
}

/*
 * .component-purchase-order-completion-rail
 * The reference column of that frame. The shared detail row reserves 13rem for
 * its label, which is most of a third-width column and leaves order numbers and
 * product names wrapping a word per line; in the rail the label takes only the
 * width its own words need and the value keeps the rest.
 *
 * Used by: app/views/core/purchase_order_completions/new.html.erb
 * Reuse when: DetailComponent rows sit in a narrow reference column.
 */
.component-purchase-order-completion-rail .component-detail-name {
  width: auto;
  min-width: 0;
  padding-right: calc(var(--spacing) * 4);
}

/* ─── Orders::SanFormComponent ─── */

/*
 * .component-san-form-dnc-title
 * Heading over the Do Not Call certification at the top of the SAN
 * form. Card-title scale, because it opens a block the client has to
 * read before signing rather than labelling a single field.
 *
 * Used by: app/components/orders/san_form_component.html.erb
 * Reuse when: labeling the DNC registry block.
 * Do NOT use for: other form headings — Forms::LabelComponent names fields.
 */
.component-san-form-dnc-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-san-form-dnc-text
 * The National "Do Not Call" Registry certification, set in the app's own
 * type on the app's own inset surface (it used to be an iframe of
 * paymentgiant.com, which rendered blank and carried none of the theme).
 * Legal prose read in place rather than skimmed, so it is a scroll region
 * with a bounded height instead of pushing the signature off the page —
 * focusable, and named by the region role, so a keyboard can scroll it.
 *
 * Used by: app/views/orders/_dnc_compliance.html.erb
 * Reuse when: the DNC certification block only.
 * Do NOT use for: general long-form copy — that is .prose.
 */
.component-san-form-dnc-text {
  max-height: 18rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(var(--spacing) * 4);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
  background: var(--color-surface-elevated);
  color: var(--color-text-body);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.component-san-form-dnc-text > p + p {
  margin-top: calc(var(--spacing) * 2);
}

.component-san-form-dnc-text strong {
  color: var(--color-text-heading);
}

.component-san-form-dnc-text:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/*
 * .component-san-form-dnc-rule
 * The certification's own divider, between the explanation and the
 * clauses being certified. A hairline, like every other divider.
 *
 * Used by: app/views/orders/_dnc_compliance.html.erb
 */
.component-san-form-dnc-rule {
  margin-block: calc(var(--spacing) * 4);
  border: 0;
  border-top: 1px solid var(--color-border-themed);
}

/*
 * .component-san-form-san-fieldset / -legend / -san-parts / -san-part /
 * -san-separator
 * The subscription account number: one number the registry issues in three
 * parts, grouped as a fieldset so it is named once rather than as three
 * fields. The separators are the hyphens of the printed number, so they are
 * aria-hidden and drawn as a rule rather than typed as text.
 *
 * Used by: app/components/orders/san_form_component.html.erb
 * Reuse when: the SAN group only.
 * Do NOT use for: any other segmented input.
 */
.component-san-form-san-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.component-san-form-legend {
  padding: 0;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-body);
}

.component-san-form-san-parts {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

/* Each box is sized to the digits it holds (8, 6, 2) rather than sharing the
 * row equally, so the group reads as the printed number's shape and a box
 * says how much goes in it before anything is typed. The bases shrink together
 * on a narrow panel, in proportion, because flex-shrink weighs each by its
 * basis. The separators are spans, so :nth-of-type counts only the boxes. */
.component-san-form-san-parts > div {
  min-width: 0;
}

.component-san-form-san-parts > div:nth-of-type(1) {
  flex: 0 1 9rem;
}

.component-san-form-san-parts > div:nth-of-type(2) {
  flex: 0 1 7rem;
}

.component-san-form-san-parts > div:nth-of-type(3) {
  flex: 0 1 4rem;
}

.component-san-form-san-separator {
  flex: none;
  width: calc(var(--spacing) * 2);
  height: 0.0625rem;
  background: var(--color-border-strong);
}

/*
 * .component-san-form-row
 * Two paired fields side by side, stacking on a phone where neither half
 * has room for its label and its control.
 *
 * Used by: app/components/orders/san_form_component.html.erb
 * Reuse when: pairing two fields side-by-side in the SAN form.
 * Do NOT use for: other two-column layouts — .switcher covers those.
 */
.component-san-form-row {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 6);
}

.component-san-form-row > div {
  flex: 1 1 0;
  min-width: 0;
}

/*
 * .component-san-form-field-input
 * The SAN expiration date control. A date input sizes itself to the
 * browser's own picker and would otherwise sit narrower than the text
 * field beside it.
 *
 * Used by: app/components/orders/san_form_component.html.erb
 */
.component-san-form-field-input {
  width: 100%;
}

/*
 * .component-san-form-exempt (+ -text / -title)
 * The exemption: the box, then what ticking it means. Top-aligned, with
 * the box set against the first line the way the terms acceptance sets
 * its box (.orders-approve-consent), because the sentence wraps and the
 * box belongs beside its first line. Both are the same 20px
 * .component-checkbox-input, held at that size so the long sentence
 * beside it cannot squeeze it narrower.
 *
 * Used by: app/components/orders/san_form_component.html.erb
 */
.component-san-form-exempt {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 2);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.component-san-form-exempt .component-checkbox-input {
  flex: none;
  margin-block-start: calc((1lh - 1.25rem) / 2);
}

.component-san-form-exempt-text {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1);
  min-width: 0;
  color: var(--color-text-body);
}

.component-san-form-exempt-title {
  font-weight: 600;
  color: var(--color-text-heading);
}

@media (width <= 40rem) {
  .component-san-form-row {
    flex-direction: column;
    gap: calc(var(--spacing) * 4);
  }

  .component-san-form-row > div {
    width: 100%;
  }
}

/* ─── Invoices::CheckNumberComponent / Invoices::SampleCheckComponent ─── */

/*
 * .component-invoice-check-number
 * Square neutral marker carrying the position number of a field on a paper
 * check. Rendered both on the sample-check illustration and beside the form
 * field it names. Gray rather than a warm hue: the marker is a key, not a
 * warning, and orange read as "something is wrong with this field".
 *
 * The recipe is the badge's: the element carries `.component-badge
 * .badge-gray`, so the tint, hairline, ink, radius and type all come from the
 * badge tokens and flip with the theme on their own. This rule only states what
 * makes the marker not a badge — a square whose width is fixed so 1 and 8 sit
 * at the same size, with the digit centred and tabular so a column of markers
 * aligns.
 *
 * Used by: app/components/invoices/check_number_component.html.erb
 * Reuse when: numbering a field on the pay-by-check form or its illustration.
 * Do NOT use for: generic badges or pills elsewhere — render BadgeComponent.
 */
.component-invoice-check-number {
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  padding: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/*
 * .component-invoice-check-number-label
 * Section name following a marker in a form heading (e.g. "2 Bank
 * information"). Takes the heading's own type; the marker supplies the colour.
 *
 * Used by: app/components/invoices/check_number_component.html.erb
 * Reuse when: labeling a check-number marker with its section name.
 * Do NOT use for: standalone labels.
 */
.component-invoice-check-number-label {
  min-width: 0;
}

/*
 * .component-invoice-sample-check (+ -figure, -row, -block, -label, -value,
 * -line, -amount, -micr, -micr-field, -caption)
 * Drawn illustration of a paper check, keyed with the same numbered markers the
 * form uses. It is a real element rather than an image so it reads at any width,
 * carries selectable text, and re-colours itself in both themes.
 *
 * The figure is a hairline-bordered surface; each field zone pairs its marker
 * with a sample value, and the MICR line at the foot sets its numbers in the
 * mono face because that is how they are printed on the check.
 *
 * Used by: app/components/invoices/sample_check_component.html.erb
 * Reuse when: showing a client where a value sits on their own check.
 * Do NOT use for: any other diagram — draw that one for its own subject.
 */
.component-invoice-sample-check {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 4);
}

.component-invoice-sample-check-figure {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-primary);
}

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

.component-invoice-sample-check-block {
  display: flex;
  align-items: baseline;
  gap: calc(var(--spacing) * 2);
  min-width: 0;
}

/* The printed lines a real check carries under its name and bank blocks, drawn
 * as short bars so the illustration reads as a check rather than a list of
 * labels. Decorative; hidden from assistive tech in the markup. */
.component-invoice-sample-check-stack {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1);
  min-width: 0;
}

.component-invoice-sample-check-bar {
  display: block;
  width: 9rem;
  max-width: 100%;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--color-border-subtle);
}

.component-invoice-sample-check-bar-short {
  width: 6rem;
}

/* The memo and signature lines above the MICR strip: two ruled lines, the
 * second standing in for the signature. */
.component-invoice-sample-check-signature {
  align-items: flex-end;
  margin-top: calc(var(--spacing) * 2);
}

.component-invoice-sample-check-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-invoice-sample-check-value {
  font-size: var(--font-size-sm);
  color: var(--color-text-heading);
}

.component-invoice-sample-check-line {
  flex: 1;
  min-width: 6rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-invoice-sample-check-amount {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.component-invoice-sample-check-micr {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 4);
  padding-top: calc(var(--spacing) * 4);
  border-top: 1px solid var(--color-border-subtle);
}

.component-invoice-sample-check-micr-field {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
}

.component-invoice-sample-check-caption {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/*
 * .component-table
 * Outer shell of the Tables::TableComponent — bordered rounded
 * container that holds the filter hint, horizontal scroll region,
 * and tbody. Replaces the per-table Tailwind cluster
 * `border border-border-themed rounded-xl overflow-hidden
 * bg-surface-primary`.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: rendering any data table through Tables::TableComponent.
 * Do NOT use for: standalone tables outside the ViewComponent.
 */
.component-table {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  /* Clips the rows, the scroll region, and its scrollbar to the radius, so a
     table that scrolls sideways still ends in the card's own corners. */
  overflow: hidden;
  position: relative;
}

/*
 * .component-table-tabs
 * The card's top band, holding the tab strip that chooses which records the
 * table is drawn from. Sits on the card's own surface under a hairline, the
 * same treatment .admin-table-toolbar gives the admin tables' top band, so the
 * question and the rows answering it read as one object.
 *
 * The horizontal padding is the cell padding, so the strip starts on the same
 * line the first column's text does.
 *
 * Used by: app/components/tables/table_component.html.erb (the `tabs` slot)
 * Reuse when: a Tables::TableComponent is rendered with a tabs slot.
 * Do NOT use for: page-level section navigation — that belongs above the card.
 */
.component-table-tabs {
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
  border-bottom: 1px solid var(--color-border-row);
}

/*
 * .component-table-toolbar
 * The card's control band: the search and the filters that narrow whatever the
 * tabs above chose. Same inset and hairline as the tabs band, so a card
 * carrying both reads as one stack rather than as two kinds of chrome.
 *
 * Used by: app/components/tables/table_component.html.erb (the `toolbar` slot)
 * Reuse when: a Tables::TableComponent is rendered with a toolbar slot.
 * Do NOT use for: page action rows — use .cluster.
 */
.component-table-toolbar {
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
  border-bottom: 1px solid var(--color-border-row);
}

/*
 * .component-table-filter-hint
 * Banner shown above filterable tables prompting the user to type
 * to filter. Appears only when `@filterable` is true.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: a Tables::TableComponent renders in filterable mode.
 * Do NOT use for: other inline hint banners.
 */
.component-table-filter-hint {
  background: var(--color-surface-quick-action);
  color: var(--color-text-body);
  padding: calc(var(--spacing) * 6) calc(var(--spacing) * 8) calc(var(--spacing) * 4);
}

/*
 * .component-table-filter-kbd
 * Inline monospace keycap rendered inside .component-table-filter-hint
 * to indicate the Enter shortcut.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: showing a keyboard key inside the filter hint banner.
 * Do NOT use for: general keyboard key rendering (use a primitive).
 */
.component-table-filter-kbd {
  background: var(--color-surface-elevated);
  color: var(--color-text-body);
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: var(--font-size-xs);
  font-weight: 600;
  margin-left: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 1);
}

/*
 * .component-table-scroll
 * Horizontal scroll region around the <table> element so wide
 * tables scroll without breaking the rounded outer shell. Owns the card's
 * bottom breathing room; the fade that says the table runs on past an edge
 * belongs to the .component-scroll-affordance wrapper around it, because an
 * overlay hung off a scroll container scrolls away with the content.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: wrapping a Tables::TableComponent's inner <table>.
 * Do NOT use for: other scroll containers — see .component-scroll-affordance
 * below for any other horizontally-scrolling element.
 */
.component-table-scroll {
  min-width: 100%;
  overflow-x: auto;
  /* A square last row against a 16px radius has its own corners cut away and
     its text sitting on the border, so a strip of surface follows the rows for
     the curve to be drawn in. It belongs to the scroll region rather than the
     shell: the horizontal scrollbar is drawn below this padding, which puts
     the track on the card's bottom edge instead of floating above a strip of
     surface. */
  padding-bottom: calc(var(--spacing) * 2);
}

/*
 * .component-scroll-affordance
 * Shared edge-fade affordance for any element that scrolls, across the line or
 * down the page. This is the wrapper, not the scroller: it holds the ::before /
 * ::after overlays and never scrolls itself, so the fades stay pinned to the
 * visible edges no matter how far the content inside has moved. An overlay hung
 * off the scroll container is laid out against that container's padding box at
 * scroll origin and translates with the content, which put the hint out of view
 * the moment the container was actually scrolled.
 *
 * The scroll-affordance Stimulus controller stays on the scrolling child
 * (data-controller="scroll-affordance") and keeps data-scroll-start /
 * data-scroll-end and data-scroll-top / data-scroll-bottom current there as it
 * scrolls or resizes; the wrapper reads that state through :has(), so the fade
 * on each edge shows only while its attribute is "true", a container that fits
 * its content never shows a hint, and nothing is measured in CSS.
 * pointer-events: none keeps the overlays from intercepting clicks on the
 * content — including sortable table headers, whose sticky positioning is
 * unaffected because the wrapper sits outside their scroll container rather
 * than between them and it.
 *
 * Used by: app/components/tables/table_component.html.erb (.component-table-scroll),
 *          app/components/tab_bar_component.html.erb (.component-tab-bar),
 *          app/views/direct_mail/campaign_zip_selections/_store_section.html.erb
 *          (.direct-mail-campaign-zip-rows),
 *          app/views/direct_mail/campaign_zip_selections/_version_rail.html.erb
 *          and _totals.html.erb (vertical),
 *          app/components/client_dashboard/portal/activity_feed_component.html.erb
 *          (.client-dashboard-portal-timeline-scroll, vertical)
 * Reuse when: marking up a new scrolling container on either axis — wrap the
 * scroller in this class and pair the scroller itself with
 * data-controller="scroll-affordance". No selector here has to learn the new
 * host's class name.
 * Do NOT use for: elements without the scroll-affordance controller wired up;
 * the fade never activates without JS setting the data attributes.
 */
.component-scroll-affordance {
  position: relative;
  /* Wide enough that the decay reads as light falling off the edge even on a
     narrow (390px) viewport — anything under ~1.5rem disappears into the
     surface at that width — short enough that it never becomes a band the eye
     counts as a column. */
  --scroll-affordance-reach: calc(var(--spacing) * 7);
  /* The ink the shadow scale is drawn in — the palette's near-black — at the
     alpha it takes to read against the surface it is drawn on. It was set a hair
     above the card shadow's own alpha, but that shadow is cast onto the page
     rather than drawn across a white card: at 7% the fade over a table's own
     surface was invisible, so a table running on past its right edge gave no
     sign that it did. Twelve percent over white lands on the same value the
     themed hairline border computes to, which is the ceiling here — darker than
     the rule the card is drawn with and the fade starts reading as a column of
     its own rather than as depth. Then most of the way to nothing by the first
     third of the reach: two stops of decay rather than a linear ramp, because
     ambient light thins fastest where it leaves the surface. */
  --scroll-affordance-near: color-mix(in srgb, var(--color-gray-1100) 12%, transparent);
  --scroll-affordance-far: color-mix(in srgb, var(--color-gray-1100) 4%, transparent);
}

/*
 * .component-scroll-affordance-inline
 * The wrapper around a scroller that sizes to its own content rather than to
 * the line — the tab bar's inline-flex pill track. A block wrapper would run
 * the full width and put the trailing fade at the page edge instead of at the
 * track's.
 *
 * Used by: app/components/tab_bar_component.html.erb
 * Reuse when: the wrapped scroller is an inline-level box.
 * Do NOT use for: block scrollers — .component-scroll-affordance alone.
 */
.component-scroll-affordance-inline {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.component-scroll-affordance::before,
.component-scroll-affordance::after {
  bottom: 0;
  content: "";
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  transition: opacity var(--motion-fast);
  width: var(--scroll-affordance-reach);
  z-index: 6;
}

.component-scroll-affordance::before {
  left: 0;
  background: linear-gradient(
    to right,
    var(--scroll-affordance-near) 0%,
    var(--scroll-affordance-far) 35%,
    transparent 100%
  );
}

.component-scroll-affordance::after {
  right: 0;
  background: linear-gradient(
    to left,
    var(--scroll-affordance-near) 0%,
    var(--scroll-affordance-far) 35%,
    transparent 100%
  );
}

.component-scroll-affordance:has(> [data-scroll-start="true"])::before {
  opacity: 1;
}

.component-scroll-affordance:has(> [data-scroll-end="true"])::after {
  opacity: 1;
}

/* The same two overlays, turned through ninety degrees for a scroller that runs
   down the page instead of across it — the ZIP editor's version rail and its
   per-version totals, whose rows are `white-space: nowrap` and never overflow
   the line. Everything else is shared: the reach, the two-stop decay, and the
   dark-theme alphas below all belong to the wrapper.

   Scoped to a scroller reporting no horizontal overflow, which is what makes
   this a pure addition. There are only two pseudo-elements on the wrapper, so a
   container that overflowed both ways would have to choose; this hands them to
   the horizontal fade whenever it has anything to say, and takes them only when
   it does not. An element with no vertical overflow reports false on both edges
   and shows nothing either way. */
.component-scroll-affordance:has(> [data-scroll-start="false"][data-scroll-end="false"])::before,
.component-scroll-affordance:has(> [data-scroll-start="false"][data-scroll-end="false"])::after {
  left: 0;
  right: 0;
  width: auto;
  height: var(--scroll-affordance-reach);
}

.component-scroll-affordance:has(> [data-scroll-start="false"][data-scroll-end="false"])::before {
  bottom: auto;
  background: linear-gradient(
    to bottom,
    var(--scroll-affordance-near) 0%,
    var(--scroll-affordance-far) 35%,
    transparent 100%
  );
}

.component-scroll-affordance:has(> [data-scroll-start="false"][data-scroll-end="false"])::after {
  top: auto;
  background: linear-gradient(
    to top,
    var(--scroll-affordance-near) 0%,
    var(--scroll-affordance-far) 35%,
    transparent 100%
  );
}

.component-scroll-affordance:has(> [data-scroll-start="false"][data-scroll-end="false"][data-scroll-top="true"])::before {
  opacity: 1;
}

.component-scroll-affordance:has(> [data-scroll-start="false"][data-scroll-end="false"][data-scroll-bottom="true"])::after {
  opacity: 1;
}

/* Dark carries depth in its borders and lets shadows fall to a whisper, and
 * the near-black ink sits only a few steps under the card surface here, so the
 * light theme's alpha would land invisible. The hint keeps the same reach as
 * light — the width has to read at 390px in either theme — with a stronger
 * first stop: legible at the edge you are scrolling, silent everywhere else. */
[data-theme="dark"] .component-scroll-affordance {
  --scroll-affordance-near: color-mix(in srgb, var(--color-gray-1100) 50%, transparent);
  --scroll-affordance-far: color-mix(in srgb, var(--color-gray-1100) 14%, transparent);
}

/*
 * .component-table-element
 * Styles the actual <table> tag rendered by Tables::TableComponent.
 * Fixed layout + full width so column widths are controlled via
 * explicit cell classes rather than content.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: rendering a Tables::TableComponent <table>.
 * Do NOT use for: other HTML tables.
 */
.component-table-element {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

/* On phones the fixed/100%-width table can't exceed the wrapper, so equal
 * ~73px columns crush and overlap their text. Let columns size to content
 * and the table grow past the viewport so .component-table-scroll actually
 * scrolls horizontally: the column clipped at the card's edge is what says
 * there is more table to the side. */
@media (max-width: 40rem) {
  .component-table-element {
    table-layout: auto;
    width: auto;
    min-width: 100%;
  }
}

/*
 * .component-table-element-filterable
 * Modifier applied to the <table> element when the filter banner
 * is shown, removing the top border so the banner and table read
 * as one block.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: the Tables::TableComponent is rendered with `filterable: true`.
 * Do NOT use for: other border-top overrides.
 */
.component-table-element-filterable {
  border-top: 0;
}

/*
 * .component-table-element-flush-columns
 * Modifier applied to the <table> element when the component is rendered with
 * `column_dividers: false`. Drops the vertical rules between columns; the row
 * hairlines stay, because those are what separate one record from the next.
 *
 * Used by: app/components/tables/table_component.html.erb (via column_dividers:)
 * Reuse when: the columns hold unrelated attributes rather than one repeated
 *   measure, so a drawn grid adds weight without adding meaning.
 * Do NOT use for: hiding the row dividers.
 */
.component-table-element-flush-columns .component-table-head-row > * + *,
.component-table-element-flush-columns .component-table-row > * + * {
  border-left: 0;
}

/*
 * .component-table-head-row
 * The <tr> inside <thead>. Adds the vertical divider between
 * header cells that the old Tailwind `divide-x` produced.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: rendering the header row of a Tables::TableComponent.
 * Do NOT use for: body rows (see .component-table-row).
 */
.component-table-head-row > * + * {
  border-left: 1px solid var(--color-border-themed);
}

/*
 * .component-table-body
 * <tbody> element. Adds the horizontal divider between body rows
 * that the old Tailwind `divide-y` produced.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: rendering the body of a Tables::TableComponent.
 * Do NOT use for: other <tbody> elements.
 */
.component-table-body > * + * {
  border-top: 1px solid var(--color-border-themed);
}

/*
 * .component-table-pagination
 * Spacing wrapper below a Tables::TableComponent that renders
 * PaginationComponent. Replaces the ad-hoc `mt-4` Tailwind class.
 *
 * Used by: app/components/tables/table_component.html.erb
 * Reuse when: spacing a pagination element after a data table.
 * Do NOT use for: other pagination wrappers.
 */
.component-table-pagination {
  margin-top: calc(var(--spacing) * 4);
}

/*
 * .component-table-row
 * Body row inside a Tables::TableComponent. Provides the vertical
 * dividers between cells that the old Tailwind `divide-x
 * divide-border-themed` produced. Hover state is composed via
 * .interactive-surface at the markup level.
 *
 * Used by: app/components/tables/row_component.html.erb
 * Reuse when: rendering a body row of a Tables::TableComponent.
 * Do NOT use for: header rows (see .component-table-head-row).
 */
.component-table-row > * + * {
  border-left: 1px solid var(--color-border-themed);
}

/*
 * .component-table-cell-outer
 * The <td> element itself. Zero padding so the inner link or div
 * can fill the entire cell and become the click target.
 *
 * Used by: app/components/tables/cell_component.html.erb
 * Reuse when: rendering a Tables::CellComponent.
 * Do NOT use for: other table cells.
 */
.component-table-cell-outer {
  color: var(--color-text-body);
  font-size: var(--font-size-sm);
  height: 0;
  padding: 0;
}

/*
 * .component-table-cell-link
 * Fills the entire Tables::CellComponent <td> with an anchor so
 * the whole cell is clickable. Applied when @url is present.
 *
 * Used by: app/components/tables/cell_component.html.erb
 * Reuse when: a table cell should link somewhere.
 * Do NOT use for: inline link targets in other cells.
 */
.component-table-cell-link {
  /* Centers against a taller sibling cell (a button, a badge stack) without
     switching to flex, which would break the truncate ellipsis on cells that
     carry it. When every cell is text-height this resolves to no movement. */
  align-content: center;
  display: block;
  height: 100%;
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
  width: 100%;
}

/*
 * .component-table-cell-inner
 * Padded content block inside a Tables::CellComponent when the
 * cell has no link target.
 *
 * Used by: app/components/tables/cell_component.html.erb
 * Reuse when: a non-linking table cell needs standard padding.
 * Do NOT use for: cells that use .component-table-cell-link.
 */
.component-table-cell-inner {
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
}

/*
 * .component-table-header-cell
 * Base <th> styling for Tables::HeaderCellComponent. Sticky top,
 * quick-action background, small uppercase type, with a 1rem/16
 * inset bottom shadow acting as the header separator (previously
 * the `header-cell-border` custom utility).
 *
 * Used by: app/components/tables/header_cell_component.html.erb
 * Reuse when: rendering a Tables::HeaderCellComponent.
 * Do NOT use for: other <th> elements.
 */
.component-table-header-cell {
  background: var(--color-surface-quick-action);
  box-shadow: inset 0 -0.0625rem 0 var(--color-border-themed);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1rem;
  position: sticky;
  text-align: left;
  top: 0;
  z-index: 5;
}

/*
 * .component-table-header-cell-sortable
 * Modifier applied to Tables::HeaderCellComponent when the column
 * is sortable. Adds the hover state and pointer cursor that
 * signal clickability.
 *
 * Used by: app/components/tables/header_cell_component.html.erb
 * Reuse when: a table header column participates in sort.
 * Do NOT use for: other hover states.
 */
.component-table-header-cell-sortable {
  cursor: pointer;
  /* A floor, not a cap — the row still sizes itself to its tallest header. It
   * is declared so the button below can resolve `height: 100%` and cover the
   * whole cell, the way .component-table-cell-outer does for body cells. */
  height: 0;
}

.component-table-header-cell-sortable:hover {
  background: var(--color-surface-elevated);
}

/*
 * .component-table-header-cell-button
 * The sort control inside a sortable <th>. A real button, so the column keeps
 * its columnheader role and the keyboard gets Enter/Space for free; stripped
 * back to nothing so the header looks exactly like a non-sortable one. It
 * fills the cell because the whole header is the hit area.
 *
 * Used by: app/components/tables/header_cell_component.html.erb
 * Reuse when: rendering the sort control of a Tables::HeaderCellComponent.
 * Do NOT use for: link-shaped sort controls — those use
 * .component-table-sort-link.
 */
.component-table-header-cell-button {
  align-items: center;
  appearance: none;
  background: none;
  border: 0;
  color: inherit;
  cursor: inherit;
  display: flex;
  font: inherit;
  height: 100%;
  letter-spacing: inherit;
  padding: 0;
  text-align: inherit;
  width: 100%;
}

/* Centred rather than top-aligned, so a label in a full-height button sits on
 * the same baseline as one in a non-sortable cell, which the table centres. */
.component-table-header-cell-button .component-table-header-cell-content {
  flex: 1 1 auto;
  min-width: 0;
}

/* Focus doctrine: the shared ring on keyboard focus. Drawn inset because the
 * table shell clips overflow — an outer ring would be cut off on the first and
 * last columns. */
.component-table-header-cell-button:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

/*
 * .component-table-header-cell-content
 * Horizontal flex row inside a header cell: label on the left,
 * sort icon on the right.
 *
 * Used by: app/components/tables/header_cell_component.html.erb
 * Reuse when: arranging the label and sort icon in a header cell.
 * Do NOT use for: other header-cell internals.
 */
.component-table-header-cell-content {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
}

/* A right-aligned column (`align: :right` on Tables::HeaderCellComponent) puts
 * `.text-right` on the <th>, but the label sits inside this flex row, where
 * text-align has nothing to act on and space-between pins the label to the
 * cell's left edge — a heading a column-width away from the numbers it names.
 * Collapse the row to its end instead, with the label/sort-icon gap of the
 * link-based header so the icon stays beside its label rather than against it. */
.text-right .component-table-header-cell-content {
  gap: var(--spacing);
  justify-content: flex-end;
}

/*
 * .component-table-sort-icon
 * Fixed-size sort indicator rendered by Tables::HeaderCellComponent.
 * One of three icons (sort-up, sort-down, sort) is visible; the
 * others carry `.hidden`.
 *
 * Used by: app/components/tables/header_cell_component.html.erb
 * Reuse when: rendering a sort indicator inside a header cell.
 * Do NOT use for: other icons.
 */
.component-table-sort-icon {
  height: calc(var(--spacing) * 4);
  width: calc(var(--spacing) * 4);
}

/*
 * .component-table-sort-link
 * Header label rendered as a link by Tables::SortableHeaderCellComponent,
 * where clicking navigates to the same page with new sort query params.
 *
 * Used by: app/components/tables/sortable_header_cell_component.html.erb
 * Reuse when: a server-sorted table header needs a link-shaped sort control.
 * Do NOT use for: client-side sorting headers — those use
 * .component-table-header-cell-sortable with .component-table-sort-icon.
 */
.component-table-sort-link {
  align-items: center;
  color: inherit;
  display: inline-flex;
  gap: var(--spacing);
  text-decoration: none;
}

/*
 * .component-table-sort-caret
 * Fixed-size caret indicator shown on every link-based sortable header.
 * Active headers switch between caret-up and caret-down; inactive headers
 * keep a muted caret-down so clickability is visible before sorting.
 *
 * Used by: app/components/tables/sortable_header_cell_component.html.erb
 * Reuse when: only with .component-table-sort-link.
 * Do NOT use for: event-based sort indicators — those use
 * .component-table-sort-icon.
 */
.component-table-sort-caret {
  flex: 0 0 auto;
  height: calc(var(--spacing) * 3);
  width: calc(var(--spacing) * 3);
}

.component-table-sort-caret-muted {
  opacity: 0.5;
}

/*
 * .component-table-sort-link-active
 * Emphasizes the header link whose column the table is currently sorted by.
 *
 * Used by: app/components/tables/sortable_header_cell_component.html.erb
 * Reuse when: only with .component-table-sort-link.
 * Do NOT use for: unrelated active navigation or tab states.
 */
.component-table-sort-link-active {
  color: var(--color-text-heading);
}

/*
 * .component-table-cell-compact
 * Reduced vertical padding for table cells that need tighter rows.
 * Applied via the `compact: true` param on Tables::CellComponent.
 * Overrides the default padding on .component-table-cell-inner and
 * .component-table-cell-link.
 *
 * Used by: app/components/tables/cell_component.html.erb (via compact: param)
 * Reuse when: a table needs compact row spacing (e.g. audiences dashboard action column).
 * Do NOT use for: non-table spacing — use .stack-sm or reduce gap instead.
 */
.component-table-cell-compact {
  padding-top: calc(var(--spacing) * 1);
  padding-bottom: calc(var(--spacing) * 1);
}

/*
 * .component-table-details
 * Outer flex container of Tables::DetailsComponent — puts the
 * main table on the left and the side panel on the right. The
 * bottom offset class (passed via @bottom_offset) is layered on
 * top for variable page-bottom padding.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: rendering a two-pane table+details layout.
 * Do NOT use for: non-detail-pane layouts.
 */
.component-table-details {
  display: flex;
  height: 100%;
  position: relative;
}

/*
 * .component-table-details-main
 * Left pane containing the navigation, navigation actions, and
 * table slot.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: sizing the main pane of a Tables::DetailsComponent.
 * Do NOT use for: other flex layouts.
 */
.component-table-details-main {
  display: flex;
  flex: 2 1 0;
  flex-direction: column;
  height: 100%;
  padding: calc(var(--spacing) * 8);
  width: 50%;
}

/*
 * .component-table-details-nav
 * Navigation slot inset flush to the edges of the main pane. The
 * negative margins cancel out the main pane's padding.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: rendering the top navigation inside a Details layout.
 * Do NOT use for: other navigation wrappers.
 */
.component-table-details-nav {
  margin: calc(var(--spacing) * -8) calc(var(--spacing) * -8) calc(var(--spacing) * 6);
}

/*
 * .component-table-details-navigation-actions
 * Navigation-actions slot beneath the top nav, inside the main
 * pane.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: spacing navigation actions above the table slot.
 * Do NOT use for: other action-bar wrappers.
 */
.component-table-details-navigation-actions {
  margin-bottom: calc(var(--spacing) * 6);
}

/*
 * .component-table-details-panel
 * Fixed-width side panel on the right that holds the item-detail
 * turbo frame.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: rendering the detail panel of a Details layout.
 * Do NOT use for: other fixed-width side panels.
 */
.component-table-details-panel {
  height: 100%;
  max-width: 28rem;
  width: 100vw;
}

/*
 * .component-table-details-scroll
 * Scrollable wrapper inside the side panel that contains the
 * empty state and the loaded header/frame.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: scrolling the detail panel contents.
 * Do NOT use for: other scroll containers.
 */
.component-table-details-scroll {
  background: var(--color-surface-primary);
  border-left: 1px solid var(--color-border-themed);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding-bottom: calc(var(--spacing) * 6);
  padding-top: calc(var(--spacing) * 6);
  position: relative;
}

/*
 * .component-table-details-empty
 * Centered empty-state overlay shown inside the detail panel
 * until a row is selected. Absolutely positioned so it fills the
 * scroll container.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: rendering the "select an item" state of a Details panel.
 * Do NOT use for: general empty states (use EmptyStateComponent).
 */
.component-table-details-empty {
  align-items: center;
  color: var(--color-text-muted);
  height: 100%;
  justify-content: center;
  position: absolute;
  top: 0;
  width: 100%;
}

/*
 * .component-table-details-empty-label
 * "Select an item on the left" label inside the empty state.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: labeling the empty state of a Details panel.
 * Do NOT use for: other empty-state labels.
 */
.component-table-details-empty-label {
  font-size: var(--font-size-sm);
}

/*
 * .component-table-details-header
 * Wrapper shown inside the detail panel when a row has been
 * selected. Holds the title row and the turbo-frame wrapper.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: rendering the populated state of a Details panel.
 * Do NOT use for: other header wrappers.
 */
.component-table-details-header {
  padding-left: calc(var(--spacing) * 4);
  padding-right: calc(var(--spacing) * 4);
}

@media (min-width: 40rem) {
  .component-table-details-header {
    padding-left: calc(var(--spacing) * 6);
    padding-right: calc(var(--spacing) * 6);
  }
}

/*
 * .component-table-details-header-row
 * Top row inside a populated detail panel: icon + title on the
 * left, (optional) actions on the right.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: laying out the header row of a Details panel.
 * Do NOT use for: other header rows.
 */
.component-table-details-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}


/*
 * .component-table-details-header-icon
 * Accent-colored icon to the left of the detail title.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: rendering the title icon in a Details panel.
 * Do NOT use for: other icons.
 */
.component-table-details-header-icon {
  color: var(--color-accent);
  height: calc(var(--spacing) * 6);
  width: calc(var(--spacing) * 6);
}

/*
 * .component-table-details-title
 * <h2> element displaying the currently selected item's title.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: labeling the selected row in a Details panel.
 * Do NOT use for: other headings.
 */
.component-table-details-title {
  color: var(--color-text-heading);
  font-size: var(--font-size-base);
  font-weight: 600;
}

/*
 * .component-table-details-frame-wrapper
 * Relative wrapper around the turbo frame so the absolutely
 * positioned loading overlay can fill it.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: wrapping a loading-capable turbo frame.
 * Do NOT use for: other turbo frames.
 */
.component-table-details-frame-wrapper {
  flex: 1 1 0;
  margin-top: calc(var(--spacing) * 6);
  position: relative;
}

/*
 * .component-table-details-loading
 * Centered spinner overlay shown while the detail turbo frame
 * is loading. Absolutely positioned so it covers the frame.
 *
 * Used by: app/components/tables/details_component.html.erb
 * Reuse when: indicating loading state over a Details turbo frame.
 * Do NOT use for: other loading overlays.
 */
.component-table-details-loading {
  background: var(--color-surface-primary);
  color: var(--color-text-muted);
  display: flex;
  height: 100%;
  justify-content: center;
  opacity: 0.6;
  padding-top: calc(var(--spacing) * 20);
  position: absolute;
  width: 100%;
  z-index: 20;
}

/* ─── Visualization::Charts ─── */

/*
 * .component-visualization-charts-section-divider
 * Horizontal divider with a centered section heading used between
 * visualization sections on the charts page.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another page needs a section divider with overlaid
 * title.
 * Do NOT use for: solo headings.
 */
.component-visualization-charts-section-divider {
  align-items: center;
  border-top: 0.0625rem solid var(--color-black);
  display: flex;
  justify-content: center;
  margin-bottom: calc(var(--spacing) * 8);
  margin-top: calc(var(--spacing) * 24);
  position: relative;
  width: 100%;
}

/*
 * .component-visualization-charts-section-title
 * Centered title overlaid on the section divider — pulls up so
 * it straddles the rule.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another section divider needs an overlaid title.
 * Do NOT use for: inline titles.
 */
.component-visualization-charts-section-title {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-top: calc(var(--spacing) * -4);
  padding-left: calc(var(--spacing) * 4);
  padding-right: calc(var(--spacing) * 4);
}

/*
 * .component-visualization-charts-section-title-advanced
 * Variant applied when the advanced audience builder feature is
 * on — matches the page background tone.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another title needs the advanced-builder background.
 * Do NOT use for: default variants.
 */
.component-visualization-charts-section-title-advanced {
  background: var(--color-gray-100);
}

/*
 * .component-visualization-charts-section-title-default
 * Default variant background tone for the section title.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another title needs the default page background.
 * Do NOT use for: advanced variants.
 */
.component-visualization-charts-section-title-default {
  background: var(--color-gray-50);
}

/*
 * .component-visualization-charts-grid
 * Vertical stack of chart cards with divided between-row borders.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another page needs a divided vertical stack.
 * Do NOT use for: grid layouts.
 */
.component-visualization-charts-grid {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 8);
}

.component-visualization-charts-grid > .component-visualization-charts-card + .component-visualization-charts-card {
  border-top: 0.125rem solid var(--color-gray-100);
  padding-top: calc(var(--spacing) * 8);
}

/*
 * .component-visualization-charts-card
 * Single chart row with its table on the left and chart on the
 * right.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another chart row needs a side-by-side layout.
 * Do NOT use for: stacked layouts.
 */
.component-visualization-charts-card {
  display: flex;
  gap: calc(var(--spacing) * 8);
}

/*
 * .component-visualization-charts-card-table-wrapper
 * Left column holding the title and table.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another chart row needs a stacked table column.
 * Do NOT use for: standalone tables.
 */
.component-visualization-charts-card-table-wrapper {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
}

/*
 * .component-visualization-charts-card-table
 * Overflow-hidden wrapper around the data table so long rows
 * don't break the card width.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: other tables need an overflow-hidden wrapper.
 * Do NOT use for: overflowing tables.
 */
.component-visualization-charts-card-table {
  overflow: hidden;
}

/*
 * .component-visualization-charts-card-group-selected
 * Highlight border applied to a <tbody> row group that matches
 * the active filter.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another table needs a selected-group highlight.
 * Do NOT use for: individual rows.
 */
.component-visualization-charts-card-group-selected {
  border: 0.0625rem solid var(--color-yellow-orange);
}

/*
 * .component-visualization-charts-card-cell
 * Default cell padding inside the charts table.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another table needs matching padding.
 * Do NOT use for: header cells.
 */
.component-visualization-charts-card-cell {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
}

/*
 * .component-visualization-charts-card-cell-count
 * Right-aligned count cell variant inside the charts table.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another table needs a right-aligned count column.
 * Do NOT use for: left-aligned values.
 */
.component-visualization-charts-card-cell-count {
  padding-left: calc(var(--spacing) * 4);
  padding-right: calc(var(--spacing) * 2);
  text-align: right;
}

/*
 * .component-visualization-charts-card-chart
 * Right column of a chart row — rounded padded container holding
 * the pie chart.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: another row needs a padded chart container.
 * Do NOT use for: inline charts.
 */
.component-visualization-charts-card-chart {
  border-radius: var(--radius-lg);
  padding: calc(var(--spacing) * 4);
  width: 66.666667%;
}

/*
 * .component-visualization-charts-card-chart-canvas
 * The target element the pie-chart controller renders into.
 *
 * Used by: app/components/visualization/charts_component.html.erb
 * Reuse when: other chart containers need a matching canvas height.
 * Do NOT use for: smaller charts.
 */
.component-visualization-charts-card-chart-canvas {
  height: calc(var(--spacing) * 96);
}

/* ─── Visualization::CompactCharts ─── */

/*
 * .component-visualization-compact-charts-section-title
 * Section heading rendered above each compact chart card block.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: another page needs a bold section heading.
 * Do NOT use for: inline titles.
 */
.component-visualization-compact-charts-section-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

/*
 * .component-visualization-compact-charts-card
 * Wrapper card applied to Cards::CardComponent so the chart row
 * has top/bottom margins that match its neighbors.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: another chart row needs matching vertical spacing.
 * Do NOT use for: inline cards.
 */
.component-visualization-compact-charts-card {
  margin-bottom: calc(var(--spacing) * 8);
  margin-top: calc(var(--spacing) * 4);
  width: 100%;
}

/*
 * .component-visualization-compact-charts-row
 * Wrappable row of compact chart tiles.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: another layout needs wrappable tile rows.
 * Do NOT use for: fixed grids.
 */
.component-visualization-compact-charts-row {
  display: flex;
  flex-wrap: wrap;
  padding: calc(var(--spacing) * 2);
}

/*
 * .component-visualization-compact-charts-card-item
 * Single chart tile inside the row — fixed 18rem wide with a
 * subtle gray border and left/right margin so tiles don't touch.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: another layout needs a matching tile size.
 * Do NOT use for: full-width tiles.
 */
.component-visualization-compact-charts-card-item {
  border: 0.0625rem solid var(--color-gray-200);
  border-radius: var(--radius-md);
  margin-left: calc(var(--spacing) * 4);
  margin-right: calc(var(--spacing) * 4);
  width: calc(var(--spacing) * 72);
}

.component-visualization-compact-charts-card-item:first-child {
  margin-left: 0;
}

.component-visualization-compact-charts-card-item:last-child {
  margin-right: 0;
}

/*
 * .component-visualization-compact-charts-card-image
 * Top banner image inside a chart tile.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other tiles need a top-rounded banner image.
 * Do NOT use for: standalone images.
 */
.component-visualization-compact-charts-card-image {
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
  width: 100%;
}

/*
 * .component-visualization-compact-charts-card-header
 * Padded header section containing the card title.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other tiles need a padded header.
 * Do NOT use for: card bodies.
 */
.component-visualization-compact-charts-card-header {
  padding: calc(var(--spacing) * 4);
  padding-bottom: 0;
}

/*
 * .component-visualization-compact-charts-card-table
 * Scrollable 12rem tall table body inside each chart tile.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other tiles need a scrollable table region.
 * Do NOT use for: static tables.
 */
.component-visualization-compact-charts-card-table {
  height: calc(var(--spacing) * 48);
  overflow: scroll;
  padding-left: calc(var(--spacing) * 4);
  padding-right: calc(var(--spacing) * 4);
}

/*
 * .component-visualization-compact-charts-group-selected
 * Highlight border applied to a selected row group inside the
 * compact chart table.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other compact tables need matching highlights.
 * Do NOT use for: other tables.
 */
.component-visualization-compact-charts-group-selected {
  border: 0.0625rem solid var(--color-yellow-orange);
}

/*
 * .component-visualization-compact-charts-cell
 * Base cell padding inside the compact chart table.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other tables need matching padding.
 * Do NOT use for: header cells.
 */
.component-visualization-compact-charts-cell {
  font-size: var(--font-size-sm);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
}

/*
 * .component-visualization-compact-charts-percent
 * Accent-colored percent badge rendered after a row's count. The
 * color is supplied via the --index-color CSS custom property so
 * each row can brand its own hue based on its position.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other tables need index-based color badges.
 * Do NOT use for: hardcoded colors.
 */
.component-visualization-compact-charts-percent {
  color: var(--index-color, var(--color-accent));
}

/*
 * .component-visualization-compact-charts-chart-wrapper
 * Wrapper around the embedded pie chart — fixed 12rem tall with
 * rounded corners.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other tiles need a matching chart wrapper.
 * Do NOT use for: full-height charts.
 */
.component-visualization-compact-charts-chart-wrapper {
  border-radius: var(--radius-md);
  height: calc(var(--spacing) * 48);
}

/*
 * .component-visualization-compact-charts-chart
 * The target div the pie chart controller renders into.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other pie charts need a matching fixed height.
 * Do NOT use for: responsive charts.
 */
.component-visualization-compact-charts-chart {
  height: calc(var(--spacing) * 48);
}

/*
 * .component-visualization-compact-charts-empty
 * Empty-state slot inside a tile that has no rows — centered
 * placeholder text.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other tiles need a matching empty slot.
 * Do NOT use for: generic empty states.
 */
.component-visualization-compact-charts-empty {
  align-items: center;
  display: flex;
  height: calc(var(--spacing) * 96);
  justify-content: center;
}

/*
 * .component-visualization-compact-charts-empty-label
 * Muted placeholder label inside the empty slot.
 *
 * Used by: app/components/visualization/compact_charts_component.html.erb
 * Reuse when: other empty slots need matching muted text.
 * Do NOT use for: body copy.
 */
.component-visualization-compact-charts-empty-label {
  color: var(--color-gray-400);
}

/* ─── Visualization::Lists ─── */

/*
 * .component-visualization-lists-section-divider
 * Horizontal divider with a centered section heading for the
 * visualization lists page.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: another page needs a matching divider with overlay
 * heading.
 * Do NOT use for: solo headings.
 */
.component-visualization-lists-section-divider {
  align-items: center;
  border-top: 0.0625rem solid var(--color-black);
  display: flex;
  justify-content: center;
  margin-bottom: calc(var(--spacing) * 8);
  margin-top: calc(var(--spacing) * 24);
  position: relative;
  width: 100%;
}

/*
 * .component-visualization-lists-section-title
 * Overlay title that straddles the section divider rule.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: other section dividers need an overlaid title.
 * Do NOT use for: inline titles.
 */
.component-visualization-lists-section-title {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-top: calc(var(--spacing) * -4);
  padding-left: calc(var(--spacing) * 4);
  padding-right: calc(var(--spacing) * 4);
}

/*
 * .component-visualization-lists-section-title-advanced
 * Advanced-builder background variant for the section title.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: other titles need the advanced-builder tone.
 * Do NOT use for: default variants.
 */
.component-visualization-lists-section-title-advanced {
  background: var(--color-gray-100);
}

/*
 * .component-visualization-lists-section-title-default
 * Default background variant for the section title.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: other titles need the default tone.
 * Do NOT use for: advanced variants.
 */
.component-visualization-lists-section-title-default {
  background: var(--color-gray-50);
}

/*
 * .component-visualization-lists-row
 * Wrappable, centered row of list cards.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: another page needs a wrappable card row.
 * Do NOT use for: fixed grids.
 */
.component-visualization-lists-row {
  align-items: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 8);
  justify-content: center;
}

/*
 * .component-visualization-lists-card
 * Vertical list card with the title and scrollable table.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: another section needs a matching list card.
 * Do NOT use for: horizontal layouts.
 */
.component-visualization-lists-card {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  margin-top: calc(var(--spacing) * 8);
}

/*
 * .component-visualization-lists-card-title
 * Centered card title above the list body.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: another card needs a matching centered title.
 * Do NOT use for: left-aligned titles.
 */
.component-visualization-lists-card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: calc(var(--spacing) * 4);
  text-align: center;
}

/*
 * .component-visualization-lists-overflow-message
 * Small muted overflow notice rendered between the title and
 * body of a list card.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: another card needs a matching overflow notice.
 * Do NOT use for: primary text.
 */
.component-visualization-lists-overflow-message {
  color: var(--color-gray-500);
  font-size: var(--font-size-sm);
  margin-bottom: calc(var(--spacing) * 4);
  margin-top: calc(var(--spacing) * -4);
  text-align: center;
}

/*
 * .component-visualization-lists-card-body
 * Padded white card body that houses the list table.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: another list needs a padded white body.
 * Do NOT use for: elevated cards.
 */
.component-visualization-lists-card-body {
  background: var(--color-white);
  border: 0.0625rem solid var(--color-gray-200);
  border-radius: var(--radius-xs);
  flex: 1 1 0;
  overflow: hidden;
  padding: calc(var(--spacing) * 4);
}

/*
 * .component-visualization-lists-group-selected
 * Highlight border applied to a selected row group inside the
 * list table.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: other list tables need matching highlights.
 * Do NOT use for: other tables.
 */
.component-visualization-lists-group-selected {
  border: 0.0625rem solid var(--color-yellow-orange);
}

/*
 * .component-visualization-lists-cell
 * Base cell padding for the list table.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: other tables need matching padding.
 * Do NOT use for: header cells.
 */
.component-visualization-lists-cell {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
}

/*
 * .component-visualization-lists-cell-count
 * Right-aligned count cell variant for the list table.
 *
 * Used by: app/components/visualization/lists_component.html.erb
 * Reuse when: other tables need a right-aligned count column.
 * Do NOT use for: left-aligned values.
 */
.component-visualization-lists-cell-count {
  padding-left: calc(var(--spacing) * 4);
  padding-right: calc(var(--spacing) * 2);
  text-align: right;
}

/* ─── ClientDashboard status + priority badges ─── */

/*
 * .component-badge-status
 * Base inline-block badge for a client-dashboard task status. Pair
 * with a `-in-queue`/`-in-progress`/`-blocked`/`-qc`/`-client-review`/
 * `-completed` variant which supplies the background and text color.
 *
 * Used by: app/components/client_dashboard/status_badge_component.html.erb,
 *   app/components/client_dashboard/status_dropdown_component.html.erb
 * Reuse when: rendering a client-dashboard task status badge.
 * Do NOT use for: generic label badges (use BadgeComponent).
 */
.component-badge-status {
  display: inline-flex;
  align-items: center;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.25;
}

.component-badge-status-in-queue {
  background: color-mix(in srgb, var(--color-gray-400) 15%, transparent);
  color: var(--color-text-muted);
}

.component-badge-status-in-progress {
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  color: var(--color-status-text-blue);
}

.component-badge-status-blocked {
  background: color-mix(in srgb, var(--color-task-rose) 18%, transparent);
  color: var(--color-task-rose);
}

.component-badge-status-qc {
  background: color-mix(in srgb, var(--color-yellow) 18%, transparent);
  color: var(--color-status-text-yellow);
}

.component-badge-status-client-review {
  background: color-mix(in srgb, var(--color-purple) 18%, transparent);
  color: var(--color-status-text-purple);
}

.component-badge-status-completed {
  background: color-mix(in srgb, var(--color-green) 18%, transparent);
  color: var(--color-status-text-green);
}

/*
 * .component-badge-priority
 * Base inline badge for a client-dashboard task priority value. Pair
 * with a `-low`/`-medium`/`-high` variant for colors.
 *
 * Used by: app/components/client_dashboard/priority_badge_component.html.erb,
 *   app/components/client_dashboard/kanban_card_component.html.erb (via PriorityBadgeComponent)
 * Reuse when: rendering a priority badge in the client dashboard.
 * Do NOT use for: generic priority indicators elsewhere in the app.
 */
.component-badge-priority {
  display: inline-flex;
  align-items: center;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.25;
}

.component-badge-priority-low {
  background: var(--color-surface-elevated);
  color: var(--color-text-muted);
}

.component-badge-priority-medium {
  background: color-mix(in srgb, var(--color-yellow) 18%, transparent);
  color: var(--color-status-text-yellow);
}

.component-badge-priority-high {
  background: color-mix(in srgb, var(--color-red) 18%, transparent);
  color: var(--color-status-text-red);
}

/* ─── ClientDashboard milestone badges ─── */

/*
 * .component-badge-milestone
 * Inline badge rendered on a milestone card showing completion state.
 * Pair with a `-completed`/`-in-progress`/`-upcoming` variant.
 *
 * Used by: app/components/client_dashboard/collapsible_milestone_component.html.erb
 * Reuse when: another milestone-state badge is needed.
 * Do NOT use for: task status badges (use `.component-badge-status`).
 */
.component-badge-milestone {
  display: inline-flex;
  align-items: center;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.25;
}

.component-badge-milestone-completed {
  background: color-mix(in srgb, var(--color-green) 18%, transparent);
  color: var(--color-status-text-green);
}

.component-badge-milestone-in-progress {
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  color: var(--color-status-text-blue);
}

.component-badge-milestone-upcoming {
  background: var(--color-surface-elevated);
  color: var(--color-text-muted);
}

/* ─── Dashboard welcome video modal ─── */

/*
 * .component-dashboard-welcome-video*
 * Flush modal content for the first-run welcome video. The frame owns a
 * responsive 16:9 aspect ratio while the shared modal owns dismissal.
 *
 * Used by: app/components/dashboard/welcome_video_modal_component.html.erb
 * Reuse when: embedding the dashboard welcome video in its modal.
 * Do NOT use for: arbitrary embedded content or Help Center video cards.
 */
.component-dashboard-welcome-video .component-modal-header {
  padding-right: calc(var(--spacing) * 12);
}

.component-dashboard-welcome-video-frame {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-black);
}

.component-dashboard-welcome-video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/*
 * .component-dashboard-video-*
 * The welcome video card on the launch dashboard: a 16:9 poster that is the
 * play button, or a "coming soon" panel when there is no video yet. Same
 * surface, play disc and tokens as the Help Center video thumb so the two
 * read as one kind of thing.
 *
 * Used by: app/components/dashboard/welcome_video_card_component.html.erb
 * Reuse when: a dashboard card that opens the welcome video modal.
 * Do NOT use for: Help Center video tiles (use .help-video-*).
 */
.component-dashboard-video-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: calc(var(--spacing) * 4);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-elevated));
}

button.component-dashboard-video-poster {
  cursor: pointer;
}

button.component-dashboard-video-poster:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-dashboard-video-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface-primary);
  box-shadow: var(--shadow-md);
  color: var(--color-accent);
  transition: transform var(--motion-fast);
}

button.component-dashboard-video-poster:hover .component-dashboard-video-play {
  transform: scale(1.05);
}

.component-dashboard-video-play-icon {
  width: 1.375rem;
  height: 1.375rem;
}

.component-dashboard-video-soon {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

/* ─── Dashboard shared shells ─── */

/*
 * .component-dashboard-page
 * The dashboard's content column. Caps the page at --dashboard-content-width
 * and centres it in whatever gutter is left, so triage rows stop stretching to
 * the width of the display and putting a thousand pixels between what broke
 * and the control that fixes it.
 *
 * The page header takes the same cap through .component-page-header--band, so
 * the band and the sections under it share one column edge. Both read the same
 * token; changing the column means changing the token, not two rules.
 *
 * Used by: app/views/dashboard/index.html.erb
 * Reuse when: never directly — one page owns this class. A second landing page
 *   that wants the cap should read the token, not this class.
 */
.component-dashboard-page {
  max-width: var(--dashboard-content-width);
  margin-inline: auto;
}

/*
 * .component-dashboard-pair-row
 * Responsive 2-column grid for dashboard card pairs. Collapses to a
 * single stacked column on mobile. The `> *` rule sets `min-width: 0`
 * on grid children so a card's content can't expand the cell past its
 * 1fr share (needed for text-overflow: ellipsis inside the card to
 * actually take effect).
 *
 * One gap at every width. The stacked column used to open to 32px while the
 * side-by-side row stayed at 16px, so on a phone the dashboard's card rows sat
 * at different rhythms from each other and from the 16px .stack holding them.
 * 16px is the documented card-to-card step; it is now the only one this row
 * uses.
 *
 * Used by: app/views/dashboard/index.html.erb (recent audiences + recent lists
 * row).
 * Reuse when: any 2-up card row on the dashboard.
 * Do NOT use for: 3-up stat rows (use .component-dashboard-stat-row).
 */
.component-dashboard-pair-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(var(--spacing) * 4);
}

.component-dashboard-pair-row > * {
  min-width: 0;
}

/* auto-fit, not repeat(2, 1fr): either card in a pair can decline to render
 * (a recent-records card with nothing recent), and a fixed two-column track
 * left the survivor at half width beside a half page of nothing. The 45%
 * minimum is what caps the row at two columns — three tracks would need 135%
 * — so the grid still reads as a pair when both cards are present. */
@media (min-width: 64rem) {
  .component-dashboard-pair-row {
    grid-template-columns: repeat(auto-fit, minmax(45%, 1fr));
  }
}

/*
 * .component-dashboard-card-stretch
 * Modifier for .component-card that makes it fill its grid cell
 * vertically and turns its children into a vertical flex column.
 *
 * Used by: recent_audiences_component, recent_lists_component.
 * Reuse when: a dashboard card must stretch to match its row height.
 * Do NOT use for: the non-stretching milestones strip.
 */
.component-dashboard-card-stretch {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/*
 * When the stretch class is applied to the Cards::CardComponent outer
 * wrapper, the inner .component-card needs `flex: 1` to actually fill
 * the wrapper's height. Without it the inner card collapses to its
 * content's natural height and sibling cards in the same grid row
 * end up at different heights even though their wrappers are equal.
 *
 * The card is a flex column for the same reason: with the height handed
 * down, a body element that wants the leftover space (a chart canvas) can
 * ask for it with `flex: 1` instead of leaving the extra height as a gap
 * under its content.
 */
.component-dashboard-card-stretch > .component-card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/*
 * .component-dashboard-stat-card
 * The shell a reporting card wears — `.component-card` plus a full-height flex
 * column. Figure cards and chart cards share it so a page carrying both reads
 * as one family rather than two: same surface, same header anatomy, same
 * rhythm.
 *
 * Content flows top-down and nothing inside it is pushed to the bottom edge:
 * when a grid stretches a short card to match a tall sibling, the spare height
 * collects under the content instead of opening a hole in the middle of it.
 *
 * Used by: email_campaigns/performance_chart_component.
 * Reuse when: a page needs a reporting card that reports one figure or one
 *   plot under a caption label.
 * Do NOT use for: cards with a title row and action links (use
 *   Cards::CardComponent and its title_actions slot).
 */
.component-dashboard-stat-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/*
 * .component-dashboard-stat-header
 * The one header anatomy for a reporting card: a caption-scale label on the
 * left, one small right-hand affordance opposite it — a tinted icon chip on
 * the figure and chart cards, a "View all" link on the dashboard's
 * recent-activity cards. The label stays quiet on purpose; the figure, the
 * plot, or the list below it is what the card is for.
 *
 * Top-aligned, not centered. The right-hand affordance is taller than a 13px
 * caption, and centering used to float the label in the middle of that band —
 * on a 640px-wide card the resulting dead space above the label read as bloated
 * card padding. Anchoring the row to the top gives the label the card's first
 * line, which is where a title belongs.
 *
 * Carries no bottom margin: each body block declares the gap it wants from the
 * header, so a value sits 4px below it and a chart or a zero state sits 16px
 * below it without two margins adding up to an off-scale number.
 *
 * Used by: email_campaigns/performance_chart_component, recent_audiences_component,
 * recent_lists_component.
 * Reuse when: a reporting card needs its label + single-affordance header row.
 * Do NOT use for: cards whose heading is a real h3-scale title (use
 * Cards::CardComponent's title and title_actions slot).
 */
.component-dashboard-stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: calc(var(--spacing) * 4);
}

/*
 * .component-dashboard-stat-header-spaced
 * Modifier for cards whose body is a block that declares no gap of its own —
 * the recent-activity record list and its empty state. Supplies the same 16px
 * the chart and zero-state bodies set for themselves, so every dashboard card
 * puts the same distance between its label and its content.
 *
 * Used by: recent_audiences_component, recent_lists_component.
 */
.component-dashboard-stat-header-spaced {
  margin-bottom: calc(var(--spacing) * 4);
}

/* ─── Dashboard::HeadlineComponent ─── */

/*
 * .component-dashboard-headline
 * The dashboard's standing number, sitting in PageHeaderComponent's `headline`
 * slot below the greeting rather than in a card of its own: it states a fact
 * about the account, and a card in the page's first slot would compete with
 * the triage region below it.
 *
 * The figure leads and its caption follows — the reverse of the stat-card
 * rhythm. On a tile the label has to name the tile before the value means
 * anything; in a hero the greeting has already introduced the page, and a
 * small label above a large number reads as an eyebrow.
 *
 * Used by: app/components/dashboard/headline_component.html.erb
 * Reuse when: another page earns a hero figure — take the same header slot
 *   rather than rebuilding these rules in an area file.
 *
 * The slot's own spacing lives on .component-page-header-headline above, so
 * this file owns only the band's internal composition and its type.
 *
 * The row carries the entitlement on the left and the account's own facts on
 * the right: what it has left to spend and what this month has cost it, with
 * where this month's syncs landed stacked beneath them. The two columns are
 * equal, divided by a hairline, and sit on a shared bottom edge, so the row
 * reads as one composed statement.
 *
 * Equal columns, not a figure with a narrow widget pushed to the far end. The
 * earlier composition set the two at opposite ends of the header and left a
 * few hundred pixels of nothing between them, which read as two fragments that
 * happened to share a line. Splitting the row in half puts the second column
 * against a drawn edge at a measured distance, and it gives the platform bars
 * enough width to be worth drawing.
 *
 * The hairline is a column divider, not a rail: it separates claims that must
 * never be read as one (see the aside's and the band's own notes below). It
 * carries the themed border weight rather than the subtle one the list rows
 * use — this hairline is structure, and at the subtle weight it all but
 * disappeared on the dark band. Below 48rem the right column drops under the
 * figure and the divider goes horizontal.
 */
.component-dashboard-headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: calc(var(--spacing) * 8);
  align-items: stretch;
}

/* Both columns hang from the same bottom edge, whichever is taller. */
.component-dashboard-headline-figure-group {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

/* Sized between the page-header h1 and the display role: comfortably bigger
 * than the greeting above it, because the greeting is chrome and this is the
 * fact. Tracking tightens with the size, the way the display role does.
 *
 * Proportional figures, deliberately: tabular-nums gives every digit the width
 * of a zero, which at 56px opens visible gutters around a 1 and makes the
 * number look loose. Tabular is for columns that have to align down the page,
 * which is why the platform values below use it and this does not. */
.component-dashboard-headline-figure {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-variant-numeric: proportional-nums;
  color: var(--color-text-heading);
}

/* Body scale rather than body-sm: a 15px caption under a 56px figure reads as
 * a footnote to the number instead of naming it. */
.component-dashboard-headline-label {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line-height);
  font-weight: var(--type-body-weight);
  color: var(--color-text-body);
}

/* The proof of work sits a step quieter than the label: it qualifies the
 * number rather than naming it, and it is absent for any account that has not
 * run a cleaning tool. */
.component-dashboard-headline-proof {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line-height);
  font-weight: var(--type-caption-weight);
  color: var(--color-text-muted);
}

/*
 * .component-dashboard-headline-aside
 * The right column of the fact row: the account's own numbers, stacked. The
 * balance pair leads and the platform band follows when there is one.
 *
 * The column hairline lives here rather than on either block, because the two
 * can render alone or together and the divider belongs to the column, not to
 * whichever fact happens to fill it.
 *
 * Used by: app/components/dashboard/headline_component.html.erb
 * Reuse when: never directly — the dashboard hero owns this column.
 * Do NOT use for: a breakdown of the figure beside it. Nothing in this column
 *   decomposes the reach number, and building it to look like it does would
 *   invite exactly the sum none of these figures supports.
 */
.component-dashboard-headline-aside {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  padding-inline-start: calc(var(--spacing) * 8);
  border-inline-start: 1px solid var(--color-border-themed);
}

/*
 * .component-dashboard-headline-usage
 * What the account has left to spend and what this month has already cost it,
 * in whichever currency the account is billed in.
 *
 * Zeros print here, unlike the reach figure above: nothing left to spend is a
 * fact the account has to see, where a zero reach is only an absence. The
 * component withholds the whole block until the ledger has a row, so a
 * brand-new account never reads "0" for something it has never been sold.
 *
 * Not a breakdown of the reach figure — one counts an entitlement, the other a
 * ledger — so the pair carries its own labels and is never totalled with it.
 *
 * Used by: app/components/dashboard/headline_component.html.erb
 * Reuse when: never directly — the dashboard hero owns this pair.
 */
.component-dashboard-headline-usage {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
}

/* Both figures share the column until one needs the whole width, then that one
 * wraps onto its own line rather than overflowing the band. The basis is short
 * so the pair stays side by side on a phone, and a figure's own width is its
 * floor rather than zero, because a number must never be cut to fit. */
.component-dashboard-headline-usage-figure {
  display: flex;
  flex: 1 1 7rem;
  flex-direction: column;
}

/* Half the reach figure's scale: enough to read as a fact rather than as
 * chrome, short of anything that would make it look like a second headline.
 *
 * Tabular here, unlike the reach figure: these two sit side by side and their
 * digits have to line up with each other, which is the case tabular numerals
 * are for. */
.component-dashboard-headline-usage-value {
  font-size: clamp(var(--font-size-2xl), 2.2vw, var(--font-size-3xl));
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-heading);
}

.component-dashboard-headline-usage-label {
  margin-top: calc(var(--spacing) * 1);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line-height);
  font-weight: var(--type-caption-weight);
  color: var(--color-text-muted);
}

/* Two claims stacked in one column need a drawn edge between them for the same
 * reason the columns do. Themed weight, not subtle: the subtle hairline all but
 * disappeared against the dark band. */
.component-dashboard-headline-usage + .component-dashboard-headline-band {
  margin-top: calc(var(--spacing) * 6);
  padding-top: calc(var(--spacing) * 6);
  border-top: 1px solid var(--color-border-themed);
}

/*
 * .component-dashboard-headline-band
 * Where this month's syncs landed, one row per ad platform.
 *
 * It is not a breakdown of the figure beside it and must never be built to
 * look like one: the two count different things, so this block keeps its own
 * caption, prints every platform's own number, and never shows a total. The
 * same person can sit in two platforms' audiences, so a sum across them would
 * count them twice.
 *
 * Used by: app/components/dashboard/headline_component.html.erb
 * Reuse when: never directly — the dashboard hero owns this block.
 */
.component-dashboard-headline-band {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.component-dashboard-headline-band-caption {
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line-height);
  color: var(--color-text-muted);
}

/* Platforms are separated more than the parts of one platform are: 16px
 * between rows against the 4px that holds a name, its value, and its bar
 * together, so the eye groups by platform before it compares across them. */
.component-dashboard-headline-band-rows {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 4);
  margin-top: calc(var(--spacing) * 2);
}

/* Name and value share the first line; the bar spans both columns underneath,
 * so a long platform name pushes its value rather than its bar. */
.component-dashboard-headline-band-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: calc(var(--spacing) * 4);
  row-gap: calc(var(--spacing) * 1);
}

.component-dashboard-headline-band-name {
  min-width: 0;
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line-height);
  color: var(--color-text-body);
}

/* Tabular here and only here: these values stack, so their digits have to line
 * up down the column. */
.component-dashboard-headline-band-value {
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line-height);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-heading);
}

/* The track is the full width of the row, so each bar is read against the
 * largest platform rather than against a scale nobody drew.
 *
 * The track is a tint of the accent rather than the neutral raised surface: on
 * a lit band a gray channel reads as a hole cut in the surface, and the tint
 * keeps the unfilled part of each bar in the same family as the fill, which is
 * what makes the comparison legible at a glance. */
.component-dashboard-headline-band-track {
  grid-column: 1 / -1;
  height: 0.5rem;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
}

/* Width comes from --band-fill-share, set per row by the component: the share
 * is server data, which is the one case the design system allows through an
 * inline custom property. */
.component-dashboard-headline-band-fill {
  display: block;
  width: var(--band-fill-share);
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
}

/* One column below 48rem: the divider turns horizontal and the account's own
 * facts sit under the figure rather than beside it. Same relationship, rotated
 * — the two columns stay separated by a drawn edge at a measured distance. */
@media (max-width: 48rem) {
  .component-dashboard-headline {
    grid-template-columns: minmax(0, 1fr);
    row-gap: calc(var(--spacing) * 6);
  }

  .component-dashboard-headline-aside {
    padding-inline-start: 0;
    padding-top: calc(var(--spacing) * 6);
    border-inline-start: none;
    border-top: 1px solid var(--color-border-themed);
  }
}

/* ─── Dashboard::PulseComponent ─── */

/*
 * .component-dashboard-pulse
 * The results line under the hero figure: one caption-scale figure per module
 * that has something to report, each linking to the page that produced it.
 *
 * Reporting, not triage. Nothing here needs a human, which is why the line is
 * quiet enough to skip and why it disappears entirely rather than printing
 * zeroes for an account that has not synced or mailed yet.
 *
 * Used by: app/components/dashboard/pulse_component.html.erb
 * Reuse when: never directly — the dashboard hero owns this line.
 * Do NOT use for: figures that need acting on (they are triage rows) or for
 *   stat tiles (use StatCardsComponent).
 */
.component-dashboard-pulse {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 2) calc(var(--spacing) * 6);
  margin-top: calc(var(--spacing) * 6);
}

/* Following the figure row, the pulse becomes the band's footer line: a rule
 * across the full width of the band, then the results underneath it. The
 * divider is drawn by the sibling combinator rather than by the pulse itself,
 * because an account with results but no reach figure renders this line alone
 * and a rule with nothing above it is a line drawn for no reason. */
.component-dashboard-headline + .component-dashboard-pulse {
  padding-top: calc(var(--spacing) * 6);
  border-top: 1px solid var(--color-border-themed);
}

/* Padding here and a matching negative margin keep the focus ring clear of the
 * text without moving the figure off the line it shares with its neighbours. */
.component-dashboard-pulse-figure {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  margin: calc(var(--spacing) * -1) calc(var(--spacing) * -2);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line-height);
  text-decoration: none;
  transition: background-color var(--motion-fast);
}

/* The line reads as reporting at rest, so the link affordance arrives on
 * approach rather than sitting under every figure permanently. */
.component-dashboard-pulse-figure:hover {
  background: var(--color-surface-hover);
}

.component-dashboard-pulse-figure:hover .component-dashboard-pulse-label {
  color: var(--color-text-body);
  text-decoration: underline;
}

.component-dashboard-pulse-figure:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/*
 * .component-dashboard-pulse-spark
 * A 24px meter carrying the module's identity color. The figure beside it is
 * already a percentage, so the meter's domain is the rate's own 0-100 and it
 * states nothing the number does not: no baseline, no target, no comparison.
 *
 * The color is identity, never a call to action — DESIGN.md's Module Identity
 * Rule keeps every primary control VIA Blue.
 */
.component-dashboard-pulse-spark {
  display: inline-block;
  flex-shrink: 0;
  width: calc(var(--spacing) * 8);
  height: 0.25rem;
  margin-right: calc(var(--spacing) * 1);
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--pulse-color) 25%, transparent);
}

.component-dashboard-pulse-spark-fill {
  display: block;
  width: var(--pulse-spark-share);
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--pulse-color);
}

.component-dashboard-pulse-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-heading);
}

.component-dashboard-pulse-label {
  color: var(--color-text-muted);
}

/* ─── Dashboard::TriageComponent / Dashboard::TriageRowComponent ─── */

/*
 * .component-dashboard-triage
 * The dashboard's leading region: the exception list and the setup checklist,
 * or the earned all-clear when neither applies. It is the rows'
 * container query context, so a row reflows on the region's own width — the
 * region sits full-bleed on the dashboard but the same rows have to survive
 * anywhere else the pattern lands.
 *
 * Used by: app/components/dashboard/triage_component.html.erb
 * Reuse when: never directly — one region owns this class.
 */
.component-dashboard-triage {
  container-type: inline-size;
}

/*
 * .component-dashboard-triage-count
 * How many things need the reader, sitting opposite the region's h2. Quiet by
 * design: the count orients, the rows do the work.
 *
 * Used by: app/components/dashboard/triage_component.html.erb
 * Reuse when: a plain figure in a SectionHeaderComponent action slot.
 * Do NOT use for: status or state (use BadgeComponent).
 */
.component-dashboard-triage-count {
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line-height);
  color: var(--color-text-muted);
}

/*
 * .component-dashboard-triage-list
 * Hairline-divided rows filling the region's card edge to edge. Cancels the
 * card's padding on all four sides so a divider spans the full width; each row
 * re-establishes the inset itself.
 *
 * The dividers run as border-top rather than the design system's border-bottom
 * variant, because the list continues inside a <details> disclosure: a top rule
 * on every row but the first divides both groups and the summary between them
 * without a last-child rule per container.
 *
 * The list clips to the card's radius. Rows run edge to edge and a washed row
 * (see the money band below) would otherwise paint square corners over the
 * card's rounded ones at the top and bottom of the list.
 *
 * Used by: app/components/dashboard/triage_component.html.erb
 * Reuse when: a card's whole body is one divided list.
 * Do NOT use for: recent-record lists, which are gap-separated rounded rows
 *   (.component-dashboard-record-list).
 */
.component-dashboard-triage-list {
  margin: calc(var(--card-padding) * -1);
  overflow: hidden;
  border-radius: inherit;
}

/*
 * .component-dashboard-triage-row
 * One exception: severity chip, what broke and why, then when and the single
 * control that ends it. No hover wash — the row is not a link, the control is.
 *
 * Used by: app/components/dashboard/triage_row_component.html.erb,
 *   app/components/dashboard/triage_resolved_row_component.html.erb
 */
.component-dashboard-triage-row {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 4) var(--card-padding);
  border-top: 1px solid var(--color-border-subtle);
}

/* The first row meets the card's own border, so it needs no rule of its own. */
.component-dashboard-triage-list > .component-dashboard-triage-rows:first-child > li:first-child
  > .component-dashboard-triage-row {
  border-top: none;
}

/*
 * The money band, washed. The one tier that costs the client money if it is
 * missed gets a quiet red tint across the row, in the accent-washed-row
 * language the setup checklist's active step already speaks — a tint plus the
 * hairlines the list already has, not a raised slab.
 *
 * This is deliberately not the banned per-row fill: that anti-pattern paints
 * every row in a neutral gray that carries no information. Here exactly one
 * tier is washed, in its own severity color, so the wash is the information.
 *
 * The other three tiers stay chip-only. Washing blocked, failed and waiting in
 * progressively quieter tints was tried and read as a rainbow: with four
 * temperatures on screen at once the list stopped being scannable and the one
 * row that actually costs money stopped standing out — which is the entire
 * point of washing it.
 */
.component-dashboard-triage-row[data-severity="money"] {
  background: var(--color-dashboard-severity-money);
}

/*
 * .component-dashboard-triage-row-body
 * Title and cause column. min-width: 0 so a 1000-character failure reason
 * wraps inside the row instead of pushing the control off the card.
 */
.component-dashboard-triage-row-body {
  flex: 1;
  min-width: 0;
}

/*
 * .component-dashboard-triage-row-heading
 * Title plus, for the money band only, its badge. Wraps rather than truncates:
 * a clipped exception is a different exception.
 */
.component-dashboard-triage-row-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

/*
 * .component-dashboard-triage-row-title
 * What happened, in the reader's own nouns. Body scale at 600 — loud enough to
 * scan five of them, quiet enough that five do not read as an alarm.
 */
.component-dashboard-triage-row-title {
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line-height);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-dashboard-triage-row-title-link
 * The title as a link, used only where the row's own control resolves in place
 * and the reader still needs to look at the thing first (a creative review).
 */
.component-dashboard-triage-row-title-link {
  color: var(--color-text-heading);
  text-decoration: none;
  transition: color var(--transition-timing-standard);
}

.component-dashboard-triage-row-title-link:hover {
  color: var(--color-accent);
}

.component-dashboard-triage-row-title-link:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

/*
 * .component-dashboard-triage-row-cause
 * Why it happened, in the owning model's own words where it wrote them.
 * Clamped to two lines: a sync failure reason runs to 1000 characters and the
 * full text lives on the destination the control leads to.
 */
.component-dashboard-triage-row-cause {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: calc(var(--spacing) * 1);
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line-height);
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

/*
 * .component-dashboard-triage-row-aside
 * When it happened and the one control that ends it, right-aligned so five
 * rows put five controls on the same vertical line.
 */
.component-dashboard-triage-row-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: calc(var(--spacing) * 2);
  flex-shrink: 0;
}

/* Dismiss sits to the left of the row's control so the primary pills still
 * line up down the right edge. */
.component-dashboard-triage-row-controls {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

.component-dashboard-triage-row-time {
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line-height);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/*
 * .component-dashboard-triage-row-resolved
 * A row after the reader resolved it inline. Keeps the row's geometry so the
 * list does not reflow under the cursor; the chip's colour does the reporting.
 */
.component-dashboard-triage-row-resolved .component-dashboard-triage-row-title {
  color: var(--color-text-body);
}

/*
 * .component-dashboard-triage-overflow
 * The rest of a bad week, behind a disclosure. Five rows is the region's
 * budget; twelve rendered at once is a wall rather than triage.
 *
 * Used by: app/components/dashboard/triage_component.html.erb
 */
.component-dashboard-triage-overflow-summary {
  padding: calc(var(--spacing) * 2) var(--card-padding);
  border-top: 1px solid var(--color-border-subtle);
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line-height);
  font-weight: 500;
  color: var(--color-accent);
  cursor: pointer;
  list-style: none;
  transition: color var(--transition-timing-standard);
}

.component-dashboard-triage-overflow-summary::-webkit-details-marker {
  display: none;
}

/* The summary stays on screen once the disclosure opens, so its label has to
 * follow: both strings ship and CSS picks the one the state calls for. */
.component-dashboard-triage-overflow-hide,
.component-dashboard-triage-overflow[open] .component-dashboard-triage-overflow-show {
  display: none;
}

.component-dashboard-triage-overflow[open] .component-dashboard-triage-overflow-hide {
  display: inline;
}

.component-dashboard-triage-overflow-summary:hover {
  color: var(--color-accent-hover);
}

/* Drawn inset: an outer ring on a full-bleed row would sit outside the card. */
.component-dashboard-triage-overflow-summary:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

/*
 * .component-dashboard-triage-all-clear
 * The earned empty state. Deliberately not EmptyStateComponent: this is a
 * report on work the platform did, not a prompt to create something, so it
 * keeps the row idiom — chip, headline, facts — rather than centring itself.
 *
 * Used by: app/components/dashboard/triage_component.html.erb
 * Reuse when: never directly — the dashboard owns this state.
 * Do NOT use for: a section with no data yet (use EmptyStateComponent).
 */
.component-dashboard-triage-all-clear {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 6);
  padding-block: calc(var(--spacing) * 4);
}

.component-dashboard-triage-all-clear-body {
  flex: 1;
  min-width: 0;
}

/*
 * .component-dashboard-triage-all-clear-chip
 * Holds the green check and the light around it. The bloom is a soft radial
 * tint of the same green the chip already carries, sized past the chip's own
 * edge so it reads as light falling on the card rather than as a ring drawn
 * around a badge. It stays inside the tinted-callout language the status
 * palette already speaks: no banner, no fill, no second hue.
 *
 * It hangs off this wrapper rather than off IconBadgeComponent because the
 * treatment belongs to this one state; the shared badge should not grow a
 * decorative variant for it.
 */
.component-dashboard-triage-all-clear-chip {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.component-dashboard-triage-all-clear-chip::before {
  content: "";
  position: absolute;
  inset: calc(var(--spacing) * -6);
  border-radius: var(--radius-pill);
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--color-green) 24%, transparent),
    color-mix(in srgb, var(--color-green) 7%, transparent) 58%,
    transparent
  );
  animation: dashboard-all-clear-bloom var(--motion-base);
}

/*
 * The page's one authored moment: arriving at "nothing needs you" is the state
 * change the dashboard exists to deliver, so the light comes up once when it
 * renders. Only the bloom moves; the chip, the headline, and the facts are all
 * at rest from the first frame, so the state is fully legible whether or not
 * the animation ever plays. The global prefers-reduced-motion rule in
 * tokens.css collapses it to nothing.
 */
@keyframes dashboard-all-clear-bloom {
  from {
    opacity: 0;
    transform: scale(0.72);
  }
}

/*
 * .component-dashboard-triage-all-clear-title
 * States the fact and stops. No congratulation, no full-width green banner —
 * the green lives in the chip beside it and nowhere else.
 *
 * Card-heading scale rather than body: this is the answer to the question the
 * reader arrived with, and at body weight it read as one more line of status
 * rather than as the page's conclusion.
 */
.component-dashboard-triage-all-clear-title {
  font-size: var(--type-h3-size);
  line-height: var(--type-h3-line-height);
  letter-spacing: var(--type-h3-letter-spacing);
  font-weight: var(--type-h3-weight);
  color: var(--color-text-heading);
}

/*
 * .component-dashboard-triage-all-clear-facts
 * What was checked, as counted figures. This line is what earns the headline,
 * so it is never dropped for looking plain.
 */
.component-dashboard-triage-all-clear-facts {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 2);
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-line-height);
  color: var(--color-text-muted);
}

/* Separator between facts, drawn rather than written so no locale has to
 * translate punctuation. */
.component-dashboard-triage-all-clear-fact + .component-dashboard-triage-all-clear-fact::before {
  content: "•";
  margin-right: calc(var(--spacing) * 2);
  color: var(--color-border-strong);
}

/* Narrow region: the time and the control drop under the text on their own
 * line rather than squeezing the cause into a column two words wide. The
 * control goes full width there, because a 44px pill at the end of a 320px row
 * is a target the thumb has to hunt for. */
@container (max-width: 34rem) {
  .component-dashboard-triage-row {
    flex-wrap: wrap;
    row-gap: calc(var(--spacing) * 2);
  }

  .component-dashboard-triage-row-aside {
    flex-basis: 100%;
    align-items: stretch;
  }

  .component-dashboard-triage-row-aside .component-button {
    width: 100%;
    justify-content: center;
  }

  /* Two controls share the full-width line in reading order. Each is either
   * the button itself or button_to's form around it. */
  .component-dashboard-triage-row-controls > * {
    flex: 1;
  }

  /* Chip on its own line above the text. Centring it against a stacked facts
   * list left it floating halfway down a column it does not belong to, with
   * the headline pushed off the reading edge; stacked, the whole state reads
   * down one left margin. */
  .component-dashboard-triage-all-clear {
    flex-direction: column;
    align-items: flex-start;
    gap: calc(var(--spacing) * 4);
  }

  /* Facts stack rather than wrap: a wrapped inline list leaves its separator
   * stranded at the head of the second line, reading as a bullet nobody set. */
  .component-dashboard-triage-all-clear-facts {
    flex-direction: column;
    gap: 0;
  }

  .component-dashboard-triage-all-clear-fact + .component-dashboard-triage-all-clear-fact::before {
    content: none;
  }
}

/* ─── EmailCampaigns::PerformanceChartComponent ─── */

/*
 * .component-dashboard-chart-canvas-wrap
 * The plotting area of a chart card. Grows into whatever height the card was
 * given rather than sitting at a fixed 11.25rem, because a card stretched to
 * match a taller sibling used to stop its chart mid-card and leave the rest of
 * the surface empty. The chart controller runs Chart.js with
 * maintainAspectRatio: false, so the canvas follows this box. The minimum is
 * the old fixed height, so a chart never gets shorter than it used to be.
 *
 * The top margin is the card header's gap: the plot is this card's data, so it
 * sits the same 16px below the label that a zero state does.
 *
 * Used by: email_campaigns/performance_chart_component.
 */
.component-dashboard-chart-canvas-wrap {
  flex: 1;
  min-height: 11.25rem;
  min-width: 0;
  margin-top: calc(var(--spacing) * 4);
}

/* Chart.js can briefly set a wide intrinsic canvas width; clamp it so the
 * canvas can never push its card past the grid track. */
.component-dashboard-chart-canvas-wrap canvas {
  max-width: 100%;
}

/* ─── QuickActionsGridComponent ─── */

/*
 * .component-quick-actions-grid
 * Responsive grid of QuickActionTileComponent tiles — 2 columns on small
 * screens, 4 on large. Shared by Dashboard, ClientDashboard, and admin
 * account quick actions via QuickActionsGridComponent.
 *
 * Used by: app/components/quick_actions_grid_component.html.erb
 */
.component-quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--spacing) * 4);
}

@media (min-width: 64rem) {
  .component-quick-actions-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/*
 * .component-quick-action-tile-checklist-step
 * Marks a tile whose destination the setup checklist is currently routing the
 * user to. While the checklist is expanded on the page the tile steps aside, so
 * the same destination isn't offered twice in two visual languages; collapsing
 * the checklist brings it straight back with no page load.
 *
 * The page wrapper carries the state (data-setup-checklist), flipped by the
 * checklist's Stimulus controller. Dashboard::QuickActionsComponent decides
 * which tiles get the class, from the checklist's own step state.
 *
 * Used by: app/components/dashboard/quick_actions_component.rb
 * Reuse when: never directly — the dashboard owns this pairing.
 */
[data-setup-checklist="expanded"] .component-quick-action-tile-checklist-step {
  display: none;
}

/* ─── Recent-records cards (RecentAudiencesComponent, RecentListsComponent) ─── */

/*
 * .component-dashboard-view-all-link
 * The recent-activity cards' right-hand affordance, sitting opposite the card
 * label in the same header row the Performance cards give their icon chip.
 * Shares the label's tightened 1.25 leading so the two sit on one baseline in a
 * top-aligned row — at the caption role's 1.4 the link's taller line box pushed
 * its text about a pixel below the label's.
 */
.component-dashboard-view-all-link {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  font-size: var(--type-caption-size);
  line-height: 1.25;
  font-weight: 500;
  color: var(--color-accent);
  transition: color var(--transition-timing-standard);
}

.component-dashboard-view-all-link:hover {
  color: var(--color-accent-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-dashboard-view-all-link:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

.component-dashboard-view-all-icon {
  width: 0.75rem;
  height: 0.75rem;
}

/*
 * .component-dashboard-record-list
 * Vertical list of record rows inside a recent-records card
 * (recent audiences, recent lists).
 */
.component-dashboard-record-list {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1);
}

/*
 * .component-dashboard-record-item
 * Single record row: 32×32 icon tile + name/meta body + status badge.
 * Pulled back into the card's padding gutter with a negative inline
 * margin so the row's content (icon, name, badge) lines up with the
 * card's title and "View all" link on either side. The row's own
 * horizontal padding still provides hover-surface breathing room
 * (16px on each side) when the background tints on hover.
 *
 * Used by: app/components/dashboard/recent_audiences_component.html.erb,
 *   app/components/dashboard/recent_lists_component.html.erb
 */
.component-dashboard-record-item {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  margin-inline: calc(var(--spacing) * -4);
  border-radius: var(--radius-lg);
  transition: background var(--transition-timing-standard);
}

.component-dashboard-record-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-lg);
  background: var(--color-accent-subtle);
  border: 1px solid var(--color-accent-border);
  flex-shrink: 0;
  color: var(--color-accent);
}

.component-dashboard-record-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-dashboard-record-body {
  flex: 1;
  min-width: 0;
}

.component-dashboard-record-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.component-dashboard-record-meta {
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line-height);
  color: var(--color-text-muted);
}

.component-dashboard-record-badge {
  flex-shrink: 0;
}

/* ─── Dashboard::MilestonesStripComponent ─── */

/*
 * .component-dashboard-milestones-header
 * Header row containing the title cluster on the left and the
 * current-rank badge + next-rank indicator on the right.
 *
 * Used by: app/components/dashboard/milestones_strip_component.html.erb
 */
.component-dashboard-milestones-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 3);
  margin-bottom: calc(var(--spacing) * 8);
}

.component-dashboard-milestones-title-icon {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--color-accent);
}

/*
 * .component-dashboard-milestones-rank-badge
 * Tinted badge showing "Lv.N Name" in the current rank's color.
 * The rank color comes from a caller-provided --rank-color custom
 * property; background and border are derived via color-mix so the
 * tint stays proportional regardless of whether --rank-color is a
 * hex, a CSS variable, or a semi-transparent color.
 *
 * This replaces the pre-C5e `#{color}18` / `#{color}30` string hack
 * that only produced a valid color when the input was a concrete
 * 6-digit hex — `var(--*)` references rendered as garbage.
 *
 * Used by: app/components/dashboard/milestones_strip_component.html.erb
 * Reuse when: a badge needs a dynamic "tinted with the passed-in color"
 * background.
 */
.component-dashboard-milestones-rank-badge {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--rank-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rank-color) 20%, transparent);
  color: var(--rank-color);
}

.component-dashboard-milestones-rank-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-dashboard-milestones-rank-level {
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.component-dashboard-milestones-rank-name {
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.component-dashboard-milestones-rank-chevron {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--color-text-muted);
}

.component-dashboard-milestones-next-rank-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-dashboard-milestones-next-rank-name {
  font-weight: 600;
  color: var(--rank-color);
}

/*
 * .component-dashboard-milestones-strip
 * Horizontal strip holding the background track, progress line,
 * and five milestone nodes.
 *
 * Used by: app/components/dashboard/milestones_strip_component.html.erb
 */
.component-dashboard-milestones-strip {
  display: flex;
  justify-content: space-between;
  gap: calc(var(--spacing) * 2);
  position: relative;
  padding: 0 calc(var(--spacing) * 4);
}

/*
 * .component-dashboard-milestones-track
 * Background track line running between node centers.
 */
.component-dashboard-milestones-track {
  position: absolute;
  left: 2rem;
  right: 2rem;
  top: 0.9375rem;
  height: 0.125rem;
  background: var(--theme-border-primary);
  z-index: 0;
}

/*
 * .component-dashboard-milestones-progress
 * Progress line that grows from 0 to its target width when the
 * milestones stimulus controller calls animateIn(). The controller
 * reads the target width from the element's `data-width` attribute
 * and sets `style.width` at connect time.
 */
.component-dashboard-milestones-progress {
  position: absolute;
  left: 2rem;
  top: 0.9375rem;
  height: 0.125rem;
  width: 0;
  background: linear-gradient(90deg, var(--color-accent), var(--color-vivid-emerald));
  z-index: 1;
  transition: width 1s ease-out 0.6s;
}

/*
 * .component-dashboard-milestones-node
 * Single milestone cell. Starts invisible + offset; the stimulus
 * controller's animateIn() sets opacity:1 and translates it home.
 * --node-delay is set inline per node so each one fades in slightly
 * after the last.
 */
.component-dashboard-milestones-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.4s ease var(--node-delay), transform 0.4s ease var(--node-delay);
}

/*
 * .component-dashboard-milestones-node-next
 * Wrapper around the SVG gauge for the "next" milestone node. The
 * accent drop-shadow is applied here so we can use color-mix with
 * --color-accent instead of the hardcoded rgba(63, 167, 237, 0.3)
 * literal the pre-C5e HAML carried.
 */
.component-dashboard-milestones-node-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  filter: drop-shadow(0 0 0.375rem color-mix(in srgb, var(--color-accent) 30%, transparent));
}

/*
 * .component-dashboard-milestones-node-completed
 * Filled accent-to-success gradient disc used for completed milestones.
 */
.component-dashboard-milestones-node-completed {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--color-accent), var(--color-vivid-emerald));
  box-shadow: 0 0.125rem 0.25rem color-mix(in srgb, var(--color-accent) 20%, transparent);
}

.component-dashboard-milestones-node-check {
  width: 0.875rem;
  height: 0.875rem;
  color: white;
}

/*
 * .component-dashboard-milestones-node-upcoming
 * Outlined disc with a muted center dot, used for "not yet started"
 * milestones.
 */
.component-dashboard-milestones-node-upcoming {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: var(--radius-pill);
  background: var(--theme-bg-elevated);
  border: 2px solid var(--theme-border-primary);
}

.component-dashboard-milestones-node-upcoming-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--color-text-muted);
}

/*
 * .component-dashboard-milestones-label
 * Milestone label beneath each node. Paired with a status modifier
 * class (-completed/-next/-upcoming) that sets the color.
 */
.component-dashboard-milestones-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-top: calc(var(--spacing) * 2);
  text-align: center;
}

.component-dashboard-milestones-label-completed {
  color: var(--color-text-heading);
}

.component-dashboard-milestones-label-next {
  color: var(--color-accent);
}

.component-dashboard-milestones-label-upcoming {
  color: var(--color-text-muted);
}

/*
 * .component-dashboard-milestones-detail
 * Smaller detail text under the label (date / progress copy).
 */
.component-dashboard-milestones-detail {
  font-size: var(--font-size-xs);
  text-align: center;
}

.component-dashboard-milestones-detail-next {
  color: var(--color-accent);
}

.component-dashboard-milestones-detail-default {
  color: var(--color-text-muted);
}

/* ─── ClientRollup::StatusDotsComponent ─── */

/*
 * .component-client-rollup-status-dots
 * Horizontal row of tiny pill-shaped status counters.
 *
 * Used by: app/components/client_rollup/status_dots_component.html.erb
 */
.component-client-rollup-status-dots {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
}

/*
 * .component-client-rollup-status-dot
 * Structural pill layout for a status-count dot. The background
 * color is supplied by a .component-status-dot-* variant passed
 * alongside this class from StatusDotsComponent.
 *
 * Used by: app/components/client_rollup/status_dots_component.html.erb
 */
.component-client-rollup-status-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: white;
  min-width: 1.25rem;
  height: 1.25rem;
}

/* ─── ClientRollup::AllTasksComponent ─── */

/*
 * .component-client-rollup-toolbar-row
 * Horizontal toolbar row used twice inside the all-tasks view: once
 * for the search + client dropdown, once for the status + priority
 * tabs and the trailing count.
 *
 * Used by: app/components/client_rollup/all_tasks_component.html.erb
 */
.component-client-rollup-toolbar-row {
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * Search input inside the all-tasks toolbar stretches to fill the
 * remaining space next to the client filter dropdown.
 */
.component-client-rollup-toolbar-row > .component-search-input {
  flex: 1;
}

.component-client-rollup-count {
  margin-left: auto;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/*
 * .component-client-rollup-task-table-wrap
 * Rounded card-like container around the task table.
 *
 * Used by: app/components/client_rollup/all_tasks_component.html.erb
 */
.component-client-rollup-task-table-wrap {
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border-themed);
  background: var(--color-surface-primary);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ─── ClientRollup::PageComponent ─── */

/*
 * .component-client-rollup-page
 * Top-level container for the client rollup page. Sets horizontal /
 * vertical padding for the whole screen.
 *
 * Used by: app/components/client_rollup/page_component.html.erb
 */
.component-client-rollup-page {
  padding: calc(var(--spacing) * 12) var(--spacing-page-x);
}

/*
 * .component-client-rollup-page-header
 * Hero row: title + subtitle block on the left, tab selector on the
 * right. Matches the prototype's PageHeader rhythm — 40px breathing
 * room before the panel content below.
 */
.component-client-rollup-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 6);
  margin-bottom: calc(var(--spacing) * 10);
}

/* On phones the title block + tab selector can't share a row; stack them. */
@media (max-width: 40rem) {
  .component-client-rollup-page-header {
    flex-direction: column;
    align-items: stretch;
    gap: calc(var(--spacing) * 4);
  }
}

.component-client-rollup-page-heading {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.component-client-rollup-page-title {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--color-text-heading);
}

.component-client-rollup-page-subtitle {
  margin-top: calc(var(--spacing) * 2);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/*
 * .component-client-rollup-page-header-actions
 * Groups the tab selector and the Add Client button on the right of
 * the page header so they share one horizontal cluster.
 */
.component-client-rollup-page-header-actions {
  align-items: center;
  gap: calc(var(--spacing) * 4);
}

/*
 * .component-client-rollup-client-search-empty
 * Empty state shown when the Overview search filters out every client.
 */
.component-client-rollup-client-search-empty {
  padding: calc(var(--spacing) * 8) 0;
  text-align: center;
  color: var(--color-text-muted);
}

/* ─── ClientRollup::AddClientModalComponent / ClientFormComponent ─── */

.component-client-rollup-add-client-title {
  margin-bottom: calc(var(--spacing) * 6);
}

/*
 * .component-client-rollup-add-client-loading
 * Placeholder shown inside the modal while the form turbo frame loads.
 */
.component-client-rollup-add-client-loading {
  padding: calc(var(--spacing) * 8) 0;
  text-align: center;
  color: var(--color-text-muted);
}

/*
 * .component-client-rollup-add-client-section
 * One labelled group in the Add Client form (Client, Account rep,
 * Projects, Team). 24px bottom gap keeps a calm form rhythm.
 */
.component-client-rollup-add-client-section {
  margin-bottom: calc(var(--spacing) * 6);
}

/*
 * .component-client-rollup-add-client-help
 * Help line under the Projects label — sits clear of the first input.
 */
.component-client-rollup-add-client-help {
  margin-bottom: calc(var(--spacing) * 2);
}

/*
 * .component-client-rollup-add-client-section-fields
 * Vertical stack of fields inside a section — 20px field-to-field gap.
 */
.component-client-rollup-add-client-section-fields {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 5);
}

/*
 * .component-client-rollup-add-client-modes
 * The Existing/New client choice — two RadioCards side by side.
 */
.component-client-rollup-add-client-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--spacing) * 3);
}

/*
 * .component-client-rollup-add-client-mode-fields
 * The input revealed below the mode cards (account picker or name field).
 */
.component-client-rollup-add-client-mode-fields {
  margin-top: calc(var(--spacing) * 4);
}

/*
 * .component-client-rollup-add-client-role
 * One team-role row: its label stacked above the assignee dropdown.
 */
.component-client-rollup-add-client-role {
  display: flex;
  flex-direction: column;
  gap: var(--field-label-gap);
}

/*
 * .component-client-rollup-page-drawer-loading
 * Centers the spinner inside the task drawer while the turbo frame
 * is loading.
 */
.component-client-rollup-page-drawer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--spacing) * 12) 0;
}

.component-client-rollup-page-drawer-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-border-themed);
  border-top-color: var(--color-accent);
  animation: spin 1s linear infinite;
}

/* ─── ClientRollup::ClientGroupComponent ─── */

/*
 * .component-client-rollup-group
 * One client-type section on the rollup: a SectionHeaderComponent naming the
 * service line, followed by that type's client rows. The page panel is a
 * .stack-xl (32px), so sections sit twice as far apart as the rows inside one
 * — the header has no surface of its own, so proximity is what binds it to
 * its rows.
 *
 * Used by: app/components/client_rollup/client_group_component.html.erb
 */
.component-client-rollup-group {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 4);
}

/*
 * SectionHeaderComponent ships a bottom margin for sections that sit directly
 * on their content. Here the group's own gap already provides that space, so
 * the margin would double it and break the 2:1 ratio the grouping relies on.
 */
.component-client-rollup-group > .component-section-header {
  margin-bottom: 0;
}

/*
 * .component-client-rollup-group-count
 * How many clients the section holds, in the header's trailing action slot.
 * Muted so the section title keeps the emphasis, and sized to sit on the same
 * baseline as the metric labels in the rows beneath it.
 */
.component-client-rollup-group-count {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ─── ClientRollup::ClientRowComponent ─── */

/*
 * .component-client-rollup-client-row
 * Accordion card for a single client on the rollup page. Contains the
 * clickable header row and a hidden body that reveals the project list.
 *
 * Used by: app/components/client_rollup/client_row_component.html.erb
 */
.component-client-rollup-client-row {
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border-themed);
  background: var(--color-surface-primary);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.component-client-rollup-client-row-header {
  width: 100%;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
  text-align: left;
  background: transparent;
  border: none;
}

/* Focus doctrine: the shared ring on keyboard focus. Inset because the row sits
 * inside an overflow-hidden rollup shell that would clip an outer ring. */
.component-client-rollup-client-row-header:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

/*
 * .component-client-rollup-client-row-dot
 * Small round color marker on the left of the client row. The hue comes from a
 * VIA brand palette class (.component-avatar-*) computed via
 * AvatarHelper.avatar_color_class(@account.name), but the dot carries no text,
 * so it takes that class's full-strength face (--avatar-tone) rather than the
 * tint the avatar disc paints. Falls back to the muted neutral for the
 * discarded/nil variant, which has no hue.
 */
.component-client-rollup-client-row-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  background: var(--avatar-tone, var(--color-text-muted));
}

.component-client-rollup-client-row-identity {
  display: flex;
  flex-direction: column;
}

.component-client-rollup-client-row-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text-heading);
  text-decoration: none;
}

.component-client-rollup-client-row-name:hover {
  text-decoration: underline;
}

/*
 * .component-client-rollup-client-row-industry
 * Small bordered pill showing the account's industry name next to the
 * client name.
 */
.component-client-rollup-client-row-industry {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface-elevated);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-client-rollup-client-row-rep {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-client-rollup-client-row-meta
 * Right side of the client row header: metrics, alerts, status dots,
 * and chevron. Pushed to the right edge with margin-left: auto.
 */
.component-client-rollup-client-row-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 8);
}

/* Phones: the row can't hold the name + full metrics cluster on one line;
 * wrap so the metrics/alerts/status drop to their own line below the name. */
@media (max-width: 40rem) {
  .component-client-rollup-client-row-header {
    position: relative;
    flex-wrap: wrap;
    padding-right: calc(var(--spacing) * 12);
  }

  .component-client-rollup-client-row-meta {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
    gap: calc(var(--spacing) * 4);
  }

  .component-client-rollup-client-row-metrics {
    gap: calc(var(--spacing) * 6);
  }

  /* Keep the accordion caret pinned right and vertically centered across the
   * whole (wrapped) row rather than flowing to the end of the meta cluster.
   * top/bottom + margin-block:auto centers without a transform, so it doesn't
   * fight the rotate transform the accordion toggles. */
  .component-client-rollup-client-row-chevron {
    position: absolute;
    right: calc(var(--spacing) * 6);
    top: 0;
    bottom: 0;
    margin-block: auto;
  }
}

.component-client-rollup-client-row-metrics {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 8);
  font-size: var(--font-size-sm);
}

/*
 * .component-client-rollup-client-row-metric
 * A single stacked metric (value + label) in the client row meta
 * area, e.g. "5 Projects" or "12 Open Tasks".
 */
.component-client-rollup-client-row-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 3rem;
}

.component-client-rollup-client-row-metric-value {
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-client-rollup-client-row-metric-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-client-rollup-client-row-alert
 * Base alert chip used in the client row meta area, shared layout for
 * overdue and at-risk warnings. Modifiers on .component-client-rollup-client-row-alert-*
 * supply the color.
 */
.component-client-rollup-client-row-alert {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.component-client-rollup-client-row-alert-overdue {
  color: var(--color-status-text-orange);
}

.component-client-rollup-client-row-alert-at-risk {
  color: var(--color-text-danger);
}

.component-client-rollup-client-row-alert-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-client-rollup-client-row-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
  transition: transform var(--transition-timing-slow);
}

/*
 * .component-client-rollup-client-row-body
 * Hidden-by-default accordion body that reveals project rows when the
 * header is clicked. Stimulus accordion controller toggles .hidden.
 */
.component-client-rollup-client-row-body {
  border-top: 1px solid var(--color-border-subtle);
}

.component-client-rollup-client-row-body.hidden {
  display: none;
}

/* ─── ClientRollup::ProjectRowComponent ─── */

/*
 * .component-client-rollup-project-row
 * Nested accordion row for a single project inside a client row.
 *
 * Used by: app/components/client_rollup/project_row_component.html.erb
 */
.component-client-rollup-project-row {
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-client-rollup-project-row:last-child {
  border-bottom: 0;
}

.component-client-rollup-project-row-header {
  width: 100%;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 8);
  text-align: left;
  background: transparent;
  border: none;
}

.component-client-rollup-project-row-icon {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
}

.component-client-rollup-project-row-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
  text-decoration: none;
}

.component-client-rollup-project-row-name:hover {
  text-decoration: underline;
}

.component-client-rollup-project-row-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 6);
  font-size: var(--font-size-xs);
}

/* Phones: wrap the project row so the progress/hours/status/late cluster
 * drops below the project name instead of clipping. */
@media (max-width: 40rem) {
  .component-client-rollup-project-row-header {
    position: relative;
    flex-wrap: wrap;
    padding-right: calc(var(--spacing) * 12);
  }

  .component-client-rollup-project-row-stats {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  /* Caret pinned right + vertically centered across the wrapped row. */
  .component-client-rollup-project-row-chevron {
    position: absolute;
    right: calc(var(--spacing) * 6);
    top: 0;
    bottom: 0;
    margin-block: auto;
  }
}

.component-client-rollup-progress-track {
  height: 0.375rem;
  width: 5rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
  overflow: hidden;
}

/*
 * .component-client-rollup-progress-fill
 * Inner fill of a progress bar. Width is set via the --progress-width
 * CSS custom property on the element. Color is set via the on-track /
 * behind modifier classes.
 */
.component-client-rollup-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  width: var(--progress-width);
}

/*
 * .component-client-rollup-progress-bar-on-track
 * Color modifier for the progress fill when the project is on track.
 * Pairs with .component-client-rollup-progress-fill.
 */
.component-client-rollup-progress-bar-on-track {
  background: var(--color-green-mark);
}

/*
 * .component-client-rollup-progress-bar-behind
 * Color modifier for the progress fill when the project is behind.
 * Pairs with .component-client-rollup-progress-fill.
 */
.component-client-rollup-progress-bar-behind {
  background: var(--color-red-mark);
}

.component-client-rollup-progress-label {
  color: var(--color-text-muted);
}

.component-client-rollup-project-row-hours {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  color: var(--color-text-muted);
}

.component-client-rollup-project-row-hours-icon {
  width: 0.75rem;
  height: 0.75rem;
}

/*
 * .component-client-rollup-project-row-status
 * Base class for the "On Track" / "Behind" label inside the project
 * row stats. Pairs with a status color modifier.
 */
.component-client-rollup-project-row-status {
  font-weight: 500;
}

/*
 * .component-client-rollup-status-on-track
 * Color modifier that tints the status label green when the project
 * is on track.
 */
.component-client-rollup-status-on-track {
  color: var(--color-text-success);
}

/*
 * .component-client-rollup-status-behind
 * Color modifier that tints the status label red when the project
 * is behind.
 */
.component-client-rollup-status-behind {
  color: var(--color-text-danger);
}

.component-client-rollup-project-row-task-count {
  color: var(--color-text-body);
}

.component-client-rollup-project-row-late {
  font-weight: 500;
  color: var(--color-text-danger);
}

.component-client-rollup-project-row-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
  transition: transform var(--transition-timing-slow);
}

.component-client-rollup-project-row-body {
  border-top: 1px solid var(--color-border-subtle);
}

.component-client-rollup-project-row-body.hidden {
  display: none;
}

.component-client-rollup-project-row-body-inner {
  padding: 0;
}

.component-client-rollup-project-row-empty {
  padding: calc(var(--spacing) * 6) 0;
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ─── ClientRollup::TaskTableComponent ─── */

/*
 * .component-client-rollup-task-table
 * Fixed-layout table used to render task rows inside the client
 * rollup views. Column widths come from the col classes below.
 *
 * Used by: app/components/client_rollup/task_table_component.html.erb
 */
.component-client-rollup-task-table {
  width: 100%;
  table-layout: fixed;
  font-size: var(--font-size-xs);
}

/*
 * .component-client-rollup-task-table-scroll — horizontal scroller wrapping the
 * task table. On narrow screens the table keeps a legible min-width and scrolls
 * inside this container rather than crushing columns or pushing the page gutter.
 */
.component-client-rollup-task-table-scroll {
  overflow-x: auto;
}

@media (max-width: 48rem) {
  .component-client-rollup-task-table {
    min-width: 56rem;
  }
}

/*
 * .component-client-rollup-task-table-col-*
 * Column width helpers on the <col> elements inside the colgroup.
 * Replaces inline width styles from the prior HAML template.
 */
.component-client-rollup-task-table-col-task { width: 20%; }
.component-client-rollup-task-table-col-task-wide { width: 30%; }
.component-client-rollup-task-table-col-client { width: 10%; }
.component-client-rollup-task-table-col-project { width: 10%; }
.component-client-rollup-task-table-col-assignee { width: 10%; }
.component-client-rollup-task-table-col-status { width: 10%; }
.component-client-rollup-task-table-col-type { width: 10%; }
.component-client-rollup-task-table-col-due { width: 8%; }
.component-client-rollup-task-table-col-hours { width: 12%; }
.component-client-rollup-task-table-col-priority { width: 10%; }

.component-client-rollup-task-table-head-row {
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.component-client-rollup-task-table-th {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-client-rollup-task-table-row {
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-client-rollup-project-row-body .component-client-rollup-task-table-row:last-child {
  border-bottom: none;
}

.component-client-rollup-task-table-cell {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
}

/*
 * Project-row context: bump first-column padding-left to 48px and
 * last-column padding-right to 32px so the nested task table reads
 * as indented from its parent project header (which sits at 32px).
 * Standalone task tables (All Tasks tab) keep the default 16px cell
 * padding on the edges.
 */
.component-client-rollup-project-row-body .component-client-rollup-task-table-th:first-child,
.component-client-rollup-project-row-body .component-client-rollup-task-table-cell:first-child {
  padding-left: calc(var(--spacing) * 12);
}

.component-client-rollup-project-row-body .component-client-rollup-task-table-th:last-child,
.component-client-rollup-project-row-body .component-client-rollup-task-table-cell:last-child {
  padding-right: calc(var(--spacing) * 8);
}

.component-client-rollup-task-table-cell-muted {
  color: var(--color-text-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-client-rollup-task-table-cell-tag {
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-client-rollup-task-table-title {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  min-width: 0;
}

/*
 * .component-client-rollup-task-table-priority-dot
 * 6px priority dot before the task title. Color comes from a
 * .component-priority-dot-* variant passed alongside this class.
 */
.component-client-rollup-task-table-priority-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.component-client-rollup-task-table-title-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-client-rollup-task-table-assignee {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  min-width: 0;
}

.component-client-rollup-task-table-assignee-name {
  color: var(--color-text-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .component-client-rollup-task-table-due
 * Base class for the due-date chip. Pairs with a due-class modifier.
 */
.component-client-rollup-task-table-due {
  font-weight: 500;
}

/*
 * .component-client-rollup-due-overdue
 * Color modifier tinting the due chip red when the task is overdue.
 */
.component-client-rollup-due-overdue {
  color: var(--color-text-danger);
}

/*
 * .component-client-rollup-due-normal
 * Color modifier for a due chip on a task that is on schedule.
 */
.component-client-rollup-due-normal {
  color: var(--color-text-body);
}

/*
 * .component-client-rollup-due-blank
 * Color modifier for a due chip when the task has no due date set.
 */
.component-client-rollup-due-blank {
  color: var(--color-text-muted);
}

.component-client-rollup-task-table-hours-text {
  color: var(--color-text-body);
}

.component-client-rollup-task-table-hours-track {
  margin-top: calc(var(--spacing) * 1);
  height: 0.125rem;
  width: 3.5rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
  overflow: hidden;
}

/*
 * .component-client-rollup-task-table-hours-fill
 * Inner fill of the per-row hours progress bar. Width is set via the
 * --hours-width CSS custom property; color comes from the hours-bar
 * modifier class.
 */
.component-client-rollup-task-table-hours-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  width: var(--hours-width);
}

/*
 * .component-client-rollup-hours-bar-ok
 * Green hours-bar fill when time spent is <=75% of estimated.
 */
.component-client-rollup-hours-bar-ok {
  background: var(--color-green-mark);
}

/*
 * .component-client-rollup-hours-bar-warning
 * Orange hours-bar fill when time spent is 76-100% of estimated.
 */
.component-client-rollup-hours-bar-warning {
  background: var(--color-orange-mark);
}

/*
 * .component-client-rollup-hours-bar-critical
 * Red hours-bar fill when time spent has exceeded estimated.
 */
.component-client-rollup-hours-bar-critical {
  background: var(--color-red-mark);
}

/*
 * .component-client-rollup-task-table-priority
 * Priority label in the last task-table column. Wrapper class for a
 * .component-priority-text-* color variant passed alongside.
 */
.component-client-rollup-task-table-priority {
  font-weight: 500;
}

/* ─── C5f shared task-status / priority / capacity / hours-bar / status-pill classes ─── */

/*
 * .component-status-text-{in-queue,in-progress,blocked,qc,client-review,completed}
 * Task status text color variants. Pair with any inline element that
 * renders a task status as text without a badge background.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb,
 *   app/components/team_capacity/task_table_component.html.erb,
 *   app/components/client_rollup/task_table_component.html.erb
 * Reuse when: rendering a task status as inline text across task tables.
 * Do NOT use for: badge backgrounds (use .component-badge-status-*).
 */
.component-status-text-in-queue {
  color: var(--color-text-muted);
}

.component-status-text-in-progress {
  color: var(--color-accent);
}

.component-status-text-blocked {
  color: var(--color-task-rose);
}

.component-status-text-qc {
  color: var(--color-status-text-yellow);
}

.component-status-text-client-review {
  color: var(--color-status-text-purple);
}

.component-status-text-completed {
  color: var(--color-status-text-green);
}

/*
 * .component-priority-text-{high,medium,low}
 * Task priority text color variants. Pair with any inline element
 * that renders a priority value as text without a badge background.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb,
 *   app/components/client_rollup/task_table_component.html.erb
 * Reuse when: rendering a task priority as inline text.
 * Do NOT use for: badge backgrounds (use .component-badge-priority-*).
 */
.component-priority-text-high {
  color: var(--color-status-text-red);
}

.component-priority-text-medium {
  color: var(--color-status-text-orange);
}

.component-priority-text-low {
  color: var(--color-text-muted);
}

/*
 * .component-priority-dot-{high,medium,low}
 * Solid background fill for a task-priority indicator dot. Caller
 * owns the element's shape (size, border-radius); this variant only
 * supplies the fill color.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb,
 *   app/components/team_capacity/task_table_component.html.erb,
 *   app/components/client_rollup/task_table_component.html.erb
 * Reuse when: marking task priority as a colored dot or circle.
 * Do NOT use for: text color or badge backgrounds.
 */
.component-priority-dot-high {
  background: var(--color-red-mark);
}

.component-priority-dot-medium {
  background: var(--color-orange-mark);
}

.component-priority-dot-low {
  background: var(--color-gray-400);
}

/*
 * .component-status-dot-{in-queue,in-progress,blocked,qc,client-review,completed}
 * Solid background fill for a task-status indicator dot. Caller owns
 * the element's shape; this variant only supplies the fill color.
 *
 * Used by: app/components/client_rollup/status_dots_component.html.erb
 * Reuse when: visualizing task-status distribution as colored dots.
 * Do NOT use for: badge backgrounds (use .component-badge-status-*).
 */
.component-status-dot-in-queue {
  background: var(--color-gray-400);
}

.component-status-dot-in-progress {
  background: var(--color-accent);
}

.component-status-dot-blocked {
  background: var(--color-task-rose);
}

.component-status-dot-qc {
  background: var(--color-yellow-mark);
}

.component-status-dot-client-review {
  background: var(--color-purple-mark);
}

.component-status-dot-completed {
  background: var(--color-green-mark);
}

/*
 * .component-due-text-{normal,overdue,blank}
 * Text color variants for task due-date labels — blank when the task
 * has no due date, overdue when it has passed, normal otherwise.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb,
 *   app/components/team_capacity/task_table_component.html.erb
 * Reuse when: rendering a due-date value whose color reflects overdue state.
 * Do NOT use for: unrelated date labels.
 */
.component-due-text-normal {
  color: var(--color-text-body);
}

.component-due-text-overdue {
  color: var(--color-text-danger);
}

.component-due-text-blank {
  color: var(--color-text-muted);
}

/*
 * .component-hours-bar-track
 * Background track of a task hours-progress bar. Pairs with
 * .component-hours-bar-fill for the filled portion.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: a task's spent/estimated hours ratio is visualized
 *   inline in a tight row.
 * Do NOT use for: unrelated progress bars (use a dedicated primitive
 *   or the milestone progress classes).
 */
.component-hours-bar-track {
  position: relative;
  width: 4rem;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
  flex-shrink: 0;
  overflow: hidden;
}

/*
 * .component-hours-bar-fill
 * Filled portion of a task hours-progress bar. Consumes the
 * --hours-bar-width CSS custom property for the per-task fill width
 * (falls back to 0% if unset). Must be paired with a
 * .component-hours-bar-{safe,warning,critical} variant for color.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with .component-hours-bar-track.
 * Do NOT use for: unrelated progress fills.
 */
.component-hours-bar-fill {
  height: 100%;
  width: var(--hours-bar-width, 0%);
  border-radius: var(--radius-pill);
  transition: width 0.15s ease-out;
}

/*
 * .component-hours-bar-{safe,warning,critical}
 * Color variant for the hours-progress bar fill. safe = ≤75% of
 * estimated, warning = 76–100%, critical = over budget.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: applied to a .component-hours-bar-fill element.
 * Do NOT use for: text color or non-progress backgrounds.
 */
.component-hours-bar-safe {
  background: var(--color-green-mark);
}

.component-hours-bar-warning {
  background: var(--color-orange-mark);
}

.component-hours-bar-critical {
  background: var(--color-red-mark);
}

/*
 * .component-status-pill
 * Base inline pill wrapper for an email-campaign deployment status.
 * Pairs with .component-status-pill-{queued,in-progress,finished,canceled}
 * for background + text color.
 *
 * Used by: app/components/email_campaigns/status_pill_component.html.erb
 * Reuse when: rendering an email-campaign status label inline.
 * Do NOT use for: task status (use .component-badge-status-*).
 */
.component-status-pill {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-xs);
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.25;
}

.component-status-pill-queued {
  background: color-mix(in srgb, var(--color-gray-400) 20%, transparent);
  color: var(--color-text-body);
}

.component-status-pill-in-progress {
  background: color-mix(in srgb, var(--color-yellow) 18%, transparent);
  color: var(--color-status-text-yellow);
}

.component-status-pill-finished {
  background: color-mix(in srgb, var(--color-green) 18%, transparent);
  color: var(--color-status-text-green);
}

.component-status-pill-canceled {
  background: color-mix(in srgb, var(--color-red) 18%, transparent);
  color: var(--color-status-text-red);
}

/*
 * .component-capacity-bar-{safe,warning,critical}
 * Background color for a team-capacity fill bar. Thresholds come from
 * TeamCapacity::Concerns::CapacityColoring: safe = below 50%,
 * warning = 50–79%, critical = 80% or higher.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb,
 *   app/components/team_capacity/member_card_component.html.erb,
 *   app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: coloring a fill bar backed by CapacityColoring.
 * Do NOT use for: text color (use .component-capacity-text-*).
 */
.component-capacity-bar-safe {
  background: var(--color-green-mark);
}

.component-capacity-bar-warning {
  background: var(--color-accent);
}

.component-capacity-bar-critical {
  background: var(--color-red-mark);
}

/*
 * .component-capacity-text-{safe,warning,critical}
 * Text color variant matching the .component-capacity-bar-* bar colors,
 * for percentage labels that should read alongside a bar.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb,
 *   app/components/team_capacity/member_card_component.html.erb,
 *   app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: a capacity label should match its paired bar color.
 * Do NOT use for: backgrounds (use .component-capacity-bar-*).
 */
.component-capacity-text-safe {
  color: var(--color-status-text-green);
}

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

.component-capacity-text-critical {
  color: var(--color-status-text-red);
}

/* ─── C5f data_sources/* domain classes ─── */

/*
 * .component-data-sources-card
 * Image-led card for a database listing row. Full-bleed lifestyle
 * photo, fade-to-black gradient at the bottom, and a content overlay
 * anchored bottom-left with eyebrow + title + description + meta and
 * an optional column of frosted tag chips on the right. The whole
 * card is a clickable link; on hover the card lifts and the shadow
 * gains a colored glow keyed to --hero (the database's hero color).
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card {
  position: relative;
  display: block;
  height: 20rem;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--color-black);
  color: var(--color-white);
  text-decoration: none;
  transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}

.component-data-sources-card:hover {
  transform: translateY(-0.1875rem);
  box-shadow:
    0 1.125rem 2.75rem -0.75rem color-mix(in srgb, var(--hero, var(--color-accent)) 40%, transparent),
    0 0.25rem 0.75rem -0.25rem color-mix(in srgb, var(--hero, var(--color-accent)) 26%, transparent);
}

/*
 * .component-data-sources-card-photo
 * Full-bleed background photo for the card. Centered crop biased
 * toward the upper half so faces and focal points stay visible
 * when the overlay covers the bottom third.
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 35%);
}

/*
 * .component-data-sources-card-gradient
 * Vertical fade-to-black overlay that anchors the white text on
 * the lower half of the card. Same falloff used on the show-page
 * hero so the two read as the same family.
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card-gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-black) 0%, transparent) 0%,
    color-mix(in srgb, var(--color-black) 35%, transparent) 40%,
    color-mix(in srgb, var(--color-black) 85%, transparent) 75%,
    var(--color-black) 100%
  );
}

/*
 * .component-data-sources-card-overlay
 * The bottom-anchored content layer above the photo + gradient.
 * Holds the body column on the left and the optional tag chip
 * column on the right.
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card-overlay {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: calc(var(--spacing) * 7);
}

.component-data-sources-card-overlay-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: calc(var(--spacing) * 6);
}

.component-data-sources-card-overlay-body {
  min-width: 0;
  flex: 1;
}

/*
 * .component-data-sources-card-eyebrow
 * Frosted-glass record-count pill above the title. The background
 * and border carry a --hero tint so each database keeps its identity
 * accent, but the text stays white for legibility over the photo —
 * saturated colors fail WCAG contrast at this size. Matches the
 * frosted-glass tag chips on the same card.
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  margin-bottom: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2.5);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--hero, var(--color-accent)) 30%, transparent);
  border: 1px solid color-mix(in srgb, var(--hero, var(--color-accent)) 50%, transparent);
  color: var(--color-white);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  backdrop-filter: blur(0.5rem);
  -webkit-backdrop-filter: blur(0.5rem);
  text-shadow: 0 0.0625rem 0.375rem color-mix(in srgb, var(--color-black) 55%, transparent);
}

/*
 * .component-data-sources-card-title
 * Database name + "Database" suffix shown over the photo. Uses h2
 * typography clamped down so it fits inside the bottom third of
 * the card on every viewport. Drop shadow keeps it readable when
 * the photo behind happens to be light.
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card-title {
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.022em;
  font-weight: 600;
  color: var(--color-white);
  text-shadow: 0 0.125rem 0.75rem color-mix(in srgb, var(--color-black) 50%, transparent);
}

/*
 * .component-data-sources-card-description
 * Short single-paragraph summary under the title.
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card-description {
  margin-top: calc(var(--spacing) * 2);
  max-width: 60ch;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: color-mix(in srgb, var(--color-white) 85%, transparent);
  text-shadow: 0 0.0625rem 0.375rem color-mix(in srgb, var(--color-black) 60%, transparent);
}

/*
 * .component-data-sources-card-meta
 * Inline meta row below the description with category count,
 * field count, and updated-ago text.
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card-meta {
  margin-top: calc(var(--spacing) * 4);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 2) calc(var(--spacing) * 5);
  font-size: var(--font-size-xs);
  color: color-mix(in srgb, var(--color-white) 85%, transparent);
}

.component-data-sources-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  white-space: nowrap;
}

.component-data-sources-card-meta-icon {
  width: 0.75rem;
  height: 0.75rem;
  color: color-mix(in srgb, var(--color-white) 70%, transparent);
}

.component-data-sources-card-meta-divider {
  color: color-mix(in srgb, var(--color-white) 65%, transparent);
  white-space: nowrap;
}

/*
 * .component-data-sources-card-tags
 * Right-anchored vertical column of frosted-glass tag chips.
 * Hidden below lg viewport widths where the photo card collapses
 * to a vertical layout.
 *
 * Used by: app/components/data_sources/card_component.html.erb
 */
.component-data-sources-card-tags {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: calc(var(--spacing) * 1.5);
  flex-shrink: 0;
}

@media (min-width: 64rem) {
  .component-data-sources-card-tags {
    display: flex;
  }
}

.component-data-sources-card-tag {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2.5);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-white) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-white) 18%, transparent);
  color: color-mix(in srgb, var(--color-white) 92%, transparent);
  font-size: var(--font-size-xs);
  font-weight: 500;
  backdrop-filter: blur(0.5rem);
  -webkit-backdrop-filter: blur(0.5rem);
}

.component-data-sources-card-tag-extra {
  color: color-mix(in srgb, var(--color-white) 70%, transparent);
  font-size: var(--font-size-xs);
}

/*
 * .component-data-sources-config-form-card — max-width modifier for cards
 * inside the config form.
 *
 * Used by: app/components/data_sources/config_form_component.html.erb
 * Reuse when: another config-form card needs the same max-width.
 * Do NOT use for: cards outside this form.
 */
.component-data-sources-config-form-card {
  max-width: 42rem;
}

/*
 * .component-data-sources-config-form-common-row — horizontal row of
 * (label, select) for the common-field-mapping section.
 *
 * Used by: app/components/data_sources/config_form_component.html.erb
 * Reuse when: same label-select row pattern in this form.
 * Do NOT use for: general form rows.
 */
.component-data-sources-config-form-common-row {
  padding: calc(var(--spacing) * 1) 0;
}

/*
 * .component-data-sources-config-form-common-label — right-aligned fixed
 * label column for the common-field-mapping row.
 *
 * Used by: app/components/data_sources/config_form_component.html.erb
 * Reuse when: same label column in another row.
 * Do NOT use for: general labels.
 */
.component-data-sources-config-form-common-label {
  width: 18rem;
  text-align: right;
}

/*
 * .component-data-sources-config-form-fields-list — divider-separated
 * list of field-form rows inside the Fields card.
 *
 * Used by: app/components/data_sources/config_form_component.html.erb
 * Reuse when: same divider list in this form.
 * Do NOT use for: general divided lists.
 */
.component-data-sources-config-form-fields-list > * + * {
  border-top: 1px solid var(--color-border-subtle);
}

/*
 * .component-data-sources-field-form — horizontal row of (column name,
 * display name, input type) for configuring a single field inside the
 * Fields card. Full-bleed into the card padding via negative side margins.
 * First/last variants tighten the top/bottom padding at the edges of the
 * divider list.
 *
 * Used by: app/components/data_sources/field_form_component.html.erb
 * Reuse when: same full-bleed row pattern inside this form.
 * Do NOT use for: general form rows.
 */
.component-data-sources-field-form {
  display: flex;
  gap: calc(var(--spacing) * 4);
  margin-left: calc(var(--spacing) * -8);
  margin-right: calc(var(--spacing) * -8);
  padding: calc(var(--spacing) * 8);
}

.component-data-sources-field-form:first-child {
  padding-top: 0;
}

.component-data-sources-field-form:last-child {
  padding-bottom: calc(var(--spacing) * 2);
}

/*
 * .component-data-sources-field-form-col — single flex-1 column within
 * the field-form row.
 *
 * Used by: app/components/data_sources/field_form_component.html.erb
 * Reuse when: same column inside this form.
 * Do NOT use for: general form columns.
 */
.component-data-sources-field-form-col {
  flex: 1 1 0%;
}

/*
 * .component-data-sources-field-form-label — bold label above each input
 * in the field-form row.
 *
 * Used by: app/components/data_sources/field_form_component.html.erb
 * Reuse when: same bold label in this form.
 * Do NOT use for: general labels.
 */
.component-data-sources-field-form-label {
  display: block;
  font-weight: 700;
  line-height: 1.25rem;
}

/*
 * .component-data-sources-field-form-display — read-only pseudo-field
 * showing the DB column name. Shares .component-form-field padding/border
 * via composition and paints a muted background for immutability.
 *
 * Used by: app/components/data_sources/field_form_component.html.erb
 * Reuse when: another read-only field display in this form.
 * Do NOT use for: editable inputs (use text_field_tag with field_classes).
 */
.component-data-sources-field-form-display {
  background: var(--color-surface-elevated);
}

/*
 * .component-data-sources-layout — outermost wrapper for the data source
 * layout (field) view that hosts the data-sources--layout-search Stimulus
 * controller.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: building another search-enabled layout wrapper in this area.
 * Do NOT use for: general search wrappers.
 */
.component-data-sources-layout {
  display: block;
}

/*
 * .component-data-sources-layout-header — sticky-style header bar above
 * the field list with a legend and a search input.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same header pattern in a sibling layout variant.
 * Do NOT use for: general page headers.
 */
.component-data-sources-layout-header {
  background: var(--color-surface-primary);
  border-bottom: 1px solid var(--color-border-subtle);
}

/*
 * .component-data-sources-layout-header-row — flex row of legend and
 * search within the layout header.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same header row pattern.
 * Do NOT use for: general header rows.
 */
.component-data-sources-layout-header-row {
  justify-content: space-between;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 2) calc(var(--spacing) * 2) calc(var(--spacing) * 6);
}

/*
 * .component-data-sources-layout-legend — inline legend with two
 * (icon, label) pairs explaining selectable vs output-only fields.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: another legend with the same pattern.
 * Do NOT use for: generic inline lists.
 */
.component-data-sources-layout-legend {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 6);
  font-size: var(--font-size-sm);
}

/*
 * .component-data-sources-layout-legend-icon-selectable — icon glyph
 * representing a selectable field inside the legend (accent color).
 *
 * Used by: app/components/data_sources/layout_component.html.erb,
 *   app/components/data_sources/layout_field_component.rb (field_icon)
 * Reuse when: same "selectable" semantics.
 * Do NOT use for: general accent icons.
 */
.component-data-sources-layout-legend-icon-selectable {
  width: 1rem;
  height: 1rem;
  color: var(--color-accent);
}

/*
 * .component-data-sources-layout-legend-icon-output — icon glyph
 * representing an output-only field inside the legend (muted color).
 *
 * Used by: app/components/data_sources/layout_component.html.erb,
 *   app/components/data_sources/layout_field_component.rb (field_icon)
 * Reuse when: same "output-only" semantics.
 * Do NOT use for: general muted icons.
 */
.component-data-sources-layout-legend-icon-output {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
}

/*
 * .component-data-sources-layout-legend-label — muted text label next to
 * the legend icon.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same legend pattern.
 * Do NOT use for: general labels.
 */
.component-data-sources-layout-legend-label {
  color: var(--color-text-body);
}

/*
 * .component-data-sources-layout-search — wrapper around the search
 * input that allows it to flex-fill up to a max width.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same search-box sizing in this area.
 * Do NOT use for: general search boxes.
 */
.component-data-sources-layout-search {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  flex: 1 1 auto;
  max-width: 28rem;
}

/*
 * .component-data-sources-layout-search-input-wrap — inner relative
 * wrapper enabling absolute positioning of the clear button.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same clear-button positioning.
 * Do NOT use for: general inputs.
 */
.component-data-sources-layout-search-input-wrap {
  position: relative;
  flex: 1 1 auto;
}

/*
 * .component-data-sources-layout-search-input — search text input
 * inside the layout header.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same search input in a sibling variant.
 * Do NOT use for: general text inputs (use Forms::FieldComponent).
 */
.component-data-sources-layout-search-input {
  width: 100%;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 8) calc(var(--spacing) * 4) calc(var(--spacing) * 4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-xs);
  background: var(--color-surface-input);
  color: var(--color-text-input);
}

.component-data-sources-layout-search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

/*
 * .component-data-sources-layout-search-clear — absolutely-positioned
 * clear button inside the search input. Hidden by default, Stimulus
 * toggles .hidden when the input has content.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same clear-button pattern.
 * Do NOT use for: general clear buttons.
 */
.component-data-sources-layout-search-clear {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  padding: 0 calc(var(--spacing) * 4);
  color: var(--color-text-muted);
  cursor: pointer;
  background: transparent;
  border: 0;
}

.component-data-sources-layout-search-clear:hover {
  color: var(--color-text-body);
}

/*
 * .component-data-sources-layout-search-clear-icon — glyph inside the
 * clear button.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same clear-button glyph.
 * Do NOT use for: other icons.
 */
.component-data-sources-layout-search-clear-icon {
  width: 1rem;
  height: 1rem;
}

/*
 * .component-data-sources-layout-table-wrap — horizontal scroll wrapper
 * around the layout field table.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same scroll wrapper.
 * Do NOT use for: general scrolling.
 */
.component-data-sources-layout-table-wrap {
  overflow-x: auto;
}

/*
 * .component-data-sources-layout-table — field listing table inside
 * the layout view. Two columns of (name, values).
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same field-listing pattern.
 * Do NOT use for: general tables.
 */
.component-data-sources-layout-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
}

/*
 * .component-data-sources-layout-category-row — category header row
 * that groups field rows. Clickable to expand/collapse via Stimulus.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same grouping pattern.
 * Do NOT use for: regular table rows.
 */
.component-data-sources-layout-category-row {
  background: var(--color-surface-elevated);
  user-select: none;
  border-top: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
}

/*
 * .component-data-sources-layout-category-cell — full-bleed td inside a
 * category row (colspan=2).
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same category row pattern.
 * Do NOT use for: general td cells.
 */
.component-data-sources-layout-category-cell {
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
}

/*
 * .component-data-sources-layout-category-inner — flex inside the
 * category cell hosting the chevron and category name.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same chevron+name row.
 * Do NOT use for: general rows.
 */
.component-data-sources-layout-category-inner {
  display: flex;
  align-items: center;
}

/*
 * .component-data-sources-layout-category-icon — chevron glyph inside
 * the category row. Rotates via .rotate-90 applied by Stimulus.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same rotating chevron pattern.
 * Do NOT use for: other chevrons.
 */
.component-data-sources-layout-category-icon {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
  transition: transform 0.15s ease-out;
}

/*
 * .component-data-sources-layout-category-name — category label text
 * inside the category row.
 *
 * Used by: app/components/data_sources/layout_component.html.erb
 * Reuse when: same category label pattern.
 * Do NOT use for: general headings.
 */
.component-data-sources-layout-category-name {
  margin-left: calc(var(--spacing) * 2);
  font-weight: 600;
  color: var(--color-text-body);
}

/*
 * .component-data-sources-layout-field-row — individual field row
 * inside the layout table. Hidden by default; Stimulus removes .hidden
 * on category expand or search match.
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same field row pattern.
 * Do NOT use for: general table rows.
 */
.component-data-sources-layout-field-row {
  border-bottom: 1px solid var(--color-border-subtle);
}

/*
 * .component-data-sources-layout-field-name-cell — left td of the
 * field row (takes half the width).
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same cell pattern.
 * Do NOT use for: general cells.
 */
.component-data-sources-layout-field-name-cell {
  width: 50%;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
}

/*
 * .component-data-sources-layout-field-name-icon-selectable — icon used
 * on a selectable-field row (accent color, small glyph).
 *
 * Used by: app/components/data_sources/layout_field_component.rb
 *   (returned by #field_icon)
 * Reuse when: same selectable semantics in a sibling variant.
 * Do NOT use for: output-only rows (use -icon-output variant).
 */
.component-data-sources-layout-field-name-icon-selectable {
  width: 1rem;
  height: 1rem;
  color: var(--color-accent);
}

/*
 * .component-data-sources-layout-field-name-icon-output — icon used on
 * an output-only field row (muted color, small glyph).
 *
 * Used by: app/components/data_sources/layout_field_component.rb
 *   (returned by #field_icon)
 * Reuse when: same output-only semantics in a sibling variant.
 * Do NOT use for: selectable rows (use -icon-selectable variant).
 */
.component-data-sources-layout-field-name-icon-output {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
}

/*
 * .component-data-sources-layout-field-name — display name text in
 * the field name cell.
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same display-name pattern.
 * Do NOT use for: general headings.
 */
.component-data-sources-layout-field-name {
  color: var(--color-text-heading);
}

/*
 * .component-data-sources-layout-field-values-cell — right td of the
 * field row (values preview).
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same cell pattern.
 * Do NOT use for: general cells.
 */
.component-data-sources-layout-field-values-cell {
  width: 50%;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
}

/*
 * .component-data-sources-layout-field-values-inner — muted text color
 * wrapper inside the values cell.
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same treatment for another values preview.
 * Do NOT use for: general muted text.
 */
.component-data-sources-layout-field-values-inner {
  color: var(--color-text-muted);
}

/*
 * .component-data-sources-layout-field-values-list — vertical list of
 * individual values inside the values preview.
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same list inside this preview.
 * Do NOT use for: general lists.
 */
.component-data-sources-layout-field-values-list {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1);
}

/*
 * .component-data-sources-layout-field-value — single value inside the
 * values list. Prevents wrapping so long strings ellipsize cleanly.
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same single-value treatment.
 * Do NOT use for: general rows.
 */
.component-data-sources-layout-field-value {
  white-space: nowrap;
}

/*
 * .component-data-sources-layout-field-show-more-wrap — wrapper below
 * the value list hosting the show-more / show-less toggle buttons.
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same toggle pattern.
 * Do NOT use for: general button rows.
 */
.component-data-sources-layout-field-show-more-wrap {
  margin-top: calc(var(--spacing) * 2);
}

/*
 * .component-data-sources-layout-field-show-more-button — show-more /
 * show-less text button with accent color and underline-on-hover.
 *
 * Used by: app/components/data_sources/layout_field_component.html.erb
 * Reuse when: same text-button treatment.
 * Do NOT use for: general buttons.
 */
.component-data-sources-layout-field-show-more-button {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--color-accent);
  cursor: pointer;
}

.component-data-sources-layout-field-show-more-button:hover {
  text-decoration: underline;
}

/* ─── C5f vendor_lists/* domain classes ─── */

/*
 * .component-vendor-lists-attachments-header — header row above the
 * attachments list with a title and an upload-file label.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: another vendor-lists header row with the same title+action
 *   layout.
 * Do NOT use for: general headers.
 */
.component-vendor-lists-attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-vendor-lists-attachments-upload-form — inline form wrapping
 * the upload label and file input.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same inline upload form pattern.
 * Do NOT use for: standard forms.
 */
.component-vendor-lists-attachments-upload-form {
  display: inline;
}

/*
 * .component-vendor-lists-attachments-upload-label — clickable label that
 * triggers the visually-hidden file input.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same label-as-button pattern.
 * Do NOT use for: general labels.
 */
.component-vendor-lists-attachments-upload-label {
  font-size: var(--font-size-sm);
  color: var(--color-accent);
  cursor: pointer;
}

.component-vendor-lists-attachments-upload-label:hover {
  text-decoration: underline;
}

/*
 * .component-vendor-lists-attachments-item — single attachment row with
 * file info and action buttons.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same row pattern.
 * Do NOT use for: general rows.
 */
.component-vendor-lists-attachments-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 4);
  background: var(--color-surface-elevated);
  border-radius: var(--radius-xs);
}

/*
 * .component-vendor-lists-attachments-item-info — left side of an
 * attachment row with icon + filename + size.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same info-block pattern.
 * Do NOT use for: general info rows.
 */
.component-vendor-lists-attachments-item-info {
  flex: 1 1 auto;
  min-width: 0;
}

/*
 * .component-vendor-lists-attachments-item-icon — paperclip glyph to the
 * left of the filename.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same glyph pattern in this area.
 * Do NOT use for: general icons.
 */
.component-vendor-lists-attachments-item-icon {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/*
 * .component-vendor-lists-attachments-item-text — stacked wrapper around
 * filename and size so they truncate cleanly.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same text stack pattern.
 * Do NOT use for: general text stacks.
 */
.component-vendor-lists-attachments-item-text {
  flex: 1 1 auto;
  min-width: 0;
}

/*
 * .component-vendor-lists-attachments-item-name — filename text.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same filename treatment.
 * Do NOT use for: general text.
 */
.component-vendor-lists-attachments-item-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*
 * .component-vendor-lists-attachments-item-size — human-readable file size
 * text beneath the filename.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same size treatment.
 * Do NOT use for: general text.
 */
.component-vendor-lists-attachments-item-size {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-vendor-lists-attachments-item-action-download — download link
 * (accent color) in the attachment action cluster.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same download link pattern.
 * Do NOT use for: general links.
 */
.component-vendor-lists-attachments-item-action-download {
  color: var(--color-accent);
}

.component-vendor-lists-attachments-item-action-download:hover {
  color: var(--color-accent-hover);
}

/*
 * .component-vendor-lists-attachments-item-action-delete — delete button
 * (red color) in the attachment action cluster.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same delete button pattern.
 * Do NOT use for: general buttons.
 */
.component-vendor-lists-attachments-item-action-delete {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--color-text-danger);
  cursor: pointer;
}

.component-vendor-lists-attachments-item-action-delete:hover {
  color: var(--color-text-danger-hover);
}

/*
 * .component-vendor-lists-attachments-item-action-delete-form — inline
 * form wrapper generated by button_to for the delete action.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same button_to form wrapper pattern.
 * Do NOT use for: general forms.
 */
.component-vendor-lists-attachments-item-action-delete-form {
  display: inline-flex;
  align-items: center;
}

/*
 * .component-vendor-lists-attachments-action-icon — small glyph used
 * inside the download and delete action buttons.
 *
 * Used by: app/components/vendor_lists/attachments_component.html.erb
 * Reuse when: same glyph size in the same action cluster.
 * Do NOT use for: general icons.
 */
.component-vendor-lists-attachments-action-icon {
  width: 1rem;
  height: 1rem;
}

/*
 * .component-vendor-lists-modal-header — top row inside the fail-QC
 * and reject modals with an icon, title, and description. Wraps in
 * responsive flex layout (icon left, text right on small+).
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: another vendor-lists modal with the same error header.
 * Do NOT use for: general modal headers.
 */
.component-vendor-lists-modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: calc(var(--spacing) * 4);
}

@media (min-width: 40rem) {
  .component-vendor-lists-modal-header {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
    gap: calc(var(--spacing) * 4);
  }
}

/*
 * .component-vendor-lists-modal-icon-wrap — circular red wrapper for the
 * exclamation glyph in the modal header.
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: same circle-icon pattern in another vendor-lists modal.
 * Do NOT use for: general icon wrappers.
 */
.component-vendor-lists-modal-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-red-light) 20%, transparent);
  flex-shrink: 0;
}

@media (min-width: 40rem) {
  .component-vendor-lists-modal-icon-wrap {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/*
 * .component-vendor-lists-modal-icon — red exclamation glyph inside the
 * circular wrapper.
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: same glyph pattern.
 * Do NOT use for: general icons.
 */
.component-vendor-lists-modal-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-text-danger);
}

/*
 * .component-vendor-lists-modal-heading — right-side wrapper in the modal
 * header holding the title and description.
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: same heading wrapper pattern.
 * Do NOT use for: general headings.
 */
.component-vendor-lists-modal-heading {
  flex: 1 1 auto;
}

/*
 * .component-vendor-lists-modal-title — bold modal heading.
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: same heading treatment.
 * Do NOT use for: general headings.
 */
.component-vendor-lists-modal-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text-heading);
}

/*
 * .component-vendor-lists-modal-description-wrap — gap between title
 * and description with right-side indent to balance the close-button
 * bleed.
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: same description row pattern.
 * Do NOT use for: general descriptions.
 */
.component-vendor-lists-modal-description-wrap {
  margin-top: calc(var(--spacing) * 1);
  margin-right: calc(var(--spacing) * 8);
}

/*
 * .component-vendor-lists-modal-description — muted description text
 * beneath the modal title.
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: same description pattern.
 * Do NOT use for: general paragraphs.
 */
.component-vendor-lists-modal-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/*
 * .component-vendor-lists-modal-field-wrap — spacing above the reason
 * text area inside the form.
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: same field spacing.
 * Do NOT use for: general form spacing.
 */
.component-vendor-lists-modal-field-wrap {
  padding-top: calc(var(--spacing) * 8);
}

/*
 * .component-vendor-lists-modal-actions — right-aligned button row at the
 * bottom of the modal.
 *
 * Used by: app/components/vendor_lists/fail_qc_modal_component.html.erb,
 *   app/components/vendor_lists/reject_modal_component.html.erb
 * Reuse when: same modal action row.
 * Do NOT use for: general button rows.
 */
.component-vendor-lists-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: calc(var(--spacing) * 2);
  margin-top: calc(var(--spacing) * 4);
}

/*
 * .component-vendor-lists-status — inline-flex wrapper around a vendor
 * list status indicator (icon + text).
 *
 * Used by: app/components/vendor_lists/status_component.html.erb
 * Reuse when: same inline status indicator.
 * Do NOT use for: general inline rows.
 */
.component-vendor-lists-status {
  display: inline-flex;
  align-items: center;
  line-height: 1.25rem;
}

/*
 * .component-vendor-lists-status-icon — base sizing for the status icon.
 * Paired with a .component-vendor-lists-status-icon-{semantic} modifier
 * returned by VendorLists::StatusComponent#badge_class.
 *
 * Used by: app/components/vendor_lists/status_component.html.erb
 * Reuse when: same icon sizing.
 * Do NOT use for: general icons.
 */
.component-vendor-lists-status-icon {
  width: 1rem;
  height: 1rem;
}

/*
 * .component-vendor-lists-status-icon-{pending,success,error,processing,default}
 * Color modifiers for the vendor-list status icon, selected via
 * VendorLists::StatusComponent#badge_class.
 *
 * Used by: app/components/vendor_lists/status_component.rb (badge_class)
 * Reuse when: same per-status coloring semantics.
 * Do NOT use for: general icon coloring.
 */
.component-vendor-lists-status-icon-pending {
  color: var(--color-status-text-yellow);
}

.component-vendor-lists-status-icon-success {
  color: var(--color-text-success);
}

.component-vendor-lists-status-icon-error {
  color: var(--color-text-danger);
}

.component-vendor-lists-status-icon-processing {
  color: var(--color-accent);
}

.component-vendor-lists-status-icon-default {
  color: var(--color-text-muted);
}

/*
 * .component-vendor-lists-status-text — label text next to the status
 * icon with a small left margin.
 *
 * Used by: app/components/vendor_lists/status_component.html.erb
 * Reuse when: same label pattern.
 * Do NOT use for: general labels.
 */
.component-vendor-lists-status-text {
  margin-left: calc(var(--spacing) * 4);
}

/*
 * .component-projects-status — inline status label rendered inside a
 * projects index table row.
 *
 * Used by: app/components/projects/status_component.html.erb
 * Reuse when: another inline projects status label is needed.
 * Do NOT use for: generic status pills — use BadgeComponent or
 * component-badge-status-* instead.
 */
.component-projects-status {
  line-height: calc(var(--spacing) * 6);
}

/*
 * .component-projects-items — nested checkbox list wrapper for the new
 * project board item tree. Re-applies itself recursively so each level
 * indents further from the previous.
 *
 * Used by: app/components/projects/items_component.html.erb
 * Reuse when: another recursive indented checkbox tree appears.
 * Do NOT use for: flat checkbox lists — use Forms::CheckboxListComponent.
 */
.component-projects-items {
  margin-left: calc(var(--spacing) * 8);
}

/*
 * .component-projects-items-option — single checkbox row inside the
 * projects items tree. Flex layout with hover feedback.
 *
 * Used by: app/components/projects/items_component.html.erb
 * Reuse when: another hover-highlighted checkbox row is needed here.
 * Do NOT use for: form field labels — use Forms::LabelComponent.
 */
.component-projects-items-option {
  border-radius: var(--radius-md);
}

/*
 * .component-projects-membership-field — outer wrapper for the project
 * membership picker (hidden list + modal trigger).
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: never — this area owns this widget.
 * Do NOT use for: other membership pickers.
 */
.component-projects-membership-field {
  display: block;
}

/*
 * .component-projects-membership-field-hint — italic subtitle describing
 * the CC behavior of project members.
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: another italic form helper subtitle.
 * Do NOT use for: form help text — use Forms::FieldComponent help_text.
 */
.component-projects-membership-field-hint {
  margin-bottom: calc(var(--spacing) * 4);
  font-style: italic;
}

/*
 * .component-projects-membership-field-select-button — vertical spacing
 * wrapper for the "Select users" trigger button.
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: same button placement appears in the same widget.
 * Do NOT use for: generic button spacing — use layout classes.
 */
.component-projects-membership-field-select-button {
  margin-top: calc(var(--spacing) * 1);
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-projects-membership-field-list-shell — hidden container
 * revealed by the Stimulus controller once a user is selected.
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: never — specific to this widget's show/hide target.
 * Do NOT use for: general hidden containers — use the `hidden` utility.
 */
.component-projects-membership-field-list-shell {
  margin-top: calc(var(--spacing) * 4);
  margin-bottom: calc(var(--spacing) * 8);
}

/*
 * .component-projects-membership-field-list — scrollable bordered box
 * that displays the currently selected members.
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: never — specific to this widget.
 * Do NOT use for: general scroll boxes.
 */
.component-projects-membership-field-list {
  max-height: calc(var(--spacing) * 48);
  padding: calc(var(--spacing) * 4);
  overflow: auto;
  border: 1px solid var(--color-border-themed);
}

/*
 * .component-projects-membership-field-modal-inner — padding + width
 * wrapper rendered inside the project-membership modal dialog.
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: never.
 * Do NOT use for: other modals.
 */
.component-projects-membership-field-modal-inner {
  width: calc(var(--spacing) * 96);
  padding: calc(var(--spacing) * 4);
}

/*
 * .component-projects-membership-field-modal-title — centered modal
 * headline for the project membership picker.
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: never.
 * Do NOT use for: other modal titles — use ModalComponent's slot.
 */
.component-projects-membership-field-modal-title {
  margin-bottom: calc(var(--spacing) * 8);
  font-size: var(--font-size-xl);
  font-weight: 700;
  text-align: center;
}

/*
 * .component-projects-membership-field-option — clickable label wrapping
 * each user checkbox inside the modal member list.
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: never — tied to collection_check_boxes builder markup.
 * Do NOT use for: general checkbox rows.
 */
.component-projects-membership-field-option {
  display: flex;
  align-items: center;
  padding-top: calc(var(--spacing) * 1);
  padding-bottom: calc(var(--spacing) * 1);
  cursor: pointer;
}

/*
 * .component-projects-membership-field-checkbox — themed checkbox used
 * inside the membership picker modal.
 *
 * Used by: app/components/projects/membership_field_component.html.erb
 * Reuse when: never — paired with the option label above.
 * Do NOT use for: Forms::FieldComponent checkboxes.
 */
.component-projects-membership-field-checkbox {
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
  margin-right: calc(var(--spacing) * 2);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-surface-hover);
  color: var(--color-brand-primary);
  cursor: pointer;
  transition: all var(--transition-timing-standard);
}

/* Focus doctrine: the shared ring on keyboard focus, replacing the bespoke
 * 2px accent ring this checkbox used to draw for itself. */
.component-projects-membership-field-checkbox:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}


/*
 * .component-insights-insight-dropdown — outer wrapper spacing the
 * dropdown from the surrounding content.
 *
 * Used by: app/components/insights/insight_dropdown_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic dropdowns.
 */
.component-insights-insight-dropdown > * + * {
  margin-top: calc(var(--spacing) * 4);
}

/*
 * .component-insights-insight-dropdown-wrap — max-width wrapper hosting
 * the Stimulus animation controller.
 *
 * Used by: app/components/insights/insight_dropdown_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic wrappers.
 */
.component-insights-insight-dropdown-wrap {
  max-width: 56rem;
  margin-top: auto;
  margin-bottom: auto;
}

/*
 * .component-insights-insight-dropdown-button — trigger button that
 * reveals the insight list.
 *
 * Used by: app/components/insights/insight_dropdown_component.html.erb
 * Reuse when: never.
 * Do NOT use for: general dropdown buttons.
 */
.component-insights-insight-dropdown-button {
  position: relative;
  display: flex;
  align-items: center;
  width: calc(var(--spacing) * 96);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  text-align: left;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xs);
  color: var(--color-text-body);
}

/*
 * .component-insights-insight-dropdown-button-label — selected insight
 * name; truncates inside the button.
 *
 * Used by: app/components/insights/insight_dropdown_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic labels.
 */
.component-insights-insight-dropdown-button-label {
  flex-grow: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/*
 * .component-insights-insight-dropdown-button-icon — chevron next to
 * the button label.
 *
 * Used by: app/components/insights/insight_dropdown_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic chevrons.
 */
.component-insights-insight-dropdown-button-icon {
  margin-left: calc(var(--spacing) * 4);
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
  color: var(--color-text-muted);
}

/*
 * .component-insights-insight-dropdown-menu — absolutely positioned
 * menu revealed by the Stimulus animation controller.
 *
 * Used by: app/components/insights/insight_dropdown_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic menus.
 */
.component-insights-insight-dropdown-menu {
  position: absolute;
  width: calc(var(--spacing) * 96);
}

/*
 * .component-insights-insight-dropdown-menu-inner — bordered, divided
 * list of insight options.
 *
 * Used by: app/components/insights/insight_dropdown_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic lists.
 */
.component-insights-insight-dropdown-menu-inner {
  display: flex;
  flex-direction: column;
  transform-origin: top left;
  max-width: 56rem;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xs);
}

.component-insights-insight-dropdown-menu-inner:focus {
  outline: none;
}

/*
 * .component-insights-insight-dropdown-item — single link in the
 * insight dropdown menu.
 *
 * Used by: app/components/insights/insight_dropdown_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic menu items.
 */
.component-insights-insight-dropdown-item {
  display: block;
  overflow: hidden;
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--color-text-body);
}

.component-insights-insight-dropdown-item + .component-insights-insight-dropdown-item {
  border-top: 1px solid var(--color-border-themed);
}

/*
 * .component-insights-profile — page-level wrap for the customer profile
 * report; spaces the profile sections from the lookalike audience section.
 *
 * Used by: app/components/insights/profile_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic page wraps.
 */
.component-insights-profile {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 10);
}

/*
 * .component-insights-profile-title — top-level section title delimiting
 * the customer profile and lookalike audience areas. Heavier than the
 * inline section headers below it, lighter than the page h1.
 *
 * Used by: app/components/insights/profile_component.html.erb
 * Reuse when: another top-level section inside insights.
 * Do NOT use for: card or chart titles.
 */
.component-insights-profile-title {
  margin-bottom: calc(var(--spacing) * 5);
  font-size: var(--font-size-xl);
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--color-text-heading);
}

/*
 * .component-insights-profile-sections — vertical rhythm between the
 * profile report sections (snapshot, key insights, chart groups).
 *
 * Used by: app/components/insights/profile_component.html.erb
 * Reuse when: never — pairs with the parent wrap.
 * Do NOT use for: generic stacks (use .stack).
 */
.component-insights-profile-sections {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 8);
}

/*
 * .component-insights-profile-chart-grid — card grid inside a profile
 * section. Two columns by default; the -three modifier widens to three
 * for the household donut row. Collapses to one column on small screens.
 *
 * Used by: app/components/insights/profile_component.html.erb
 * Reuse when: never — chart-card layout only.
 * Do NOT use for: stat tiles (see -audience-tiles).
 */
.component-insights-profile-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: calc(var(--spacing) * 6);
}

@media (min-width: 48rem) {
  .component-insights-profile-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .component-insights-profile-chart-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/*
 * .component-insights-section-header — icon + title (+ optional subtitle)
 * header above each profile section.
 *
 * Used by: app/components/insights/section_header_component.html.erb
 * Reuse when: paired with that component only.
 * Do NOT use for: generic headings.
 */
.component-insights-section-header {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 2.5);
  margin-bottom: calc(var(--spacing) * 4);
}

/* Top offset puts the icon's center on the title's optical center. */
.component-insights-section-header-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: calc(var(--spacing) * 1);
  color: var(--color-insights-accent);
}

.component-insights-section-header-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text-heading);
}

.component-insights-section-header-subtitle {
  margin-top: calc(var(--spacing) * 0.5);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-insights-snapshot — opening summary card: match-rate ring and
 * business context up top, a four-stat row along the bottom.
 *
 * Used by: app/components/insights/snapshot_component.html.erb
 * Reuse when: never.
 * Do NOT use for: other summary cards.
 */
.component-insights-snapshot-summary {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 8);
}

.component-insights-snapshot-match {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 5);
}

.component-insights-snapshot-ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 5.5rem;
  height: 5.5rem;
}

/* Rotated so the filled arc starts at twelve o'clock. */
.component-insights-snapshot-ring {
  transform: rotate(-90deg);
}

.component-insights-snapshot-ring-track {
  fill: none;
  stroke: var(--color-surface-elevated);
  stroke-width: 8;
}

.component-insights-snapshot-ring-fill {
  fill: none;
  stroke: var(--color-insights-accent);
  stroke-width: 8;
  stroke-linecap: round;
}

.component-insights-snapshot-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text-heading);
}

/* Shared small-label / value / sub-line trio used by both the match
 * summary and the bottom stat row. */
.component-insights-snapshot-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.component-insights-snapshot-value {
  margin-top: calc(var(--spacing) * 0.5);
  font-size: var(--font-size-xl);
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--color-text-heading);
}

.component-insights-snapshot-sub {
  margin-top: calc(var(--spacing) * 1);
  font-size: var(--font-size-xs);
  color: var(--color-text-body);
}

.component-insights-snapshot-context {
  flex: 1;
  min-width: 17.5rem;
  padding-left: calc(var(--spacing) * 7);
  border-left: 1px solid var(--color-border-subtle);
}

.component-insights-snapshot-context-chip {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  margin-top: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
  border: 1px solid var(--color-insights-accent-border);
  border-radius: var(--radius-pill);
  background: var(--color-insights-accent-bg-subtle);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
}

.component-insights-snapshot-context-icon {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--color-insights-accent);
}

.component-insights-snapshot-context-text {
  margin-top: calc(var(--spacing) * 3);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--color-text-body);
}

.component-insights-snapshot-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: calc(var(--spacing) * 4);
  margin-top: calc(var(--spacing) * 6);
  padding-top: calc(var(--spacing) * 6);
  border-top: 1px solid var(--color-border-subtle);
}

@media (min-width: 48rem) {
  .component-insights-snapshot-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.component-insights-snapshot-stat {
  padding-inline: calc(var(--spacing) * 5);
}

.component-insights-snapshot-stat + .component-insights-snapshot-stat {
  border-left: 1px solid var(--color-border-subtle);
}

.component-insights-snapshot-stat-value {
  margin-top: calc(var(--spacing) * 1);
  font-size: var(--font-size-xl);
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--color-text-heading);
}

/*
 * .component-insights-key-insights — card listing the AI-generated
 * findings. The Stimulus disclosure controller toggles the -open class
 * on this element to reveal rows past the preview count and rotate the
 * toggle chevron.
 *
 * Used by: app/components/insights/key_insights_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic disclosure lists.
 */
.component-insights-key-insight {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 3);
  padding-block: calc(var(--spacing) * 3.5);
}

.component-insights-key-insight + .component-insights-key-insight {
  border-top: 1px solid var(--color-border-subtle);
}

.component-insights-key-insight-hidden {
  display: none;
}

.component-insights-key-insights-open .component-insights-key-insight-hidden {
  display: flex;
}

.component-insights-key-insight-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--color-insights-accent-border);
  border-radius: var(--radius-pill);
  background: var(--color-insights-accent-bg);
}

.component-insights-key-insight-icon {
  width: 0.8125rem;
  height: 0.8125rem;
  color: var(--color-insights-accent);
}

.component-insights-key-insight-text {
  flex: 1;
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--color-text-body);
}

.component-insights-key-insight-text strong {
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-insights-key-insights-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--spacing) * 1.5);
  width: 100%;
  margin-top: calc(var(--spacing) * 1);
  padding-block: calc(var(--spacing) * 3);
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  background: transparent;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-insights-accent);
  cursor: pointer;
  transition: color var(--transition-timing-standard);
}

.component-insights-key-insights-toggle:hover {
  color: var(--color-text-heading);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-insights-key-insights-toggle:focus-visible {
  outline: none;
  border-radius: var(--radius-md);
  box-shadow: var(--focus-ring);
}

.component-insights-key-insights-toggle-icon {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform var(--transition-timing-standard);
}

.component-insights-key-insights-open .component-insights-key-insights-toggle-icon {
  transform: rotate(180deg);
}

/*
 * .component-insights-bars-card / .component-insights-donut-card — chart
 * cards inside the profile sections: a horizontal bar list and a donut
 * with a dot legend. Both open with the same small bold title.
 *
 * Used by: app/components/insights/bars_card_component.html.erb,
 *          app/components/insights/donut_card_component.html.erb
 * Reuse when: paired with those components only.
 * Do NOT use for: dashboard charts.
 */
.component-insights-bars-title,
.component-insights-donut-title {
  margin-bottom: calc(var(--spacing) * 4);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/* Label / track / value columns share one grid so bar tracks align to the
 * longest label in the list; rows contribute their cells via
 * display: contents. */
.component-insights-bars-list {
  display: grid;
  grid-template-columns: minmax(6.5rem, max-content) minmax(0, 1fr) max-content;
  align-items: center;
  column-gap: calc(var(--spacing) * 3);
  row-gap: calc(var(--spacing) * 3);
}

/* Two-column wrapper for the lifestyle affinity list — each half is its own
 * bars list so alignment stays per-column. */
.component-insights-bars-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  column-gap: calc(var(--spacing) * 10);
  row-gap: calc(var(--spacing) * 3);
}

@media (min-width: 48rem) {
  .component-insights-bars-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.component-insights-bar-row {
  display: contents;
}

.component-insights-bar-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
}

.component-insights-bar-track {
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
  overflow: hidden;
}

.component-insights-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-insights-accent);
}

.component-insights-bar-value {
  min-width: 3rem;
  text-align: right;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-insights-donut-body {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 5);
}

/* Rotated so the first segment starts at twelve o'clock. */
.component-insights-donut {
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.component-insights-donut-track {
  fill: none;
  stroke: var(--color-surface-elevated);
  stroke-width: 14;
}

.component-insights-donut-segment {
  fill: none;
  stroke-width: 14;
}

.component-insights-donut-segment-1 {
  stroke: var(--color-insights-accent);
}

.component-insights-donut-segment-2 {
  stroke: var(--color-insights-accent-tint-2);
}

.component-insights-donut-segment-3 {
  stroke: var(--color-insights-accent-tint-3);
}

.component-insights-donut-segment-4 {
  stroke: var(--color-insights-accent-tint-4);
}

.component-insights-donut-legend {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: calc(var(--spacing) * 2);
}

.component-insights-donut-legend-row {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

.component-insights-donut-legend-dot {
  flex-shrink: 0;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: var(--radius-pill);
}

.component-insights-donut-legend-dot-1 {
  background: var(--color-insights-accent);
}

.component-insights-donut-legend-dot-2 {
  background: var(--color-insights-accent-tint-2);
}

.component-insights-donut-legend-dot-3 {
  background: var(--color-insights-accent-tint-3);
}

.component-insights-donut-legend-dot-4 {
  background: var(--color-insights-accent-tint-4);
}

.component-insights-donut-legend-label {
  flex: 1;
  font-size: var(--font-size-xs);
  color: var(--color-text-body);
}

.component-insights-donut-legend-value {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-insights-profile-audience — lookalike audience card: name +
 * view button up top, three elevated stat tiles, applied filters below.
 *
 * Used by: app/components/insights/profile_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic stat tiles.
 */
.component-insights-profile-audience-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 4);
  margin-bottom: calc(var(--spacing) * 5);
}

.component-insights-profile-audience-name {
  font-size: var(--font-size-xl);
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--color-text-heading);
}

.component-insights-profile-audience-tiles {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: calc(var(--spacing) * 3);
}

@media (min-width: 48rem) {
  .component-insights-profile-audience-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.component-insights-profile-audience-tile {
  padding: calc(var(--spacing) * 4);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface-elevated);
}

.component-insights-profile-audience-tile-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.component-insights-profile-audience-tile-value {
  margin-top: calc(var(--spacing) * 1.5);
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-insights-profile-audience-tile-sub {
  margin-top: calc(var(--spacing) * 0.5);
  font-size: var(--font-size-xs);
  color: var(--color-text-body);
}

.component-insights-profile-audience-filters {
  margin-top: calc(var(--spacing) * 5);
}

.component-insights-profile-audience-filters-label {
  margin-bottom: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.component-insights-profile-audience-filters-list {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1);
  padding-left: calc(var(--spacing) * 4);
  list-style: disc;
}

.component-insights-profile-audience-filters-item {
  font-size: var(--font-size-xs);
  color: var(--color-text-body);
}

/*
 * .component-insights-visualization-pipeline — outer wrap for the
 * three-step progress layout shown during insight processing.
 *
 * Used by: app/components/insights/visualization/pipeline_component.html.erb
 * Reuse when: never.
 * Do NOT use for: other progress trackers.
 */
.component-insights-visualization-pipeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  margin-top: calc(var(--spacing) * 8);
}

.component-insights-visualization-pipeline > * + * {
  margin-top: calc(var(--spacing) * 8);
}

/*
 * .component-insights-visualization-pipeline-steps — horizontal row of
 * three progress boxes.
 *
 * Used by: app/components/insights/visualization/pipeline_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic rows.
 */
.component-insights-visualization-pipeline-steps {
  display: flex;
  gap: calc(var(--spacing) * 6);
}

/*
 * .component-insights-visualization-pipeline-current-step — italic text
 * describing the current visualization step.
 *
 * Used by: app/components/insights/visualization/pipeline_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic italic text.
 */
.component-insights-visualization-pipeline-current-step {
  font-style: italic;
  color: var(--color-text-muted);
}

/*
 * .component-insights-visualization-pipeline-error — red error callout
 * displayed when the pipeline fails.
 *
 * Used by: app/components/insights/visualization/pipeline_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic errors.
 */
.component-insights-visualization-pipeline-error {
  padding-top: calc(var(--spacing) * 8);
  text-align: center;
  color: var(--color-text-danger);
}

/*
 * .component-insights-visualization-pipeline-box — single progress
 * tile containing the step illustration and label.
 *
 * Used by: app/components/insights/visualization/pipeline_component.html.erb
 * Reuse when: never.
 * Do NOT use for: other cards.
 */
.component-insights-visualization-pipeline-box {
  display: flex;
  flex-direction: column;
  width: calc(var(--spacing) * 80);
  padding-top: calc(var(--spacing) * 8);
  padding-bottom: calc(var(--spacing) * 6);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-md);
}

.component-insights-visualization-pipeline-box-not-started {
  opacity: 0.5;
}

.component-insights-visualization-pipeline-box-in-progress {
  opacity: 1;
}

.component-insights-visualization-pipeline-box-completed {
  opacity: 0.75;
}

.component-insights-visualization-pipeline-box-failed {
  opacity: 0.5;
}

/*
 * .component-insights-visualization-pipeline-box-image — illustration
 * image centered inside the progress box.
 *
 * Used by: app/components/insights/visualization/pipeline_component.html.erb
 * Reuse when: paired with progress box.
 * Do NOT use for: standalone images.
 */
.component-insights-visualization-pipeline-box-image {
  height: calc(var(--spacing) * 48);
  width: auto;
  padding: calc(var(--spacing) * 4);
}

/*
 * .component-insights-visualization-pipeline-box-label — bottom row
 * pairing the status icon and label text.
 *
 * Used by: app/components/insights/visualization/pipeline_component.html.erb
 * Reuse when: paired with progress box.
 * Do NOT use for: generic rows.
 */
.component-insights-visualization-pipeline-box-label {
  justify-content: center;
  margin-top: calc(var(--spacing) * 6);
  padding: calc(var(--spacing) * 2);
}

.component-insights-visualization-pipeline-box-label-muted {
  color: var(--color-text-muted);
}

/*
 * .component-insights-visualization-pipeline-box-icon — sized status
 * icon inside the label row.
 *
 * Used by: app/components/insights/visualization/pipeline_component.html.erb
 * Reuse when: paired with label row.
 * Do NOT use for: generic icons.
 */
.component-insights-visualization-pipeline-box-icon {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
}

.component-insights-visualization-pipeline-box-icon-completed {
  color: var(--color-text-success);
}

.component-insights-visualization-pipeline-box-icon-failed {
  color: var(--color-text-danger);
}

/*
 * .component-status-pill-icon — small icon rendered inside the shared
 * .component-status-pill wrapper. Size + spacing only — color comes
 * from the pill background/text modifier.
 *
 * Used by: app/components/email_campaigns/status_pill_component.html.erb
 * Reuse when: paired with .component-status-pill.
 * Do NOT use for: standalone icons.
 */
.component-status-pill-icon {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
}

/*
 * .component-email-campaigns-row-frame — layout-transparent wrapper
 * for the turbo-frame that hosts a campaign row. Its children become
 * direct flex items of the parent .row link so the icon, body, stats,
 * and badge lay out horizontally.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb
 * Reuse when: a turbo-frame must wrap a row's children for streamed
 *             updates without disrupting the row's flex layout.
 * Do NOT use for: turbo-frames that stand alone as a layout box.
 */
.component-email-campaigns-row-frame {
  display: contents;
}

/*
 * .component-email-campaigns-row-body — flexible column between the
 * row icon and the stats/badge cluster.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb,
 *          app/components/email_campaigns/deployment_row_component.html.erb
 * Reuse when: paired with row icon wrap.
 * Do NOT use for: generic bodies.
 */
.component-email-campaigns-row-body {
  flex: 1 1 0;
  min-width: 0;
}

/*
 * .component-email-campaigns-row-title — semibold truncated campaign
 * or deployment title.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb,
 *          app/components/email_campaigns/deployment_row_component.html.erb
 * Reuse when: paired with row body.
 * Do NOT use for: generic headings.
 */
.component-email-campaigns-row-title {
  overflow: hidden;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .component-email-campaigns-row-meta — small muted subtitle beneath
 * the row title.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb,
 *          app/components/email_campaigns/deployment_row_component.html.erb
 * Reuse when: paired with row body.
 * Do NOT use for: generic muted text.
 */
.component-email-campaigns-row-meta {
  margin-top: calc(var(--spacing) * 1);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-email-campaigns-row-stats — horizontal stat cluster on
 * the right side of a finished row.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb,
 *          app/components/email_campaigns/deployment_row_component.html.erb
 * Reuse when: paired with row body.
 * Do NOT use for: top-level stats — use StatCardsComponent.
 */
.component-email-campaigns-row-stats {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 6);
  flex-shrink: 0;
}

/*
 * .component-email-campaigns-row-stat — single text-centered stat
 * column inside the row stats cluster.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb,
 *          app/components/email_campaigns/deployment_row_component.html.erb
 * Reuse when: paired with row stats.
 * Do NOT use for: standalone metrics.
 */
.component-email-campaigns-row-stat {
  text-align: center;
}

/*
 * .component-email-campaigns-row-stat-label — small muted label above
 * a row stat value.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb,
 *          app/components/email_campaigns/deployment_row_component.html.erb
 * Reuse when: paired with row stat.
 * Do NOT use for: generic labels.
 */
.component-email-campaigns-row-stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-email-campaigns-row-stat-value — primary metric number
 * beneath the stat label.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb,
 *          app/components/email_campaigns/deployment_row_component.html.erb
 * Reuse when: paired with row stat.
 * Do NOT use for: generic numbers.
 */
.component-email-campaigns-row-stat-value {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-email-campaigns-row-stat-value-accent — accent-colored
 * variant of the stat value, used for the open rate column.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb,
 *          app/components/email_campaigns/deployment_row_component.html.erb
 * Reuse when: another row metric should read as a highlight.
 * Do NOT use for: generic accent text.
 */
.component-email-campaigns-row-stat-value-accent {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-accent);
}

/*
 * .component-email-campaigns-row-status (+ -status-* modifiers) — campaign
 * status as plain colored text on the right of the row, matching the
 * audiences/vault status treatment. finished → green, in_progress → amber,
 * everything else (queued) → muted.
 *
 * Used by: app/components/email_campaigns/row_component.html.erb
 */
.component-email-campaigns-row-status {
  flex-shrink: 0;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

.component-email-campaigns-row-status-finished {
  color: var(--color-text-success);
}

.component-email-campaigns-row-status-in_progress {
  color: var(--color-text-warning);
}

/* Bring the campaign name up to the index name size only in the panel layout,
 * leaving the shared title class (also used by deployment rows) untouched. */
.component-resource-list-panel .component-email-campaigns-row-title {
  font-size: var(--font-size-base);
}

/*
 * .component-email-campaigns-actions-menu-link — muted icon-only
 * download link inside the actions menu column.
 *
 * Used by: app/components/email_campaigns/actions_menu_component.html.erb
 * Reuse when: another muted→accent icon link is needed in this area.
 * Do NOT use for: primary buttons — use ButtonComponent.
 */
.component-email-campaigns-actions-menu-link {
  display: inline-flex;
  color: var(--color-text-muted);
}

.component-email-campaigns-actions-menu-link:hover {
  color: var(--color-accent);
}

/*
 * .component-email-campaigns-actions-menu-icon — sized download icon
 * inside the actions menu link.
 *
 * Used by: app/components/email_campaigns/actions_menu_component.html.erb
 * Reuse when: paired with actions menu link.
 * Do NOT use for: generic icons.
 */
.component-email-campaigns-actions-menu-icon {
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
}

/* ─── C5f team_capacity/* domain classes ─── */

/*
 * .component-team-capacity-panel-card — shared outer wrapper for the
 * capacity chart and distribution cards. Uses themed border + padding
 * so inner tables read cleanly.
 *
 * Used by: app/components/team_capacity/capacity_chart_component.html.erb,
 *          app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: building another card panel inside the team capacity view.
 * Do NOT use for: generic cards — use Cards::CardComponent.
 */
.component-team-capacity-panel-card {
  padding: calc(var(--spacing) * 6);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
}

/*
 * .component-team-capacity-chart-card — capacity chart outer card with
 * extra bottom margin above the distribution table.
 *
 * Used by: app/components/team_capacity/capacity_chart_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic chart cards.
 */
.component-team-capacity-chart-card {
  margin-bottom: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 6);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
}

/*
 * .component-team-capacity-chart-title — section heading above the
 * capacity chart canvas.
 *
 * Used by: app/components/team_capacity/capacity_chart_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic headings.
 */
.component-team-capacity-chart-title {
  margin-bottom: calc(var(--spacing) * 4);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-team-capacity-chart-canvas-wrap — fixed-height wrapper
 * hosting the Chart.js canvas and Stimulus controller.
 *
 * Used by: app/components/team_capacity/capacity_chart_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic canvases.
 */
.component-team-capacity-chart-canvas-wrap {
  height: calc(var(--spacing) * 80);
}

/*
 * .component-team-capacity-distribution-header — flex header above the
 * weekly hours table.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic headers.
 */
.component-team-capacity-distribution-header {
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-team-capacity-distribution-header-label — uppercase muted
 * heading for the distribution table.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic labels.
 */
.component-team-capacity-distribution-header-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-team-capacity-distribution-table — full-width table
 * rendering the weekly hour summary for each team member.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic tables — use Tables::TableComponent.
 */
.component-team-capacity-distribution-table {
  width: 100%;
  font-size: var(--font-size-xs);
}

/*
 * .component-team-capacity-distribution-row-head — header row inside
 * the distribution table with bottom border.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic rows.
 */
.component-team-capacity-distribution-row-head {
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/*
 * Header cells inside the distribution table get the shared gray
 * --color-surface-elevated background + bottom hairline, matching
 * every other table header in the app.
 */
.component-team-capacity-distribution-row-head .component-team-capacity-distribution-cell {
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border-subtle);
}

/*
 * .component-team-capacity-distribution-row — body row inside the
 * distribution table.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic rows.
 */
.component-team-capacity-distribution-row {
  border-bottom: 1px solid var(--color-border-subtle);
}

/*
 * .component-team-capacity-distribution-cell — padding + alignment
 * shared by both header and body cells in the distribution table.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic cells.
 */
.component-team-capacity-distribution-cell {
  padding-top: calc(var(--spacing) * 2);
  padding-bottom: calc(var(--spacing) * 2);
  padding-right: calc(var(--spacing) * 4);
}

.component-team-capacity-distribution-cell-first {
  padding-left: calc(var(--spacing) * 4);
}

.component-team-capacity-distribution-cell-center {
  text-align: center;
}

/*
 * .component-team-capacity-distribution-member-info — stacked name +
 * job-title column next to the member avatar.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: paired with distribution member.
 * Do NOT use for: generic member info.
 */
.component-team-capacity-distribution-member-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/*
 * .component-team-capacity-distribution-member-name — truncated member
 * display name inside the distribution row.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: paired with distribution member info.
 * Do NOT use for: generic names.
 */
.component-team-capacity-distribution-member-name {
  overflow: hidden;
  font-size: var(--font-size-xs);
  color: var(--color-text-heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .component-team-capacity-distribution-member-title — muted job title
 * shown below the member name.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: paired with distribution member info.
 * Do NOT use for: generic titles.
 */
.component-team-capacity-distribution-member-title {
  font-size: var(--font-size-2xs);
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-distribution-daily — numeric daily-average
 * cell inside the distribution table.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: paired with distribution row.
 * Do NOT use for: generic cells.
 */
.component-team-capacity-distribution-daily {
  font-size: var(--font-size-xs);
  color: var(--color-text-body);
}

/*
 * .component-team-capacity-distribution-total — bold total-hours cell
 * inside the distribution table.
 *
 * Used by: app/components/team_capacity/daily_distribution_table_component.html.erb
 * Reuse when: paired with distribution row.
 * Do NOT use for: generic cells.
 */
.component-team-capacity-distribution-total {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-team-capacity-daily-forecast — outer block spacing the
 * daily forecast from surrounding content.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic blocks.
 */
.component-team-capacity-daily-forecast {
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-team-capacity-daily-forecast-header — row grouping the
 * calendar icon and the uppercase heading.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic headers.
 */
.component-team-capacity-daily-forecast-header {
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-team-capacity-daily-forecast-header-icon — sized calendar
 * icon inside the daily forecast header.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: paired with header.
 * Do NOT use for: generic icons.
 */
.component-team-capacity-daily-forecast-header-icon {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-daily-forecast-header-label — uppercase
 * muted label for the daily forecast block.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic labels.
 */
.component-team-capacity-daily-forecast-header-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-daily-forecast-grid — horizontal row of
 * day-cells + total cell.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic rows.
 */
.component-team-capacity-daily-forecast-grid {
  display: flex;
  gap: calc(var(--spacing) * 2);
}

/*
 * .component-team-capacity-daily-forecast-cell — single day cell
 * inside the forecast row.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: paired with grid.
 * Do NOT use for: generic tiles.
 */
.component-team-capacity-daily-forecast-cell {
  flex: 1 1 0;
  padding: calc(var(--spacing) * 4);
  text-align: center;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
}

/* Phones: the 7-day strip won't fit; keep cell sizes and scroll horizontally
 * instead of crushing or clipping the days. */
@media (max-width: 40rem) {
  .component-team-capacity-daily-forecast-grid {
    overflow-x: auto;
  }

  .component-team-capacity-daily-forecast-cell {
    flex: 0 0 auto;
    min-width: calc(var(--spacing) * 16);
  }
}

.component-team-capacity-daily-forecast-cell-total {
  background: var(--color-surface-elevated);
}

/*
 * .component-team-capacity-daily-forecast-cell-label — small muted
 * day-name label inside each forecast cell.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: paired with cell.
 * Do NOT use for: generic labels.
 */
.component-team-capacity-daily-forecast-cell-label {
  margin-bottom: calc(var(--spacing) * 1);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-daily-forecast-bar-track — thin pill track
 * hosting the forecast fill bar.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: paired with cell.
 * Do NOT use for: generic bars.
 */
.component-team-capacity-daily-forecast-bar-track {
  height: calc(var(--spacing) * 1);
  margin: 0 calc(var(--spacing) * 4) calc(var(--spacing) * 2);
  background: var(--color-surface-elevated);
  border-radius: var(--radius-pill);
}

.component-team-capacity-daily-forecast-cell-total .component-team-capacity-daily-forecast-bar-track {
  background: var(--color-border-themed);
}

/*
 * .component-team-capacity-daily-forecast-bar-fill — width-driven fill
 * inside the forecast track. Width comes from --forecast-bar-width.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: paired with track.
 * Do NOT use for: generic fills.
 */
.component-team-capacity-daily-forecast-bar-fill {
  height: 100%;
  width: var(--forecast-bar-width, 0%);
  border-radius: var(--radius-pill);
}

/*
 * .component-team-capacity-daily-forecast-cell-value — bold hours text
 * beneath the fill bar.
 *
 * Used by: app/components/team_capacity/daily_forecast_component.html.erb
 * Reuse when: paired with cell.
 * Do NOT use for: generic numbers.
 */
.component-team-capacity-daily-forecast-cell-value {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-team-capacity-forecast-card — outer card panel for the
 * week-at-a-glance forecast with member bars.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic cards.
 */
.component-team-capacity-forecast-card {
  padding: calc(var(--spacing) * 6);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
}

/*
 * .component-team-capacity-forecast-card-header — flex row with the
 * week title on the left and the legend on the right.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic headers.
 */
.component-team-capacity-forecast-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-team-capacity-forecast-card-icon — sized calendar icon in
 * the forecast card title row.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with title row.
 * Do NOT use for: generic icons.
 */
.component-team-capacity-forecast-card-icon {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-forecast-card-title — semibold title next
 * to the icon.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic headings.
 */
.component-team-capacity-forecast-card-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-team-capacity-forecast-card-week-label — muted week range
 * next to the title.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic labels.
 */
.component-team-capacity-forecast-card-week-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-forecast-card-legend — flex row of small
 * legend markers on the right side of the header.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic legends.
 */
.component-team-capacity-forecast-card-legend {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-forecast-card-legend-item — single marker
 * with dot + label.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with legend.
 * Do NOT use for: generic items.
 */
.component-team-capacity-forecast-card-legend-item {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

/*
 * .component-team-capacity-forecast-card-legend-dot — shared round
 * indicator used by the legend markers.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with legend item.
 * Do NOT use for: generic dots.
 */
.component-team-capacity-forecast-card-legend-dot {
  width: calc(var(--spacing) * 2);
  height: calc(var(--spacing) * 2);
  border-radius: var(--radius-pill);
}

.component-team-capacity-forecast-card-legend-dot-allocated {
  background: var(--color-green-mark);
}

.component-team-capacity-forecast-card-legend-dot-available {
  background: var(--color-surface-elevated);
}

/*
 * .component-team-capacity-forecast-card-member-name — truncated first
 * name column on the member row.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with member row.
 * Do NOT use for: generic names.
 */
.component-team-capacity-forecast-card-member-name {
  overflow: hidden;
  width: calc(var(--spacing) * 16);
  font-size: var(--font-size-xs);
  color: var(--color-text-heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .component-team-capacity-forecast-card-bar-track — flex-filling
 * pill-shaped bar that hosts the utilization fill.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with member row.
 * Do NOT use for: generic bars.
 */
.component-team-capacity-forecast-card-bar-track {
  overflow: hidden;
  flex: 1 1 0;
  height: calc(var(--spacing) * 4);
  background: var(--color-surface-elevated);
  border-radius: var(--radius-pill);
}

/*
 * .component-team-capacity-forecast-card-bar-fill — width-driven fill
 * bar inside the forecast track. Width comes from --forecast-bar-width.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with track.
 * Do NOT use for: generic fills.
 */
.component-team-capacity-forecast-card-bar-fill {
  height: 100%;
  width: var(--forecast-bar-width, 0%);
  border-radius: var(--radius-pill);
  transition: width 150ms ease-in-out;
}

/*
 * .component-team-capacity-forecast-card-stats — trailing stat cluster
 * on each member row.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with member row.
 * Do NOT use for: generic stats.
 */
.component-team-capacity-forecast-card-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: calc(var(--spacing) * 1);
  width: calc(var(--spacing) * 28);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-forecast-card-stats-pct — percentage value
 * inside the stat cluster. Pairs with .component-capacity-text-* for
 * color.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with stats.
 * Do NOT use for: generic percentages.
 */
.component-team-capacity-forecast-card-stats-pct {
  font-weight: 600;
}

/*
 * .component-team-capacity-forecast-card-expand — wrapper centering
 * the "show more" button beneath the member rows.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic footers.
 */
.component-team-capacity-forecast-card-expand {
  margin-top: calc(var(--spacing) * 4);
  text-align: center;
}

/*
 * .component-team-capacity-forecast-card-expand-button — muted button
 * that toggles extra member rows.
 *
 * Used by: app/components/team_capacity/forecast_card_component.html.erb
 * Reuse when: paired with expand wrapper.
 * Do NOT use for: generic buttons — use ButtonComponent.
 */
.component-team-capacity-forecast-card-expand-button {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  background: transparent;
  border: none;
}

.component-team-capacity-forecast-card-expand-button:hover {
  color: var(--color-accent);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-team-capacity-forecast-card-expand-button:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

/*
 * .component-team-capacity-member-card — accordion card representing a
 * single team member's weekly load.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic cards.
 */
.component-team-capacity-member-card {
  overflow: hidden;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
}

/*
 * .component-team-capacity-member-card-trigger — clickable header of
 * the member card that toggles the accordion.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with member card.
 * Do NOT use for: generic buttons.
 */
.component-team-capacity-member-card-trigger {
  width: 100%;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
  text-align: left;
  background: transparent;
  border: none;
}

/*
 * .component-team-capacity-member-card-info — stacked name/title/clients
 * column next to the member avatar.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with trigger.
 * Do NOT use for: generic info blocks.
 */
.component-team-capacity-member-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/*
 * .component-team-capacity-member-card-name — semibold member display
 * name.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with title row.
 * Do NOT use for: generic names.
 */
.component-team-capacity-member-card-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-team-capacity-member-card-title — bordered pill showing
 * the member's job title.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with title row.
 * Do NOT use for: generic pills.
 */
.component-team-capacity-member-card-title {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

/*
 * .component-team-capacity-member-card-clients — muted list of
 * associated client names.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with info.
 * Do NOT use for: generic captions.
 */
.component-team-capacity-member-card-clients {
  overflow: hidden;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .component-team-capacity-member-card-meta — right-aligned cluster
 * containing the bar, hours column, badges, and chevron.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with trigger.
 * Do NOT use for: generic clusters.
 */
.component-team-capacity-member-card-meta {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 6);
  margin-left: auto;
}

/* Phones: wrap the member card header so the capacity bar / hours / badges
 * cluster drops below the name instead of clipping. */
@media (max-width: 40rem) {
  .component-team-capacity-member-card-trigger {
    position: relative;
    flex-wrap: wrap;
    padding-right: calc(var(--spacing) * 12);
  }

  .component-team-capacity-member-card-meta {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
    gap: calc(var(--spacing) * 4);
  }

  /* Caret pinned right + vertically centered across the wrapped trigger. */
  .component-team-capacity-member-card-chevron {
    position: absolute;
    right: calc(var(--spacing) * 6);
    top: 0;
    bottom: 0;
    margin-block: auto;
  }
}


/*
 * .component-team-capacity-member-card-bar-track — fixed-width pill
 * track hosting the member utilization fill.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with bar row.
 * Do NOT use for: generic bars.
 */
.component-team-capacity-member-card-bar-track {
  overflow: hidden;
  width: calc(var(--spacing) * 32);
  height: calc(var(--spacing) * 2);
  background: var(--color-surface-elevated);
  border-radius: var(--radius-pill);
}

/*
 * .component-team-capacity-member-card-bar-fill — width-driven fill
 * bar inside the track. Width comes from --capacity-bar-width.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with track.
 * Do NOT use for: generic fills.
 */
.component-team-capacity-member-card-bar-fill {
  height: 100%;
  width: var(--capacity-bar-width, 0%);
  border-radius: var(--radius-pill);
}

/*
 * .component-team-capacity-member-card-pct — percentage label next to
 * the utilization bar. Pairs with .component-capacity-text-* for color.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with bar row.
 * Do NOT use for: generic percentages.
 */
.component-team-capacity-member-card-pct {
  font-size: var(--font-size-xs);
  font-weight: 600;
}

/*
 * .component-team-capacity-member-card-hours — stacked allocated/total
 * hours column inside the meta cluster.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with meta.
 * Do NOT use for: generic columns.
 */
.component-team-capacity-member-card-hours {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/*
 * .component-team-capacity-member-card-hours-value — bold allocated
 * hours value.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with hours.
 * Do NOT use for: generic numbers.
 */
.component-team-capacity-member-card-hours-value {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--color-text-heading);
}

/*
 * .component-team-capacity-member-card-hours-total — muted "of Nh"
 * label under the allocated value.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with hours.
 * Do NOT use for: generic labels.
 */
.component-team-capacity-member-card-hours-total {
  font-size: var(--font-size-2xs);
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-member-card-badges — flex row of status
 * badges (tasks/overdue/at-risk/due soon).
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with meta.
 * Do NOT use for: generic rows.
 */
.component-team-capacity-member-card-badges {
  font-size: var(--font-size-xs);
}

/*
 * .component-team-capacity-member-card-badge — base badge styling
 * shared by all meta badges. Color modifiers follow.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with badges row.
 * Do NOT use for: generic badges.
 */
.component-team-capacity-member-card-badge {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
}

.component-team-capacity-member-card-badge-tasks {
  background: color-mix(in srgb, var(--color-gray-500) 10%, transparent);
  color: var(--color-text-muted);
}

.component-team-capacity-member-card-badge-overdue {
  background: color-mix(in srgb, var(--color-red) 18%, transparent);
  color: var(--color-status-text-red);
}

.component-team-capacity-member-card-badge-at-risk {
  background: color-mix(in srgb, var(--color-orange) 18%, transparent);
  color: var(--color-status-text-orange);
}

.component-team-capacity-member-card-badge-due-soon {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  color: var(--color-accent);
}

/*
 * .component-team-capacity-member-card-badge-icon — sized icon inside
 * a member card badge.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with badges.
 * Do NOT use for: generic icons.
 */
.component-team-capacity-member-card-badge-icon {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
}

/*
 * .component-team-capacity-member-card-chevron — chevron that rotates
 * to indicate expanded state on the member accordion.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with trigger.
 * Do NOT use for: generic chevrons.
 */
.component-team-capacity-member-card-chevron {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
  color: var(--color-text-muted);
  transform: rotate(180deg);
  transition: transform var(--transition-timing-standard);
}

/*
 * .component-team-capacity-member-card-content — collapsible content
 * region inside the member accordion.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with member card.
 * Do NOT use for: generic collapsible content.
 */
.component-team-capacity-member-card-content {
  border-top: 1px solid var(--color-border-subtle);
}

/*
 * .component-team-capacity-member-card-content-section — padded block
 * inside the accordion content region.
 *
 * Used by: app/components/team_capacity/member_card_component.html.erb
 * Reuse when: paired with content.
 * Do NOT use for: generic padded blocks.
 */
.component-team-capacity-member-card-content-section {
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
}

.component-team-capacity-member-card-content-section-tasks {
  padding: 0 calc(var(--spacing) * 6) calc(var(--spacing) * 4);
}

/*
 * .component-team-capacity-page — outer padding for the team capacity
 * page shell.
 *
 * Used by: app/components/team_capacity/page_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic pages.
 */
.component-team-capacity-page {
  padding: calc(var(--spacing) * 12) var(--spacing-page-x);
}

/*
 * .component-team-capacity-page-header — hero row separating the page
 * title block from the tab controls.
 *
 * Used by: app/components/team_capacity/page_component.html.erb
 */
.component-team-capacity-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 6);
  margin-bottom: calc(var(--spacing) * 10);
}

/* On phones the title block + tab selector can't share a row; stack them. */
@media (max-width: 40rem) {
  .component-team-capacity-page-header {
    flex-direction: column;
    align-items: stretch;
    gap: calc(var(--spacing) * 4);
  }
}

.component-team-capacity-page-heading {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.component-team-capacity-page-title {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--color-text-heading);
}

.component-team-capacity-page-subtitle {
  margin-top: calc(var(--spacing) * 2);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-page-panel — stacked panel hosting the
 * member cards.
 *
 * Used by: app/components/team_capacity/page_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic panels.
 */
.component-team-capacity-page-panel {
  margin-top: calc(var(--spacing) * 4);
}

/*
 * .component-team-capacity-page-drawer-loading — centered spinner
 * shown while the task drawer is loading.
 *
 * Used by: app/components/team_capacity/page_component.html.erb
 * Reuse when: paired with drawer frame.
 * Do NOT use for: generic loaders.
 */
.component-team-capacity-page-drawer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: calc(var(--spacing) * 12);
  padding-bottom: calc(var(--spacing) * 12);
}

/*
 * .component-team-capacity-page-drawer-spinner — small animated ring
 * rendered inside the drawer loading state.
 *
 * Used by: app/components/team_capacity/page_component.html.erb
 * Reuse when: paired with drawer loading wrap.
 * Do NOT use for: generic spinners.
 */
.component-team-capacity-page-drawer-spinner {
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
  border: 2px solid var(--color-border-themed);
  border-top-color: var(--color-accent);
  border-radius: var(--radius-pill);
  animation: spin 1s linear infinite;
}

/*
 * .component-team-capacity-task-table — compact table rendering the
 * tasks assigned to a team member inside the member accordion.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic tables.
 */
.component-team-capacity-task-table {
  width: 100%;
  table-layout: fixed;
  font-size: var(--font-size-xs);
}

/*
 * .component-team-capacity-task-table-scroll — horizontal scroller wrapping the
 * task table. On narrow screens the table keeps a legible min-width and scrolls
 * inside this container rather than crushing columns or pushing the page gutter.
 */
.component-team-capacity-task-table-scroll {
  overflow-x: auto;
}

@media (max-width: 48rem) {
  .component-team-capacity-task-table {
    min-width: 48rem;
  }
}

.component-team-capacity-task-table-col-task {
  width: 24%;
}

.component-team-capacity-task-table-col-client {
  width: 16%;
}

.component-team-capacity-task-table-col-project {
  width: 16%;
}

.component-team-capacity-task-table-col-status {
  width: 12%;
}

.component-team-capacity-task-table-col-due {
  width: 10%;
}

.component-team-capacity-task-table-col-hours {
  width: 10%;
}

.component-team-capacity-task-table-col-priority {
  width: 12%;
}

/*
 * .component-team-capacity-task-table-head-row — header row with a
 * subtle bottom border and uppercase labels.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: paired with table.
 * Do NOT use for: generic headers.
 */
.component-team-capacity-task-table-head-row {
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/*
 * .component-team-capacity-task-table-th — header cells. Gray
 * --color-surface-elevated background + bottom hairline matches the
 * shared table-header treatment used across My Tasks, Client Rollup,
 * and the meetings tables.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 */
.component-team-capacity-task-table-th {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-team-capacity-task-table-th-first {
  padding-left: calc(var(--spacing) * 4);
}

/*
 * .component-team-capacity-task-table-row — body row inside the task
 * table with hover highlight and click handler.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: paired with table.
 * Do NOT use for: generic rows.
 */
.component-team-capacity-task-table-row {
  border-bottom: 1px solid var(--color-border-subtle);
}

/*
 * .component-team-capacity-task-table-td — padding + overflow handling
 * shared by body cells.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: paired with row.
 * Do NOT use for: generic cells.
 */
.component-team-capacity-task-table-td {
  overflow: hidden;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-team-capacity-task-table-td-first {
  padding-left: calc(var(--spacing) * 4);
}

.component-team-capacity-task-table-td-body {
  color: var(--color-text-body);
}

/*
 * .component-team-capacity-task-table-task-wrap — flex pair of the
 * priority dot + task title inside the first column.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: paired with task cell.
 * Do NOT use for: generic rows.
 */
.component-team-capacity-task-table-task-wrap {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  min-width: 0;
}

/*
 * .component-team-capacity-task-table-priority-dot — small round dot
 * indicating task priority. Color comes from .component-priority-dot-*.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: paired with task wrap.
 * Do NOT use for: generic dots.
 */
.component-team-capacity-task-table-priority-dot {
  width: calc(var(--spacing) * 2);
  height: calc(var(--spacing) * 2);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

/*
 * .component-team-capacity-task-table-task-title — task title text
 * inside the first column.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: paired with task wrap.
 * Do NOT use for: generic titles.
 */
.component-team-capacity-task-table-task-title {
  overflow: hidden;
  font-size: var(--font-size-xs);
  color: var(--color-text-heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .component-team-capacity-task-table-due — font-medium wrapper for
 * the due value. Color comes from .component-due-text-*.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: paired with row.
 * Do NOT use for: generic spans.
 */
.component-team-capacity-task-table-due {
  font-weight: 500;
}

/*
 * .component-team-capacity-task-table-priority — font-medium wrapper
 * for the priority value. Color comes from .component-priority-text-*.
 *
 * Used by: app/components/team_capacity/task_table_component.html.erb
 * Reuse when: paired with row.
 * Do NOT use for: generic spans.
 */
.component-team-capacity-task-table-priority {
  font-weight: 500;
}

/* ─── MyTasks::PageComponent ─── */

/*
 * .component-my-tasks-page — outer padding shell for the My Tasks page.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic pages.
 */
.component-my-tasks-page {
  padding: calc(var(--spacing) * 12) var(--spacing-page-x);
}

/*
 * .component-my-tasks-page-header — hero block above the stats cluster.
 * Matches the prototype's list-page hero rhythm: title + lead subtitle,
 * 40px (mb-10) of breathing room before the stats grid.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 */
.component-my-tasks-page-header {
  margin-bottom: calc(var(--spacing) * 10);
}

/*
 * .component-my-tasks-page-title — primary page heading.
 * Fluid clamp matching the prototype's PageHeader title.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 */
.component-my-tasks-page-title {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--color-text-heading);
}

/*
 * .component-my-tasks-page-subtitle — lead-style subtitle beneath the
 * title. Uses the prototype's type.body size (17px) for a hero-grade
 * read rather than the older xs caption.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 */
.component-my-tasks-page-subtitle {
  margin-top: calc(var(--spacing) * 2);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/*
 * .component-my-tasks-page-tabs — spacing wrapper that sets the Open /
 * Completed tab strip below the hero copy. The strip is inline-flex, so it
 * needs a block owner to carry the gap between it and the subtitle.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic tab strips — TabBarComponent brings its own chrome.
 */
.component-my-tasks-page-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 3);
  margin-top: calc(var(--spacing) * 6);
}

/*
 * .component-my-tasks-page-template-links — shortcuts to the admin template
 * pages, sitting at the far end of the tab strip for template editors.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 * Reuse when: never.
 */
.component-my-tasks-page-template-links {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 2);
}

/*
 * .component-my-tasks-page-stats — margin wrapper around the stat cards
 * grid.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 */
.component-my-tasks-page-stats {
  margin-bottom: calc(var(--spacing) * 10);
}

/*
 * .component-my-tasks-page-drawer-loading — centered spinner shown
 * while the task drawer is loading.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 * Reuse when: paired with drawer frame.
 * Do NOT use for: generic loaders.
 */
.component-my-tasks-page-drawer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: calc(var(--spacing) * 12);
  padding-bottom: calc(var(--spacing) * 12);
}

/*
 * .component-my-tasks-page-drawer-spinner — animated spinner ring
 * rendered inside the drawer loading state.
 *
 * Used by: app/components/my_tasks/page_component.html.erb
 * Reuse when: paired with drawer loading wrap.
 * Do NOT use for: generic spinners.
 */
.component-my-tasks-page-drawer-spinner {
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
  border: 2px solid var(--color-border-themed);
  border-top-color: var(--color-accent);
  border-radius: var(--radius-pill);
  animation: spin 1s linear infinite;
}

/* ─── MyTasks::CollapsibleSectionComponent ─── */

/*
 * .component-my-tasks-section — outer card wrapping one collapsible
 * section header + content.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic cards.
 */
.component-my-tasks-section {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/*
 * .component-my-tasks-section-button — full-width clickable header
 * that toggles the accordion.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with section.
 * Do NOT use for: generic buttons.
 */
.component-my-tasks-section-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 6);
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* Focus doctrine: the shared ring on keyboard focus. Inset — the button is a
 * full-bleed header row inside the section card's clipped rounded edge. */
.component-my-tasks-section-button:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}


/*
 * .component-my-tasks-section-icon-wrap — rounded square wrapping the
 * section icon. Pair with a `-red`/`-blue`/`-amber`/`-gray` variant for color.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with section button.
 * Do NOT use for: generic icon wraps.
 */
.component-my-tasks-section-icon-wrap {
  display: inline-flex;
  width: calc(var(--spacing) * 8);
  height: calc(var(--spacing) * 8);
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.component-my-tasks-section-icon-wrap-red {
  background: color-mix(in srgb, var(--color-red) 15%, transparent);
  color: var(--color-red-mark);
}

.component-my-tasks-section-icon-wrap-blue {
  background: color-mix(in srgb, var(--color-accent) 15%, transparent);
  color: var(--color-accent);
}

/*
 * .component-my-tasks-section-icon-wrap-amber — icon-wrap variant for the
 * Waiting section, where the task is parked with someone else. Amber sits
 * between the red of Overdue and the gray of To do, which is the same
 * ranking the section order states.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with the icon wrap on a My Tasks section.
 * Do NOT use for: generic amber icon wraps.
 */
.component-my-tasks-section-icon-wrap-amber {
  background: color-mix(in srgb, var(--color-yellow) 15%, transparent);
  color: var(--color-yellow-mark);
}

.component-my-tasks-section-icon-wrap-gray {
  background: color-mix(in srgb, var(--color-gray-400) 15%, transparent);
  color: var(--color-text-muted);
}

/*
 * .component-my-tasks-section-icon — sized icon rendered inside the
 * icon wrap.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with icon wrap.
 * Do NOT use for: generic icons.
 */
.component-my-tasks-section-icon {
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
}

/*
 * .component-my-tasks-section-title — semibold section title next to
 * the icon.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with section heading.
 * Do NOT use for: generic titles.
 */
.component-my-tasks-section-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-my-tasks-section-count — circular pill displaying the
 * task count next to the section title.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with section heading.
 * Do NOT use for: generic count pills.
 */
.component-my-tasks-section-count {
  display: inline-flex;
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
  align-items: center;
  justify-content: center;
  background: var(--color-surface-elevated);
  color: var(--color-text-body);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

/*
 * .component-my-tasks-section-chevron — chevron icon indicating the
 * section's expanded state.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with section button.
 * Do NOT use for: generic chevrons.
 */
.component-my-tasks-section-chevron {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
  color: var(--color-text-muted);
  transition: transform var(--transition-timing-slow);
}

.component-my-tasks-section-chevron-collapsed {
  transform: rotate(180deg);
}

/*
 * .component-my-tasks-section-content — bordered content region
 * rendered beneath the section button.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with section.
 * Do NOT use for: generic content regions.
 */
.component-my-tasks-section-content {
  border-top: 1px solid var(--color-border-subtle);
}

/*
 * .component-my-tasks-section-empty — muted empty-state message shown
 * when the section has no tasks.
 *
 * Used by: app/components/my_tasks/collapsible_section_component.html.erb
 * Reuse when: paired with section content.
 * Do NOT use for: generic empty states.
 */
.component-my-tasks-section-empty {
  padding: calc(var(--spacing) * 6) 0;
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ─── MyTasks::TaskTableComponent ─── */

/*
 * .component-my-tasks-table — table rendering tasks inside a
 * collapsible section. The five fixed columns below claim 748px; the min-width
 * leaves the task column 180px on top of that instead of letting it collapse,
 * and below it the table scrolls inside the section card. It is set just under
 * the width the table reaches at 1280, so no desktop viewport gains a
 * scrollbar it did not have.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic tables.
 */
.component-my-tasks-table {
  width: 100%;
  min-width: 58rem;
  table-layout: fixed;
  font-size: var(--font-size-xs);
}

/*
 * .component-my-tasks-table-col-*
 * Column widths on the <col> elements inside the colgroup. Five of the six
 * columns hold content with a hard floor — a status or priority pill, the due
 * phrase, the hours bar and its label — and none of it wraps, so each takes a
 * fixed width sized to its longest string in either locale plus the cell's
 * 32px of padding. The status column is sized by the Spanish "Revisión del
 * Cliente" pill at 148px, which is 39px wider than the English "Client
 * review"; a percentage share that cleared it would have had to come out of
 * the task column, which is the one place the page cannot afford to lose.
 * That column carries the only elastic content, the truncating title and
 * breadcrumb, so it is left unsized and absorbs whatever the table has left:
 * 354px at 1440, still wider than the 32% share it replaced, and 180px at the
 * table's min-width.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: never.
 * Do NOT use for: generic table columns.
 */
.component-my-tasks-table-col-status {
  width: 11.5rem;
}

.component-my-tasks-table-col-tag {
  width: 6.75rem;
}

.component-my-tasks-table-col-priority {
  width: 6.5rem;
}

.component-my-tasks-table-col-due {
  width: 10rem;
}

.component-my-tasks-table-col-time {
  width: 12rem;
}

/*
 * .component-my-tasks-table-head — elevated table head background.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with table.
 * Do NOT use for: generic headers.
 */
.component-my-tasks-table-head {
  background: var(--color-surface-elevated);
}

/*
 * .component-my-tasks-table-head-row — single header row with uppercase
 * label styling.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with table head.
 * Do NOT use for: generic rows.
 */
.component-my-tasks-table-head-row {
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

/*
 * .component-my-tasks-table-th — padding shared by header cells.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with head row.
 * Do NOT use for: generic cells.
 */
.component-my-tasks-table-th {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
}

.component-my-tasks-table-th-first {
  padding-left: calc(var(--spacing) * 4);
}

/*
 * .component-my-tasks-table-row — body row with hover highlight and
 * click handler.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with table.
 * Do NOT use for: generic rows.
 */
.component-my-tasks-table-row {
  border-bottom: 1px solid var(--color-border-subtle);
}

/*
 * .component-my-tasks-table-td — padding shared by body cells.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with row.
 * Do NOT use for: generic cells.
 */
.component-my-tasks-table-td {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  vertical-align: middle;
}

.component-my-tasks-table-td-first {
  padding-left: calc(var(--spacing) * 4);
}

/*
 * .component-my-tasks-table-task-wrap — flex pair of the priority dot
 * and the stacked title/breadcrumb.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with first task cell.
 * Do NOT use for: generic rows.
 */
.component-my-tasks-table-task-wrap {
  min-width: 0;
}

/*
 * .component-my-tasks-table-priority-dot — small round dot indicating
 * task priority. Color comes from .component-priority-dot-*.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with task wrap.
 * Do NOT use for: generic dots.
 */
.component-my-tasks-table-priority-dot {
  width: calc(var(--spacing) * 2);
  height: calc(var(--spacing) * 2);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

/*
 * .component-my-tasks-table-task-body — stacked title/breadcrumb column
 * inside the task cell.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with task wrap.
 * Do NOT use for: generic columns.
 */
.component-my-tasks-table-task-body {
  min-width: 0;
}

/*
 * .component-my-tasks-table-task-title — truncated task title, rendered as
 * the anchor to the task page so the row survives a cmd-click.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with task body.
 * Do NOT use for: generic titles.
 */
.component-my-tasks-table-task-title {
  display: block;
  overflow: hidden;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The whole row opens the drawer, so the title underlines only on its own
 * hover: that is what tells the reader this one target is also a real link
 * they can open in a new tab. */
.component-my-tasks-table-task-title:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.component-my-tasks-table-task-title:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/*
 * .component-my-tasks-table-task-breadcrumb — muted breadcrumb beneath the
 * title: client › project for a top-level task, client › parent task for a
 * sub-task.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with task body.
 * Do NOT use for: generic captions.
 */
.component-my-tasks-table-task-breadcrumb {
  display: block;
  overflow: hidden;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * .component-my-tasks-table-due — flex wrapper for the due-date icon
 * and label inside the Due cell.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with due cell.
 * Do NOT use for: generic rows.
 */
.component-my-tasks-table-due {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  font-weight: 500;
  white-space: nowrap;
}

/*
 * .component-my-tasks-table-due-icon — sized calendar icon inside the
 * due wrap.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with due wrap.
 * Do NOT use for: generic icons.
 */
.component-my-tasks-table-due-icon {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
}

/*
 * .component-my-tasks-table-time-wrap
 * Row pairing the hours bar track with the spent/estimated label. The
 * label uses tabular nums + no-wrap so "13.3h / 2h" doesn't break in
 * the table cell. Bar takes flex space; label hugs the right.
 */
.component-my-tasks-table-time-wrap {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

.component-my-tasks-table-time-wrap .component-hours-bar-track {
  flex: 1;
  min-width: 0;
}

/*
 * .component-my-tasks-table-time-label — body-colored time label.
 *
 * Used by: app/components/my_tasks/task_table_component.html.erb
 * Reuse when: paired with time wrap.
 * Do NOT use for: generic labels.
 */
.component-my-tasks-table-time-label {
  color: var(--color-text-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── DividerComponent ─── */

/*
 * .component-divider — thin horizontal separator. Pairs with a
 * spacing modifier (`component-divider-N`) that sets symmetric
 * vertical margin using the shared --spacing token.
 *
 * Used by: app/components/divider_component.html.erb
 * Reuse when: a simple horizontal break is needed between
 *   blocks of content. For layout gaps, prefer `.stack`.
 * Do NOT use for: decorative section breaks with gradients,
 *   patterns, or other custom styling.
 */
.component-divider {
  border-top: 1px solid var(--color-border-themed);
}

.component-divider-3  { margin: calc(var(--spacing) * 4) 0; }
.component-divider-4  { margin: calc(var(--spacing) * 4) 0; }
.component-divider-6  { margin: calc(var(--spacing) * 6) 0; }
.component-divider-10 { margin: calc(var(--spacing) * 8) 0; }

/* ─── DataSourceGridComponent ─── */

/*
 * .component-data-source-grid — responsive grid of full-bleed hero
 * cards on the databases index. Reflows from one column on phones to
 * two on laptops, capped at three on wide screens so the cards never
 * get narrow enough to wrap their titles or crowd the tag column.
 * auto-fill keeps a lone card at its natural width; the inner max()
 * raises the track floor to a third of the row once three columns
 * fit, which pins the count at three and lets those three widen to
 * fill ultrawide displays; the outer min(…, 100%) collapses to a
 * single full-width column below 30rem so cards never overflow a
 * narrow viewport. The subtracted `calc(var(--spacing) * 8)` is the
 * two 16px gaps that sit between three columns.
 *
 * Used by: app/components/data_source_grid_component.html.erb
 * Reuse when: laying out large photo/hero cards that should stay
 *   readable rather than stretch to the full page width.
 * Do NOT use for: small uniform tiles — prefer the 16rem-min grids on
 *   the audiences/vault indexes, or `.grid-auto`.
 */
.component-data-source-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, max(30rem, calc((100% - calc(var(--spacing) * 8)) / 3))), 1fr)
  );
  gap: calc(var(--spacing) * 4);
  margin-top: calc(var(--spacing) * 6);
}

/* ─── SystemNoticesComponent ─── */

/*
 * .component-system-notices — top-of-app broadcast banner.
 * Uses a static brand-blue background so the notice is visible
 * across themes; paired with inverted text color.
 *
 * Used by: app/components/system_notices_component.html.erb
 * Reuse when: you need a full-width alert strip at the very top
 *   of the app chrome. For inline page alerts, use the alert
 *   pattern instead.
 */
.component-system-notices {
  width: 100%;
  padding: calc(var(--spacing) * 4) 0;
  text-align: center;
  font-size: var(--font-size-sm);
  /* blue-strong, not blue: white text on the bright --color-blue only reaches
   * 2.6:1; the deeper blue clears WCAG AA in both themes. */
  background: var(--color-blue-strong);
  color: var(--color-text-inverted);
}

/* ─── ToggleComponent ─── */

/*
 * .component-toggle-wrapper — switch button. Shape, transition,
 * and focus ring are size-independent; the size modifier class
 * sets local CSS variables that cascade to the slider inside.
 *
 * Stimulus `toggle_controller` swaps the `-on` / `-off` variant
 * classes on the wrapper and slider to animate state changes.
 *
 * Used by: app/components/toggle_component.html.erb
 * Reuse when: render via `ToggleComponent.new(...)`; do not apply
 *   these classes directly on bespoke elements.
 */
.component-toggle-wrapper {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color var(--transition-timing-slow);
  height: var(--toggle-height);
  width: var(--toggle-width);
}

/* Focus doctrine: the shared ring on keyboard focus, replacing the bespoke
 * double ring this toggle used to draw for itself. The gap that kept the ring
 * legible against the accent-filled "on" track is now made by painting the
 * track's own 2px transparent border with the surface color, so the ring
 * itself stays the untouched token. */
.component-toggle-wrapper:focus-visible {
  outline: none;
  border-color: var(--color-surface-primary);
  box-shadow: var(--focus-ring);
}

/* Toggle geometry is internally consistent, not on the {1,2,4,6,8} rhythm:
   slider-size must equal height minus 2*border, and translate must equal
   width minus height. Keeps `* 5` / `* 9` as geometric exceptions. */
.component-toggle-wrapper-default {
  --toggle-height:      calc(var(--spacing) * 6);
  --toggle-width:       calc(var(--spacing) * 11);
  --toggle-slider-size: calc(var(--spacing) * 5);
  --toggle-translate:   calc(var(--spacing) * 5);
}

.component-toggle-wrapper-small {
  --toggle-height:      calc(var(--spacing) * 5);
  --toggle-width:       calc(var(--spacing) * 9);
  --toggle-slider-size: calc(var(--spacing) * 4);
  --toggle-translate:   calc(var(--spacing) * 4);
}

.component-toggle-wrapper-on  { background: var(--color-accent); }
.component-toggle-wrapper-off { background: var(--color-border-strong); }

/*
 * .component-toggle-slider — the circular thumb that slides
 * across the wrapper. Reads `--toggle-slider-size` and
 * `--toggle-translate` inherited from the wrapper size class.
 */
.component-toggle-slider {
  position: relative;
  display: inline-block;
  height: var(--toggle-slider-size);
  width: var(--toggle-slider-size);
  background: var(--color-text-inverted);
  border-radius: var(--radius-pill);
  box-shadow: 0 0.0625rem 0.125rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
  transition: transform var(--transition-timing-slow);
}

.component-toggle-slider-on  { transform: translateX(var(--toggle-translate)); }
.component-toggle-slider-off { transform: translateX(0); }

/* ─── FooterComponent ─── */

/*
 * .component-footer — app-level footer. Sticks to the bottom of a
 * minimum-full-viewport layout via `top: 100vh` so it only appears
 * after the main content on short pages.
 *
 * Used by: app/components/footer_component.html.erb
 * Reuse when: rendering the global page footer. Do not reuse for
 *   in-card or per-section footers.
 */
.component-footer {
  position: sticky;
  top: 100vh;
  font-size: var(--font-size-sm);
  border-top: 1px solid var(--color-border-subtle);
}

.component-footer-content {
  padding: calc(var(--spacing) * 6);
  color: var(--color-text-muted);
}

.component-footer-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* ─── SidebarLinkComponent ─── */

/*
 * .component-sidebar-link — one nav row inside the left sidebar.
 * Active state replaces muted text with surface-primary background
 * + accent text. Icon and chevron siblings use their own size
 * modifiers so the link row can be reused for both mobile and
 * desktop sidebar variants.
 *
 * Used by: app/components/sidebar_link_component.html.erb
 * Reuse when: rendering a sidebar/menu row inside the sidebar
 *   shell. For top-nav links, use the topbar classes.
 */
.component-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: background-color var(--motion-fast), color var(--motion-fast);
  color: var(--color-text-muted);
}

.component-sidebar-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-sidebar-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-sidebar-link-active,
.component-sidebar-link-active:hover {
  background: var(--color-surface-elevated);
  color: var(--color-text-heading);
  font-weight: 600;
}

/*
 * .component-sidebar-link-active-module — the active row of a module whose
 * children render below it. It keeps everything the active state says (heading
 * ink, 600, module-colored icon) except the fill, which belongs to the active
 * child: exactly one filled pill in the rail, on the row naming the page you
 * are on. Applied alongside .component-sidebar-link-active, which stays the
 * single "this row is active" hook.
 *
 * Used by: app/components/sidebar_link_component.rb (link_class)
 */
.component-sidebar-link-active-module {
  background: transparent;
}

.component-sidebar-link-active-module:hover {
  background: var(--color-surface-hover);
}

/* Chevron turns down over an expanded group — a right-pointing one reads as
 * "collapsed". The global prefers-reduced-motion reset collapses the duration. */
.component-sidebar-link-active-module .component-sidebar-link-chevron {
  transform: rotate(90deg);
  transition: transform var(--motion-fast);
}

.component-sidebar-link-icon {
  width: 1rem;
  height: 1rem;
}

.component-sidebar-link-active .component-sidebar-link-icon,
.component-sidebar-link-active .component-sidebar-link-chevron {
  color: var(--sidebar-link-color, var(--color-accent));
}

.component-sidebar-link-title { flex: 1; }

.component-sidebar-link-chevron {
  width: 0.625rem;
  height: 0.625rem;
  margin-left: auto;
}

/* ─── SidebarChildLinkComponent ─── */

/*
 * .component-sidebar-children — the nested rows under an expanded module
 * entry (today only Direct Mail). Server-rendered only while the viewer is
 * inside that module, so there is no expand/collapse motion to animate. It is
 * a real list labelled by its parent row, so the group is announced as that
 * module's pages rather than as five more top-level links.
 *
 * Used by: app/components/sidebar_component.html.erb
 * Reuse when: rendering the child rows of a sidebar module entry.
 */
.component-sidebar-children {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/*
 * .component-sidebar-child-link — one nested nav row. Same states as
 * .component-sidebar-link (muted at rest, surface wash on hover, filled
 * raised-surface pill with heading text when active) but with no icon
 * column and no chevron; the indent alone carries the nesting.
 *
 * Used by: app/components/sidebar_child_link_component.html.erb
 * Reuse when: rendering a nested row inside .component-sidebar-children.
 *   For a top-level row, use .component-sidebar-link.
 */
.component-sidebar-child-link {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  /* Child text aligns under the parent row's *title*, not its icon: the
     parent's own left padding plus the icon column (1rem icon + 0.625rem
     gap). Off the {1,2,4,6,8} rhythm on purpose — this is an alignment
     constraint against a sibling row, not a spacing choice. */
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
  padding-left: calc(var(--spacing) * 3 + 1rem + 0.625rem);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: background-color var(--motion-fast), color var(--motion-fast);
  color: var(--color-text-muted);
}

.component-sidebar-child-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-sidebar-child-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-sidebar-child-link-active,
.component-sidebar-child-link-active:hover {
  background: var(--color-surface-elevated);
  color: var(--color-text-heading);
  font-weight: 600;
}

/*
 * .component-sidebar-child-link-soon — a surface that is listed but not built.
 * Rendered as a <span>, so it takes no hover, no focus and no pill; the lighter
 * ink plus the tag on the right say "coming, not clickable" before the click
 * rather than after it.
 */
.component-sidebar-child-link-soon {
  color: color-mix(in srgb, var(--color-text-muted) 70%, transparent);
  cursor: default;
}

.component-sidebar-child-link-tag {
  flex: none;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-hover);
  border-radius: var(--radius-sm);
  padding-inline: calc(var(--spacing) * 1.5);
}

/* Long labels (Spanish runs wide in a 15rem rail) truncate rather than wrap:
 * a second line would break the row rhythm of the group. */
.component-sidebar-child-link-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── ModalComponent ─── */

/*
 * .component-modal-* — overlay shell for ModalComponent.
 *
 * Animation approach: the container starts with `.hidden` (display: none).
 * The modal_controller.js removes `.hidden` and on the next frame adds
 * `.component-modal-visible`. CSS transitions on background and panel
 * animate from hidden-state (opacity 0, translated down) to visible-state.
 * On close, the controller removes `.component-modal-visible`, waits for
 * transitionend, then re-adds `.hidden`.
 *
 * Used by: app/components/modal_component.html.erb
 * Reuse when: rendering a modal shell via `ModalComponent.new`.
 *   Do not apply these classes outside of a ModalComponent render.
 */
.component-modal-container {
  position: fixed;
  inset: 0;
  padding: 0 calc(var(--spacing) * 4) calc(var(--spacing) * 6);
  /* Modals interrupt everything else: above the task drawer (60) and
   * the asset lightbox (80). Confirmation modals especially must be
   * able to appear over a lightbox-triggered destructive action. */
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 40rem) {
  .component-modal-container {
    inset: 0;
    padding: 0;
    align-items: center;
  }
}

.component-modal-background {
  position: fixed;
  inset: 0;
  opacity: 0;
  transition: opacity 200ms ease-in;
}

.component-modal-container.component-modal-visible .component-modal-background {
  opacity: 1;
  transition: opacity 300ms ease-out;
}

.component-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-scrim);
}

/* Focus doctrine, container exception: the panel takes focus on open so the
 * dialog announces its role and name before the reader lands on a control. It
 * is not itself operable, so it draws no ring — the ring belongs to the controls
 * inside it, and the browser's default ring around the whole panel read as a
 * selected box. Mirrors .component-drawer-panel. */
.component-modal-panel:focus,
.component-modal-panel:focus-visible {
  outline: none;
}

.component-modal-panel {
  position: relative;
  padding: calc(var(--spacing) * 6) calc(var(--spacing) * 4) calc(var(--spacing) * 4);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-elev);
  /* Below 40rem the container anchors the panel above a spacing-6 bottom gap,
   * so the panel stops at the space left above that gap and keeps its header
   * on screen. dvh tracks the visible height on phone browsers whose 100vh
   * runs taller than the screen; vh is the fallback. */
  max-height: calc(100vh - var(--spacing) * 6);
  max-height: calc(100dvh - var(--spacing) * 6);
  /* Scroll the panel's own content when a tall modal (e.g. a multi-section
   * form) exceeds the viewport, so the action row stays reachable instead of
   * spilling off-screen. Short modals never show a scrollbar. */
  overflow-y: auto;
  z-index: 50;
  opacity: 0;
  transform: translateY(1rem) scale(0.95);
  transition: opacity var(--motion-fast), transform var(--motion-fast);
}

.component-modal-container.component-modal-visible .component-modal-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity var(--motion-base), transform var(--motion-base);
}

@media (min-width: 40rem) {
  .component-modal-panel {
    padding: calc(var(--spacing) * 6);
    max-height: 100vh;
  }
}

.component-modal-close {
  position: absolute;
  right: 0;
  top: 0;
  margin: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 2);
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--color-text-body);
  background: transparent;
  transition: background var(--motion-fast), color var(--motion-fast);
}

.component-modal-close:hover {
  color: var(--color-text-heading);
  background: var(--color-surface-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-modal-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-modal-close-icon {
  width: 1rem;
  height: 1rem;
}

/*
 * .component-modal-narrow / -medium / -wide / -large
 * Modal panel width variants. Applied via the `size:` param on
 * ModalComponent (see the SIZES hash there for picking guidance).
 *
 * Used by: app/components/modal_component.html.erb
 * Reuse when: rendering a ModalComponent with a specific width.
 * Do NOT use for: standalone width caps — extend SIZES instead.
 */
.component-modal-narrow {
  max-width: 22rem;
  width: 100%;
}

.component-modal-medium {
  max-width: 32rem;
  width: 100%;
}

.component-modal-wide {
  max-width: 32.5rem;
  width: 100%;
}

.component-modal-large {
  max-width: 56rem;
  width: 100%;
}

/*
 * .component-modal-header / -body / -footer
 * Opt-in three-zone layout for content modals — header with title, body
 * with content, footer with action buttons. Each zone is divided by a
 * hairline border so the modal reads as a clear top-to-bottom flow.
 *
 * Use when the modal has a distinct title row and action buttons that
 * should anchor to the bottom edge. Skip when the modal is short and
 * action buttons can sit inline with the form (e.g. update-ETA, share).
 *
 * Adoption pattern:
 *   <%= render ModalComponent.new(id: ...) do %>
 *     <div class="component-modal-header">
 *       <h3 class="component-modal-title">Title</h3>
 *       <p class="component-modal-subtitle">Optional helper</p>
 *     </div>
 *     <div class="component-modal-body">…</div>
 *     <div class="component-modal-footer">[Cancel] [Confirm]</div>
 *   <% end %>
 *
 * The default modal panel already has top padding; when using the
 * header zone, the inner panel padding is shifted onto the zones so
 * the dividers can span edge-to-edge.
 */
.component-modal-panel:has(> .component-modal-header) {
  padding: 0;
}

/* .component-modal-flush — remove the panel's inner padding when the modal's
 * content owns its own edge-to-edge sections (header/body/footer hairlines).
 * Applied via `flush: true` on ModalComponent. */
.component-modal-flush {
  padding: 0;
}

.component-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 5) calc(var(--spacing) * 6);
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text-heading);
  letter-spacing: -0.012em;
}

.component-modal-subtitle {
  margin-top: calc(var(--spacing) * 1);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-modal-body {
  padding: calc(var(--spacing) * 6);
}

.component-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 6);
  border-top: 1px solid var(--color-border-subtle);
}

/*
 * .component-confirmation-modal*
 * Content shell for the global in-app confirmation modal. The surrounding
 * overlay and animation come from `.component-modal-*`; these classes own
 * confirmation-specific spacing, copy, and destructive emphasis.
 *
 * Used by: app/components/confirmation_modal_component.html.erb
 * Reuse when: rendering a confirmation dialog through
 * `ConfirmationModalComponent`.
 * Do NOT use for: general-purpose form or content modals.
 */
.component-confirmation-modal-panel {
  width: min(100%, 32rem);
}

/*
 * .component-modal-container:has(.component-confirmation-modal-panel)
 * Promotes the ModalComponent container above any other overlay (e.g.
 * the asset preview lightbox at z-index 70) when it hosts a
 * ConfirmationModalComponent. Confirmation prompts must always win the
 * stacking contest since they gate a destructive user decision.
 *
 * Used by: app/components/confirmation_modal_component.html.erb (via the
 *   `component-confirmation-modal-panel` class it passes into ModalComponent).
 * Reuse when: never — this is the single rule for the confirmation overlay.
 */
.component-modal-container:has(.component-confirmation-modal-panel) {
  z-index: 80;
}

.component-confirmation-modal {
  display: grid;
  gap: calc(var(--spacing) * 6);
}

.component-confirmation-modal-copy {
  padding-top: calc(var(--spacing) * 2);
}

.component-confirmation-modal-title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--color-text-heading);
}

.component-confirmation-modal-message {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: 1.55;
}

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

/*
 * .component-confirmation-modal-impersonation
 * While a super admin impersonates someone, the callout a destructive confirm
 * carries naming the account it changes ("This deletes it from Acme's
 * account, not yours"). Follows the impersonation tab so the warning reads
 * as the same signal: purple tonal with a 35% hairline in light, the plain
 * surface with heading ink and an orange icon and edge in dark.
 *
 * Used by: app/components/confirmation_modal_component.html.erb
 * Reuse when: never — the only impersonation warning inside a dialog.
 * Do NOT use for: general warnings in a dialog — use the body slot.
 */
.component-confirmation-modal-impersonation {
  display: flex;
  gap: calc(var(--spacing) * 2);
  align-items: flex-start;
  padding: calc(var(--spacing) * 3);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-purple) 18%, var(--color-surface-body));
  border: 1px solid color-mix(in srgb, var(--color-purple) 35%, transparent);
  color: var(--color-status-text-purple);
  font-size: var(--font-size-sm);
}

[data-theme="dark"] .component-confirmation-modal-impersonation {
  background: var(--color-surface-primary);
  border-color: var(--color-orange-mark);
  color: var(--color-text-heading);
}

.component-confirmation-modal-impersonation-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

[data-theme="dark"] .component-confirmation-modal-impersonation-icon {
  color: var(--color-orange-mark);
}

.component-confirmation-modal-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: calc(var(--spacing) * 3);
}

@media (min-width: 40rem) {
  .component-confirmation-modal-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.component-confirmation-modal-destructive .component-confirmation-modal-title {
  color: var(--color-text-danger);
}

/* ─── WhatsNewModalComponent ─── */

/*
 * .component-whats-new-* — content shell for the What's New announcement
 * modal. The overlay and animation come from `.component-modal-*`; these
 * classes own the gradient header, highlight rows, and CTA footer. The
 * panel class zeroes the default panel padding so the header gradient and
 * zone dividers can span edge-to-edge.
 *
 * Used by: app/components/whats_new_modal_component.html.erb
 * Reuse when: never — announcement entries reuse this one modal.
 * Do NOT use for: general-purpose content modals (use the
 *   `.component-modal-header/-body/-footer` zones instead).
 */
.component-modal-panel.component-whats-new-panel {
  max-width: 35rem;
  width: 100%;
  max-height: 85vh;
  padding: 0;
}

.component-whats-new-header {
  position: relative;
  padding: calc(var(--spacing) * 8) calc(var(--spacing) * 8) calc(var(--spacing) * 6);
  background: linear-gradient(135deg, var(--color-accent-subtle), transparent 70%);
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-whats-new-badge {
  margin-bottom: calc(var(--spacing) * 4);
}

/* The app's section-label idiom: 12px, 600, muted, sentence case. Uppercase and
   tracking are reserved for operators (AND, OR, API), never for a category. */
.component-whats-new-eyebrow {
  margin-bottom: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.component-whats-new-title {
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-whats-new-intro {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
}

.component-whats-new-intro a {
  color: var(--color-accent-strong);
  text-decoration: underline;
}

.component-whats-new-body {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 6) calc(var(--spacing) * 8);
}

.component-whats-new-highlight {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 3);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
}

.component-whats-new-highlight-copy {
  flex: 1;
  min-width: 0;
}

.component-whats-new-highlight-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-whats-new-highlight-desc {
  margin-top: calc(var(--spacing) * 0.5);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-whats-new-footer {
  display: flex;
  justify-content: flex-end;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 8);
  border-top: 1px solid var(--color-border-subtle);
}

/* ─── CommentToggleComponent ─── */

/*
 * .component-comment-toggle — inline switch + labels pair used on
 * comment/edit forms. Structural + layout classes live here;
 * `comment_toggle_controller.js` still toggles Tailwind background
 * / transform utilities on the button and slider during state
 * swaps — those remain inline on the template elements and are
 * tracked in the Tailwind cleanup queue.
 *
 * Used by: app/components/comment_toggle_component.html.erb
 * Reuse when: render via `CommentToggleComponent.new`.
 */
.component-comment-toggle {
  display: flex;
  align-items: center;
}

.component-comment-toggle-button {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: calc(var(--spacing) * 11);
  height: calc(var(--spacing) * 6);
  background-color: var(--color-surface-elevated);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color var(--transition-timing-slow);
}

.component-comment-toggle-button-checked {
  background-color: var(--color-accent);
}

/* Focus doctrine: the shared ring on keyboard focus, matching
 * .component-toggle-wrapper — the 2px transparent border is painted with the
 * surface color to keep a gap against the accent-filled "on" track, and the
 * ring itself is the untouched token. */
.component-comment-toggle-button:focus-visible {
  outline: none;
  border-color: var(--color-surface-primary);
  box-shadow: var(--focus-ring);
}

/* Slider size/translate are geometric exceptions: must match track
   inner height (24px - 2*2px borders = 20px = * 5) and slide distance
   (width 44px - height 24px = 20px = * 5). Off the {1,2,4,6,8} rhythm. */
.component-comment-toggle-slider {
  pointer-events: none;
  display: inline-block;
  width: calc(var(--spacing) * 5);
  height: calc(var(--spacing) * 5);
  background: var(--color-white);
  border-radius: var(--radius-pill);
  box-shadow: 0 0.0625rem 0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.0625rem 0.125rem color-mix(in srgb, var(--color-gray-900) 6%, transparent);
  transition: transform var(--transition-timing-slow);
  transform: translateX(0);
}

.component-comment-toggle-slider-checked {
  transform: translateX(calc(var(--spacing) * 5));
}

.component-comment-toggle-labels {
  margin-left: calc(var(--spacing) * 4);
  display: flex;
  flex-direction: column;
}

.component-comment-toggle-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-heading);
}

.component-comment-toggle-sublabel {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-comment-private-highlight
 * Subtle background tint applied to the rich-text editor input when
 * the "private" toggle is enabled, indicating the comment will be
 * internal-only.
 *
 * Used by: app/javascript/controllers/comment_controller.js
 */
.component-comment-private-highlight {
  background-color: color-mix(in srgb, var(--color-yellow-light) 10%, transparent);
}

/*
 * .component-comment-mention-suggestion
 * Individual suggestion button inside the @-mention dropdown.
 * Created dynamically by comment_mention_controller.js.
 *
 * Used by: app/javascript/controllers/comment_mention_controller.js
 */
.component-comment-mention-suggestion {
  width: 100%;
  text-align: left;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  font-size: var(--font-size-xs);
  color: var(--color-text-body);
  cursor: pointer;
}

/*
 * .component-comment-mention-suggestion-active
 * Highlighted suggestion in the @-mention dropdown. Keyboard navigation and
 * mouse hover share this one active state (set by the controller), so the
 * suggestion button intentionally has no :hover rule of its own.
 *
 * Used by: app/javascript/controllers/comment_mention_controller.js
 */
.component-comment-mention-suggestion-active {
  background: var(--color-surface-hover);
}

/* ─── TermsModalComponent ─── */

/*
 * .component-terms-modal-* — the control that opens the terms, and the
 * panel styling. `.component-terms-modal-panel` is passed through
 * to ModalComponent via its `:class` option to override the default
 * panel width.
 *
 * Used by: app/components/terms_modal_component.html.erb
 */
.component-terms-modal-prompt {
  padding-bottom: calc(var(--spacing) * 2);
}

/*
 * .component-terms-modal-inline-trigger — the `inline:` variant's control,
 * for a surface that names the terms inside a running sentence (the order
 * approval page's acceptance line) rather than offering them as a separate
 * action. It takes link treatment, not button chrome, so the sentence reads
 * as one line of prose, and it keeps a real <button> so it is focusable and
 * announced as the control that opens the terms.
 *
 * Used by: app/components/terms_modal_component.html.erb (inline: true)
 */
.component-terms-modal-inline-trigger {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.component-terms-modal-inline-trigger:hover {
  color: var(--color-accent-hover);
}

.component-terms-modal-inline-trigger:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

/* Wide enough for a comfortable measure on a desktop, and the whole
 * container on a phone, where 60% of the screen left the terms a
 * few words a line. */
.component-terms-modal-panel {
  width: 100%;
  max-width: 48rem;
}

.component-terms-modal-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: calc(var(--spacing) * 8);
}

/*
 * .component-terms-modal-body
 * The terms themselves: CORE's published copy, fetched and sanitized by
 * Core::Term#body_html down to paragraphs, lists, headings, emphasis and
 * links, then set here in the system face on the panel's own surface so
 * it reads the same in both themes. Legal prose is read in place, so it
 * is a bounded scroll region under the title rather than a page-long
 * modal, focusable and named by the title so a keyboard can scroll it.
 *
 * Used by: app/components/terms_modal_component.html.erb
 * Reuse when: nowhere else; other long copy is .prose.
 * Do NOT use for: the iframe fallback, which is .component-terms-modal-iframe.
 */
.component-terms-modal-body {
  max-height: min(34rem, 65dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-inline-end: calc(var(--spacing) * 2);
  color: var(--color-text-body);
  font-size: var(--font-size-sm);
  line-height: 1.55;
  text-align: start;
  overflow-wrap: break-word;
}

.component-terms-modal-body > * {
  max-width: 72ch;
}

.component-terms-modal-body > * + *,
.component-terms-modal-body li + li {
  margin-top: calc(var(--spacing) * 2);
}

.component-terms-modal-body ol,
.component-terms-modal-body ul {
  padding-inline-start: calc(var(--spacing) * 6);
}

.component-terms-modal-body ol {
  list-style: decimal;
}

.component-terms-modal-body ul {
  list-style: disc;
}

.component-terms-modal-body :is(h1, h2, h3, h4, strong) {
  color: var(--color-text-heading);
  font-weight: 600;
}

.component-terms-modal-body a {
  color: var(--color-accent-strong);
  text-decoration: underline;
}

.component-terms-modal-body:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

.component-terms-modal-iframe {
  width: 100%;
  height: calc(var(--spacing) * 96);
  font-size: var(--font-size-lg);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-md);
}

/* ─── CarouselComponent ─── */

/*
 * .component-carousel-* — horizontal card carousel header, nav,
 * and track. The `track` element is scrolled horizontally by
 * carousel_controller.js on next/previous button clicks.
 *
 * Used by: app/components/carousel_component.html.erb
 * Reuse when: render via `CarouselComponent.new(title:)`.
 */
.component-carousel-header {
  justify-content: space-between;
  margin-top: calc(var(--spacing) * 16);
  margin-bottom: calc(var(--spacing) * 4);
}

.component-carousel-title {
  font-weight: 700;
  font-size: var(--font-size-xl);
}

.component-carousel-nav {
  display: flex;
  gap: calc(var(--spacing) * 1);
}

.component-carousel-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

/* ─── PageSizeSelectComponent ─── */

/*
 * .component-page-size-select-* — tiny per-page dropdown. Pops up
 * above the trigger; the `animation_controller` still toggles the
 * Tailwind transition utilities that live inline on the menu
 * element (see Tailwind cleanup queue).
 *
 * Used by: app/components/page_size_select_component.html.erb
 */
.component-page-size-select { position: relative; }

.component-page-size-select-button {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  cursor: pointer;
}

.component-page-size-select-button:hover { color: var(--color-text-heading); }

/* Focus doctrine: the shared ring on keyboard focus. */
.component-page-size-select-button:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

.component-page-size-select-chevron {
  width: 0.75rem;
  height: 0.75rem;
}

.component-page-size-select-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: calc(var(--spacing) * 4);
  z-index: 9999;
}

.component-page-size-select-panel {
  position: relative;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.25rem 0.375rem -0.25rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
  width: calc(var(--spacing) * 48);
  padding: calc(var(--spacing) * 2) 0;
}

.component-page-size-select-option {
  display: block;
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  text-align: left;
  font-size: var(--font-size-xs);
  color: var(--color-text-body);
}

.component-page-size-select-option-active {
  background: var(--color-surface-elevated);
  font-weight: 500;
}

/* Focus doctrine: the shared ring on keyboard focus. Inset because the option
 * is a full-bleed row — an outer ring would sit outside the panel's border. */
.component-page-size-select-option:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

.component-page-size-select-arrow {
  position: absolute;
  right: calc(var(--spacing) * 4);
  top: 100%;
  margin-top: -0.0625rem;
  width: 0;
  height: 0;
  border-left: 0.375rem solid transparent;
  border-right: 0.375rem solid transparent;
  border-top: 0.375rem solid var(--color-surface-primary);
}

/* ─── ActiveTaskPanelComponent ─── */

/*
 * .component-active-tasks — in-progress task indicator docked in the
 * sidebar, just above the footer divider. With a single active task it
 * is a sidebar-style link (pulse dot + live timer + task title) that
 * opens the task. With several, it collapses to a pulse dot + count and
 * reveals a flyout to the right of the sidebar listing each task.
 *
 * The wrapper is a flex column with no block padding so it collapses to
 * zero height when the user has no active tasks (the empty wrapper still
 * carries the id that the Turbo stream replaces). The flyout is
 * position: fixed (not absolute) so it escapes the sidebar's
 * overflow-y: auto clipping; active_tasks_flyout_controller sets its
 * coordinates from the trigger's bounding rect.
 *
 * Used by: app/components/active_task_panel_component.html.erb
 */
.component-active-tasks {
  display: flex;
  flex-direction: column;
  padding-inline: calc(var(--spacing) * 3);
}

.component-active-tasks > * {
  margin-bottom: calc(var(--spacing) * 2);
}

/* Shared row chrome for the single-task link and the multi-task trigger. */
.component-active-tasks-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.component-active-tasks-row:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-hover);
}

/* Reset native button chrome so the trigger matches the link row. */
.component-active-tasks-trigger-button {
  background: transparent;
  border: 0;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-active-tasks-trigger-button:focus-visible {
  outline: none;
  border-radius: var(--radius-md);
  box-shadow: var(--focus-ring);
}

.component-active-tasks-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 2.5);
  height: calc(var(--spacing) * 2.5);
  flex-shrink: 0;
}

.component-active-tasks-indicator-ping {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--color-task-emerald);
  opacity: 0.45;
  animation: ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.component-active-tasks-indicator-dot {
  position: relative;
  width: calc(var(--spacing) * 2);
  height: calc(var(--spacing) * 2);
  border-radius: var(--radius-pill);
  background: var(--color-task-emerald);
}

.component-active-tasks-time {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--color-text-heading);
  flex-shrink: 0;
}

.component-active-tasks-title,
.component-active-tasks-count {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-active-tasks-chevron {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

/*
 * Flyout: a fixed-position panel placed to the right of the sidebar by
 * active_tasks_flyout_controller. Hidden until the controller adds the
 * open class on hover/focus; padding-left bridges the gap so the pointer
 * can travel from the trigger into the panel.
 */
.component-active-tasks-flyout {
  position: fixed;
  z-index: 60;
  padding-left: calc(var(--spacing) * 2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-0.25rem);
  transition: opacity var(--motion-fast), transform var(--motion-fast), visibility var(--motion-fast);
}

.component-active-tasks-flyout-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.component-active-tasks-flyout-panel {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 15rem;
  max-width: 20rem;
  max-height: calc(100vh - calc(var(--spacing) * 16));
  overflow-y: auto;
  padding: calc(var(--spacing) * 2);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.component-active-tasks-flyout-heading {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.component-active-tasks-flyout-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.component-active-tasks-flyout-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-hover);
}

.component-active-tasks-flyout-title {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-heading);
}

/* ─── AppSwitcherComponent ─── */

/*
 * .component-app-switcher — the VIA / Admin / CORE app switcher: an
 * icon-only "waffle" button sitting in line with the logo at the top of
 * the sidebar (rendered only for partner-admins via
 * SidebarComponent#show_apps?). Clicking it opens a popover listing every
 * app the user can reach as a colored icon tile (tinted bg + glyph,
 * matching the dashboard quick-action tiles), the current one marked with
 * a check. Toggle / click-outside / motion use the shared `animation`
 * Stimulus controller (same as the user menu), so no bespoke JS. The
 * popover opens downward within the sidebar's width, so a plain absolute
 * popover is not clipped by the sidebar's overflow-y: auto.
 *
 * Used by: app/components/app_switcher_component.html.erb
 */
.component-app-switcher {
  position: relative;
  flex-shrink: 0;
}

.component-app-switcher-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 9);
  height: calc(var(--spacing) * 9);
  border-radius: var(--radius-lg);
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.component-app-switcher-trigger:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-app-switcher-trigger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-app-switcher-trigger-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Popover: aligned to the button's right edge, opens downward. */
.component-app-switcher-popover {
  position: absolute;
  top: calc(100% + calc(var(--spacing) * 2));
  /* Right edge lines up with the nav's right padding and the panel spans the
   * nav content width, so it fully covers the active nav pill behind it
   * rather than leaving its rounded edge peeking out. */
  right: calc(var(--spacing) * -3);
  width: calc(var(--spacing) * 54);
  z-index: 60;
  transform-origin: top right;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: calc(var(--spacing) * 1);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elev);
}

.component-app-switcher-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: calc(var(--spacing) * 2);
  border-radius: var(--radius-lg);
  transition: background-color var(--motion-fast);
}

.component-app-switcher-option:hover {
  background: var(--color-surface-hover);
}

.component-app-switcher-option-name {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
}

/*
 * App icon tiles — tinted background + full-color glyph, one hue per app,
 * matching the dashboard quick-action tile treatment.
 */
.component-app-switcher-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 9);
  height: calc(var(--spacing) * 9);
  flex-shrink: 0;
  border-radius: var(--radius-lg);
}

.component-app-switcher-tile-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.component-app-switcher-tile-via {
  background: color-mix(in srgb, var(--color-app-via) 14%, transparent);
  color: var(--color-app-via);
}

.component-app-switcher-tile-admin {
  background: color-mix(in srgb, var(--color-app-admin) 14%, transparent);
  color: var(--color-app-admin);
}

.component-app-switcher-tile-core {
  background: color-mix(in srgb, var(--color-app-core) 14%, transparent);
  color: var(--color-app-core);
}

.component-app-switcher-check {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

/* ─── SettingsPageComponent ─── */

/*
 * .component-settings-page — chrome wrapping every settings page.
 * Header is hidden on narrow viewports (the side menu provides
 * enough context); body switches from column to row at `lg`.
 *
 * Used by: app/components/settings_page_component.html.erb
 */
.component-settings-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Layout metrics shared by the body columns and the header cap below.
   * --settings-content-max must stay in sync with .accounts-settings-medium
   * (accounts.css) — the cap the content cards actually use. Pages that switch
   * to .accounts-settings-wide would need a wider cap here before gaining a
   * header trigger, or its right edge would not line up with the card. */
  --settings-side-menu-width: calc(var(--spacing) * 52);
  --settings-body-gap: calc(var(--spacing) * 10);
  --settings-content-max: 42rem;
}

/*
 * .component-settings-page-header
 * Horizontal-padding wrapper around the inner PageHeaderComponent.
 * Vertical rhythm comes from the page header's own hero padding.
 */
.component-settings-page-header {
  padding-inline: var(--spacing-page-x);
}

/* Pin the header's right edge to the content card's right edge (where the
 * right-aligned help trigger sits). The card column is
 * min(gutter-bounded width, --settings-content-max); capping the inner page
 * header to side-menu + body-gap + that same content max makes its right edge
 * resolve to the same min at every viewport width, so the two stay flush. */
.component-settings-page-header .component-page-header {
  max-width: calc(var(--settings-side-menu-width) + var(--settings-body-gap) + var(--settings-content-max));
}

/* No side menu (e.g. webhooks/new): the content column starts at the header's
 * left edge, so the header caps directly at the content max. */
.component-settings-page--no-sidebar .component-settings-page-header .component-page-header {
  max-width: var(--settings-content-max);
}

.component-settings-page-body {
  padding: 0 var(--spacing-page-x) calc(var(--spacing) * 12);
  flex: 1;
  gap: var(--settings-body-gap);
}

/* On phones/tablets the topbar already names the page and the section
 * dropdown shows the current item, so the hero header is redundant — hide it
 * (matching the documented intent above) and let the body own the top gutter.
 * The stacked dropdown→card gap also tightens to the standard section rhythm. */
@media (max-width: 63.9375rem) {
  .component-settings-page-header { display: none; }

  .component-settings-page-body {
    padding-top: var(--spacing-page-x);
    gap: calc(var(--spacing) * 6);
  }
}

@media (min-width: 64rem) {
  .component-settings-page-body { flex-direction: row; }
}

.component-settings-page-main {
  flex: 1;
  min-width: 0;
}

/* The contextual "Need help?" trigger fills the PageHeaderComponent actions
 * slot on the hero title row. The base .help-trigger caption size (xs) reads as
 * an afterthought beside the hero title, so bump it to sm (icon stays 1rem). */
.component-settings-page-header .help-trigger {
  font-size: var(--font-size-sm);
  gap: calc(var(--spacing) * 2);
}

/* ─── WizardStepsComponent ─── */

/*
 * .component-wizard-step-* — horizontal step indicator. The
 * `wizard_controller` reads the active/completed/upcoming class
 * arrays from data attributes on the container and applies them
 * to circles, labels, and lines directly (`element.className =
 * [...base, ...state].join(' ')`). Because the JS sets the class
 * string wholesale, the Ruby component and the controller must
 * reference the same class names — keep them in sync.
 *
 * Used by: app/components/wizard_steps_component.html.erb +
 *   app/javascript/controllers/wizard_controller.js
 */
.component-wizard-steps {
  display: flex;
  align-items: center;
  width: fit-content;
  margin-bottom: calc(var(--spacing) * 8);
}

.component-wizard-step {
  flex-shrink: 0;
}

.component-wizard-step-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 8);
  height: calc(var(--spacing) * 8);
  border: 1px solid;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 700;
  transition: all var(--transition-timing-slow);
}

.component-wizard-step-circle-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text-inverted);
  box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--color-accent) 20%, transparent);
  animation: component-wizard-step-pulse 2s ease-in-out infinite;
}

@keyframes component-wizard-step-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--color-accent) 20%, transparent);
  }
  50% {
    box-shadow: 0 0 0 0.4375rem color-mix(in srgb, var(--color-accent) 10%, transparent);
  }
}

.component-wizard-step-circle-completed {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text-inverted);
}

.component-wizard-step-circle-upcoming {
  background: var(--color-surface-primary);
  border-color: var(--color-border-themed);
  color: var(--color-text-muted);
}

.component-wizard-step-check {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
}

.component-wizard-step-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: color var(--transition-timing-slow);
}

.component-wizard-step-label-active  { color: var(--color-text-heading); }
.component-wizard-step-label-upcoming { color: var(--color-text-muted); }

.component-wizard-step-line {
  width: calc(var(--spacing) * 8);
  height: 0.0625rem;
  margin: 0 calc(var(--spacing) * 4);
  transition: background-color var(--transition-timing-slow);
}

.component-wizard-step-line-filled   { background: var(--color-accent); }
.component-wizard-step-line-unfilled { background: var(--color-border-themed); }

/*
 * On narrow screens the full circle+label row is wider than the
 * viewport and forces the page to scroll sideways. Collapse to a
 * full-width strip: every step keeps its circle, only the active
 * step keeps its label (matched structurally via the circle's
 * state class, since completed labels share the active label
 * class), and the connector lines flex to absorb the remainder.
 */
@media (max-width: 40rem) {
  .component-wizard-steps {
    width: 100%;
  }

  .component-wizard-step:not(:has(.component-wizard-step-circle-active)) .component-wizard-step-label {
    display: none;
  }

  .component-wizard-step-line {
    flex: 1;
    min-width: calc(var(--spacing) * 2);
    margin: 0 calc(var(--spacing) * 2);
  }
}

/* ─── ThemeToggleComponent ─── */

/*
 * .component-theme-toggle-* — dark/light theme flip button.
 * Compact variant fits in a tight toolbar; full variant is wider
 * and includes a text label. The `theme_controller` toggles the
 * `.hidden` utility on the dark/light icon siblings — no domain
 * class for that state swap.
 *
 * Used by: app/components/theme_toggle_component.html.erb
 */
.component-theme-toggle-compact {
  width: calc(var(--spacing) * 9);
  height: calc(var(--spacing) * 9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background var(--motion-fast), color var(--motion-fast);
}

.component-theme-toggle-compact:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

.component-theme-toggle-full {
  width: 100%;
  gap: 0.625rem;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition-timing-slow);
}

.component-theme-toggle-full:hover { color: var(--color-text-hover); }

/* Both variants are plain <button>s with no text input styling to inherit
 * the global input:focus-visible rule, so they'd otherwise fall through to
 * the browser's UA outline. Layer in the shared accent ring explicitly —
 * see docs/guides/design-system.md "Focus". */
.component-theme-toggle-compact:focus-visible,
.component-theme-toggle-full:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-theme-toggle-icon {
  width: 1rem;
  height: 1rem;
}

/* ─── ProgressBarComponent ─── */

/*
 * .component-progress-bar — linear progress bar primitive used
 * across upload, step-of-N, and inline record-count contexts.
 * The fill element consumes `--progress` from inline style for
 * dynamic width; the outer wrapper supplies the variant height,
 * radius, and background.
 *
 * Used by: app/components/progress_bar_component.html.erb
 * Reuse: reach for this for any new linear determinate/indeterminate
 *   progress surface — pass `variant: :upload | :step | :inline`
 *   to match the target treatment. Pass `fill_classes:` to layer
 *   a color modifier (e.g. `.component-progress-bar-success`).
 * Do NOT use: for non-linear progress pipelines (step tiles with
 *   images) — those are domain shapes, not progress bars.
 */
.component-progress-bar {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
}

.component-progress-bar-upload {
  height: 0.375rem;
  border-radius: var(--radius-pill);
}

.component-progress-bar-step {
  height: calc(var(--spacing) * 8);
  border-radius: var(--radius-md);
  background: var(--color-gray-700);
}

.component-progress-bar-inline {
  height: 0.5rem;
}

.component-progress-bar-fill {
  height: 100%;
  width: var(--progress, 0%);
  background: var(--color-blue);
  transition: width var(--transition-timing-standard);
}

.component-progress-bar-success {
  background: var(--color-green-mark);
}

.component-progress-bar-indeterminate {
  position: absolute;
  top: 0;
  left: 0;
  width: 12rem;
  animation: component-progress-bar-indeterminate 2s infinite linear;
}

@keyframes component-progress-bar-indeterminate {
  from { left: -12rem; }
  to   { left: 100%; }
}

.component-progress-bar-label-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.component-progress-bar-label {
  color: var(--color-white);
  font-size: var(--font-size-xs);
}

/* ─── DrawerComponent ─── */

/*
 * .component-drawer-* — right-side slide-out drawer. Width is
 * per-instance via `--drawer-width`; the `drawer_controller`
 * toggles the `.hidden` utility on the container and swaps the
 * panel transform between `translate-x-full` and open state.
 * Those transform classes still live inline on the template and
 * are tracked in the Tailwind cleanup queue until the controller
 * is rewritten to use a CSS class.
 *
 * Used by: app/components/drawer_component.html.erb
 */
.component-drawer-container {
  position: fixed;
  inset: 0;
  z-index: 60;
}

/* The same scrim the modal lays down — a drawer makes the page behind it inert
 * for the same reason and should say so the same way. */
.component-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-scrim);
  opacity: 0;
  transition: opacity var(--motion-base);
}

.component-drawer-backdrop-visible {
  opacity: 1;
}

.component-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--drawer-width, 35rem);
  max-width: 100vw;
  /* The panel itself does not scroll — the body does (below). This keeps the
   * panel a stable positioning context so the headerless floating close stays
   * pinned instead of scrolling away with the content. */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* The panel keeps the page's own background on purpose, because it is a page
   * of its own: the cards inside it are --color-surface-primary and need this
   * to sit under them. Its separation from what it covers is the job of the
   * scrim and the shadow below, not of the panel's face — moving the face to
   * the card surface fixed the panel/page edge by flattening every card in the
   * drawer against it, which is the same bug one layer in. */
  background: var(--color-surface-body);
  border-left: 1px solid var(--color-border-themed);
  /* The lift a modal panel gets, which is what says "this is over the page" on
   * a theme where every surface is within a few values of every other. Paired
   * with --color-scrim: the page behind goes to about #040404 on Studio Dark
   * while the panel stays #0d0d0e, and the shadow darkens the seam between. */
  box-shadow: var(--shadow-elev);
  transform: translateX(100%);
  transition: transform var(--motion-base);
}

.component-drawer-panel-visible {
  transform: translateX(0);
}

/* Focus doctrine, container exception: the panel takes focus on open so the
 * dialog announces its role and name before the reader lands on a control.
 * It is not itself operable, so it draws no ring — the ring belongs to the
 * controls inside it. */
.component-drawer-panel:focus,
.component-drawer-panel:focus-visible {
  outline: none;
}

.component-drawer-header {
  position: sticky;
  top: 0;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 14);
  /* Opaque, and the panel's own surface: the body scrolls under this header, so
   * it has to repeat whatever the panel is painted with. */
  background: var(--color-surface-body);
  border-bottom: 1px solid var(--color-border-themed);
}

.component-drawer-header-leading {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  min-width: 0;
}

.component-drawer-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-drawer-header-actions {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  flex-shrink: 0;
}

/*
 * .component-drawer-action
 * Quiet circular icon button used for the drawer's close (X). Transparent
 * at rest, surface-hover fill on rollover — matches the modal close button
 * idiom so drawers and modals read as one family.
 */
.component-drawer-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 8);
  height: calc(var(--spacing) * 8);
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.component-drawer-action:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-drawer-action:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-drawer-action-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: calc(var(--spacing) * 6);
}

/*
 * .component-drawer-panel-headerless
 * Variant that removes the drawer's sticky header bar — the panel relies
 * on the slot content to supply its own sticky header (eyebrow back-link,
 * title, meta, action row). Pairs with .component-drawer-floating-close
 * (the absolute-positioned close button) and .component-drawer-body-flush
 * (zero body padding) so the content can sit edge-to-edge.
 *
 * Where used:
 *   - Task drawer in app/components/client_dashboard/project_task_board_component.html.erb,
 *     team_capacity/page_component.html.erb, my_tasks/page_component.html.erb,
 *     client_rollup/page_component.html.erb
 */
.component-drawer-panel-headerless {
  /* No position override — keeps the default fixed-right slide-in. The
   * floating close button below is absolutely positioned against the
   * fixed panel itself. */
}

.component-drawer-floating-close {
  /* Absolute against the panel, which no longer scrolls (the body does), so
   * the close stays pinned at the panel's top-right while content scrolls. */
  position: absolute;
  top: calc(var(--spacing) * 4);
  right: calc(var(--spacing) * 4);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 8);
  height: calc(var(--spacing) * 8);
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
  border: 0;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.component-drawer-floating-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-drawer-floating-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-drawer-body-flush {
  padding: 0;
  min-height: 100%;
}

/* ─── FormatColumnsComponent ─── */

/*
 * .component-format-columns-* — table of source → output field
 * mappings on the format show page. Rendered inside a CardComponent.
 *
 * Used by: app/components/format_columns_component.html.erb
 */
.component-format-columns-description {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: calc(var(--spacing) * 4);
}

.component-format-columns-table-scroll {
  overflow-x: auto;
}

.component-format-columns-table {
  width: 100%;
  border-collapse: collapse;
}

.component-format-columns-head-row {
  background: var(--color-surface-elevated);
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.component-format-columns-head-index {
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 4);
  width: calc(var(--spacing) * 12);
}

.component-format-columns-head-cell {
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 4);
}

.component-format-columns-body > tr {
  border-top: 1px solid var(--color-border-subtle);
}

.component-format-columns-body > tr:first-child {
  border-top: none;
}

.component-format-columns-index-cell {
  padding: calc(var(--spacing) * 4);
  white-space: nowrap;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.component-format-columns-cell {
  padding: calc(var(--spacing) * 4);
  font-size: var(--font-size-sm);
}

.component-format-columns-field {
  font-weight: 500;
  color: var(--color-text-heading);
}

.component-format-columns-field-key {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: calc(var(--spacing) * 1);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─── StatCardsComponent ─── */

/*
 * .component-stat-cards-grid-* — responsive grid wrapper for stat
 * cards. Five variants map 1:1 to the `columns` argument passed
 * to `StatCardsComponent.new(columns:)`. The Ruby `grid_class`
 * method returns these class names; any new column count should
 * get its own modifier, not a dynamically generated Tailwind
 * class string.
 *
 * Used by: app/components/stat_cards_component.html.erb
 *   + app/components/stat_cards_component.rb#grid_class
 */
/*
 * .component-stat-cards-container — wrapper that establishes the
 * container-query context. The inner .component-stat-cards-grid sizes
 * itself based on this wrapper's width, not the viewport, so a stat
 * grid inside a narrow settings column stays 2-wide even when a stat
 * grid inside a full-width dashboard goes 4-wide on the same viewport.
 */
.component-stat-cards-container {
  container-type: inline-size;
  container-name: stat-cards;
}

.component-stat-cards-grid {
  display: grid;
  gap: calc(var(--spacing) * 4);
}

/* Default (narrow container): always 1 column */
.component-stat-cards-grid-1,
.component-stat-cards-grid-2,
.component-stat-cards-grid-3,
.component-stat-cards-grid-4,
.component-stat-cards-grid-5 {
  grid-template-columns: minmax(0, 1fr);
}

/* ≥ 30rem (~480px) container — pair up 2-col grids and split 4-col into
 * two rows of 2 so values like "990,000" never get cramped */
@container stat-cards (min-width: 30rem) {
  .component-stat-cards-grid-2,
  .component-stat-cards-grid-3,
  .component-stat-cards-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ≥ 48rem (~768px) container — 3-col grids hit their full layout */
@container stat-cards (min-width: 48rem) {
  .component-stat-cards-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ≥ 60rem (~960px) container — only at this width does a 4-col grid have
 * enough room per card for the largest values; settings pages with a
 * sidebar reach this threshold around a 1280px viewport */
@container stat-cards (min-width: 60rem) {
  .component-stat-cards-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* The five-up grid keeps its own steps rather than the four-up's, because the
 * audience show page wants its channel row in one line on a laptop with the
 * sidebar open (a ~43rem container at 1024px). Five columns from 42rem, three
 * from 30rem, two from 24rem, one below that. */
@container stat-cards (min-width: 24rem) {
  .component-stat-cards-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container stat-cards (min-width: 30rem) {
  .component-stat-cards-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container stat-cards (min-width: 42rem) {
  .component-stat-cards-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .component-stat-cards-grid-5 .component-stat-card {
    padding: calc(var(--spacing) * 5) calc(var(--spacing) * 4);
  }

  .component-stat-cards-grid-5 .component-stat-card-row {
    gap: calc(var(--spacing) * 2);
  }
}

/*
 * Five-up values scale with their own card. The shared value size tracks the
 * viewport (3vw), which is right for wide cards and wrong for five cards
 * sharing a laptop's content column: "245,000,000" at 36px needs ~210px and a
 * five-up card at 1024px has ~90px. Each five-up card becomes a size container
 * and the value is sized off its width, in three steps keyed to the longest
 * value in the row (StatCardsComponent#value_length_class) so the row stays
 * one size: 25cqi fits seven characters ("922,975"), -values-medium 20cqi fits
 * nine ("9,999,999"), -values-long 16.5cqi fits eleven ("245,000,000").
 * Capped at --font-size-4xl, the shared clamp's floor.
 *
 * The value also takes the card's slack above it, so a label that wraps to two
 * lines in a narrow card doesn't drop that card's value below its neighbors'.
 */
.component-stat-cards-grid-5 .component-stat-card {
  container-type: inline-size;
}

.component-stat-cards-grid-5 .component-stat-card-value {
  font-size: clamp(var(--font-size-base), 25cqi, var(--font-size-4xl));
  margin-top: auto;
  padding-top: calc(var(--spacing) * 2);
}

.component-stat-cards-grid-5.component-stat-cards-values-medium .component-stat-card-value {
  font-size: clamp(var(--font-size-base), 20cqi, var(--font-size-4xl));
}

.component-stat-cards-grid-5.component-stat-cards-values-long .component-stat-card-value {
  font-size: clamp(var(--font-size-sm), 16.5cqi, var(--font-size-4xl));
}

/*
 * The card used to be its own container-query context so a per-card query could
 * swap a 36px chip for a 24px one on narrow cards. The chip is now 28px at every
 * width — small enough for a 4-up grid, still legible on a wide one — so the
 * swap, the second rendered badge, and the containment it needed are all gone.
 * The five-up variant makes its cards containers again, for the value size only.
 */
.component-stat-card {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ─── Loading skeletons ─── */

/*
 * .component-skeleton
 * Grouping wrapper for a component's loading placeholder blocks. Carries no
 * animation of its own — it marks the group so tests and future layout rules
 * have a stable hook, while each block animates via .component-skeleton-shimmer.
 *
 * Used by: app/components/stat_cards_component.html.erb
 *   + app/components/audiences/charts_row_component.html.erb
 * Reuse when: a component renders a cluster of neutral loading placeholders.
 * Do NOT use for: a single standalone placeholder block — put the shimmer class
 *   on it directly.
 */
.component-skeleton {
  display: block;
}

/*
 * .component-skeleton-shimmer
 * Traveling highlight for an individual loading placeholder block. A moving
 * sweep reads as work in progress; the opacity pulse this replaced read as
 * broken or empty content. Owns the block's background, so shape classes set
 * only size, radius, and spacing.
 *
 * Used by: app/components/stat_cards_component.html.erb
 *   + app/components/audiences/charts_row_component.html.erb
 * Reuse when: any placeholder block stands in for content that is loading.
 * Do NOT use for: empty states, or blocks that are permanently blank — a
 *   shimmer promises content is coming.
 */
.component-skeleton-shimmer {
  background: linear-gradient(90deg,
    var(--color-skeleton-base) 0%,
    var(--color-skeleton-highlight) 50%,
    var(--color-skeleton-base) 100%);
  background-size: 200% 100%;
  animation: component-skeleton-shimmer 1.6s linear infinite;
}

@keyframes component-skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.component-stat-card-skeleton-label {
  height: calc(var(--spacing) * 4);
  border-radius: var(--radius-sm);
  width: calc(var(--spacing) * 24);
  margin-bottom: calc(var(--spacing) * 2);
}

.component-stat-card-skeleton-value {
  height: calc(var(--spacing) * 8);
  border-radius: var(--radius-sm);
  width: calc(var(--spacing) * 16);
}

.component-stat-card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: calc(var(--spacing) * 4);
}

/*
 * .component-stat-card-icon-wrap / .component-stat-card-icon
 * The pre-IconBadge chip path, still used by cards that pass a background class
 * instead of an icon color (account_report_component, my_tasks/page_component).
 * Sized to match IconBadgeComponent's 28px stat-card chip so both paths produce
 * the same header band height.
 */
.component-stat-card-icon-wrap {
  flex-shrink: 0;
  width: calc(var(--spacing) * 7);
  height: calc(var(--spacing) * 7);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.component-stat-card-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-stat-card-icon-wrap-blue {
  background: color-mix(in srgb, var(--color-blue) 15%, transparent);
}

.component-stat-card-icon-blue {
  color: var(--color-accent);
}

.component-stat-card-icon-wrap-green {
  background: color-mix(in srgb, var(--color-green) 15%, transparent);
}

.component-stat-card-icon-green {
  color: var(--color-green-mark);
}

.component-stat-card-icon-wrap-purple {
  background: color-mix(in srgb, var(--color-purple) 15%, transparent);
}

.component-stat-card-icon-purple {
  color: var(--color-purple-mark);
}

/*
 * .component-stat-card-label
 * The shared caption label every stat-shaped card wears at its top-left — the
 * StatCardsComponent tiles, the reporting cards, and the dashboard's
 * recent-activity cards all use this one class, so a label reads the same
 * everywhere.
 *
 * Leading is tightened from the caption role's 1.4 to 1.25. These labels are
 * always one short line, and the role's relaxed leading exists for wrapped
 * running text; at 13px it added ~2.5px of box the label never used, which read
 * as slack at the top of the card rather than as line spacing.
 *
 * Used by: stat_cards_component, email_campaigns/performance_chart_component,
 * recent_audiences_component, recent_lists_component.
 */
.component-stat-card-label {
  font-size: var(--type-caption-size);
  line-height: 1.25;
  font-weight: 500;
  color: var(--color-text-muted);
}

/*
 * .component-stat-card-heading
 * A stat card label with an InfoTipComponent beside it, explaining what the
 * card counts.
 *
 * Used by: stat_cards_component.
 */
.component-stat-card-heading {
  align-items: center;
  display: inline-flex;
  gap: var(--spacing);
  min-width: 0;
}

.component-stat-card-value {
  font-size: clamp(2.25rem, 3vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-top: calc(var(--spacing) * 2);
}

.component-stat-card-value-default {
  color: var(--color-text-heading);
}

/*
 * .component-stat-card-subtitle
 * The caption closing a stat card, anchored to the card's floor rather than
 * hung under the value.
 *
 * The cards in a row already stretch to a common height, so a card whose value
 * wraps to two lines — a long date, a seven-figure number in a narrow column —
 * or whose caption runs long makes every other card in the row taller than its
 * own content. That slack used to fall below the caption, which left each
 * caption sitting at whatever height its own card's value happened to end at,
 * up to a caption's worth of raggedness across a four-card row. `margin-top:
 * auto` hands the slack to the gap above the caption instead, so the captions
 * land on the card's bottom edge, which is a line the row already shares. The
 * padding is the minimum gap the auto margin gives up when a card has no slack
 * to distribute.
 *
 * Used by: app/components/stat_cards_component.html.erb
 */
.component-stat-card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: auto;
  padding-top: calc(var(--spacing) * 2);
}

/*
 * .component-stat-cards-overview
 * StatCardsComponent `variant: :overview`: the home page's headline figures.
 * Each card is its own size container, so the chip and the value answer to
 * the card's width: a 36px chip that drops to 24px under 240px, and a value
 * that never wraps, sized down to fit the card (--stat-card-value-ems is the
 * value's length in ems, set per card). The subtitle hangs 8px under the
 * value instead of sitting on the card's floor, and the label takes the
 * caption role's own 1.4 leading.
 *
 * Used by: app/components/stat_cards_component.html.erb (variant: :overview)
 * Reuse when: a row of headline figures that each open their own page.
 * Do NOT use for: report figures inside a page (use the default variant).
 */
.component-stat-cards-overview .component-stat-card {
  container-type: inline-size;
  color: inherit;
  text-decoration: none;
}

.component-stat-cards-overview .component-stat-card-label {
  line-height: var(--type-caption-line-height);
}

.component-stat-cards-overview .component-stat-card-value {
  font-size: min(clamp(2.25rem, 3vw, 3rem), calc(100cqi / var(--stat-card-value-ems)));
  white-space: nowrap;
}

.component-stat-cards-overview .component-stat-card-subtitle {
  margin-top: calc(var(--spacing) * 2);
  padding-top: 0;
  line-height: 1.25rem;
}

.component-stat-card-icon-small {
  display: inline-flex;
}

.component-stat-card-icon-medium {
  display: none;
}

@container (min-width: 15rem) {
  .component-stat-card-icon-small {
    display: none;
  }

  .component-stat-card-icon-medium {
    display: inline-flex;
  }
}

/* A card that opens its own page lifts like an interactive tile. */
.component-stat-card-link {
  transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}

.component-stat-card-link:hover {
  transform: translateY(-0.125rem);
  box-shadow: var(--shadow-lg);
}

.component-stat-card-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-stat-card-skeleton-subtitle {
  height: calc(var(--spacing) * 4);
  border-radius: var(--radius-sm);
  width: calc(var(--spacing) * 32);
  margin-top: calc(var(--spacing) * 3);
}

.component-stat-cards-overview .component-stat-card-skeleton-value {
  height: calc(var(--spacing) * 12);
  width: calc(var(--spacing) * 40);
  max-width: 100%;
  margin-top: calc(var(--spacing) * 2);
}

/* ─── DashboardRecentActivityComponent ─── */

/*
 * .component-dashboard-recent-activity-* — recent activity table
 * on the dashboard. Header row has a link to the full activity
 * page.
 *
 * Used by: app/components/dashboard_recent_activity_component.html.erb
 */
.component-dashboard-recent-activity-header {
  padding-bottom: calc(var(--spacing) * 6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.component-dashboard-recent-activity-title {
  font-weight: 700;
  font-size: var(--font-size-2xl);
}

.component-dashboard-recent-activity-link {
  font-weight: 600;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 4);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-xs);
  border: 1px solid var(--color-border-themed);
  background: var(--color-surface-primary);
  justify-content: center;
}

.component-dashboard-recent-activity-link-icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.component-dashboard-recent-activity-date-col {
  width: calc(var(--spacing) * 24);
}

.component-dashboard-recent-activity-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
}

.component-dashboard-recent-activity-icon-green { color: var(--color-green-mark); }
.component-dashboard-recent-activity-icon-red   { color: var(--color-red-mark); }
.component-dashboard-recent-activity-icon-blue  { color: var(--color-accent); }
.component-dashboard-recent-activity-icon-gray  { color: var(--color-text-muted); }

.component-dashboard-recent-activity-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── ListFilterDropdownComponent ─── */

/*
 * .component-list-filter-* — type + data source filter dropdown
 * used in the page header search. Shares animation controller
 * conventions with data source dropdown.
 *
 * Used by: app/components/list_filter_dropdown_component.html.erb
 */
.component-list-filter-button {
  padding: calc(var(--spacing) * 6) calc(var(--spacing) * 4);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  text-align: left;
  background: var(--color-surface-primary);
  color: var(--color-text-body);
}

.component-list-filter-button-icon {
  width: 1rem;
  height: 1rem;
  margin-right: calc(var(--spacing) * 4);
}

.component-list-filter-button-label {
  flex-grow: 1;
  margin-right: calc(var(--spacing) * 4);
}

.component-list-filter-chevron {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--color-text-muted);
}

.component-list-filter-menu {
  position: absolute;
  z-index: 20;
}

.component-list-filter-panel {
  margin-left: -0.0625rem;
  transform-origin: top left;
  width: calc(var(--spacing) * 56);
  border: 1px solid var(--color-border-themed);
  border-bottom-left-radius: 0.125rem;
  border-bottom-right-radius: 0.125rem;
  background: var(--color-surface-primary);
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.25rem 0.375rem -0.25rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
}

.component-list-filter-panel:focus {
  outline: none;
}

.component-list-filter-clear {
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  display: flex;
  align-items: center;
  text-align: left;
  color: var(--color-text-body);
  margin: calc(var(--spacing) * 1) 0;
}

.component-list-filter-clear-icon {
  width: 0.75rem;
  height: 0.75rem;
}

.component-list-filter-clear-label {
  padding-left: calc(var(--spacing) * 4);
}

.component-list-filter-group {
  padding: calc(var(--spacing) * 1) 0;
  border-top: 1px solid var(--color-border-themed);
}

.component-list-filter-group:first-child {
  border-top: none;
}

.component-list-filter-option-wrap {
  position: relative;
  width: 100%;
}

.component-list-filter-option {
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  display: flex;
  align-items: center;
  text-align: left;
  color: var(--color-text-body);
}

/* Focus doctrine: the shared ring on keyboard focus. The row also carries
 * .interactive-surface, whose ring is drawn outside the border box; overridden
 * here because these rows run full-bleed to the panel edge, where an outer ring
 * would sit on top of the panel's own border. */
.component-list-filter-option:focus-visible,
.component-list-filter-clear:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

.component-list-filter-option-icon {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
}

.component-list-filter-option-label {
  padding-left: calc(var(--spacing) * 4);
}

/* ─── AccountReportComponent ─── */

/*
 * .component-account-report-filters
 * Single-row filter strip on the account report page: title label,
 * preset chips, and compact date-range form laid out horizontally
 * with space between. Elevated surface with themed border.
 *
 * Used by: app/components/account_report_component.html.erb
 */
.component-account-report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 5);
  background: var(--color-surface-primary);
  border: 0.0625rem solid var(--color-border-themed);
  border-radius: var(--radius-xl);
}

.component-account-report-filter-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/*
 * .component-account-report-presets / -preset / -preset-active
 * Pill-style preset chips that snap the date range to common windows
 * (7D, 30D, 90D, MTD, YTD). Clicking a preset submits the form.
 *
 * Used by: app/components/account_report_component.html.erb
 */
.component-account-report-presets {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 1);
  padding: calc(var(--spacing) * 1);
  background: var(--color-surface-elevated);
  border: 0.0625rem solid var(--color-border-themed);
  border-radius: var(--radius-pill);
}

.component-account-report-preset {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 3);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition-timing-standard),
              color var(--transition-timing-standard);
}

.component-account-report-preset:hover {
  color: var(--color-text-body);
  background: var(--color-surface-hover);
}

.component-account-report-preset-active {
  color: var(--color-text-inverted);
  background: var(--color-accent);
}

.component-account-report-preset-active:hover {
  color: var(--color-text-inverted);
  background: var(--color-accent);
}

/*
 * .component-account-report-filter-form
 * Inline date-range form: two date inputs separated by "to" and an
 * icon-only Update submit. Sits on the right end of the single-row
 * filter strip; pushed right by margin-left: auto on wider screens.
 *
 * Used by: app/components/account_report_component.html.erb
 */
.component-account-report-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  margin-left: auto;
}

.component-account-report-filter-form .component-form-field {
  width: auto;
  flex: 0 0 auto;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  font-size: max(var(--font-size-xs), var(--field-font-floor));
}

.component-account-report-filter-to {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-account-report-chart
 * Fixed-height canvas host for a Chart.js breakdown chart inside each
 * table-variant Cards::CardComponent. Height is dynamic based on the
 * number of bars (handled by the `grid-auto` parent).
 *
 * Used by: app/components/account_report_component.html.erb
 */
.component-account-report-chart {
  position: relative;
  height: 14rem;
  width: 100%;
}

/* ─── SearchInputComponent ─── */

/*
 * .component-search-input-* — shared icon + input + trailing actions
 * used by SearchInputComponent. Wrapper provides position: relative
 * so the icon and actions can sit absolutely over the input.
 *
 * Used by: app/components/search_input_component.html.erb
 *   (consumed by PageHeaderSearchComponent and
 *    ClientRollup::AllTasksComponent).
 */
.component-search-input {
  position: relative;
}

.component-search-input-icon {
  width: 0.875rem;
  height: 0.875rem;
  position: absolute;
  left: calc(var(--spacing) * 4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

.component-search-input-field {
  width: 100%;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 8) calc(var(--spacing) * 4) calc(var(--spacing) * 9);
  border-radius: var(--radius-lg);
  font-size: max(var(--font-size-sm), var(--field-font-floor));
  outline: none;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  color: var(--color-text-body);
}

.component-search-input-field::placeholder {
  color: var(--color-text-muted);
}

.component-search-input-field:disabled {
  background: var(--color-surface-elevated);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.component-search-input-actions {
  position: absolute;
  right: calc(var(--spacing) * 4);
  top: 50%;
  transform: translateY(-50%);
}

/* Pill variant (SearchInputComponent rounded: :full) for toolbars where
 * the input sits next to fully rounded buttons. */
.component-search-input-rounded-full .component-search-input-field {
  border-radius: var(--radius-pill);
}

/* ─── PageHeaderSearchComponent ─── */

/*
 * .component-page-header-search-* — layout + trailing controls
 * (refresh / clear / columns menu / user filter) stacked around
 * the shared SearchInputComponent on list index pages.
 *
 * The `user_check` empty/filled modifiers are returned from the
 * Ruby component's `selection_classes` method.
 *
 * Used by: app/components/page_header_search_component.html.erb
 *   + app/components/page_header_search_component.rb#selection_classes
 */
.component-page-header-search-inline {
  margin-bottom: calc(var(--spacing) * 4);
}

@media (min-width: 48rem) {
  .component-page-header-search-float {
    margin-top: calc(var(--spacing) * -14);
    margin-left: auto;
    max-width: calc(var(--spacing) * 168);
  }
}

.component-page-header-search-action {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
  transition: color var(--transition-timing-slow);
}

.component-page-header-search-action:hover {
  color: var(--color-text-heading);
}

.component-page-header-search-action-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-page-header-search-columns {
  position: relative;
}

.component-page-header-search-columns-menu {
  position: absolute;
  right: 0;
  z-index: 30;
  margin-top: calc(var(--spacing) * 2);
  width: calc(var(--spacing) * 64);
  transform-origin: top right;
  border-radius: var(--radius-lg);
  background: var(--color-surface-primary);
  padding: calc(var(--spacing) * 1) 0;
  border: 1px solid var(--color-border-themed);
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.25rem 0.375rem -0.25rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
}

.component-page-header-search-columns-menu:focus {
  outline: none;
}

.component-page-header-search-columns-body {
  padding: calc(var(--spacing) * 2);
}

.component-page-header-search-column-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 1) 0;
}

.component-page-header-search-column-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
  display: flex;
  align-items: center;
}

.component-page-header-search-column-checkbox {
  margin-right: calc(var(--spacing) * 2);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text-body);
}

.component-page-header-search-grip {
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
  cursor: grab;
}

.component-page-header-search-user-filter {
  margin-top: calc(var(--spacing) * 4);
  margin-bottom: calc(var(--spacing) * 1);
}

.component-page-header-search-user-button {
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
  cursor: pointer;
}

.component-page-header-search-user-check {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  border-radius: var(--radius-xs);
  border: 1px solid;
  display: flex;
  justify-content: center;
  align-items: center;
}

.component-page-header-search-user-check-empty {
  border-color: var(--color-text-heading);
  background: transparent;
}

.component-page-header-search-user-check-filled {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

.component-page-header-search-user-check-icon {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--color-white);
}

/* ─── SettingsSideMenuComponent ─── */

/*
 * .component-settings-side-menu-* — desktop left rail + mobile
 * dropdown for settings navigation. The desktop rail is hidden
 * on narrow viewports; the mobile dropdown is hidden on wide.
 *
 * Used by: app/components/settings_side_menu_component.html.erb
 */
.component-settings-side-menu {
  display: none;
  width: var(--settings-side-menu-width);
  flex-shrink: 0;
}

@media (min-width: 64rem) {
  .component-settings-side-menu { display: block; }
}

/*
 * .component-settings-side-menu-list — flat vertical list of settings
 * links. Matches the prototype's single-group SettingsSidebar layout
 * (no Personal/Account section labels).
 */
.component-settings-side-menu-list {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 0.5);
}

.component-settings-side-menu-link {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2.5);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--radius-lg);
  transition: background-color var(--motion-fast), color var(--motion-fast);
  color: var(--color-text-body);
}

.component-settings-side-menu-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

.component-settings-side-menu-link-active,
.component-settings-side-menu-link-active:hover {
  background: var(--color-surface-elevated);
  color: var(--color-text-heading);
  font-weight: 600;
}

.component-settings-side-menu-link-icon {
  width: 0.9375rem;
  height: 0.9375rem;
}

.component-settings-side-menu-mobile {
  position: relative;
  text-align: left;
  /* No margin — the parent .component-settings-page-body owns the horizontal
   * gutter (so this aligns with the cards) and the vertical gap to the card. */
}

@media (min-width: 64rem) {
  .component-settings-side-menu-mobile { display: none; }
}

.component-settings-side-menu-mobile-button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 0.375rem;
  border-radius: var(--radius-lg);
  background: var(--color-surface-primary);
  padding: calc(var(--spacing) * 4);
  color: var(--color-text-heading);
  border: 1px solid var(--color-border-themed);
  box-shadow: 0 0.0625rem 0.1875rem color-mix(in srgb, var(--color-gray-900) 8%, transparent);
}

.component-settings-side-menu-mobile-chevron {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-text-muted);
}

.component-settings-side-menu-mobile-menu {
  position: absolute;
  right: 0;
  z-index: 20;
  width: 100%;
  transform-origin: top;
  border-radius: var(--radius-lg);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.25rem 0.375rem -0.25rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
}

.component-settings-side-menu-mobile-menu:focus {
  outline: none;
}

.component-settings-side-menu-mobile-panel {
  padding: calc(var(--spacing) * 1) 0;
}

.component-settings-side-menu-mobile-link {
  display: block;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  color: var(--color-text-body);
}

/* Below lg the settings dropdown shares its row with an icon-only "Need help?"
 * trigger. The dropdown flexes to fill; the trigger is a square peer control
 * styled to match the dropdown chrome (same border, radius, surface, shadow),
 * so the two read as a matched pair. It's square by construction — the same
 * padding token and a 1.5rem icon give it the dropdown button's exact height,
 * and matching content on both axes makes the width equal that height. */
.component-settings-side-menu-mobile-row {
  display: flex;
  align-items: stretch;
  gap: calc(var(--spacing) * 2);
}

.component-settings-side-menu-mobile-row .component-settings-side-menu-mobile-button {
  flex: 1;
}

.component-settings-side-menu-mobile-row .help-trigger-icon-only {
  justify-content: center;
  padding: calc(var(--spacing) * 4);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
  background: var(--color-surface-primary);
  box-shadow: 0 0.0625rem 0.1875rem color-mix(in srgb, var(--color-gray-900) 8%, transparent);
}

.component-settings-side-menu-mobile-row .help-trigger-icon-only .help-trigger-icon {
  width: 1.5rem;
  height: 1.5rem;
}

/*
 * .component-connection-status-* — card chrome for Facebook Ads, Google Ads,
 * and LinkedIn connection status components. Variants
 * (success/warning/alert/error/neutral) are set via `status_classes` on the
 * component Ruby class.
 *
 * Callers: facebook_connection_status_component,
 * google_ad_connection_status_component, linkedin_connection_status_component.
 * Reuse rule: reserved for audience/campaign connection status panels. Do not
 * repurpose for generic alerts — use a button/tag component instead.
 */
.component-connection-status {
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: calc(var(--spacing) * 4);
}

.component-connection-status-success {
  background: color-mix(in srgb, var(--color-green) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-green) 25%, transparent);
  color: var(--color-status-text-green);
}

.component-connection-status-warning {
  background: color-mix(in srgb, var(--color-yellow) 10%, transparent);
  border-color: color-mix(in srgb, var(--color-yellow) 30%, transparent);
  color: var(--color-status-text-yellow);
}

.component-connection-status-alert {
  background: color-mix(in srgb, var(--color-orange) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-orange) 25%, transparent);
  color: var(--color-status-text-orange);
}

.component-connection-status-error {
  background: color-mix(in srgb, var(--color-red) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-red) 25%, transparent);
  color: var(--color-status-text-red);
}

.component-connection-status-neutral {
  background: var(--color-surface-elevated);
  border-color: var(--color-border-themed);
  color: var(--color-text-body);
}

.component-connection-status-row {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 4);
}

.component-connection-status-icon-wrap {
  flex-shrink: 0;
}

.component-connection-status-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.component-connection-status-body {
  flex: 1 1 0;
  min-width: 0;
}

.component-connection-status-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.component-connection-status-message {
  font-size: var(--font-size-sm);
  margin-top: calc(var(--spacing) * 1);
}

.component-connection-status-chip-row {
  margin-top: calc(var(--spacing) * 2);
}

.component-connection-status-chip {
  display: inline-flex;
  align-items: center;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 500;
  gap: calc(var(--spacing) * 1);
}

.component-connection-status-chip-success {
  background: color-mix(in srgb, var(--color-green) 15%, transparent);
  color: var(--color-status-text-green);
}

.component-connection-status-chip-warning {
  background: color-mix(in srgb, var(--color-yellow) 20%, transparent);
  color: var(--color-status-text-yellow);
}

.component-connection-status-chip-icon {
  width: 0.75rem;
  height: 0.75rem;
}

.component-connection-status-tip {
  margin-top: calc(var(--spacing) * 4);
  font-size: var(--font-size-sm);
  color: var(--color-accent);
  background: var(--color-accent-subtle);
  border-radius: var(--radius-sm);
  padding: calc(var(--spacing) * 2);
}

.component-connection-status-tip-icon {
  display: inline;
  width: 1rem;
  height: 1rem;
  margin-right: calc(var(--spacing) * 1);
}

.component-connection-status-tip-link {
  margin-left: calc(var(--spacing) * 2);
  color: var(--color-accent);
  text-decoration: underline;
}

.component-connection-status-tip-link:hover {
  color: var(--color-accent-hover);
}

.component-connection-status-actions {
  margin-top: calc(var(--spacing) * 4);
}

.component-connection-status-reconnect {
  display: inline-flex;
  align-items: center;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  line-height: 1rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  color: var(--color-white);
  background: var(--color-accent);
}

.component-connection-status-reconnect:hover {
  background: var(--color-accent-hover);
}

.component-connection-status-expiry {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
}

.component-connection-status-expiry-text {
  color: var(--color-text-muted);
}

/*
 * .component-pagination-* — paginator bar. Row of (results count · page size
 * select · divider · page number · prev/next nav). Rendered at the bottom of
 * index tables via PaginationComponent.
 *
 * Callers: pagination_component.
 * Reuse rule: exclusive to PaginationComponent. Anything else that needs a
 * similar row should reach for .row or .cluster primitives.
 */
.component-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 3);
  flex-wrap: wrap;
  padding: 0.625rem calc(var(--spacing) * 4);
  border-radius: var(--radius-2xl);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-subtle);
}

.component-pagination-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-pagination-count-value {
  color: var(--color-text-body);
}

.component-pagination-controls {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  flex-wrap: wrap;
}

.component-pagination-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-pagination-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.component-pagination-select {
  appearance: none;
  -webkit-appearance: none;
  font-size: max(var(--font-size-xs), var(--field-font-floor));
  line-height: 1.25;
  border-radius: var(--radius-pill);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 7) calc(var(--spacing) * 1) calc(var(--spacing) * 3);
  outline: none;
  cursor: pointer;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  color: var(--color-text-heading);
}

.component-pagination-select-chevron {
  position: absolute;
  right: calc(var(--spacing) * 2);
  top: 50%;
  transform: translateY(-50%);
  width: 0.6875rem;
  height: 0.6875rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

.component-pagination-nav {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

.component-pagination-nav-button {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
  border-radius: var(--radius-pill);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  color: var(--color-text-body);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--motion-fast), color var(--motion-fast);
}

.component-pagination-nav-button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-pagination-nav-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Muted ink rather than 40% opacity. Opacity dilutes the text and its border
 * together against whatever is behind them — body ink at 0.4 landed near 1.9:1,
 * which is not readable — where --color-text-muted is the tone the design system
 * already guarantees at WCAG AA in both themes. The control still reads as
 * unavailable: it is a disabled button, so it is dimmer than its live sibling,
 * skipped by the keyboard, and announced as disabled. */
.component-pagination-nav-button-disabled,
.component-pagination-nav-button-disabled:hover {
  cursor: default;
  background: var(--color-surface-primary);
  border-color: var(--color-border-subtle);
  color: var(--color-text-muted);
}

.component-pagination-nav-icon {
  width: 0.75rem;
  height: 0.75rem;
}

/* On phones the inline paginator row (count · page size · page · prev/next) is
 * too wide and wraps into a cramped, ragged layout. Stack it: the results count
 * on its own row, the page-size select and page indicator sharing a row, and
 * Previous/Next as an equal-width button pair spanning the full width with
 * larger tap targets. */
@media (max-width: 40rem) {
  .component-pagination {
    flex-direction: column;
    align-items: stretch;
    gap: calc(var(--spacing) * 3);
  }

  /* The page indicator ("Page 1 of 1") carries enough context on phones —
   * drop the redundant results count to keep the paginator compact. */
  .component-pagination-count {
    display: none;
  }

  .component-pagination-controls {
    justify-content: space-between;
  }

  .component-pagination-nav {
    flex-basis: 100%;
    gap: calc(var(--spacing) * 2);
  }

  .component-pagination-nav-button {
    flex: 1;
    justify-content: center;
    padding-block: calc(var(--spacing) * 2);
  }
}

/*
 * .component-topbar-* — top utility bar: app title, impersonation banner,
 * grid-apps dropdown, avatar dropdown. Fixed to top, offset for desktop
 * sidebar on the left. Title fade-in hooks to topbar--title Stimulus controller.
 *
 * Callers: topbar_component.
 * Reuse rule: exclusive to the global topbar. Dropdown panel styles are local;
 * reach for ButtonComponent or a new primitive for reusable dropdowns.
 */
.component-topbar {
  background: var(--color-gray-800);
  color: var(--color-gray-200);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-left: 18rem;
  padding-right: calc(var(--spacing) * 4);
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 4rem;
  z-index: 30;
}

.component-topbar-title {
  flex: 1 1 0;
  padding-left: calc(var(--spacing) * 8);
  font-weight: 600;
  line-height: 1.5rem;
  color: var(--color-white);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  font-size: var(--font-size-lg);
  transition: opacity var(--transition-timing-slow);
  opacity: 0;
}

.component-topbar-title-visible {
  opacity: 1;
}

.component-topbar-impersonating {
  display: flex;
  align-items: center;
  padding: 0 calc(var(--spacing) * 4);
}

.component-topbar-apps,
.component-topbar-avatar {
  position: relative;
}

.component-topbar-apps-button,
.component-topbar-avatar-button {
  padding: calc(var(--spacing) * 6);
  cursor: pointer;
  background: transparent;
  border: 0;
  color: inherit;
}

.component-topbar-avatar-button {
  padding: calc(var(--spacing) * 6) calc(var(--spacing) * 4);
}

.component-topbar-apps-button:hover,
.component-topbar-avatar-button:hover {
  background: var(--color-gray-700);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-topbar-apps-button:focus-visible,
.component-topbar-avatar-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-topbar-apps-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.component-topbar-avatar-chevron {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--color-gray-300);
  flex-shrink: 0;
}

.component-topbar-dropdown-menu {
  position: absolute;
  right: 0;
  margin-right: -0.0625rem;
  z-index: 60;
}

.component-topbar-dropdown-panel {
  transform-origin: top right;
  width: 12rem;
  border-bottom-left-radius: 0.125rem;
  border-bottom-right-radius: 0.125rem;
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.25rem 0.375rem -0.25rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
  border: 1px solid var(--color-gray-300);
  border-top: 0;
  background: var(--color-white);
  padding: calc(var(--spacing) * 1) 0;
}

.component-topbar-dropdown-group {
  padding: calc(var(--spacing) * 1) 0;
}

.component-topbar-dropdown-link {
  display: block;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  font-size: var(--font-size-sm);
  color: var(--color-gray-700);
}

.component-topbar-dropdown-link:hover {
  background: var(--color-gray-100);
}

.component-topbar-dropdown-link-icon {
  width: 1rem;
  height: 1rem;
  color: var(--color-gray-500);
}

/*
 * .component-unauthenticated-page-* — centered-card layout for sign-in,
 * password reset, signup, invite acceptance, and confirmation pages. A
 * single card sits on a softly washed body, with a small page-bottom
 * footer (copyright + policy links). Backdrop colors come from
 * --color-auth-backdrop-sky and --color-auth-backdrop-lavender in
 * tokens.css.
 *
 * Callers: unauthenticated_page_component.
 * Reuse rule: exclusive to pre-login pages. Authenticated shells use
 * sidebar + topbar instead.
 */
.component-unauthenticated-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--color-surface-body);
}

/* Backdrop: two off-center radial washes giving the page ambient color.
 * Colors come from --color-auth-backdrop-* tokens in tokens.css. */
.component-unauthenticated-page-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 45% at 32% 30%, var(--color-auth-backdrop-sky), transparent 70%),
    radial-gradient(ellipse 50% 40% at 72% 70%, var(--color-auth-backdrop-lavender), transparent 70%);
}

.component-unauthenticated-page-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--spacing) * 6);
  position: relative;
  z-index: 1;
}

/* container-type establishes a container-query context sized to the card's
 * own ~30rem width rather than the viewport, so content inside (e.g.
 * .accounts-form-grid in accounts.css) reflows by the card's actual width.
 * Same pattern as .component-stat-cards-container above. */
.component-unauthenticated-page-card {
  width: 100%;
  max-width: 30rem;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: 1rem;
  box-shadow: var(--shadow-elev);
  padding: calc(var(--spacing) * 9) calc(var(--spacing) * 9) calc(var(--spacing) * 8);
  container-type: inline-size;
}

/* Dark mode carries depth in borders rather than shadows, and --shadow-elev is
 * nearly invisible there — so the subtle step (#1b1c1f) left the page's most
 * elevated object edgeless against the #0d0d0e page. Step to the themed
 * hairline the dark ladder uses for card edges. Light mode keeps the subtle
 * step: there the ambient shadow already draws the edge. */
[data-theme="dark"] .component-unauthenticated-page-card {
  border-color: var(--color-border-themed);
}

.component-unauthenticated-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: calc(var(--spacing) * 9);
}

.component-unauthenticated-page-logo {
  height: 1.625rem;
  width: auto;
  filter: var(--theme-logo-filter);
}

.component-unauthenticated-page-title {
  font-size: clamp(2rem, 3vw, 2.5rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--color-text-heading);
  margin-bottom: calc(var(--spacing) * 3);
}

.component-unauthenticated-page-subtitle {
  font-size: var(--font-size-base);
  line-height: 1.55;
  color: var(--color-text-muted);
  margin-bottom: calc(var(--spacing) * 8);
}

/* Auth-card form overrides: breathable inputs and a slightly larger label gap
 * for the centered card, plus the accent focus ring below. Labels themselves
 * use the standard .component-form-label-text treatment. Scoped to the card so
 * other forms in the app are untouched. */
.component-unauthenticated-page-card .stack {
  gap: calc(var(--spacing) * 5);
}

/* Field → CTA step matches the 20px card rhythm, so every auth page moves from
 * its last field to its submit button by the same amount it moves between
 * fields. sessions/new gets this from the .stack gap above because its button
 * sits inside the stack; the pages that close with an .accounts-form-actions
 * row are normalized here. Settings forms outside this card keep that class's
 * own 24px. */
.component-unauthenticated-page-card .accounts-form-actions {
  margin-top: calc(var(--spacing) * 5);
}

.component-unauthenticated-page-card .component-form-label {
  margin-bottom: calc(var(--spacing) * 2);
}

.component-unauthenticated-page-card .component-form-field {
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
  border-color: var(--color-border-themed);
}

/* The card sets a softer resting border above, which ties .component-form-field:focus
   on specificity and wins on source order — so the accent focus border needs an
   equally-specific :focus rule here. The ring itself comes from the base var(--focus-ring). */
.component-unauthenticated-page-card .component-form-field:focus {
  border-color: var(--color-accent);
}

.component-unauthenticated-page-footer-text {
  font-size: var(--font-size-xs);
  margin-top: calc(var(--spacing) * 10);
  text-align: center;
  color: var(--color-text-muted);
}

/* Wraps and keeps its own gutter: at 320px the four items no longer fit on one
 * line, and without padding-inline the last link sat flush against the viewport
 * edge. Separation is carried by the gap alone — the middot separators this
 * footer used to draw sat at 1.15:1 against the page and read as dirt rather
 * than structure, and they strand awkwardly once the row wraps. */
.component-unauthenticated-page-pagefooter {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: calc(var(--spacing) * 2) calc(var(--spacing) * 6);
  padding-block: calc(var(--spacing) * 6);
  padding-inline: calc(var(--spacing) * 6);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-unauthenticated-page-pagefooter-link {
  color: var(--color-text-muted);
  transition: color var(--motion-fast);
}

.component-unauthenticated-page-pagefooter-link:hover {
  color: var(--color-text-heading);
}

/* Same treatment as .link-accent: the shared accent ring, radiused tight to
 * the text instead of the UA default outline. */
.component-unauthenticated-page-pagefooter-link:focus-visible {
  outline: none;
  border-radius: var(--radius-xs);
  box-shadow: var(--focus-ring);
}

/*
 * .component-sidebar-* — authenticated-shell navigation. Two rendered copies:
 * a mobile off-canvas panel (.component-sidebar-mobile-*) and a desktop fixed
 * rail (.component-sidebar-desktop). Shared child classes (brand, nav, footer,
 * section labels, user block) apply to both copies.
 *
 * NOTE: sidebar_component.html.erb duplicates its nav tree for mobile/desktop.
 * Tracked in docs/archive/haml-migration-log.md § Reorganization candidates for future
 * cleanup — do not dedupe as a drive-by here.
 *
 * Callers: sidebar_component.
 * Reuse rule: exclusive to global nav. Use SidebarLinkComponent for any
 * nested nav items.
 */
.component-sidebar-mobile-overlay {
  position: relative;
  z-index: 50;
}

.component-sidebar-mobile-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--color-gray-900) 80%, transparent);
}

.component-sidebar-mobile-panel-wrap {
  position: fixed;
  inset: 0;
  display: flex;
}

.component-sidebar-mobile-panel {
  position: relative;
  margin-right: calc(var(--spacing) * 16);
  display: flex;
  width: 100%;
  max-width: 20rem;
  flex: 1 1 0;
}

.component-sidebar-mobile-close {
  position: absolute;
  left: 100%;
  top: 0;
  display: flex;
  width: calc(var(--spacing) * 16);
  justify-content: center;
  padding-top: calc(var(--spacing) * 6);
}

.component-sidebar-mobile-close-button {
  margin: calc(var(--spacing) * -2);
  padding: calc(var(--spacing) * 2);
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-sidebar-mobile-close-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-sidebar-mobile-close-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-text-heading);
}

.component-sidebar-mobile-nav {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  overflow-y: auto;
  background: var(--color-surface-sidebar);
  border-right: 1px solid var(--color-border-subtle);
}

/* Child rows are compact enough on the desktop rail, where they are a pointer
 * target; in the drawer they are a thumb target and take the 44px minimum. */
.component-sidebar-mobile-nav .component-sidebar-child-link {
  min-height: 2.75rem;
}

/* The rail itself never scrolls: .component-sidebar-nav-region does, so the
 * brand stays pinned at the top and the user block + Sign out stay reachable at
 * the bottom however many rows a module adds. */
.component-sidebar-desktop {
  display: none;
  overflow: hidden;
  background: var(--color-surface-sidebar);
  border-right: 1px solid var(--color-border-subtle);
}

@media (min-width: 64rem) {
  .component-sidebar-desktop {
    position: fixed;
    inset-block: 0;
    z-index: 30;
    display: flex;
    width: 15rem;
    flex-direction: column;
  }
}

.component-sidebar-brand {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: flex-start;
  padding: calc(var(--spacing) * 6);
  gap: 0.625rem;
}

/*
 * .component-sidebar-brand-top — the logo + app-switcher line. It holds a
 * fixed layout (logo left, waffle right) that is identical in every app, so
 * switching apps never moves the logo; the optional app badge renders below
 * this row, not within it.
 */
.component-sidebar-brand-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.component-sidebar-brand-logo {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-sidebar-brand-logo:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

.component-sidebar-logo {
  height: 1.375rem;
  width: auto;
  box-sizing: content-box;
  filter: var(--theme-logo-filter);
  color: var(--color-text-heading);
  fill: currentColor;
}

/*
 * .component-sidebar-via-tile
 * The built-in W2 tile the VIA rail shows in place of the partner upload, as
 * the approved SVGs so it stays sharp on 2x screens. 40px, in the rail and
 * the mobile drawer alike: centred on the 36px waffle, its left edge on the
 * nav icons, with the brand's 24px padding around it. No filter: the tile ships one file per theme
 * (.icon-theme-light / .icon-theme-dark), and --theme-logo-filter would
 * flatten it.
 *
 * Used by: app/components/sidebar_component.rb (via_tile_tag)
 */
.component-sidebar-via-tile {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
}

/*
 * .component-sidebar-app-badge
 * Pill naming the current non-default app (today only "Admin"), rendered on
 * its own line beneath the logo + switcher row so it never competes with
 * the partner logo horizontally — partner logos vary widely in width.
 * Tinted with the app-identity hue so it matches that app's tile in the
 * switcher.
 *
 * Used by: app/components/sidebar_component.html.erb
 */
.component-sidebar-app-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-app-admin);
  background: color-mix(in srgb, var(--color-app-admin) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-app-admin) 30%, transparent);
  border-radius: var(--radius-pill);
  padding: 0.125rem calc(var(--spacing) * 2);
}

/*
 * .component-sidebar-partner-name
 * Text fallback when a partner has no logo image attached.
 *
 * Used by: app/components/sidebar_component.rb (partner_logo_tag)
 */
.component-sidebar-partner-name {
  font-size: var(--font-size-base);
  font-weight: 700;
  padding-inline: calc(var(--spacing) * 4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-heading);
}

/*
 * .component-sidebar-nav-region — the rail's one scroll region. It wraps the
 * nav so the scrolled-edge fades can sit at the region's edges instead of
 * scrolling away with the rows, and so the brand and footer stay outside the
 * scroller. sidebar_scroll_controller publishes data-overflow-start/end, which
 * is what turns each fade on: no fade unless there really is a row behind it.
 *
 * Used by: app/components/sidebar_component.html.erb
 */
.component-sidebar-nav-region {
  position: relative;
  display: flex;
  flex: 1 1 0;
  min-height: 0;
}

.component-sidebar-nav-region::before,
.component-sidebar-nav-region::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  height: calc(var(--spacing) * 6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-fast);
}

.component-sidebar-nav-region::before {
  top: 0;
  background: linear-gradient(to bottom, var(--color-surface-sidebar), transparent);
}

.component-sidebar-nav-region::after {
  bottom: 0;
  background: linear-gradient(to top, var(--color-surface-sidebar), transparent);
}

.component-sidebar-nav-region[data-overflow-start="true"]::before,
.component-sidebar-nav-region[data-overflow-end="true"]::after {
  opacity: 1;
}

.component-sidebar-nav {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  /* Matches the fade height, so a row scrolled into view lands clear of the
   * fade instead of under it. */
  scroll-padding-block: calc(var(--spacing) * 6);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.component-sidebar-section-label {
  padding: calc(var(--spacing) * 6) calc(var(--spacing) * 3) calc(var(--spacing) * 1);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.component-sidebar-section-label-accent {
  padding-top: 0;
  padding-bottom: calc(var(--spacing) * 1);
}

.component-sidebar-apps {
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 3);
}

.component-sidebar-footer {
  flex-shrink: 0;
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 3);
  border-top: 1px solid var(--color-border-subtle);
}

.component-sidebar-user-menu {
  position: relative;
}

.component-sidebar-user {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  width: 100%;
  border-radius: var(--radius-lg);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: background-color var(--transition-timing-standard);
}

.component-sidebar-user:hover {
  background: var(--color-surface-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-sidebar-user:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-sidebar-user-avatar {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.component-sidebar-user-name-wrap {
  flex: 1 1 0;
  min-width: 0;
}

.component-sidebar-user-name {
  font-size: var(--font-size-xs);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-heading);
}

.component-sidebar-user-role {
  font-size: var(--font-size-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
}

/* Up/down chevron signalling the avatar row opens the account menu. */
.component-sidebar-user-chevron {
  width: 0.875rem;
  height: 0.875rem;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.component-sidebar-user-popover {
  position: absolute;
  bottom: calc(100% + calc(var(--spacing) * 1));
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 0.625rem 0.9375rem -0.1875rem color-mix(in srgb, var(--color-gray-900) 10%, transparent),
              0 0.25rem 0.375rem -0.25rem color-mix(in srgb, var(--color-gray-900) 10%, transparent);
  padding: calc(var(--spacing) * 1);
}

.component-sidebar-user-popover-link {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  transition: background-color var(--transition-timing-standard), color var(--transition-timing-standard);
}

.component-sidebar-user-popover-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

/* Focus doctrine: the shared ring on keyboard focus. Covers the button rows
 * too — they carry this class alongside .component-sidebar-user-popover-button. */
.component-sidebar-user-popover-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-sidebar-user-popover-icon {
  width: 1rem;
  height: 1rem;
}

/* Button rows in the popover (What's New) need the anchor-row resets. Reset
   font-family/weight only — not the `font` shorthand, which would clobber the
   link class's --font-size-sm and render the row larger than its siblings. */
.component-sidebar-user-popover-button {
  width: 100%;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-weight: inherit;
}

/* Trailing indicator that the Status link opens in a new tab. */
.component-sidebar-user-popover-external {
  width: 0.75rem;
  height: 0.75rem;
  margin-left: auto;
  color: var(--color-text-muted);
}

.component-sidebar-user-popover-separator {
  margin: calc(var(--spacing) * 1) 0;
  border-top: 1px solid var(--color-border-subtle);
}

/* The theme toggle renders its own button; align it with the popover rows. */
.component-sidebar-user-popover .component-theme-toggle-full {
  border-radius: var(--radius-md);
  gap: calc(var(--spacing) * 2);
  font-weight: inherit;
}

.component-sidebar-user-popover .component-theme-toggle-full:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

.component-sidebar-mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: 0 calc(var(--spacing) * 3);
  box-shadow: 0 0.0625rem 0.125rem 0 color-mix(in srgb, var(--color-gray-900) 5%, transparent);
  height: 3.5rem;
  background: var(--color-surface-sidebar);
  border-bottom: 1px solid var(--color-border-subtle);
}

@media (min-width: 64rem) {
  .component-sidebar-mobile-topbar { display: none; }
}

/* Hamburger + avatar share a fixed width so the flex:1 title centers between them. */
.component-sidebar-mobile-hamburger {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.component-sidebar-mobile-hamburger:hover {
  background: var(--color-surface-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-sidebar-mobile-hamburger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-sidebar-mobile-hamburger-icon {
  width: 1.375rem;
  height: 1.375rem;
}

.component-sidebar-mobile-topbar-title {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.5rem;
  color: var(--color-text-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-sidebar-mobile-topbar-avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
}

/* 32px identity avatar (larger than the 24px default circle). */
.component-sidebar-mobile-topbar-avatar-circle,
.component-sidebar-mobile-topbar-avatar-circle.component-avatar-image {
  width: 2rem;
  height: 2rem;
  font-size: var(--font-size-xs);
}

/*
 * .component-lists-status-* — status pill used on list rows/details (Vault).
 * Icon color encodes state (ready/failed/pending).
 *
 * Callers: lists/status_component.
 * Reuse rule: exclusive to list status rendering.
 */
.component-lists-status {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  line-height: 1.25rem;
}

.component-lists-status-icon-ready { color: var(--theme-badge-green-text); }
.component-lists-status-icon-failed { color: var(--theme-badge-red-text); }
.component-lists-status-icon-pending { color: var(--theme-badge-gray-text); }

/*
 * .component-lists-delete-button-* — destructive delete action rendered at the
 * bottom of the list details panel when the list is uploaded.
 *
 * Callers: lists/delete_button_component.
 * Reuse rule: exclusive to the list delete affordance.
 */
.component-lists-delete-button {
  margin-top: calc(var(--spacing) * 8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-danger);
  padding: calc(var(--spacing) * 2);
  border-radius: var(--radius-lg);
}

/* Same commit-on-hover shape as .component-button-red: the fill is the
 * presentation-strength face carrying --color-text-on-vivid (4.83:1 light,
 * 7.02:1 dark), not the 400-level base under a near-black label. */
.component-lists-delete-button:hover {
  background: var(--color-red-mark);
  color: var(--color-text-on-vivid);
}

.component-lists-delete-button:active {
  background: color-mix(in srgb, var(--color-red-mark) 85%, var(--color-text-heading));
  color: var(--color-text-on-vivid);
}

.component-lists-delete-button-icon {
  height: 1rem;
}

.component-lists-delete-button-label {
  margin-left: calc(var(--spacing) * 2);
}


/*
 * .component-lists-record-count-preset — preset button pill used inside the
 * list record count picker (wizard step). Uses aria-pressed for selection.
 *
 * Callers: lists/record_count_presets_component.
 * Reuse rule: exclusive to the record count preset row.
 */
.component-lists-record-count-preset {
  align-items: center;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.625rem; /* 10px — shared control radius from the card design */
  color: var(--color-text-body);
  display: inline-flex;
  font-size: var(--font-size-sm);
  font-weight: 500;
  height: 2.125rem; /* 34px */
  justify-content: center;
  min-width: 2.875rem; /* 46px */
  padding: 0 0.8125rem; /* 0 13px */
  transition: all var(--transition-timing-standard);
}

.component-lists-record-count-preset[aria-pressed="true"] {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent-border);
  color: var(--color-accent);
}

/*
 * .component-lists-manual-processing-card-* — checkbox card for "This list
 * requires manual processing" option on the wizard upload step.
 *
 * Callers: lists/manual_processing_card_component.
 * Reuse rule: exclusive to the manual processing opt-in. Uses :has() for check
 * state so the hidden input can live inside the label.
 */
.component-lists-manual-processing-card {
  position: relative;
  padding: calc(var(--spacing) * 4);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-themed);
  background: var(--color-surface-primary);
  cursor: pointer;
  transition: all var(--transition-timing-standard);
  user-select: none;
}

.component-lists-manual-processing-card:has(.component-lists-manual-processing-card-input:checked) {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
}

.component-lists-manual-processing-card-input {
  appearance: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
}

.component-lists-manual-processing-card-box {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0.09375rem solid var(--color-border-strong);
  transition: all var(--transition-timing-standard);
}

.component-lists-manual-processing-card:has(.component-lists-manual-processing-card-input:checked) .component-lists-manual-processing-card-box {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.component-lists-manual-processing-card-check {
  display: none;
}

.component-lists-manual-processing-card:has(.component-lists-manual-processing-card-input:checked) .component-lists-manual-processing-card-check {
  display: block;
}

.component-lists-manual-processing-card-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
}

.component-lists-manual-processing-card:has(.component-lists-manual-processing-card-input:checked) .component-lists-manual-processing-card-title {
  color: var(--color-accent);
}

.component-lists-manual-processing-card-description {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

/*
 * .component-lists-navigation-actions — button wrapping row shown at the top of
 * list details (Download/Append/Edit/etc).
 *
 * Callers: lists/navigation_actions_component.
 * Reuse rule: exclusive to list navigation. .row primitive not used because the
 * wrap behavior + negative top margin is specific.
 */
.component-lists-navigation-actions {
  margin-top: calc(var(--spacing) * -2);
  display: flex;
  flex-wrap: wrap;
}

.component-lists-navigation-actions-button {
  margin-top: calc(var(--spacing) * 2);
  margin-right: calc(var(--spacing) * 2);
}

/*
 * .component-lists-records-to-export-* — records-to-export card (wizard step):
 * account usage bar + audience record count input with presets + per-segment
 * breakdown.
 *
 * Callers: lists/records_to_export_component.
 * Reuse rule: exclusive to this wizard step.
 */
.component-lists-records-to-export-usage {
  background: var(--color-surface-elevated);
  border-radius: var(--radius-xl); /* 12px */
  margin-bottom: 1.375rem; /* 22px */
  padding: 0.875rem 1rem; /* 14px 16px */
}

.component-lists-records-to-export-usage-header {
  align-items: baseline;
  display: flex;
  font-size: 0.8125rem; /* 13px */
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.component-lists-records-to-export-usage-label { color: var(--color-text-muted); }
.component-lists-records-to-export-usage-value { color: var(--color-text-body); }

.component-lists-records-to-export-usage-track {
  width: 100%;
  height: 0.3125rem; /* 5px */
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--color-border-themed);
}

.component-lists-records-to-export-usage-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: all var(--transition-timing-slow);
  width: var(--usage, 0%);
}

.component-lists-records-to-export-usage-bar-full { background: var(--color-red-mark); }
.component-lists-records-to-export-usage-bar-normal { background: var(--color-accent); }

.component-lists-records-to-export-usage-remaining {
  font-size: var(--font-size-xs);
  color: var(--color-text-success);
  margin-top: 0.375rem;
}

/**
 * .component-lists-records-to-export-cost-breakdown / -cost-row / -cost-total
 * Per-record credit pricing block shown in the export card when the
 * account bills in credits: one row per priced field add-on plus a
 * bolded total row whose value the lists--credit-cost Stimulus
 * controller recomputes as the record count changes.
 *
 * Where used:
 *   - app/components/lists/records_to_export_component.html.erb
 */
.component-lists-records-to-export-cost-breakdown {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1);
  margin-top: calc(var(--spacing) * 2);
  padding-top: calc(var(--spacing) * 2);
  border-top: 1px solid var(--color-border-subtle);
}

.component-lists-records-to-export-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-records-to-export-cost-total {
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-lists-records-to-export-input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.component-lists-records-to-export-input-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-heading);
}

.component-lists-records-to-export-input-available {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-records-to-export-number-field {
  background: var(--color-surface-input);
  border: 1px solid var(--color-border-strong);
  border-radius: 0.625rem; /* 10px */
  color: var(--color-text-heading);
  font-size: max(var(--font-size-sm), var(--field-font-floor));
  font-weight: 500;
  height: 2.125rem; /* 34px */
  outline: none;
  padding: 0 calc(var(--spacing) * 3); /* 0 12px */
  transition: all var(--transition-timing-standard);
  width: 7rem;
}

.component-lists-records-to-export-number-field:focus {
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.component-lists-records-to-export-error {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-danger);
}

.component-lists-records-to-export-groups {
  /* Passthrough wrapper: the allocator owns its spacing, and the usage block
   * above provides the gap, so no divider here. */
  display: block;
}

.component-lists-records-to-export-groups-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-body);
  margin-bottom: calc(var(--spacing) * 4);
}

/*
 * .component-lists-mapping-form-* — column mapping step (upload wizard).
 * Select-with-chevron rows for mapping columns to format fields.
 *
 * Callers: lists/mapping_form_component.
 * Reuse rule: exclusive to list column mapping.
 */
.component-lists-mapping-form-error {
  padding-bottom: calc(var(--spacing) * 6);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-danger);
}

.component-lists-mapping-form-retry {
  text-align: right;
}

.component-lists-mapping-form-card {
  margin-top: calc(var(--spacing) * 4);
}

.component-lists-mapping-form-instructions {
  padding-top: calc(var(--spacing) * 2);
  padding-bottom: calc(var(--spacing) * 8);
  color: var(--color-text-body);
}

.component-lists-mapping-form-field {
  margin-bottom: calc(var(--spacing) * 8);
}

.component-lists-mapping-form-select-wrap {
  position: relative;
}

.component-lists-mapping-form-select {
  margin-top: calc(var(--spacing) * 1);
  appearance: none;
}

.component-lists-mapping-form-select-chevron {
  width: 1rem;
  height: 1rem;
  position: absolute;
  right: calc(var(--spacing) * 6);
  top: calc(var(--spacing) * 6);
  pointer-events: none;
}

.component-lists-mapping-form-submit {
  margin-top: calc(var(--spacing) * 6);
  text-align: right;
}

/*
 * .component-lists-uploads-* — user-initiated CSV list upload wizard
 * (Source → Upload → Map Columns → Review → Success). Shares the
 * `.vault-wizard` shell and `WizardStepsComponent` indicator with the
 * audience-export wizard; the classes below style content specific to
 * the upload path: the source picker, column-by-column mapping rows
 * (with sample-value preview + AI confidence indicator), the analyzing
 * state, and the post-submit success screen.
 *
 * Callers: lists/uploads/source_step_component, upload_step_component,
 *   mapping_step_component, review_step_component, success_component.
 * Reuse rule: exclusive to the list-upload wizard. Do not apply these
 * to the audience-export wizard (that wizard uses generic
 * `.vault-wizard-*` classes for the review rows it already has).
 */

/* --- Source step --- */

.component-lists-uploads-source-step-heading {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

/* --- Preattached file preview (post-error re-render) --- */

/*
 * Shown on step 2 when the form re-renders after a validation failure:
 * the file lives as an ActiveStorage signed_id in a hidden input, so
 * Dropzone has no DOM state to hang onto. This panel reassures the
 * user that their file is still attached and will be resubmitted.
 */
.component-lists-uploads-preattached {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 5);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
}

.component-lists-uploads-preattached-icon {
  width: calc(var(--spacing) * 8);
  height: calc(var(--spacing) * 8);
  color: var(--color-accent);
  flex-shrink: 0;
}

.component-lists-uploads-preattached-body {
  min-width: 0;
}

.component-lists-uploads-preattached-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
}

.component-lists-uploads-preattached-size {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

/* --- Mapping step intro and summary --- */

.component-lists-uploads-mapping-intro {
  font-size: var(--font-size-sm);
  color: var(--color-text-heading);
  margin-bottom: 0.25rem;
}

.component-lists-uploads-mapping-body {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-uploads-summary {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-uploads-summary strong {
  color: var(--color-text-heading);
  font-weight: 600;
}

.component-lists-uploads-summary strong.component-lists-uploads-summary-mapped {
  color: var(--color-text-success);
}

/* --- Mapping step column rows --- */

.component-lists-uploads-column-list {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.component-lists-uploads-column-list > * + * {
  border-top: 1px solid var(--color-border-subtle);
}

.component-lists-uploads-column-row {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
}

.component-lists-uploads-column-info {
  flex: 1 1 0;
  min-width: 0;
}

.component-lists-uploads-column-header {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-lists-uploads-column-samples {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-lists-uploads-column-arrow {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.component-lists-uploads-column-mapping {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  width: 12.5rem;
  flex-shrink: 0;
}

.component-lists-uploads-column-select {
  width: 100%;
}

.component-lists-uploads-confidence {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding-inline-start: 0.25rem;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-uploads-confidence-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  background: var(--color-text-muted);
}

.component-lists-uploads-confidence[data-confidence="high"] .component-lists-uploads-confidence-dot {
  background: var(--color-green-mark);
}

.component-lists-uploads-confidence-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Mapping step: AI analyzing placeholder --- */

.component-lists-uploads-analyzing {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: calc(var(--spacing) * 10);
  gap: calc(var(--spacing) * 1);
}

.component-lists-uploads-analyzing-icon {
  width: calc(var(--spacing) * 7);
  height: calc(var(--spacing) * 7);
  margin-bottom: calc(var(--spacing) * 2);
  color: var(--color-accent);
  animation: component-lists-uploads-pulse 1.5s ease-in-out infinite;
}

.component-lists-uploads-analyzing-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-lists-uploads-analyzing-subtitle {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

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

/* --- HubSpot source step (alternate step 2) --- */

/*
 * The HubSpot import panel that replaces the CSV dropzone when the source is
 * a connected HubSpot portal: a lazily-loaded list picker (turbo frame), a
 * one-time/ongoing cadence choice, and the shared list-name field.
 */

.component-lists-uploads-crm-loading {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 6);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.component-lists-uploads-crm-loading-icon {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
  flex-shrink: 0;
}

.component-lists-uploads-crm-picker {
  max-height: 20rem;
  overflow-y: auto;
}

.component-lists-uploads-crm-cadence {
  border: none;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.component-lists-uploads-crm-cadence-option {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 4);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: border-color var(--transition-timing-standard), background var(--transition-timing-standard);
}

.component-lists-uploads-crm-cadence-option:hover {
  border-color: var(--color-border-strong);
}

.component-lists-uploads-crm-cadence-option:has(input:checked) {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.component-lists-uploads-crm-cadence-radio {
  margin-top: 0.125rem;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}

.component-lists-uploads-crm-cadence-body {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.component-lists-uploads-crm-cadence-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
}

.component-lists-uploads-crm-cadence-help {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-uploads-crm-map-target {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
  flex-shrink: 0;
}

.component-lists-uploads-crm-error {
  padding: calc(var(--spacing) * 6);
  text-align: center;
}

.component-lists-uploads-crm-error-message {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.component-lists-uploads-crm-error-retry {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-accent);
}

/*
 * .component-lists-uploads-success* — centered check-circle + heading +
 * body + actions layout used by post-processing "success" screens.
 *
 * Used by: app/components/lists/uploads/success_component.html.erb,
 *          app/components/lists/exports/success_component.html.erb,
 *          app/components/email_campaigns/export_success_component.html.erb
 * Reuse when: any flow that ends with "we're working on it" + CTAs.
 * Do NOT use for: inline confirmations — use a flash or toast instead.
 */

.component-lists-uploads-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 4rem);
  padding: calc(var(--spacing) * 8);
  text-align: center;
}

.component-lists-uploads-success-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 16);
  height: calc(var(--spacing) * 16);
  border-radius: var(--radius-pill);
  background: var(--color-accent-subtle);
  border: 2px solid var(--color-accent);
  margin-bottom: calc(var(--spacing) * 6);
}

.component-lists-uploads-success-check {
  width: calc(var(--spacing) * 8);
  height: calc(var(--spacing) * 8);
  color: var(--color-accent);
}

.component-lists-uploads-success-heading {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-heading);
  margin-bottom: calc(var(--spacing) * 2);
}

.component-lists-uploads-success-body {
  max-width: 24rem;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: calc(var(--spacing) * 8);
}

.component-lists-uploads-success-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--spacing) * 3);
  width: 100%;
  max-width: 36rem;
  margin-bottom: calc(var(--spacing) * 6);
}

.component-lists-uploads-success-action-card {
  display: block;
  padding: calc(var(--spacing) * 4);
  text-align: left;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xl);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition-timing-standard);
}

.component-lists-uploads-success-action-card:hover {
  border-color: var(--color-accent);
}

.component-lists-uploads-success-action-card--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.component-lists-uploads-success-action-card--disabled:hover {
  border-color: var(--color-border-themed);
}

.component-lists-uploads-success-action-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
  margin-bottom: 0.25rem;
}

.component-lists-uploads-success-action-description {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/*
 * .component-lists-output-fields-* — output fields selector (wizard step).
 * Categorized checkbox list with search, quick actions (select/clear all),
 * per-category expand/collapse, and count summary. Stimulus controller
 * lists--output-fields drives filtering and recalc.
 *
 * Callers: lists/output_fields_component.
 * Reuse rule: exclusive to this wizard step. The :has() selectors replace
 * group-has-[:checked] Tailwind utilities.
 */
.component-lists-output-fields-error {
  padding-bottom: calc(var(--spacing) * 4);
  font-weight: 500;
  color: var(--color-text-danger);
}

.component-lists-output-fields-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: calc(var(--spacing) * 4);
}

.component-lists-output-fields-counter {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-output-fields-counter-active {
  color: var(--color-accent);
}

.component-lists-output-fields-toggle-active {
  color: var(--color-accent);
}

.component-lists-output-fields-toggle-muted {
  color: var(--color-text-muted);
}

.component-lists-output-fields-search {
  position: relative;
  margin-bottom: calc(var(--spacing) * 4);
}

.component-lists-output-fields-search-icon {
  position: absolute;
  left: calc(var(--spacing) * 4);
  top: 50%;
  transform: translateY(-50%);
  width: 0.875rem;
  height: 0.875rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

.component-lists-output-fields-search-input {
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4) calc(var(--spacing) * 2) calc(var(--spacing) * 8);
  font-size: max(var(--font-size-xs), var(--field-font-floor));
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-elevated);
  color: var(--color-text-heading);
  outline: none;
  transition: all var(--transition-timing-standard);
}

.component-lists-output-fields-search-input:focus {
  border-color: var(--color-accent);
}

.component-lists-output-fields-quick-actions {
  display: flex;
  gap: calc(var(--spacing) * 4);
  margin-bottom: calc(var(--spacing) * 4);
}

.component-lists-output-fields-select-all {
  font-size: var(--font-size-xs);
  color: var(--color-accent);
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
}

.component-lists-output-fields-clear-all {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
}

.component-lists-output-fields-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 20rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.component-lists-output-fields-category-row {
  padding: calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
  background: var(--color-surface-elevated);
  cursor: pointer;
}

.component-lists-output-fields-category-chevron {
  color: var(--color-text-muted);
}

.component-lists-output-fields-category:has(> .component-lists-output-fields-fields[hidden]) .component-lists-output-fields-category-chevron {
  transform: rotate(-90deg);
}

.component-lists-output-fields-category-chevron-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-lists-output-fields-category-name {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-heading);
  flex: 1 1 0;
}

.component-lists-output-fields-category-counter {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-output-fields-category-counter-active {
  color: var(--color-accent);
}

.component-lists-output-fields-category-toggle {
  font-size: var(--font-size-xs);
  cursor: pointer;
  margin-left: 0.25rem;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 0;
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-lists-output-fields-category-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-lists-output-fields-category-toggle-select { color: var(--color-accent); }
.component-lists-output-fields-category-toggle-deselect { color: var(--color-text-muted); }

.component-lists-output-fields-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: calc(var(--spacing) * 4);
  row-gap: 0.125rem;
  padding: calc(var(--spacing) * 2);
  margin-left: calc(var(--spacing) * 4);
}

.component-lists-output-fields-field {
  position: relative;
  padding: 0.375rem calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  cursor: pointer;
  color: var(--color-text-body);
  transition: all var(--transition-timing-standard);
}

.component-lists-output-fields-field:has(.component-lists-output-fields-field-input:checked) {
  color: var(--color-accent);
}

.component-lists-output-fields-field-input {
  appearance: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
}

.component-lists-output-fields-field-box {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0.09375rem solid var(--color-border-strong);
  transition: all var(--transition-timing-standard);
}

.component-lists-output-fields-field:has(.component-lists-output-fields-field-input:checked) .component-lists-output-fields-field-box {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.component-lists-output-fields-field-check {
  display: none;
}

.component-lists-output-fields-field:has(.component-lists-output-fields-field-input:checked) .component-lists-output-fields-field-check {
  display: block;
}

.component-lists-dnc-scrub[hidden] {
  display: none;
}

.component-lists-dnc-scrub-label {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-heading);
}

.component-lists-dnc-scrub-icon {
  display: inline;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: calc(var(--spacing) * 1);
  color: var(--color-text-muted);
}

.component-lists-dnc-scrub-note {
  margin-top: calc(var(--spacing) * 2);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-lists-dnc-scrub-note:first-child {
  margin-top: 0;
}

.component-lists-dnc-scrub:has([aria-pressed="false"]) .component-lists-dnc-scrub-shortfall {
  display: none;
}

/* ─── RadioCardComponent ─── */

/*
 * .component-radio-card-* — shared radio-as-card primitive. One selectable
 * option inside a role="radiogroup" wrapper owned by the caller. The card root
 * carries the selection state (data-selected, aria-disabled, set by
 * radio_card_controller) and the caller's data payload; the inner
 * .component-radio-card-control is the role="radio" element that takes focus
 * and clicks. They are separate elements so a caller can hang its own
 * focusable content off the detail slot, which renders below the control and
 * outside the radio. Icon and radio-indicator slots are both optional; radio
 * may be leading (default) or trailing.
 *
 * Callers: RadioCardComponent (lists/format_component,
 * audiences/exports/destination_step_component).
 * Reuse rule: use when any new surface needs a role="radio" card with
 * accent selected state and optional icon slot. Do not override the
 * attribute-selector states with class-based variants — drive state via the
 * controller instead.
 */
.component-radio-card {
  padding: calc(var(--spacing) * 4);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border-themed);
  background: var(--color-surface-primary);
  transition: all var(--motion-fast);
}

.component-radio-card[data-selected="true"] {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
}

.component-radio-card[aria-disabled="true"] {
  opacity: 0.6;
  pointer-events: none;
}

/* Hover reads as "click to select", so it follows the control rather than the
 * whole card — the detail slot below it is not a selection surface. */
.component-radio-card:not([data-selected="true"]):not([aria-disabled="true"]):has(.component-radio-card-control:hover) {
  background: var(--color-surface-hover);
}

.component-radio-card-control {
  align-items: center;
  cursor: pointer;
}

.component-radio-card-control:focus-visible {
  outline: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--focus-ring);
}

.component-radio-card[aria-disabled="true"] .component-radio-card-control {
  cursor: default;
}

.component-radio-card-icon-wrapper {
  align-items: center;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  color: var(--color-text-muted);
  display: flex;
  flex-shrink: 0;
  height: calc(var(--spacing) * 10);
  justify-content: center;
  width: calc(var(--spacing) * 10);
}

.component-radio-card[data-selected="true"] .component-radio-card-icon-wrapper {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.component-radio-card-icon {
  height: 1.125rem;
  width: 1.125rem;
}

.component-radio-card-body {
  flex: 1 1 0;
  min-width: 0;
}

.component-radio-card-title-row {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  flex-wrap: wrap;
}

.component-radio-card-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-radio-card[data-selected="true"] .component-radio-card-label {
  color: var(--color-accent);
}

.component-radio-card-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
  margin-top: 0.125rem;
}

.component-radio-card-description-link {
  color: var(--color-accent);
}

.component-radio-card-description-link:hover {
  text-decoration: underline;
}

.component-radio-card-radio {
  width: 1rem;
  height: 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.component-radio-card-radio--trailing {
  margin-left: auto;
}

.component-radio-card[data-selected="true"] .component-radio-card-radio {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.component-radio-card-radio-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--color-text-inverted);
  display: none;
}

.component-radio-card[data-selected="true"] .component-radio-card-radio-dot {
  display: block;
}

/*
 * .component-lists-format-fields-* — disclosure listing every column an export
 * format writes, rendered into the RadioCardComponent detail slot. Indented to
 * line up under the card body, past the radio indicator. Chip labels are the
 * literal file headers, so they are never re-cased here.
 *
 * Callers: lists/format_fields_component.
 * Reuse rule: exclusive to the export format picker. A different surface that
 * needs field chips should define its own family rather than borrow these.
 */
.component-lists-format-fields {
  margin-top: calc(var(--spacing) * 2);
  margin-left: calc(var(--spacing) * 8);
}

.component-lists-format-fields-summary {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
  width: fit-content;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  margin-left: calc(var(--spacing) * -2);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-accent);
  list-style: none;
}

.component-lists-format-fields-summary::-webkit-details-marker {
  display: none;
}

.component-lists-format-fields-summary:hover {
  background: var(--color-surface-hover);
}

.component-lists-format-fields-summary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-lists-format-fields-chevron {
  display: flex;
  align-items: center;
  transition: transform var(--motion-fast);
}

.component-lists-format-fields[open] .component-lists-format-fields-chevron {
  transform: rotate(90deg);
}

.component-lists-format-fields-chevron-icon {
  height: calc(var(--spacing) * 3);
  width: calc(var(--spacing) * 3);
}

.component-lists-format-fields[open] .component-lists-format-fields-show,
.component-lists-format-fields:not([open]) .component-lists-format-fields-hide {
  display: none;
}

.component-lists-format-fields-list {
  margin-top: calc(var(--spacing) * 2);
  gap: calc(var(--spacing) * 1);
}

.component-lists-format-fields-chip {
  display: inline-flex;
  align-items: center;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-body);
}

/*
 * .component-lists-format — format chooser wrapper (wizard step). Owns the
 * outer stack + sibling panels (csv grouping options, custom options). The
 * actual radio cards are rendered by RadioCardComponent; see
 * .component-radio-card-* above.
 *
 * Callers: lists/format_component.
 * Reuse rule: exclusive to format selection.
 */
.component-lists-format {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 8);
}

.component-lists-format-error {
  margin-top: calc(var(--spacing) * 4);
  font-weight: 500;
  font-size: var(--font-size-sm);
  color: var(--color-text-danger);
}

.component-lists-format-segment-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/*
 * .component-lists-details-* — list details sidebar (Vault list show page).
 * Admin + public branches, cleaning section, append section, group record
 * count breakdown, and created/updated user rows.
 *
 * Callers: lists/details_component.
 * Reuse rule: exclusive to Vault list details. Tooltip match-type chips here
 * are bespoke; don't generalize unless another surface needs them.
 */
.component-lists-details-status-note {
  font-size: var(--font-size-sm);
  margin-top: calc(var(--spacing) * 2);
}

.component-lists-details-error {
  font-size: var(--font-size-sm);
  color: var(--color-text-danger);
}

.component-lists-details-retry {
  margin-top: calc(var(--spacing) * 2);
}

.component-lists-details-segment-row {
  display: flex;
  justify-content: space-between;
}

.component-lists-details-segment-name {
  font-size: var(--font-size-sm);
  color: var(--color-gray-700);
}

.component-lists-details-segment-value {
  font-weight: 500;
}

.component-lists-details-segment-total {
  border-top: 1px solid var(--color-border-themed);
  padding-top: calc(var(--spacing) * 2);
  margin-top: calc(var(--spacing) * 2);
}

.component-lists-details-segment-total-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-gray-900);
}

.component-lists-details-segment-total-value {
  font-weight: 600;
}

.component-lists-details-vin-invalid {
  color: var(--color-text-danger);
}

.component-lists-details-vin-rows {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1);
  max-height: calc(var(--spacing) * 60);
  overflow-y: auto;
  border-top: 1px solid var(--color-border-themed);
  padding-top: calc(var(--spacing) * 2);
  margin-top: calc(var(--spacing) * 1);
}

.component-lists-details-vin-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: calc(var(--spacing) * 2);
  font-size: var(--font-size-sm);
}

.component-lists-details-vin-row-line {
  color: var(--color-text-muted);
}

.component-lists-details-vin-row-value {
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.component-lists-details-vin-row-reason {
  grid-column: 2;
  color: var(--color-text-danger);
}

.component-lists-details-vin-more {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.component-lists-details-na {
  color: var(--color-gray-500);
}

.component-lists-details-code {
  background: var(--color-gray-100);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-family: ui-monospace, monospace;
}

.component-lists-details-match-types {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.component-lists-details-match-type {
  position: relative;
}

.component-lists-details-match-type-name {
  border-bottom: 1px dashed var(--color-gray-500);
  cursor: help;
}

.component-lists-details-match-type-tooltip {
  display: none;
  position: relative;
  background: var(--color-gray-200);
  padding: 0 calc(var(--spacing) * 2);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  text-align: center;
}

.component-lists-details-match-type:hover .component-lists-details-match-type-tooltip {
  display: flex;
}

.component-lists-details-append {
  margin-top: calc(var(--spacing) * 8);
  margin-bottom: calc(var(--spacing) * 8);
}

.component-lists-details-append-title {
  font-weight: 700;
  margin-left: calc(var(--spacing) * 2);
  margin-right: calc(var(--spacing) * 2);
  margin-bottom: calc(var(--spacing) * 4);
}

.component-lists-details-field-chip {
  display: inline-flex;
  align-items: center;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  background: var(--color-gray-100);
  color: var(--color-gray-800);
}


.component-lists-details-user-row {
  display: flex;
  align-items: center;
}

.component-lists-details-user-avatar {
  margin-right: calc(var(--spacing) * 2);
}

/*
 * .component-lists-details-icon-muted
 * Small muted inline icon used next to row labels (data source icon,
 * suppression list icon). Mirrors the audience details equivalent.
 *
 * Used by: app/components/lists/details_component.html.erb
 * Reuse when: another label needs a muted 1rem icon.
 */
.component-lists-details-icon-muted {
  color: var(--color-text-muted);
  height: calc(var(--spacing) * 4);
  width: calc(var(--spacing) * 4);
}

/*
 * .component-lists-details-criteria-list
 * Bullet-prefixed match-criteria list inside the list details card.
 *
 * Used by: app/components/lists/details_component.html.erb
 * Reuse when: another inline criteria list needs the same rhythm.
 */
.component-lists-details-criteria-list > * + * {
  margin-top: calc(var(--spacing) * 1);
}

/*
 * .component-core-orders-payment-options-input — wrapper for payment options
 * checkbox list in the Core orders form. Only bottom padding.
 *
 * Callers: core/orders/payment_options_input_component.
 * Reuse rule: exclusive to Core orders.
 */
.component-core-orders-payment-options-input {
  padding-bottom: calc(var(--spacing) * 4);
}


/* ═══ Trix editor ═══ */

/*
 * Trix editor and toolbar styling. These rules override Trix's default
 * stylesheet to match the design system's surfaces, borders, and spacing.
 * Relocated from app/assets/tailwind/application.css during Phase 6.
 */

trix-editor {
  background: var(--color-surface-input);
  color: var(--color-text-input);
  border-color: var(--color-border-strong);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  min-height: 5rem;
  transition: all var(--transition-timing-standard);
}

trix-editor:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: var(--focus-ring);
}

trix-editor:hover {
  background: var(--color-surface-elevated);
}

trix-toolbar {
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

trix-toolbar .trix-button-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.125rem !important;
  margin-bottom: 0.375rem !important;
  overflow: visible !important;
}

trix-toolbar .trix-button-group {
  display: flex !important;
  align-items: center !important;
  gap: 0.0625rem !important;
  border: none !important;
  margin: 0 !important;
  padding-right: 0.375rem !important;
  margin-right: 0.375rem !important;
  border-right: 1px solid var(--theme-border-primary) !important;
}

trix-toolbar .trix-button-group:last-of-type {
  border-right: none !important;
  margin-right: 0 !important;
  padding-right: 0 !important;
}

trix-toolbar .trix-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.875rem !important;
  height: 1.875rem !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0.375rem !important;
  background-color: transparent !important;
  background: none !important;
  transition: all var(--transition-timing-standard) !important;
  cursor: pointer !important;
}

trix-toolbar .trix-button--icon::before {
  background-size: 60% !important;
  opacity: 0.55;
  filter: var(--theme-logo-filter);
}

trix-toolbar .trix-button:hover {
  background-color: var(--theme-bg-hover) !important;
}

trix-toolbar .trix-button:hover::before {
  opacity: 0.85;
}

trix-toolbar .trix-button.trix-active {
  background-color: color-mix(in srgb, var(--theme-accent) 12%, transparent) !important;
  opacity: 1;
}

trix-toolbar .trix-button-group--file-tools {
  display: none !important;
}

trix-toolbar .trix-dialogs {
  position: relative !important;
  margin-top: 0.25rem !important;
}

trix-toolbar .trix-dialog {
  background: var(--theme-bg-surface) !important;
  border: 1px solid var(--theme-border-primary) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 0.25rem 0.75rem color-mix(in srgb, var(--color-black) 8%, transparent) !important;
  padding: 0.625rem !important;
  margin-top: 0.25rem !important;
  inset: auto !important;
  position: relative !important;
}

trix-toolbar .trix-dialog__link-fields {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

trix-toolbar .trix-dialog__link-fields input[type="url"],
trix-toolbar .trix-dialog__link-fields input[type="text"] {
  background: var(--color-surface-input);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  color: var(--color-text-input);
  padding: 0.375rem 0.625rem !important;
  flex: 1 !important;
  outline: none !important;
}

trix-toolbar .trix-dialog__link-fields input[type="url"]:focus,
trix-toolbar .trix-dialog__link-fields input[type="text"]:focus {
  border-color: var(--color-accent) !important;
  box-shadow: var(--focus-ring);
}

trix-toolbar .trix-dialog__link-fields .trix-button-group {
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0.25rem !important;
}

trix-toolbar .trix-dialog__link-fields .trix-button-group .trix-button {
  background-color: var(--theme-accent) !important;
  color: white !important;
  border-radius: 0.375rem !important;
  padding: 0.375rem 0.75rem !important;
  width: auto !important;
  height: auto !important;
  font-size: var(--font-size-xs) !important;
  font-weight: 500 !important;
  opacity: 1 !important;
  background-image: none !important;
}

trix-toolbar .trix-dialog__link-fields .trix-button-group .trix-button:hover {
  background-color: var(--theme-accent-hover) !important;
}

/*
 * Trix attachment gallery overrides — accommodates the
 * <action-text-attachment> wrapper element.
 */
.trix-content .attachment-gallery > action-text-attachment,
.trix-content .attachment-gallery > .attachment {
  flex: 1 0 33%;
  padding: 0 0.5em;
  max-width: 33%;
}

.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
.trix-content .attachment-gallery.attachment-gallery--2 > .attachment,
.trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
.trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
  flex-basis: 50%;
  max-width: 50%;
}

.trix-content action-text-attachment .attachment {
  padding: 0 !important;
  max-width: 100% !important;
}

/*
 * Inline content attachments (@mentions) inside the Trix editor. Trix wraps
 * them in <figure class="attachment attachment--content">; render the figure
 * inline with the surrounding text instead of as a block. Trix also injects
 * an empty block-level <figcaption> (which would wrap the rest of the line)
 * and, on selection, a floating remove button designed for file/image cards —
 * both are hidden since backspace already removes the whole mention.
 */
trix-editor .attachment--content {
  display: inline;
  margin: 0;
}

trix-editor .attachment--content .attachment__caption,
trix-editor .attachment--content .trix-button--remove {
  display: none;
}

/*
 * Non-image rich-text attachments (PDFs, docs, archives) render as a file card:
 * file-type icon, filename, size, and a trailing download glyph. Replaces the raw
 * Trix/ActionText default box. Scoped to .attachment--file so image attachments
 * (.attachment--preview) keep their thumbnail treatment. Shared by comments and
 * task rich-text descriptions via app/views/active_storage/blobs/_blob.html.erb.
 */
.attachment--file {
  display: inline-block;
  max-width: min(100%, 24rem);
}

.attachment--file .attachment__caption {
  margin: 0;
  text-align: left;
}

.attachment--file .attachment__link {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background-color 0.15s;
}

.attachment--file .attachment__link:hover {
  border-color: var(--color-accent);
  background: var(--color-surface-hover);
}

/*
 * File-type glyph. Drawn with a CSS mask rather than an inline <svg>/IconComponent
 * because ActionText sanitizes rendered attachment HTML and strips <svg>; a masked
 * <span> survives and stays themeable (tinted with the accent color, dark-mode aware).
 * The icon is keyed off the figure's .attachment--<extension> modifier — generic
 * document by default, with overrides for common office/archive types.
 */
.attachment--file .attachment__icon {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  background-color: var(--color-accent);
  -webkit-mask: url("/assets/icons/regular/file-7648d60c.svg") no-repeat center / contain;
  mask: url("/assets/icons/regular/file-7648d60c.svg") no-repeat center / contain;
}

.attachment--doc .attachment__icon,
.attachment--docx .attachment__icon {
  -webkit-mask-image: url("/assets/icons/regular/file-word-645a622a.svg");
  mask-image: url("/assets/icons/regular/file-word-645a622a.svg");
}

.attachment--xls .attachment__icon,
.attachment--xlsx .attachment__icon {
  -webkit-mask-image: url("/assets/icons/regular/file-excel-4baeb8e5.svg");
  mask-image: url("/assets/icons/regular/file-excel-4baeb8e5.svg");
}

.attachment--csv .attachment__icon {
  -webkit-mask-image: url("/assets/icons/regular/file-csv-d7e77825.svg");
  mask-image: url("/assets/icons/regular/file-csv-d7e77825.svg");
}

.attachment--ppt .attachment__icon,
.attachment--pptx .attachment__icon {
  -webkit-mask-image: url("/assets/icons/regular/file-powerpoint-38d12661.svg");
  mask-image: url("/assets/icons/regular/file-powerpoint-38d12661.svg");
}

.attachment--zip .attachment__icon,
.attachment--gz .attachment__icon,
.attachment--rar .attachment__icon {
  -webkit-mask-image: url("/assets/icons/regular/file-zip-09c5c6cc.svg");
  mask-image: url("/assets/icons/regular/file-zip-09c5c6cc.svg");
}

.attachment--file .attachment__details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attachment--file .attachment__name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment--file .attachment__size {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Image/preview attachments: the picture stays inside the comment, then the caption. */
.attachment--preview img {
  display: block;
  max-width: min(100%, 24rem);
  height: auto;
  border-radius: var(--radius-lg);
}

.attachment--preview .attachment__caption {
  margin-top: calc(var(--spacing) * 2);
}


/* ═══ Relocated global classes ═══ */

/*
 * .audit-highlight — bold emphasis for changed values in audit log entries.
 * Applied via raw HTML in Auditable concern and read by Audits::NameComponent.
 *
 * Heading ink, not a fixed palette gray: this is the emphasized half of a
 * sentence, so it has to stay the darker of the two in light and the lighter of
 * the two in dark. The static --color-gray-700 it used to carry landed at
 * 1.72:1 against the change-log drawer's dark surface.
 */
.audit-highlight {
  font-weight: 700;
  color: var(--color-text-heading);
}

/*
 * .mention — styled @mention tags in Trix rich-text content (comments).
 */
.mention {
  color: var(--color-accent);
  font-weight: 500;
}

/*
 * .date-range-input — removes default left padding/margin from the
 * native date picker indicator in webkit browsers.
 * Callers: audiences/forms/date_input_component.
 */
.date-range-input {
  flex: 1;
}

.date-range-input::-webkit-calendar-picker-indicator {
  padding-left: 0;
  margin-left: 0;
}

/*
 * .back-and-forth — horizontal oscillation animation for the auto-input
 * component's "car driving" loading indicator.
 * Callers: audiences/forms/auto_input_component.
 */
.back-and-forth {
  position: absolute;
  animation: back-and-forth 2s linear infinite;
  transition: all;
}

@keyframes back-and-forth {
  0%  { left: 0; transform: scaleX(100%); }
  49% { left: 6.25rem; transform: scaleX(100%); }
  50% { left: 6.25rem; transform: scaleX(-100%); }
  100% { left: 0; transform: scaleX(-100%); }
}

/* ─── TooltipController ─���─ */

/*
 * .component-tooltip-container
 * Positioning context for tooltip elements. Applied to the
 * controller's root element by tooltip_controller.js.
 *
 * Used by: app/javascript/controllers/tooltip_controller.js
 */
.component-tooltip-container {
  position: relative;
}

/*
 * .component-tooltip
 * Floating tooltip element created dynamically by the tooltip
 * controller. Positioned absolute to the right of its container.
 *
 * Used by: app/javascript/controllers/tooltip_controller.js
 */
.component-tooltip {
  position: absolute;
  white-space: nowrap;
  transform-origin: top right;
  right: 0;
  font-size: var(--font-size-xs);
  background-color: var(--color-surface-elevated);
  padding: calc(var(--spacing) * 2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-themed);
  transition: all 200ms ease-in-out;
}

/*
 * .sortable-fallback — disables transitions on SortableJS fallback
 * clone elements to prevent visual glitches during drag operations.
 * Applied automatically by the SortableJS library.
 */
.sortable-fallback {
  transition: none !important;
}

/* ─── Team assignments grid ─── */

/**
 * .component-team-grid-input
 * Inline edit input for team assignment grid cells. Created by JS
 * when a grid cell enters edit mode.
 *
 * Where used (JS createElement):
 *   - app/javascript/controllers/team_assignments_grid_controller.js
 *
 * When to reuse: Inline-edit inputs inside data grid cells.
 * When NOT to: Standard form fields — use Forms::FieldComponent.
 */
.component-team-grid-input {
  font-weight: 600;
  color: var(--color-text-heading);
  background: var(--color-surface-input);
  border: 0.0625rem solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding-block: 0;
  padding-inline: calc(var(--spacing) * 1);
  margin-block: -0.0625rem;
  width: 100%;
  min-width: 0;
  font-size: max(var(--font-size-sm), var(--field-font-floor));
  line-height: 1.25;
  text-align: center;
}

/* ─── Format columns ─── */

/**
 * .component-format-columns-missing
 * Warning color for missing/unmapped format columns.
 *
 * Where used (JS className):
 *   - app/javascript/controllers/format_columns_controller.js
 *
 * When to reuse: Highlighting missing or invalid field mappings.
 */
.component-format-columns-missing {
  color: var(--color-status-text-orange);
}

/* ─── Autocomplete selected display ─── */

/**
 * .component-autocomplete-selected
 * Container for a selected user in the user autocomplete fallback display.
 * Used when no template target exists for the selection.
 *
 * Where used (JS template literal):
 *   - app/javascript/controllers/forms/user_autocomplete_controller.js
 */
.component-autocomplete-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 4);
  background: var(--color-surface-input);
  border: 0.0625rem solid var(--color-border-strong);
  border-radius: var(--radius-lg);
}

.component-autocomplete-selected-name {
  font-size: var(--font-size-xs);
  color: var(--color-text-input);
}

.component-autocomplete-selected-remove {
  margin-inline-start: calc(var(--spacing) * 4);
  color: var(--color-text-muted);
  cursor: pointer;
}
.component-autocomplete-selected-remove:hover {
  color: var(--color-accent);
}

/**
 * .component-account-autocomplete-selected
 * Container for a selected account in the account autocomplete display.
 *
 * Where used (JS template literal):
 *   - app/javascript/controllers/forms/account_autocomplete_controller.js
 */
.component-account-autocomplete-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 4);
  background: var(--color-surface-elevated);
  border-radius: var(--radius-xs);
}

.component-account-autocomplete-selected-name {
  color: var(--color-text-body);
}

.component-account-autocomplete-remove {
  color: var(--color-text-muted);
  cursor: pointer;
}
.component-account-autocomplete-remove:hover {
  color: var(--color-accent);
}

/* ─── File upload list ─── */

/**
 * .component-file-upload-item
 * Row for a file in the file upload preview list, created by JS.
 *
 * Where used (JS template literal):
 *   - app/javascript/controllers/file_upload_controller.js
 */
.component-file-upload-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 4);
  background: var(--color-surface-primary);
  border: 0.0625rem solid var(--color-border-themed);
  border-radius: var(--radius-xs);
  margin-bottom: calc(var(--spacing) * 2);
}

.component-file-upload-item-info {
  flex: 1;
  min-width: 0;
}

.component-file-upload-item-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.component-file-upload-item-name {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-file-upload-item-size {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-file-upload-item-remove {
  color: var(--color-text-danger);
}
.component-file-upload-item-remove:hover {
  color: var(--color-text-danger-hover);
}

/* ─── Wizard check icon ─── */

/**
 * .wizard-check-icon
 * Size for the completed-step checkmark SVG in the wizard indicator.
 *
 * Where used (JS innerHTML):
 *   - app/javascript/controllers/wizard_controller.js
 */
.wizard-check-icon {
  width: 0.75rem;
  height: 0.75rem;
}

/* ─── MenuComponent ─── */

/*
 * .component-menu
 * Positioning context for the overflow menu's floating item list so the
 * absolutely-positioned menu pins directly below its trigger button.
 *
 * Used by: app/components/menu_component.html.erb
 * Reuse when: another trigger-plus-dropdown pattern needs a positioning context.
 * Do NOT use for: modal dialogs or tooltips.
 */
.component-menu {
  position: relative;
}

/*
 * .component-menu-items
 * The floating item list pinned under its trigger. Elevated surface with a
 * themed border and shadow; min-width ensures labels fit on one line.
 *
 * Anchored to the trigger's left edge so it opens rightward. The trigger is
 * the leftmost button in its action group, so a leftward (right: 0) open would
 * run off the left edge of the viewport on narrow screens.
 *
 * Used by: app/components/menu_component.html.erb
 * Reuse when: other dropdowns need the same elevated menu look.
 * Do NOT use for: modal content.
 */
.component-menu-items {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  margin-top: calc(var(--spacing) * 1);
  min-width: 11.25rem;
  padding: calc(var(--spacing) * 1) 0;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 50;
}

/*
 * .component-menu-item
 * A single link or button inside the overflow dropdown. Full-bleed
 * row (no per-item radius) — the surrounding container owns the
 * corner radius and clips the row's hover background.
 *
 * Used by: app/components/menu_component.html.erb
 */
.component-menu-item {
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  font-size: var(--font-size-sm);
  text-align: left;
  color: var(--color-text-body);
  transition: background var(--motion-fast), color var(--motion-fast);
}

.component-menu-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

.component-menu-item-destructive {
  color: var(--color-text-danger);
}

.component-menu-item-destructive:hover {
  color: var(--color-text-danger-hover);
}

/*
 * .component-menu-item-disabled / -label / -hint
 * An item for an action that exists but can't be taken right now, with a
 * muted hint under its label saying why. Rendered for an item passed as
 * `{ disabled: true, hint: '...' }`.
 *
 * Used by: app/components/menu_component.html.erb
 */
.component-menu-item-disabled,
.component-menu-item-disabled:hover {
  background: none;
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.component-menu-item-label {
  display: flex;
  flex-direction: column;
}

.component-menu-item-hint {
  font-size: var(--font-size-xs);
}

/*
 * .component-menu-divider
 * Hairline between groups of items, set off from the destructive action that
 * closes a menu. Rendered for an item passed as `{ divider: true }`.
 *
 * Used by: app/components/menu_component.html.erb
 * Reuse when: a MenuComponent needs to separate groups of items.
 * Do NOT use for: row menus (use .component-row-menu-divider).
 */
.component-menu-divider {
  height: 0.0625rem;
  margin: calc(var(--spacing) * 1) 0;
  background: var(--color-border-subtle);
}

/* ─── Filter chip / popover ─────────────────────────────────────── */

/*
 * .component-filter-chip-wrapper
 * Inline-block positioning context for a filter chip plus its anchored
 * popover. Position relative so the popover can be absolutely positioned
 * below the trigger button.
 *
 * Used by: app/components/filter_chip_component.html.erb
 * Reuse when: building any pill-style filter trigger with a dropdown panel.
 * Do NOT use for: standalone buttons (just use .component-button).
 */
.component-filter-chip-wrapper {
  position: relative;
  display: inline-block;
}

/*
 * .component-filter-chip
 * The chip button itself — pill-shaped, hairline border, hover/active
 * states driven by .is-active and the inactive/active modifier classes.
 *
 * Used by: app/components/filter_chip_component.html.erb
 * Reuse when: rendering a single tap-to-open filter pill in a toolbar.
 * Do NOT use for: badge displays or status chips (use .component-badge).
 */
.component-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: 0 calc(var(--spacing) * 3);
  height: calc(var(--spacing) * 8);
  border-radius: var(--radius-pill);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  color: var(--color-text-body);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}

.component-filter-chip:hover {
  background: var(--color-surface-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-filter-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-filter-chip-active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent-border);
  color: var(--color-accent);
}

/*
 * .component-filter-chip-icon
 * Leading icon inside a filter chip; sized to match the chip's text.
 *
 * Used by: app/components/filter_chip_component.html.erb
 */
.component-filter-chip-icon {
  width: var(--font-size-xs);
  height: var(--font-size-xs);
}

/*
 * .component-filter-chip-caret
 * Trailing chevron-down icon. Smaller than the leading icon to recede.
 *
 * Used by: app/components/filter_chip_component.html.erb
 */
.component-filter-chip-caret {
  width: var(--font-size-2xs);
  height: var(--font-size-2xs);
  color: var(--color-text-muted);
}

/*
 * .component-filter-chip-label
 * The static label portion (e.g. "Status"). Muted relative to the value.
 *
 * Used by: app/components/filter_chip_component.html.erb
 */
.component-filter-chip-label {
  color: inherit;
}

/*
 * .component-filter-chip-value
 * The currently-selected value portion (e.g. "2 selected"). Inherits the
 * chip's active foreground when the chip is active.
 *
 * Used by: app/components/filter_chip_component.html.erb
 */
.component-filter-chip-value {
  font-weight: 600;
}

/*
 * .component-filter-chip-dot
 * A small color swatch shown between label and value (e.g. for a folder
 * color or tag color). The dot color is passed via --chip-dot.
 *
 * Used by: app/components/filter_chip_component.html.erb
 */
.component-filter-chip-dot {
  display: inline-block;
  width: calc(var(--spacing) * 2);
  height: calc(var(--spacing) * 2);
  border-radius: var(--radius-pill);
  background: var(--chip-dot, var(--color-text-muted));
}

/*
 * .component-filter-chip-popover
 * The floating popover panel anchored below a filter chip. White surface,
 * hairline border, soft shadow. Scrolls when content overflows.
 *
 * Used by: app/components/filter_chip_component.html.erb
 * Reuse when: a chip-driven dropdown needs a contained scrollable panel.
 */
.component-filter-chip-popover {
  position: absolute;
  top: calc(100% + calc(var(--spacing) * 1.5));
  left: 0;
  min-width: 14rem;
  max-height: 26rem;
  overflow-y: auto;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elev);
  padding: calc(var(--spacing) * 1.5);
  z-index: 50;
}

/* ─── Multi-select filter popover contents ─────────────────────── */

/*
 * .component-multi-select-filter
 * Vertical layout root for a multi-select filter (optional search + scroll
 * list of options). Lives inside .component-filter-chip-popover.
 *
 * Used by: app/components/multi_select_filter_component.html.erb
 */
.component-multi-select-filter {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1.5);
}

/*
 * .component-multi-select-search
 * Search input shown above the option list when searchable: true.
 *
 * Used by: app/components/multi_select_filter_component.html.erb
 */
.component-multi-select-search {
  width: 100%;
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 2.5);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-sm);
  font-size: max(var(--font-size-xs), var(--field-font-floor));
  color: var(--color-text-heading);
  outline: none;
}

/*
 * .component-multi-select-options
 * The scrollable list area below the search input.
 *
 * Used by: app/components/multi_select_filter_component.html.erb
 */
.component-multi-select-options {
  display: flex;
  flex-direction: column;
  gap: var(--spacing);
}

/*
 * .component-multi-select-option
 * A single row inside the options list. Checkbox-driven; click anywhere
 * on the row to toggle.
 *
 * Used by: app/components/multi_select_filter_component.html.erb,
 *         app/components/audiences/toolbar_component.html.erb
 */
.component-multi-select-option {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 2);
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
  text-align: left;
}

.component-multi-select-option:hover {
  background: var(--color-surface-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-multi-select-option:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/*
 * .component-multi-select-checkbox — the option's checkbox, drawn to match the
 * row-selection checkbox (RowCheckboxComponent): a rounded box that fills with
 * the accent and shows a white check when checked. Unlike the row checkbox it
 * stays fully visible (no hover-reveal), since the options list is always open.
 *
 * Used by: app/components/multi_select_filter_component.html.erb
 */
.component-multi-select-checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: calc(var(--spacing) * 4.5);
  height: calc(var(--spacing) * 4.5);
  margin: 0;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border-strong);
  background: var(--color-surface-primary);
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}

.component-multi-select-checkbox:checked {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.7rem 0.7rem;
}

/*
 * .component-multi-select-dot
 * Color swatch shown before a multi-select option's label (e.g. tag color
 * or status color). Color is passed via --option-dot.
 *
 * Used by: app/components/multi_select_filter_component.html.erb
 */
.component-multi-select-dot {
  display: inline-block;
  width: calc(var(--spacing) * 2);
  height: calc(var(--spacing) * 2);
  border-radius: var(--radius-pill);
  background: var(--option-dot, var(--color-text-muted));
  flex-shrink: 0;
}

/*
 * .component-multi-select-label
 * The label text inside a multi-select option. Stretches to push the count
 * to the right edge of the row.
 *
 * Used by: app/components/multi_select_filter_component.html.erb
 */
.component-multi-select-label {
  flex: 1;
  min-width: 0;
}

/*
 * .component-multi-select-count
 * Trailing per-option count (e.g. how many audiences carry this tag).
 *
 * Used by: app/components/multi_select_filter_component.html.erb
 */
.component-multi-select-count {
  font-size: var(--font-size-2xs);
  color: var(--color-text-muted);
}

/* ─── Tag pill ────────────────────────────────────────────────── */

/*
 * .component-tag-pill
 * Small inline pill that displays a tag's color swatch and name. The
 * background derives from --tag-color via color-mix to keep contrast
 * consistent across light and dark themes.
 *
 * Used by: app/components/tag_pill_component.html.erb,
 *         app/components/audiences/list_row_component.html.erb
 */
.component-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing);
  padding: 0 calc(var(--spacing) * 2);
  height: calc(var(--spacing) * 5);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--tag-color, var(--color-text-muted)) 12%, transparent);
  color: var(--tag-color, var(--color-text-body));
  font-size: var(--font-size-2xs);
  font-weight: 500;
}

/*
 * .component-tag-pill-dot
 * Color swatch inside the tag pill, picked up from --tag-color.
 *
 * Used by: app/components/tag_pill_component.html.erb
 */
.component-tag-pill-dot {
  width: calc(var(--spacing) * 1.5);
  height: calc(var(--spacing) * 1.5);
  border-radius: var(--radius-pill);
  background: var(--tag-color, var(--color-text-muted));
}

.component-tag-pill-label {
  color: inherit;
}

.component-tag-pill-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
}

/* ─── Brand pill ──────────────────────────────────────────────── */

/*
 * .component-brand-pill
 * Square pill that frames a brand logo (Meta, Google, LinkedIn, TikTok).
 * The background and size are driven by component variants.
 *
 * Used by: app/components/brand_pill_component.html.erb,
 *         row/card components across the audiences index.
 */
.component-brand-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--brand-bg, var(--color-surface-elevated));
  border: 1px solid var(--color-border-subtle);
}

.component-brand-pill-xs {
  width: calc(var(--spacing) * 4);
  height: calc(var(--spacing) * 4);
}

.component-brand-pill-sm {
  width: calc(var(--spacing) * 5);
  height: calc(var(--spacing) * 5);
}

/*
 * .component-brand-pill-icon
 * Inline brand SVG inside the pill — sized relative to its parent pill.
 *
 * Used by: app/components/brand_pill_component.html.erb
 */
.component-brand-pill-icon {
  width: 70%;
  height: 70%;
}

/* ─── Row selection checkbox ───────────────────────────────────── */

/*
 * .component-row-checkbox — label wrapper holding the hidden native input
 *   plus the styled box. Default opacity is reduced so the checkbox is
 *   subdued until the row is hovered or the box is checked.
 * .component-row-checkbox-input — visually-hidden native input (still
 *   focusable for keyboard access; sized 0 so it doesn't take layout space).
 * .component-row-checkbox-box — visible square; turns into a filled accent
 *   when the input is checked via :has() on the parent label, and carries the
 *   focus ring on the input's behalf since the input itself is invisible.
 *   An indeterminate input (a partial select-all) fills the same accent and
 *   draws a dash instead of the check.
 * .component-row-checkbox-icon — white check icon shown only when checked.
 *
 * Used by: app/components/row_checkbox_component.html.erb
 * Reuse when: rendering a row-level multi-selection checkbox in any list
 * UI (audiences index, vault index, etc.).
 */
.component-row-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  /* Shift-click extends a selection range, and without this the browser would
     also drag-select the row text under the cursor. */
  user-select: none;
}

.component-row-checkbox-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.component-row-checkbox-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: calc(var(--spacing) * 4.5);
  height: calc(var(--spacing) * 4.5);
  border-radius: var(--radius-sm);
  background: var(--color-surface-primary);
  border: 1.5px solid var(--color-border-themed);
  transition: background var(--motion-fast), border-color var(--motion-fast);
}

.component-audiences-list-row:hover .component-row-checkbox-box,
.component-vault-list-row:hover .component-row-checkbox-box {
  border-color: var(--color-border-strong);
}

.component-row-checkbox:has(.component-row-checkbox-input:checked) .component-row-checkbox-box,
.component-row-checkbox:has(.component-row-checkbox-input:indeterminate) .component-row-checkbox-box {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* The native input is opacity: 0, so keyboard focus would otherwise be
   invisible. Paint the shared ring on the visible box instead. */
.component-row-checkbox:has(.component-row-checkbox-input:focus-visible) .component-row-checkbox-box {
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.component-row-checkbox-icon {
  width: calc(var(--spacing) * 3);
  height: calc(var(--spacing) * 3);
  color: var(--color-white);
  opacity: 0;
}

.component-row-checkbox:has(.component-row-checkbox-input:checked) .component-row-checkbox-icon {
  opacity: 1;
}

/* Partial selection: a dash rather than a check. 0.125rem is a hairline mark,
   not a rhythm value, so it sits outside the spacing scale. */
.component-row-checkbox:has(.component-row-checkbox-input:indeterminate) .component-row-checkbox-box::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: calc(var(--spacing) * 2);
  height: 0.125rem;
  border-radius: var(--radius-pill);
  background: var(--color-white);
}

/* ─── Row overflow menu (⋯) ───────────────────────────────────────── */

/*
 * .component-row-menu — wrapper anchoring the kebab trigger + dropdown for a
 *   single list row's overflow actions.
 * .component-row-menu-trigger / -trigger-icon — the kebab button + its icon.
 * .component-row-menu-popover — the dropdown panel (anchored below-right).
 * .component-row-menu-item / -item-icon — one action (link or button_to button);
 *   the is-destructive modifier paints it red.
 * .component-row-menu-form — the button_to wrapper form around a destructive action.
 * .component-row-menu-divider — hairline between action groups.
 *
 * Used by: app/components/row_menu_component.html.erb (audiences + vault rows)
 */
.component-row-menu {
  position: relative;
  display: inline-flex;
}

.component-row-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 8);
  height: calc(var(--spacing) * 8);
  border-radius: var(--radius-lg);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition-timing-standard), color var(--transition-timing-standard);
}

.component-row-menu-trigger:hover {
  background: var(--color-surface-elevated);
  color: var(--color-text-heading);
}

.component-row-menu-trigger-icon {
  width: var(--font-size-base);
  height: var(--font-size-base);
}

.component-row-menu-popover {
  position: absolute;
  top: calc(100% + calc(var(--spacing) * 1.5));
  right: 0;
  z-index: 40;
  min-width: 13rem;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elev);
  padding: calc(var(--spacing) * 1.5);
}

.component-row-menu-item {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2.5);
  width: 100%;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 2.5);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
  text-align: left;
  text-decoration: none;
}

.component-row-menu-item:hover {
  background: var(--color-surface-hover);
}

.component-row-menu-item.is-destructive {
  color: var(--color-text-danger);
}

.component-row-menu-item-icon {
  width: var(--font-size-sm);
  height: var(--font-size-sm);
  flex-shrink: 0;
}

.component-row-menu-form {
  display: block;
  width: 100%;
}

.component-row-menu-divider {
  height: 0.0625rem;
  margin: calc(var(--spacing) * 1.5) calc(var(--spacing) * 2);
  background: var(--color-border-subtle);
}

/* Bottom-sheet entrance (mobile row-menu). One-shot on show; the global
   prefers-reduced-motion reset collapses the duration. */
@keyframes component-sheet-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes component-sheet-rise {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* On desktop the panel is transparent (items behave as direct children of the
   dropdown) and the scrim is hidden; below 64rem the whole popover becomes a
   bottom sheet — the scrim dims the page and closes the sheet on tap. */
.component-row-menu-scrim {
  display: none;
}

.component-row-menu-panel {
  display: contents;
}

.component-row-menu-handle {
  display: none;
}

@media (max-width: 63.9375rem) {
  .component-row-menu-popover {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  /* The popover controller only toggles `.hidden` (display), which can't be
     transitioned — so the sheet plays a one-shot entrance animation each time
     it's shown, matching the slide-up of the filter/sort sheets. */
  .component-row-menu-scrim {
    display: block;
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--color-black) 42%, transparent);
    animation: component-sheet-fade-in var(--motion-base);
  }

  .component-row-menu-panel {
    display: block;
    position: relative;
    z-index: 1;
    max-height: 80vh;
    overflow-y: auto;
    padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3) calc(calc(var(--spacing) * 3) + env(safe-area-inset-bottom));
    background: var(--color-surface-primary);
    border-top-left-radius: var(--radius-2xl);
    border-top-right-radius: var(--radius-2xl);
    box-shadow: var(--shadow-elev);
    animation: component-sheet-rise var(--motion-base);
    transition: transform var(--motion-base);
  }

  .component-row-menu-handle {
    display: flex;
    justify-content: center;
    padding: calc(var(--spacing) * 1) 0 calc(var(--spacing) * 2.5);
    cursor: pointer;
  }

  .component-row-menu-handle span {
    width: 2.375rem;
    height: 0.3125rem;
    border-radius: var(--radius-pill);
    background: var(--color-border-strong);
  }

  /* Swipe-down exit. popover#close only flips `.hidden`, so the dismissing
     state plays the reverse of the entrance — panel slides out from wherever
     the drag released, scrim fades — before the controller hides it. */
  .component-row-menu-popover-dismissing {
    pointer-events: none;
  }

  .component-row-menu-popover-dismissing .component-row-menu-scrim {
    opacity: 0;
    transition: opacity var(--motion-base);
  }

  .component-row-menu-popover-dismissing .component-row-menu-panel {
    transform: translateY(100%);
  }

  .component-row-menu-item {
    gap: calc(var(--spacing) * 3.5);
    padding: calc(var(--spacing) * 3.5) calc(var(--spacing) * 3);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
  }

  .component-row-menu-item-icon {
    width: var(--font-size-base);
    height: var(--font-size-base);
  }

  .component-row-menu-divider {
    margin-left: calc(var(--spacing) * 3);
    margin-right: calc(var(--spacing) * 3);
  }
}

/* ─── Color picker (folder/tag color swatches) ────────────────── */

/*
 * .component-color-picker — horizontal cluster of round color swatches
 *   used as a single-selection radio group. Used inside the inline folder/tag
 *   create forms and on the folder/tag admin pages.
 * .component-color-picker-swatch — clickable label wrapping the hidden radio
 *   input and the visible dot.
 * .component-color-picker-input — visually hidden native radio (focus-only).
 * .component-color-picker-dot — the visible color disc. Picks up its color
 *   from --swatch-color set on the label; the checked variant gets a ring.
 *
 * Used by: app/components/color_picker_component.html.erb
 * Reuse when: any UI needs to pick a color from a small fixed palette.
 */
.component-color-picker {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
}

.component-color-picker-swatch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.component-color-picker-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.component-color-picker-dot {
  display: inline-block;
  width: calc(var(--spacing) * 5);
  height: calc(var(--spacing) * 5);
  border-radius: var(--radius-pill);
  background: var(--swatch-color, var(--color-text-muted));
  border: 1.5px solid transparent;
  transition: transform var(--motion-fast), border-color var(--motion-fast);
}

.component-color-picker-swatch:hover .component-color-picker-dot {
  transform: scale(1.1);
}

.component-color-picker-swatch:has(.component-color-picker-input:checked) .component-color-picker-dot {
  border-color: var(--color-surface-primary);
  box-shadow: 0 0 0 0.125rem var(--swatch-color, var(--color-text-muted));
}

/* ─── Inline create form (footer of filter popovers) ─────────── */

/*
 * .component-inline-create — wrapper holding the toggle button and the
 *   collapsed form. The form is initially hidden; the toggle reveals it
 *   via Stimulus. On successful submit (turbo:submit-end), the form
 *   collapses back and the toggle re-shows.
 * .component-inline-create-toggle — "+ New folder…" text button.
 * .component-inline-create-form — the inline form row (name + colors + ok/cancel).
 * .component-inline-create-name — text input for the name.
 * .component-inline-create-submit / -cancel — round icon buttons.
 *
 * Used by: app/components/audiences/inline_create_form_component.html.erb
 */
.component-inline-create {
  border-top: 1px solid var(--color-border-subtle);
  margin-top: calc(var(--spacing) * 1.5);
  padding-top: calc(var(--spacing) * 1.5);
}

.component-inline-create-toggle {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  width: 100%;
  padding: calc(var(--spacing) * 1.75) calc(var(--spacing) * 2.5);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: left;
}

.component-inline-create-toggle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

.component-inline-create-form {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  padding: calc(var(--spacing) * 1.5);
  background: var(--color-surface-elevated);
  border-radius: var(--radius-md);
}

.component-inline-create-name {
  flex: 1;
  min-width: 0;
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--color-text-heading);
  outline: none;
}

.component-inline-create-submit,
.component-inline-create-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
}

.component-inline-create-submit {
  background: var(--color-accent);
  color: var(--color-white);
}

.component-inline-create-cancel {
  background: transparent;
  color: var(--color-text-muted);
}

.component-inline-create-cancel:hover {
  background: var(--color-surface-hover);
}

/* ─── Organizer admin (Folders & Tags index pages) ─────────────── */

/*
 * .component-organizer-admin-list — vertical stack of admin rows on
 *   /folders and /tags pages.
 * .component-organizer-admin-row — single row, wraps in a turbo_frame_tag
 *   so edit-in-place can swap it.
 * .component-organizer-admin-row-display — display state contents.
 * .component-organizer-admin-row-swatch — small color dot reflecting the
 *   folder/tag color (picked up from --swatch-color).
 * .component-organizer-admin-row-name — bold name.
 * .component-organizer-admin-row-count — muted use count.
 * .component-organizer-admin-row-action — icon button (edit/delete) at end.
 * .component-organizer-admin-row-form — wrapper for the destroy button_to form so it sits inline.
 * .component-organizer-admin-create — header form (create new folder/tag).
 * .component-organizer-admin-create-name — text input.
 * .component-organizer-admin-edit — inline edit row layout (replaces display state).
 *
 * Used by: app/views/folders/index.html.erb, app/views/tags/index.html.erb,
 *         app/components/audiences/folder_admin_row_component.html.erb,
 *         app/components/audiences/tag_admin_row_component.html.erb
 */
.component-organizer-admin-list {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 1.5);
}

.component-organizer-admin-row {
  display: block;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
}

.component-organizer-admin-row-display {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
}

.component-organizer-admin-row-swatch {
  display: inline-block;
  width: calc(var(--spacing) * 3);
  height: calc(var(--spacing) * 3);
  border-radius: var(--radius-pill);
  background: var(--swatch-color, var(--color-text-muted));
  flex-shrink: 0;
}

.component-organizer-admin-row-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-organizer-admin-row-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-organizer-admin-row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 7);
  height: calc(var(--spacing) * 7);
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
}

.component-organizer-admin-row-action:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-heading);
}

.component-organizer-admin-row-form {
  display: inline-flex;
  margin: 0;
}

.component-organizer-admin-create {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 4);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
}

.component-organizer-admin-create-name {
  flex: 1;
  min-width: 0;
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-heading);
}

.component-organizer-admin-edit {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
}

/*
 * .component-folder-admin-row-restricted — lock + "Restricted" note on a
 *   folder admin row whose folder has permission grants.
 * .component-folder-permissions — the inline permissions panel that replaces a
 *   folder admin row (Audiences::FolderPermissionsFormComponent). The people
 *   list only shows while "Specific people" is picked.
 *
 * Used by: app/components/audiences/folder_admin_row_component.html.erb,
 *         app/components/audiences/folder_permissions_form_component.html.erb
 */
.component-folder-admin-row-restricted {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1);
}

.component-folder-permissions {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 4);
}

.component-folder-permissions-access {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 3);
  margin: 0;
  padding: 0;
  border: none;
}

.component-folder-permissions-choice {
  display: flex;
  flex: 1 1 calc(var(--spacing) * 60);
  align-items: flex-start;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 3);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.component-folder-permissions-choice:has(input:checked) {
  border-color: var(--color-accent);
}

.component-folder-permissions-choice input {
  margin-top: calc(var(--spacing) * 0.5);
  accent-color: var(--color-accent);
}

.component-folder-permissions-choice-text {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 0.5);
}

.component-folder-permissions-choice-title {
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-folder-permissions-choice-hint,
.component-folder-permissions-person-email,
.component-folder-permissions-person-fixed {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-folder-permissions-people {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.component-folder-permissions:has(input[value='everyone']:checked) .component-folder-permissions-people {
  display: none;
}

.component-folder-permissions-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 2) 0;
  border-top: 1px solid var(--color-border-themed);
}

.component-folder-permissions-person-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--color-text-heading);
  overflow-wrap: anywhere;
}

.component-folder-permissions-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: calc(var(--spacing) * 3);
}

.component-folder-permissions-cancel {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ─── Module upsell surface (shared) ─── */

/*
 * Module-upsell surface shown when an account lacks a paid module's feature.
 * Used by:
 *   - Ad Services (/services) — ClientDashboard::ServicesUpsellComponent
 *   - Email Campaigns (/email-campaigns) — EmailCampaigns::CampaignsUpsellComponent
 * Implements the approved Claude Design mock: a hero + locked workspace
 * preview, a dense capability panel and/or campaign-type cards, a dark photo
 * band carrying a connector-line stepper, and a closing CTA. Built on app
 * theme tokens (adapts to light/dark). The module identity color is applied as
 * accent only — primary CTAs stay VIA blue — via the --upsell-accent-* locals.
 * The base sets the Ad Services orange; the -email modifier swaps in the Email
 * Campaigns pink. soft / soft-border and the glow gradients are all derived
 * from --upsell-accent, so a module only sets the accent + its strong (text)
 * variant.
 *
 * Reuse when: gating a new paid module behind a marketing upsell — add a
 *   `.component-upsell-<module>` accent modifier alongside `.component-upsell`.
 * Do NOT use for: in-page empty states (use EmptyStateComponent).
 */
.component-upsell {
  --upsell-accent: var(--color-upsell-ads);
  --upsell-accent-strong: var(--color-upsell-ads-strong);
  --upsell-accent-soft: color-mix(in srgb, var(--upsell-accent) 10%, transparent);
  --upsell-accent-soft-border: color-mix(in srgb, var(--upsell-accent) 22%, transparent);
  padding-block: clamp(1.5rem, 3vw, 2.5rem) clamp(2rem, 4vw, 3.5rem);
}

[data-theme="dark"] .component-upsell {
  --upsell-accent-strong: var(--color-upsell-ads-strong-dark);
  --upsell-accent-soft: color-mix(in srgb, var(--upsell-accent) 14%, transparent);
  --upsell-accent-soft-border: color-mix(in srgb, var(--upsell-accent) 30%, transparent);
}

/* Email Campaigns identity — pink accent (pairs with .component-upsell). */
.component-upsell-email {
  --upsell-accent: var(--color-upsell-email);
  --upsell-accent-strong: var(--color-upsell-email-strong);
}

[data-theme="dark"] .component-upsell-email {
  --upsell-accent-strong: var(--color-upsell-email-strong-dark);
}

/* Header */
.component-upsell-header {
  margin-bottom: calc(var(--spacing) * 8);
}

.component-upsell-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 2) calc(var(--spacing) * 3.5);
}

.component-upsell-header-title {
  margin: 0;
  font-size: clamp(1.875rem, 2.8vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--color-text-heading);
}

.component-upsell-pill {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 3);
  border-radius: var(--radius-pill);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-themed);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.component-upsell-pill-icon {
  width: 0.75rem;
  height: 0.75rem;
}

.component-upsell-header-sub {
  margin: calc(var(--spacing) * 3) 0 0;
  max-width: 58ch;
  font-size: clamp(1.125rem, 1.4vw, 1.375rem);
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--color-text-muted);
}

.component-upsell-body {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 4vw, 3rem);
}

/* Hero card */
.component-upsell-hero {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.component-upsell-hero-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(1.75rem, 3vw, 2.75rem);
}

.component-upsell-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.75);
  margin-bottom: calc(var(--spacing) * 5.5);
  padding: calc(var(--spacing) * 1.25) calc(var(--spacing) * 3.25);
  border-radius: var(--radius-pill);
  background: var(--upsell-accent-soft);
  border: 1px solid var(--upsell-accent-soft-border);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--upsell-accent-strong);
}

.component-upsell-badge-icon {
  width: 0.8125rem;
  height: 0.8125rem;
  color: var(--upsell-accent);
}

.component-upsell-hero-title {
  margin: 0;
  font-size: clamp(1.75rem, 2.6vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--color-text-heading);
  text-wrap: balance;
}

.component-upsell-hero-sub {
  margin: calc(var(--spacing) * 4) 0 0;
  max-width: 46ch;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--color-text-body);
}

/* Hero proof stats — stacked on mobile (long labels can't wrap into thirds),
   a tight divided row once there's room. */
.component-upsell-stats {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing) * 4);
  margin: clamp(1.5rem, 4vw, 1.875rem) 0 clamp(1.75rem, 4vw, 2rem);
}

.component-upsell-stat {
  min-width: 0;
}

.component-upsell-stat-value {
  font-size: 1.875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--color-text-heading);
}

.component-upsell-stat-label {
  margin-top: calc(var(--spacing) * 1.5);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.component-upsell-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  margin-top: auto;
}

.component-upsell-footnote {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  margin: calc(var(--spacing) * 4.5) 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.component-upsell-footnote-icon {
  width: 0.8125rem;
  height: 0.8125rem;
  color: var(--color-text-success);
}

/* Locked workspace preview */
.component-upsell-preview {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--color-border-subtle);
  background: radial-gradient(130% 120% at 85% 0%, color-mix(in srgb, var(--upsell-accent) 16%, transparent), color-mix(in srgb, var(--upsell-accent) 4%, transparent) 55%, transparent 80%);
}

.component-upsell-preview-stage {
  position: relative;
  width: 100%;
  max-width: 23.75rem;
}

.component-upsell-preview-card {
  overflow: hidden;
  filter: blur(0.09375rem);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.component-upsell-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--spacing) * 4.5) calc(var(--spacing) * 5);
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-upsell-preview-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-upsell-preview-meta {
  margin-top: calc(var(--spacing) * 0.5);
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.component-upsell-preview-head-icon {
  width: 1rem;
  height: 1rem;
  color: var(--upsell-accent);
}

.component-upsell-preview-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--spacing) * 0.25);
  background: var(--color-border-subtle);
}

.component-upsell-preview-metric {
  padding: calc(var(--spacing) * 3.5) calc(var(--spacing) * 4.5);
  background: var(--color-surface-primary);
}

.component-upsell-preview-metric-label {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.component-upsell-preview-metric-value {
  margin-top: calc(var(--spacing) * 0.75);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text-heading);
}

.component-upsell-preview-rows {
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 2);
}

.component-upsell-preview-row {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2.75);
  padding: calc(var(--spacing) * 2.75) calc(var(--spacing) * 3);
}

.component-upsell-preview-row + .component-upsell-preview-row {
  border-top: 1px solid var(--color-border-subtle);
}

.component-upsell-preview-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 0.4375rem;
  font-size: 0.6875rem;
  font-weight: 700;
}

.component-upsell-preview-badge-meta {
  background: var(--color-upsell-meta-bg);
  color: var(--color-upsell-meta-fg);
}

.component-upsell-preview-badge-google {
  background: var(--color-upsell-google-bg);
  color: var(--color-upsell-google-fg);
}

/* Accent icon tile variant of the preview badge (e.g. email send rows). */
.component-upsell-preview-badge-icon {
  background: var(--upsell-accent-soft);
}

.component-upsell-preview-badge-icon-svg {
  width: 0.8125rem;
  height: 0.8125rem;
  color: var(--upsell-accent);
}

.component-upsell-preview-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-heading);
}

/* Status pill inside a preview row — base layout; pair with a color variant. */
.component-upsell-preview-row-status {
  flex-shrink: 0;
  padding: calc(var(--spacing) * 0.5) calc(var(--spacing) * 2.25);
  border-radius: var(--radius-md);
  font-size: 0.6875rem;
  font-weight: 500;
}

.component-upsell-preview-row-status-active {
  background: var(--color-upsell-status-active-bg);
  border: 1px solid var(--color-upsell-status-active-border);
  color: var(--color-upsell-status-active-text);
}

.component-upsell-preview-row-status-scheduled {
  background: var(--color-upsell-status-scheduled-bg);
  border: 1px solid var(--color-upsell-status-scheduled-border);
  color: var(--color-upsell-status-scheduled-text);
}

.component-upsell-preview-row-status-sending {
  background: var(--color-upsell-status-sending-bg);
  border: 1px solid var(--color-upsell-status-sending-border);
  color: var(--color-upsell-status-sending-text);
}

/* Right-aligned trailing value in a preview row (ROAS, send count, …). */
.component-upsell-preview-row-value {
  width: 2.875rem;
  text-align: right;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-upsell-preview-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--color-surface-body) 30%, transparent);
}

.component-upsell-preview-lock-pill {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 2.25) calc(var(--spacing) * 4);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-surface-primary) 80%, transparent);
  border: 1px solid var(--color-border-subtle);
  backdrop-filter: blur(0.5rem);
  box-shadow: var(--shadow-md);
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-upsell-preview-lock-icon {
  width: 0.8125rem;
  height: 0.8125rem;
  color: var(--upsell-accent);
}

/* Section headings (capability grids / how it works) */
.component-upsell-section-title {
  margin: 0 0 calc(var(--spacing) * 1.5);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
  color: var(--color-text-heading);
}

.component-upsell-section-sub {
  margin: 0 0 calc(var(--spacing) * 5.5);
  max-width: 64ch;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* Card grids */
.component-upsell-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(var(--spacing) * 4);
}

.component-upsell-tile {
  padding: calc(var(--spacing) * 6.5);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
}

/* Sentence-case category label above a tile (campaign-type cards). */
.component-upsell-tile-eyebrow {
  margin: 0 0 calc(var(--spacing) * 3);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--upsell-accent-strong);
}

.component-upsell-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: calc(var(--spacing) * 4);
  border-radius: var(--radius-lg);
  background: var(--upsell-accent-soft);
  border: 1px solid var(--upsell-accent-soft-border);
}

.component-upsell-tile-icon-svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--upsell-accent);
}

.component-upsell-tile-title {
  margin: 0 0 calc(var(--spacing) * 1.5);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text-heading);
}

.component-upsell-tile-desc {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-body);
}

/* Dense capability panel — a single bordered card whose cells are split by
   hairlines (gap:1px showing the border-subtle backdrop through the grid).
   Lighter and more scannable than a grid of separate tile cards; used for the
   Ad Services "What's included" list. */
.component-upsell-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(var(--spacing) * 0.25);
  overflow: hidden;
  /* Hairline-divided list: --color-border-row stays readable on the deep dark
     surface where -subtle would collapse into the cell background. */
  background: var(--color-border-row);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
}

.component-upsell-panel-cell {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 3.5);
  padding: calc(var(--spacing) * 5.5) calc(var(--spacing) * 6);
  background: var(--color-surface-primary);
}

.component-upsell-panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--upsell-accent-soft);
  border: 1px solid var(--upsell-accent-soft-border);
}

.component-upsell-panel-icon-svg {
  width: 1.0625rem;
  height: 1.0625rem;
  color: var(--upsell-accent);
}

.component-upsell-panel-title {
  margin: 0 0 calc(var(--spacing) * 0.5);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text-heading);
}

.component-upsell-panel-desc {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

/* Dark photo band — the page's one large visual beat. A photograph on the left
   (diagonal scrim blending into the panel) carries smoked-glass stat chips; the
   dark panel on the right narrates the engagement as a connector-line stepper.
   Always dark regardless of theme (a fixed marketing surface), so its surface
   text colors are component-scoped locals rather than themed tokens; the accent
   (number badges, connector) still rides the cascaded --upsell-accent. */
.component-upsell-band {
  --band-bg: var(--color-upsell-band-bg);
  --band-text: var(--color-upsell-band-text);
  --band-text-dim: var(--color-upsell-band-text-dim);
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  background: var(--band-bg);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
}

/* In dark mode the band's near-black surface collapses into the dark page
   background (the shadow can't separate them); a soft top-light edge restores
   the card boundary. Light mode keeps it borderless — dark-on-gray reads fine. */
[data-theme="dark"] .component-upsell-band {
  border: 1px solid var(--color-upsell-band-border);
}

.component-upsell-band-media {
  position: relative;
  min-height: 13.75rem;
}

.component-upsell-band-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Near-square photos overflow vertically on the wide desktop band crop; anchor
   to the top so the subject's head stays in frame instead of being clipped. */
.component-upsell-band-photo-top {
  object-position: center top;
}

/* Mobile: photo sits above the panel, so fade downward into the dark body.
   The diagonal left-to-right fade is restored at the lg breakpoint below. */
.component-upsell-band-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 35%, var(--color-upsell-band-scrim) 75%, var(--band-bg) 100%);
}

.component-upsell-band-stats {
  position: absolute;
  inset-inline-start: clamp(1rem, 4vw, 2rem);
  bottom: clamp(1rem, 4vw, 1.875rem);
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 2.5);
}

.component-upsell-band-stat {
  display: inline-flex;
  flex-direction: column;
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4.25);
  border-radius: var(--radius-md);
  background: var(--color-upsell-band-stat-bg);
  border: 1px solid var(--color-upsell-band-stat-border);
  backdrop-filter: blur(0.75rem) saturate(140%);
  box-shadow: 0 0.25rem 1rem var(--color-upsell-band-stat-shadow);
}

.component-upsell-band-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-white);
  text-shadow: 0 0.0625rem 0.1875rem var(--color-upsell-band-stat-value-shadow);
}

.component-upsell-band-stat-label {
  margin-top: calc(var(--spacing) * 1);
  font-size: 0.6875rem;
  color: var(--color-upsell-band-stat-label);
  text-shadow: 0 0.0625rem 0.125rem var(--color-upsell-band-stat-label-shadow);
}

.component-upsell-band-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.75rem, 4vw, 2.5rem) clamp(1.5rem, 4vw, 2.75rem);
}

.component-upsell-band-title {
  margin: 0 0 calc(var(--spacing) * 5.5);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.018em;
  color: var(--band-text);
}

.component-upsell-band-steps {
  --band-step-gap: calc(var(--spacing) * 5);
  display: flex;
  flex-direction: column;
  gap: var(--band-step-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.component-upsell-band-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: calc(var(--spacing) * 4);
}

/* Connector line from each badge's center down to the next badge's center; the
   last step omits it so the line stops at step 4 rather than trailing past it.
   The next badge's band-bg ring punches through the end so it reads as a stop. */
.component-upsell-band-step:not(:last-child)::before {
  content: '';
  position: absolute;
  inset-inline-start: 0.8125rem;
  top: 0.875rem;
  bottom: calc(-1 * (var(--band-step-gap) + 0.875rem));
  width: 0.125rem;
  background: color-mix(in srgb, var(--upsell-accent) 35%, transparent);
}

.component-upsell-band-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-pill);
  background: var(--upsell-accent);
  color: var(--color-white);
  font-size: 0.8125rem;
  font-weight: 700;
  box-shadow: 0 0 0 0.25rem var(--band-bg);
}

.component-upsell-band-step-title {
  margin-bottom: calc(var(--spacing) * 0.5);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--band-text);
}

.component-upsell-band-step-desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--band-text-dim);
}

/* Closing CTA strip */
.component-upsell-closing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1.5rem, 4vw, 2rem) calc(var(--spacing) * 8);
  padding: clamp(1.75rem, 4vw, 2rem) clamp(1.5rem, 4vw, 2.25rem);
  border: 1px solid var(--upsell-accent-soft-border);
  border-radius: var(--radius-2xl);
  background: radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--upsell-accent) 12%, transparent), color-mix(in srgb, var(--upsell-accent) 3%, transparent) 45%, var(--color-surface-primary) 75%);
  box-shadow: var(--shadow-sm);
}

.component-upsell-closing-copy {
  min-width: 0;
}

.component-upsell-closing-sub {
  margin: calc(var(--spacing) * 2) 0 0;
  max-width: 54ch;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--color-text-body);
}

.component-upsell-closing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  flex-shrink: 0;
}

@media (min-width: 40rem) {
  /* Stats become a tight, left-aligned divided row once there's room. */
  .component-upsell-stats {
    flex-direction: row;
    gap: 0;
  }

  .component-upsell-stat {
    padding-inline: calc(var(--spacing) * 7);
  }

  .component-upsell-stat:first-child {
    padding-inline-start: 0;
  }

  .component-upsell-stat + .component-upsell-stat {
    border-inline-start: 1px solid var(--color-border-subtle);
  }

  /* Dense panel splits to two columns once there's room. */
  .component-upsell-panel {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 48rem) {
  .component-upsell-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 64rem) {
  .component-upsell-hero {
    grid-template-columns: 1.05fr 0.95fr;
  }

  .component-upsell-preview {
    border-top: none;
    border-left: 1px solid var(--color-border-subtle);
  }

  .component-upsell-panel {
    grid-template-columns: repeat(3, 1fr);
  }

  .component-upsell-band {
    grid-template-columns: 1.05fr 0.95fr;
    min-height: 27.5rem;
  }

  .component-upsell-band-media {
    min-height: auto;
  }

  /* Two-column layout: fade the photo left-to-right into the dark panel. */
  .component-upsell-band-scrim {
    background: linear-gradient(110deg, transparent 0%, transparent 45%, var(--color-upsell-band-scrim) 72%, var(--band-bg) 100%);
  }
}

/*
 * .component-sidebar-link-badge — unread-count pill on a sidebar link (Inbox).
 * Sits after the title (which is flex:1), so it right-aligns ahead of the
 * active chevron. Hidden at zero so it stays a live Turbo Stream replace target.
 *
 * This is DESIGN.md's one sanctioned solid badge: an unread counter has to
 * carry across a sidebar full of quiet muted rows, and a tint would not. It is
 * still routed through the presentation-strength face rather than the raw base,
 * so it is the deep red on Cool Paper and the bright one on Studio Dark, with
 * the ink flipping to match — 4.83:1 light and 7.02:1 dark, where the old
 * base/white pairing measured 2.77:1.
 */
.component-sidebar-link-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 calc(var(--spacing) * 1.5);
  border-radius: var(--radius-pill);
  background-color: var(--color-red-mark);
  color: var(--color-text-on-vivid);
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1;
}

.component-sidebar-link-badge-empty {
  display: none;
}

/*
 * .notification-settings-* — the profile/notifications grid: one row per
 * NotificationSetting category, each with In-app and Email toggles.
 *
 * Where used: app/views/notification_settings/edit.html.erb
 * When to reuse: only on that page. Category labels are full sentences
 *                ("Comments on tasks assigned to you"), so the label and the
 *                toggles share a line only while there is room for both; below
 *                40rem the row stacks and the toggles drop beneath the label.
 * When NOT to use: for any other label-plus-switch list — use the form field
 *                  components, or write a domain class for that area.
 */
.notification-settings {
  max-width: 40rem;
}

.notification-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 4);
  padding: calc(var(--spacing) * 3) 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.notification-settings-category {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-heading);
}

.notification-settings-channels {
  display: flex;
  gap: calc(var(--spacing) * 6);
}

.notification-settings-channel {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
}

.notification-settings-channel-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-body);
  /* "In-app" is one word to a reader; without this it wraps at the hyphen. */
  white-space: nowrap;
}

.notification-settings-submit {
  margin-top: calc(var(--spacing) * 4);
}

/*
 * Narrow widths: a sentence-length category label squeezed beside the toggles
 * leaves a column too thin to read, so the label takes the whole row and the
 * toggles follow on a line of their own, left-aligned under it.
 */
@media (max-width: 40rem) {
  .notification-settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: calc(var(--spacing) * 2);
  }
}

/* =============================================================================
 * Mobile index chrome + bottom sheets
 * -----------------------------------------------------------------------------
 * Below 64rem the Audiences / Vault desktop filter toolbar is replaced by a
 * compact chip row (search + Scope / Filter / Sort) whose chips open bottom
 * sheets. Rendered by Mobile::IndexChromeComponent; the sheets are driven by
 * the sheet + filter-form + event controllers. Above 64rem the desktop toolbar
 * is shown instead and this chrome is hidden.
 * ========================================================================== */

.component-index-mobile {
  display: none;
}

@media (max-width: 63.9375rem) {
  .component-index-mobile {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing) * 3);
  }

  /* Descendant selector (0,2,0) so this beats the base row's display:flex
     regardless of stylesheet load order (the base lives in a later file). */
  .component-audiences-toolbar .component-audiences-toolbar-row,
  .component-vault-toolbar .component-vault-toolbar-row {
    display: none;
  }
}

/* ── Search pill ─────────────────────────────────────────────────────────── */
.component-index-mobile-search {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
  background: var(--color-surface-input);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

.component-index-mobile-search-icon {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
}

.component-index-mobile-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text-input);
  font-size: max(var(--font-size-sm), var(--field-font-floor));
  font-family: inherit;
}

.component-index-mobile-search-input:focus {
  outline: none;
}

.component-index-mobile-search-input::placeholder {
  color: var(--color-text-muted);
}

/* ── Chip row (Scope / Filter / Sort) ────────────────────────────────────── */
.component-index-mobile-chips {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: calc(var(--spacing) * 0.5);
}

.component-index-mobile-chips::-webkit-scrollbar {
  display: none;
}

.component-index-mobile-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3.5);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-heading);
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.component-index-mobile-chip-active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent-border);
  color: var(--color-accent-hover);
}

/* Focus doctrine: the shared ring on keyboard focus. The chip already spends
 * its box-shadow on a resting lift, so the ring stacks after it. */
.component-index-mobile-chip:focus-visible {
  outline: none;
  box-shadow: var(--shadow-sm), var(--focus-ring);
}

.component-index-mobile-chip-icon {
  width: 0.9375rem;
  height: 0.9375rem;
  color: var(--color-text-muted);
}

.component-index-mobile-chip-active .component-index-mobile-chip-icon {
  color: currentColor;
}

.component-index-mobile-chip-caret {
  width: 0.8125rem;
  height: 0.8125rem;
  color: var(--color-text-muted);
}

.component-index-mobile-chip-active .component-index-mobile-chip-caret {
  color: currentColor;
}

.component-index-mobile-chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 calc(var(--spacing) * 1.25);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-white);
  font-size: var(--font-size-2xs);
  font-weight: 700;
}

/* ── Active filter chips ─────────────────────────────────────────────────── */
.component-index-mobile-active {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: calc(var(--spacing) * 0.5);
}

.component-index-mobile-active::-webkit-scrollbar {
  display: none;
}

.component-index-mobile-active-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 2) calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
  background: var(--color-accent-subtle);
  border: 1px solid var(--color-accent-border);
  border-radius: var(--radius-pill);
  color: var(--color-accent-hover);
  font-size: var(--font-size-xs);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-index-mobile-active-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.component-index-mobile-active-chip-icon {
  width: 0.875rem;
  height: 0.875rem;
}

.component-index-mobile-active-clear {
  flex: none;
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 2);
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}

/* Focus doctrine: the shared ring on keyboard focus. */
.component-index-mobile-active-clear:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

/* ── Bottom sheet shell ──────────────────────────────────────────────────── */
.component-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.component-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--color-black) 42%, transparent);
  opacity: 0;
  transition: opacity var(--motion-base);
}

.component-sheet-overlay-open .component-sheet-backdrop {
  opacity: 1;
}

.component-sheet-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 34rem;
  max-height: 85vh;
  background: var(--color-surface-primary);
  border-top-left-radius: var(--radius-2xl);
  border-top-right-radius: var(--radius-2xl);
  box-shadow: var(--shadow-elev);
  transform: translateY(100%);
  transition: transform var(--motion-base);
}

.component-sheet-overlay-open .component-sheet-panel {
  transform: translateY(0);
}

/* While a swipe is tracking the finger the panel must follow it instantly;
   the transition comes back on release for the snap-back / dismiss. */
.component-sheet-panel-dragging {
  transition: none;
}

.component-sheet-handle {
  flex: none;
  display: flex;
  justify-content: center;
  padding: calc(var(--spacing) * 2.5) 0 calc(var(--spacing) * 1);
  cursor: pointer;
}

.component-sheet-handle span {
  width: 2.375rem;
  height: 0.3125rem;
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
}

.component-sheet-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--spacing) * 3);
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 5) calc(var(--spacing) * 3.5);
  border-bottom: 1px solid var(--color-border-subtle);
}

.component-sheet-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text-heading);
}

.component-sheet-reset {
  padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.component-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: calc(var(--spacing) * 4) calc(var(--spacing) * 3) calc(var(--spacing) * 2);
}

.component-sheet-footer {
  flex: none;
  padding: calc(var(--spacing) * 3.5) calc(var(--spacing) * 5) calc(calc(var(--spacing) * 3.5) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border-subtle);
}

/* ── Filter sheet: sectioned toggle chips ────────────────────────────────── */
.component-sheet-section {
  padding: 0 calc(var(--spacing) * 2) calc(var(--spacing) * 5);
}

.component-sheet-section-label {
  margin-bottom: calc(var(--spacing) * 2.5);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-body);
}

.component-sheet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing) * 2);
}

.component-sheet-chip {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--spacing) * 1.5);
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3.5);
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-pill);
  color: var(--color-text-body);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
}

.component-sheet-chip:has(.component-sheet-chip-input:checked) {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent-border);
  color: var(--color-accent-hover);
}

.component-sheet-chip:has(.component-sheet-chip-input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.component-sheet-chip-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--sheet-chip-dot);
}

/* ── Scope / Sort sheet: option rows ─────────────────────────────────────── */
.component-sheet-group-label {
  padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3) calc(var(--spacing) * 1.5);
  font-size: var(--font-size-2xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: none;
}

.component-sheet-option {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing) * 3);
  width: 100%;
  padding: calc(var(--spacing) * 3) calc(var(--spacing) * 3);
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--color-text-heading);
  font-size: var(--font-size-base);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.component-sheet-option:hover {
  background: var(--color-surface-hover);
}

.component-sheet-option-icon {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--color-text-muted);
}

.component-sheet-option-live {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 calc(var(--spacing) * 1.25);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--color-accent) 20%, transparent);
}

.component-sheet-option-label {
  flex: 1;
  min-width: 0;
}

.component-sheet-option-selected {
  font-weight: 600;
}

.component-sheet-option-check {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--color-accent);
}

.component-sheet-divider {
  margin: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
  border-top: 1px solid var(--color-border-subtle);
}

/* Lock background scroll while a sheet is open. */
body.is-sheet-open {
  overflow: hidden;
}

/* ─── Info tip ─── */

/*
 * .component-info-tip
 * A small "i" button beside an option, with a note that shows while the
 * button is hovered or focused, or after a tap pins it (touch screens). The
 * note is moved to <body> and placed with position: fixed (utils/info_tip.js),
 * so a drawer or card that clips its overflow cannot cut it off; it flips and
 * shifts to stay inside the viewport. The note ignores the pointer so a click
 * on the option it explains still lands on the option.
 *
 * Used by: InfoTipComponent (info_tip_controller.js; DncNoticeComponent and
 * the visualize Phone Numbers card render it) and DncInfoTip in
 * app/javascript/pages/audience_builders/builder/dnc-acknowledgement.jsx.
 * When to reuse: a one-paragraph note about a single option that has to be
 * reachable without opening anything.
 */
.component-info-tip {
  display: inline-flex;
  vertical-align: middle;
}

.component-info-tip-trigger {
  align-items: center;
  background: none;
  border: 0;
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  cursor: help;
  display: inline-flex;
  height: 1.25rem;
  justify-content: center;
  padding: 0;
  width: 1.25rem;
}

.component-info-tip-trigger:hover,
.component-info-tip-trigger:focus-visible,
.component-info-tip[data-open='true'] .component-info-tip-trigger {
  color: var(--color-text-heading);
}

.component-info-tip-icon {
  height: 0.75rem;
  width: 0.75rem;
}

.component-info-tip-bubble {
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border-themed);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--color-text-body);
  font-size: var(--font-size-xs);
  font-weight: 400;
  left: 0;
  letter-spacing: normal;
  line-height: 1.5;
  /* utils/info_tip.js sets the cap from the visible width when it opens. */
  max-width: min(20rem, calc(100vw - 2rem));
  padding: calc(var(--spacing) * 3);
  pointer-events: none;
  position: fixed;
  text-align: left;
  text-transform: none;
  top: 0;
  visibility: hidden;
  white-space: normal;
  width: max-content;
  z-index: 260;
}

.component-info-tip-bubble[data-open='true'] {
  visibility: visible;
}

/* ─── DNC acknowledgement modal ─── */

/*
 * .component-dnc-acknowledgement
 * The once-per-user modal a DNC option opens before it turns on: the notice,
 * a checkbox the user has to tick, and Cancel / Continue.
 *
 * Used by: app/components/dnc_acknowledgement_modal_component.html.erb
 */
.component-dnc-acknowledgement-title {
  color: var(--color-text-heading);
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin: 0;
  padding-right: calc(var(--spacing) * 8);
}

.component-dnc-acknowledgement-notice {
  color: var(--color-text-body);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  margin: 0;
}

.component-dnc-acknowledgement-confirm {
  align-items: flex-start;
  color: var(--color-text-heading);
  cursor: pointer;
  display: flex;
  font-size: var(--font-size-sm);
  gap: calc(var(--spacing) * 2);
  line-height: 1.5;
}

.component-dnc-acknowledgement-confirm input {
  accent-color: var(--color-accent);
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.component-dnc-acknowledgement-error {
  color: var(--color-text-danger);
  font-size: var(--font-size-sm);
  margin: 0;
}

.component-dnc-acknowledgement-actions {
  display: flex;
  gap: calc(var(--spacing) * 2);
  justify-content: flex-end;
}

/* Staff signed in as a customer: their Continue is not recorded. */
.component-dnc-acknowledgement-note {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  margin: 0;
}

/*
 * .component-lists-download-modal-* — the Download flow on a list's page
 * (preset, file type and sort before the file is built).
 *
 * Callers: lists/download_modal_component.
 * Reuse rule: exclusive to the list download modal.
 */
.component-lists-download-modal-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text-heading);
}

/* Matches .component-form-label-text so the preset group reads like the dropdown labels below it. */
.component-lists-download-modal-label {
  font-weight: 500;
  font-size: var(--font-size-sm);
  line-height: 1.25rem;
  color: var(--color-text-body);
}

.component-lists-download-modal-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/*
 * .component-lists-share-link-modal-* — the Share dialog on a list's insights
 * tab (turn the public insights link on, copy it, turn it off).
 *
 * Callers: lists/share_link_modal_component.
 * Reuse rule: exclusive to the list share link modal.
 */
.component-lists-share-link-modal-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text-heading);
}

.component-lists-share-link-modal-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
