.loan-dashboard-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f8f9fa;
    border-radius: 12px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px 25px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.last-updated {
    color: #6c757d;
    font-size: 14px;
    background: #f8f9fa;
    padding: 6px 14px;
    border-radius: 20px;
}

.btn-export {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.global-filters {
    background: #fff;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.filter-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group label {
    font-weight: 600;
    color: #495057;
}

.filter-select, .filter-input {
    padding: 8px 14px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.filter-select:focus, .filter-input:focus {
    border-color: #0d5b06;
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 91, 6, 0.1);
}

.filter-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dashboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    background: #fff;
    padding: 12px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tab-btn.active {
    background-color: #e4b914 !important;
    color: #0d5b06 !important;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 18px;
}

.loading:after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #0d5b06;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-card h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #212529;
    line-height: 1.2;
}

/* Charts */
.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.chart-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.chart-card h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 16px;
}

.chart-card canvas {
    max-height: 300px;
    max-width: 100%;
}

/* Tables */
.table-container, .defaulters-table-container, .customer-table-container,
.installment-table-container, .payment-details-table, .customer-payment-table {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: auto;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 10;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

/* Status badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-running { background: #d4edda; color: #155724; }
.status-paid { background: #cce5ff; color: #004085; }
.status-defaulted { background: #f8d7da; color: #721c24; }
.status-excellent { background: #d4edda; color: #155724; }
.status-good { background: #fff3cd; color: #856404; }
.status-attention { background: #f8d7da; color: #721c24; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 950px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
}

.close-modal {
    color: #aaa;
    position: sticky;
    top: 10px;
    right: 20px;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 20;
    background: #fff;
    padding: 0 10px;
    border-radius: 50%;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

#customer-detail-content, #payment-detail-content, #receipt-content {
    padding: 30px;
}

/* Receipt */
#receipt-content {
    background: #f8f9fa;
}

/* Responsive */
@media (max-width: 768px) {
    .loan-dashboard-wrapper {
        padding: 10px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
    }
    
    .dashboard-header h1 {
        font-size: 22px;
    }
    
    .dashboard-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    #customer-detail-content, #payment-detail-content, #receipt-content {
        padding: 15px;
    }
    
    .chart-container {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-group {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-select, .filter-input {
        width: 100%;
        min-width: unset;
    }
}