:root {
    /* --- MODE GELAP (DEFAULT) --- */
    --primary: #10b981;       /* Hijau Emerald */
    --primary-hover: #059669;
    --bg: #111827;            /* Hitam Pekat */
    --surface: #1f2937;       /* Abu Gelap */
    --border: #374151;        /* Abu */
    --text: #f9fafb;          /* Putih */
    --text-muted: #9ca3af;    /* Abu Muda */
    --success: #10b981; 
    --danger: #ef4444; 
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
    --sidebar-width: 260px;
}

[data-theme="light"] {
    --primary: #0085FF;
    --primary-hover: #0066cc;
    --bg: #f3f5f9;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; transition: background 0.3s, color 0.3s; }

/* --- CUSTOM TOAST NOTIFICATION --- */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    min-width: 280px; background: var(--surface); color: var(--text);
    padding: 15px 20px; border-radius: 8px; border-left: 5px solid var(--success);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3); font-size: 0.95rem; font-weight: 500;
    display: flex; align-items: center; justify-content: space-between;
    animation: slideInRight 0.3s ease forwards; cursor: pointer; border: 1px solid var(--border);
}
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(100%); } }

/* --- LAYOUT UTAMA --- */
.app-wrapper { display: flex; height: 100%; width: 100%; }
.sidebar {
    width: var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 20px; z-index: 50; transition: 0.3s;
}
.brand { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 30px; display: flex; align-items: center; gap: 10px; }
.menu-list { flex: 1; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.menu-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin: 15px 0 5px 10px; letter-spacing: 1px; font-weight: 600; }
.nav-btn {
    text-align: left; padding: 12px 15px; border-radius: var(--radius); background: transparent; border: none;
    color: var(--text-muted); font-size: 0.95rem; font-weight: 500; cursor: pointer;
    display: flex; align-items: center; gap: 12px; transition: 0.2s;
}
.nav-btn:hover { background: rgba(128,128,128,0.1); color: var(--text); }
.nav-btn.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
[data-theme="light"] .nav-btn.active { color: #fff; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 15px; display: flex; gap: 10px; }
.main-content { flex: 1; overflow-y: auto; padding: 30px; position: relative; padding-bottom: 100px; }
.mobile-header { display: none; padding: 15px; background: var(--surface); border-bottom: 1px solid var(--border); align-items: center; justify-content: space-between; }

/* UTILS */
.hidden { display: none !important; }
.full-width { width: 100%; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; border: 1px solid var(--border); transition: 0.3s; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* BUTTONS */
.btn { padding: 10px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; border: none; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 8px; transition: 0.2s; justify-content: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(110%); }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* GRID */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bank-card { display: flex; justify-content: space-between; align-items: center; border-left: 5px solid var(--primary); overflow: hidden; position: relative; }
.bank-card.E-Wallet { border-left-color: #f59e0b; }
.bank-card.Cash { border-left-color: #ec4899; }
.balance { font-size: 1.5rem; font-weight: bold; margin-top: 5px; color: var(--text); }
.bank-card h4 { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

/* TABLES & FORMS */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; margin-top:10px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); color: var(--text); }
th { background: rgba(128,128,128,0.05); color: var(--primary); font-weight: 600; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; font-size: 1rem; }
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }

/* MODALS */
.auth-wrapper { position: fixed; top:0; left:0; width:100%; height:100%; background: var(--bg); z-index: 100; display: flex; justify-content: center; align-items: center; padding: 20px; }
.auth-box { width: 100%; max-width: 400px; padding: 40px; background: var(--surface); border-radius: 16px; border: 1px solid var(--border); text-align: center; box-shadow: var(--shadow); }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: none; justify-content: center; align-items: center; z-index: 2000; backdrop-filter: blur(4px); }
.modal { background: var(--surface); padding: 25px; border-radius: 16px; width: 90%; max-width: 400px; border: 1px solid var(--border); max-height: 90vh; overflow-y: auto; color: var(--text); animation: slideUp 0.3s ease; position: relative; }
.modal h3 { color: var(--primary); margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-top: 0; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background-color: var(--primary); }

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .app-wrapper { flex-direction: column; }
    .sidebar { position: fixed; bottom: 0; left: 0; width: 100%; height: auto; flex-direction: row; padding: 8px; border-top: 1px solid var(--border); border-right: none; justify-content: space-around; background: var(--surface); box-shadow: 0 -4px 10px rgba(0,0,0,0.2); }
    .brand, .sidebar-footer, .menu-label { display: none; }
    .menu-list { flex-direction: row; overflow-x: auto; gap: 0; width: 100%; justify-content: space-between; }
    .nav-btn { flex-direction: column; padding: 8px 5px; font-size: 0.7rem; gap: 4px; text-align: center; border-radius: 8px; width: 20%; justify-content: center; }
    .nav-btn i { font-size: 1.2rem; margin-bottom: 2px; }
    .nav-btn.active { background: transparent; color: var(--primary); box-shadow: none; }
    .mobile-header { display: flex; }
    .main-content { padding: 15px; padding-bottom: 80px; }
    .grid-2 { grid-template-columns: 1fr; }
}