:root {
    color-scheme: light; 
    --bg-color: #f4f7fa;
    --surface: #ffffff;
    --text-main: #2d3748;
    --text-muted: #718096;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --border: #e2e8f0;
    --hover: #edf2f7;
    --red: #e53e3e;
    --green: #38a169;
    --blue: #3182ce;
}

body.dark-mode {
    color-scheme: dark; 
    --bg-color: #1a202c;
    --surface: #2d3748;
    --text-main: #f7fafc;
    --text-muted: #a0aec0;
    --primary: #667eea;
    --primary-hover: #5a67d8;
    --border: #4a5568;
    --hover: #2b6cb0;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; transition: background-color 0.3s, color 0.3s; }
body { background-color: var(--bg-color); color: var(--text-main); padding-bottom: 120px; } 

/* Header */
header { background-color: var(--surface); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; }
.header-left { display: flex; align-items: center; gap: 10px; }
.logo { width: 35px; height: 35px; border-radius: 5px; object-fit: cover;}
header h1 { font-size: 1.2rem; margin: 0; color: var(--primary); font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 15px; font-size: 0.85rem; font-weight: 500;}
.icon-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; }

/* Marquee */
.marquee-container { background: var(--primary); color: white; padding: 8px 0; overflow: hidden; white-space: nowrap; position: relative; font-size: 0.9rem; font-weight: 500; box-shadow: 0 2px 5px rgba(0,0,0,0.1);}
.marquee-content { display: inline-block; animation: marquee-scroll 25s linear infinite; }
@keyframes marquee-scroll { 0% { transform: translateX(100vw); } 100% { transform: translateX(-100%); } }

/* Page Control */
.page { display: none; padding: 20px; animation: fadeIn 0.4s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Dashboard Header */
.dashboard-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 10px; }
.section-title { font-size: 1.3rem; border-bottom: 3px solid var(--primary); display: inline-block; padding-bottom: 5px; }

.search-box { display: flex; align-items: center; background: var(--surface); border: 2px solid var(--border); border-radius: 50px; padding: 6px 20px; flex-grow: 1; max-width: 350px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); transition: border-color 0.2s;}
.search-box:focus-within { border-color: var(--primary); }
.search-box input { border: none; background: transparent; color: var(--text-main); width: 100%; outline: none; padding: 5px; font-size: 0.95rem; }
.search-icon { color: var(--text-muted); font-size: 1rem; margin-right: 5px;}

/* Cards Dashboard */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card { background-color: var(--surface); padding: 20px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid var(--border); transition: transform 0.2s;}
.card:hover { transform: translateY(-3px); }
.card h3 { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px;}
.card .amount { font-size: 1.8rem; font-weight: 700; margin-bottom: 5px;}
.card-highlight { border-left: 5px solid var(--blue); }
.text-blue { color: var(--blue); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }

/* Table Masterpiece */
.table-responsive { overflow-x: auto; background: var(--surface); border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); border: 1px solid var(--border);}
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th, td { border: 1px solid var(--border); padding: 14px 15px; text-align: center; white-space: nowrap; font-size: 0.95rem; }
th { background-color: var(--hover); font-weight: 600; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; color: var(--text-muted);}
tbody tr:hover { background-color: var(--hover); }

/* Gelembung Badges */
.badge { padding: 6px 15px; border-radius: 50px; font-size: 0.8rem; font-weight: 600; display: inline-block; box-shadow: 0 2px 4px rgba(0,0,0,0.05);}
.badge.deposit { background-color: #c6f6d5; color: #22543d; border: 1px solid #9ae6b4;}
.badge.penarikan { background-color: #fed7d7; color: #822727; border: 1px solid #feb2b2;}

/* Action Buttons */
.btn-action { border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; margin: 0 3px; font-size: 0.85rem; font-weight: 600; display: inline-flex; align-items: center; gap: 5px;}
.btn-edit { background-color: var(--blue); color: white; }
.btn-del { background-color: var(--red); color: white; }
.btn-action:hover { opacity: 0.8; }

/* Floating Action Button */
.fab { 
    position: fixed; right: 25px; bottom: 95px; 
    width: 60px; height: 60px; border-radius: 50%; 
    background-color: var(--primary); color: white; 
    font-size: 38px; font-weight: 500; line-height: 1; 
    border: none; box-shadow: 0 4px 20px rgba(79, 70, 229, 0.5); 
    cursor: pointer; z-index: 90; display: flex; align-items: center; justify-content: center;
    padding-bottom: 5px; transition: transform 0.2s, background-color 0.2s;
}
.fab:hover { transform: scale(1.08) rotate(90deg); background-color: var(--primary-hover);}

/* Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background-color: var(--surface); display: flex; justify-content: space-around;
    width: 90%; max-width: 400px; padding: 12px 0; border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); z-index: 100; border: 1px solid var(--border);
}
.nav-item { background: none; border: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; flex: 1; }
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 1.4rem; }
.nav-text { font-size: 0.75rem; font-weight: 600; }

footer { position: fixed; bottom: 3px; width: 100%; text-align: center; font-size: 0.7rem; color: var(--text-muted); z-index: 99; pointer-events: none; font-weight: 500;}

/* Modals */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal.show { display: flex; animation: fadeInModal 0.2s ease-out; }
@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }

.modal-content { background: var(--surface); padding: 30px; border-radius: 15px; width: 92%; max-width: 450px; box-shadow: 0 15px 35px rgba(0,0,0,0.2); animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.modal-content h3 { margin-bottom: 20px; text-align: center; color: var(--primary); font-size: 1.4rem;}

.input-group { margin-bottom: 18px; text-align: left; }
.input-group label { display: block; font-size: 0.9rem; margin-bottom: 6px; color: var(--text-muted); font-weight: 500;}
.input-group input, .input-group select { width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: 8px; background: var(--bg-color); color: var(--text-main); font-family: inherit; font-size: 1rem; transition: border-color 0.2s;}
.input-group input:focus, .input-group select:focus { outline: none; border-color: var(--primary); background-color: var(--surface); }

.modal-actions { display: flex; justify-content: space-between; gap: 15px; margin-top: 25px; }
.modal-actions button { flex: 1; padding: 12px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 1rem; transition: background-color 0.2s;}
.btn-cancel { background-color: var(--border); color: var(--text-main); }
.btn-cancel:hover { background-color: #cbd5e0; }
.btn-save { background-color: var(--primary); color: white; }
.btn-save:hover { background-color: var(--primary-hover); }

/* Custom Popup Alert */
.text-center { text-align: center; }
.confirm-icon { font-size: 3.5rem; margin-bottom: 10px; }
@keyframes popIn { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }


/* ========== STYLING BUKU BESAR INDIVIDU (DIPERBARUI) ========== */
#individu-container {
    background-color: var(--surface);
    padding: 20px 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    margin-top: 25px;
}
#individu-title {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
    padding-bottom: 3px;
    text-transform: capitalize;
}
.table-individu-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-individu {
    /* KUNCI UTAMA: Membiarkan tabel melebar ke samping sesuai panjang teks */
    width: max-content; 
    min-width: 100%;
    border-collapse: collapse;
}
.table-individu th, .table-individu td {
    border-bottom: 1px solid var(--border);
    padding: 12px 14px; 
    font-size: 0.85rem; 
    vertical-align: middle;
    
    /* PAKSA TEKS SATU BARIS LURUS (NO WRAPPING) */
    white-space: nowrap !important; 
    word-break: keep-all !important;
}
.table-individu th {
    background-color: var(--hover);
    color: var(--text-muted);
    font-weight: 600;
    text-align: center; 
}

/* Mengatur alignment teks khusus untuk sel isi data (td) */
.table-individu td:nth-child(1) { text-align: center; }
.table-individu td:nth-child(2) { text-align: right; }
.table-individu td:nth-child(3) { text-align: right; }
.table-individu td:nth-child(4) { text-align: right; font-weight: 700;}
.table-individu td:nth-child(5) { text-align: left; }
