/* ==========================================================================
   PERFEX CRM - MODERN DARK THEME
   ARQUIVO: contrast_leads_sales.css
   GRUPO: Leads, Propostas, Estimativas, Contratos, Assinaturas e CRM Kanban
   
   CORES PADRÃO DEFINIDAS:
     - Texto Primário (Alto Contraste): #f1f5f9
     - Texto Secundário (Tabelas/Paineis/Detalhes): #e5e7eb
     - Texto Suave / Metadados / Inativos: #cbd5e1
     - Links Padrão: #bfdbfe
     - Links Hover: #ffffff
     - Preservação estrita: badges, botões, switches, inputs e labels coloridas
   ========================================================================== */

/* ==========================================================================
   1. TABELAS DE LISTAGEM (LEADS, PROPOSTAS, ESTIMATIVAS, CONTRATOS, ASSINATURAS)
   ========================================================================== */

/* Cabeçalhos de Tabelas com Alto Contraste */
body.dark-theme .table-leads > thead > tr > th,
body.dark-theme .table-proposals > thead > tr > th,
body.dark-theme .table-estimates > thead > tr > th,
body.dark-theme .table-contracts > thead > tr > th,
body.dark-theme .table-subscriptions > thead > tr > th,
body.dark-theme .table-proposals-lead > thead > tr > th,
body.dark-theme .table-rel-tasks-leads > thead > tr > th,
body.dark-theme .table-reminders-leads > thead > tr > th,
body.dark-theme .table-reminders > thead > tr > th,
body.dark-theme .crm-overview-table > thead > tr > th {
    color: #f1f5f9 !important;
    font-weight: 600;
}

/* Células das Tabelas */
body.dark-theme .table-leads > tbody > tr > td,
body.dark-theme .table-proposals > tbody > tr > td,
body.dark-theme .table-estimates > tbody > tr > td,
body.dark-theme .table-contracts > tbody > tr > td,
body.dark-theme .table-subscriptions > tbody > tr > td,
body.dark-theme .table-proposals-lead > tbody > tr > td,
body.dark-theme .table-rel-tasks-leads > tbody > tr > td,
body.dark-theme .table-reminders-leads > tbody > tr > td,
body.dark-theme .table-reminders > tbody > tr > td,
body.dark-theme .crm-overview-table > tbody > tr > td {
    color: #f1f5f9 !important;
}

/* Links em Tabelas (preservando botões, badges e labels) */
body.dark-theme .table-leads > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .table-proposals > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .table-estimates > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .table-contracts > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .table-subscriptions > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .table-proposals-lead > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .table-rel-tasks-leads > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .table-reminders-leads > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .table-reminders > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]),
body.dark-theme .crm-overview-table > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]) {
    color: #bfdbfe !important;
}

body.dark-theme .table-leads > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .table-proposals > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .table-estimates > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .table-contracts > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .table-subscriptions > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .table-proposals-lead > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .table-rel-tasks-leads > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .table-reminders-leads > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .table-reminders > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover,
body.dark-theme .crm-overview-table > tbody > tr > td a:not(.btn):not(.label):not(.badge):not([class*="tag"]):hover {
    color: #ffffff !important;
    text-decoration: underline;
}

/* Textos secundários, subtítulos e text-muted em tabelas */
body.dark-theme .table-leads td .text-muted,
body.dark-theme .table-proposals td .text-muted,
body.dark-theme .table-estimates td .text-muted,
body.dark-theme .table-contracts td .text-muted,
body.dark-theme .table-subscriptions td .text-muted,
body.dark-theme .table-leads td small,
body.dark-theme .table-proposals td small,
body.dark-theme .table-estimates td small,
body.dark-theme .table-contracts td small,
body.dark-theme .table-subscriptions td small,
body.dark-theme .crm-overview-table td small {
    color: #cbd5e1 !important;
}

/* Controles de DataTables (Info, Length, Filter) nas telas do grupo */
body.dark-theme.leads .dataTables_info,
body.dark-theme.leads .dataTables_length,
body.dark-theme.leads .dataTables_filter,
body.dark-theme.proposals .dataTables_info,
body.dark-theme.proposals .dataTables_length,
body.dark-theme.proposals .dataTables_filter,
body.dark-theme.estimates .dataTables_info,
body.dark-theme.estimates .dataTables_length,
body.dark-theme.estimates .dataTables_filter,
body.dark-theme.contracts .dataTables_info,
body.dark-theme.contracts .dataTables_length,
body.dark-theme.contracts .dataTables_filter,
body.dark-theme.subscriptions .dataTables_info,
body.dark-theme.subscriptions .dataTables_length,
body.dark-theme.subscriptions .dataTables_filter {
    color: #e5e7eb !important;
}

/* ==========================================================================
   2. LEADS: VISÃO GERAL, SUMÁRIO E FILTROS
   ========================================================================== */

body.dark-theme .leads-overview h4 {
    color: #f1f5f9 !important;
}

body.dark-theme .leads-overview button {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
    color: #e5e7eb !important;
}

body.dark-theme .leads-overview button:hover,
body.dark-theme .leads-overview button:focus {
    background-color: #243049 !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

body.dark-theme .leads-overview button span:first-child {
    color: #f1f5f9 !important;
}

/* Modal de ações em massa (Bulk Actions) de Leads */
body.dark-theme #leads_bulk_actions .modal-title {
    color: #f8fafc !important;
}

body.dark-theme #leads_bulk_actions label {
    color: #e5e7eb !important;
}

/* ==========================================================================
   3. KANBAN NATIVO DE LEADS (.leads-kan-ban)
   ========================================================================== */

/* Barra de ordenação do Kanban */
body.dark-theme .kanban-leads-sort {
    color: #cbd5e1 !important;
}

body.dark-theme .kanban-leads-sort span.bold {
    color: #f1f5f9 !important;
}

body.dark-theme .kanban-leads-sort a {
    color: #bfdbfe !important;
}

body.dark-theme .kanban-leads-sort a:hover {
    color: #ffffff !important;
}

/* Cabeçalho da coluna no Kanban nativo */
body.dark-theme .leads-kan-ban .kan-ban-col .panel-heading {
    color: #ffffff !important;
}

body.dark-theme .leads-kan-ban .kan-ban-col .panel-heading small {
    color: #cbd5e1 !important;
}

/* Card individual do Kanban de Leads */
body.dark-theme li.lead-kan-ban {
    background: #1a2333 !important;
    border: 1px solid #2d3b55 !important;
    color: #e5e7eb !important;
}

body.dark-theme li.lead-kan-ban:hover {
    background: #202d44 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

body.dark-theme li.lead-kan-ban .lead-name a,
body.dark-theme li.lead-kan-ban .lead-name span {
    color: #f1f5f9 !important;
    font-weight: 600;
}

body.dark-theme li.lead-kan-ban .lead-name a:hover {
    color: #bfdbfe !important;
}

body.dark-theme li.lead-kan-ban .lead-body p.tw-text-sm {
    color: #e5e7eb !important;
}

body.dark-theme li.lead-kan-ban small.text-dark {
    color: #cbd5e1 !important;
}

body.dark-theme li.lead-kan-ban small.text-dark .bold,
body.dark-theme li.lead-kan-ban .text-has-action {
    color: #f1f5f9 !important;
}

body.dark-theme li.lead-kan-ban .inline-block.text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme li.lead-kan-ban .inline-block.text-muted:hover {
    color: #f1f5f9 !important;
}

body.dark-theme li.lead-kan-ban .kan-ban-expand-top {
    color: #bfdbfe !important;
}

body.dark-theme li.lead-kan-ban .lead-field-heading {
    color: #cbd5e1 !important;
}

body.dark-theme li.lead-kan-ban p.bold.tw-text-sm {
    color: #f1f5f9 !important;
}

body.dark-theme li.lead-kan-ban p.bold.tw-text-sm a {
    color: #bfdbfe !important;
}

body.dark-theme li.lead-kan-ban p.bold.tw-text-sm a:hover {
    color: #ffffff !important;
}

body.dark-theme .leads-kan-ban .kanban-empty h4 {
    color: #cbd5e1 !important;
}

/* ==========================================================================
   4. MODAL DE LEAD & PERFIL COMPLETO (lead.php / profile.php)
   ========================================================================== */

body.dark-theme #lead-modal .modal-title,
body.dark-theme .lead-modal .modal-title {
    color: #f8fafc !important;
}

body.dark-theme .lead-print-btn {
    color: #bfdbfe !important;
}

body.dark-theme .lead-print-btn:hover {
    color: #ffffff !important;
}

/* Banner de seleção de etapa do Kanban no topo do modal de lead */
body.dark-theme .crm-kanban-lead-modal-banners .crm-kanban-modal-top-bar {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
}

body.dark-theme .crm-kanban-lead-modal-banners .crm-kanban-modal-top-bar span.tw-text-indigo-950 {
    color: #f1f5f9 !important;
}

body.dark-theme .crm-kanban-lead-modal-banners .crm-kanban-modal-top-bar span.text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-kanban-lead-stage-select {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

/* Informações e campos do Perfil do Lead */
body.dark-theme .lead-information-col .lead-info-heading h4 {
    color: #f8fafc !important;
}

body.dark-theme .lead-information-col dt.lead-field-heading {
    color: #cbd5e1 !important;
    font-weight: 500;
}

body.dark-theme .lead-information-col dd,
body.dark-theme .lead-information-col dd.tw-text-neutral-900,
body.dark-theme .lead-information-col dd.lead-name {
    color: #f1f5f9 !important;
}

body.dark-theme .lead-information-col dd a:not(.btn):not(.label):not(.badge) {
    color: #bfdbfe !important;
}

body.dark-theme .lead-information-col dd a:not(.btn):not(.label):not(.badge):hover {
    color: #ffffff !important;
}

body.dark-theme .lead-information-col dd .text-has-action {
    color: #f1f5f9 !important;
}

/* Abas de navegação no modal de lead */
body.dark-theme .top-lead-menu .nav-tabs > li > a {
    color: #cbd5e1 !important;
}

body.dark-theme .top-lead-menu .nav-tabs > li > a:hover {
    color: #ffffff !important;
    background-color: #1e293b !important;
}

body.dark-theme .top-lead-menu .nav-tabs > li.active > a {
    color: #38bdf8 !important;
    background-color: #151c2c !important;
}

/* Atividades de E-mail do Lead */
body.dark-theme .lead-email-activity .lead-mail-activity-subject {
    color: #f1f5f9 !important;
}

body.dark-theme .lead-email-activity .lead-mail-activity-subject small.text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme .lead-email-activity .lead-mail-activity-body {
    color: #e5e7eb !important;
}

/* Activity Feed do Lead */
body.dark-theme .activity-feed .feed-item .date {
    color: #cbd5e1 !important;
}

body.dark-theme .activity-feed .feed-item .text {
    color: #e5e7eb !important;
}

body.dark-theme .activity-feed .feed-item .text a {
    color: #bfdbfe !important;
}

body.dark-theme .activity-feed .feed-item .text a:hover {
    color: #ffffff !important;
}

/* Mais opções / dropdown no topo do Lead */
body.dark-theme #lead-more-btn .dropdown-menu > li > a {
    color: #f1f5f9 !important;
}

body.dark-theme #lead-more-btn .dropdown-menu > li > a:hover {
    color: #ffffff !important;
    background-color: #334155 !important;
}

/* ==========================================================================
   5. MÓDULO CRM KANBAN (QUADRO, COLUNAS, CARDS, MODAIS E WORKSPACE)
   ========================================================================== */

/* Cabeçalho da coluna no CRM Kanban */
body.dark-theme .crm-kanban-column-header strong {
    color: #ffffff !important;
    font-weight: 700;
}

body.dark-theme .crm-kanban-column-header small {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-kanban-empty {
    color: #cbd5e1 !important;
    border-color: #243049 !important;
}

body.dark-theme .crm-kanban-load-more {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-theme .crm-kanban-load-more:hover {
    background-color: #243049 !important;
    color: #ffffff !important;
}

/* Card no CRM Kanban */
body.dark-theme .crm-kanban-card {
    background: #1a2333 !important;
    border-color: #2d3b55 !important;
    color: #f1f5f9 !important;
}

body.dark-theme .crm-kanban-card:hover {
    background: #202d44 !important;
    border-color: #3b82f6 !important;
}

body.dark-theme .crm-kanban-card a.tw-font-semibold,
body.dark-theme .crm-kanban-card a.tw-text-neutral-900,
body.dark-theme .crm-kanban-card .tw-font-semibold {
    color: #f1f5f9 !important;
}

body.dark-theme .crm-kanban-card a.tw-font-semibold:hover,
body.dark-theme .crm-kanban-card a.tw-text-neutral-900:hover {
    color: #ffffff !important;
}

body.dark-theme .crm-kanban-card a:not(.btn):not(.label):not(.badge):not([href*="whatsapp"]) {
    color: #bfdbfe !important;
}

body.dark-theme .crm-kanban-card a:not(.btn):not(.label):not(.badge):not([href*="whatsapp"]):hover {
    color: #ffffff !important;
}

body.dark-theme .crm-kanban-card .text-muted,
body.dark-theme .crm-kanban-card .tw-text-xs {
    color: #e5e7eb !important;
}

body.dark-theme .crm-kanban-card .text-muted i,
body.dark-theme .crm-kanban-card .tw-text-xs i {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-kanban-card [class*="tw-text-neutral"] {
    color: #e5e7eb !important;
}

body.dark-theme .crm-kanban-card .font-bold.text-neutral-700,
body.dark-theme .crm-kanban-card [id^="timer_display"] {
    color: #f1f5f9 !important;
}

body.dark-theme .crm-kanban-stage-selector-wrap span.text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-kanban-stage-combo {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-theme .crm-kanban-card .btn-default {
    background-color: #243049 !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

body.dark-theme .crm-kanban-card .btn-default:hover {
    background-color: #2d3b55 !important;
    color: #ffffff !important;
}

/* Bloco de Última Conversa no WhatsApp no card do Kanban */
body.dark-theme .crm-kanban-card a[href*="whatsapp_ai_bot"] {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #86efac !important;
    border: 1px solid rgba(16, 185, 129, 0.25) !important;
}

body.dark-theme .crm-kanban-card a[href*="whatsapp_ai_bot"]:hover {
    background-color: rgba(16, 185, 129, 0.25) !important;
    color: #ffffff !important;
}

/* Modal Ágil de Demanda: Subtarefas, Checklist e Anexos (#tasksModal) */
body.dark-theme #tasksModal .modal-body {
    background-color: #151c2c !important;
    color: #f1f5f9 !important;
}

body.dark-theme #tasksModal .modal-body .tw-bg-white,
body.dark-theme #tasksModal .modal-body .tw-bg-slate-50,
body.dark-theme #tasksModal .modal-body .tw-bg-slate-100 {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
    color: #f1f5f9 !important;
}

body.dark-theme #tasksModal .tw-text-slate-800,
body.dark-theme #tasksModal .tw-text-slate-700,
body.dark-theme #tasksModal #task_modal_lead_name {
    color: #f1f5f9 !important;
}

body.dark-theme #tasksModal .tw-text-slate-600 {
    color: #cbd5e1 !important;
}

body.dark-theme #tasksModal kbd {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

body.dark-theme #tasksModal #task_modal_stage_id,
body.dark-theme #tasksModal #new_task_priority,
body.dark-theme #tasksModal #new_task_name {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-theme #tasksModal #new_task_name::placeholder {
    color: #cbd5e1 !important;
}

body.dark-theme #tasksModal .subtask-item {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
    color: #f1f5f9 !important;
}

body.dark-theme #tasksModal .subtask-done {
    background-color: #141c2c !important;
    color: #cbd5e1 !important;
}

body.dark-theme #tasksModal .subtask-item .tw-text-slate-700 {
    color: #f1f5f9 !important;
}

body.dark-theme #tasksModal .subtask-item .text-muted {
    color: #cbd5e1 !important;
}

/* Modal SDR IA (#sdrModal) */
body.dark-theme #sdrModal .modal-content {
    background-color: #151c2c !important;
    border-color: #2d3b55 !important;
    color: #f1f5f9 !important;
}

body.dark-theme #sdrModal #sdr_lead_title {
    color: #f8fafc !important;
}

body.dark-theme #sdrModal #sdr_result_box {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
    color: #f1f5f9 !important;
}

body.dark-theme #sdrModal #sdr_summary {
    color: #e5e7eb !important;
}

/* Drawer / Workspace Lateral do Lead (#crm-lead-workspace) */
body.dark-theme .crm-lead-workspace__panel {
    background: #151c2c !important;
    color: #f1f5f9 !important;
}

body.dark-theme .crm-lead-workspace__eyebrow {
    color: #93c5fd !important;
}

body.dark-theme .crm-lead-workspace__title {
    color: #f8fafc !important;
}

body.dark-theme .crm-lead-workspace__subtitle {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-lead-workspace__close {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-lead-workspace__close:hover {
    color: #ffffff !important;
}

body.dark-theme .crm-lead-workspace__section h3 {
    color: #f1f5f9 !important;
}

body.dark-theme .crm-lead-workspace__fact {
    background: #1a2333 !important;
    border-color: #2d3b55 !important;
}

body.dark-theme .crm-lead-workspace__fact dt {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-lead-workspace__fact dd {
    color: #f8fafc !important;
}

body.dark-theme .crm-lead-workspace__score-reason {
    color: #e5e7eb !important;
}

body.dark-theme .crm-lead-workspace__next-card {
    background: #1a2333 !important;
    border-color: #2d3b55 !important;
}

body.dark-theme .crm-lead-workspace__next-card strong {
    color: #f8fafc !important;
}

body.dark-theme .crm-lead-workspace__next-card span {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-lead-workspace__timeline:before {
    background: #334155 !important;
}

body.dark-theme .crm-lead-workspace__timeline-heading strong {
    color: #f8fafc !important;
}

body.dark-theme .crm-lead-workspace__timeline-heading time {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-lead-workspace__timeline-meta {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-lead-workspace__timeline-body {
    color: #e5e7eb !important;
}

body.dark-theme .crm-lead-workspace__empty {
    color: #cbd5e1 !important;
}

/* Visão Geral (Overview) do CRM */
body.dark-theme .crm-overview .crm-overview-kpi {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
}

body.dark-theme .crm-overview .crm-overview-kpi-label {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-overview .crm-overview-kpi-value {
    color: #f8fafc !important;
}

body.dark-theme .crm-overview .crm-overview-meta {
    color: #cbd5e1 !important;
}

/* Playbooks e Configuração de Pipelines */
body.dark-theme .crm-playbooks-page .crm-playbook-step {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
}

body.dark-theme .crm-playbooks-page .crm-playbook-step .step-number {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-playbooks-page .crm-playbook-step label {
    color: #cbd5e1 !important;
}

body.dark-theme .stage-card {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
    color: #f1f5f9 !important;
}

body.dark-theme .stage-card.is-inactive {
    background-color: #141c2c !important;
    border-color: #243049 !important;
    color: #cbd5e1 !important;
}

/* ==========================================================================
   6. PROPOSTAS (PROPOSALS: PIPELINE, PREVIEW, ITENS E COMENTÁRIOS)
   ========================================================================== */

/* Pipeline Kanban de Propostas */
body.dark-theme li[data-proposal-id] .panel-body {
    background: #1a2333 !important;
    border: 1px solid #2d3b55 !important;
}

body.dark-theme li[data-proposal-id]:hover .panel-body {
    background: #202d44 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

body.dark-theme li[data-proposal-id] .pipeline-heading a {
    color: #f1f5f9 !important;
    font-weight: 600;
}

body.dark-theme li[data-proposal-id] .pipeline-heading a:hover {
    color: #ffffff !important;
}

body.dark-theme li[data-proposal-id] a.tw-font-medium,
body.dark-theme li[data-proposal-id] a.tw-text-neutral-700 {
    color: #bfdbfe !important;
}

body.dark-theme li[data-proposal-id] a.tw-font-medium:hover,
body.dark-theme li[data-proposal-id] a.tw-text-neutral-700:hover {
    color: #ffffff !important;
}

body.dark-theme li[data-proposal-id] p.tw-text-neutral-700 {
    color: #e5e7eb !important;
}

body.dark-theme li[data-proposal-id] span.tw-text-neutral-500 {
    color: #cbd5e1 !important;
}

body.dark-theme li[data-proposal-id] small {
    color: #cbd5e1 !important;
}

/* Preview de Propostas (#proposal e proposals_preview_template.php) */
body.dark-theme #proposal #proposal-number,
body.dark-theme .proposal-preview #proposal-number {
    color: #f1f5f9 !important;
}

body.dark-theme #proposal h4.bold,
body.dark-theme #proposal h5.bold {
    color: #f8fafc !important;
}

body.dark-theme #proposal address.tw-text-neutral-500,
body.dark-theme .proposal-preview address.tw-text-neutral-500 {
    color: #e5e7eb !important;
}

body.dark-theme #proposal address span.tw-text-neutral-700,
body.dark-theme .proposal-preview address span.tw-text-neutral-700 {
    color: #f1f5f9 !important;
}

body.dark-theme #proposal a:not(.btn):not(.label):not(.badge) {
    color: #bfdbfe !important;
}

body.dark-theme #proposal a:not(.btn):not(.label):not(.badge):hover {
    color: #ffffff !important;
}

/* Comentários da Proposta */
body.dark-theme #proposal .comment-item .media-body a {
    color: #bfdbfe !important;
}

body.dark-theme #proposal .comment-item .media-body a:hover {
    color: #ffffff !important;
}

body.dark-theme #proposal .comment-item small.text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme #proposal div[data-proposal-comment] {
    color: #f1f5f9 !important;
}

/* Formulário de Criação/Edição de Propostas */
body.dark-theme .proposal-form h4.tw-text-neutral-700 {
    color: #f8fafc !important;
}

body.dark-theme .proposal-form label.control-label {
    color: #e5e7eb !important;
}

/* ==========================================================================
   7. ESTIMATIVAS (ESTIMATES: QUICK STATS, PIPELINE, PREVIEW E ITENS)
   ========================================================================== */

/* Quick Top Stats nas Estimativas */
body.dark-theme .quick-top-stats button.tw-bg-white {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
    color: #e5e7eb !important;
}

body.dark-theme .quick-top-stats button.tw-bg-white:hover {
    background-color: #243049 !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

body.dark-theme .quick-top-stats button .tw-text-neutral-600 {
    color: #e5e7eb !important;
}

body.dark-theme .quick-top-stats button .tw-text-neutral-500 {
    color: #cbd5e1 !important;
}

body.dark-theme .quick-top-stats button span.tw-font-semibold {
    color: #f1f5f9 !important;
}

/* Totalizadores em caixa (#estimates_total) */
body.dark-theme #estimates_total dl > div.tw-bg-white {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
}

body.dark-theme #estimates_total dl dd .tw-text-neutral-600 {
    color: #f1f5f9 !important;
}

/* Pipeline de Estimativas */
body.dark-theme li[data-estimate-id] .panel-body {
    background: #1a2333 !important;
    border: 1px solid #2d3b55 !important;
}

body.dark-theme li[data-estimate-id]:hover .panel-body {
    background: #202d44 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

body.dark-theme li[data-estimate-id] .pipeline-heading a {
    color: #f1f5f9 !important;
    font-weight: 600;
}

body.dark-theme li[data-estimate-id] .pipeline-heading a:hover {
    color: #ffffff !important;
}

body.dark-theme li[data-estimate-id] a.tw-text-neutral-700 {
    color: #bfdbfe !important;
}

body.dark-theme li[data-estimate-id] a.tw-text-neutral-700:hover {
    color: #ffffff !important;
}

body.dark-theme li[data-estimate-id] p.tw-text-neutral-700 {
    color: #e5e7eb !important;
}

body.dark-theme li[data-estimate-id] span.tw-text-neutral-500 {
    color: #cbd5e1 !important;
}

body.dark-theme li[data-estimate-id] small {
    color: #cbd5e1 !important;
}

/* Preview de Estimativas (#estimate e estimate_preview_template.php) */
body.dark-theme #estimate #estimate-number {
    color: #f1f5f9 !important;
}

body.dark-theme #estimate address.tw-text-neutral-500 {
    color: #e5e7eb !important;
}

body.dark-theme #estimate p.no-mbot {
    color: #e5e7eb !important;
}

body.dark-theme #estimate p.no-mbot span.bold {
    color: #f1f5f9 !important;
}

body.dark-theme #estimate a:not(.btn):not(.label):not(.badge) {
    color: #bfdbfe !important;
}

body.dark-theme #estimate a:not(.btn):not(.label):not(.badge):hover {
    color: #ffffff !important;
}

/* Tabela de Itens e Cálculos (Estimativas, Propostas e Vendas) */
body.dark-theme .table-main-estimate-edit,
body.dark-theme .proposal-items-table,
body.dark-theme .table-items-preview {
    color: #f1f5f9 !important;
}

body.dark-theme .table-main-estimate-edit span.bold.tw-text-neutral-700,
body.dark-theme .proposal-items-table span.bold.tw-text-neutral-700 {
    color: #f8fafc !important;
}

body.dark-theme table.has-calculations td.total,
body.dark-theme table.has-calculations td.subtotal,
body.dark-theme table.has-calculations td.adjustment,
body.dark-theme table.has-calculations td.discount-total {
    color: #f1f5f9 !important;
    font-weight: 700;
}

/* ==========================================================================
   8. CONTRATOS (CONTRACTS: SUMMARY, PREVIEW, RENOVAÇÕES E COMENTÁRIOS)
   ========================================================================== */

/* Cards de Sumário no topo de Contratos (#contract_summary) */
body.dark-theme #contract_summary .tw-bg-white {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
}

body.dark-theme #contract_summary .tw-font-semibold {
    color: #f1f5f9 !important;
}

body.dark-theme #contract_summary .text-muted {
    color: #cbd5e1 !important;
}

/* Título e formulário de Contratos */
body.dark-theme.contracts h4.tw-text-neutral-700,
body.dark-theme #contract-form label {
    color: #e5e7eb !important;
}

body.dark-theme.contracts a:not(.btn):not(.label):not(.badge) {
    color: #bfdbfe !important;
}

body.dark-theme.contracts a:not(.btn):not(.label):not(.badge):hover {
    color: #ffffff !important;
}

/* Histórico de Renovações de Contrato (#renewals) */
body.dark-theme #renewals .media-body b {
    color: #f1f5f9 !important;
}

body.dark-theme #renewals small.text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme #renewals p.tw-text-neutral-500 {
    color: #cbd5e1 !important;
}

body.dark-theme #renewals hr.hr-10 {
    border-color: #243049 !important;
}

/* Comentários de Contrato (#contract-comments) */
body.dark-theme #contract-comments .comment-item .media-body a {
    color: #bfdbfe !important;
}

body.dark-theme #contract-comments .comment-item .media-body a:hover {
    color: #ffffff !important;
}

body.dark-theme #contract-comments .comment-item small.text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme #contract-comments div[data-contract-comment] {
    color: #f1f5f9 !important;
}

body.dark-theme #contract-comments a.text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme #contract-comments a.text-muted:hover {
    color: #ffffff !important;
}

/* ==========================================================================
   9. ASSINATURAS (SUBSCRIPTIONS: SUMÁRIO, FORMULÁRIO E INVOICES FILHAS)
   ========================================================================== */

/* Sumário com contadores de Assinaturas */
body.dark-theme.subscriptions .tw-grid div.md\:tw-border-r {
    border-color: #2d3b55 !important;
}

body.dark-theme.subscriptions .tw-grid div span.tw-font-semibold {
    color: #f1f5f9 !important;
}

/* Formulário de Assinatura */
body.dark-theme.subscriptions h4.tw-text-neutral-700 {
    color: #f8fafc !important;
}

body.dark-theme.subscriptions .tw-bg-neutral-50 {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
    color: #f1f5f9 !important;
}

body.dark-theme.subscriptions label.control-label,
body.dark-theme.subscriptions #stripe_plan_wrapper label {
    color: #e5e7eb !important;
}

body.dark-theme.subscriptions p.help-block {
    color: #cbd5e1 !important;
}

/* Invoices Filhas / Histórico de Faturas da Assinatura (#child_invoices) */
body.dark-theme #child_invoices .list-group-item {
    background-color: #1a2333 !important;
    border-color: #2d3b55 !important;
}

body.dark-theme #child_invoices .list-group-item a {
    color: #bfdbfe !important;
}

body.dark-theme #child_invoices .list-group-item a:hover {
    color: #ffffff !important;
}

body.dark-theme #child_invoices .list-group-item .bold {
    color: #f1f5f9 !important;
}

body.dark-theme #child_invoices .list-group-item span.text-muted,
body.dark-theme #child_invoices .list-group-item small {
    color: #cbd5e1 !important;
}

/* ==========================================================================
   10. PRESERVAÇÃO ESTATUTÁRIA DE CORES SEMÂNTICAS E COMPONENTES ESPECÍFICOS
   ========================================================================== */

/* Assegura que cores semânticas não sejam esmaecidas ou neutralizadas */
body.dark-theme .text-success { color: #86efac !important; }
body.dark-theme .text-danger { color: #fca5a5 !important; }
body.dark-theme .text-warning { color: #fcd34d !important; }
body.dark-theme .text-info { color: #7dd3fc !important; }
body.dark-theme .text-primary { color: #93c5fd !important; }

/* Proteção de badges e labels contra sobreposição de cor genérica */
body.dark-theme .label-default {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}


/* ==================================
   CRM Kanban - Onboarding Guiado (wizard)
   Causa: view usa utilitarios Tailwind claros (tw-bg-neutral-50, tw-bg-neutral-100,
   tw-text-neutral-*, tw-bg-white) sem equivalente no tema escuro.
   ================================== */
body.dark-theme .panel-body:has(.crm-wizard-stepper) { color: #e5e7eb; }
body.dark-theme .panel-body:has(.crm-wizard-stepper) > div[class*="tw-border-neutral"],
body.dark-theme .panel-body:has(.crm-wizard-stepper) > div.tw-border-t {
    border-color: #1e293b !important;
}
body.dark-theme .panel-body:has(.crm-wizard-stepper) h3 { color: #f1f5f9 !important; }
body.dark-theme .panel-body:has(.crm-wizard-stepper) > div:first-child p { color: #cbd5e1 !important; }

/* Stepper */
body.dark-theme .crm-wizard-stepper .crm-wizard-step > div:first-child {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
    box-shadow: none !important;
}
body.dark-theme .crm-wizard-stepper .crm-wizard-step > div:first-child.tw-bg-indigo-600 {
    background-color: #1d4ed8 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25) !important;
}
body.dark-theme .crm-wizard-stepper .crm-wizard-step > div:first-child.tw-bg-emerald-500 {
    background-color: #166534 !important;
    border-color: #22c55e !important;
    color: #bbf7d0 !important;
}
body.dark-theme .crm-wizard-stepper .crm-wizard-step .tw-text-neutral-500 { color: #cbd5e1 !important; }
body.dark-theme .crm-wizard-stepper .crm-wizard-step .tw-text-indigo-600 { color: #f1f5f9 !important; }
body.dark-theme .crm-wizard-stepper .crm-wizard-step .tw-text-emerald-700 { color: #86efac !important; }

/* Paineis dos passos */
body.dark-theme .crm-wizard-pane > div {
    background-color: #111827 !important;
    border-color: #2d3b55 !important;
}
body.dark-theme .crm-wizard-pane h4 { color: #f1f5f9 !important; }
body.dark-theme .crm-wizard-pane p { color: #cbd5e1 !important; }
body.dark-theme .crm-wizard-pane label { color: #e5e7eb !important; }
body.dark-theme .crm-wizard-pane label .text-danger { color: #fca5a5 !important; }

/* Linhas de vendedores (passo 3) */
body.dark-theme .crm-wizard-pane .user-row {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
}

/* Destaque de comandos (passo 2) */
body.dark-theme .crm-wizard-pane [class*="tw-bg-emerald-50"] {
    background-color: rgba(22, 101, 52, 0.25) !important;
    border-color: #166534 !important;
}
body.dark-theme .crm-wizard-pane [class*="tw-bg-emerald-50"] .tw-text-emerald-950,
body.dark-theme .crm-wizard-pane [class*="tw-bg-emerald-50"] .tw-text-emerald-900 { color: #d1fae5 !important; }
body.dark-theme .crm-wizard-pane [class*="tw-bg-emerald-50"] [class*="tw-bg-white"] {
    background-color: #0f172a !important;
    border-color: #166534 !important;
    color: #e5e7eb !important;
}

/* Botoes secundarios / loading */
body.dark-theme .panel-body:has(.crm-wizard-stepper) .btn-default {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}
body.dark-theme .panel-body:has(.crm-wizard-stepper) .btn-default:hover { background-color: #334155 !important; }
body.dark-theme .panel-body:has(.crm-wizard-stepper) .btn-link { color: #cbd5e1 !important; }
body.dark-theme .panel-body:has(.crm-wizard-stepper) #wizard-loading { color: #cbd5e1 !important; }
