/* ============================================
   DANA FAMILY - Custom Stylesheet
   Modern UI: PC Dashboard + Mobile App-like
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --primary-bg: #eef2ff;
    --secondary: #8b5cf6;
    --success: #10b981;
    --success-dark: #059669;
    --success-bg: #ecfdf5;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --bottomnav-height: 65px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-info: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --gradient-dark: linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #3730a3 100%);
}

/* --- Base Reset & Typography --- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    /* PWA: prevent overscroll bounce & pull-to-refresh */
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    /* Prevent text selection on UI elements for app-like feel */
    -webkit-user-select: none;
    user-select: none;
}

/* Allow text selection on content areas */
.page-content, .modal-body, .table, .sumbangan-grid,
input, textarea, select { 
    -webkit-user-select: auto;
    user-select: auto; 
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

a { color: var(--primary); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--primary-dark); }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ============================================
   SIDEBAR (PC Only)
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--gradient-dark);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 24px 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .brand-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 10px;
    backdrop-filter: blur(10px);
}

.sidebar-brand h2 {
    color: white;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin: 0;
}

.sidebar-brand small {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
    font-weight: 400;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.sidebar-nav .nav-item {
    margin-bottom: 4px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255,255,255,0.7);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(4px);
}

.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.sidebar-nav .nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    text-align: center;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* Top Bar */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.9);
}

.topbar h1 {
    font-size: 1.5rem;
    margin: 0;
}

.topbar .breadcrumb-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.topbar .tahun-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar .tahun-selector select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.topbar .tahun-selector select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* Page Content */
.page-content {
    padding: 24px 32px 40px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 20px 24px;
}

/* Stat Cards */
.stat-card {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 24px;
    background: var(--bg-card);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Stat Card Variants */
.stat-card.primary::before { background: var(--primary); }
.stat-card.primary .stat-icon { background: var(--primary-bg); color: var(--primary); }
.stat-card.primary .stat-value { color: var(--primary); }

.stat-card.success::before { background: var(--success); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.success .stat-value { color: var(--success); }

.stat-card.danger::before { background: var(--danger); }
.stat-card.danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.danger .stat-value { color: var(--danger); }

.stat-card.info::before { background: var(--info); }
.stat-card.info .stat-icon { background: var(--info-bg); color: var(--info); }
.stat-card.info .stat-value { color: var(--info); }

/* Hero Stat Card (for BAKI FUND) */
.hero-stat {
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    padding: 32px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.hero-stat::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.hero-stat::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.hero-stat .hero-label {
    font-size: 0.9rem;
    opacity: 0.85;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-stat .hero-value {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    position: relative;
    z-index: 1;
}

.hero-stat .hero-sub {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-container .table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-container .table-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--bg-body);
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.table .text-right { text-align: right; }
.table .text-center { text-align: center; }

/* ============================================
   SUMBANGAN GRID (Excel-like)
   ============================================ */
.sumbangan-grid {
    overflow-x: auto;
}

.sumbangan-grid table {
    width: 100%;
    border-collapse: collapse;
}

.sumbangan-grid th,
.sumbangan-grid td {
    padding: 10px 14px;
    text-align: center;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.sumbangan-grid th {
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.sumbangan-grid .bulan-col {
    background: var(--bg-body);
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    min-width: 120px;
}

.sumbangan-grid .bawa-hadapan {
    background: var(--warning-bg);
    font-weight: 700;
    color: var(--warning);
}

.sumbangan-grid .cell-paid {
    color: var(--success-dark);
    font-weight: 600;
    background: var(--success-bg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.sumbangan-grid .cell-paid:hover {
    background: #d1fae5;
}

.sumbangan-grid .cell-empty {
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.sumbangan-grid .cell-empty:hover {
    background: var(--primary-bg);
}

.sumbangan-grid .row-total {
    background: var(--primary-bg);
    font-weight: 800;
    color: var(--primary);
    border-top: 3px solid var(--primary);
}

.sumbangan-grid .row-guna {
    background: var(--danger-bg);
    font-weight: 700;
    color: var(--danger);
}

.sumbangan-grid .row-baki {
    background: var(--success-bg);
    font-weight: 800;
    color: var(--success-dark);
    font-size: 1rem;
}

/* ============================================
   BADGES & CHIPS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: var(--success-bg); color: var(--success-dark); }
.badge-danger { background: var(--danger-bg); color: var(--danger-dark); }
.badge-primary { background: var(--primary-bg); color: var(--primary-dark); }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-info { background: var(--info-bg); color: #1e40af; }

.badge-aktif { background: var(--success-bg); color: var(--success-dark); }
.badge-tidak_aktif { background: var(--danger-bg); color: var(--danger-dark); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: var(--success-dark); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: 12px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 4px; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-body); color: var(--text-primary); box-shadow: none; }

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.2rem;
    margin: 0;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-body);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast.warning { background: var(--warning); }

.toast.hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

/* ============================================
   EVENT CARDS
   ============================================ */
.event-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: var(--transition);
    border-left: 4px solid var(--primary);
}

.event-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.event-card .event-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.event-card .event-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 6px 0;
}

.event-card .event-total {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--danger);
}

.event-card .event-breakdown {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.event-card .event-member {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-body);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ============================================
   CHART CONTAINER
   ============================================ */
.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    position: relative;
}

.chart-container h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.chart-container canvas {
    max-height: 300px;
}

/* ============================================
   LIST ITEMS (Recent transactions, etc.)
   ============================================ */
.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.list-item:last-child { border-bottom: none; }

.list-item .item-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.list-item .item-icon.sumbangan { background: var(--success-bg); color: var(--success); }
.list-item .item-icon.perbelanjaan { background: var(--danger-bg); color: var(--danger); }

.list-item .item-info { flex: 1; min-width: 0; }
.list-item .item-info .item-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item .item-info .item-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.list-item .item-amount {
    font-weight: 700;
    font-size: 0.95rem;
    text-align: right;
    white-space: nowrap;
}

.list-item .item-amount.positive { color: var(--success); }
.list-item .item-amount.negative { color: var(--danger); }

/* ============================================
   AHLI AVATAR
   ============================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.avatar-1 { background: linear-gradient(135deg, #f472b6, #ec4899); }
.avatar-2 { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.avatar-3 { background: linear-gradient(135deg, #34d399, #10b981); }
.avatar-4 { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.avatar-5 { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.avatar-6 { background: linear-gradient(135deg, #fb7185, #f43f5e); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    display: block;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 20px;
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-bar .tab-group {
    display: flex;
    background: var(--bg-body);
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
}

.filter-bar .tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
}

.filter-bar .tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.filter-bar .tab-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* ============================================
   LAPORAN / REPORT
   ============================================ */
.report-section {
    margin-bottom: 30px;
}

.report-section h3 {
    font-size: 1.1rem;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.ringkasan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.ringkasan-item {
    text-align: center;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.ringkasan-item .ringkasan-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.ringkasan-item .ringkasan-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================
   FLOATING ACTION BUTTON (Mobile)
   ============================================ */
.fab {
    display: none;
    position: fixed;
    bottom: calc(var(--bottomnav-height) + 20px);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 900;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.fab:hover { transform: scale(1.1); }
.fab:active { transform: scale(0.95); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

@keyframes countUp {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-in {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }

.skeleton {
    background: linear-gradient(90deg, var(--bg-body) 25%, var(--border-color) 50%, var(--bg-body) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

/* ============================================
   BOTTOM NAVIGATION (Mobile)
   ============================================ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,0,0,0.06);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 20px rgba(0,0,0,0.06);
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--bottomnav-height);
}

.bottom-nav .nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    gap: 2px;
    position: relative;
    min-width: 56px;
    letter-spacing: 0.2px;
}

.bottom-nav .nav-tab i {
    font-size: 1.4rem;
    transition: all 0.2s ease;
}

.bottom-nav .nav-tab.active {
    color: var(--primary);
}

.bottom-nav .nav-tab.active i {
    transform: scale(1.15);
}

.bottom-nav .nav-tab.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 0 0 4px 4px;
}

.bottom-nav .nav-tab:active {
    transform: scale(0.9);
    opacity: 0.7;
}

/* ============================================
   MOBILE APP BAR
   ============================================ */
.mobile-appbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--gradient-primary);
    color: white;
    padding: 12px 20px 14px;
    padding-top: max(12px, env(safe-area-inset-top, 12px));
    box-shadow: 0 2px 16px rgba(99, 102, 241, 0.3);
}

.mobile-appbar h1 {
    color: white;
    font-size: 1.15rem;
    margin: 0;
    letter-spacing: -0.3px;
}

.mobile-appbar .app-subtitle {
    font-size: 0.72rem;
    opacity: 0.75;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.mobile-appbar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-tahun-wrap {
    flex-shrink: 0;
}

.mobile-tahun-select {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.mobile-tahun-select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.6);
    background-color: rgba(255,255,255,0.3);
}

.mobile-tahun-select option {
    color: var(--text-primary);
    background: var(--bg-card);
}

/* ============================================
   MOBILE CARD LIST (replaces tables)
   ============================================ */
.mobile-card-list {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.mobile-card-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition-fast);
}

.mobile-card-item:active {
    transform: scale(0.98);
    background: var(--bg-body);
}

/* ============================================
   RESPONSIVE — TABLET
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .main-content {
        margin-left: 220px;
    }
    .page-content {
        padding: 20px;
    }
    .topbar {
        padding: 14px 20px;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (<= 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Hide PC elements */
    .sidebar { display: none !important; }
    .topbar { display: none !important; }
    .desktop-only { display: none !important; }

    /* Show mobile elements */
    .mobile-appbar { display: block !important; }
    .bottom-nav { display: block !important; }
    .fab { display: flex !important; }
    .mobile-card-list { display: flex !important; }
    .mobile-only { display: block !important; }

    /* Reset main content */
    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 16px;
        padding-bottom: calc(var(--bottomnav-height) + 80px);
    }

    /* Stat cards in 2-column grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stat-card {
        padding: 16px;
        border-radius: var(--radius);
    }

    .stat-card .stat-value {
        font-size: 1.3rem;
    }

    .stat-card .stat-label {
        font-size: 0.78rem;
    }

    .stat-card .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    /* Hero card */
    .hero-stat {
        padding: 24px 20px;
        border-radius: var(--radius-lg);
        margin-bottom: 16px;
    }

    .hero-stat .hero-value {
        font-size: 2rem;
    }

    /* Tables → Cards on mobile */
    .table-container .desktop-table { display: none; }

    /* Filter bar scroll */
    .filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    /* Cards */
    .card-body { padding: 16px; }

    /* Modals: slide up from bottom (native bottom-sheet) */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 90vh;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .modal-overlay.show .modal-content {
        transform: translateY(0);
    }

    /* Bottom-sheet handle bar */
    .modal-content::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--border-color);
        border-radius: 4px;
        margin: 10px auto 4px;
    }

    /* Event cards */
    .event-card { padding: 16px; }

    /* Report grid */
    .ringkasan-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Sumbangan grid: scrollable */
    .sumbangan-grid {
        margin: 0 -16px;
        padding: 0 16px;
    }

    /* Toast */
    .toast-container {
        top: auto;
        bottom: calc(var(--bottomnav-height) + 20px);
        right: 16px;
        left: 16px;
    }

    .toast { min-width: auto; }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (<= 375px)
   ============================================ */
@media (max-width: 375px) {
    .hero-stat .hero-value { font-size: 1.7rem; }
    .stat-card .stat-value { font-size: 1.1rem; }
    .page-content { padding: 12px; }
}

/* ============================================
   PWA INSTALL BANNER
   ============================================ */
.pwa-install-banner {
    display: none;
    position: fixed;
    bottom: calc(var(--bottomnav-height) + env(safe-area-inset-bottom, 0px) + 12px);
    left: 16px;
    right: 16px;
    background: var(--gradient-dark);
    color: white;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    z-index: 1100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    animation: fadeInUp 0.4s ease;
    align-items: center;
    gap: 14px;
}

.pwa-install-banner.show {
    display: flex;
}

/* Hide PWA banner on PC/desktop */
@media (min-width: 769px) {
    .pwa-install-banner,
    .pwa-install-banner.show {
        display: none !important;
    }
}

.pwa-install-banner .pwa-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.pwa-install-banner .pwa-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-banner .pwa-text strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
}

.pwa-install-banner .pwa-text span {
    font-size: 0.75rem;
    opacity: 0.75;
}

.pwa-install-banner .pwa-btn {
    padding: 8px 18px;
    background: white;
    color: var(--primary-dark);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.pwa-install-banner .pwa-btn:active {
    transform: scale(0.95);
}

.pwa-install-banner .pwa-close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

/* ============================================
   STANDALONE MODE (Added to Homescreen)
   ============================================ */
@media (display-mode: standalone) {
    .mobile-appbar {
        padding-top: max(20px, env(safe-area-inset-top, 20px));
    }

    .pwa-install-banner { display: none !important; }
}

/* iOS standalone */
@media (display-mode: standalone) and (-webkit-min-device-pixel-ratio: 2) {
    body {
        padding-top: 0;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar, .bottom-nav, .topbar, .mobile-appbar, .fab,
    .btn, .modal-overlay, .toast-container, .filter-bar { display: none !important; }

    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }

    body { background: white; }
    .card, .stat-card, .table-container {
        box-shadow: none;
        break-inside: avoid;
    }

    .table { font-size: 0.85rem; }
    .table thead th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-sm { font-size: 0.85rem; }
.fs-xs { font-size: 0.75rem; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
