/* Shared form surfaces, including the existing Select2 widgets. */
/* FormValidation applies this after startup; reserve the same hint spacing now. */
html:not(#ui-x) body form.validation .help-block { margin-bottom: 0; }
/* Hide scrollbar chrome everywhere; scrolling itself remains native and enabled. */
html:not(#ui-x), html:not(#ui-x) * {
    scrollbar-width: none !important;
    scrollbar-gutter: auto !important;
    -ms-overflow-style: none !important;
}
html:not(#ui-x)::-webkit-scrollbar, html:not(#ui-x) *::-webkit-scrollbar {
    display: none !important; width: 0 !important; height: 0 !important;
}
html:not(#ui-x) body :is(#page-scrollbar, .slimScrollBar, .slimScrollRail) { display: none !important; }
/* Close controls follow the active theme rather than a fixed muted ink. */
html:not(#ui-x) body :is(.mp-x, .mp-look-x, .mp-cz-x, .sx-modal-x, .modal-header .close) {
    color: var(--mc-accent, var(--ac, #0a84d6)) !important;
}
html:not(#ui-x) body :is(.mp-x, .mp-look-x, .mp-cz-x, .sx-modal-x, .modal-header .close):hover {
    background-color: var(--mc-accent-soft, var(--ac-soft, #e4f2fa)) !important;
}
/* All dialog/sheet backgrounds blur the page; the panel itself stays sharp. */
html:not(#ui-x) body :is(.mp-modal, .modal-backdrop, .spd, .fs-dim, .dp-dim, .mp-cz, .mp-popover-dim) {
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.mp-popover-dim {
    display: none; position: fixed; inset: 0; z-index: 94;
    background: rgba(40, 25, 22, .42);
}
body.mp-pos:has(.mp-look:not([hidden])) .mp-popover-dim { display: block; }
@media (prefers-reduced-transparency: reduce), print {
    html:not(#ui-x) body :is(.mp-modal, .modal-backdrop, .spd, .fs-dim, .dp-dim, .mp-cz, .mp-popover-dim) {
        -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    }
}
@media print { .mp-popover-dim { display: none !important; } }
html:not(#ui-x) body :is(.pg, .sx, .cdm, .cdk) :is(input.form-control, textarea.form-control, input.xinp, select.xinp) {
    border-radius: var(--mc-radius-sm, 12px) !important;
    border-color: var(--mc-border) !important; color: var(--mc-text) !important;
    background-color: var(--mc-surface) !important;
}
html:not(#ui-x) body .select2-container { max-width: 100%; min-width: 0; }
html:not(#ui-x) body .select2-container--default :is(.select2-selection--single, .select2-selection--multiple) {
    min-height: 40px; border: 1px solid var(--mc-border, #ded7ec) !important;
    background: var(--mc-surface, #fff) !important; color: var(--mc-text, #252037);
    border-radius: var(--mc-radius-sm, 12px) !important;
}
html:not(#ui-x) body .select2-container--default .select2-selection--single { height: 40px; }
html:not(#ui-x) body .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--mc-text, #252037) !important; line-height: 38px; padding-left: 12px;
}
html:not(#ui-x) body .select2-container--default .select2-selection__arrow { height: 38px; right: 8px; }
/* Keep the field's first-paint dimensions when Select2 enhances it. */
html:not(#ui-x) body .shared-select-stable {
    vertical-align: middle; box-sizing: border-box;
    height: var(--shared-select-height) !important;
    font-family: var(--shared-select-font) !important;
    font-size: var(--shared-select-size) !important;
    font-weight: var(--shared-select-weight) !important;
    letter-spacing: var(--shared-select-spacing) !important;
}
html:not(#ui-x) body .shared-select-stable .select2-selection--single {
    height: var(--shared-select-height) !important;
    min-height: var(--shared-select-height) !important;
    box-sizing: border-box;
    padding: 0 !important;
}
html:not(#ui-x) body .shared-select-stable .select2-selection--single .select2-selection__rendered {
    line-height: calc(var(--shared-select-height) - 2px) !important;
    font: inherit; padding-inline-start: 12px;
    margin: 0 !important;
}
html:not(#ui-x) body .shared-select-stable .select2-selection__arrow { height: calc(var(--shared-select-height) - 2px) !important; }
/* Form dimensions must be identical even before a hidden Settings tab opens.
   Do not preserve the legacy 28px Select2 default as a form field's height. */
html:not(#ui-x) body :is(.pg, .sx) { --shared-control-height: 42px; }
html:not(#ui-x) body .pg.fk { --shared-control-height: 44px; }
html:not(#ui-x) body :is(.pg, .sx) select.form-control:not([multiple]):not([size]):not(.select2-hidden-accessible) {
    height: var(--shared-control-height) !important; min-height: var(--shared-control-height) !important;
    box-sizing: border-box; padding: 0 12px; line-height: normal;
    border: 1px solid var(--mc-border); border-radius: var(--mc-radius-sm, 12px);
    background-color: var(--mc-surface); color: var(--mc-text);
}
html:not(#ui-x) body :is(.pg, .sx) .form-group > .select2-container:has(.select2-selection--single),
html:not(#ui-x) body :is(.pg, .sx) .sx-f > .select2-container:has(.select2-selection--single),
html:not(#ui-x) body :is(.pg, .sx) .sx-row > .select2-container:has(.select2-selection--single) {
    --shared-select-height: var(--shared-control-height) !important;
    height: var(--shared-control-height) !important; vertical-align: top;
}
html:not(#ui-x) body :is(.pg, .sx) :is(.form-group, .sx-f, .sx-row) > .select2-container .select2-selection--single {
    height: var(--shared-control-height) !important; min-height: var(--shared-control-height) !important;
    box-sizing: border-box;
}
html:not(#ui-x) body :is(.pg, .sx) :is(.form-group, .sx-f, .sx-row) > .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: calc(var(--shared-control-height) - 2px) !important;
}
html:not(#ui-x) body :is(.pg, .sx) :is(.form-group, .sx-f, .sx-row) > .select2-container .select2-selection__arrow {
    height: calc(var(--shared-control-height) - 2px) !important; top: 1px !important;
}
html:not(#ui-x) body .select2-container--default.select2-container--disabled .select2-selection--single { opacity: .55; cursor: not-allowed; }
/* Compact role controls keep one outline and one arrow while using the same
   themed dropdown menu as every other enhanced select. */
html:not(#ui-x) body #us .us-role select { width: 100px; max-width: 100%; height: 18px; min-height: 18px; margin: 0; line-height: 18px; }
html:not(#ui-x) body #us label.us-role { width: 138px; flex-shrink: 0; }
html:not(#ui-x) body #us .us-role .select2-container { flex: 1; width: 100px !important; max-width: 100%; height: 18px !important; margin: 0 !important; }
html:not(#ui-x) body #us .us-role .select2-selection--single { height: 18px !important; min-height: 18px !important; border: 0 !important; background: transparent !important; border-radius: 0 !important; box-shadow: none !important; }
html:not(#ui-x) body #us .us-role .select2-selection__rendered { padding: 0 14px 0 0 !important; line-height: 18px !important; font: inherit; }
html:not(#ui-x) body #us .us-role .select2-selection__arrow { right: 0; top: 0 !important; height: 18px !important; }
html:not(#ui-x) body #us .us-role:has(.select2-container) > b { display: none; }
html:not(#ui-x) body .select2-container--open { z-index: 5010; }
html:not(#ui-x) body .select2-dropdown {
    background: var(--mc-surface, #fff); color: var(--mc-text, #252037);
    border: 1px solid var(--mc-border, #ded7ec); border-radius: var(--mc-radius-sm, 12px) !important;
    padding: 5px; box-shadow: 0 12px 32px rgba(0,0,0,.16); overflow: hidden;
}
html:not(#ui-x) body .select2-results__option { padding: 9px 12px; border-radius: 8px; }
html:not(#ui-x) body .select2-container--default .select2-results__option[aria-selected=true] {
    background: var(--mc-accent-soft, #eee8fa); color: var(--mc-accent, #7852b8);
}
html:not(#ui-x) body .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--mc-accent, #7852b8); color: var(--mc-accent-text, #fff);
}
html:not(#ui-x) body .select2-search__field {
    background: var(--mc-surface-2, #f4f2f7); color: var(--mc-text); border: 1px solid var(--mc-border) !important;
    border-radius: 8px; padding: 7px;
}
html:not(#ui-x) body :is(.cdm, .cdk) { --cr: var(--mc-radius, 18px); }
html:not(#ui-x) body :is(.cdm, .cdk) :is(.xb, .xseg button, .ttabs button, .xtabs button, .xscr) {
    border-radius: var(--mc-radius-sm, 12px) !important;
}
html:not(#ui-x) body :is(.cdm, .cdk) .xb { min-height: 40px; box-sizing: border-box; }
html:not(#ui-x) body :is(.pg, .sx, .cdm, .cdk) input[type=file]::file-selector-button {
    border: 1px solid var(--mc-border); border-radius: var(--mc-radius-sm, 12px);
    background: var(--mc-surface-2); color: var(--mc-text); padding: 8px 12px; font: inherit; cursor: pointer;
}

/* Native first paint and enhanced selects use one text/arrow geometry. */
html:not(#ui-x) body :is(.pg, .sx) select:not([multiple]):not([size]):not(.select2-hidden-accessible) {
    appearance: none; -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #89939b 50%), linear-gradient(135deg, #89939b 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 13px) 50%;
    background-size: 4px 4px; background-repeat: no-repeat;
    padding-right: 30px;
}
html:not(#ui-x) body .shared-select-stable .select2-selection__rendered {
    padding-left: var(--shared-select-padding, 12px) !important;
}
/* Absolutely clipped fields must not contribute a second box to their row. */
html:not(#ui-x) body select.select2-hidden-accessible {
    position: absolute !important; width: 1px !important; height: 1px !important;
    min-width: 0 !important; min-height: 0 !important; padding: 0 !important;
    margin: -1px !important; border: 0 !important; overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important; clip-path: inset(50%) !important;
}

/* One themed calendar surface for Bootstrap date/time pickers, including the
   popup portalled to body by glass_modal.js. Keep these rules shared. */
html:not(#ui-x) body .bootstrap-datetimepicker-widget.dropdown-menu {
    box-sizing: border-box; width: 304px; max-width: calc(100vw - 24px);
    padding: 12px !important; border: 1px solid var(--mc-border, #ded7ec) !important;
    border-radius: var(--mc-radius, 18px) !important;
    background: var(--mc-surface, #fff) !important; color: var(--mc-text, #252037) !important;
    box-shadow: 0 16px 44px rgba(20, 15, 35, .18); font-family: inherit; font-size: 13px;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget.dropdown-menu::before,
html:not(#ui-x) body .bootstrap-datetimepicker-widget.dropdown-menu::after { display: none; }
html:not(#ui-x) body .bootstrap-datetimepicker-widget table {
    width: 100%; margin: 0; border-collapse: separate; border-spacing: 2px;
    background: transparent !important; color: inherit;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table :is(td, th) {
    border: 0 !important; box-shadow: none !important; text-align: center;
    padding: 0 !important; border-radius: var(--mc-radius-sm, 10px) !important;
    color: inherit; background: transparent; vertical-align: middle;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table :is(td.day, td.hour, td.minute, td.second) {
    width: 36px; height: 36px; line-height: 36px; font-variant-numeric: tabular-nums;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table thead tr:first-child th {
    height: 38px; line-height: 38px; font-size: 14px; font-weight: 700;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table th.dow {
    height: 30px; line-height: 30px; font-size: 11px; font-weight: 600;
    color: var(--mc-muted, #787187) !important;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table :is(td.old, td.new, td.disabled, th.disabled) {
    color: var(--mc-muted, #787187) !important; opacity: .5;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table :is(td.day, td.hour, td.minute, td.second, th.picker-switch, th.prev, th.next):not(.disabled):hover,
html:not(#ui-x) body .bootstrap-datetimepicker-widget table td span:not(.disabled):hover {
    background: var(--mc-accent-soft, #eee9fc) !important; color: var(--mc-accent, #7c5cf0) !important;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table td.active,
html:not(#ui-x) body .bootstrap-datetimepicker-widget table td.active:hover,
html:not(#ui-x) body .bootstrap-datetimepicker-widget table td span.active,
html:not(#ui-x) body .bootstrap-datetimepicker-widget table td span.active:hover {
    background: var(--mc-accent, #7c5cf0) !important; color: var(--mc-accent-text, #fff) !important;
    text-shadow: none; font-weight: 700; opacity: 1;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table td.today::before {
    border-bottom-color: var(--mc-accent, #7c5cf0); bottom: 4px; right: 4px;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget table td.today.active::before { border-bottom-color: currentColor; }
html:not(#ui-x) body .bootstrap-datetimepicker-widget table td span {
    border-radius: var(--mc-radius-sm, 10px); text-shadow: none;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget .picker-switch.accordion-toggle {
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--mc-border, #ded7ec);
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget a[data-action] {
    display: block; padding: 5px 0; border-radius: var(--mc-radius-sm, 10px);
    color: var(--mc-accent, #7c5cf0) !important; background: transparent;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget a[data-action]:hover {
    background: var(--mc-accent-soft, #eee9fc) !important;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget .picker-switch td span {
    height: 32px; line-height: 32px; margin: 0;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget :is(.timepicker-hour, .timepicker-minute, .timepicker-second) {
    color: var(--mc-text, #252037); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums;
}
html:not(#ui-x) body .bootstrap-datetimepicker-widget a:focus-visible {
    outline: 2px solid var(--mc-accent, #7c5cf0); outline-offset: 2px;
}
@media (max-width: 360px) {
    html:not(#ui-x) body .bootstrap-datetimepicker-widget.dropdown-menu { width: 280px; padding: 8px !important; }
    html:not(#ui-x) body .bootstrap-datetimepicker-widget table td.day { height: 33px; line-height: 33px; }
}
