/* ============================================================
   KasKu - Sistem Manajemen Keuangan — Compact Edition
   ============================================================ */

:root {
    --primary: #1a56db;
    --primary-light: #e8f0fe;
    --primary-dark: #1245b0;
    --success: #0e9f6e;
    --success-light: #d1fae5;
    --danger: #e02424;
    --danger-light: #fde8e8;
    --warning: #e07b00;
    --warning-light: #fff3e0;
    --dark: #111928;
    --dark2: #1f2a37;
    --gray: #6b7280;
    --gray-light: #f3f4f6;
    --border: #e5e7eb;
    --sidebar-w: 248px;
    --font: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 12px;
    --radius-sm: 7px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.05), 0 10px 30px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: #f0f2f8;
    color: var(--dark);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 13.5px;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--dark);
    display: flex; flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.brand-icon {
    width: 34px; height: 34px;
    background: var(--primary); border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: #fff; flex-shrink: 0;
}

.brand-name { display: block; font-size: 15px; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.brand-sub  { display: block; font-size: 10px; color: rgba(255,255,255,.38); font-weight: 400; }

.sidebar-saldo {
    margin: 10px 10px 0;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    border-radius: 9px;
    padding: 11px 13px;
    flex-shrink: 0;
}

.saldo-label  { font-size: 10px; color: rgba(255,255,255,.6); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.saldo-amount { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: #fff; margin: 3px 0 6px; line-height: 1; }
.saldo-detail { display: flex; gap: 8px; font-size: 10px; font-weight: 500; }
.saldo-detail .in  { color: #6ee7b7; }
.saldo-detail .out { color: #fca5a5; }

.sidebar-nav { padding: 5px 8px 16px; flex: 1; }

.nav-section-title {
    font-size: 9.5px; font-weight: 700;
    color: rgba(255,255,255,.25);
    text-transform: uppercase; letter-spacing: 1px;
    padding: 9px 8px 3px;
}

.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px;
    border-radius: 7px;
    color: rgba(255,255,255,.58);
    text-decoration: none;
    font-size: 12.5px; font-weight: 500;
    transition: all .18s;
    margin-bottom: 1px;
}

.nav-item i { font-size: 14px; flex-shrink: 0; }
.nav-item:hover  { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.danger { color: #fca5a5; }
.nav-item.danger:hover { background: rgba(224,36,36,.18); }

/* ===== MAIN WRAP ===== */
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 54px;
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 100;
}

.topbar-title { font-size: 15px; font-weight: 700; flex: 1; display: flex; align-items: center; gap: 7px; }
.topbar-title i { color: var(--primary); font-size: 15px; }

.topbar-user {
    display: flex; align-items: center; gap: 7px;
    font-size: 12.5px; font-weight: 500; color: var(--gray);
}

.user-avatar {
    width: 30px; height: 30px;
    background: var(--primary); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 12px;
}

.page-content { padding: 18px 20px; flex: 1; }

/* ===== CARDS ===== */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    margin-bottom: 14px;
}

.card-title {
    font-size: 13px; font-weight: 700; color: var(--dark);
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 6px;
}

.card-title i { color: var(--primary); font-size: 14px; }

/* ===== STAT CARDS ===== */
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 15px;
    display: flex; align-items: center; gap: 11px;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    height: 100%;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; flex-shrink: 0;
}

.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light);  color: var(--success); }
.stat-icon.red    { background: var(--danger-light);   color: var(--danger); }
.stat-icon.orange { background: var(--warning-light);  color: var(--warning); }

.stat-label { font-size: 10.5px; color: var(--gray); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; line-height: 1.3; }
.stat-value { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: var(--dark); margin-top: 3px; line-height: 1.2; }
.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

.table { margin: 0; font-size: 12.5px; }

.table thead th {
    background: #f8f9fc;
    border-bottom: 2px solid var(--border);
    border-top: none;
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--gray);
    padding: 8px 11px;
    white-space: nowrap;
}

.table tbody td {
    padding: 8px 11px;
    border-color: #f0f2f6;
    vertical-align: middle;
    line-height: 1.4;
}

.table tfoot td, .table tfoot th {
    padding: 8px 11px;
    border-top: 2px solid var(--border);
    font-size: 12.5px;
}

.table tbody tr:hover { background: #fafbff; }

/* ===== BADGES ===== */
.badge-masuk  { background: var(--success-light); color: #065f46; font-weight: 600; font-size: 10.5px; padding: 2px 7px; border-radius: 20px; display: inline-block; white-space: nowrap; }
.badge-keluar { background: var(--danger-light);  color: #991b1b; font-weight: 600; font-size: 10.5px; padding: 2px 7px; border-radius: 20px; display: inline-block; white-space: nowrap; }
.badge-aktif  { background: var(--success-light); color: #065f46; font-weight: 600; font-size: 10.5px; padding: 2px 7px; border-radius: 20px; display: inline-block; white-space: nowrap; }
.badge-lunas  { background: var(--success-light); color: #065f46; font-weight: 600; font-size: 10.5px; padding: 2px 7px; border-radius: 20px; display: inline-block; white-space: nowrap; }

/* ===== FORMS ===== */
.form-label { font-size: 12px; font-weight: 600; color: var(--dark2); margin-bottom: 4px; }

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    padding: 7px 11px;
    font-family: var(--font);
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.1);
    outline: none;
}

.form-control-sm, .form-select-sm { font-size: 12px; padding: 5px 9px; }

.input-group-text {
    font-size: 12.5px; padding: 7px 11px;
    background: #f8f9fc; border-color: var(--border); color: var(--gray);
}

/* ===== BUTTONS ===== */
.btn {
    font-family: var(--font); font-weight: 600;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    padding: 7px 15px;
    transition: all .2s; line-height: 1.4;
}

.btn-sm { padding: 5px 10px; font-size: 11.5px; }

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #0b8760; border-color: #0b8760; }

/* Icon-only square button */
.btn-icon {
    width: 27px; height: 27px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px;
    font-size: 12px;
    flex-shrink: 0;
}

/* ===== MODAL ===== */
.modal-content { border: none; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-header  { border-bottom: 1px solid var(--border); padding: 14px 18px 11px; }
.modal-title   { font-size: 14px; font-weight: 700; }
.modal-body    { padding: 16px 18px; }
.modal-footer  { border-top: 1px solid var(--border); padding: 11px 18px; }

/* ===== PROGRESS ===== */
.progress { height: 6px; border-radius: 3px; background: var(--gray-light); }
.progress-bar { border-radius: 3px; }

/* ===== MONEY TEXT ===== */
.money { font-family: var(--font-mono); font-weight: 600; font-size: 12.5px; }
.money.masuk  { color: var(--success); }
.money.keluar { color: var(--danger); }

/* ===== OVERLAY & TOGGLE ===== */
#overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 999; }
#overlay.show { display: block; }
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--dark); cursor: pointer; padding: 4px; }

/* ===== SEARCH BAR ===== */
.search-bar { position: relative; }
.search-bar .form-control { padding-left: 32px; }
.search-bar .search-icon  { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray); font-size: 13px; pointer-events: none; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 32px 20px; color: var(--gray); }
.empty-state i { font-size: 38px; opacity: .22; display: block; margin-bottom: 8px; }
.empty-state p { font-size: 13px; margin: 0; }

/* ===== NO ANGGOTA BADGE ===== */
.no-anggota-badge {
    font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
    background: var(--primary-light); color: var(--primary);
    padding: 2px 7px; border-radius: 5px; white-space: nowrap;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--dark) 0%, #2d3748 100%);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}

.login-card {
    background: #fff; border-radius: 16px; padding: 34px;
    width: 100%; max-width: 390px;
    box-shadow: 0 25px 80px rgba(0,0,0,.3);
}

.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo .icon {
    width: 54px; height: 54px; background: var(--primary); border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 24px; color: #fff; margin-bottom: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrap { margin-left: 0; }
    .page-content { padding: 12px; }
    .sidebar-toggle { display: block; }
    .topbar { padding: 0 12px; height: 50px; }
    .card { padding: 12px 14px; margin-bottom: 10px; }
    .stat-card { padding: 10px 12px; gap: 9px; }
    .stat-icon { width: 34px; height: 34px; font-size: 15px; }
    .stat-value { font-size: 13px; }
    .stat-label { font-size: 10px; }
    .table tbody td, .table thead th { padding: 6px 8px; font-size: 11.5px; }
    .btn-icon { width: 24px; height: 24px; font-size: 11px; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card, .stat-card { animation: fadeInUp .3s ease both; }
.row > [class*="col"]:nth-child(2) .stat-card { animation-delay: .05s; }
.row > [class*="col"]:nth-child(3) .stat-card { animation-delay: .1s; }
.row > [class*="col"]:nth-child(4) .stat-card { animation-delay: .15s; }
