.btn,
:global(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-default);
  height: var(--control-height-md);
  padding: 0 var(--inset-control-inline);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-family: var(--font-sans);
  font-size: var(--type-body-3-size);
  font-weight: var(--type-body-3-weight);
  line-height: var(--type-body-3-line-height);
  white-space: nowrap;
  transition:
    background var(--duration-normal) var(--ease-out),
    border-color var(--duration-normal) var(--ease-out),
    color var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.btn:focus-visible,
:global(.btn):focus-visible {
  box-shadow:
    0 0 0 2px var(--surface-page),
    var(--control-focus-ring);
}

.btn:hover:not(:disabled),
:global(.btn):hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary,
:global(.btn-primary) {
  background: var(--control-primary-bg);
  color: var(--control-primary-fg);
}

.primary:hover:not(:disabled):not([aria-disabled="true"]),
:global(.btn-primary):hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--control-primary-bg-hover);
}

.secondary,
:global(.btn-default),
:global(.btn-secondary) {
  background: var(--control-secondary-bg);
  border-color: var(--control-secondary-border);
  color: var(--text-primary);
}

.secondary:hover:not(:disabled):not([aria-disabled="true"]),
:global(.btn-default):hover:not(:disabled):not([aria-disabled="true"]),
:global(.btn-secondary):hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--control-secondary-bg-hover);
  border-color: var(--control-secondary-border-hover);
}

.ghost,
:global(.btn-ghost) {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.ghost:hover:not(:disabled):not([aria-disabled="true"]),
:global(.btn-ghost):hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--control-ghost-bg-hover);
  color: var(--text-primary);
}

.danger,
:global(.btn-danger) {
  background: var(--control-danger-bg);
  color: var(--control-danger-fg);
}

.sm,
:global(.btn-sm) {
  height: var(--control-height-sm);
  padding: 0 var(--gap-default);
  border-radius: var(--radius-control-sm);
  font-size: var(--type-body-6-size);
  font-weight: var(--type-body-6-weight);
  line-height: var(--type-body-6-line-height);
}

.lg,
:global(.btn-lg) {
  height: var(--control-height-lg);
  padding: 0 var(--inset-dialog);
  border-radius: var(--radius-control-lg);
}

.label {
  display: inline-flex;
  align-items: center;
}

.icon {
  display: inline-flex;
  align-items: center;
}

.loading {
  pointer-events: none;
}

.spinner {
  display: inline-flex;
  width: var(--sp-3);
  height: var(--sp-3);
  flex-shrink: 0;
  border: calc(var(--sp-1) / 2) solid var(--control-spinner-track);
  border-top-color: currentColor;
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: var(--radius-full);
  box-sizing: border-box;
}
