/* ═══════════════════════════════════════════════════
   KPI Dashboard (Module 3.4)
   ═══════════════════════════════════════════════════ */

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.kpi-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #e4e6eb;
    margin: 0;
}

.kpi-header select {
    background: #1e2030;
    border: 1px solid #2d3045;
    color: #b8bcc8;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
}

/* Stats row */
.kpi-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.kpi-stat-card {
    background: #1e2030;
    border: 1px solid #2d3045;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.kpi-stat-card.warn {
    border-color: rgba(245, 158, 11, 0.3);
}

.kpi-stat-icon {
    font-size: 24px;
}

.kpi-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #e4e6eb;
    margin: 4px 0;
}

.kpi-stat-label {
    font-size: 12px;
    color: #8b8d94;
}

.kpi-stat-sub {
    font-size: 11px;
    color: #6b7085;
    margin-top: 2px;
}

/* Section */
.kpi-section {
    margin-bottom: 24px;
}

.kpi-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #d0d2db;
    margin: 0 0 12px;
}

/* Table */
.kpi-table-wrap {
    overflow-x: auto;
}

.kpi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.kpi-table th {
    text-align: left;
    padding: 8px 12px;
    background: #181926;
    color: #8b8d94;
    font-weight: 500;
    border-bottom: 1px solid #2d3045;
}

.kpi-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #1e2030;
    color: #d0d2db;
}

.kpi-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.kpi-rate {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.kpi-rate-good {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.kpi-rate-ok {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.kpi-rate-low {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Approval bars */
.kpi-approval-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kpi-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #b8bcc8;
}

.kpi-bar-item>span:first-child {
    width: 100px;
    flex-shrink: 0;
}

.kpi-bar-item>span:last-child {
    width: 40px;
    text-align: right;
    flex-shrink: 0;
}

.kpi-bar {
    flex: 1;
    height: 8px;
    background: #1e2030;
    border-radius: 4px;
    overflow: hidden;
}

.kpi-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.kpi-bar-green {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.kpi-bar-yellow {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.kpi-bar-blue {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.kpi-empty,
.kpi-error {
    text-align: center;
    padding: 24px;
    color: #6b7085;
    font-size: 13px;
}

.kpi-error {
    color: #ef4444;
}