/* Vendored rather than linked: the layout picks up only app/assets/stylesheets,
   and importing here keeps Tom Select's defaults ahead of the overrides below. */
@import url("/assets/tom-select-22c139fe.css");

/* Tom Select copies the select's classes onto its wrapper, so a select styled
   as .input would draw a second field around the control. The control is the
   field; the wrapper only positions it. */
.ts-wrapper.input {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
}

/* Built from the same tokens as .input so it lines up with the fields and
   buttons beside it, and grows to 16px on touch screens like they do. */
.ts-control {
  align-items: center;
  background-color: var(--input-background, var(--color-surface));
  border: 1px solid var(--input-border-color, var(--color-border));
  border-width: var(--input-border-width, 1px);
  border-radius: var(--input-radius, var(--rounded-md));
  box-shadow: var(--input-box-shadow, none);
  color: var(--color-text);
  display: flex;
  font-size: var(--input-font-size, var(--text-sm));
  line-height: inherit;
  padding: var(--input-padding, .25rem .625rem);

  > input {
    color: inherit; font-size: inherit; line-height: inherit;
  }

  &:focus-within {
    outline: var(--input-outline-size, 2px) solid var(--color-selected-dark);
    outline-offset: 2px;
  }
}

.ts-dropdown {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--rounded-lg);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
  font-size: var(--input-font-size, var(--text-sm));
  line-height: inherit;

  /* Setup transition */
  transition-behavior: allow-discrete;
  transition-duration: var(--time-150);
  transition-property: display, opacity, transform;
  transition-timing-function: var(--ease-out-3);

  /* Exit stage to */
  opacity: 0;
  transform: var(--scale-95);

  /* On stage */
  .dropdown-active & {
    opacity: 1; transform: var(--scale-100);
  }

  /* Enter stage from */
  @starting-style {
    .dropdown-active & {
      opacity: 0; transform: var(--scale-95);
    }
  }

  .ts-dropdown-content:not(:has(.optgroup)) {
    padding: var(--size-1);
  }

  .optgroup:not(:first-child) {
    border-block-start-width: var(--border);
  }

  .optgroup {
    padding: var(--size-1);
  }

  .optgroup-header {
    background-color: inherit;
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    padding: var(--size-1_5) var(--size-2);
  }

  :is(.option, .create) {
    border: 1px solid transparent;
    border-radius: var(--rounded-lg);
    padding: var(--size-1) var(--size-1_5);
  }

  [data-selectable].option {
    cursor: default;
  }

  .active {
    background-color: var(--color-border-light);
    color: inherit !important;
  }

  .highlight {
    background-color: transparent !important;
  }

  .no-results {
    color: var(--color-text-subtle);
    text-align: center;
  }

  .spinner {
    margin: var(--size-1) 0 0;
  }

  .spinner::after {
    border-block-color: var(--color-border-dark);
  }
}

.ts-wrapper.single .ts-control {
  background-color: var(--color-surface) !important;
  background-image: url("/assets/chevron-down-zinc-500-e6dc6029.svg") !important;
  background-position: center right var(--size-2) !important;
  background-repeat: no-repeat !important;
  background-size: var(--size-4) auto !important;
  cursor: text;
  padding-inline-end: var(--size-8);

  input {
    cursor: inherit;
  }
}

.ts-wrapper.multi .ts-control > .item {
  background: var(--color-border-light);
  border-radius: var(--rounded-lg);
  color: inherit;
  line-height: var(--leading-none);
}

.disabled .ts-control {
  opacity: var(--opacity-50);
}

.disabled .ts-control * {
  cursor: not-allowed !important;
}

/* Tom Select marks a required, empty select .invalid as soon as it loads, so
   the field would be red before anyone touched it. Follow the hidden select's
   :user-invalid instead, the way .input does: red only after an attempt to submit. */
select:user-invalid + .ts-wrapper .ts-control {
  border-color: var(--color-text-negative);
}

[data-controller~="combobox"] {
  clip: rect(0 0 0 0); position: absolute;
}
