:root {
    --color-primary: #1b5e20;
    --color-primary-light: #4caf50;
    --color-success: #2ecc71;
    --color-danger: #e74c3c;
    --color-warning: #f1c40f;
    --color-info: #3498db;
    --color-pink: #e84393;
    --color-bg: #f8f9fa;
    --color-card: #ffffff;
    --color-text: #2c3e50;
    --color-text-muted: #7f8c8d;
    --color-border: #eeeeee;
    --color-dark: #34495e;
    
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.04);
    --shadow-md: 0 6px 18px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --color-primary: #2e7d32;
    --color-bg: #121212;
    --color-card: #1e1e1e;
    --color-text: #f5f6fa;
    --color-text-muted: #a4b0be;
    --color-border: #2f3640;
    --color-pink: #fd79a8;
    --color-dark: #1e1e1e;
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.2);
    --shadow-md: 0 6px 18px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: 'Inter', sans-serif; color: var(--color-text); background: var(--color-bg); transition: background 0.3s, color 0.3s; }

/* SPACING & UTILITIES ASLI */
.m-0 { margin: 0; } .mt-5 { margin-top: 5px; } .mt-10 { margin-top: 10px; } .mt-15 { margin-top: 15px; } .mb-5 { margin-bottom: 5px; } .mb-10 { margin-bottom: 10px; } .mb-15 { margin-bottom: 15px; } .ml-10 { margin-left: 10px; }
.p-15 { padding: 15px; } .px-15 { padding-left: 15px; padding-right: 15px; } .pb-10 { padding-bottom: 10px; } .py-10 { padding-top: 10px; padding-bottom: 10px; }
.fw-bold { font-weight: bold; }
.fs-10 { font-size: 10px; } .fs-11 { font-size: 11px; } .fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; }
.text-center { text-align: center; } .text-right { text-align: right; }
.flex-between-center { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.d-none { display: none !important; } .d-block { display: block; }
.border-bottom { border-bottom: 1px solid var(--color-border); }
.border-none { border: none !important; }
.cursor-pointer { cursor: pointer; }
.w-100 { width: 100%; } .h-200 { height: 200px; }
.sticky-top { position: sticky; top: 0; z-index: 100; }

/* TEXT COLORS */
.text-success, .text-income, .text-green { color: var(--color-success) !important; }
.text-expense, .text-red { color: var(--color-danger) !important; }
.text-info { color: var(--color-info) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-pink { color: var(--color-pink) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-white { color: #ffffff !important; }

/* BG COLORS */
.bg-expense { background-color: var(--color-danger); color:white;}
.bg-green { background-color: var(--color-success); color:white;}
.bg-pink { background-color: var(--color-pink); color:white;}
.bg-dark { background-color: var(--color-dark); color:white;}
.bg-info { background-color: var(--color-info); color:white;}
.bg-warning { background-color: var(--color-warning); color:#000;}
.bg-gradient-blue { background: linear-gradient(135deg, #2980b9, #3498db); }

/* DASHBOARD COMPONENTS */
.app-container { padding-bottom: 90px; }
.dashboard-section { padding: 0 15px; }
.section-heading { margin: 0 0 10px 0; font-size: 14px; color: var(--color-text); font-weight: bold; }
.page-title { margin: 0 0 10px 0; font-size: 16px; font-weight: bold; }

.net-worth-card { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light)); color: white; padding: 25px 15px 35px 15px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); text-align: center; box-shadow: var(--shadow-md); position: relative;}
.net-worth-label { font-size: 12px; opacity: 0.9; display: block; margin-bottom: 5px; }
.net-worth-value { font-size: 30px; font-weight: 800; margin: 0; letter-spacing: -0.5px;}

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 15px; margin-top: -20px; position: relative; z-index: 10;}
.stat-card { background: var(--color-card); padding: 12px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--color-border); }
.stat-card-label { font-size: 11px; color: var(--color-text-muted); font-weight: 600; margin-bottom: 5px; text-transform: uppercase;}
.stat-card-value { font-size: 14px; font-weight: bold; color: var(--color-text);}

/* CARDS & HISTORY LAYOUT (KEMBALIKAN LOGIKA LAMA YG BENAR) */
.card-section { background: var(--color-card); border-radius: var(--radius-md); border: 1px solid var(--color-border); margin-bottom: 15px; box-shadow: var(--shadow-sm); overflow: hidden; padding: 15px;}
.card-header, .section-title { padding: 10px 15px; font-weight: bold; font-size: 14px; border-bottom: 1px solid var(--color-border); margin: -15px -15px 15px -15px; border-radius: var(--radius-md) var(--radius-md) 0 0; text-align: center;}
.panel-fitur { display: flex; flex-direction: column; gap: 12px; }

/* STRUKTUR HISTORY FLEXBOX YANG HILANG */
.history-card, .wallet-card, .goal-card, .debt-card { background: var(--color-card); padding: 12px; border-radius: var(--radius-md); margin-bottom: 10px; border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.history-card { display: flex; justify-content: space-between; align-items: center; }
.date-header { font-size: 12px; font-weight: bold; color: var(--color-text-muted); margin: 15px 0 8px 0; border-bottom: 1px solid var(--color-border); padding-bottom: 5px;}
.history-icon { width: 35px; height: 35px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 15px; margin-right: 12px;}
.history-left { display: flex; align-items: center; }
.history-desc { font-weight: 600; font-size: 13px; margin: 0; color: var(--color-text); }
.history-cat { font-size: 11px; color: var(--color-text-muted); margin: 3px 0 0 0; }
.history-amount { font-weight: bold; font-size: 13px; }
.history-right { text-align: right; }

/* STRUKTUR DOMPET & GOALS YANG HILANG */
.wallet-card-header { display: flex; justify-content: space-between; align-items: center; }
.wallet-logo-img, .menu-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-right: 12px;}
.wallet-name, .debt-name, .goal-title { margin: 0; font-size: 14px; font-weight: bold; color: var(--color-text); }
.wallet-balance, .debt-amount { margin: 4px 0 0 0; font-size: 13px; font-weight: 600; color: var(--color-text); }
.debt-type-label { font-size: 10px; font-weight: bold; margin-bottom: 4px; }
.goal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.goal-target { font-size: 11px; color: var(--color-text-muted); margin-top: 3px; }

/* FORMS & INPUTS (DENGAN FIX UNTUK MOBILE) */
input, select { width: 100%; padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: 13px; background-color: var(--color-bg); color: var(--color-text); outline: none; box-sizing: border-box; transition: 0.2s;}
input:focus, select:focus { border-color: var(--color-primary); }

/* PENAMBAHAN FIX KHUSUS DROPDOWN DI HP (IOS/ANDROID) */
select {
    -webkit-appearance: menulist-button !important;
    appearance: menulist-button !important;
    min-height: 45px !important; 
    opacity: 1 !important;
    display: block !important;
    pointer-events: auto !important;
    position: relative;
    cursor: pointer;
}

label { font-size: 11px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 4px; display: block; }
.input-large { font-size: 22px; font-weight: bold; color: var(--color-primary); text-align: center; }

/* BUTTONS */
.btn-primary { width: 100%; background: var(--color-primary); color: white; padding: 14px; border: none; border-radius: var(--radius-md); font-weight: bold; font-size: 13px; cursor: pointer; }
.btn-aksi { border: none; padding: 6px 10px; border-radius: 5px; cursor: pointer; font-size: 10px; font-weight: bold; transition: 0.2s;}
.btn-kembali { background: transparent; border: none; color: var(--color-primary); font-size: 13px; font-weight: bold; margin-bottom: 10px; cursor: pointer; padding: 0; display: flex; align-items: center; gap: 6px;}

/* NAVIGATION */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--color-card); display: flex; justify-content: space-around; padding: 8px 0 12px 0; box-shadow: 0 -4px 20px rgba(0,0,0,0.05); border-top: 1px solid var(--color-border); z-index: 1000; border-radius: var(--radius-lg) var(--radius-lg) 0 0;}
.nav-item { color: var(--color-text-muted); text-decoration: none; display: flex; flex-direction: column; align-items: center; font-size: 10px; font-weight: 600; gap: 4px; }
.nav-item i { font-size: 18px; }
.nav-item.active { color: var(--color-primary); }
.nav-fab { background: var(--color-primary); color: white; width: 50px; height: 50px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 22px; margin-top: -35px; box-shadow: 0 6px 12px rgba(27,94,32,0.3); border: 4px solid var(--color-bg); transition: transform 0.2s;}

/* BOTTOM SHEET MODAL */
.bottom-sheet-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: 0.3s; }
.bottom-sheet-overlay.active { opacity: 1; pointer-events: all; }
.bottom-sheet { background: var(--color-card); width: 100%; border-radius: 20px 20px 0 0; padding: 20px 15px; transform: translateY(100%); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); overflow-y: auto; max-height: 90vh;}
.bottom-sheet-overlay.active .bottom-sheet { transform: translateY(0); }
.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.sheet-title { margin: 0; font-size: 16px; font-weight: bold; color: var(--color-text);}
.btn-close-sheet { background: none; border: none; font-size: 24px; color: var(--color-text-muted); cursor: pointer; }

/* QUICK ACTIONS */
.quick-action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-action-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; background: var(--color-bg); border-radius: var(--radius-md); color: var(--color-text); text-decoration: none; font-size: 11px; font-weight: 600; border: 1px solid var(--color-border); text-align: center;}
.quick-action-item i { font-size: 20px; margin-bottom: 2px;}

/* OTHERS */
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--color-border); cursor: pointer;}
[data-theme="dark"] .settings-item { border-bottom: none; background: rgba(255,255,255,0.03); margin-bottom: 6px; padding: 12px; border-radius: 8px; }
.progress-wrapper { background: var(--color-bg); border-radius: 8px; height: 10px; width: 100%; overflow: hidden; border: 1px solid var(--color-border); margin-top: 4px;}
.progress-fill { height: 100%; border-radius: 8px; transition: width 0.3s ease; }

.login-screen { position: fixed; inset: 0; background: var(--color-bg); z-index: 99999; display: flex; justify-content: center; align-items: center; }
.login-container { background: var(--color-card); padding: 25px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); width: 85%; max-width: 320px; text-align: center; border: 1px solid var(--color-border);}
.view-section { display: none; animation: fadeIn 0.2s ease-in-out; } .view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* TOASTS & AUTOCOMPLETE */
#custom-toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #333; color: white; padding: 10px 20px; border-radius: 30px; font-size: 12px; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.2); transition: 0.3s; }
.toast-hidden { opacity: 0; top: -50px; pointer-events: none;}
.modal-overlay, #custom-confirm { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 10000; transition: opacity 0.2s; }
.confirm-hidden { opacity: 0; pointer-events: none; }
.modal-box, .confirm-box { background: var(--color-card); padding: 20px; border-radius: var(--radius-md); width: 85%; max-width: 320px; box-shadow: var(--shadow-md); border: 1px solid var(--color-border); transform: scale(0.95); transition: transform 0.2s;}
.modal-overlay:not(.confirm-hidden) .modal-box, #custom-confirm:not(.confirm-hidden) .confirm-box { transform: scale(1); }
#confirm-msg { font-size: 14px; margin-bottom: 15px; color: var(--color-text); text-align: center;}
.confirm-actions, .modal-actions { display: flex; gap: 10px; justify-content: center; }

.autocomplete-wrapper { position: relative; width: 100%; display: block; }
.autocomplete-list { position: absolute; top: calc(100% - 12px); left: 0; right: 0; background: var(--color-card); border: 1px solid var(--color-primary); border-radius: 8px; max-height: 150px; overflow-y: auto; z-index: 10000; box-shadow: 0 8px 16px rgba(0,0,0,0.15); }
.autocomplete-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--color-border); font-size: 12px; color: var(--color-text); transition: 0.2s;}
.autocomplete-item:hover { background-color: var(--color-primary); color: white; font-weight: bold; }