/* Desplegable HES: el select real conserva el valor enviado por el formulario. */
.hes-custom-select {
    display: inline-block;
    min-width: 0;
    position: relative;
    vertical-align: middle;
    width: 100%;
}

.hes-custom-select__native {
    height: 1px !important;
    left: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    top: 0 !important;
    width: 1px !important;
}

.hes-custom-select__trigger {
    align-items: center;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: var(--redondeado-bordes, 8px);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    color: #172033;
    cursor: pointer;
    display: flex;
    font: inherit;
    font-weight: 600;
    gap: 0.75rem;
    justify-content: space-between;
    line-height: 1.35;
    min-height: 42px;
    padding: 0.58rem 0.72rem 0.58rem 0.8rem;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    width: 100%;
}

body.hes-body-private .hes-custom-select__trigger {
    background: color-mix(in srgb, var(--color-fondo-card, #fff) 5%, #fff);
    border-color: color-mix(in srgb, var(--color-borde, #cbd5e1) 68%, #cbd5e1);
    border-width: var(--grosor-bordes, 1px);
}

.hes-custom-select__trigger:hover:not(:disabled) {
    border-color: var(--color-borde, #94a3b8);
}

.hes-custom-select__trigger:focus-visible,
.hes-custom-select.is-open .hes-custom-select__trigger,
.hes-custom-select.is-invalid .hes-custom-select__trigger {
    border-color: var(--color-boton, #0d6efd);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-boton, #0d6efd) 20%, transparent), 0 4px 12px rgba(15, 23, 42, 0.08);
    outline: 0;
}

.hes-custom-select.is-invalid .hes-custom-select__trigger {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.14);
}

.hes-custom-select__value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hes-custom-select__arrow {
    align-items: center;
    color: var(--color-boton, #475569);
    display: inline-flex;
    flex: 0 0 1.6rem;
    height: 1.6rem;
    justify-content: center;
    transition: transform 0.18s ease;
    width: 1.6rem;
}

.hes-custom-select__arrow::before {
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    content: '';
    height: 0.48rem;
    transform: rotate(45deg) translate(-0.12rem, -0.12rem);
    width: 0.48rem;
}

.hes-custom-select.is-open .hes-custom-select__arrow {
    transform: rotate(180deg);
}

.hes-custom-select.is-disabled .hes-custom-select__trigger {
    background: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
    opacity: 0.72;
}

.hes-custom-select.is-placeholder .hes-custom-select__value {
    color: #64748b;
    font-weight: 500;
}

.hes-custom-select.is-small .hes-custom-select__trigger {
    font-size: 0.875rem;
    min-height: 34px;
    padding: 0.36rem 0.55rem 0.36rem 0.66rem;
}

.hes-custom-select.is-large .hes-custom-select__trigger {
    font-size: 1rem;
    min-height: 48px;
    padding: 0.7rem 0.75rem 0.7rem 0.9rem;
}

.hes-custom-select__menu {
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--color-borde, #cbd5e1) 70%, #cbd5e1);
    border-radius: max(8px, var(--redondeado-bordes, 8px));
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18), 0 3px 10px rgba(15, 23, 42, 0.1);
    display: none;
    margin: 0;
    max-height: min(19rem, calc(100vh - 1.5rem));
    min-width: 10rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.38rem;
    position: fixed;
    z-index: 1090;
}

.hes-custom-select__menu.is-visible {
    animation: hes-select-show 0.14s ease-out;
    display: block;
}

.hes-custom-select__option {
    align-items: center;
    border-radius: max(5px, calc(var(--redondeado-bordes, 8px) - 3px));
    color: #273449;
    cursor: pointer;
    display: flex;
    font-weight: 500;
    gap: 0.65rem;
    line-height: 1.35;
    min-height: 2.35rem;
    padding: 0.5rem 0.72rem;
    position: relative;
}

.hes-custom-select__option:hover,
.hes-custom-select__option.is-active {
    background: color-mix(in srgb, var(--color-boton, #0d6efd) 10%, #fff);
    color: color-mix(in srgb, var(--color-boton, #0d6efd) 82%, #111827);
}

.hes-custom-select__option[aria-selected='true'] {
    background: color-mix(in srgb, var(--color-boton, #0d6efd) 14%, #fff);
    color: color-mix(in srgb, var(--color-boton, #0d6efd) 84%, #111827);
    font-weight: 700;
    padding-right: 2.25rem;
}

.hes-custom-select__option[aria-selected='true']::after {
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    content: '';
    height: 0.72rem;
    position: absolute;
    right: 0.85rem;
    top: 0.62rem;
    transform: rotate(45deg);
    width: 0.38rem;
}

.hes-custom-select__option.is-disabled {
    background: transparent;
    color: #94a3b8;
    cursor: not-allowed;
}

.hes-custom-select__group {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 0.68rem 0.72rem 0.28rem;
    text-transform: uppercase;
}

@keyframes hes-select-show {
    from { opacity: 0; transform: translateY(-4px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .hes-custom-select__menu.is-visible { animation: none; }
    .hes-custom-select__arrow { transition: none; }
}
