:root {
    --bg-dark: #05070a;
    --bg-sidebar: #0a0d14;
    --bg-card: rgba(16, 21, 30, 0.7);
    --glass-accent: rgba(0, 229, 255, 0.05);

    --accent-blue: #00e5ff;
    --accent-purple: #9d50bb;
    --accent-green: #30d158;
    --accent-orange: #ff9f0a;
    --accent-red: #ff3b30;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #475569;

    --border-color: rgba(255, 255, 255, 0.06);
    --sidebar-width: 280px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Background Effects */
.background-decor {
    position: fixed;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(120px);
    opacity: 0.12;
    border-radius: 50%;
}

.blob-1 {
    top: -20%;
    left: -10%;
    width: 800px;
    height: 800px;
    background: var(--accent-blue);
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 700px;
    height: 700px;
    background: var(--accent-purple);
}

.blob-3 {
    top: 30%;
    left: 50%;
    width: 500px;
    height: 500px;
    background: var(--accent-green);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    padding: 2.5rem 1.8rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-logo {
    margin-bottom: 4rem;
    padding-left: 0.5rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem 1.2rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    box-shadow: 0 10px 20px rgba(0, 229, 255, 0.2);
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

.nav-exit {
    margin-top: auto;
    color: var(--accent-red) !important;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 3rem 4rem;
    max-width: calc(100vw - var(--sidebar-width));
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
}

.top-bar h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1.5px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-blue), #d946ef);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-indicator {
    background: rgba(48, 209, 88, 0.05);
    border: 1px solid rgba(48, 209, 88, 0.2);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--accent-green);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-refresh {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-refresh:hover {
    transform: rotate(180deg);
    background: rgba(255, 255, 255, 0.05);
}

/* Sections */
.dashboard-section {
    margin-bottom: 6rem;
}

.section-title {
    margin-bottom: 2.5rem;
}

.section-title h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.section-title p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* KPI Grid */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.8rem;
    margin-bottom: 3rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 30px;
    backdrop-filter: blur(25px);
    display: flex;
    gap: 1.5rem;
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.15);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.accent-blue .kpi-icon {
    background: rgba(0, 229, 255, 0.08);
    color: var(--accent-blue);
}

.accent-purple .kpi-icon {
    background: rgba(157, 80, 187, 0.08);
    color: var(--accent-purple);
}

.accent-green .kpi-icon {
    background: rgba(48, 209, 88, 0.08);
    color: var(--accent-green);
}

.accent-orange .kpi-icon {
    background: rgba(255, 159, 10, 0.08);
    color: var(--accent-orange);
}

.kpi-data h2 {
    font-size: 1.8rem;
    font-weight: 800;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.8rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 2.2rem;
    border-radius: 32px;
    backdrop-filter: blur(25px);
    transition: var(--transition);
}

.card.full-width {
    grid-column: span 4;
}

.card.medium {
    grid-column: span 2;
}

.card.large {
    grid-column: span 2;
    grid-row: span 2;
}

.chart-wrapper {
    width: 100%;
    height: 350px;
    margin-top: 1.5rem;
}

.chart-wrapper.main-chart {
    height: 450px;
}

/* Averages Grid */
.averages-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

.average-item h3 {
    font-size: 1.8rem;
    color: var(--accent-blue);
}

/* Causal Analysis Layout */
.causal-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    text-align: center;
}

.causal-card h2 {
    font-size: 2.2rem;
}

.pos {
    color: var(--accent-green);
}

.neg {
    color: var(--accent-red);
}

/* Lists */
.data-list {
    list-style: none;
    margin-top: 1.5rem;
}

.data-list li {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.data-list li:last-child {
    border-bottom: none;
}

/* KPI Groups */
.kpi-val-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 1rem 0;
}

.avg-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mini-chart-placeholder {
    height: 80px;
    width: 100%;
    opacity: 0.6;
}

/* BCG Styles */
.bcg-legend-grid {
    display: flex;
    gap: 0.8rem;
    margin-top: 2rem;
    justify-content: center;
}

.bcg-pill {
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.bcg-pill.star {
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent-blue);
}

.bcg-pill.vaca {
    background: rgba(48, 209, 88, 0.1);
    color: var(--accent-green);
}

.bcg-pill.perro {
    background: rgba(255, 59, 48, 0.1);
    color: var(--accent-red);
}

.bcg-pill.interrogante {
    background: rgba(255, 159, 10, 0.1);
    color: var(--accent-orange);
}

@media (max-width: 1400px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card.medium,
    .card.full-width {
        grid-column: span 2;
    }

    .causal-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}