/* Branded single-selects: keep the native control for forms, but replace the
   operating-system popup with a consistent, accessible house-style listbox. */
.branded-select {
  position: relative;
  min-width: 0;
}
.branded-select.is-open { z-index: 80; }
select.branded-select__native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.branded-select__toggle,
.branded-select__option {
  width: 100%;
  display: flex;
  align-items: center;
  font: inherit;
  color: var(--text);
  text-align: left;
}
.branded-select__toggle {
  min-height: 44px;
  justify-content: space-between;
  gap: .75rem;
  padding: .15rem .8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
  font-size: .95rem;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.branded-select__toggle:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 45%, var(--border));
  background: #fff;
}
.branded-select__toggle:focus-visible,
.branded-select.is-open .branded-select__toggle {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 16%, transparent);
  outline: none;
}
.branded-select.is-invalid .branded-select__toggle {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}
.branded-select__toggle:disabled {
  color: var(--muted);
  background: var(--bg);
  cursor: not-allowed;
  box-shadow: none;
  opacity: .72;
}
.branded-select__current {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.branded-select__current.is-placeholder { color: var(--muted); }
.branded-select__chevron {
  width: 18px;
  height: 18px;
  display: grid;
  flex: 0 0 18px;
  place-items: center;
  color: var(--brand-primary);
}
.branded-select__chevron::before {
  content: '';
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .16s ease, margin .16s ease;
}
.branded-select.is-open .branded-select__chevron::before {
  margin-top: 4px;
  transform: rotate(225deg);
}
.branded-select__menu {
  position: absolute;
  top: calc(100% + .45rem);
  right: 0;
  z-index: 90;
  width: max-content;
  min-width: 100%;
  max-width: min(420px, calc(100vw - 2rem));
  max-height: min(22rem, 55vh);
  padding: .45rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid color-mix(in srgb, var(--brand-primary) 28%, var(--border));
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .18), 0 3px 10px rgba(15, 23, 42, .08);
}
.branded-select.is-viewport-positioned .branded-select__menu {
  position: fixed;
  z-index: 3200;
}
.branded-select.align-left .branded-select__menu {
  right: auto;
  left: 0;
}
.branded-select__menu::before {
  content: '';
  position: sticky;
  top: -.45rem;
  z-index: 1;
  height: 3px;
  display: block;
  margin: -.45rem -.45rem .35rem;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
}
.branded-select__menu[hidden] { display: none; }
.branded-select__search {
  position: sticky;
  top: -.1rem;
  z-index: 2;
  margin: 0 0 .4rem;
  padding: .1rem;
  background: #fff;
}
.branded-select__search input {
  width: 100%;
  min-height: 40px;
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
}
.branded-select__search input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 14%, transparent);
  outline: none;
}
.branded-select__empty {
  margin: .35rem .2rem .2rem;
  padding: .7rem .55rem;
  color: var(--muted);
  font-size: .88rem;
  text-align: center;
}
.branded-select__empty[hidden] { display: none; }
.branded-select__option {
  position: relative;
  min-height: 44px;
  padding: .55rem .65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: .92rem;
  cursor: pointer;
}
.branded-select__option + .branded-select__option { margin-top: .1rem; }
.branded-select__group-label {
  padding: .6rem .65rem .3rem;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.branded-select__group-label:not(:first-child) {
  margin-top: .25rem;
  border-top: 1px solid var(--border);
}
.branded-select__option:hover,
.branded-select__option:focus-visible {
  background: color-mix(in srgb, var(--brand-primary) 7%, #fff);
  outline: none;
}
.branded-select__option.is-selected {
  color: color-mix(in srgb, var(--brand-primary) 88%, #071a12);
  background: color-mix(in srgb, var(--brand-primary) 11%, #fff);
  font-weight: 650;
}
.branded-select__option.is-placeholder:not(.is-selected) { color: var(--muted); }
.branded-select__option-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.branded-select__option.has-meta {
  display: grid;
  justify-items: start;
  gap: .12rem;
  text-align: left;
}
.branded-select__option-meta {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.branded-select__option:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: .55;
}
@media (prefers-reduced-motion: reduce) {
  .branded-select__toggle,
  .branded-select__chevron::before { transition: none; }
}
