/* Paleta noturna: superfícies suaves, contraste legível e vermelho da marca. */
html[data-theme="dark"] {
  --ink: #e5eaf2;
  --muted: #b2bdce;
  --subtle: #96a4b9;
  --line: #303d50;
  --surface: #141e2c;
  --red: #f07878;
  --red-soft: #39242c;
  --green: #66c4a0;
  --theme-page: #101824;
  --theme-card: #1b2636;
  --theme-input: #121c2b;
  --theme-raised: #253247;
  color-scheme: dark;
  background: var(--theme-page);
}
html[data-theme="dark"] body { background: var(--theme-page); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.theme-toggle:hover { border-color: var(--subtle); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .theme-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
html[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
html[data-theme="dark"] .site-header { background: #101824ed; border-color: var(--line); }
html[data-theme="dark"] :is(.brand, .admin-brand) img { filter: brightness(0) invert(1); }
html[data-theme="dark"] :is(.page-hero, .admin-shell) { background: var(--surface); }
html[data-theme="dark"] :is(.info-card, .feature-list li, .blog-card, .price-card, .testimonial-card, .empty-state, .pricing-contact, .roadmap-panel, .store-card, .chat-card, .admin-login, .admin-top, .admin-sidebar, .admin-table-wrap, .admin-form-card, .admin-editor, .user-list, .mobile-menu nav, .skip-link, .inbox-card, .platform-panel, .team-float, .platform-chip, .channel-grid article, .segment-card, .editorial-note, .stat-pill) {
  background: var(--theme-card);
  border-color: var(--line);
}
html[data-theme="dark"] :is(.admin-login input, .admin-fields input, .admin-fields textarea, .admin-fields select, .inbox-chat, .inbox-input, .inbox-rail) {
  background: var(--theme-input);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--subtle); opacity: 1; }
html[data-theme="dark"] :is(input, select, textarea):focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
html[data-theme="dark"] :is(.admin-table th, .admin-table td, .order-line, .workflow-row, .inbox-ui, .inbox-list, .inbox-rail, .search-bar, .hero-proof) { border-color: var(--line); }
html[data-theme="dark"] :is(.admin-sidebar button, .admin-sidebar a, .eyebrow, .message, .workflow-icon, .team-mark, .channel-symbol, .testimonial-card blockquote, .wp-content blockquote) { color: var(--muted); }
html[data-theme="dark"] :is(.admin-sidebar button.active, .admin-sidebar button:hover, .admin-sidebar a:hover, .status-pill, .button.secondary, .admin-logout, .admin-table button, .message, .workflow-icon, .team-mark, .channel-symbol) {
  background: var(--theme-raised);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] :is(.visual-card, .blog-card-placeholder, .blog-empty-art, .visual-shape-a) { background: #202d40; }
html[data-theme="dark"] :is(.visual-card::before, .page-hero::before, .blog-empty-art::before, .platform-layer, .visual-shape-b, .conversation i, .conversation b) { background: #29384d; }
html[data-theme="dark"] :is(.conversation.active, .message-reddy, .workflow-icon.red) { background: #3b2832; }
html[data-theme="dark"] :is(.message-reddy b, .workflow-icon.red, .card-index, .segment-card > span, .prose a, .wp-content a) { color: #f49a9a; }
html[data-theme="dark"] .workflow-icon.green { background: #183b34; color: #8ad6b6; }
html[data-theme="dark"] :is(.home-hero h1 em, .page-hero h1 em, .store-tag) { color: var(--subtle); }
html[data-theme="dark"] :is(.button.primary, .header-cta, .chat-launcher) {
  background: #34445c;
  color: #f5f7fb;
  border-color: #485b76;
}
html[data-theme="dark"] :is(.button.primary:hover, .header-cta:hover, .chat-launcher:hover) { background: #405575; }
html[data-theme="dark"] :is(.site-footer, .content-section.dark, .reddy-home, .cta-panel, .reddy-float, .blog-empty-art span, .pricing-symbol, .chat-badge) { background: #0b121d; color: #e5eaf2; }
html[data-theme="dark"] .cta-panel .button { background: #34445c; color: #f5f7fb; }
html[data-theme="dark"] .admin-notice { background: #36291c; border-color: #705236; color: #f1c595; }
html[data-theme="dark"] :is(.admin-message, .admin-alert) { color: #ffaaa5; }
html[data-theme="dark"] .admin-alert.success { color: #8ad6b6; }
html[data-theme="dark"] .status-pill.published { background: #1d3c35; color: #9edfc4; }
html[data-theme="dark"] .price-card.highlight { border-color: #bf747b; }
/* Logomarcas de terceiros mantêm sua própria superfície para não perder contraste. */
html[data-theme="dark"] :is(.logo-list a, .logo-list .logo-mark) { background: #dce3ec; border-color: var(--line); }
html[data-theme="dark"] .logo-list img { opacity: .9; }
/* O widget é carregado sob demanda e injeta seu CSS; a especificidade mantém o tema. */
html[data-theme="dark"] :is(#channel-chat-container, #channel-chat-messages, #channel-chat-input-area) { background: var(--theme-card); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] #channel-chat-input { background: var(--theme-input); color: var(--ink); border-color: var(--line); }
@media (max-width: 760px) {
  .header-inner { gap: 12px; }
  .theme-toggle { margin-left: auto; }
}
html[data-theme="dark"] #channel-chat-container .channel-sent { background: #3b2832; color: var(--ink); }
html[data-theme="dark"] #channel-chat-container :is(.channel-received, .channel-media-document, .channel-media-caption, .channel-menu-pill) { background: var(--theme-raised); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] #channel-chat-container :is(.channel-quoted, .channel-sent .channel-quoted) { background: #302631; }
html[data-theme="dark"] #channel-chat-container :is(.channel-quoted-text, .channel-media-caption) { color: var(--muted); }
html[data-theme="dark"] #channel-chat-container :is(.channel-quoted-author, .channel-menu-title) { color: #f49a9a; }
.editor-top .text-link { border: 0; background: transparent; color: var(--muted); padding: 0; font: inherit; cursor: pointer; }
