/* entraEd custom form controls, shared by the public site, dashboards and partner portal.
   Element rules use :where() so component-specific styles always win. */
:root {
    --slf-navy: #111C44;
    --slf-royal: #3657A4;
    --slf-gold: #F4C542;
    --slf-text: #111C44;
    --slf-muted: #4F5D75;
    --slf-placeholder: #6B7A91;
    --slf-border: #5F7294;
    --slf-border-hover: #445572;
    --slf-line: #C9D4E6;
    --slf-ice: #E6ECF5;
    --slf-field: #E6ECF5;
    --slf-hover: #F3F6FB;
    --slf-danger: #B42318;
    --slf-radius: 12px;
    --slf-radius-sm: 9px;
    --slf-height: 52px;
    --slf-ring: 0 0 0 4px rgba(54, 87, 164, 0.16);
    --slf-shadow: 0 18px 40px rgba(17, 28, 68, 0.16), 0 2px 6px rgba(17, 28, 68, 0.06);
}

/* ---------- Custom dropdown ---------- */
.sl-native-select {
    position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important;
    opacity: 0 !important; pointer-events: none !important; border: 0 !important; clip-path: inset(50%);
}
.sl-select { position: relative; width: 100%; min-width: 0; }
.sl-select.is-hidden { display: none; }
.sl-select-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; min-height: var(--slf-height); padding: 0 12px 0 14px; margin: 0;
    background: var(--slf-field); border: 2px solid var(--slf-border); border-radius: var(--slf-radius);
    font: inherit; font-size: 16px; line-height: 1.3; color: var(--slf-text); text-align: left; cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.sl-select-trigger:hover { border-color: var(--slf-border-hover); }
.sl-select-trigger:focus-visible { outline: none; border-color: var(--slf-navy); background: #fff; box-shadow: var(--slf-ring); }
.sl-select.is-open .sl-select-trigger { border-color: var(--slf-navy); background: #fff; box-shadow: var(--slf-ring); }
.sl-select.is-disabled .sl-select-trigger, .sl-select-trigger:disabled { background: #F4F6FA; color: var(--slf-muted); cursor: not-allowed; border-color: var(--slf-line); }
.sl-select.is-invalid .sl-select-trigger { border-color: var(--slf-danger); }
.sl-select.is-invalid .sl-select-trigger:focus-visible { box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16); }
.sl-select-value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-select-value.is-placeholder { color: var(--slf-placeholder); }
.sl-select-caret { flex: 0 0 auto; color: var(--slf-muted); transition: transform 0.18s ease; }
.sl-select.is-open .sl-select-caret { transform: rotate(180deg); color: var(--slf-royal); }
.sl-select-sm .sl-select-trigger { min-height: 36px; font-size: 14.5px; border-radius: var(--slf-radius-sm); padding: 0 10px 0 12px; }

.sl-select-popover {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1060;
    min-width: 240px; padding: 6px;
    background: #fff; border: 1px solid var(--slf-line); border-radius: var(--slf-radius);
    box-shadow: var(--slf-shadow); font-size: 15px; color: var(--slf-text);
    opacity: 0; transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}
.sl-select-popover.is-open { opacity: 1; transform: none; }
.sl-select-popover.is-floating { position: fixed; right: auto; z-index: 1090; }
.sl-select-popover.is-floating.is-up { transform: translateY(4px); }
.sl-select-popover.is-floating.is-up.is-open { transform: none; }
.sl-select-sheet-head { display: none; }
.sl-select-search { position: relative; margin: 2px 2px 6px; }
.sl-select-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--slf-muted); pointer-events: none; }
.sl-select-search input {
    width: 100%; height: 40px; padding: 0 12px 0 36px; margin: 0;
    border: 1px solid var(--slf-line); border-radius: var(--slf-radius-sm); background: #F7F9FC;
    font: inherit; font-size: 14.5px; color: var(--slf-text);
}
.sl-select-search input:focus { outline: none; background: #fff; border-color: var(--slf-royal); box-shadow: var(--slf-ring); }
.sl-select-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.sl-select-list:focus { outline: none; }
.sl-select-list [role="option"] {
    display: flex; align-items: center; gap: 10px;
    min-height: 40px; padding: 8px 10px; border-radius: var(--slf-radius-sm);
    font-size: 14.5px; line-height: 1.35; color: var(--slf-text); cursor: pointer;
}
.sl-select-list [role="option"]:hover { background: var(--slf-hover); }
.sl-select-list [role="option"].is-active { background: var(--slf-ice); }
.sl-select:not(.is-keyboard) .sl-select-list [role="option"].is-active:not(:hover):not([aria-selected="true"]) { background: transparent; }
.sl-select-list [role="option"][aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.sl-select-list [aria-selected="true"] { font-weight: 600; color: var(--slf-navy); background: #EEF3FC; }
.sl-select-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sl-select-text small { font-size: 12.5px; font-weight: 400; color: var(--slf-muted); }
.sl-select-badge {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 22px; border-radius: 6px;
    background: var(--slf-navy); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.sl-select-check { flex: 0 0 auto; color: var(--slf-royal); opacity: 0; }
.sl-select-list [aria-selected="true"] .sl-select-check { opacity: 1; }
.sl-select-box {
    flex: 0 0 auto; width: 18px; height: 18px; border: 1.5px solid var(--slf-border-hover); border-radius: 5px; background: #fff;
    display: inline-grid; place-items: center; transition: background-color 0.12s ease, border-color 0.12s ease;
}
.sl-select-list [aria-selected="true"] .sl-select-box {
    border-color: var(--slf-royal);
    background: var(--slf-royal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.sl-select-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slf-muted); }
.sl-select-empty { padding: 16px 12px; font-size: 14px; color: var(--slf-muted); }
.sl-select-foot { display: none; justify-content: space-between; gap: 8px; padding: 6px 4px 2px; border-top: 1px solid var(--slf-line); margin-top: 6px; }
.sl-select.has-value .sl-select-foot, .sl-select-popover.is-floating .sl-select-foot { display: flex; }
.sl-select-clear, .sl-select-done { border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--slf-royal); padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.sl-select-clear:hover, .sl-select-done:hover { background: var(--slf-ice); }
.sl-select-done { margin-left: auto; background: var(--slf-navy); color: #fff; }
.sl-select-done:hover { background: #1B2A5E; }

@media (max-width: 575px) {
    /* Dropdowns open as a bottom sheet on phones */
    .sl-select-popover {
        position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 1090; min-width: 0;
        max-height: 80vh; display: flex; flex-direction: column; padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0; transform: translateY(16px);
        box-shadow: 0 -20px 50px rgba(17, 28, 68, 0.25), 0 0 0 100vmax rgba(17, 28, 68, 0.4);
    }
    .sl-select-popover[hidden] { display: none; }
    .sl-select-sheet-head { display: block; padding: 4px 6px 10px; }
    .sl-select-sheet-title { font-family: var(--font-body, "Inter", sans-serif); font-size: 17px; font-weight: 600; color: var(--slf-navy); }
    .sl-select-list { max-height: none; flex: 1 1 auto; }
    .sl-select-list [role="option"] { min-height: 50px; font-size: 16px; }
    .sl-select-search input { height: 48px; font-size: 16px; }
    .sl-select-foot { display: flex; }
}

/* ---------- Native selects that stay native (DataTables page length, opted-out fields) ---------- */
:where(select:not([multiple]):not(.sl-native-select)) {
    appearance: none; -webkit-appearance: none;
    padding-right: 34px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}

/* ---------- Checkboxes and radios ---------- */
:where(input[type="checkbox"]:not([role="switch"]), input[type="radio"]) {
    appearance: none; -webkit-appearance: none;
    flex: 0 0 auto; display: inline-grid; place-content: center;
    width: 18px; height: 18px; margin: 0; vertical-align: -3px;
    border: 1.5px solid var(--slf-border-hover); background: #fff; color: var(--slf-royal); cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
:where(input[type="checkbox"]:not([role="switch"])) { border-radius: 5px; }
:where(input[type="radio"]) { border-radius: 50%; }
:where(input[type="checkbox"]:not([role="switch"]), input[type="radio"]):hover { border-color: var(--slf-royal); }
:where(input[type="checkbox"]:not([role="switch"]), input[type="radio"]):focus-visible { outline: none; box-shadow: var(--slf-ring); }
:where(input[type="checkbox"]:not([role="switch"])):checked,
:where(input[type="checkbox"]:not([role="switch"])):indeterminate { border-color: var(--slf-royal); background-color: var(--slf-royal); }
:where(input[type="checkbox"]:not([role="switch"])):checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    background-position: center; background-size: 12px; background-repeat: no-repeat;
}
:where(input[type="checkbox"]:not([role="switch"])):indeterminate {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
    background-position: center; background-size: 12px; background-repeat: no-repeat;
}
:where(input[type="radio"]):checked { border-color: var(--slf-royal); box-shadow: inset 0 0 0 4px #fff; background: var(--slf-royal); }
:where(input[type="radio"]):checked:focus-visible { box-shadow: inset 0 0 0 4px #fff, var(--slf-ring); }
:where(input[type="checkbox"], input[type="radio"]):disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- File picker ---------- */
:where(input[type="file"]) { font: inherit; font-size: 14px; color: var(--slf-muted); max-width: 100%; }
:where(input[type="file"])::file-selector-button {
    margin-right: 12px; padding: 8px 14px; border: 1px solid var(--slf-border); border-radius: var(--slf-radius-sm);
    background: var(--slf-ice); color: var(--slf-navy); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
:where(input[type="file"])::file-selector-button:hover { background: #E1EAF7; border-color: var(--slf-border-hover); }

/* ---------- Dates, numbers, ranges ---------- */
:where(input[type="date"], input[type="datetime-local"], input[type="time"], input[type="month"])::-webkit-calendar-picker-indicator {
    cursor: pointer; opacity: 0.7; padding: 4px; border-radius: 6px;
    filter: invert(29%) sepia(43%) saturate(800%) hue-rotate(190deg);
}
:where(input[type="date"], input[type="datetime-local"], input[type="time"], input[type="month"])::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--slf-ice); }
:where(input[type="range"]) { accent-color: var(--slf-royal); }
:where(progress, meter) { accent-color: var(--slf-royal); }
:where(textarea) { resize: vertical; }
::placeholder { color: var(--slf-placeholder); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .sl-select-popover, .sl-select-caret, .sl-select-trigger { transition: none; }
}

/* ---------- Vendor dropdowns (Select2, niceSelect, bootstrap-multiselect) matched to the custom dropdown ---------- */
/* Closed state */
body .select2-container .select2-selection--single,
body .select2-container .select2-selection--multiple,
body .nice-select,
body .sf-select-checkbox-btn,
body .sf-select-checkbox-search-btn {
    min-height: var(--slf-height) !important; height: auto !important;
    border: 2px solid var(--slf-border) !important; border-radius: var(--slf-radius) !important;
    background-color: var(--slf-field) !important; box-shadow: none !important;
    font-size: 16px !important; color: var(--slf-text) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
body .select2-container .select2-selection--single:hover, body .nice-select:hover,
body .sf-select-checkbox-btn:hover, body .sf-select-checkbox-search-btn:hover { border-color: var(--slf-border-hover) !important; }
body .select2-container--open .select2-selection, body .select2-container--focus .select2-selection,
body .nice-select.open, body .nice-select:focus,
body .sf-select-checkbox-btn.show, body .sf-select-checkbox-btn:focus,
body .sf-select-checkbox-search-btn.show, body .sf-select-checkbox-search-btn:focus {
    border-color: var(--slf-navy) !important; background-color: #fff !important; box-shadow: var(--slf-ring) !important; outline: none;
}
body .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: calc(var(--slf-height) - 2px) !important; padding: 0 40px 0 14px !important; color: var(--slf-text) !important;
}
body .select2-container .select2-selection__placeholder { color: var(--slf-placeholder) !important; }
body .select2-container .select2-selection--single .select2-selection__arrow {
    height: calc(var(--slf-height) - 2px) !important; width: 36px !important; right: 4px !important;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 18px no-repeat !important;
    transition: transform 0.18s ease;
}
body .select2-container--open .select2-selection--single .select2-selection__arrow { transform: rotate(180deg); }
body .select2-container .select2-selection__arrow b { display: none !important; }
body .select2-container .select2-selection--multiple { padding: 4px 8px !important; }
body .select2-container .select2-selection__choice {
    margin: 3px 4px 3px 0 !important; padding: 3px 8px 3px 24px !important; border: 0 !important; border-radius: 8px !important;
    background: var(--slf-ice) !important; color: var(--slf-navy) !important; font-size: 13.5px !important; font-weight: 600;
}
body .select2-container .select2-selection__choice__remove { border: 0 !important; color: var(--slf-muted) !important; background: none !important; }

body .nice-select { display: flex !important; align-items: center; float: none !important; width: 100%; padding: 0 40px 0 14px !important; line-height: 1.3 !important; }
body .nice-select .current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body .nice-select::after {
    content: "" !important; border: 0 !important; width: 18px !important; height: 18px !important; margin: 0 !important; top: 50% !important; right: 12px !important;
    transform: translateY(-50%) !important; transform-origin: center !important;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 18px no-repeat;
    transition: transform 0.18s ease;
}
body .nice-select.open::after { transform: translateY(-50%) rotate(180deg) !important; }
body .nice-select.disabled { background: #F4F6FA !important; color: var(--slf-muted) !important; }

body .sf-select-checkbox-btn, body .sf-select-checkbox-search-btn { padding: 0 40px 0 14px !important; text-align: left; }

/* Open lists */
body .select2-dropdown, body .nice-select .list, body .multiselect-container.dropdown-menu {
    margin-top: 6px !important; padding: 6px !important;
    border: 1px solid var(--slf-line) !important; border-radius: var(--slf-radius) !important;
    background: #fff !important; box-shadow: var(--slf-shadow) !important; overflow: hidden;
}
body .select2-container--open .select2-dropdown--above { margin-top: -6px !important; }
body .select2-dropdown { z-index: 1090; }
body .nice-select .list { left: 0 !important; right: 0 !important; width: 100% !important; max-height: 280px; overflow-y: auto !important; }
body .select2-search--dropdown { padding: 2px 2px 6px !important; }
body .select2-search--dropdown .select2-search__field, body .multiselect-container .multiselect-search {
    height: 40px !important; padding: 0 12px !important; border: 1px solid var(--slf-line) !important; border-radius: var(--slf-radius-sm) !important;
    background: #F7F9FC !important; font-size: 14.5px !important; color: var(--slf-text) !important; outline: none !important;
}
body .select2-search--dropdown .select2-search__field:focus, body .multiselect-container .multiselect-search:focus {
    background: #fff !important; border-color: var(--slf-royal) !important; box-shadow: var(--slf-ring) !important;
}
body .select2-results__options { max-height: 280px !important; }
body .select2-results__option, body .nice-select .option, body .multiselect-container .multiselect-option {
    display: flex !important; align-items: center; min-height: 40px !important; padding: 8px 10px !important; margin: 0 !important;
    border-radius: var(--slf-radius-sm) !important; background: transparent !important;
    font-size: 14.5px !important; line-height: 1.35 !important; color: var(--slf-text) !important; white-space: normal !important;
}
body .select2-results__option--highlighted, body .select2-results__option--highlighted[aria-selected],
body .nice-select .option:hover, body .nice-select .option.focus,
body .multiselect-container .multiselect-option:hover, body .multiselect-container .multiselect-option:focus { background: var(--slf-hover) !important; color: var(--slf-text) !important; }
body .select2-results__option[aria-selected="true"], body .select2-results__option--selected,
body .nice-select .option.selected, body .multiselect-container .multiselect-option.active {
    background: #EEF3FC !important; color: var(--slf-navy) !important; font-weight: 600 !important;
}
body .select2-results__option[aria-selected="true"]::after, body .select2-results__option--selected::after, body .nice-select .option.selected::after {
    content: ""; margin-left: auto; width: 18px; height: 18px; flex: 0 0 auto;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233657A4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 18px no-repeat;
}
body .select2-results__option--disabled, body .nice-select .option.disabled { opacity: 0.45; }
body .select2-results__group, body .multiselect-container .multiselect-group {
    padding: 10px 10px 4px !important; font-size: 11.5px !important; font-weight: 700 !important; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slf-muted) !important; background: none !important;
}
body .multiselect-container .multiselect-option .form-check { display: flex; align-items: center; gap: 10px; margin: 0 !important; padding: 0 !important; min-height: 0 !important; }
body .multiselect-container .multiselect-option .form-check-input {
    float: none !important; margin: 0 !important; width: 18px !important; height: 18px !important; border-radius: 5px !important;
    border: 1.5px solid var(--slf-border-hover) !important; box-shadow: none !important;
}
body .multiselect-container .multiselect-option .form-check-input:checked { background-color: var(--slf-royal) !important; border-color: var(--slf-royal) !important; }
body .multiselect-container .multiselect-option .form-check-label { margin: 0 !important; padding: 0 !important; font-size: 14.5px !important; color: inherit !important; cursor: pointer; }

/* Bootstrap checkboxes, radios and switches in the brand colour */
body .form-check-input:checked { background-color: var(--slf-royal); border-color: var(--slf-royal); }
body .form-check-input:focus { border-color: var(--slf-royal); box-shadow: var(--slf-ring); }
body .form-switch .form-check-input:focus:not(:checked) { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2364748B'/%3e%3c/svg%3e"); }
body .sf-select-checkbox-btn, body .sf-select-checkbox-search-btn {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important; background-position: right 12px center !important; background-size: 18px !important;
}
body .sf-select-checkbox-btn::after, body .sf-select-checkbox-search-btn::after { display: none !important; }
body .multiselect-container .multiselect-option .form-check-input[type="radio"] { border-radius: 50% !important; }
body .multiselect-container .multiselect-option .form-check-input[type="radio"]:checked { background: var(--slf-royal) !important; box-shadow: inset 0 0 0 4px #fff !important; }
