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

:root {
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --navy-600: #475569;
  --navy-500: #64748b;
  --navy-400: #94a3b8;
  --navy-300: #cbd5e1;
  --navy-200: #e2e8f0;
  --navy-100: #f1f5f9;
  --navy-50: #f8fafc;

  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --accent-light: #ccfbf1;

  --expense: #f43f5e;
  --expense-bg: #ffe4e6;
  --income: #22c55e;
  --income-bg: #dcfce7;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --info: #3b82f6;
  --info-bg: #dbeafe;

  --bg: var(--navy-50);
  --surface: #ffffff;
  --surface-hover: var(--navy-100);
  --border: var(--navy-200);
  --text: var(--navy-900);
  --text-secondary: var(--navy-500);
  --text-muted: var(--navy-400);

  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px rgba(15, 23, 42, 0.08), 0 4px 6px rgba(15, 23, 42, 0.05);
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* ─── Auth Pages ─── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 50%, #0d3b66 100%);
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  animation: slideUp 0.4s ease;
}

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

.auth-card .logo {
  text-align: center;
  margin-bottom: 8px;
}

.auth-card .logo h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy-900);
}

.auth-card .logo span {
  color: var(--accent);
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 0.9rem;
}

.auth-card .auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-card .auth-link a {
  font-weight: 600;
}

/* ─── Form Elements ─── */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.form-input::placeholder {
  color: var(--text-muted);
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364758b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

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

.form-error {
  color: var(--expense);
  font-size: 0.8rem;
  margin-top: 4px;
  display: none;
}

.form-input.error {
  border-color: var(--expense);
}

.form-input.error + .form-error {
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--navy-100);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--navy-200);
}

.btn-danger {
  background: var(--expense);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #e11d48;
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--navy-100);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

/* ─── App Layout ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--navy-900);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
}

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

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-brand h2 span {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}

.sidebar-nav .nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  padding: 16px 12px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(20, 184, 166, 0.15);
  color: var(--accent);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--expense);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

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

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.user-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

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

.user-info .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info .user-email {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Main Content ─── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.page-header {
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

.page-body {
  padding: 0 32px 32px;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.card-body:only-child {
  padding: 20px;
}

/* ─── Stat Cards ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-value.positive {
  color: var(--income);
}

.stat-card .stat-value.negative {
  color: var(--expense);
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.stat-card .stat-icon.income {
  background: var(--income-bg);
  color: var(--income);
}

.stat-card .stat-icon.expense {
  background: var(--expense-bg);
  color: var(--expense);
}

.stat-card .stat-icon.savings {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-card .stat-icon.budget {
  background: var(--info-bg);
  color: var(--info);
}

/* ─── Charts ─── */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
}

.chart-card .chart-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ─── Dashboard Grid ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-grid-wide {
  grid-template-columns: 1fr 1fr;
}

/* ─── Tables ─── */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

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

.amount-cell {
  font-weight: 600;
  white-space: nowrap;
}

.amount-cell.negative {
  color: var(--expense);
}

.amount-cell.positive {
  color: var(--income);
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--navy-100);
  color: var(--text-secondary);
}

.category-badge .badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary {
  background: var(--accent);
  color: #fff;
}

.date-cell {
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}

.action-cell {
  white-space: nowrap;
  text-align: right;
}

.action-cell .btn-icon {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
}

/* ─── Filters ─── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Period Selector ─── */
.period-selector {
  display: flex;
  gap: 4px;
  background: var(--navy-100);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.period-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
}

.period-btn:hover {
  color: var(--text);
}

.period-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ─── Modals ─── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

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

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

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--navy-100);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--navy-200);
  color: var(--text);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Loading ─── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-secondary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--navy-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-text {
  margin-left: 12px;
  font-size: 0.9rem;
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease;
  max-width: 360px;
}

.toast.success {
  background: var(--income);
}

.toast.error {
  background: var(--expense);
}

.toast.info {
  background: var(--info);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── Progress Bar ─── */
.progress-bar {
  height: 8px;
  background: var(--navy-100);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-fill.good {
  background: var(--income);
}

.progress-fill.warn {
  background: var(--warning);
}

.progress-fill.danger {
  background: var(--expense);
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

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

.empty-state p {
  font-size: 0.875rem;
}

/* ─── Responsive ─── */
.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--navy-100);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text);
  align-items: center;
  justify-content: center;
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 4px 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 500;
  transition: color var(--transition);
  font-family: inherit;
}

.mobile-nav-item .nav-icon {
  font-size: 1.3rem;
}

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding-bottom: 70px;
  }

  .mobile-nav {
    display: block;
  }

  .page-header {
    padding: 16px;
  }

  .page-body {
    padding: 0 16px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

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

  .dashboard-grid-wide {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 28px 24px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    flex: 1;
  }
}

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

  .stat-card {
    padding: 14px;
  }

  .stat-card .stat-value {
    font-size: 1.15rem;
  }
}

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Page visibility ─── */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ─── Split Builder ─── */
.split-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.split-row select,
.split-row input {
  flex: 1;
}

.split-row .btn-remove {
  flex-shrink: 0;
}

/* ─── Health Score ─── */
.score-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  margin: 0 auto 12px;
  position: relative;
}

.score-ring.excellent {
  background: conic-gradient(var(--income) var(--score), var(--navy-100) var(--score));
  color: var(--income);
}

.score-ring.good {
  background: conic-gradient(var(--accent) var(--score), var(--navy-100) var(--score));
  color: var(--accent);
}

.score-ring.fair {
  background: conic-gradient(var(--warning) var(--score), var(--navy-100) var(--score));
  color: var(--warning);
}

.score-ring.poor {
  background: conic-gradient(var(--expense) var(--score), var(--navy-100) var(--score));
  color: var(--expense);
}

/* ─── AI Insights ─── */
.insight-card {
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border-left: 3px solid;
}

.insight-card.insight-positive {
  background: var(--income-bg);
  border-color: var(--income);
}

.insight-card.insight-warning {
  background: var(--warning-bg);
  border-color: var(--warning);
}

.insight-card.insight-info {
  background: var(--info-bg);
  border-color: var(--info);
}

/* ─── Budget Usage ─── */
.budget-item {
  margin-bottom: 16px;
}

.budget-item .budget-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.budget-item .budget-category {
  font-weight: 500;
}

.budget-item .budget-numbers {
  color: var(--text-secondary);
}

/* ─── AI Assistant Chat ─── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 400px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  display: flex;
  max-width: 85%;
}

.chat-msg-user {
  align-self: flex-end;
}

.chat-msg-assistant {
  align-self: flex-start;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: .875rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble-user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble-assistant {
  background: var(--navy-100);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

.chat-suggested {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  flex-wrap: wrap;
}

.suggested-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.suggested-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
  outline: none;
  font-family: inherit;
}

.chat-input:focus {
  border-color: var(--accent);
}

/* ─── Receipt Scanner ─── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
}

.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-zone .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: .9rem;
}

.receipt-preview-card {
  background: var(--navy-50);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.receipt-preview-card img {
  display: block;
  margin-top: 8px;
  border-radius: var(--radius-sm);
}

/* ─── Notification Badge ─── */
.notif-badge {
  position: relative;
}

.notif-badge .badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--expense);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
}
