/* Select2: solo presentación; cada flujo mantiene inicialización, datos, eventos y dropdownParent. */
.th-interface .select2-container { max-width: 100%; min-width: 0; }
.th-interface .select2-container:not(.select2-container--open) { width: 100% !important; }
.th-interface .select2-container .select2-selection--single,
.th-interface .select2-container .select2-selection--multiple { min-height: var(--th-control-height); height: auto; border: 1px solid var(--th-color-control-border); border-radius: var(--th-radius-control); background: var(--th-color-surface); color: var(--th-color-text); font-size: var(--th-text-base); }
.th-interface .select2-container .select2-selection--single { display: flex; align-items: center; padding: .45rem 2.25rem .45rem .75rem; }
.th-interface .select2-container .select2-selection--single .select2-selection__rendered { width: 100%; padding: 0; color: inherit; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-interface .select2-selection__placeholder { color: var(--th-color-muted); }
.th-interface .select2-container .select2-selection__arrow { top: 0; right: .625rem; height: 100%; }
.th-interface .select2-selection__clear { margin-right: .5rem; }
.th-interface .select2-selection--multiple { padding: .25rem .5rem; }
.th-interface .select2-container .select2-selection--multiple .select2-selection__rendered { display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: 0; }
.th-interface .select2-container .select2-selection__choice { margin: .125rem 0; border: 1px solid var(--th-color-border); border-radius: .4rem; color: var(--th-color-label); background: var(--th-color-surface-soft); white-space: normal; overflow-wrap: anywhere; }
.th-interface .select2-container--focus .select2-selection,
.th-interface .select2-container--open .select2-selection { border-color: var(--th-color-focus); box-shadow: var(--th-focus-ring); }
.th-interface .select2-container--disabled .select2-selection { background: var(--th-color-surface-soft); color: var(--th-color-muted); cursor: default; }
.th-interface .select2-dropdown { border: 1px solid var(--th-color-control-border); border-radius: var(--th-radius-control); box-shadow: 0 8px 24px rgba(23,39,67,.14); color: var(--th-color-text); overflow: hidden; background: var(--th-color-surface); font-size: var(--th-text-base); }
.th-interface .select2-search--dropdown { padding: .625rem; }
.th-interface .select2-search__field { min-height: 2.5rem; padding: .4rem .65rem; border: 1px solid var(--th-color-control-border) !important; border-radius: .5rem; font-family: inherit; font-size: var(--th-text-base); }
.th-interface .select2-search__field:focus { outline: 2px solid var(--th-color-focus); outline-offset: 1px; }
.th-interface .select2-results__option { padding: .6rem .75rem; overflow-wrap: anywhere; }
.th-interface .select2-container .select2-results__option--highlighted[aria-selected],
.th-interface .select2-results__option--highlighted.select2-results__option--selectable { background: var(--th-color-primary); color: #fff; }
.th-interface .select2-selection.is-invalid, .th-interface .select2-selection[aria-invalid="true"] { border-color: var(--th-color-danger); box-shadow: 0 0 0 .15rem rgba(220,53,69,.12); }
.th-interface .select2-selection.is-valid { border-color: var(--th-color-success); }
/* Filtros compartidos: Bootstrap conserva collapse y los controladores muestran el toolbar. */
.th-filter-panel { border: 1px solid var(--th-color-border); border-radius: var(--th-radius-panel); box-shadow: var(--th-shadow-panel); background: var(--th-color-surface); min-width: 0; }
.th-filter-panel > .card-header { display: flex; flex-wrap: wrap; gap: .75rem; padding: 1rem 1.25rem; border-radius: var(--th-radius-panel) var(--th-radius-panel) 0 0; color: var(--th-color-on-dark); background: linear-gradient(110deg,var(--th-color-dark-start),var(--th-color-dark-end)); border-bottom: 2px solid #a9d4ff; font-weight: var(--th-weight-semibold); }
.th-filter-panel .card-body { padding: var(--th-space-5); }
.th-filter-panel .form-label { display: flex; align-items: center; gap: .4rem; }
.th-filter-actions { display: flex; flex-wrap: wrap; gap: .625rem; margin-top: 1rem; }
.th-filter-toolbar { border: 1px solid var(--th-color-border); border-radius: var(--th-radius-panel); padding: var(--th-space-4); background: var(--th-color-surface-soft); gap: .75rem; }
.th-filter-toolbar :is(.form-control,.input-group-text) { min-height: var(--th-control-height); height: auto; }
.th-filter-toolbar .ms-auto { min-width: 0 !important; max-width: 100%; }
.th-filter-panel .label-icon { font-size: var(--th-text-base); }
/* Switches: solo presentación; ninguna escritura o confirmación se añade desde este componente. */
.th-switch .form-check-input { width: 2.6em; height: 1.4em; flex-shrink: 0; cursor: pointer; border-color: var(--th-color-control-border); }
.th-switch .form-check-input:checked { background-color: var(--th-color-success); border-color: var(--th-color-success); }
.th-switch .form-check-input:focus-visible { outline: 2px solid var(--th-color-focus); outline-offset: 3px; }
.th-switch .form-check-input:disabled { cursor: default; opacity: .55; }
.th-switch[aria-busy="true"] .form-check-input { cursor: wait; }
.th-save-status { display: block; min-height: 1.25rem; font-size: var(--th-text-sm); line-height: 1.5; }
.th-status { color: var(--th-color-label); background-color: var(--th-color-neutral-soft); display: inline-flex; align-items: center; justify-content: center; gap: .3rem; padding: .4rem .65rem; border: 1px solid transparent; border-radius: var(--th-radius-pill); font-size: var(--th-text-xs); font-weight: var(--th-weight-semibold); line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.th-status:is(.bg-success,.text-bg-success,.th-status--success,.th-status--green) { color: #176749 !important; background-color: var(--th-color-success-soft) !important; }
.th-status:is(.bg-danger,.text-bg-danger,.th-status--danger,.th-status--red) { color: #a43047 !important; background-color: var(--th-color-danger-soft) !important; }
.th-status:is(.bg-warning,.text-bg-warning,.th-status--warning,.th-status--amber) { color: var(--th-color-warning) !important; background-color: var(--th-color-warning-soft) !important; }
.th-status:is(.bg-info,.text-bg-info,.th-status--info,.th-status--cyan) { color: #086b80 !important; background-color: var(--th-color-info-soft) !important; }
.th-status:is(.bg-primary,.text-bg-primary,.th-status--primary,.th-status--blue) { color: var(--th-color-primary) !important; background-color: #e7effd !important; }
.th-status:is(.bg-secondary,.text-bg-secondary,.th-status--muted,.th-status--slate) { color: #52637c !important; background-color: var(--th-color-neutral-soft) !important; }
.th-result-state { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.5rem 1rem; color: var(--th-color-muted); text-align: center; font-size: var(--th-text-sm); }
.th-result-state > .bi { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .8rem; background: var(--th-color-surface-soft); color: var(--th-color-primary); font-size: 1.25rem; }
.th-result-state--error { color: #a43047; }
.th-result-state--loading > .bi { animation: th-loading-spin 1s linear infinite; }
@media (max-width: 767.98px) { .th-filter-panel .card-body { padding: var(--th-space-4); } .th-filter-actions > .th-btn { flex: 1 1 auto; } .th-filter-toolbar .ms-auto { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .th-result-state--loading > .bi { animation: none; } }

.th-status--violet { color: #7250c7 !important; background-color: #f1eafd !important; }
.th-status--orange { color: #94540b !important; background-color: #fff1df !important; }

.th-progress { height: 1.25rem; border: 1px solid var(--th-color-border); border-radius: var(--th-radius-pill); background: var(--th-color-surface-soft); }
.th-progress .progress-bar { background: linear-gradient(100deg,var(--th-gradient-blue-start),var(--th-gradient-blue-end)); font-size: var(--th-text-xs); transition: width var(--th-motion-fast); }
@media (prefers-reduced-motion: reduce) { .th-progress .progress-bar { transition: none; } }
