.px-select-search {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 44px;
  min-width: 0; width: 100%;
}
.px-select-search[hidden] { display: none; }
.px-select-search > input {
  grid-area: 1 / 1 / 2 / -1; box-sizing: border-box; min-width: 0; width: 100%;
  /* Keep text clear of the arrow even when mobile filter padding is applied. */
  padding-inline-end: 3rem !important;
}
.px-select-toggle {
  /* Share the input's row, so opening the list never stretches the arrow. */
  grid-area: 1 / 2 / 2 / 3; align-self: stretch; margin: 1px;
  min-width: 0; min-height: 0 !important;
  display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 0; border-inline-start: 1px solid var(--tm-line, #cbd5e1);
  border-radius: 0 7px 7px 0; background: var(--tm-bg-soft, #f1f5f9);
  color: var(--tm-text, #0f172a); font-size: 1.125rem;
}
.px-select-toggle:hover, .px-select-toggle[aria-expanded="true"] {
  background: var(--analysis-control-bg, #e0f2fe);
}
.px-select-toggle:focus-visible { outline: 2px solid var(--tm-info, #0284c7); outline-offset: 2px; }
.px-select-options {
  position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 40;
  max-height: min(20rem, 45dvh); overflow-y: auto; overscroll-behavior: contain;
  background: var(--tm-bg, #fff); color: var(--tm-text, #0f172a);
  border: 1px solid var(--tm-line, #cbd5e1); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.px-select-options[hidden] { display: none; }
.px-select-options [role="option"], .px-select-empty {
  padding: .65rem .75rem; min-height: 44px; font-size: .8125rem;
  font-weight: 500; line-height: 1.4; letter-spacing: normal; text-transform: none;
  white-space: normal; overflow-wrap: anywhere; cursor: pointer;
}
.px-select-options [role="option"]:hover, .px-select-options .is-active,
.px-select-options [aria-selected="true"] { background: var(--tm-bg-soft, #f1f5f9); }
.px-select-empty { cursor: default; color: var(--tm-muted, #64748b); }
/* An <optgroup>'s label heads its options (Indices, Stocks); it stays in view while its options scroll. */
.px-select-group {
  position: sticky; top: 0; z-index: 1; padding: .4rem .75rem .3rem;
  background: var(--tm-bg-soft, #f1f5f9); color: var(--tm-muted, #64748b);
  font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--tm-line, #e2e8f0);
}
@media (max-width: 767px) { .px-select-search > input { font-size: 16px !important; min-height: 44px; } }
@media (max-width: 767px) {
  /* Keep touch results in the form flow so they cannot cover Apply or another field. */
  .px-select-options { grid-area: 2 / 1 / 3 / -1; position: relative; inset: auto; margin-top: 4px; }
}
