/* v1.9.9-pre1 — sistema de tema claro/oscuro/sistema.
   Preferencia local: localStorage('leadgestor_theme_pref'). Sin dependencia de DB. */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --theme-bg: #08101d;
  --theme-bg-soft: #0b1220;
  --theme-surface: #101b2f;
  --theme-surface-2: #14233d;
  --theme-surface-3: #0c1728;
  --theme-text: #eef4ff;
  --theme-text-strong: #ffffff;
  --theme-muted: #9fb0c8;
  --theme-line: rgba(255,255,255,.10);
  --theme-line-strong: rgba(255,255,255,.16);
  --theme-input: #0c1728;
  --theme-shadow: 0 20px 60px rgba(0,0,0,.25);
  --theme-primary: #FFC107;
  --theme-primary-contrast: #1a1200;
  --theme-blue: #123456;
  --theme-wine: #560216;
  --bg: var(--theme-bg);
  --panel: var(--theme-surface);
  --panel2: var(--theme-surface-2);
  --text: var(--theme-text);
  --muted: var(--theme-muted);
  --line: var(--theme-line);
}

[data-theme="light"] {
  color-scheme: light;
  --theme-bg: #f5f7fb;
  --theme-bg-soft: #eef3f8;
  --theme-surface: #ffffff;
  --theme-surface-2: #f8fafc;
  --theme-surface-3: #f1f5f9;
  --theme-text: #102033;
  --theme-text-strong: #0f172a;
  --theme-muted: #64748b;
  --theme-line: rgba(15,23,42,.12);
  --theme-line-strong: rgba(15,23,42,.18);
  --theme-input: #ffffff;
  --theme-shadow: 0 18px 50px rgba(15,23,42,.10);
  --theme-primary: #FFC107;
  --theme-primary-contrast: #102033;
  --theme-blue: #123456;
  --theme-wine: #560216;
  --bg: var(--theme-bg);
  --panel: var(--theme-surface);
  --panel2: var(--theme-surface-2);
  --text: var(--theme-text);
  --muted: var(--theme-muted);
  --line: var(--theme-line);
  --danger: #dc2626;
}

body {
  background: var(--theme-bg-soft);
  color: var(--theme-text);
}

/* Control de tema */
.theme-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.theme-control__label {
  color: var(--theme-muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.theme-control__select {
  width: auto;
  min-width: 112px;
  min-height: 38px;
  padding: 7px 32px 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--theme-line-strong);
  background: var(--theme-input);
  color: var(--theme-text);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}
.theme-control--public .theme-control__label,
.theme-control--auth .theme-control__label {
  display: none;
}
.theme-control--public .theme-control__select {
  min-width: 102px;
  min-height: 42px;
  border-color: rgba(18,52,86,.16);
  background: rgba(255,255,255,.72);
  color: #123456;
}
[data-theme="dark"] .theme-control--public .theme-control__select {
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: #eef4ff;
}
.auth-theme-wrap {
  display: flex;
  justify-content: center;
  margin: 18px auto 0;
}

/* Panel app: tema claro seguro sobre la UI existente. */
[data-theme="light"] .app-body {
  background: linear-gradient(180deg,#f6f8fb 0%,#eef3f8 100%);
  color: var(--theme-text);
}
[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right-color: var(--theme-line);
  box-shadow: 16px 0 45px rgba(15,23,42,.05);
}
[data-theme="light"] .sidebar .brand,
[data-theme="light"] .sidebar .brand-wordmark,
[data-theme="light"] .topbar h1,
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3 {
  color: var(--theme-text-strong);
}
[data-theme="light"] .tenant,
[data-theme="light"] .nav-group-title {
  background: rgba(18,52,86,.055);
  color: var(--theme-text-strong);
  border-color: var(--theme-line);
}
[data-theme="light"] .tenant small,
[data-theme="light"] .sidebar a,
[data-theme="light"] .note,
[data-theme="light"] .muted-text,
[data-theme="light"] td small,
[data-theme="light"] .table-title + small {
  color: var(--theme-muted);
}
[data-theme="light"] .sidebar a:hover,
[data-theme="light"] .sidebar a.is-active {
  background: rgba(255,193,7,.18);
  color: #123456;
}
[data-theme="light"] .main {
  background: transparent;
}
[data-theme="light"] .topbar {
  background: rgba(255,255,255,.76);
  border: 1px solid var(--theme-line);
  border-radius: 22px;
  padding: 14px 16px;
  box-shadow: 0 12px 35px rgba(15,23,42,.06);
}
[data-theme="light"] .topbar-email {
  color: var(--theme-muted);
}
[data-theme="light"] .card,
[data-theme="light"] .glass-card,
[data-theme="light"] .subcard,
[data-theme="light"] .line-item,
[data-theme="light"] .metric-card,
[data-theme="light"] .campaign-card,
[data-theme="light"] .agent-availability-card,
[data-theme="light"] .dashboard-hero-card,
[data-theme="light"] .dashboard-filter-card,
[data-theme="light"] .support-context-card,
[data-theme="light"] .fallback-shell,
[data-theme="light"] .campaign-hero,
[data-theme="light"] .catalog-intro,
[data-theme="light"] .onboarding-command-card,
[data-theme="light"] .table-responsive,
[data-theme="light"] .table-scroll {
  background: var(--theme-surface) !important;
  border-color: var(--theme-line) !important;
  color: var(--theme-text) !important;
  box-shadow: var(--theme-shadow);
}
[data-theme="light"] .card span,
[data-theme="light"] .metric-list span,
[data-theme="light"] .metric-card span,
[data-theme="light"] .metric-card small {
  color: var(--theme-muted);
}
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: var(--theme-input);
  color: var(--theme-text);
  border-color: var(--theme-line);
}
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder,
[data-theme="light"] .form-clean input::placeholder,
[data-theme="light"] .form-clean textarea::placeholder {
  color: #8a98aa;
}
[data-theme="light"] .field label,
[data-theme="light"] th,
[data-theme="light"] label {
  color: #334155;
}
[data-theme="light"] table,
[data-theme="light"] .table-responsive table,
[data-theme="light"] .table-scroll table {
  color: var(--theme-text);
  background: transparent;
}
[data-theme="light"] th,
[data-theme="light"] td {
  border-bottom-color: var(--theme-line);
}
[data-theme="light"] code,
[data-theme="light"] .debug {
  background: #f1f5f9;
  color: #0f172a;
  border-color: var(--theme-line);
}
[data-theme="light"] .mini-btn {
  background: rgba(18,52,86,.055);
  border-color: rgba(18,52,86,.14);
  color: #123456;
}
[data-theme="light"] .btn.ghost,
[data-theme="light"] .mini-btn.muted {
  background: transparent;
  color: var(--theme-muted);
}
[data-theme="light"] .pill,
[data-theme="light"] .metric-list > div,
[data-theme="light"] .schedule-builder,
[data-theme="light"] .tabs a {
  background: rgba(18,52,86,.045);
  border-color: var(--theme-line);
  color: var(--theme-muted);
}
[data-theme="light"] .pill.ok,
[data-theme="light"] .mini-btn.ok {
  background: rgba(22,163,74,.10);
  border-color: rgba(22,163,74,.26);
  color: #15803d;
}
[data-theme="light"] .pill.warn,
[data-theme="light"] .mini-btn.warn {
  background: rgba(245,158,11,.13);
  border-color: rgba(245,158,11,.28);
  color: #92400e;
}
[data-theme="light"] .pill.danger,
[data-theme="light"] .mini-btn.danger {
  background: rgba(220,38,38,.10);
  border-color: rgba(220,38,38,.28);
  color: #b91c1c;
}
[data-theme="light"] .flash,
[data-theme="light"] .alert {
  color: var(--theme-text);
}
[data-theme="light"] .impersonation-banner {
  background: #fff7df;
  color: #5f4300;
  border-color: rgba(245,158,11,.32);
}
[data-theme="light"] .mobile-menu-toggle span {
  background: #123456;
}

/* Auth */
[data-theme="light"] .auth-body {
  background: radial-gradient(circle at top left, rgba(255,193,7,.20), transparent 32%), linear-gradient(180deg,#f6f8fb,#edf3f8);
}
[data-theme="light"] .login-card {
  background: #ffffff;
  color: var(--theme-text);
  border-color: var(--theme-line);
  box-shadow: var(--theme-shadow);
}
[data-theme="light"] .auth-back-link,
[data-theme="light"] .auth-secondary-link,
[data-theme="light"] .auth-legal-footer a {
  color: #123456;
}

/* Landing / público: modo oscuro elegante, modo claro permanece prácticamente como diseño original. */
[data-theme="dark"] {
  --ink: #eef4ff;
  --muted: #b7c6d8;
  --line: rgba(255,255,255,.13);
  --paper: #101b2f;
  --soft: #07101d;
  --shadow: 0 24px 80px rgba(0,0,0,.34);
  --shadow-soft: 0 14px 45px rgba(0,0,0,.24);
}
[data-theme="dark"] body.public-body {
  background: radial-gradient(circle at 20% 20%,rgba(255,193,7,.12),transparent 24%), radial-gradient(circle at 80% 10%,rgba(86,2,22,.42),transparent 22%), #07101d;
  color: #eef4ff;
}
[data-theme="dark"] .site-nav {
  background: rgba(7,16,29,.84) !important;
  border-bottom-color: rgba(255,255,255,.10) !important;
}
[data-theme="dark"] .site-nav .brand,
[data-theme="dark"] .site-nav .brand:visited,
[data-theme="dark"] .site-nav .brand > span:not(.brand-mark),
[data-theme="dark"] .site-nav .nav-links a {
  color: #eaf3ff !important;
}
[data-theme="dark"] .site-nav .menu-toggle span {
  background: #eaf3ff !important;
}
[data-theme="dark"] .hero-section,
[data-theme="dark"] .section,
[data-theme="dark"] .pricing-section,
[data-theme="dark"] .faq-section,
[data-theme="dark"] .community-section,
[data-theme="dark"] .legal-page {
  background: linear-gradient(180deg,#07101d 0%,#0b1627 62%,#08101d 100%);
}
[data-theme="dark"] .hero-copy h1,
[data-theme="dark"] .section-heading h2,
[data-theme="dark"] .pricing-copy h2,
[data-theme="dark"] .agents-copy h2,
[data-theme="dark"] .weight-copy h2,
[data-theme="dark"] .heatmap-copy-public h2,
[data-theme="dark"] .no-api-copy h2,
[data-theme="dark"] .community-copy h2,
[data-theme="dark"] .faq-heading h2 {
  color: #f8fbff;
}
[data-theme="dark"] .hero-copy p,
[data-theme="dark"] .section-heading p,
[data-theme="dark"] .pricing-copy p,
[data-theme="dark"] .agents-copy p,
[data-theme="dark"] .weight-copy p,
[data-theme="dark"] .heatmap-copy-public p,
[data-theme="dark"] .no-api-copy p,
[data-theme="dark"] .community-copy p,
[data-theme="dark"] .faq-heading p {
  color: #b7c6d8;
}
[data-theme="dark"] .hero-metrics div,
[data-theme="dark"] .premium-card,
[data-theme="dark"] .benefit-card,
[data-theme="dark"] .pricing-card,
[data-theme="dark"] .checkout-preview,
[data-theme="dark"] .heatmap-card-public,
[data-theme="dark"] .weight-card,
[data-theme="dark"] .phone-mock,
[data-theme="dark"] .faq-item,
[data-theme="dark"] details,
[data-theme="dark"] .community-card,
[data-theme="dark"] .payment-mini-card,
[data-theme="dark"] .cta-final-card {
  background: rgba(16,27,47,.92) !important;
  border-color: rgba(255,255,255,.13) !important;
  color: #eef4ff !important;
  box-shadow: var(--shadow-soft);
}
[data-theme="dark"] .premium-card h3,
[data-theme="dark"] .pricing-card h3,
[data-theme="dark"] .hero-metrics strong,
[data-theme="dark"] .weight-card b,
[data-theme="dark"] .faq-item summary {
  color: #ffffff;
}
[data-theme="dark"] .premium-card p,
[data-theme="dark"] .pricing-card p,
[data-theme="dark"] .pricing-card li,
[data-theme="dark"] .hero-metrics span,
[data-theme="dark"] .weight-card span,
[data-theme="dark"] .faq-item p {
  color: #b7c6d8;
}
[data-theme="dark"] .btn--secondary,
[data-theme="dark"] .btn--ghost {
  background: rgba(255,255,255,.08);
  color: #eef4ff;
  border-color: rgba(255,255,255,.16);
}
[data-theme="dark"] .micro-badge,
[data-theme="dark"] .section-kicker {
  color: #ffd65a;
}
[data-theme="dark"] .nav-links.is-open {
  background: rgba(7,16,29,.96) !important;
  border-color: rgba(255,255,255,.12) !important;
}

@media (max-width: 980px) {
  .theme-control--public {
    width: 100%;
  }
  .theme-control--public .theme-control__select {
    width: 100%;
  }
}
@media (max-width: 760px) {
  .topbar-actions {
    gap: 8px;
    flex-wrap: wrap;
  }
  .theme-control--topbar {
    width: 100%;
    justify-content: space-between;
  }
  .theme-control--topbar .theme-control__select {
    width: min(180px, 58vw);
  }
}

/* v1.9.9-pre2 — pulido visual de panel en modo claro.
   Objetivo: corregir contraste de KPIs/cards/botones sin tocar lógica ni modo oscuro. */
[data-theme="light"] .kpi-card,
[data-theme="light"] .metric-card,
[data-theme="light"] .insight-card,
[data-theme="light"] .agent-kpi,
[data-theme="light"] .agent-hero-status,
[data-theme="light"] .agent-campaign-stats,
[data-theme="light"] .campaign-stats,
[data-theme="light"] .product-command-kpis > div,
[data-theme="light"] .leader-strip > div,
[data-theme="light"] .empty-state,
[data-theme="light"] .empty-state.compact {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border-color: var(--theme-line) !important;
  color: var(--theme-text) !important;
  box-shadow: 0 16px 42px rgba(15,23,42,.075) !important;
}

[data-theme="light"] .kpi-card::after,
[data-theme="light"] .metric-card::after {
  background: radial-gradient(circle, rgba(18,52,86,.06), transparent 66%) !important;
}

[data-theme="light"] .kpi-card.primary,
[data-theme="light"] .metric-card.primary,
[data-theme="light"] .card.is-warning,
[data-theme="light"] .support-cta-card {
  background: linear-gradient(135deg, #fffdf4 0%, #ffffff 78%) !important;
  border-color: rgba(245,158,11,.34) !important;
}

[data-theme="light"] .kpi-card.ok,
[data-theme="light"] .metric-card.ok,
[data-theme="light"] .card.is-success-box,
[data-theme="light"] .card.is-success,
[data-theme="light"] .is-success-box {
  background: linear-gradient(135deg, #f2fff7 0%, #ffffff 78%) !important;
  border-color: rgba(22,163,74,.28) !important;
}

[data-theme="light"] .kpi-card.warn,
[data-theme="light"] .metric-card.warn {
  background: linear-gradient(135deg, #fff8e8 0%, #ffffff 78%) !important;
  border-color: rgba(245,158,11,.34) !important;
}

[data-theme="light"] .kpi-card.danger,
[data-theme="light"] .metric-card.danger,
[data-theme="light"] .card.is-danger,
[data-theme="light"] .card.is-error {
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 78%) !important;
  border-color: rgba(220,38,38,.28) !important;
}

/* Texto fuerte hardcodeado en blanco dentro de cards del panel. */
[data-theme="light"] .kpi-card strong,
[data-theme="light"] .metric-card strong,
[data-theme="light"] .insight-card strong,
[data-theme="light"] .product-command-kpis strong,
[data-theme="light"] .leader-strip strong,
[data-theme="light"] .catalog-summary .metric-card strong,
[data-theme="light"] .agent-kpi strong,
[data-theme="light"] .agent-hero-status strong,
[data-theme="light"] .agent-campaign-stats strong,
[data-theme="light"] .campaign-stats strong,
[data-theme="light"] .empty-state strong,
[data-theme="light"] .empty-state.compact strong,
[data-theme="light"] .support-context-card strong,
[data-theme="light"] .card > strong,
[data-theme="light"] .card .line-item strong,
[data-theme="light"] .line-item strong,
[data-theme="light"] .meta-row strong,
[data-theme="light"] .meta-subrow strong,
[data-theme="light"] .timeline-item strong,
[data-theme="light"] .action-item strong,
[data-theme="light"] .alert-item strong,
[data-theme="light"] .domain-card-head strong,
[data-theme="light"] .payment-selected-box__head strong,
[data-theme="light"] .payment-selected-detail__title strong,
[data-theme="light"] .summary-price-row strong,
[data-theme="light"] .summary-limits-box b,
[data-theme="light"] .password-policy-box strong {
  color: var(--theme-text-strong) !important;
}

[data-theme="light"] .kpi-card span,
[data-theme="light"] .kpi-card small,
[data-theme="light"] .metric-card span,
[data-theme="light"] .metric-card small,
[data-theme="light"] .insight-card span,
[data-theme="light"] .insight-card small,
[data-theme="light"] .product-command-kpis span,
[data-theme="light"] .leader-strip span,
[data-theme="light"] .agent-kpi span,
[data-theme="light"] .agent-kpi small,
[data-theme="light"] .agent-hero-status small,
[data-theme="light"] .agent-campaign-stats span,
[data-theme="light"] .campaign-stats span,
[data-theme="light"] .empty-state p,
[data-theme="light"] .empty-state.compact p,
[data-theme="light"] .support-context-card p,
[data-theme="light"] .summary-price-row small,
[data-theme="light"] .summary-limits-box li,
[data-theme="light"] .payment-methods-box p {
  color: var(--theme-muted) !important;
}

/* Botones/acciones secundarias que quedaban demasiado pálidas en claro. */
[data-theme="light"] .support-action,
[data-theme="light"] .support-context-card .mini-btn {
  background: #eef6ff !important;
  border-color: rgba(37,99,235,.22) !important;
  color: #1d4ed8 !important;
}
[data-theme="light"] .support-action:hover,
[data-theme="light"] .support-context-card .mini-btn:hover {
  background: #dbeafe !important;
  border-color: rgba(37,99,235,.34) !important;
  color: #1e40af !important;
}
[data-theme="light"] .btn[disabled],
[data-theme="light"] .btn.is-disabled,
[data-theme="light"] .mini-btn[disabled],
[data-theme="light"] .mini-btn.is-disabled {
  background: #eef2f7 !important;
  border-color: #d8e0ea !important;
  color: #64748b !important;
  opacity: .72 !important;
}

/* Hamburguesa mobile del panel: usa tokens claros en modo claro. */
[data-theme="light"] .mobile-menu-toggle,
[data-theme="light"] .sidebar-toggle,
[data-theme="light"] .menu-toggle.app-menu-toggle {
  background: #ffffff !important;
  border-color: rgba(15,23,42,.14) !important;
  color: #123456 !important;
  box-shadow: 0 14px 32px rgba(15,23,42,.12) !important;
}
[data-theme="light"] .mobile-menu-toggle span,
[data-theme="light"] .sidebar-toggle span,
[data-theme="light"] .menu-toggle.app-menu-toggle span {
  background: #123456 !important;
}

/* Formularios internos y tarjetas de registro/pago en modo claro. */
[data-theme="light"] .registro-form-panel,
[data-theme="light"] .registro-summary-panel,
[data-theme="light"] .registro-action-panel,
[data-theme="light"] .registro-change-plan,
[data-theme="light"] .summary-limits-box,
[data-theme="light"] .summary-price-row > div,
[data-theme="light"] .payment-methods-box,
[data-theme="light"] .payment-selected-box,
[data-theme="light"] .payment-selected-detail,
[data-theme="light"] .password-policy-box {
  background: #ffffff !important;
  border-color: var(--theme-line) !important;
  color: var(--theme-text) !important;
  box-shadow: 0 14px 34px rgba(15,23,42,.065) !important;
}
[data-theme="light"] .registro-change-plan summary,
[data-theme="light"] .payment-methods-box summary,
[data-theme="light"] .summary-limits-box > strong,
[data-theme="light"] .registro-form-panel h2,
[data-theme="light"] .registro-summary-panel h2 {
  color: var(--theme-text-strong) !important;
}
[data-theme="light"] .payment-methods-list span {
  background: #f8fafc !important;
  border-color: var(--theme-line) !important;
  color: var(--theme-text) !important;
}
[data-theme="light"] .summary-eyebrow,
[data-theme="light"] .payment-methods-box summary b {
  color: #9a6700 !important;
}

/* Mejor lectura para tablas, filtros y paneles densos. */
[data-theme="light"] .filters,
[data-theme="light"] .compact-filter-bar,
[data-theme="light"] .filter-card,
[data-theme="light"] .form-panel,
[data-theme="light"] .hero-action-panel,
[data-theme="light"] .actions-cell {
  background: #ffffff !important;
  border-color: var(--theme-line) !important;
  color: var(--theme-text) !important;
}
[data-theme="light"] .table-responsive,
[data-theme="light"] .table-scroll {
  background: #ffffff !important;
}
[data-theme="light"] tr:hover td {
  background: rgba(18,52,86,.035);
}

/* Mantiene contraste en chips y metadata técnica sin forzar blanco. */
[data-theme="light"] .email-variable-hints code,
[data-theme="light"] .dns-copy-box code,
[data-theme="light"] .dns-copy-box strong,
[data-theme="light"] code {
  background: #f1f5f9 !important;
  border-color: var(--theme-line) !important;
  color: #123456 !important;
}

/* v1.9.9-pre3 — premium light polish.
   Objetivo: hacer el modo claro más intencional, mover el selector al área de Cuenta
   y corregir restos visuales del panel/onboarding sin tocar lógica. */
[data-theme="light"] {
  --theme-bg: #edf2f7;
  --theme-bg-soft: #f3f6fa;
  --theme-surface: #ffffff;
  --theme-surface-2: #f8fafc;
  --theme-surface-3: #eef3f8;
  --theme-text: #172033;
  --theme-text-strong: #07182d;
  --theme-muted: #526174;
  --theme-muted-2: #738197;
  --theme-line: rgba(15,23,42,.115);
  --theme-line-strong: rgba(15,23,42,.18);
  --theme-input: #ffffff;
  --theme-shadow: 0 22px 55px rgba(15,23,42,.095);
  --theme-shadow-soft: 0 12px 32px rgba(15,23,42,.065);
  --theme-primary: #FFC107;
  --theme-primary-deep: #D99A00;
  --theme-primary-soft: #FFF4CC;
  --theme-blue: #123456;
  --theme-green: #16a34a;
  --theme-red: #dc2626;
  --bg: var(--theme-bg);
  --panel: var(--theme-surface);
  --panel2: var(--theme-surface-2);
  --text: var(--theme-text);
  --muted: var(--theme-muted);
  --line: var(--theme-line);
}

[data-theme="light"] .app-body {
  background:
    radial-gradient(circle at 12% 0%, rgba(18,52,86,.075), transparent 32%),
    radial-gradient(circle at 90% 8%, rgba(255,193,7,.13), transparent 28%),
    linear-gradient(180deg, #f7f9fc 0%, #edf2f7 100%);
  color: var(--theme-text);
}

[data-theme="light"] .main {
  background: transparent;
}

/* Selector de tema: ya no ocupa la topbar; vive dentro de Cuenta. */
.topbar .theme-control--topbar { display: none !important; }
.sidebar-theme-slot {
  margin: 12px 0 4px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--theme-line);
  background: rgba(255,255,255,.045);
}
.sidebar-theme-title {
  display: block;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--theme-muted);
}
.theme-control--sidebar {
  width: 100%;
  display: grid;
  gap: 6px;
}
.theme-control--sidebar .theme-control__label { display: none; }
.theme-control--sidebar .theme-control__select {
  width: 100%;
  min-width: 0;
  border-radius: 14px;
  font-weight: 850;
}
[data-theme="light"] .sidebar-theme-slot {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(15,23,42,.105);
  box-shadow: 0 10px 24px rgba(15,23,42,.045);
}

/* Shell premium claro */
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%);
  border-right: 1px solid rgba(15,23,42,.10);
  box-shadow: 18px 0 48px rgba(15,23,42,.06);
}
[data-theme="light"] .brand small,
[data-theme="light"] .app-version {
  color: #526174 !important;
}
[data-theme="light"] .tenant {
  background: linear-gradient(180deg,#f7f9fc 0%,#eef3f8 100%) !important;
  border: 1px solid rgba(15,23,42,.08) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
[data-theme="light"] .tenant strong,
[data-theme="light"] .tenant b {
  color: var(--theme-text-strong) !important;
}
[data-theme="light"] .nav-group-title {
  background: #f1f5f9 !important;
  border: 1px solid rgba(15,23,42,.055) !important;
  color: #334155 !important;
}
[data-theme="light"] .nav-group-links a {
  color: #526174 !important;
  border: 1px solid transparent;
}
[data-theme="light"] .nav-group-links a:hover {
  background: #f8fafc !important;
  border-color: rgba(18,52,86,.10);
  color: #123456 !important;
}
[data-theme="light"] .nav-group-links a.is-active {
  background: linear-gradient(180deg, #fff8dc 0%, #fff2bd 100%) !important;
  border-color: rgba(255,193,7,.48) !important;
  color: #123456 !important;
  box-shadow: 0 10px 24px rgba(255,193,7,.14);
}

/* Drawer/hamburger móvil del panel en claro. */
[data-theme="light"] .mobile-menu-toggle,
[data-theme="light"] .sidebar-close,
[data-theme="light"] [data-sidebar-close-button] {
  background: #ffffff !important;
  border: 1px solid rgba(15,23,42,.12) !important;
  color: #123456 !important;
  box-shadow: 0 16px 36px rgba(15,23,42,.12) !important;
}
[data-theme="light"] .mobile-menu-toggle span,
[data-theme="light"] .sidebar-close span,
[data-theme="light"] [data-sidebar-close-button] span {
  background: #123456 !important;
}
[data-theme="light"] .sidebar-backdrop {
  background: rgba(15,23,42,.42) !important;
}

[data-theme="light"] .topbar {
  background: rgba(255,255,255,.88) !important;
  backdrop-filter: blur(14px);
  border: 1px solid rgba(15,23,42,.10) !important;
  box-shadow: 0 16px 40px rgba(15,23,42,.07) !important;
}
[data-theme="light"] .topbar h1 { color: var(--theme-text-strong) !important; }
[data-theme="light"] .topbar-email { color: #526174 !important; }

/* Cards premium: más intención, menos blanco plano. */
[data-theme="light"] .card,
[data-theme="light"] .glass-card,
[data-theme="light"] .subcard,
[data-theme="light"] .dashboard-hero-card,
[data-theme="light"] .dashboard-filter-card,
[data-theme="light"] .chart-card,
[data-theme="light"] .onboarding-command-card,
[data-theme="light"] .support-context-card,
[data-theme="light"] .line-item,
[data-theme="light"] .table-responsive,
[data-theme="light"] .table-scroll {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  border-color: rgba(15,23,42,.10) !important;
  color: var(--theme-text) !important;
  box-shadow:
    0 18px 45px rgba(15,23,42,.075),
    inset 0 1px 0 rgba(255,255,255,.88) !important;
}
[data-theme="light"] .kpi-card,
[data-theme="light"] .metric-card,
[data-theme="light"] .insight-card,
[data-theme="light"] .product-command-kpis > div,
[data-theme="light"] .leader-strip > div,
[data-theme="light"] .agent-kpi,
[data-theme="light"] .campaign-stats,
[data-theme="light"] .agent-campaign-stats {
  background:
    radial-gradient(circle at top right, rgba(255,193,7,.13), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border-color: rgba(15,23,42,.105) !important;
  color: var(--theme-text) !important;
  box-shadow: 0 16px 42px rgba(15,23,42,.075) !important;
}
[data-theme="light"] .kpi-card.ok,
[data-theme="light"] .metric-card.ok,
[data-theme="light"] .card.is-success,
[data-theme="light"] .card.is-success-box,
[data-theme="light"] .setup-step.is-done,
[data-theme="light"] .onboarding-step.is-complete {
  background:
    radial-gradient(circle at top right, rgba(22,163,74,.13), transparent 40%),
    linear-gradient(180deg, #ffffff 0%, #f2fff7 100%) !important;
  border-color: rgba(22,163,74,.28) !important;
}
[data-theme="light"] .kpi-card.warn,
[data-theme="light"] .metric-card.warn,
[data-theme="light"] .card.is-warning,
[data-theme="light"] .support-cta-card {
  background:
    radial-gradient(circle at top right, rgba(255,193,7,.18), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #fff8e7 100%) !important;
  border-color: rgba(245,158,11,.34) !important;
}
[data-theme="light"] .kpi-card.danger,
[data-theme="light"] .metric-card.danger,
[data-theme="light"] .card.is-danger,
[data-theme="light"] .card.is-error {
  background:
    radial-gradient(circle at top right, rgba(220,38,38,.11), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #fff5f5 100%) !important;
  border-color: rgba(220,38,38,.28) !important;
}

/* Texto y jerarquía. */
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] .card h1,
[data-theme="light"] .card h2,
[data-theme="light"] .card h3,
[data-theme="light"] .card strong,
[data-theme="light"] .kpi-card strong,
[data-theme="light"] .metric-card strong,
[data-theme="light"] .stat-value,
[data-theme="light"] .metric-number,
[data-theme="light"] .kpi-value,
[data-theme="light"] .summary-number,
[data-theme="light"] .hero-progress strong,
[data-theme="light"] .progress-value {
  color: var(--theme-text-strong) !important;
}
[data-theme="light"] p,
[data-theme="light"] .note,
[data-theme="light"] .muted,
[data-theme="light"] .muted-text,
[data-theme="light"] .card small,
[data-theme="light"] .card span,
[data-theme="light"] td small,
[data-theme="light"] .chart-head p,
[data-theme="light"] .empty-state p {
  color: var(--theme-muted) !important;
}

/* Botones: más vivos en claro. */
[data-theme="light"] .btn,
[data-theme="light"] button.btn,
[data-theme="light"] .button,
[data-theme="light"] .primary-btn,
[data-theme="light"] button[type="submit"]:not(.nav-group-title):not(.mobile-menu-toggle) {
  box-shadow: 0 10px 24px rgba(15,23,42,.07);
}
[data-theme="light"] .btn.primary,
[data-theme="light"] .btn-primary,
[data-theme="light"] .primary-btn,
[data-theme="light"] .button-primary,
[data-theme="light"] button[type="submit"]:not(.nav-group-title):not(.mobile-menu-toggle) {
  background: linear-gradient(180deg, #FFD84D 0%, #FFC107 100%) !important;
  color: #102033 !important;
  border-color: rgba(217,154,0,.46) !important;
  box-shadow: 0 13px 26px rgba(255,193,7,.27) !important;
}
[data-theme="light"] .mini-btn,
[data-theme="light"] .btn.ghost,
[data-theme="light"] .btn--secondary,
[data-theme="light"] .secondary-btn,
[data-theme="light"] .btn-secondary {
  background: #ffffff !important;
  color: #123456 !important;
  border-color: rgba(18,52,86,.16) !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.055) !important;
}
[data-theme="light"] .support-action,
[data-theme="light"] a[href*="/r/soporte"].mini-btn {
  background: #eff6ff !important;
  border-color: rgba(37,99,235,.20) !important;
  color: #1e3a8a !important;
}
[data-theme="light"] a[href*="/r/ventas"],
[data-theme="light"] .sales-action {
  background: #ecfdf3 !important;
  border-color: rgba(22,163,74,.26) !important;
  color: #166534 !important;
}
[data-theme="light"] .mini-btn:disabled,
[data-theme="light"] .btn:disabled,
[data-theme="light"] .is-disabled,
[data-theme="light"] [aria-disabled="true"] {
  opacity: .62 !important;
  color: #64748b !important;
  background: #eef2f7 !important;
  border-color: #d8e0ea !important;
  box-shadow: none !important;
}

/* Onboarding/progreso: remover residuos oscuros. */
[data-theme="light"] .setup-step,
[data-theme="light"] .onboarding-step,
[data-theme="light"] .quick-action-card,
[data-theme="light"] .limit-card,
[data-theme="light"] .progress-card,
[data-theme="light"] .onboarding-progress,
[data-theme="light"] .hero-progress,
[data-theme="light"] .command-card,
[data-theme="light"] .action-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border-color: rgba(15,23,42,.10) !important;
  color: var(--theme-text) !important;
}
[data-theme="light"] .progress-ring,
[data-theme="light"] .progress-circle {
  background: conic-gradient(#FFC107 var(--progress, 0%), #e8edf4 0) !important;
  color: #123456 !important;
}
[data-theme="light"] .progress-ring::before,
[data-theme="light"] .progress-circle::before {
  background: #ffffff !important;
}

/* Formularios/tablas más premium. */
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(15,23,42,.13) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  border-color: rgba(255,193,7,.70) !important;
  box-shadow: 0 0 0 3px rgba(255,193,7,.18) !important;
  outline: none !important;
}
[data-theme="light"] table thead th {
  background: #f8fafc !important;
  color: #334155 !important;
}
[data-theme="light"] table tbody tr:hover {
  background: #fbfdff !important;
}

/* Chart/heatmap containers y leyendas. El JS actualiza ECharts; esto corrige contenedores/empty states. */
[data-theme="light"] .echart-box,
[data-theme="light"] .chart-empty {
  color: var(--theme-muted) !important;
}
[data-theme="light"] .chart-badge {
  background: #fff7d6 !important;
  border-color: rgba(255,193,7,.35) !important;
  color: #725000 !important;
}
[data-theme="light"] .heatmap-explain-grid > div,
[data-theme="light"] .breach-chip,
[data-theme="light"] .gap-chip {
  background: #ffffff !important;
  border-color: rgba(15,23,42,.10) !important;
  color: var(--theme-muted) !important;
}
[data-theme="light"] .breach-chip strong,
[data-theme="light"] .gap-chip strong {
  color: var(--theme-text-strong) !important;
}

@media (max-width: 760px) {
  [data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%) !important;
    box-shadow: -22px 0 56px rgba(15,23,42,.16) !important;
  }
  [data-theme="light"] .sidebar .brand {
    border-bottom-color: rgba(15,23,42,.08) !important;
  }
  [data-theme="light"] .nav-group-links a {
    text-align: right;
  }
  .sidebar-theme-slot {
    margin-left: 0;
    margin-right: 0;
  }
}

/* v1.9.9-pre4 — micro polish final del modo claro.
   Objetivo: subir percepción premium sin tocar lógica ni estructura. */
[data-theme="light"] {
  --theme-success-soft: #dcfce7;
  --theme-success-soft-2: #ecfdf3;
  --theme-success: #15803d;
  --theme-success-strong: #166534;
  --theme-success-line: rgba(22,163,74,.28);
  --theme-sales: #166534;
  --theme-sales-soft: #ecfdf3;
}

/* Checks/completado: más evidente, menos lavado. */
[data-theme="light"] .onboarding-step.done .step-icon,
[data-theme="light"] .onboarding-command-step.done span,
[data-theme="light"] .setup-step.done .step-icon,
[data-theme="light"] .setup-step.is-done .step-icon,
[data-theme="light"] .setup-check,
[data-theme="light"] .check-icon,
[data-theme="light"] .checkmark,
[data-theme="light"] .status-check,
[data-theme="light"] .success-check,
[data-theme="light"] .completed-check,
[data-theme="light"] .is-complete .step-icon,
[data-theme="light"] .is-complete .check-icon,
[data-theme="light"] .done .check-icon {
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%) !important;
  color: #15803d !important;
  border: 1px solid rgba(22,163,74,.28) !important;
  box-shadow: 0 8px 18px rgba(22,163,74,.12) !important;
}
[data-theme="light"] .onboarding-step.done .step-icon,
[data-theme="light"] .setup-step.done .step-icon,
[data-theme="light"] .setup-check,
[data-theme="light"] .check-icon,
[data-theme="light"] .checkmark {
  font-weight: 950 !important;
}
[data-theme="light"] .onboarding-step.done,
[data-theme="light"] .onboarding-command-step.done,
[data-theme="light"] .setup-step.done,
[data-theme="light"] .setup-step.is-done {
  border-color: rgba(22,163,74,.30) !important;
  background: linear-gradient(180deg, #ffffff 0%, #f2fff7 100%) !important;
}
[data-theme="light"] .onboarding-step.done strong,
[data-theme="light"] .onboarding-command-step.done strong,
[data-theme="light"] .setup-step.done strong {
  color: #0f172a !important;
}

/* CTA comercial en cards de planes: link premium sin pastilla verde invasiva. */
.plan-sales-link,
[data-theme="light"] .plan-sales-link,
[data-theme="dark"] .plan-sales-link,
[data-theme="light"] a.plan-sales-link[href*="/r/ventas"],
[data-theme="dark"] a.plan-sales-link[href*="/r/ventas"] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto !important;
  max-width: 100%;
  margin-top: 8px;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #166534 !important;
  font-weight: 900 !important;
  text-decoration: underline !important;
  text-decoration-thickness: 1.5px !important;
  text-underline-offset: 3px !important;
}
.plan-sales-link:hover,
[data-theme="light"] .plan-sales-link:hover,
[data-theme="dark"] .plan-sales-link:hover {
  color: #14532d !important;
  background: transparent !important;
  transform: none !important;
}
[data-theme="dark"] .plan-sales-link,
[data-theme="dark"] a.plan-sales-link[href*="/r/ventas"] {
  color: #86efac !important;
}
[data-theme="dark"] .plan-sales-link:hover {
  color: #bbf7d0 !important;
}

/* Botones pequeños: más definidos en claro, especialmente navegación/paginación. */
[data-theme="light"] .mini-btn,
[data-theme="light"] .pager a,
[data-theme="light"] .pagination a,
[data-theme="light"] .pagination button,
[data-theme="light"] .page-link,
[data-theme="light"] a[rel="prev"],
[data-theme="light"] a[rel="next"] {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  color: #123456 !important;
  border: 1px solid rgba(18,52,86,.16) !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.06) !important;
}
[data-theme="light"] .mini-btn:hover,
[data-theme="light"] .pager a:hover,
[data-theme="light"] .pagination a:hover,
[data-theme="light"] .pagination button:hover,
[data-theme="light"] .page-link:hover {
  background: #fff8dc !important;
  border-color: rgba(255,193,7,.42) !important;
  color: #102033 !important;
}
[data-theme="light"] .mini-btn.ok,
[data-theme="light"] .btn.ok,
[data-theme="light"] .pill.ok,
[data-theme="light"] .status-ok,
[data-theme="light"] .badge.ok,
[data-theme="light"] .badge.success,
[data-theme="light"] .status-success {
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%) !important;
  border-color: rgba(22,163,74,.30) !important;
  color: #15803d !important;
  box-shadow: 0 8px 18px rgba(22,163,74,.10) !important;
}
[data-theme="light"] .mini-btn.warn,
[data-theme="light"] .btn.warn,
[data-theme="light"] .pill.warn,
[data-theme="light"] .status-warn,
[data-theme="light"] .badge.warn,
[data-theme="light"] .badge.warning {
  background: linear-gradient(180deg, #fff7df 0%, #ffedb0 100%) !important;
  border-color: rgba(245,158,11,.34) !important;
  color: #92400e !important;
}
[data-theme="light"] .mini-btn.danger,
[data-theme="light"] .btn.danger,
[data-theme="light"] .pill.danger,
[data-theme="light"] .status-danger,
[data-theme="light"] .badge.danger,
[data-theme="light"] .badge.error {
  background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%) !important;
  border-color: rgba(220,38,38,.30) !important;
  color: #b91c1c !important;
}

/* Drawer mobile claro: mejor separación y sensación premium. */
@media (max-width: 760px) {
  [data-theme="light"] .sidebar {
    background:
      radial-gradient(circle at top left, rgba(255,193,7,.09), transparent 28%),
      linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  }
  [data-theme="light"] .nav-group-title {
    background: #f1f5f9 !important;
    border-color: rgba(15,23,42,.06) !important;
    color: #334155 !important;
  }
  [data-theme="light"] .nav-group-links a.is-active,
  [data-theme="light"] .sidebar a.is-active {
    background: linear-gradient(180deg, #fff8dc 0%, #fff1b8 100%) !important;
    border-color: rgba(255,193,7,.50) !important;
    color: #123456 !important;
    box-shadow: 0 10px 22px rgba(255,193,7,.13) !important;
  }
  [data-theme="light"] .sidebar-close,
  [data-theme="light"] [data-sidebar-close-button] {
    background: #ffffff !important;
    border-color: rgba(15,23,42,.14) !important;
    color: #123456 !important;
  }
}

/* Formularios largos y selectores: detalle fino de foco y lectura. */
[data-theme="light"] .field small,
[data-theme="light"] .help-text,
[data-theme="light"] .form-hint,
[data-theme="light"] .input-hint {
  color: #64748b !important;
}
[data-theme="light"] input[type="checkbox"],
[data-theme="light"] input[type="radio"] {
  accent-color: #FFC107;
}
[data-theme="light"] .legal-acceptance-box input[type="checkbox"] {
  accent-color: #FFC107;
}

/* Admin/correos/tablas: micro contraste sin rediseño. */
[data-theme="light"] .email-preview-frame,
[data-theme="light"] .template-preview,
[data-theme="light"] .preview-card,
[data-theme="light"] .metadata-box,
[data-theme="light"] .json-box {
  background: #ffffff !important;
  border-color: rgba(15,23,42,.11) !important;
  color: #172033 !important;
  box-shadow: 0 12px 30px rgba(15,23,42,.055) !important;
}
[data-theme="light"] .table-responsive thead th,
[data-theme="light"] .table-scroll thead th {
  background: #f1f5f9 !important;
  color: #334155 !important;
}
[data-theme="light"] .table-responsive tbody tr:hover,
[data-theme="light"] .table-scroll tbody tr:hover {
  background: #fbfdff !important;
}

/* Heatmap/leyendas: más lectura alrededor del gráfico; ECharts conserva paleta de pre3. */
[data-theme="light"] .heatmap-card,
[data-theme="light"] .pro-heatmap-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
}
[data-theme="light"] .heatmap-explain-grid > div {
  background: #ffffff !important;
  color: #526174 !important;
  border-color: rgba(15,23,42,.12) !important;
}
[data-theme="light"] .heatmap-explain-grid strong,
[data-theme="light"] .heatmap-card h2,
[data-theme="light"] .pro-heatmap-card h2 {
  color: #07182d !important;
}

/* Mantener oscuro sin alteraciones agresivas; solo mejora success si comparte clase. */
[data-theme="dark"] .onboarding-step.done .step-icon,
[data-theme="dark"] .onboarding-command-step.done span,
[data-theme="dark"] .setup-check,
[data-theme="dark"] .check-icon {
  color: #86efac;
}

/* v1.9.9-pre8 — final visual/copy polish para panel claro. */
[data-theme="light"] .dns-copy-box > div {
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%) !important;
  border-color: rgba(18, 52, 86, .13) !important;
  color: #172033 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82);
}
[data-theme="light"] .dns-copy-box span {
  color: #5f6f85 !important;
  font-weight: 750;
}
[data-theme="light"] .dns-copy-box code,
[data-theme="light"] .dns-copy-box strong {
  background: #ffffff !important;
  border: 1px solid rgba(18, 52, 86, .12) !important;
  border-radius: 10px !important;
  color: #123456 !important;
  padding: 3px 7px !important;
  box-shadow: 0 4px 10px rgba(15,23,42,.045);
}
[data-theme="light"] .domain-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border-color: rgba(18, 52, 86, .12) !important;
  box-shadow: 0 16px 38px rgba(15,23,42,.07) !important;
}
[data-theme="light"] .domain-progress span {
  background: #f8fafc !important;
  border-color: rgba(18, 52, 86, .12) !important;
  color: #526174 !important;
}
[data-theme="light"] .domain-progress span.is-active,
[data-theme="light"] .domain-progress span.ok,
[data-theme="light"] .domain-progress span.activo {
  background: #ecfdf3 !important;
  border-color: rgba(22,163,74,.28) !important;
  color: #166534 !important;
}

[data-theme="light"] .permission-chip {
  background: #f8fafc !important;
  border: 1px solid rgba(18, 52, 86, .14) !important;
  color: #26384f !important;
  box-shadow: 0 6px 14px rgba(15,23,42,.04) !important;
}
[data-theme="light"] .permission-detail summary {
  color: #123456 !important;
  background: #f8fafc !important;
  border: 1px solid rgba(18, 52, 86, .12) !important;
  border-radius: 999px;
  padding: 6px 10px;
  width: fit-content;
}
[data-theme="light"] .permission-detail[open] summary {
  background: #fff8dc !important;
  border-color: rgba(255,193,7,.36) !important;
}
[data-theme="light"] .permission-list-small {
  gap: 8px !important;
  margin-top: 10px !important;
}
[data-theme="light"] .table-responsive td small,
[data-theme="light"] .table-scroll td small {
  color: #5f6f85 !important;
  overflow-wrap: anywhere;
  word-break: normal;
}
[data-theme="light"] .table-responsive td .table-title + small,
[data-theme="light"] .table-scroll td .table-title + small {
  display: block;
  margin-top: 3px;
  max-width: 280px;
}

[data-theme="light"] .guide-card,
[data-theme="light"] .guide-empty-note {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border-color: rgba(18, 52, 86, .12) !important;
  color: #172033 !important;
}
[data-theme="light"] .guide-card .btn[disabled],
[data-theme="light"] .guide-card .btn.ghost[disabled] {
  background: #eef2f7 !important;
  border-color: rgba(18,52,86,.12) !important;
  color: #66758a !important;
  opacity: 1 !important;
}

[data-theme="light"] .notice.readonly-banner,
[data-theme="light"] .readonly-banner {
  background: #eff6ff !important;
  border: 1px solid rgba(37,99,235,.18) !important;
  color: #27496f !important;
}
[data-theme="light"] .notice.readonly-banner strong,
[data-theme="light"] .readonly-banner strong {
  color: #123456 !important;
  margin-right: 8px;
}

[data-theme="light"] .email-template-editor-card,
[data-theme="light"] .email-preview-frame,
[data-theme="light"] .template-preview,
[data-theme="light"] .preview-card {
  background: #ffffff !important;
  color: #172033 !important;
  border-color: rgba(15,23,42,.12) !important;
}
[data-theme="light"] .email-preview-frame {
  padding: 20px !important;
  overflow: auto !important;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.04), 0 14px 32px rgba(15,23,42,.06) !important;
}
[data-theme="light"] .email-preview-frame > table,
[data-theme="light"] .email-preview-frame table[role="presentation"]:first-child {
  max-width: 720px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
[data-theme="light"] .email-preview-frame table[width="100%"]:first-child {
  width: min(720px, 100%) !important;
}

[data-theme="light"] .code-block,
[data-theme="light"] pre.debug,
[data-theme="light"] pre.code-block {
  background: #f8fafc !important;
  border-color: rgba(18,52,86,.12) !important;
  color: #123456 !important;
}

/* v1.9.9-pre9 — final QA polish: guías y preview neutral de correos.
   No cambia plantillas de email ni lógica de descarga; solo presentación. */
[data-theme="light"] .guide-page .guide-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff8dc !important;
  border: 1px solid rgba(255,193,7,.34) !important;
  color: #8a5a00 !important;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(255,193,7,.12);
}
[data-theme="light"] .guide-hero-card {
  background:
    radial-gradient(circle at top right, rgba(255,193,7,.10), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  border-color: rgba(18,52,86,.10) !important;
}
[data-theme="light"] .guide-library-card {
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  border-color: rgba(18,52,86,.10) !important;
  box-shadow: 0 20px 48px rgba(15,23,42,.075) !important;
}
[data-theme="light"] .guide-section-head {
  align-items: flex-start;
  margin-bottom: 18px;
}
[data-theme="light"] .guide-meta-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 7px 11px;
  border-radius: 999px;
  background: #eff6ff !important;
  border: 1px solid rgba(37,99,235,.16) !important;
  color: #1e3a8a !important;
  font-size: .78rem;
  font-weight: 850;
}
[data-theme="light"] .guide-card {
  padding: 20px !important;
  background:
    radial-gradient(circle at top right, rgba(18,52,86,.045), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
}
[data-theme="light"] .guide-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
[data-theme="light"] .guide-empty-note {
  padding: 18px 20px !important;
  background: #f8fafc !important;
  border: 1px dashed rgba(18,52,86,.20) !important;
  border-radius: 18px !important;
}
[data-theme="light"] .guide-pending-btn,
[data-theme="light"] .guide-card .btn[disabled].guide-pending-btn {
  width: min(520px, 100%);
  justify-content: center;
  background: #f1f5f9 !important;
  border: 1px solid rgba(18,52,86,.14) !important;
  color: #526174 !important;
  font-weight: 850 !important;
  opacity: 1 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85) !important;
}
[data-theme="light"] .guide-support-card {
  background:
    radial-gradient(circle at top right, rgba(37,99,235,.06), transparent 30%),
    #ffffff !important;
  border-color: rgba(37,99,235,.12) !important;
}

[data-theme="dark"] .guide-page .guide-kicker {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,193,7,.10);
  border: 1px solid rgba(255,193,7,.24);
  color: #ffd54a;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}
[data-theme="dark"] .guide-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

[data-theme="light"] .email-preview-shell-card {
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  border-color: rgba(18,52,86,.11) !important;
  color: #172033 !important;
  box-shadow: 0 20px 48px rgba(15,23,42,.075) !important;
}
[data-theme="light"] .email-preview-neutral {
  background:
    radial-gradient(circle at top right, rgba(18,52,86,.045), transparent 32%),
    #f8fafc !important;
  border: 1px solid rgba(18,52,86,.12) !important;
  border-radius: 20px !important;
  padding: 28px !important;
  min-height: 320px;
  color: #172033 !important;
}
[data-theme="light"] .email-preview-neutral > table:first-child,
[data-theme="light"] .email-preview-neutral > table[role="presentation"]:first-child,
[data-theme="light"] .email-preview-neutral > table[width="100%"]:first-child {
  background: transparent !important;
  width: min(720px, 100%) !important;
  max-width: 720px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
[data-theme="light"] .email-preview-neutral > table:first-child > tbody > tr > td:first-child,
[data-theme="light"] .email-preview-neutral > table[role="presentation"]:first-child > tbody > tr > td:first-child {
  background: transparent !important;
}
[data-theme="light"] .email-preview-neutral iframe,
[data-theme="light"] .email-preview-neutral img {
  max-width: 100%;
}

/* v1.9.9-pre10 — email preview isolation.
   El panel puede cambiar de tema, pero el email previsualizado conserva su HTML/CSS propio. */
.email-preview-isolated {
  overflow: hidden !important;
}
.email-preview-iframe {
  display: block;
  width: min(760px, 100%);
  height: 760px;
  margin: 0 auto;
  border: 0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 22px 48px rgba(15, 23, 42, .16);
}
[data-theme="light"] .email-preview-isolated {
  background:
    radial-gradient(circle at top right, rgba(18,52,86,.045), transparent 32%),
    #f8fafc !important;
  border-color: rgba(18,52,86,.12) !important;
}
[data-theme="light"] .email-preview-iframe {
  background: #ffffff !important;
  box-shadow: 0 22px 48px rgba(15, 23, 42, .14) !important;
}
[data-theme="dark"] .email-preview-isolated {
  background: rgba(255,255,255,.04);
}
[data-theme="dark"] .email-preview-iframe {
  background: #ffffff;
  box-shadow: 0 24px 52px rgba(0,0,0,.38);
}
@media (max-width: 760px) {
  .email-preview-neutral.email-preview-isolated {
    padding: 14px !important;
  }
  .email-preview-iframe {
    height: 700px;
    border-radius: 14px;
  }
}
