:root{
  /* Paleta Projetar */
  --teal: #51A8B1;
  --teal-700: #3B8E96;
  --lime: #A8CF4F;
  --bg: #F4F7F8;
  --ink: #334155;
  --muted: #6B7280;

  --surface: #FFFFFF;
  --accent-fill: #E9F4F6;       /* teal muito claro */
  --accent-stroke: #D8EDEF;

  --radius: 12px;
  --shadow: 0 2px 6px rgba(16,24,40,.06);
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family:"Poppins",sans-serif;
  background:var(--bg);
  color:var(--ink);
}

/* ===== Header */
.header{
  position: sticky;
  top: 0;
  z-index: 10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 24px;
  background:var(--surface);
  box-shadow: var(--shadow);
  border-bottom: 3px solid var(--lime);
}
.brand{ display:flex; align-items:center; gap:16px; }
.brand-logo{ height:120px; width:auto; display:block; }
.app-title{
  margin:0;
  font-size:24px;
  font-weight:800;
  letter-spacing:.5px;
  color:var(--teal);
  text-transform:uppercase;
  text-align: center;
}

/* ===== Controles (select + botão) */
.controls{
  display:flex;
  align-items:center;
  gap:10px;
}
.month-select{
  padding:10px 12px;
  border:1px solid var(--accent-stroke);
  border-radius:10px;
  background:var(--surface);
  font-size:14px;
  color:var(--ink);
  outline:none;
  transition:border-color .2s, box-shadow .2s;
}
.month-select:focus{
  border-color:var(--teal);
  box-shadow:0 0 0 3px rgba(81,168,177,.2);
}

.print-btn{
  padding:10px 16px;
  background:var(--teal);
  color:#fff;
  border:none;
  border-radius:10px;
  font-weight:700;
  cursor:pointer;
  transition:transform .05s ease, background-color .2s ease;
}
.print-btn:hover{ background:var(--teal-700); }
.print-btn:active{ transform:translateY(1px); }

/* ===== Container da Tabela */
.table-container{
  margin:20px 16px 32px;
  overflow-x:auto;
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 10px; /* “cards” por linha */
}

/* Thead sticky para tabelas longas */
thead th{
  position: sticky;
  top: 0;
  z-index: 5;
  background:var(--surface);
  text-align:center;
  font-weight:900;
  padding:14px 16px;
  font-size:14px;
  color:#0f172a;
  border-bottom:1px solid var(--accent-stroke);
}

/* Linhas “cards” */
tbody tr{
  background:var(--surface);
  box-shadow:var(--shadow);
  border-radius:10px;
}
tbody td{
  padding:12px 16px;
  vertical-align:middle;
  border-top:1px solid rgba(0,0,0,0); /* preserva radius visual */
}
tbody tr:hover{ box-shadow:0 4px 10px rgba(16,24,40,.08); }
tbody tr td:first-child{ font-weight:600; }

/* Inputs de valor somente leitura */
input.amount{
  width:110px;
  padding:8px 6px;
  border:none;
  background:var(--accent-fill);
  border-radius:8px;
  text-align:right;
  font-weight:600;
  color:#0f172a;
}
input.amount:disabled{
  color:#0f172a;
  background:var(--accent-fill);
}

/* Botões de download */
.download-btn{
  padding:9px 14px;
  border:1px solid var(--accent-stroke);
  border-radius:10px;
  background:linear-gradient(#fff, #fbfeff);
  color:var(--teal-700);
  cursor:pointer;
  font-size:13px;
  font-weight:700;
  transition:box-shadow .2s, border-color .2s, transform .05s;
}
.download-btn:hover{
  border-color:var(--teal);
  box-shadow:0 0 0 3px rgba(81,168,177,.15);
}
.download-btn:active{ transform:translateY(1px); }

/* Linha de totais com destaque de marca */
.total-row{
  background: #F1FAF3; /* leve verde para diferenciar */
}
.total-row td{
  font-weight:800;
  padding-top:16px;
  border-top:3px solid var(--teal);
}
.total-row td:first-child{ font-size:1.05rem; color:#0f172a; }
.total-row td .amount{
  background: #E6F7F2;
  color:#0f172a;
}

/* ===== Gráfico + Painel lateral */
.chart-wrapper{
  margin:16px auto 32px;
  max-width:1200px;
  padding:0 16px;
}
.chart-grid{
  display:grid;
  grid-template-columns: minmax(300px, 1fr) 380px;
  gap:16px;
  align-items:start;
}
.chart-box{
  background:var(--surface);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
  border-left:6px solid var(--lime);
}
.chart-title{
  color:var(--teal);
  font-size:22px;
  margin:0 0 8px 0;
  text-align:center;
  font-weight:800;
  letter-spacing:.5px;
}
#chart{ max-width:900px; max-height:400px; width:100%; }

/* Painel lateral */
.insight-panel{ display:flex; flex-direction:column; gap:16px; }
.card{
  background:var(--surface);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
  border-top:4px solid var(--teal);
}
.card h3{
  margin:0 0 10px 0;
  font-size:16px;
  color:#0f172a;
  font-weight:800;
  letter-spacing:.2px;
}
.muted{ color:var(--muted); font-size:12px; margin-top:4px; }

/* Tabelas do painel */
.stats-table, .cmp-table{ width:100%; border-collapse:collapse; }
.stats-table td, .cmp-table td, .cmp-table th{
  padding:8px 6px;
  border-bottom:1px solid #EEF2F7;
  font-size:12px;
}
.stats-table td.right{ text-align:right; }
.cmp-table th{
  text-align:left; font-weight:700; background:#F9FBFF;
}

/* Input de dinheiro (resumo) */
.money-input-wrap{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  background:var(--accent-fill);
  border:1px solid var(--accent-stroke);
  border-radius:8px;
}
.money-input-wrap span{ font-weight:700; color:#0f172a; }
#inputRecebido{
  width:130px;
  border:none;
  background:transparent;
  text-align:right;
  font-weight:700;
  color:#0f172a;
  outline:none;
}

/* Variações */
.delta{ font-weight:700; }
.delta.up{ color:#16a34a; }
.delta.down{ color:#e11d48; }
.delta.flat{ color:#64748b; }

/* Responsivo */
@media (max-width:980px){
  .chart-grid{ grid-template-columns:1fr; }
  .controls{ flex-wrap:wrap; justify-content:flex-end; }
}
@media (max-width:600px){
  thead{ display:none; }
  tbody tr{ display:block; margin-bottom:12px; }
  tbody td{
    display:flex; justify-content:space-between; align-items:center; padding:10px 12px;
  }
  tbody td::before{ content:attr(data-label); font-weight:700; color:#0f172a; }
  .brand-logo{ height:48px; }
  .app-title{ font-size:18px; }
}

.loadMore{
  background:rgb(114, 156, 59)  ;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .05s ease, background-color .2s ease;
  color: #fff ;
}

.loadMore:hover{
  background: rgb(70, 95, 36) ;
}

/* Impressão: foca na tabela */
/* ===== PRINT FIX (A4 paisagem, tabela paginando e cards visíveis) ===== */
@media print {
  /* Página */
  @page { size: A4 landscape; margin: 12mm; }
  html, body { background: #fff !important; font-size: 11px !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Esconde o que não precisa no papel */
  .header, .controls, .download-btn { display: none !important; }

  /* Mostra o painel e a área do gráfico (vamos ocultar só o canvas) */
  .chart-wrapper { display: block !important; margin: 0 !important; padding: 0 !important; }
  .chart-grid { display: block !important; }     /* empilha */
  .chart-box { border: 1px solid #e5e7eb !important; box-shadow: none !important; }
  #chart { display: none !important; }           /* se quiser imprimir o gráfico, remova esta linha */
  .insight-panel, .card { display: block !important; break-inside: avoid; page-break-inside: avoid;
    border: 1px solid #e5e7eb !important; box-shadow: none !important; }

  /* Tabela ocupa largura total, sem scroll horizontal */
  .table-container { margin: 0 !important; overflow: visible !important; }
  table { width: 100% !important; border-spacing: 0 !important; table-layout: auto !important; }
  thead { display: table-header-group !important; }
  thead th { position: static !important; box-shadow: none !important; border-bottom: 1px solid #e5e7eb !important; }
  tbody tr { box-shadow: none !important; border: 1px solid #e5e7eb !important; }
  tr, td, th { page-break-inside: avoid !important; break-inside: avoid !important; }

  /* Cores / detalhes */
  .total-row td { border-top: 2px solid #51A8B1 !important; }
  .chart-title, .app-title { color: #000 !important; } /* melhora leitura em PB */
}

