/* The text field every form draws — the sign-in form's, the account pages',
   the onboarding's, the invoice editor's, the filter chips'. Zero specificity
   like the button's base, so a block that sizes or tints its field its own
   way (`.inv-input`'s editor height, the filter chips' tinted wells) wins
   with a plain class. */

@layer components {
  :where(.input) {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font-size: 0.875rem;
    inline-size: 100%;
    min-inline-size: 0;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
  }

  :where(.input:focus) {
    border-color: var(--color-brand);
    box-shadow: var(--shadow-focus);
    outline: none;
  }

  :where(.input::placeholder) {
    color: var(--color-ink-faint);
  }

  /* The class the validation response toggles on a rejected field. */
  :where(.input.input-error) {
    border-color: var(--color-negative);
  }

  /* The tall field of the sign-in, account and onboarding forms. */
  :where(.input--large) {
    block-size: 48px;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    padding-block: 0;
    padding-inline: 1rem;
  }

  /* A select drawn as a field, with the chevron the browser would draw. */
  :where(.input--select) {
    -webkit-appearance: none;
    appearance: none;
    background-image: var(--icon-chevron-muted);
    background-position: right 1rem center;
    background-repeat: no-repeat;
    cursor: pointer;
    padding-inline-end: 2.75rem;
  }
}

/* iOS zooms into a field whose text is under 16px, so on a phone every field
   is at least that: a platform rule, in the layer past the components'
   sizes. The fields without the `input` class are the joined input's parts
   and the search box, sized by their own components. */
@layer platform {
  @media (width < 480px) {
    .input,
    .inv-joined__input,
    .inv-joined__display,
    .inv-joined__select,
    .nav-search-panel__input {
      font-size: 16px;
    }
  }
}
