/* Keep editable fields steady across page, dialog and body-mounted controls.
   Important declarations in this layer take precedence over the older,
   unlayered page rules without escalating selector specificity. */
@layer hanbridge-fields {
  html.atelier-theme body :is(
    input:not([type="checkbox"], [type="radio"], [type="range"], [type="button"], [type="submit"], [type="reset"], [type="image"], [type="hidden"]),
    textarea, select, [contenteditable="true"], .hb-select-trigger
  ) {
    outline: none !important;
    box-shadow: none !important;
    transition: none !important;
  }

  html.atelier-theme body :is(
    input:not([type="checkbox"], [type="radio"], [type="range"], [type="button"], [type="submit"], [type="reset"], [type="image"], [type="hidden"], [type="file"], [type="color"]),
    textarea, select, [contenteditable="true"], .hb-select-trigger
  ):not(:disabled, [aria-disabled="true"], [aria-invalid="true"]) {
    border-color: var(--field-border, #dce1ea) !important;
  }

  html.atelier-theme body :is(.auth-password-field, .admin-search, .hb-select),
  html.atelier-theme body .generation-composer,
  html.atelier-theme body .generation-composer::before {
    outline: none !important;
    box-shadow: none !important;
    transition: none !important;
  }
  html.atelier-theme body .auth-password-field,
  html.atelier-theme body.has-conversation .generation-composer,
  html.atelier-theme body .generation-composer::before {
    border-color: var(--field-border, #dce1ea) !important;
  }

  /* Borderless fields keep their existing structure and menu presentation. */
  html.atelier-theme body :is(.language-switch, .composer-level) .hb-select-trigger {
    border-color: transparent !important;
  }

  /* Errors remain visible without an outer glow; disabled states stay intact. */
  html.atelier-theme body :is(
    input:not([type="checkbox"], [type="radio"], [type="range"], [type="button"], [type="submit"], [type="reset"], [type="image"], [type="hidden"]),
    textarea, select, [contenteditable="true"], .hb-select-trigger
  )[aria-invalid="true"],
  html.atelier-theme body .auth-password-field:has(input[aria-invalid="true"]) {
    border-color: var(--hb-bad, #b74255) !important;
  }
}
