@layer components {
  .eyebrow {
    color: var(--mf-color-accent);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    margin-bottom: 3px;
    text-transform: uppercase;
  }

  :where(.bot-ops-layout, .dashboard-page) :where(input, select, textarea) {
    background: var(--mf-color-input);
    border: 1px solid var(--mf-color-border);
    border-radius: var(--mf-radius-control);
    color: var(--mf-color-text);
    min-height: var(--mf-control-h-md);
    min-width: 0;
    padding: 0 var(--mf-space-3);
    transition:
      background-color 160ms var(--mf-ease-out),
      border-color 160ms var(--mf-ease-out),
      box-shadow 160ms var(--mf-ease-out);
  }

  .icon-button {
    padding: 0 !important;
    width: var(--mf-control-h-md);
  }

  .mf-checkbox-field {
    align-items: start;
    color: var(--mf-color-muted);
    display: grid;
    gap: var(--mf-space-2);
    grid-template-columns: auto minmax(0, 1fr);
  }

  .mf-checkbox-field input {
    accent-color: var(--mf-color-accent);
    margin-top: 0.2em;
  }

  .mf-button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--mf-button-radius, var(--mf-radius-pill));
    display: inline-flex;
    flex: 0 0 auto;
    font-size: var(--mf-text-base);
    font-weight: 600;
    gap: var(--mf-space-2);
    justify-content: center;
    max-width: 100%;
    min-height: var(--mf-control-h-md);
    padding: 0 var(--mf-space-4);
    transition:
      background-color 160ms var(--mf-ease-out),
      border-color 160ms var(--mf-ease-out),
      box-shadow 160ms var(--mf-ease-out),
      color 160ms var(--mf-ease-out),
      transform 160ms var(--mf-ease-out);
  }

  .mf-button-rounded {
    --mf-button-radius: var(--mf-radius-control);
  }

  .mf-icon-button {
    align-items: center;
    background: transparent;
    color: var(--mf-color-muted);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
    padding: 0;
    transition:
      background-color 120ms var(--mf-ease-out),
      border-color 120ms var(--mf-ease-out),
      color 120ms var(--mf-ease-out),
      transform 120ms var(--mf-ease-out);
  }

  .mf-icon-button-compact {
    border: 1px solid transparent;
    border-radius: var(--mf-radius-compact);
    height: 30px;
    width: 30px;
  }

  .mf-icon-button-bare {
    border: 0;
  }

  .mf-icon-button:active:not(:disabled) {
    transform: scale(0.97);
  }

  .mf-icon-button.is-active {
    background: rgb(var(--accent-rgb, 126, 207, 152), 0.12);
    border-color: var(--mf-color-border-strong);
    color: var(--mf-color-accent);
  }

  .mf-icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.38;
  }

  @media (hover: hover) and (pointer: fine) {
    .mf-icon-button:not(:disabled):hover {
      background: var(--mf-color-panel-raised);
      border-color: var(--mf-color-border);
      color: var(--mf-color-text);
    }
  }

  .mf-info-tile {
    align-items: center;
    background: color-mix(in srgb, var(--mf-color-panel-raised) 76%, transparent);
    border: 1px solid var(--mf-color-border);
    border-radius: var(--mf-radius-control);
    display: grid;
    gap: var(--mf-space-3);
    grid-template-columns: auto minmax(0, 1fr);
    padding: var(--mf-space-3) var(--mf-space-4);
  }

  .mf-info-tile-icon {
    align-items: center;
    background: color-mix(in srgb, var(--mf-color-accent) 10%, transparent);
    border-radius: var(--mf-radius-compact);
    color: var(--mf-color-accent);
    display: inline-flex;
    height: 32px;
    justify-content: center;
    width: 32px;
  }

  .mf-info-tile-compact {
    background: color-mix(in srgb, var(--mf-color-panel-raised) 72%, transparent);
    min-height: 70px;
    padding: var(--mf-space-3);
  }

  .mf-info-tile-compact .mf-info-tile-icon {
    background: color-mix(in srgb, var(--mf-color-accent) 11%, transparent);
    height: 34px;
    width: 34px;
  }

  @media (hover: hover) and (pointer: fine) {
    .mf-button:hover:not(:disabled) {
      filter: brightness(1.04);
    }
  }

  .mf-button:active:not(:disabled) {
    transform: scale(0.98);
  }

  .mf-button-sm {
    min-height: var(--mf-control-h-sm);
    padding-inline: var(--mf-space-3);
  }

  .mf-button-primary {
    background: var(--mf-color-accent);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 28%),
      0 8px 24px rgb(var(--accent-rgb, 126, 207, 152), 0.2);
    color: var(--mf-color-on-accent);
  }

  .mf-button-secondary {
    background: color-mix(in srgb, var(--mf-color-panel-raised) 88%, transparent);
    border-color: var(--mf-color-border);
    box-shadow: inset 0 1px 0 var(--mf-color-highlight);
    color: var(--mf-color-text);
  }

  .mf-button-ghost {
    background: transparent;
    color: var(--mf-color-muted);
  }

  .mf-button-text {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: var(--mf-color-muted);
    min-height: auto;
    padding: 0;
  }

  .mf-button-danger {
    background: rgb(var(--mf-color-danger-rgb) / 12%);
    border-color: rgb(var(--mf-color-danger-rgb) / 28%);
    color: var(--mf-color-danger);
  }

  .mf-destructive-action {
    background: var(--mf-color-danger);
    border-color: transparent;
    color: var(--mf-color-on-danger);
    justify-content: flex-start;
    justify-self: start;
    max-width: min(100%, var(--mf-action-card-max-width));
    min-height: 68px;
    padding: var(--mf-space-3);
    text-align: left;
    width: 100%;
  }

  .mf-destructive-action-icon {
    align-items: center;
    background: color-mix(in srgb, var(--mf-color-on-danger) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--mf-color-on-danger) 28%, transparent);
    border-radius: var(--mf-radius-compact);
    color: var(--mf-color-on-danger);
    display: inline-flex;
    flex: 0 0 36px;
    height: 36px;
    justify-content: center;
  }

  .mf-destructive-action-copy {
    display: grid;
    flex: 1;
    gap: 3px;
    min-width: 0;
  }

  .mf-destructive-action-copy strong {
    color: var(--mf-color-on-danger);
    font-size: var(--mf-text-base);
    font-weight: 650;
    line-height: 1.2;
  }

  .mf-destructive-action-copy small {
    color: color-mix(in srgb, var(--mf-color-on-danger) 82%, transparent);
    font-size: var(--mf-text-xs);
    font-weight: 500;
    line-height: 1.35;
  }

  .mf-destructive-action-chevron {
    color: color-mix(in srgb, var(--mf-color-on-danger) 82%, transparent);
    flex: 0 0 auto;
    transition: transform 160ms var(--mf-ease-out);
  }

  @media (hover: hover) and (pointer: fine) {
    .mf-destructive-action:hover:not(:disabled) .mf-destructive-action-chevron {
      transform: translateX(3px);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .mf-destructive-action-chevron {
      transition: none;
    }
  }

  .mf-button-marketing-primary,
  .mf-button-marketing-secondary,
  .mf-button-marketing-ghost {
    border-radius: var(--mf-button-radius, var(--mf-radius-pill));
    font-size: 14px;
    font-weight: 600;
    gap: 7px;
    line-height: 1;
    min-height: 42px;
    padding: 0 20px;
    transition:
      filter 150ms ease,
      transform 150ms ease,
      background-color 150ms ease;
  }

  .mf-button-marketing-primary {
    background: var(--mf-marketing-accent);
    border: 1px solid color-mix(in srgb, var(--mf-marketing-accent) 75%, white);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 24%),
      0 10px 24px rgb(0 113 227 / 18%);
    color: var(--mf-marketing-on-accent);
  }

  .mf-button-marketing-secondary {
    background: rgb(255 255 255 / 78%);
    border: var(--mf-marketing-border-rule);
    box-shadow: 0 5px 18px rgb(0 0 0 / 5%);
    color: var(--mf-marketing-ink);
  }

  .mf-button-marketing-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--mf-marketing-accent);
  }

  @media (hover: hover) and (pointer: fine) {
    :is(.mf-button-marketing-primary, .mf-button-marketing-secondary, .mf-button-marketing-ghost):hover:not(:disabled) {
      filter: brightness(1.06);
      transform: translateY(-1px);
    }
  }

  :is(.mf-button-marketing-primary, .mf-button-marketing-secondary, .mf-button-marketing-ghost):active:not(:disabled) {
    filter: brightness(0.96);
    transform: scale(0.97);
  }

  .mf-tabs button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: var(--mf-radius-pill);
    color: var(--mf-color-muted);
    display: inline-flex;
    font-size: var(--mf-text-sm);
    font-weight: 600;
    flex: 0 0 auto;
    gap: var(--mf-space-2);
    min-height: var(--mf-control-h-sm);
    min-width: var(--mf-control-h-sm);
    padding-inline: var(--mf-space-3);
    white-space: nowrap;
    transition:
      background-color 160ms var(--mf-ease-out),
      box-shadow 160ms var(--mf-ease-out),
      color 160ms var(--mf-ease-out),
      transform 160ms var(--mf-ease-out);
  }

  .mf-tabs button[aria-selected="true"] {
    background: var(--mf-color-control-selected);
    box-shadow: var(--mf-shadow-control-active);
    color: var(--mf-color-on-control-selected);
  }

  .mf-tabs button:active {
    transform: scale(0.97);
  }

  @media (max-width: 680px), (pointer: coarse) {
    .mf-tabs button {
      min-height: 44px;
    }
  }

  .mf-field {
    color: var(--mf-color-muted);
    display: grid;
    font-size: 0.68rem;
    font-weight: 600;
    gap: var(--mf-space-2);
    min-width: 0;
  }

  .mf-field :where(input, select, textarea) {
    background: var(--mf-color-input);
    border: 1px solid var(--mf-color-border);
    border-radius: var(--mf-radius-control);
    color: var(--mf-color-text);
    min-height: var(--mf-control-h-md);
    min-width: 0;
    padding: 0 var(--mf-space-3);
    transition:
      background-color 160ms var(--mf-ease-out),
      border-color 160ms var(--mf-ease-out),
      box-shadow 160ms var(--mf-ease-out);
    width: 100%;
  }

  .mf-field .mf-field-control-elevated {
    background: var(--mf-color-bg-elevated);
  }

  .mf-prefixed-control,
  .mf-field-action-control {
    align-items: center;
    display: flex;
    min-width: 0;
  }

  .mf-prefixed-control > :is(input, select),
  .mf-field-action-control > input {
    flex: 1 1 auto;
  }

  .mf-field :where(input, select, textarea):focus {
    background: var(--mf-color-panel-raised);
    border-color: var(--mf-color-accent);
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb, 126, 207, 152), 0.12);
  }

  @media (hover: hover) and (pointer: fine) {
    .mf-field :where(input, select, textarea):hover:not(:disabled) {
      border-color: color-mix(in srgb, var(--mf-color-accent) 32%, var(--mf-color-border));
    }
  }

  .mf-field small {
    color: var(--mf-color-subtle);
    font-weight: 450;
    line-height: 1.4;
  }

  .mf-field-inline {
    align-items: center;
    grid-template-columns: minmax(8rem, auto) minmax(0, 1fr);
  }

  .mf-field-error {
    color: var(--mf-color-danger) !important;
  }

  .mf-choice-group {
    border: 0;
    display: grid;
    gap: var(--mf-space-2);
    margin: 0;
    min-width: 0;
    padding: 0;
  }

  .mf-choice-group legend {
    color: var(--mf-color-muted);
    font-size: 0.68rem;
    font-weight: 650;
  }

  .mf-choice-grid {
    display: grid;
    gap: var(--mf-space-2);
    grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
  }

  .mf-choice-card {
    align-items: flex-start;
    background: var(--mf-color-bg-elevated);
    border: 1px solid var(--mf-color-border);
    border-radius: var(--mf-radius-control);
    display: flex;
    gap: var(--mf-space-2);
    padding: var(--mf-space-3);
    transition:
      background-color 160ms var(--mf-ease-out),
      border-color 160ms var(--mf-ease-out),
      transform 160ms var(--mf-ease-out);
  }

  .mf-choice-card:has(input:checked) {
    background: color-mix(in srgb, var(--mf-color-accent) 8%, var(--mf-color-bg-elevated));
    border-color: var(--mf-color-border-strong);
  }
  .mf-choice-card input {
    accent-color: var(--mf-color-accent);
    margin-top: 2px;
  }
  .mf-choice-card span,
  .mf-choice-card small {
    display: grid;
    gap: var(--mf-space-1);
  }

  .mf-choice-card-visual {
    cursor: pointer;
  }

  .mf-choice-card-appearance {
    color: var(--mf-color-muted);
    cursor: pointer;
    display: grid;
    font-size: var(--mf-text-xs);
    gap: 5px;
    grid-template-columns: 1fr;
    min-height: 68px;
    padding: var(--mf-space-2);
    place-items: center;
    position: relative;
    text-align: center;
  }

  .mf-choice-card-appearance strong {
    font-size: inherit;
    font-weight: inherit;
  }

  .mf-choice-card-appearance:active {
    transform: scale(0.98);
  }

  .mf-choice-card-appearance:has(input:checked) {
    background: color-mix(in srgb, var(--mf-color-accent) 12%, var(--mf-color-panel));
    border-color: var(--mf-color-accent);
    box-shadow: var(--mf-shadow-progress-active);
    color: var(--mf-color-text);
  }

  .mf-choice-card-appearance:has(input:focus-visible) {
    outline: 2px solid var(--mf-color-accent);
    outline-offset: 2px;
  }

  .mf-choice-card-appearance:has(input:checked) > svg {
    color: var(--mf-color-accent);
  }

  .mf-choice-card-appearance > svg:last-child {
    position: absolute;
    right: 7px;
    top: 7px;
  }

  @media (hover: hover) and (pointer: fine) {
    .mf-choice-card-appearance:hover {
      background: var(--mf-color-panel-raised);
      color: var(--mf-color-text);
    }
  }

  .mf-choice-card-indicator {
    align-items: center;
    color: var(--mf-color-muted);
    cursor: pointer;
    display: grid;
    gap: var(--mf-space-3);
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 66px;
    text-align: left;
    transition:
      border-color 120ms var(--mf-ease-out),
      transform 120ms var(--mf-ease-out);
  }

  .mf-choice-card-indicator:has(input:checked) {
    background: rgb(var(--accent-rgb, 126, 207, 152), 0.1);
    border-color: var(--mf-color-accent);
  }

  .mf-choice-card-indicator:active {
    transform: scale(0.97);
  }

  .mf-choice-card-indicator > span {
    display: grid;
    gap: 2px;
  }

  .mf-choice-card-indicator strong {
    color: var(--mf-color-text);
    font-size: var(--mf-text-sm);
  }

  .mf-choice-card-indicator small {
    color: var(--mf-color-subtle);
    font-size: var(--mf-text-xs);
  }

  @media (hover: hover) and (pointer: fine) {
    .mf-choice-card-indicator:hover {
      border-color: var(--mf-color-border-strong);
    }
  }

  .mf-secret-control input {
    border-radius: var(--mf-radius-control) !important;
    padding-right: calc(var(--mf-control-h-md) + var(--mf-space-3)) !important;
  }

  .mf-secret-control input::-ms-clear,
  .mf-secret-control input::-ms-reveal {
    display: none;
  }

  .mf-secret-control button {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: var(--mf-radius-pill);
    color: var(--mf-color-muted);
    cursor: pointer;
    display: inline-flex;
    height: calc(var(--mf-control-h-md) - 8px);
    justify-content: center;
    max-height: 100%;
    padding: 0;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    transition:
      background-color 160ms var(--mf-ease-out),
      color 160ms var(--mf-ease-out),
      box-shadow 160ms var(--mf-ease-out),
      transform 160ms var(--mf-ease-out);
    width: calc(var(--mf-control-h-md) - 8px);
  }

  .mf-secret-control button:hover:not(:disabled) {
    background: color-mix(in srgb, var(--mf-color-accent) 10%, transparent);
    color: var(--mf-color-text);
  }

  .mf-secret-control button:focus-visible {
    background: color-mix(in srgb, var(--mf-color-accent) 12%, transparent);
    color: var(--mf-color-accent);
    outline: 2px solid color-mix(in srgb, var(--mf-color-accent) 72%, transparent);
    outline-offset: 2px;
  }

  .mf-secret-control button[aria-pressed="true"] {
    color: var(--mf-color-accent);
  }

  .mf-field [aria-invalid="true"] {
    border-color: var(--mf-color-danger);
  }

  .mf-switch {
    align-items: center;
    display: inline-flex;
    gap: var(--mf-space-2);
  }

  .mf-switch input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
  }

  .mf-switch > span {
    --mf-switch-height: 22px;
    --mf-switch-width: 38px;
    --mf-switch-padding: 2px;
    --mf-switch-thumb-size: 16px;
    --mf-switch-thumb-travel: calc(var(--mf-switch-width) - var(--mf-switch-height));

    background: color-mix(in srgb, var(--mf-color-subtle) 72%, var(--mf-color-panel-raised));
    border: 1px solid var(--mf-color-border);
    border-radius: var(--mf-radius-pill);
    display: inline-flex;
    flex: 0 0 var(--mf-switch-width);
    height: var(--mf-switch-height);
    padding: var(--mf-switch-padding);
    transition:
      background-color 160ms var(--mf-ease-out),
      border-color 160ms var(--mf-ease-out);
    width: var(--mf-switch-width);
  }

  .mf-switch > span::after {
    background: #fff;
    border-radius: 50%;
    content: "";
    height: var(--mf-switch-thumb-size);
    box-shadow: 0 2px 5px rgb(0 0 0 / 28%);
    transition: transform 160ms var(--mf-ease-out);
    width: var(--mf-switch-thumb-size);
  }

  .mf-switch input:checked + span {
    background: var(--mf-color-accent);
    border-color: var(--mf-color-accent);
  }

  .mf-switch input:checked + span::after {
    transform: translateX(var(--mf-switch-thumb-travel));
  }

  .mf-switch input:focus-visible + span {
    box-shadow: var(--mf-focus);
  }

  .mf-switch em {
    color: var(--mf-color-muted);
    font-size: 0.7rem;
    font-style: normal;
  }

  .mf-form-grid {
    display: grid;
    gap: var(--mf-space-3);
  }

  .mf-form-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  }

  .mf-accent-picker {
    border: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--mf-space-2);
    margin: 0;
    padding: 0;
  }

  .mf-accent-picker legend {
    color: var(--mf-color-muted);
    font-size: 0.68rem;
    font-weight: 650;
    margin-bottom: var(--mf-space-2);
  }

  .mf-accent-picker button {
    align-items: center;
    background: var(--mf-color-bg-elevated);
    border: 1px solid var(--mf-color-border);
    border-radius: var(--mf-radius-control);
    color: var(--mf-color-muted);
    display: inline-flex;
    font-size: 0.68rem;
    gap: var(--mf-space-2);
    min-height: var(--mf-control-h-sm);
    padding: 0 var(--mf-space-3);
    text-transform: capitalize;
    transition:
      background-color 160ms var(--mf-ease-out),
      border-color 160ms var(--mf-ease-out),
      transform 160ms var(--mf-ease-out);
  }

  .mf-accent-picker button[aria-pressed="true"] {
    background: var(--mf-color-control-selected);
    border-color: var(--mf-color-border-strong);
    color: var(--mf-color-on-control-selected);
  }

  .mf-accent-picker i {
    background: var(--swatch, var(--mf-color-accent));
    border-radius: 50%;
    height: 10px;
    width: 10px;
  }

  .mf-checkbox {
    align-items: center;
    color: var(--mf-color-muted);
    display: flex;
    font-size: 0.7rem;
    gap: var(--mf-space-2);
  }

  .mf-checkbox input {
    accent-color: var(--mf-color-accent);
  }

  @media (max-width: 680px), (pointer: coarse) {
    .mf-button:not(.mf-button-text),
    .mf-icon-button-compact,
    .mf-field :where(input, select, textarea) {
      min-height: 44px;
    }

    .mf-icon-button-compact {
      width: 44px;
    }

    .mf-secret-control button {
      height: 44px;
      right: 2px;
      width: 44px;
    }
  }

  @media (max-width: 760px), (max-width: 950px) and (max-height: 500px) {
    html[data-mobile-device="true"] .mf-field :where(input, select, textarea) {
      font-size: var(--mf-text-xs);
    }
  }
}
