/* =============================================
   FINELLA - Controle Financeiro Feminino
   Público: mulheres 25–50 anos
   Paleta: Lavanda + Rhodamine + Menta
   ============================================= */

:root {
  /* Cores primárias — FinElla */
  --primary: #4C1D95;
  --primary-dark: #3b1578;
  --primary-light: #f3f0ff;
  
  /* Cores semânticas */
  --success: #0a7c3e;
  --success-light: #d1fae5;
  --danger: #c0392b;
  --danger-light: #fee2e2;
  --warning: #b45309;
  --warning-light: #fef3c7;
  --info: #0e7490;
  --info-light: #cffafe;
  
  /* Categorias — FinElla */
  --fixas-color: #4C1D95;
  --fixas-bg: #ede8fa;
  --variaveis-color: #E10098;
  --variaveis-bg: #fdf0fa;
  --financiamentos-color: #7C3AED;
  --financiamentos-bg: #ece8fc;
  --receitas-color: #059669;
  --receitas-bg: #e6f4ee;
  --investimentos-color: #059669;
  --investimentos-bg: #e6f4ee;
  
  /* Neutros */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Tipografia - FinElla */
  --font-base: 'Nunito', sans-serif;
  --text-xs: 13px;
  --text-sm: 15px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 28px;
  --text-4xl: 36px;
  
  /* Espaçamento */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  
  /* Layout */
  --header-height: 70px;
  --max-width: 1200px;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
  
  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* Reset e base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: var(--text-base);
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  color: var(--gray-900);
  background-color: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Foco visível - Acessibilidade */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===== HEADER ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 100%);
  height: var(--header-height);
  box-shadow: 0 2px 12px rgba(76,29,149,0.25);
  border-bottom: none;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

/* FinElla brand no header */
.finella-brand {
  display: flex;
  align-items: center;
  gap: 0;
}
.finella-name {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1;
}
.finella-divider {
  width: 1.5px;
  height: 38px;
  background: rgba(255,255,255,0.4);
  margin: 0 12px;
  border-radius: 2px;
}
.finella-tagline {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.finella-tagline span {
  font-size: 11px;
  color: rgba(255,255,255,0.80);
  font-style: italic;
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.2px;
  line-height: 1.45;
}

/* Mobile: esconde tagline para não apertar */
@media (max-width: 400px) {
  .finella-tagline { display: none; }
  .finella-divider { display: none; }
}

/* Botão Sair na página Conta */
.btn-conta-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: #fff;
  border: 2px solid #1e3a5f;
  border-radius: 8px;
  color: #1e3a5f;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.btn-conta-logout:hover { background: #1e3a5f; color: #fff; }
.btn-conta-logout i { font-size: 15px; }

/* Logo na tela de auth */
.auth-logo-img {
  height: 118px;
  width: auto;
  object-fit: contain;
  margin-bottom: var(--space-4);
}

.brand-icon { font-size: 28px; }
.brand-name {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Nav desktop — dentro do header, visível em telas >= 768px */
.main-nav--desktop {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* Barra inferior mobile — FORA do header, controlada pelo JS */
.bottom-nav {
  display: none; /* JS faz display:flex quando logado */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #4C1D95;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
  z-index: 2000;
  border-top: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 -4px 20px rgba(76,29,149,0.4);
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Em desktop, a bottom-nav nunca aparece */
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  color: #4C1D95;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 75px;
}

.nav-btn:hover {
  background: rgba(76,29,149,0.12);
  color: #4C1D95;
}

.nav-btn.active {
  background: rgba(255,255,255,0.20);
  color: white;
}

/* Nav buttons desktop — texto lavanda no fundo gradiente */
.main-nav--desktop .nav-btn {
  color: rgba(255,255,255,0.80);
}
.main-nav--desktop .nav-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.main-nav--desktop .nav-btn.active {
  background: rgba(255,255,255,0.25);
  color: white;
}

/* Botões da bottom-nav: inativos branco semi-transparente, ativo com destaque */
.bottom-nav .nav-btn {
  color: rgba(255,255,255,0.65);
}
.bottom-nav .nav-btn:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.90);
}
.bottom-nav .nav-btn.active {
  background: rgba(255,255,255,0.22);
  color: white;
  border-radius: 14px;
}
.bottom-nav .nav-btn.active i {
  color: #E10098;
}

.hamburger {
  display: none;
}

/* ===== MAIN ===== */
.app-main {
  min-height: calc(100vh - var(--header-height));
  padding-bottom: var(--space-10);
}

.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-6);
}

.page-header {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Cabeçalho da página Conta: título à esq, botão Sair à dir */
#page-conta .page-header {
  justify-content: space-between;
  align-items: center;
  flex-direction: row;
  flex-wrap: nowrap;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-title i { color: var(--primary); }

/* ===== LOADING ===== */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: var(--space-4);
  color: var(--gray-600);
  font-size: var(--text-lg);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== AUTH ===== */
.auth-container {
  max-width: 480px;
  margin: 40px auto;
  padding: var(--space-4);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
  display: flex;
  justify-content: center;
}

.auth-logo-img {
  height: 135px;
  width: auto;
  object-fit: contain;
}

.auth-tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--border-radius-lg);
  padding: 4px;
  margin-bottom: var(--space-6);
}

.auth-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: none;
  background: none;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-500);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  background: white;
  border-radius: var(--border-radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}

.otp-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.otp-icon { font-size: 48px; color: var(--primary); }

.otp-header h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-top: var(--space-3);
}

.otp-desc {
  font-size: var(--text-base);
  color: var(--gray-500);
  margin-top: var(--space-2);
}

/* ===== FORMULÁRIOS ===== */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-base);
  color: var(--gray-900);
  background: white;
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.15);
  outline: none;
}

.form-control-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
  border-radius: var(--border-radius);
  min-height: 58px;
}

.form-control-xl {
  font-size: 32px;
  text-align: center;
  letter-spacing: 0.5em;
  font-weight: 700;
}

.otp-input {
  font-size: 28px !important;
  text-align: center;
  letter-spacing: 0.3em;
  font-weight: 700;
}

.form-hint {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-top: var(--space-1);
  display: block;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  flex: 1;
}

/* Botão de olho (ver/esconder senha) — tela de Conta */
.btn-eye {
  background: var(--gray-100);
  border: 2px solid var(--gray-300);
  border-left: none;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  padding: 0 var(--space-4);
  color: var(--primary);
  font-size: var(--text-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-width: 48px;
}
.btn-eye:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.btn-toggle-pass {
  padding: 0 var(--space-4);
  border: 2px solid var(--gray-300);
  border-left: none;
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  font-size: var(--text-lg);
  transition: all 0.2s;
  min-width: 54px;
}

.btn-toggle-pass:hover { background: var(--gray-200); color: var(--gray-700); }

.radio-group {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.radio-option {
  flex: 1;
  min-width: 140px;
  cursor: pointer;
}

.radio-option input[type="radio"] { display: none; }

.radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-600);
  transition: all 0.2s;
  background: white;
}

.radio-option input[type="radio"]:checked + .radio-label {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== BOTÕES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-base);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  min-height: 48px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) { background: #085f30; }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #a93226; }

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}
.btn-warning:hover:not(:disabled) { background: #8a3e04; }

.btn-info {
  background: var(--info);
  color: white;
  border-color: var(--info);
}
.btn-info:hover:not(:disabled) { background: #0a5a71; }

.btn-outline {
  background: white;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-outline:hover:not(:disabled) { background: var(--gray-100); border-color: var(--gray-400); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  min-height: 56px;
  border-radius: var(--border-radius);
}

.btn-xl {
  padding: var(--space-5) var(--space-8);
  font-size: var(--text-xl);
  min-height: 64px;
  border-radius: var(--border-radius-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  min-height: 38px;
}

.btn-full { width: 100%; }

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--border-radius);
  background: white;
  color: var(--gray-700);
  border: 2px solid var(--gray-300);
  font-size: 18px;
}

.btn-icon:hover { background: var(--gray-100); }

.btn-toggle {
  background: transparent;
  color: var(--gray-500);
  border: 2px solid var(--gray-200);
  font-size: var(--text-base);
}

.btn-toggle.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: var(--space-2) 0;
  display: block;
  text-align: center;
}

.btn-link:hover { color: var(--primary-dark); }

/* ===== ALERTAS ===== */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--border-radius);
  font-size: var(--text-base);
  font-weight: 500;
  margin: var(--space-3) 0;
  border-width: 1px;
  border-style: solid;
}

.alert-error {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #f5c2bb;
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
  border-color: #86efac;
}

.alert-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-color: #fcd34d;
}

.alert-info {
  background: var(--info-light);
  color: var(--info);
  border-color: #67e8f9;
}

/* ===== CONTROLES DE PERÍODO ===== */
.controls-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-left: auto;
}

.period-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: var(--space-2);
}

.period-display {
  min-width: 160px;
  text-align: center;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-800);
  padding: 0 var(--space-2);
}

.view-toggle {
  display: flex;
  gap: var(--space-2);
}

/* ===== CARDS DE RESUMO ===== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.summary-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  border-left: 5px solid;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Card Disponível Invest. — fundo colorido */
.summary-card--positive {
  background: #0a7c3e;
  border-left-color: #085e2e !important;
}
.summary-card--positive .summary-card-label {
  color: rgba(255,255,255,0.85);
}
.summary-card--positive .summary-card-value {
  color: #ffffff !important;
}

.summary-card--negative {
  background: #C80101;
  border-left-color: #c41a00 !important;
}
.summary-card--negative .summary-card-label {
  color: rgba(255,255,255,0.85);
}
.summary-card--negative .summary-card-value {
  color: #ffffff !important;
}

.summary-card-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-card-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1.2;
}

.summary-card-sub {
  font-size: var(--text-sm);
  color: var(--gray-500);
}

/* ===== BLOCOS DE CATEGORIA ===== */
.expense-block {
  background: #D3D3D3;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-5);
  overflow: hidden;
}

.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 2px solid var(--gray-100);
  cursor: pointer;
  user-select: none;
}

.block-header:hover { background: var(--gray-50); }

.block-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.block-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.block-title { font-size: var(--text-xl); font-weight: 700; }
.block-total { font-size: var(--text-xl); font-weight: 800; }

/* Chevron destacado */
.chevron-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.block-body { padding: var(--space-4) var(--space-5); background: white; }

.expense-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--gray-100);
}

.expense-item:last-child { border-bottom: none; }

.expense-item-info { flex: 1; min-width: 0; }

.expense-item-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-item-meta {
  font-size: var(--text-sm);
  color: var(--gray-400);
  margin-top: 2px;
}

.expense-item-amount {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
}

.expense-item-actions {
  display: flex;
  gap: var(--space-2);
}

.add-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
  background: transparent;
  border: 2px dashed var(--gray-300);
  border-radius: var(--border-radius);
  color: var(--gray-500);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}

.add-btn:hover {
  background: var(--gray-50);
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== RESULTADO DO MÊS ===== */
.result-card {
  background: var(--gray-900);
  color: white;
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-lg);
}

.result-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  margin-bottom: var(--space-4);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.result-item { text-align: center; }

.result-label {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-1);
}

.result-value {
  font-size: var(--text-2xl);
  font-weight: 800;
}

.result-positive { color: #0a7c3e; }
.result-negative { color: #FD3500; }
.result-neutral { color: white; }

/* ===== DASHBOARD / GRÁFICOS ===== */
.dashboard-section {
  margin-top: var(--space-8);
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-title i { color: var(--primary); }

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-5);
}

.chart-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.chart-full { grid-column: 1 / -1; }

.chart-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: var(--space-4);
  text-align: center;
}

.chart-wrapper {
  position: relative;
  height: 280px;
}

/* ===== TABELA ANUAL ===== */
.annual-table-wrapper {
  overflow-x: auto;
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-5);
}

.annual-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.annual-table th {
  background: var(--gray-800);
  color: white;
  padding: var(--space-4) var(--space-5);
  text-align: left;
  font-weight: 700;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.annual-table td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-100);
  white-space: nowrap;
}

.annual-table tr:hover td { background: var(--gray-50); }
.annual-table tr.total-row td { background: var(--gray-100); font-weight: 700; }
.annual-table tr.avg-row td { background: var(--primary-light); font-weight: 600; }

.annual-table td.month-link {
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
}

.annual-table td.month-link:hover { color: var(--primary-dark); }

.td-positive { color: var(--success); font-weight: 700; }
.td-negative { color: var(--danger); font-weight: 700; }
.td-receitas { color: var(--receitas-color); }
.td-fixas { color: var(--fixas-color); }
.td-variaveis { color: var(--variaveis-color); }
.td-financiamentos { color: var(--financiamentos-color); }

/* ===== FILTROS / RELATÓRIOS ===== */
.filter-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.filter-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.period-inputs {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.period-inputs .form-control { flex: 1; }

/* ===== TABELA DE RESULTADOS ===== */
.result-table-card {
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.result-table-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 2px solid var(--gray-100);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.result-count {
  font-size: var(--text-base);
  color: var(--gray-600);
}

.result-table-wrapper { overflow-x: auto; }

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.result-table th {
  background: var(--gray-100);
  padding: var(--space-4) var(--space-5);
  text-align: left;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.result-table td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-100);
}

.result-table tr:hover td { background: var(--gray-50); }

.result-table tfoot td {
  background: var(--primary-light);
  font-weight: 700;
  font-size: var(--text-lg);
  border-top: 2px solid var(--gray-200);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }

/* ===== LOGS ===== */
.logs-list {
  background: white;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.log-item {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.log-item:last-child { border-bottom: none; }
.log-item:hover { background: var(--gray-50); }

.log-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.log-content { flex: 1; }

.log-action {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gray-800);
}

.log-detail {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-top: 2px;
}

.log-time {
  font-size: var(--text-sm);
  color: var(--gray-400);
  white-space: nowrap;
}

.log-data {
  margin-top: var(--space-2);
}

.log-data summary {
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--primary);
  font-weight: 600;
}

.log-data pre {
  background: var(--gray-100);
  border-radius: var(--border-radius);
  padding: var(--space-3);
  font-size: 13px;
  overflow-x: auto;
  margin-top: var(--space-2);
  white-space: pre-wrap;
}

/* ===== PAGINAÇÃO ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5);
  flex-wrap: wrap;
}

.pagination-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 var(--space-3);
  border: 2px solid var(--gray-200);
  background: white;
  color: var(--gray-700);
  border-radius: var(--border-radius);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary); }
.pagination-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== CONTA ===== */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  width: 100%;
  box-sizing: border-box;
}

.account-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.account-card-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.account-card-title i { color: var(--primary); }

.info-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  border-radius: var(--border-radius);
  border: 2px solid var(--gray-200);
  min-height: 58px;
}

.info-value {
  flex: 1;
  font-size: var(--text-lg);
  color: var(--gray-700);
}

.account-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.divider {
  border: none;
  border-top: 2px solid var(--gray-100);
  margin: var(--space-5) 0;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.2s;
}

@keyframes fadeIn { from { opacity: 0; } }

.modal-box {
  background: white;
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s;
}

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 2px solid var(--gray-100);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 2px solid var(--gray-100);
  flex-wrap: wrap;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-base);
  font-weight: 500;
  max-width: 360px;
  pointer-events: auto;
  animation: toastIn 0.3s;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--danger); }
.toast.toast-warning { background: var(--warning); }
.toast.toast-info { background: var(--info); }

/* ===== MISC ===== */
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.text-center { text-align: center; }

.empty-state {
  text-align: center;
  padding: var(--space-12);
  color: var(--gray-400);
}

.empty-state i { font-size: 48px; margin-bottom: var(--space-4); display: block; }
.empty-state p { font-size: var(--text-lg); }

.tag-recorrente {
  background: var(--info-light);
  color: var(--info);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Tag de data de vencimento / inclusão / previsão */
.tag-due-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff3cd;
  color: #856404;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.tag-due-income {
  background: #d1fae5;
  color: #065f46;
}

/* Cores por categoria */
.cat-fixas { color: var(--fixas-color); background: var(--fixas-bg); }
.cat-variaveis { color: var(--variaveis-color); background: var(--variaveis-bg); }
.cat-financiamentos { color: var(--financiamentos-color); background: var(--financiamentos-bg); }
.cat-receitas { color: var(--receitas-color); background: var(--receitas-bg); }

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
  :root {
    --text-base: 17px;
    --text-lg: 19px;
  }
  
  .hamburger { display: none !important; }

  /* Desktop nav some no mobile */
  .main-nav--desktop { display: none !important; }

  /* Header mobile: padding reduzido, logo menor */
  .header-inner {
    padding: 0 8px;
    gap: 8px;
  }
  .header-logo {
    height: 44px;
    width: auto;
    max-width: calc(100vw - 80px);
  }

  /* Espaço para não cobrir conteúdo com a bottom-nav */
  .app-main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom) + 12px) !important;
  }

  /* Botões da bottom-nav no mobile */
  .bottom-nav .nav-btn {
    min-width: 0;
    flex: 1;
    padding: 6px 4px;
    border-radius: 12px;
    gap: 2px;
  }
  .bottom-nav .nav-btn i  { font-size: 22px; }
  .bottom-nav .nav-btn span { font-size: 11px; font-weight: 600; }

  .brand-name { display: none; }
  
  /* Container ocupa toda a largura com borda fina de 8px (~2mm) em cada lado */
  .page-container {
    padding: var(--space-3) 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Blocos de despesa/receita ocupam toda a largura disponível */
  .expense-block {
    width: 100%;
    box-sizing: border-box;
  }

  /* Block header mobile: permite quebra de linha para palavras longas */
  .block-header {
    padding: var(--space-3) var(--space-3);
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* Grupo título+ícone+badge: ocupa toda a linha */
  .block-title-group {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* Título do bloco pode quebrar em 2 linhas */
  .block-title {
    font-size: var(--text-base);
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
  }

  /* Total e chevron ficam na direita, abaixo do título */
  .block-header > div:last-child {
    margin-left: auto;
  }

  .block-total { font-size: var(--text-base); }

  /* Corpo do bloco com padding menor */
  .block-body { padding: var(--space-3) var(--space-3); background: white; }

  /* Nome da despesa/receita: permite 2 linhas em vez de cortar com "..." */
  .expense-item-name {
    white-space: normal;
    word-break: break-word;
    font-size: var(--text-sm);
    line-height: 1.3;
  }

  /* Valor: tamanho legível sem ser enorme */
  .expense-item-amount {
    font-size: var(--text-base);
    min-width: 0;
    text-align: right;
  }

  /* Botões de ação menores */
  .expense-item-actions .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  /* Botão adicionar ocupa toda largura */
  .add-btn {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
  
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls-bar {
    flex-direction: row;
    justify-content: center;
    margin-left: 0;
    width: 100%;
  }
  
  .period-selector {
    justify-content: center;
  }
  
  .period-display { min-width: 120px; font-size: var(--text-base); }
  
  .filter-grid { grid-template-columns: 1fr; }
  
  .charts-grid { grid-template-columns: 1fr; }
  
  /* Summary cards: 2 colunas, mesma largura dos blocos de despesa */
  .summary-cards {
    grid-template-columns: 1fr 1fr;
    width: 100%;
    box-sizing: border-box;
  }

  /* Cards individuais: padding compacto para caber na tela */
  .summary-card {
    padding: var(--space-3) var(--space-3);
    min-width: 0;
    overflow: hidden;
  }

  /* Label menor */
  .summary-card-label {
    font-size: 10px;
    letter-spacing: 0;
    white-space: normal;
    line-height: 1.2;
  }

  /* Valor: quebra se necessário, não transborda */
  .summary-card-value {
    font-size: var(--text-lg);
    word-break: break-word;
    line-height: 1.2;
  }
  
  /* Conta mobile: 1 coluna, padding compacto, sem overflow */
  .account-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    width: 100%;
  }

  .account-card {
    padding: var(--space-4) var(--space-3);
    width: 100%;
    box-sizing: border-box;
  }

  /* Botões de ação ocupam largura total */
  .account-actions .btn {
    width: 100%;
    box-sizing: border-box;
  }

  /* Conta: título e botão Sair lado a lado */
  #page-conta .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box {
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
    max-height: 92vh;
  }
  
  .toast-container {
    bottom: calc(64px + env(safe-area-inset-bottom) + 12px);
    left: var(--space-4);
    right: var(--space-4);
  }
  
  .toast { max-width: 100%; }
  
  .filter-actions { flex-direction: column; }
  .filter-actions .btn { width: 100%; }
  
  .annual-table th, .annual-table td { font-size: var(--text-sm); padding: var(--space-3); }
  
  .auth-form { padding: var(--space-5); }

  /* Filter card: padding menor no mobile */
  .filter-card {
    padding: var(--space-3) var(--space-3);
    margin-bottom: var(--space-4);
  }

  /* Filter grid: 1 coluna no mobile */
  .filter-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  /* Evitar overflow horizontal */
  .page, .page-container {
    overflow-x: hidden;
  }

  /* Logs mobile */
  .logs-list {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .log-item {
    padding: var(--space-3) var(--space-3);
    gap: var(--space-2);
    align-items: flex-start;
    min-width: 0;
  }

  .log-icon {
    width: 32px;
    height: 32px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .log-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .log-action {
    font-size: var(--text-sm);
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
  }

  .log-time {
    font-size: 11px;
    white-space: normal;
    word-break: break-all;
    text-align: right;
    flex-shrink: 0;
    max-width: 64px;
    line-height: 1.3;
  }

  /* Captcha input: largura total */
  .captcha-math-input {
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .summary-cards { grid-template-columns: 1fr 1fr; width: 100%; }
  .period-inputs { flex-direction: column; }
  .period-inputs .form-control { max-width: 100% !important; }
}

/* Print */
@media print {
  .app-header, .controls-bar, .filter-actions, .btn, .add-btn { display: none !important; }
  .app-main { padding: 0; }
  body { font-size: 12pt; }
}

/* Animações suaves */
.page { animation: pageFadeIn 0.25s; }
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(8px); } }

/* ═══════════════════════════════════════════════════════
   TELA DE AUTENTICAÇÃO — regras definitivas
   Vêm DEPOIS de .form-control, então sempre ganham
   ═══════════════════════════════════════════════════════ */

/* Abas Entrar / Criar Conta */
.step-tabs {
  display: flex;
  margin-bottom: 24px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #1a56db;
}
.step-tab {
  flex: 1;
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  background: #fff;
  color: #1a56db;
  border: none;
  cursor: pointer;
  transition: .2s;
}
.step-tab.active { background: #1a56db; color: #fff; }
.step-tab:hover:not(.active) { background: #e8f0fe; }

/* Labels grandes */
.form-label-big {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

/* ── TODOS os inputs/selects dentro da tela de auth ──
   Estes seletores vêm depois de .form-control no arquivo,
   então naturalmente os sobrescrevem sem precisar de !important */
#page-auth input[type="text"],
#page-auth input[type="email"],
#page-auth input[type="password"],
#page-auth input[type="tel"],
#page-auth select {
  display: block;
  width: 100%;
  padding: 16px 18px;
  font-size: 18px;
  font-family: inherit;
  color: #1e293b;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  outline: none;
  box-sizing: border-box;
  appearance: none;
  transition: border-color .2s, box-shadow .2s;
  /* Resetar o que .form-control possa ter definido */
  min-height: auto;
}
#page-auth input[type="text"]:focus,
#page-auth input[type="email"]:focus,
#page-auth input[type="password"]:focus,
#page-auth input[type="tel"]:focus,
#page-auth select:focus {
  border-color: #1a56db;
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
  outline: none;
}

/* Campo OTP — especial, sobrescreve o genérico acima */
#page-auth input.otp-mega-input {
  font-size: 36px;
  text-align: center;
  letter-spacing: 14px;
  font-weight: 700;
  border: 3px solid #1a56db;
  border-radius: 12px;
  padding: 20px;
  font-family: monospace;
}
#page-auth input.otp-mega-input:focus {
  box-shadow: 0 0 0 4px rgba(26,86,219,.2);
}

/* ── Grupo input + botão olho ── */
#page-auth .auth-input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}
/* O input dentro do grupo: cresce e perde borda/radius direito */
#page-auth .auth-input-group input[type="password"],
#page-auth .auth-input-group input[type="text"] {
  flex: 1;
  min-width: 0;
  width: auto;
  border-right: none;
  border-radius: 12px 0 0 12px;
}
/* Botão olho */
#page-auth .auth-input-group .btn-eye-auth {
  background: #e8f0fe;
  border: 2px solid #cbd5e1;
  border-left: none;
  border-radius: 0 12px 12px 0;
  padding: 0 20px;
  color: #1a56db;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .2s;
  min-width: 58px;
  flex-shrink: 0;
}
#page-auth .auth-input-group .btn-eye-auth:hover {
  background: #1a56db;
  color: #fff;
}

/* ── Botão principal Entrar / Criar Conta ── */
.btn-auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px;
  font-size: 18px;
  font-weight: 700;
  background: #1a56db;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(26,86,219,.3);
  transition: .2s;
}
.btn-auth-main:hover    { background: #1245b5; box-shadow: 0 6px 16px rgba(26,86,219,.4); }
.btn-auth-main:disabled { background: #93c5fd; box-shadow: none; cursor: not-allowed; }
.btn-auth-main i        { font-size: 20px; }

/* ── Botão secundário Esqueci senha / Voltar ── */
.btn-link-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  color: #1a56db;
  background: #f0f4ff;
  border: 2px solid #c7d7fd;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: .2s;
}
.btn-link-big:hover { background: #dce8ff; border-color: #1a56db; }
.btn-link-big i     { font-size: 18px; }

/* ── Mensagens de feedback ── */
.auth-msg {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 15px;
  margin: 12px 0;
  font-weight: 500;
}
.auth-msg.msg-ok   { background: #f0fdf4; color: #15803d; border: 2px solid #86efac; }
.auth-msg.msg-err  { background: #fef2f2; color: #b91c1c; border: 2px solid #fca5a5; }
.auth-msg.msg-info { background: #eff6ff; color: #1e40af; border: 2px solid #bfdbfe; }

/* ── Caixa info azul ── */
.auth-info-box {
  background: #eff6ff;
  border: 2px solid #bfdbfe;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: #1e40af;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ── Regras de senha ── */
.pass-rules-simple {
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: #854d0e;
  margin-bottom: 10px;
}
.pass-hint { font-size: 14px; padding: 8px 12px; border-radius: 6px; margin-top: 6px; font-weight: 500; }
.pass-hint.hint-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.pass-hint.hint-ok    { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }

/* ── CAPTCHA MATEMÁTICO ── */
.captcha-box {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0 16px;
}
.captcha-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.captcha-icon { font-size: 20px; }
.captcha-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  flex: 1;
}
.captcha-refresh {
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  transition: all 0.2s;
}
.captcha-refresh:hover { background: #e2e8f0; color: #1e293b; }
.captcha-instruction {
  font-size: 18px;
  font-weight: 700;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 0.5px;
}
.captcha-math-row {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}
.captcha-math-input {
  width: 100%;
  max-width: 100%;
  padding: 10px 14px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}
.captcha-math-input::-webkit-inner-spin-button,
.captcha-math-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.captcha-math-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
.captcha-status {
  font-size: 13px;
  font-weight: 600;
  min-height: 22px;
  text-align: center;
  border-radius: 6px;
  padding: 4px 8px;
}
.captcha-ok  { background: #f0fdf4; color: #15803d; }
.captcha-err { background: #fef2f2; color: #b91c1c; }

/* ── OTP ── */
.otp-big-header    { text-align: center; margin-bottom: 24px; }
.otp-big-icon      { font-size: 56px; margin-bottom: 8px; }
.otp-big-header h2 { font-size: 24px; color: #1e293b; margin: 0 0 8px; }
.otp-desc-big      { font-size: 16px; color: #475569; line-height: 1.6; }
.otp-visible-code  { background: #f0fdf4; border: 3px solid #16a34a; border-radius: 12px; padding: 20px; text-align: center; margin-bottom: 20px; }
.otp-visible-label { font-size: 15px; color: #166534; font-weight: 600; margin: 0 0 8px; }
.otp-big-number    { font-size: 48px; font-weight: 900; letter-spacing: 14px; color: #15803d; font-family: monospace; margin: 8px 0; }
.btn-copy-code     { background: #16a34a; color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font-size: 14px; cursor: pointer; margin-top: 8px; }

/* Dica de formato */
.form-hint-big { display: block; font-size: 14px; color: #64748b; margin-top: 6px; }

/* Animação auth */
.auth-step { animation: authFadeIn .3s ease; }
@keyframes authFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== INVEST. - CALCULADORA DE JUROS COMPOSTOS ===== */

.invest-page { max-width: 960px; margin: 0 auto; padding-bottom: 40px; padding-top: 0; }
.page-container.invest-page { padding-top: 4mm; }

/* Hero */
.invest-hero {
  text-align: center;
  padding: var(--space-3) var(--space-4) var(--space-4);
}
.invest-hero-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-4);
  font-size: 28px; color: #fff;
  box-shadow: 0 4px 20px rgba(59,130,246,.35);
}
.invest-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--gray-900);
  margin: 0 0 var(--space-3);
  background: linear-gradient(135deg, #3b82f6, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.invest-subtitle {
  font-size: var(--text-base);
  color: var(--gray-600);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Card genérico */
.invest-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  border: 1px solid var(--gray-200);
}
.invest-section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-800);
  margin: 0 0 var(--space-5);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Grid do formulário */
.invest-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
@media (max-width: 600px) {
  .invest-form-grid { grid-template-columns: 1fr; }
}
.invest-field {}
.invest-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.invest-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--gray-50);
  color: var(--gray-900);
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.invest-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
  background: #fff;
}
.invest-hint {
  display: block;
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Presets de prazo */
.invest-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-5);
}
.invest-preset-label {
  font-size: var(--text-sm);
  color: var(--gray-600);
  font-weight: 600;
  white-space: nowrap;
}
.invest-preset-btn {
  background: var(--gray-100);
  border: 1.5px solid var(--gray-300);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all .18s;
}
.invest-preset-btn:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

/* Botões de ação */
.invest-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.invest-calc-btn {
  background: linear-gradient(135deg, #3b82f6, #10b981) !important;
  border: none !important;
  min-width: 160px;
}
.invest-calc-btn:hover {
  opacity: .9;
  transform: translateY(-1px);
}

/* Cards de resumo */
.invest-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
@media (max-width: 768px) {
  .invest-summary-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .invest-summary-grid { grid-template-columns: 1fr; }
}
.invest-summary-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
  border-top: 4px solid transparent;
  text-align: center;
  border: 1px solid var(--gray-200);
}
.invest-summary-total   { border-top: 4px solid #10b981; }
.invest-summary-invested { border-top: 4px solid #3b82f6; }
.invest-summary-interest { border-top: 4px solid #f59e0b; }
.invest-summary-yield   { border-top: 4px solid #8b5cf6; }
.invest-summary-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.invest-summary-value {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 800;
  color: var(--gray-900);
}
.invest-summary-total .invest-summary-value   { color: #10b981; }
.invest-summary-interest .invest-summary-value { color: #f59e0b; }
.invest-summary-yield .invest-summary-value   { color: #8b5cf6; }

/* Área de gráficos */
.invest-charts-row {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  flex-wrap: wrap;
}
.invest-chart-doughnut-wrap {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.invest-chart-line-wrap {
  flex: 1;
  min-width: 260px;
}
@media (max-width: 640px) {
  .invest-charts-row { flex-direction: column; }
  .invest-chart-doughnut-wrap { flex: none; width: 100%; }
  .invest-chart-line-wrap { width: 100%; }
}

/* Legenda do donut */
.inv-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-700);
  white-space: nowrap;
}
.inv-legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.inv-legend-item strong { color: var(--gray-900); font-weight: 700; }
.inv-legend-item em { color: var(--gray-500); font-style: normal; font-size: 11px; }
.invest-pie-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Toggle mensal */
.invest-toggle-monthly {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: #3b82f6;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid #3b82f6;
  transition: all .18s;
}
.invest-toggle-monthly:hover {
  background: #3b82f6;
  color: #fff;
}

/* Tabela */
.invest-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}
.invest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.invest-table th {
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 700;
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 2px solid var(--gray-300);
}
.invest-table th:first-child { text-align: left; }
.invest-table td {
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.invest-table td:first-child { text-align: left; }
.inv-row-even td { background: var(--gray-50); }
.inv-td-interest { color: #10b981 !important; font-weight: 600; }
.inv-td-total { color: var(--gray-900) !important; }
.invest-table tr:last-child td {
  border-bottom: none;
  background: #f0fdf4 !important;
}
.invest-table tr:last-child td { font-weight: 700; }

/* ═══ HISTÓRICO DE ALTERAÇÕES (dentro da Conta) ═══════════════════════════ */

.account-logs-section {
  background: #fff;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Cabeçalho da seção com toggle */
.account-logs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
}

.account-logs-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gray-800);
}

.account-logs-title-wrap > i {
  color: #1a56db;
  font-size: 1.1em;
}

.account-logs-badge {
  font-size: 0.75em;
  font-weight: 600;
  background: #e8f0fe;
  color: #1a56db;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: var(--space-1);
}

/* Toggle switch */
.logs-toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.logs-toggle-wrap input[type="checkbox"] {
  display: none;
}

.logs-toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 24px;
  transition: background 0.25s;
  flex-shrink: 0;
}

.logs-toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform 0.25s;
}

.logs-toggle-wrap input:checked ~ .logs-toggle-slider {
  background: #1a237e;
}

.logs-toggle-wrap input:checked ~ .logs-toggle-slider::after {
  transform: translateX(20px);
}

.logs-toggle-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-600);
  min-width: 68px;
}

.logs-toggle-wrap input:checked ~ .logs-toggle-slider ~ .logs-toggle-label {
  color: #1a237e;
}

/* Corpo expandível */
#account-logs-body {
  padding: var(--space-4) var(--space-5);
}

/* Loading */
.acclogs-loading {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--gray-500);
  font-size: var(--text-sm);
  padding: var(--space-4) 0;
}

/* Estado vazio */
.acclogs-empty {
  text-align: center;
  padding: var(--space-6) 0;
  color: var(--gray-400);
}
.acclogs-empty i {
  font-size: 2.2rem;
  margin-bottom: var(--space-2);
  color: #10b981;
  display: block;
}
.acclogs-empty p {
  font-size: var(--text-sm);
  margin: 0;
}

/* Lista de logs */
.acclogs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.acclogs-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--gray-100);
}

.acclogs-item:last-child {
  border-bottom: none;
}

.acclogs-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

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

.acclogs-action {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acclogs-entity {
  font-size: 0.78rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acclogs-time {
  font-size: 0.75rem;
  color: var(--gray-400);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
}

@media (max-width: 480px) {
  .account-logs-header { gap: var(--space-2); padding: var(--space-3) var(--space-4); }
  #account-logs-body   { padding: var(--space-3) var(--space-4); }
  .acclogs-time        { display: none; }
}

/* ═══ RELATÓRIO AGRUPADO POR CATEGORIA ════════════════════════════════════ */

.grp-subtitle {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--gray-500);
  margin-left: var(--space-2);
}

/* Wrapper geral */
.grp-result-wrap {
  margin-top: var(--space-5);
}

/* Cabeçalho KPIs */
.grp-header {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.grp-header-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.grp-header-title > i {
  color: #1a56db;
}

.grp-header-totals {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.grp-kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.grp-kpi-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.grp-kpi-value {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--gray-900);
}

/* Tabela agrupada */
.grp-table td, .grp-table th {
  vertical-align: middle;
}

.grp-name-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.grp-td-total {
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
}

.grp-td-pct {
  min-width: 130px;
}

/* Barra de progresso inline */
.grp-bar-wrap {
  height: 8px;
  background: var(--gray-100);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 3px;
  width: 100%;
}

.grp-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.4s ease;
  min-width: 2px;
}

/* Cards de gráfico */
.grp-chart-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.grp-chart-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.grp-chart-title > i {
  color: #1a56db;
}

.grp-chart-wrap {
  position: relative;
  width: 100%;
}

.grp-bar-wrap-outer {
  max-height: 420px;
  overflow-y: auto;
}

@media (max-width: 600px) {
  .grp-header { flex-direction: column; align-items: flex-start; }
  .grp-header-totals { gap: var(--space-3); }
  .grp-kpi { align-items: flex-start; }
  .grp-td-pct { display: none; }
}
