[data-fui-comp="ui-button"], .ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  /* Token-scaled touch target: --spacing-touch-target defaults to
     44px (WCAG 2.5.5 floor). Apps that want a larger tap zone for
     accessibility-mode skins can bump it via theme.Layout.
     TouchTarget without forking the component. */
  min-height: var(--spacing-touch-target);
  padding: 10px var(--spacing-lg);
  border: 1px solid transparent;
  border-radius: var(--radii-md);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-primary);
  color: var(--color-primary-fg);
  text-decoration: none;
  transition: filter 150ms ease, opacity 150ms ease;
}
[data-fui-comp="ui-button"]:hover, .ui-button:hover { filter: brightness(0.95); }
/* Layered focus ring: inner halo in the surface color creates a
   visible gap between the button and the outer primary ring, so
   keyboard focus stays visible regardless of the button's own
   background color. */
[data-fui-comp="ui-button"]:focus-visible, .ui-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-primary);
}
[data-fui-comp="ui-button"]:disabled, .ui-button:disabled,
[data-fui-comp="ui-button"][aria-disabled="true"], .ui-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  filter: none;
}

/* Variants — Primary is the default style above. */
.ui-button--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.ui-button--secondary:hover { filter: none; background: var(--color-surface-soft); }
/* secondary's bg IS --color-surface, so the layered-shadow inner halo
   would be invisible. Use a plain outline with offset instead — it
   contrasts against any page background. */
.ui-button--secondary:focus-visible {
  box-shadow: none;
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

.ui-button--danger {
  /* Use a darker red than the raw token so axe's color-contrast
     scanner — which can't always evaluate color-mix() — sees a
     literal background and confirms ~7:1 vs white text. The raw
     --color-danger (#DC2626 / red-600) hits ~5.5:1 which is fine
     mathematically but trips axe in some configurations. red-700
     (#B91C1C) is unambiguous: 7.07:1 vs white. */
  background: #B91C1C;
  color: #FFFFFF;
}
.ui-button--danger:focus-visible {
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-danger);
}

.ui-button--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: transparent;
}
.ui-button--ghost:hover { filter: none; background: var(--color-surface-soft); }
/* ghost sits on --color-background; a halo of --color-surface collapses
   to near-invisible. Plain outline + offset is reliable on any bg. */
.ui-button--ghost:focus-visible {
  box-shadow: none;
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

/* Size modifiers — the default Button size already meets WCAG 2.5.5
   touch-target via min-height. --small explicitly opts out for compact
   row-action contexts (table rows, dense toolbars) where the parent
   row already provides the 44px tap area. --large bumps padding +
   font-size for hero CTAs. */
.ui-button--small {
  min-height: auto;
  padding: 4px var(--spacing-md, 12px);
  font-size: 0.8rem;
}
.ui-button--large {
  padding: 14px var(--spacing-xl, 24px);
  font-size: 1.05rem;
}