.sel { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.sel.sel-block { display: block; width: 100%; }
.sel[hidden] { display: none; }
.sel-native { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.sel-btn {
  display: flex; align-items: center; width: 100%; min-width: 0; height: 37px; padding: 0 34px 0 12px;
  border: 1px solid rgba(14, 26, 43, 0.2); border-radius: var(--r-ctl);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23676F7A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7.5 10 4.5 4.5 4.5-4.5'/%3E%3C/svg%3E") right 10px center / 17px no-repeat;
  color: var(--text); font-family: var(--font-ui); font-size: 13.5px; text-align: left; cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.2s ease;
}
.sel:not(.sel-block) .sel-btn { width: auto; }
.sel-btn:hover { border-color: rgba(14, 26, 43, 0.34); }
.sel-btn:focus-visible, .sel-btn[aria-expanded="true"] { outline: none; border-color: var(--t600); box-shadow: var(--focus-ring); }
.sel-btn:disabled { background-color: var(--bg-soft); border-color: var(--line-soft); color: rgba(14, 26, 43, 0.55); cursor: default; }
.sel-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-sm .sel-btn { height: 30px; padding: 0 28px 0 10px; border-radius: 9px; font-size: 12.5px; background-position: right 7px center; background-size: 15px; }
.sel-pop {
  position: fixed; z-index: 1000; box-sizing: border-box; min-width: 160px; max-width: min(420px, calc(100vw - 16px));
  max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding: 5px;
  background: var(--bg-raised); border-radius: 12px; box-shadow: var(--sh-pop);
  font-family: var(--font-ui); font-size: 13.5px; color: var(--text); outline: none;
  animation: sel-in 0.14s var(--ease-out);
}
.sel-pop[data-side="top"] { animation-name: sel-up; }
@keyframes sel-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes sel-up { from { opacity: 0; transform: translateY(4px); } }

.sel-opt {
  position: relative; display: flex; align-items: center; min-height: 32px; padding: 6px 32px 6px 10px; border-radius: 8px;
  line-height: 1.3; cursor: pointer; user-select: none;
}
.sel-opt[data-active] { background: var(--bg-soft); }
.sel-opt[aria-selected="true"] { color: var(--t800); font-weight: 600; }
.sel-opt[aria-selected="true"]::after {
  content: ""; position: absolute; right: 9px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23249575' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.sel-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-meta { margin-left: 12px; color: var(--dim); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums;
            white-space: nowrap; }
.sel-opt[aria-selected="true"] .sel-meta { color: var(--t700); }
.sel-opt[aria-disabled="true"] { color: var(--dim); cursor: default; }
.sel-opt[aria-disabled="true"][data-active] { background: none; }
.sel-grp { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px 4px; color: var(--dim);
           font-size: 11.5px; font-weight: 600; }
.sel-grp-n { font-weight: 500; }
.sel-none { padding: 14px 12px; color: var(--dim); font-size: 13px; }
.sel-pop.sel-find { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.sel-search { flex: none; padding: 6px; border-bottom: 1px solid var(--line-soft); }
.sel-search input {
  width: 100%; height: 32px; padding: 0 10px 0 31px; border: 1px solid rgba(14, 26, 43, 0.2); border-radius: 8px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23676F7A' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.3'/%3E%3Cpath d='m15.8 15.8 3.9 3.9'/%3E%3C/svg%3E") 9px center / 15px no-repeat;
  color: var(--text); font: 13.5px var(--font-ui); outline: none;
}
.sel-search input:focus { border-color: var(--t600); box-shadow: var(--focus-ring); }
.sel-search input::-webkit-search-cancel-button { display: none; }
.sel-find .sel-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 5px; outline: none; }
.sel-grp:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--line-soft); }
.sel-scrim { position: fixed; inset: 0; z-index: 999; background: rgba(14, 26, 43, 0.32); animation: sel-fade 0.16s ease; }
.sel-pop.sel-sheet {
  left: 8px; right: 8px; bottom: 8px; top: auto; max-width: none; max-height: 62vh; padding: 8px;
  border-radius: 18px; font-size: 15px; animation: sel-sheet 0.2s var(--ease-out);
}
.sel-sheet .sel-opt { min-height: 46px; padding-left: 14px; }
@keyframes sel-fade { from { opacity: 0; } }
@keyframes sel-sheet { from { transform: translateY(24px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .sel-pop, .sel-pop.sel-sheet, .sel-scrim { animation: none; }
}
