* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ================= THEME VARIABLES ================= */
:root {
  /* Light Theme (Default) */
  --primary: #4361ee;
  --secondary: #3f37c9;
  --accent: #4895ef;
  --success: #2ecc71;
  --dark: #1e293b;
  --light: #f8fafc;
  --gray: #64748b;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  
  --gradient-bg: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  --glass-header: rgba(255, 255, 255, 0.88);
  --glass-content: rgba(255, 255, 255, 0.8);
  --glass-card: rgba(255, 255, 255, 0.75);
  --glass-nav: rgba(255, 255, 255, 0.92);
  
  --border-glass: rgba(255, 255, 255, 0.6);
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-input: rgba(0, 0, 0, 0.08);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
  
  --transition-fast: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
  --transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
  --transition-slow: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
  
  --border-radius-sm: 12px;
  --border-radius: 16px;
  --border-radius-lg: 24px;
  --border-radius-full: 9999px;
  
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
  --safe-area-left: env(safe-area-inset-left);
  --safe-area-right: env(safe-area-inset-right);
  
  /* Modal Defaults */
  --modal-bg: #ffffff;
  --modal-text: #0f172a;
  --modal-subtext: #475569;
  --modal-indicator: #cbd5f5;
  --modal-close: #64748b;
  --modal-close-hover: #0f172a;
  --modal-btn-grad: linear-gradient(135deg, #1558B0, #2563eb);
  --modal-btn-grad-hover: linear-gradient(135deg, #0f428a, #1d4ed8);
  --modal-btn-text: #ffffff;
}

/* ================= DARK THEME ================= */
.dark {
  --primary: #60a5fa;
  --secondary: #818cf8;
  --accent: #38bdf8;
  --success: #34d399;
  --dark: #f8fafc;
  --light: #0f172a;
  --gray: #94a3b8;
  --danger: #f87171;
  --warning: #fbbf24;
  --info: #38bdf8;
  
  --gradient-bg: linear-gradient(135deg, #1e1b4b 0%, #1e3a8a 100%);
  --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.85));
  --glass-header: rgba(15, 23, 42, 0.9);
  --glass-content: rgba(30, 41, 59, 0.85);
  --glass-card: rgba(30, 41, 59, 0.75);
  --glass-nav: rgba(15, 23, 42, 0.92);
  
  --border-glass: rgba(51, 65, 85, 0.6);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-input: rgba(255, 255, 255, 0.15);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.6);
  
  --modal-bg: #0f172a;
  --modal-text: #f8fafc;
  --modal-subtext: #94a3b8;
  --modal-indicator: #334155;
  --modal-close: #64748b;
  --modal-close-hover: #f8fafc;
  --modal-btn-grad: linear-gradient(135deg, #2563eb, #1d4ed8);
  --modal-btn-grad-hover: linear-gradient(135deg, #1d4ed8, #1e40af);
  --modal-btn-text: #ffffff;
}

/* Auto-detect system preference (optional) */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --primary: #60a5fa; --secondary: #818cf8; --accent: #38bdf8; --success: #34d399;
    --dark: #f8fafc; --light: #0f172a; --gray: #94a3b8; --danger: #f87171; --warning: #fbbf24; --info: #38bdf8;
    --gradient-bg: linear-gradient(135deg, #1e1b4b 0%, #1e3a8a 100%);
    --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.85));
    --glass-header: rgba(15, 23, 42, 0.9); --glass-content: rgba(30, 41, 59, 0.85);
    --glass-card: rgba(30, 41, 59, 0.75); --glass-nav: rgba(15, 23, 42, 0.92);
    --border-glass: rgba(51, 65, 85, 0.6); --border-subtle: rgba(255, 255, 255, 0.08); --border-input: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4); --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5); --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.6);
    --modal-bg: #0f172a; --modal-text: #f8fafc; --modal-subtext: #94a3b8; --modal-indicator: #334155;
    --modal-close: #64748b; --modal-close-hover: #f8fafc; --modal-btn-grad: linear-gradient(135deg, #2563eb, #1d4ed8); --modal-btn-text: #ffffff;
  }
}

/* ================= BASE STYLES ================= */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gradient-bg);
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--safe-area-bottom) + 70px);
  padding-top: var(--safe-area-top);
  background-attachment: fixed;
  transition: var(--transition);
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 70%);
  z-index: -1;
  animation: rotate 35s linear infinite;
  pointer-events: none;
}

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


.dark {
  --page-bg: #020617;
}

:root {
  --page-bg: #f8fafc;
}

body {
  background: var(--page-bg);
}
/* ================= HEADER ================= */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(12px + var(--safe-area-top)) 16px 12px;
  background: var(--glass-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(60px + var(--safe-area-top));
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  margin-bottom: 16px;
  transition: var(--transition);
}

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

.profile-pic {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(45deg, var(--primary), var(--accent));
  display: flex; justify-content: center; align-items: center;
  color: white; font-weight: 700; font-size: 16px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3); position: relative;
}

.user-details { display: flex; flex-direction: column; gap: 4px; }
.user-name { font-weight: 600; font-size: 0.95rem; color: var(--dark); }

.plan-badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--border-radius-full);
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(67, 97, 238, 0.15); color: var(--primary); white-space: nowrap; text-decoration: none;
}
.plan-badge.trial { background: rgba(243, 156, 18, 0.15); color: var(--warning); }

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

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--border-radius-full);
  background: var(--glass-card); border: none; display: flex; justify-content: center;
  align-items: center; cursor: pointer; transition: var(--transition-fast);
  position: relative; box-shadow: var(--shadow-sm); color: var(--gray); flex-shrink: 0;
}
.icon-btn:active { transform: scale(0.95); background: var(--glass-content); }
.icon-btn.active, .icon-btn:hover { background: var(--primary); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(67, 97, 238, 0.4); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; transition: var(--transition-fast); }

.new {
  background: var(--danger); color: white; font-size: 10px; font-weight: 700; width: 18px; height: 18px;
  border-radius: 50%; display: flex; padding: 4px; justify-content: center; align-items: center;
  box-shadow: 0 0 0 2px var(--glass-nav); animation: pulse 2s infinite; z-index: 10; line-height: 1;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* ================= MAIN CONTENT ================= */
.dashboard {
  display: flex; flex-direction: column; flex: 1; padding: 0 16px; max-width: 100%;
  margin: 0 auto; width: 100%; position: relative; z-index: 10;
}

.content {
  background: var(--gradient-card); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: var(--border-radius-lg); box-shadow: var(--shadow-lg); padding: 24px 20px;
  position: relative; overflow: hidden; margin-bottom: 20px; border: 1px solid var(--border-glass);
  transition: var(--transition);
}

.content::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(67, 97, 238, 0.03) 0%, rgba(255,255,255,0) 70%);
  z-index: -1; animation: rotate 45s linear infinite reverse;
}

/* ================= GREETING & BALANCE ================= */
.greeting { margin-bottom: 4px; animation: fadeInDown 0.5s ease-out; }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

#greeting-text {
  font-size: 1.65rem; font-weight: 700; line-height: 1.3;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { color: var(--gray); font-size: 1rem; margin-bottom: 24px; animation: fadeInDown 0.5s ease-out 0.1s both; }

.account-balance {
  display: flex; flex-direction: column; background: var(--glass-content); border-radius: var(--border-radius);
  padding: 18px; margin-bottom: 24px; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
  border: 1px solid var(--border-subtle); animation: fadeInDown 0.5s ease-out 0.2s both; transition: var(--transition);
}
.account-balance::before {
  content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--gradient-bg); z-index: 1;
}
.balance-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-right: 4px; }
.balance-title { display: flex; align-items: center; gap: 6px; color: var(--gray); font-size: 0.95rem; }
.balance-title svg { width: 16px; height: 16px; fill: var(--success); }

.balance-amount { font-size: 1.8rem; font-weight: 700; color: var(--dark); display: flex; align-items: center; gap: 6px; }
.balance-amount a { color: var(--dark); text-decoration: none; display: flex; align-items: center; gap: 4px; }
.balance-amount svg { width: 20px; height: 20px; fill: var(--gray); transition: var(--transition-fast); }
.balance-amount a:hover svg { fill: var(--primary); transform: translateX(3px); }

.balance-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; border-top: 1px solid var(--border-input); }
.transactions-link { color: var(--primary); font-weight: 500; font-size: 0.95rem; display: flex; align-items: center; gap: 4px; text-decoration: none; }
.transactions-link svg { width: 16px; height: 16px; fill: var(--primary); transition: var(--transition-fast); }
.transactions-link:hover svg { transform: translateX(2px); }

.add-btn {
  background: var(--gradient-bg); color: white; border: none; padding: 8px 18px; border-radius: var(--border-radius-full);
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 6px;
  cursor: pointer; transition: var(--transition); box-shadow: 0 4px 12px rgba(67, 97, 238, 0.35);
  position: relative; overflow: hidden; flex-shrink: 0;
}
.add-btn::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transition: left 0.7s;
}
.add-btn:hover::after { left: 100%; }
.add-btn:active { transform: scale(0.97); box-shadow: 0 3px 10px rgba(67, 97, 238, 0.4); }
.add-btn svg { width: 16px; height: 16px; fill: white; }

/* ================= STATS ================= */
.stats-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.stats-title svg { width: 20px; height: 20px; fill: var(--primary); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 28px; animation: fadeInDown 0.5s ease-out 0.3s both; }
.stat-card {
  background: var(--glass-card); border-radius: var(--border-radius); padding: 18px 16px; text-align: center;
  box-shadow: var(--shadow-md); transition: var(--transition); position: relative; overflow: hidden;
  border: 1px solid var(--border-subtle); display: flex; flex-direction: column; justify-content: center;
  min-height: 100px; opacity: 0; transform: translateY(20px);
}
.stat-card.visible { opacity: 1; transform: translateY(0); transition: opacity 0.5s ease, transform 0.5s ease; }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: var(--gradient-bg);
  transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease; z-index: 1;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); background: var(--glass-content); }
.stat-card:hover::before { transform: scaleX(1); }
.stat-card.paid::before { background: var(--success); }
.stat-card.pending::before { background: var(--warning); }
.stat-card.revenue::before { background: linear-gradient(to right, var(--accent), var(--info)); }

.stat-label { font-size: 0.85rem; color: var(--gray); margin-bottom: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--dark); line-height: 1.2; }
.stat-card.paid .stat-value { color: var(--success); }
.stat-card.pending .stat-value { color: var(--warning); }
.stat-card.revenue .stat-value { color: var(--info); }

/* ================= ACTIONS ================= */
.actions-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.actions-title svg { width: 20px; height: 20px; fill: var(--primary); }
.actions { display: flex; gap: 14px; margin-bottom: 8px; animation: fadeInDown 0.5s ease-out 0.4s both; }

.btn {
  flex: 1; min-height: 52px; padding: 0 16px; border-radius: var(--border-radius); font-family: 'Inter', sans-serif;
  font-weight: 600; font-size: 1rem; display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: var(--transition); position: relative; overflow: hidden;
  box-shadow: var(--shadow-md); border: none; cursor: pointer; line-height: 1.3;
}
.btn.primary { background: var(--gradient-bg); color: white; box-shadow: 0 4px 15px rgba(67, 97, 238, 0.4); }
.btn.secondary { background: var(--glass-card); color: var(--primary); border: 1px solid var(--border-input); box-shadow: var(--shadow-sm); }
.btn.primary:active { transform: scale(0.98); box-shadow: 0 3px 12px rgba(67, 97, 238, 0.45); }
.btn.secondary:active { transform: scale(0.98); background: var(--glass-content); box-shadow: var(--shadow-sm); }
.btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ================= RECENT ACTIVITY ================= */
.section { margin-bottom: 28px; animation: fadeInDown 0.5s ease-out 0.5s both; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding: 0 4px; }
.section-title { font-size: 1.25rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.section-title svg { width: 20px; height: 20px; fill: var(--primary); }

.view-all { color: var(--primary); font-weight: 500; font-size: 0.9rem; display: flex; align-items: center; gap: 4px; text-decoration: none; }
.view-all svg { width: 14px; height: 14px; fill: var(--primary); transition: var(--transition-fast); }
.view-all:hover svg { transform: translateX(2px); }

.activity-list { display: flex; flex-direction: column; gap: 12px; }
.activity-item {
  background: var(--glass-content); border-radius: var(--border-radius); padding: 16px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle); transition: var(--transition-fast);
}
.activity-item:hover { transform: translateX(4px); box-shadow: var(--shadow-md); background: var(--glass-card); }

.activity-icon { width: 42px; height: 42px; border-radius: var(--border-radius); display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.activity-icon.invoice { background: rgba(67, 97, 238, 0.12); color: var(--primary); }
.activity-icon.payment { background: rgba(46, 204, 113, 0.12); color: var(--success); }
.activity-icon.client { background: rgba(52, 152, 219, 0.12); color: var(--info); }
.activity-icon.account { background: rgba(14, 140, 225, 0.529); color: var(--info); }
.activity-icon svg { width: 22px; height: 22px; fill: currentColor; }

.activity-content { flex: 1; }
.activity-title { font-weight: 600; margin-bottom: 4px; font-size: 0.95rem; }
.activity-time { font-size: 0.85rem; color: var(--gray); }
.activity-amount { font-weight: 600; font-size: 1.05rem; }
.activity-amount.paid { color: var(--success); }
.activity-amount.pending { color: var(--warning); }

/* ================= UPGRADE BANNER ================= */
.upgrade-banner {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); border-radius: var(--border-radius);
  padding: 16px; margin-bottom: 24px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-md); border: 1px solid rgba(243, 156, 18, 0.3); animation: fadeInDown 0.5s ease-out 0.1s both;
}
.upgrade-banner.hidden { display: none; }
.banner-icon { width: 40px; height: 40px; background: rgba(243, 156, 18, 0.2); border-radius: 50%; display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.banner-icon svg { width: 24px; height: 24px; fill: var(--warning); }
.banner-content { flex: 1; }
.banner-title { font-weight: 700; color: var(--dark); margin-bottom: 4px; font-size: 1rem; }
.banner-text { color: var(--gray); font-size: 0.9rem; line-height: 1.4; }

.upgrade-btn {
  background: var(--warning); color: white; border: none; padding: 8px 16px; border-radius: var(--border-radius-full);
  font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: var(--transition);
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}
.upgrade-btn:hover { background: #d35400; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(243, 156, 18, 0.4); }

/* ================= BOTTOM NAV ================= */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--glass-nav); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px); display: flex; justify-content: space-around;
  padding: 10px 8px calc(10px + var(--safe-area-bottom)) 8px; box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.12);
  z-index: 200; border-top-left-radius: 24px; border-top-right-radius: 24px; max-width: 600px;
  margin: 0 auto; width: 100%; left: 50%; transform: translateX(-50%); transition: var(--transition);
}

.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--gray); text-decoration: none; font-size: 0.75rem; font-weight: 500; padding: 8px 4px;
  position: relative; transition: var(--transition-fast); width: 100%; max-width: 80px; border-radius: var(--border-radius-sm);
}
.nav-item.active { color: var(--primary); background: rgba(67, 97, 238, 0.08); transform: translateY(-2px); }
.nav-item.active::after { content: ''; position: absolute; bottom: -6px; width: 28px; height: 4px; background: var(--primary); border-radius: 2px; }
.nav-item svg { width: 24px; height: 24px; fill: currentColor; transition: var(--transition-fast); }
.nav-item:hover svg, .nav-item.active svg { transform: scale(1.15); }
.nav-item.active svg { fill: var(--primary); }

/* ================= UTILITIES & ANIMATIONS ================= */
.refresh-indicator {
  position: fixed; top: calc(60px + var(--safe-area-top)); left: 50%; transform: translateX(-50%) scale(0);
  width: 40px; height: 40px; border-radius: 50%; background: var(--glass-nav); display: flex;
  justify-content: center; align-items: center; box-shadow: var(--shadow-md); z-index: 150;
  transition: transform 0.3s ease; pointer-events: none;
}
.refresh-indicator svg { width: 20px; height: 20px; fill: var(--primary); animation: spin 1.5s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.refresh-indicator.active { transform: translateX(-50%) scale(1); }

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.9) 50%, rgba(255,255,255,0.6) 100%);
  background-size: 200% 100%; animation: loading 1.5s infinite; border-radius: var(--border-radius); margin-bottom: 12px;
}
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text { height: 20px; }
.skeleton-title { height: 32px; margin-bottom: 16px; }
.skeleton-card { height: 100px; margin-bottom: 16px; }

.particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
.particle { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.6); animation: float 15s infinite linear; }
@keyframes float { 0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(-100vh) translateX(100px) rotate(720deg); opacity: 0; } }

.scroll-indicator {
  position: fixed; bottom: calc(80px + var(--safe-area-bottom)); right: 24px; width: 40px; height: 40px;
  border-radius: 50%; background: var(--glass-nav); display: flex; justify-content: center; align-items: center;
  box-shadow: var(--shadow-md); z-index: 100; opacity: 0; transform: scale(0.8); transition: var(--transition); pointer-events: none;
}
.scroll-indicator.visible { opacity: 1; transform: scale(1); }
.scroll-indicator svg { width: 20px; height: 20px; fill: var(--primary); }

.spinner {
  display: inline-block; width: 16px; height: 16px; border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #fff; border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 8px; vertical-align: middle;
}

@keyframes haptic { 0% { transform: translateX(0); } 25% { transform: translateX(-2px); } 50% { transform: translateX(2px); } 75% { transform: translateX(-2px); } 100% { transform: translateX(0); } }
.haptic-feedback { animation: haptic 0.15s ease-in-out; }

/* ================= MODAL ================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(2, 6, 23, 0.6); backdrop-filter: blur(10px);
  display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease; z-index: 9999;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--modal-bg); border-radius: 14px; padding: 32px 28px; width: 100%; max-width: 420px;
  text-align: center; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15); transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); color: var(--modal-text);
}
.modal-overlay.show .modal-card { transform: translateY(0); }
.modal-card::before { content: ""; width: 42px; height: 4px; background: var(--modal-indicator); border-radius: 999px; display: block; margin: 0 auto 18px; }

.modal-icon { width: 58px; height: 58px; margin: 4px auto 16px; color: #16a34a; animation: popIcon 0.4s ease-out; }
.modal-icon svg { width: 100%; height: 100%; }
.modal-card h2 { font-size: 20px; font-weight: 600; color: var(--modal-text); margin-bottom: 8px; }
.modal-card p { font-size: 14.5px; line-height: 1.6; color: var(--modal-subtext); margin-bottom: 22px; }

.modal-btn {
  width: 100%; padding: 14px; font-size: 15px; font-weight: 600; border-radius: 14px; border: none;
  background: var(--modal-btn-grad); color: var(--modal-btn-text); cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.modal-btn:active { transform: scale(0.97); box-shadow: 0 10px 25px rgba(21, 88, 176, 0.35); }

.close { position: absolute; top: 14px; right: 18px; font-size: 1.3rem; color: var(--modal-close); cursor: pointer; transition: color 0.2s ease; }
.close:hover { color: var(--modal-close-hover); }

.modal-card.error .modal-icon { color: #dc2626; }
.modal-card.error .modal-btn { background: linear-gradient(135deg, #dc2626, #b91c1c); }

/* ================= RESPONSIVE ================= */
@media (min-width: 768px) {
  :root { --border-radius-lg: 28px; }
  .dashboard-header { height: calc(72px + var(--safe-area-top)); padding: calc(16px + var(--safe-area-top)) 24px 16px; border-radius: 0 0 28px 28px; margin-bottom: 24px; }
  .profile-pic { width: 46px; height: 46px; font-size: 18px; }
  .user-name { font-size: 1.05rem; }
  .plan-badge { font-size: 0.8rem; padding: 4px 12px; }
  .dashboard { padding: 0 24px; max-width: 1200px; }
  .content { padding: 32px 28px; border-radius: var(--border-radius-lg); }
  #greeting-text { font-size: 2rem; }
  .subtitle { font-size: 1.1rem; margin-bottom: 32px; }
  .account-balance { flex-direction: row; align-items: center; justify-content: space-between; padding: 24px; margin-bottom: 32px; }
  .balance-footer { border-top: none; padding-top: 0; flex-direction: column; align-items: flex-start; gap: 12px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
  .stat-card { padding: 20px; min-height: 120px; }
  .stat-value { font-size: 1.75rem; }
  .actions { gap: 20px; }
  .btn { min-height: 56px; padding: 0 24px; font-size: 1.05rem; }
  .btn svg { width: 22px; height: 22px; }
  .section { margin-bottom: 36px; }
  .activity-item { padding: 20px; gap: 16px; }
  .activity-icon { width: 48px; height: 48px; }
  .activity-icon svg { width: 26px; height: 26px; }
  .bottom-nav { max-width: 1200px; border-radius: 28px; padding: 8px 16px calc(8px + var(--safe-area-bottom)) 16px; bottom: auto; top: auto; left: 0; right: 0; transform: none; position: sticky; margin: 0 auto; }
  .nav-item { flex-direction: row; justify-content: center; gap: 8px; font-size: 0.9rem; padding: 10px 12px; max-width: none; border-radius: var(--border-radius); }
  .nav-item.active::after { display: none; }
  .nav-item.active { transform: none; background: rgba(67, 97, 238, 0.15); }
}

@media (min-width: 1024px) {
  .dashboard { padding: 0 32px; }
  .content { padding: 40px 36px; }
  #greeting-text { font-size: 2.25rem; }
  .account-balance { padding: 28px; }
  .stats { gap: 24px; }
  .stat-card { padding: 24px; min-height: 130px; }
  .stat-value { font-size: 2rem; }
  .section-title { font-size: 1.4rem; }
  .activity-item { padding: 24px; }
}

@media (max-width: 767px) {
  body { padding-top: calc(var(--safe-area-top) + 8px); }
  .dashboard-header { padding-top: calc(8px + var(--safe-area-top)); height: calc(56px + var(--safe-area-top)); }
  .profile-pic { width: 36px; height: 36px; font-size: 16px; }
  .user-name { font-size: 0.95rem; }
  .plan-badge { font-size: 0.7rem; padding: 1px 6px; }
  .content { padding: 20px 16px; }
  #greeting-text { font-size: 1.55rem; }
  .account-balance { padding: 16px; }
  .balance-amount { font-size: 1.7rem; }
  .stat-value { font-size: 1.45rem; }
  .btn { min-height: 50px; padding: 0 14px; font-size: 0.95rem; }
  .activity-item { padding: 14px; }
  .bottom-nav { padding: 8px 4px calc(8px + var(--safe-area-bottom)) 4px; }
  .nav-item { gap: 2px; font-size: 0.7rem; padding: 6px 2px; }
  .nav-item svg { width: 22px; height: 22px; }
}

/* ================= ACCOUNT DETAILS MODAL ================= */
.account-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.account-modal-overlay.active {
    display: flex;
}

.account-modal-card {
    max-width: 480px;
    width: 100%;
    padding: 32px 28px;
    text-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.account-modal-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.15) 0%, rgba(72, 149, 239, 0.15) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .account-modal-icon {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2) 0%, rgba(56, 189, 248, 0.2) 100%);
}

.account-modal-icon svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.account-modal-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.account-modal-text {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Steps */
.account-modal-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    text-align: left;
}

.account-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.account-step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-step-icon svg {
    width: 16px;
    height: 16px;
    color: white;
}

.account-step-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-step-text strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
}

.account-step-text span {
    font-size: 0.8rem;
    color: var(--gray);
}

/* Actions */
.account-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.account-modal-btn {
    padding: 14px 20px;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    width: 100%;
}

.account-modal-btn.primary {
    background: var(--gradient-bg);
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.account-modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.45);
}

.account-modal-btn.secondary {
    background: transparent;
    color: var(--gray);
    border: 1px solid var(--border-color);
}

.account-modal-btn.secondary:hover {
    background: var(--bg-input);
    color: var(--dark);
}

.account-modal-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Security Note */
.account-modal-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--gray);
}

.account-modal-secure svg {
    width: 14px;
    height: 14px;
    color: var(--success);
}

/* Responsive */
@media (max-width: 480px) {
    .account-modal-overlay {
        padding: 16px;
    }
    
    .account-modal-card {
        padding: 24px 20px;
    }
    
    .account-modal-card h2 {
        font-size: 1.2rem;
    }
    
    .account-modal-text {
        font-size: 0.9rem;
    }
}

/* ================= PERSISTENT ACCOUNT SETUP BANNER ================= */
.account-setup-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.08) 0%, rgba(231, 76, 60, 0.05) 100%);
    border: 1px solid rgba(243, 156, 18, 0.25);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    margin-bottom: 20px;
    animation: slideDown 0.4s ease;
    position: relative;
}

.dark .account-setup-banner {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(248, 113, 113, 0.08) 100%);
    border-color: rgba(251, 191, 36, 0.3);
}

.account-setup-banner.hidden {
    display: none;
}

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

.setup-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(243, 156, 18, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--warning);
}

.dark .setup-banner-icon {
    background: rgba(251, 191, 36, 0.2);
}

.setup-banner-icon svg {
    width: 20px;
    height: 20px;
}

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

.setup-banner-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 2px;
}

.setup-banner-text {
    font-size: 0.85rem;
    color: var(--gray);
    line-height: 1.4;
}

.setup-banner-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--warning);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
    flex-shrink: 0;
    white-space: nowrap;
}

.setup-banner-btn:hover {
    background: #d35400;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.setup-banner-btn svg {
    width: 14px;
    height: 14px;
}

.setup-banner-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.setup-banner-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--dark);
}

.dark .setup-banner-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.setup-banner-close svg {
    width: 14px;
    height: 14px;
}

/* ================= ADVANCED ANALYTICS SECTION ================= */
.analytics-section {
    margin-top: 8px;
}

.analytics-section.hidden {
    display: none;
}

.pro-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--gradient-bg);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    letter-spacing: 0.5px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Analytics Stats Grid */
.analytics-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.analytics-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

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

.analytics-stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-stat-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-stat-icon svg {
    width: 16px;
    height: 16px;
}

.analytics-stat-icon.growth {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success);
}

.analytics-stat-icon.success {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
}

.analytics-stat-icon.avg {
    background: rgba(147, 51, 234, 0.1);
    color: #9333ea;
}

.analytics-stat-icon.cashflow {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

.analytics-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
    line-height: 1;
}

.analytics-stat-trend {
    font-size: 0.8rem;
    color: var(--gray);
}

.analytics-stat-trend.positive {
    color: var(--success);
}

.analytics-stat-trend.negative {
    color: var(--danger);
}

/* Charts Row */
.analytics-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
}

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

.chart-card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 2px;
}

.chart-card-header p {
    font-size: 0.8rem;
    color: var(--gray);
}

.chart-total {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
    font-family: 'JetBrains Mono', monospace;
}

.view-all-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 180px;
    padding: 0 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
}

.bar-stack {
    width: 100%;
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 100%;
}

.bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    position: relative;
    min-height: 4px;
}

.bar.paid {
    background: var(--primary);
}

.bar.pending {
    background: var(--warning);
    opacity: 0.7;
}

.bar:hover {
    opacity: 0.8;
    transform: scaleY(1.02);
    transform-origin: bottom;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 500;
    margin-top: 6px;
}

.chart-legend-bar {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 8px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--gray);
}

.legend-bar {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-bar.paid {
    background: var(--primary);
}

.legend-bar.pending {
    background: var(--warning);
}

/* Top Clients */
.top-clients-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-client-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.top-client-item:hover {
    background: var(--bg-input);
}

.client-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray);
    flex-shrink: 0;
}

.top-client-item:nth-child(1) .client-rank {
    background: var(--gradient-bg);
    color: white;
}

.top-client-item:nth-child(2) .client-rank {
    background: var(--info);
    color: white;
}

.top-client-item:nth-child(3) .client-rank {
    background: var(--success);
    color: white;
}

.client-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: white;
    flex-shrink: 0;
}

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

.client-name-small {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-invoices-small {
    font-size: 0.7rem;
    color: var(--gray);
}

.client-revenue-small {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--dark);
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
}

/* Cash Flow Card */
.cash-flow-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
}

.cash-flow-visual {
    margin-top: 16px;
}

.cash-flow-bar {
    display: flex;
    height: 32px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-input);
    margin-bottom: 16px;
}

.cash-flow-income {
    background: linear-gradient(90deg, var(--success), #27ae60);
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.cash-flow-expense {
    background: linear-gradient(90deg, var(--danger), #c0392b);
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.cash-flow-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.cash-flow-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cash-flow-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cash-flow-item.income .cash-flow-dot {
    background: var(--success);
}

.cash-flow-item.expense .cash-flow-dot {
    background: var(--danger);
}

.cash-flow-item.net .cash-flow-dot {
    background: var(--primary);
}

.cash-flow-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cash-flow-label {
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 500;
}

.cash-flow-amount {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    font-family: 'JetBrains Mono', monospace;
}

/* Empty State for Analytics */
.analytics-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.analytics-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.analytics-empty p {
    font-size: 0.9rem;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px) {
    .analytics-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .account-setup-banner {
        flex-wrap: wrap;
        padding: 14px 16px;
        gap: 10px;
    }
    
    .setup-banner-icon {
        width: 36px;
        height: 36px;
    }
    
    .setup-banner-content {
        flex: 1;
        min-width: calc(100% - 50px);
    }
    
    .setup-banner-title {
        font-size: 0.9rem;
    }
    
    .setup-banner-text {
        font-size: 0.8rem;
    }
    
    .setup-banner-btn {
        width: 100%;
        justify-content: center;
        padding: 10px;
    }
    
    .analytics-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .analytics-stat-value {
        font-size: 1.4rem;
    }
    
    .bar-chart {
        height: 140px;
    }
    
    .cash-flow-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .analytics-stats {
        grid-template-columns: 1fr;
    }
    
    .analytics-stat-card {
        padding: 16px;
    }
    
    .chart-card {
        padding: 16px;
    }
    
    .bar-chart {
        height: 120px;
        gap: 8px;
    }
    
    .bar-label {
        font-size: 0.65rem;
    }
}
