/* =========================================================
   Dashboard Panel Expand
   Shared B–H Pop-Out System
   ========================================================= */


/* =========================================================
   Button
   ========================================================= */

.dashboard-panel
.dashboard-panel__expand {
    cursor: pointer;
}


.dashboard-panel
.dashboard-panel__expand:hover {
    background: var(
        --dashboard-background,
        #f4f6f9
    );
}


.dashboard-panel
.dashboard-panel__expand:focus-visible {
    outline: 2px solid #4f7ee8;
    outline-offset: 2px;
}


/* =========================================================
   Backdrop
   ========================================================= */

.dashboard-panel-backdrop {
    position: fixed;

    inset: 0;

    z-index: 9998;

    background:
        rgba(
            15,
            23,
            42,
            0.42
        );

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 140ms ease,
        visibility 140ms ease;
}


.dashboard-panel-backdrop.is-visible {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}


/* =========================================================
   Expanded Panel
   ========================================================= */

body >
.dashboard-panel.dashboard-panel--expanded {
    position: fixed !important;

    top: 1rem !important;
    right: 1rem !important;
    bottom: 1rem !important;
    left: 1rem !important;

    z-index: 9999 !important;

    display: flex !important;
    flex-direction: column !important;

    grid-column: auto !important;

    width: auto !important;
    height: auto !important;

    max-width: none !important;
    max-height: none !important;

    min-width: 0 !important;
    min-height: 0 !important;

    margin: 0 !important;

    overflow: hidden !important;

    background: #ffffff !important;

    border: 1px solid
        var(
            --dashboard-border,
            #dfe5ec
        ) !important;

    border-radius: 0.75rem !important;

    box-shadow:
        0 24px 80px
        rgba(
            15,
            23,
            42,
            0.28
        ) !important;
}


/* =========================================================
   Header
   ========================================================= */

body >
.dashboard-panel.dashboard-panel--expanded
.dashboard-panel__header {
    flex: 0 0 auto;

    min-height: 58px;

    padding:
        0.8rem
        1rem;

    background: #ffffff;

    border-bottom: 1px solid
        var(
            --dashboard-border,
            #e3e8ef
        );
}


body >
.dashboard-panel.dashboard-panel--expanded
.dashboard-panel__title {
    font-size: 0.9rem;
}


body >
.dashboard-panel.dashboard-panel--expanded
.dashboard-panel__subtitle {
    font-size: 0.62rem;
}


/* =========================================================
   Collapse Button
   ========================================================= */

body >
.dashboard-panel.dashboard-panel--expanded
.dashboard-panel__expand {
    flex: 0 0 30px;

    width: 30px;
    height: 30px;
}


body >
.dashboard-panel.dashboard-panel--expanded
.dashboard-panel__expand svg {
    width: 16px;
    height: 16px;

    transform: rotate(180deg);
}


/* =========================================================
   Body
   ========================================================= */

body >
.dashboard-panel.dashboard-panel--expanded
.dashboard-panel__body {
    flex: 1;

    width: 100%;

    min-width: 0;
    min-height: 0;

    overflow: auto;

    padding:
        1rem
        1.1rem;

    background: #ffffff;
}


/* =========================================================
   B — Performance
   ========================================================= */

body >
.dashboard-panel--performance.dashboard-panel--expanded
.performance-dynamic__trend {
    grid-template-columns:
        minmax(280px, 0.85fr)
        minmax(0, 1.5fr);

    gap: 1.3rem;
}


body >
.dashboard-panel--performance.dashboard-panel--expanded
.performance-dynamic__years {
    min-height: 300px;
}


body >
.dashboard-panel--performance.dashboard-panel--expanded
.performance-dynamic__year {
    height: 300px;
}


body >
.dashboard-panel--performance.dashboard-panel--expanded
.performance-dynamic__bar {
    width: 22px;
}


/* =========================================================
   C — Vote Share
   ========================================================= */

body >
.dashboard-panel--vote-share.dashboard-panel--expanded
.vote-share-trend__svg {
    height: 420px;
}


body >
.dashboard-panel--vote-share.dashboard-panel--expanded
.vote-share-individual,

body >
.dashboard-panel--vote-share.dashboard-panel--expanded
.vote-share-compare {
    justify-content: center;

    min-height: 400px;
}


/* =========================================================
   D — Turnout
   ========================================================= */

body >
.dashboard-panel--turnout.dashboard-panel--expanded
.turnout-dynamic__svg {
    height: 420px;
}


body >
.dashboard-panel--turnout.dashboard-panel--expanded
.turnout-dynamic__individual,

body >
.dashboard-panel--turnout.dashboard-panel--expanded
.turnout-compare {
    min-height: 400px;
}


/* =========================================================
   E — Movement
   ========================================================= */

body >
.dashboard-panel--movements.dashboard-panel--expanded
.movement-chart__head,

body >
.dashboard-panel--movements.dashboard-panel--expanded
.movement-chart__row {
    grid-template-columns:
        minmax(260px, 1.5fr)
        minmax(220px, 1fr)
        180px;
}


body >
.dashboard-panel--movements.dashboard-panel--expanded
.movement-chart__row {
    min-height: 48px;
}


/* =========================================================
   F — Competitive
   ========================================================= */

body >
.dashboard-panel--competitive.dashboard-panel--expanded
.competitive-chart__head,

body >
.dashboard-panel--competitive.dashboard-panel--expanded
.competitive-chart__row {
    grid-template-columns:
        minmax(260px, 1.5fr)
        minmax(220px, 1fr)
        90px;
}


body >
.dashboard-panel--competitive.dashboard-panel--expanded
.competitive-chart__row {
    min-height: 48px;
}


body >
.dashboard-panel--competitive.dashboard-panel--expanded
.competitive-compare__head,

body >
.dashboard-panel--competitive.dashboard-panel--expanded
.competitive-compare__row {
    grid-template-columns:
        minmax(260px, 1.6fr)
        130px
        130px
        100px;
}


/* =========================================================
   G — Transition
   ========================================================= */

body >
.dashboard-panel--transition.dashboard-panel--expanded
.transition-analysis__table {
    font-size: 0.6rem;
}


body >
.dashboard-panel--transition.dashboard-panel--expanded
.transition-analysis__table th,

body >
.dashboard-panel--transition.dashboard-panel--expanded
.transition-analysis__table td {
    padding:
        0.65rem
        0.5rem;
}


/* =========================================================
   H — Raw Data
   ========================================================= */

body >
.dashboard-panel--raw.dashboard-panel--expanded
.raw-data-col--detail {
    display: table-cell;
}


body >
.dashboard-panel--raw.dashboard-panel--expanded
.raw-data-table-wrap {
    flex: 1;

    min-width: 0;
    min-height: 0;

    overflow: auto;
}


body >
.dashboard-panel--raw.dashboard-panel--expanded
.raw-data-table {
    width: 100%;

    min-width: 900px;

    table-layout: auto;
}


body >
.dashboard-panel--raw.dashboard-panel--expanded
.raw-data-table th,

body >
.dashboard-panel--raw.dashboard-panel--expanded
.raw-data-table td {
    padding:
        0.6rem
        0.55rem;

    overflow: visible;

    font-size: 0.54rem;

    text-overflow: initial;
}


body >
.dashboard-panel--raw.dashboard-panel--expanded
.raw-data-table th:first-child,

body >
.dashboard-panel--raw.dashboard-panel--expanded
.raw-data-table td:first-child {
    width: auto;
}


/* =========================================================
   Scroll Lock
   ========================================================= */

body.dashboard-panel-expanded {
    overflow: hidden !important;
}


/* =========================================================
   Dark Mode
   ========================================================= */

[data-theme="dark"]
.dashboard-panel-backdrop {
    background:
        rgba(
            0,
            0,
            0,
            0.62
        );
}


[data-theme="dark"]
body >
.dashboard-panel.dashboard-panel--expanded {
    background: #172033 !important;

    border-color: #2d394c !important;
}


[data-theme="dark"]
body >
.dashboard-panel.dashboard-panel--expanded
.dashboard-panel__header,

[data-theme="dark"]
body >
.dashboard-panel.dashboard-panel--expanded
.dashboard-panel__body {
    background: #172033;
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 900px) {

    body >
    .dashboard-panel.dashboard-panel--expanded {
        top: 0.7rem !important;
        right: 0.7rem !important;
        bottom: 0.7rem !important;
        left: 0.7rem !important;
    }


    body >
    .dashboard-panel--performance.dashboard-panel--expanded
    .performance-dynamic__trend {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 700px) {

    body >
    .dashboard-panel.dashboard-panel--expanded {
        top: 0.35rem !important;
        right: 0.35rem !important;
        bottom: 0.35rem !important;
        left: 0.35rem !important;

        border-radius: 0.55rem !important;
    }


    body >
    .dashboard-panel.dashboard-panel--expanded
    .dashboard-panel__header {
        min-height: 52px;

        padding:
            0.65rem
            0.75rem;
    }


    body >
    .dashboard-panel.dashboard-panel--expanded
    .dashboard-panel__body {
        padding: 0.75rem;
    }


    body >
    .dashboard-panel--vote-share.dashboard-panel--expanded
    .vote-share-trend__svg,

    body >
    .dashboard-panel--turnout.dashboard-panel--expanded
    .turnout-dynamic__svg {
        height: 300px;
    }


    body >
    .dashboard-panel--raw.dashboard-panel--expanded
    .raw-data-table {
        min-width: 900px;
    }

}
/* =========================================================
   Expanded Panels — Shared Geography Navigation
   ========================================================= */

.dashboard-panel__geo-strip {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    width: 100%;

    margin:
        0.15rem
        0
        0.45rem;

    padding:
        0
        0.2rem;

    min-height: 18px;
}


/* Shared context */

.dashboard-geo-context {
    display: inline-flex;

    align-items: center;

    justify-content: flex-end;

    gap: 0.28rem;

    color:
        var(
            --dashboard-text-soft,
            #98a2b3
        );

    font-size: 0.59rem;

    line-height: 1.2;

    font-weight: 450;

    white-space: nowrap;

    opacity: 0.64;
}


/* Back */

.dashboard-geo-context__back {
    display: inline-flex;

    align-items: center;

    gap: 0.2rem;

    margin: 0;

    padding: 0;

    border: 0;

    background: transparent;

    color: inherit;

    font: inherit;

    font-weight: 500;

    cursor: pointer;

    opacity: 0.78;

    transition:
        opacity 0.12s ease,
        color 0.12s ease;
}


.dashboard-geo-context__back:hover {
    color:
        var(
            --dashboard-text-muted,
            #667085
        );

    opacity: 1;
}


.dashboard-geo-context__back:focus-visible {
    outline:
        1px solid
        currentColor;

    outline-offset: 2px;

    border-radius: 2px;
}


/* Dividers / labels */

.dashboard-geo-context__divider {
    opacity: 0.32;
}


.dashboard-geo-context__level {
    opacity: 0.72;
}


.dashboard-geo-context__current {
    opacity: 0.82;

    font-weight: 500;
}


/* =========================================================
   Panel E already owns its exact accordion placement
   ========================================================= */

.movement-study__accordion-context
.dashboard-geo-context {
    font-size: 0.59rem;
}


/* =========================================================
   Dark Mode
   ========================================================= */

[data-theme="dark"]
.dashboard-geo-context {
    color: #778292;
}


[data-theme="dark"]
.dashboard-geo-context__back:hover {
    color: #aab4c3;
}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 700px) {

    .dashboard-panel__geo-strip {
        justify-content: flex-start;

        margin-bottom: 0.4rem;
    }


    .dashboard-geo-context {
        flex-wrap: wrap;

        justify-content: flex-start;

        white-space: normal;

        font-size: 0.58rem;
    }

}