/* ============================================
   DASHBOARD KPI CARDS — Mobile First
   ============================================ */

/* ---------- Welcome header row ---------- */
.kpi-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-header__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: -0.03em;
}

.kpi-header__filter {
    align-self: flex-start;
}

@media (min-width: 768px) {
    .kpi-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .kpi-header__title {
        font-size: 2rem;
    }
    .kpi-header__filter {
        align-self: center;
    }
}

/* ---------- KPI wrapper (hero + secondary) ---------- */
.kpi-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 1024px) {
    .kpi-wrapper {
        flex-direction: row;
        gap: 20px;
    }
}

/* ---------- Hero Card (Total Sales) ---------- */
.kpi-hero {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 60%, #334155 100%);
    border-radius: 20px;
    padding: 28px 24px 20px;
    position: relative;
    overflow: hidden;
    color: #fff;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .kpi-hero {
        width: 38%;
        min-width: 340px;
    }
}

/* Decorative wave */
.kpi-hero::before {
    content: '';
    position: absolute;
    bottom: -40px;
    right: -40px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.kpi-hero::after {
    content: '';
    position: absolute;
    top: -30px;
    right: 60px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}

.kpi-hero__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    margin-bottom: 4px;
}

.kpi-hero__value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 20px;
    font-family: 'Inter', ui-monospace, monospace;
}

@media (min-width: 768px) {
    .kpi-hero__value {
        font-size: 2.5rem;
    }
}

/* Sub-cards inside hero - stacking on mobile */
.kpi-hero__subcards {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    position: relative;
    z-index: 1;
}

@media (min-width: 641px) {
    .kpi-hero__subcards {
        flex-direction: row !important;
    }
}

.kpi-hero__subcard {
    flex: 1;
    width: 100%; /* Force full width on mobile */
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (min-width: 641px) {
    .kpi-hero__subcard {
        width: auto; /* Reset for desktop row */
    }
}

.kpi-hero__subcard-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.kpi-hero__subcard-icon--expense {
    background: #EF4444;
    color: #fff;
}

.kpi-hero__subcard-icon--net {
    background: #10B981;
    color: #fff;
}

.kpi-hero__subcard-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    font-family: 'Inter', ui-monospace, monospace;
}

.kpi-hero__subcard-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}

.kpi-hero__footer {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

/* ---------- Secondary KPI grid ---------- */
.kpi-secondary-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
    flex: 1;
}

.kpi-secondary-card {
    padding: 18px 22px;
    border-bottom: 1px solid #F1F5F9;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-secondary-card:last-child {
    border-bottom: none;
}

.kpi-secondary-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpi-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kpi-dot--blue      { background: #3B82F6; }
.kpi-dot--orange    { background: #F59E0B; }
.kpi-dot--green     { background: #10B981; }
.kpi-dot--pink      { background: #EC4899; }
.kpi-dot--indigo    { background: #6366F1; }
.kpi-dot--amber     { background: #F97316; }

.kpi-secondary-card__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748B;
}

.kpi-secondary-card__value {
    font-size: 1.375rem;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: -0.02em;
    font-family: 'Inter', ui-monospace, monospace;
    line-height: 1.2;
}

/* Desktop: 3-column grid */
@media (min-width: 1024px) {
    .kpi-secondary-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0;
    }

    .kpi-secondary-card {
        border-bottom: 1px solid #F1F5F9;
        border-right: 1px solid #F1F5F9;
        padding: 22px 24px;
    }

    /* Remove right border on every 3rd card */
    .kpi-secondary-card:nth-child(3n) {
        border-right: none;
    }

    /* Remove bottom border on last row */
    .kpi-secondary-card:nth-last-child(-n+3) {
        border-bottom: none;
    }

    .kpi-secondary-card__value {
        font-size: 1.5rem;
    }
}
