/* HyggerSelect · 零依赖限高可滚动/可搜索自定义下拉组件样式
 * 列表区严格限高 max-height: 240px（约 6-7 项），超出平滑滚动，绝不撑爆屏幕。
 */
.cs-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}
.field .cs-wrap { display: flex; width: 100%; }
.cs-wrap[hidden] { display: none !important; }

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

.cs-trigger {
  width: 100%;
  min-width: 118px;
  height: 36px;
  padding: 0 32px 0 11px;
  border: 1px solid var(--border-default, #cbd5e1);
  border-radius: 8px;
  background: var(--bg-surface, #fff);
  color: var(--text-primary, #0f172a);
  font: 400 13px/1 inherit;
  text-align: left;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  position: relative;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.cs-trigger:hover:not(:disabled) { border-color: var(--border-strong, #94a3b8); }
.cs-trigger:focus-visible,
.cs-trigger[aria-expanded="true"] {
  outline: none;
  border-color: var(--brand-600, #0f766e);
  box-shadow: 0 0 0 3px var(--brand-ring, rgba(15, 118, 110, 0.16));
}
.cs-trigger:disabled {
  background: var(--bg-subtle, #f1f5f9);
  color: var(--text-disabled, #94a3b8);
  cursor: not-allowed;
}
.cs-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}
.cs-label.is-placeholder { color: var(--text-muted, #64748b); }
.cs-chevron {
  position: absolute;
  right: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted, #64748b);
  transition: transform .16s ease;
  pointer-events: none;
}
.cs-trigger[aria-expanded="true"] .cs-chevron { transform: rotate(180deg); color: var(--brand-600, #0f766e); }

@keyframes csMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 弹出浮层（支持 Top-Layer Popover API 与 fixed 降级） */
.cs-menu {
  position: fixed;
  z-index: 9999;
  margin: 0;
  padding: 0;
  background: var(--bg-surface, #fff);
  animation: csMenuIn .16s cubic-bezier(.22, 1, .36, 1) both;
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 10px;
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 23, 42, 0.14));
  overflow: hidden;
  min-width: 168px;
  max-width: min(440px, calc(100vw - 20px));
  color: var(--text-primary, #0f172a);
  font-size: 13px;
}
.cs-menu::backdrop { display: none; }

.cs-search-wrap {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  background: #ffffff;
  position: relative;
  z-index: 2;
}
.cs-search {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border-default, #cbd5e1);
  border-radius: 6px;
  background: #fff;
  color: var(--text-primary, #0f172a);
  font: inherit;
  font-size: 12.5px;
}
.cs-search:focus {
  outline: none;
  border-color: var(--brand-600, #0f766e);
  box-shadow: 0 0 0 2px var(--brand-ring, rgba(15, 118, 110, 0.16));
}

/* 核心限高滚动区：最多可视 6-7 项（240px），超出平滑滚动 */
.cs-list {
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.cs-list::-webkit-scrollbar { width: 6px; }
.cs-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.cs-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.cs-group-label {
  padding: 6px 10px 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  letter-spacing: .3px;
}
.cs-option {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary, #0f172a);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background .1s ease, color .1s ease;
}
.cs-option span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-option.is-active,
.cs-option:hover:not(:disabled) { background: var(--bg-subtle, #f1f5f9); }
.cs-option.is-selected {
  background: var(--brand-50, #ecfdf5);
  color: var(--brand-700, #115e59);
  font-weight: 600;
}
.cs-option:disabled { color: var(--text-disabled, #94a3b8); cursor: not-allowed; }
.cs-check { flex: 0 0 auto; font-size: 12px; color: var(--brand-600, #0f766e); }
.cs-empty { padding: 16px 12px; text-align: center; color: var(--text-muted, #64748b); font-size: 12.5px; }
