/* Native controls, scoped to the mt- namespace; import theme.css first. */
.mt-button,
.mt-link,
.mt-field,
.mt-input,
.mt-textarea,
.mt-checkbox,
.mt-alert {
  box-sizing: border-box;
  color-scheme: var(--mt-color-scheme);
  font-family: var(--mt-font-family);
  font-size: var(--mt-font-size-body);
  line-height: var(--mt-line-height-body);
}

.mt-button {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: var(--mt-space-2);
  min-block-size: 2.75rem;
  max-inline-size: 100%;
  padding: var(--mt-space-2) var(--mt-space-4);
  border: var(--mt-border-width) solid;
  border-radius: var(--mt-radius-control);
  font-weight: var(--mt-font-weight-semibold);
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 1px 2px
    color-mix(in srgb, var(--mt-shadow-color) 6%, transparent);
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}
.mt-button:hover:not(:disabled) {
  box-shadow: 0 2px 4px
    color-mix(in srgb, var(--mt-shadow-color) 10%, transparent);
}
.mt-button:active:not(:disabled) {
  box-shadow: inset 0 1px 2px
    color-mix(in srgb, var(--mt-shadow-color) 12%, transparent);
}
.mt-button--primary {
  color: var(--mt-action-primary-fg);
  background: var(--mt-action-primary-bg);
  border-color: var(--mt-action-primary-border);
}
.mt-button--primary:hover:not(:disabled) {
  background: var(--mt-action-primary-bg-hover);
}
.mt-button--primary:active:not(:disabled) {
  background: var(--mt-action-primary-bg-pressed);
}
.mt-button--secondary {
  color: var(--mt-action-secondary-fg);
  background: var(--mt-action-secondary-bg);
  border-color: var(--mt-action-secondary-border);
}
.mt-button--secondary:hover:not(:disabled) {
  background: var(--mt-action-secondary-bg-hover);
}
.mt-button--secondary:active:not(:disabled) {
  background: var(--mt-action-secondary-bg-pressed);
}
.mt-button:disabled {
  color: var(--mt-disabled-fg);
  background: var(--mt-disabled-bg);
  border-color: var(--mt-disabled-border);
  cursor: not-allowed;
  box-shadow: none;
}
.mt-button[aria-busy="true"] {
  cursor: progress;
}
.mt-button__spinner {
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-block;
  inline-size: 1em;
  block-size: 1em;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: mt-spin 0.85s linear infinite;
}
@keyframes mt-spin {
  to {
    transform: rotate(360deg);
  }
}

.mt-link {
  color: var(--mt-link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}
.mt-link:visited {
  color: var(--mt-link-visited);
}
.mt-link:hover {
  color: var(--mt-link-hover);
  text-decoration-thickness: 0.14em;
}
.mt-link--standalone {
  display: inline-flex;
  align-items: center;
  min-block-size: 2.75rem;
}

.mt-button:focus-visible,
.mt-link:focus-visible,
.mt-input:focus-visible,
.mt-textarea:focus-visible,
.mt-checkbox__input:focus-visible {
  outline: var(--mt-focus-width) solid var(--mt-focus-ring);
  outline-offset: var(--mt-focus-offset);
}

.mt-field {
  display: grid;
  gap: var(--mt-space-2);
  min-inline-size: 0;
}
.mt-field__label,
.mt-checkbox__label {
  color: var(--mt-text-default);
  font-size: var(--mt-font-size-label);
  font-weight: var(--mt-font-weight-semibold);
  line-height: var(--mt-line-height-label);
  overflow-wrap: anywhere;
}
.mt-field__required {
  font-weight: var(--mt-font-weight-regular);
}
.mt-field__control {
  min-inline-size: 0;
}
.mt-field__hint,
.mt-checkbox__hint {
  margin: 0;
  color: var(--mt-text-muted);
  font-size: var(--mt-font-size-supporting);
  line-height: var(--mt-line-height-supporting);
  overflow-wrap: anywhere;
}
.mt-field__error,
.mt-checkbox__error {
  margin: 0;
  color: var(--mt-status-error-fg);
  font-size: var(--mt-font-size-supporting);
  font-weight: var(--mt-font-weight-semibold);
  line-height: var(--mt-line-height-supporting);
  overflow-wrap: anywhere;
}

.mt-input,
.mt-textarea {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  min-block-size: 2.75rem;
  padding: var(--mt-space-2) var(--mt-space-3);
  color: var(--mt-text-default);
  background: var(--mt-surface-page);
  border: var(--mt-border-width) solid var(--mt-border-strong);
  border-radius: var(--mt-radius-control);
  box-shadow: 0 1px 2px
    color-mix(in srgb, var(--mt-shadow-color) 2.5%, transparent);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}
.mt-input:hover:not(:focus-visible):not(:disabled):not([readonly]):not(
    [aria-invalid="true"]
  ),
.mt-textarea:hover:not(:focus-visible):not(:disabled):not([readonly]):not(
    [aria-invalid="true"]
  ) {
  border-color: var(--mt-border-hover);
}
.mt-input:focus-visible,
.mt-textarea:focus-visible {
  box-shadow: 0 0 0 3px var(--mt-focus-halo);
}
.mt-input:focus-visible:not([aria-invalid="true"]),
.mt-textarea:focus-visible:not([aria-invalid="true"]) {
  border-color: var(--mt-focus-ring);
}
.mt-textarea {
  min-block-size: 8rem;
  resize: vertical;
}
.mt-input::placeholder,
.mt-textarea::placeholder {
  color: var(--mt-text-muted);
  opacity: 1;
}
.mt-input[readonly],
.mt-textarea[readonly] {
  background: var(--mt-surface-subtle);
}
.mt-input[aria-invalid="true"],
.mt-textarea[aria-invalid="true"] {
  border-color: var(--mt-status-error-border);
  border-width: 2px;
}
.mt-input:disabled,
.mt-textarea:disabled {
  color: var(--mt-disabled-fg);
  background: var(--mt-disabled-bg);
  border-color: var(--mt-disabled-border);
  cursor: not-allowed;
  box-shadow: none;
}

.mt-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--mt-space-3);
  min-inline-size: 0;
}
.mt-checkbox__input {
  box-sizing: border-box;
  flex: 0 0 auto;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  margin: 0;
  color-scheme: var(--mt-color-scheme);
  accent-color: var(--mt-checkbox-accent);
  cursor: pointer;
}
.mt-checkbox__body {
  display: grid;
  gap: var(--mt-space-1);
  min-inline-size: 0;
}
.mt-checkbox__label {
  display: block;
  min-block-size: 1.5rem;
  cursor: pointer;
}
.mt-checkbox__input:disabled {
  cursor: not-allowed;
}
.mt-checkbox__input:disabled + .mt-checkbox__body .mt-checkbox__label {
  color: var(--mt-text-muted);
  cursor: not-allowed;
}
.mt-checkbox__input[aria-invalid="true"] {
  outline: 2px solid var(--mt-status-error-border);
  outline-offset: 2px;
}
.mt-checkbox__input[aria-invalid="true"]:focus-visible {
  outline-color: var(--mt-focus-ring);
}

.mt-alert {
  position: relative;
  min-inline-size: 0;
  min-block-size: 4.25rem;
  padding: 1.0625rem 1.125rem;
  padding-inline-start: 3.875rem;
  color: var(--mt-text-default);
  background: var(--mt-surface-page);
  border: var(--mt-border-width) solid var(--mt-border-default);
  border-radius: var(--mt-radius-panel);
  box-shadow: 0 1px 3px
    color-mix(in srgb, var(--mt-shadow-color) 4%, transparent);
  overflow-wrap: anywhere;
}
.mt-alert:empty {
  display: none;
}
/* Decorative icon badges preserve the same markup in every integration.
   Message titles/body carry meaning; these empty pseudo-elements add none
   to the accessible name or live-region announcement. */
.mt-alert::before,
.mt-alert::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
}
.mt-alert::before {
  inset-block-start: 1rem;
  inset-inline-start: 1rem;
  inline-size: 2rem;
  block-size: 2rem;
  border-radius: var(--mt-radius-control);
  background: var(--mt-status-info-bg);
}
.mt-alert::after {
  inset-block-start: 1.4375rem;
  inset-inline-start: 1.4375rem;
  inline-size: 1.125rem;
  block-size: 1.125rem;
  background: var(--mt-status-info-fg);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6'/%3E%3Ccircle cx='12' cy='7.5' r='.8' fill='black' stroke='none'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6'/%3E%3Ccircle cx='12' cy='7.5' r='.8' fill='black' stroke='none'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.mt-alert > .mt-alert__title {
  display: block;
  margin: 0 0 var(--mt-space-1);
  color: var(--mt-text-default);
  font-size: 0.9375rem;
  font-weight: var(--mt-font-weight-semibold);
  line-height: 1.45;
}
.mt-alert__body {
  margin: 0;
  color: var(--mt-text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.mt-alert__body > :first-child {
  margin-block-start: 0;
}
.mt-alert__body > :last-child {
  margin-block-end: 0;
}
.mt-alert--success::before {
  background: var(--mt-status-success-bg);
}
.mt-alert--success::after {
  background: var(--mt-status-success-fg);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E");
}
.mt-alert--warning::before {
  background: var(--mt-status-warning-bg);
}
.mt-alert--warning::after {
  background: var(--mt-status-warning-fg);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 10 17H2Z'/%3E%3Cpath d='M12 9v4'/%3E%3Ccircle cx='12' cy='16.5' r='.8' fill='black' stroke='none'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 10 17H2Z'/%3E%3Cpath d='M12 9v4'/%3E%3Ccircle cx='12' cy='16.5' r='.8' fill='black' stroke='none'/%3E%3C/svg%3E");
}
.mt-alert--error::before {
  background: var(--mt-status-error-bg);
}
.mt-alert--error::after {
  background: var(--mt-status-error-fg);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m9 9 6 6m0-6-6 6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m9 9 6 6m0-6-6 6'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
  .mt-button__spinner {
    animation: none;
  }
  .mt-button,
  .mt-input,
  .mt-textarea {
    transition: none;
  }
}
@media (forced-colors: active) {
  .mt-button,
  .mt-input,
  .mt-textarea,
  .mt-alert {
    border-color: ButtonText;
  }
  .mt-button:disabled {
    color: GrayText;
    border-color: GrayText;
  }
  .mt-checkbox__input {
    accent-color: auto;
  }
  .mt-button,
  .mt-input,
  .mt-textarea,
  .mt-alert {
    box-shadow: none;
  }
  .mt-alert,
  .mt-alert > .mt-alert__title,
  .mt-alert__body {
    color: CanvasText;
  }
  .mt-alert {
    background: Canvas;
  }
  .mt-alert::before {
    forced-color-adjust: none;
    background: Canvas;
    border: 1px solid CanvasText;
  }
  .mt-alert::after {
    forced-color-adjust: none;
    background: CanvasText;
  }
}

/* Preserve native hidden attributes despite the display rules above. */
.mt-button[hidden]:not([hidden="until-found"]),
.mt-button__spinner[hidden]:not([hidden="until-found"]),
.mt-link[hidden]:not([hidden="until-found"]),
.mt-field[hidden]:not([hidden="until-found"]),
.mt-input[hidden]:not([hidden="until-found"]),
.mt-textarea[hidden]:not([hidden="until-found"]),
.mt-checkbox[hidden]:not([hidden="until-found"]),
.mt-checkbox__input[hidden]:not([hidden="until-found"]),
.mt-alert[hidden]:not([hidden="until-found"]),
.mt-sr-only[hidden]:not([hidden="until-found"]) {
  display: none !important;
}
