/* ═══════════════════════════════ TEMA PLUGA v5.54.3 ═══════════════════════════════ */
:root {
  color-scheme: light;
  --theme-focus: rgba(26, 86, 219, .18);
  --theme-overlay: rgba(15, 23, 42, .48);
}

html[data-pluga-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111827;
  --surface2: #172033;
  --surface3: #202b3c;
  --border: rgba(148, 163, 184, .20);
  --border2: rgba(148, 163, 184, .38);
  --text: #f7f9fc;
  --text2: #d5deea;
  --text3: #a9b6c8;
  --blue: #86a8ff;
  --blue-bg: rgba(78, 120, 235, .17);
  --blue-border: rgba(125, 161, 255, .42);
  --green: #54d6a0;
  --green-bg: rgba(16, 185, 129, .14);
  --green-border: rgba(52, 211, 153, .34);
  --amber: #f7c66b;
  --amber-bg: rgba(245, 158, 11, .14);
  --amber-border: rgba(251, 191, 36, .34);
  --red: #ff8b8b;
  --red-bg: rgba(239, 68, 68, .14);
  --red-border: rgba(248, 113, 113, .35);
  --teal: #59d6c4;
  --teal-bg: rgba(20, 184, 166, .14);
  --teal-border: rgba(45, 212, 191, .32);
  --navy: #263a85;
  --shadow: 0 1px 3px rgba(0,0,0,.38), 0 10px 28px rgba(0,0,0,.22);
  --shadow-lg: 0 12px 34px rgba(0,0,0,.46), 0 28px 70px rgba(0,0,0,.28);
  --theme-focus: rgba(134, 168, 255, .22);
  --theme-overlay: rgba(0, 0, 0, .70);
}

html[data-pluga-theme="dark"] body,
html[data-pluga-theme="dark"] #app {
  background: var(--bg);
  color: var(--text);
}

html[data-pluga-theme="dark"] ::selection {
  background: rgba(134,168,255,.35);
  color: #fff;
}

html[data-pluga-theme="dark"] * {
  scrollbar-color: #46546a #111827;
}

html[data-pluga-theme="dark"] *::-webkit-scrollbar-track { background: #111827; }
html[data-pluga-theme="dark"] *::-webkit-scrollbar-thumb { background: #46546a; border-color: #111827; }

/* Alternador */
.theme-toggle {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: background .15s, color .15s, border-color .15s, transform .12s;
}
.theme-toggle:hover { background: rgba(255,255,255,.15); color: #fff; }
.theme-toggle:active { transform: scale(.97); }
.theme-toggle-icon { width: 15px; text-align: center; font-size: 15px; }
.theme-toggle-login {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 5;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
}

/* Login e carregamento */
html[data-pluga-theme="dark"] #login-screen {
  background: radial-gradient(circle at 20% 0%, #243873 0%, transparent 42%),
              linear-gradient(135deg, #090f1d 0%, #101a3d 52%, #080d19 100%);
}
html[data-pluga-theme="dark"] .login-card {
  background: #111827;
  border: 1px solid rgba(148,163,184,.18);
  box-shadow: 0 30px 80px rgba(0,0,0,.52);
}
html[data-pluga-theme="dark"] .field input,
html[data-pluga-theme="dark"] .field select,
html[data-pluga-theme="dark"] .field textarea {
  background: #172033;
  color: var(--text);
  border-color: var(--border2);
}
html[data-pluga-theme="dark"] .field input:focus { box-shadow: 0 0 0 3px var(--theme-focus); }
html[data-pluga-theme="dark"] #pluga-boot-screen { background: #0b1120; }
html[data-pluga-theme="dark"] #pluga-boot-screen .pluga-boot-card,
html[data-pluga-theme="dark"] .pluga-loading-state strong { color: #cbd8ff; }
html[data-pluga-theme="dark"] .pluga-loading-state { color: var(--text2); }
html[data-pluga-theme="dark"] .pluga-spinner { border-color: #334155; border-top-color: #86a8ff; }

/* Estrutura principal */
html[data-pluga-theme="dark"] .app-topbar {
  background: linear-gradient(135deg, #111b44 0%, #0b1433 100%);
  border-bottom: 1px solid rgba(148,163,184,.12);
}
html[data-pluga-theme="dark"] .app-sidebar,
html[data-pluga-theme="dark"] .app-tabbar,
html[data-pluga-theme="dark"] .sistema-dropdown {
  background: #0f1726;
  border-color: var(--border);
}
html[data-pluga-theme="dark"] .sidebar-context,
html[data-pluga-theme="dark"] .sidebar-footer,
html[data-pluga-theme="dark"] .sidebar-group-body { border-color: var(--border); }
html[data-pluga-theme="dark"] .sidebar-group-toggle.active {
  color: #a9beff;
  background: rgba(78,120,235,.15);
}
html[data-pluga-theme="dark"] .sidebar-group-toggle.active .sidebar-group-icon { background: rgba(78,120,235,.18); }
html[data-pluga-theme="dark"] .sidebar-link:hover { background: rgba(148,163,184,.08); }
html[data-pluga-theme="dark"] .sidebar-link.active {
  background: rgba(78,120,235,.18);
  color: #adc1ff;
}
html[data-pluga-theme="dark"] .sidebar-overlay { background: rgba(0,0,0,.68); }
html[data-pluga-theme="dark"] .tab-btn.active { color: #adc1ff; border-bottom-color: #86a8ff; }
html[data-pluga-theme="dark"] .app-main { background: var(--bg); }

/* Superfícies, tabelas e formulários compartilhados */
html[data-pluga-theme="dark"] :is(.panel,.kpi-card,.modal,.forecast-card,.diagnostic-guide) {
  background: var(--surface);
  border-color: var(--border);
}
html[data-pluga-theme="dark"] .modal-overlay { background: var(--theme-overlay); }
html[data-pluga-theme="dark"] .modal-header,
html[data-pluga-theme="dark"] .modal-footer,
html[data-pluga-theme="dark"] .panel-header { border-color: var(--border); }
html[data-pluga-theme="dark"] .data-table th,
html[data-pluga-theme="dark"] .dre-table .dre-section { background: var(--surface2); }
html[data-pluga-theme="dark"] .data-table tr:hover td { background: rgba(148,163,184,.07); }
html[data-pluga-theme="dark"] .dre-table .dre-total { background: #263a85; }
html[data-pluga-theme="dark"] .diagnostic-guide::before { background: var(--surface); border-color: var(--border2); }
html[data-pluga-theme="dark"] #app :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),select,textarea),
html[data-pluga-theme="dark"] .modal :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),select,textarea) {
  background-color: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}
html[data-pluga-theme="dark"] #app :is(input,select,textarea)::placeholder { color: #728096; }
html[data-pluga-theme="dark"] #app :is(input,select,textarea):focus {
  border-color: #86a8ff;
  box-shadow: 0 0 0 3px var(--theme-focus);
}
html[data-pluga-theme="dark"] select option { background: #172033; color: var(--text); }
html[data-pluga-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-pluga-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.75); }
html[data-pluga-theme="dark"] .btn-ghost { color: var(--text2); border-color: var(--border2); }
html[data-pluga-theme="dark"] .btn-ghost:hover { color: var(--text); background: var(--surface2); }
html[data-pluga-theme="dark"] .btn-danger:hover { background: rgba(239,68,68,.22); }
html[data-pluga-theme="dark"] #toast { background: #243457; color: #fff; border: 1px solid rgba(148,163,184,.2); }
html[data-pluga-theme="dark"] .cat-fixo { background: rgba(99,102,241,.17); color: #aab5ff; }
html[data-pluga-theme="dark"] .cat-variavel { background: rgba(234,179,8,.16); color: #f6d365; }
html[data-pluga-theme="dark"] .cat-pessoal { background: rgba(34,197,94,.15); color: #77df9c; }
html[data-pluga-theme="dark"] .cat-impostos { background: rgba(239,68,68,.15); color: #ff9a9a; }

/* Dashboard */
html[data-pluga-theme="dark"] .dashboard-period-control,
html[data-pluga-theme="dark"] .dashboard-privacy-btn,
html[data-pluga-theme="dark"] .dashboard-action-btn,
html[data-pluga-theme="dark"] .dashboard-sync-pill { background: var(--surface); border-color: var(--border2); color: var(--text2); }
html[data-pluga-theme="dark"] .dashboard-action-btn:hover,
html[data-pluga-theme="dark"] .dashboard-period-current:hover { background: var(--surface2); color: var(--text); }
html[data-pluga-theme="dark"] .dashboard-privacy-btn[aria-pressed="true"] { background: #263a85; border-color: #526fc7; color: #fff; }
html[data-pluga-theme="dark"] .diagnostic-info-btn:hover,
html[data-pluga-theme="dark"] .diagnostic-info-btn[aria-expanded="true"] { background: var(--surface2); }

/* Agenda administrativa. Rotas públicas permanecem com seu desenho próprio. */
html[data-pluga-theme="dark"] #app :is(.apl-tabs,.apl-card,.apl-status-row,.apl-empty,.apl-service,.apl-service-menu,.apl-day,.apl-day-off,.apl-test-result,.apl-slot,.apl-banner,.apl-connection-error,.apl-dialog,.apl-saving-card) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html[data-pluga-theme="dark"] #app .apl-tab:hover,
html[data-pluga-theme="dark"] #app .apl-btn:hover,
html[data-pluga-theme="dark"] #app .apl-icon-btn:hover { background: var(--surface2); }
html[data-pluga-theme="dark"] #app .apl-service-meta span,
html[data-pluga-theme="dark"] #app .apl-pill.neutral { background: var(--surface2); color: var(--text2); }
html[data-pluga-theme="dark"] #app .apl-pill.warn { background: var(--amber-bg); color: var(--amber); }

/* Planejamento Estratégico administrativo */
html[data-pluga-theme="dark"] #app :is(.pe-note-editor,.pe-note-empty,.pe-share-url,.pe-cycle-card,.pe-direction-block,.pe-action-row,.pe-highlight) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html[data-pluga-theme="dark"] #app .pe-cycle-card.active,
html[data-pluga-theme="dark"] #app .pe-highlight,
html[data-pluga-theme="dark"] #app .pe-direction-block.primary { background: linear-gradient(145deg,#17213a,#10252a); }
html[data-pluga-theme="dark"] #app .pe-note-composer-foot,
html[data-pluga-theme="dark"] #app .pe-notebook-head { background: var(--surface2); }
html[data-pluga-theme="dark"] #app .pe-note-sheet {
  background: repeating-linear-gradient(var(--surface),var(--surface) 28px,#263244 29px);
}
html[data-pluga-theme="dark"] #app .pe-note-tool:hover { background: var(--surface2); color: #adc1ff; }
html[data-pluga-theme="dark"] #app .pe-share-note { background: linear-gradient(145deg,#17213a,#10252a); color: var(--text2); border-color: var(--blue-border); }

/* Vida em Movimento */
html[data-pluga-theme="dark"] #app .vm-manifesto,
html[data-pluga-theme="dark"] #app .vm-insight { background: linear-gradient(145deg,#17213a,#10252a); color: var(--text2); border-color: var(--blue-border); }
html[data-pluga-theme="dark"] #app :is(.vm-coherence-score,.vm-coherence-preview,.vm-range-value,.vm-chip) { background: var(--surface); border-color: var(--border2); color: var(--text2); }
html[data-pluga-theme="dark"] #app .vm-timeline-btn.active,
html[data-pluga-theme="dark"] #app .vm-chip:has(input:checked) { background: var(--blue-bg); color: #adc1ff; border-color: var(--blue-border); }
html[data-pluga-theme="dark"] #app .vm-score-start { background: var(--blue-bg); color: #9bb6ff; }
html[data-pluga-theme="dark"] #app .vm-score-now { background: var(--amber-bg); color: var(--amber); }
html[data-pluga-theme="dark"] #app .vm-score-target { background: var(--green-bg); color: var(--green); }

/* Anamnese Breathwork administrativa */
html[data-pluga-theme="dark"] #app :is(.btw-stat,.btw-panel,.btw-card,.btw-kpi,.btw-research-card,.btw-dialog) {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
html[data-pluga-theme="dark"] #app .btw-table th { background: var(--surface2); }
html[data-pluga-theme="dark"] #app .btw-status.wait,
html[data-pluga-theme="dark"] #app .btw-safety-item,
html[data-pluga-theme="dark"] #app .btw-config-error { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); }
html[data-pluga-theme="dark"] #app .btw-status.initial,
html[data-pluga-theme="dark"] #app .btw-rules-note { background: var(--blue-bg); color: #adc1ff; }
html[data-pluga-theme="dark"] #app .btw-status.done { background: var(--green-bg); color: var(--green); }

/* Pluga Task */
html[data-pluga-theme="dark"] #app :is(.tm-shell,.tm-topbar,.tm-workbar,.tm-card,.tm-kpi,.tm-list-panel,.tm-calendar,.tm-report-card,.tm-dialog,.tm-settings-tabs,.tm-settings-section,.tm-color-current,.tm-picker-box,.tm-manager-row,.tm-add-manager,.tm-task-side,.tm-mobile-projects) {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
html[data-pluga-theme="dark"] #app .tm-board { background: #0b1120; }
html[data-pluga-theme="dark"] #app .tm-column { background: #182231; border-color: rgba(148,163,184,.1); }
html[data-pluga-theme="dark"] #app .tm-column-body::-webkit-scrollbar-thumb { background: #46546a; border-color: #182231; }
html[data-pluga-theme="dark"] #app .tm-quick-add,
html[data-pluga-theme="dark"] #app .tm-list-check { background: var(--surface2); border-color: var(--border2); color: var(--text2); }
html[data-pluga-theme="dark"] #app .tm-list-row:hover,
html[data-pluga-theme="dark"] #app .tm-manager-row:hover,
html[data-pluga-theme="dark"] #app .tm-menu-action:hover { background: rgba(148,163,184,.07); }
html[data-pluga-theme="dark"] #app .tm-cal-week,
html[data-pluga-theme="dark"] #app .tm-cal-day.muted { background: var(--surface2); }
html[data-pluga-theme="dark"] #app .tm-cal-day { border-color: var(--border); }
html[data-pluga-theme="dark"] #app .tm-cal-task,
html[data-pluga-theme="dark"] #app .tm-mode-btn.active,
html[data-pluga-theme="dark"] #app .tm-activity-icon { background: var(--blue-bg); color: #adc1ff; }
html[data-pluga-theme="dark"] #app .tm-progress,
html[data-pluga-theme="dark"] #app .tm-bar-track { background: #2b3648; }
html[data-pluga-theme="dark"] #app .tm-picker-trigger { background: var(--surface2); color: var(--text2); border-color: var(--border2); }
html[data-pluga-theme="dark"] #app .tm-menu-identity { background: linear-gradient(135deg,#172033,#111827); border-color: var(--border); }
html[data-pluga-theme="dark"] #app .tm-notice { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); }

/* Contraste refinado v5.54.1
   Os seletores abaixo corrigem componentes que ainda utilizavam cores fixas do tema claro. */
html[data-pluga-theme="dark"] #app :is(.page-subtitle,.section-subtitle,.form-hint,.field-hint,.help-text,.muted,.text-muted) {
  color: var(--text3);
}
html[data-pluga-theme="dark"] #app :is(.panel,.kpi-card,.modal,.forecast-card,.diagnostic-guide) :is(h1,h2,h3,h4,strong) {
  color: var(--text);
}

/* Pluga Task: leitura reforçada em quadro, lista, calendário, relatórios e configurações. */
html[data-pluga-theme="dark"] #app .tm-main { background: #0e1727; color: var(--text); }
html[data-pluga-theme="dark"] #app .tm-topbar,
html[data-pluga-theme="dark"] #app .tm-workbar { background: #111b2c; border-color: var(--border); }
html[data-pluga-theme="dark"] #app .tm-title,
html[data-pluga-theme="dark"] #app .tm-dialog-title,
html[data-pluga-theme="dark"] #app .tm-report-title,
html[data-pluga-theme="dark"] #app .tm-block-title,
html[data-pluga-theme="dark"] #app .tm-settings-section-title,
html[data-pluga-theme="dark"] #app .tm-menu-name { color: var(--text); }
html[data-pluga-theme="dark"] #app .tm-subtitle,
html[data-pluga-theme="dark"] #app .tm-filter-count,
html[data-pluga-theme="dark"] #app .tm-settings-section-sub,
html[data-pluga-theme="dark"] #app .tm-menu-meta,
html[data-pluga-theme="dark"] #app .tm-menu-label,
html[data-pluga-theme="dark"] #app .tm-picker-label,
html[data-pluga-theme="dark"] #app .tm-side-label,
html[data-pluga-theme="dark"] #app .tm-activity-time { color: var(--text3); }
html[data-pluga-theme="dark"] #app .tm-column {
  background: #1a2739;
  border-color: #2d3b50;
}
html[data-pluga-theme="dark"] #app .tm-column.drag-over { background: #223557; outline-color: rgba(134,168,255,.45); }
html[data-pluga-theme="dark"] #app .tm-column-empty { color: #b4c0d0; border-color: #46566d; }
html[data-pluga-theme="dark"] #app .tm-quick-add-zone { color: #b9c5d5; }
html[data-pluga-theme="dark"] #app .tm-quick-add-zone::before { background: #46566d; }
html[data-pluga-theme="dark"] #app .tm-quick-add {
  background: #202e42;
  color: #dbe4ef;
  border-color: #52627a;
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
}
html[data-pluga-theme="dark"] #app .tm-quick-add:hover { background: #3657b8; color: #fff; border-color: #7292ee; }
html[data-pluga-theme="dark"] #app .tm-card {
  background: #131e2f;
  color: var(--text);
  border-color: #2e3d53;
  box-shadow: 0 2px 8px rgba(0,0,0,.23);
}
html[data-pluga-theme="dark"] #app .tm-card:hover {
  background: #18263a;
  border-color: #40536e;
  box-shadow: 0 8px 20px rgba(0,0,0,.30);
}
html[data-pluga-theme="dark"] #app .tm-card-title { color: #f1f5fa; }
html[data-pluga-theme="dark"] #app .tm-card-meta { color: #b6c2d2; }
html[data-pluga-theme="dark"] #app .tm-card.done .tm-card-title,
html[data-pluga-theme="dark"] #app .tm-list-title.done,
html[data-pluga-theme="dark"] #app .tm-check-row.done .tm-check-text { color: #9daabd; }
html[data-pluga-theme="dark"] #app .tm-card-meta .danger { color: #ff9b9b; }
html[data-pluga-theme="dark"] #app .tm-card-priority { color: #ffd16f; }
html[data-pluga-theme="dark"] #app .tm-progress,
html[data-pluga-theme="dark"] #app .tm-bar-track { background: #344258; }
html[data-pluga-theme="dark"] #app .tm-add-column {
  background: rgba(23,32,51,.82);
  color: #c9d4e2;
  border-color: #526179;
}
html[data-pluga-theme="dark"] #app .tm-add-column:hover { background: #202e42; color: #fff; border-color: #7292ee; }
html[data-pluga-theme="dark"] #app .tm-list-row,
html[data-pluga-theme="dark"] #app .tm-cal-day,
html[data-pluga-theme="dark"] #app .tm-check-row,
html[data-pluga-theme="dark"] #app .tm-activity-item,
html[data-pluga-theme="dark"] #app .tm-side-group,
html[data-pluga-theme="dark"] #app .tm-menu-block { border-color: var(--border); }
html[data-pluga-theme="dark"] #app .tm-list-row:hover { background: #1b293d; }
html[data-pluga-theme="dark"] #app .tm-cal-week { background: #1b2738; color: #b9c5d4; }
html[data-pluga-theme="dark"] #app .tm-cal-day.muted { background: #101927; color: #7f8da1; }
html[data-pluga-theme="dark"] #app .tm-cal-day.today { background: #1d2e4d; box-shadow: inset 0 0 0 1px #4f6cae; }
html[data-pluga-theme="dark"] #app .tm-cal-task { background: #243b69; color: #e8efff; border-left-color: #86a8ff; }
html[data-pluga-theme="dark"] #app .tm-mode-btn { color: #aebacd; }
html[data-pluga-theme="dark"] #app .tm-mode-btn:hover { background: #202d40; color: #fff; }
html[data-pluga-theme="dark"] #app .tm-mode-btn.active { background: #2a4074; color: #fff; }
html[data-pluga-theme="dark"] #app .tm-settings-tab { color: #aebacd; }
html[data-pluga-theme="dark"] #app .tm-settings-tab:hover,
html[data-pluga-theme="dark"] #app .tm-settings-tab.active { color: #dce6ff; }
html[data-pluga-theme="dark"] #app .tm-picker-trigger,
html[data-pluga-theme="dark"] #app .tm-icon-choice,
html[data-pluga-theme="dark"] #app .tm-menu-action-icon {
  background: #202d40;
  color: #c4cfdd;
  border-color: #3d4c61;
}
html[data-pluga-theme="dark"] #app .tm-picker-trigger:hover,
html[data-pluga-theme="dark"] #app .tm-icon-choice:hover,
html[data-pluga-theme="dark"] #app .tm-icon-choice.active {
  background: #2a3b55;
  color: #fff;
  border-color: #7292ee;
}
html[data-pluga-theme="dark"] #app .tm-manager-row input,
html[data-pluga-theme="dark"] #app .tm-manager-row select,
html[data-pluga-theme="dark"] #app .tm-menu-action { color: var(--text2); }
html[data-pluga-theme="dark"] #app .tm-manager-row input:focus { background: #202d40; color: #fff; }
html[data-pluga-theme="dark"] #app .tm-menu-action:hover { color: #fff; }
html[data-pluga-theme="dark"] #app .tm-menu-action.danger { color: #ff9b9b; }
html[data-pluga-theme="dark"] #app .tm-menu-action.danger .tm-menu-action-icon { background: rgba(239,68,68,.16); color: #ff9b9b; }
html[data-pluga-theme="dark"] #app .tm-task-name,
html[data-pluga-theme="dark"] #app .tm-task-description,
html[data-pluga-theme="dark"] #app .tm-inline-add input,
html[data-pluga-theme="dark"] #app .tm-activity-input textarea,
html[data-pluga-theme="dark"] #app .tm-side-group input,
html[data-pluga-theme="dark"] #app .tm-side-group select {
  background: #172235;
  color: var(--text);
  border-color: #405069;
}
html[data-pluga-theme="dark"] #app .tm-timer { color: #a9beff; }
html[data-pluga-theme="dark"] #app .tm-danger-zone { color: #ff9b9b; }

/* Agenda administrativa */
html[data-pluga-theme="dark"] #app :is(.apl-metric,.apl-status-icon,.apl-btn,.apl-service-menu,.apl-icon-btn,.apl-slot) {
  background: var(--surface2);
  color: var(--text2);
  border-color: var(--border2);
}
html[data-pluga-theme="dark"] #app :is(.apl-btn:hover,.apl-service-menu:hover,.apl-icon-btn:hover) { background: #26364c; color: #fff; }
html[data-pluga-theme="dark"] #app .apl-pill { background: var(--green-bg); color: var(--green); }
html[data-pluga-theme="dark"] #app .apl-banner { background: var(--amber-bg); color: #f8d98f; border-color: var(--amber-border); }
html[data-pluga-theme="dark"] #app .apl-connection-error { background: var(--red-bg); color: #ffaaaa; border-color: var(--red-border); }

/* Planejamento Estratégico */
html[data-pluga-theme="dark"] #app .pe-notebook-count,
html[data-pluga-theme="dark"] #app .pe-action-handle:hover { background: var(--blue-bg); color: #c3d1ff; }
html[data-pluga-theme="dark"] #app .pe-note-toolbar select { background: var(--surface2); color: var(--text2); border-color: var(--border2); }
html[data-pluga-theme="dark"] #app .pe-note-empty { color: var(--text3); }

/* Vida em Movimento */
html[data-pluga-theme="dark"] #app .vm-avatar { background: linear-gradient(145deg,#263a67,#1d4b47); color: #fff; }
html[data-pluga-theme="dark"] #app .vm-coherence { background: linear-gradient(145deg,#1d2438,#252040); border-color: var(--border); }
html[data-pluga-theme="dark"] #app .vm-score-energy { background: rgba(139,92,246,.18); color: #c4b5fd; }
html[data-pluga-theme="dark"] #app .vm-state-expansao { background: rgba(34,197,94,.16); color: #86efac; }
html[data-pluga-theme="dark"] #app .vm-state-estabilidade { background: rgba(234,179,8,.16); color: #fde68a; }
html[data-pluga-theme="dark"] #app .vm-state-transicao { background: rgba(249,115,22,.17); color: #fdba74; }
html[data-pluga-theme="dark"] #app .vm-state-contracao { background: rgba(239,68,68,.16); color: #fca5a5; }
html[data-pluga-theme="dark"] #app .vm-question { background: var(--blue-bg); color: #cbd8ff; border-color: var(--blue-border); }

/* Anamnese Breathwork administrativa */
html[data-pluga-theme="dark"] #app .btw-delta.up { background: var(--green-bg); color: #86efac; }
html[data-pluga-theme="dark"] #app .btw-delta.down { background: var(--red-bg); color: #fca5a5; }
html[data-pluga-theme="dark"] #app .btw-delta.neutral { background: var(--surface2); color: var(--text2); }
html[data-pluga-theme="dark"] #app .btw-mini-bar { background: #344258; }
html[data-pluga-theme="dark"] #app :is(.btw-field input,.btw-field select,.btw-field textarea) { background: var(--surface2); color: var(--text); border-color: var(--border2); }


/* Mapas Mentais: escurece a interface, preserva o fundo e as cores próprias do mapa. */
html[data-pluga-theme="dark"] #app :is(.mm-shell,.mm-library,.mm-editor,.mm-card,.mm-zoom-bar,.mm-select-toolbar,.mm-popover,.mm-outline-panel,.mm-dialog,.mm-template,.mm-template-sidebar,.mm-template-card,.mm-appearance,.mm-search-panel,.mm-search-result,.mm-export-option,.mm-menu) {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
html[data-pluga-theme="dark"] #app :is(.mm-soft-btn,.mm-icon-btn,.mm-search,.mm-filter-chip,.mm-template-search,.mm-shape,.mm-field input,.mm-field textarea,.mm-field select) {
  background: var(--surface2); color: var(--text2); border-color: var(--border2);
}
html[data-pluga-theme="dark"] #app .mm-list-head,
html[data-pluga-theme="dark"] #app .mm-template-sidebar { background: var(--surface2); }
html[data-pluga-theme="dark"] #app .mm-list-row,
html[data-pluga-theme="dark"] #app .mm-search-head,
html[data-pluga-theme="dark"] #app .mm-dialog-head,
html[data-pluga-theme="dark"] #app .mm-dialog-foot,
html[data-pluga-theme="dark"] #app .mm-appearance-section { border-color: var(--border); }
html[data-pluga-theme="dark"] #app .mm-list-row:hover,
html[data-pluga-theme="dark"] #app .mm-outline-row:hover,
html[data-pluga-theme="dark"] #app .mm-search-result:hover,
html[data-pluga-theme="dark"] #app .mm-menu button:hover { background: rgba(148,163,184,.08); }
html[data-pluga-theme="dark"] #app .mm-layout-option,
html[data-pluga-theme="dark"] #app .mm-theme-option { background: var(--surface2); color: var(--text); border-color: var(--border2); }
html[data-pluga-theme="dark"] #app .mm-layout-option:hover,
html[data-pluga-theme="dark"] #app .mm-layout-option.active,
html[data-pluga-theme="dark"] #app .mm-theme-option:hover,
html[data-pluga-theme="dark"] #app .mm-theme-option.active { background: #202c42; border-color: #6c87d8; }
html[data-pluga-theme="dark"] #app .mm-idea-box textarea { background: var(--surface2); color: var(--text); }
html[data-pluga-theme="dark"] #app .mm-suggestion { background: #202b3c; color: var(--text2); }
html[data-pluga-theme="dark"] #app .mm-card-preview { background: linear-gradient(145deg,#1a2433,#111827); }
html[data-pluga-theme="dark"] #app .mm-comment { background: var(--surface2); border-color: var(--border); }
html[data-pluga-theme="dark"] #app .mm-focus-exit { background: rgba(17,24,39,.95); color: var(--text2); border-color: var(--border2); }
html[data-pluga-theme="dark"] #app .mm-canvas {
  box-shadow: inset 0 0 0 1px rgba(148,163,184,.14);
}

/* Mapas Mentais, interface administrativa. O canvas e as cores dos nós continuam próprios do mapa. */
html[data-pluga-theme="dark"] #app :is(.mm-back,.mm-tool,.mm-row-action,.mm-filter-chip,.mm-template-category) { color: var(--text2); }
html[data-pluga-theme="dark"] #app :is(.mm-back:hover,.mm-tool:hover,.mm-row-action:hover,.mm-filter-chip:hover,.mm-template-category:hover) { background: #223047; color: #fff; }
html[data-pluga-theme="dark"] #app :is(.mm-tool.active,.mm-filter-chip.active,.mm-template-category.active,.mm-shape.active) {
  background: #28446a;
  color: #e8f2ff;
  border-color: #6f93c8;
}
html[data-pluga-theme="dark"] #app .mm-appearance-note,
html[data-pluga-theme="dark"] #app .mm-menu kbd { background: var(--surface2); color: var(--text3); }
html[data-pluga-theme="dark"] #app .mm-export-icon { background: var(--blue-bg); color: #c7d5ff; }


/* Linhas e cartões gerados com estilos inline nas telas administrativas */
html[data-pluga-theme="dark"] #app [style*="background:#fff"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="background: #fff"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="background:#f9fafb"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="background:#f7f8fa"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="background:#f5f7fa"]:not(.mm-editor *) {
  background: var(--surface) !important;
}
html[data-pluga-theme="dark"] #app [style*="border:1px solid #e5e7eb"],
html[data-pluga-theme="dark"] #app [style*="border: 1px solid #e5e7eb"] { border-color: var(--border2) !important; }
html[data-pluga-theme="dark"] #app [style*="color:#666"],
html[data-pluga-theme="dark"] #app [style*="color: #666"],
html[data-pluga-theme="dark"] #app [style*="color:#888"],
html[data-pluga-theme="dark"] #app [style*="color:#aaa"] { color: var(--text2) !important; }

/* Transição curta, desativada para quem prefere menos movimento. */
body,
#app,
.login-card,
.app-sidebar,
.panel,
.kpi-card,
.modal,
input,
select,
textarea {
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

@media (max-width: 720px) {
  .theme-toggle-label { display: none; }
  .theme-toggle { width: 34px; padding-inline: 0; }
  .theme-toggle-login { right: 12px; top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  body,#app,.login-card,.app-sidebar,.panel,.kpi-card,.modal,input,select,textarea { transition: none; }
}

/* Elementos de controle que precisam manter contraste próprio. */
html[data-pluga-theme="dark"] #rec-thumb { background: #fff !important; }


/* ═════════════════════ AUDITORIA GLOBAL DE CONTRASTE v5.54.2 ═════════════════════
   Revisão integral dos componentes administrativos que ainda herdavam cores fixas
   do tema claro. Rotas públicas continuam forçadas no tema claro pelo theme.js. */

/* Hierarquia tipográfica compartilhada */
html[data-pluga-theme="dark"] #app :is(
  .apl-card-title,.apl-status-left strong,.apl-service h3,.apl-switch-row strong,.apl-test-day strong,
  .btw-title,.btw-person,.btw-panel-title,.btw-empty-title,.btw-score-line strong,.btw-research-card strong,
  .mm-library-title,.mm-map-name,.mm-empty strong,.mm-title-input,.mm-pop-title,.mm-template-section-title,
  .mm-template-card strong,.mm-search-result strong,.mm-export-option strong,.mm-menu button,
  .pe-card-title,.pe-section-title,.pe-stat-value,.pe-company-name,.pe-company-focus-value,.pe-pillar-name,
  .pe-score,.pe-summary-item strong,.pe-cycle-name,.pe-gap-title,.pe-swot-title,.pe-kpi-name,.pe-kpi-value strong,
  .pe-week-title,.pe-direction-text,.pe-direction-meta-item strong,.pe-dialog-title,.pe-empty-title,.pe-event-title,
  .pe-note-content h2,.pe-note-content h3,.pe-note-editor h2,.pe-note-editor h3,.pe-notebook-title,.pe-note-date,
  .vm-person-name,.vm-card-title,.vm-category-name,.vm-report-card h4,.vm-coherence-title,.vm-coherence-count strong,
  .tm-title,.tm-dialog-title,.tm-report-title,.tm-block-title,.tm-settings-section-title,.tm-menu-name
) { color: var(--text); }

html[data-pluga-theme="dark"] #app :is(
  .apl-card-sub,.apl-status-left small,.apl-service p,.apl-service-meta span,.apl-service-handle,.apl-service-order,
  .apl-field label,.apl-help,.apl-switch-row small,.apl-range span,.apl-test-day small,.apl-no-slots,
  .btw-kicker,.btw-meta,.btw-panel-sub,.btw-sub,.btw-kpi-label,.btw-kpi-value span,.btw-table th,
  .mm-library-sub,.mm-map-meta,.mm-card-foot,.mm-empty,.mm-save-state,.mm-zoom-label,.mm-pop-close,.mm-tab,
  .mm-reset-style,.mm-field label,.mm-check,.mm-comment-head,.mm-outline-toggle,.mm-template-section-sub,
  .mm-template-card p,.mm-template-card-category,.mm-appearance-label,.mm-search-result span,.mm-export-option small,
  .pe-card-sub,.pe-section-sub,.pe-stat-label,.pe-company-meta,.pe-company-focus-label,.pe-cycle-meta,.pe-gap-meta,
  .pe-pillar-note,.pe-kpi-meta,.pe-week-text,.pe-direction-label,.pe-direction-meta,.pe-event-text,.pe-note-updated,
  .vm-kicker,.vm-person-meta,.vm-person-summary,.vm-card-sub,.vm-coherence-text,.vm-coherence-count span,
  .tm-subtitle,.tm-filter-count,.tm-settings-section-sub,.tm-menu-meta,.tm-menu-label,.tm-picker-label,.tm-side-label
) { color: var(--text3); }

/* Agenda Pluga administrativa */
html[data-pluga-theme="dark"] #app .apl-shell { color: var(--text); }
html[data-pluga-theme="dark"] #app .apl-tab { color: #b9c5d5; }
html[data-pluga-theme="dark"] #app .apl-tab.active { background: #263d78; color: #f5f8ff; }
html[data-pluga-theme="dark"] #app .apl-card-title { color: #f4f7fb; }
html[data-pluga-theme="dark"] #app .apl-metric small { color: #b8c5d7; }
html[data-pluga-theme="dark"] #app .apl-metric strong { color: #9eb7ff; }
html[data-pluga-theme="dark"] #app .apl-metric span { color: #aebbd0; }
html[data-pluga-theme="dark"] #app .apl-status-left strong,
html[data-pluga-theme="dark"] #app .apl-service h3 { color: #edf3fb; }
html[data-pluga-theme="dark"] #app .apl-overview-link .apl-status-row { background: transparent; }
html[data-pluga-theme="dark"] #app .apl-field input,
html[data-pluga-theme="dark"] #app .apl-field select,
html[data-pluga-theme="dark"] #app .apl-field textarea,
html[data-pluga-theme="dark"] #app .apl-range input { background:#172235; color:#f3f7fb; border-color:#405069; }
html[data-pluga-theme="dark"] #app .apl-switch-row { border-color:var(--border2); background:#151f30; }
html[data-pluga-theme="dark"] #app .apl-test-head { border-color:var(--border); }
html[data-pluga-theme="dark"] #app .apl-test-day { border-color:var(--border); }
html[data-pluga-theme="dark"] #app .apl-reservation { color:var(--text2); border-color:var(--border); background:var(--surface); }
html[data-pluga-theme="dark"] #app .apl-reservation-date { color:#b9caff; }

/* Anamnese Breathwork administrativa */
html[data-pluga-theme="dark"] #app .btw-title { color:#f5f8fc; }
html[data-pluga-theme="dark"] #app .btw-person { color:#edf3fa; }
html[data-pluga-theme="dark"] #app .btw-stat strong,
html[data-pluga-theme="dark"] #app .btw-score-line strong,
html[data-pluga-theme="dark"] #app .btw-research-card strong { color:#f4f7fb; }
html[data-pluga-theme="dark"] #app .btw-card:hover { border-color:#536887; box-shadow:0 8px 22px rgba(0,0,0,.30); }
html[data-pluga-theme="dark"] #app .btw-table td { color:var(--text2); }
html[data-pluga-theme="dark"] #app .btw-safety-ok { color:#75e3ad; }
html[data-pluga-theme="dark"] #app .btw-empty p { color:var(--text3); }

/* Mapas Mentais, biblioteca e ferramentas. O conteúdo dos nós preserva suas cores próprias. */
html[data-pluga-theme="dark"] #app .mm-library { background:#101827; color:var(--text); }
html[data-pluga-theme="dark"] #app .mm-library-title { color:#f5f8fc; }
html[data-pluga-theme="dark"] #app .mm-list-head { background:#18243a; color:#b9c6d8; border-color:#35445b; }
html[data-pluga-theme="dark"] #app .mm-list-row { color:var(--text2); border-color:#2d3b50; }
html[data-pluga-theme="dark"] #app .mm-list-row:hover { background:#1a293e; }
html[data-pluga-theme="dark"] #app .mm-map-name { color:#e9eff7; }
html[data-pluga-theme="dark"] #app .mm-map-name:hover { color:#9ec5ff; }
html[data-pluga-theme="dark"] #app .mm-map-meta { color:#aebbd0; }
html[data-pluga-theme="dark"] #app .mm-card-title { color:#eef3f9; }
html[data-pluga-theme="dark"] #app .mm-title-input { color:#f3f7fb; }
html[data-pluga-theme="dark"] #app .mm-template-section-title,
html[data-pluga-theme="dark"] #app .mm-pop-title { color:#f3f7fb; }
html[data-pluga-theme="dark"] #app .mm-template-card strong,
html[data-pluga-theme="dark"] #app .mm-search-result strong,
html[data-pluga-theme="dark"] #app .mm-export-option strong { color:#eaf0f7; }
html[data-pluga-theme="dark"] #app .mm-menu button { color:#d9e3ef; }
html[data-pluga-theme="dark"] #app .mm-search-head input { background:#172235; color:var(--text); border-color:#405069; }
html[data-pluga-theme="dark"] #app .mm-outline-toggle { color:#aebbd0; }

/* Planejamento Estratégico */
html[data-pluga-theme="dark"] #app .pe-highlight-kicker { color:#aebee8; }
html[data-pluga-theme="dark"] #app .pe-highlight-title { color:#dbe5ff; }
html[data-pluga-theme="dark"] #app .pe-week-date,
html[data-pluga-theme="dark"] #app .pe-notebook-title,
html[data-pluga-theme="dark"] #app .pe-note-date { color:#a9beff; }
html[data-pluga-theme="dark"] #app .pe-note-editor h2,
html[data-pluga-theme="dark"] #app .pe-note-content h2 { color:#c6d4ff; }
html[data-pluga-theme="dark"] #app .pe-note-editor h3,
html[data-pluga-theme="dark"] #app .pe-note-content h3 { color:#b8c9ee; }
html[data-pluga-theme="dark"] #app .pe-note-editor a,
html[data-pluga-theme="dark"] #app .pe-note-content a { color:#91b6ff; }
html[data-pluga-theme="dark"] #app .pe-direction-block.primary .pe-direction-text { color:#d7e2ff; }
html[data-pluga-theme="dark"] #app .pe-import-note,
html[data-pluga-theme="dark"] #app .pe-note-editing { color:#c7d6ff; }
html[data-pluga-theme="dark"] #app .pe-danger-zone p { color:#ffaaaa; }
html[data-pluga-theme="dark"] #app .pe-action-handle { color:#a8b5c6; }
html[data-pluga-theme="dark"] #app .pe-share-url { background:#172235; color:#d9e5ff; border-color:#405069; }

/* Vida em Movimento */
html[data-pluga-theme="dark"] #app .vm-kicker { color:#aab8ca; }
html[data-pluga-theme="dark"] #app .vm-insight span { color:#aebee8; }
html[data-pluga-theme="dark"] #app .vm-insight strong { color:#eef3f9; }
html[data-pluga-theme="dark"] #app .vm-coherence-title { color:#d8cbff; }
html[data-pluga-theme="dark"] #app .vm-coherence-text { color:#c0b8d0; }
html[data-pluga-theme="dark"] #app .vm-coherence-count { background:rgba(255,255,255,.045); border-color:#4a4260; }
html[data-pluga-theme="dark"] #app .vm-coherence-count span { color:#b8add0; }
html[data-pluga-theme="dark"] #app .vm-coherence-count strong { color:#eee8f7; }
html[data-pluga-theme="dark"] #app .vm-report-card.expand h4 { color:#7fe0a4; }
html[data-pluga-theme="dark"] #app .vm-report-card.stable h4 { color:#f2cf7a; }
html[data-pluga-theme="dark"] #app .vm-report-card.contract h4 { color:#ff9d9d; }

/* Financeiro e componentes genéricos com cores semânticas muito escuras */
html[data-pluga-theme="dark"] #app .kpi-value.amber,
html[data-pluga-theme="dark"] #app .forecast-card.amber .forecast-sub { color:#f7c66b; }
html[data-pluga-theme="dark"] #app .kpi-value.red,
html[data-pluga-theme="dark"] #app .dre-table .dre-negative { color:#ff9292; }
html[data-pluga-theme="dark"] #app .kpi-value.teal,
html[data-pluga-theme="dark"] #app .forecast-card.teal .forecast-sub { color:#64dccb; }
html[data-pluga-theme="dark"] #app .dre-table .dre-positive { color:#68d99d; }
html[data-pluga-theme="dark"] #app .dre-table .dre-subtotal { background:#1d2b44; color:#d7e2ff; }
html[data-pluga-theme="dark"] #app .nfse-alerta-info { color:#c6d7ff; }

/* Cores inline herdadas de telas antigas */
html[data-pluga-theme="dark"] #app [style*="color:#1A2766"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="color: #1A2766"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="color:#172033"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="color:#202a3b"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="color:#253044"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="color:#273044"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="color:#13213b"]:not(.mm-editor *) { color:var(--text) !important; }
html[data-pluga-theme="dark"] #app [style*="background:#eef2ff"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="background: #eef2ff"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="background:#eff6ff"]:not(.mm-editor *),
html[data-pluga-theme="dark"] #app [style*="background:#f0fdf4"]:not(.mm-editor *) { background:var(--surface2) !important; }


/* Fechamento da auditoria: componentes antigos com cor própria em elementos filhos. */
html[data-pluga-theme="dark"] #app .dre-table .dre-section { color: var(--text); }
html[data-pluga-theme="dark"] #app .vm-manifesto strong { color: #eef3fb; }
html[data-pluga-theme="dark"] #app .vm-manifesto span { color: #c1ccda; }
html[data-pluga-theme="dark"] #app .vm-coherence-score strong { color: #f1ecff; }
html[data-pluga-theme="dark"] #app .vm-coherence-score span { color: #b9add8; }
html[data-pluga-theme="dark"] #app .apl-saving-card small { color: var(--text3); }


/* ═══════════════════ MAPAS MENTAIS · ÁREA DE EDIÇÃO CLARA v5.54.3 ═══════════════════
   O editor visual permanece em tema claro mesmo quando o painel administrativo está
   no modo escuro. Isso preserva as cores próprias dos tópicos, conexões e temas do mapa. */
html[data-pluga-theme="dark"] #app .mm-editor {
  color-scheme: light;
  background: #fff !important;
  color: #182033;
}
html[data-pluga-theme="dark"] #app .mm-editor .mm-canvas {
  background-color: #fff !important;
  background-image: radial-gradient(#e4e8ee .85px, transparent .85px) !important;
  background-size: 24px 24px !important;
  box-shadow: inset 0 0 0 1px #edf0f4;
}
html[data-pluga-theme="dark"] #app .mm-editor :is(
  .mm-floating-bar,.mm-zoom-bar,.mm-select-toolbar,.mm-popover,.mm-outline-panel,
  .mm-search-panel,.mm-search-result,.mm-menu,.mm-focus-exit
) {
  background: rgba(255,255,255,.97) !important;
  color: #283144 !important;
  border-color: #dfe4eb !important;
}
html[data-pluga-theme="dark"] #app .mm-editor :is(.mm-title-input,.mm-search-head input,.mm-field input,.mm-field textarea,.mm-field select) {
  background: #fff !important;
  color: #283144 !important;
  border-color: #dfe4eb !important;
  -webkit-text-fill-color: #283144;
}
html[data-pluga-theme="dark"] #app .mm-editor .mm-title-input {
  background: transparent !important;
  color: #252d3e !important;
  -webkit-text-fill-color: #252d3e;
}
html[data-pluga-theme="dark"] #app .mm-editor :is(.mm-back,.mm-tool,.mm-row-action,.mm-filter-chip,.mm-template-category) {
  color: #485264 !important;
}
html[data-pluga-theme="dark"] #app .mm-editor :is(.mm-back:hover,.mm-tool:hover,.mm-row-action:hover,.mm-filter-chip:hover,.mm-template-category:hover) {
  background: #eff3f8 !important;
  color: #182033 !important;
}
html[data-pluga-theme="dark"] #app .mm-editor :is(.mm-tool.active,.mm-filter-chip.active,.mm-template-category.active,.mm-shape.active) {
  background: #e4f3ff !important;
  color: #067bc5 !important;
  border-color: #50b4f4 !important;
}
html[data-pluga-theme="dark"] #app .mm-editor :is(.mm-save-state,.mm-zoom-label,.mm-pop-close,.mm-tab,.mm-field label,.mm-comment-head,.mm-outline-toggle,.mm-search-result span) {
  color: #7c8798 !important;
}
html[data-pluga-theme="dark"] #app .mm-editor :is(.mm-pop-title,.mm-search-result strong,.mm-menu button) {
  color: #252d3e !important;
}
html[data-pluga-theme="dark"] #app .mm-editor .mm-tool-sep,
html[data-pluga-theme="dark"] #app .mm-editor .mm-zoom-sep { background: #e5e9ef !important; }
html[data-pluga-theme="dark"] #app .mm-editor .mm-outline-row:hover,
html[data-pluga-theme="dark"] #app .mm-editor .mm-search-result:hover,
html[data-pluga-theme="dark"] #app .mm-editor .mm-menu button:hover { background: #edf5fd !important; }
html[data-pluga-theme="dark"] #app .mm-editor .mm-collapse {
  background: #fff !important;
  box-shadow: 0 0 0 3px #fff !important;
}
