/* ================================================
   PlenarA+ — Premium UI CSS
   Paleta: Azul Escuro | Verde | Branco
   ================================================ */

:root {
  --primary: #0f2d55;
  --primary-light: #1a4480;
  --primary-glow: #1e5799;
  --accent: #00c97a;
  --accent-dark: #00a864;
  --accent-light: #e8faf3;
  --danger: #ff4757;
  --danger-light: #fff0f1;
  --warning: #ffa502;
  --warning-light: #fff8ec;
  --purple: #6c5ce7;
  --purple-light: #f0eeff;
  --white: #ffffff;
  --bg: #f4f6fb;
  --bg-card: #ffffff;
  --text: #0d1b2a;
  --text-muted: #7a8599;
  --text-light: #b0bac7;
  --border: #e8ecf2;
  --shadow: 0 4px 24px rgba(15, 45, 85, 0.08);
  --shadow-md: 0 8px 32px rgba(15, 45, 85, 0.12);
  --shadow-lg: 0 16px 48px rgba(15, 45, 85, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 260px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ======================== SPLASH ======================== */
#splash-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #00c97a22 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#splash-screen.hidden { opacity: 0; visibility: hidden; }

.splash-content { text-align: center; color: white; }

.splash-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.splash-logo .logo-icon {
  font-size: 3rem;
  color: var(--accent);
  animation: pulse-glow 2s infinite;
}
.splash-logo .logo-text {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
}
.splash-logo .logo-plus { color: var(--accent); }
.splash-tagline { font-size: 1rem; opacity: 0.7; margin-bottom: 40px; letter-spacing: 2px; text-transform: uppercase; }

.splash-loader {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 99px;
  overflow: hidden;
  margin: 0 auto;
}
.loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #00ffaa);
  border-radius: 99px;
  animation: loader-fill 1.8s ease forwards;
}
@keyframes loader-fill { to { width: 100%; } }

/* ======================== SIDEBAR ======================== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

.sidebar-header {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo .logo-icon { font-size: 1.4rem; color: var(--accent); }
.logo .logo-text { font-size: 1.4rem; font-weight: 800; color: white; letter-spacing: -0.5px; }
.logo .logo-plus { color: var(--accent); }

.sidebar-toggle {
  background: rgba(255,255,255,0.08);
  border: none;
  color: white;
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.9rem;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.15); }

.user-profile {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.user-avatar {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), #00a864);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  position: relative;
  flex-shrink: 0;
}
.avatar-status {
  width: 10px; height: 10px;
  background: #2ecc71;
  border-radius: 50%;
  border: 2px solid var(--primary);
  position: absolute;
  bottom: -2px; right: -2px;
}
.user-name { font-weight: 600; color: white; font-size: 0.9rem; }
.user-subtitle { font-size: 0.75rem; color: var(--accent); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-item i { width: 18px; text-align: center; font-size: 1rem; }
.nav-item span { flex: 1; }

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}
.nav-item.active {
  background: linear-gradient(135deg, var(--accent)22, var(--accent)11);
  color: var(--accent);
  border: 1px solid var(--accent)33;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  background: var(--accent);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}
.nav-ai-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.btn-voice-mini {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-voice-mini:hover { transform: translateY(-1px); box-shadow: 0 8px 20px var(--accent)44; }

/* ======================== MAIN CONTENT ======================== */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* ======================== TOPBAR ======================== */
.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--primary);
  cursor: pointer;
}
.page-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.date-time {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-btn {
  width: 40px; height: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  position: relative;
  font-size: 1rem;
}
.topbar-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

.notif-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: 6px; right: 6px;
  display: none;
}
.notif-dot.active { display: block; animation: pulse-dot 2s infinite; }

/* ======================== CONTENT AREA ======================== */
.content-area { padding: 28px; flex: 1; }

.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }

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

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.view-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

/* ======================== DASHBOARD ======================== */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 200px; height: 200px;
  background: var(--accent);
  opacity: 0.08;
  border-radius: 50%;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  right: 80px; bottom: -40px;
  width: 140px; height: 140px;
  background: var(--accent);
  opacity: 0.05;
  border-radius: 50%;
}
.welcome-text h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.welcome-text p { opacity: 0.75; font-size: 0.9rem; }

.weather-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
}
.weather-icon { font-size: 1.4rem; color: #ffd32a; }

/* ======================== STATS GRID ======================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.blue::after { background: var(--primary); }
.stat-card.green::after { background: var(--accent); }
.stat-card.red::after { background: var(--danger); }
.stat-card.purple::after { background: var(--purple); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-card.blue .stat-icon { background: #e8f0ff; color: var(--primary); }
.stat-card.green .stat-icon { background: var(--accent-light); color: var(--accent-dark); }
.stat-card.red .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card.purple .stat-icon { background: var(--purple-light); color: var(--purple); }

.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }

/* ======================== CARDS ======================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.card-full { grid-column: 1 / -1; }

.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h3 i { color: var(--accent); }

.btn-sm {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-sm:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ======================== MINI LISTS ======================== */
.mini-task-list, .mini-transaction-list {
  padding: 12px 16px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: var(--transition);
}
.mini-task-item:hover { background: #eef2ff; }
.mini-task-check { color: var(--accent); cursor: pointer; }
.mini-task-title { flex: 1; font-size: 0.85rem; font-weight: 500; }
.mini-task-title.done { text-decoration: line-through; color: var(--text-muted); }
.mini-task-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}
.badge-alta { background: var(--danger-light); color: var(--danger); }
.badge-media { background: var(--warning-light); color: var(--warning); }
.badge-baixa { background: var(--accent-light); color: var(--accent-dark); }

.mini-transaction-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.mini-trans-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.mini-trans-icon.income { background: var(--accent-light); color: var(--accent-dark); }
.mini-trans-icon.expense { background: var(--danger-light); color: var(--danger); }
.mini-trans-desc { flex: 1; font-size: 0.83rem; font-weight: 500; }
.mini-trans-amount { font-size: 0.88rem; font-weight: 700; }
.mini-trans-amount.income { color: var(--accent-dark); }
.mini-trans-amount.expense { color: var(--danger); }

/* ======================== AI CARD ======================== */
.ai-card { border: 1px solid var(--accent)22; }
.ai-insight-text {
  padding: 16px 20px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.7;
  background: linear-gradient(135deg, var(--accent-light), #f0f8ff);
}

.ai-pulse {
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

/* ======================== EMPTY STATES ======================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; color: var(--primary); }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 0.85rem; opacity: 0.7; }

.empty-state-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 16px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state-mini i { font-size: 1.8rem; margin-bottom: 8px; opacity: 0.25; color: var(--primary); }
.empty-state-mini p { font-size: 0.8rem; }

/* ======================== BUTTONS ======================== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px var(--primary)44; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ======================== FILTER BAR ======================== */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-btn {
  background: white;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ======================== TASKS GRID ======================== */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.task-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border-left: 4px solid transparent;
  position: relative;
}
.task-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.task-card.priority-alta { border-left-color: var(--danger); }
.task-card.priority-media { border-left-color: var(--warning); }
.task-card.priority-baixa { border-left-color: var(--accent); }
.task-card.status-concluida { opacity: 0.65; }
.task-card.status-concluida .task-card-title { text-decoration: line-through; }

.task-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.task-card-title { font-size: 0.95rem; font-weight: 600; color: var(--primary); flex: 1; }
.task-card-actions { display: flex; gap: 6px; }
.task-action-btn {
  width: 28px; height: 28px;
  background: var(--bg);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: var(--transition);
}
.task-action-btn:hover { background: var(--primary); color: white; }
.task-action-btn.complete:hover { background: var(--accent); color: white; }
.task-action-btn.delete:hover { background: var(--danger); color: white; }

.task-card-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.task-card-footer { display: flex; align-items: center; justify-content: space-between; }

.task-priority-badge {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 99px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.task-due {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-due.overdue { color: var(--danger); font-weight: 600; }

/* ======================== FINANCES ======================== */
.balance-summary {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  color: white;
  box-shadow: var(--shadow-md);
}
.balance-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}
.balance-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.balance-card.income .balance-icon { background: rgba(0,201,122,0.25); color: #00ffaa; }
.balance-card.expense .balance-icon { background: rgba(255,71,87,0.25); color: #ff7979; }
.balance-amount { font-size: 1.4rem; font-weight: 700; }
.balance-label { font-size: 0.78rem; opacity: 0.7; margin-top: 2px; }
.balance-divider {
  text-align: center;
  padding: 0 32px;
}
.balance-total-label { font-size: 0.8rem; opacity: 0.7; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px; }
.balance-total { font-size: 2rem; font-weight: 800; }

.chart-card .card-header select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.search-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
}
.search-mini i { color: var(--text-muted); font-size: 0.8rem; }
.search-mini input {
  background: none;
  border: none;
  outline: none;
  font-size: 0.82rem;
  color: var(--text);
  width: 140px;
  font-family: 'Inter', sans-serif;
}

.transactions-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: var(--transition);
}
.transaction-item:hover { background: #eef2ff; }
.trans-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.trans-icon.income { background: var(--accent-light); color: var(--accent-dark); }
.trans-icon.expense { background: var(--danger-light); color: var(--danger); }
.trans-info { flex: 1; }
.trans-desc { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.trans-cat { font-size: 0.75rem; color: var(--text-muted); text-transform: capitalize; margin-top: 2px; }
.trans-right { text-align: right; }
.trans-amount { font-size: 0.95rem; font-weight: 700; }
.trans-amount.income { color: var(--accent-dark); }
.trans-amount.expense { color: var(--danger); }
.trans-date { font-size: 0.73rem; color: var(--text-muted); margin-top: 2px; }
.trans-delete {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  font-size: 0.8rem;
}
.trans-delete:hover { background: var(--danger-light); color: var(--danger); }

/* ======================== AI ASSISTANT ======================== */
.ai-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ai-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}
.ai-message.user { flex-direction: row-reverse; }

.ai-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.ai-message.user .ai-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.ai-bubble {
  max-width: 70%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text);
}
.ai-message.bot .ai-bubble {
  background: var(--bg);
  border-radius: 4px 16px 16px 16px;
}
.ai-message.user .ai-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 16px 4px 16px 16px;
}
.ai-bubble p { margin-bottom: 8px; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-bubble ul { padding-left: 18px; }
.ai-bubble ul li { margin-bottom: 4px; }
.ai-bubble strong { font-weight: 600; }

/* Voice section */
.voice-section {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  background: white;
}
.voice-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--accent)33;
}
.voice-status.hidden { display: none; }
.voice-status-text { font-size: 0.85rem; color: var(--accent-dark); font-weight: 500; }

.voice-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
}
.voice-waves span {
  width: 3px;
  background: var(--accent);
  border-radius: 99px;
  animation: wave 1s ease-in-out infinite;
}
.voice-waves span:nth-child(1) { height: 8px; animation-delay: 0s; }
.voice-waves span:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.voice-waves span:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.voice-waves span:nth-child(4) { height: 16px; animation-delay: 0.3s; }
.voice-waves span:nth-child(5) { height: 8px; animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.5); }
}

.ai-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.ai-input-wrapper { flex: 1; }
.ai-input-wrapper textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.88rem;
  resize: none;
  outline: none;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  line-height: 1.5;
  transition: var(--transition);
  max-height: 120px;
}
.ai-input-wrapper textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary)11; }

.voice-btn {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: var(--transition);
}
.voice-btn:hover { transform: scale(1.05); box-shadow: 0 6px 16px var(--accent)44; }
.voice-btn.recording { background: linear-gradient(135deg, var(--danger), #c0392b); animation: pulse-record 1s infinite; }

.send-btn {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: var(--transition);
}
.send-btn:hover { transform: scale(1.05); box-shadow: 0 6px 16px var(--primary)44; }

.quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.quick-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.quick-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

.ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--accent-dark);
  font-weight: 500;
  background: var(--accent-light);
  padding: 6px 14px;
  border-radius: 99px;
}

/* ======================== INSIGHTS ======================== */
.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.insight-card {
  padding: 24px;
}
.insight-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 14px;
}
.insight-icon.blue { background: #e8f0ff; color: var(--primary); }
.insight-icon.green { background: var(--accent-light); color: var(--accent-dark); }
.insight-icon.purple { background: var(--purple-light); color: var(--purple); }

.insight-card h3 { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.insight-content { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }

.insight-progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.insight-progress { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width 0.8s ease; }
.insight-percent { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.insight-score {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-dark);
  margin-top: 10px;
}

.insight-recommendations { display: flex; flex-direction: column; gap: 12px; }
.rec-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.rec-item i { color: var(--accent-dark); font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.rec-item p { font-size: 0.85rem; color: var(--text); line-height: 1.5; }

/* ======================== MODALS ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: modalSlide 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-sm { max-width: 420px; }
@keyframes modalSlide { from { transform: scale(0.9) translateY(20px); } to { transform: scale(1) translateY(0); } }

.modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.modal-close {
  width: 32px; height: 32px;
  background: var(--bg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: white; }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

/* ======================== FORM ======================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  outline: none;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  background: white;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary)11;
}

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

.type-toggle { display: flex; gap: 10px; margin-bottom: 4px; }
.type-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  color: var(--text-muted);
}
.type-btn[data-type="receita"].active { border-color: var(--accent); background: var(--accent-light); color: var(--accent-dark); }
.type-btn[data-type="despesa"].active { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }

.input-currency {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
}
.input-currency:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary)11; }
.input-currency span {
  padding: 10px 14px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  border-right: 1px solid var(--border);
}
.input-currency input { border: none; border-radius: 0; box-shadow: none; flex: 1; }
.input-currency input:focus { box-shadow: none; }

/* ======================== VOICE MODAL ======================== */
.voice-orb {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  margin: 0 auto 16px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 8px 32px var(--primary)33;
}
.voice-orb:hover { transform: scale(1.05); }
.voice-orb.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  animation: pulse-record 1s infinite;
  box-shadow: 0 8px 32px var(--accent)55;
}
.voice-instruction { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 16px; font-weight: 500; }
.voice-transcript {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text);
  min-height: 56px;
  margin-bottom: 12px;
  font-style: italic;
  line-height: 1.5;
}
.voice-hint { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }

/* ======================== NOTIFICATION ======================== */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.notification-toast {
  background: white;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-left: 4px solid var(--primary);
  max-width: 360px;
}
.notification-toast.success { border-left-color: var(--accent); }
.notification-toast.error { border-left-color: var(--danger); }
.notification-toast.warning { border-left-color: var(--warning); }
.notification-toast.info { border-left-color: var(--primary); }

.notification-toast.hide { animation: toastOut 0.3s ease forwards; }

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

.toast-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.notification-toast.success .toast-icon { background: var(--accent-light); color: var(--accent-dark); }
.notification-toast.error .toast-icon { background: var(--danger-light); color: var(--danger); }
.notification-toast.warning .toast-icon { background: var(--warning-light); color: var(--warning); }
.notification-toast.info .toast-icon { background: #e8f0ff; color: var(--primary); }

.toast-body { flex: 1; }
.toast-title { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.toast-msg { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px;
  margin-top: 2px;
  transition: var(--transition);
}
.toast-close:hover { color: var(--danger); }

/* ======================== ANIMATIONS ======================== */
@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}
@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,71,87,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(255,71,87,0); }
}

/* ======================== SCROLLBAR ======================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 40px rgba(0,0,0,0.3); }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }
  .welcome-banner { padding: 20px; }
  .weather-widget { display: none; }
  .balance-summary { flex-direction: column; gap: 20px; text-align: center; }
  .balance-divider { order: -1; }
  .form-row { grid-template-columns: 1fr; }
  .ai-container { height: calc(100vh - 160px); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .tasks-grid { grid-template-columns: 1fr; }
  .modal { margin: 10px; }
  .view-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ======================== CHART CARD ======================== */
.chart-card canvas { display: block; width: 100% !important; }
.chart-card { padding-bottom: 20px; }
.chart-card .card-header + div { padding: 16px; }
