/* ============================================================
   MtAir — Components layer (ported to Radix Primitives)
   Visual recipes kept 1:1 from the Claude Design bundle; state
   hooks rewired from .is-* classes to Radix data-attributes
   ([data-state], [data-highlighted], [data-disabled]).
   ============================================================ */

@keyframes mta-pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes mta-scale-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes mta-scale-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}
@keyframes mta-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes mta-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ---------- BUTTONS ---------- */
.mta-btn {
  font-family: var(--mta-font-sans);
  font-size: var(--ctl-font);
  font-weight: var(--w-medium);
  line-height: 1;
  letter-spacing: -0.005em;
  padding: var(--ctl-pad-y) var(--ctl-pad-x);
  border-radius: var(--r-md);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  background: var(--color-control);
  transition:
    background var(--dur-quick) var(--ease-out),
    border-color var(--dur-quick) var(--ease-out),
    box-shadow var(--dur-quick) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
}
.mta-btn:hover {
  background: var(--color-control-hover);
}
.mta-btn:active {
  transform: scale(0.97);
}
.mta-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.mta-btn[disabled],
.mta-btn.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}
.mta-btn .ph {
  font-size: 1.05em;
  display: inline-flex;
}

.mta-btn--primary {
  color: var(--color-text-on-primary);
  background: var(--color-accent);
  border-color: transparent;
}
.mta-btn--primary:hover {
  background: var(--color-accent-hover);
}
.mta-btn--primary:focus-visible {
  box-shadow: var(--focus-ring);
}

.mta-btn--ember {
  color: #fff;
  background: var(--color-error);
  border-color: transparent;
}
.mta-btn--ember:hover {
  background: var(--mta-red-600);
}
.mta-btn--ember:focus-visible {
  box-shadow: var(--focus-ring-ember);
}

.mta-btn--ghost {
  color: var(--color-text-secondary);
  background: transparent;
  border-color: transparent;
}
.mta-btn--ghost:hover {
  background: var(--color-control);
  color: var(--color-text-primary);
}

.mta-btn--sm {
  font-size: 13px;
  padding: 0 12px;
  height: 30px;
  gap: 5px;
}
.mta-btn--icon {
  padding: var(--ctl-pad-y);
  width: calc(var(--ctl-font) + 2 * var(--ctl-pad-y));
  aspect-ratio: 1;
}

/* ---------- TEXT FIELDS ---------- */
.mta-field {
  width: 100%;
  font-family: var(--mta-font-sans);
  font-size: var(--ctl-font);
  font-weight: var(--mta-font-weight-regular);
  color: var(--color-text-primary);
  padding: var(--field-pad-y) var(--field-pad-x);
  border-radius: var(--r-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-strong);
  outline: none;
  transition:
    box-shadow var(--dur-quick) var(--ease-out),
    border-color var(--dur-quick) var(--ease-out);
}
.mta-field::placeholder {
  color: var(--color-text-muted);
}
.mta-field:focus {
  border-color: var(--color-border-focus);
  box-shadow: var(--focus-ring);
}
.mta-field[disabled] {
  color: var(--color-text-disabled);
  background: var(--color-bg-muted);
  cursor: not-allowed;
}
textarea.mta-field {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}

.mta-search {
  position: relative;
  display: flex;
  align-items: center;
}
.mta-search .ph {
  position: absolute;
  left: 11px;
  color: var(--color-text-muted);
  font-size: 16px;
  pointer-events: none;
  display: inline-flex;
}
.mta-search .mta-field {
  padding-left: 34px;
}

/* ---------- TYPING ANIMATION (osu!-lazer style char in/out) ---------- */
/* The real field renders transparent over a mirrored per-letter overlay. */
.mta-field-wrap {
  position: relative;
  width: 100%;
}
.mta-search .mta-field-wrap {
  width: 100%;
}
.mta-field--animated {
  color: transparent;
  caret-color: var(--color-text-primary);
}
.mta-field--animated::placeholder {
  color: var(--color-text-muted);
}

.mta-field-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  /* transparent border mirrors the field's 1px border so content aligns */
  border: 1px solid transparent;
  padding: var(--field-pad-y) var(--field-pad-x);
  font-family: var(--mta-font-sans);
  font-size: var(--ctl-font);
  line-height: normal;
  color: var(--color-text-primary);
  white-space: pre;
  text-align: left;
  will-change: transform;
}
.mta-field-overlay--multiline {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  line-height: 1.5;
}
.mta-search .mta-field-overlay {
  padding-left: 34px;
}

.mta-field-char {
  /* inline (not inline-block) so the overlay wraps exactly like the field;
     inherit white-space so multiline (pre-wrap) wraps while input (pre) won't.
     'pre' on the span itself would suppress wrapping at its boundaries.
     Multiline keeps this inline path: inline boxes ignore transform, so the
     rise eases `top` (a layout property — acceptable here, textarea wraps
     instead of scrolling so there's no per-keystroke scroll-sync thrash). */
  position: relative;
  white-space: inherit;
  animation: mta-char-in var(--dur-base) var(--ease-snap) both;
}
/* Single-line never wraps, so chars can be inline-block and animate
   `transform` (compositor-only) instead of `top` (relayout every frame).
   The single-line field scrolls horizontally and syncs the overlay each
   keystroke, so the layout-triggering `top` path janked there — this doesn't. */
.mta-field-char--composited {
  display: inline-block;
  will-change: transform, opacity;
  animation-name: mta-char-in-rise;
}
.mta-field-char--leaving {
  display: inline-block;
  position: absolute;
  white-space: pre;
  animation: mta-char-out var(--dur-base) var(--ease-out) forwards;
}

/* inline elements ignore transform, so the rise uses top instead */
@keyframes mta-char-in {
  from {
    opacity: 0;
    top: -0.32em;
  }
  to {
    opacity: 1;
    top: 0;
  }
}
/* inline-block (single-line) variant — composited transform, no relayout */
@keyframes mta-char-in-rise {
  from {
    opacity: 0;
    transform: translateY(-0.32em);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes mta-char-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(0.7em) scale(0.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mta-field-char {
    animation: none;
  }
  .mta-field-char--leaving {
    animation: mta-char-out 1ms linear forwards;
  }
}

/* ---------- SELECT (Radix Select) ---------- */
.mta-select {
  font-family: var(--mta-font-sans);
  font-size: var(--mta-font-size-sm);
  font-weight: var(--w-medium);
  color: var(--color-text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: var(--field-pad-y) 12px var(--field-pad-y) var(--field-pad-x);
  border-radius: var(--r-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  outline: none;
  transition:
    border-color var(--dur-quick) var(--ease-out),
    box-shadow var(--dur-quick) var(--ease-out);
}
.mta-select:hover {
  border-color: var(--color-border-strong);
}
.mta-select:focus-visible,
.mta-select[data-state='open'] {
  border-color: var(--color-border-focus);
  box-shadow: var(--focus-ring);
}
.mta-select[data-placeholder] {
  color: var(--color-text-muted);
}
.mta-select__icon {
  color: var(--color-text-muted);
  display: inline-flex;
  margin-left: auto;
}
.mta-select__content {
  min-width: var(--radix-select-trigger-width);
  padding: 6px;
  border-radius: var(--r-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  box-shadow: var(--mta-shadow-lg);
  z-index: 50;
  transform-origin: var(--radix-select-content-transform-origin);
}
/* slide out of the trigger: grows from the radix transform-origin while
   sliding in from the open side. Symmetric, token-driven exit. */
.mta-select__content[data-side='bottom'] {
  --sel-from-y: -6px;
}
.mta-select__content[data-side='top'] {
  --sel-from-y: 6px;
}
.mta-select__content[data-side='left'],
.mta-select__content[data-side='right'] {
  --sel-from-y: 0px;
}
.mta-select__content[data-state='open'] {
  animation: mta-select-in var(--dur-base) var(--ease-snap);
}
.mta-select__content[data-state='closed'] {
  animation: mta-select-out var(--dur-quick) var(--ease-out);
}
@keyframes mta-select-in {
  from {
    opacity: 0;
    transform: translateY(var(--sel-from-y, -6px)) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes mta-select-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(var(--sel-from-y, -6px)) scale(0.96);
  }
}
@media (prefers-reduced-motion: reduce) {
  .mta-select__content[data-state='open'],
  .mta-select__content[data-state='closed'] {
    animation: mta-fade-in var(--dur-quick) var(--ease-out);
  }
}
.mta-select__item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: var(--mta-font-size-sm);
  font-weight: var(--w-medium);
  color: var(--color-text-primary);
  cursor: pointer;
  outline: none;
  user-select: none;
}
.mta-select__item[data-highlighted] {
  background: var(--color-control);
}
.mta-select__item-indicator {
  margin-left: auto;
  display: inline-flex;
  color: var(--color-accent);
}

/* ---------- SWITCH ---------- */
.mta-switch {
  position: relative;
  width: var(--switch-w);
  height: var(--switch-h);
  flex-shrink: 0;
  border-radius: var(--r-pill);
  padding: 0;
  border: 1px solid var(--color-border-strong);
  background: var(--color-border-strong);
  cursor: pointer;
  transition:
    background var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}
.mta-switch__thumb {
  display: block;
  position: absolute;
  top: 50%;
  left: var(--switch-gap);
  transform: translateY(-50%);
  width: var(--switch-knob);
  height: var(--switch-knob);
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(24, 20, 12, 0.28),
    0 1px 1px rgba(24, 20, 12, 0.16);
  transition:
    left var(--dur-base) var(--ease-snap),
    background var(--dur-base) var(--ease-out);
}
.mta-switch[data-state='checked'] {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.mta-switch[data-state='checked'] .mta-switch__thumb {
  left: calc(100% - var(--switch-knob) - var(--switch-gap));
}
.mta-switch:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- CHECKBOX ---------- */
.mta-check {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  padding: 0;
  background: var(--color-bg-card);
  border: 1.5px solid var(--color-border-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--dur-quick) var(--ease-out),
    border-color var(--dur-quick) var(--ease-out);
}
.mta-check[data-state='checked'] {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.mta-check__indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mta-pop var(--dur-quick) var(--ease-snap);
}
.mta-check__indicator svg {
  width: 12px;
  height: 12px;
  display: block;
}
.mta-check:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- RADIO ---------- */
.mta-radio {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 0;
  background: var(--color-bg-card);
  border: 1.5px solid var(--color-border-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-quick) var(--ease-out);
}
.mta-radio[data-state='checked'] {
  border-color: var(--color-accent);
}
.mta-radio__indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.mta-radio__indicator::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: mta-pop var(--dur-quick) var(--ease-snap);
}
.mta-radio:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* control + label row helper */
.mta-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--color-text-secondary);
  cursor: pointer;
}

/* ---------- SEGMENTED CONTROL (Radix ToggleGroup) ---------- */
.mta-seg {
  position: relative;
  display: inline-flex;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.mta-seg__thumb {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  background: var(--color-bg-card);
  border-radius: var(--r-sm);
  box-shadow: var(--mta-shadow-sm);
  pointer-events: none;
  transition:
    transform var(--dur-quick) var(--ease-out),
    width var(--dur-quick) var(--ease-out);
  will-change: transform, width;
}
.mta-seg__item {
  position: relative;
  z-index: 1;
  font-family: var(--mta-font-sans);
  font-size: var(--mta-font-size-sm);
  font-weight: var(--mta-font-weight-medium);
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  padding: var(--seg-pad-y) 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur-quick);
}
.mta-seg__item:hover {
  color: var(--color-text-primary);
}
.mta-seg__item[data-state='on'] {
  color: var(--color-text-primary);
}

/* ---------- SLIDER ---------- */
.mta-slider {
  --ms-thumb: 20px;
  --ms-thumb-w: var(--ms-thumb);
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--ms-thumb);
  user-select: none;
  touch-action: none;
}
.mta-slider__track {
  position: relative;
  flex-grow: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--color-bg-muted);
}
.mta-slider__range {
  position: absolute;
  height: 100%;
  border-radius: 3px;
  background: var(--color-accent);
}
/* Radix positions the range via left/right offsets (not width); ease those
   so the fill glides between discrete steps while dragging. */
.mta-slider--animated .mta-slider__range {
  transition:
    left 0.12s ease-out,
    right 0.12s ease-out;
}
.mta-slider__thumb {
  display: block;
  width: var(--ms-thumb-w);
  height: var(--ms-thumb);
  border-radius: 4px;
  background: #fff;
  border: 1.5px solid var(--color-border-strong);
  box-shadow: var(--mta-shadow-sm);
  cursor: pointer;
  outline: none;
}
/* Radix sets the step position (left) on a WRAPPER span around the thumb, not on
   the thumb element itself — so the transition must live on that wrapper. The
   wrapper is the slider's direct child span that isn't the track. */
.mta-slider--animated > span:not(.mta-slider__track) {
  transition: left 0.12s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .mta-slider--animated > span:not(.mta-slider__track),
  .mta-slider--animated .mta-slider__range {
    transition: none;
  }
}
.mta-slider--knob-square .mta-slider__thumb {
  --ms-thumb-w: 14px;
}
.mta-slider--knob-round .mta-slider__thumb {
  --ms-thumb-w: var(--ms-thumb);
  border-radius: 50%;
}
.mta-slider__thumb:focus-visible {
  border-color: var(--color-border-focus);
  box-shadow: var(--mta-shadow-sm), var(--focus-ring);
}

/* Notches sit OUTSIDE the bar, anchored to the track edges. Horizontal position tracks
   the thumb centre: it travels from thumb-radius to (width - radius). Reserve layout
   room with padding so ticks/labels never collide with neighbours. */
.mta-slider--notch-top {
  padding-top: 14px;
}
.mta-slider--notch-bottom {
  padding-bottom: 14px;
}
.mta-slider--has-labels {
  padding-bottom: 18px;
}
.mta-slider--notch-bottom.mta-slider--has-labels {
  padding-bottom: 30px;
}

.mta-slider__notches {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  pointer-events: none;
}
.mta-slider__notches--top {
  bottom: calc(100% + 7px);
}
.mta-slider__notches--bottom {
  top: calc(100% + 7px);
}
.mta-slider__notch {
  position: absolute;
  left: calc(var(--ms-thumb) / 2 + (100% - var(--ms-thumb)) * var(--p));
  width: 3px;
  height: 3px;
  border-radius: 99px;
  background: var(--color-border-strong);
  transform: translateX(-50%);
}
.mta-slider__notches--top .mta-slider__notch {
  bottom: 0;
}
.mta-slider__notches--bottom .mta-slider__notch {
  top: 0;
}

.mta-slider__labels {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  pointer-events: none;
}
.mta-slider--notch-bottom .mta-slider__labels {
  top: calc(100% + 18px);
}
.mta-slider__label {
  position: absolute;
  left: calc(var(--ms-thumb) / 2 + (100% - var(--ms-thumb)) * var(--p));
  transform: translateX(-50%);
  font-family: var(--mta-font-mono);
  font-size: 10px;
  line-height: 1;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ---------- STEPPER ---------- */
.mta-stepper {
  display: inline-flex;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
}
.mta-stepper button {
  font-family: var(--mta-font-mono);
  font-size: 16px;
  font-weight: var(--mta-font-weight-semibold);
  color: var(--color-text-primary);
  background: var(--color-control);
  border: none;
  width: 34px;
  height: var(--stepper-h);
  cursor: pointer;
  transition: background var(--dur-quick);
}
.mta-stepper button:hover {
  background: var(--color-control-hover);
}
.mta-stepper button:active {
  background: var(--color-control-hover);
}
.mta-stepper button:first-child {
  border-right: 1px solid var(--color-border-strong);
}

/* ---------- BADGES / CHIPS / TAGS ---------- */
.mta-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mta-font-sans);
  font-size: 12px;
  font-weight: var(--w-medium);
  line-height: 1;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  letter-spacing: 0.005em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.mta-badge--lime {
  color: var(--color-success-text);
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
}
.mta-badge--ember {
  color: var(--color-error-text);
  background: var(--color-error-bg);
  border-color: var(--color-error-border);
}
.mta-badge--neutral {
  color: var(--color-text-secondary);
  background: var(--color-control);
  border-color: var(--color-border);
}
.mta-badge--outline {
  color: var(--color-text-secondary);
  background: transparent;
  border-color: var(--color-border-strong);
}
.mta-badge--dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.mta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: var(--w-medium);
  color: var(--color-text-primary);
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--color-control);
  border: 1px solid var(--color-border);
}
.mta-chip .x {
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
}
.mta-chip .x:hover {
  color: var(--color-text-primary);
}

/* ---------- CARD ---------- */
.mta-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--mta-space-4) var(--mta-space-5);
}

/* ---------- LIST ROWS ---------- */
.mta-list {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--mta-shadow-sm);
  overflow: hidden;
}
.mta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  cursor: default;
  font-size: 14px;
  color: var(--color-text-primary);
}
.mta-row:last-child {
  border-bottom: none;
}
.mta-row:hover {
  background: var(--color-control);
}
.mta-row.is-selected {
  background: var(--color-accent-subtle);
}
.mta-row .nm {
  font-size: 14px;
  font-weight: var(--mta-font-weight-medium);
  color: var(--color-text-primary);
  white-space: nowrap;
}
.mta-row .meta {
  margin-left: auto;
  font-family: var(--mta-font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ---------- MENU / POPOVER (Radix DropdownMenu) ---------- */
.mta-menu {
  min-width: 208px;
  padding: 6px;
  border-radius: var(--r-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  box-shadow: var(--mta-shadow-lg);
  z-index: 50;
  transform-origin: var(--radix-dropdown-menu-content-transform-origin);
}
.mta-menu[data-state='open'] {
  animation: mta-scale-in var(--dur-base) var(--ease-out);
}
.mta-menu[data-state='closed'] {
  animation: mta-scale-out var(--dur-quick) var(--ease-out);
}
.mta-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: var(--mta-font-size-sm);
  font-weight: var(--w-medium);
  color: var(--color-text-primary);
  cursor: pointer;
  outline: none;
  user-select: none;
}
.mta-menu-item .ph {
  font-size: 16px;
  color: var(--color-text-muted);
  display: inline-flex;
}
.mta-menu-item .sc {
  margin-left: auto;
  font-family: var(--mta-font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
}
.mta-menu-item[data-highlighted] {
  background: var(--color-control);
}
.mta-menu-sep {
  height: 1px;
  background: var(--color-border-subtle);
  margin: 5px 4px;
}

/* ---------- TABS (Radix Tabs) ---------- */
.mta-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--color-border);
}
.mta-tabs__trigger {
  font-family: var(--mta-font-sans);
  font-size: var(--mta-font-size-sm);
  font-weight: var(--mta-font-weight-semibold);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  padding: 9px 14px;
  cursor: pointer;
  position: relative;
  transition: color var(--dur-quick);
}
.mta-tabs__trigger:hover {
  color: var(--color-text-secondary);
}
.mta-tabs__trigger[data-state='active'] {
  color: var(--color-text-primary);
}
.mta-tabs__trigger[data-state='active']::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-accent);
}

/* ---------- PROGRESS (Radix Progress) ---------- */
.mta-progress {
  width: 100%;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--color-bg-muted);
  overflow: hidden;
}
.mta-progress__indicator {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--color-accent);
  transition: width var(--dur-base) var(--ease-out);
}

/* ---------- TOOLTIP (Radix Tooltip) ---------- */
.mta-tooltip {
  display: inline-flex;
  align-items: center;
  font-size: var(--mta-font-size-xs);
  font-weight: var(--mta-font-weight-medium);
  color: var(--color-text-inverse);
  padding: 5px 9px;
  border-radius: var(--r-sm);
  background: var(--mta-neutral-900);
  box-shadow: var(--mta-shadow-md);
  z-index: 60;
  transform-origin: var(--radix-tooltip-content-transform-origin);
}
[data-theme='dark'] .mta-tooltip {
  background: var(--mta-surface-dark-3);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}
.mta-tooltip[data-state='delayed-open'],
.mta-tooltip[data-state='instant-open'] {
  animation: mta-scale-in var(--dur-base) var(--ease-out);
}
.mta-tooltip[data-state='closed'] {
  animation: mta-fade-out var(--dur-quick) var(--ease-out);
}

/* ---------- ICON BUTTON ----------
   Square tactile key. Reuses the .mta-btn engine; variants below
   just recolor. Pair with .mta-btn / .mta-btn--primary etc. */
.mta-iconbtn {
  padding: 0;
  width: 32px;
  height: 32px;
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mta-iconbtn--sm {
  width: 26px;
  height: 26px;
}
.mta-iconbtn--lg {
  width: 38px;
  height: 38px;
}

/* ---------- SPINNER ----------
   A flat ring track with an accent-colored arc spinning in place.
   CSS sizes the box and drives the rotation. Honors reduced motion. */
.mta-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 0;
}
.mta-spinner--sm {
  width: 16px;
  height: 16px;
}
.mta-spinner--lg {
  width: 34px;
  height: 34px;
}
.mta-spinner svg {
  width: 100%;
  height: 100%;
  display: block;
}
.mta-spinner__arc {
  transform-origin: center;
  animation: mta-spin 0.7s linear infinite;
}
@keyframes mta-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .mta-spinner__arc {
    animation-duration: 1.8s;
  }
}

/* ---------- CALLOUT ----------
   Soft semantic surface with a flat icon chip. Variants reuse the
   semantic --color-*-bg / --color-*-border tokens. */
.mta-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--r-lg);
  border: 1px solid var(--color-accent-muted);
  background: var(--info-bg);
  color: var(--color-text-primary);
}
.mta-callout__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  color: var(--info);
}
.mta-callout__body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  padding-top: 3px;
}
.mta-callout__body strong {
  color: var(--color-text-primary);
  font-weight: var(--mta-font-weight-semibold);
}
.mta-callout--success {
  background: var(--success-bg);
  border-color: var(--color-success-border);
}
.mta-callout--success .mta-callout__icon {
  color: var(--success);
}
.mta-callout--warning {
  background: var(--warning-bg);
  border-color: var(--color-warning-border);
}
.mta-callout--warning .mta-callout__icon {
  color: var(--warning);
}
.mta-callout--danger {
  background: var(--danger-bg);
  border-color: var(--color-error-border);
}
.mta-callout--danger .mta-callout__icon {
  color: var(--danger);
}

/* ---------- TABLE ----------
   The list-row aesthetic stretched to columns: hairline grid, subtle
   header strip, mono numerals, calm row selection. */
.mta-table-wrap {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--mta-shadow-sm);
  overflow: hidden;
}
.mta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.mta-table thead th {
  text-align: left;
  font-family: var(--mta-font-sans);
  font-size: 11px;
  font-weight: var(--mta-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-muted);
  padding: 9px 14px;
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border-strong);
  white-space: nowrap;
}
.mta-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
  vertical-align: middle;
}
.mta-table tbody tr:last-child td {
  border-bottom: none;
}
.mta-table tbody tr:hover td {
  background: var(--color-control);
}
.mta-table tbody tr.is-selected td {
  background: var(--color-accent-subtle);
}
.mta-table .num {
  font-family: var(--mta-font-mono);
  font-size: 12px;
  color: var(--color-text-secondary);
  text-align: right;
}
.mta-table .muted {
  color: var(--color-text-muted);
}

/* ---------- SCROLL AREA (Radix) ---------- */
.mta-scroll {
  overflow: hidden;
}
.mta-scroll__viewport {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}
.mta-scroll__bar {
  display: flex;
  user-select: none;
  touch-action: none;
  padding: 2px;
  background: transparent;
  transition: background var(--dur-base) var(--ease-out);
}
.mta-scroll__bar[data-orientation='vertical'] {
  width: 10px;
}
.mta-scroll__bar[data-orientation='horizontal'] {
  flex-direction: column;
  height: 10px;
}
.mta-scroll:hover .mta-scroll__bar {
  background: var(--color-bg-muted);
}
.mta-scroll__thumb {
  flex: 1;
  background: var(--color-border-strong);
  border-radius: var(--r-pill);
  position: relative;
}
.mta-scroll__thumb:hover {
  background: var(--color-text-disabled);
}
.mta-scroll__thumb::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  min-width: 44px;
  min-height: 44px;
}

/* ---------- DIALOG / MODAL (Radix Dialog + AlertDialog) ----------
   A calm floating sheet on a soft scrim. */
.mta-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--color-bg-overlay);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.mta-overlay[data-state='open'] {
  animation: mta-fade-in var(--dur-base) var(--ease-out);
}
.mta-overlay[data-state='closed'] {
  animation: mta-fade-out var(--dur-quick) var(--ease-out);
}
.mta-dialog {
  position: fixed;
  z-index: 81;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: min(92vw, 460px);
  max-height: 85vh;
  overflow: auto;
  border-radius: var(--r-xl);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  box-shadow: var(--mta-shadow-modal);
  padding: 22px 22px 20px;
  transform-origin: center;
  font-family: var(--mta-font-sans);
  color: var(--color-text-primary);
}
.mta-dialog[data-state='open'] {
  animation: mta-scale-in var(--dur-base) var(--ease-out);
}
.mta-dialog[data-state='closed'] {
  animation: mta-scale-out var(--dur-quick) var(--ease-out);
}
.mta-dialog__title {
  font-family: var(--mta-font-sans);
  font-size: var(--text-lg);
  font-weight: var(--mta-font-weight-semibold);
  color: var(--color-text-primary);
  letter-spacing: var(--track-snug);
}
.mta-dialog__desc {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text-secondary);
}
.mta-dialog__body {
  margin-top: 16px;
}
.mta-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}
.mta-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
}

