/* ── Dashboard wrapper ── */
.dashboard-container {
    background: white;
    border-radius: 20px;
    margin: 24px 0;
    overflow: hidden;
}

/* ── Compact stat cards ── */
.stat-card {
    border: none;
    border-radius: 12px;
    transition: transform .25s ease, box-shadow .25s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12) !important;
}
.stat-card .card-body {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-text { line-height: 1; }
.stat-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}
.stat-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ── Search ── */
.search-box {
    border-radius: 10px;
    border: 2px solid var(--border-color);
    padding: 10px 16px;
    font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
}
.search-box:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ── Table ── */
.table-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
}
.table thead { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.table thead th {
    border: none; padding: 14px 12px;
    font-weight: 600; text-transform: uppercase;
    font-size: 12px; letter-spacing: .5px;
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #f9fafb; }
.table tbody td { padding: 14px 12px; vertical-align: middle; border-bottom: 1px solid #f3f4f6; font-size: 14px; }
.badge { padding: 5px 10px; font-weight: 600; border-radius: 6px; font-size: 11px; }

/* ── Progress bars ── */
.repayment-progress {
    min-width: 180px;
}
.progress-bar-container {
    background: #e9ecef;
    border-radius: 8px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 4px;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 8px;
    transition: width .4s ease;
}
.progress-bar-fill.progress-green { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-bar-fill.progress-yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-bar-fill.progress-red { background: linear-gradient(90deg, #ef4444, #f87171); }
.progress-bar-fill.progress-complete { background: linear-gradient(90deg, #10b981, #059669); }
.progress-text {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.3;
}

/* ── Status badges ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.overdue-indicator {
    display: inline-block;
    margin-top: 4px;
}

/* ── Pagination ── */
.pagination-container {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; background: #f9fafb;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap; gap: 10px;
    font-size: 13px;
}
.pagination-btn {
    border: 1px solid #d1d5db; background: white;
    padding: 6px 14px; border-radius: 8px;
    cursor: pointer; transition: all .2s; font-size: 13px;
}
.pagination-btn:hover:not(:disabled) { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.pagination-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── No results ── */
.no-results { text-align: center; padding: 50px 20px; color: #9ca3af; }
.no-results i { font-size: 52px; margin-bottom: 16px; display: block; }

/* ── Toast notification ── */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
}
.toast-msg {
    min-width: 280px; padding: 14px 18px;
    border-radius: 10px; color: white; font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    animation: slideIn .3s ease;
}
.toast-msg.success { background: #10b981; }
.toast-msg.error   { background: #ef4444; }
@keyframes slideIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { to   { opacity: 0; transform: translateX(60px); } }

/* ── Spinner overlay ── */
.btn-loading { position: relative; pointer-events: none; opacity: .75; }
.btn-loading::after {
    content: '';
    position: absolute; right: 12px; top: 50%; margin-top: -8px;
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: white;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Installment modal table ── */
.installment-table {
    width: 100%;
    border-collapse: collapse;
}
.installment-table th {
    background: #f8f9fa;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}
.installment-table td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.installment-table tr.row-paid { background: #f0fdf4; }
.installment-table tr.row-overdue { background: #fef2f2; }
.installment-table tr.row-pending { background: #fff; }

/* ── Modal summary ── */
.modal-summary {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.modal-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}
.modal-summary .summary-label { color: #6c757d; }
.modal-summary .summary-value { font-weight: 600; }

/* ── Pay multiple section ── */
.pay-multiple-section select.form-select {
    border: 2px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

/* ── Confirmation section ── */
.confirm-section {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    margin-top: 14px;
}

/* ── Responsive ── */
@media (max-width: 576px) {
    .stat-value { font-size: 18px; }
    .repayment-progress { min-width: 120px; }
}
