/* OSPrimeApp / Crescia Assist — Estilo Financeiro & Gestão Unificada */

/* Container Principal */
.finance-advanced-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: radial-gradient(circle at top right, rgba(14, 165, 233, 0.06), transparent 40%),
              radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.04), transparent 50%),
              linear-gradient(180deg, #09111e 0%, #060c16 100%);
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Header Pro */
.finance-head-pro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 4px;
}

.finance-head-info .finance-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.finance-head-info .finance-subtitle {
  font-size: 13.5px;
  color: #94a3b8;
  margin: 0;
}

.finance-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Sub-navegação em Pílulas (Estilo da Print) */
.finance-pills-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.finance-pills-bar::-webkit-scrollbar {
  height: 4px;
}
.finance-pills-bar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.finance-pills-hint { display: none; }
@media (min-width: 1000px) {
  .finance-pills-bar { flex-wrap: wrap; overflow-x: visible; }
}
@media (max-width: 999px) {
  .finance-pills-hint { display: block; margin: -2px 2px 12px; color: #aebfd5; font-size: 12px; }
}

.finance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.finance-pill:hover {
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  border-color: rgba(56, 189, 248, 0.3);
}

.finance-pill.active {
  background: rgba(6, 182, 212, 0.12);
  color: #ffffff;
  border-color: #00e5ff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.25), inset 0 0 10px rgba(0, 229, 255, 0.1);
}

.finance-pill .pill-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.finance-pill.active .pill-badge {
  background: #00e5ff;
  color: #060b14;
}

/* Barra de Filtros e Período (Estilo da Print) */
.finance-controls-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: rgba(11, 20, 36, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-radius: 14px;
}

.finance-period-toggle {
  display: inline-flex;
  align-items: center;
  background: #070e1b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.period-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.period-btn:hover {
  color: #ffffff;
}

.period-btn.active {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.finance-month-navigator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #070e1b;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  padding: 4px 12px;
}

.month-nav-arrow {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.month-nav-arrow:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #ffffff;
}

.month-nav-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.02em;
  min-width: 130px;
  text-align: center;
  text-transform: capitalize;
}

.finance-custom-dates {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.finance-custom-dates label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #94a3b8;
}

.finance-custom-dates input[type="date"] {
  background: #070e1b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12.5px;
}

/* Grade de Cards KPIs (Estilo idêntico ao da print) */
.finance-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.finance-kpi-card {
  position: relative;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.8) 0%, rgba(9, 15, 28, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.finance-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.3);
}

.finance-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

/* Cores de topo das abas da print */
.finance-kpi-card.saldo-anterior::before {
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
}

.finance-kpi-card.entradas::before {
  background: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.finance-kpi-card.saidas::before {
  background: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

.finance-kpi-card.receber::before {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.finance-kpi-card.pagar::before {
  background: #f97316;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.6);
}

.kpi-top-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #94a3b8;
  text-transform: uppercase;
}

.finance-kpi-card.entradas .kpi-top-label { color: #34d399; }
.finance-kpi-card.saidas .kpi-top-label { color: #f87171; }
.finance-kpi-card.receber .kpi-top-label { color: #fbbf24; }
.finance-kpi-card.pagar .kpi-top-label { color: #fb923c; }

.kpi-main-val {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.kpi-bottom-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
  margin-top: 2px;
}

.finance-kpi-card.entradas .kpi-bottom-sub { color: #34d399; }
.finance-kpi-card.saidas .kpi-bottom-sub { color: #f87171; }
.finance-kpi-card.receber .kpi-bottom-sub { color: #fbbf24; }
.finance-kpi-card.pagar .kpi-bottom-sub { color: #fb923c; }

/* Composição das Entradas (Estilo da Print) */
.finance-composition-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.7) 0%, rgba(9, 15, 28, 0.85) 100%);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 14px;
  padding: 16px 20px;
}

.composition-title {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

.composition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.comp-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(6, 12, 23, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 14px;
  border-radius: 10px;
}

.comp-name {
  font-size: 12px;
  color: #94a3b8;
}

.comp-val {
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
}

/* Área de Conteúdo das Abas */
.finance-tab-content {
  display: none;
  animation: fadeInFinance 0.2s ease-in-out;
}

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

@keyframes fadeInFinance {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tabela de Fluxo de Caixa (Estilo Exato da Print) */
.cashflow-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.cashflow-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #64748b;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cashflow-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

.cashflow-table tr:hover td {
  background: rgba(56, 189, 248, 0.04);
}

.cashflow-table .cf-day {
  font-weight: 700;
  color: #94a3b8;
}

.cashflow-table .cf-income {
  font-weight: 700;
  color: #10b981;
}

.cashflow-table .cf-expense {
  font-weight: 700;
  color: #ef4444;
}

.cashflow-table .cf-balance-pos {
  font-weight: 700;
  color: #38bdf8;
}

.cashflow-table .cf-balance-neg {
  font-weight: 700;
  color: #f87171;
}

.cashflow-table .cf-accumulated {
  font-weight: 800;
  color: #ffffff;
}

.cashflow-table .cf-empty {
  color: #475569;
}

/* Card e Listas de A Receber */
.receivables-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.receivables-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.receivables-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.receivable-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  transition: all 0.15s ease;
}

.receivable-card-item:hover {
  background: rgba(15, 23, 42, 0.85);
  border-color: #f59e0b;
}

.receivable-card-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.receivable-card-left .rec-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.receivable-card-left .rec-meta {
  font-size: 12px;
  color: #94a3b8;
}

.receivable-card-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.receivable-card-right .rec-value {
  font-size: 17px;
  font-weight: 800;
  color: #fbbf24;
}

.rec-btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #25d366;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.rec-btn-wa:hover {
  opacity: 0.9;
}

/* Filtros rápidos do extrato */
.entries-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.entries-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.entries-filters input, .entries-filters select {
  background: #070e1b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
}

/* Grid de Visão Geral (Gráficos e Detalhes) */
.finance-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.finance-overview-wide {
  grid-column: 1 / -1;
}

.box-title-pro {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Pílulas de tipo de transação */
.type-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.type-pill.income {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.type-pill.expense {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Responsividade Mobile */
@media (max-width: 768px) {
  .finance-advanced-panel {
    padding: 16px;
    gap: 16px;
  }
  .finance-kpis-grid {
    grid-template-columns: 1fr 1fr;
  }
  .composition-grid {
    grid-template-columns: 1fr 1fr;
  }
  .finance-head-pro {
    flex-direction: column;
    align-items: flex-start;
  }
  .finance-head-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .finance-kpis-grid {
    grid-template-columns: 1fr;
  }
  .composition-grid {
    grid-template-columns: 1fr;
  }
}
