.kp-custom-select {
    border-radius: 6px;
    display: inline-block;
    max-width: 100%;
    position: relative;
    vertical-align: middle;
}

.kp-custom-select[data-shape="pill"] {
    border-radius: 999px;
}

.kp-custom-select[data-full-width="true"] {
    width: 100%;
}

.kp-custom-select > .kp-custom-select-native {
    height: 1px !important;
    left: 0;
    max-width: 1px !important;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 1px !important;
}

.kp-custom-select > svg {
    display: none;
}

.kp-custom-select-trigger {
    align-items: center;
    background: color-mix(in srgb, var(--theme-deep) 82%, transparent);
    border: 1px solid var(--theme-line);
    border-radius: inherit;
    color: var(--theme-content);
    cursor: pointer;
    display: flex;
    font: inherit;
    height: var(--kp-select-height, 44px);
    justify-content: space-between;
    max-width: 100%;
    min-width: 100%;
    padding: 0 1rem;
    text-align: left;
    width: 100%;
}

.kp-custom-select-trigger:hover,
.kp-custom-select[data-open="true"] .kp-custom-select-trigger {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(239, 23, 51, 0.14);
}

.kp-custom-select-trigger:focus-visible {
    border-color: var(--color-accent);
    outline: 2px solid var(--theme-content);
    outline-offset: 3px;
}

.kp-custom-select-trigger-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kp-custom-select-trigger svg {
    display: block;
    flex: 0 0 auto;
    height: 16px;
    margin-left: 0.75rem;
    transition: transform 180ms ease;
    width: 16px;
}

.kp-custom-select[data-open="true"] .kp-custom-select-trigger svg {
    transform: rotate(180deg);
}

.kp-custom-select-menu {
    background: var(--theme-panel);
    border: 1px solid var(--theme-line);
    border-radius: 8px;
    box-shadow: var(--theme-panel-shadow), 0 20px 50px rgba(0, 0, 0, 0.32);
    left: 0;
    margin-top: 0.5rem;
    max-height: 320px;
    max-width: min(420px, calc(100vw - 2rem));
    min-width: min(320px, calc(100vw - 2rem));
    overflow-y: auto;
    padding: 0.4rem;
    position: absolute;
    scrollbar-color: var(--theme-faint) transparent;
    top: 100%;
    width: max-content;
    z-index: 50;
}

.kp-custom-select[data-align="end"] .kp-custom-select-menu {
    left: auto;
    right: 0;
}

.kp-custom-select-menu[hidden] {
    display: none;
}

.kp-custom-select-group {
    color: var(--theme-faint);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.75rem 0.75rem 0.35rem;
    text-transform: uppercase;
}

.kp-custom-select-option {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: var(--theme-subtle);
    cursor: pointer;
    display: flex;
    font: inherit;
    gap: 0.75rem;
    justify-content: space-between;
    min-height: 38px;
    padding: 0.5rem 0.75rem;
    text-align: left;
    width: 100%;
}

.kp-custom-select-option > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kp-custom-select-option:hover,
.kp-custom-select-option:focus-visible {
    background: color-mix(in srgb, var(--theme-content) 8%, transparent);
    color: var(--theme-content);
    outline: none;
}

.kp-custom-select-option[aria-selected="true"] {
    background: rgba(239, 23, 51, 0.14);
    color: #ff6579;
}

.kp-custom-select-option[aria-disabled="true"] {
    cursor: default;
    opacity: 0.45;
}

.kp-custom-select-check {
    color: #ff536a;
    flex: 0 0 auto;
    font-size: 0.85rem;
    opacity: 0;
}

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

@media (max-width: 640px) {
    .kp-custom-select-menu {
        min-width: min(280px, calc(100vw - 2rem));
    }
}