.smart-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.smart-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.smart-select [hidden] {
  display: none !important;
}

.smart-select-trigger {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #CFC1B7;
  border-radius: 8px;
  background: white;
  color: var(--text);
  text-align: left;
  font: inherit;
  line-height: 1.5;
}

.smart-select-trigger:hover:not(:disabled) {
  border-color: #BFAFA4;
}

.smart-select-trigger:focus-visible,
.smart-select.is-open .smart-select-trigger {
  outline: none;
  border-color: var(--sheet-green);
  box-shadow: 0 0 0 3px rgba(105,148,140,.14);
}

.smart-select-trigger:disabled {
  background: #F1ECE8;
  color: #756D67;
  cursor: not-allowed;
}

.smart-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-select-trigger.is-placeholder .smart-select-value {
  color: var(--muted);
}

.smart-select-chevron {
  width: 9px;
  height: 9px;
  margin-right: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .12s ease;
}

.smart-select.is-open .smart-select-chevron {
  transform: translateY(2px) rotate(225deg);
}

.smart-select-panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  min-width: min(320px, 90vw);
  padding: 6px;
  border: 1px solid #CFC1B7;
  border-radius: 10px;
  background: white;
  box-shadow: 0 16px 36px rgba(43, 54, 51, .16);
}

/* Open menus are moved to document.body so table/panel overflow can never clip
   them. The portal script supplies viewport-relative top/left/width values. */
.smart-select-panel-portaled {
  position: fixed;
  z-index: 1000;
  right: auto;
  min-width: 0;
  margin: 0;
}

.smart-select-search {
  width: 100%;
  min-height: 38px;
  margin: 0 0 5px;
  padding: 7px 9px;
  border-radius: 7px;
  font-weight: 500;
}

.smart-select-results {
  max-height: 260px;
  overflow-y: auto;
}

.smart-select-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: white;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-weight: 600;
}

.smart-select-option:hover:not(:disabled),
.smart-select-option.is-active,
.smart-select-option:focus-visible {
  outline: none;
  background: #EDF4F1;
}

.smart-select-option.is-selected {
  color: var(--sheet-dark-green);
  background: #F4F8F6;
}

.smart-select-option:disabled {
  color: #9A928C;
  cursor: not-allowed;
}

.smart-select-check {
  color: var(--sheet-dark-green);
  font-weight: 900;
}

.smart-select-message {
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.smart-select.is-invalid .smart-select-trigger {
  border-color: #B96B59;
  box-shadow: 0 0 0 3px rgba(185,107,89,.12);
}

.smart-select-compact .smart-select-trigger {
  min-height: 36px;
  padding: 7px 9px;
  font-size: 12px;
}

.smart-select-compact .smart-select-panel {
  min-width: 240px;
}

/* Status controls keep their coloured dot, so reserve space for it in the
   generated searchable-select trigger instead of letting the dot cover text. */
.status-picker .smart-select-trigger {
  padding-left: 30px;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.status-picker .status-picker-dot {
  z-index: 3;
}

.status-picker[data-tone="neutral"] .smart-select-trigger {
  background: #F5F1EE;
  border-color: #DDD4CE;
  color: #5B625F;
}

.status-picker[data-tone="success"] .smart-select-trigger {
  background: #E7F0ED;
  border-color: #B9D0CA;
  color: #2D4F48;
}

.status-picker[data-tone="info"] .smart-select-trigger {
  background: #E9F0EE;
  border-color: #C3D5D0;
  color: #385B54;
}

.status-picker[data-tone="warning"] .smart-select-trigger {
  background: #FAF0DB;
  border-color: #DFC48E;
  color: #78521D;
}

.status-picker[data-tone="danger"] .smart-select-trigger {
  background: #F8EAE5;
  border-color: #DBB7AC;
  color: #81493C;
}

@media (max-width: 680px) {
  .smart-select-panel:not(.smart-select-panel-portaled) {
    min-width: 100%;
  }

  .smart-select-results {
    max-height: 220px;
  }
}
