/* Keep browser autofill in the field's own palette. */
:root {
  --bm-autofill-background: #fff;
  --bm-autofill-ink: #111;
}
.chroma-field input {
  --bm-autofill-background: var(--field-bg, #e1e1e1);
  --bm-autofill-ink: var(--card-ink, #201d1d);
}
.chroma-field.is-invalid input {
  --bm-autofill-background: var(--error-bg, #eadbd7);
}
.account-contact-form__message textarea { --bm-autofill-background: #f7f7f7; }
.account-profile-modal .account-field input:disabled {
  --bm-autofill-background: #e6e6e6;
  --bm-autofill-ink: #7d7d7d;
}
.studio-shell {
  --bm-autofill-background: #151515;
  --bm-autofill-ink: #f2f2ef;
}
.studio-shell :is(
  .search-box input, .catalog-search input, .business-search input,
  .creative-search input, .admin-toolbar input[type="search"],
  .cover-controls input, .cover-controls select,
  .settings-card input, .settings-card select, .seo-form textarea,
  .beat-editor input, .beat-editor select, .beat-editor textarea,
  .studio-dialog input, .studio-dialog select, .studio-dialog textarea,
  .visual-inspector input, .visual-inspector select, .visual-inspector textarea
) {
  --bm-autofill-background: #fff;
  --bm-autofill-ink: #111;
}
.studio-shell :is(
  .admin-detail-modal, .admin-customer-panel, .admin-customer-contact-modal__body,
  .admin-refund-fields, .admin-refund-step-up-field, .admin-sensitive-modal,
  .admin-commercial-offer-modal__body, .admin-commercial-reject-modal,
  .admin-commercial-cancel-modal, .admin-commercial-withdraw-modal,
  .admin-thread-reply, .thumbnail-control-group
) :is(input, textarea, select) {
  --bm-autofill-background: #181818;
  --bm-autofill-ink: #fff;
}
.studio-shell .terms-variable-picker-search input {
  --bm-autofill-background: #101010;
  --bm-autofill-ink: #eee;
}
.studio-shell .cover-beat-picker-modal .cover-beat-search input {
  --bm-autofill-background: #f7f6f3;
  --bm-autofill-ink: #111;
}
.enrollment-shell input {
  --bm-autofill-background: #0d0d0d;
  --bm-autofill-ink: #fff;
}
.bm-checkout-coupon input {
  --bm-autofill-background: #171717;
  --bm-autofill-ink: #fff;
}
.bm-checkout-coupon input:is(:hover, :focus) { --bm-autofill-background: #1c1c1c; }
.site-header__search input {
  --bm-autofill-background: #181818;
  --bm-autofill-ink: #fff;
}
.download-modal__field input:user-invalid {
  --bm-autofill-validation: inset 0 0 0 2px #c33a1f;
}
.bm-exclusive-offer__fields :is(input, textarea).is-invalid {
  --bm-autofill-validation: inset 0 0 0 2px #8c1818;
}
.bm-checkout-field input[aria-invalid="true"] {
  --bm-autofill-validation: 0 0 0 1px #ed8d87;
}
.enrollment-shell input:focus {
  --bm-autofill-validation: 0 0 0 3px #e86a382e;
}

/* Layered important declarations also survive existing focus overrides. */
@layer beatmolen-form-colors {
  :is(input, textarea, select):is(:autofill, :-webkit-autofill) {
    transition: none !important;
    background-color: var(--bm-autofill-background) !important;
    box-shadow: var(--bm-autofill-validation, 0 0 0 0 transparent),
      0 0 0 1000px var(--bm-autofill-background) inset !important;
    color: var(--bm-autofill-ink) !important;
    -webkit-text-fill-color: var(--bm-autofill-ink) !important;
    caret-color: var(--bm-autofill-ink) !important;
  }

  /* Notification text only; product/order/status badges retain their meaning. */
  :is(
    [data-inline-feedback][role="status"],
    .account-form-status, .account-download-status,
    .account-commercial-action-status, .account-commercial-load-error,
    .account-commercial-waiting.is-error p,
    .contact-form__api-status, .download-modal__request-status,
    .bm-exclusive-offer__status, .bm-checkout-status,
    .bm-checkout-coupon__status, .bm-checkout-field-error span,
    .bm-cart-availability, .project-delivery__status,
    .demo-toast, .studio-toast, .seo-message, .seo-error,
    .seo-empty [role="alert"], .admin-inline-warning, .admin-error p,
    .catalog-filter-error, .visual-version-state.is-error p, .maker-render-status,
    [data-beat-number-error], [data-mail-audience-status],
    .download-modal__success p, .account-contact__confirmation small,
    .bm-exclusive-offer__confirmation p,
    .contact-step__content--success > p:not(.contact-success__signature),
    .bm-checkout-success p, .bm-checkout-success > small,
    .bm-checkout-success > span:not(.bm-checkout-success__mark),
    .bm-checkout-empty > p[role="status"],
    [data-payment-detail], .enrollment-status, .enrollment-error,
    .chroma-login-error, .chroma-field-tooltip
  ) {
    color: #fff !important;
  }
  .chroma-login-error { background-color: #201d1d !important; }
}
