.fk-ms {
    position: relative;
    width: 100%;
    min-width: 0;
}

.fk-ms-native {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.fk-ms-control {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    padding: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    cursor: text;
}

.fk-ms-control:focus-within,
.fk-ms-control.is-open {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent);
}

.fk-ms-control.is-disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: var(--surface-muted);
}

.fk-ms-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 240px;
    border: 1px solid var(--border);
    background: var(--surface-subtle);
    color: var(--text-soft);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    line-height: 1.3;
}

.fk-ms-chip-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fk-ms-chip-remove {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.fk-ms-chip-remove:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-radius: 4px;
}

.fk-ms-more {
    font-size: 12px;
    color: var(--muted);
}

.fk-ms-search {
    flex: 1 1 140px;
    min-width: 100px;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 4px 2px;
    min-height: 30px;
}

.fk-ms-search:focus {
    outline: none;
    box-shadow: none;
}

.fk-ms-placeholder {
    color: var(--muted);
    font-size: 14px;
    padding-left: 2px;
}

.fk-ms-toggle {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    min-width: 28px;
    min-height: 28px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1;
}

.fk-ms-toggle:hover {
    background: var(--surface-subtle);
}

.fk-ms-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.fk-ms-panel {
    position: absolute;
    z-index: 1500;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fk-ms-panel-header {
    border-bottom: 1px solid var(--border);
    padding: 8px;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.fk-ms-panel-search {
    width: 100%;
}

.fk-ms-list {
    max-height: 300px;
    overflow: auto;
    position: relative;
}

.fk-ms-list-inner {
    position: relative;
}

.fk-ms-option {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
    background: var(--surface);
}

.fk-ms-option:hover {
    background: var(--surface-subtle);
}

.fk-ms-option.is-active {
    background: var(--surface-hover);
}

.fk-ms-option.is-selected {
    background: var(--info-bg);
}

.fk-ms-option.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fk-ms-option-check {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex: 0 0 auto;
}

.fk-ms-option-main {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.fk-ms-option-label {
    font-size: 14px;
    line-height: 1.3;
    color: var(--text);
    word-break: break-word;
}

.fk-ms-option-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.3;
}

.fk-ms-highlight {
    background: var(--warning-bg);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.fk-ms-empty {
    padding: 14px 12px;
    color: var(--muted);
    font-size: 13px;
}

.fk-ms-loading {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
}

.fk-ms-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 1700;
}

.fk-ms-sheet {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: var(--surface);
    z-index: 1701;
    display: flex;
    flex-direction: column;
}

.fk-ms-sheet-header {
    position: sticky;
    top: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px;
    display: grid;
    gap: 8px;
    z-index: 1;
}

.fk-ms-sheet-title {
    font-size: 14px;
    font-weight: 600;
}

.fk-ms-sheet-footer {
    border-top: 1px solid var(--border);
    padding: 10px;
    background: var(--surface);
}

.fk-ms-sheet-done {
    width: 100%;
    min-height: 44px;
}

@media (max-width: 768px) {
    .fk-ms-panel {
        display: none;
    }
}
