.u-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  box-shadow: var(--shadow-md);
}

.u-card-tight {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-card) 84%, transparent);
  box-shadow: var(--shadow-sm);
}

.u-btn,
.u-btn-primary,
.u-btn-secondary,
.u-btn-ghost,
.u-btn-danger {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  padding: 0 var(--space-5);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), color var(--transition-base), transform var(--transition-fast);
}

.u-btn {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-input) 78%, transparent);
  color: var(--text);
}

.u-btn-primary {
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.u-btn-secondary {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-input) 78%, transparent);
  color: var(--text);
}

.u-btn-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.u-btn-danger {
  border: 1px solid color-mix(in srgb, var(--error) 28%, var(--border));
  background: color-mix(in srgb, var(--error) 10%, transparent);
  color: color-mix(in srgb, var(--error) 88%, var(--text));
}

.u-btn-sm {
  min-height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}

.u-btn-icon {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}

.u-btn svg,
.u-btn-primary svg,
.u-btn-secondary svg,
.u-btn-ghost svg,
.u-btn-danger svg {
  flex: 0 0 auto;
}

.u-btn-primary:hover,
.u-btn-secondary:hover,
.u-btn-ghost:hover,
.u-btn-danger:hover {
  transform: translateY(-1px);
}

.u-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-input));
}

.u-btn-danger:hover {
  border-color: color-mix(in srgb, var(--error) 44%, var(--border));
  background: color-mix(in srgb, var(--error) 16%, transparent);
}

.u-btn:focus-visible,
.u-btn-primary:focus-visible,
.u-btn-secondary:focus-visible,
.u-btn-ghost:focus-visible,
.u-btn-danger:focus-visible,
.u-switch:focus-within {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}

.u-btn:disabled,
.u-btn-primary:disabled,
.u-btn-secondary:disabled,
.u-btn-ghost:disabled,
.u-btn-danger:disabled,
.u-btn[aria-disabled="true"],
.u-btn-primary[aria-disabled="true"],
.u-btn-secondary[aria-disabled="true"],
.u-btn-ghost[aria-disabled="true"],
.u-btn-danger[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.u-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-input) 88%, transparent);
  color: var(--text);
  padding: 0 var(--space-4);
  font: inherit;
  font-size: var(--text-sm);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.u-input:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  outline: none;
}

.u-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--text);
}

.u-field > span,
.u-field > label,
.u-field-label {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 760;
}

.u-field-help {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.u-field > input:not([type="checkbox"]):not([type="radio"]),
.u-field > textarea,
.u-field > select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-input) 88%, transparent);
  color: var(--text);
  padding: 0 var(--space-4);
  font: inherit;
  font-size: var(--text-sm);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.u-field > textarea,
textarea.u-input {
  min-height: 92px;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  resize: vertical;
}

.u-field > input:not([type="checkbox"]):not([type="radio"]):focus-visible,
.u-field > textarea:focus-visible,
.u-field > select:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  outline: none;
}

.u-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.u-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.u-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.u-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-4);
}

.u-h1,
.u-h2,
.u-h3,
.u-text,
.u-muted,
.u-caption {
  margin: 0;
}

.u-h1 {
  color: var(--text);
  font-size: var(--text-2xl);
  font-weight: 860;
  line-height: 1.1;
}

.u-h2 {
  color: var(--text);
  font-size: var(--text-xl);
  font-weight: 820;
  line-height: 1.15;
}

.u-h3 {
  color: var(--text);
  font-size: var(--text-lg);
  font-weight: 780;
  line-height: 1.2;
}

.u-text {
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.6;
}

.u-muted {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.u-caption {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.u-switch {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 720;
  cursor: pointer;
}

.u-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.u-switch-track {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  transition: background var(--transition-base), border-color var(--transition-base);
}

.u-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), background var(--transition-base);
}

.u-switch input:checked + .u-switch-track {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: var(--accent-gradient);
}

.u-switch input:checked + .u-switch-track::after {
  transform: translateX(20px);
  background: #fff;
}

.u-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: var(--space-1);
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, currentColor 12%, transparent);
  color: var(--accent);
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: 780;
  line-height: 1;
}

.u-badge.success { color: var(--success); }
.u-badge.warning { color: var(--warning); }
.u-badge.error { color: var(--error); }
.u-badge.info { color: var(--info); }
