@use 'sass:color';
@use 'variables' as *;

code {
  font-family: var(--font-monospace);
  font-weight: 400;
}

.form-container {
  max-width: 450px;
  padding: 20px;
  padding-bottom: 50px;
  margin: 50px auto;
}

.form-section {
  border-radius: 8px;
  background: var(--color-bg-secondary);
  padding: 24px;
  margin-bottom: 24px;
}

.fade-out-top {
  position: relative;
  overflow: hidden;
  height: 160px;
  max-width: 566px;
  margin-inline: auto;

  &::after {
    content: '';
    display: block;
    background: linear-gradient(
      to bottom,
      var(--color-bg-secondary),
      transparent
    );
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100px;
    pointer-events: none;
  }

  & > div {
    position: absolute;
    inset-inline-start: 0;
    bottom: 0;
  }
}

.indicator-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--color-text-primary);

  &.success {
    color: var(--color-text-on-success-base);
    background: var(--color-bg-success-base);
  }

  &.failure {
    color: var(--color-text-on-error-base);
    background: var(--color-bg-error-base);
  }
}

.simple_form {
  h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
  }

  .numbered-list {
    list-style: decimal;
    font-size: 16px;
    line-height: 24px;
    margin-bottom: 16px;
    margin-inline-start: 28px;

    li {
      margin-bottom: 4px;
    }
  }

  &.hidden {
    display: none;
  }

  .input {
    margin-bottom: 16px;

    &:last-child {
      margin-bottom: 0;
    }

    &__toolbar {
      margin-top: 16px;
      display: flex;
      align-items: center;
      gap: 16px;

      .character-counter {
        flex: 0 0 auto;
      }
    }

    &.hidden {
      margin: 0;
    }

    &.radio_buttons {
      .radio {
        margin-bottom: 15px;

        &:last-child {
          margin-bottom: 0;
        }
      }

      .radio > label {
        position: relative;
        padding-inline-start: 28px;

        input {
          position: absolute;
          top: -2px;
          inset-inline-start: 0;
        }
      }
    }

    &.boolean {
      position: relative;
      margin-bottom: 0;

      .label_input > label {
        font-family: inherit;
        font-size: 14px;
        padding-top: 5px;
        color: var(--color-text-primary);
        display: block;
        width: auto;
      }

      .label_input,
      .hint {
        padding-inline-start: 28px;
      }

      .label_input__wrapper {
        position: static;
      }

      label.checkbox {
        position: absolute;
        top: 2px;
        inset-inline-start: 0;
      }

      label a {
        color: var(--color-text-brand);
        text-decoration: underline;

        &:hover,
        &:active,
        &:focus {
          text-decoration: none;
        }
      }

      .overridden,
      .recommended,
      .not_recommended {
        position: absolute;
        margin: 0 4px;
        margin-top: -2px;
      }
    }
  }

  .row {
    display: flex;
    margin: 0 -5px;

    .input {
      box-sizing: border-box;
      flex: 1 1 auto;
      width: 50%;
      padding: 0 5px;
    }
  }

  .title {
    font-size: 28px;
    line-height: 33px;
    font-weight: 700;
    margin-bottom: 15px;
  }

  .lead {
    font-size: 17px;
    line-height: 22px;
    color: var(--color-text-primary);
    margin-bottom: 30px;

    &.invited-by {
      margin-bottom: 15px;
    }

    a {
      color: var(--color-text-brand);
    }
  }

  .rules-list {
    font-size: 17px;
    line-height: 22px;
    margin-bottom: 30px;
  }

  .hint {
    color: var(--color-text-secondary);

    a {
      color: var(--color-text-brand);
    }

    code {
      border-radius: 3px;
      padding: 0.2em 0.4em;
      background: var(--color-bg-secondary);
    }

    li {
      list-style: disc;
      margin-inline-start: 18px;
    }

    .icon {
      vertical-align: -3px;
    }
  }

  ul.hint {
    margin-bottom: 15px;
  }

  span.hint {
    display: block;
    font-size: 12px;
    margin-top: 4px;
  }

  p.hint {
    margin-bottom: 15px;
    color: var(--color-text-secondary);

    &.subtle-hint {
      text-align: center;
      font-size: 12px;
      line-height: 18px;
      margin-top: 15px;
      margin-bottom: 0;
    }
  }

  .authentication-hint {
    margin-bottom: 25px;
  }

  .card {
    margin-bottom: 15px;
  }

  strong {
    font-weight: 500;

    @each $lang in $cjk-langs {
      &:lang(#{$lang}) {
        font-weight: 700;
      }
    }
  }

  .input.with_floating_label {
    .label_input {
      display: flex;

      & > label {
        font-family: inherit;
        font-size: 14px;
        color: var(--color-text-primary);
        font-weight: 500;
        min-width: 150px;
        flex: 0 0 auto;
      }

      input,
      select {
        flex: 1 1 auto;
      }
    }

    &.select .hint {
      margin-top: 6px;
      margin-inline-start: 150px;
    }
  }

  .input.with_label {
    .label_input > label {
      font-family: inherit;
      font-size: 14px;
      color: var(--color-text-primary);
      display: block;
      margin-bottom: 8px;
      overflow-wrap: break-word;
      font-weight: 500;
    }

    .hint {
      margin-top: 6px;
    }

    ul {
      flex: 390px;
    }
  }

  .input.with_block_label {
    max-width: none;

    & > label {
      font-family: inherit;
      font-size: 14px;
      color: var(--color-text-primary);
      display: block;
      font-weight: 600;
      line-height: 20px;
    }

    .hint {
      line-height: 16px;
      margin-bottom: 12px;
    }

    ul {
      columns: 2;

      @media screen and (max-width: $mobile-breakpoint) {
        columns: 1;
      }
    }
  }

  .input.with_block_label.user_role_permissions_as_keys ul {
    columns: unset;
  }

  .input.datetime .label_input,
  .input.date .label_input {
    display: flex;
    gap: 4px;
    align-items: center;

    select {
      display: inline-block;
      width: auto;
      flex: 0;
    }
  }

  .input.date_of_birth .label_input {
    display: flex;
    gap: 8px;
    align-items: center;

    input {
      box-sizing: content-box;
      width: 32px;
      flex: 0;

      &:last-child {
        width: 64px;
      }
    }
  }

  .input.select.select--languages {
    min-width: 32ch;
  }

  .required abbr {
    text-decoration: none;
    color: var(--color-text-error);
  }

  .fields-group {
    margin-bottom: 25px;

    .input:last-child {
      margin-bottom: 0;
    }

    &__thumbnail {
      display: block;
      margin: 0;
      margin-bottom: 10px;
      max-width: 100%;
      height: auto;
      border-radius: var(--avatar-border-radius);
      background: url('@/images/void.png');

      &[src$='missing.png'] {
        visibility: hidden;
      }

      &:last-child {
        margin-bottom: 0;
      }

      &#account_avatar-preview {
        width: 90px;
        height: 90px;
        object-fit: cover;
      }
    }
  }

  .fields-row {
    display: flex;
    margin: 0 -10px;
    padding-top: 5px;
    margin-bottom: 25px;

    .input {
      max-width: none;
    }

    &__column {
      box-sizing: border-box;
      padding: 0 10px;
      flex: 1 1 auto;
      min-height: 1px;

      &-6 {
        max-width: 50%;
      }

      .actions {
        margin-top: 27px;
      }
    }

    .fields-group:last-child,
    .fields-row__column.fields-group {
      margin-bottom: 0;
    }

    @media screen and (max-width: $no-columns-breakpoint) {
      display: block;
      margin-bottom: 0;

      &__column {
        max-width: none;
      }

      .fields-group:last-child,
      .fields-row__column.fields-group,
      .fields-row__column {
        margin-bottom: 25px;
      }
    }

    .fields-group.invited-by {
      margin-bottom: 30px;

      .hint {
        text-align: center;
      }
    }
  }

  .input.radio_buttons .radio {
    label {
      margin-bottom: 5px;
      font-family: inherit;
      font-size: 14px;
      color: var(--color-text-primary);
      display: block;
      width: auto;
    }

    input[type='radio'] {
      accent-color: var(--color-text-brand);
      width: 15px;
      height: 15px;
    }
  }

  .check_boxes {
    .checkbox {
      label {
        font-family: inherit;
        font-size: 14px;
        color: var(--color-text-primary);
        display: inline-block;
        width: auto;
        position: relative;
        padding-top: 5px;
        padding-inline-start: 25px;
        flex: 1 1 auto;
      }

      input[type='checkbox'] {
        position: absolute;
        inset-inline-start: 0;
        top: 5px;
        margin: 0;
      }
    }

    .checkbox.disabled {
      opacity: 0.5;
    }
  }

  label.checkbox {
    input[type='checkbox'] {
      accent-color: var(--color-text-brand);
      width: 15px;
      height: 15px;
    }
  }

  .input.static .label_input__wrapper {
    font-size: 14px;
    padding: 10px;
    border: 1px solid var(--color-border-primary);
    border-radius: 4px;
  }

  input[type='text'],
  input[type='number'],
  input[type='email'],
  input[type='password'],
  input[type='url'],
  input[type='datetime-local'],
  textarea {
    box-sizing: border-box;
    font-size: 14px;
    line-height: 20px;
    color: var(--color-text-primary);
    display: block;
    width: 100%;
    font-family: inherit;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: 4px;
    padding: 10px 16px;
    outline: var(--outline-focus-default);
    outline-offset: -2px;
    outline-color: transparent;
    transition: outline-color 0.15s ease-out;

    &:focus {
      outline: var(--outline-focus-default);
    }

    &:invalid {
      box-shadow: none;
    }

    &:required:valid {
      border-color: var(--color-text-success);
    }

    @media screen and (width <= 600px) {
      font-size: 16px;
    }
  }

  textarea {
    resize: vertical;
  }

  input[type='text'],
  input[type='number'],
  input[type='email'],
  input[type='password'],
  input[type='datetime-local'] {
    &:focus:user-invalid:not(:placeholder-shown),
    &:required:user-invalid:not(:placeholder-shown) {
      border-color: var(--color-border-error);
    }
  }

  .input.field_with_errors {
    label {
      color: var(--color-text-error);
    }

    .error {
      display: block;
      font-weight: 500;
      color: var(--color-text-error);
      margin-top: 4px;
    }
  }

  .input.disabled {
    opacity: 0.5;
  }

  .actions {
    margin-top: 30px;
    display: flex;
    gap: 10px;

    &.actions--top {
      margin-top: 0;
      margin-bottom: 30px;
    }
  }

  .stacked-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
    margin-bottom: 15px;
  }

  .btn {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 4px;
    background: var(--color-bg-brand-base);
    color: var(--color-text-on-brand-base);
    font-size: 15px;
    line-height: 22px;
    height: auto;
    padding: 7px 18px;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
    cursor: pointer;
    font-weight: 500;
    outline: 0;

    &:last-child {
      margin-inline-end: 0;
    }

    &:focus-visible {
      outline: var(--outline-focus-default);
      outline-offset: 2px;
    }

    &:active,
    &:focus,
    &:hover {
      background: var(--color-bg-brand-base-hover);
    }

    &:disabled,
    &:disabled:hover {
      color: var(--color-text-on-disabled);
      background: var(--color-bg-disabled);
    }

    &.negative {
      background: var(--color-bg-error-base);

      &:hover,
      &:active,
      &:focus {
        background: var(--color-bg-error-base-hover);
      }
    }
  }

  select {
    appearance: none;
    box-sizing: border-box;
    font-size: 14px;
    color: var(--color-text-primary);
    display: block;
    width: 100%;
    outline: 0;
    font-family: inherit;
    resize: vertical;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-primary);
    border-radius: 4px;
    padding-inline-start: 10px;
    padding-inline-end: 30px;
    height: 41px;

    &:focus-visible {
      outline: var(--outline-focus-default);
      outline-offset: 2px;
    }

    @media screen and (width <= 600px) {
      font-size: 16px;
    }
  }

  h4 {
    margin-bottom: 15px !important;
  }

  .label_input {
    position: relative;

    &__loading-indicator {
      box-sizing: border-box;
      position: absolute;
      top: 0;
      inset-inline-start: 0;
      border: 1px solid transparent;
      padding: 10px 16px;
      width: 100%;
    }

    &__wrapper {
      position: relative;
    }

    &__append {
      position: absolute;
      inset-inline-end: 3px;
      top: 1px;
      padding: 10px;
      font-size: 14px;
      color: var(--color-text-tertiary);
      font-family: inherit;
      pointer-events: none;
      cursor: default;
      max-width: 50%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;

      &::after {
        content: '';
        display: block;
        position: absolute;
        top: 0;
        inset-inline-end: 0;
        bottom: 1px;
        width: 5px;
      }
    }
  }

  .horizontal-options .label_input__wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;

    .radio,
    .radio > label {
      margin-bottom: 0;
    }
  }

  .status-card {
    contain: unset;
  }
}

.simple_form .input.field_with_errors,
[data-has-error='true'] {
  input[type='text'],
  input[type='number'],
  input[type='email'],
  input[type='password'],
  input[type='datetime-local'],
  textarea,
  select {
    border-color: var(--color-border-error);
  }
}

/* Double-chevron icon for custom select components */
.select-wrapper,
.select .label_input__wrapper {
  position: relative;
  width: 100%;

  &::after {
    --icon-size: 11px;

    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-end: 9px;
    width: var(--icon-size);
    background-color: var(--color-text-tertiary);
    pointer-events: none;
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14.933 18.467' height='19.698' width='15.929'><path d='M3.467 14.967l-3.393-3.5H14.86l-3.392 3.5c-1.866 1.925-3.666 3.5-4 3.5-.335 0-2.135-1.575-4-3.5zm.266-11.234L7.467 0 11.2 3.733l3.733 3.734H0l3.733-3.734z' fill='black'/></svg>");
    mask-position: right center;
    mask-size: var(--icon-size);
    mask-repeat: no-repeat;
  }
}

.block-icon {
  display: block;
  margin: 0 auto;
  margin-bottom: 10px;
  font-size: 24px;
}

.flash-message {
  color: var(--color-text-brand);
  background: transparent;
  border: 1px solid var(--color-border-brand);
  border-radius: 4px;
  padding: 15px 10px;
  margin-bottom: 30px;
  text-align: center;

  &.notice {
    border: 1px solid var(--color-border-success-soft);
    background: var(--color-bg-success-softest);
    color: var(--color-text-success);
  }

  &.warning {
    border: 1px solid var(--color-border-warning-soft);
    background: var(--color-bg-warning-softest);
    color: var(--color-text-warning);
  }

  &.alert {
    border: 1px solid var(--color-border-error-soft);
    background: var(--color-bg-error-softest);
    color: var(--color-text-error);
  }

  &.hidden {
    display: none;
  }

  &.hidden-on-touch-devices {
    @media screen and (pointer: coarse) {
      display: none;
    }
  }

  a {
    display: inline-block;
    color: var(--color-text-secondary);
    text-decoration: none;

    &:hover {
      color: var(--color-text-primary);
      text-decoration: underline;
    }
  }

  &.warning a {
    font-weight: 700;
    color: inherit;
    text-decoration: underline;

    &:hover,
    &:focus,
    &:active {
      text-decoration: none;
      color: inherit;
    }
  }

  p {
    margin-bottom: 15px;
  }

  .oauth-code {
    outline: 0;
    box-sizing: border-box;
    display: block;
    width: 100%;
    border: 0;
    padding: 10px;
    font-family: var(--font-monospace);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: 14px;
    margin: 0;

    &::-moz-focus-inner {
      border: 0;
    }

    &::-moz-focus-inner,
    &:focus,
    &:active {
      outline: 0 !important;
    }

    &:focus {
      background: var(--color-bg-brand-softest);
    }
  }

  strong {
    font-weight: 500;

    @each $lang in $cjk-langs {
      &:lang(#{$lang}) {
        font-weight: 700;
      }
    }
  }

  @media screen and (440px < width <= 740px) {
    margin-top: 40px;
  }

  &.translation-prompt {
    text-align: unset;
    color: unset;

    a {
      text-decoration: underline;
    }
  }
}

.flash-message-stack {
  margin-bottom: 30px;

  .flash-message {
    border-radius: 0;
    margin-bottom: 0;
    border-top-width: 0;

    &:first-child {
      border-radius: 4px 4px 0 0;
      border-top-width: 1px;
    }

    &:last-child {
      border-radius: 0 0 4px 4px;

      &:first-child {
        border-radius: 4px;
      }
    }
  }
}

.form-footer {
  margin-top: 30px;
  text-align: center;

  a {
    color: var(--color-text-secondary);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }
}

.quick-nav {
  list-style: none;
  margin-bottom: 25px;
  font-size: 14px;

  li {
    display: inline-block;
    margin-inline-end: 10px;
  }

  a {
    color: var(--color-text-brand);
    text-transform: uppercase;
    text-decoration: none;
    font-weight: 700;

    &:hover,
    &:focus,
    &:active {
      color: var(--color-text-brand-soft);
    }
  }
}

.oauth-prompt,
.follow-prompt {
  margin-bottom: 30px;
  color: var(--color-text-secondary);

  h2 {
    font-size: 16px;
    margin-bottom: 30px;
    text-align: center;
  }

  strong {
    color: var(--color-text-primary);
    font-weight: 500;

    @each $lang in $cjk-langs {
      &:lang(#{$lang}) {
        font-weight: 700;
      }
    }
  }
}

.oauth-prompt {
  h3 {
    color: var(--color-text-primary);
    font-size: 17px;
    line-height: 22px;
    font-weight: 500;
    margin-bottom: 30px;
  }

  p {
    font-size: 14px;
    line-height: 18px;
    margin-bottom: 30px;
  }

  .permissions-list {
    border: 1px solid var(--color-border-primary);
    border-radius: 4px;
    background: var(--color-bg-secondary);
    margin-bottom: 30px;
  }

  .actions {
    margin: 0 -10px;
    display: flex;

    form {
      box-sizing: border-box;
      padding: 0 10px;
      flex: 1 1 auto;
      min-height: 1px;
      width: 50%;
    }
  }
}

.qr-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

.qr-code {
  flex: 0 0 auto;
  background: white;
  padding: 4px;
  margin: 0 10px 20px 0;
  box-shadow: 0 0 15px var(--color-shadow-primary);
  display: inline-block;

  svg {
    display: block;
    margin: 0;
  }
}

.qr-alternative {
  margin-bottom: 20px;
  color: var(--color-text-primary);
  flex: 150px;

  samp {
    display: block;
    font-size: 14px;
  }
}

.action-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;

  .actions,
  .pagination {
    flex: 1 1 auto;
  }

  .actions {
    padding: 30px 0;
    padding-inline-end: 20px;
    flex: 0 0 auto;
  }
}

.post-follow-actions {
  text-align: center;
  color: var(--color-text-secondary);

  div {
    margin-bottom: 4px;
  }
}

.alternative-login {
  margin-top: 20px;
  margin-bottom: 20px;

  h4 {
    font-size: 16px;
    color: var(--color-text-primary);
    text-align: center;
    margin-bottom: 20px;
    border: 0;
    padding: 0;
  }

  .button {
    display: block;
  }
}

.scope-danger {
  color: var(--color-text-error);
}

.form_admin_settings_site_short_description,
.form_admin_settings_site_description,
.form_admin_settings_site_extended_description,
.form_admin_settings_site_terms,
.form_admin_settings_custom_css,
.form_admin_settings_closed_registrations_message {
  textarea {
    font-family: var(--font-monospace);
  }
}

.input-copy {
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-primary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding-inline-end: 4px;
  position: relative;
  top: 1px;
  transition: border-color 300ms linear;

  &__wrapper {
    flex: 1 1 auto;
  }

  input[type='text'] {
    background: transparent;
    border: 0;
    padding: 10px;
    font-size: 14px;
    font-family: var(--font-monospace);
  }

  button {
    flex: 0 0 auto;
    margin: 4px;
    text-transform: none;
    font-weight: 400;
    font-size: 14px;
    padding: 7px 18px;
    padding-bottom: 6px;
    width: auto;
    transition: background 300ms linear;
  }

  &.copied {
    border-color: var(--color-text-success);
    transition: none;

    button {
      background: var(--color-bg-success-base);
      transition: none;
    }
  }
}

.input.user_confirm_password,
.input.user_website {
  &:not(.field_with_errors) {
    display: none;
  }
}

.simple_form .h-captcha {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.permissions-list {
  &__item {
    padding: 15px;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-primary);
    display: flex;
    align-items: center;

    &__text {
      flex: 1 1 auto;

      &__title {
        font-weight: 500;
      }

      &__type {
        color: var(--color-text-secondary);
        overflow-wrap: anywhere;
      }
    }

    &__icon {
      flex: 0 0 auto;
      font-size: 18px;
      width: 30px;
      color: var(--color-text-success);
      display: flex;
      align-items: center;
    }

    &:last-child {
      border-bottom: 0;
    }
  }
}

// Only remove padding when listing applications, to prevent styling issues on
// the Authorization page.
.applications-list {
  .permissions-list__item:last-child {
    padding-bottom: 0;
  }
}

.keywords-table {
  thead {
    th {
      white-space: nowrap;
    }

    th:first-child {
      width: 100%;
    }
  }

  tfoot {
    td {
      border: 0;
    }
  }

  .input.string {
    margin-bottom: 0;
  }

  .label_input__wrapper {
    margin-top: 10px;
  }

  .table-action-link {
    margin-top: 10px;
    white-space: nowrap;
  }
}

.progress-tracker {
  --circle-size: 30px;

  display: flex;
  align-items: center;
  padding-bottom: 30px;
  margin-bottom: 30px;

  li {
    position: relative;

    --connector-color: var(--color-border-primary);
    --connector-thickness: 2px;

    &.completed {
      --connector-color: var(--color-bg-brand-base);
    }

    &:not(:last-child) {
      flex-grow: 1;

      // Connector line between circles
      &::after {
        content: '';
        display: block;
        position: absolute;
        inset-inline: var(--circle-size) 0;
        background-color: var(--connector-color);
        height: 2px;
        top: calc((var(--circle-size) - var(--connector-thickness)) / 2);
      }
    }
  }

  .circle {
    box-sizing: border-box;
    position: relative;
    width: var(--circle-size);
    height: var(--circle-size);
    border-radius: 50%;
    border: 2px solid var(--color-border-primary);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;

    svg {
      width: 16px;
    }
  }

  .label {
    position: absolute;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    padding-top: 10px;
    text-align: center;
    width: 100px;

    // Center-align the label with the circle
    transform: translateX(-33.3333%);
  }

  li:first-child .label {
    inset-inline-start: 0;
    inset-inline-end: auto;
    text-align: start;
    transform: none;
  }

  li:last-child .label {
    inset-inline-start: auto;
    inset-inline-end: 0;
    text-align: end;
    transform: none;
  }

  [aria-current='step'] .circle {
    border-color: var(--color-bg-brand-base);

    &::before {
      content: '';
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: var(--color-bg-brand-base);
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }
  }

  .completed .circle {
    color: var(--color-text-on-brand-base);
    background: var(--color-bg-brand-base);
    border-color: var(--color-bg-brand-base);
  }
}

.app-form {
  padding: 16px;

  &__avatar-input,
  &__header-input {
    display: block;
    border-radius: 8px;
    background: var(--color-bg-secondary);
    position: relative;
    cursor: pointer;

    &:hover {
      background-color: var(--color-bg-brand-softest);
    }

    img {
      position: absolute;
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 8px;
      z-index: 0;
    }

    .icon {
      position: absolute;
      inset-inline-start: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      color: var(--color-text-secondary);
      z-index: 3;
    }

    &.selected .icon {
      color: var(--color-text-primary);
      transform: none;
      inset-inline-start: auto;
      inset-inline-end: 8px;
      top: auto;
      bottom: 8px;
    }

    &.invalid img {
      outline: 1px solid var(--color-border-error);
      outline-offset: -1px;
    }

    &.invalid::before {
      display: block;
      content: '';
      width: 100%;
      height: 100%;
      position: absolute;
      background: var(--color-bg-error-softest);
      z-index: 2;
      border-radius: 8px;
    }
  }

  &__avatar-input {
    width: 80px;
    height: 80px;
  }

  &__header-input {
    aspect-ratio: 580/193;
  }

  &__toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--color-text-secondary);
    font-size: 14px;
    line-height: 20px;

    .icon {
      flex: 0 0 auto;
    }

    .icon {
      width: 24px;
      height: 24px;
    }

    &__label {
      flex: 1 1 auto;

      strong {
        color: var(--color-text-primary);
        font-weight: 600;
      }

      .hint {
        display: block;
        font-size: 14px;
        color: var(--color-text-secondary);
      }

      .recommended {
        position: absolute;
        margin: 0 4px;
        margin-top: -2px;
      }
    }

    &__toggle {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
    }

    &__toggle > div {
      display: flex;
      border-inline-start: 1px solid var(--color-border-primary);
      padding-inline-start: 16px;
    }
  }

  &__link {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-primary);
    margin-bottom: 16px;

    &__text {
      flex: 1 1 auto;
      font-size: 14px;
      line-height: 20px;
      color: var(--color-text-secondary);

      strong {
        font-weight: 600;
        display: block;
        color: var(--color-text-primary);
      }

      .icon {
        vertical-align: -5px;
        width: 20px;
        height: 20px;
      }
    }
  }
}
