/* ============================================================
   FinTrack — Premium Design System v2.0
   Professional Financial Dashboard
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS VARIABLES — Light Mode
   ============================================================ */
:root {
  --primary: #6366F1;
  --primary-dark: #4F46E5;
  --primary-light: #EEF2FF;
  --primary-rgb: 99, 102, 241;
  --success: #10B981;
  --success-light: #D1FAE5;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --info: #3B82F6;
  --info-light: #DBEAFE;
  --white: #FFFFFF;
  --bg: #F8FAFC;
  --bg-secondary: #F1F5F9;
  --card-bg: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-inverse: #FFFFFF;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  --header-height: 60px;
  --bottom-nav-h: 68px;
  --transition-fast: 0.15s ease;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --primary-light: rgba(99,102,241,0.15);
  --bg: #0C111D;
  --bg-secondary: #151B2B;
  --card-bg: #1A2236;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(255,255,255,0.07);
  --border-light: rgba(255,255,255,0.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.45);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.25);
  --success-light: rgba(16,185,129,0.12);
  --danger-light: rgba(239,68,68,0.12);
  --warning-light: rgba(245,158,11,0.12);
  --info-light: rgba(59,130,246,0.12);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-slow), color var(--transition);
  overflow-x: hidden;
}

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

img { max-width: 100%; height: auto; }

/* ============================================================
   STAGGER ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.8); }
  70% { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Stagger delay classes */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.30s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.40s; }

.animate-fadeInUp { animation: fadeInUp 0.5s var(--transition) both; }
.animate-fadeInLeft { animation: fadeInLeft 0.5s var(--transition) both; }
.animate-fadeInRight { animation: fadeInRight 0.5s var(--transition) both; }
.animate-scaleIn { animation: scaleIn 0.4s var(--transition) both; }
.animate-popIn { animation: popIn 0.4s var(--transition-spring) both; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   COMPACT APP HEADER
   ============================================================ */
.app-header {
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  transition: all var(--transition);
  animation: fadeInDown 0.4s ease both;
}

[data-theme="light"] .app-header {
  background: rgba(255,255,255,0.88);
}
[data-theme="dark"] .app-header {
  background: rgba(26,34,54,0.88);
}

.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.header-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #A855F7 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
  transition: transform var(--transition-spring), box-shadow var(--transition);
}

.header-brand:hover .header-brand-icon {
  transform: scale(1.08) rotate(-3deg);
  box-shadow: 0 6px 18px rgba(99,102,241,0.4);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
  opacity: 0.7;
}

.header-page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-btn {
  width: 38px; height: 38px;
  border: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.header-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary);
  opacity: 0;
  border-radius: inherit;
  transition: opacity var(--transition);
}

.header-btn:hover {
  color: var(--primary);
  transform: scale(1.05);
}

.header-btn:active {
  transform: scale(0.95);
}

.header-btn i {
  position: relative;
  z-index: 1;
}

.header-avatar-link {
  display: flex;
  align-items: center;
  margin-left: 4px;
}

.header-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  transition: all var(--transition);
}

.header-avatar:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
  transform: scale(1.05);
}

/* ============================================================
   BOTTOM NAVIGATION BAR
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 1000;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  transition: all var(--transition);
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.3s;
}

[data-theme="light"] .bottom-nav {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow: 0 -1px 20px rgba(0,0,0,0.06);
}

[data-theme="dark"] .bottom-nav {
  background: rgba(26,34,54,0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow: 0 -1px 20px rgba(0,0,0,0.3);
}

.bottom-nav.hide-nav {
  transform: translateY(100%);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 0;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  flex: 1;
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
  font-size: 19px;
  transition: all var(--transition);
  line-height: 1;
}

.bottom-nav-item span {
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.bottom-nav-item:hover {
  color: var(--primary);
}

.bottom-nav-item.active {
  color: var(--primary);
  font-weight: 600;
}

.bottom-nav-item.active i {
  transform: scale(1.15);
  filter: drop-shadow(0 2px 6px rgba(var(--primary-rgb), 0.35));
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #8B5CF6);
  border-radius: 0 0 4px 4px;
  animation: scaleIn 0.3s ease both;
}

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

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 20px;
  padding-bottom: calc(var(--bottom-nav-h) + 24px);
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  animation: fadeInUp 0.45s ease both;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
  animation: fadeInUp 0.4s ease both;
}

.page-header .page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px;
  letter-spacing: -0.5px;
}

.page-header .page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.page-header .page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   CARDS — Glassmorphism touch
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.2px;
}

.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
}

/* ============================================================
   STAT CARDS (Dashboard) — with hover lift
   ============================================================ */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  cursor: default;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: rgba(var(--primary-rgb), 0.15);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100px; height: 100px;
  background: currentColor;
  opacity: 0.03;
  border-radius: 50%;
  transform: translate(30px, -30px);
  transition: all var(--transition);
}

.stat-card:hover::after {
  opacity: 0.06;
  transform: translate(20px, -20px) scale(1.1);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-spring);
}

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

.stat-icon.income  { background: var(--success-light); color: var(--success); }
.stat-icon.expense { background: var(--danger-light);  color: var(--danger); }
.stat-icon.saving  { background: var(--primary-light); color: var(--primary); }
.stat-icon.debt    { background: var(--warning-light); color: var(--warning); }
.stat-icon.asset   { background: var(--info-light);    color: var(--info); }
.stat-icon.net     { background: linear-gradient(135deg,#6366F1,#8B5CF6); color: #fff; }

.stat-content { flex: 1; min-width: 0; }

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-change.up   { color: var(--success); background: var(--success-light); }
.stat-change.down { color: var(--danger); background: var(--danger-light); }

/* ── Net Worth Card ── */
.networth-card {
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 40%, #4338CA 100%);
  border-radius: var(--radius-xl);
  padding: 28px;
  color: #fff;
  position: relative;
  overflow: hidden;
  border: none;
  box-shadow: 0 8px 30px rgba(79,70,229,0.25);
  animation: fadeInUp 0.5s ease both;
}

.networth-card::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(139,92,246,0.4) 0%, transparent 70%);
  animation: float 6s ease-in-out infinite;
}

.networth-card::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(99,102,241,0.3) 0%, transparent 70%);
  animation: float 8s ease-in-out infinite reverse;
}

.networth-card .nw-label {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.networth-card .nw-value {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: #fff;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.networth-card .nw-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 8px;
  position: relative;
  z-index: 1;
}

/* ============================================================
   BUTTONS — with micro-interactions
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.15), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after { opacity: 1; }

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, #6366F1, #7C3AED);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}

.btn-success:hover {
  box-shadow: 0 4px 16px rgba(16,185,129,0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(239,68,68,0.4);
  transform: translateY(-1px);
  color: #fff;
}

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

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

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

.btn-ghost:hover {
  background: var(--border);
  color: var(--text-primary);
}

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

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

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

.form-control,
.form-select {
  display: block;
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  appearance: none;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
  background: var(--card-bg);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }

.invalid-feedback {
  display: none;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}
.form-control.is-invalid ~ .invalid-feedback { display: block; }

.input-group { position: relative; }
.input-group .input-prefix,
.input-group .input-suffix {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}
.input-group .input-prefix { left: 14px; }
.input-group .input-suffix { right: 14px; }
.input-group .input-prefix ~ .form-control { padding-left: 40px; }

.rupiah-input .form-control { padding-left: 52px; }
.rupiah-input .input-prefix {
  left: 0;
  width: 44px;
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  pointer-events: none;
}

/* ============================================================
   TABLES — clean professional look
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

table.dataTable {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
}

table.dataTable thead th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.dataTable tbody td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

table.dataTable tbody tr {
  transition: all var(--transition-fast);
}

table.dataTable tbody tr:hover {
  background: var(--bg-secondary);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

.badge-success  { background: var(--success-light);  color: #065F46; }
.badge-danger   { background: var(--danger-light);   color: #991B1B; }
.badge-warning  { background: var(--warning-light);  color: #92400E; }
.badge-primary  { background: var(--primary-light);  color: var(--primary-dark); }
.badge-info     { background: var(--info-light);     color: #1E40AF; }
.badge-neutral  { background: var(--bg-secondary);   color: var(--text-secondary); }

[data-theme="dark"] .badge-success  { color: #6EE7B7; }
[data-theme="dark"] .badge-danger   { color: #FCA5A5; }
[data-theme="dark"] .badge-warning  { color: #FCD34D; }
[data-theme="dark"] .badge-primary  { color: #A5B4FC; }
[data-theme="dark"] .badge-info     { color: #93C5FD; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, var(--primary), #8B5CF6);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
  background-size: 200% 100%;
}

.progress-bar.success { background: linear-gradient(90deg, #10B981, #34D399); }
.progress-bar.warning { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.progress-bar.danger  { background: linear-gradient(90deg, #EF4444, #F87171); }

/* ============================================================
   MODAL
   ============================================================ */
.modal { z-index: 1060; }

.modal-content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  background: var(--card-bg);
  animation: scaleIn 0.3s ease both;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 14px; }
.skeleton-value { height: 30px; width: 80%; margin-bottom: 6px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  animation: fadeInUp 0.5s ease both;
}

.empty-state .empty-icon {
  font-size: 52px;
  margin-bottom: 16px;
  opacity: 0.4;
  animation: float 4s ease-in-out infinite;
}

.empty-state h5 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
  margin: 0 auto 20px;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.page-loader {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #8B5CF6, #A855F7);
  z-index: 9999;
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 0 2px 2px 0;
}

/* ============================================================
   AMOUNT COLORS
   ============================================================ */
.text-income   { color: var(--success) !important; }
.text-expense  { color: var(--danger)  !important; }
.text-warning  { color: var(--warning) !important; }
.text-primary-c{ color: var(--primary) !important; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast-notif {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-xl);
  animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  position: relative;
  overflow: hidden;
}

.toast-notif::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}

.toast-notif.success::before { background: var(--success); }
.toast-notif.error::before   { background: var(--danger); }
.toast-notif.warning::before { background: var(--warning); }
.toast-notif.info::before    { background: var(--info); }

/* ============================================================
   PROFILE / HUB PAGE
   ============================================================ */
.profile-header {
  text-align: center;
  padding: 32px 20px 28px;
  margin-bottom: 4px;
  animation: fadeInUp 0.5s ease both;
}

.profile-avatar-wrap {
  width: 80px; height: 80px;
  margin: 0 auto 16px;
  position: relative;
}

.profile-avatar-wrap img {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.25);
  transition: all var(--transition);
}

.profile-avatar-wrap:hover img {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(var(--primary-rgb), 0.35);
}

.profile-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}

.profile-email {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* Menu grid in profile hub */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0;
  margin-bottom: 24px;
}

.menu-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}

.menu-grid-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(var(--primary-rgb), 0.2);
}

.menu-grid-item:active {
  transform: scale(0.97);
}

.menu-grid-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: transform var(--transition-spring);
}

.menu-grid-item:hover .menu-grid-icon {
  transform: scale(1.1) rotate(-5deg);
}

.menu-grid-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.3;
}

.menu-grid-item:hover .menu-grid-label { color: var(--primary); }

/* Profile action items */
.profile-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 8px;
}

.profile-action:hover {
  background: var(--bg-secondary);
  transform: translateX(4px);
  border-color: rgba(var(--primary-rgb), 0.15);
}

.profile-action:active {
  transform: scale(0.99);
}

.profile-action .action-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: transform var(--transition-spring);
}

.profile-action:hover .action-icon {
  transform: scale(1.1);
}

.profile-action .action-label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.profile-action .action-arrow {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform var(--transition);
}

.profile-action:hover .action-arrow {
  transform: translateX(3px);
  color: var(--primary);
}

/* Section title in profile */
.section-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
  padding-left: 2px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 769px) {
  .page-content {
    padding: 28px 32px;
    padding-bottom: calc(var(--bottom-nav-h) + 28px);
  }

  .bottom-nav-item {
    gap: 5px;
    font-size: 11px;
  }

  .bottom-nav-item i {
    font-size: 18px;
  }
}

@media (min-width: 1024px) {
  .page-content {
    padding: 32px 40px;
    padding-bottom: calc(var(--bottom-nav-h) + 32px);
  }

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

@media (max-width: 768px) {
  :root {
    --header-height: 54px;
    --bottom-nav-h: 62px;
  }

  .page-content {
    padding: 16px;
    padding-bottom: calc(var(--bottom-nav-h) + 16px);
  }

  .networth-card .nw-value { font-size: 28px; }
  .stat-value { font-size: 18px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .page-title { font-size: 20px; }

  .header-page-title { font-size: 14px; }
  .header-brand-icon { width: 32px; height: 32px; font-size: 13px; border-radius: 8px; }

  .menu-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .menu-grid-item { padding: 16px 8px; }
  .menu-grid-icon { width: 42px; height: 42px; font-size: 18px; border-radius: 12px; }
  .menu-grid-label { font-size: 11px; }

  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px 12px; }
  
  /* Datatables Mobile */
  div.dataTables_wrapper div.dataTables_length,
  div.dataTables_wrapper div.dataTables_filter {
    text-align: left;
    margin-bottom: 12px;
  }
  div.dataTables_wrapper div.dataTables_filter input {
    margin-left: 0;
    margin-top: 6px;
    width: 100%;
    display: block;
  }
  div.dataTables_wrapper div.dataTables_info,
  div.dataTables_wrapper div.dataTables_paginate {
    text-align: center;
    margin-top: 12px;
  }
  table.dataTable tbody td, table.dataTable thead th {
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .bottom-nav-item {
    padding: 6px 0;
    font-size: 9px;
    gap: 3px;
  }

  .bottom-nav-item i { font-size: 18px; }

  .stat-card { padding: 16px; gap: 12px; }
  .stat-icon { width: 42px; height: 42px; font-size: 17px; }
  .stat-value { font-size: 16px; }
  .stat-label { font-size: 10px; }

  .networth-card { padding: 22px; }
  .networth-card .nw-value { font-size: 24px; }

  .profile-avatar-wrap, .profile-avatar-wrap img {
    width: 68px; height: 68px;
  }

  .profile-name { font-size: 19px; }
}

/* ============================================================
   EDIT PROFILE / SETTINGS PAGE
   ============================================================ */
.settings-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 20px;
  animation: fadeInUp 0.5s ease both;
}

.settings-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-card-header .settings-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.settings-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px;
}

.settings-card-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.settings-card-body {
  padding: 24px;
}

.avatar-upload {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  transition: all var(--transition);
}

.avatar-upload:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.avatar-upload img {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--card-bg);
  box-shadow: var(--shadow-md);
}

.avatar-upload-info {
  flex: 1;
}

.avatar-upload-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.avatar-upload-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================================
   UTILS
   ============================================================ */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.fs-6   { font-size: 16px !important; }
.text-muted-sm { font-size: 12px; color: var(--text-muted); }
.rounded-lg { border-radius: var(--radius-lg) !important; }

.chart-container {
  position: relative;
  width: 100%;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
}

.status-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.paid    { background: var(--success-light); color: var(--success); }
.status-pill.partial { background: var(--warning-light); color: var(--warning); }
.status-pill.unpaid  { background: var(--danger-light);  color: var(--danger); }

.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-sm  { width: 28px; height: 28px; }
.avatar-md  { width: 36px; height: 36px; }
.avatar-lg  { width: 48px; height: 48px; }
.avatar-xl  { width: 64px; height: 64px; }

/* ============================================================
   DATATABLES OVERRIDES
   ============================================================ */
div.dataTables_wrapper div.dataTables_length select {
  padding: 7px 28px 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

div.dataTables_wrapper div.dataTables_filter input {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  margin-left: 6px;
  transition: all var(--transition);
}

div.dataTables_wrapper div.dataTables_filter input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
  background: var(--card-bg);
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button {
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-secondary) !important;
  font-size: 13px;
  transition: all var(--transition-fast);
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button.current,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border: none;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button:hover {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: none;
}

div.dataTables_wrapper div.dataTables_info {
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 8px;
}

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

/* ============================================================
   BOOTSTRAP & DATATABLES OVERRIDES (DARK MODE)
   ============================================================ */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu {
  background-color: var(--card-bg);
  border-color: var(--border);
  color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item {
  color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: var(--bg);
  border-color: var(--border);
  color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: var(--bg);
  border-color: var(--primary);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

[data-theme="dark"] .form-control::placeholder {
  color: var(--text-muted);
}

[data-theme="dark"] .input-group-text {
  background-color: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-secondary);
}

/* DataTables Dark Mode Overrides */
[data-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_processing,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
  color: var(--text-secondary);
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: var(--border-light);
  --bs-table-striped-bg: rgba(255,255,255,0.02);
  --bs-table-striped-color: var(--text-primary);
  --bs-table-active-bg: rgba(255,255,255,0.04);
  --bs-table-active-color: var(--text-primary);
  --bs-table-hover-bg: rgba(255,255,255,0.04);
  --bs-table-hover-color: var(--text-primary);
}

[data-theme="dark"] table.dataTable tbody tr {
  background-color: transparent !important;
}

[data-theme="dark"] table.dataTable tbody tr.odd {
  background-color: rgba(255,255,255, 0.02);
}

[data-theme="dark"] table.dataTable tbody tr:hover {
  background-color: rgba(255,255,255, 0.04);
}

[data-theme="dark"] table.dataTable,
[data-theme="dark"] table.dataTable th,
[data-theme="dark"] table.dataTable td {
  border-color: var(--border-light);
}

[data-theme="dark"] table.dataTable thead th,
[data-theme="dark"] table.dataTable thead td {
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] table.dataTable.no-footer {
  border-bottom: 1px solid var(--border);
}

/* Modals extra */
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: var(--border-light);
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
