/* Smart Picker — 4-mode dropdown for high-volume selects */
.smart-picker { position: relative; display: inline-block; width: 100%; }

.sp-trigger {
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-inline-end: 2rem;
}
.sp-trigger[aria-expanded="true"] {
  border-color: var(--brand, #0f6e56);
  box-shadow: 0 0 0 .15rem rgba(15,110,86,.18);
}

.sp-panel {
  position: absolute;
  z-index: 1060;
  top: 100%;
  inset-inline-start: 0;
  width: 100%;
  min-width: 320px;
  max-height: 420px;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: .375rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 2px;
}

/* Mode tabs */
.sp-modes {
  display: flex;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  background: var(--bs-tertiary-bg, #f8f9fa);
  flex-shrink: 0;
}
.sp-mode-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: .4rem .2rem;
  font-size: .85rem;
  color: var(--bs-secondary-color, #6c757d);
  cursor: pointer;
  transition: all .15s;
  border-bottom: 2px solid transparent;
}
.sp-mode-btn:hover { color: var(--brand, #0f6e56); background: rgba(15,110,86,.04); }
.sp-mode-btn.active {
  color: var(--brand, #0f6e56);
  border-bottom-color: var(--brand, #0f6e56);
  font-weight: 600;
}

/* Search */
.sp-search-wrap {
  padding: .4rem .5rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  flex-shrink: 0;
}
.sp-search { font-size: .85rem; }

/* Content */
.sp-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .25rem 0;
  min-height: 80px;
  max-height: 320px;
}

/* Status */
.sp-status {
  flex-shrink: 0;
  padding: .2rem .5rem;
  font-size: .75rem;
  color: var(--bs-secondary-color, #6c757d);
  border-top: 1px solid var(--bs-border-color, #dee2e6);
  background: var(--bs-tertiary-bg, #f8f9fa);
  text-align: center;
}

/* ── Gallery mode ── */
.sp-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .35rem; padding: .35rem; }
.sp-gallery-card {
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: .35rem;
  padding: .5rem;
  cursor: pointer;
  transition: all .12s;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.sp-gallery-card:hover { border-color: var(--brand, #0f6e56); background: rgba(15,110,86,.04); }
.sp-gallery-card.selected { border-color: var(--brand, #0f6e56); background: rgba(15,110,86,.08); }
.sp-gallery-icon { font-size: 1.1rem; opacity: .7; }
.sp-gallery-title { font-size: .8rem; font-weight: 600; line-height: 1.2; }
.sp-gallery-desc { font-size: .7rem; color: var(--bs-secondary-color, #6c757d); line-height: 1.2; }

/* ── List mode ── */
.sp-group-header {
  padding: .25rem .6rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bs-secondary-color, #6c757d);
  background: var(--bs-tertiary-bg, #f8f9fa);
  position: sticky;
  top: 0;
  z-index: 1;
}
.sp-list-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .6rem;
  cursor: pointer;
  font-size: .85rem;
  transition: background .1s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: start;
}
.sp-list-item:hover { background: rgba(15,110,86,.06); }
.sp-list-item.selected { background: rgba(15,110,86,.1); font-weight: 600; }
.sp-list-item .sp-match { background: rgba(255,200,0,.3); border-radius: 2px; }
.sp-list-desc { font-size: .72rem; color: var(--bs-secondary-color, #6c757d); margin-inline-start: auto; }

/* ── Describe mode ── */
.sp-describe-hint {
  padding: .6rem;
  font-size: .82rem;
  color: var(--bs-secondary-color, #6c757d);
  text-align: center;
}
.sp-describe-suggestion {
  padding: .4rem .6rem;
  font-size: .82rem;
  color: var(--brand, #0f6e56);
  font-style: italic;
}

/* ── Suggested/recent mode ── */
.sp-recent-header {
  padding: .25rem .6rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--brand, #0f6e56);
}
.sp-empty {
  padding: 1rem;
  text-align: center;
  color: var(--bs-secondary-color, #6c757d);
  font-size: .85rem;
}

/* ── Current mode (native select) ── */
.sp-native-select { width: 100%; border: none; font-size: .85rem; }
.sp-native-select:focus { box-shadow: none; outline: none; }

/* RTL adjustments */
[dir="rtl"] .sp-trigger { text-align: right; padding-left: 2rem; padding-right: .75rem; }
[dir="rtl"] .sp-list-desc { margin-inline-start: auto; margin-inline-end: 0; }
