/* ───────────────────────────────────────────────────
   Dashboard  –  db- namespace
   ─────────────────────────────────────────────────── */

/* ── Stat Cards ─────────────────────────────────── */

.db-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.db-stat {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 1rem 1.1rem 0.85rem;
    overflow: hidden;
    box-shadow:
        0 0.46875rem 2.1875rem rgba(4,9,20,.03),
        0 0.9375rem 1.40625rem rgba(4,9,20,.03),
        0 0.25rem 0.53125rem rgba(4,9,20,.05),
        0 0.125rem 0.1875rem rgba(4,9,20,.03);
    transition: transform .18s ease, box-shadow .18s ease;
}

.db-stat:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0.6rem 2.4rem rgba(4,9,20,.06),
        0 1rem 1.6rem rgba(4,9,20,.05),
        0 0.3rem 0.7rem rgba(4,9,20,.08),
        0 0.15rem 0.25rem rgba(4,9,20,.04);
}

/* Colored left accent stripe */
.db-stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    background: var(--db-accent, #f79319);
}

/* Icon circle */
.db-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 1rem;
    color: #fff;
    background: var(--db-accent, #f79319);
    margin-bottom: 0.65rem;
    flex-shrink: 0;
}

.db-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.15;
}

/* Accent color per card (set via inline --db-accent variable) */
.db-stat--cyan  { --db-accent: #01b2c6; }
.db-stat--purple { --db-accent: #5427b6; }
.db-stat--magenta { --db-accent: #ad00b2; }
.db-stat--amber  { --db-accent: #f8af0c; }
.db-stat--red    { --db-accent: #ff4141; }
.db-stat--crimson { --db-accent: #ad0000; }

/* ── Week Range Picker ──────────────────────────── */

.db-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.db-range-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
}

.db-range select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right 0.6rem center / 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.db-range select:focus {
    outline: none;
    border-color: #f79319;
    box-shadow: 0 0 0 3px rgba(247,147,25,.12);
}

.db-range-sep {
    color: #9ca3af;
    font-size: 0.85rem;
}

.dashboard-sync-fab {
	display: none;
}

/* ── Chart Cards ────────────────────────────────── */

.db-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.db-chart-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow:
        0 0.46875rem 2.1875rem rgba(4,9,20,.03),
        0 0.9375rem 1.40625rem rgba(4,9,20,.03),
        0 0.25rem 0.53125rem rgba(4,9,20,.05),
        0 0.125rem 0.1875rem rgba(4,9,20,.03);
}

.db-chart-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #374151;
    letter-spacing: 0.02em;
}

.db-chart-header i {
    color: #f79319;
    font-size: 0.9rem;
}

/* Keep .kpi-body class for JS compat (dynamic height) */
.db-chart-card .kpi-body {
    padding: 0.75rem 1rem 1rem;
    background: #fff;
}

/* ── Responsive ─────────────────────────────────── */

@media (max-width: 1199.98px) {
    .db-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767.98px) {
		.db-range {
			justify-content: space-between;
		}
    .db-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .db-charts {
        grid-template-columns: 1fr;
    }
    .db-stat-value {
        font-size: 1.35rem;
    }
    .dashboard-sync-fab {
        display: inline-flex;
        position: fixed;
        right: 1rem;
        bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
        width: 3.25rem;
        height: 3.25rem;
        padding: 0;
        border-radius: 9999px;
        align-items: center;
        justify-content: center;
        z-index: 300;
    }
    .dashboard-sync-fab i {
        margin: 0;
    }
}

@media (max-width: 479.98px) {
    .db-stats {
        grid-template-columns: 1fr 1fr;
    }
    .db-stat {
        padding: 0.75rem 0.85rem 0.65rem;
    }
    .db-stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}
