/* ==========================================================================
   Activa el Modo · Design System (tema claro por defecto)
   Cargado el último en todos los layouts. Modo oscuro opcional: html.aem-dark
   (preferencia en localStorage 'aem-theme', ver public/js/aem-theme.js).
   Sin rebuild de Vite: sobrescribe tokens --aem-* / --color-* existentes.
   ========================================================================== */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/aem/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/aem/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/aem/montserrat-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/aem/montserrat-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- 1. Tokens ---------- */
:root {
  /* Paleta corporativa */
  --ds-white: #FFFFFF;
  --ds-bg: #F3F7F5;
  --ds-green: #00B96B;          /* relleno grande / gráfico, nunca texto pequeño sobre blanco */
  --ds-green-deep: #163B32;
  --ds-slate: #263746;
  --ds-green-soft: #E8F3ED;
  /* Funcionales (valor de marca) */
  --ds-pos: #16A36A;  --ds-neg: #DC4C4C;  --ds-info: #3186C8;
  --ds-violet: #7957C8; --ds-warn: #D99A32; --ds-muted: #64748B; --ds-border: #E2EAE5;
  /* Variantes AA para texto pequeño (>= 4.5:1 sobre blanco) */
  --ds-green-text: #007A47;     /* 5,42:1 sobre blanco · 4,77:1 sobre verde suave */
  --ds-pos-text: #007A47;
  --ds-neg-text: #B83A3A;       /* 5,67:1 */
  --ds-info-text: #266FA8;
  --ds-warn-text: #8A5A12;      /* 5,91:1 */
  --ds-muted-on-bg: #5B6B80;    /* 5,3:1 sobre blanco · 4,9:1 sobre #F3F7F5 */
  --ds-muted-text: #5B6B80;     /* gris secundario para TEXTO (#64748B solo iconos/bordes) */
  /* Botón primario: blanco sobre #007A47 = 5,42:1; hover #006B3F = 6,61:1 */
  --ds-btn: #007A47; --ds-btn-hover: #006B3F; --ds-btn-ink: #FFFFFF;
  --ds-focus: #3186C8;
  /* Tipografía */
  --ds-font-head: "Montserrat", "Inter", system-ui, sans-serif;
  --ds-font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Forma */
  --ds-radius-sm: 10px; --ds-radius: 14px; --ds-radius-lg: 16px; --ds-radius-pill: 999px;
  --ds-shadow: 0 1px 2px rgba(22,59,50,.05), 0 4px 16px rgba(22,59,50,.06);
  --ds-shadow-lg: 0 2px 4px rgba(22,59,50,.06), 0 12px 32px rgba(22,59,50,.08);
  --ds-space-1: 4px; --ds-space-2: 8px; --ds-space-3: 12px; --ds-space-4: 16px; --ds-space-6: 24px; --ds-space-8: 32px;
}

/* ---------- 2. Tema claro: remapeo de los tokens existentes ---------- */
html:not(.aem-dark) body.theme-dark,
html:not(.aem-dark) body.blog-page,
html:not(.aem-dark) body.theme-light,
html:not(.aem-dark) body.theme-admin {
  --aem-base: var(--ds-bg);
  --aem-surface: var(--ds-white);
  --aem-surface-alt: var(--ds-bg);
  --aem-mint: var(--ds-green-text);
  --aem-mint-soft: var(--ds-green-soft);
  --aem-ink: var(--ds-slate);
  --aem-muted: var(--ds-muted-text);
  --aem-line: var(--ds-border);
  --aem-border: var(--ds-border);
  --color-base: var(--ds-bg);
  --color-surface: var(--ds-white);
  --color-surfaceAlt: var(--ds-bg);
  --color-mint: var(--ds-green-text);
  --color-mintSoft: var(--ds-green-soft);
  --color-ink: var(--ds-slate);
  --color-muted: var(--ds-muted-text);
  --color-line: var(--ds-border);
  --color-border: var(--ds-border);
  background: var(--ds-bg) !important;
  color: var(--ds-slate) !important;
  font-family: var(--ds-font-ui) !important;
  -webkit-font-smoothing: antialiased;
}
html:not(.aem-dark) body.theme-admin { --color-white: #FFFFFF;
  --accent: var(--ds-green-text); --accent-soft: var(--ds-green-soft); --accent-rgb: 0,122,71;
}
html:not(.aem-dark) body.theme-admin.tone-tools { background: var(--ds-bg) !important; }
html:not(.aem-dark) { color-scheme: light; background: var(--ds-bg); }
/* Solo en páginas del antiguo tema oscuro: text-white / bg-white/x pasan a pizarra */
html:not(.aem-dark) body.theme-dark { --color-white: var(--ds-slate); }

/* ---------- 3. Tipografía ---------- */
html:not(.aem-dark) body :is(h1,h2,h3,h4,.font-display) {
  font-family: var(--ds-font-head) !important;
  color: var(--ds-slate);
  letter-spacing: -0.01em;
}
html:not(.aem-dark) body :is(h1,h2) { font-weight: 700; }
html:not(.aem-dark) body :is(h3,h4) { font-weight: 650; }
html:not(.aem-dark) body .font-mono { font-family: var(--ds-font-ui) !important; font-weight: 600; letter-spacing: .06em; }
html:not(.aem-dark) body :is(.text-\[9px\],.text-\[10px\]) { font-size: 11.5px !important; }
html:not(.aem-dark) body :is(.text-\[11px\]) { font-size: 12.5px !important; }
html:not(.aem-dark) body :is(td,th,.tabular-nums,[data-price],[data-change],.num) { font-variant-numeric: tabular-nums; }
html:not(.aem-dark) body p { color: inherit; }
html:not(.aem-dark) body :is(.text-muted, [class*="text-white/4"], [class*="text-white/5"], [class*="text-white/6"]) { color: var(--ds-muted-text) !important; }
html:not(.aem-dark) body :is([class*="text-white/2"], [class*="text-white/3"]) { color: var(--ds-muted-text) !important; }
html:not(.aem-dark) body .text-mint { color: var(--ds-green-text) !important; }

/* ---------- 4. Componentes compartidos ---------- */
/* Cabecera flotante (landing / market / blog): blanca */
html:not(.aem-dark) body nav.glass-panel,
html:not(.aem-dark) body .glass-panel,
html:not(.aem-dark) body nav.blog-nav,
html:not(.aem-dark) body.blog-page > nav {
  background: rgba(255,255,255,.96) !important;
  border: 1px solid var(--ds-border) !important;
  box-shadow: var(--ds-shadow) !important;
  -webkit-backdrop-filter: saturate(1.2) blur(10px); backdrop-filter: saturate(1.2) blur(10px);
  color: var(--ds-slate) !important;
}
html:not(.aem-dark) body nav.glass-panel a:not(.bg-mint):not(.blog-register) { color: var(--ds-slate) !important; font-weight: 600; }
html:not(.aem-dark) body nav.glass-panel a:not(.bg-mint):not(.blog-register):hover,
html:not(.aem-dark) body nav.glass-panel a[aria-current="page"] { color: var(--ds-green-text) !important; }
html:not(.aem-dark) body .aem-mobile-menu summary { background: var(--ds-white) !important; color: var(--ds-slate) !important; border: 1px solid var(--ds-border) !important; }
html:not(.aem-dark) body .aem-mobile-links { background: var(--ds-white) !important; border: 1px solid var(--ds-border) !important; box-shadow: var(--ds-shadow-lg) !important; }
html:not(.aem-dark) body .aem-mobile-links a { color: var(--ds-slate) !important; border-color: var(--ds-border) !important; }
html:not(.aem-dark) body .aem-mobile-links a:hover { background: var(--ds-green-soft) !important; color: var(--ds-green-text) !important; }

/* Botón primario: todo .bg-mint sólido y CTAs verdes hardcodeados */
html:not(.aem-dark) body :is(.bg-mint, .bg-\[\#19D98B\], .hero-cta, .blog-register, .brk-cta, button[type="submit"]:not(.ds-keep)) {
  background: var(--ds-btn) !important;
  color: var(--ds-btn-ink) !important;
  border-color: transparent !important;
  font-weight: 700;
  transition: background-color .15s ease, box-shadow .15s ease;
}
html:not(.aem-dark) body :is(.bg-mint, .bg-\[\#19D98B\], .hero-cta, .blog-register, .brk-cta) * { color: inherit !important; }
html:not(.aem-dark) body :is(.bg-mint, .bg-\[\#19D98B\], .hero-cta, .blog-register, .brk-cta, button[type="submit"]):hover { background: var(--ds-btn-hover) !important; filter: none !important; }
html:not(.aem-dark) body :is(button, .btn, [role="button"]):disabled,
html:not(.aem-dark) body [aria-disabled="true"] { background: #C9D3CE !important; color: #3E4C5A !important; cursor: not-allowed; }
html:not(.aem-dark) body [aria-busy="true"] { cursor: progress; opacity: .8; }
/* Icono dentro del CTA hero */
html:not(.aem-dark) body .hero-cta .bg-\[\#07100C\] { background: var(--ds-white) !important; color: var(--ds-btn) !important; }

/* Botón secundario reutilizable */
.ds-btn-secondary, html:not(.aem-dark) body .btn-secondary {
  background: var(--ds-white); color: var(--ds-slate); border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm); font-weight: 600; padding: 10px 18px;
}
.ds-btn-secondary:hover, html:not(.aem-dark) body .btn-secondary:hover { background: var(--ds-green-soft); }

/* Tarjetas */
html:not(.aem-dark) body :is(.card, .panel-section, .glass-card, .brk-card, .brk-box, .hip-card, .market-card) {
  background: var(--ds-white) !important;
  border: 1px solid var(--ds-border) !important;
  box-shadow: var(--ds-shadow) !important;
  border-radius: var(--ds-radius) !important;
  color: var(--ds-slate) !important;
}
html:not(.aem-dark) body.theme-dark :is(.bg-surface, .bg-base\/80, [class*="bg-white/5"], [class*="bg-white/\[0"], [class*="bg-black/"]) {
  background-color: var(--ds-white) !important;
}
html:not(.aem-dark) body.theme-dark :is([class*="border-white/"]) { border-color: var(--ds-border) !important; }

/* Formularios */
html:not(.aem-dark) body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]), select, textarea) {
  background: var(--ds-white) !important;
  color: var(--ds-slate) !important;
  border: 1px solid #C9D6CF !important;  /* 3:1 aprox. respecto a fondos claros para el control */
  border-radius: var(--ds-radius-sm);
}
html:not(.aem-dark) body :is(input, select, textarea)::placeholder { color: #6B7A8C !important; opacity: 1; }
html:not(.aem-dark) body :is(input, select, textarea):focus { border-color: var(--ds-btn) !important; box-shadow: 0 0 0 3px rgba(0,122,71,.18) !important; outline: none; }
html:not(.aem-dark) body :is(input, select, textarea)[aria-invalid="true"],
html:not(.aem-dark) body :is(input, select, textarea).is-invalid { border-color: var(--ds-neg-text) !important; box-shadow: 0 0 0 3px rgba(220,76,76,.15) !important; }
html:not(.aem-dark) body :is(.text-red-400, .text-red-300, .invalid-feedback, .form-error) { color: var(--ds-neg-text) !important; }

/* Foco visible y teclado */
html:not(.aem-dark) body :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ds-focus) !important; outline-offset: 2px !important; border-radius: 6px;
}
html:not(.aem-dark) body .skip-link:focus { background: var(--ds-btn) !important; color: #fff !important; }

/* Estados financieros */
html:not(.aem-dark) body :is(.text-up, .is-up, .pos, .positive, .text-emerald-400, .text-emerald-300, .text-green-400) { color: var(--ds-pos-text) !important; }
html:not(.aem-dark) body :is(.text-down, .is-down, .neg, .negative, .text-red-500, .text-rose-400) { color: var(--ds-neg-text) !important; }

/* Footer: verde profundo con texto blanco */
html:not(.aem-dark) body footer[role="contentinfo"] {
  --color-white: #FFFFFF;
  background: var(--ds-green-deep) !important;
  color: #E6EFEA !important;
  border-top: 0 !important;
}
html:not(.aem-dark) body footer[role="contentinfo"] :is(a, p, span, small, li, div) { color: #DCE8E1 !important; }
html:not(.aem-dark) body footer[role="contentinfo"] a:hover { color: #FFFFFF !important; text-decoration: underline; }
html:not(.aem-dark) body footer[role="contentinfo"] :is(.text-mint, .hover\:text-mint:hover) { color: #8FE3BC !important; }

/* Toggle de tema (opcional) */
.ds-theme-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px;
  border-radius: var(--ds-radius-pill); border: 1px solid rgba(255,255,255,.35); background: transparent;
  color: inherit; font: 600 12px/1 var(--ds-font-ui); cursor: pointer;
}


/* ---------- 4b. Logo sobre claro ---------- */
html:not(.aem-dark) body:not(.theme-admin) .aem-brand:not(.aem-brand--light) .aem-brand-symbol { content: url("../brand/aem-symbol-dark-v2.png"); }
html:not(.aem-dark) body .aem-brand { color: var(--ds-green-deep) !important; }
html:not(.aem-dark) body footer[role="contentinfo"] .aem-brand { color: #fff !important; }
html:not(.aem-dark) body footer[role="contentinfo"] .aem-brand-symbol { content: url("../brand/aem-symbol-light-v2.png"); }

/* ---------- 4c. Landing: secciones claras alternas ---------- */
html:not(.aem-dark) body.theme-dark main > section { background-color: var(--ds-bg); border-color: var(--ds-border) !important; }
html:not(.aem-dark) body.theme-dark main > section:nth-of-type(odd) { background-color: var(--ds-white); }
html:not(.aem-dark) body.theme-dark :is(#noticias.noticias-video-section, #mercados.mercados-video-section, .blog-video-section) { background: var(--ds-white) !important; }
/* El núcleo 3D se mantiene sobre un orbe verde profundo integrado en el claro */
html:not(.aem-dark) body #coreLabel { color: #CFF5E2 !important; text-shadow: none !important; }
html:not(.aem-dark) body .hero-flow a.glass-panel.hero-cta { background: var(--ds-white) !important; color: var(--ds-slate) !important; border: 1px solid var(--ds-border) !important; }
html:not(.aem-dark) body .hero-flow a.glass-panel.hero-cta:hover { background: var(--ds-green-soft) !important; }
html:not(.aem-dark) body .ticker-band { background: var(--ds-green-deep) !important; --color-white: #fff; color: #fff !important; }
html:not(.aem-dark) body .ticker-band * { --color-white: #fff; }
html:not(.aem-dark) body :is(.news-media-badge, .news-cat-badge) { background: var(--ds-white) !important; color: var(--ds-green-text) !important; border-color: var(--ds-border) !important; box-shadow: var(--ds-shadow) !important; }
html:not(.aem-dark) body .news-media--fallback, html:not(.aem-dark) body .front-thumb { background: linear-gradient(145deg, var(--ds-green-soft), #D3E8DC) !important; }
html:not(.aem-dark) body .aem-player { background: var(--ds-green-deep) !important; }
html:not(.aem-dark) body .float-chip { background: var(--ds-white) !important; color: var(--ds-slate) !important; border: 1px solid var(--ds-border) !important; box-shadow: var(--ds-shadow) !important; }

/* ---------- 4d. Calculadoras y herramientas: paneles claros ---------- */
html:not(.aem-dark) body .fib {
  --fib-bg: #FFFFFF; --fib-panel: var(--ds-bg); --fib-border: var(--ds-border); --fib-ink: var(--ds-slate);
  --fib-muted: var(--ds-muted-text); --fib-mint: var(--ds-green-text); --fib-input-bg: #fff; --fib-input-ink: var(--ds-slate); --fib-danger: var(--ds-neg-text);
  box-shadow: var(--ds-shadow); border-radius: var(--ds-radius-lg) !important;
}
html:not(.aem-dark) body .hip {
  --hip-bg: #FFFFFF; --hip-panel: var(--ds-bg); --hip-border: var(--ds-border); --hip-ink: var(--ds-slate);
  --hip-muted: var(--ds-muted-text); --hip-mint: var(--ds-green-text); --hip-blue: var(--ds-info); --hip-gold: var(--ds-warn);
  --hip-input-bg: #fff; --hip-input-ink: var(--ds-slate); --hip-danger: var(--ds-neg-text);
  box-shadow: var(--ds-shadow); border-radius: var(--ds-radius-lg) !important;
}
html:not(.aem-dark) body .hip .hip-card { background: var(--ds-bg) !important; box-shadow: none !important; }
html:not(.aem-dark) body .hip-toggle { color: var(--ds-slate) !important; background: #fff !important; }
html:not(.aem-dark) body .dy {
  --dy-bg: #FFFFFF; --dy-panel: var(--ds-bg); --dy-border: var(--ds-border); --dy-ink: var(--ds-slate);
  --dy-muted: var(--ds-muted-text); --dy-mint: var(--ds-green-text); --dy-blue: var(--ds-info); --dy-gold: var(--ds-warn);
  --dy-input-bg: #fff; --dy-input-ink: var(--ds-slate); --dy-danger: var(--ds-neg-text);
  box-shadow: var(--ds-shadow); border-radius: var(--ds-radius-lg) !important;
}
html:not(.aem-dark) body .dy .dy-card { background: var(--ds-bg) !important; box-shadow: none !important; }
html:not(.aem-dark) body :is(.dy-toggle, .dy-preload) { color: var(--ds-slate) !important; background: #fff !important; }
html:not(.aem-dark) body .dy-error { color: var(--ds-neg-text) !important; }
html:not(.aem-dark) body .dy-status.is-ok { color: var(--ds-green-text) !important; }
html:not(.aem-dark) body .dy button[type="submit"] { background: var(--ds-btn) !important; color: #fff !important; }
html:not(.aem-dark) body .dy :focus-visible { outline-color: var(--ds-focus) !important; }
html:not(.aem-dark) body .dy .dy-swatch[style*="#00D49A"] { background: var(--ds-green) !important; }
html:not(.aem-dark) body .dy .dy-swatch[style*="#7EB6FF"] { background: var(--ds-info) !important; }
html:not(.aem-dark) body .brk { --b-bg: var(--ds-bg); --b-panel: #FFFFFF; --b-border: var(--ds-border); --b-mint: var(--ds-green-text); --b-ink: var(--ds-slate); --b-muted: var(--ds-muted-text); }
html:not(.aem-dark) body .brk-warn strong { color: var(--ds-warn-text) !important; }
html:not(.aem-dark) body.theme-admin .tools-ci {
  --ci-page: var(--ds-bg); --ci-bg: #FFFFFF; --ci-ink: var(--ds-slate); --ci-muted: var(--ds-muted-text); --ci-border: var(--ds-border);
  --ci-accent: var(--ds-green-text); --ci-accent-ink: #FFFFFF; --ci-input-bg: #FFFFFF; --ci-input-ink: var(--ds-slate);
  --ci-input-placeholder: #6B7A8C; --ci-input-border: #C9D6CF; --ci-focus: var(--ds-btn); --ci-error: var(--ds-neg-text);
  --ci-card: #FFFFFF; --ci-card-alt: var(--ds-bg); --ci-down: var(--ds-neg-text);
}

/* ---------- 5. Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 4e. Panel / admin ---------- */
html:not(.aem-dark) body.theme-admin { background: var(--ds-bg) !important; }
html:not(.aem-dark) body.theme-admin .admin-sidebar { background: #FFFFFF !important; border-color: var(--ds-border) !important; }
html:not(.aem-dark) body.theme-admin .nav-item { color: var(--ds-slate) !important; font-weight: 500; }
html:not(.aem-dark) body.theme-admin .nav-item:hover { background: var(--ds-green-soft) !important; }
html:not(.aem-dark) body.theme-admin .nav-item.is-active { background: var(--ds-green-soft) !important; color: var(--ds-green-text) !important; font-weight: 700; box-shadow: inset 3px 0 0 var(--ds-btn); }
html:not(.aem-dark) body.theme-admin header { background: rgba(255,255,255,.95) !important; border-color: var(--ds-border) !important; }
html:not(.aem-dark) body.theme-admin .bg-black, html:not(.aem-dark) body.theme-admin .bg-ink { background: var(--ds-btn) !important; color: #fff !important; }

/* ---------- 4f. Mercados: cifras con contraste AA y símbolo ▲▼ ---------- */
html:not(.aem-dark) body.theme-admin .tools-ci { --mkt-down: var(--ds-neg-text); --mkt-down-flash: rgba(220,76,76,.18); --mkt-up-flash: rgba(22,163,106,.18); }
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-price,
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-price.is-down,
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-price.is-up,
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-price.flash-down,
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-price.flash-up { color: var(--ds-slate) !important; font-variant-numeric: tabular-nums; }
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-price.is-down { background: #FBEAEA !important; }
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-price.is-up { background: var(--ds-green-soft) !important; }
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-chg.is-up { color: var(--ds-pos-text) !important; }
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-chg.is-down { color: var(--ds-neg-text) !important; }
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-chg.is-up::before { content: "▲ "; }
html:not(.aem-dark) body.theme-admin .tools-ci .mkt-chg.is-down::before { content: "▼ "; }

/* ---------- 4g. Estilos inline heredados del tema oscuro ---------- */
html:not(.aem-dark) body.theme-dark :is(label, p, span, h1, h2, h3, a)[style*="color:#fff"]:not(.bg-mint) { color: var(--ds-slate) !important; }
html:not(.aem-dark) body.theme-dark [style*="background:#19D98B"] { background: var(--ds-btn) !important; color: #fff !important; font-family: var(--ds-font-ui) !important; }
html:not(.aem-dark) body.theme-dark [style*="background:#19D98B"]:hover { background: var(--ds-btn-hover) !important; }

/* ---------- 4h. Hero: una sola superficie verde profundo, tarjeta contenida ----------
   El núcleo 3D usa partículas menta/blancas brillantes: se leen mejor sobre #163B32 uniforme.
   Texto blanco sobre #163B32 = 12,3:1. */
html:not(.aem-dark) body .hero-flow { background: var(--ds-bg) !important; --color-white: #FFFFFF; color: #fff; }
html:not(.aem-dark) body .hero-video-bg--static {
  background: var(--ds-green-deep) !important;
  inset: 96px clamp(8px, 2vw, 24px) 16px !important;
  border-radius: 24px;
  box-shadow: var(--ds-shadow-lg);
}
html:not(.aem-dark) body .hero-core { background: none !important; }
html:not(.aem-dark) body .hero-flow :is(h1, .hero-title) { color: #FFFFFF !important; text-shadow: none !important; }
html:not(.aem-dark) body .hero-flow .hero-lead { color: #D7E7DE !important; }   /* 10,4:1 */
html:not(.aem-dark) body .hero-flow .hero-copy { padding-left: clamp(8px, 2vw, 24px); }
html:not(.aem-dark) body .hero-flow :is([class*="text-white/"], .text-muted) { color: #D7E7DE !important; }
html:not(.aem-dark) body .hero-flow .hero-badge > * { background: rgba(255,255,255,.08) !important; border-color: rgba(255,255,255,.28) !important; color: #E6F2EB !important; }
html:not(.aem-dark) body .hero-flow .text-mint { color: #7BE0B3 !important; }       /* 9,0:1 sobre #163B32 */
/* CTA principal dentro del hero: verde corporativo con texto verde profundo (4,78:1, negrita) */
html:not(.aem-dark) body .hero-flow a.hero-cta.bg-mint { background: var(--ds-green) !important; color: var(--ds-green-deep) !important; }
html:not(.aem-dark) body .hero-flow a.hero-cta.bg-mint:hover { background: #2FD08A !important; }
html:not(.aem-dark) body .hero-flow a.hero-cta.bg-mint .bg-\[\#07100C\] { background: var(--ds-green-deep) !important; color: #7BE0B3 !important; }
html:not(.aem-dark) body .hero-flow a.glass-panel.hero-cta { background: transparent !important; color: #FFFFFF !important; border: 1px solid rgba(255,255,255,.45) !important; box-shadow: none !important; }
html:not(.aem-dark) body .hero-flow a.glass-panel.hero-cta:hover { background: rgba(255,255,255,.1) !important; }
html:not(.aem-dark) body .hero-flow .float-chip { background: rgba(255,255,255,.96) !important; }

/* ---------- 4i. Campos de formulario legibles (anula -webkit-text-fill-color heredado) ---------- */
html:not(.aem-dark) body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="hidden"]), select, textarea),
html:not(.aem-dark) body :is(.fx-theme-dark, .fx-theme-light, .tools-ci, .fib, .hip, .brk) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]), select, textarea, .fx-input) {
  background-color: #FFFFFF !important;
  color: var(--ds-slate) !important;
  -webkit-text-fill-color: var(--ds-slate) !important;
  caret-color: var(--ds-slate);
  border: 1px solid var(--ds-border) !important;
  color-scheme: light !important;
  opacity: 1 !important;
}
html:not(.aem-dark) body :is(input, textarea)::placeholder,
html:not(.aem-dark) body .fx-input::placeholder { color: var(--ds-muted-text) !important; -webkit-text-fill-color: var(--ds-muted-text) !important; opacity: 1 !important; }
html:not(.aem-dark) body select option { background: #FFFFFF !important; color: var(--ds-slate) !important; }
html:not(.aem-dark) body :is(input, select, textarea, .fx-input):focus { border-color: var(--ds-btn) !important; box-shadow: 0 0 0 3px rgba(0,185,107,.28) !important; }
html:not(.aem-dark) body :is(input, select, textarea)[readonly],
html:not(.aem-dark) body :is(.fx-result, output) { background-color: var(--ds-green-soft) !important; color: var(--ds-green-deep) !important; -webkit-text-fill-color: var(--ds-green-deep) !important; font-weight: 700; }
html:not(.aem-dark) body input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset !important; -webkit-text-fill-color: var(--ds-slate) !important; }
/* Conversor: contenedor oscuro heredado pasa a tarjeta clara */
html:not(.aem-dark) body .fx-theme-dark { background: #FFFFFF !important; color: var(--ds-slate) !important; border-color: var(--ds-border) !important; --color-white: var(--ds-slate); }
html:not(.aem-dark) body [data-fx-result] { color: var(--ds-slate) !important; -webkit-text-fill-color: var(--ds-slate) !important; font-weight: 700; font-variant-numeric: tabular-nums; }
html:not(.aem-dark) body :is([data-fx-rate],[data-fx-date]) { color: var(--ds-muted-text) !important; -webkit-text-fill-color: var(--ds-muted-text) !important; }

/* ---------- 4j. Landing: secciones con vídeo de fondo en claro ---------- */
html:not(.aem-dark) body :is(#noticias .noticias-video-bg, #mercados .mercados-video-bg, #blog .blog-video-bg) { background-color: var(--ds-white) !important; background-image: none !important; }
html:not(.aem-dark) body :is(#noticias .noticias-video-bg, #mercados .mercados-video-bg, #blog .blog-video-bg) video { filter: saturate(.6) !important; opacity: .18; }
html:not(.aem-dark) body :is(#noticias .noticias-video-veil, #mercados .mercados-video-veil, #blog .blog-video-veil) {
  background: linear-gradient(180deg, rgba(255,255,255,.94) 0%, rgba(255,255,255,.86) 45%, rgba(255,255,255,.96) 100%) !important;
}
html:not(.aem-dark) body .mkt-sample-up { color: var(--ds-pos-text) !important; }
html:not(.aem-dark) body .mkt-sample-down { color: var(--ds-neg-text) !important; }
html:not(.aem-dark) body .news-media { background-color: var(--ds-green-soft) !important; }

/* ---------- 4k. Interés compuesto ---------- */
html:not(.aem-dark) body .compound { --ci-border: var(--ds-border); background: #FFFFFF !important; color: var(--ds-slate) !important; border-color: var(--ds-border) !important; box-shadow: var(--ds-shadow); border-radius: var(--ds-radius-lg) !important; }
html:not(.aem-dark) body .compound a { color: var(--ds-green-text) !important; }
html:not(.aem-dark) body .compound button:not(.ds-keep) { background: var(--ds-btn) !important; color: #fff !important; }
html:not(.aem-dark) body .compound-totals div { background: var(--ds-bg) !important; }
html:not(.aem-dark) body .compound-note { color: var(--ds-muted-text) !important; }
html:not(.aem-dark) body .compound-error { color: var(--ds-neg-text) !important; }
html:not(.aem-dark) body .compound :focus-visible { outline-color: var(--ds-focus) !important; }

/* ---------- 5. Gráficos SVG propios (CSS anula atributos de presentación) ---------- */
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [fill="#00D49A"] { fill: var(--ds-green); }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [stroke="#00D49A"] { stroke: var(--ds-green-text); }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [fill="#7EB6FF"] { fill: var(--ds-info); }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [stroke="#7EB6FF"] { stroke: var(--ds-info); }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [fill="#F5C15A"] { fill: var(--ds-warn); }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [stroke="#F5C15A"] { stroke: var(--ds-warn); }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [fill="#394941"] { fill: #C9D6CF; }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [stroke="#394941"] { stroke: var(--ds-border); }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [stroke="#151D1A"] { stroke: #FFFFFF; }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg [fill="#c5d0cb"],
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg text { fill: var(--ds-muted-text); }
html:not(.aem-dark) body .compound svg [stroke^="#ffffff"], html:not(.aem-dark) body .compound svg [stroke^="#fff"] { stroke: var(--ds-border); }
html:not(.aem-dark) body .hip .hip-swatch[style*="#394941"] { background: #C9D6CF !important; }
html:not(.aem-dark) body .hip .hip-swatch[style*="#00D49A"] { background: var(--ds-green) !important; }
html:not(.aem-dark) body .hip .hip-swatch[style*="#7EB6FF"] { background: var(--ds-info) !important; }
html:not(.aem-dark) body .hip .hip-swatch[style*="#F5C15A"] { background: var(--ds-warn) !important; }
html:not(.aem-dark) body .fib :is(.fib-pt-a) { color: #266FA8 !important; }
html:not(.aem-dark) body .fib :is(.fib-pt-b) { color: var(--ds-green-text) !important; }
html:not(.aem-dark) body .fib :is(.fib-pt-c) { color: var(--ds-warn-text) !important; }

/* ---------- 5b. Tablas de datos ---------- */
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy, .tools-ci, .legal-prose, .blog-body) table th { color: var(--ds-slate) !important; background: var(--ds-bg); font-weight: 700; }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy, .tools-ci) table :is(td, th) { border-color: var(--ds-border) !important; font-variant-numeric: tabular-nums; }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy, .tools-ci) table tbody tr:nth-child(even) td { background: #FAFCFB; }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy, .tools-ci) table tbody tr:hover td { background: var(--ds-green-soft); }
html:not(.aem-dark) body :is(.hip-table-wrap, .compound-scroll, .fib-table-wrap, .dy-table-wrap, .overflow-x-auto) { scrollbar-color: #C9D6CF transparent; }

/* ---------- 4l. Blog (editorial claro) · anula la piel oscura de blog.css ---------- */
html:not(.aem-dark):has(body.blog-page) { background: var(--ds-white) !important; }
html:not(.aem-dark) body.blog-page { background: var(--ds-white) !important; color: var(--ds-slate) !important; }
html:not(.aem-dark) body.blog-page :is(h1, h2, h3, h4, .blog-title, .font-display) { color: var(--ds-slate) !important; }
html:not(.aem-dark) body.blog-page :is(.blog-muted, .blog-excerpt, .blog-rail-card__meta, time) { color: var(--ds-muted-text) !important; }
html:not(.aem-dark) body.blog-page :is(.blog-kicker, .text-mint) { color: var(--ds-green-text) !important; }
html:not(.aem-dark) body.blog-page .blog-body :is(p, li, b, strong) { color: var(--ds-slate) !important; }
html:not(.aem-dark) body.blog-page .blog-body :is(h2, h3, h4) { color: var(--ds-slate) !important; }
html:not(.aem-dark) body.blog-page .blog-body a { color: var(--ds-green-text) !important; }
html:not(.aem-dark) body.blog-page .blog-body blockquote { background: var(--ds-green-soft) !important; border-left: 4px solid var(--ds-btn) !important; color: var(--ds-green-deep) !important; }
html:not(.aem-dark) body.blog-page .blog-body :is(code, pre) { background: var(--ds-bg) !important; color: var(--ds-slate) !important; }
html:not(.aem-dark) body.blog-page .blog-body figure figcaption { color: var(--ds-muted-text) !important; }
html:not(.aem-dark) body.blog-page :is(.blog-card, .blog-rail-card, .blog-feature, .blog-toc) { background: var(--ds-white) !important; border: 1px solid var(--ds-border) !important; box-shadow: var(--ds-shadow) !important; color: var(--ds-slate) !important; }
html:not(.aem-dark) body.blog-page :is(.blog-card, .blog-rail-card, .blog-feature) :is(h2, h3, p, .blog-rail-card__title) { color: var(--ds-slate) !important; }
html:not(.aem-dark) body.blog-page :is(.blog-card, .blog-rail-card, .blog-feature):hover { border-color: var(--ds-btn) !important; }
html:not(.aem-dark) body.blog-page :is(.blog-rail-card__fallback, .blog-feature__fallback, .blog-hero__media--empty) { background: var(--ds-green-soft) !important; }
html:not(.aem-dark) body.blog-page .blog-toc__link { color: var(--ds-slate) !important; }
html:not(.aem-dark) body.blog-page .blog-toc__link.is-active { color: var(--ds-green-text) !important; font-weight: 700; }
html:not(.aem-dark) body.blog-page :is(.blog-related-band, .blog-index-stage) { background: transparent !important; }
html:not(.aem-dark) body.blog-page .blog-index-stage__bg video { filter: saturate(.7) brightness(.95) contrast(1.05); opacity: .55; }
html:not(.aem-dark) body.blog-page .blog-index-stage__veil { background:
  linear-gradient(180deg, rgba(255,255,255,.78) 0%, rgba(251,247,242,.70) 45%, rgba(255,255,255,.90) 100%),
  radial-gradient(ellipse 70% 55% at 70% 35%, rgba(185,138,90,.12), transparent 70%) !important; }
html:not(.aem-dark) body.blog-page .blog-index-stage__content .blog-card { background: rgba(255,255,255,.92) !important; backdrop-filter: blur(8px); }
/* Hero con imagen: se mantiene el velo oscuro sobre la foto y el texto blanco (contraste) */
html:not(.aem-dark) body.blog-page .blog-hero :is(.blog-title--hero, .blog-excerpt--hero, .blog-back, .blog-back__label) { color: #FFFFFF !important; }
html:not(.aem-dark) body.blog-page .blog-hero .blog-kicker { color: #8FE3BC !important; }
html:not(.aem-dark) body.blog-page .blog-register { background: var(--ds-btn) !important; color: #fff !important; }
html:not(.aem-dark) body.blog-page .aem-mobile-menu summary { color: var(--ds-slate) !important; }
/* Contenedor del índice (la plantilla actual usa .blog-wrap) */
body.blog-page .blog-wrap { width: 100%; max-width: 720px; margin-inline: auto; padding-inline: 1.25rem; }
body.blog-page .blog-wrap--index { max-width: 1120px; }
@media (min-width: 640px) { body.blog-page .blog-wrap { padding-inline: 1.5rem; } }

/* ---------- 6. Responsive y legibilidad ---------- */
html:not(.aem-dark) { overflow-x: clip; }
html:not(.aem-dark) body :is(.news-source-badge, .news-cat-badge, .news-media-badge) { font-size: 11.5px !important; }
html:not(.aem-dark) body :is(.hip, .fib, .compound, .dy) svg text { font-size: 11.5px; }
html:not(.aem-dark) body .aem-min-text { font-size: 11.5px !important; }

/* ---------- 6b. Contraste: ajustes de la auditoría automática ---------- */
html:not(.aem-dark) body.blog-page .blog-register, html:not(.aem-dark) body.blog-page .blog-register * { color: #FFFFFF !important; }
html:not(.aem-dark) body .legal-prose a, html:not(.aem-dark) body.theme-light main a:not([class*="bg-"]) { color: var(--ds-green-text) !important; }
html:not(.aem-dark) body .mode-pills button { color: var(--ds-slate) !important; border-color: var(--ds-border) !important; background: #fff !important; }
html:not(.aem-dark) body .mode-pills button:is(.is-active, :hover) { color: var(--ds-green-text) !important; border-color: var(--ds-btn) !important; background: var(--ds-green-soft) !important; }
/* Banner de cookies claro */
html:not(.aem-dark) body #aem-cookie-banner { background: #FFFFFF !important; color: var(--ds-slate) !important; border: 1px solid var(--ds-border) !important; box-shadow: var(--ds-shadow-lg) !important; }
html:not(.aem-dark) body #aem-cookie-banner :is(h2, p, label, strong) { color: var(--ds-slate) !important; }
html:not(.aem-dark) body #aem-cookie-banner small { color: var(--ds-muted-text) !important; }
html:not(.aem-dark) body #aem-cookie-banner a { color: var(--ds-green-text) !important; }
html:not(.aem-dark) body #aem-cookie-banner input { accent-color: var(--ds-btn); }
html:not(.aem-dark) body #aem-cookie-banner .aem-cookie-actions button { background: #FFFFFF !important; color: var(--ds-slate) !important; border: 1px solid var(--ds-border) !important; }
html:not(.aem-dark) body #aem-cookie-banner .aem-cookie-actions :is(#aem-cookie-accept, #aem-cookie-reject) { background: var(--ds-btn) !important; color: #fff !important; border-color: var(--ds-btn) !important; }
html:not(.aem-dark) body #aem-cookie-banner .aem-cookie-actions button:hover { background: var(--ds-green-soft) !important; }
html:not(.aem-dark) body #aem-cookie-banner .aem-cookie-actions :is(#aem-cookie-accept, #aem-cookie-reject):hover { background: var(--ds-btn-hover) !important; }
