:root {
    --bth-sel-border: #bfbfc0;
    --bth-sel-focus: #3374db;
    --bth-sel-text: #242424;
    --bth-sel-muted: #9a9a9a;
    --bth-sel-hover-bg: #eef3fc;
    --bth-sel-check: #3374db;
    --bth-sel-radius: 4px;
    --bth-sel-spring: cubic-bezier(.22, 1.2, .36, 1);
}

/* Select nativo fica escondido, mas continua sendo a fonte */
select.bth-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.bth-select {
    position: relative;
    width: 100%;
}

div.bth-select .bth-select-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    height: 34px;
    padding: 6px 34px 6px 12px;
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 13px;
    line-height: 1.42857;
    color: var(--bth-sel-text);
    text-align: left;
    background-color: #fff;
    border: 1px solid var(--bth-sel-border);
    border-radius: var(--bth-sel-radius);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

    div.bth-select .bth-select-trigger:hover:not([disabled]) {
        border-color: #a3a3a5;
    }

    div.bth-select .bth-select-trigger:focus,
    div.bth-select.is-open .bth-select-trigger {
        outline: 0;
        border-color: var(--bth-sel-focus) !important;
        box-shadow: 0 0 0 3px rgba(51, 116, 219, .15) !important;
    }

    div.bth-select .bth-select-trigger[disabled] {
        background-color: #ededed !important;
        color: #757576 !important;
        cursor: not-allowed !important;
    }

.bth-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

    .bth-select-value.is-placeholder {
        color: var(--bth-sel-muted);
    }

.bth-select-chevron {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    color: #757576;
    opacity: .7;
    pointer-events: none;
    transition: transform .25s var(--bth-sel-spring);
}

.bth-select.is-open .bth-select-chevron {
    transform: rotate(180deg);
}

/* Erro de validação (mesmo padrão dos demais campos) */
.bth-field-error div.bth-select .bth-select-trigger,
.field-error div.bth-select .bth-select-trigger {
    border-color: #dd413c !important;
}

/*  Menu  */
.bth-select-menu {
    position: fixed;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e1e1e2;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06);
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 13px;
    color: var(--bth-sel-text);
    transform-origin: top center;
    opacity: 0;
    transform: translateY(-4px) scale(.95);
}

    .bth-select-menu.is-up {
        transform-origin: bottom center;
        transform: translateY(4px) scale(.95);
    }

    .bth-select-menu.is-open {
        opacity: 1;
        transform: translateY(0) scale(1);
        transition: opacity .2s ease-out, transform .25s var(--bth-sel-spring);
    }

    .bth-select-menu.is-closing {
        opacity: 0;
        transform: translateY(-4px) scale(.95);
        transition: opacity .15s ease-in, transform .15s ease-in;
    }

        .bth-select-menu.is-up.is-closing {
            transform: translateY(4px) scale(.95);
        }

.bth-select-list {
    overflow-y: auto;
    padding: 4px;
    overscroll-behavior: contain;
}

/* Pesquisa opcional (select com data-pesquisa) */
.bth-select-search {
    flex-shrink: 0;
    padding: 6px 6px 4px;
    border-bottom: 1px solid #ededee;
}

    .bth-select-search-input {
        width: 100%;
        height: 30px;
        padding: 0 8px;
        border: 1px solid #e1e1e2;
        border-radius: 4px;
        font: inherit;
        font-size: 13px;
        outline: none;
    }

        .bth-select-search-input:focus {
            border-color: #3374db;
        }

.bth-select-group-label {
    padding: 6px 8px 4px;
    font-size: 11px;
    color: #757576;
}

.bth-select-separator {
    height: 1px;
    margin: 4px -4px;
    background: #ededed;
}

.bth-select-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 6px 30px 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background-color .12s ease, transform .15s ease;
}

.bth-select-menu.is-open .bth-select-item {
    animation: bth-select-item-in .2s ease-out both;
    animation-delay: calc(var(--i, 0) * 20ms);
}

.bth-select-item.is-active {
    background: var(--bth-sel-hover-bg);
    transform: translateX(2px);
}

.bth-select-item.is-selected {
    font-weight: 600;
}

.bth-select-item.is-disabled {
    color: #b5b5b6;
    cursor: not-allowed;
}

.bth-select-item-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bth-select-check {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 15px;
    height: 15px;
    margin-top: -7.5px;
    color: var(--bth-sel-check);
    opacity: 0;
    transform: scale(0);
    transition: opacity .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}

.bth-select-item.is-selected .bth-select-check {
    opacity: 1;
    transform: scale(1);
}

.bth-select-empty {
    padding: 8px;
    color: var(--bth-sel-muted);
    font-style: italic;
}

@keyframes bth-select-item-in {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bth-select-chevron,
    .bth-select-menu,
    .bth-select-menu.is-open,
    .bth-select-menu.is-closing,
    .bth-select-item,
    .bth-select-check {
        transition: none !important;
        animation: none !important;
    }

    .bth-select-item.is-active {
        transform: none;
    }
}

div.bth-select.is-attached .bth-select-trigger {
    border-color: var(--bth-sel-focus) !important;
    border-bottom-color: #e3e3e3 !important;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: none !important;
}

div.bth-select.is-attached.is-up .bth-select-trigger {
    border-bottom-color: var(--bth-sel-focus) !important;
    border-top-color: #e3e3e3 !important;
    border-radius: 0 0 var(--bth-sel-radius) var(--bth-sel-radius);
}

.bth-select-menu {
    box-sizing: border-box;
    border: 1px solid var(--bth-sel-focus);
    border-top: 0;
    border-radius: 0 0 var(--bth-sel-radius) var(--bth-sel-radius);
    box-shadow: 0 8px 16px -6px rgba(0, 0, 0, .18);
    transform: scaleY(.96);
}

    .bth-select-menu.is-up {
        border-top: 1px solid var(--bth-sel-focus);
        border-bottom: 0;
        border-radius: var(--bth-sel-radius) var(--bth-sel-radius) 0 0;
        box-shadow: 0 -8px 16px -6px rgba(0, 0, 0, .18);
        transform: scaleY(.96);
    }

    .bth-select-menu.is-open {
        transform: scaleY(1);
    }

    .bth-select-menu.is-closing,
    .bth-select-menu.is-up.is-closing {
        transform: scaleY(.96);
    }

:root {
    --bth-sel-success: #2e9d5b;
}

.bth-select-chevron {
    transition: transform .25s var(--bth-sel-spring), opacity .15s ease;
}

.bth-select-confirm {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    color: var(--bth-sel-success);
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
}

    .bth-select-confirm path {
        stroke-dasharray: 24;
        stroke-dashoffset: 24;
    }

/* chevron sai */
.bth-select.is-confirmed .bth-select-chevron {
    opacity: 0;
    transform: scale(.4);
}

/* check entra e é desenhado */
.bth-select.is-confirmed .bth-select-confirm {
    opacity: 1;
    animation: bth-select-confirm-pop .45s var(--bth-sel-spring) .1s both;
}

    .bth-select.is-confirmed .bth-select-confirm path {
        animation: bth-select-confirm-draw .35s cubic-bezier(.65, 0, .35, 1) .1s forwards;
    }

/* Somente leitura: mesmo visual dos inputs readonly */
div.bth-select .bth-select-trigger.is-readonly {
    background-color: #ededed !important;
    border-color: #bfbfc0 !important;
    cursor: not-allowed;
}

    div.bth-select .bth-select-trigger.is-readonly .bth-select-chevron {
        opacity: .35;
    }

@keyframes bth-select-confirm-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes bth-select-confirm-pop {
    0% {
        transform: scale(.6);
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bth-select-confirm,
    .bth-select-confirm path {
        animation: none !important;
        transition: none !important;
    }

    .bth-select.is-confirmed .bth-select-confirm path {
        stroke-dashoffset: 0;
    }
}