/* ==========================================================================
   PERFEX CRM - MODERN DARK THEME: ALTO CONTRASTE (TELAS GERAIS)
   Arquivo: contrast_work_general.css
   Escopo exclusivo: body.dark-theme
   Telas cobertas:
     - Projetos (Visão geral, Gantt, Milestones/Marcos Kanban, Atividades, Discussões/jquery-comments)
     - Tarefas (Modal view_task_template, Kanban de tarefas, checklists, timers, comentários)
     - Tickets (Visualização individual, sticky header, coluna lateral, histórico e respostas)
     - Base de Conhecimento (Artigos, Kanban da KB, grupos, leitor de artigo)
     - Calendário (FullCalendar v5, dias, eventos, visualização lista, popover, filtros)
     - Contatos (Listas, modal de edição, notificações e permissões)
     - Equipe / Staff (Tabela de membros, perfil, tabela de permissões e capabilities)
     - Configurações (Menu lateral por grupos, abas internas, descrições e helpers)
     - Formulários e Modais Gerais (Estrutura modal, labels, addons, help-blocks)
     - Dropdowns e Selects (Bootstrap dropdowns, Bootstrap-Select / selectpicker, Select2)
     - Painéis e Cards Gerais (.panel_s, .card, .well, divisores e bordas)
     - Portal do Cliente (body.customers.dark-theme, header, sidebar, cards e tabelas)
     - Módulos integrados (crm_kanban cards e workspace, perfex_saas cards e views)

   Paleta de Alto Contraste:
     - Títulos e Destaques: #f8fafc / #ffffff
     - Texto de Leitura / Valores / Células: #f1f5f9 / #e5e7eb
     - Links: #bfdbfe (hover: #ffffff com underline)
     - Texto Suave (apenas inativos, timestamps e desabilitados): #cbd5e1
     - Bordas escuras harmonizadas: #243049 / #2d3b55 / #334155
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. PAINÉIS, CARDS E TEXTOS GERAIS DE ALTO CONTRASTE
   -------------------------------------------------------------------------- */
body.dark-theme .panel_s,
body.dark-theme .panel,
body.dark-theme .panel-default,
body.dark-theme .card,
body.dark-theme .well {
    color: #f1f5f9;
}

body.dark-theme .panel-heading,
body.dark-theme .panel-title,
body.dark-theme .panel-heading h1,
body.dark-theme .panel-heading h2,
body.dark-theme .panel-heading h3,
body.dark-theme .panel-heading h4,
body.dark-theme .panel-heading h5,
body.dark-theme .card-header,
body.dark-theme .card-title {
    color: #f8fafc !important;
}

body.dark-theme .panel-body,
body.dark-theme .card-body {
    color: #e5e7eb;
}

body.dark-theme .panel-body h1,
body.dark-theme .panel-body h2,
body.dark-theme .panel-body h3,
body.dark-theme .panel-body h4,
body.dark-theme .panel-body h5,
body.dark-theme .panel-body h6,
body.dark-theme .card-body h1,
body.dark-theme .card-body h2,
body.dark-theme .card-body h3,
body.dark-theme .card-body h4,
body.dark-theme .card-body h5,
body.dark-theme .card-body h6 {
    color: #f8fafc !important;
}

body.dark-theme .panel-footer,
body.dark-theme .card-footer {
    color: #e5e7eb !important;
}

/* Divisores e bordas claras herdadas do tema claro */
body.dark-theme .tw-border-neutral-300,
body.dark-theme .tw-border-neutral-200,
body.dark-theme .tw-border-slate-300,
body.dark-theme .tw-border-slate-200,
body.dark-theme .tw-border-slate-100,
body.dark-theme [class*="tw-border-neutral-300"],
body.dark-theme [class*="tw-border-slate-200"] {
    border-color: #2d3b55 !important;
}

body.dark-theme .tw-bg-neutral-300,
body.dark-theme .tw-bg-neutral-200 {
    background-color: #2d3b55 !important;
}

/* Links em painéis e cards sem quebrar botões e badges */
body.dark-theme .panel_s a:not(.btn):not(.label):not(.badge):not(.onoffswitch-label):not([class*="nav"]):not(.dropdown-toggle),
body.dark-theme .panel a:not(.btn):not(.label):not(.badge):not(.onoffswitch-label):not([class*="nav"]):not(.dropdown-toggle),
body.dark-theme .card a:not(.btn):not(.label):not(.badge):not(.onoffswitch-label):not([class*="nav"]):not(.dropdown-toggle) {
    color: #bfdbfe;
}

body.dark-theme .panel_s a:not(.btn):not(.label):not(.badge):not(.onoffswitch-label):not([class*="nav"]):not(.dropdown-toggle):hover,
body.dark-theme .panel a:not(.btn):not(.label):not(.badge):not(.onoffswitch-label):not([class*="nav"]):not(.dropdown-toggle):hover,
body.dark-theme .card a:not(.btn):not(.label):not(.badge):not(.onoffswitch-label):not([class*="nav"]):not(.dropdown-toggle):hover {
    color: #ffffff !important;
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   2. PROJETOS (PROJECTS)
   -------------------------------------------------------------------------- */
/* Visão geral do projeto */
body.dark-theme .project-info {
    color: #f8fafc !important;
}

body.dark-theme .project-overview-left h4,
body.dark-theme .project-overview-right h4 {
    color: #f8fafc !important;
}

body.dark-theme .project-overview-open-tasks,
body.dark-theme .project-overview-days-left {
    background-color: #151c2c !important;
    border-color: #2d3b55 !important;
}

body.dark-theme .project-overview-open-tasks p.tw-text-neutral-700,
body.dark-theme .project-overview-days-left p.tw-text-neutral-700 {
    color: #f1f5f9 !important;
}

body.dark-theme .project-overview-open-tasks p.tw-text-neutral-400,
body.dark-theme .project-overview-days-left p.tw-text-neutral-400 {
    color: #cbd5e1 !important;
}

/* Finanças e Horas apontadas */
body.dark-theme .project-overview-logged-hours-finance,
body.dark-theme .project-overview-expenses-finance {
    color: #e5e7eb;
}

body.dark-theme .project-overview-logged-hours-finance h4,
body.dark-theme .project-overview-expenses-finance h4 {
    color: #f1f5f9 !important;
}

body.dark-theme .project-overview-logged-hours-finance .text-muted,
body.dark-theme .project-overview-expenses-finance .text-muted {
    color: #cbd5e1 !important;
}

body.dark-theme .project-overview-logged-hours-finance .tw-font-medium,
body.dark-theme .project-overview-expenses-finance .tw-font-medium {
    color: #f8fafc !important;
}

/* Lista de descrição de detalhes do projeto */
body.dark-theme dl.tw-grid dt,
body.dark-theme .project-overview-left dl dt {
    color: #cbd5e1 !important;
}

body.dark-theme dl.tw-grid dd,
body.dark-theme .project-overview-left dl dd {
    color: #f1f5f9 !important;
    font-weight: 500;
}

body.dark-theme .project-overview-left dl dd a {
    color: #bfdbfe !important;
}

body.dark-theme .project-overview-left dl dd a:hover {
    color: #ffffff !important;
}

/* Exportar dados do projeto */
body.dark-theme a[href*="export_project_data"] {
    color: #bfdbfe !important;
}

body.dark-theme a[href*="export_project_data"]:hover {
    color: #ffffff !important;
}

/* Milestones / Marcos Kanban */
body.dark-theme .milestones-kan-ban li.task .panel-body,
body.dark-theme ul.milestone-tasks li.task .panel-body {
    background-color: #151c2c !important;
    border-color: #243049 !important;
}

body.dark-theme a.task_milestone {
    color: #f1f5f9 !important;
    font-weight: 600;
}

body.dark-theme a.task_milestone:hover,
body.dark-theme a.task_milestone:focus {
    color: #ffffff !important;
    text-decoration: underline;
}

body.dark-theme a.task_milestone.text-muted,
body.dark-theme a.task_milestone.line-through {
    color: #cbd5e1 !important;
}

body.dark-theme .milestones-kan-ban p.tw-text-sm,
body.dark-theme ul.milestone-tasks p.tw-text-sm {
    color: #e5e7eb !important;
}

/* Feed de Atividades de Projetos */
body.dark-theme .activity-feed .feed-item {
    border-left-color: #3b82f6 !important;
}

body.dark-theme .activity-feed .feed-item .date,
body.dark-theme .activity-feed .feed-item .date span {
    color: #cbd5e1 !important;
}

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

body.dark-theme .activity-feed .feed-item .text b,
body.dark-theme .activity-feed .feed-item .text strong {
    color: #ffffff !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;
}

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

/* Discussões de Projetos */
body.dark-theme h3.tw-text-neutral-700,
body.dark-theme .project_discussion h3 {
    color: #f8fafc !important;
}

body.dark-theme .project_discussion p.tw-text-neutral-700,
body.dark-theme .project-discussions-wrapper p {
    color: #e5e7eb !important;
}

body.dark-theme .project_discussion .tw-text-neutral-500 {
    color: #f1f5f9 !important;
}

/* Plugin jquery-comments em Discussões e Arquivos */
body.dark-theme .jquery-comments {
    color: #e5e7eb;
}

body.dark-theme .jquery-comments .textarea-wrapper .textarea {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

body.dark-theme .jquery-comments .textarea-wrapper:before {
    border-right-color: #334155 !important;
    border-top-color: #334155 !important;
}

body.dark-theme .jquery-comments .textarea-wrapper:after {
    border-right-color: #0f172a !important;
    border-top-color: #0f172a !important;
}

body.dark-theme .jquery-comments ul.navigation {
    color: #cbd5e1 !important;
    border-bottom: 2px solid #334155 !important;
}

body.dark-theme .jquery-comments ul.navigation li {
    color: #cbd5e1 !important;
}

body.dark-theme .jquery-comments ul.navigation li:hover,
body.dark-theme .jquery-comments ul.navigation li.active {
    color: #ffffff !important;
}

body.dark-theme .jquery-comments ul.navigation li.active:after {
    background: #3b82f6 !important;
}

body.dark-theme .jquery-comments ul.main li.comment .wrapper .content {
    color: #f1f5f9 !important;
}

body.dark-theme .jquery-comments ul.main li.comment .name {
    color: #f8fafc !important;
}

body.dark-theme .jquery-comments ul.main li.comment .name a {
    color: #bfdbfe !important;
}

body.dark-theme .jquery-comments ul.main li.comment .name a:hover {
    color: #ffffff !important;
}

body.dark-theme .jquery-comments ul.main li.comment time {
    color: #cbd5e1 !important;
}

body.dark-theme .jquery-comments ul.main li.comment .actions > * {
    color: #cbd5e1 !important;
}

body.dark-theme .jquery-comments ul.main li.comment .actions .action:hover {
    color: #ffffff !important;
}

body.dark-theme .jquery-comments ul.dropdown {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-theme .jquery-comments ul.dropdown li:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

body.dark-theme .jquery-comments .no-data {
    color: #cbd5e1 !important;
}

/* Gráfico de Gantt do Projeto */
body.dark-theme .gantt-container {
    background-color: #151c2c !important;
}

body.dark-theme .gantt .grid-background,
body.dark-theme .gantt .grid-header,
body.dark-theme .gantt .grid-row {
    fill: #151c2c !important;
    background: #151c2c !important;
}

body.dark-theme .gantt .grid-row,
body.dark-theme .gantt .tick {
    stroke: #2d3b55 !important;
}

body.dark-theme .gantt .lower-text,
body.dark-theme .gantt .upper-text,
body.dark-theme .gantt .bar-label {
    fill: #f1f5f9 !important;
}

/* --------------------------------------------------------------------------
   3. TAREFAS (TASKS)
   -------------------------------------------------------------------------- */
/* Modal de Detalhe da Tarefa (view_task_template) */
body.dark-theme .task-single-header {
    background-color: #101725 !important;
    border-bottom: 1px solid #243049 !important;
}

body.dark-theme .task-single-header .modal-title {
    color: #f8fafc !important;
}

body.dark-theme .task-single-col-left p.task-info-created {
    color: #e5e7eb !important;
}

body.dark-theme .task-single-related-wrapper {
    color: #e5e7eb !important;
}

body.dark-theme .task-single-related-wrapper a {
    color: #bfdbfe !important;
}

body.dark-theme .task-single-related-wrapper a:hover {
    color: #ffffff !important;
}

body.dark-theme #task_view_description {
    color: #f1f5f9 !important;
}

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

/* Checklists da Tarefa */
body.dark-theme .chk-heading {
    color: #f8fafc !important;
}

body.dark-theme .checklist-item,
body.dark-theme .checklist-item-title {
    color: #f1f5f9 !important;
}

body.dark-theme .checklist-item.line-through,
body.dark-theme .checklist-item.completed {
    color: #cbd5e1 !important;
}

/* Comentários da Tarefa */
body.dark-theme .tasks-comments {
    color: #e5e7eb;
}

body.dark-theme #task-comment-form {
    background-color: #151c2c !important;
    border-color: #243049 !important;
}

body.dark-theme .task-comment .comment-wrapper {
    color: #e5e7eb !important;
}

body.dark-theme .task-comment .comment-content {
    color: #f1f5f9 !important;
}

body.dark-theme .task-comment .task-date-as-comment-id span {
    color: #cbd5e1 !important;
}

body.dark-theme .task-comment a[href*="profile/"],
body.dark-theme .task-comment a[href*="clients/client/"] {
    color: #bfdbfe !important;
    font-weight: 600;
}

body.dark-theme .task-comment a[href*="profile/"]:hover,
body.dark-theme .task-comment a[href*="clients/client/"]:hover {
    color: #ffffff !important;
}

body.dark-theme .task-comment-dropzone {
    background-color: #101725 !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

/* Coluna Direita da Tarefa (task-single-col-right) */
body.dark-theme .task-single-col-right h4 {
    color: #f8fafc !important;
}

body.dark-theme .task-single-col-right .task-info h5 {
    color: #e5e7eb !important;
}

body.dark-theme .task-single-col-right .task-info-icon {
    color: #93c5fd !important;
}

body.dark-theme .task-single-col-right .task-info span.tw-text-neutral-800,
body.dark-theme .task-single-col-right .task-info span.trigger {
    color: #f1f5f9 !important;
    font-weight: 500;
}

body.dark-theme .task-info-inline-input-edit {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

/* Popovers e Menus Flutuantes na Tarefa (content-menu) */
body.dark-theme .task-single-menu .content-menu {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .task-single-menu .content-menu ul li a {
    color: #f1f5f9 !important;
}

body.dark-theme .task-single-menu .content-menu ul li a:hover,
body.dark-theme .task-single-menu .content-menu ul li a:focus {
    color: #ffffff !important;
    background-color: #2563eb !important;
}

/* Kanban de Tarefas */
body.dark-theme .tasks-kan-ban li.task .panel-body {
    background-color: #151c2c !important;
    border-color: #243049 !important;
}

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

body.dark-theme .tasks-kan-ban li.task .task-name a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

body.dark-theme .tasks-kan-ban li.task .task-name a[title] {
    color: #bfdbfe !important;
}

body.dark-theme .tasks-kan-ban li.task .task-name a[title]:hover {
    color: #ffffff !important;
}

body.dark-theme .tasks-kan-ban li.task .col-md-4.tw-text-neutral-600,
body.dark-theme .tasks-kan-ban li.task .col-md-8.tw-text-neutral-500 {
    color: #cbd5e1 !important;
}

body.dark-theme .tasks-kan-ban li.task span.tw-text-neutral-500 {
    color: #cbd5e1 !important;
}

/* Modal de tarefas do Kanban (#tasksModal) - Corrigindo cinzas apagados */
body.dark-theme #tasksModal .modal-body,
body.dark-theme #tasksModal .modal-footer {
    background-color: #151c2c !important;
    color: #e5e7eb !important;
}

body.dark-theme #tasksModal [class*="tw-text-slate-800"],
body.dark-theme #tasksModal [class*="tw-text-slate-700"],
body.dark-theme #tasksModal [class*="tw-text-neutral-900"] {
    color: #f8fafc !important;
}

body.dark-theme #tasksModal [class*="tw-text-slate-600"],
body.dark-theme #tasksModal [class*="tw-text-slate-500"] {
    color: #e5e7eb !important;
}

body.dark-theme #tasksModal [class*="tw-text-slate-400"],
body.dark-theme #tasksModal [class*="tw-text-slate-300"] {
    color: #cbd5e1 !important;
}

/* --------------------------------------------------------------------------
   4. TICKETS
   -------------------------------------------------------------------------- */
/* Visualização Individual do Ticket */
body.dark-theme #ticketLeftInformation {
    color: #f1f5f9;
}

body.dark-theme #ticketLeftInformation h3,
body.dark-theme #ticket_subject {
    color: #f8fafc !important;
}

/* Header sticky de tickets sem gradiente claro */
body.dark-theme div.tw-bg-gradient-to-r.tw-from-neutral-50.tw-to-white {
    background: #0f172a !important;
    border-bottom: 1px solid #243049 !important;
}

/* Coluna Lateral de Detalhes do Ticket */
body.dark-theme .ticket-right-column,
body.dark-theme #ticketDetails {
    background-color: #151c2c !important;
    border-color: #243049 !important;
}

body.dark-theme .ticket-right-column > div:first-child,
body.dark-theme #ticketDetails > div:first-child {
    background-color: #101725 !important;
    border-bottom: 1px solid #243049 !important;
}

body.dark-theme .ticket-right-column h4,
body.dark-theme #ticketDetails h4 {
    color: #f8fafc !important;
}

body.dark-theme .ticket-right-column label,
body.dark-theme #ticketDetails label {
    color: #cbd5e1 !important;
    font-weight: 500;
}

body.dark-theme .ticket-right-column p,
body.dark-theme #ticketDetails p {
    color: #e5e7eb !important;
}

/* Histórico de Mensagens e Respostas do Ticket */
body.dark-theme .panel-body.ticket-thread {
    background-color: #151c2c !important;
    border-color: #243049 !important;
    color: #f1f5f9 !important;
}

body.dark-theme .panel-body.client-reply {
    background-color: #131d33 !important;
    border-left: 3px solid #3b82f6 !important;
}

body.dark-theme .ticket-thread p.tw-font-semibold {
    color: #f8fafc !important;
}

body.dark-theme .ticket-thread p.tw-font-semibold a {
    color: #bfdbfe !important;
}

body.dark-theme .ticket-thread p.tw-font-semibold a:hover {
    color: #ffffff !important;
}

body.dark-theme .ticket-thread p.tw-text-neutral-600 {
    color: #cbd5e1 !important;
}

body.dark-theme .ticket-thread a.tw-text-neutral-500,
body.dark-theme .ticket-thread a.tw-text-neutral-600 {
    color: #cbd5e1 !important;
}

body.dark-theme .ticket-thread a.tw-text-neutral-500:hover,
body.dark-theme .ticket-thread a.tw-text-neutral-600:hover {
    color: #ffffff !important;
}

/* Abas de Responder / Nota Interna / Lembretes */
body.dark-theme .ticket-single-page .nav-tabs-segmented {
    background: #0f172a !important;
    border-bottom: 1px solid #243049 !important;
}

body.dark-theme .ticket-single-page .nav-tabs-segmented > li > a {
    color: #cbd5e1 !important;
}

body.dark-theme .ticket-single-page .nav-tabs-segmented > li.active > a,
body.dark-theme .ticket-single-page .nav-tabs-segmented > li > a:hover {
    color: #ffffff !important;
    border-bottom-color: #3b82f6 !important;
}

/* --------------------------------------------------------------------------
   5. BASE DE CONHECIMENTO (KNOWLEDGE BASE)
   -------------------------------------------------------------------------- */
body.dark-theme .knowledge-base-page h4 {
    color: #f8fafc !important;
}

body.dark-theme a.toggle-articles-list {
    color: #bfdbfe !important;
}

body.dark-theme a.toggle-articles-list:hover {
    color: #ffffff !important;
}

/* Kanban da KB */
body.dark-theme .kb-kan-ban .kan-ban-col-wrapper .panel_s {
    background-color: #111827 !important;
    border-color: #243049 !important;
}

body.dark-theme .kb-kan-ban .panel-heading.tw-bg-neutral-700 {
    color: #ffffff !important;
}

body.dark-theme .kb-kan-ban ul.article-group li .panel-body {
    background-color: #151c2c !important;
    border-color: #243049 !important;
}

body.dark-theme .kb-kan-ban ul.article-group li .panel-body a {
    color: #f1f5f9 !important;
    font-weight: 500;
}

body.dark-theme .kb-kan-ban ul.article-group li .panel-body a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

body.dark-theme .kb-kan-ban ul.article-group li .panel-body p small {
    color: #cbd5e1 !important;
}

/* Artigo individual */
body.dark-theme .kb-article,
body.dark-theme .article-content {
    color: #f1f5f9 !important;
}

body.dark-theme .kb-article h1,
body.dark-theme .kb-article h2,
body.dark-theme .kb-article h3 {
    color: #f8fafc !important;
}

body.dark-theme .kb-article a {
    color: #bfdbfe !important;
}

body.dark-theme .kb-article a:hover {
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   6. CALENDÁRIO (FULLCALENDAR V5 & FILTROS)
   -------------------------------------------------------------------------- */
body.dark-theme #calendar,
body.dark-theme .fc {
    background-color: #151c2c !important;
    color: #f1f5f9 !important;
    --fc-border-color: #243049;
    --fc-page-bg-color: #151c2c;
    --fc-neutral-bg-color: #101725;
    --fc-neutral-text-color: #cbd5e1;
    --fc-today-bg-color: rgba(37, 99, 235, 0.12);
}

body.dark-theme .fc .fc-toolbar-title {
    color: #f8fafc !important;
    font-weight: 700;
}

/* Botões do FullCalendar */
body.dark-theme .fc .fc-button,
body.dark-theme .fc .fc-button-primary {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-theme .fc .fc-button:hover,
body.dark-theme .fc .fc-button-primary:hover {
    background-color: #2563eb !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

body.dark-theme .fc .fc-button:disabled,
body.dark-theme .fc .fc-button-primary:disabled {
    background-color: #1e293b !important;
    border-color: #243049 !important;
    color: #cbd5e1 !important;
    opacity: 0.5;
}

body.dark-theme .fc .fc-button-active,
body.dark-theme .fc .fc-button-primary:not(:disabled).fc-button-active {
    background-color: #2563eb !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

/* Cabeçalhos de dia (Seg, Ter, Qua...) */
body.dark-theme .fc .fc-col-header-cell {
    background-color: #101725 !important;
    border-color: #243049 !important;
}

body.dark-theme .fc .fc-col-header-cell-cushion {
    color: #f1f5f9 !important;
    font-weight: 600;
}

/* Células e Dias */
body.dark-theme .fc-theme-standard td,
body.dark-theme .fc-theme-standard th,
body.dark-theme .fc-scrollgrid {
    border-color: #243049 !important;
}

body.dark-theme .fc .fc-daygrid-day-number {
    color: #f1f5f9 !important;
    font-weight: 600;
}

body.dark-theme .fc .fc-day-other .fc-daygrid-day-number {
    color: #cbd5e1 !important;
    opacity: 0.5;
}

body.dark-theme .fc .fc-day-today {
    background-color: rgba(37, 99, 235, 0.12) !important;
}

body.dark-theme .fc .fc-day-today .fc-daygrid-day-number {
    color: #93c5fd !important;
    font-weight: 700;
}

/* Eventos */
body.dark-theme .fc .fc-event-title,
body.dark-theme .fc .fc-event-time {
    color: #ffffff !important;
    font-weight: 600;
}

/* Visualização Lista */
body.dark-theme .fc .fc-list-table {
    background-color: #151c2c !important;
    border-color: #243049 !important;
}

body.dark-theme .fc .fc-list-day-cushion {
    background-color: #101725 !important;
}

body.dark-theme .fc .fc-list-day-text,
body.dark-theme .fc .fc-list-day-side-text {
    color: #f1f5f9 !important;
    font-weight: 700;
}

body.dark-theme .fc .fc-list-event {
    color: #f1f5f9 !important;
}

body.dark-theme .fc .fc-list-event:hover td {
    background-color: #1e293b !important;
}

body.dark-theme .fc .fc-list-event-title a {
    color: #bfdbfe !important;
}

body.dark-theme .fc .fc-list-event-title a:hover {
    color: #ffffff !important;
}

body.dark-theme .fc .fc-list-event-time {
    color: #cbd5e1 !important;
}

/* Popover do calendário (+ mais eventos) */
body.dark-theme .fc .fc-popover {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .fc .fc-popover-header {
    background-color: #0f172a !important;
    border-bottom: 1px solid #334155 !important;
}

body.dark-theme .fc .fc-popover-title {
    color: #f8fafc !important;
}

body.dark-theme .fc .fc-popover-close {
    color: #cbd5e1 !important;
}

/* Filtros do Calendário */
body.dark-theme #calendar_filters {
    color: #e5e7eb !important;
}

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

/* --------------------------------------------------------------------------
   7. CONTATOS (CONTACTS)
   -------------------------------------------------------------------------- */
body.dark-theme .table-all-contacts tbody td a,
body.dark-theme .table-contacts tbody td a {
    color: #bfdbfe !important;
    font-weight: 600;
}

body.dark-theme .table-all-contacts tbody td a:hover,
body.dark-theme .table-contacts tbody td a:hover {
    color: #ffffff !important;
}

/* Modal de Contato */
body.dark-theme #contact .modal-title {
    color: #f8fafc !important;
}

body.dark-theme #contact .modal-header p {
    color: #cbd5e1 !important;
}

body.dark-theme #contact .control-label,
body.dark-theme #contact label {
    color: #f1f5f9 !important;
}

body.dark-theme #contact_email_notifications {
    color: #e5e7eb;
}

body.dark-theme #contact_email_notifications span {
    color: #e5e7eb !important;
}

body.dark-theme #contact_email_notifications .border-right {
    border-right-color: #243049 !important;
}

/* --------------------------------------------------------------------------
   8. EQUIPE / STAFF
   -------------------------------------------------------------------------- */
body.dark-theme .table-staff tbody td a {
    color: #bfdbfe !important;
    font-weight: 600;
}

body.dark-theme .table-staff tbody td a:hover {
    color: #ffffff !important;
}

/* Perfil de Staff */
body.dark-theme .staff-profile-page h4.tw-text-neutral-700,
body.dark-theme h4.tw-text-neutral-700 {
    color: #f8fafc !important;
}

body.dark-theme .staff-profile-page p.tw-text-neutral-600 {
    color: #e5e7eb !important;
}

body.dark-theme .staff-profile-page i.tw-text-neutral-400 {
    color: #93c5fd !important;
}

/* Tabela de Permissões e Capabilities */
body.dark-theme table.roles th {
    background-color: #101725 !important;
    color: #f8fafc !important;
}

body.dark-theme table.roles tr[data-name] td {
    border-color: #243049 !important;
}

body.dark-theme table.roles tr[data-name] td b {
    color: #f1f5f9 !important;
}

body.dark-theme table.roles .checkbox label {
    color: #e5e7eb !important;
}

body.dark-theme table.roles .checkbox input[disabled] + label {
    color: #cbd5e1 !important;
    opacity: 0.6;
}

/* --------------------------------------------------------------------------
   9. CONFIGURAÇÕES (SETTINGS)
   -------------------------------------------------------------------------- */
/* Menu Lateral de Abas de Configurações */
body.dark-theme .settings-group-wrapper h4.tw-text-neutral-800,
body.dark-theme .settings-page h4.tw-text-neutral-800 {
    color: var(--modern-settings-title) !important;
}

body.dark-theme .settings-page .col-md-4.col-lg-3 > .panel_s {
    background-color: var(--modern-settings-panel-bg) !important;
    border-color: var(--modern-settings-panel-border) !important;
}

body.dark-theme .settings-page h4.tw-text-neutral-500 {
    color: var(--modern-settings-section) !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

body.dark-theme .settings-page a.tw-text-neutral-600 {
    color: var(--modern-settings-link) !important;
}

body.dark-theme .settings-page a.tw-text-neutral-600 i.tw-text-neutral-500 {
    color: var(--modern-settings-icon) !important;
}

body.dark-theme .settings-page a.tw-text-neutral-600:hover,
body.dark-theme .settings-page a.tw-text-neutral-600:focus {
    color: var(--modern-settings-hover-text) !important;
    background-color: var(--modern-settings-hover-bg) !important;
    border-radius: var(--modern-radius-sm);
}

body.dark-theme .settings-page a.tw-text-neutral-600:hover i,
body.dark-theme .settings-page a.tw-text-neutral-600:focus i {
    color: var(--modern-settings-hover-text) !important;
}

/* Item ativo no menu de configurações */
body.dark-theme .settings-page a.tw-text-neutral-800 {
    color: var(--modern-settings-active-text) !important;
    background-color: var(--modern-settings-active-bg) !important;
    border-radius: var(--modern-radius-sm);
    font-weight: 600;
}

body.dark-theme .settings-page a.tw-text-neutral-800 i {
    color: var(--modern-settings-active-text) !important;
}

/* Abas internas horizontais em configurações */
body.dark-theme .panel-full-width-tabs .nav-tabs-horizontal > li > a {
    color: var(--modern-settings-help) !important;
}

body.dark-theme .panel-full-width-tabs .nav-tabs-horizontal > li > a:hover {
    color: var(--modern-settings-hover-text) !important;
}

body.dark-theme .panel-full-width-tabs .nav-tabs-horizontal > li.active > a {
    color: var(--modern-settings-active-text) !important;
    border-bottom: 2px solid var(--modern-settings-tab-indicator) !important;
}

/* Textos de ajuda, helpers e descrições */
body.dark-theme .settings-page p.text-muted,
body.dark-theme .settings-page p.tw-text-neutral-500,
body.dark-theme .settings-page .help-block,
body.dark-theme .settings-page small.text-muted {
    color: var(--modern-settings-help) !important;
}

body.dark-theme .settings-page i.fa-circle-question {
    color: var(--modern-settings-section) !important;
}

/* --------------------------------------------------------------------------
   10. FORMULÁRIOS E MODAIS GERAIS
   -------------------------------------------------------------------------- */
body.dark-theme .modal-content {
    background-color: #151c2c !important;
    border: 1px solid #334155 !important;
    color: #f1f5f9 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .modal-header {
    background-color: #101725 !important;
    border-bottom: 1px solid #243049 !important;
    color: #f8fafc !important;
}

body.dark-theme .modal-title {
    color: #f8fafc !important;
    font-weight: 600;
}

body.dark-theme .modal-header .close {
    color: #cbd5e1 !important;
    opacity: 0.8;
}

body.dark-theme .modal-header .close:hover {
    color: #ffffff !important;
    opacity: 1;
}

body.dark-theme .modal-body {
    background-color: #151c2c !important;
    color: #e5e7eb !important;
}

body.dark-theme .modal-body p,
body.dark-theme .modal-body span:not(.label):not(.badge):not(.onoffswitch-label) {
    color: #e5e7eb;
}

body.dark-theme .modal-footer {
    background-color: #101725 !important;
    border-top: 1px solid #243049 !important;
}

/* Labels e Ajuda em Formulários */
body.dark-theme .control-label,
body.dark-theme .form-group > label,
body.dark-theme label {
    color: #f1f5f9 !important;
    font-weight: 500;
}

body.dark-theme .help-block,
body.dark-theme .form-text {
    color: #cbd5e1 !important;
}

body.dark-theme .input-group-addon {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e5e7eb !important;
}

body.dark-theme .checkbox label,
body.dark-theme .radio label {
    color: #e5e7eb !important;
}

/* --------------------------------------------------------------------------
   11. DROPDOWNS, BOOTSTRAP-SELECT E SELECT2
   -------------------------------------------------------------------------- */
/* Bootstrap Dropdown */
body.dark-theme .dropdown-menu {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .dropdown-menu > li > a {
    color: #f1f5f9 !important;
    font-weight: 500;
}

body.dark-theme .dropdown-menu > li > a:hover,
body.dark-theme .dropdown-menu > li > a:focus,
body.dark-theme .dropdown-menu > li.active > a {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

body.dark-theme .dropdown-header {
    color: #93c5fd !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
}

body.dark-theme .dropdown-divider,
body.dark-theme .dropdown-menu .divider {
    background-color: #334155 !important;
}

/* Bootstrap-Select (selectpicker) */
body.dark-theme .bootstrap-select .btn.dropdown-toggle {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-theme .bootstrap-select .btn.dropdown-toggle:hover,
body.dark-theme .bootstrap-select .btn.dropdown-toggle:focus {
    background-color: #151c2c !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

body.dark-theme .bootstrap-select .filter-option {
    color: #f8fafc !important;
}

body.dark-theme .bootstrap-select .filter-option.placeholder,
body.dark-theme .bootstrap-select .bs-placeholder {
    color: #cbd5e1 !important;
}

body.dark-theme .bootstrap-select .dropdown-menu {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
}

body.dark-theme .bootstrap-select .dropdown-menu li a {
    color: #f1f5f9 !important;
}

body.dark-theme .bootstrap-select .dropdown-menu li a span.text {
    color: #f1f5f9 !important;
}

body.dark-theme .bootstrap-select .dropdown-menu li.selected a,
body.dark-theme .bootstrap-select .dropdown-menu li.active a,
body.dark-theme .bootstrap-select .dropdown-menu li a:hover {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

body.dark-theme .bootstrap-select .dropdown-menu li.selected a span.text,
body.dark-theme .bootstrap-select .dropdown-menu li.active a span.text,
body.dark-theme .bootstrap-select .dropdown-menu li a:hover span.text {
    color: #ffffff !important;
}

body.dark-theme .bootstrap-select .bs-searchbox input {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-theme .bootstrap-select .no-results {
    color: #cbd5e1 !important;
}

/* Select2 */
body.dark-theme .select2-container--default .select2-selection--single,
body.dark-theme .select2-container--default .select2-selection--multiple {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-theme .select2-selection__rendered {
    color: #f8fafc !important;
}

body.dark-theme .select2-dropdown {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

body.dark-theme .select2-results__option {
    color: #f1f5f9 !important;
}

body.dark-theme .select2-results__option--highlighted {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

body.dark-theme .select2-search__field {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

/* --------------------------------------------------------------------------
   12. PORTAL DO CLIENTE (CUSTOMER PORTAL)
   -------------------------------------------------------------------------- */
body.customers.dark-theme,
body.dark-theme.customers {
    background-color: #0b0f19 !important;
    color: #f1f5f9 !important;
}

body.customers.dark-theme .section-heading,
body.customers.dark-theme .tickets-summary-heading,
body.dark-theme.customers .section-heading,
body.dark-theme.customers .tickets-summary-heading {
    color: #f8fafc !important;
    font-weight: 700;
}

body.customers.dark-theme .client-card-item,
body.dark-theme.customers .client-card-item {
    background: #151c2c !important;
    border-color: #243049 !important;
    color: #f1f5f9 !important;
}

body.customers.dark-theme .client-card-title,
body.dark-theme.customers .client-card-title {
    color: #f8fafc !important;
}

body.customers.dark-theme .client-card-desc,
body.dark-theme.customers .client-card-desc {
    color: #cbd5e1 !important;
}

/* Tabelas e visualizações do portal do cliente */
body.customers.dark-theme .table tbody td,
body.dark-theme.customers .table tbody td {
    color: #f1f5f9 !important;
}

body.customers.dark-theme .table tbody td a,
body.dark-theme.customers .table tbody td a {
    color: #bfdbfe !important;
    font-weight: 500;
}

body.customers.dark-theme .table tbody td a:hover,
body.dark-theme.customers .table tbody td a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   13. MÓDULOS INTEGRADOS (CRM_KANBAN & PERFEX_SAAS)
   -------------------------------------------------------------------------- */
/* Cards do CRM Kanban */
body.dark-theme .crm-kanban-card a.tw-text-neutral-900 {
    color: #f8fafc !important;
    font-weight: 600;
}

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

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

body.dark-theme .crm-kanban-card [id^="timer_display_"] {
    color: #f1f5f9 !important;
}

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

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

/* Workspace lateral do Lead / Demanda */
body.dark-theme .crm-lead-workspace__panel {
    background-color: #151c2c !important;
    border-left: 1px solid #243049 !important;
}

body.dark-theme .crm-lead-workspace__header {
    background-color: #101725 !important;
    border-bottom: 1px solid #243049 !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__facts dt {
    color: #cbd5e1 !important;
}

body.dark-theme .crm-lead-workspace__facts dd {
    color: #f1f5f9 !important;
    font-weight: 500;
}

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

/* Perfex SaaS Views & Cards */
body.dark-theme .ps-card,
body.dark-theme .ps-view .card,
body.dark-theme .ps-view .panel {
    background-color: #151c2c !important;
    border-color: #243049 !important;
    color: #f1f5f9 !important;
}

body.dark-theme .ps-view h1,
body.dark-theme .ps-view h2,
body.dark-theme .ps-view h3,
body.dark-theme .ps-view h4,
body.dark-theme .ps-view h5 {
    color: #f8fafc !important;
}


/* ==========================================================================
   Labels / badges semanticos com contraste (contratos, propostas, estimativas,
   faturas, despesas, projetos, tarefas, tickets, leads, clientes, assinaturas,
   base de conhecimento). Preserva a familia de cor; fundo escuro + texto claro.
   Labels com style inline (cor do banco) NAO sao sobrescritos por cor/fundo,
   exceto no override de hover/link abaixo.
   ========================================================================== */
body.dark-theme .label:not([style]),
body.dark-theme .badge:not([style]) {
    border: 1px solid transparent;
    font-weight: 600;
}
body.dark-theme .label-default:not([style]),
body.dark-theme .badge-default:not([style]),
body.dark-theme .badge:not([class*="label-"]):not([class*="badge-"]):not([style]) {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}
body.dark-theme .label-success:not([style]),
body.dark-theme .badge-success:not([style]) {
    background-color: #166534 !important;
    color: #bbf7d0 !important;
    border-color: #14532d !important;
}
body.dark-theme .label-danger:not([style]),
body.dark-theme .badge-danger:not([style]) {
    background-color: #7f1d1d !important;
    color: #fecaca !important;
    border-color: #991b1b !important;
}
body.dark-theme .label-warning:not([style]),
body.dark-theme .badge-warning:not([style]) {
    background-color: #78350f !important;
    color: #fde68a !important;
    border-color: #92400e !important;
}
body.dark-theme .label-info:not([style]),
body.dark-theme .badge-info:not([style]) {
    background-color: #0c4a6e !important;
    color: #bae6fd !important;
    border-color: #075985 !important;
}
body.dark-theme .label-primary:not([style]),
body.dark-theme .badge-primary:not([style]) {
    background-color: #1e3a8a !important;
    color: #bfdbfe !important;
    border-color: #1e40af !important;
}
/* Mantem o chip Recorrente de despesas (regra especifica de contrast_finance.css) */
body.dark-theme table.table-expenses td .label.label-primary:not([style]) {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border-color: #475569 !important;
}
/* Links dentro de labels e hover */
body.dark-theme a.label:not([style]):hover,
body.dark-theme a.label:not([style]):focus {
    filter: brightness(1.15);
    text-decoration: none;
}
/* Tags (label-tag) e chips de tags de leads/tarefas/tickets/contratos */
body.dark-theme .label.label-tag:not([style]),
body.dark-theme .tags-labels .label:not([style]),
body.dark-theme .bootstrap-tagsinput .tag.label:not([style]) {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569 !important;
}
/* Badges contadores (indicadores de comentarios/anexos/templates) */
body.dark-theme .comments-indicator,
body.dark-theme .attachments-indicator,
body.dark-theme .total_templates {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}
/* Labels com cor customizada inline (tarefas/status do banco): garante borda e
   remove opacidade que reduz leitura; cor/fundo inline sao respeitados. */
body.dark-theme .label[style*="color"],
body.dark-theme .label[style*="background"] {
    opacity: 1 !important;
    font-weight: 600;
}
