/* ========== KPI Row ========== */

.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: box-shadow 0.15s ease;
}

.kpi-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 20px;
    flex-shrink: 0;
}

.kpi-icon-unpaid { background: #fef3c7; color: #d97706; }
.kpi-icon-overdue { background: #fee2e2; color: #dc2626; }
.kpi-icon-paid { background: #d1fae5; color: #059669; }
.kpi-icon-outstanding { background: #dbeafe; color: #2563eb; }
.kpi-icon-queue { background: #e0e7ff; color: #4f46e5; }

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.kpi-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

/* ========== Dashboard Grid ========== */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.dashboard-panel-full {
    grid-column: 1 / -1;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.panel-title i {
    margin-right: 8px;
    color: #059669;
}

.panel-body {
    padding: 20px;
}

/* ========== Status Distribution ========== */

.status-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-bar-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-bar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-bar-count {
    margin-left: auto;
    font-weight: 600;
    color: #1e293b;
}

.status-bar-track {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.status-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.status-dot.status-draft, .status-bar-fill.status-draft { background-color: #94a3b8; }
.status-dot.status-sent, .status-bar-fill.status-sent { background-color: #3b82f6; }
.status-dot.status-partial, .status-bar-fill.status-partial { background-color: #f59e0b; }
.status-dot.status-paid, .status-bar-fill.status-paid { background-color: #10b981; }
.status-dot.status-overdue, .status-bar-fill.status-overdue { background-color: #ef4444; }
.status-dot.status-void, .status-bar-fill.status-void { background-color: #475569; }

/* ========== Status Badges ========== */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.status-badge.status-draft { background: #f1f5f9; color: #475569; }
.status-badge.status-sent { background: #dbeafe; color: #1e40af; }
.status-badge.status-partial { background: #fef3c7; color: #92400e; }
.status-badge.status-paid { background: #d1fae5; color: #065f46; }
.status-badge.status-overdue { background: #fee2e2; color: #991b1b; }
.status-badge.status-void { background: #e2e8f0; color: #334155; }

/* ========== Aging Summary ========== */

.aging-buckets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.aging-bucket {
    text-align: center;
    padding: 14px 8px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.aging-bucket-value {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.aging-bucket-label {
    font-size: 12px;
    color: #64748b;
}

.aging-current { border-color: #10b981; }
.aging-current .aging-bucket-value { color: #059669; }

.aging-30 { border-color: #f59e0b; }
.aging-30 .aging-bucket-value { color: #d97706; }

.aging-60 { border-color: #f97316; }
.aging-60 .aging-bucket-value { color: #ea580c; }

.aging-90 { border-color: #ef4444; }
.aging-90 .aging-bucket-value { color: #dc2626; }

.aging-over90 { border-color: #991b1b; }
.aging-over90 .aging-bucket-value { color: #991b1b; }

.aging-total {
    text-align: right;
    font-size: 14px;
    color: #64748b;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

/* ========== Invoice Link ========== */

.invoice-link {
    color: #1e40af;
    font-weight: 600;
    text-decoration: none;
}

.invoice-link:hover {
    text-decoration: underline;
}

/* ========== Responsive ========== */

@media (max-width: 1200px) {
    .kpi-row {
        grid-template-columns: repeat(3, 1fr);
    }

    .aging-buckets {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .kpi-row {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .aging-buckets {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .kpi-row {
        grid-template-columns: 1fr;
    }
}