:root {
  /* Cores de Destaque */
  --primary: #CC5A37;
  --primary-hover: #B24724;
  --primary-light: #FDF2EE;
  --secondary: #7E736C;
  
  /* Fundos e Superfícies */
  --bg: #FAF8F5;
  --sidebar-bg: #ffffff;
  --white: #ffffff;
  --input-bg: #F5EFEB;
  --table-hover: #FDFBF9;
  --chat-bg: #F2ECE4;
  --border: #EDE8E2;
  
  /* Fontes */
  --text-main: #2A2421;
  --text-muted: #7E736C;
  
  /* Status Semânticos */
  --success: #276F43;
  --danger: #BA3C2A;
  
  /* Efeitos e Grid */
  --card-shadow:
    0 4px 20px -2px rgba(42, 36, 33, 0.04),
    0 2px 8px -1px rgba(42, 36, 33, 0.02);
  --card-shadow-hover:
    0 20px 25px -5px rgba(42, 36, 33, 0.06),
    0 8px 10px -6px rgba(42, 36, 33, 0.04);
  --radius: 20px;
  --sidebar-collapsed-width: 80px;
  --sidebar-expanded-width: 280px;
  
  /* Efeitos de Glow para Gráficos */
  --glow-cyan: #CC5A37;
  --glow-mint: #276F43;
  --glow-coral: #BA3C2A;
}

/* Dark Theme */
[data-theme="dark"] {
  /* Cores de Destaque */
  --primary: #E59F54;
  --primary-hover: #C7823C;
  --primary-light: rgba(229, 159, 84, 0.12);
  --secondary: #A3978E;

  /* Fundos e Superfícies */
  --bg: #120E0C;
  --white: #1E1815;
  --sidebar-bg: #0A0807;
  --input-bg: #120E0C;
  --table-hover: #261F1B;
  --chat-bg: #1A1412;
  --border: #332822;

  /* Fontes */
  --text-main: #F7F4F0;
  --text-muted: #A3978E;

  /* Status Semânticos */
  --success: #52B788;
  --danger: #E07A5F;
  
  /* Sombras Tema Escuro */
  --card-shadow:
    0 10px 30px -10px rgba(10, 8, 7, 0.5), 
    0 4px 12px -5px rgba(10, 8, 7, 0.3);
  --card-shadow-hover:
    0 20px 40px -5px rgba(10, 8, 7, 0.7), 
    0 8px 20px -6px rgba(10, 8, 7, 0.5);
}

/* Accessibility contrast overrides for Dark Mode */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-primary i,
[data-theme="dark"] .nav-btn:hover,
[data-theme="dark"] .nav-btn:hover i,
[data-theme="dark"] .sidebar nav ul li.active,
[data-theme="dark"] .sidebar nav ul li.active i,
[data-theme="dark"] .settings-tab-item.active,
[data-theme="dark"] .settings-tab-item.active i,
[data-theme="dark"] .category-settings-actions .btn-edit:hover,
[data-theme="dark"] .category-settings-actions .btn-edit:hover i {
  color: #070a14 !important;
}

[data-theme="dark"] body {
  background-color: var(--bg);
}

[data-theme="dark"] th {
  background: #1e293b;
}

[data-theme="dark"] .close {
  background: #334155;
}

[data-theme="dark"] .close:hover {
  background: #475569;
}

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

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select {
  border-color: #334155;
  background-color: var(--input-bg);
  color: var(--text-main);
}

[data-theme="dark"] .btn-secondary {
  background-color: var(--white);
  color: var(--primary);
  border-color: #334155;
}

[data-theme="dark"] .category-item {
  background: #0f172a;
}

[data-theme="dark"] .month-picker {
  color: var(--text-main);
}

[data-theme="dark"] .month-picker::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

[data-theme="dark"] .nav-btn {
  background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .current-month {
  background: var(--white);
}

[data-theme="dark"] .ai-chat-messages {
  background-color: var(--chat-bg);
}

[data-theme="dark"] .message.ai {
  background-color: #1e293b;
  color: var(--text-main);
}

[data-theme="dark"] .ai-chat-input-area {
  background-color: #1e293b;
  border-top-color: #334155;
}

[data-theme="dark"] .ai-chat-input-area input {
  background-color: #0f172a;
  border-color: #334155;
  color: var(--text-main);
}

[data-theme="dark"] tr:hover td {
  background-color: var(--table-hover);
}

[data-theme="dark"] td {
  border-bottom-color: #334155;
}

[data-theme="dark"] .page-btn {
  border-color: #334155;
  background-color: var(--white);
  color: var(--text-main);
}

[data-theme="dark"] .page-btn:disabled {
  background-color: #1e293b;
}

[data-theme="dark"] .icon-selector label {
  border-color: #334155;
  background: #0f172a;
}

[data-theme="dark"] .icon-selector label:hover {
  background: #1e293b;
}

[data-theme="dark"] .btn-delete-planning {
  background: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .btn-delete {
  background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .btn-edit {
  background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .progress-bar-bg {
  background: #334155;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
}

.container {
  display: flex;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════
   SIDEBAR — Collapsible on hover
   ═══════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-collapsed-width);
  background-color: var(--sidebar-bg);
  color: var(--text-main);
  padding: 1.5rem 0.75rem;
  position: fixed;
  height: 100vh;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.03);
  border-right: 1px solid var(--border);
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar:hover {
  width: var(--sidebar-expanded-width);
}

.sidebar-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-top nav {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.sidebar-top nav::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

/* Sidebar text animation */
.sidebar-text {
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.2s ease 0s;
  pointer-events: none;
}

.sidebar:hover .sidebar-text {
  opacity: 1;
  transition: opacity 0.2s ease 0.1s;
  pointer-events: auto;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  margin-bottom: 2rem;
  padding: 0;
  height: 70px;
  overflow: hidden;
}

.logo-img {
  height: 58px;
  width: 58px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover .logo-img {
  transform: scale(1.1);
}

.logo i {
  flex-shrink: 0;
  font-size: 1.5rem;
  -webkit-text-fill-color: var(--primary);
}

.sidebar nav ul {
  list-style: none;
}

.sidebar nav ul li {
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar nav ul li i {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.sidebar nav ul li:hover {
  background-color: var(--input-bg);
  color: var(--text-main);
}

.sidebar nav ul li.active {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 15px -3px var(--primary-light);
}

/* Sidebar Categories (Dividers) */
.sidebar nav ul li.sidebar-category {
  display: flex;
  align-items: center;
  padding: 1.5rem 0.75rem 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: default;
  pointer-events: none;
  background-color: transparent !important;
  gap: 0;
  border-radius: 0;
  box-shadow: none !important;
}

.sidebar nav ul li.sidebar-category:hover {
  background-color: transparent !important;
  color: #64748b !important;
}

.sidebar nav ul li.sidebar-category span {
  display: none;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar:hover nav ul li.sidebar-category span {
  display: inline;
  opacity: 1;
}

.sidebar nav ul li.sidebar-category hr {
  flex: 1;
  border: none;
  height: 1px;
  background-color: var(--border);
  margin: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover nav ul li.sidebar-category hr {
  margin-left: 8px;
}

/* Sidebar Profile Area */
.sidebar-profile-area {
  display: flex;
  align-items: center;
  gap: 0px;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}

.sidebar:hover .sidebar-profile-area {
  gap: 8px;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
  padding: 0.5rem 0.6rem;
  border-radius: 12px;
  transition: background-color 0.2s ease;
  overflow: hidden;
  min-width: 0;
}

.sidebar-profile:hover {
  background-color: var(--input-bg);
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.profile-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-settings-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 0;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
  font-size: 1rem;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  padding: 0;
}

.sidebar:hover .sidebar-settings-btn {
  opacity: 1;
  pointer-events: auto;
  width: 36px;
}

.sidebar-settings-btn:hover {
  background-color: var(--input-bg);
  color: var(--text-main);
  transform: rotate(45deg);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.875rem 1rem;
  color: var(--danger);
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s ease;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logout i {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.sidebar-logout:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

/* ═══════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-collapsed-width);
  padding: 2.5rem 3rem;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
}

.current-month {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--white);
  padding: 0.5rem;
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

.month-picker {
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  background: transparent;
  cursor: pointer;
  outline: none;
  padding: 0.25rem 0.5rem;
}

.nav-btn {
  background: var(--primary-light);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.875rem 1.75rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.23);
}

.btn-secondary {
  background-color: var(--white);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 0.875rem 1.75rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--white);
  padding: 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

[data-theme="dark"] .stat-card {
  border-color: var(--border);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.stat-card h3 {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.stat-card p {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
}

.stat-card.income {
  border-top: 4px solid var(--success);
}
.stat-card.expense {
  border-top: 4px solid var(--danger);
}
.stat-card.balance {
  border-top: 4px solid var(--primary);
}

.dashboard-stats {
  grid-template-columns: repeat(4, 1fr);
}

/* Charts Row */
.charts-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* AI Consultant Styling */
.ai-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 2.5rem;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.ai-header i {
  font-size: 3rem;
  color: var(--primary);
  background: var(--primary-light);
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
}

.ai-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.ai-header p {
  color: var(--text-muted);
}

.ai-header .btn-primary {
  margin-left: auto;
}

.ai-content {
  line-height: 1.8;
  color: var(--text-main);
  font-size: 1.05rem;
}

.ai-content h3 {
  margin: 1.5rem 0 1rem;
  color: var(--primary);
}

.ai-content ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.ai-content li {
  margin-bottom: 0.5rem;
}

.ai-placeholder {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

/* Charts Container */
.charts-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.chart-box {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.chart-box h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

/* Table styling */
.table-container {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto; /* Volta para auto para priorizar o conteúdo */
}

th,
td {
  padding: 1rem 1.25rem;
  text-align: left;
}

/* Tratamento para descrição */
td:nth-child(2) {
  max-width: 300px; /* Limita o tamanho máximo */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help; /* Indica que tem mais texto ao passar o mouse */
}

/* Garante que valores e datas não quebrem nem sumam */
td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5) {
  white-space: nowrap;
}

/* Coluna de Ações sempre fixa e junta */
th:nth-child(7),
td:nth-child(7) {
  width: 100px;
  text-align: center;
  white-space: nowrap;
}

th {
  background: var(--table-hover);
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

th.sortable {
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

th.sortable:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

th.sortable i {
  margin-left: 5px;
  font-size: 0.7rem;
  opacity: 0.5;
}

th.sort-asc i,
th.sort-desc i {
  opacity: 1;
  color: var(--primary);
}

td {
  padding: 1.25rem;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}

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

tr:hover td {
  background-color: var(--table-hover);
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 2rem 1rem;
  transition: all 0.3s ease;
}

.modal-content {
  background-color: var(--white);
  margin: auto;
  padding: 3rem;
  border-radius: 24px;
  width: 100%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 2rem;
  color: var(--text-main);
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-content h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 4px;
}

.close {
  position: absolute;
  right: 1.5rem;
  top: 1.5rem;
  font-size: 1.25rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.close:hover {
  background: #e2e8f0;
  color: var(--danger);
  transform: rotate(90deg);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  min-height: 2.6rem; /* Garante espaço igual de até 2 linhas para alinhar os inputs horizontalmente */
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: var(--input-bg);
  transition: all 0.2s;
  appearance: none;
}

/* Custom select arrow */
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--white);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-group input[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-footer {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
}

.modal-footer .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 1rem;
  font-size: 1rem;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--input-bg);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.category-item span:last-child {
  font-weight: 700;
  color: var(--primary);
}

/* Review Table Styles */
#reviewTable {
  width: 100%;
  border-collapse: collapse;
}

#reviewTable th,
#reviewTable td {
  padding: 0.75rem;
  font-size: 0.9rem;
}

.review-modal {
  max-width: 900px !important;
  width: 95% !important;
}

#reviewTable th:nth-child(1),
#reviewTable td:nth-child(1) {
  width: 140px;
} /* Data */
#reviewTable th:nth-child(3),
#reviewTable td:nth-child(3) {
  width: 150px;
} /* Categoria */
#reviewTable th:nth-child(4),
#reviewTable td:nth-child(4) {
  width: 110px;
} /* Valor */
#reviewTable th:nth-child(5),
#reviewTable td:nth-child(5) {
  width: 80px;
  text-align: center;
}

#reviewTable td:nth-child(5) {
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: none; /* Reset for flex */
}

/* Add border back for the TD since it's now flex */
#reviewTable tr td:nth-child(5) {
  border-bottom: 1px solid var(--border);
}

#reviewTable input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  background-color: var(--input-bg);
  color: var(--text-main);
}

#reviewTableBody .btn-delete {
  width: 28px;
  height: 28px;
}

.btn-edit,
.btn-delete {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-edit {
  background: var(--primary-light);
  color: var(--primary);
}
.btn-edit:hover {
  background: var(--primary);
  color: #ffffff;
}

.btn-delete {
  background: #fee2e2;
  color: var(--danger);
}
.btn-delete:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
  border: none;
  padding: 0.875rem 1.75rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39);
}

.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.23);
}

.confirm-modal {
  max-width: 400px;
  padding: 2.5rem;
  text-align: center;
}

.confirm-modal h2::before {
  display: none;
}

.confirm-modal h2 {
  justify-content: center;
  margin-bottom: 1rem;
}

.confirm-modal p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.confirm-footer {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.confirm-footer button {
  flex: 1;
}

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════
   PROFILE EDIT MODAL
   ═══════════════════════════════════════════════════ */
.profile-edit-modal {
  max-width: 420px;
}

.profile-edit-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  margin: 0 auto 2rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

/* ═══════════════════════════════════════════════════
   SETTINGS MODAL
   ═══════════════════════════════════════════════════ */
.settings-modal-content {
  max-width: 480px;
}

.settings-modal-content h2 i {
  color: var(--primary);
  -webkit-text-fill-color: var(--primary);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.settings-item:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.settings-item-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.settings-item-info > i {
  font-size: 1.25rem;
  color: var(--primary);
  width: 24px;
  text-align: center;
}

.settings-item-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.settings-item-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: all 0.3s ease;
  border-radius: 26px;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.3s ease;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-collapsed-width);
  }
  .sidebar:hover {
    width: var(--sidebar-collapsed-width);
  }
  .sidebar-text {
    display: none;
  }
  .sidebar-settings-btn {
    opacity: 1;
    pointer-events: auto;
  }
  .main-content {
    margin-left: var(--sidebar-collapsed-width);
    padding: 1.5rem;
  }
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════
   FLOATING AI CHAT
   ═══════════════════════════════════════════════════ */
.ai-chat-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.ai-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.ai-chat-toggle:hover {
  transform: scale(1.1);
  background-color: var(--primary-hover);
}

.ai-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 500px;
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.ai-chat-window.hidden {
  display: none;
  opacity: 0;
  transform: translateY(20px);
}

.ai-chat-header {
  background-color: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.close-chat-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.close-chat-btn:hover {
  opacity: 1;
}

.ai-chat-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: var(--chat-bg);
}

.message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.message.ai {
  align-self: flex-start;
  background-color: var(--white);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.message.user {
  align-self: flex-end;
  background-color: var(--primary);
  color: white;
  border-bottom-right-radius: 2px;
}

.message p {
  margin-bottom: 0.5rem;
}

.message p:last-child {
  margin-bottom: 0;
}

.ai-chat-input-area {
  padding: 1rem;
  display: flex;
  gap: 0.5rem;
  background-color: var(--white);
  border-top: 1px solid var(--border);
}

.ai-chat-input-area input {
  flex: 1;
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 99px;
  outline: none;
  font-size: 0.95rem;
  background-color: var(--input-bg);
  color: var(--text-main);
}

.ai-chat-input-area input:focus {
  border-color: var(--primary);
}

.ai-chat-input-area button {
  background-color: var(--primary);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.ai-chat-input-area button:hover {
  background-color: var(--primary-hover);
}

@media (max-width: 480px) {
  .ai-chat-window {
    width: calc(100vw - 2rem);
    height: calc(100vh - 120px);
    bottom: 80px;
    right: -1rem;
  }
}

/* Pagination Styles */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 1rem;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border: 1.5px solid var(--border);
  background-color: var(--white);
  color: var(--text-main);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.page-btn.active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--input-bg);
}

.page-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 1rem;
}

/* Plannings Styles */
.plannings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.planning-card {
  background: var(--white);
  padding: 2rem;
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
  border: 1px solid var(--border);
  position: relative;
  display: flex;
  flex-direction: column;
}

.planning-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.planning-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.planning-icon {
  width: 54px;
  height: 54px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.planning-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.planning-info p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.progress-container {
  margin-bottom: 1.5rem;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.progress-percent {
  color: var(--primary);
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--input-bg);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.planning-values {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.value-box {
  flex: 1;
}

.value-box span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.value-box strong {
  font-size: 1rem;
  color: var(--text-main);
  font-weight: 800;
}

.planning-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
}

.planning-actions button {
  flex: 1;
  padding: 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-add-funds {
  background: var(--primary);
  color: #ffffff;
}

.btn-add-funds:hover {
  background: var(--primary-hover);
}

.btn-delete-planning {
  background: #f1f5f9;
  color: var(--danger);
  width: 44px;
  flex: none !important;
}

.btn-delete-planning:hover {
  background: #fee2e2;
}

/* Icon Selector Style */
.icon-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.icon-selector label {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  transition: all 0.2s;
}

.icon-selector label:hover {
  background: var(--primary-light);
}

.icon-selector input {
  display: none;
}

.icon-selector i {
  font-size: 1.25rem;
  color: var(--text-muted);
}

.icon-selector input:checked + i {
  color: var(--primary);
}

.icon-selector label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* SPLIT SETTINGS MODAL */
.settings-modal-content-split {
  max-width: 800px;
  width: 95%;
  padding: 0 !important;
  border-radius: 20px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--border);
  position: relative;
}

.settings-container-split {
  display: flex;
  height: 600px;
  max-height: 85vh;
}

/* Sidebar styling */
.settings-sidebar-split {
  width: 260px;
  background: var(--sidebar-bg);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  color: #ffffff;
}

.settings-sidebar-split h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #ffffff;
}

.settings-sidebar-split h2 i {
  color: var(--primary);
}

.settings-tabs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-tab-item {
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s ease;
  color: #94a3b8;
}

.settings-tab-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.settings-tab-item.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Content Panel styling */
.settings-content-split {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
  background: var(--white);
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .settings-content-split {
  background: var(
    --white
  ); /* In dark mode, white maps to --white (which is #1e293b) */
}

.settings-tab-panel {
  display: none;
  height: 100%;
}

.settings-tab-panel.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.settings-tab-panel h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

/* Category Configuration CSS */
.category-settings-form {
  background: var(--bg);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.category-form-inputs-row {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  width: 100%;
}

.category-settings-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0;
  flex: 1.5;
}

.category-settings-form .category-form-inputs-row .form-group:nth-child(2) {
  flex: 1; /* Limit field takes slightly less space */
}

.category-settings-form label {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-main);
}

.category-settings-form input {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.category-settings-form input:focus {
  border-color: var(--primary);
}

.category-form-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  width: 100%;
}

.category-form-buttons button {
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  box-sizing: border-box;
  white-space: nowrap;
}

.categories-settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.category-settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.category-settings-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--card-shadow);
}

.category-settings-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.category-settings-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.category-settings-limit {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.category-settings-actions {
  display: flex;
  gap: 0.5rem;
}

.category-settings-actions button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.category-settings-actions .btn-edit {
  background: var(--primary-light);
  color: var(--primary);
}

.category-settings-actions .btn-edit:hover {
  background: var(--primary);
  color: var(--white);
}

.category-settings-actions .btn-delete {
  background: #fee2e2;
  color: var(--danger);
}

.category-settings-actions .btn-delete:hover {
  background: var(--danger);
  color: var(--white);
}

/* PREMIUM DASHBOARD CATEGORY LIMIT PROGRESS BARS */
.category-item {
  display: flex;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem !important;
}

.category-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.category-item-header span:first-child {
  font-weight: 600;
  color: var(--text-main);
}

.category-item-header span:last-child {
  font-weight: 700;
  color: var(--primary);
}

.category-progress-container {
  height: 8px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
  margin-top: 0.15rem;
}

[data-theme="dark"] .category-progress-container {
  background: #334155;
}

.category-progress-bar {
  height: 100%;
  background: var(--success);
  border-radius: 6px;
  transition:
    width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.3s ease;
}

.category-progress-bar.warning {
  background: #f59e0b;
}

.category-progress-bar.danger {
  background: var(--danger);
}

.category-limit-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 0.1rem;
}

.category-limit-info .percentage {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
}

.category-limit-info .percentage.warning {
  color: #b45309;
  background: #fef3c7;
}

.category-limit-info .percentage.danger {
  color: #b91c1c;
  background: #fee2e2;
}

[data-theme="dark"] .category-limit-info .percentage.warning {
  color: #fef08a;
  background: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .category-limit-info .percentage.danger {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.2);
}

/* Sleek, premium confirmation popover */
.confirm-popover {
  position: fixed;
  background: rgba(26, 26, 36, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: popoverFadeIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 140px;
}

.confirm-popover::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(26, 26, 36, 0.95);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .confirm-popover,
[data-theme="dark"] .confirm-popover::after {
  background: rgba(15, 23, 42, 0.95);
}

.confirm-popover-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.confirm-popover-buttons {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.confirm-popover-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-align: center;
}

.confirm-popover-btn-yes {
  background: var(--danger);
  color: #fff;
}

.confirm-popover-btn-yes:hover {
  background: #e03e3e;
  transform: translateY(-1px);
}

.confirm-popover-btn-no {
  background: var(--border);
  color: var(--text-main);
}

.confirm-popover-btn-no:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

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

/* Double check delete button animation */
.confirming-delete {
  background-color: var(--danger) !important;
  color: #ffffff !important;
  border-color: var(--danger) !important;
  animation: flashDanger 1s infinite alternate;
  transition: all 0.2s ease;
  border-radius: 8px !important;
  padding: 4px 10px !important;
}

@keyframes flashDanger {
  from {
    box-shadow: 0 0 2px var(--danger);
  }
  to {
    box-shadow: 0 0 10px var(--danger);
  }
}

/* ═══════════════════════════════════════════════════
   PREMIUM TYPOGRAPHY & DESIGN SYSTEM UPGRADE
   ═══════════════════════════════════════════════════ */
h1,
h2,
h3,
h4,
h5,
h6,
.bento-box-title,
.logo span,
.modal h2,
.insight-greeting {
  font-family: "Plus Jakarta Sans", "Inter", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

.bento-amount,
.carry-over-value,
.stat-card p,
td:nth-child(4),
#carryOverBalance,
#totalIncome,
#totalExpenses,
#totalBalance {
  font-family: "JetBrains Mono", "Inter", monospace !important;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════
   AURORA INSIGHT PANEL (SIGNATURE ELEMENT)
   ═══════════════════════════════════════════════════ */
.aurora-insight-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2.5rem;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.aurora-insight-glow {
  position: absolute;
  top: -50%;
  right: -20%;
  width: 350px;
  height: 350px;
  background: radial-gradient(
    circle,
    rgba(0, 242, 254, 0.15) 0%,
    rgba(5, 240, 168, 0.05) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  filter: blur(40px);
  pointer-events: none;
  z-index: 1;
  animation: aurora-shift 15s infinite alternate ease-in-out;
}

@keyframes aurora-shift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-30px, 20px) scale(1.2);
    background-color: rgba(255, 75, 114, 0.08);
  }
}

.aurora-insight-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.insight-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.insight-badge {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(79, 70, 229, 0.15);
}

[data-theme="dark"] .insight-badge {
  background: rgba(0, 242, 254, 0.1);
  color: var(--primary);
  border-color: rgba(0, 242, 254, 0.2);
}

.insight-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  text-transform: capitalize;
}

.insight-tag.health-excellent {
  background: rgba(5, 240, 168, 0.1);
  color: var(--success);
}
.insight-tag.health-stable {
  background: rgba(0, 242, 254, 0.1);
  color: var(--primary);
}
.insight-tag.health-warning {
  background: rgba(255, 75, 114, 0.1);
  color: var(--danger);
}

.insight-greeting {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.insight-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.sparkline-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 140px;
  justify-content: space-between;
  width: 100%;
}

[data-theme="light"] .sparkline-box {
  background: rgba(15, 23, 42, 0.02);
  border-color: rgba(15, 23, 42, 0.05);
}

.sparkline-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.sparkline-chart-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
}

/* ═══════════════════════════════════════════════════
   BENTO GRID LAYOUT
   ═══════════════════════════════════════════════════ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(160px, auto);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 1200px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
}

.bento-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.bento-box:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
  border-color: rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] .bento-box:hover {
  border-color: rgba(0, 242, 254, 0.4);
}

/* Tipos de Bento Box */
.bento-wide {
  grid-column: span 2;
}

.bento-large {
  grid-column: span 4;
}

@media (max-width: 1200px) {
  .bento-wide,
  .bento-large {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .bento-wide,
  .bento-large {
    grid-column: span 1;
  }
}

/* Header do Bento Box */
.bento-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.bento-box-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bento-box-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: var(--primary-light);
  color: var(--primary);
  transition: transform 0.3s ease;
}

.bento-box:hover .bento-box-icon {
  transform: scale(1.1) rotate(5deg);
}

/* Body do Bento Box */
.bento-box-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1;
}

.bento-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.bento-subtext {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Bento Box Específicos */
.bento-balance .bento-box-icon {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
}
[data-theme="dark"] .bento-balance .bento-box-icon {
  background: rgba(0, 242, 254, 0.1);
  color: #00f2fe;
}

.bento-income .bento-box-icon {
  background: rgba(5, 240, 168, 0.1);
  color: var(--success);
}
.bento-expense .bento-box-icon {
  background: rgba(255, 75, 114, 0.1);
  color: var(--danger);
}

/* Bento Charts Layout */
.bento-charts-layout {
  display: grid;
  grid-template-columns: 1.3fr 1.7fr;
  gap: 2rem;
  align-items: center;
  margin-top: 1rem;
  width: 100%;
}

@media (max-width: 992px) {
  .bento-charts-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.bento-charts-layout .chart-container {
  position: relative;
  height: 250px;
  width: 100%;
}

.category-list-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bento-box-subtitle {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

#categoryList {
  max-height: 245px;
  overflow-y: auto;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

#categoryList::-webkit-scrollbar {
  width: 5px;
}

#categoryList::-webkit-scrollbar-track {
  background: transparent;
}

#categoryList::-webkit-scrollbar-thumb {
  background-color: var(--text-muted);
  border-radius: 10px;
}

#categoryList::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary);
}

/* Chart Type Selector */
.chart-type-selector {
  display: flex;
  gap: 0.25rem;
  background: var(--input-bg);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.chart-type-btn {
  background: transparent;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-type-btn:hover {
  color: var(--text-main);
  background: var(--border);
}

.chart-type-btn.active {
  color: var(--primary);
  background: var(--white);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}


