/* ==========================================================
   TAX REVENUE STATISTICS
   District trend selector
========================================================== */

.tax-revenue-statistics-selector {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(120, 130, 145, 0.28);
    border-radius: 8px;
}

.tax-revenue-statistics-selector label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.82rem;
    font-weight: 700;
}

.tax-revenue-statistics-selector small {
    display: block;
    margin-top: 7px;
    line-height: 1.4;
    opacity: 0.75;
}

.tax-district-chart-selector {
    width: 100%;
}

.tax-revenue-statistics-selector .ts-wrapper {
    width: 100%;
}

.tax-revenue-statistics-selector .ts-control {
    width: 100%;
    min-height: 40px;
}


/* ==========================================================
   REVENUE STATISTICS — TWO-COLUMN CARDS
========================================================== */




/* ==========================================================
   REVENUE STATISTICS — SQUARE GRAPH SURFACES
========================================================== */

/*
 * Remove rounded corners from the actual graph area.
 * The outer dashboard card keeps its existing styling.
 */
.tax-indicator-chart-wrap,
.tax-indicator-chart-wrap canvas {
    border-radius: 0 !important;
}

/* ==========================================================
   REVENUE STATISTICS — SECTOR CODE KEY
========================================================== */

.tax-sector-code-key {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 12px;
}

.tax-sector-code-key-table {
    border-collapse: collapse;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: #ffffff;
    font-size: 11px;
}

.tax-sector-code-key-table th,
.tax-sector-code-key-table td {
    border: 1px solid #d9e4ef;
    padding: 4px 8px;
    vertical-align: top;
    text-align: left;
}

.tax-sector-code-key-table th {
    background: #f5f8fb;
    color: #17365d;
    font-weight: 700;
}

.tax-sector-code-key-table .sector-code-cell {
    width: 48px;
    white-space: nowrap;
    font-weight: 700;
    color: #17365d;
}

.tax-sector-code-key-table .sector-name-cell {
    max-width: none;
    color: #34495e;
}

.tax-sector-code-key-empty {
    border: none !important;
    background: transparent !important;
}

@media (max-width: 1100px) {

    .tax-sector-code-key {
        width: 100%;
        overflow-x: auto;
    }

    .tax-sector-code-key-table {
        width: 100%;
        min-width: 720px;
    }

}

/* REVENUE STATISTICS — TOP 15 SECTOR FULL WIDTH */

/*
 * Top 15 Sectors by Contribution to
 * Central Government Fiscal Revenue
 */
.tax-indicator-chart-card[
    data-tax-chart-kind="tax_sector_trend"
] {
    grid-column: span 2;
}


@media (max-width: 900px) {

    .tax-indicator-chart-card[
        data-tax-chart-kind="tax_sector_trend"
    ] {
        grid-column: span 1;
    }

}


/* ==========================================================
   REVENUE STATISTICS — FOUR-COLUMN SECTOR KEY
========================================================== */

.tax-sector-code-key {
    width: 100%;
    margin-top: 12px;
    overflow-x: auto;
}


.tax-sector-code-key-table {
    width: 100%;
    min-width: 1100px;
    table-layout: fixed;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 10.5px;
}


.tax-sector-code-key-table th,
.tax-sector-code-key-table td {
    padding: 5px 6px;
    border: 1px solid #d9e4ef;
    vertical-align: top;
    text-align: left;
}


.tax-sector-code-key-table th {
    background: #f5f8fb;
    color: #17365d;
    font-weight: 700;
}


.tax-sector-code-key-table .sector-code-header,
.tax-sector-code-key-table .sector-code-cell {
    width: 38px;
    font-weight: 700;
    color: #17365d;
    white-space: nowrap;
}


.tax-sector-code-key-table .sector-name-header,
.tax-sector-code-key-table .sector-name-cell {
    width: calc((100% - 152px) / 4);
    color: #34495e;
    line-height: 1.25;
}


.tax-sector-code-key-empty {
    border: 1px solid #d9e4ef !important;
    background: #ffffff !important;
}


/* ==========================================================
   REVENUE STATISTICS — FIVE-GROUP SECTOR KEY
========================================================== */

/*
 * 15 sectors = 5 groups across × 3 rows.
 */
.tax-sector-code-key-table {
    width: 100%;
    min-width: 1250px;
    table-layout: fixed;
}


.tax-sector-code-key-table .sector-code-header,
.tax-sector-code-key-table .sector-code-cell {
    width: 34px;
    padding-left: 5px;
    padding-right: 5px;
}


.tax-sector-code-key-table .sector-name-header,
.tax-sector-code-key-table .sector-name-cell {
    width: calc((100% - 170px) / 5);
    padding-left: 6px;
    padding-right: 6px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}


@media (max-width: 1100px) {

    .tax-sector-code-key-table {
        min-width: 1250px;
    }

}


/* ==========================================================
   REVENUE STATISTICS — FIVE-GROUP FIT CARD
========================================================== */

/*
 * Fill the entire two-column chart card without creating
 * horizontal overflow.
 */
.tax-sector-code-key {
    width: 100%;
    max-width: 100%;
    margin-top: 12px;
    overflow: visible;
}


.tax-sector-code-key-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    table-layout: fixed;
    border-collapse: collapse;

    font-size: 10px;
}


/*
 * There are 10 table columns:
 *
 * Code | Sector
 * Code | Sector
 * Code | Sector
 * Code | Sector
 * Code | Sector
 *
 * Each Code column gets 3%.
 * Each Sector column gets 17%.
 *
 * 5 × (3% + 17%) = 100%
 */
.tax-sector-code-key-table th:nth-child(odd),
.tax-sector-code-key-table td:nth-child(odd) {
    width: 3% !important;
}


.tax-sector-code-key-table th:nth-child(even),
.tax-sector-code-key-table td:nth-child(even) {
    width: 17% !important;
}


/*
 * Compact cell spacing.
 */
.tax-sector-code-key-table th,
.tax-sector-code-key-table td {
    padding: 5px 6px;

    box-sizing: border-box;

    vertical-align: top;
    text-align: left;
}


/*
 * Code cells remain short and readable.
 */
.tax-sector-code-key-table .sector-code-header,
.tax-sector-code-key-table .sector-code-cell {
    width: auto !important;

    font-weight: 700;

    white-space: nowrap;

    overflow: hidden;
}


/*
 * Long sector descriptions wrap naturally inside
 * their allocated column rather than overlapping.
 */
.tax-sector-code-key-table .sector-name-header,
.tax-sector-code-key-table .sector-name-cell {
    width: auto !important;
    max-width: none !important;

    white-space: normal;

    overflow-wrap: break-word;
    word-break: normal;

    line-height: 1.2;
}


/*
 * Remove any earlier minimum-width rule.
 */
@media (max-width: 1100px) {

    .tax-sector-code-key {
        width: 100%;
        max-width: 100%;

        overflow-x: auto;
    }


    .tax-sector-code-key-table {
        width: 100% !important;
        min-width: 900px !important;
    }

}


/* ==========================================================
   REVENUE STATISTICS — SECTOR YEAR FILTER
========================================================== */

.tax-sector-year-filter {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 12px;

    width: 100%;
    margin: 4px 0 10px;
}


.tax-sector-year-filter-label {
    color: #17365d;

    font-size: 12px;
    font-weight: 700;

    white-space: nowrap;
}


.tax-sector-year-filter-select {
    min-width: 140px;
    height: 38px;

    padding: 5px 34px 5px 10px;

    border: 1px solid #c8d4e1;
    border-radius: 0;

    background: #ffffff;
    color: #17365d;

    font-size: 12px;
    font-weight: 700;
}


@media (max-width: 700px) {

    .tax-sector-year-filter {
        justify-content: flex-start;
    }


    .tax-sector-year-filter-select {
        min-width: 125px;
    }

}


/* TAX BUDGET RATIO RANGE CONTROL */

.tax-budget-ratio-range-control {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;

    gap: 9px;

    margin:
        6px
        0
        8px;
}


.tax-budget-ratio-range-label {
    color: #17365d;

    font-size: 10.5px;
    font-weight: 700;

    white-space: nowrap;
}


.tax-budget-ratio-range-buttons {
    display: inline-flex;

    border:
        1px solid
        #b7cde0;

    background:
        #ffffff;
}


.tax-budget-ratio-range-button {
    min-height: 30px;

    padding:
        5px
        12px;

    border:
        0;

    border-right:
        1px solid
        #b7cde0;

    background:
        #ffffff;

    color:
        #355578;

    cursor:
        pointer;

    font-size:
        10.5px;

    font-weight:
        700;
}


.tax-budget-ratio-range-button:last-child {
    border-right:
        0;
}


.tax-budget-ratio-range-button:hover {
    background:
        #f3f8fc;
}


.tax-budget-ratio-range-button.is-active {
    background:
        #0788c8;

    color:
        #ffffff;
}


@media (max-width: 700px) {

    .tax-budget-ratio-range-control {
        flex-wrap:
            wrap;
    }

}


/* ==========================================================
   TAX BUDGET RATIO NAVIGATOR
========================================================== */

.tax-budget-ratio-navigator-control {
    width: 100%;
    max-width: 100%;

    box-sizing: border-box;

    padding:
        0
        28px;

    margin:
        8px
        0
        6px;
}


.tax-budget-ratio-navigator-shell {
    position: relative;

    width: 100%;
    height: 52px;

    overflow: hidden;

    background:
        #e3e8ed;

    border-top:
        1px solid
        #ccd5df;

    border-bottom:
        1px solid
        #ccd5df;
}


/*
 * Historical overview bars.
 */
.tax-budget-ratio-mini-bars {
    position: absolute;

    left: 8px;
    right: 8px;

    bottom: 4px;

    height: 38px;

    display: flex;
    align-items: flex-end;

    gap: 2px;

    pointer-events:
        none;

    z-index:
        1;
}


.tax-budget-ratio-mini-bar {
    flex:
        1 1 0;

    min-width:
        1px;

    background:
        #3d79b3;

    opacity:
        0.68;
}


/*
 * Visible selected portion.
 */
.tax-budget-ratio-selection-window {
    position: absolute;

    top: 0;
    bottom: 0;

    background:
        rgba(
            7,
            136,
            200,
            0.10
        );

    border-left:
        2px solid
        #476b8d;

    border-right:
        2px solid
        #476b8d;

    pointer-events:
        none;

    z-index:
        2;
}


/*
 * Two overlapping range sliders provide
 * left and right navigator handles.
 */
.tax-budget-ratio-range-input {
    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 52px;

    margin: 0;

    background:
        transparent;

    pointer-events:
        none;

    -webkit-appearance:
        none;

    appearance:
        none;

    z-index:
        4;
}


.tax-budget-ratio-range-input::-webkit-slider-runnable-track {
    height: 1px;

    background:
        transparent;

    border: 0;
}


.tax-budget-ratio-range-input::-moz-range-track {
    height: 1px;

    background:
        transparent;

    border: 0;
}


/*
 * Draggable handles.
 */
.tax-budget-ratio-range-input::-webkit-slider-thumb {
    width: 10px;
    height: 42px;

    margin-top:
        -20px;

    border:
        1px solid
        #52697f;

    border-radius:
        2px;

    background:
        #ffffff;

    cursor:
        ew-resize;

    pointer-events:
        auto;

    -webkit-appearance:
        none;

    appearance:
        none;
}


.tax-budget-ratio-range-input::-moz-range-thumb {
    width: 10px;
    height: 42px;

    border:
        1px solid
        #52697f;

    border-radius:
        2px;

    background:
        #ffffff;

    cursor:
        ew-resize;

    pointer-events:
        auto;
}


/*
 * Selected start and end period.
 */
.tax-budget-ratio-range-caption {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    margin-top: 5px;

    color:
        #17365d;

    font-size:
        10.5px;

    font-weight:
        700;
}


.tax-budget-ratio-range-separator {
    opacity:
        0.65;
}


@media (max-width: 700px) {

    .tax-budget-ratio-navigator-control {
        padding:
            0
            8px;
    }


    .tax-budget-ratio-navigator-shell,
    .tax-budget-ratio-range-input {
        height:
            46px;
    }

}


/* ==========================================================
   TAX BUDGET RATIO NAVIGATOR COMPACT
========================================================== */

/*
 * Smaller navigator footprint.
 */
.tax-budget-ratio-navigator-control {
    margin-top: 5px;
    margin-bottom: 3px;

    padding-left: 28px;
    padding-right: 28px;
}


.tax-budget-ratio-navigator-shell {
    height: 34px;
}


.tax-budget-ratio-mini-bars {
    left: 6px;
    right: 6px;

    bottom: 3px;

    height: 24px;

    gap: 2px;
}


.tax-budget-ratio-range-input {
    height: 34px;
}


/*
 * Smaller draggable handles.
 */
.tax-budget-ratio-range-input::-webkit-slider-thumb {
    width: 9px;
    height: 28px;

    margin-top: -13px;
}


.tax-budget-ratio-range-input::-moz-range-thumb {
    width: 9px;
    height: 28px;
}


.tax-budget-ratio-range-caption {
    margin-top: 3px;

    font-size: 10px;
}


@media (max-width: 700px) {

    .tax-budget-ratio-navigator-shell,
    .tax-budget-ratio-range-input {
        height: 32px;
    }


    .tax-budget-ratio-mini-bars {
        height: 22px;
    }

}




/* ==========================================================
   MAJOR TAX TYPE NOTE
========================================================== */

.tax-major-tax-type-note {
    margin-top: 8px;

    padding: 0 4px;

    font-size: 12px;
    line-height: 1.45;

    color: #52677A;

    font-style: italic;
}


/* ==========================================================
   TAX DASHBOARD — FINAL CARD WIDTH POLICY
   ==========================================================

   Standard one-space visuals:
   - Revenue-to-Budget Ratio Trend
   - Top 15 Sectors

   Two-space visual:
   - Regional Revenue Map
========================================================== */

/*
 * ==========================================================
 * FINAL TAX VISUAL GRID SPANS
 * ==========================================================
 *
 * Standard width:
 * - Revenue-to-Budget Ratio Trend
 *
 * Two-space width:
 * - Top 15 Sectors
 * - Regional Revenue Map
 */

.tax-indicator-chart-card[
    data-tax-chart-kind="tax_revenue_budget_ratio"
] {
    grid-column: span 1 !important;
}


.tax-indicator-chart-card[
    data-tax-chart-kind="tax_sector_trend"
] {
    grid-column: span 2 !important;
}


.tax-indicator-chart-card[
    data-tax-chart-kind="tax_region_map"
] {
    grid-column: span 2 !important;
}


/*
 * All visuals return to one column on smaller screens.
 */
@media (max-width: 900px) {

    .tax-indicator-chart-card[
        data-tax-chart-kind="tax_revenue_budget_ratio"
    ],
    .tax-indicator-chart-card[
        data-tax-chart-kind="tax_sector_trend"
    ],
    .tax-indicator-chart-card[
        data-tax-chart-kind="tax_region_map"
    ] {
        grid-column: span 1 !important;
    }
}



/* ==========================================================
   MAJOR TAX TYPE — TWO-CARD WIDTH

   Tax Revenue Trend by Major Tax Type needs additional
   horizontal space for its stacked bars, total line,
   legend and fiscal-year labels.
========================================================== */

.tax-indicator-chart-card[
    data-tax-chart-kind="tax_major_type_trend"
] {
    grid-column: span 2 !important;
}


/*
 * Return to one column on smaller screens.
 */
@media (max-width: 900px) {

    .tax-indicator-chart-card[
        data-tax-chart-kind="tax_major_type_trend"
    ] {
        grid-column: span 1 !important;
    }
}


/* ==========================================================
   REVENUE-TO-BUDGET — SINGLE CARD
========================================================== */

.tax-indicator-chart-card[
    data-tax-chart-kind="tax_revenue_budget_ratio"
] {
    grid-column: span 1 !important;
}


/* ==========================================================
   REVENUE-TO-BUDGET — SINGLE CARD WIDTH
========================================================== */

.tax-indicator-chart-card[
    data-tax-chart-kind="tax_revenue_budget_ratio"
] {
    grid-column: span 1 !important;
}
