/* ============================================================
   SpaceForge UI Kit
   Design-token driven interactive components.
   Theme variants are switched by [data-theme-style="nexus"] /
   [data-theme-style="ironcore"] on <html>.
   ============================================================ */

/* ---------------- Button ---------------- */
.ui-btn {
  --ui-btn-height: 34px;
  --ui-btn-padding: 0 16px;
  --ui-btn-font-size: 12.5px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--ui-btn-height);
  padding: var(--ui-btn-padding);
  border: 1px solid transparent;
  border-radius: var(--brand-radius-md);
  font-family: var(--font-body);
  font-size: var(--ui-btn-font-size);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease;
}

.ui-btn--sm {
  --ui-btn-height: 28px;
  --ui-btn-padding: 0 10px;
  --ui-btn-font-size: 11.5px;
  border-radius: var(--brand-radius-sm);
}

.ui-btn--lg {
  --ui-btn-height: 40px;
  --ui-btn-padding: 0 22px;
  --ui-btn-font-size: 13.5px;
}

.ui-btn--block {
  width: 100%;
}

.ui-btn:disabled,
.ui-btn.is-loading {
  opacity: 0.55;
  cursor: not-allowed;
}

.ui-btn:not(:disabled):not(.is-loading):active {
  transform: translateY(1px);
}

.ui-btn:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
}

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

.ui-btn__spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  animation: ui-spin 0.8s linear infinite;
}

.ui-btn--sm .ui-btn__spinner {
  width: 12px;
  height: 12px;
}

.ui-btn--lg .ui-btn__spinner {
  width: 16px;
  height: 16px;
}

/* primary */
.ui-btn--primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  color: var(--brand-primary-foreground);
  box-shadow: var(--btn-glow-shadow);
}

.ui-btn--primary:not(:disabled):not(.is-loading):hover {
  box-shadow: var(--btn-hover-glow-shadow);
  transform: translateY(-1px);
}

[data-theme-style='nexus'] .ui-btn--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 70%
  );
  transform: translateX(-130%);
  transition: transform 0.5s ease;
  pointer-events: none;
}

[data-theme-style='nexus'] .ui-btn--primary:not(:disabled):hover::before {
  transform: translateX(130%);
}

[data-theme-style='ironcore'] .ui-btn {
  letter-spacing: 0.05em;
  font-weight: 700;
  border-radius: 8px;
}

[data-theme-style='ironcore'] .ui-btn--sm {
  border-radius: 6px;
}

[data-theme-style='ironcore'] .ui-btn--lg {
  border-radius: 9px;
}

[data-theme-style='ironcore'] .ui-btn--primary {
  background: linear-gradient(
    180deg,
    var(--brand-primary-light) 0%,
    var(--brand-primary) 55%,
    var(--brand-primary-dark) 100%
  );
  border: 1px solid var(--brand-primary-dark);
  color: #1a1408;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

/* IRONCORE 与 C 端一致的斜向流光 */
[data-theme-style='ironcore'] .ui-btn--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 18%,
    rgba(255, 255, 255, 0.55) 46%,
    transparent 72%
  );
  transform: translateX(-130%);
  transition: transform 0.65s ease;
  pointer-events: none;
}

[data-theme-style='ironcore'] .ui-btn--primary:not(:disabled):not(.is-loading):hover::before {
  transform: translateX(130%);
}

[data-theme-style='ironcore'] .ui-btn--primary:not(:disabled):not(.is-loading):hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 22px rgba(var(--brand-primary-rgb), 0.3);
}

/* secondary */
.ui-btn--secondary {
  background: transparent;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.ui-btn--secondary:not(:disabled):not(.is-loading):hover {
  background: color-mix(in srgb, var(--brand-primary) 10%, transparent);
}

[data-theme-style='ironcore'] .ui-btn--secondary {
  background: color-mix(in srgb, var(--brand-card) 72%, transparent);
  border: 1px solid var(--brand-border);
  color: var(--brand-foreground);
  backdrop-filter: blur(8px);
}

[data-theme-style='ironcore'] .ui-btn--secondary:not(:disabled):not(.is-loading):hover {
  border-color: color-mix(in srgb, var(--brand-primary) 42%, transparent);
  color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 5.5%, transparent);
}

/* ghost */
.ui-btn--ghost {
  background: transparent;
  color: var(--brand-muted-foreground);
}

.ui-btn--ghost:not(:disabled):not(.is-loading):hover {
  background: var(--brand-input);
  color: var(--brand-foreground);
}

/* danger */
.ui-btn--danger {
  background: color-mix(in srgb, var(--color-status-error) 14%, transparent);
  border-color: color-mix(in srgb, var(--color-status-error) 45%, transparent);
  color: var(--color-status-error);
}

.ui-btn--danger:not(:disabled):not(.is-loading):hover {
  background: color-mix(in srgb, var(--color-status-error) 24%, transparent);
  border-color: var(--color-status-error);
  box-shadow: 0 0 14px color-mix(in srgb, var(--color-status-error) 24%, transparent);
}

[data-theme-style='ironcore'] .ui-btn--danger {
  border-width: 2px;
}

/* ---------------- Field / Input / Textarea ---------------- */
.ui-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.ui-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ui-form-field--wide {
  grid-column: 1 / -1;
}

.ui-form-field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ui-form-field__label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-muted-foreground);
}

.ui-form-field__required {
  margin-left: 3px;
  color: var(--color-status-error);
}

.ui-form-field__en {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--brand-muted-foreground) 65%, transparent);
}

.ui-form-field__hint {
  margin: 0;
  font-family: var(--font-body);
  font-size: 11px;
  line-height: 1.5;
  color: var(--brand-muted-foreground);
}

.ui-form-field__error {
  margin: 0;
  font-family: var(--font-body);
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-status-error);
}

.ui-control {
  --ui-control-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: var(--ui-control-height);
  padding: 0 10px;
  background: var(--brand-input);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-sm);
  color: var(--brand-foreground);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.ui-control--sm {
  --ui-control-height: 28px;
  padding: 0 8px;
}

.ui-control--lg {
  --ui-control-height: 40px;
  padding: 0 12px;
}

.ui-control:hover:not(.is-disabled) {
  border-color: color-mix(in srgb, var(--brand-primary) 55%, var(--brand-border));
}

.ui-control:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--color-glow-primary);
}

.ui-control.is-invalid {
  border-color: var(--color-status-error);
}

.ui-control.is-invalid:focus-within {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-status-error) 22%, transparent);
}

.ui-control.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ui-control__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1;
}

.ui-control--sm .ui-control__input {
  font-size: 11.5px;
}

.ui-control--lg .ui-control__input {
  font-size: 13.5px;
}

.ui-control__input::placeholder,
.ui-textarea::placeholder {
  color: var(--brand-muted-foreground);
}

.ui-control__input:focus,
.ui-textarea:focus {
  border-color: transparent;
  box-shadow: none;
  outline: none;
}

.ui-control.is-disabled .ui-control__input {
  cursor: not-allowed;
}

.ui-control__affix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--brand-muted-foreground);
}

.ui-control__affix > svg {
  width: 14px;
  height: 14px;
}

.ui-control__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-muted-foreground);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.ui-control__action:hover:not(:disabled) {
  color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
}

.ui-control__action > svg {
  width: 13px;
  height: 13px;
}

.ui-control--textarea {
  height: auto;
  align-items: stretch;
  padding: 8px 10px;
}

.ui-control--sm.ui-control--textarea {
  padding: 6px 8px;
}

.ui-control--lg.ui-control--textarea {
  padding: 10px 12px;
}

.ui-textarea {
  width: 100%;
  min-height: 68px;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
}

.ui-control--sm .ui-textarea {
  font-size: 11.5px;
}

.ui-control--lg .ui-textarea {
  font-size: 13.5px;
}

.ui-textarea.is-no-resize {
  resize: none;
}

.ui-field__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 0;
}

.ui-field__error {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-status-error);
}

.ui-field__count {
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--brand-muted-foreground);
}

/* IRONCORE controls: 与 C 端机甲主题一致的近黑半透明输入面 */
[data-theme-style='ironcore'] .ui-control {
  background: color-mix(in srgb, var(--brand-background) 72%, transparent);
  border: 1px solid var(--brand-border);
  border-radius: 7px;
  text-shadow: none;
}

[data-theme-style='ironcore'] .ui-control:hover:not(.is-disabled) {
  border-color: color-mix(in srgb, var(--brand-primary) 38%, var(--brand-border));
  box-shadow: none;
}

[data-theme-style='ironcore'] .ui-control:focus-within {
  border-color: color-mix(in srgb, var(--brand-primary) 50%, transparent);
  background: color-mix(in srgb, var(--brand-background) 92%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 8%, transparent);
}

[data-theme-style='ironcore'] .ui-control.is-invalid {
  border-color: var(--color-status-error);
}

[data-theme-style='ironcore'] .ui-control--md.ui-control--textarea {
  padding: 10px 12px;
}

[data-theme-style='ironcore'] .ui-textarea {
  font-size: 12px;
  line-height: 1.7;
}

/* ---------------- Date picker ---------------- */
.ui-date__input {
  min-width: 0;
}

.ui-date__input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.ui-date__input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.ui-date__input::-webkit-datetime-edit {
  color: inherit;
}

[data-theme-style='ironcore'] .ui-date__input::-webkit-calendar-picker-indicator {
  filter: sepia(1) saturate(3) hue-rotate(352deg) brightness(1.05);
}

/* ---------------- Select ---------------- */
.ui-select {
  --ui-control-height: 34px;
  position: relative;
  width: 100%;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 12.5px;
}

.ui-select--sm {
  --ui-control-height: 28px;
  font-size: 11.5px;
}

.ui-select--lg {
  --ui-control-height: 40px;
  font-size: 13.5px;
}

.ui-select__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: var(--ui-control-height);
  padding: 0 10px;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-sm);
  background: var(--brand-input);
  color: var(--brand-foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.ui-select--sm .ui-select__trigger {
  padding: 0 8px;
}

.ui-select--lg .ui-select__trigger {
  padding: 0 12px;
}

.ui-select__trigger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--brand-primary) 55%, var(--brand-border));
}

.ui-select__trigger.is-open {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--color-glow-primary);
}

.ui-select__trigger.is-invalid {
  border-color: var(--color-status-error);
}

.ui-select__trigger:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
}

.ui-select__trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

[data-theme-style='ironcore'] .ui-select__trigger {
  background: color-mix(in srgb, var(--brand-background) 72%, transparent);
  border: 1px solid var(--brand-border);
  border-radius: 7px;
  text-shadow: none;
}

[data-theme-style='ironcore'] .ui-select__trigger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--brand-primary) 38%, var(--brand-border));
  box-shadow: none;
}

[data-theme-style='ironcore'] .ui-select__trigger.is-open {
  border-color: color-mix(in srgb, var(--brand-primary) 50%, transparent);
  background: color-mix(in srgb, var(--brand-background) 92%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 8%, transparent);
}

.ui-select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ui-select__value.is-placeholder {
  color: var(--brand-muted-foreground);
}

.ui-select__chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--brand-muted-foreground);
  transition: transform 0.2s ease, color 0.2s ease;
}

.ui-select__chevron.is-open {
  transform: rotate(180deg);
  color: var(--brand-primary);
}

.ui-select__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-muted-foreground);
  cursor: pointer;
}

.ui-select__clear:hover {
  color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
}

.ui-select__clear > svg {
  width: 13px;
  height: 13px;
}

.ui-select__dropdown {
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  padding: 5px;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-md);
  background: var(--brand-popover);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
  overflow: hidden;
}

[data-theme-style='nexus'] .ui-select__dropdown {
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48), 0 0 18px rgba(0, 240, 255, 0.1);
}

[data-theme-style='ironcore'] .ui-select__dropdown {
  border: 1px solid var(--brand-border);
  border-radius: 7px;
  background: var(--brand-popover);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme-style='ironcore'] .ui-select__search-input {
  background: color-mix(in srgb, var(--brand-background) 72%, transparent);
  border-radius: 6px;
}

.ui-select__search {
  position: relative;
  display: flex;
  align-items: center;
  padding: 2px 3px 6px;
  border-bottom: 1px solid var(--brand-border);
  margin-bottom: 3px;
}

.ui-select__search-icon {
  position: absolute;
  left: 11px;
  width: 13px;
  height: 13px;
  color: var(--brand-muted-foreground);
  pointer-events: none;
}

.ui-select__search-input {
  width: 100%;
  height: 28px;
  padding: 0 8px 0 28px;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-sm);
  background: var(--brand-input);
  color: var(--brand-foreground);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
}

.ui-select__search-input::placeholder {
  color: var(--brand-muted-foreground);
}

.ui-select__search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 1px var(--brand-primary);
}

.ui-select__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1px;
}

.ui-select__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 5px 9px;
  border: none;
  border-radius: var(--brand-radius-sm);
  background: transparent;
  color: var(--brand-foreground);
  font-family: var(--font-body);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.ui-select__option.is-active:not(.is-disabled) {
  background: var(--brand-input);
}

.ui-select__option.is-selected {
  background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  color: var(--brand-primary);
  font-weight: 600;
}

.ui-select__option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ui-select__option-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.ui-select__option-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ui-select__option-desc {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--brand-muted-foreground);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ui-select__option-check {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--brand-primary);
}

.ui-select__empty {
  padding: 18px 10px;
  text-align: center;
  font-size: 11.5px;
  color: var(--brand-muted-foreground);
}

/* dropdown transition */
.ui-pop-enter-active,
.ui-pop-leave-active {
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.ui-pop-enter-from,
.ui-pop-leave-to {
  opacity: 0;
  transform: translateY(-4px);
}

/* ---------------- Dropdown menu ---------------- */
.ui-dropdown {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}

.ui-dropdown.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ui-dropdown__menu {
  position: fixed;
  z-index: 1060;
  max-height: min(320px, 60vh);
  padding: 5px;
  overflow-y: auto;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-md);
  background: var(--brand-popover);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
  font-family: var(--font-body);
}

.ui-dropdown__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--brand-radius-sm);
  background: transparent;
  color: var(--brand-foreground);
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.ui-dropdown__item:hover:not(:disabled),
.ui-dropdown__item:focus-visible {
  background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  color: var(--brand-primary);
  outline: none;
}

.ui-dropdown__item.is-danger {
  color: var(--color-status-error);
}

.ui-dropdown__item.is-danger:hover:not(:disabled),
.ui-dropdown__item.is-danger:focus-visible {
  background: color-mix(in srgb, var(--color-status-error) 12%, transparent);
  color: var(--color-status-error);
}

.ui-dropdown__item.is-disabled {
  opacity: 0.5;
  cursor: default;
}

.ui-dropdown__item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ui-dropdown__item-desc {
  font-size: 10.5px;
  color: var(--brand-muted-foreground);
}

.ui-dropdown__check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--brand-primary);
}

.ui-dropdown__divider {
  height: 1px;
  margin: 5px 4px;
  background: var(--brand-border);
}

[data-theme-style='ironcore'] .ui-dropdown__menu {
  border-width: 2px;
}

[data-theme-style='ironcore'] .ui-dropdown__item {
  border-radius: 2px;
}

/* ---------------- Pagination ---------------- */
.ui-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  font-family: var(--font-body);
}

.ui-pagination--center {
  justify-content: center;
}

.ui-pagination__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ui-pagination__total {
  font-size: 11.5px;
  color: var(--brand-muted-foreground);
  white-space: nowrap;
}

.ui-pagination__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ui-pagination__pages {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.ui-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-sm);
  background: transparent;
  color: var(--brand-muted-foreground);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease,
    box-shadow 0.15s ease;
}

.ui-pagination__btn:hover:not(:disabled):not(.is-active) {
  color: var(--brand-foreground);
  border-color: var(--brand-primary);
}

.ui-pagination__btn:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 1px;
}

.ui-pagination__btn.is-active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--brand-primary-foreground);
  font-weight: 700;
  box-shadow: var(--btn-glow-shadow);
}

[data-theme-style='ironcore'] .ui-pagination__btn.is-active {
  background: linear-gradient(180deg, var(--brand-primary-light), var(--brand-primary));
  border: 2px solid var(--brand-primary-dark);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ui-pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ui-pagination__nav {
  padding: 0 6px;
}

.ui-pagination__nav > svg {
  width: 14px;
  height: 14px;
}

.ui-pagination__ellipsis {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 18px;
  height: 30px;
  padding-bottom: 6px;
  color: var(--brand-muted-foreground);
  font-size: 12px;
  user-select: none;
}

.ui-pagination__size {
  width: 112px;
  flex-shrink: 0;
}

[data-theme-style='ironcore'] .ui-pagination__btn {
  border-radius: 6px;
}

[data-theme-style='ironcore'] .ui-pagination__btn.is-active {
  color: var(--brand-primary-foreground);
  box-shadow: 0 0 16px rgba(var(--brand-primary-rgb), 0.28);
}

/* ---------------- Table ---------------- */
.ui-table {
  position: relative;
  width: 100%;
  min-width: 0;
  border: var(--card-border-width, 1px) solid var(--brand-border);
  border-radius: var(--brand-radius-md);
  background: var(--brand-card);
  overflow: hidden;
}

[data-theme-style='ironcore'] .ui-table {
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.28);
}

.ui-table__scroll {
  width: 100%;
  overflow: auto;
  /* 只横向 contain：阻止触控板横向滑到边界时触发浏览器前进/后退。
     纵向不 contain——否则无 maxHeight 的表格会把滚轮吞掉，
     页面父容器无法滚动（"鼠标停在表格上滚轮没反应"）。 */
  overscroll-behavior-x: contain;
}

.ui-table__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.ui-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 16px;
  border-bottom: 1px solid var(--brand-border);
  background: color-mix(in srgb, var(--brand-card) 92%, var(--brand-muted));
  color: var(--brand-muted-foreground);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.ui-table td {
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-border) 72%, transparent);
  color: var(--brand-foreground);
  font-family: var(--font-body);
  font-size: 12.5px;
  vertical-align: middle;
}

.ui-table tbody tr:last-child td {
  border-bottom: none;
}

.ui-table--sm th {
  padding: 8px 12px;
  font-size: 10.5px;
}

.ui-table--sm td {
  padding: 8px 12px;
  font-size: 11.5px;
}

.ui-table--hover tbody tr:hover td {
  background: color-mix(in srgb, var(--brand-popover) 82%, transparent);
}

.ui-table--striped tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--brand-input) 42%, transparent);
}

.ui-table--hover.ui-table--striped tbody tr:nth-child(even):hover td {
  background: color-mix(in srgb, var(--brand-popover) 82%, transparent);
}

.ui-table th.is-left,
.ui-table td.is-left {
  text-align: left;
}

.ui-table th.is-center,
.ui-table td.is-center {
  text-align: center;
}

.ui-table th.is-right,
.ui-table td.is-right {
  text-align: right;
}

.ui-table td.is-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-table__cell-text {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.ui-table__sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition: color 0.15s ease;
}

.ui-table__sort:hover {
  color: var(--brand-foreground);
}

.ui-table__sort.is-active {
  color: var(--brand-primary);
}

.ui-table__sort-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.7;
}

.ui-table__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 44px 16px;
  color: var(--brand-muted-foreground);
  font-size: 12px;
}

.ui-table__empty > svg {
  width: 34px;
  height: 34px;
  opacity: 0.35;
}

.ui-table__loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: color-mix(in srgb, var(--brand-background) 58%, transparent);
  backdrop-filter: blur(1px);
  color: var(--brand-muted-foreground);
  font-size: 11.5px;
}

.ui-table__loading > svg {
  width: 24px;
  height: 24px;
  color: var(--brand-primary);
  animation: ui-spin 0.9s linear infinite;
}

.ui-table.is-clickable tbody tr {
  cursor: pointer;
}

/* ---------------- Modal ---------------- */
.ui-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ui-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

[data-theme-style='ironcore'] .ui-modal__backdrop {
  background: rgba(10, 10, 10, 0.72);
}

.ui-modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(86vh, 900px);
  border: var(--card-border-width, 1px) solid var(--brand-border);
  border-radius: var(--brand-radius-md);
  background: var(--brand-card);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  outline: none;
}

.ui-modal__panel--sm {
  max-width: 400px;
}

.ui-modal__panel--md {
  max-width: 560px;
}

.ui-modal__panel--lg {
  max-width: 760px;
}

.ui-modal__panel--xl {
  max-width: 980px;
}

.ui-modal__panel--full {
  max-width: 1200px;
}

[data-theme-style='ironcore'] .ui-modal__panel {
  border-width: 2px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35), 0 24px 64px rgba(0, 0, 0, 0.6);
}

[data-theme-style='ironcore'] .ui-modal__panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--brand-radius-md) var(--brand-radius-md) 0 0;
  background: repeating-linear-gradient(
    -45deg,
    var(--brand-primary),
    var(--brand-primary) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0.45;
  pointer-events: none;
}

.ui-modal__corner {
  position: absolute;
  display: none;
  pointer-events: none;
}

[data-theme-style='nexus'] .ui-modal__corner {
  display: block;
  width: 14px;
  height: 14px;
  border-color: var(--brand-primary);
}

[data-theme-style='nexus'] .ui-modal__corner--tl {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--brand-primary);
  border-left: 2px solid var(--brand-primary);
}

[data-theme-style='nexus'] .ui-modal__corner--tr {
  top: -1px;
  right: -1px;
  border-top: 2px solid var(--brand-primary);
  border-right: 2px solid var(--brand-primary);
}

[data-theme-style='nexus'] .ui-modal__corner--bl {
  bottom: -1px;
  left: -1px;
  border-bottom: 2px solid var(--brand-primary);
  border-left: 2px solid var(--brand-primary);
}

[data-theme-style='nexus'] .ui-modal__corner--br {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--brand-primary);
  border-right: 2px solid var(--brand-primary);
}

[data-theme-style='ironcore'] .ui-modal__corner {
  display: block;
  width: 8px;
  height: 8px;
  border: 1px solid var(--brand-border);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--brand-muted), var(--brand-border));
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.12);
}

[data-theme-style='ironcore'] .ui-modal__corner--tl {
  top: 6px;
  left: 6px;
}

[data-theme-style='ironcore'] .ui-modal__corner--tr {
  top: 6px;
  right: 6px;
}

[data-theme-style='ironcore'] .ui-modal__corner--bl {
  bottom: 6px;
  left: 6px;
}

[data-theme-style='ironcore'] .ui-modal__corner--br {
  bottom: 6px;
  right: 6px;
}

.ui-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--brand-border);
}

.ui-modal__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brand-primary);
}

.ui-modal__desc {
  margin-top: 4px;
  font-family: var(--font-body);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--brand-muted-foreground);
}

.ui-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: var(--brand-radius-sm);
  background: transparent;
  color: var(--brand-muted-foreground);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.ui-modal__close:hover {
  color: var(--brand-foreground);
  background: var(--brand-input);
}

.ui-modal__close:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 1px;
}

.ui-modal__close > svg {
  width: 15px;
  height: 15px;
}

.ui-modal__body {
  flex: 1;
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
}

.ui-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--brand-border);
}

.ui-modal-enter-active,
.ui-modal-leave-active {
  transition: opacity 0.18s ease;
}

.ui-modal-enter-active .ui-modal__panel,
.ui-modal-leave-active .ui-modal__panel {
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.ui-modal-enter-from,
.ui-modal-leave-to {
  opacity: 0;
}

.ui-modal-enter-from .ui-modal__panel,
.ui-modal-leave-to .ui-modal__panel {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
}

/* ---------------- Drawer ---------------- */
.ui-drawer {
  position: fixed;
  inset: 0;
  display: flex;
}

.ui-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

[data-theme-style='ironcore'] .ui-drawer__backdrop {
  background: rgba(10, 10, 10, 0.72);
}

.ui-drawer__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 480px);
  height: 100%;
  border: var(--card-border-width, 1px) solid var(--brand-border);
  background: var(--brand-card);
  box-shadow: 0 0 64px rgba(0, 0, 0, 0.55);
  outline: none;
}

.ui-drawer__panel--right {
  margin-left: auto;
}

.ui-drawer__panel--left {
  margin-right: auto;
}

.ui-drawer__panel--sm {
  width: min(100%, 380px);
}

.ui-drawer__panel--md {
  width: min(100%, 480px);
}

.ui-drawer__panel--lg {
  width: min(100%, 640px);
}

.ui-drawer__panel--xl {
  width: min(100%, 820px);
}

.ui-drawer__panel--full {
  width: 100%;
}

[data-theme-style='ironcore'] .ui-drawer__panel {
  border-width: 2px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 64px rgba(0, 0, 0, 0.6);
}

.ui-drawer__body {
  flex: 1;
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
}

.ui-drawer__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--brand-border);
}

.ui-drawer-right-enter-active,
.ui-drawer-right-leave-active,
.ui-drawer-left-enter-active,
.ui-drawer-left-leave-active {
  transition: opacity 0.2s ease;
}

.ui-drawer-right-enter-active .ui-drawer__panel,
.ui-drawer-right-leave-active .ui-drawer__panel,
.ui-drawer-left-enter-active .ui-drawer__panel,
.ui-drawer-left-leave-active .ui-drawer__panel {
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ui-drawer-right-enter-from,
.ui-drawer-right-leave-to,
.ui-drawer-left-enter-from,
.ui-drawer-left-leave-to {
  opacity: 0;
}

.ui-drawer-right-enter-from .ui-drawer__panel,
.ui-drawer-right-leave-to .ui-drawer__panel {
  transform: translateX(100%);
}

.ui-drawer-left-enter-from .ui-drawer__panel,
.ui-drawer-left-leave-to .ui-drawer__panel {
  transform: translateX(-100%);
}

/* ---------------- Message / Notification ---------------- */
.ui-message-host {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.ui-message {
  --ui-message-accent: var(--brand-primary);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px 12px 14px;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-md);
  background: var(--brand-popover);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  overflow: hidden;
}

.ui-message::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--ui-message-accent);
}

.ui-message--success {
  --ui-message-accent: var(--color-status-online);
}

.ui-message--error {
  --ui-message-accent: var(--color-status-error);
}

.ui-message--warning {
  --ui-message-accent: var(--color-status-warning);
}

.ui-message--info,
.ui-message--loading {
  --ui-message-accent: var(--brand-primary);
}

[data-theme-style='nexus'] .ui-message {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45),
    0 0 18px color-mix(in srgb, var(--ui-message-accent) 20%, transparent);
}

[data-theme-style='ironcore'] .ui-message {
  border: 2px solid var(--brand-border);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ui-message__icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--ui-message-accent);
}

.ui-message__icon.is-spinning {
  animation: ui-spin 0.9s linear infinite;
}

.ui-message__body {
  flex: 1;
  min-width: 0;
}

.ui-message__title {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--brand-foreground);
  word-break: break-word;
}

.ui-message__desc {
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--brand-muted-foreground);
  word-break: break-word;
}

.ui-message__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-muted-foreground);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.ui-message__close:hover {
  color: var(--brand-foreground);
  background: var(--brand-input);
}

.ui-message__close > svg {
  width: 12px;
  height: 12px;
}

.ui-message__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--ui-message-accent);
  opacity: 0.4;
  transform-origin: left center;
  animation: ui-message-progress var(--ui-message-duration, 3200ms) linear forwards;
}

.ui-message-enter-active,
.ui-message-leave-active {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.ui-message-enter-from,
.ui-message-leave-to {
  opacity: 0;
  transform: translateX(28px);
}

.ui-message-move {
  transition: transform 0.22s ease;
}

/* ---------------- Shared animations ---------------- */
@keyframes ui-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ui-message-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* ---------------- Tabs ---------------- */
.ui-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  border-bottom: 1px solid var(--brand-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.ui-tabs::-webkit-scrollbar {
  display: none;
}

.ui-tabs--stretch .ui-tabs__tab {
  flex: 1;
  justify-content: center;
}

.ui-tabs__tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--brand-muted-foreground);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.ui-tabs__tab::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--brand-primary);
  transform: scaleX(0);
  transition: transform 0.18s ease;
}

.ui-tabs__tab:hover:not(.is-disabled):not(.is-active) {
  color: var(--brand-foreground);
}

.ui-tabs__tab.is-active {
  color: var(--brand-primary);
}

.ui-tabs__tab.is-active::after {
  transform: scaleX(1);
}

.ui-tabs__tab.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ui-tabs__tab:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: -2px;
}

.ui-tabs__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--brand-primary) 18%, transparent);
  color: var(--brand-primary);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
}

.ui-tabs--sm .ui-tabs__tab {
  padding: 7px 10px;
  font-size: 11.5px;
}

[data-theme-style='ironcore'] .ui-tabs {
  gap: 0;
}

[data-theme-style='ironcore'] .ui-tabs__tab {
  letter-spacing: 0.04em;
}

/* ---------------- Steps ---------------- */
.ui-steps {
  display: flex;
  align-items: flex-start;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ui-steps__item {
  position: relative;
  display: flex;
  flex: 1;
  align-items: flex-start;
  min-width: 0;
}

.ui-steps__inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  font-family: var(--font-body);
}

.ui-steps__inner:disabled {
  cursor: default;
}

.ui-steps.is-clickable .ui-steps__inner {
  cursor: pointer;
}

.ui-steps__marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: 1px solid var(--brand-border);
  border-radius: 50%;
  background: var(--brand-input);
  color: var(--brand-muted-foreground);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    box-shadow 0.18s ease;
}

.ui-steps__check {
  width: 13px;
  height: 13px;
}

.ui-steps__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 2px;
}

.ui-steps__title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--brand-muted-foreground);
  transition: color 0.18s ease;
}

.ui-steps__desc {
  font-size: 11px;
  line-height: 1.5;
  color: var(--brand-muted-foreground);
  opacity: 0.8;
}

.ui-steps__line {
  flex: 1;
  min-width: 16px;
  height: 1px;
  margin: 13px 12px 0;
  background: var(--brand-border);
}

.ui-steps__item.is-active .ui-steps__marker {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: var(--brand-primary-foreground);
  box-shadow: 0 0 12px var(--color-glow-primary);
}

.ui-steps__item.is-active .ui-steps__title {
  color: var(--brand-primary);
}

.ui-steps__item.is-done .ui-steps__marker {
  border-color: color-mix(in srgb, var(--brand-primary) 55%, var(--brand-border));
  background: color-mix(in srgb, var(--brand-primary) 16%, transparent);
  color: var(--brand-primary);
}

.ui-steps__item.is-done .ui-steps__title {
  color: var(--brand-foreground);
}

.ui-steps__item.is-done .ui-steps__line {
  background: color-mix(in srgb, var(--brand-primary) 45%, var(--brand-border));
}

.ui-steps--sm .ui-steps__marker {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

[data-theme-style='ironcore'] .ui-steps__marker {
  border-radius: 3px;
}

/* ---------------- Tag ---------------- */
.ui-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--brand-border);
  border-radius: 9999px;
  background: color-mix(in srgb, var(--brand-muted) 55%, transparent);
  color: var(--brand-muted-foreground);
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.ui-tag--sm {
  padding: 1px 6px;
  font-size: 10px;
}

.ui-tag--mono {
  font-family: var(--font-mono, var(--font-display));
  letter-spacing: 0.02em;
}

.ui-tag--primary {
  border-color: color-mix(in srgb, var(--brand-primary) 38%, transparent);
  background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  color: var(--brand-primary);
}

.ui-tag--success {
  border-color: color-mix(in srgb, var(--color-status-online) 38%, transparent);
  background: color-mix(in srgb, var(--color-status-online) 12%, transparent);
  color: var(--color-status-online);
}

.ui-tag--warning {
  border-color: color-mix(in srgb, var(--color-status-warning) 42%, transparent);
  background: color-mix(in srgb, var(--color-status-warning) 12%, transparent);
  color: var(--color-status-warning);
}

.ui-tag--danger {
  border-color: color-mix(in srgb, var(--color-status-error) 42%, transparent);
  background: color-mix(in srgb, var(--color-status-error) 12%, transparent);
  color: var(--color-status-error);
}

.ui-tag__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

[data-theme-style='ironcore'] .ui-tag {
  border-radius: 2px;
  letter-spacing: 0.03em;
}

/* ---------------- Spin ---------------- */
.ui-spin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--brand-primary);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.ui-spin__icon {
  width: 18px;
  height: 18px;
  animation: ui-spin 0.9s linear infinite;
}

.ui-spin__label {
  color: var(--brand-muted-foreground);
}

.ui-spin-box {
  position: relative;
}

.ui-spin-box__mask {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: color-mix(in srgb, var(--brand-background) 45%, transparent);
  backdrop-filter: blur(1px);
}

.ui-spin-box--sm .ui-spin__icon {
  width: 14px;
  height: 14px;
}

.ui-spin-box--lg .ui-spin__icon {
  width: 24px;
  height: 24px;
}

/* ---------------- Checkbox ---------------- */
.ui-checkbox {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-family: var(--font-body);
  cursor: pointer;
  user-select: none;
}

.ui-checkbox__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.ui-checkbox__box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 1px solid var(--brand-border);
  border-radius: 3px;
  background: var(--brand-input);
  color: var(--brand-primary-foreground);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.ui-checkbox__icon {
  width: 11px;
  height: 11px;
}

.ui-checkbox.is-checked .ui-checkbox__box,
.ui-checkbox.is-indeterminate .ui-checkbox__box {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  box-shadow: 0 0 8px var(--color-glow-primary);
}

.ui-checkbox__input:focus-visible + .ui-checkbox__box {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
}

.ui-checkbox__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ui-checkbox__label {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--brand-foreground);
}

.ui-checkbox__desc {
  font-size: 11px;
  line-height: 1.5;
  color: var(--brand-muted-foreground);
}

.ui-checkbox.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ui-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.ui-checkbox-group--vertical {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.ui-checkbox-group.has-columns {
  display: grid;
  gap: 10px 16px;
}

[data-theme-style='ironcore'] .ui-checkbox__box {
  border-radius: 2px;
}

/* ---------------- Switch ---------------- */
.ui-switch {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 40px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--brand-border);
  border-radius: 9999px;
  background: var(--brand-muted);
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ui-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: var(--brand-primary-foreground);
  transition: transform 0.2s ease, background 0.2s ease;
}

.ui-switch.is-on {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  box-shadow: 0 0 10px var(--color-glow-primary);
}

.ui-switch.is-on .ui-switch__thumb {
  transform: translateX(18px);
  background: var(--brand-primary-foreground);
}

.ui-switch:not(.is-disabled):hover {
  border-color: var(--brand-primary);
}

.ui-switch:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
}

.ui-switch.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-theme-style='ironcore'] .ui-switch {
  width: 42px;
  border-radius: 2px;
}

[data-theme-style='ironcore'] .ui-switch__thumb {
  border-radius: 1px;
}

[data-theme-style='ironcore'] .ui-switch.is-on .ui-switch__thumb {
  transform: translateX(20px);
}

@media (max-width: 640px) {
  .ui-message-host {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .ui-modal {
    padding: 10px;
  }

  .ui-pagination {
    justify-content: center;
  }

  .ui-pagination__controls {
    justify-content: center;
  }

  .ui-table th,
  .ui-table td {
    padding: 9px 12px;
  }

  .ui-steps__desc {
    display: none;
  }

  .ui-steps__line {
    min-width: 8px;
    margin-left: 6px;
    margin-right: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ui-message__progress {
    animation: none;
  }

  .ui-message-enter-active,
  .ui-message-leave-active,
  .ui-modal-enter-active,
  .ui-modal-leave-active,
  .ui-drawer-right-enter-active,
  .ui-drawer-right-leave-active,
  .ui-drawer-left-enter-active,
  .ui-drawer-left-leave-active,
  .ui-pop-enter-active,
  .ui-pop-leave-active {
    transition-duration: 0.01ms;
  }

  .ui-btn__spinner,
  .ui-message__icon.is-spinning,
  .ui-table__loading > svg,
  .ui-spin__icon {
    animation-duration: 2s;
  }
}
