.team-role-filter {
  position: relative;
  flex: 0 1 15.5rem;
  min-width: min(100%, 11rem);
  max-width: 100%;
}

.team-role-control {
  position: relative;
}

.team-role-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.team-role-control::after {
  position: absolute;
  right: .97rem;
  bottom: 1.14rem;
  width: .45rem;
  height: .45rem;
  transform: rotate(45deg);
  border-right: 2px solid var(--highlight);
  border-bottom: 2px solid var(--highlight);
  content: "";
  pointer-events: none;
}

.team-role-control:has([aria-expanded="true"])::after {
  bottom: .97rem;
  transform: rotate(225deg);
  border-color: var(--accent);
}

.team-role-control input[data-team-role-input] {
  display: block;
  width: 100%;
  padding-inline-end: 2.23rem;
}

.team-role-control input[aria-expanded="true"] { border-color: var(--highlight); }

.team-role-control:has([data-team-role-clear]:not([hidden])) input {
  padding-inline-end: 4.1rem;
}

.team-role-control [data-team-role-clear] {
  position: absolute;
  right: 1.88rem;
  bottom: .29rem;
  display: grid;
  width: 2.02rem;
  height: 2.02rem;
  place-items: center;
  border: 0;
  border-radius: var(--small-radius);
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 1.32rem;
  line-height: 1;
}

.team-role-control [data-team-role-clear]:hover {
  background: var(--surface-active);
  color: var(--ink);
}

.team-role-control [data-team-role-clear]:focus-visible { outline-offset: -2px; }

.team-role-menu {
  position: absolute;
  z-index: 4;
  inset: calc(100% + .35rem) 0 auto;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--small-radius);
  background: var(--surface);
  box-shadow: 0 12px 30px #06091d9c;
}

.team-role-options {
  max-height: min(16.5rem, 42dvh);
  overflow: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: .28rem;
  list-style: none;
  scrollbar-color: var(--border-strong) var(--surface-sunken);
}

.team-role-option {
  position: relative;
  display: grid;
  min-height: 2.45rem;
  align-content: center;
  gap: .14rem;
  border-radius: .3rem;
  color: var(--ink);
  padding: .52rem 1.78rem .52rem .62rem;
  font-size: .89rem;
  line-height: 1.33;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.team-role-option:hover { background: var(--surface-raised); }

.team-role-option.is-highlighted {
  background: var(--surface-active);
  box-shadow: inset 2px 0 var(--highlight);
}

.team-role-option[aria-selected="true"] { color: var(--highlight); }

.team-role-option[aria-selected="true"]::after {
  position: absolute;
  top: 50%;
  right: .65rem;
  width: .41rem;
  height: .7rem;
  transform: translateY(-65%) rotate(45deg);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
}

.team-role-option-label { font-weight: 730; }
.team-role-option-hint { color: var(--muted); font-size: .81rem; }

.team-role-empty {
  padding: .72rem .81rem;
  color: var(--muted);
  font-size: .88rem;
}

@media (max-width: 40rem) {
  .team-role-filter { flex: 1 1 13rem; }
}

@media (max-width: 31rem) {
  .team-role-filter { flex-basis: 100%; }
  .team-role-option { min-height: 2.7rem; }
}
