* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f3f5f7;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --primary: #1d3763;
    --primary-2: #2f4f88;
    --primary-3: #2d3fa3;
    --primary-light: #5d74c8;
    --text: #243b63;
    --text-soft: #667085;
    --border: #d9e0ea;
    --shadow-sm: 0 4px 14px rgba(29, 55, 99, 0.08);
    --shadow-md: 0 10px 28px rgba(29, 55, 99, 0.12);
    --radius: 18px;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #eef2f7 0%, #f7f9fb 100%);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.5;
}

.dashboard-header {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-2) 55%, var(--primary-3) 100%);
    color: #fff;
    padding: 1.4rem 2.5rem;
    box-shadow: 0 6px 24px rgba(29, 55, 99, 0.18);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
}

.header-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin-bottom: 0.2rem;
}

.header-subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
    font-weight: 400;
}

.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.filters-section {
    position: sticky;
    top: 105px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 6px;
}

.filter-card {
    background: linear-gradient(180deg, #223c73 0%, #1f3567 100%);
    color: #fff;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.section-title {
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: 1.1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
}

.clear-filters-container {
    margin-bottom: 1.4rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.filter-group {
    margin-bottom: 1.2rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #dfe7f8;
    margin-bottom: 0.5rem;
}

.filter-object {
    min-height: 180px !important;
    height: auto !important;
    overflow: visible !important;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 0.3rem;
}

.filter-object > div,
.filter-object > article,
.filter-object .qv-object,
.filter-object .qv-object-content-container {
    min-height: 180px !important;
    height: auto !important;
    overflow: visible !important;
    border-radius: 12px;
}

.clear-filters-container .qv-object,
.clear-filters-container .qvplaceholder {
    min-height: 70px !important;
    height: auto !important;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.kpi-section {
    width: 100%;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.kpi-card {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    border-radius: var(--radius);
    padding: 1rem 1.25rem 1.25rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    min-height: 150px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, var(--primary-3), var(--primary-light));
    border-radius: 18px 0 0 18px;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(29, 55, 99, 0.14);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #55657f;
    margin-bottom: 0.8rem;
}

.kpi-object {
    min-height: 85px;
    height: 85px !important;
}

.charts-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-card {
    background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
    border-radius: 22px;
    padding: 1rem 1.2rem 1.2rem 1.2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(29, 55, 99, 0.12);
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: #67768d;
    margin-bottom: 0.9rem;
}

.chart-medium {
    min-height: 420px;
}

.chart-full {
    grid-column: 1 / -1;
    min-height: 430px;
}

.chart-object {
    height: 340px !important;
    min-height: 340px;
    width: 100%;
}

.chart-object-wide {
    height: 360px !important;
    min-height: 360px;
    width: 100%;
}

.timeline-object {
    height: 420px !important;
    min-height: 420px;
    width: 100%;
}

.qvobject,
.qvplaceholder {
    width: 100%;
    border: none;
}

.qv-object,
.qv-inner-object {
    border-radius: 12px !important;
}

.error-popup {
    background: linear-gradient(135deg, #2f4f88 0%, #2d3fa3 100%);
    color: #ffffff;
    position: fixed;
    max-width: 360px;
    padding: 1rem 1.2rem;
    bottom: 16px;
    right: 16px;
    display: none;
    border-radius: 16px;
    z-index: 9999;
    box-shadow: 0 16px 32px rgba(29, 55, 99, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.close {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.14);
    border: none;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: absolute;
    right: 10px;
    top: 10px;
}

.close:hover {
    background: rgba(255, 255, 255, 0.24);
}

#popupText {
    margin-right: 26px;
    font-size: 0.94rem;
    line-height: 1.5;
}

@media (max-width: 1200px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }

    .filters-section {
        position: relative;
        top: 0;
        max-height: none;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

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

    .chart-full {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 1.1rem 1rem;
    }

    .header-title {
        font-size: 1.55rem;
    }

    .header-subtitle {
        font-size: 0.9rem;
    }

    .dashboard-container {
        padding: 1rem;
        gap: 1rem;
    }

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

    .chart-object,
    .chart-object-wide,
    .timeline-object {
        height: 300px !important;
        min-height: 300px;
    }

    .filter-object {
        min-height: 160px !important;
    }
}

@media (max-width: 480px) {
    .filter-card,
    .kpi-card,
    .chart-card {
        padding: 0.9rem;
    }

    .header-title {
        font-size: 1.35rem;
    }
}