/* ============================================
   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.25rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.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: 1.75rem;
    }
    .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: #0f172a;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    color: #fff;
    flex-shrink: 0;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

@media (min-width: 1024px) {
    .kpi-hero {
        width: 33%;
        min-width: 300px;
    }
}

/* Removed decorative wave circles for a simpler, sleeker look */

.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: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (min-width: 768px) {
    .kpi-hero__value {
        font-size: 2.125rem;
    }
}

/* 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%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

@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.875rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.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: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    flex: 1;
}

.kpi-secondary-card {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.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.25rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    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: 18px 20px;
    }

    /* 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.375rem;
    }
}
