.choices {
    width: 100%;
    min-width: 100%; /* ✅ 关键：最小宽度也是 100% */
    display: block;
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.4;
    position: relative;
    overflow: visible;
    height: auto; /* ✅ 确保它也随内容变高 */
}

.input-group-sm .input-group-text {
    align-self: flex-start;
    height: auto !important;
    padding-top: 0.375rem;
    padding-bottom: 0;
    font-size: 0.875rem;
    line-height: 1.4;
    white-space: nowrap;
}

.choices__inner {
    padding: 0.25rem 0.5rem;
    min-height: 32px !important;
    font-size: 0.875rem;
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    background: #fff;
    box-shadow: none;

    display: flex;
    flex-wrap: wrap; /* ✅ 自动换行 */
    align-items: flex-start; /* ✅ 顶部对齐内容 */
    gap: 4px; /* ✅ 项目间距 */
    overflow: visible; /* ✅ 不隐藏内容 */
    /** ✅ 添加关键属性 **/
    height: auto !important; /* 自动适应高度 */
}

.choices__list--multiple {
    display: flex;
    flex-wrap: wrap; /* ✅ 自动换行 */
    align-items: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    max-height: none !important;
    overflow: visible !important;
}

.choices__list--multiple .choices__item {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 0.75rem;
    background-color: #e7f1ff;
    border-radius: 0.25rem;
    color: #0d6efd;
    white-space: nowrap;
    line-height: 1.4;
    box-sizing: border-box;
}

.choices__item--selectable .choices__button {
    position: relative;
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1;
    margin-left: 6px;
    background: none;
    border: none;
    color: #0d6efd;
    opacity: 0.8;
    cursor: pointer;
    padding: 0;
}

.choices__item--selectable .choices__button::before {
    content: 'x';
    display: inline-block;
}

.choices__input--cloned {
    flex: 0 1 auto; /* ✅ 不强制占满空间，也不压缩成一行 */
    min-width: 160px; /* ✅ 设置较小的最小宽度 */
    max-width: 100%;
    border: none;
    padding: 2px 4px;
    font-size: 0.85rem;
    background: transparent;
    outline: none;
    box-sizing: border-box;
    align-self: center; /* ✅ 垂直居中 */
    white-space: nowrap;
}


.choices__list--dropdown,
.choices__list[aria-expanded] {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.05);
    font-size: 0.875rem;
    z-index: 999;
}

.choices__item--choice:hover {
    background-color: #f8f9fa;
}
