.pseudo-form,
form {
  & h2 {
    font-weight: 600;
    font-size: 1.15rem;
  }

  & fieldset {
    border: none;
    padding: 0;
    margin-bottom: 1rem;
  }

  & fieldset:has(.is-required) legend::after {
    content: "*";
    margin-left: 1px;
  }

  & > fieldset {
    margin-top: 2rem;
  }

  & label {
    font-weight: 500;
    display: block;
    margin-bottom: 0.5rem;

    &.is-required::after {
      content: "*";
      margin-left: 1px;
    }
  }

  & .fields,
  & form-fields {
    display: flex;
    gap: 1rem;
  }

  & .field,
  & form-field {
    flex: 1;
    margin-bottom: 1rem;
  }

  & fieldset {
    legend {
      font-weight: 500;
      margin-bottom: 0.5rem;
    }
  }

  & fieldset.collapsed {
    margin-bottom: 1rem;
  }

  & .checkbox,
  & .radio-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;

    & label {
      font-weight: normal;
      margin-bottom: 0;
    }

    &.checkbox-inline {
      margin-bottom: 1.5rem;
    }
  }

  & input[type="text"],
  & input[type="email"],
  & input[type="number"],
  textarea {
    background-color: var(--custom-text-background-color);
    color: var(--custom-text-color);
    width: 100%;
    border-radius: 0.25rem;
    border: 1px solid var(--custom-border-color);
    box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
  }

  & input[type="number"] {
    max-width: 100px;
  }

  & select {
    display: inline-block;
    background-color: var(--custom-text-background-color);
    border: 1px solid var(--custom-border-color);
    box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
    border-radius: 0.25rem;
    color: var(--custom-text-color);
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    padding-right: 2rem;
    width: 100%;

    &.custom-appearance {
      appearance: none;
      background-repeat: no-repeat, repeat;
      background-position:
        right 0.7em top 50%,
        0 0;
      background-size:
        0.65em auto,
        100%;
    }
  }

  & .hint {
    font-size: 0.875rem;
    color: var(--custom-text-color-muted);
    margin-bottom: 0.5rem;
  }

  & input[type="submit"] {
    width: 100%;
  }

  & footer {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* Real border + flush outline (not box-shadow) keeps focus visible in
   forced-colors mode with no layout shift. */
input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="number"]:focus-visible,
textarea:focus-visible,
select:focus-visible,
.btn-secondary:focus-visible {
  border-color: var(--custom-text-color, #030616);
  outline: 1px solid var(--custom-text-color, #030616);
  outline-offset: 0;
}

& form.button_to {
  padding: 0;
}

.btn-primary,
.btn-secondary {
  width: 100%;
}
