/* Camada exclusivamente visual. A lógica e os eventos do HUB não são alterados. */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f8f5;
  --panel: #ffffff;
  --panel2: #edf5f0;
  --panel-2: #edf5f0;
  --deep: #edf5f0;
  --sidebar: #f7fbf8;
  --line: #a9cdb8;
  --line-soft: #c3dacf;
  --muted: #476b5a;
  --white: #071a11;
  --text: #071a11;
  --green: #087d32;
  --mint: #008c6a;
  --lime: #668a00;
  --orange: #b76000;
  --red: #b52e2e;
  --amber: #8c6500;
  --blue: #006fa8;
  --shadow: 0 22px 58px rgba(23, 58, 40, .13);
}

.theme-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 2147483000;
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(44, 255, 69, .55);
  border-radius: 50%;
  background: rgba(0, 23, 15, .94);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  color: #f5fff9;
  cursor: pointer;
  font: inherit;
  isolation: isolate;
}
.theme-toggle:hover { border-color: #2cff45; transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: 3px solid #00e9ad; outline-offset: 3px; }
.theme-toggle__icon { font: 700 22px/1 Arial, sans-serif; }
.theme-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html[data-theme="light"] .theme-toggle {
  border-color: #8fbca3;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 28px rgba(23, 58, 40, .16);
  color: #071a11;
}

/* Reserva o canto do controle sem cobrir botões já existentes. */
.topbar, .billing-nav { padding-right: 66px; }

/* Paleta base do HUB, autenticação e componentes compartilhados. */
html[data-theme="light"] body,
html[data-theme="light"] .main,
html[data-theme="light"] .auth-panel,
html[data-theme="light"] .billing-shell,
html[data-theme="light"] .triade-tools {
  color: #071a11;
  background-color: #f4f8f5;
}
html[data-theme="light"] body {
  background-image: radial-gradient(circle at 90% 0, #d8eee0 0, transparent 36%);
}
html[data-theme="light"] .sidebar,
html[data-theme="light"] .billing-nav,
html[data-theme="light"] .auth-card,
html[data-theme="light"] .auth-plans-card,
html[data-theme="light"] .card,
html[data-theme="light"] .section,
html[data-theme="light"] .gate,
html[data-theme="light"] .plan-card,
html[data-theme="light"] .checkout-card,
html[data-theme="light"] .admin-card {
  border-color: var(--line);
  background: #ffffff;
  color: #071a11;
  box-shadow: var(--shadow, 0 22px 58px rgba(23, 58, 40, .13));
}
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  border-color: #9ebfac;
  background: #ffffff;
  color: #071a11;
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder { color: #6e887b; }
html[data-theme="light"] .btn,
html[data-theme="light"] .button {
  border-color: #7fad91;
  background: #ffffff;
  color: #071a11;
}
html[data-theme="light"] .btn-primary,
html[data-theme="light"] .button.primary { color: #001008; background: linear-gradient(90deg, #00c79a, #32d94e, #95cf00); }
html[data-theme="light"] .brand,
html[data-theme="light"] .billing-brand,
html[data-theme="light"] .nav a,
html[data-theme="light"] td strong,
html[data-theme="light"] .summary-line strong,
html[data-theme="light"] .security-strip strong { color: #071a11; }
html[data-theme="light"] .nav a:hover,
html[data-theme="light"] .nav a.active,
html[data-theme="light"] .nav-item:hover,
html[data-theme="light"] .nav-item.active {
  background: #e2f2e8;
  color: #071a11;
}
html[data-theme="light"] .side-plan,
html[data-theme="light"] .chip,
html[data-theme="light"] .analytics-tabs,
html[data-theme="light"] .analytics-breakdown,
html[data-theme="light"] .download-steps,
html[data-theme="light"] .print-ticket,
html[data-theme="light"] .print-preview {
  border-color: var(--line);
  background: #f7fbf8;
  color: #071a11;
}
html[data-theme="light"] .table-wrap { border-color: var(--line); background: #ffffff; }
html[data-theme="light"] th,
html[data-theme="light"] td { border-color: #c8ddd1; color: #173a2a; }
html[data-theme="light"] th { background: #edf5f0; color: #365e4b; }
html[data-theme="light"] .toast { background: #ffffff; color: #071a11; box-shadow: var(--shadow); }
html[data-theme="light"] .toast.error { background: #fff1f1; color: #821f1f; }
html[data-theme="light"] .notice { background: #fff7dc; color: #624800; }
html[data-theme="light"] dialog,
html[data-theme="light"] .pair-dialog { background: #ffffff; color: #071a11; }

/* Login: mantém a fotografia, mas troca o contraste do conteúdo. */
html[data-theme="light"] .auth-personality .auth-visual {
  background: linear-gradient(90deg, rgba(248, 252, 249, .74), rgba(248, 252, 249, .92)), url('/login-background.png') center/cover no-repeat;
}
html[data-theme="light"] .auth-personality .auth-visual::after {
  background: radial-gradient(circle at 50% 55%, transparent 0 28%, rgba(255, 255, 255, .18) 58%, rgba(240, 247, 242, .7) 100%);
}
html[data-theme="light"] .auth-message { color: #071a11; text-shadow: 0 2px 20px rgba(255, 255, 255, .75); }
html[data-theme="light"] .auth-message > p { color: #294f3d; }
html[data-theme="light"] .auth-benefits span { border-color: #87b89c; background: rgba(255, 255, 255, .76); }
html[data-theme="light"] .auth-card .small a,
html[data-theme="light"] .auth-card a[href="#/forgot"] { color: #071a11 !important; text-decoration-color: rgba(7, 26, 17, .6); }
html[data-theme="light"] .auth-plans-card h3,
html[data-theme="light"] .auth-plan-highlights { color: #071a11; }
html[data-theme="light"] .auth-plans-card p { color: #365e4b; }
html[data-theme="light"] .auth-plan-badge { background: #dff1e6; color: #087d32; }

/* Downloads, análises e registro por print. */
html[data-theme="light"] .download-product,
html[data-theme="light"] .analytics-breakdown,
html[data-theme="light"] .steps-section,
html[data-theme="light"] .faq-section {
  background: #ffffff;
  box-shadow: var(--shadow);
}
html[data-theme="light"] .download-copy > p,
html[data-theme="light"] .download-copy > small,
html[data-theme="light"] .feature-list li,
html[data-theme="light"] .download-steps li,
html[data-theme="light"] .downloads-warning p { color: #365e4b; }
html[data-theme="light"] .analytics-tabs button { color: #365e4b; }
html[data-theme="light"] .analytics-tabs button.active { background: #dff1e6; color: #071a11; }
html[data-theme="light"] .breakdown-track,
html[data-theme="light"] .risk-band i { background: #d8e8df; }
html[data-theme="light"] .donut { background: radial-gradient(circle, #fff 0 55%, transparent 57%), conic-gradient(var(--green) calc(var(--win)*1%), #ff5a4e 0 90%, #9aaea4 0); }
html[data-theme="light"] .print-drop { background: rgba(0, 142, 73, .035); }
html[data-theme="light"] .print-warning { background: #fff8df; color: #674a00; }
html[data-theme="light"] .register-mode-tabs {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
}
html[data-theme="light"] .register-mode-tabs a { color: #476b5a; }
html[data-theme="light"] .register-mode-tabs a:hover {
  border-color: #8fbca3;
  background: #edf7f1;
  color: #071a11;
}
html[data-theme="light"] .register-mode-tabs a.active {
  border-color: #22a653;
  background: linear-gradient(135deg, #dff7e8, #f3fbf6);
  color: #071a11;
  box-shadow: inset 4px 0 #18a34a;
}
html[data-theme="light"] .register-mode-tabs i {
  border-color: #8fbca3;
  background: #f0f8f3;
}
html[data-theme="light"] .register-mode-tabs small { color: #476b5a; }
html[data-theme="light"] .register-mode-intro {
  border-color: #8fbca3;
  background: linear-gradient(135deg, #ffffff, #edf7f1);
  color: #071a11;
  box-shadow: var(--shadow);
}

/* Central de Ferramentas possui sua própria paleta interna. */
html[data-theme="light"] .triade-tools {
  --tt-bg: #f4f8f5;
  --tt-sidebar: #ffffff;
  --tt-panel: #ffffff;
  --tt-panel-2: #edf5f0;
  --tt-line: rgba(7, 70, 39, .18);
  --tt-green: #087d32;
  --tt-green-2: #008c6a;
  --tt-orange: #b76000;
  --tt-orange-2: #c87824;
  --tt-text: #071a11;
  --tt-muted: #476b5a;
  --tt-red: #b52e2e;
}
html[data-theme="light"] .triade-tools button,
html[data-theme="light"] .triade-tools input,
html[data-theme="light"] .triade-tools select,
html[data-theme="light"] .triade-tools option,
html[data-theme="light"] .triade-tools b,
html[data-theme="light"] .triade-tools strong,
html[data-theme="light"] .triade-tools h1,
html[data-theme="light"] .triade-tools h2,
html[data-theme="light"] .triade-tools h3,
html[data-theme="light"] .triade-tools__brand,
html[data-theme="light"] .triade-tools__nav a { color: #071a11 !important; }
html[data-theme="light"] .triade-tools__nav a:hover,
html[data-theme="light"] .triade-tools__nav a.is-active { background: rgba(8, 125, 50, .08); color: #071a11 !important; }
html[data-theme="light"] .triade-tools__heading p,
html[data-theme="light"] .triade-tools__hero-card p,
html[data-theme="light"] .triade-tools__card p { color: #476b5a !important; }
html[data-theme="light"] .triade-tools__main { background: radial-gradient(circle at 80% 0, rgba(0, 140, 106, .08), transparent 28%), var(--tt-bg); }
html[data-theme="light"] .triade-tools__modal-backdrop { background: rgba(225, 237, 230, .82); }
html[data-theme="light"] .triade-tools__icon {
  border-color: #66d94a;
  background: #e5ffdc;
  color: #079333 !important;
  box-shadow: 0 8px 20px rgba(7, 147, 51, .12);
}
html[data-theme="light"] .triade-tools__card.is-orange .triade-tools__icon {
  border-color: #ffad62;
  background: #fff0df;
  color: #d46500 !important;
  box-shadow: 0 8px 20px rgba(212, 101, 0, .12);
}
html[data-theme="light"] .triade-tools__card button {
  border: 0;
  background: linear-gradient(90deg, #00d89f, #6ce72f);
  color: #001008 !important;
  box-shadow: 0 9px 20px rgba(0, 168, 104, .16);
}
html[data-theme="light"] .triade-tools__card.is-orange button {
  border: 0;
  background: linear-gradient(90deg, #ffb15f, #ff8a28);
  color: #2b1200 !important;
  box-shadow: 0 9px 20px rgba(226, 112, 16, .16);
}

/* Planos e checkout. Fotografias e marcas conservam suas cores originais. */
html[data-theme="light"] .hub-showcase,
html[data-theme="light"] .hub-plan-carousel,
html[data-theme="light"] .mp-trust,
html[data-theme="light"] .benefit-grid article,
html[data-theme="light"] .trust-grid article,
html[data-theme="light"] .steps-grid article,
html[data-theme="light"] .faq-grid details,
html[data-theme="light"] .modal-card,
html[data-theme="light"] .payment-notes div,
html[data-theme="light"] .mercadopago-trust,
html[data-theme="light"] .hosted-checkout {
  border-color: var(--line);
  background: #ffffff;
  color: #071a11;
  box-shadow: var(--shadow);
}
html[data-theme="light"] .hero-proof { color: #294f3d; }
html[data-theme="light"] .hero-proof span { border-color: var(--line); background: #eef6f1; }
html[data-theme="light"] .showcase-copy > p,
html[data-theme="light"] .benefit-grid span,
html[data-theme="light"] .trust-grid span,
html[data-theme="light"] .price small,
html[data-theme="light"] .price-note,
html[data-theme="light"] .mp-trust span,
html[data-theme="light"] .steps-grid span,
html[data-theme="light"] .faq-grid p,
html[data-theme="light"] .waitlist-form p,
html[data-theme="light"] .mercadopago-trust p,
html[data-theme="light"] .hosted-checkout p,
html[data-theme="light"] .payment-notes span { color: #476b5a; }
html[data-theme="light"] .faq-grid summary,
html[data-theme="light"] .waitlist-card .price,
html[data-theme="light"] .mp-brand strong,
html[data-theme="light"] .mp-summary-badge strong,
html[data-theme="light"] .hosted-mp-brand strong,
html[data-theme="light"] .payment-notes strong { color: #071a11; }
html[data-theme="light"] .hub-carousel-controls > button,
html[data-theme="light"] .gallery-dots button,
html[data-theme="light"] .waitlist-form input { border-color: #8fbca3; background: #ffffff; color: #071a11; }
html[data-theme="light"] .modal-backdrop { background: rgba(225, 237, 230, .86); }
html[data-theme="light"] .modal-close { background: #ffffff; color: #071a11; }
html[data-theme="light"] .payment-environment { background: #fff2d6; color: #744800; }
html[data-theme="light"] .secure-pill,
html[data-theme="light"] .mp-summary-badge { color: #365e4b; }
html[data-theme="light"] .hosted-methods button { border-color: #8fbca3; background: #f3f8f5; color: #071a11; }
html[data-theme="light"] .hosted-methods button.active { background: #dff1e6; }

/* Central ADM. */
html[data-theme="light"] .auth-screen { background: transparent; }
html[data-theme="light"] .admin-app .sidebar { background: rgba(255, 255, 255, .96); }
html[data-theme="light"] .admin-app .metric,
html[data-theme="light"] .admin-app .panel,
html[data-theme="light"] .admin-app .list-card,
html[data-theme="light"] .admin-app .product-card,
html[data-theme="light"] .admin-app .review-card,
html[data-theme="light"] .admin-app .import-stats div,
html[data-theme="light"] .admin-app .dialog-card {
  border-color: var(--line-soft);
  background: #ffffff;
  color: #071a11;
  box-shadow: var(--shadow);
}
html[data-theme="light"] .admin-app .nav-item:hover,
html[data-theme="light"] .admin-app .nav-item.active { background: #e2f2e8; color: #071a11; }
html[data-theme="light"] .admin-app .button { background: #ffffff; color: #071a11; }
html[data-theme="light"] .admin-app .button.primary { color: #001008; background: linear-gradient(90deg, #00c79a, #32d94e, #95cf00); }
html[data-theme="light"] .admin-app .feedback,
html[data-theme="light"] .safe-import { background: #e8f6ed; color: #20523a; }
html[data-theme="light"] .admin-app .feedback.error { background: #fff0f0; color: #8b2525; }
html[data-theme="light"] .admin-app .callout,
html[data-theme="light"] .admin-app .import-confirmation { background: #fff7dc; color: #624800; }
html[data-theme="light"] .admin-app .import-confirmation p { color: #624800; }
html[data-theme="light"] .admin-app .import-confirmation code,
html[data-theme="light"] .admin-app .dialog-close { background: #f3f8f5; }

@media (max-width: 780px) {
  .theme-toggle { width: 40px; height: 40px; }
  .topbar, .billing-nav { padding-right: 54px; }
}
@media (prefers-reduced-motion: no-preference) {
  .theme-toggle { transition: transform .18s ease, color .18s ease, background .18s ease, border-color .18s ease; }
}
