.smart-select {
    position: relative;
    min-width: 0;
    width: 100%;
}

.smart-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.smart-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    padding: 0.7rem 2.35rem 0.7rem 0.9rem;
    border: 1px solid var(--t-border);
    border-radius: 0.65rem;
    background: var(--t-surface-2);
    color: var(--t-text);
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.smart-select-trigger::after {
    content: '';
    position: absolute;
    right: 0.95rem;
    top: 50%;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-65%) rotate(45deg);
    opacity: 0.68;
    transition: transform 0.16s ease;
}

.smart-select.is-open .smart-select-trigger::after {
    transform: translateY(-30%) rotate(225deg);
}

.smart-select-trigger:hover {
    border-color: color-mix(in srgb, var(--t-text-muted) 55%, var(--t-border));
    background: var(--t-surface-3);
}

.smart-select-trigger:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--t-accent) 58%, var(--t-border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--t-accent) 16%, transparent);
}

.smart-select-trigger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.smart-select-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smart-select-menu {
    position: fixed;
    z-index: 1200;
    display: none;
    max-height: min(20rem, calc(100dvh - 1.5rem));
    padding: 0.35rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--t-border);
    border-radius: 0.7rem;
    background: var(--t-dropdown, var(--t-surface));
    color: var(--t-text);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    box-sizing: border-box;
}

.smart-select-menu.is-open { display: grid; gap: 0.15rem; }

.smart-select-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 2.7rem;
    padding: 0.65rem 0.75rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.84rem;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.smart-select-option:hover,
.smart-select-option:focus-visible {
    outline: none;
    background: var(--t-dropdown-hover, var(--t-surface-3));
}

.smart-select-option.is-selected {
    background: color-mix(in srgb, var(--t-accent) 13%, var(--t-surface-2));
    font-weight: 650;
}

.smart-select-option.is-selected::after {
    content: '';
    width: 0.42rem;
    height: 0.7rem;
    margin-right: 0.2rem;
    border-right: 2px solid var(--t-accent);
    border-bottom: 2px solid var(--t-accent);
    transform: rotate(45deg) translateY(-1px);
}

.smart-select-option:disabled { opacity: 0.45; cursor: not-allowed; }

.smart-select-option-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .smart-select-menu {
        max-height: min(55dvh, 24rem);
        padding: 0.4rem;
        border-radius: 0.8rem;
    }

    .smart-select-option {
        min-height: 3.15rem;
        padding: 0.75rem 0.85rem;
        font-size: 0.9rem;
    }
}
