:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #263548;
  --bg-input: #162032;
  --border-color: rgba(255,255,255,0.08);
  --border-color-focus: rgba(99,102,241,0.5);
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-card: linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(139,92,246,0.05) 100%);
  
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(99,102,241,0.3);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --transition: all 0.2s ease;
  --transition-slow: all 0.4s ease;
  
  --navbar-height: 60px;
  --bottom-nav-height: 70px;
  --header-height: 56px;
}

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: var(--radius-full);
}

#app-wrapper {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    padding-top: var(--header-height);
}

.main-content {
    padding: 1.5rem;
    padding-bottom: calc(var(--bottom-nav-height) + 2rem);
}

.page-header {
    margin-bottom: 2rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
}
.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

/* Cards & Glassmorphism */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-md);
}
.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.stat-card-bank .stat-card-icon { background: rgba(99,102,241,0.2); color: var(--primary); }
.stat-card-cash .stat-card-icon { background: rgba(245,158,11,0.2); color: var(--warning); }
.stat-card-loan .stat-card-icon { background: rgba(239,68,68,0.2); color: var(--danger); }
.stat-card-receivable .stat-card-icon { background: rgba(16,185,129,0.2); color: var(--success); }

/* Hero Balance Card */
.hero-balance-card {
    position: relative;
    border-radius: var(--radius-xl);
    padding: 2rem;
    overflow: hidden;
    color: white;
    box-shadow: var(--shadow-glow);
}
.hero-balance-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gradient-primary);
    z-index: 1;
}
.hero-balance-content {
    position: relative;
    z-index: 2;
}
.hero-balance-amount {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0.5rem 0;
}
.hero-mini-stat {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.1);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    flex: 1;
    font-size: 0.875rem;
}

/* Navigation */
.top-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: rgba(15,23,42,0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    justify-content: space-between;
}
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-height);
    background: rgba(30,41,59,0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    height: 100%;
    flex: 1;
    position: relative;
    transition: var(--transition);
}
.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    transition: var(--transition);
}
.nav-item.active {
    color: var(--primary);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}
.nav-item:hover {
    color: var(--primary-light);
}

/* Forms */
.form-control, .form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}
.form-control:focus, .form-select:focus {
    background-color: var(--bg-input);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--border-color-focus);
}
.form-label {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Buttons */
.btn {
    border-radius: var(--radius-md);
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
}
.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    color: white;
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}
.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.btn-icon, .btn-icon-xs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
}
.btn-icon { width: 40px; height: 40px; }
.btn-icon-xs { width: 32px; height: 32px; font-size: 0.875rem; }

/* FAB */
.fab-btn {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 20px);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    z-index: 900;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.fab-btn:hover {
    transform: scale(1.1);
}

/* Transaction Items */
.transaction-item {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}
.transaction-item:last-child {
    border-bottom: none;
}
.txn-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 1rem;
}
.txn-details {
    flex-grow: 1;
}
.txn-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.txn-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}
.txn-amount {
    font-weight: 700;
    text-align: right;
}

/* Quick Add Panel */
.quick-add-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.quick-add-overlay.active {
    opacity: 1;
    visibility: visible;
}
.quick-add-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-card);
    border-radius: 24px 24px 0 0;
    padding: 2rem 1.5rem;
    z-index: 1050;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 -10px 25px rgba(0,0,0,0.5);
}
.quick-add-panel.active {
    transform: translateY(0);
}
.quick-add-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: -1rem auto 1.5rem;
}

/* Utilities */
.icon-box {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-box-sm {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

/* Bootstrap Overrides */
.table { color: var(--text-primary); }
.table-dark { background-color: transparent; }
.table-dark th { border-bottom-color: var(--border-color); color: var(--text-secondary); font-weight: 600; }
.table-dark td { border-bottom-color: var(--border-color); vertical-align: middle; }
.table-hover tbody tr:hover { color: var(--text-primary); background-color: var(--bg-card-hover); }

/* Skeleton Loading */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: var(--radius-sm);
}

.account-dot {
    width: 12px; height: 12px; border-radius: 50%;
}
