:root {
    --portal-select-bg: #ffffff;
    --portal-select-border: #d6deeb;
    --portal-select-text: #1f2937;
    --portal-select-placeholder: #6b7280;
    --portal-select-focus: #008600;
    --portal-select-radius: 10px;
    --portal-select-height: 44px;
    --portal-select-shadow: 0 0 0 3px rgba(0, 134, 0, 0.14);
    --portal-select-font-size: 0.95rem;
    --portal-select-option-highlight: #e9f7eb;
}

/* Standardize native single-select rendering across macOS/Windows browsers. */
select:not(.input):not(.select):not(.select2-hidden-accessible):not([multiple]):not([size]) {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    width: 100%;
    min-height: var(--portal-select-height);
    padding: 10px 40px 10px 12px !important;
    border: 1px solid var(--portal-select-border) !important;
    border-radius: var(--portal-select-radius) !important;
    background-color: var(--portal-select-bg) !important;
    color: var(--portal-select-text) !important;
    line-height: 1.35;
    background-image:
        linear-gradient(45deg, transparent 50%, #6b7280 50%),
        linear-gradient(135deg, #6b7280 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

select:not(.input):not(.select):not(.select2-hidden-accessible):not([multiple]):not([size])::-ms-expand {
    display: none;
}

select:not(.input):not(.select):not(.select2-hidden-accessible):not([multiple]):not([size]):focus {
    border-color: var(--portal-select-focus) !important;
    box-shadow: var(--portal-select-shadow) !important;
    outline: none;
}

select:not(.input):not(.select):not(.select2-hidden-accessible):not([multiple]):not([size]):disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #f3f4f6 !important;
}

select:not(.input):not(.select):not(.select2-hidden-accessible):not([multiple]):not([size]) option {
    color: var(--portal-select-text);
    background: #ffffff;
}

/* Keep dark themed ib/base selects as-is. */
select.input,
select.select {
    background-image: none;
}

/* Unify Select2 visuals used across update/profile/admin pages. */
.select2-container {
    width: 100% !important;
    min-width: 0 !important;
    z-index: 1080 !important;
}

.select2-container--default .select2-selection--single {
    min-height: var(--portal-select-height) !important;
    border: 1px solid var(--portal-select-border) !important;
    border-radius: var(--portal-select-radius) !important;
    background: var(--portal-select-bg) !important;
    display: flex !important;
    align-items: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--portal-select-text) !important;
    line-height: 1.35 !important;
    padding-left: 12px !important;
    padding-right: 34px !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--portal-select-placeholder) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    width: 30px !important;
    right: 4px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border: 0 !important;
    width: 8px;
    height: 8px;
    transform: rotate(45deg);
    border-right: 2px solid #6b7280 !important;
    border-bottom: 2px solid #6b7280 !important;
    margin-top: -6px !important;
    margin-left: -6px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--portal-select-focus) !important;
    box-shadow: var(--portal-select-shadow) !important;
}

.select2-dropdown {
    border: 1px solid var(--portal-select-border) !important;
    border-radius: 10px !important;
    overflow: hidden;
    box-shadow: 0 16px 28px rgba(16, 24, 40, 0.12) !important;
    background: #ffffff !important;
    z-index: 1081 !important;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--portal-select-border) !important;
    border-radius: 8px !important;
    padding: 8px 10px;
    font-size: inherit !important;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--portal-select-focus) !important;
    box-shadow: var(--portal-select-shadow) !important;
    outline: none;
}

.select2-results__option {
    padding: 9px 12px;
    color: #1f2937;
    font-size: inherit !important;
    font-weight: inherit !important;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--portal-select-option-highlight) !important;
    color: #10492c !important;
}

.select2-container--default .select2-results__option--selected {
    background-color: #d8efdb !important;
    color: #10492c !important;
}

.select2-container .select2-selection__clear {
    display: none !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted[aria-selected="true"] {
    background-color: var(--portal-select-option-highlight) !important;
    color: #10492c !important;
}

/* Dark variant used by IB glass forms. */
.select2-container--portal-dark .select2-selection--single {
    border: 1px solid rgba(132, 202, 35, 0.3) !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

.select2-container--portal-dark .select2-selection--single .select2-selection__rendered {
    color: rgba(240, 253, 244, 0.95) !important;
}

.select2-container--portal-dark .select2-selection--single .select2-selection__placeholder {
    color: rgba(187, 247, 208, 0.6) !important;
}

.select2-container--portal-dark .select2-selection--single .select2-selection__arrow b {
    border-right-color: rgba(187, 247, 208, 0.85) !important;
    border-bottom-color: rgba(187, 247, 208, 0.85) !important;
}

.select2-container--portal-dark-dropdown {
    border: 1px solid rgba(132, 202, 35, 0.3) !important;
    background: #0f3626 !important;
    color: #f0fdf4 !important;
}

.select2-container--portal-dark-dropdown .select2-search__field {
    border: 1px solid rgba(132, 202, 35, 0.3) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f0fdf4 !important;
    font-size: inherit !important;
}

.select2-container--portal-dark-dropdown .select2-results__option {
    color: #f0fdf4 !important;
    font-size: inherit !important;
    font-weight: 400 !important;
}

.select2-container--portal-dark-dropdown .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: rgba(132, 202, 35, 0.24) !important;
    color: #f3ffef !important;
}

.select2-container--portal-dark-dropdown .select2-results__option--selected {
    background-color: rgba(132, 202, 35, 0.14) !important;
    color: #e9ffe9 !important;
}

/* Match report-field dark input theme exactly for Select2 controls. */
.report-field .select2-container,
.report-offer .select2-container {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

.report-field .select2-container--default .select2-selection--single,
.report-offer .select2-container--default .select2-selection--single {
    min-height: 0 !important;
    height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: #fff !important;
    box-sizing: border-box !important;
}

.report-field .select2-container--default .select2-selection--single .select2-selection__rendered,
.report-offer .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #fff !important;
    padding-left: 14px !important;
    padding-right: 38px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    line-height: normal !important;
    font-size: inherit !important;
    font-weight: 400 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.report-field .select2-container--default .select2-selection--single .select2-selection__placeholder,
.report-offer .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: rgba(255, 255, 255, 0.75) !important;
}

.report-field .select2-container--default .select2-selection--single .select2-selection__arrow,
.report-offer .select2-container--default .select2-selection--single .select2-selection__arrow {
    right: 8px !important;
}

.report-field .select2-container--default .select2-selection--single .select2-selection__arrow b,
.report-offer .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-right-color: rgba(255, 255, 255, 0.85) !important;
    border-bottom-color: rgba(255, 255, 255, 0.85) !important;
}

.report-field .select2-container--default.select2-container--focus .select2-selection--single,
.report-field .select2-container--default.select2-container--open .select2-selection--single,
.report-offer .select2-container--default.select2-container--focus .select2-selection--single,
.report-offer .select2-container--default.select2-container--open .select2-selection--single {
    border-color: rgba(132, 202, 35, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(132, 202, 35, 0.18) !important;
    outline: none !important;
}

.report-field .select2-dropdown,
.report-offer .select2-dropdown {
    background: #0f3626 !important;
    border: 1px solid rgba(132, 202, 35, 0.3) !important;
}

.report-field .select2-search--dropdown .select2-search__field,
.report-offer .select2-search--dropdown .select2-search__field {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(132, 202, 35, 0.3) !important;
    color: #fff !important;
}

.report-field .select2-results__option,
.report-offer .select2-results__option {
    color: #f0fdf4 !important;
    font-size: inherit !important;
    font-weight: 400 !important;
}

.report-field .select2-results__option--highlighted[aria-selected],
.report-field .select2-results__option--highlighted[aria-selected="true"],
.report-offer .select2-results__option--highlighted[aria-selected],
.report-offer .select2-results__option--highlighted[aria-selected="true"] {
    background-color: rgba(132, 202, 35, 0.24) !important;
    color: #f3ffef !important;
}

.report-field .select2-results__option--selected,
.report-offer .select2-results__option--selected {
    background-color: rgba(132, 202, 35, 0.14) !important;
    color: #e9ffe9 !important;
}
