/* Every dropdown in the site's identity (static/js/select.js). The native <select> stays as the value, hidden; a
   button stands in its place; the options open in a bottom sheet on touch and in an anchored list for a mouse.
   Colours come from the page's own tokens: navy and cyan on the forum's pages, black and white on RRAY's. */
:root { --sel-accent: #ffffff; --sel-ring: rgba(255, 255, 255, 0.1); --sel-surface: #111111; --sel-field: #0a0a0a; --sel-tint: rgba(255, 255, 255, 0.09); --sel-mark: #ffffff; }
body.forum { --sel-accent: #4cd0d4; --sel-ring: rgba(7, 164, 169, 0.24); --sel-surface: #02304f; --sel-field: rgba(0, 22, 38, 0.55); --sel-tint: rgba(7, 164, 169, 0.2); --sel-mark: #4cd0d4; }
.dash { --sel-field: var(--field-bg, #0a0a0a); }

/* the native control: still there for forms and scripts, never seen and never opened */
select.sel-native { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; border: 0 !important;
  overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }

/* the button that stands in its place */
.sel-trigger { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 50px; box-sizing: border-box; padding: 12px 14px;
  background: var(--sel-field); border: 1px solid var(--line, rgba(255, 255, 255, 0.14)); border-radius: 12px; color: var(--ink, #f5f5f5);
  font: inherit; font-size: 16px; font-weight: 500; line-height: 1.5; text-align: start; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease; }
.sel-trigger:hover { border-color: color-mix(in srgb, var(--sel-accent) 55%, transparent); }
.sel-trigger:focus-visible, .sel-trigger[aria-expanded="true"] { outline: none; border-color: var(--sel-accent); box-shadow: 0 0 0 3px var(--sel-ring); }
.sel-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
.sel-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-trigger.is-placeholder .sel-value { color: var(--ink-mute, #8a8a8a); }
.sel-chevron { flex: none; width: 16px; height: 16px; color: var(--ink-dim, #a3a3a3); transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s ease; }
.sel-trigger[aria-expanded="true"] .sel-chevron { transform: rotate(180deg); color: var(--sel-accent); }
select.sel-native.is-invalid + .sel-trigger, select.sel-native.has-error + .sel-trigger { border-color: #ff7a7a; box-shadow: 0 0 0 3px rgba(255, 122, 122, 0.16); }
/* the dashboard's fields are smaller; a filter is as wide as its words */
.dash .sel-trigger { min-height: 0; padding: 10px 13px; border-radius: var(--r-sm, 10px); font-size: 14.5px; }
.sel-trigger.is-compact { display: inline-flex; width: auto; min-height: 0; padding: 8px 12px; font-size: 13px; }

/* the open list, shared by both forms */
.sel-pop, dialog.sel-sheet { box-sizing: border-box; padding: 0; color: var(--ink, #f5f5f5); background: var(--sel-surface); border: 1px solid var(--line, rgba(255, 255, 255, 0.14)); font-family: inherit; }
.sel-list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 6px; list-style: none; overflow-y: auto; overscroll-behavior: contain; outline: none; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
.sel-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 12px; border-radius: 10px; font-size: 15px; line-height: 1.5; cursor: pointer; }
.sel-opt.is-active { background: color-mix(in srgb, var(--sel-accent) 10%, transparent); }
.sel-opt[aria-selected="true"] { background: var(--sel-tint); color: #fff; font-weight: 700; }
.sel-opt[aria-selected="true"].is-active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sel-accent) 60%, transparent); }
.sel-opt[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.sel-check { flex: none; width: 18px; height: 18px; color: var(--sel-mark); opacity: 0; transform: scale(0.6); transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.sel-opt[aria-selected="true"] .sel-check { opacity: 1; transform: none; }
.sel-group { padding: 12px 12px 4px; font-size: 12.5px; font-weight: 700; color: var(--ink-mute, #8a8a8a); }
.sel-empty { padding: 22px 12px; text-align: center; font-size: 14px; color: var(--ink-mute, #8a8a8a); }
.sel-search { flex: none; padding: 8px 8px 2px; }
.sel-search[hidden] { display: none; }
.sel-search input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line, rgba(255, 255, 255, 0.14)); border-radius: 10px; background: rgba(0, 0, 0, 0.22); color: inherit; font: inherit; font-size: 16px; }
.sel-search input:focus { outline: none; border-color: var(--sel-accent); box-shadow: 0 0 0 3px var(--sel-ring); }
.sel-search input::placeholder { color: var(--ink-mute, #8a8a8a); }
.sel-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* a mouse: a list anchored to the button (the script places it) */
.sel-pop { position: fixed; inset: auto; z-index: 2000; margin: 0; border-radius: 14px; box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.75); overflow: hidden; flex-direction: column; }
.sel-pop:not(.is-open) { display: none; }
.sel-pop.is-open { display: flex; animation: selPop 0.18s cubic-bezier(0.16, 1, 0.3, 1); }
.sel-pop.is-open.is-up { animation-name: selPopUp; }
.sel-pop .sel-grip, .sel-pop .sel-head { display: none; }
@keyframes selPop { from { opacity: 0; transform: translateY(-6px); } }
@keyframes selPopUp { from { opacity: 0; transform: translateY(6px); } }

/* touch: a bottom sheet with large rows */
dialog.sel-sheet { position: fixed; inset: auto 0 0 0; width: 100%; max-width: 560px; height: auto; max-height: min(82vh, 680px); max-height: min(82dvh, 680px); margin: 0 auto;
  border-bottom: 0; border-radius: 24px 24px 0 0; box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, 0.7); overflow: hidden; }
dialog.sel-sheet[open] { display: flex; flex-direction: column; animation: selUp 0.34s cubic-bezier(0.16, 1, 0.3, 1); }
dialog.sel-sheet::backdrop { background: rgba(0, 8, 16, 0.62); animation: selFade 0.25s ease; }
.sel-grip { flex: none; width: 40px; height: 4px; margin: 10px auto 0; border-radius: 4px; background: rgba(255, 255, 255, 0.22); }
.sel-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 8px 10px; padding-inline: 18px 10px; border-bottom: 1px solid var(--line-soft, rgba(255, 255, 255, 0.08)); }
.sel-title { font-size: 16.5px; font-weight: 800; }
.sel-close { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.07); color: inherit; cursor: pointer; }
.sel-close svg { width: 18px; height: 18px; }
.sel-close:focus-visible { outline: 2px solid var(--sel-accent); outline-offset: 2px; }
.sel-sheet .sel-search { padding: 12px 14px 4px; }
.sel-sheet .sel-search input { padding: 12px 14px; border-radius: 12px; }
.sel-sheet .sel-list { padding: 8px 10px calc(14px + env(safe-area-inset-bottom, 0px)); }
.sel-sheet .sel-opt { min-height: 54px; padding: 10px 14px; border-radius: 14px; font-size: 16.5px; }
.sel-sheet .sel-check { width: 22px; height: 22px; }
@keyframes selUp { from { transform: translateY(100%); } }
@keyframes selFade { from { opacity: 0; } }
/* while the sheet is open the page behind does not scroll */
html.sel-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .sel-pop.is-open, dialog.sel-sheet[open], dialog.sel-sheet::backdrop { animation: none; }
  .sel-chevron, .sel-check { transition: none; }
}
