/* Tema compartido entre los cuatro paneles. Se carga después de sus estilos. */
.itsc-preferences{display:flex;align-items:center;justify-content:flex-end;gap:.65rem;flex-wrap:wrap;margin-left:auto;font:600 .85rem Arial,sans-serif}
.itsc-theme-toggle,.itsc-idle-select{border:1px solid #94a3b8;border-radius:.65rem;background:#fff;color:#0f172a;min-height:2.35rem}
.itsc-theme-toggle{padding:.25rem .6rem;font-size:1.12rem;line-height:1.4;cursor:pointer}
.itsc-idle-label{display:flex;align-items:center;gap:.4rem;color:inherit}
.itsc-idle-select{padding:.2rem .45rem;cursor:pointer}
.itsc-theme-toggle:focus-visible,.itsc-idle-select:focus-visible,.itsc-idle-warning button:focus-visible{outline:3px solid #38bdf8;outline-offset:2px}
.itsc-idle-warning[hidden]{display:none!important}
.itsc-idle-warning{position:fixed;right:1rem;bottom:1rem;z-index:3000;width:min(420px,calc(100vw - 2rem));padding:1rem 1.2rem;border:2px solid #f59e0b;border-radius:1rem;background:#fff;color:#172033;box-shadow:0 18px 40px #0005}
.itsc-idle-warning p{margin:0 0 .75rem;line-height:1.45}
.itsc-idle-warning button{padding:.45rem .85rem;border:0;border-radius:.55rem;background:#0b3d91;color:#fff;font-weight:700;cursor:pointer}
@media(max-width:700px){.itsc-preferences{justify-content:flex-start;margin:.65rem 0 0}.topbar:has(.itsc-preferences),.inv-header:has(.itsc-preferences){flex-wrap:wrap}}

html[data-theme="dark"]{color-scheme:dark;--bs-body-bg:#0f172a;--bs-body-color:#f8fafc;--bs-secondary-color:#cbd5e1;--bs-border-color:#475569;--bs-tertiary-bg:#1e293b;--fondo:#0f172a;--blanco:#1e293b}
html[data-theme="dark"] body,html[data-theme="dark"] .content,html[data-theme="dark"] .inv-main,html[data-theme="dark"] main{background-color:#0f172a!important;color:#f8fafc!important}
html[data-theme="dark"] :is(.navbar,footer,.footer){background-color:#1e293b!important;color:#f8fafc!important}
html[data-theme="dark"] :is(.topbar,.card,.card-body,.card-box,.content-card,.profile-card,.materia-card,.materia-card-body,.dashboard-card,.summary-card,.task-card,.task-meta-item,.annual-card,.recovery-box,.inv-box,.inv-card,.login-card,.modal-content,.dropdown-menu,.list-group-item,.accordion-item,.alert-secondary,.bg-white,.bg-light){background:#1e293b!important;color:#f8fafc!important;border-color:#334155!important}
html[data-theme="dark"] :is(h1,h2,h3,h4,h5,h6,p,label,strong,small,dt,dd,li,.profile-value,.profile-label,.section-title,.text-dark,.text-muted,.text-secondary,.card-title,.topbar h3){color:#f8fafc!important}
html[data-theme="dark"] :is(.form-control,.form-select,input:not([type="submit"],[type="button"],[type="checkbox"],[type="radio"]),textarea,select,.itsc-theme-toggle,.itsc-idle-select){background-color:#0f172a!important;color:#f8fafc!important;border-color:#64748b!important}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#cbd5e1!important;opacity:1}
html[data-theme="dark"] :is(.table,table){--bs-table-bg:#1e293b;--bs-table-color:#f8fafc;--bs-table-border-color:#475569;--bs-table-striped-bg:#26364c;--bs-table-striped-color:#f8fafc;--bs-table-hover-bg:#334155;--bs-table-hover-color:#f8fafc;color:#f8fafc!important;border-color:#475569!important}
html[data-theme="dark"] :is(th,td){color:#f8fafc!important;border-color:#475569!important}
html[data-theme="dark"] .table tbody tr:nth-child(even){background:#26364c!important}
html[data-theme="dark"] :is(.info-line,.summary-label,.summary-value,.dashboard-value,.annual-title,.annual-score,.task-meta-item){color:#f8fafc!important}
html[data-theme="dark"] :is(a:not(.btn),.btn-link){color:#93c5fd}
html[data-theme="dark"] :is(.sidebar,.inv-sidebar) a{color:#f8fafc!important}
html[data-theme="dark"] .alert{background:#334155!important;color:#f8fafc!important;border-color:#64748b!important}
html[data-theme="dark"] .alert-info{background:#0c4a6e!important}
html[data-theme="dark"] .alert-success{background:#14532d!important}
html[data-theme="dark"] .alert-warning{background:#78350f!important}
html[data-theme="dark"] .alert-danger{background:#7f1d1d!important}
html[data-theme="dark"] :is(.border,.border-top,.border-bottom,.border-start,.border-end){border-color:#475569!important}
html[data-theme="dark"] .itsc-idle-warning{background:#1e293b;color:#f8fafc;border-color:#f59e0b}
html[data-theme="dark"] .itsc-idle-warning button{background:#2563eb}
html[data-theme="dark"] .btn-outline-primary{color:#93c5fd;border-color:#60a5fa}
html[data-theme="dark"] .btn-outline-secondary{color:#e2e8f0;border-color:#94a3b8}
html[data-theme="dark"] :is(.badge.bg-warning,.btn-warning){color:#0f172a!important}

/* Paneles academicos: cubrir las tarjetas definidas en estilos de cada pagina. */
html[data-theme="dark"] :is(.card-materia,.modulo-card,.info-panel,.panel-card,.tarjeta,.box,.library-card,.material-card,.library-file,.archivo){background-color:#1e293b!important;border-color:#334155!important;color:#f8fafc!important}
html[data-theme="dark"] :is(.card,.card-box,.card-materia,.modulo-card,.info-panel,.panel-card,.materia-card,.dashboard-card,.content-card,.library-card,.material-card,.tarjeta,.box) :is(h1,h2,h3,h4,h5,h6,p,li,strong,.card-title,.modulo-icon){color:#f8fafc!important}
html[data-theme="dark"] :is(.text-muted,.text-secondary,.profile-label,.summary-label,.dashboard-value,.library-description,.descripcion){color:#94a3b8!important}
html[data-theme="dark"] :is(.card-materia,.materia-card) :is(.card-header-custom,.materia-card-header) small{color:#cbd5e1!important}
html[data-theme="dark"] :is(.card,.card-box,.card-materia,.modulo-card,.info-panel,.panel-card,.materia-card,.dashboard-card,.content-card,.library-card,.material-card,.tarjeta,.box) :is(.text-muted,.text-secondary,small,.summary-label,.dashboard-value,.info-line,.library-description,.descripcion){color:#94a3b8!important}

/* Las celdas necesitan fondo propio: algunos estilos claros lo fijan en td. */
html[data-theme="dark"] :is(table,.table) :is(thead,tbody,tr,th,td){background-color:#1e293b!important;color:#f8fafc!important;border-color:#334155!important}
html[data-theme="dark"] :is(table,.table) tbody tr:nth-child(even) :is(th,td){background-color:#26364c!important}
html[data-theme="dark"] :is(table,.table) tbody tr:hover :is(th,td){background-color:#334155!important}

html[data-theme="dark"] :is(.form-control:not(select),.form-select:not(select),input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),textarea):not([type="hidden"]){background-color:#0f172a!important;border-color:#334155!important;color:#f8fafc!important}
html[data-theme="dark"] :is(.btn-main,.btn-primary){background-color:#2563eb!important;border:1px solid #60a5fa!important;color:#fff!important}
html[data-theme="dark"] :is(.btn-main,.btn-primary):hover{background-color:#1d4ed8!important;border-color:#93c5fd!important}
html[data-theme="dark"] .btn-light{background-color:#334155!important;border-color:#64748b!important;color:#f8fafc!important}
html[data-theme="dark"] :is(.btn-outline-primary,.btn-outline-secondary):hover{background-color:#334155!important;color:#f8fafc!important;border-color:#93c5fd!important}

/* Select nativo, Select2 y Choices (incluidos desplegables fuera de la tarjeta). */
html[data-theme="dark"] :is(select,select option,select optgroup,datalist,datalist option,.select2-container,.select2-dropdown,.select2-selection,.select2-selection--single,.select2-selection--multiple,.select2-results,.select2-results__options,.select2-results__option,.select2-selection__rendered,.choices,.choices__inner,.choices__list,.choices__list--dropdown,.choices__list[aria-expanded],.choices__item){background-color:#1e293b!important;color:#f8fafc!important;border-color:#334155!important}
html[data-theme="dark"] :is(.select2-selection__placeholder,.choices__placeholder){color:#94a3b8!important}
html[data-theme="dark"] :is(.select2-selection__choice,.choices__item--selectable){background-color:#334155!important;color:#f8fafc!important;border-color:#64748b!important}
html[data-theme="dark"] :is(.select2-selection__choice__display,.select2-selection__choice__remove,.select2-selection__clear,.select2-selection__arrow){color:#f8fafc!important;border-color:#64748b!important}
html[data-theme="dark"] :is(.select2-search__field,.select2-search--dropdown .select2-search__field,.choices__input,.choices__input--cloned){background-color:#0f172a!important;color:#f8fafc!important;border-color:#334155!important}
html[data-theme="dark"] :is(.select2-search__field,.choices__input)::placeholder{color:#94a3b8!important;opacity:1}
html[data-theme="dark"] :is(select option:checked,select option:hover,select option:focus,.select2-results__option--highlighted,.select2-results__option--selected,.select2-results__option[aria-selected="true"],.choices__item--choice.is-highlighted,.choices__item--choice.is-selected){background-color:#2563eb!important;color:#fff!important}
html[data-theme="dark"] :is(.select2-container--focus .select2-selection,.select2-container--open .select2-selection,.choices.is-focused .choices__inner){border-color:#60a5fa!important}
html[data-theme="dark"] :is(input:not([type="hidden"]),textarea,select):autofill{background-color:#0f172a!important;color:#f8fafc!important;box-shadow:0 0 0 1000px #0f172a inset!important;-webkit-text-fill-color:#f8fafc!important}
@media print{.itsc-preferences,.itsc-idle-warning{display:none!important}}
