.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.toolbar > .custom-select {
  width: auto;
  min-width: 190px;
  flex: 0 1 220px;
}

.toolbar > .custom-select .custom-select-trigger {
  background: var(--panel);
}

#page-payments .payments-history-controls .custom-select {
  width: min(220px, 100%);
}

.custom-select > select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select-trigger {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--panel2);
  font: inherit;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.custom-select-trigger:hover {
  border-color: color-mix(in srgb, var(--brand2) 32%, var(--line));
  background: var(--panel);
}

.custom-select.is-open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  outline: 0;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
  background: var(--panel);
}

.custom-select-trigger:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-chevron {
  width: 9px;
  height: 9px;
  justify-self: center;
  margin-top: -4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.custom-select.is-open .custom-select-chevron {
  margin-top: 4px;
  transform: rotate(225deg);
}

.custom-select-popover {
  position: fixed;
  z-index: 1200;
  max-height: min(320px, calc(100vh - 24px));
  padding: 6px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(31, 27, 42, 0.16);
}

.custom-select-option {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  color: var(--text);
  background: transparent;
  font: inherit;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.custom-select-option::before {
  content: '';
  width: 7px;
  height: 12px;
  justify-self: center;
  border: solid transparent;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.custom-select-option:hover,
.custom-select-option.is-active {
  background: var(--panel2);
}

.custom-select-option[aria-selected='true'] {
  color: var(--brand-ink);
  background: color-mix(in srgb, var(--soft) 78%, var(--panel));
  font-weight: 800;
}

.custom-select-option[aria-selected='true']::before {
  border-color: var(--brand-ink);
}

.custom-select-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rating-label .custom-select {
  width: 68px;
  flex: 0 0 68px;
}

.rating-label .custom-select-trigger {
  min-height: 36px;
  padding: 8px 9px;
  border-radius: 10px;
}

@media (max-width: 620px) {
  .custom-select-popover {
    max-height: min(300px, calc(100vh - 18px));
  }

  .custom-select-option {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .custom-select-trigger,
  .custom-select-chevron {
    transition: none;
  }
}
