/* ================================================================
   FamFi - Modern Financial & Family Management Design System
   Professional Typography, Fintech Color Palette & Iconography
   ================================================================ */

:root {
  /* Brand & Core Hues */
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --primary-gradient: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
  
  --success: #10B981;
  --success-hover: #059669;
  --success-light: #ECFDF5;
  --success-gradient: linear-gradient(135deg, #10B981 0%, #059669 100%);

  --warning: #F59E0B;
  --warning-hover: #D97706;
  --warning-light: #FFFBEB;
  --warning-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);

  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-light: #FEF2F2;
  --danger-gradient: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);

  --info: #0EA5E9;
  --purple: #8B5CF6;
  --indigo: #6366F1;
  --pink: #EC4899;

  /* 65-20-15 Financial Envelope Colors */
  --needs-color: #2563EB;
  --savings-color: #10B981;
  --wants-color: #F59E0B;

  /* Layout & Geometry */
  --sidebar-width: 250px;
  --sidebar-bg: #FFFFFF;
  --sidebar-border: #E2E8F0;
  --sidebar-brand-name: #0F172A;
  --sidebar-brand-sub: #64748B;
  --sidebar-user-name: #0F172A;
  --sidebar-user-role: #64748B;
  --sidebar-user-hover: #F1F5F9;
  --sidebar-section-label: #64748B;
  --sidebar-nav-item: #334155;
  --sidebar-nav-item-hover-bg: #F1F5F9;
  --sidebar-nav-item-hover-color: #2563EB;
  --sidebar-logout-color: #DC2626;
  --topbar-height: 60px;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Light Theme Surfaces & Text */
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --surface-hover: #F1F5F9;
  --surface-subtle: #F8FAFC;
  --surface-muted: #F1F5F9;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --border-focus: #93C5FD;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow-primary: 0 4px 16px rgba(37, 99, 235, 0.25);

  /* Specific Component Surfaces */
  --chat-bg: #F8FAFC;
  --chat-other-bg: #FFFFFF;
  --toast-bg: #FFFFFF;
  --input-bg: #FFFFFF;
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --topbar-backdrop: blur(12px);

  --notif-hover: #F8FAFC;
  --notif-unread: #EFF6FF;
  --notif-unread-hover: #DBEAFE;
  --notif-border: #F1F5F9;
  --notif-mark-hover: #DBEAFE;

  --pill-blue-bg: rgba(37, 99, 235, 0.08);
  --pill-red-bg: rgba(239, 68, 68, 0.08);
  --pill-green-bg: rgba(16, 185, 129, 0.08);
  --pill-yellow-bg: rgba(245, 158, 11, 0.08);

  --badge-needs-bg: #EFF6FF;
  --badge-savings-bg: #ECFDF5;
  --badge-wants-bg: #FFFBEB;

  --needs-icon-bg: rgba(37, 99, 235, 0.12);
  --savings-icon-bg: rgba(16, 185, 129, 0.12);
  --wants-icon-bg: rgba(245, 158, 11, 0.12);

  --warning-card-bg: #FEF2F2;
  --goal-done-bg: #ECFDF5;
  --task-done-bg: #ECFDF5;
  --task-done-border: #A7F3D0;
  --task-check-border: #CBD5E1;

  --meal-item-bg: #EFF6FF;
  --meal-item-hover: #DBEAFE;
  --btn-add-meal-border: #CBD5E1;
  --grocery-border: #E2E8F0;
  --today-cell-bg: #EFF6FF;
  --progress-track: #E2E8F0;

  --quick-q-bg: #FFFFFF;
  --quick-q-side-bg: #EFF6FF;
  --quick-q-side-border: #BFDBFE;
  --ctx-border: #E2E8F0;
  --fchat-bg: #F8FAFC;
  --fchat-mine-bg: var(--primary);
  --member-hover: #EFF6FF;

  --login-gradient-start: #0F172A;
  --login-gradient-mid: #1E293B;
  --login-gradient-end: #2563EB;
  --login-card-bg: #FFFFFF;

  --ex-usd-bg: #EFF6FF;
  --ex-khr-bg: #ECFDF5;
  --ex-cny-bg: #FFFBEB;
  --ex-eur-bg: #FDF2F8;
  --ex-status-bg: #F1F5F9;
  --ex-status-text: #64748B;
}

/* ======== DARK THEME ======== */
[data-theme="dark"] {
  --bg: #090D16;
  --card-bg: #111827;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --border: #1E293B;
  --border-focus: #3B82F6;
  --sidebar-bg: #090D16;
  --sidebar-border: #1E293B;
  --sidebar-brand-name: #FFFFFF;
  --sidebar-brand-sub: #94A3B8;
  --sidebar-user-name: #FFFFFF;
  --sidebar-user-role: #94A3B8;
  --sidebar-user-hover: rgba(255, 255, 255, 0.06);
  --sidebar-section-label: rgba(100, 180, 255, 0.65);
  --sidebar-nav-item: rgba(255, 255, 255, 0.72);
  --sidebar-nav-item-hover-bg: rgba(255, 255, 255, 0.08);
  --sidebar-nav-item-hover-color: #FFFFFF;
  --sidebar-logout-color: #F87171;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), 0 2px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
  --shadow-glow-primary: 0 4px 20px rgba(59, 130, 246, 0.3);

  --surface-hover: #1E293B;
  --surface-subtle: #111827;
  --surface-muted: #111827;
  --chat-bg: #090D16;
  --chat-other-bg: #111827;
  --toast-bg: #111827;
  --input-bg: #0F172A;
  --topbar-bg: rgba(17, 24, 39, 0.88);
  --topbar-backdrop: blur(12px);

  --notif-hover: #1E293B;
  --notif-unread: #172554;
  --notif-unread-hover: #1E3A8A;
  --notif-border: #1E293B;
  --notif-mark-hover: #1E3A8A;

  --pill-blue-bg: rgba(59, 130, 246, 0.15);
  --pill-red-bg: rgba(239, 68, 68, 0.15);
  --pill-green-bg: rgba(16, 185, 129, 0.15);
  --pill-yellow-bg: rgba(245, 158, 11, 0.15);

  --badge-needs-bg: rgba(59, 130, 246, 0.18);
  --badge-savings-bg: rgba(16, 185, 129, 0.18);
  --badge-wants-bg: rgba(245, 158, 11, 0.18);

  --needs-icon-bg: rgba(59, 130, 246, 0.18);
  --savings-icon-bg: rgba(16, 185, 129, 0.18);
  --wants-icon-bg: rgba(245, 158, 11, 0.18);

  --warning-card-bg: rgba(239, 68, 68, 0.12);
  --goal-done-bg: rgba(16, 185, 129, 0.12);
  --task-done-bg: rgba(16, 185, 129, 0.12);
  --task-done-border: rgba(16, 185, 129, 0.35);
  --task-check-border: #475569;

  --meal-item-bg: rgba(59, 130, 246, 0.15);
  --meal-item-hover: rgba(59, 130, 246, 0.25);
  --btn-add-meal-border: #334155;
  --grocery-border: #1E293B;
  --today-cell-bg: rgba(59, 130, 246, 0.15);
  --progress-track: #1E293B;

  --quick-q-bg: #1E293B;
  --quick-q-side-bg: rgba(59, 130, 246, 0.12);
  --quick-q-side-border: rgba(59, 130, 246, 0.3);
  --ctx-border: #1E293B;
  --fchat-bg: #090D16;
  --fchat-mine-bg: var(--primary);
  --member-hover: rgba(59, 130, 246, 0.12);

  --login-gradient-start: #090D16;
  --login-gradient-mid: #111827;
  --login-gradient-end: #1E3A8A;
  --login-card-bg: #111827;

  --ex-usd-bg: rgba(59, 130, 246, 0.18);
  --ex-khr-bg: rgba(16, 185, 129, 0.18);
  --ex-cny-bg: rgba(245, 158, 11, 0.18);
  --ex-eur-bg: rgba(239, 68, 68, 0.18);
  --ex-status-bg: #1E293B;
  --ex-status-text: #94A3B8;

  /* Bootstrap Dark Theme Overrides */
  --bs-body-color: #F1F5F9;
  --bs-body-bg: #111827;
  --bs-secondary-color: rgba(241, 245, 249, 0.7);
  --bs-tertiary-color: rgba(241, 245, 249, 0.45);
  --bs-emphasis-color: #FFFFFF;
  --bs-border-color: #1E293B;
  --bs-heading-color: #F1F5F9;
  --bs-link-color: #60A5FA;
  --bs-link-hover-color: #93C5FD;
  --bs-code-color: #F472B6;
  color-scheme: dark;
}

/* ======== SQUIRCLE ICON BADGES ======== */
.famfi-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}
.famfi-icon-badge i { line-height: 1; }
.famfi-icon-badge-lg { width: 50px; height: 50px; border-radius: 15px; font-size: 1.5rem; }
.famfi-icon-badge-sm { width: 30px; height: 30px; border-radius: 8px; font-size: 0.9rem; }
.famfi-icon-badge-xs { width: 24px; height: 24px; border-radius: 6px; font-size: 0.75rem; }

.icon-badge-primary { background: rgba(37, 99, 235, 0.12); color: var(--primary); }
.icon-badge-success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.icon-badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.icon-badge-danger  { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.icon-badge-purple  { background: rgba(139, 92, 246, 0.12); color: var(--purple); }
.icon-badge-indigo  { background: rgba(99, 102, 241, 0.12); color: var(--indigo); }
.icon-badge-cyan    { background: rgba(14, 165, 233, 0.12); color: var(--info); }
.icon-badge-pink    { background: rgba(236, 72, 153, 0.12); color: var(--pink); }

[data-theme="dark"] .icon-badge-primary { background: rgba(59, 130, 246, 0.22); color: #60A5FA; }
[data-theme="dark"] .icon-badge-success { background: rgba(16, 185, 129, 0.22); color: #34D399; }
[data-theme="dark"] .icon-badge-warning { background: rgba(245, 158, 11, 0.22); color: #FBBF24; }
[data-theme="dark"] .icon-badge-danger  { background: rgba(239, 68, 68, 0.22); color: #F87171; }
[data-theme="dark"] .icon-badge-purple  { background: rgba(139, 92, 246, 0.22); color: #A78BFA; }
[data-theme="dark"] .icon-badge-indigo  { background: rgba(99, 102, 241, 0.22); color: #818CF8; }
[data-theme="dark"] .icon-badge-cyan    { background: rgba(14, 165, 233, 0.22); color: #38BDF8; }
[data-theme="dark"] .icon-badge-pink    { background: rgba(236, 72, 153, 0.22); color: #F472B6; }

/* Dark theme – Bootstrap & form overrides */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: var(--input-bg);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  color: var(--text);
}
[data-theme="dark"] .form-control::placeholder {
  color: var(--text-muted);
}
[data-theme="dark"] .modal-content {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .modal-header {
  border-color: var(--border);
}
[data-theme="dark"] .modal-footer {
  border-color: var(--border);
}
[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
[data-theme="dark"] .alert {
  border-color: var(--border);
}
[data-theme="dark"] .table {
  color: var(--text);
}
[data-theme="dark"] .card {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .dropdown-menu {
  background: var(--card-bg);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
[data-theme="dark"] .dropdown-item {
  color: var(--text);
}
[data-theme="dark"] .dropdown-item:hover {
  background: var(--surface-hover);
}
[data-theme="dark"] .form-label {
  color: var(--text);
}
[data-theme="dark"] .form-control-plaintext {
  color: var(--text);
}
[data-theme="dark"] .input-group-text {
  background: var(--surface-subtle);
  border-color: var(--border);
  color: var(--text-muted);
}
[data-theme="dark"] .btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-muted);
}
[data-theme="dark"] .btn-outline-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
  color: var(--text);
}
[data-theme="dark"] .btn-light {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .text-muted {
  color: var(--text-muted) !important;
}
[data-theme="dark"] .text-dark {
  color: var(--text) !important;
}
[data-theme="dark"] .bg-white {
  background-color: var(--card-bg) !important;
}
[data-theme="dark"] .bg-light {
  background-color: var(--surface-subtle) !important;
}
[data-theme="dark"] hr {
  border-color: var(--border);
}

@font-face {
  font-family: 'Noto Sans Khmer Local';
  src: url("/static/fonts/NotoSansKhmer-Regular.2df4fad163ca.ttf") format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

body {
  font-family: 'Kantumruy Pro', 'Noto Sans Khmer Local', 'Inter', 'Siemreap', 'Khmer OS Battambang', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: 'Kantumruy Pro', 'Noto Sans Khmer Local', 'Inter', sans-serif;
  line-height: 1.42;
  letter-spacing: normal;
}

button, input, select, textarea {
  font-family: inherit;
}

code, kbd, samp, pre {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, 'Kantumruy Pro', 'Noto Sans Khmer Local', monospace;
}

/* Bump Bootstrap .small / <small> from 0.875em to 0.9em */
.small, small { font-size: 0.9em !important; }

/* ======== SIDEBAR ======== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease, background-color 0.2s ease, border-color 0.2s ease;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

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

.brand-icon {
  font-size: 26px;
  width: 40px; height: 40px;
  background: rgba(37, 99, 235, 0.12);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--sidebar-brand-name);
  line-height: 1.2;
  white-space: nowrap;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--sidebar-brand-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
  transition: background .15s;
}
.sidebar-user:hover { background: var(--sidebar-user-hover); border-radius: 8px; }

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

.user-name { color: var(--sidebar-user-name); font-size: 14px; font-weight: 600; line-height: 1.3; }
.user-role { color: var(--sidebar-user-role); font-size: 12px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--sidebar-section-label);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 10px;
  margin-bottom: 2px;
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-nav-item);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.sidebar .nav-item:hover {
  background: var(--sidebar-nav-item-hover-bg);
  color: var(--sidebar-nav-item-hover-color);
  transform: translateX(3px);
}

.sidebar .nav-item.active {
  background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.sidebar .nav-item i {
  font-size: 18px;
  width: 22px;
  text-align: center;
  transition: transform 0.2s ease;
}

.sidebar .nav-item:hover i {
  transform: scale(1.1);
}

/* Chat unread badge on sidebar nav */
.chat-unread-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.sidebar-footer {
  padding: 8px 8px 16px;
  border-top: 1px solid var(--sidebar-border);
}

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

/* ======== MAIN CONTENT ======== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======== COLLAPSED SIDEBAR (SHOW ONLY ICONS) ======== */
@media (min-width: 769px) {
  html.sidebar-collapsed {
    --sidebar-width: 72px;
  }

  html.sidebar-collapsed .sidebar {
    width: 72px;
    overflow-x: hidden;
  }

  html.sidebar-collapsed .main-content {
    margin-left: 72px;
  }

  html.sidebar-collapsed .sidebar-brand {
    padding: 16px 8px;
    justify-content: center;
    align-items: center;
  }

  html.sidebar-collapsed .brand-link {
    justify-content: center;
    width: 100%;
    gap: 0;
  }

  html.sidebar-collapsed .brand-info {
    display: none !important;
  }

  html.sidebar-collapsed .sidebar-user {
    padding: 10px 4px;
    justify-content: center;
  }

  html.sidebar-collapsed .sidebar-user .user-info {
    display: none !important;
  }

  html.sidebar-collapsed .sidebar-nav {
    padding: 8px 6px;
    align-items: center;
  }

  html.sidebar-collapsed .nav-section-label {
    height: 1px;
    width: 36px;
    padding: 0;
    margin: 10px auto;
    background: var(--sidebar-border);
    font-size: 0;
    line-height: 0;
    color: transparent;
    border: none;
    overflow: hidden;
  }

  html.sidebar-collapsed .sidebar .nav-item {
    width: 46px;
    height: 44px;
    padding: 0;
    margin: 2px 0;
    justify-content: center;
    border-radius: 12px;
    position: relative;
  }

  html.sidebar-collapsed .sidebar .nav-item span:not(.chat-unread-badge) {
    display: none !important;
  }

  html.sidebar-collapsed .sidebar .nav-item i {
    font-size: 21px;
    margin: 0;
  }

  html.sidebar-collapsed .sidebar .nav-item:hover {
    transform: translateY(-1px);
  }

  html.sidebar-collapsed .chat-unread-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    padding: 0 3px;
    border-radius: 999px;
  }

  html.sidebar-collapsed .sidebar-footer {
    padding: 8px 4px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  html.sidebar-collapsed .sidebar-footer form {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  html.sidebar-collapsed .sidebar-footer .nav-item {
    width: 46px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }

  html.sidebar-collapsed .sidebar-footer .nav-item span {
    display: none !important;
  }

  html.sidebar-collapsed .sidebar-footer .text-center {
    display: none !important;
  }
}

.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.btn-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 11px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-menu:hover {
  background: var(--border);
  color: var(--primary);
  transform: translateY(-1px);
}
.btn-menu:active {
  transform: scale(0.92);
}

.topbar-title {
  font-family: 'Kantumruy Pro', sans-serif;
  font-size: 18px;
  font-weight: 700;
  flex: 1;
  letter-spacing: -0.2px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-content {
  padding: 24px;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
}

/* ======== CARDS ======== */
.famfi-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card-bg);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-title-km {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ======== DASHBOARD ======== */
.page-heading {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.summary-pills { display: flex; gap: 12px; flex-wrap: nowrap; }

.pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  flex: 1;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pill:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.pill-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.pill-value {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.pill-blue { border-top: 3px solid var(--primary); }
.pill-blue .pill-value { color: var(--primary); }
.pill-red { border-top: 3px solid var(--danger); }
.pill-red .pill-value { color: var(--danger); }
.pill-green { border-top: 3px solid var(--success); }
.pill-green .pill-value { color: var(--success); }
.pill-yellow { border-top: 3px solid var(--warning); }
.pill-yellow .pill-value { color: var(--warning); }

/* Quick Actions Bar */
.quick-actions-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 0.5rem;
  min-height: 74px;
  border-radius: var(--radius);
  text-decoration: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.quick-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
  color: var(--primary);
}
.quick-action-btn i { font-size: 1.4rem; line-height: 1; }
.quick-action-btn .qa-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Budget Setup Bar */
.budget-setup-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

/* ======== BUDGET CARDS ======== */
.budget-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
  overflow: hidden;
}

.budget-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.budget-card.budget-card-needs::before { background: linear-gradient(90deg, #2563EB, #60A5FA); }
.budget-card.budget-card-savings::before { background: linear-gradient(90deg, #10B981, #34D399); }
.budget-card.budget-card-wants::before { background: linear-gradient(90deg, #F59E0B, #FBBF24); }

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

.budget-card--warning {
  border-color: var(--danger) !important;
  background: var(--warning-card-bg);
}

.budget-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.budget-card-title { font-size: 18px; font-weight: 700; color: var(--text); }
.budget-card-subtitle { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

.budget-card-icon {
  font-size: 20px;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}

.budget-card-icon .bi { line-height: 1; }
.needs-icon { background: var(--needs-icon-bg); color: var(--needs-color); }
.savings-icon { background: var(--savings-icon-bg); color: var(--savings-color); }
.wants-icon { background: var(--wants-icon-bg); color: var(--wants-color); }

.budget-card-amount {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.4px;
}

.budget-card-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.progress-bar-container { margin: 12px 0; }
.progress-bar-track {
  height: 10px;
  background: var(--progress-track);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
}

.needs-fill { background: linear-gradient(90deg, #2563EB, #3B82F6); }
.savings-fill { background: linear-gradient(90deg, #10B981, #059669); }
.wants-fill { background: linear-gradient(90deg, #F59E0B, #D97706); }

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.budget-card-remaining {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--surface-subtle);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.budget-card-remaining .remaining-amount {
  color: var(--success);
  font-size: 17px;
  font-weight: 800;
}
.budget-card-remaining .remaining-amount.text-danger {
  color: var(--danger) !important;
}

.user-breakdown .d-flex { border-bottom: 1px dashed var(--border); }
.user-breakdown .d-flex:last-child { border-bottom: none; }

/* ======== GOAL CARDS ======== */
.goal-mini-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.goal-icon { font-size: 18px; }
.goal-name { font-size: 14px; font-weight: 500; }

.goal-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.goal-card--done {
  background: var(--goal-done-bg);
  border-color: var(--success);
}

.goal-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.goal-card-icon { font-size: 24px; }
.goal-card-name { font-weight: 600; font-size: 15px; }

/* ======== AMOUNT SLIDER ======== */
.amount-slider-container {}
.form-range { accent-color: var(--primary); }

/* ======== TABLE ======== */
.famfi-table {
  font-size: 14.5px;
  vertical-align: middle;
}

.famfi-table thead th {
  background: var(--surface-subtle);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
}

.famfi-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

.famfi-table tbody tr:hover td {
  background-color: var(--surface-hover);
}

.exp-desc { font-weight: 600; color: var(--text); }

/* ======== CATEGORY BADGES ======== */
.badge-category {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.2;
}

.badge-needs { background: var(--badge-needs-bg); color: var(--primary); }
.badge-savings { background: var(--badge-savings-bg); color: var(--success); }
.badge-wants { background: var(--badge-wants-bg); color: var(--warning); }

/* ======== EMPTY STATE ======== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 12px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ======== BTN ICON ======== */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-icon:hover {
  transform: scale(1.08);
}

/* ======== SECTION TITLE ======== */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ======== MEAL PLAN ======== */
.meal-table { font-size: 13px; }
.meal-table th { text-align: center; font-size: 12px; padding: 6px 4px; background: var(--surface-subtle); }
.meal-cell { padding: 4px; min-width: 80px; height: 60px; vertical-align: top; }
.meal-type-cell { font-size: 12px; font-weight: 600; color: var(--text-muted); vertical-align: middle; }

.meal-item {
  background: var(--meal-item-bg);
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 12px;
  height: 100%;
}

.meal-item:hover { background: var(--meal-item-hover); }
.meal-name { font-weight: 600; color: var(--primary); }
.meal-ingredients { color: var(--text-muted); font-size: 11px; }

.btn-add-meal {
  width: 100%; height: 100%;
  background: none;
  border: 1.5px dashed var(--btn-add-meal-border);
  border-radius: 6px;
  color: var(--btn-add-meal-border);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  min-height: 44px;
}

.btn-add-meal:hover { border-color: var(--primary); color: var(--primary); background: var(--quick-q-side-bg); }

/* ======== GROCERY LIST ======== */
.grocery-category { margin-bottom: 12px; }
.grocery-cat-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }

.grocery-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
  border-bottom: 1px solid var(--grocery-border);
  transition: all 0.2s;
}

.grocery-item.is-purchased {
  opacity: 0.45;
}

.grocery-item.is-purchased .grocery-name {
  text-decoration: line-through;
}

.grocery-check { background: none; border: none; cursor: pointer; padding: 0; font-size: 16px; color: #ccc; }
.grocery-check.checked { color: var(--success); }
.grocery-name { flex: 1; font-size: 14px; }
.grocery-qty { font-size: 13px; color: var(--text-muted); }

/* ======== TASK LIST ======== */
.task-list { display: flex; flex-direction: column; gap: 8px; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s;
}

.task-item.priority-high { border-left: 3px solid var(--danger); }
.task-item.priority-medium { border-left: 3px solid var(--warning); }
.task-item.priority-low { border-left: 3px solid var(--success); }
.task-item.task-done { background: var(--task-done-bg); border-color: var(--task-done-border); }

.task-check { background: none; border: 1.5px solid var(--task-check-border); cursor: pointer; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--task-check-border); transition: 0.2s; }
.task-check:hover { border-color: var(--success); color: var(--success); }
.done-check { border: none; background: none; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 20px; }

.task-content { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; }
.task-desc { font-size: 13px; margin-top: 2px; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.task-priority { font-size: 12px; }
.strikethrough { text-decoration: line-through; color: var(--text-muted); }

/* ======== CALENDAR ======== */
.calendar-table { table-layout: fixed; font-size: 13px; }
.calendar-table th { text-align: center; padding: 6px 2px; font-size: 12px; color: var(--text-muted); }
.calendar-cell { height: 80px; vertical-align: top; padding: 4px; font-size: 13px; }
.today-cell { background: var(--today-cell-bg) !important; }
.cal-day-num { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event-dot { border-radius: 3px; padding: 1px 4px; font-size: 11px; overflow: hidden; }
.cal-event-title { white-space: nowrap; overflow: hidden; display: block; }

.event-birthday { background: #FFE5F0; color: #c2185b; }
.event-payment { background: #FFF3E0; color: #E65100; }
.event-medical { background: #E3F2FD; color: #1565C0; }
.event-school { background: #E8F5E9; color: #2E7D32; }
.event-holiday { background: #F3E5F5; color: #6A1B9A; }
.event-meeting { background: #E0F7FA; color: #006064; }
.event-other { background: #F5F5F5; color: #616161; }

/* Upcoming events */
.upcoming-list { display: flex; flex-direction: column; gap: 10px; }
.upcoming-item { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--surface-muted); border-radius: 8px; border: 1px solid var(--border); }
.upcoming-date { font-size: 14px; font-weight: 700; color: var(--primary); min-width: 36px; text-align: center; }
.upcoming-title { font-size: 14px; font-weight: 500; }
.upcoming-type { font-size: 12px; }

/* Event Cards */
.event-card {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
}
.event-card-birthday { background: #FFF0F6; border-color: #FFB3D1; }
.event-card-payment { background: #FFF8F0; border-color: #FFD8A8; }
.event-card-medical { background: #F0F8FF; border-color: #A8D8FF; }
.event-card-school { background: #F0FFF4; border-color: #A8E6BE; }
.event-card-holiday { background: #F8F0FF; border-color: #D8A8FF; }
.event-card-meeting { background: #F0FFFE; border-color: #A8EBE4; }
.event-card-other { background: #F8F8F8; border-color: #E0E0E0; }

.event-card-date { font-size: 18px; font-weight: 800; line-height: 1; color: var(--text); min-width: 36px; text-align: center; }

/* ======== AI CHAT ======== */
.chat-window {
  overflow-y: auto;
  padding: 12px;
  background: var(--chat-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  max-height: 65vh;
  min-height: 420px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: flex-start;
}

.chat-msg-user { flex-direction: row-reverse; }
.chat-msg-user .chat-bubble { background: var(--primary); color: white; border-radius: 18px 4px 18px 18px; }
.chat-msg-assistant .chat-bubble { background: var(--chat-other-bg); border: 1px solid var(--border); border-radius: 4px 18px 18px 18px; }

.chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #e8ecef;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}

.chat-msg-user .chat-avatar { background: var(--primary); color: white; }

.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
}

.ai-welcome { text-align: center; padding: 20px 10px; }
.ai-avatar { font-size: 48px; margin-bottom: 12px; }
.ai-welcome-text p { color: var(--text-muted); margin-bottom: 8px; }

.quick-questions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.quick-q {
  background: var(--quick-q-bg); border: 1.5px solid var(--primary); color: var(--primary);
  border-radius: 20px; padding: 5px 14px; font-size: 13px; cursor: pointer;
  font-family: 'Kantumruy Pro', sans-serif;
  transition: 0.2s;
}
.quick-q:hover { background: var(--primary); color: white; }

.quick-q-side {
  background: var(--quick-q-side-bg); border: 1px solid var(--quick-q-side-border); color: var(--primary);
  border-radius: 8px; padding: 8px 12px; font-size: 13.5px; cursor: pointer;
  font-family: 'Kantumruy Pro', sans-serif;
  text-align: left; width: 100%;
  transition: 0.2s;
}
.quick-q-side:hover { background: var(--primary); color: white; }

.chat-input-area .input-group { border-radius: 10px; overflow: hidden; }
.chat-input-area .form-control { border-radius: 10px 0 0 10px; }
.chat-input-area .btn { border-radius: 0 10px 10px 0; }

.typing-dots { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dots span {
  width: 8px; height: 8px; background: var(--text-muted);
  border-radius: 50%; animation: typing 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots 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); }
}

/* Context Summary */
.context-summary {}
.ctx-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--ctx-border); font-size: 14px; }
.ctx-label { color: var(--text-muted); }
.ctx-value { font-weight: 600; }

/* ======== FAMILY CHAT ======== */
.family-chat-header {
  background: var(--surface-subtle);
}

.family-chat-window {
  overflow-y: auto;
  padding: 16px;
  background: var(--fchat-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fchat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 80%;
}

.fchat-msg-other { align-self: flex-start; }
.fchat-msg-mine { align-self: flex-end; flex-direction: row-reverse; }

.fchat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

.fchat-content { display: flex; flex-direction: column; }

.fchat-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 2px;
  padding-left: 4px;
}

.fchat-bubble {
  padding: 10px 14px;
  font-size: 14.5px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

.fchat-msg-other .fchat-bubble {
  background: var(--chat-other-bg);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
  color: var(--text);
}

.fchat-msg-mine .fchat-bubble {
  background: var(--fchat-mine-bg);
  color: #fff;
  border-radius: 18px 4px 18px 18px;
}

.fchat-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  padding: 0 4px;
}

.fchat-msg-mine .fchat-time { text-align: right; }

.family-chat-input {
  background: var(--card-bg);
}

/* Members sidebar */
.member-item {
  transition: background 0.15s;
}
.member-item:hover { background: var(--member-hover); }

.member-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.member-name { font-size: 14px; font-weight: 600; }
.member-role { font-size: 12px; }

/* ======== LOGIN & REGISTER PAGE ======== */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  padding: 32px 16px;
}

.login-bg-decor {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.4;
  animation: loginGlowPulse 10s ease-in-out infinite alternate;
}

.login-glow-1 {
  width: 440px;
  height: 440px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.45), rgba(99, 102, 241, 0.08));
  top: -80px;
  left: -80px;
}

.login-glow-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.38), rgba(236, 72, 153, 0.08));
  bottom: -60px;
  right: -60px;
  animation-delay: -5s;
}

.login-glow-3 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.28), rgba(6, 182, 212, 0.05));
  top: 35%;
  left: 60%;
  animation-delay: -2.5s;
}

@keyframes loginGlowPulse {
  0% { transform: scale(1) translate(0, 0); opacity: 0.3; }
  50% { transform: scale(1.1) translate(20px, -20px); opacity: 0.5; }
  100% { transform: scale(0.92) translate(-15px, 15px); opacity: 0.35; }
}

.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.login-theme-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.login-theme-btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--primary);
}

.login-container {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 38px 32px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px);
  transition: box-shadow 0.3s ease;
}

[data-theme="dark"] .login-card {
  background: rgba(17, 24, 39, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(124, 58, 237, 0.15));
  border: 1px solid rgba(37, 99, 235, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.3);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.login-brand-icon:hover {
  transform: scale(1.06) rotate(2deg);
}

.login-brand-icon img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text) 30%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 8px;
  font-weight: 400;
}

.login-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

[data-theme="dark"] .login-badge-pill {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.login-form .form-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.login-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-group .input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
  z-index: 4;
  transition: color 0.2s ease;
}

.login-input-group .form-control {
  padding-left: 42px;
  padding-right: 42px;
  height: 48px;
  border-radius: 12px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  transition: all 0.2s ease;
}

.login-input-group .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.login-input-group:focus-within .input-icon {
  color: var(--primary);
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 8px;
  cursor: pointer;
  z-index: 4;
  font-size: 16px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.password-toggle-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.btn-login-submit {
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  border: none;
  color: #ffffff;
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.4);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login-submit:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%);
  box-shadow: 0 12px 24px -4px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn-login-submit:active {
  transform: translateY(0);
}

.login-trust-badges {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.login-trust-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ======== RESPONSIVE ======== */

/* ── Tablet: 769px – 1024px ── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 200px; }
  .page-content { max-width: 100%; }
  .budget-card-amount { font-size: 22px; }
  /* Stack chart/sidebar panels */
  .col-lg-5, .col-lg-7 { flex: 0 0 100%; max-width: 100%; }
  .cal-event-dot { display: none; }
  .cal-event-dot:first-child { display: block; }
}

/* ── Mobile: ≤ 768px ── */
@media (max-width: 768px) {

  /* ------- Sidebar: off-canvas ------- */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: 1050;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
  }
  .sidebar-overlay.show { display: block; }

  /* ------- Layout ------- */
  .main-content { margin-left: 0; }
  .btn-menu { display: flex; }
  .page-content { padding: 12px 12px 80px; }

  /* ------- Topbar ------- */
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 15px; }

  /* Notification panel: see override after base .notif-panel rule */

  /* ------- Dashboard header ------- */
  .dashboard-header {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
    gap: 10px !important;
  }
  .dashboard-header > div:first-child { text-align: center; }
  .dashboard-header > div:last-child {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }
  .summary-pills { gap: 6px; width: 100%; justify-content: center; flex-wrap: nowrap; }
  .pill { padding: 8px 8px; flex: 1; min-width: 0; align-items: center; text-align: center; border-radius: 12px; }
  .pill-value { font-size: 18px; }
  .pill-label { font-size: 11px; }
  .month-nav { flex-shrink: 0; }

  /* ------- Budget setup bar: compact on mobile ------- */
  .budget-setup-bar { padding: 10px 12px; }
  .budget-setup-bar > div { flex-direction: column !important; gap: 8px !important; align-items: center !important; }
  .budget-setup-bar form { flex-wrap: nowrap !important; gap: 6px !important; justify-content: center; }
  .budget-setup-bar form > div { flex: 1; min-width: 0; }
  .budget-setup-bar form > div .form-select,
  .budget-setup-bar form > div .form-control { width: 100%; }
  .budget-setup-bar .ms-3 {
    margin-left: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    width: 100%;
    text-align: center;
  }
  .budget-setup-bar .ms-3 .form-label { margin-bottom: 0 !important; color: var(--text-muted); }
  .budget-setup-bar .ms-3 .form-control-plaintext {
    font-size: 1rem !important;
    font-weight: 700;
    padding: 0;
    text-align: center;
  }

  /* ------- Bootstrap column collapse (lg cols don't auto-collapse at our 768px breakpoint) ------- */
  .col-md-4, .col-md-6, .col-md-8,
  .col-lg-4, .col-lg-5, .col-lg-6,
  .col-lg-7, .col-lg-8 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  /* BUT keep col-auto in filter/form rows intact */
  .row.g-2 .col-auto, .row.g-2 .col-md-auto { flex: none !important; max-width: none !important; }

  /* ------- Budget cards ------- */
  .budget-card-amount { font-size: 22px; }
  .budget-card-icon { width: 38px; height: 38px; font-size: 18px; }

  /* ------- Amount slider ------- */
  .amount-slider-container .d-flex { flex-wrap: nowrap; align-items: center; }
  .amount-slider-container .d-flex > span.text-muted.small { display: none; } /* hide 0 / 1M labels */
  #amountInput { min-width: 0; flex: 1; text-align: center; }

  /* ------- Tables: horizontal scroll ------- */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .famfi-table { min-width: 600px; } /* wider for member column */

  /* ------- Meal plan ------- */
  .meal-plan-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .meal-table { min-width: 520px; }
  .meal-cell { min-width: 70px; }

  /* ------- Calendar ------- */
  .calendar-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .calendar-table { min-width: 480px; }
  .calendar-cell { height: 52px; padding: 2px 3px; }
  .cal-day-num { font-size: 12px; }
  .cal-event-dot { display: none; }
  .cal-event-dot:first-child { display: block; font-size: 10px; }

  /* ------- AI Chat ------- */
  .chat-window { max-height: 55vh; min-height: 300px; }
  .chat-bubble { max-width: 88%; font-size: 13.5px; }
  .quick-questions { gap: 6px; }
  .quick-q { font-size: 12px; padding: 4px 10px; }
  /* Override the inline min-height:500px on the AI chat card */
  .card-body[style*="min-height"] { min-height: unset !important; }

  /* ------- Goal mini cards: full width ------- */
  .goal-mini-card { margin-bottom: 8px; }

  /* ------- Task, event, upcoming ------- */
  .task-meta { flex-wrap: wrap; }
  .event-card { margin-bottom: 8px; }
  .upcoming-list { gap: 8px; }

  /* ------- Profile page: avatar form on mobile ------- */
  .profile-avatar-upload .d-flex.align-items-center.gap-4 {
    flex-direction: column;
    align-items: flex-start !important;
  }

  /* ------- Forms: prevent iOS auto-zoom (needs font-size ≥ 16px) ------- */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="search"],
  select, textarea {
    font-size: 16px !important;
  }

  /* ------- Touch targets: minimum 44px ------- */
  .btn { min-height: 38px; }
  .btn-sm { min-height: 34px; }
  .sidebar .nav-item { padding: 11px 12px; }
}

/* ── Small phones: ≤ 480px ── */
@media (max-width: 480px) {
  .page-content { padding: 10px 10px 80px; }
  .brand-name { font-size: 16px; }
  .page-heading { font-size: 16px; }
  .topbar-title { font-size: 14px; }

  /* Budget cards */
  .budget-card { padding: 12px; }
  .budget-card-amount { font-size: 20px; }
  .budget-card-icon { width: 34px; height: 34px; font-size: 17px; }
  .budget-card-title { font-size: 14px; }
  .budget-card-subtitle { font-size: 12px; }
  .budget-card-remaining { font-size: 12px; }

  /* Summary pills: stay in a row but tighter */
  .pill { padding: 6px 6px; min-width: 0; border-radius: 10px; }
  .pill-value { font-size: 15px; }
  .pill-label { font-size: 9px; }

  /* Table header smaller */
  .famfi-table thead th { font-size: 11px; padding: 8px 6px; }
  .famfi-table td { font-size: 13px; padding: 6px 8px; }

  /* Login */
  .login-card { padding: 24px 18px; border-radius: 12px; }
  .login-title { font-size: 24px; }
  .login-logo { font-size: 44px; }

  /* Chat */
  .chat-window { min-height: 250px; max-height: 50vh; }

  /* Notification panel: inherited from 768px breakpoint */
}


/* ======== NOTIFICATION BELL ======== */

/* Topbar avatar */
.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px;
  overflow: hidden; flex-shrink: 0;
}

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

.notif-bell-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-bell-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 11px;
  font-size: 16px;
  color: var(--text-muted);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}
.notif-bell-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}
.notif-bell-btn:active {
  transform: scale(0.92);
}
.notif-bell-btn.has-notif {
  color: var(--primary);
}

.notif-badge {
  display: none;
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--card-bg);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
  pointer-events: none;
  line-height: 1;
}
.notif-badge.visible {
  display: flex;
  animation: badgePop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgePop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.notif-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 310px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.14);
  z-index: 9999;
  overflow: hidden;
}
.notif-panel.open {
  display: block;
  animation: notifFadeIn 0.18s ease;
}

/* Mobile: fixed full-width notification panel (must come AFTER base .notif-panel) */
@media (max-width: 768px) {
  .notif-panel {
    position: fixed;
    width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
    top: 56px;
  }
}

@keyframes notifFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 11px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.notif-mark-all {
  all: unset;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.notif-mark-all:hover { background: var(--notif-mark-hover); }

.notif-list {
  max-height: 340px;
  overflow-y: auto;
}

.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 2;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--notif-border);
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--notif-hover); color: inherit; }
.notif-item.unread { background: var(--notif-unread); }
.notif-item.unread:hover { background: var(--notif-unread-hover); }

.notif-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
  opacity: 0;
}
.notif-item.unread .notif-item-dot { opacity: 1; }

.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.4;
}
.notif-item-msg {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 4px;
}
.notif-item-time {
  font-size: 10.5px;
  color: #b0b7c3;
}

/* ======== TOAST NOTIFICATIONS ======== */
.famfi-toast {
  background: var(--toast-bg);
  border-radius: 12px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.13);
  border-left: 4px solid var(--primary);
  margin-top: 8px;
  max-width: 340px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: auto;
}
.famfi-toast.show { opacity: 1; transform: translateY(0); }
.famfi-toast.hide { opacity: 0; transform: translateY(8px); }

.famfi-toast-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 12px;
}
.famfi-toast-icon { font-size: 20px; flex-shrink: 0; }
.famfi-toast-body { flex: 1; min-width: 0; }
.famfi-toast-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  word-break: break-word;
}
.famfi-toast-msg {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-word;
  line-height: 1.4;
}
.famfi-toast-close {
  all: unset;
  cursor: pointer;
  font-size: 16px;
  color: #b0b7c3;
  line-height: 1;
  flex-shrink: 0;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.famfi-toast-close:hover { color: var(--danger); }

/* ======== THEME TOGGLE ======== */
.theme-toggle-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 11px;
  font-size: 16px;
  color: var(--text-muted);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}
.theme-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}
.theme-toggle-btn:active {
  transform: scale(0.92);
}
.theme-toggle-btn .bi-moon-fill { display: inline; }
.theme-toggle-btn .bi-sun-fill { display: none; }
[data-theme="dark"] .theme-toggle-btn .bi-moon-fill { display: none; }
[data-theme="dark"] .theme-toggle-btn .bi-sun-fill { display: inline; }

/* Dark theme – event cards */
[data-theme="dark"] .event-card-birthday { background: rgba(193,33,89,0.12); border-color: rgba(255,179,209,0.25); }
[data-theme="dark"] .event-card-payment { background: rgba(230,81,0,0.1); border-color: rgba(255,216,168,0.25); }
[data-theme="dark"] .event-card-medical { background: rgba(21,101,192,0.1); border-color: rgba(168,216,255,0.25); }
[data-theme="dark"] .event-card-school { background: rgba(46,125,50,0.1); border-color: rgba(168,230,190,0.25); }
[data-theme="dark"] .event-card-holiday { background: rgba(106,27,154,0.1); border-color: rgba(216,168,255,0.25); }
[data-theme="dark"] .event-card-meeting { background: rgba(0,96,100,0.1); border-color: rgba(168,235,228,0.25); }
[data-theme="dark"] .event-card-other { background: rgba(255,255,255,0.05); border-color: rgba(224,224,224,0.2); }

/* Dark theme – calendar event dots */
[data-theme="dark"] .event-birthday { background: rgba(193,33,89,0.2); }
[data-theme="dark"] .event-payment { background: rgba(230,81,0,0.2); }
[data-theme="dark"] .event-medical { background: rgba(21,101,192,0.2); }
[data-theme="dark"] .event-school { background: rgba(46,125,50,0.2); }
[data-theme="dark"] .event-holiday { background: rgba(106,27,154,0.2); }
[data-theme="dark"] .event-meeting { background: rgba(0,96,100,0.2); }
[data-theme="dark"] .event-other { background: rgba(255,255,255,0.08); }

/* Dark theme – chat avatar */
[data-theme="dark"] .chat-avatar { background: var(--border); }

/* Dark theme – topbar avatar */
[data-theme="dark"] .topbar-avatar { border-color: var(--border); }

/* Dark theme – grocery check */
[data-theme="dark"] .grocery-check { color: var(--text-muted); }
[data-theme="dark"] .grocery-check.checked { color: var(--success); }

/* Dark theme – notification time & toast close */
[data-theme="dark"] .notif-item-time { color: #6b7280; }
[data-theme="dark"] .famfi-toast-close { color: #6b7280; }

/* Dark theme – profile page cards */
[data-theme="dark"] .profile-card-dark {
  border: 1px solid var(--border) !important;
  box-shadow: 0 2px 16px rgba(0,0,0,.25) !important;
}
[data-theme="dark"] .profile-avatar-ring {
  border-color: var(--border) !important;
}
[data-theme="dark"] .profile-accent {
  color: #a78bfa !important;
}

/* Dark theme – income summary cards inline borders */
[data-theme="dark"] .income-card-green { border-left-color: var(--success) !important; }
[data-theme="dark"] .income-card-blue { border-left-color: var(--primary) !important; }
[data-theme="dark"] .income-card-yellow { border-left-color: var(--warning) !important; }
[data-theme="dark"] .income-icon-green { background: rgba(39,174,96,0.15) !important; }
[data-theme="dark"] .income-icon-blue { background: rgba(74,144,217,0.15) !important; }
[data-theme="dark"] .income-icon-yellow { background: rgba(245,166,35,0.15) !important; }

/* Dark theme – search icon in transactions */
[data-theme="dark"] .search-icon-muted { color: var(--text-muted) !important; }

/* Dark theme – progress bar (bootstrap) */
[data-theme="dark"] .progress {
  background-color: var(--progress-track);
}

/* Dark theme – Bootstrap table overrides */
[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-hover-bg: rgba(255,255,255,0.04);
  --bs-table-hover-color: var(--text);
  --bs-table-striped-bg: rgba(255,255,255,0.03);
  --bs-table-striped-color: var(--text);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .table-light {
  --bs-table-bg: var(--surface-subtle);
  --bs-table-border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .table-hover > tbody > tr:hover > * {
  --bs-table-hover-bg: rgba(255,255,255,0.04);
  color: var(--text);
}
[data-theme="dark"] .table > :not(caption) > * > * {
  border-bottom-color: var(--border);
}

/* Dark theme – page header icon in profile */
[data-theme="dark"] .page-icon {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
[data-theme="dark"] .page-subtitle {
  color: var(--text-muted);
}

/* Dark theme – meta color for theme-color */
[data-theme="dark"] .border-bottom {
  border-bottom-color: var(--border) !important;
}

/* Dark theme – Topbar buttons & mobile navigation */
[data-theme="dark"] .btn-menu,
[data-theme="dark"] .theme-toggle-btn,
[data-theme="dark"] .notif-bell-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: #CBD5E1;
}

[data-theme="dark"] .btn-menu:hover,
[data-theme="dark"] .theme-toggle-btn:hover,
[data-theme="dark"] .notif-bell-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #60A5FA;
  border-color: rgba(96, 165, 250, 0.3);
}

/* Dark theme: bottom nav */
[data-theme="dark"] .mobile-bottom-nav {
  background: rgba(15, 23, 42, 0.94);
  border-top-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .bottom-nav-item {
  color: #94A3B8;
}

[data-theme="dark"] .bottom-nav-item:hover,
[data-theme="dark"] .bottom-nav-item:focus {
  color: #F1F5F9;
}

[data-theme="dark"] .bottom-nav-item:hover .bottom-nav-icon-wrap {
  background: rgba(255, 255, 255, 0.08);
  color: #F1F5F9;
}

[data-theme="dark"] .bottom-nav-item.active {
  color: #60A5FA;
}

[data-theme="dark"] .bottom-nav-item.active span {
  color: #60A5FA;
  text-shadow: 0 0 14px rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .bottom-nav-item.active .bottom-nav-icon-wrap {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(37, 99, 235, 0.3) 100%);
  color: #60A5FA;
  border-color: rgba(96, 165, 250, 0.32);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .bottom-nav-item.active::after {
  background: linear-gradient(90deg, #3B82F6, #93C5FD);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.7);
}

[data-theme="dark"] .bottom-nav-badge,
[data-theme="dark"] .notif-badge {
  border-color: #0F172A;
}

/* ================================================================
   MOBILE BOTTOM NAVIGATION BAR
   ================================================================ */
@keyframes navIndicatorPop {
  0% { transform: scaleX(0); opacity: 0; }
  60% { transform: scaleX(1.2); opacity: 1; }
  100% { transform: scaleX(1); opacity: 1; }
}

@keyframes navIconBounce {
  0% { transform: scale(0.94); }
  50% { transform: scale(1.14); }
  100% { transform: scale(1.08); }
}

.mobile-bottom-nav {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(66px + env(safe-area-inset-bottom, 0px));
    min-height: 66px;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 -6px 24px -2px rgba(15, 23, 42, 0.07), 0 -1px 3px rgba(15, 23, 42, 0.02);
    z-index: 1030;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px)) 6px;
    justify-content: space-around;
    align-items: center;
    box-sizing: border-box;
    transform: translateY(0);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease, border-color 0.25s ease;
    will-change: transform;
    -webkit-user-select: none;
    user-select: none;
  }

  .mobile-bottom-nav.nav-hidden {
    transform: translateY(115%);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 2px 2px;
    color: #64748B;
    text-decoration: none;
    font-family: 'Kantumruy Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1.2;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    border-radius: 14px;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: -0.05px;
    transition: color 0.18s ease, font-weight 0.18s ease, transform 0.18s ease;
  }

  .bottom-nav-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 30px;
    border-radius: 15px;
    border: 1px solid transparent;
    transition: all 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    color: #64748B;
  }

  .bottom-nav-item i {
    font-size: 19px;
    line-height: 1;
    transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.18s ease;
  }

  .bottom-nav-item:hover {
    color: #1E293B;
  }

  .bottom-nav-item:hover .bottom-nav-icon-wrap {
    background: rgba(100, 116, 139, 0.1);
    color: #1E293B;
  }

  .bottom-nav-item:active {
    transform: scale(0.92);
  }

  .bottom-nav-item.active {
    color: #1D4ED8;
    font-weight: 700;
  }

  .bottom-nav-item.active span {
    color: #1D4ED8;
    font-weight: 700;
    transform: scale(1.02);
  }

  .bottom-nav-item.active .bottom-nav-icon-wrap {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.14) 0%, rgba(59, 130, 246, 0.2) 100%);
    color: #1D4ED8;
    border-color: rgba(37, 99, 235, 0.24);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
  }

  .bottom-nav-item.active i {
    transform: scale(1.08);
    animation: navIconBounce 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .bottom-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 1px;
    width: 14px;
    height: 3px;
    background: linear-gradient(90deg, #2563EB, #60A5FA);
    border-radius: 999px;
    box-shadow: 0 1px 6px rgba(37, 99, 235, 0.45);
    animation: navIndicatorPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .bottom-nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 19px);
    min-width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #fff;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
  }

  /* Adjust page content bottom padding for bottom nav */
  .page-content {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Toast container: above bottom nav */
  .toast-container {
    bottom: 84px !important;
  }
}

/* ================================================================
   IMPROVED MOBILE RESPONSIVE - PILLS & DASHBOARD
   ================================================================ */
@media (max-width: 768px) {
  /* Dashboard pills: horizontal scroll instead of wrap */
  .summary-pills {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    width: 100%;
    align-self: stretch;
    max-width: 100%;
  }
  .summary-pills::-webkit-scrollbar { display: none; }

  .pill {
    flex-shrink: 0;
    min-width: 100px;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .pill-label { font-size: 12px; }
  .pill-value { font-size: 18px; }

  /* Page heading smaller on mobile */
  .page-heading { font-size: 17px; }

  /* Budget card: tighter on mobile */
  .budget-card { padding: 14px; }
  .budget-card-title { font-size: 15px; }
  .budget-card-subtitle { font-size: 12px; }
  .budget-card-amount { font-size: 20px; }
  .budget-card-remaining { font-size: 12px; }

  /* Topbar: refined mobile spacing */
  .btn-menu {
    display: inline-flex;
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .topbar {
    padding: 0 14px;
    gap: 12px;
    height: 58px;
  }
  .topbar-title {
    font-size: 16.5px;
    font-weight: 700;
  }
  .topbar-actions {
    gap: 6px;
  }
}

/* ================================================================
   IMPROVED MOBILE - TABS HORIZONTAL SCROLL
   ================================================================ */
@media (max-width: 768px) {
  /* Report/page tabs: horizontal scrollable */
  .nav-pills {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
  }
  .nav-pills::-webkit-scrollbar { display: none; }
  .nav-pills .nav-link {
    white-space: nowrap;
    font-size: 13px;
    padding: 6px 12px;
  }
}

/* ================================================================
   IMPROVED MOBILE - TABLES
   ================================================================ */
@media (max-width: 768px) {
  /* Ensure all tables are scrollable horizontally */
  .table-responsive {
    margin: 0 -12px;
    padding: 0 12px;
  }

  /* Transaction day header: stack on mobile */
  .d-flex.justify-content-between.align-items-center.px-2.py-2 {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 4px;
  }

  /* Smaller text in tables on mobile */
  .table th { font-size: 12px; padding: 8px 6px; }
  .table td { font-size: 13px; padding: 8px 6px; }

  /* Better badge sizing on mobile */
  .badge-category { font-size: 11px; padding: 3px 8px; }
}

/* ================================================================
   IMPROVED MOBILE - CHAT PAGES
   ================================================================ */
@media (max-width: 768px) {
  /* Family chat: reorder so chat comes first on mobile */
  .row.g-3:has(.family-chat-window) {
    flex-direction: column-reverse;
  }

  /* Show member list as collapsed on mobile */
  .row.g-3:has(.family-chat-window) > .col-lg-3.col-md-4 {
    order: 2;
  }
  .row.g-3:has(.family-chat-window) > .col-lg-9.col-md-8 {
    order: 1;
  }

  /* Better chat height on mobile */
  .card-body[style*="min(600px"] {
    height: calc(100vh - 200px) !important;
    max-height: 500px;
  }
  .card-body[style*="min(500px"] {
    min-height: calc(100vh - 220px) !important;
    max-height: 500px;
  }

  /* Chat bubble wider on mobile */
  .chat-bubble { max-width: 90%; }
  .fchat-msg { max-width: 88%; }

  /* Chat input: bigger touch target */
  .family-chat-input .form-control {
    min-height: 44px;
 }
  .family-chat-input .btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ================================================================
   IMPROVED MOBILE - FORMS & FILTERS
   ================================================================ */
@media (max-width: 768px) {
  /* Filter form rows: stack properly */
  .row.g-2 .col-6 { flex: 0 0 50%; max-width: 50%; }
  .row.g-2 .col-md { flex: 0 0 50% !important; max-width: 50% !important; }
  .row.g-2 .col-md-auto {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    display: flex;
    gap: 8px;
  }
  .row.g-2 .col-md-auto .btn {
    flex: 1;
  }

  /* Modal: full-width on mobile */
  .modal-dialog {
    margin: 10px;
    max-width: calc(100vw - 20px);
  }

  /* Form controls: ensure minimum height for touch */
  .form-control, .form-select {
    min-height: 42px;
  }
  .form-control-sm, .form-select-sm {
    min-height: 38px;
  }

  /* Download buttons: compact */
  .btn-group .btn-sm {
    padding: 4px 8px;
  }
}

/* ================================================================
   IMPROVED MOBILE - CALENDAR & MEAL PLAN
   ================================================================ */
@media (max-width: 768px) {
  /* Calendar cells: compact */
  .calendar-cell {
    height: 48px;
    padding: 2px;
  }
  .cal-day-num { font-size: 11px; }

  /* Calendar day names: abbreviated */
  .calendar-table th { font-size: 11px; padding: 4px 2px; }

  /* Meal plan: sticky sidebar fix on mobile */
  .sticky-top[style*="top:70px"] {
    position: relative !important;
    top: auto !important;
  }
}

/* ================================================================
   IMPROVED MOBILE - QUICK LINKS / CARDS
   ================================================================ */
@media (max-width: 768px) {
  /* Quick link cards on dashboard: 2 columns */
  .col-6.col-md-3 .card-body {
    padding: 12px 8px !important;
  }
  .col-6.col-md-3 .card-body i.fs-2 {
    font-size: 1.5rem !important;
  }
  .col-6.col-md-3 .card-body .fw-semibold {
    font-size: 12px;
  }
}

/* ================================================================
   IMPROVED MOBILE - PROFILE PAGE
   ================================================================ */
@media (max-width: 768px) {
  /* Profile avatar: smaller on mobile */
  .profile-avatar-upload img,
  .profile-avatar-upload div[style*="width:110px"] {
    width: 80px !important;
    height: 80px !important;
    font-size: 30px !important;
  }
}

/* ================================================================
   SMALL PHONES (≤ 480px) - EXTRA COMPACT
   ================================================================ */
@media (max-width: 480px) {
  /* Bottom nav: refined compact proportions for small phones */
  .mobile-bottom-nav {
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px)) 2px;
  }
  .bottom-nav-item {
    font-size: 10px;
    padding: 1px 1px;
  }
  .bottom-nav-icon-wrap {
    width: 44px;
    height: 28px;
    border-radius: 14px;
  }
  .bottom-nav-item i {
    font-size: 18px;
  }
  .bottom-nav-item span {
    font-size: 10px;
  }
  .bottom-nav-item.active::after {
    bottom: 1px;
    width: 12px;
    height: 2.5px;
  }

  /* Page content: tighter padding */
  .page-content {
    padding: 8px 8px 80px !important;
  }

  /* Summary pills: compact but readable */
  .pill { padding: 6px 6px; min-width: 80px; border-radius: 10px; }
  .pill-value { font-size: 15px; }
  .pill-label { font-size: 10px; }

  /* Tabs: smaller */
  .nav-pills .nav-link {
    font-size: 12px;
    padding: 5px 10px;
  }

  /* Budget card: ultra compact */
  .budget-card { padding: 10px; }
  .budget-card-amount { font-size: 18px; }
  .budget-card-icon { width: 32px; height: 32px; font-size: 16px; }

  /* Tables: smaller */
  .table th { font-size: 11px; padding: 6px 4px; }
  .table td { font-size: 12px; padding: 6px 4px; }

  /* Topbar */
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-title { font-size: 15px; font-weight: 700; }
  .page-heading { font-size: 15px; }

  /* Filter form: full width columns */
  .row.g-2 .col-6 { flex: 0 0 100% !important; max-width: 100% !important; }
  .row.g-2 .col-md { flex: 0 0 100% !important; max-width: 100% !important; }
}



/* ================================================================
   FLOATING AI CHAT WIDGET
   ================================================================ */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(124,58,237,0.5); }
.ai-fab .fab-icon-open,
.ai-fab .fab-icon-close { position: absolute; transition: opacity 0.2s, transform 0.2s; }
.ai-fab .fab-icon-close { opacity: 0; transform: rotate(-90deg); }
.ai-fab.active .fab-icon-open { opacity: 0; transform: rotate(90deg); }
.ai-fab.active .fab-icon-close { opacity: 1; transform: rotate(0deg); }

.ai-widget {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.ai-widget.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ai-widget-header {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-widget-header-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.ai-widget-header-text { flex: 1; }
.ai-widget-header-text .wh-title { font-weight: 700; font-size: 15px; }
.ai-widget-header-text .wh-sub { font-size: 11px; opacity: 0.85; }
.ai-widget-header-clear {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: 0.15s;
}
.ai-widget-header-clear:hover { color: #fff; background: rgba(255,255,255,0.15); }

.ai-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: 340px;
}

.ai-widget-welcome {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ai-widget-welcome-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}
.ai-widget-welcome-bubble {
  background: var(--surface-subtle, #f8f9fa);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.ai-widget-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-widget-qbtn {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text);
  font-family: 'Kantumruy Pro', sans-serif;
  transition: 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-widget-qbtn:hover {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border-color: transparent;
}

/* Chat messages inside widget */
.ai-widget-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.ai-widget-msg.msg-user {
  flex-direction: row-reverse;
}
.ai-widget-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.ai-widget-msg.msg-ai .ai-widget-msg-avatar {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
}
.ai-widget-msg.msg-user .ai-widget-msg-avatar {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.ai-widget-msg-bubble {
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  max-width: 80%;
  line-height: 1.5;
  word-break: break-word;
}
.ai-widget-msg.msg-ai .ai-widget-msg-bubble {
  background: var(--surface-subtle, #f8f9fa);
  color: var(--text);
}
.ai-widget-msg.msg-user .ai-widget-msg-bubble {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
}

.ai-widget-typing {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.ai-widget-typing .typing-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #a855f7;
  margin: 0 2px;
  animation: wTypingBounce 1.2s infinite;
}
.ai-widget-typing .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-widget-typing .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wTypingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.ai-widget-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.ai-widget-footer form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-widget-footer input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: 'Kantumruy Pro', sans-serif;
  background: var(--input-bg, #fff);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.ai-widget-footer input:focus {
  border-color: #a855f7;
}
.ai-widget-footer input::placeholder {
  color: var(--text-muted);
}
.ai-widget-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: 0.15s;
}
.ai-widget-send-btn:hover { transform: scale(1.05); }
.ai-widget-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Mobile adjustments */
@media (max-width: 768px) {
  .ai-fab { bottom: 80px; right: 16px; width: 50px; height: 50px; font-size: 22px; }
  .ai-widget {
    bottom: 140px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 200px);
  }
  .ai-widget-body { max-height: calc(100dvh - 340px); }
}

/* Dark theme overrides */
[data-theme="dark"] .ai-widget {
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
[data-theme="dark"] .ai-widget-qbtn {
  background: var(--surface-subtle);
  border-color: var(--border);
}
[data-theme="dark"] .ai-widget-footer input {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}

/* ============================================================
   FamFi Flash Alerts & Confirmation Dialog Modal
   ============================================================ */

.famfi-flash-alert {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 0.85rem 1.15rem;
  backdrop-filter: blur(8px);
  animation: slideInDown 0.25s ease forwards;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
  color: #065f46 !important;
}
.alert-danger, .alert-error {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.25) !important;
  color: #991b1b !important;
}
.alert-warning {
  background: rgba(245, 158, 11, 0.1) !important;
  border-color: rgba(245, 158, 11, 0.25) !important;
  color: #92400e !important;
}
.alert-info, .alert-primary {
  background: rgba(37, 99, 235, 0.1) !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
  color: #1e40af !important;
}

[data-theme="dark"] .alert-success {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #6ee7b7 !important;
}
[data-theme="dark"] .alert-danger, [data-theme="dark"] .alert-error {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
}
[data-theme="dark"] .alert-warning {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #fcd34d !important;
}
[data-theme="dark"] .alert-info, [data-theme="dark"] .alert-primary {
  background: rgba(37, 99, 235, 0.15) !important;
  border-color: rgba(37, 99, 235, 0.3) !important;
  color: #93c5fd !important;
}

/* Universal Modal Styling */
.modal-content {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
}

.modal-footer {
  border-top: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
}

.modal-backdrop.show {
  opacity: 0.6;
  backdrop-filter: blur(4px);
}

/* Modal Dialog */
.famfi-dialog-modal .modal-content {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.famfi-dialog-modal .modal-backdrop {
  backdrop-filter: blur(6px);
}

@keyframes modalScaleIn {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes slideInDown {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}

