:root {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.2);
    --income: #10b981;
    --expense: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-dark); color: var(--text-main); display: flex; justify-content: center; min-height: 100vh; }

.app-container { width: 100%; max-width: 480px; background-color: var(--bg-dark); min-height: 100vh; position: relative; padding-bottom: 90px; overflow-x: hidden; box-shadow: 0 0 40px rgba(0,0,0,0.05); }
.px-24 { padding: 0 24px; }

/* Auth Views */
.auth-box { padding: 40px 24px; }
.auth-header { text-align: center; margin-bottom: 40px; }
.auth-header .logo { font-size: 32px; font-weight: 700; color: var(--primary); display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-header p { color: var(--text-muted); margin-top: 8px; }
.auth-toggle { display: flex; background: var(--bg-card); border-radius: 12px; margin-bottom: 24px; padding: 4px; }
.auth-toggle button { flex: 1; padding: 12px; background: transparent; border: none; color: var(--text-muted); border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.3s; }
.auth-toggle button.active { background: var(--primary); color: white; }

.primary-btn { width: 100%; background: linear-gradient(135deg, var(--primary), #8b5cf6); color: white; border: none; padding: 16px; border-radius: 16px; font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px var(--primary-glow); margin-top: 16px; transition: all 0.3s; }
.primary-btn:active { transform: scale(0.98); }

.icon-btn { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-main); width: 40px; height: 40px; border-radius: 12px; font-size: 20px; cursor: pointer; display:flex; align-items:center; justify-content:center; transition: all 0.2s; }
.admin-action-btn { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-main); padding: 8px 16px; border-radius: 12px; font-size: 14px; cursor: pointer; display:flex; align-items:center; gap: 8px; font-weight: 500; transition: all 0.2s; }
.admin-action-btn:active { transform: scale(0.95); }
.admin-action-btn i { font-size: 18px; }

.top-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 24px 16px; }
.user-info { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #8b5cf6); display: flex; align-items: center; justify-content: center; font-size: 20px; color: white; }
.greeting p { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.greeting h2 { font-size: 18px; font-weight: 600; }

.balance-card { margin: 16px 24px; position: relative; border-radius: 24px; overflow: hidden; padding: 24px; background: linear-gradient(135deg, var(--primary), #8b5cf6); border: none; box-shadow: 0 12px 32px var(--primary-glow); color: white; }
.card-bg { position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle at center, var(--primary-glow) 0%, transparent 60%); opacity: 0.4; z-index: 0; }
.card-content { position: relative; z-index: 1; }
.card-content > p { font-size: 14px; color: rgba(255,255,255,0.8); margin-bottom: 4px; }
.card-content h1 { font-size: 36px; font-weight: 700; margin-bottom: 24px; letter-spacing: -0.5px; }
.cash-flow { display: flex; justify-content: space-between; gap: 16px; }
.flow-item { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.2); padding: 12px 16px; border-radius: 16px; flex: 1; }
.flow-item .icon-wrapper { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.flow-item.income .icon-wrapper { background: rgba(16, 185, 129, 0.2); color: var(--income); }
.flow-item.expense .icon-wrapper { background: rgba(239, 68, 68, 0.2); color: var(--expense); }
.flow-item p { font-size: 12px; color: rgba(255,255,255,0.7); }
.flow-item h3 { font-size: 16px; font-weight: 600; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; margin-top:24px; }
.section-header h3 { font-size: 18px; font-weight: 600; }
.transactions-section { padding: 0 24px; }

.list-container { display: flex; flex-direction: column; gap: 12px; }
.t-item { display: flex; align-items: center; justify-content: space-between; background: var(--bg-card); padding: 16px; border-radius: 16px; border: 1px solid var(--glass-border); transition: transform 0.2s; }
.t-left { display: flex; align-items: center; gap: 16px; }
.t-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(255,255,255,0.05); color: var(--primary); }
.t-info h4 { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.t-info p { font-size: 12px; color: var(--text-muted); }
.t-amount { font-weight: 600; font-size: 16px; }
.t-amount.income, .t-amount.settle-in, .t-amount.borrow { color: var(--income); }
.t-amount.expense, .t-amount.lend, .t-amount.settle-out { color: var(--text-main); }
.t-amount.transfer { color: #3b82f6; }

.delete-btn { background: rgba(239, 68, 68, 0.1); color: var(--expense); border: none; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; margin-left: 12px; }

.bottom-nav { position: fixed; bottom: 0; width: 100%; max-width: 480px; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(20px); border-top: 1px solid var(--glass-border); display: flex; justify-content: space-around; align-items: center; padding: 10px 0 20px; z-index: 100; }
.nav-item { color: var(--text-muted); font-size: 24px; text-decoration: none; padding: 8px; cursor: pointer; transition: color 0.3s; }
.nav-item.active { color: var(--primary); }
.fab-wrapper { position: relative; top: -24px; }
.fab { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #8b5cf6); border: none; color: white; font-size: 28px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px var(--primary-glow); cursor: pointer; transition: transform 0.3s; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); z-index: 200; display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-content { background: var(--bg-dark); width: 100%; max-width: 480px; border-radius: 32px 32px 0 0; padding: 32px 24px; transform: translateY(100%); transition: transform 0.4s; border-top: 1px solid var(--glass-border); max-height: 90vh; display: flex; flex-direction: column; }
.modal-overlay.active .modal-content { transform: translateY(0); }
.scrollable-form { overflow-y: auto; padding-bottom: 20px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.close-modal { background: var(--bg-card); border: none; width: 36px; height: 36px; border-radius: 50%; color: white; font-size: 20px; cursor: pointer; }

.type-selector { display: flex; background: var(--bg-card); border-radius: 12px; padding: 4px; margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.type-selector::-webkit-scrollbar { display: none; }
.type-btn { flex: 0 0 auto; background: transparent; border: none; color: var(--text-muted); padding: 10px 16px; font-size: 14px; font-weight: 600; border-radius: 8px; transition: all 0.3s; cursor: pointer; }
.type-btn.active { background: var(--primary); color: white; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.form-group input, .form-group select { width: 100%; background: var(--bg-dark); border: 1px solid var(--glass-border); color: var(--text-main); padding: 16px; border-radius: 16px; font-size: 16px; outline: none; }
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }

.amount-group { position: relative; display: flex; align-items: center; margin-bottom: 32px; }
.currency-symbol { position: absolute; left: 0; font-size: 48px; font-weight: 700; color: var(--text-main); }
.amount-group input { background: transparent; border: none; border-bottom: 2px solid var(--glass-border); border-radius: 0; padding: 10px 10px 10px 48px; font-size: 48px; font-weight: 700; height: 70px; color: var(--text-main); }
.amount-group input:focus { border-bottom-color: var(--primary); }

/* Status coloring */
.positive { color: var(--income); }
.negative { color: var(--expense); }

/* Light Mode */
body.light-mode {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
}
body.light-mode .modal-content { background: var(--bg-card); }
body.light-mode input, body.light-mode select { color: var(--text-main); }
body.light-mode .t-icon { background: rgba(0,0,0,0.05); }
body.light-mode .flow-item p { color: var(--text-muted); }
body.light-mode .card-content > p { color: rgba(255,255,255,0.9); }

body.light-mode .bottom-nav { background: rgba(255, 255, 255, 0.9); }
body.light-mode .balance-card { background: linear-gradient(135deg, var(--primary), #8b5cf6); color: white; border: none; }
body.light-mode .card-content > p { color: rgba(255,255,255,0.9); }
body.light-mode .balance-card h1, body.light-mode .flow-item p, body.light-mode .flow-item h3 { color: white; }
body.light-mode .flow-item { background: rgba(255,255,255,0.15); }
body.light-mode .flow-item.income .icon-wrapper { background: rgba(255,255,255,0.9); }
body.light-mode .flow-item.expense .icon-wrapper { background: rgba(255,255,255,0.9); }
body.light-mode .close-modal { color: var(--text-main); background: rgba(0,0,0,0.05); }
body.light-mode .type-selector { background: rgba(0,0,0,0.05); }
body.light-mode .form-group input, body.light-mode .form-group select { border: 1px solid rgba(0,0,0,0.1); background: var(--bg-dark); }
body.light-mode .amount-group input { color: var(--text-main); }
body.light-mode .currency-symbol { color: var(--text-main); }
