/* =====================================================================
   ProfeYa V70 · tema claro/oscuro unificado
   01/10/2026
   ===================================================================== */

html[data-theme="light"]{
  color-scheme:light;
  --py70-bg:#f7f9ff;
  --py70-card:#ffffff;
  --py70-card-2:#f6f8ff;
  --py70-text:#0b1557;
  --py70-muted:#66749b;
  --py70-line:#e5eaf5;
  --py70-soft:#f0edff;
}
html[data-theme="dark"]{
  color-scheme:dark;
  --py70-bg:#080d22;
  --py70-card:#111833;
  --py70-card-2:#151e3b;
  --py70-text:#f5f8ff;
  --py70-muted:#aeb9d4;
  --py70-line:#2a3658;
  --py70-soft:#211d49;
}

/* Selector disponible incluso en páginas que antes no tenían botón. */
.globalThemeToggleV70{
  position:fixed;right:max(14px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));
  z-index:9999;display:inline-flex;align-items:center;justify-content:center;gap:7px;
  min-height:42px;padding:9px 13px;border-radius:999px;
  border:1px solid var(--py70-line);background:color-mix(in srgb,var(--py70-card) 94%,transparent);
  color:var(--py70-text);font:inherit;font-size:11px;font-weight:900;cursor:pointer;
  box-shadow:0 12px 34px rgba(14,26,73,.16);backdrop-filter:blur(14px)
}
.globalThemeToggleV70 [data-theme-icon]{font-size:15px;line-height:1}
html[data-theme="dark"] .globalThemeToggleV70{box-shadow:0 12px 34px rgba(0,0,0,.34)}
.adminTopActionsV70{margin-left:auto;display:flex;align-items:center;gap:8px}
.adminTop .adminThemeToggleV70{position:static;right:auto;bottom:auto;box-shadow:var(--shadow);min-height:36px;padding:7px 11px}
@media(max-width:600px){
  body>.globalThemeToggleV70{width:43px;height:43px;padding:0}
  body>.globalThemeToggleV70 [data-theme-label]{display:none}
  .adminTop .adminThemeToggleV70 [data-theme-label]{display:none}
}

/* ---------------------------------------------------------------------
   APP ESTUDIANTE · corrige fondos mezclados y contraste del modo oscuro
   --------------------------------------------------------------------- */
html[data-theme="dark"] #practiceView .practiceHeader,
html[data-theme="dark"] #practiceView .exerciseCard{
  background:#101832!important;
  border-color:#2a3658!important;
  color:#f6f8ff!important;
}
html[data-theme="dark"] #practiceView .practiceAppTopV13{
  background:linear-gradient(90deg,#111936,#121d3d 55%,#102742)!important;
  border-bottom-color:#293758!important;
}
html[data-theme="dark"] #practiceView .practiceBrandV13 strong,
html[data-theme="dark"] #practiceView .practiceSubjectCopyV13>strong,
html[data-theme="dark"] #practiceView .exerciseInstructionV13,
html[data-theme="dark"] #practiceView .practiceProgressLabelsV13,
html[data-theme="dark"] #practiceView .practiceProgressLabelsV13 b{
  color:#f7f9ff!important;
}
html[data-theme="dark"] #practiceView .practiceSubjectCopyV13 h1{
  color:#aebce3!important;
}
html[data-theme="dark"] #practiceView .practiceBackV13,
html[data-theme="dark"] #practiceView .practiceCounterV13,
html[data-theme="dark"] #practiceView .practiceStreakPill,
html[data-theme="dark"] #practiceView .practiceUserV13,
html[data-theme="dark"] #practiceView .difficulty{
  background:#1c2749!important;
  border-color:#334366!important;
  color:#dce6ff!important;
}
html[data-theme="dark"] #practiceView .practiceProgressTrackV13,
html[data-theme="dark"] #practiceView .progressTrack{
  background:#263250!important;
}
html[data-theme="dark"] #practiceView #promptCardV63,
html[data-theme="dark"] #practiceView .promptCardV13{
  background:#121b36!important;
  border-color:#2c395c!important;
  color:#f8f9ff!important;
}
html[data-theme="dark"] #practiceView .equation,
html[data-theme="dark"] #practiceView #prompt{
  color:#f8f9ff!important;
  -webkit-text-fill-color:initial!important;
  background:none!important;
}
html[data-theme="dark"] #practiceView .choiceBtn{
  background:#151e3b!important;
  border-color:#2c395c!important;
  color:#f4f7ff!important;
  box-shadow:0 9px 24px rgba(0,0,0,.14)!important;
}
html[data-theme="dark"] #practiceView .choiceBtn:hover:not(:disabled){
  background:#1a2749!important;border-color:#4c5f8d!important
}
html[data-theme="dark"] #practiceView .choiceBtn:before{
  background:#eef2ff!important;color:#17347c!important
}
html[data-theme="dark"] #practiceView .answerLabel,
html[data-theme="dark"] #practiceView .muted,
html[data-theme="dark"] #practiceView small{
  color:#aeb9d4!important
}
html[data-theme="dark"] #practiceView #answer{
  background:#10182f!important;color:#f7f9ff!important;border-color:#34415f!important
}
html[data-theme="dark"] #practiceView #answer::placeholder{color:#8492b3!important}
html[data-theme="dark"] #practiceView .profeGuideV31{
  background:linear-gradient(135deg,#151d3b,#11263d)!important;
  border-color:#334364!important
}
html[data-theme="dark"] #practiceView .profeGuideV31 strong{color:#f6f8ff!important}
html[data-theme="dark"] #practiceView .profeGuideV31 small{color:#adb9d2!important}

/* La falla visible de las capturas: las métricas quedaban blancas dentro del tema oscuro. */
html[data-theme="dark"] #practiceView .metricsGrid .metric,
html[data-theme="dark"] #practiceView .metricsGrid .adaptiveMetric{
  background:linear-gradient(145deg,#121a35,#17213f)!important;
  border:1px solid #2d3b5d!important;
  color:#f4f7ff!important;
  box-shadow:0 16px 38px rgba(0,0,0,.18)!important;
}
html[data-theme="dark"] #practiceView .metricsGrid .metric>span,
html[data-theme="dark"] #practiceView .metricsGrid .metric>small,
html[data-theme="dark"] #practiceView .metricsGrid .adaptiveMetric>span,
html[data-theme="dark"] #practiceView .metricsGrid .adaptiveMetric>small{
  color:#a9b6d0!important
}
html[data-theme="dark"] #practiceView .metricsGrid .metric>strong,
html[data-theme="dark"] #practiceView .metricsGrid .adaptiveMetric>strong{
  color:#f7f9ff!important
}
html[data-theme="dark"] #practiceView .navRow .ghost{
  background:#121a35!important;border-color:#2c395c!important;color:#c5d0e7!important
}
html[data-theme="dark"] #practiceView .navRow .ghost:disabled{color:#65718f!important}

/* Ayudas */
html[data-theme="dark"] #practiceView .helpBox,
html[data-theme="dark"] #practiceView .teacherSpeechV34,
html[data-theme="dark"] #practiceView .teacherCheckV34,
html[data-theme="dark"] #practiceView .teacherSelectedV34,
html[data-theme="dark"] #practiceView .easyThinkV63,
html[data-theme="dark"] #practiceView .stepRowV67{
  border-color:#33415f!important
}
html[data-theme="dark"] #practiceView .helpBox{color:#f5f8ff!important}
html[data-theme="dark"] #practiceView .teacherSpeechV34{background:#151d39!important}
html[data-theme="dark"] #practiceView .teacherMainV34,
html[data-theme="dark"] #practiceView .teacherLeadV34,
html[data-theme="dark"] #practiceView .teacherCheckV34 p,
html[data-theme="dark"] #practiceView .teacherSelectedV34 p{
  color:#d9e2f3!important
}

/* Progreso: todo oscuro cuando se eligió oscuro. */
html[data-theme="dark"] #progressView{
  background:
    radial-gradient(circle at 9% 7%,rgba(111,43,238,.42),transparent 25%),
    radial-gradient(circle at 91% 8%,rgba(23,177,207,.31),transparent 28%),
    linear-gradient(145deg,#151145,#14265f 48%,#0b4a68 76%,#08626e)!important
}
html[data-theme="dark"] #progressView .progressMasterCard,
html[data-theme="dark"] #progressView .progressStatCard,
html[data-theme="dark"] #progressView .progressMascotCard{
  background:linear-gradient(145deg,#111936,#17213f)!important;
  border-color:#2d3b5d!important;color:#f6f8ff!important
}
html[data-theme="dark"] #progressView .progressRing:after{
  background:#101832!important;box-shadow:inset 0 0 0 1px #2b3859!important
}
html[data-theme="dark"] #progressView .progressRing strong,
html[data-theme="dark"] #progressView .progressMasterCopy h2,
html[data-theme="dark"] #progressView .progressStatCopy strong,
html[data-theme="dark"] #progressView .progressStatCopy small{
  color:#f6f8ff!important
}
html[data-theme="dark"] #progressView .progressRing span,
html[data-theme="dark"] #progressView .progressMasterCopy p,
html[data-theme="dark"] #progressView .streakValue span{
  color:#aeb9d4!important
}
html[data-theme="dark"] #progressView .progressWideTrack,
html[data-theme="dark"] #progressView .progressXpTrack,
html[data-theme="dark"] #progressView .progressStreakTrack{
  background:#273451!important
}

/* Tema claro explícito: evita que el modo del teléfono fuerce piezas oscuras. */
html[data-theme="light"] #practiceView .metricsGrid .metric{
  color:#0b1557!important
}
html[data-theme="light"] #practiceView .metricsGrid .metric>span,
html[data-theme="light"] #practiceView .metricsGrid .metric>small{
  color:#7380a5!important
}

/* ---------------------------------------------------------------------
   PÁGINAS PÚBLICAS
   --------------------------------------------------------------------- */
html[data-theme="dark"] body.publicV17{
  background:
    radial-gradient(circle at 8% 0%,rgba(104,45,255,.20),transparent 27%),
    radial-gradient(circle at 95% 3%,rgba(20,198,223,.15),transparent 27%),
    #080d22!important;color:#f7f9ff!important
}
html[data-theme="dark"] .publicV17 .v17HeroPanel,
html[data-theme="dark"] .publicV17 .feature,
html[data-theme="dark"] .publicV17 .v17QuickBenefits article,
html[data-theme="dark"] .publicV17 .seoArticle,
html[data-theme="dark"] .publicV17 .seoAside,
html[data-theme="dark"] .publicV17 .seoMini{
  background:#111833!important;border-color:#293657!important;color:#f5f8ff!important
}
html[data-theme="dark"] .publicV17 .v17Section .feature:nth-child(n),
html[data-theme="dark"] .publicV17 .v17Family{
  background:linear-gradient(145deg,#111833,#14213b)!important;
  border-color:#293657!important
}
html[data-theme="dark"] .publicV17 :is(h1,h2,h3,strong),
html[data-theme="dark"] .publicV17 .v17HeroCopy h1,
html[data-theme="dark"] .publicV17 .v17HeroKicker,
html[data-theme="dark"] .publicV17 .sectionTitle h2{
  color:#f7f9ff!important
}
html[data-theme="dark"] .publicV17 :is(p,.lead,.sectionTitle p,.feature p,.v17QuickBenefits span,.trust,.footer){
  color:#aeb9d4!important
}
html[data-theme="dark"] .publicV17 .v17Secondary,
html[data-theme="dark"] .publicV17 .nav a:not(.primary),
html[data-theme="dark"] .publicV17 .theme{
  background:#151e3b!important;border-color:#2d3a5c!important;color:#eff3ff!important
}
html[data-theme="dark"] .publicV17 .v17FloatingTag{
  background:#17213f!important;color:#f5f8ff!important;border-color:#314063!important
}
/* En mobile el botón había quedado oculto. */
@media(max-width:620px){
  .publicV17 .v17Top .theme{display:grid!important}
}

/* ---------------------------------------------------------------------
   AUTH / FAMILIA / PERFILES
   --------------------------------------------------------------------- */
html[data-theme="dark"] :is(.authCard,.panel,.profileCard,.familySubpanel,.familyModal,.roleCard,.studentAccessChoice,.recoveryOption){
  border-color:#2b3858
}
html[data-theme="dark"] :is(.authCard,.profileCard,.familySubpanel,.familyModal,.roleCard,.studentAccessChoice,.recoveryOption){
  background:#111833!important;color:#f5f8ff!important
}
html[data-theme="dark"] :is(.profilePage,.authPage) :is(h1,h2,h3,strong,label){color:#f5f8ff}
html[data-theme="dark"] :is(.profilePage,.authPage) :is(.muted,small,p){color:#aeb9d4}
html[data-theme="dark"] :is(input,select,textarea){
  color-scheme:dark
}

/* ---------------------------------------------------------------------
   ADMIN · selector manual real, independiente del tema del sistema
   --------------------------------------------------------------------- */
html[data-theme="light"]{
  --bg:#f4f6fb;--card:#fff;--text:#182033;--muted:#697386;--line:#e4e8f0;
  --soft:#f1efff;--shadow:0 10px 30px rgba(17,24,39,.055);
  --ok:#087f5b;--okbg:#ecfdf5;--warn:#a15c00;--warnbg:#fff7e8;--bad:#b42318;--badbg:#fff1f0;
}
html[data-theme="dark"]{
  --bg:#0b1120;--card:#111827;--text:#e8edf7;--muted:#9da9bd;--line:#29364a;
  --soft:#211f42;--shadow:0 12px 32px rgba(0,0,0,.20);
  --ok:#68ddb5;--okbg:#102a21;--warn:#ffd18a;--warnbg:#302510;--bad:#ffaca7;--badbg:#32181a;
}
html[data-theme="light"] .adminSidebar{
  background:linear-gradient(180deg,#111827,#0d1422)!important
}
html[data-theme="dark"] .adminSidebar{
  background:linear-gradient(180deg,#070d18,#0a1220)!important
}
html[data-theme="light"] .adminMain,
html[data-theme="light"] .adminEditorPage,
html[data-theme="light"] .adminAuth{
  color:#182033!important
}
html[data-theme="dark"] .adminMain,
html[data-theme="dark"] .adminEditorPage,
html[data-theme="dark"] .adminAuth{
  color:#e8edf7!important
}
html[data-theme="dark"] .adminAuth{
  background:radial-gradient(circle at 20% 10%,rgba(101,84,232,.17),transparent 35%),#0b1120!important
}
html[data-theme="light"] .adminAuth{
  background:radial-gradient(circle at 20% 10%,#ede9fe,transparent 35%),#f4f6fb!important
}
html[data-theme="dark"] .adminEditorPage{background:#0b1120!important}
html[data-theme="light"] .adminEditorPage{background:#f5f6fb!important}

html[data-theme="dark"] :is(
 .adminMetrics article,.panel,.tableWrap,.statusCards>div,.courseGrid>div,.detailMetrics>div,
 .petAdminCard,.insightList p,.alertGrid a,.systemItem,.adminPlanCard,.existingTopicRow,
 .exerciseEditorCard,.qualityQueueSideV45,.qualityEditorV45,.qualityIssuePanelV45,
 .qualityIssuePanelV45>div,.catalogAuditSummaryV51>div,.growthMetricsV56 article,
 .growthTopicV56,.growthBulkNumbersV60 article,.growthBulkProgressV60,.growthTargetFormV61,
 .growthWorkerStatusV61,.evidenceCard
){
  background:#111827!important;border-color:#29364a!important;color:#e8edf7!important
}
html[data-theme="light"] :is(
 .adminMetrics article,.panel,.tableWrap,.statusCards>div,.courseGrid>div,.detailMetrics>div,
 .petAdminCard,.insightList p,.alertGrid a,.systemItem,.adminPlanCard,.existingTopicRow,
 .exerciseEditorCard,.qualityQueueSideV45,.qualityEditorV45,.qualityIssuePanelV45,
 .qualityIssuePanelV45>div,.catalogAuditSummaryV51>div,.growthMetricsV56 article,
 .growthTopicV56,.growthBulkNumbersV60 article,.growthBulkProgressV60,.growthTargetFormV61,
 .growthWorkerStatusV61,.evidenceCard
){
  background:#fff!important;border-color:#e4e8f0!important;color:#182033!important
}
html[data-theme="dark"] :is(th,.familyTopicHead){background:#172033!important;color:#b5c0d2!important}
html[data-theme="light"] :is(th,.familyTopicHead){background:#f8fafc!important;color:#64748b!important}
html[data-theme="dark"] tbody tr:hover{background:#141d2c!important}
html[data-theme="light"] tbody tr:hover{background:#fafbfe!important}
html[data-theme="dark"] :is(
 .requestControls select,.requestControls input,.stack input,.filterBar input,.filterBar select,
 .adminPlanCard input,.settingsGrid input,.settingsGrid textarea,.inlinePlanForm select,
 .contentMetaGrid input,.contentMetaGrid select,.exerciseEditorCard input,.exerciseEditorCard select,
 .exerciseEditorCard textarea,.qualityEditFormV45 input,.qualityEditFormV45 select,.qualityEditFormV45 textarea,
 .growthTargetFormV61 input,.discoveryFilterBar input,.discoveryFilterBar select,.discoveryTestGrid input,.discoveryTestGrid select
){
  background:#0e1625!important;color:#f8fafc!important;border-color:#39475d!important
}
html[data-theme="light"] :is(
 .requestControls select,.requestControls input,.stack input,.filterBar input,.filterBar select,
 .adminPlanCard input,.settingsGrid input,.settingsGrid textarea,.inlinePlanForm select,
 .contentMetaGrid input,.contentMetaGrid select,.exerciseEditorCard input,.exerciseEditorCard select,
 .exerciseEditorCard textarea,.qualityEditFormV45 input,.qualityEditFormV45 select,.qualityEditFormV45 textarea,
 .growthTargetFormV61 input,.discoveryFilterBar input,.discoveryFilterBar select,.discoveryTestGrid input,.discoveryTestGrid select
){
  background:#fff!important;color:#182033!important;border-color:#d8dee9!important
}
html[data-theme="dark"] :is(.smallSecondary,.buttonLink,.rowAction,.growthBulkActionsV60 button.secondary,.growthTargetFormV61 button,.growthWorkerStatusV61 details button){
  background:#263244!important;color:#dce5f2!important;border-color:#39475d!important
}
html[data-theme="light"] :is(.smallSecondary,.buttonLink,.rowAction,.growthBulkActionsV60 button.secondary,.growthTargetFormV61 button,.growthWorkerStatusV61 details button){
  background:#eef2f7!important;color:#334155!important
}
html[data-theme="dark"] .notice{background:#12223d!important;color:#bfdbfe!important;border-color:#294a76!important}
html[data-theme="dark"] .notice.subtle{background:#141d2c!important;color:#aeb8ca!important;border-color:#29364a!important}
html[data-theme="dark"] .notice.warn{background:#302510!important;color:#ffd18a!important;border-color:#6f5320!important}
html[data-theme="dark"] .notice.bad{background:#32181a!important;color:#ffb4af!important;border-color:#713337!important}
html[data-theme="dark"] .notice.success{background:#102a21!important;color:#a7f3d0!important;border-color:#275f48!important}
html[data-theme="dark"] .metricWarn{background:#2b220f!important;border-color:#69511e!important}
html[data-theme="dark"] .metricBad{background:#2d1719!important;border-color:#6f3135!important}
html[data-theme="light"] .metricWarn{background:linear-gradient(145deg,#fff,#fff9ec)!important}
html[data-theme="light"] .metricBad{background:linear-gradient(145deg,#fff,#fff4f4)!important}
html[data-theme="dark"] .statusPill.neutral,
html[data-theme="dark"] .scorePill.neutral{background:#263244!important;color:#c3cede!important}
html[data-theme="dark"] .countPill{background:#272244!important;color:#c9c2ff!important}
html[data-theme="dark"] code{background:#111827;color:#dbeafe;border-color:#334155}
html[data-theme="dark"] .publishBar{background:rgba(17,24,39,.94)!important;border-color:#39475d!important}
html[data-theme="light"] .publishBar{background:rgba(255,255,255,.94)!important}

/* Algunas extensiones Admin tenían blancos fijos. */
html[data-theme="dark"] :is(
 .bulkAiGuardV52,.growthHoldV56,.growthWorkerStatusV61.warn,.growthBulkPauseReasonV61,
 .webSourcesV49 a,.webManualV49
){
  background:#172033!important;color:#dce5f2!important;border-color:#39475d!important
}

/* ---------------------------------------------------------------------
   TRANSICIÓN SUAVE, sin animar durante la carga inicial
   --------------------------------------------------------------------- */
body,.card,.panel,.metric,.choiceBtn,.authCard,.adminMetrics article,.tableWrap{
  transition:background-color .16s ease,border-color .16s ease,color .16s ease
}
@media(prefers-reduced-motion:reduce){
  body,.card,.panel,.metric,.choiceBtn,.authCard,.adminMetrics article,.tableWrap{transition:none}
}
