/* ============================================================
   FINANCEIRO.CSS - Estilo completo do módulo Financeiro
   Seguindo o padrão do módulo Solicitações
   ============================================================ */

/* ------------------------- */
/* CABEÇALHO LOCAL         */
/* ------------------------- */

#financeiro-header {
  padding: 20px 30px;
  background: #f5f7fa;
  border-bottom: 1px solid #ddd;
  max-width: none;
  width: 100%;
  margin: 0;
}

.titulo-modulo {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 15px;
  color: #2c3e50;
}

/* ------------------------- */
/* SUBMENU TOP             */
/* ------------------------- */

#submenu-financeiro {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sub-btn {
  background: #e6e9ef;
  border: none;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: #2c3e50;
  transition: 0.2s;
}

.sub-btn:hover {
  background: #d5d9e3;
}

.sub-btn.active {
  background: #667eea;
  color: #fff;
}


/* ============================= */
/* SEÇÕES PRINCIPAIS         */
/* ============================= */

.secao-financeiro {
  /* Reduzimos o padding lateral para aproveitar melhor a largura da
     página, principalmente em Curva Financeira e Análises. Mantemos
     padding vertical semelhante para espaçamento vertical consistente. */
  padding: 25px 20px;
  display: none;
  background: #f9fafb;
  margin-left: 0;
  margin-right: 0;  
}

.secao-financeiro.active {
  display: block;
}

/* O contêiner principal de conteúdo do módulo financeiro deve
   utilizar toda a largura disponível da página. Usamos !important
   para garantir que nenhuma regra vinda de style.css ou de outros
   estilos redefina a largura máxima ou adicione margens. O
   preenchimento horizontal básico é mantido para respirar o
   conteúdo. */
#conteudoFinanceiro {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 15px;
  padding-right: 15px;
  box-sizing: border-box;
}

/* Também aplicamos as mesmas regras ao elemento body. Algumas
   definições globais no arquivo style.css (não visível aqui)
   definem uma largura máxima e centralizam o conteúdo com
   margens automáticas. Esta regra garante que o módulo financeiro
   ocupe toda a largura da tela, removendo margens laterais. */
body {
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Em telas pequenas, reduza ainda mais o padding das seções principais
   para maximizar a área útil e evitar margens laterais grandes em
   dispositivos móveis. */
@media (max-width: 600px) {
  .secao-financeiro {
    padding: 15px 10px;
  }
}

.titulo-sec {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #111827;
}


/* ============================= */
/* CARDS GERAIS             */
/* ============================= */

.card-importacao,
.card-pessoas,
.card-vinculos,
.card-descontos,
.card-analise,
.card-alancar,
.card-lista-alancar,
.resumo-card,
.relatorio-grid {
  background: #fff;
  border-radius: 10px;
  padding: 25px 30px;
  margin-bottom: 25px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.card-importacao h2,
.card-pessoas h3,
.card-vinculos h3,
.card-descontos h3,
.card-alancar h3,
.card-lista-alancar h3 {
  margin-bottom: 15px;
  font-weight: 700;
  color: #2c3e50;
}


/* ============================= */
/* INPUTS E BOTÕES            */
/* ============================= */

input[type="text"],
input[type="number"],
input[type="file"],
select {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  margin-bottom: 10px;
  background: #fff;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.3);
}

.btn-importar {
  background: #28a745;
  border: none;
  padding: 10px 18px;
  font-weight: bold;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-importar:hover {
  background: #218838;
}

.btn-salvar {
  background: #3498db;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  margin-top: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-salvar:hover {
  background: #2980b9;
}

/* Botão Cancelar Edição (Novo) */
.btn-cancelar-edicao {
  background: #9ca3af;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  margin-top: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn-cancelar-edicao:hover {
  background: #6b7280;
}

.btn-relatorio {
  background: #667eea;
  padding: 10px 18px;
  color: #fff;
  font-size: 15px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin: 6px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-relatorio:hover {
  background: #5568d4;
}

.btn-acao-tabela {
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  margin-right: 4px;
}

.btn-acao-editar {
  background: #fbbf24;
  color: #111827;
}

.btn-acao-remover {
  background: #ef4444;
  color: #fff;
}

/* Botão para ocultar/mostrar nomes de obras nas tabelas */
.btn-toggle-obra,
.btn-toggle-col {
  background-color: #e5e7eb;
  color: #374151;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.btn-toggle-obra:hover,
.btn-toggle-col:hover {
  background-color: #d1d5db;
}


/* ============================= */
/* INFO BOXES               */
/* ============================= */

.info-box {
  background: #f1f3f7;
  padding: 12px 15px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 15px;
  color: #34495e;
  border-left: 4px solid #667eea;
}

.import-status {
  margin-top: 15px;
  font-size: 15px;
  padding: 10px;
  background: #f1f3f7;
  border-radius: 6px;
  color: #2c3e50;
  border-left: 4px solid #3498db;
}


/* ============================= */
/* RESUMO DA IMPORTAÇÃO       */
/* ============================= */

.resumo-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.resumo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 15px;
}

.resumo-item {
  background: #f8f9fc;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e1e5ec;
}

.resumo-item .label {
  font-weight: bold;
  color: #2c3e50;
  display: block;
  margin-bottom: 4px;
}


/* ============================= */
/* TABELAS                 */
/* ============================= */

.tabela-financeiro {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

/* Cabeçalhos das tabelas utilizam o mesmo degradê da tela de Quantidades */
.tabela-financeiro th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

.tabela-financeiro td {
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  color: #111827;
}

.tabela-financeiro tr:hover td {
  background: #f8f9fc;
}

/* ============================= */
/* ESTILO TAG CAUÇÃO (NOVO)      */
/* ============================= */
.tag-cau {
    color: #ef4444; /* Vermelho */
    font-weight: 800; /* Negrito Extra */
    font-size: 13px;
    background: #fef2f2;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #fee2e2;
}

/* ============================= */
/* FORMULÁRIOS               */
/* ============================= */

.form-grid {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1.2fr 0.8fr;
  gap: 18px;
  align-items: end;
}

.col-acao-pessoa {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 10px;
}

/* Status do cadastro de pessoas */
.status-pessoa {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  border-left: 4px solid #10b981;
  background: #ecfdf5;
  color: #065f46;
}

/* Largura padronizada para colunas numéricas (Previsto/Realizado/Diferença/Total) */
.tabela-curva th.curva-previsto,
.tabela-curva td.curva-previsto,
.tabela-curva th.curva-realizado,
.tabela-curva td.curva-realizado,
.tabela-curva th.curva-diferenca,
.tabela-curva td.curva-diferenca,
.tabela-curva th.curva-total,
.tabela-curva td.curva-total {
  width: var(--curva-num-col-w) !important;
  min-width: var(--curva-num-col-w) !important;
  max-width: var(--curva-num-col-w) !important;
}


/* ============================= */
/* GRID A LANÇAR (Atualizado)    */
/* ============================= */

.form-grid-alancar {
  display: grid;
  grid-template-columns: 1.5fr 2fr 1fr 0.8fr;
  gap: 15px;
  align-items: end;
}

.col-acao-alancar {
  display: flex;
  align-items: flex-end;
  gap: 5px;
}


/* ============================= */
/* VÍNCULO DE OBRAS         */
/* ============================= */

.card-vinculos table select {
  padding: 6px;
  font-size: 14px;
  width: 100%;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
}

.ajuda-vinculos {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 12px;
}


/* ============================= */
/* TABS PARAMETRIZAÇÃO       */
/* ============================= */

.tabs-param {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-param {
  background: #e6e9ef;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-weight: 600;
  font-size: 14px;
  transition: 0.2s;
  color: #111827;
}

.tab-param:hover {
  background: #d5dae3;
}

.tab-param.active {
  background: #3498db;
  color: #fff;
}

.tab-content-param {
  display: none;
}

.tab-content-param.active {
  display: block;
}


/* ============================= */
/* DESCONTOS               */
/* ============================= */

.card-descontos {
  position: relative;
}

.ajuda-descontos {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
}

.descontos-filtros {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1.6fr;
  gap: 16px;
  margin-bottom: 10px;
  align-items: end;
}

.area-lista-descontos {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 4px;
}

.tabela-descontos th {
  background: #111827;
}

.tabela-descontos td {
  font-size: 13px;
}

.tabela-descontos td:first-child {
  text-align: center;
}

.tabela-descontos input[type="checkbox"] {
  transform: scale(1.1);
  cursor: pointer;
}

.rodape-descontos {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-descontos {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #ecfdf5;
  border-left: 4px solid #10b981;
  color: #065f46;
}

.nota-descontos {
  margin-top: 10px;
  font-size: 13px;
  color: #6b7280;
}


/* ============================= */
/* ANÁLISES               */
/* ============================= */

.painel-analises {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.card-analise {
  min-height: 200px;
  max-width: 100%; /* Usar toda largura disponível */
}

.card-analise.full-width {
    width: 100%;
}

/* Wrapper para tabela matricial com scroll horizontal */
.analise-matrix-wrapper {
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  max-width: 100%; /* Usar toda largura */
}

/* Tabela Matrix */
.tabela-matrix {
  width: 100%; /* Usar 100% da largura */
  min-width: 100%;
  border-collapse: collapse;
}

.tabela-matrix th, 
.tabela-matrix td {
  padding: 12px 18px; /* Aumentar padding */
  text-align: center;
  border: 1px solid #e5e7eb;
  font-size: 14px; /* Aumentar fonte */
}

/* Coluna 1 Fixa (Label) */
.tabela-matrix th:first-child,
.tabela-matrix td:first-child {
  position: sticky;  
  background: #fff;
  left: 0 !important;
  z-index: 12;
  border-right: 2px solid #d1d5db;
  text-align: left;
  font-weight: bold;
  /* Dinâmico: cresce/encolhe conforme o texto (sem travar largura fixa) */
  width: max-content;
  white-space: nowrap;
  background-clip: padding-box;
}

.tabela-matrix thead th:first-child {
  z-index: 20; /* Ficar acima das outras colunas no header */
  /* Aplicar gradiente para combinar com o módulo Quantidades */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.tabela-matrix thead th {
  /* Gradiente de fundo para cabeçalhos, inspirado no módulo Quantidades */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  min-width: 110px; /* NOVO: Largura mínima para colunas de valores */
  white-space: nowrap; /* NOVO: Evitar quebra de linha nos cabeçalhos */
}

/* Estilos de linha da Matrix */
.tabela-matrix tr:hover td {
  background: #f8f9fc;
}

/* NOVO: Colunas de valores com largura otimizada */
.tabela-matrix td:nth-child(n+3) {
  min-width: 110px; /* Largura mínima para valores monetários */
}

/* Linha Outros Gastos */
.row-outros-gastos td {
  background-color: #fffbeb;
  color: #b45309;
}
.row-outros-gastos td:first-child {
  background-color: #fffbeb; /* manter sticky na cor correta */
  color: #b45309;
}

/* Linha Total Geral */
.row-total-geral td {
  background-color: #ecfdf5;
  color: #047857;
  font-weight: bold;
  border-top: 2px solid #10b981;
}
.row-total-geral td:first-child {
  background-color: #ecfdf5; /* manter sticky na cor correta */
}

/* ===================================== */
/* LINHA SEPARADORA FÍSICA (ANÁLISE)     */
/* ===================================== */
.row-separator td {
    background-color: #d1d5db; /* Cor cinza escura */
    height: 8px; /* Altura fixa */
    padding: 0 !important;
    border: none;
}
.row-separator td:first-child {
    background-color: #d1d5db;
}

/* ============================= */
/* CURVA FINANCEIRA              */
/* ============================= */

/* Grid dos campos de mês no formulário da Curva Financeira */
.campos-meses-curva {
  display: grid;
  /* Quatro colunas em telas grandes para distribuir melhor os meses. O valor
     minmax(0, 1fr) garante que cada coluna ocupe a mesma proporção */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  /* Maior espaço entre os campos para evitar que fiquem colados */
  gap: 16px;
  margin-top: 16px;
}

/* Layout responsivo para os campos de mês na Curva Financeira. Em telas
   médias (até 768px), organizamos em 2 colunas e, em telas muito
   pequenas (até 480px), organizamos em 1 coluna. Isso melhora a
   usabilidade em celulares, evitando que os inputs fiquem muito
   comprimidos ou fora da tela. */
@media (max-width: 768px) {
  .campos-meses-curva {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .campos-meses-curva {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

.campo-mes {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.campo-mes label {
  font-size: 12px;
  color: #6b7280;
}

.campo-mes input {
  padding: 6px 8px;
  font-size: 13px;
}

/* Cores claras para as sub-colunas da Curva Financeira */
/*
 * Cores claras para as sub-colunas da Curva Financeira. As cores
 * possuem !important para sobrepor a cor de fundo aplicada pelo
 * sombreado de trimestre (curva-q1..q4). Desta forma, cada tipo de
 * coluna (Previsto, Realizado e Diferença) mantém sua cor mesmo
 * quando combinada com as classes de trimestre.
 */
/* Cores suaves para a Curva Financeira. Inspiradas no padrão pastel do módulo Quantidades. */
.curva-previsto {
  background-color: #f2f8f5 !important; /* verde suave */
  color: #374151 !important;
}

.curva-realizado {
  background-color: #f5f8fd !important; /* azul suave */
  color: #374151 !important;
}

.curva-diferenca {
  background-color: #fdf5f7 !important; /* rosa suave */
  /* o texto de Diferença recebe cores dinâmicas (vermelho ou verde) via inline style, mas definimos
     uma cor escura padrão caso nenhuma cor seja aplicada */
  color: #374151 !important;
}

/* Cores alternadas por trimestre para facilitar visualização */
.curva-q1 {
  background-color: #fafafa;
}
.curva-q2 {
  background-color: #f5f5f5;
}
.curva-q3 {
  background-color: #fafafa;
}
.curva-q4 {
  background-color: #f5f5f5;
}

/* Cabeçalho de trimestre na Curva Financeira */
.trimestre-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  text-align: center;
  font-weight: bold;
}

/* Tornar o texto das subcolunas no cabeçalho da Curva Financeira branco.
   Isso se aplica apenas ao thead, preservando as cores nas linhas de dados. */
/* =================================================================
   CURVA FINANCEIRA - CABEÇALHO STICKY (VERSÃO LIMPA E DEFINITIVA)
   Removendo TODAS as regras antigas e criando do ZERO
   ================================================================= */

/* PASSO 1: Reset - remover bordas collapse que causam problemas */
.tabela-curva {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: max-content !important;
  table-layout: auto !important;
  white-space: nowrap !important;
  /* Vars (atualizadas via JS) */
  --curva-sticky-col2-left: 200px;
  --curva-num-col-w: 140px;
}

.tabela-curva th,
.tabela-curva td {
  box-sizing: border-box !important;
}


/* PASSO 2: Base para TODAS as células do thead - fundo ROXO SÓLIDO */
.tabela-curva thead th {
  position: sticky !important;
  background-color: #667eea !important; /* ROXO SÓLIDO - SEM GRADIENTE */
  color: #ffffff !important; /* BRANCO */
  font-weight: 600 !important;
  text-align: center !important;
  border: 1px solid #5568d4 !important;
  padding: 8px !important;
  white-space: nowrap !important;
  /* Sem background-image, sem gradiente - SÓLIDO */
  background-image: none !important;
}

/* PASSO 3: Linha 1 (Trimestres + Nome/Obra com rowspan=3) */
.tabela-curva thead tr:nth-child(1) th {
  top: 0 !important;
  z-index: 42 !important; /* Maior que linhas 2 e 3 */
  height: 35px !important;
}

/* PASSO 4: Células Nome e Obra - MÁXIMA PRIORIDADE */
.tabela-curva thead tr:nth-child(1) th:nth-child(1) {
  position: sticky !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 101 !important; /* MAIOR que Obra para nunca ser coberta */
  width: max-content !important; /* dinâmico */
  min-width: max-content !important;
  max-width: none !important;
  white-space: nowrap !important;
  border-right: 2px solid #5568d4 !important;
  transform: translateZ(0) !important;
  will-change: transform !important;
  backface-visibility: hidden !important;
  contain: paint !important;  
}

.tabela-curva thead tr:nth-child(1) th:nth-child(2) {
  position: sticky !important;
  left: var(--curva-sticky-col2-left, 200px) !important; /* calculado via JS */
  top: 0 !important;
  z-index: 100 !important;
  width: max-content !important; /* dinâmico */
  min-width: max-content !important;
  max-width: none !important;
  white-space: nowrap !important;
  transform: translateZ(0) !important;
  will-change: transform !important;
  backface-visibility: hidden !important;
  contain: paint !important;  
  border-right: 2px solid #5568d4 !important;
}

/* PASSO 5: Linha 2 (Meses) */
.tabela-curva thead tr:nth-child(2) th {
  position: sticky !important;
  top: 35px !important; /* Abaixo da linha 1 */
  z-index: 41 !important;
  height: 35px !important;
}

/* PASSO 6: Linha 3 (Previsto/Realizado/Diferença) */
.tabela-curva thead tr:nth-child(3) th {
  position: sticky !important;
  top: 70px !important; /* Abaixo das linhas 1 e 2 */
  z-index: 40 !important;
  height: 35px !important;
}

/* PASSO 7: Colunas fixas do tbody (Nome e Obra) */
.tabela-curva tbody td:nth-child(1) {
  position: sticky !important;
  left: 0 !important;
  z-index: 31 !important; /* Maior que Obra */
  background-color: #ffffff !important;
  border-right: 2px solid #cbd5e1 !important;
  font-weight: 600 !important;
  width: max-content !important; /* dinâmico */
  min-width: max-content !important;
  max-width: none !important;
  white-space: nowrap !important;
  transform: translateZ(0) !important;
  will-change: transform !important;
  backface-visibility: hidden !important;
  contain: paint !important;  
  box-shadow: 2px 0 4px rgba(0,0,0,0.1) !important; /* Sombra para destacar */
}

.tabela-curva tbody td:nth-child(2) {
  position: sticky !important;
  left: var(--curva-sticky-col2-left, 200px) !important; /* calculado via JS */
  z-index: 30 !important;
  background-color: #ffffff !important;
  border-right: 2px solid #cbd5e1 !important;
  width: max-content !important; /* dinâmico */
  min-width: max-content !important;
  max-width: none !important;
  white-space: nowrap !important;
  box-shadow: 2px 0 4px rgba(0,0,0,0.1) !important; /* Sombra para destacar */
  transform: translateZ(0) !important;
  will-change: transform !important;
  backface-visibility: hidden !important;
  contain: paint !important;  
}

/* PASSO 8: Linha de total - ambas colunas fixas */
.tabela-curva tbody tr:last-child td:first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 35 !important;
  background-color: #f0fdf4 !important;
  border-top: 2px solid #10b981 !important;
  color: #047857 !important;
  font-weight: 800 !important;
}

.tabela-curva tbody tr:last-child td:nth-child(2) {
  position: sticky !important;
  left: var(--curva-sticky-col2-left, 200px) !important; /* calculado via JS */
  z-index: 34 !important; /* Menor que Nome */
  background-color: #f0fdf4 !important;
  border-top: 2px solid #10b981 !important;
  color: #047857 !important;
  font-weight: 800 !important;
}

/* PASSO 9: Larguras das colunas de dados */
.curva-previsto,
.curva-realizado,
.curva-diferenca {
  width: var(--curva-num-col-w) !important;
  max-width: var(--curva-num-col-w) !important;
  min-width: var(--curva-num-col-w) !important;
}

/* =================================================================
   SELETOR DE ANO E BOTÕES DA CURVA FINANCEIRA
   ================================================================= */
#selAnoCurva {
  width: 95px !important; /* Tamanho adequado para 4 dígitos + seta */
  padding: 6px 10px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  border: 2px solid #667eea !important;
  border-radius: 4px !important;
  background-color: #fff !important;
  color: #2c3e50 !important;
  cursor: pointer !important;
  display: inline-block !important;
  vertical-align: baseline !important;
}

#selAnoCurva:focus {
  outline: none !important;
  border-color: #5568d4 !important;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2) !important;
}

#sec-curvafinanceira .cabecalho-analise-pessoa h3 {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 26px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
}
 
/* ============================================================
   TOPO - ANÁLISES FINANCEIRAS (filtros e botões)
   ============================================================ */
#sec-analises .cabecalho-analise-pessoa {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}

#sec-analises .analise-periodo-label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #6b7280 !important;
  margin-left: 6px !important;
}

#sec-analises .filtros-analise-pessoa {
  display: flex !important;
  gap: 10px !important;
  row-gap: 10px !important;
  flex-wrap: wrap !important;
  padding: 10px 15px !important;
  background: #f8fafc !important;
  border-radius: 6px !important;
  align-items: flex-end !important;
  justify-content: flex-start !important;
  margin: 0 !important;
}

#sec-analises .filtros-analise-pessoa .campo-filtro-pessoa {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  min-width: 220px !important;
  flex: 1 1 220px !important;
}

#sec-analises .filtros-analise-pessoa .campo-filtro-pessoa label {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #6b7280 !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

#sec-analises .filtros-analise-pessoa > label {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #1f2937 !important;
  margin: 0 !important;
}

#sec-analises .filtros-analise-pessoa .btn-toggle-obra {
  padding: 6px 12px !important;
  font-size: 13px !important;
}

@media (max-width: 900px) {
  #sec-analises .filtros-analise-pessoa {
    width: 100% !important;
  }
}


.botoes-controle-curva {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-end !important;
  gap: 12px 16px !important;
  margin-bottom: 12px !important;
  padding: 12px 14px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border-radius: 10px !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06) !important;
}

/* Filtros dentro da linha de botões */
.botoes-controle-curva .campo-filtro-pessoa {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  min-width: 210px !important;
  flex: 1 1 230px !important;  
}

.botoes-controle-curva .campo-filtro-pessoa label {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #6b7280 !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

/* Checkbox (labels sem atributo for) - alinhar e criar respiro */
.botoes-controle-curva .campo-filtro-pessoa label:not([for]) {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding-top: 22px !important; /* alinha com inputs */
  user-select: none !important;
}
.botoes-controle-curva .campo-filtro-pessoa label:not([for]) input[type="checkbox"] {
  transform: scale(1.05) !important;
}

/* Separador vertical - dar folga e acompanhar a altura */
.botoes-controle-curva .separador-curva,
.botoes-controle-curva > div[style*="width:1px"][style*="height:30px"] {
  align-self: stretch !important;
  height: 44px !important;
  margin: 0 6px !important;
  opacity: 0.65 !important;
}

.botoes-controle-curva .campo-filtro-pessoa select,
.botoes-controle-curva .campo-filtro-pessoa input[type="text"] {
  padding: 4px 8px !important;
  font-size: 13px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 4px !important;
  min-width: 120px !important;
  margin: 0 !important;
}

.botoes-controle-curva .campo-filtro-pessoa input[type="checkbox"] {
  margin: 0 !important;
  margin-right: 4px !important;
}

/* Botões compactos */
.botoes-controle-curva .btn-toggle-obra,
.botoes-controle-curva .btn-toggle-col,
.botoes-controle-curva .btn-salvar {
  padding: 6px 12px !important;
  font-size: 13px !important;
  white-space: nowrap !important;
  margin: 0 !important;
  border-radius: 8px !important;  
}

/* Responsividade: quebrar em telas menores */
@media (max-width: 1400px) {
  .botoes-controle-curva {
    flex-wrap: wrap !important;
  }
}


/* Empurra o bloco de botões para a direita (mantém filtros à esquerda) */
.botoes-controle-curva > button:first-of-type {
  margin-left: auto !important;
}

/* =================================================================
   AJUSTES VISUAIS - CADASTRO DE PREVISÕES (Curva Financeira)
   ================================================================= */
#sec-curvafinanceira .card-analise {
  border-radius: 14px;
}
#sec-curvafinanceira .card-analise .form-grid {
  gap: 12px 14px;
  align-items: end;
}
#sec-curvafinanceira .responsaveis-curva {
  margin-top: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}
#sec-curvafinanceira .responsaveis-curva > div {
  flex: 1 1 220px;
  min-width: 220px;
}


/* =================================================================
   OVERRIDES (Dez/2025) - Layout/flags + Cadastro Previsões + Responsivo
   ================================================================= */

/* CURVA - garantir larguras iguais nas subcolunas mesmo quando faltar classe */
.tabela-curva thead tr:nth-child(3) th {
  width: var(--curva-num-col-w) !important;
  min-width: var(--curva-num-col-w) !important;
  max-width: var(--curva-num-col-w) !important;
}

.tabela-curva tbody td:nth-child(n+3) {
  width: var(--curva-num-col-w) !important;
  min-width: var(--curva-num-col-w) !important;
  max-width: var(--curva-num-col-w) !important;
}

/* CURVA - separador + flag Unificar em "pill" (sem padding-top exagerado) */
.botoes-controle-curva .flag-unificar-curva label {
  padding-top: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  border: 1px solid #e5e7eb !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05) !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #1f2937 !important;
}

.botoes-controle-curva .flag-unificar-curva input[type="checkbox"] {
  transform: scale(1.08) !important;
}

/* ANÁLISES - flags com mesmo padrão visual */
#sec-analises .filtros-analise-pessoa .campo-filtro-pessoa.flag-analise label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  border: 1px solid #e5e7eb !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.04) !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #1f2937 !important;
  margin: 0 !important;
  user-select: none !important;
  white-space: nowrap !important;
}

#sec-analises .filtros-analise-pessoa .campo-filtro-pessoa.flag-analise input[type="checkbox"] {
  transform: scale(1.08) !important;
}

/* CADASTRO DE PREVISÕES - bloco "Adicionar nova obra" mais bonito */
#sec-curvafinanceira #novoObraContainer {
  margin-top: 10px !important;
  margin-bottom: 14px !important;
  padding: 12px 12px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05) !important;
}

#sec-curvafinanceira #novoObraContainer label {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #6b7280 !important;
}

#sec-curvafinanceira #inpNovoObraCodigo,
#sec-curvafinanceira #inpNovoObraNome {
  height: 40px !important;
  border-radius: 10px !important;
  border: 1px solid #d1d5db !important;
  background: #fff !important;
  margin: 0 !important;
}

#sec-curvafinanceira #btnSalvarNovaObra {
  height: 40px !important;
  border-radius: 10px !important;
  margin: 0 !important;
}

/* CADASTRO DE PREVISÕES - "caixinhas" dos meses */
#sec-curvafinanceira .campo-mes {
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  padding: 10px 10px !important;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04) !important;
}

#sec-curvafinanceira .campo-mes label {
  font-size: 11px !important;
  font-weight: 800 !important;
  color: #6b7280 !important;
}

#sec-curvafinanceira .campo-mes input {
  height: 38px !important;
  border-radius: 10px !important;
  margin: 0 !important;
  text-align: right !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

/* RESPONSIVIDADE - tablets/celulares */
@media (max-width: 900px) {
  .card-importacao,
  .card-pessoas,
  .card-vinculos,
  .card-descontos,
  .card-analise,
  .card-alancar,
  .card-lista-alancar,
  .resumo-card,
  .relatorio-grid {
    padding: 18px 16px !important;
  }

  .botoes-controle-curva {
    padding: 10px 12px !important;
    gap: 10px 12px !important;
  }

  .botoes-controle-curva .campo-filtro-pessoa {
    min-width: 170px !important;
    flex: 1 1 170px !important;
  }

  #sec-curvafinanceira .card-analise .form-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 520px) {
  #sec-curvafinanceira .card-analise .form-grid {
    grid-template-columns: 1fr !important;
  }

  .botoes-controle-curva .separador-curva {
    display: none !important;
  }

  #sec-curvafinanceira .campo-mes input {
    font-size: 15px !important;
  }
}
/* ============================================================
   MODAL DE COMPOSIÇÃO DE SERVIÇOS
   ============================================================ */

.modal-composicao {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-composicao-content {
  background: white;
  border-radius: 12px;
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-composicao-header {
  padding: 20px 30px;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px 12px 0 0;
}

.modal-composicao-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: white;
}

.btn-fechar-modal {
  background: none;
  border: none;
  font-size: 32px;
  color: white;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-fechar-modal:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-composicao-body {
  padding: 25px 30px;
  overflow-y: auto;
  flex: 1;
}

.composicao-info {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.composicao-info span {
  font-weight: 600;
  color: #334155;
}

.tabela-composicao-wrapper {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 20px;
}

.tabela-composicao {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.tabela-composicao thead {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  z-index: 10;
}

.tabela-composicao th {
  padding: 12px;
  text-align: left;
  font-weight: 700;
  color: #1e293b;
  background: #f1f5f9;
  border-bottom: 2px solid #cbd5e1;
  font-size: 13px;
  text-transform: uppercase;
}

.tabela-composicao td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.tabela-composicao tbody tr:hover {
  background: #f8fafc;
}

.tabela-composicao input {
  width: 100%;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.tabela-composicao input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tabela-composicao .item-numero {
  text-align: center;
  font-weight: 600;
  color: #64748b;
}

.tabela-composicao .item-total {
  text-align: right;
  font-weight: 600;
  color: #059669;
  font-size: 15px;
}

.composicao-controles {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-top: 2px solid #e2e8f0;
}

.composicao-total {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 18px;
}

.composicao-total strong {
  color: #1e293b;
}

.composicao-total span {
  color: #059669;
  font-weight: 700;
  font-size: 22px;
}

.modal-composicao-footer {
  padding: 20px 30px;
  border-top: 2px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  border-radius: 0 0 12px 12px;
}

.btn-excluir-item-composicao {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-excluir-item-composicao:hover {
  background: #dc2626;
}

/* Estilo para células clicáveis na curva quando Composição está ativa */
.celula-mes-composicao {
  cursor: pointer;
  transition: background 0.2s;
}

.celula-mes-composicao:hover {
  background: #fef3c7 !important;
  box-shadow: inset 0 0 0 2px #f59e0b;
}

/* Indicador visual de que há composição */
.tem-composicao {
  position: relative;
}

.tem-composicao::after {
  content: '📋';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
}

/* Estilos para campos de mês em modo composição (formulário de previsões) */
.campo-mes-composicao {
  background: #fef3c7 !important;
  border: 2px solid #f59e0b !important;
  cursor: pointer !important;
}

.campo-mes-composicao:hover {
  background: #fde68a !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.tem-composicao-form {
  position: relative;
  background: #d1fae5 !important;
  border-color: #10b981 !important;
}

.tem-composicao-form::before {
  content: '📋';
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

/* ============================= */
/* ESTILOS DO HISTÓRICO         */
/* ============================= */

.historico-lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.historico-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.historico-item:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.historico-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.historico-info strong {
  color: #2c3e50;
  font-size: 15px;
}

.historico-info span {
  color: #6b7280;
  font-size: 14px;
}

/* Botões do histórico */
.btn-secondary-small {
  padding: 8px 16px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-secondary-small:hover {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary-small:active {
  transform: translateY(0);
}

.btn-delete-small {
  padding: 8px 12px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.btn-delete-small:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-delete-small:active {
  transform: translateY(0);
}

/* Animação de fade para remoção */
@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.historico-item.removing {
  animation: fadeOut 0.3s ease forwards;
}

/* Botão Ver Todos os Credores */
.btn-ver-todos-credores {
  padding: 8px 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-ver-todos-credores:hover {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-ver-todos-credores:active {
  transform: translateY(0);
}
