/* ── Searchable Select ─────────────────────────────────────────────
   Progressive enhancement for <select data-searchable>.
   ----------------------------------------------------------------- */

.ss-wrap {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: auto;
  min-width: 160px;
  max-width: 260px;
}

.ss-input {
  width: 100%;
  min-width: 160px;
  cursor: text;
  padding-right: 1.75rem;
}

.ss-chevron {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
  cursor: pointer;
  font-size: .75rem;
  color: #64748b;
  line-height: 1;
  user-select: none;
}

.ss-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  min-width: 100%;
  margin-top: 2px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  z-index: 200;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.ss-option {
  padding: .4rem .75rem;
  cursor: pointer;
  font-size: .875rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-option:hover,
.ss-option--active {
  background: #f1f5f9;
}

.ss-option--selected {
  color: #0ea5e9;
}

.ss-option--disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ss-option--empty {
  color: #94a3b8;
  cursor: default;
  font-style: italic;
}
.ss-option--empty:hover {
  background: transparent;
}

.ss-group-header {
  padding: .3rem .75rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
  margin-top: .15rem;
  cursor: default;
  user-select: none;
}
.ss-group-header:first-child {
  border-top: none;
  margin-top: 0;
}

/* ── Dark mode (data-mode="dark" on <html>) ── */
[data-mode="dark"] .ss-dropdown {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
[data-mode="dark"] .ss-option {
  color: #e2e8f0;
}
[data-mode="dark"] .ss-option:hover,
[data-mode="dark"] .ss-option--active {
  background: #334155;
}
[data-mode="dark"] .ss-option--selected {
  color: #38bdf8;
}
[data-mode="dark"] .ss-option--empty {
  color: #64748b;
}
[data-mode="dark"] .ss-group-header {
  color: #64748b;
  border-top-color: #334155;
}
[data-mode="dark"] .ss-chevron {
  color: #94a3b8;
}
