@layer components {
  /* Suggestions float over what follows the field instead of pushing it down. */
  .suggestions {
    position: relative;
  }

  /* A turbo-frame is display: contents by default, which would leave nothing to position. */
  .suggestions__list {
    display: block;
    position: absolute;
    inset-block-start: 100%;
    inset-inline: 0;
    z-index: var(--z-popup);
    max-block-size: 60vh;
    overflow-y: auto;
    background-color: var(--color-canvas);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);

    &:not(:has(.row:not([hidden]))) {
      display: none;
    }

    [data-filtering] &:has(.suggestions__skeleton) {
      display: block;
    }
  }

  .suggestions__skeleton {
    padding: var(--block-space-half) var(--inline-space-double);

    > * + * {
      margin-block-start: var(--block-space-half);
    }

    /* The hairline's ink is too faint on the white list in light mode. */
    .skeleton {
      background-color: light-dark(var(--tint-ink-20), var(--color-ink-light));
    }
  }

  /* What to do with the text when nothing suggested matches it, offered once something is typed. Flush with the
     search above it. */
  .suggestions__fallback {
    display: none;

    [data-filtering]:not([data-has-match]) &,
    &[open] {
      display: block;
    }

    > .btn {
      inline-size: fit-content;
      list-style: none;
    }
  }

  .suggestions__typed {
    display: none;

    [data-filtering] & {
      display: inline;
    }
  }

  [data-filtering] .suggestions__untyped {
    display: none;
  }

  /* A firm hired in place: a search over the register, or a new firm's fields. */
  .hire {
    display: flex;
    flex-direction: column;
    gap: var(--block-space-half);
    padding-block: var(--block-space-half);
  }

  .hire__search {
    align-items: center;
    display: flex;
    gap: var(--inline-space-half);

    > .suggestions {
      flex: 1 1 auto;
      min-inline-size: 0;
    }
  }

  .hire__form {
    display: flex;
    flex-direction: column;
    gap: var(--block-space);
    margin-block-start: var(--block-space);
  }

  /* Country, CUIT and name on one row, stacked on a phone. */
  .hire__fields {
    display: flex;
    flex-direction: column;
    gap: var(--block-space-half) var(--inline-space);

    .input {
      inline-size: 100%;
    }

    @media (width >= 640px) {
      flex-direction: row;

      > :nth-child(1) {
        flex: 0 0 9rem;
      }

      > :nth-child(2) {
        flex: 0 1 14rem;
      }

      > :nth-child(3) {
        flex: 1 1 0;
        min-inline-size: 0;
      }
    }
  }
}
