/* mselect.css - 通用多选下拉样式
 * 配套 js/core/mselect.js 使用
 * 单一源:所有用 mselect 的页面引这一个文件
 * 源自 relations.css 的 .mselect 段(2026-07-29 §14 重构抽出)
 */

.mselect {
  position: relative;
}

.mselect-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.mselect-toggle:hover {
  border-color: #94a3b8;
}

.mselect-arrow {
  color: #94a3b8;
  font-size: 10px;
}

.mselect-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 100;
  /* §16: 默认 5 个 item 高度 (~200px = 25px*5 + 搜索框 + 全选 占位),需要更多时单独加 .mselect-lg */
  max-height: 200px;
  overflow-y: auto;
}

.mselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: #1e293b;
  cursor: pointer;
}

.mselect-item:hover {
  background: #f8fafc;
}

.mselect-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.mselect-search {
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.mselect-search input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  outline: none;
  background: #fff;
  color: #37352f;
  box-sizing: border-box;
}

.mselect-search input:focus {
  border-color: var(--color-primary);
}

.mselect-item.mselect-all {
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  color: var(--color-primary-dark);
  background: #f8fafc;
}

/* mselect 紧凑版(filter bar 用) */
.mselect-sm .mselect-toggle {
  padding: 5px 8px;
  font-size: 12px;
  min-width: 160px;
}

.mselect-sm .mselect-dropdown {
  min-width: 240px;
  max-height: 240px;
}

.mselect-sm .mselect-search input {
  padding: 4px 6px;
  font-size: 11px;
}

.mselect-sm .mselect-item {
  padding: 4px 8px;
  font-size: 12px;
}

/* mselect 大版(§16: 授权 modal 选 LP 用,显示 7 个 item,其余滚动) */
.mselect-lg .mselect-dropdown {
  max-height: 260px;  /* 7 item × 28px + 搜索框 + 全选 */
}

/* grant form: mselect + 范围 select + 添加按钮同行 */
.grant-form-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.grant-form-row .mselect {
  flex: 1;
  min-width: 0;
}

.grant-form-row .grant-form-scope {
  flex: 0 0 auto;
  width: 110px;
  min-width: 0;
}

.grant-form-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}
