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

.baggy-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.baggy-select-trigger {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 15px;
  border: 1px solid var(--line, #d8dee9);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface, #fff) 96%, transparent);
  color: var(--text, #172033);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.baggy-select-trigger:hover {
  border-color: color-mix(in srgb, var(--accent, #2454d6) 35%, var(--line));
}

.baggy-select-trigger:focus-visible,
.baggy-select.is-open .baggy-select-trigger {
  outline: 0;
  border-color: var(--accent, #2454d6);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, #2454d6) 14%, transparent);
}

.baggy-select-trigger.is-placeholder {
  color: var(--muted, #70798b);
}

.baggy-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

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

.baggy-select-chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}

.baggy-select.is-open .baggy-select-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.baggy-select-listbox {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 7px);
  left: 0;
  width: 100%;
  max-height: min(320px, 52vh);
  padding: 6px;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--line, #d8dee9) 88%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface, #fff) 98%, transparent);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.985);
  transform-origin: top center;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  backdrop-filter: blur(18px);
  overscroll-behavior: contain;
}

.baggy-select.is-open .baggy-select-listbox {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.baggy-select.is-upward .baggy-select-listbox {
  top: auto;
  bottom: calc(100% + 7px);
  transform-origin: bottom center;
}

.baggy-select-option {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text, #172033);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.baggy-select-option:hover,
.baggy-select-option.is-active {
  background: color-mix(in srgb, var(--accent, #2454d6) 8%, transparent);
  color: var(--accent, #2454d6);
}

.baggy-select-option:active {
  transform: scale(0.995);
}

.baggy-select-option[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent, #2454d6) 12%, transparent);
  color: var(--accent, #2454d6);
  font-weight: 750;
}

.baggy-select-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.baggy-select-check {
  opacity: 0;
  text-align: center;
  font-size: 12px;
}

.baggy-select-option[aria-selected="true"] .baggy-select-check {
  opacity: 1;
}

body.dark .baggy-select-trigger,
body.dark .baggy-select-listbox {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(24, 31, 46, 0.96);
  color: #f4f6fa;
}

body.dark .baggy-select-option {
  color: #f4f6fa;
}

@media (prefers-reduced-motion: reduce) {
  .baggy-select-trigger,
  .baggy-select-chevron,
  .baggy-select-listbox,
  .baggy-select-option {
    transition: none;
  }
}
