/* CSS Global e Sistema de Design para San. Financeiro */

/* Importar Fontes Metropolis e Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.cdnfonts.com/css/metropolis');

/* Variáveis e Temas */
:root {
  /* Tema Escuro (Padrão) */
  --bg-primary: #111111;
  --bg-secondary: #1a1a1a;
  --bg-card: rgba(49, 49, 49, 0.4);
  --bg-card-hover: rgba(49, 49, 49, 0.65);
  --border-color: rgba(92, 92, 92, 0.25);
  --border-color-hover: rgba(219, 219, 219, 0.2);
  
  --text-primary: #DBDBDB;
  --text-secondary: #9ca3af;
  --text-muted: #5C5C5C;
  
  --primary: #A9E100;
  --primary-hover: #91C200;
  --primary-light: rgba(169, 225, 0, 0.12);
  
  --success: #91C200;
  --success-hover: #455C00;
  --success-light: rgba(145, 194, 0, 0.1);
  
  --danger: #ff5a5a;
  --danger-hover: #e04b4b;
  --danger-light: rgba(255, 90, 90, 0.1);
  
  --warning: #eab308;
  --warning-hover: #ca8a04;
  --warning-light: rgba(234, 179, 8, 0.1);
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  --glass-blur: blur(12px);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

[data-theme="light"] {
  /* Tema Claro */
  --bg-primary: #E8E8E8;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-color: rgba(49, 49, 49, 0.08);
  --border-color-hover: rgba(49, 49, 49, 0.15);
  
  --text-primary: #111111;
  --text-secondary: #5C5C5C;
  --text-muted: #94a3b8;
  
  --primary: #A9E100;
  --primary-hover: #91C200;
  --primary-light: rgba(169, 225, 0, 0.12);
  
  --success: #91C200;
  --success-hover: #455C00;
  --success-light: rgba(145, 194, 0, 0.1);
  
  --danger: #d13b3b;
  --danger-hover: #b91c1c;
  --danger-light: rgba(209, 59, 59, 0.08);
  
  --warning: #ca8a04;
  --warning-hover: #a16207;
  --warning-light: rgba(202, 138, 4, 0.08);
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

/* Reset de Estilos */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  outline: none;
}

/* Tipografia de Identidade Visual */
h1, h2, h3, h4, h5, h6,
.stat-value,
.chart-title,
.section-title,
.logo,
.logo-icon,
.balance-title,
.account-balance,
.btn,
.nav-item,
.modal-title {
  font-family: 'Metropolis', 'Inter', sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color-hover);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout Principal */
header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 200;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle-btn {
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  align-items: center;
  height: 34px;
  transition: all var(--transition-fast);
}

.logo-container img {
  height: 100%;
  width: auto;
  max-width: 100%;
}

.logo-dark-theme { display: block; }
.logo-light-theme { display: none; }
[data-theme="light"] .logo-dark-theme { display: none; }
[data-theme="light"] .logo-light-theme { display: block; }

/* ===== LAYOUT SEM HEADER — SIDEBAR FULL HEIGHT ===== */
.layout-body {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

/* Sidebar ocupa altura total da tela */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 0;
  height: 100vh;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow: hidden;
  transition: width 0.25s ease;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed {
  width: 64px;
}

/* Container interno com scroll se necessário */
.sidebar-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: padding 0.25s ease;
}

.sidebar.collapsed .sidebar-inner {
  padding: 16px 8px;
}

/* Topo da sidebar: logo + botão toggle lado a lado (expandido) */
.sidebar-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px 4px;
  width: 100%;
}

/* Logo completo — visível apenas expandido */
.sidebar-logo-full {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.sidebar-logo-full img {
  height: 52px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Logo mini (favicon) — visível apenas colapsado */
.sidebar-logo-mini {
  display: none;
  align-items: center;
  justify-content: center;
}

.sidebar-logo-mini img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

/* Colapsado: muda para coluna centralizada */
.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sidebar.collapsed .sidebar-logo-full {
  display: none;
}

.sidebar.collapsed .sidebar-logo-mini {
  display: flex;
}


/* Botão Nova Transação na sidebar */
.sidebar-new-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 12px;
  padding: 10px 14px;
}

.sidebar.collapsed .sidebar-new-btn span {
  display: none;
}

.sidebar.collapsed .sidebar-new-btn {
  padding: 10px;
  min-width: unset;
}


.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.sidebar-item i {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.sidebar-item span {
  opacity: 1;
  transition: opacity 0.15s ease, max-width 0.25s ease;
  max-width: 200px;
  overflow: hidden;
}

/* Colapsado: centraliza ícone, esconde texto */
.sidebar.collapsed .sidebar-inner {
  padding: 16px 8px;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}

.sidebar.collapsed .sidebar-item span {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

.sidebar-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .sidebar-item:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.sidebar-item.active {
  color: #111111;
  background-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .sidebar-item.active {
  color: #111111;
}

/* Overlay mobile */
.sidebar-overlay {
  display: none;
}

/* Main ocupa o restante ao lado da sidebar */
main {
  flex: 1;
  min-width: 0;
  padding: 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
}


/* Espaçador flex na sidebar */
.sidebar-spacer {
  flex: 1;
}

/* Divisor na sidebar */
.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 0;
}

/* Bloco de usuário + logout na base da sidebar */
.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  margin-top: 8px;
  overflow: hidden;
  transition: all 0.25s ease;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
}

.sidebar-user-info i,
.sidebar-user-info svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  color: var(--text-secondary);
}

.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.2s ease, max-width 0.25s ease;
  max-width: 200px;
}

.sidebar-logout-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s ease;
}

/* Colapsado: mostra apenas ícone de usuário centralizado */
.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding: 8px 0;
  border: none;
  background: transparent;
}

.sidebar.collapsed .sidebar-user-info {
  flex: none;
  justify-content: center;
}

.sidebar.collapsed .sidebar-user-email,
.sidebar.collapsed .sidebar-logout-btn {
  display: none;
}



/* Nav do header (topo) */
.nav-links {
  display: flex;
  gap: 6px;
  background-color: rgba(0, 0, 0, 0.1);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .nav-links {
  background-color: rgba(0, 0, 0, 0.03);
}

.nav-item {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .nav-item:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.nav-item.active {
  color: #111111;
  background-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .nav-item.active {
  color: #111111;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  max-width: 200px;
  overflow: hidden;
}

.header-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user i {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}


/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--primary);
  color: #111111;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(169, 225, 0, 0.25);
  color: #111111;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color-hover);
}

[data-theme="light"] .btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-color-hover);
  background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .btn-icon:hover {
  background-color: rgba(0, 0, 0, 0.02);
}


/* Seções de Exibição das Abas */
.page-section {
  display: none;
  animation: fadeIn var(--transition-normal) forwards;
}

.page-section.active {
  display: block;
}

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

/* Títulos de Páginas */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* Cartões Metas / Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-glass);
  transition: border-color var(--transition-normal), background-color var(--transition-normal), transform var(--transition-normal);
}

.glass-card:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: transparent;
}

.stat-card.card-balance::after { background: var(--primary); }
.stat-card.card-receivable::after { background: var(--success); }
.stat-card.card-payable::after { background: var(--danger); }
.stat-card.card-projected::after { background: var(--warning); }

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-balance .stat-icon { background: var(--primary-light); color: var(--primary); }
.card-receivable .stat-icon { background: var(--success-light); color: var(--success); }
.card-payable .stat-icon { background: var(--danger-light); color: var(--danger); }
.card-projected .stat-icon { background: var(--warning-light); color: var(--warning); }

.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.stat-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Gráficos Grid */
.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.charts-grid-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.chart-container {
  height: 320px;
  position: relative;
  width: 100%;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Lista / Tabela Recentes */
.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Tabela e Linhas */
.table-container {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 16px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.05em;
}

td {
  padding: 16px 20px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr {
  transition: background-color var(--transition-fast);
}

tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.01);
}

/* Badges e Tipos */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-income {
  background-color: var(--success-light);
  color: var(--success);
}

.badge-expense {
  background-color: var(--danger-light);
  color: var(--danger);
}

.badge-pending {
  background-color: var(--warning-light);
  color: var(--warning);
}

.badge-realized {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

[data-theme="light"] .badge-realized {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Indicador de Categoria */
.category-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

/* Formatação de Valores */
.amount-text {
  font-weight: 600;
}
.amount-text.income {
  color: var(--success);
}
.amount-text.expense {
  color: var(--danger);
}
.amount-text.pending {
  color: var(--warning);
}

/* Controles de Filtro */
.filter-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-wrapper svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  width: 18px;
  height: 18px;
}

.input-field {
  width: 100%;
  padding: 10px 16px;
  padding-left: 44px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.select-field {
  padding: 10px 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  min-width: 160px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.select-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Modais */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  overflow-y: auto;
  padding: 24px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: calc(80vh - 160px);
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

[data-theme="light"] .modal-footer {
  background-color: rgba(0, 0, 0, 0.01);
}

/* Formulários */
.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

/* Forçar reset robusto no input de data para evitar vazamento lateral em navegadores móveis (iOS Safari) */
input[type="date"].form-input {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  display: block !important;
  overflow: hidden !important;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Estilo de Opções Radiais/Abas do Formulário (Entrada/Saída) */
.form-tab-group {
  display: flex;
  background-color: var(--bg-primary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.form-tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.form-tab-btn.active[data-type="income"] {
  background-color: var(--success);
  color: #ffffff;
}

.form-tab-btn.active[data-type="expense"] {
  background-color: var(--danger);
  color: #ffffff;
}

/* Alinhamento de Ações em Linhas de Tabela */
.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Vazio */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 320px;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast-content {
  font-size: 0.875rem;
  font-weight: 500;
}

/* Categorias de Configuração Grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.category-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.category-card:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}

.category-card .row-actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.category-card:hover .row-actions {
  opacity: 1;
  pointer-events: auto;
}

.category-card .row-actions .btn-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.category-card .row-actions .btn-action:hover {
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

.category-card .row-actions .btn-action.btn-edit:hover {
  color: var(--primary);
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.category-card .row-actions .btn-action.btn-delete:hover {
  color: var(--danger);
  background-color: var(--danger-light);
  border-color: var(--danger);
}

.category-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.category-name {
  font-weight: 500;
  font-size: 0.875rem;
}

.category-type-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Indicador de Status de Pagamento */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-indicator.late {
  color: var(--danger);
}

/* Responsividade Geral */
/* ===================================================
   MOBILE — Bottom Nav + FAB
   =================================================== */

/* Bottom nav: oculto no desktop */
.mobile-bottom-nav { display: none; }
.mobile-fab        { display: none; }
.mobile-fab-placeholder { display: none; }
.mobile-more-popover { display: none; }

@media (max-width: 768px) {

  /* Ajuste de Modais para Mobile (Encostado perfeitamente no Topo da Tela) */
  .modal-overlay {
    align-items: flex-start !important;
    padding: 0 8px 16px 8px !important; /* Totalmente encostado no topo! */
    overflow-x: hidden !important;
  }

  .modal-content {
    max-height: 82vh !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important; /* Cantos retos no topo, arredondados embaixo */
    overflow-x: hidden !important;
  }

  .modal-body {
    max-height: calc(82vh - 150px) !important;
    overflow-x: hidden !important;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* 1. Sidebar some completamente */
  .sidebar { display: none !important; }
  .sidebar-overlay { display: none !important; }

  /* 2. Layout vira coluna única */
  .layout-body {
    flex-direction: column;
  }

  /* 3. Main ocupa tudo, com padding inferior para não ficar atrás da bottom nav */
  main {
    padding: 20px 16px 100px;
    min-height: 100vh;
  }

  /* 4. Grids simplificados */
  .charts-grid,
  .charts-grid[style],
  #op-costs-grid-layout {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .accounts-grid {
    grid-template-columns: 1fr !important;
  }

  /* 5. Page header em coluna */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }
  .page-header .btn { width: 100%; }

  /* 6. Filtros em coluna */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-wrapper, .select-field, .input-field { width: 100%; }

  /* 7. Tabela responsiva em cards */
  table thead { display: none; }
  tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: 12px;
  }
  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 4px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
  }
  tbody td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    text-align: left;
  }
  tbody td:last-child { border-bottom: none; justify-content: flex-end; }

  /* 8. Modal em tela cheia */
  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
  }

  /* ── BOTTOM NAVIGATION ── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 900;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-family: var(--font-family);
    font-weight: 500;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
  }

  .mobile-nav-item i,
  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
  }

  .mobile-nav-item.active {
    color: var(--primary);
  }

  .mobile-nav-item:hover {
    color: var(--text-primary);
  }

  /* Espaço no centro para o FAB */
  .mobile-fab-placeholder {
    display: block;
    width: 64px;
    flex-shrink: 0;
  }

  /* ── FAB (Floating Action Button) ── */
  .mobile-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #111;
    border: none;
    cursor: pointer;
    z-index: 950;
    box-shadow: 0 4px 20px rgba(169,225,0,0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-fab:active {
    transform: translateX(-50%) scale(0.93);
    box-shadow: 0 2px 10px rgba(169,225,0,0.4);
  }

  .mobile-fab i,
  .mobile-fab svg {
    width: 24px;
    height: 24px;
  }
}

/* ===== LISTA DE USUÁRIOS ===== */
.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  transition: border-color 0.2s;
}

.user-row:hover {
  border-color: var(--primary);
}

.user-row-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #111;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.user-row-info strong {
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row-info span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  flex-shrink: 0;
}

.user-row-meta span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ===== CONTAS BANCÁRIAS ===== */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.account-card:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.account-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.account-name {
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.account-balance {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-top: 2px;
  letter-spacing: -0.02em;
}

/* Ações no Hover para cards de Conta em Configurações */
.account-card .row-actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.account-card:hover .row-actions {
  opacity: 1;
  pointer-events: auto;
}

.account-card .row-actions .btn-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.account-card .row-actions .btn-action:hover {
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

.account-card .row-actions .btn-action.btn-edit:hover {
  color: var(--primary);
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.account-card .row-actions .btn-action.btn-delete:hover {
  color: var(--danger);
  background-color: var(--danger-light);
  border-color: var(--danger);
}

/* ── MENU FLUTUANTE "MAIS" PARA MOBILE ── */
@media (max-width: 768px) {
  .mobile-more-popover {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 200px;
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 940;
    padding: 6px 0;
    flex-direction: column;
    gap: 2px;
    transition: opacity 0.2s, transform 0.2s;
    transform: translateY(10px);
    opacity: 0;
    pointer-events: none;
  }

  .mobile-more-popover.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-more-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }

  .mobile-more-item:active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
  }

  .mobile-more-item.active {
    color: var(--primary);
    background: rgba(169, 225, 0, 0.1);
  }

  .mobile-more-item i,
  .mobile-more-item svg {
    width: 18px;
    height: 18px;
  }
}

/* ============================================================ */
/* FEE PROFILE DRAWER                                           */
/* ============================================================ */

.fee-profile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
}
.fee-profile-backdrop.active { display: block; }

.fee-profile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
}
.fee-profile-drawer.active { transform: translateX(0); }

.fee-profile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  gap: 12px;
  flex-shrink: 0;
}

.fee-profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #5ea800);
  color: #111;
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(169, 225, 0, 0.25);
}

.fee-profile-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 32px;
}
.fee-profile-body::-webkit-scrollbar { width: 4px; }
.fee-profile-body::-webkit-scrollbar-track { background: transparent; }
.fee-profile-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.fee-invoice-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
  background: var(--bg-card);
  transition: all 0.18s ease;
}
.fee-invoice-row:hover {
  border-color: var(--border-color-hover);
  transform: translateX(2px);
  background: var(--bg-card-hover);
}
.fee-invoice-row.status-paid { opacity: 0.72; }
.fee-invoice-row.status-overdue {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.04);
}
.fee-invoice-row.status-cancelled { opacity: 0.5; }

@media (max-width: 520px) {
  .fee-profile-drawer { width: 100vw; border-left: none; }
}

/* Estilos de Ajuste / Transferência Interna */
.transfer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .transfer-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ===== RELATÓRIOS FINANCEIROS ===== */

/* Grid de gráficos dos relatórios */
#rpt-charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

@media (max-width: 900px) {
  #rpt-charts-grid {
    grid-template-columns: 1fr;
  }
}

/* Tabela Pivot — Categorias × Meses */
.reports-pivot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.reports-pivot-table thead th {
  padding: 10px 12px;
  text-align: right;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-family: 'Metropolis', 'Inter', sans-serif;
}

.reports-pivot-table thead th:first-child {
  text-align: left;
}

.reports-pivot-table tbody td {
  padding: 10px 12px;
  text-align: right;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(92, 92, 92, 0.1);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.reports-pivot-table tbody td:first-child {
  text-align: left;
  font-weight: 500;
}

.reports-pivot-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .reports-pivot-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.reports-pivot-table tfoot td {
  padding: 10px 12px;
  text-align: right;
  font-weight: 700;
  color: var(--text-primary);
  border-top: 2px solid var(--border-color);
  font-family: 'Metropolis', 'Inter', sans-serif;
  white-space: nowrap;
}

.reports-pivot-table tfoot td:first-child {
  text-align: left;
}

/* Highlight de célula com maior valor */
.pivot-cell-highlight {
  background: rgba(255, 90, 90, 0.08);
  border-radius: 4px;
  color: var(--danger);
  font-weight: 600;
}

[data-theme="light"] .pivot-cell-highlight {
  background: rgba(209, 59, 59, 0.06);
}

/* Cards de resumo por conta */
.rpt-account-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color var(--transition-fast);
}

.rpt-account-card:hover {
  border-color: var(--border-color-hover);
}

.rpt-account-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.rpt-account-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rpt-account-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: 'Metropolis', 'Inter', sans-serif;
}

.rpt-account-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.rpt-account-metric {
  text-align: center;
}

.rpt-account-metric-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.rpt-account-metric-value {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Metropolis', 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
}

/* Utilitários de Cores de Texto */
.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}
