/* ==========================================================================
   MONEYTRACK – DAILY PERSONAL FINANCE MANAGEMENT
   Modern Fintech Dashboard Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS VARIABLES & THEMES
   -------------------------------------------------------------------------- */
:root {
  /* Brand Palette - Soft Pastel Blue / Periwinkle (#B1C9EF) */
  --primary: #5282CA;             /* Accessible contrast primary on white / text */
  --primary-accent: #B1C9EF;      /* User Theme Color: Soft Periwinkle Blue */
  --primary-hover: #406FB5;
  --primary-active: #325A99;
  --primary-light: #EBF2FC;       /* Very soft tint of #B1C9EF */
  --primary-border: #B1C9EF;

  --secondary: #1E2D4A;           /* Deep Blue Navy - harmonic with #B1C9EF */
  --secondary-light: #2A3E66;
  --secondary-surface: #141F33;

  /* Functional Status Colors */
  --income: #10B981;              /* Green */
  --income-bg: #ECFDF5;
  --income-border: #A7F3D0;

  --expense: #EF4444;             /* Soft Red */
  --expense-hover: #DC2626;
  --expense-bg: #FEF2F2;
  --expense-border: #FECACA;

  --savings: #5282CA;             /* Harmonized Blue */
  --savings-bg: #EBF2FC;
  --savings-border: #B1C9EF;

  --warning: #F59E0B;             /* Amber / Yellow */
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;

  --purple: #8B5CF6;
  --purple-bg: #F5F3FF;

  /* Light Theme Neutrals */
  --bg-app: #F4F7FC;              /* Light soothing background tinted toward #B1C9EF */
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F8FAFD;
  --border-color: #DDE5F2;        /* Soft cool border */
  --border-subtle: #EDF3FA;

  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --text-inverse: #FFFFFF;

  /* Elevation Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 16px -2px rgba(20, 43, 41, 0.07), 0 2px 6px -2px rgba(20, 43, 41, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(20, 43, 41, 0.1), 0 4px 12px -2px rgba(20, 43, 41, 0.05);
  --shadow-xl: 0 20px 35px -5px rgba(20, 43, 41, 0.15);

  /* Layout Measurements */
  --sidebar-width: 260px;
  --topbar-height: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme Overrides */
body.theme-dark {
  --bg-app: #0D1424;
  --bg-surface: #141F36;
  --bg-surface-alt: #1A2846;
  --border-color: #24365C;
  --border-subtle: #1D2C4D;

  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;

  --primary-light: rgba(177, 201, 239, 0.15);
  --income-bg: rgba(16, 185, 129, 0.15);
  --expense-bg: rgba(239, 68, 68, 0.15);
  --savings-bg: rgba(177, 201, 239, 0.15);
  --warning-bg: rgba(245, 158, 11, 0.15);
  --purple-bg: rgba(139, 92, 246, 0.15);

  --shadow-sm: 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   2. RESET & BASE ELEMENTS
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

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

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

button, input, select, textarea {
  font-family: inherit;
  font-size: 0.9375rem;
  color: inherit;
  outline: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* --------------------------------------------------------------------------
   3. UTILITY CLASSES & BADGES
   -------------------------------------------------------------------------- */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-income { color: var(--income) !important; }
.text-expense { color: var(--expense) !important; }
.text-savings { color: var(--savings) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge-success {
  background-color: var(--income-bg);
  color: var(--income);
  border: 1px solid var(--income-border);
}

.badge-danger {
  background-color: var(--expense-bg);
  color: var(--expense);
  border: 1px solid var(--expense-border);
}

.badge-info {
  background-color: var(--savings-bg);
  color: var(--savings);
  border: 1px solid var(--savings-border);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-neutral {
  background-color: var(--border-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   4. BUTTON STYLES
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn i, .btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, #6495ED, #4A7ECF);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(82, 130, 202, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5587E0, #3E6FC0);
  box-shadow: 0 6px 18px rgba(82, 130, 202, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  background-color: var(--primary-active);
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

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

.btn-success {
  background-color: var(--income);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--expense);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background-color: var(--expense-hover);
  transform: translateY(-1px);
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline-primary:hover {
  background-color: var(--primary-light);
}

.btn-outline-secondary {
  background-color: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border-color);
}

.btn-outline-secondary:hover {
  background-color: var(--bg-surface-alt);
  color: var(--text-main);
  border-color: var(--text-subtle);
}

.btn-outline-danger {
  background-color: transparent;
  color: var(--expense);
  border: 1.5px solid var(--expense);
}

.btn-outline-danger:hover {
  background-color: var(--expense-bg);
}

.btn-outline-light {
  background-color: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(4px);
}

.btn-outline-light:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.btn-demo {
  background: linear-gradient(135deg, #6495ED, #4A7ECF);
  color: #FFFFFF;
  box-shadow: 0 4px 15px rgba(82, 130, 202, 0.35);
}

.btn-demo:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-sm i, .btn-sm svg {
  width: 15px;
  height: 15px;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

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

.btn-icon i, .btn-icon svg {
  width: 20px;
  height: 20px;
}

/* --------------------------------------------------------------------------
   5. AUTH / LOGIN VIEW
   -------------------------------------------------------------------------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 10% 20%, rgba(177, 201, 239, 0.45) 0%, transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(30, 45, 74, 0.12) 0%, transparent 45%),
              var(--bg-app);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--secondary), #2A3E66);
  color: var(--primary-accent);
  box-shadow: 0 8px 20px rgba(30, 45, 74, 0.25);
  margin-bottom: 12px;
}

.brand-logo svg {
  width: 32px;
  height: 32px;
}

.brand-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--secondary);
}

body.theme-dark .brand-title {
  color: #FFFFFF;
}

.brand-title span {
  color: var(--primary);
}

.brand-tagline {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header h2 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 0.875rem;
}

.auth-form .form-group {
  margin-bottom: 18px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-subtle);
  pointer-events: none;
}

.input-icon-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background-color: var(--bg-surface-alt);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.input-icon-wrapper input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.btn-toggle-password {
  position: absolute;
  right: 12px;
  color: var(--text-subtle);
  padding: 4px;
  border-radius: 6px;
}

.btn-toggle-password:hover {
  color: var(--text-main);
}

.btn-toggle-password svg {
  width: 18px;
  height: 18px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.demo-hint-badge {
  font-size: 0.75rem;
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.form-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  font-size: 0.875rem;
}

.checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
}

.checkbox-container input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.auth-alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 18px;
  background-color: var(--expense-bg);
  color: var(--expense);
  border: 1px solid var(--expense-border);
}

.input-error {
  display: block;
  font-size: 0.75rem;
  color: var(--expense);
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
  padding: 0 12px;
  font-size: 0.75rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8125rem;
}

.version-tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.6875rem;
  color: var(--text-subtle);
}

.auth-copyright {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 10px;
  letter-spacing: 0.2px;
  pointer-events: none;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   6. MAIN APP LAYOUT (SIDEBAR + TOPBAR + CONTENT)
   -------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-app);
}

/* SIDEBAR */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--secondary);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-smooth);
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #B1C9EF, #5282CA);
  color: #1E2D4A;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(82, 130, 202, 0.35);
}

.logo-box svg {
  width: 22px;
  height: 22px;
}

.logo-text {
  font-family: 'Poppins', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.3px;
}

.logo-text span {
  color: var(--primary);
}

.btn-sidebar-close {
  display: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 6px;
  border-radius: 8px;
}

.btn-sidebar-close:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.1);
}

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

.nav-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1px;
  padding: 0 12px 10px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link svg {
  width: 19px;
  height: 19px;
  color: rgba(255, 255, 255, 0.6);
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.08);
}

.nav-link:hover svg {
  color: var(--primary);
}

.nav-link.active {
  color: #FFFFFF;
  background: linear-gradient(90deg, rgba(177, 201, 239, 0.28), rgba(177, 201, 239, 0.08));
  border-left: 3.5px solid #B1C9EF;
  font-weight: 600;
}

.nav-link.active svg {
  color: #B1C9EF;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 700;
  background-color: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background-color: var(--secondary-surface);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--primary);
}

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

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

.user-status {
  font-size: 0.6875rem;
  color: var(--primary);
  white-space: nowrap;
}

.btn-logout {
  color: rgba(255, 255, 255, 0.6);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  color: var(--expense);
  background-color: rgba(239, 68, 68, 0.15);
}

.btn-logout svg {
  width: 18px;
  height: 18px;
}

/* MAIN CONTENT WRAPPER */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* TOPBAR */
.app-topbar {
  height: var(--topbar-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(8px);
}

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

.mobile-menu-toggle {
  display: none;
}

.page-main-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.page-sub-title {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

.notification-dropdown-wrapper {
  position: relative;
}

.notification-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  background-color: var(--expense);
  color: #FFFFFF;
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-surface);
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  z-index: 1000;
  display: none;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-dropdown.show {
  display: block;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.notif-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
}

.btn-link-xs {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
}

.notif-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px 0;
}

.notif-item {
  padding: 12px 18px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.notif-item:hover {
  background-color: var(--bg-surface-alt);
}

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-item-icon.warning {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.notif-item-icon.danger {
  background-color: var(--expense-bg);
  color: var(--expense);
}

.notif-item-icon.success {
  background-color: var(--income-bg);
  color: var(--income);
}

.notif-item-content h5 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.notif-item-content p {
  font-size: 0.75rem;
  line-height: 1.4;
}

.notif-item-time {
  font-size: 0.6875rem;
  color: var(--text-subtle);
  margin-top: 4px;
}

.notif-empty {
  padding: 30px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.8125rem;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.topbar-profile:hover {
  background-color: var(--bg-surface-alt);
  border-color: var(--border-color);
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
}

.topbar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.topbar-user-tier {
  font-size: 0.6875rem;
  color: var(--primary);
  font-weight: 500;
}

/* APP CONTENT CONTAINER */
.app-content {
  flex: 1;
  padding: 30px 32px 30px;
  display: flex;
  flex-direction: column;
}

.app-page-footer {
  margin-top: auto;
  padding: 24px 0 10px;
  text-align: center;
  pointer-events: none; /* Tidak menghalangi klik tombol atau interaksi */
}

.copyright-text {
  font-size: 0.75rem;
  color: var(--text-subtle);
  letter-spacing: 0.3px;
  margin: 0;
  user-select: none;
  opacity: 0.8;
}

.page-view {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.page-view.active {
  display: block;
}

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

/* --------------------------------------------------------------------------
   7. PAGE HEADER & BANNERS
   -------------------------------------------------------------------------- */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.view-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-banner {
  background: linear-gradient(135deg, #1E2D4A 0%, #2A3E66 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(30, 45, 74, 0.18);
  gap: 20px;
  flex-wrap: wrap;
  border: 1px solid rgba(177, 201, 239, 0.2);
}

.banner-text h2 {
  font-size: 1.375rem;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.banner-text p {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-select-sm {
  background-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.8125rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.form-select-sm option {
  background-color: var(--secondary);
  color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   8. METRICS GRID & CARDS
   -------------------------------------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(16, 185, 129, 0.3);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: transparent;
}

.card-balance::before { background: linear-gradient(90deg, #5282CA, #B1C9EF); }
.card-income::before { background: linear-gradient(90deg, var(--income), #34D399); }
.card-expense::before { background: linear-gradient(90deg, var(--expense), #F87171); }
.card-savings::before { background: linear-gradient(90deg, var(--savings), #60A5FA); }

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon-box svg {
  width: 20px;
  height: 20px;
}

.icon-emerald { background-color: var(--primary-light); color: var(--primary); }
.icon-green { background-color: var(--income-bg); color: var(--income); }
.icon-red { background-color: var(--expense-bg); color: var(--expense); }
.icon-blue { background-color: var(--savings-bg); color: var(--savings); }
.icon-orange { background-color: var(--warning-bg); color: var(--warning); }
.icon-rose { background-color: #FFE4E6; color: #E11D48; }
.icon-purple { background-color: var(--purple-bg); color: var(--purple); }

.metric-value {
  font-family: 'Poppins', sans-serif;
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  white-space: nowrap;
}

.metric-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.75rem;
}

.metric-note {
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   9. FINANCIAL AI INSIGHTS WIDGET
   -------------------------------------------------------------------------- */
.insight-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.insight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.insight-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.insight-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), #059669);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.insight-icon svg {
  width: 22px;
  height: 22px;
}

.insight-title-group h3 {
  font-size: 1.0625rem;
  font-weight: 600;
}

.insight-title-group p {
  font-size: 0.8125rem;
}

.insight-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: var(--income-bg);
  color: var(--income);
  border: 1px solid var(--income-border);
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.insight-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.insight-item-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.insight-item-label svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.insight-item-value {
  font-family: 'Poppins', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.insight-item-sub {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: auto;
}

.insight-recommendation {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
  border-color: var(--primary-border);
}

.insight-recommendation p {
  font-size: 0.8125rem;
  color: var(--text-main);
  line-height: 1.4;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   10. CHARTS & GRAPHS CARDS
   -------------------------------------------------------------------------- */
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chart-legend-custom {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
}

.legend-dot.green { background-color: var(--income); }
.legend-dot.red { background-color: var(--expense); }
.legend-dot.blue { background-color: var(--savings); }

.chart-body {
  position: relative;
  height: 270px;
  width: 100%;
}

.doughnut-body {
  height: 270px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   11. RECENT TRANSACTIONS WIDGET (DASHBOARD)
   -------------------------------------------------------------------------- */
.recent-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.recent-item:hover {
  background-color: var(--border-subtle);
  transform: translateX(2px);
}

.recent-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recent-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.recent-icon svg {
  width: 18px;
  height: 18px;
}

.recent-info h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.recent-info span {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.recent-item-right {
  text-align: right;
}

.recent-amount {
  font-family: 'Poppins', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
}

.recent-date {
  font-size: 0.6875rem;
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   12. TRANSACTIONS PAGE & DATA TABLE
   -------------------------------------------------------------------------- */
.trans-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.trans-stat-box {
  display: flex;
  flex-direction: column;
}

.trans-stat-box .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.trans-stat-box .val {
  font-family: 'Poppins', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Filter Card */
.filter-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1.2fr;
  gap: 14px;
  align-items: flex-end;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-item label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-item label svg {
  width: 14px;
  height: 14px;
}

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

.input-clearable input {
  width: 100%;
  padding: 9px 32px 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-alt);
  font-size: 0.875rem;
}

.input-clearable input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary);
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  color: var(--text-subtle);
  font-size: 1.125rem;
  display: none;
}

.btn-clear-search:hover {
  color: var(--text-main);
}

.form-select, .form-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-alt);
  font-size: 0.875rem;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.form-select:focus, .form-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-alt);
  font-size: 0.875rem;
  color: var(--text-main);
  resize: vertical;
}

.form-textarea:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.filter-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.filter-results-info {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* DATA TABLE CARD */
.table-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

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

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

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table thead tr {
  background-color: var(--bg-surface-alt);
  border-bottom: 1.5px solid var(--border-color);
}

.data-table th {
  padding: 14px 18px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: var(--bg-surface-alt);
}

.data-table td {
  padding: 14px 18px;
  vertical-align: middle;
}

.trans-name-cell {
  display: flex;
  flex-direction: column;
}

.trans-name-primary {
  font-weight: 600;
  color: var(--text-main);
}

.trans-notes-sub {
  font-size: 0.75rem;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.trans-amount-cell {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-table-action {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.btn-table-action:hover {
  background-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-table-action.delete:hover {
  background-color: var(--expense-bg);
  color: var(--expense);
}

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

.btn-table-action svg {
  width: 15px;
  height: 15px;
}

/* Table Empty State */
.empty-state {
  padding: 50px 24px;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface-alt);
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-icon svg {
  width: 32px;
  height: 32px;
}

.empty-state h3 {
  font-size: 1.125rem;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 380px;
  margin: 0 auto 18px;
}

/* Pagination */
.table-pagination {
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-page {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-surface);
  transition: all var(--transition-fast);
}

.btn-page:hover {
  background-color: var(--bg-surface-alt);
  border-color: var(--primary);
}

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

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

/* --------------------------------------------------------------------------
   13. ANGGARAN (BUDGET) MODULE STYLES
   -------------------------------------------------------------------------- */
.budget-alert-banner {
  background-color: var(--warning-bg);
  border: 1.5px solid var(--warning-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
  animation: pulseAlert 2s infinite ease-in-out;
}

@keyframes pulseAlert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

.alert-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background-color: var(--warning);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-icon svg {
  width: 22px;
  height: 22px;
}

.alert-content h4 {
  font-size: 0.9375rem;
  color: #92400E;
  margin-bottom: 2px;
}

body.theme-dark .alert-content h4 {
  color: #FBBF24;
}

.alert-content p {
  font-size: 0.8125rem;
  color: #78350F;
}

body.theme-dark .alert-content p {
  color: #FDE68A;
}

.alert-dismiss {
  margin-left: auto;
  font-size: 1.5rem;
  color: #92400E;
  padding: 4px;
}

/* Budget Cards Grid */
.budget-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.budget-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

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

.budget-card.over-budget {
  border-color: var(--expense);
}

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

.budget-cat-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.budget-cat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.budget-cat-icon svg {
  width: 20px;
  height: 20px;
}

.budget-cat-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.budget-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.budget-amounts {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 8px;
}

.budget-spent {
  display: flex;
  flex-direction: column;
}

.budget-spent .lbl {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.budget-spent .val {
  font-family: 'Poppins', sans-serif;
  font-size: 1.1875rem;
  font-weight: 700;
}

.budget-limit {
  text-align: right;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.budget-progress-track {
  height: 10px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 12px;
}

.budget-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.budget-progress-fill.safe {
  background: linear-gradient(90deg, #10B981, #059669);
}

.budget-progress-fill.warning {
  background: linear-gradient(90deg, #F59E0B, #D97706);
}

.budget-progress-fill.danger {
  background: linear-gradient(90deg, #EF4444, #DC2626);
}

.budget-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.budget-remaining-text {
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   14. TARGET TABUNGAN (SAVINGS GOAL) STYLES
   -------------------------------------------------------------------------- */
.savings-goals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.goal-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  position: relative;
}

.goal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(59, 130, 246, 0.4);
}

.goal-card.completed {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(16, 185, 129, 0.04) 100%);
}

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

.goal-icon-badge {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background-color: var(--savings-bg);
  color: var(--savings);
  display: flex;
  align-items: center;
  justify-content: center;
}

.goal-card.completed .goal-icon-badge {
  background-color: var(--income-bg);
  color: var(--income);
}

.goal-icon-badge svg {
  width: 24px;
  height: 24px;
}

.goal-menu-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.goal-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.goal-date-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.goal-amounts {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.goal-collected {
  font-family: 'Poppins', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--savings);
}

.goal-card.completed .goal-collected {
  color: var(--income);
}

.goal-target {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.goal-progress-track {
  height: 10px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.goal-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #3B82F6, #2563EB);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.goal-card.completed .goal-progress-fill {
  background: linear-gradient(90deg, #10B981, #059669);
}

.goal-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.goal-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* --------------------------------------------------------------------------
   15. FINANCIAL REPORTS & PRINT STYLES
   -------------------------------------------------------------------------- */
.report-toolbar-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.period-tabs {
  display: flex;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.period-tab {
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  transition: all var(--transition-fast);
}

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

.period-tab.active {
  background-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.custom-range-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.form-input-sm {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-alt);
  font-size: 0.8125rem;
}

.print-only-header {
  display: none;
}

/* PRINT MEDIA QUERY FOR PDF EXPORT */
@media print {
  body {
    background-color: #FFFFFF !important;
    color: #000000 !important;
  }

  .app-sidebar, .app-topbar, .action-buttons-group, .report-toolbar-card, .btn-table-action, #toastContainer {
    display: none !important;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .app-content {
    padding: 0 !important;
  }

  .print-only-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid #5282CA;
  }

  .brand-logo-print {
    font-size: 2rem;
    font-weight: 800;
    color: #5282CA;
  }

  .print-meta {
    text-align: right;
    font-size: 0.8125rem;
    line-height: 1.6;
  }

  .metric-card, .chart-card, .table-card {
    box-shadow: none !important;
    border: 1px solid #E2E8F0 !important;
    break-inside: avoid;
  }
}

/* --------------------------------------------------------------------------
   16. SETTINGS PAGE STYLES
   -------------------------------------------------------------------------- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.settings-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.settings-card-wide {
  grid-column: span 2;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.settings-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.settings-header p {
  font-size: 0.8125rem;
}

.settings-form .form-group {
  margin-bottom: 18px;
}

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

.avatar-preview-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.profile-preview-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--primary);
}

.preset-avatars {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.preset-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
  padding: 0;
}

.preset-avatar-btn.active {
  border-color: var(--primary);
  transform: scale(1.1);
}

.preset-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.input-currency-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-currency-wrapper input {
  padding-left: 48px;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: 4px;
}

.theme-choice-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.theme-choice-box input[type="radio"] {
  display: none;
}

.theme-preview-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.theme-choice-box input[type="radio"]:checked + .theme-preview-card {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
}

/* Category Manager */
.category-manager-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
}

.category-lists-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.cat-column h5 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-column h5 svg {
  width: 16px;
  height: 16px;
}

.category-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  font-size: 0.8125rem;
  color: var(--text-main);
}

.btn-chip-delete {
  color: var(--text-subtle);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-chip-delete:hover {
  color: var(--expense);
}

/* Data Actions Grid */
.data-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.data-action-box {
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.data-action-box.danger-box {
  border-color: var(--expense-border);
  background-color: var(--expense-bg);
}

.data-action-box .action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.data-action-box .action-icon svg {
  width: 22px;
  height: 22px;
}

.data-action-box h4 {
  font-size: 0.9375rem;
  margin-bottom: 6px;
}

.data-action-box p {
  font-size: 0.75rem;
  line-height: 1.4;
  margin-bottom: 16px;
  flex: 1;
}

/* --------------------------------------------------------------------------
   17. MODALS & POPUPS
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(14, 31, 29, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  width: 100%;
  max-width: 520px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: all var(--transition-smooth);
}

.modal-dialog-sm {
  max-width: 420px;
}

.modal-backdrop.show .modal-dialog {
  transform: translateY(0) scale(1);
}

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

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

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon-badge svg {
  width: 20px;
  height: 20px;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-close-btn {
  font-size: 1.5rem;
  color: var(--text-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.required {
  color: var(--expense);
}

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

.form-input-lg {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 12px 14px 12px 48px;
}

.nominal-preview {
  font-size: 0.8125rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 4px;
}

.type-segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
}

.segment-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.segment-btn svg {
  width: 18px;
  height: 18px;
}

.segment-btn.active.segment-income {
  background-color: var(--income);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.segment-btn.active.segment-expense {
  background-color: var(--expense);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-surface-alt);
}

/* Detail Receipt Card */
.receipt-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.receipt-amount-block {
  text-align: center;
  padding: 18px;
  background-color: var(--bg-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.receipt-type-badge {
  margin-bottom: 8px;
}

.receipt-amount {
  font-family: 'Poppins', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
}

.receipt-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.receipt-meta-row .label {
  color: var(--text-muted);
}

.receipt-meta-row .val {
  font-weight: 600;
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   18. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  min-width: 300px;
  max-width: 420px;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all var(--transition-fast);
}

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

.toast.hiding {
  opacity: 0;
  transform: translateX(100%);
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast.toast-success { border-left: 4px solid var(--income); }
.toast.toast-success .toast-icon { color: var(--income); }

.toast.toast-error { border-left: 4px solid var(--expense); }
.toast.toast-error .toast-icon { color: var(--expense); }

.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-warning .toast-icon { color: var(--warning); }

.toast.toast-info { border-left: 4px solid var(--savings); }
.toast.toast-info .toast-icon { color: var(--savings); }

.toast-content {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
}

.toast-close {
  color: var(--text-subtle);
  font-size: 1.125rem;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   19. RESPONSIVE DESIGN (MEDIA QUERIES)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .insight-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .budget-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .savings-goals-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .data-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

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

  .btn-sidebar-close {
    display: block;
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .app-main {
    margin-left: 0;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .app-topbar {
    padding: 0 16px;
  }

  .app-content {
    padding: 20px 16px 40px;
  }

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

  .settings-card-wide {
    grid-column: span 1;
  }

  .category-manager-grid {
    grid-template-columns: 1fr;
  }

  .category-lists-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

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

  .budget-cards-grid {
    grid-template-columns: 1fr;
  }

  .savings-goals-grid {
    grid-template-columns: 1fr;
  }

  .data-actions-grid {
    grid-template-columns: 1fr;
  }

  .trans-stats-strip {
    grid-template-columns: 1fr 1fr;
  }

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

  .topbar-user-info {
    display: none;
  }

  .btn-add-transaction .btn-text {
    display: none;
  }

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

  .period-tabs {
    flex-wrap: wrap;
    width: 100%;
  }

  .period-tab {
    flex: 1;
    text-align: center;
  }
}
