﻿/* ============================================
   DATOS / DASHBOARD — CUSTOM STYLES
   Extends styles.css shared base
   ============================================ */

/* --- BODY OVERRIDE: allow scroll --- */
body {
    overflow: hidden;
}

.dash-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.dash-center {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px 80px;
}

/* --- PAGE TITLE --- */
.page-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: #1a1a1a;
    margin-bottom: 14px;
    font-family: var(--font);
}

/* ============================================
   CAMPAIGN STATUS BAR
   ============================================ */
.campaign-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1a1a;
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 0.72rem;
    font-weight: 700;
}

.campaign-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
}

.status-dot.active {
    background: #4CAF50;
    box-shadow: 0 0 6px #4CAF50;
    animation: dotPulse 2s infinite;
}

@keyframes dotPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.campaign-days {
    color: #ccc;
    font-weight: 600;
}

/* ============================================
   NIVEL 1: KPI CARDS
   ============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    background: var(--card-surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.kpi-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1a1a1a;
    font-family: var(--font);
    line-height: 1.1;
}

.kpi-value.alert {
    color: var(--brand-red);
}

.kpi-trend {
    font-size: 0.6rem;
    font-weight: 700;
    margin-top: 4px;
}

.kpi-trend.up {
    color: #2E7D32;
}

.kpi-trend.down {
    color: var(--brand-red);
}

.kpi-sub {
    font-size: 0.6rem;
    color: var(--text-gray);
    font-weight: 600;
    margin-top: 4px;
}

.kpi-sparkline {
    position: absolute;
    bottom: 8px;
    right: 12px;
    width: 60px;
    height: 24px;
}

.kpi-sparkline svg {
    width: 100%;
    height: 100%;
}

/* KPI alert */
.kpi-alert {
    font-size: 0.58rem;
    font-weight: 700;
    color: #D84315;
    background: #FBE9E7;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    display: inline-block;
}

.kpi-alert.hidden {
    display: none;
}

/* KPI progress bar */
.kpi-progress-bar {
    height: 5px;
    background: #eee;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.kpi-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-red), #FF6B35);
    border-radius: 4px;
    transition: width 1s ease-out;
    width: 0;
}

/* ============================================
   NIVEL 2: CHARTS ROW
   ============================================ */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 12px;
    margin-bottom: 16px;
}

.chart-card {
    background: var(--card-surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
}

.chart-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 0;
    font-family: var(--font);
}

/* --- CHART HEADER (title + toggle) --- */
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.chart-header .chart-title {
    margin-bottom: 0;
}

/* --- PERIOD / DIMENSION TOGGLE PILLS --- */
.period-toggle,
.dimension-toggle {
    display: flex;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
}

.period-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.58rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    background: transparent;
    color: #777;
    transition: all 0.2s;
    white-space: nowrap;
}

.period-btn:hover {
    color: #333;
}

.period-btn.active {
    background: #1a1a1a;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Full-width charts row */
.charts-row-full {
    grid-template-columns: 1fr;
}

/* --- FUNNEL (pure CSS) --- */
.funnel-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.funnel-step {
    display: flex;
    align-items: center;
    gap: 10px;
}

.funnel-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #555;
    min-width: 70px;
    text-align: right;
    flex-shrink: 0;
}

.funnel-bar-track {
    flex: 1;
    height: 28px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.funnel-bar-fill {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: #fff;
    transition: width 1.2s ease-out;
    min-width: 40px;
}

.funnel-bar-fill.step-1 {
    background: linear-gradient(90deg, #1a1a1a, #333);
}

.funnel-bar-fill.step-2 {
    background: linear-gradient(90deg, #555, #777);
}

.funnel-bar-fill.step-3 {
    background: linear-gradient(90deg, var(--brand-red), #FF6B35);
}

.funnel-bar-fill.step-4 {
    background: linear-gradient(90deg, #EA7600, #B91D00);
}

.funnel-arrow {
    font-size: 0.6rem;
    color: #aaa;
    text-align: center;
    padding-left: 80px;
}

/* --- CHART CANVAS --- */
.chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 250px;
}

.chart-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ============================================
   NIVEL 3: TABLES ROW
   ============================================ */
.tables-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.table-card {
    background: var(--card-surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
}

.dash-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}

.dash-table thead tr {
    background: #1a1a1a;
    color: #fff;
}

.dash-table th {
    padding: 8px 10px;
    font-weight: 700;
    text-align: left;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dash-table th:first-child {
    border-radius: 6px 0 0 0;
}

.dash-table th:last-child {
    border-radius: 0 6px 0 0;
}

.dash-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    color: #333;
}

.dash-table tbody tr:hover {
    background: #fafafa;
}

.dash-table tbody tr:last-child td {
    border-bottom: none;
}

/* Fraud alert badge */
.fraud-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #FFEBEE;
    color: #C96500;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.55rem;
    font-weight: 800;
    white-space: nowrap;
}

.fraud-badge.clean {
    background: #E8F5E9;
    color: #2E7D32;
}

/* Participation bar */
.part-bar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.part-bar-track {
    width: 50px;
    height: 5px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.part-bar-fill {
    height: 100%;
    background: var(--brand-red);
    border-radius: 4px;
}

/* ============================================
   NIVEL 4: BANNER
   ============================================ */
.banner-section {
    margin-bottom: 16px;
}

.banner-card {
    background: var(--card-surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-card);
}

.banner-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.banner-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.banner-slot {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    border: 1px dashed #ddd;
    transition: border-color 0.2s;
}

.banner-slot:hover {
    border-color: var(--brand-red);
}

.banner-slot-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: #555;
    margin-bottom: 4px;
}

.banner-slot-value {
    font-size: 0.9rem;
    font-weight: 900;
    color: #1a1a1a;
}

.banner-slot-sub {
    font-size: 0.55rem;
    color: #999;
    font-weight: 600;
    margin-top: 2px;
}

/* ============================================
   NIVEL 5: LOYALTY & REWARDS
   ============================================ */

/* Section Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 16px;
}

.section-divider-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.section-divider-title {
    font-size: 0.85rem;
    font-weight: 900;
    color: #1a1a1a;
    font-family: var(--font);
    white-space: nowrap;
    flex-shrink: 0;
}

.section-divider-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, #ddd, transparent);
    border-radius: 1px;
}

/* Loyalty KPI Cards */
.kpi-loyalty {
    border-left: 3px solid var(--brand-red);
}

/* Premio Funnel */
.premio-funnel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pf-step {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pf-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: #555;
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
    line-height: 1.2;
}

.pf-bar-track {
    flex: 1;
    height: 30px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    position: relative;
}

.pf-bar-redeemed {
    height: 100%;
    background: linear-gradient(90deg, #2E7D32, #43A047);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 800;
    color: #fff;
    transition: width 1.2s ease-out;
    min-width: 0;
}

.pf-bar-unlocked {
    height: 100%;
    background: linear-gradient(90deg, #FFB300, #FFC107);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 800;
    color: #333;
    transition: width 1.2s ease-out;
    min-width: 0;
}

.pf-total {
    font-size: 0.6rem;
    font-weight: 800;
    color: #333;
    min-width: 40px;
    flex-shrink: 0;
}

/* Funnel Legend */
.funnel-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #666;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-unlocked {
    background: #FFB300;
}

.legend-redeemed {
    background: #2E7D32;
}

/* Loyalty Charts Row */
.charts-row-loyalty {
    grid-template-columns: 1.2fr 1fr;
}

/* Real-Time Cards Grid */
.realtime-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.rt-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f8f8;
    border-radius: 10px;
    padding: 12px;
    transition: transform 0.2s;
}

.rt-card:hover {
    transform: translateY(-1px);
}

.rt-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.rt-data {
    display: flex;
    flex-direction: column;
}

.rt-value {
    font-size: 1rem;
    font-weight: 900;
    color: #1a1a1a;
    font-family: var(--font);
    line-height: 1.1;
}

.rt-label {
    font-size: 0.52rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Full-width table row */
.tables-row-full {
    grid-template-columns: 1fr;
}

/* Heat Map Badges */
.heat-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.55rem;
    font-weight: 800;
    white-space: nowrap;
}

.heat-badge.critical {
    background: #FFEBEE;
    color: #C96500;
}

.heat-badge.warning {
    background: #FFF3E0;
    color: #E65100;
}

.heat-badge.ok {
    background: #E8F5E9;
    color: #2E7D32;
}

/* ============================================
   FILTER FAB
   ============================================ */
.filter-fab {
    position: fixed;
    bottom: 60px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--brand-red);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(234, 118, 0, 0.35);
    z-index: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.filter-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(234, 118, 0, 0.45);
}

.filter-fab:active {
    transform: scale(0.95);
}

.fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.5rem;
    font-weight: 900;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-badge.hidden {
    display: none;
}

/* ============================================
   FILTER DRAWER (Bottom Sheet)
   ============================================ */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.filter-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.filter-overlay.hidden {
    display: none;
}

.filter-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 16px 24px 30px;
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    margin: 0 auto;
    max-height: 80vh;
    overflow-y: auto;
}

.filter-drawer.visible {
    transform: translateY(0);
}

.drawer-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 0 auto 14px;
}

.drawer-title {
    font-size: 1rem;
    font-weight: 900;
    color: #1a1a1a;
    margin-bottom: 16px;
    font-family: var(--font);
}

.filter-group {
    margin-bottom: 14px;
}

.filter-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #555;
    margin-bottom: 4px;
    display: block;
}

.filter-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.78rem;
    font-family: var(--font);
    font-weight: 600;
    color: #333;
    background: #fafafa;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.filter-input:focus {
    outline: none;
    border-color: var(--brand-red);
    background: #fff;
}

.filter-dates-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-dates-row .filter-input {
    flex: 1;
}

.filter-sep {
    color: #aaa;
    font-weight: 700;
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.filter-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.2s, transform 0.2s;
}

.filter-btn-apply {
    background: var(--brand-red);
    color: #fff;
}

.filter-btn-apply:hover {
    background: #b91d00;
}

.filter-btn-clear {
    background: #f0f0f0;
    color: #555;
}

.filter-btn-clear:hover {
    background: #e0e0e0;
}

/* ============================================
   RESPONSIVE — MOBILE FIRST
   ============================================ */
@media (max-width: 900px) {
    .charts-row {
        grid-template-columns: 1fr;
    }

    .tables-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {

    .dash-center {
        padding: 10px 10px 80px;
    }

    .page-title {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .period-toggle,
    .dimension-toggle {
        width: 100%;
        justify-content: center;
    }

    .period-btn {
        flex: 1;
        text-align: center;
    }

    .kpi-card {
        padding: 12px;
    }

    .kpi-value {
        font-size: 1.2rem;
    }

    .kpi-label {
        font-size: 0.55rem;
    }

    .campaign-bar {
        font-size: 0.62rem;
        padding: 6px 12px;
    }

    .chart-card {
        padding: 12px;
    }

    .chart-title {
        font-size: 0.7rem;
    }

    .chart-canvas-wrap {
        height: 200px;
    }

    .funnel-label {
        min-width: 55px;
        font-size: 0.58rem;
    }

    .funnel-bar-track {
        height: 24px;
    }

    .funnel-bar-fill {
        font-size: 0.58rem;
    }

    .banner-slots {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 6px;
    }

    .dash-table {
        font-size: 0.62rem;
    }

    .dash-table th,
    .dash-table td {
        padding: 6px 8px;
    }

    .filter-fab {
        bottom: 50px;
        right: 14px;
        width: 44px;
        height: 44px;
    }

    .charts-row-loyalty {
        grid-template-columns: 1fr;
    }

    .pf-label {
        min-width: 60px;
        font-size: 0.55rem;
    }

    .pf-bar-track {
        height: 26px;
    }

    .rt-value {
        font-size: 0.85rem;
    }

    .section-divider-title {
        font-size: 0.75rem;
    }

    /* Heat map table — responsive */
    .tables-row-full .dash-table {
        font-size: 0.58rem;
    }

    .tables-row-full .dash-table th,
    .tables-row-full .dash-table td {
        padding: 5px 6px;
        white-space: nowrap;
    }

    .heat-badge {
        font-size: 0.48rem;
        padding: 2px 6px;
    }
}

@media (max-width: 420px) {

    .kpi-value {
        font-size: 1rem;
    }

    .kpi-label {
        font-size: 0.5rem;
    }

    .kpi-card {
        padding: 10px;
    }

    .funnel-label {
        min-width: 45px;
        font-size: 0.52rem;
    }

    .funnel-bar-track {
        height: 20px;
    }

    .banner-slots {
        grid-template-columns: 1fr;
    }

    .chart-canvas-wrap {
        height: 170px;
    }

    .page-title {
        font-size: 0.95rem;
    }

    .pf-label {
        min-width: 50px;
        font-size: 0.5rem;
    }

    .pf-bar-track {
        height: 22px;
    }

    .pf-bar-redeemed,
    .pf-bar-unlocked {
        font-size: 0.5rem;
    }

    .realtime-grid {
        grid-template-columns: 1fr;
    }

    .rt-card {
        padding: 10px;
    }

    .rt-value {
        font-size: 0.78rem;
    }

    .section-divider {
        margin: 18px 0 12px;
    }
}

/* ============================================
   DARK THEME OVERRIDES FOR DATOS DASHBOARD
   ============================================ */
body.dark-theme .page-title,
body.dark-theme .kpi-value,
body.dark-theme .chart-title,
body.dark-theme .banner-label,
body.dark-theme .banner-slot-value,
body.dark-theme .section-divider-title,
body.dark-theme .rt-value,
body.dark-theme .drawer-title {
    color: #ffffff;
}

body.dark-theme .kpi-label,
body.dark-theme .kpi-sub,
body.dark-theme .banner-slot-sub,
body.dark-theme .pf-label,
body.dark-theme .rt-label,
body.dark-theme .filter-label {
    color: #cccccc;
}

body.dark-theme .dash-table td {
    color: #dddddd;
    border-bottom: 1px solid #333333;
}

body.dark-theme .dash-table tbody tr:hover {
    background: #2a2a2a;
}

body.dark-theme .period-btn {
    color: #aaaaaa;
}

body.dark-theme .period-btn:hover {
    color: #ffffff;
}

body.dark-theme .period-toggle,
body.dark-theme .dimension-toggle {
    background: #444444;
}

body.dark-theme .period-btn.active {
    background: #EA7600;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(234, 118, 0, 0.4);
}

body.dark-theme .funnel-label {
    color: #cccccc;
}

body.dark-theme .funnel-bar-track,
body.dark-theme .pf-bar-track {
    background: #333333;
}

body.dark-theme .rt-card,
body.dark-theme .banner-slot {
    background: #222222;
    border-color: #444444;
}

body.dark-theme .legend-item {
    color: #cccccc;
}

body.dark-theme .filter-drawer {
    background: #1a1a1a;
    border-color: #2a2a2a;
}

body.dark-theme .filter-input {
    background: #333333;
    color: #ffffff;
    border-color: #555555;
}

body.dark-theme .filter-btn-clear {
    background: #444444;
    color: #ffffff;
}

body.dark-theme .kpi-progress-bar {
    background: #333;
}

body.dark-theme .campaign-bar {
    background: #111;
    border: 1px solid #333;
}

body.dark-theme .campaign-days {
    color: #999;
}

body.dark-theme .banner-slot-label {
    color: #bbb;
}

body.dark-theme .fraud-badge {
    background: rgba(198, 40, 40, 0.2);
    color: #ff6b6b;
}

body.dark-theme .fraud-badge.clean {
    background: rgba(46, 125, 50, 0.2);
    color: #66bb6a;
}

body.dark-theme .heat-badge.critical {
    background: rgba(198, 40, 40, 0.15);
    color: #ff6b6b;
}

body.dark-theme .heat-badge.warning {
    background: rgba(230, 81, 0, 0.15);
    color: #ffb74d;
}

body.dark-theme .heat-badge.ok {
    background: rgba(46, 125, 50, 0.15);
    color: #66bb6a;
}

body.dark-theme .kpi-alert {
    background: rgba(216, 67, 21, 0.15);
    color: #ff7043;
}

body.dark-theme .section-divider-line {
    background: linear-gradient(90deg, #444, transparent);
}

body.dark-theme .part-bar-track {
    background: #333;
}

body.dark-theme .filter-overlay.visible {
    background: rgba(0, 0, 0, 0.7);
}

body.dark-theme .drawer-handle {
    background: #555;
}

body.dark-theme .kpi-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

body.dark-theme .filter-sep {
    color: #666;
}

body.dark-theme .pf-total {
    color: #ddd;
}

/* ============================================
   SKELETON LOADING SHIMMER
   ============================================ */
.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: #e8e8e8;
    min-height: 20px;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.5),
            transparent);
    animation: shimmer 1.5s infinite;
}

body.dark-theme .skeleton {
    background: #2a2a2a;
}

body.dark-theme .skeleton::after {
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.skeleton-value {
    display: inline-block;
    width: 80%;
    height: 1.3rem;
}

.skeleton-label {
    display: inline-block;
    width: 60%;
    height: 0.6rem;
}

.skeleton-chart {
    width: 100%;
    height: 200px;
}

.skeleton-row {
    height: 32px;
    margin-bottom: 4px;
}

/* ============================================
   SCROLL-TRIGGERED REVEAL ANIMATIONS
   ============================================ */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children inside revealed sections */
.reveal-on-scroll.revealed .kpi-card,
.reveal-on-scroll.revealed .chart-card,
.reveal-on-scroll.revealed .table-card,
.reveal-on-scroll.revealed .rt-card {
    animation: fadeInUp 0.5s ease-out both;
}

.reveal-on-scroll.revealed .kpi-card:nth-child(1) {
    animation-delay: 0s;
}

.reveal-on-scroll.revealed .kpi-card:nth-child(2) {
    animation-delay: 0.06s;
}

.reveal-on-scroll.revealed .kpi-card:nth-child(3) {
    animation-delay: 0.12s;
}

.reveal-on-scroll.revealed .kpi-card:nth-child(4) {
    animation-delay: 0.18s;
}

.reveal-on-scroll.revealed .kpi-card:nth-child(5) {
    animation-delay: 0.24s;
}

.reveal-on-scroll.revealed .kpi-card:nth-child(6) {
    animation-delay: 0.30s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   IMPROVED SPARKLINE STYLES
   ============================================ */
.kpi-sparkline {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.kpi-card:hover .kpi-sparkline {
    opacity: 1;
}

/* ============================================
   PREFERS-REDUCED-MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .skeleton::after {
        animation: none;
    }

    .reveal-on-scroll.revealed .kpi-card,
    .reveal-on-scroll.revealed .chart-card,
    .reveal-on-scroll.revealed .table-card {
        animation: none;
    }
}