/* Auditoría de superficies oscuras: aplicar solo a herramientas y contenidos identificados */
:root{
  --aa-audit-paper:#f8efe4;
  --aa-audit-panel:#fffaf4;
  --aa-audit-soft:#f2e5d8;
  --aa-audit-ink:#302019;
  --aa-audit-muted:#765f53;
  --aa-audit-line:#dfcbbb;
  --aa-audit-rust:#b74325;
}
/* Aplicaciones con utilidades Tailwind oscuras */
body.bg-stone-950, body.bg-stone-900, body[class*="bg-stone-950"], body[class*="bg-stone-900"]{
  background:var(--aa-audit-paper)!important;color:var(--aa-audit-ink)!important;
}
.bg-stone-950,.bg-stone-900,.bg-stone-800,
.bg-neutral-950,.bg-neutral-900,.bg-gray-950,.bg-gray-900,.bg-zinc-950,.bg-zinc-900{
  background-color:var(--aa-audit-panel)!important;color:var(--aa-audit-ink)!important;
}
[class*="bg-stone-9"],[class*="bg-neutral-9"],[class*="bg-gray-9"],[class*="bg-zinc-9"]{
  background-color:var(--aa-audit-panel)!important;color:var(--aa-audit-ink)!important;
}
.text-stone-100,.text-stone-200,.text-stone-300,.text-neutral-100,.text-neutral-200,
.text-gray-100,.text-gray-200,.text-zinc-100,.text-zinc-200{
  color:var(--aa-audit-ink)!important;
}
.text-stone-400,.text-stone-500,.text-neutral-400,.text-neutral-500,
.text-gray-400,.text-gray-500,.text-zinc-400,.text-zinc-500{color:var(--aa-audit-muted)!important}
.border-stone-700,.border-stone-800,.border-neutral-700,.border-neutral-800,
.border-gray-700,.border-gray-800,.border-zinc-700,.border-zinc-800{border-color:var(--aa-audit-line)!important}

/* Taller interactivo M: controles claros; el lienzo se aclara también desde su color de dibujo */
:root{
  --bg-dark:var(--aa-audit-paper);
  --panel-bg:var(--aa-audit-panel);
  --panel-border:var(--aa-audit-line);
  --text-main:var(--aa-audit-ink);
  --text-muted:var(--aa-audit-muted);
  --btn-bg:var(--aa-audit-soft);
  --btn-hover:#ead8c7;
  --accent:#b74325;
  --accent-light:#96371f;
  --accent-glow:rgba(183,67,37,.12);
}
#sidebar{background:var(--aa-audit-panel)!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important;box-shadow:4px 0 20px rgba(69,43,27,.08)!important}
#sidebar h1,#sidebar h2,#sidebar h3,.section-title{color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important}
#sidebar .author-tag,#sidebar label,#sidebar .toggle-row span{color:var(--aa-audit-muted)!important}
.btn,.nudge-btn{background:#fbf3ea!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important}
.btn:hover,.nudge-btn:hover{background:#f0dfcf!important;border-color:#c98b70!important}
.btn-upload,.btn-move-all{background:var(--aa-audit-rust)!important;color:#fffaf4!important;border-color:var(--aa-audit-rust)!important}
.btn-export,.btn-export-grid{background:#ead8c7!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important}
.stepper-card,.step-text,.toggle-row,.ext-box{background:#f5e9dc!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important}
.step-text,.step-text b,.toggle-row span{color:var(--aa-audit-ink)!important}
.step-badge{background:#f1dfd0!important;color:var(--aa-audit-rust)!important;border-color:var(--aa-audit-line)!important}
#stage{background:#eee4d9!important}
#canvas-wrapper{background:#f2e8dc!important;box-shadow:0 10px 30px rgba(69,43,27,.12)!important}
#hud{background:rgba(255,250,244,.94)!important;color:#6b4b39!important;border-color:var(--aa-audit-line)!important}
#step-toast{background:rgba(255,250,244,.97)!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-rust)!important;box-shadow:0 6px 18px rgba(69,43,27,.12)!important}
#sidebar input[type=range],#sidebar select{background:#fffaf4!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important}

/* Visor facetado: entorno y controles claros; no se recolorean los materiales del modelo */
body:has(#stage canvas){background:var(--aa-audit-paper)!important;color:var(--aa-audit-ink)!important}
body:has(#stage canvas) .viewer,body:has(#stage canvas) .viewer-shell,body:has(#stage canvas) .stage-wrap{
  background:var(--aa-audit-panel)!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important
}
body:has(#stage canvas) #stage{background:radial-gradient(ellipse at 50% 42%,#f5eee6,#e8ddd1 78%)!important}
body:has(#stage canvas) .toolbar,body:has(#stage canvas) .learning article,
body:has(#stage canvas) .panel,body:has(#stage canvas) .controls{
  background:var(--aa-audit-panel)!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important
}
body:has(#stage canvas) .status,body:has(#stage canvas) .hint{
  background:rgba(255,250,244,.94)!important;color:var(--aa-audit-muted)!important;border-color:var(--aa-audit-line)!important
}
body:has(#stage canvas) button{background:#fbf3ea!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important}

/* Medidor antropométrico: superficies externas del lienzo */
.canvas-wrapper{background:#eee4d9!important;border-color:var(--aa-audit-line)!important;box-shadow:0 12px 32px rgba(69,43,27,.10)!important}
.canvas-wrapper canvas{background:#f2e8dc!important}

/* Retículas, ruedas y tablas: se aclaran paneles, no los trazos ni las muestras */
body:has(canvas) .controls,body:has(canvas) .panel,body:has(canvas) .tool-panel,
body:has(canvas) .control-panel,body:has(canvas) .settings-panel{
  background:var(--aa-audit-panel)!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important
}
body:has(canvas) .workspace,body:has(canvas) .stage,body:has(canvas) .canvas-stage{
  background:#eee4d9!important;border-color:var(--aa-audit-line)!important
}

/* Lecciones de teoría del color: tarjetas de fórmulas y paneles explicativos */
.formula-box{background:#f2e5d8!important;color:#49372e!important;border:1px solid var(--aa-audit-line)!important}
.formula-box code,.formula-box strong,.formula-box span{color:var(--aa-audit-ink)!important}
body > main div[style*="background:#0c0a09"],body > main div[style*="background: #0c0a09"]{
  background:#f2e5d8!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important
}
body > main div[style*="background:#0c0a09"] p,
body > main div[style*="background: #0c0a09"] p{color:var(--aa-audit-muted)!important}
svg rect[fill="#1c1917"]{fill:#ead8c7!important;stroke:#cdb7a5!important}
svg text[fill="#fef08a"]{fill:#49372e!important}

/* Artículo del Método M: bloques de fórmula e imágenes de demostración */
.formula-box{background:#f2e5d8!important;color:#49372e!important;border-color:var(--aa-audit-line)!important}
.image-container{background:#eee4d9!important;border-color:var(--aa-audit-line)!important}

/* Galerías: neutralizar solo el fondo detrás de las obras; mantener modal de ampliación */
.img-container{background:#eee4d9!important}
.tools,.notice{background:#fffaf4!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important}

/* Reglas de cierre para herramientas cuyo fondo oscuro estaba definido directamente en su CSS */
body{
  background:var(--aa-audit-paper)!important;
  color:var(--aa-audit-ink)!important;
  color-scheme:light!important;
}
main{color:var(--aa-audit-ink)}
body:has(.top) .top,
body:has(.top) .pill,
body:has(.top) .lead{color:var(--aa-audit-muted)!important}
body:has(.top) nav a,body:has(.top) .button{
  background:#f2e5d8!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important
}
body:has(.top) a{color:var(--aa-audit-rust)!important}
body:has(.top) .card,body:has(.top) .panel,body:has(.top) .step-card,
body:has(.top) .example,body:has(.top) .callout{
  background:var(--aa-audit-panel)!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important
}
body:has(.top) .muted{color:var(--aa-audit-muted)!important}
body:has(.top) .eyebrow{color:var(--aa-audit-rust)!important}
body:has(.top) h1,body:has(.top) h2,body:has(.top) h3{color:var(--aa-audit-ink)!important}

/* Diagramas de teoría: cajas de explicación claras, sin alterar el espectro cromático */
body div[style*="background:#0c0a09"],body div[style*="background: #0c0a09"]{
  background:#f2e5d8!important;color:var(--aa-audit-ink)!important;border-color:var(--aa-audit-line)!important
}
body div[style*="background:#0c0a09"] span,
body div[style*="background: #0c0a09"] span{color:var(--aa-audit-rust)!important}

/* Barras de desplazamiento de las paletas */
::-webkit-scrollbar-track{background:#f1e7dc!important}
::-webkit-scrollbar-thumb{background:#cdb7a5!important;border-color:#f1e7dc!important}

/* Método M: panel de movimiento que estaba definido con fondo inline oscuro */
#sidebar div[style*="background:#101014"],
#sidebar div[style*="background: #101014"],
body.aa-app-embedded #sidebar div[style*="background:#101014"],
body.aa-app-embedded #sidebar div[style*="background: #101014"]{
  background:#f5e9dc!important;
  border:1px solid #dfcbbb!important;
  color:#302019!important;
}
#sidebar div[style*="background:#101014"] p,
#sidebar div[style*="background: #101014"] p{
  color:#765f53!important;
}
#sidebar div[style*="border-top:1px dashed #282834"],
#sidebar div[style*="border-top: 1px dashed #282834"]{
  border-top:1px dashed #dfcbbb!important;
}
#sidebar [style*="color:#d1d5db"],
#sidebar [style*="color: #d1d5db"]{color:#765f53!important}
#sidebar [style*="color:#6b7280"],
#sidebar [style*="color: #6b7280"]{color:#8a7467!important}
