/* =====================================================================
   ProfeYa V76.23 · tema claro/oscuro unificado
   Revisión integral sobre public_html del 03/10/2026
   Se carga ÚLTIMO para neutralizar estilos viejos que dependían del tema
   del sistema o tenían fondos claros/oscuros fijos.
   ===================================================================== */
html[data-theme="light"]{
  --v7623-bg:#f4f6fb;--v7623-card:#ffffff;--v7623-card2:#f8fafc;--v7623-text:#182033;
  --v7623-muted:#667085;--v7623-line:#e4e8f0;--v7623-soft:#f1efff;--v7623-input:#ffffff;
  --v7623-shadow:0 10px 30px rgba(17,24,39,.055);color-scheme:light;
}
html[data-theme="dark"]{
  --v7623-bg:#0b1120;--v7623-card:#111827;--v7623-card2:#141d2c;--v7623-text:#eef3fb;
  --v7623-muted:#aeb8ca;--v7623-line:#29364a;--v7623-soft:#201f3e;--v7623-input:#0e1625;
  --v7623-shadow:0 12px 32px rgba(0,0,0,.22);color-scheme:dark;
}

/* ---------- ADMIN: base explícita, sin depender de prefers-color-scheme ---------- */
body.adminThemeV7623{background:var(--v7623-bg)!important;color:var(--v7623-text)!important}
body.adminThemeV7623 .adminMain{background:var(--v7623-bg)!important;color:var(--v7623-text)!important}
body.adminThemeV7623 :is(h1,h2,h3,h4,strong,label){color:var(--v7623-text)}
body.adminThemeV7623 :is(p,small,.muted,.note){color:var(--v7623-muted)}
body.adminThemeV7623 :is(input,select,textarea){background:var(--v7623-input)!important;color:var(--v7623-text)!important;border-color:var(--v7623-line)!important}
body.adminThemeV7623 :is(.panel,.tableWrap,.adminMetrics article,.statusCards>div,.courseGrid>div,.detailMetrics>div,.systemItem,.adminPlanCard){
  border-color:var(--v7623-line)!important;color:var(--v7623-text)!important
}
html[data-theme="light"] body.adminThemeV7623 :is(.panel,.tableWrap,.adminMetrics article,.statusCards>div,.courseGrid>div,.detailMetrics>div,.systemItem,.adminPlanCard){background:#fff!important}
html[data-theme="dark"] body.adminThemeV7623 :is(.panel,.tableWrap,.adminMetrics article,.statusCards>div,.courseGrid>div,.detailMetrics>div,.systemItem,.adminPlanCard){background:#111827!important}
html[data-theme="light"] body.adminThemeV7623 th{background:#f8fafc!important;color:#64748b!important}
html[data-theme="dark"] body.adminThemeV7623 th{background:#172033!important;color:#b5c0d2!important}
html[data-theme="light"] body.adminThemeV7623 tbody tr:hover{background:#fafbfe!important}
html[data-theme="dark"] body.adminThemeV7623 tbody tr:hover{background:#141d2c!important}

/* V53 · diagnóstico: antes quedaba SIEMPRE oscuro aun con tema claro */
html[data-theme="light"] body.adminThemeV7623 .qualityDiagnosisV53{background:linear-gradient(145deg,#fff,#f8fbff)!important;border-color:#d9e3f2!important}
html[data-theme="light"] body.adminThemeV7623 .qualityDiagnosisV53 :is(.diagnosisHeadV53 h2,.diagnosisSubjectsV53>div:first-child strong){color:#182033!important}
html[data-theme="light"] body.adminThemeV7623 .qualityDiagnosisV53 :is(.diagnosisHeadV53 p,.diagnosisSubjectsV53>div:first-child span){color:#667085!important}
html[data-theme="light"] body.adminThemeV7623 :is(.diagnosisSummaryV53 article,.diagnosisIssueCardV53,.diagnosisSubjectChipsV53 a,.queueFilterV53){background:#fff!important;border-color:#dce4ef!important;color:#182033!important}
html[data-theme="light"] body.adminThemeV7623 .diagnosisSummaryV53 :is(strong,span,small),
html[data-theme="light"] body.adminThemeV7623 .diagnosisIssueCardV53 :is(span,b,p,small),
html[data-theme="light"] body.adminThemeV7623 .diagnosisSubjectChipsV53 :is(a,b),
html[data-theme="light"] body.adminThemeV7623 .queueFilterV53 :is(strong){color:inherit!important}
html[data-theme="light"] body.adminThemeV7623 .diagnosisSummaryV53 strong{color:#182033!important}
html[data-theme="light"] body.adminThemeV7623 .diagnosisSummaryV53 :is(span,small){color:#697386!important}
html[data-theme="light"] body.adminThemeV7623 .diagnosisIssueTopV53 span{color:#182033!important}
html[data-theme="light"] body.adminThemeV7623 .diagnosisIssueTopV53 b{color:#21618c!important}
html[data-theme="light"] body.adminThemeV7623 .diagnosisIssueCardV53 p{color:#667085!important}
html[data-theme="light"] body.adminThemeV7623 .diagnosisSubjectsV53{border-top-color:#e4e8f0!important}
html[data-theme="dark"] body.adminThemeV7623 .qualityDiagnosisV53{background:linear-gradient(145deg,#0f172a,#111d32)!important;border-color:#33415f!important}

/* V54 · reparación por grupos */
html[data-theme="light"] body.adminThemeV7623 .groupRepairPanelV54{background:linear-gradient(145deg,#fff,#f8fbff)!important;border-color:#d7e1ef!important}
html[data-theme="light"] body.adminThemeV7623 .groupRepairPanelV54 .panelHead h2{color:#182033!important}
html[data-theme="light"] body.adminThemeV7623 .groupRepairPanelV54 .panelHead p{color:#667085!important}
html[data-theme="light"] body.adminThemeV7623 :is(.groupRepairHeroV54,.groupRepairProgressV54,.groupPatternBlockV54,.groupRecentV54 table){background:#fff!important;border-color:#dce4ef!important;color:#182033!important}
html[data-theme="light"] body.adminThemeV7623 .groupPatternTitleV54{border-bottom-color:#e5eaf2!important}
html[data-theme="light"] body.adminThemeV7623 .groupPatternListV54 article{border-bottom-color:#edf0f5!important}
html[data-theme="light"] body.adminThemeV7623 :is(.groupRepairHeroV54 strong,.groupRepairProgressHeadV54 strong,.groupPatternTitleV54 strong,.groupPatternListV54 article strong,.groupRecentV54>strong,.groupRecentV54 td strong){color:#182033!important}
html[data-theme="light"] body.adminThemeV7623 :is(.groupRepairHeroV54 p,.groupRepairHeroV54 small,.groupRepairProgressV54 small,.groupPatternTitleV54 span,.groupPatternListV54 article small,.groupPatternListV54 article>b,.groupRecentV54 td){color:#667085!important}

/* V45–V52 · cola/calidad/web/auditoría: oscuro real y claro real */
html[data-theme="dark"] body.adminThemeV7623 :is(.qualityAlertV45,.qualityEmptyV45,.qualityQueueSideV45,.qualityEditorV45,.qualityIssuePanelV45,.qualityIssuePanelV45>div,.qualityAiProgressV46,.repairDetailV50,.catalogAuditPanelV51,.catalogAuditSummaryV51>div,.catalogAuditProgressV51,.legacyRepairNoticeV52,.legacyRepairProgressV52,.webAlertV49,.webQualityNoticeV49,.webIntroV49,.webCandidateCardV49,.webReasonV49,.webSourcesV49 a,.webManualV49){background:#111827!important;border-color:#334155!important;color:#e8edf7!important}
html[data-theme="dark"] body.adminThemeV7623 :is(.qualityQueueListV45>a,.qualityEditFormV45 label,.qualityReviewTopV45 p,.qualityEditorHeadV45 p,.qualityIssuePanelV45 p,.qualityIssuePanelV45 small,.qualityAiProgressV46 small,.repairStateV50 small,.repairStateV50 p,.repairDetailV50 p,.repairDetailV50 small,.catalogAuditPanelV51 .panelHead p,.catalogAuditSummaryV51 span,.catalogAuditProgressV51 span,.catalogAuditProgressV51 small,.legacyRepairNoticeV52 span,.legacyRepairProgressV52 span,.webCandidateCardV49>p,.webCandidateHeadV49 small,.webReasonV49 span){color:#aeb8ca!important}
html[data-theme="dark"] body.adminThemeV7623 :is(.qualityQueueListV45>a,.qualityQueueTitleV45,.webCandidateActionsV49){border-color:#29364a!important}
html[data-theme="dark"] body.adminThemeV7623 :is(.qualityQueueListV45>a,.qualityQueueListV45 strong,.qualitySelectV45 h2,.qualityEditorHeadV45 h2,.qualityIssuePanelV45 strong,.qualityAiProgressV46 strong,.repairDetailV50 strong,.catalogAuditPanelV51 h2,.catalogAuditSummaryV51 strong,.catalogAuditProgressV51 strong,.legacyRepairNoticeV52 strong,.legacyRepairProgressV52 strong,.webCandidateHeadV49 h3){color:#f3f6ff!important}
html[data-theme="dark"] body.adminThemeV7623 .qualityQueueListV45>a:hover{background:#162036!important}
html[data-theme="dark"] body.adminThemeV7623 .qualityQueueListV45>a.active{background:#211f42!important}
html[data-theme="dark"] body.adminThemeV7623 .qualityEditFormV45 :is(input,select,textarea){background:#0e1625!important;color:#f8fafc!important;border-color:#39475d!important}
html[data-theme="dark"] body.adminThemeV7623 .catalogAuditTrackV51,
html[data-theme="dark"] body.adminThemeV7623 .qualityAiProgressTrackV46{background:#263244!important}
html[data-theme="dark"] body.adminThemeV7623 .legacyRepairNoticeV52{background:linear-gradient(135deg,#2b2415,#172033)!important}
html[data-theme="dark"] body.adminThemeV7623 .bulkAiGuardV52{background:#302510!important;color:#ffd18a!important}
html[data-theme="dark"] body.adminThemeV7623 .webQualityPillV49{background:#263244!important;color:#cbd5e1!important}
html[data-theme="dark"] body.adminThemeV7623 .webQualityPillV49.high{background:#102a21!important;color:#a7f3d0!important}
html[data-theme="dark"] body.adminThemeV7623 .webQualityPillV49.medium{background:#302510!important;color:#ffd18a!important}

/* V56/V58/V60/V61 · crecimiento y reparaciones */
html[data-theme="light"] body.adminThemeV7623 .structureRepairV56{background:linear-gradient(135deg,#eefaf7,#f6f9ff)!important;border-color:#b8d8d4!important}
html[data-theme="light"] body.adminThemeV7623 .structureRepairV56 :is(h2,p,p strong){color:#25414a!important}
html[data-theme="dark"] body.adminThemeV7623 .catalogGrowthPanelV56{background:linear-gradient(145deg,#111827,#151f34)!important;border-color:#35445f!important}
html[data-theme="dark"] body.adminThemeV7623 .catalogGrowthPanelV56 .panelHead h2{color:#f4f7ff!important}
html[data-theme="dark"] body.adminThemeV7623 .catalogGrowthPanelV56 .panelHead p{color:#aeb8ca!important}
html[data-theme="dark"] body.adminThemeV7623 :is(.growthMetricsV56 article,.growthTopicV56,.growthProgressV56){background:#151f34!important;border-color:#35445f!important}
html[data-theme="dark"] body.adminThemeV7623 :is(.growthMetricsV56 strong,.growthTopicMainV56 strong,.growthTopicCountV56 strong,.growthProgressV56 strong,.growthRecentV56>strong){color:#eef3ff!important}
html[data-theme="dark"] body.adminThemeV7623 :is(.growthMetricsV56 span,.growthMetricsV56 small,.growthTopicMainV56 small,.growthTopicCountV56 span,.growthTopicCountV56 small,.growthProgressV56 span){color:#aeb8ca!important}
html[data-theme="dark"] body.adminThemeV7623 .growthTopicBarV56{background:#263244!important}
html[data-theme="dark"] body.adminThemeV7623 .growthTopicActionsV56 button.secondary{background:#263244!important;color:#dce5f2!important;border-color:#39475d!important}
html[data-theme="dark"] body.adminThemeV7623 .growthHoldV56{background:#302510!important;color:#ffd18a!important;border-color:#6f5320!important}
html[data-theme="dark"] body.adminThemeV7623 .orthographyFixV58{background:linear-gradient(135deg,#122b38,#1b2140)!important}
html[data-theme="light"] body.adminThemeV7623 :is(.growthBulkV60,.growthTargetFormV61,.growthWorkerStatusV61){color:#182033!important}
html[data-theme="dark"] body.adminThemeV7623 :is(.growthBulkCopyV60>p,.growthBulkActionsV60 small,.growthTargetFormV61 label,.growthTargetFormV61 small,.growthWorkerStatusV61>div>small,.growthWorkerStatusV61 details){color:#aeb8ca!important}

/* Banco pedagógico */
body.adminThemeV7623 .pbShell{color:var(--pb-text)}
html[data-theme="light"] body.adminThemeV7623{--pb-bg:#f6f8fc;--pb-card:#fff;--pb-text:#172033;--pb-muted:#667085;--pb-line:#e4e7ec}
html[data-theme="dark"] body.adminThemeV7623{--pb-bg:#0d1324;--pb-card:#121a2d;--pb-text:#f5f7ff;--pb-muted:#aeb7d2;--pb-line:#263452}

/* Auditor de especialistas */
body.expertAuditThemeV7623{background:var(--v7623-bg)!important;color:var(--v7623-text)!important}
body.expertAuditThemeV7623 :is(.eaHero>div,.eaStats article,.eaRun,.eaReview){background:var(--v7623-card)!important;border-color:var(--v7623-line)!important;color:var(--v7623-text)!important}
body.expertAuditThemeV7623 :is(.eaTop p,.eaHero p,.eaReview p,.eaStats span,.eaRunHead small,.eaTable th){color:var(--v7623-muted)!important}
body.expertAuditThemeV7623 .eaTable :is(th,td){border-color:var(--v7623-line)!important}

/* Recuperación por cobertura · antes era sólo clara */
body.coverageThemeV7623{background:var(--v7623-bg)!important;color:var(--v7623-text)!important}
body.coverageThemeV7623 :is(.card,.metric){background:var(--v7623-card)!important;border-color:var(--v7623-line)!important;color:var(--v7623-text)!important}
body.coverageThemeV7623 :is(p,.note,.status,.metric span,th){color:var(--v7623-muted)!important}
body.coverageThemeV7623 :is(.targets a,button.secondary,.pill){background:var(--v7623-card2)!important;border-color:var(--v7623-line)!important;color:var(--v7623-text)!important}
body.coverageThemeV7623 .help{background:color-mix(in srgb,var(--v7623-card) 82%,#dbeafe 18%)!important;border-color:var(--v7623-line)!important}
body.coverageThemeV7623 .track{background:var(--v7623-line)!important}
body.coverageThemeV7623 :is(th,td){border-color:var(--v7623-line)!important}
html[data-theme="dark"] body.coverageThemeV7623 .targets a.active{background:#211f42!important;color:#c4b5fd!important;border-color:#5d53a5!important}

/* Reparación masiva segura · antes era sólo oscura */
html[data-theme="light"] body.massRepairThemeV7623{background:linear-gradient(135deg,#f4f6fb,#eef4ff 60%,#f7f3ff)!important;color:#182033!important}
html[data-theme="light"] body.massRepairThemeV7623 :is(.hero,.metric,.card,.master,.progress){background:#fff!important;border-color:#dce4ef!important;color:#182033!important;box-shadow:var(--v7623-shadow)!important}
html[data-theme="light"] body.massRepairThemeV7623 :is(p,.detail,.log){color:#667085!important}
html[data-theme="light"] body.massRepairThemeV7623 .back{background:#fff!important;border-color:#dce4ef!important;color:#182033!important}
html[data-theme="light"] body.massRepairThemeV7623 .btn.secondary{background:#eef2f7!important;color:#334155!important;border-color:#dce4ef!important}
html[data-theme="light"] body.massRepairThemeV7623 .badge{background:#eef4ff!important;color:#344a78!important;border-color:#d5e1f2!important}
html[data-theme="light"] body.massRepairThemeV7623 .track{background:#e7ebf2!important}
html[data-theme="light"] body.massRepairThemeV7623 .log div{border-bottom-color:#e9edf4!important}
html[data-theme="light"] body.massRepairThemeV7623 .safe{background:#ecfdf5!important;border-color:#a7e6cf!important;color:#166534!important}
html[data-theme="light"] body.massRepairThemeV7623 .warn{background:#fff7e8!important;border-color:#f0d6a4!important;color:#8a5a08!important}

/* ---------- Sitio/familia/auth: refuerzo de contraste ---------- */
html[data-theme="dark"] body.siteThemeV7623 :is(.authCard,.profileCard,.panel,.familySubpanel,.familyModal,.roleCard,.studentAccessChoice,.recoveryOption){background:#111833!important;border-color:#2b3858!important;color:#f5f8ff!important}
html[data-theme="light"] body.siteThemeV7623 :is(.authCard,.profileCard,.panel,.familySubpanel,.familyModal,.roleCard,.studentAccessChoice,.recoveryOption){background:#fff!important;border-color:#e4e8f0!important;color:#182033!important}
body.siteThemeV7623 hr{border-color:var(--v7623-line)!important}

/* ---------- Universidad: ahora comparte la misma preferencia ---------- */
body.universityThemeV7623{background:var(--v7623-bg)!important;color:var(--v7623-text)!important;--bg:var(--v7623-bg);--surface:var(--v7623-card);--text:var(--v7623-text);--muted:var(--v7623-muted);--line:var(--v7623-line);--soft:var(--v7623-soft);--shadow:var(--v7623-shadow)}
body.universityThemeV7623 .topbar{background:color-mix(in srgb,var(--v7623-card) 94%,transparent)!important;border-color:var(--v7623-line)!important}
body.universityThemeV7623 :is(.hero-card,.panel,.card,.exercise,.result,.notice,.similar-item,.practice-card,.stat-card,.expert-answer){background:var(--v7623-card)!important;border-color:var(--v7623-line)!important;color:var(--v7623-text)!important}
body.universityThemeV7623 :is(.btn.ghost,.field input,.field select,.field textarea,td select){background:var(--v7623-input)!important;border-color:var(--v7623-line)!important;color:var(--v7623-text)!important}
body.universityThemeV7623 :is(.hero p,.lead,.card p,.muted,.microcopy,.footer,.navlinks>a:not(.btn),.similar-item small,.stat-card span){color:var(--v7623-muted)!important}
body.universityThemeV7623 .section.soft{background:color-mix(in srgb,var(--v7623-bg) 88%,#5b6cff 12%)!important}
body.universityThemeV7623 .footer{background:var(--v7623-card)!important;border-color:var(--v7623-line)!important}
html[data-theme="dark"] body.universityThemeV7623 .hero{background:radial-gradient(circle at 85% 20%,rgba(28,199,218,.10),transparent 34%),linear-gradient(135deg,#0c1328,#111a31 65%)!important}
html[data-theme="light"] body.universityThemeV7623 .hero{background:radial-gradient(circle at 85% 20%,#e7ffff 0,transparent 34%),linear-gradient(135deg,#f2f4ff 0,#fbfcff 65%)!important}
body.universityThemeV7623 .progress-track{background:var(--v7623-line)!important}
body.universityThemeV7623 :is(th,td){border-color:var(--v7623-line)!important}

/* ---------- Selector: siempre visible y legible ---------- */
body.adminThemeV7623 .globalThemeToggleV70,
body.siteThemeV7623 .globalThemeToggleV70,
body.universityThemeV7623 .globalThemeToggleV70{
  background:color-mix(in srgb,var(--v7623-card) 94%,transparent)!important;
  color:var(--v7623-text)!important;border-color:var(--v7623-line)!important
}

/* No animar cambio inicial; sólo cambios posteriores muy breves. */
@media(prefers-reduced-motion:no-preference){
  body.adminThemeV7623,body.siteThemeV7623,body.universityThemeV7623,
  body.adminThemeV7623 .panel,body.universityThemeV7623 .card{transition:background-color .12s ease,color .12s ease,border-color .12s ease}
}
