/* ============================================================
   TAX DASHBOARD — FINAL LAYOUT + STICKY NORMALIZATION
   Match Debt dashboard behaviour
============================================================ */


/* ============================================================
   DASHBOARD TABS
============================================================ */

.public-dashboard-page.tax-dashboard-page
.dashboard-tabs.top-dashboard-tabs {

    position: sticky !important;

    top: var(--public-header-height) !important;

    z-index: 10000 !important;

    background: var(--public-bg-main) !important;

}



/* ============================================================
   FILTER BAR
============================================================ */


.public-dashboard-page.tax-dashboard-page
.filter-bar-card,

.public-dashboard-page.tax-dashboard-page
.filter-bar-card.dashboard-card {

    position: sticky !important;

    top: calc(
        var(--public-header-height)
        + var(--public-tabs-height)
    ) !important;


    z-index: 9000 !important;


    margin-top: 0 !important;

    margin-bottom: 0 !important;


    transform: none !important;


    overflow: visible !important;

}


/* Remove common floating layer */

.public-dashboard-page.tax-dashboard-page
.filter-bar-card::before,

.public-dashboard-page.tax-dashboard-page
.filter-bar-card::after {

    content: none !important;

    display: none !important;

}



/* ============================================================
   FILTER CONTENT
============================================================ */


.public-dashboard-page.tax-dashboard-page
.filter-bar-card form,

.public-dashboard-page.tax-dashboard-page
.filter-bar-card .filters-grid {

    margin-top: 0 !important;

    margin-bottom: 0 !important;

    padding-top: 0 !important;

    padding-bottom: 0 !important;

}


.public-dashboard-page.tax-dashboard-page
.filter-box,

.public-dashboard-page.tax-dashboard-page
.ts-wrapper {

    overflow: visible !important;

}


.public-dashboard-page.tax-dashboard-page
.ts-dropdown {

    z-index: 999999 !important;

}



/* ============================================================
   KPI SECTION
============================================================ */


.public-dashboard-page.tax-dashboard-page
.tax-kpi-grid,

.public-dashboard-page.tax-dashboard-page
.kpi-grid.tax-kpi-grid {

    position: relative !important;

    z-index: 1 !important;


    margin-top: 0 !important;
    margin-bottom: -10px !important;

    padding-top: 0 !important;


    width: 100% !important;

    box-sizing: border-box !important;

}



/* KPI cards */

.public-dashboard-page.tax-dashboard-page
.tax-kpi-grid > .dashboard-card.kpi-card {

    margin-top: 0 !important;

    margin-bottom: 0 !important;

}



/* ============================================================
   REMOVE GLOBAL DASHBOARD CARD SPACING CONFLICT
============================================================ */


.public-dashboard-page.tax-dashboard-page
.dashboard-card:not(.filter-bar-card) {

    margin-top: 0 !important;

}



/* ============================================================
   GRID SPACING
============================================================ */


.public-dashboard-page.tax-dashboard-page
.kpi-grid {

    row-gap: 12px !important;

}



/* ============================================================
   RESPONSIVE STABILITY
============================================================ */


@media (max-width: 900px) {


    .public-dashboard-page.tax-dashboard-page
    .dashboard-tabs.top-dashboard-tabs {

        position: relative !important;

        top: auto !important;

    }


    .public-dashboard-page.tax-dashboard-page
    {

        position: relative !important;

        top: auto !important;

    }

}

/* ============================================================
   TAX DASHBOARD — KPI POSITION AFTER STICKY CONTROLS
============================================================ */




/* Remove inherited card spacing */

.public-dashboard-page.tax-dashboard-page
.tax-kpi-grid > .dashboard-card {

    margin-top: 0 !important;

}


/* Keep KPI visible below sticky layers */

.public-dashboard-page.tax-dashboard-page
.tax-kpi-grid {

    position: relative !important;

    z-index: 1 !important;

}


/* ============================================================
   TAX DASHBOARD — MATCH DEBT STICKY CONTROLS EXACTLY
============================================================ */




/* Tabs */
.public-dashboard-page.tax-dashboard-page
.top-dashboard-tabs {

    position: sticky !important;

    top: var(--public-header-height) !important;

    z-index: 9300 !important;

    background: var(--public-bg-main) !important;

}



/* Filter bar */
.public-dashboard-page.tax-dashboard-page
.filter-bar-card,
.public-dashboard-page.tax-dashboard-page
.filter-bar-card.dashboard-card {

    position: sticky !important;

    top: calc(
        var(--public-header-height)
        + var(--public-tabs-height)
        + 5px
    ) !important;

    z-index: 9000 !important;
}



/* Keep KPI below sticky area */
.public-dashboard-page.tax-dashboard-page
.tax-kpi-grid {

    position: relative !important;

    z-index: 1 !important;

    margin-top: 0 !important;

    padding-top: 0 !important;

}


/* Remove inherited dashboard-card margin */
.public-dashboard-page.tax-dashboard-page
.tax-kpi-grid > .dashboard-card {

    margin-top: 0 !important;

}

/* ============================================================
   TAX — FILTER GROUP SPACING
   More space between filter groups and outer card
============================================================ */

.public-dashboard-page.tax-dashboard-page
.filter-bar-card,
.public-dashboard-page.tax-dashboard-page
.filter-bar-card.dashboard-card {
    padding: 20px 26px !important;
}


/* Space between Indicator, Start Year, End Year and Actions */
.public-dashboard-page.tax-dashboard-page
.filters-grid {
    column-gap: 28px !important;
    row-gap: 16px !important;
}


/* Space between each label and its own dropdown */
.public-dashboard-page.tax-dashboard-page
.filter-box label {
    display: block !important;
    margin-bottom: 8px !important;
}


/* Remove any unwanted internal padding override */
.public-dashboard-page.tax-dashboard-page
.filter-box {
    padding: 0 !important;
    margin: 0 !important;
}

/* ============================================================
   TAX — MAJOR SECTION SPACING
============================================================ */

.public-dashboard-page.tax-dashboard-page
#indicator-guide-section,

.public-dashboard-page.tax-dashboard-page
#faq-section,

.public-dashboard-page.tax-dashboard-page
#downloads-section {
    margin-top: 20px !important;
}


/* ============================================================
   TAX — SPACE AFTER FAQ
============================================================ */

.public-dashboard-page.tax-dashboard-page
#faq-section {
    margin-bottom: 20px !important;
}


/* ============================================================
   TAX — FINAL LIGHT / DARK LAYOUT PARITY
============================================================ */

/* Filter -> KPI spacing */
[data-theme="dark"]
.public-dashboard-page.tax-dashboard-page
.filter-bar-card,

[data-theme="dark"]
.public-dashboard-page.tax-dashboard-page
.filter-bar-card.dashboard-card {
    margin-bottom: 22px !important;
}


/* Do not create extra spacing on the KPI grid itself */
[data-theme="dark"]
.public-dashboard-page.tax-dashboard-page
.tax-kpi-grid,

[data-theme="dark"]
.public-dashboard-page.tax-dashboard-page
.kpi-grid.tax-kpi-grid {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}


/*
   IMPORTANT:
   Create the KPI -> charts spacing on the CHART CONTAINER.
   This is more reliable than margin-bottom on .tax-kpi-grid
   because the shared common CSS forces the KPI grid gap.
*/
[data-theme="dark"]
.public-dashboard-page.tax-dashboard-page
.tax-multi-chart-card {
    margin-top: -12px !important;
    top: auto !important;
    transform: none !important;
}

/* ============================================================
   TAX KPI -> VISUAL SPACING

   Keep this separate from the spacing between graph rows.
   ============================================================ */

.public-dashboard-page.tax-dashboard-page
.tax-multi-chart-card {
    margin-top: 18px !important;
}

/* Keep the same spacing in dark mode. */
[data-theme="dark"]
.public-dashboard-page.tax-dashboard-page
.tax-multi-chart-card {
    margin-top: 18px !important;
}

