/* Keep the native option semantics and templates; the checkbox is decorative. */
.gh-select2-multiple-selection .select2-search--inline {
    display: none;
}

/* Empty enhanced multiples use a real placeholder instead of the inline input. */
.select2-container--default .gh-select2-multiple-selection:has(.select2-selection__placeholder) {
    display: flex;
    align-items: center;
}

.select2-container--default .gh-select2-multiple-selection:has(.select2-selection__placeholder) .select2-selection__rendered {
    margin: 0;
    padding-block: 0;
    padding-inline: 0.875rem;
}

.select2-container--default .gh-select2-multiple-selection .select2-selection__placeholder {
    color: var(--bs-secondary-color, #999);
    line-height: 1.5;
}

.gh-select2-dropdown-search {
    position: relative;
    display: block;
    padding: 0.5rem;
}

.gh-select2-dropdown-search.select2-search--dropdown .select2-search__field {
    box-sizing: border-box;
    width: 100%;
    inline-size: 100%;
    margin: 0;
    padding-inline-end: 2rem;
}

.gh-select2-dropdown-search .select2-search__field::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.gh-select2-clear-search {
    position: absolute;
    inset-inline-end: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0.25rem 0.4rem;
    min-width: 2rem;
    min-height: 2rem;
    line-height: 1;
    cursor: pointer;
}

.gh-select2-clear-search[hidden] {
    display: none;
}

.gh-select2-clear-search:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.gh-select2-multiple-results .select2-results__option[aria-selected],
.gh-select2-multiple-results .select2-results__option.gh-select2-disabled-option {
    position: relative;
    padding-inline-start: 2.25rem;
}

.gh-select2-multiple-results .select2-results__option[aria-selected]::before,
.gh-select2-multiple-results .select2-results__option.gh-select2-disabled-option::before {
    content: "";
    position: absolute;
    inset-inline-start: 0.65rem;
    top: 0.65em;
    width: 1rem;
    height: 1rem;
    box-sizing: border-box;
    border: 1px solid currentColor;
    border-radius: 0.2rem;
    pointer-events: none;
}

.gh-select2-multiple-results .select2-results__option[aria-selected="true"]::after,
.gh-select2-multiple-results .gh-select2-disabled-selected::after {
    content: "";
    position: absolute;
    inset-inline-start: 0.98rem;
    top: calc(0.65em + 0.12rem);
    width: 0.3rem;
    height: 0.55rem;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    pointer-events: none;
}

.gh-select2-multiple-results .select2-results__option[aria-disabled="true"]::before {
    opacity: 0.45;
}

/* Two-line options (title + subtitle such as an employee's role). */
.gh-select2-option {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.gh-select2-option__title,
.gh-select2-option__subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-select2-option__subtitle {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Employee options: avatar + text column that truncates instead of overflowing. */
.gh-select2-person {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.gh-select2-person .gh-select2-option {
    flex: 1 1 auto;
}

.gh-select2-avatar.avatar {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
}

.gh-select2-avatar img {
    width: 24px;
    height: 24px;
    object-fit: cover;
}

.gh-select2-avatar .avatar-initial {
    font-size: 0.625rem;
}

.select2-selection__rendered .gh-select2-person,
.select2-selection__choice .gh-select2-person {
    display: inline-flex;
    vertical-align: middle;
}

.select2-selection__choice .gh-select2-avatar.avatar,
.select2-selection__choice .gh-select2-avatar img {
    flex-basis: 18px;
    width: 18px;
    height: 18px;
}
