.bi-page {
    --bi-categorical-1: #3366CC;
    --bi-categorical-2: #0F8B7A;
    --bi-categorical-3: #D97706;
    --bi-categorical-4: #C2417A;
    --bi-categorical-5: #7C3AED;
    --bi-categorical-6: #64748B;
    --bi-categorical-7: #0284C7;
    --bi-categorical-8: #A16207;
    --bi-chart-1: var(--bi-categorical-1);
    --bi-chart-2: var(--bi-categorical-2);
    --bi-chart-3: var(--bi-categorical-3);
    --bi-chart-4: var(--bi-categorical-4);
    --bi-chart-5: var(--bi-categorical-5);
    --bi-chart-6: var(--bi-categorical-6);
    --bi-chart-7: var(--bi-categorical-7);
    --bi-chart-8: var(--bi-categorical-8);
    --bi-semantic-positive: #15803D;
    --bi-semantic-negative: #B42318;
    --bi-semantic-warning: #B54708;
    --bi-semantic-actual: #3366CC;
    --bi-semantic-target: #D97706;
    --bi-semantic-comparison: #7C3AED;
    --bi-semantic-no-data: #CBD5E1;
    --bi-map-scale: #3366CC;
    --bi-map-no-data: #E2E8F0;
    --bi-map-boundary: #F8FAFC;
    --bi-chart-selection: #111827;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: var(--erp-space-5);
    overflow: auto;
    border: 1px solid var(--erp-border-glass);
    border-radius: var(--erp-radius-panel);
    color: var(--erp-text-primary);
    background: var(--erp-grid-background);
    box-shadow: var(--erp-shadow-md);
}

/* BI data-visualization palette is independent from the ERP interaction theme. */
html[data-theme="dark"] .bi-page {
    --bi-categorical-1: #60A5FA;
    --bi-categorical-2: #2DD4BF;
    --bi-categorical-3: #FBBF24;
    --bi-categorical-4: #F472B6;
    --bi-categorical-5: #A78BFA;
    --bi-categorical-6: #94A3B8;
    --bi-categorical-7: #38BDF8;
    --bi-categorical-8: #FACC15;
    --bi-semantic-positive: #4ADE80;
    --bi-semantic-negative: #FB7185;
    --bi-semantic-warning: #FBBF24;
    --bi-semantic-actual: #60A5FA;
    --bi-semantic-target: #FBBF24;
    --bi-semantic-comparison: #A78BFA;
    --bi-semantic-no-data: #475569;
    --bi-map-scale: #60A5FA;
    --bi-map-no-data: #334155;
    --bi-map-boundary: #0F172A;
    --bi-chart-selection: #F8FAFC;
}

.bi-dashboard-workbench--published-unified .bi-dashboard-commandbar {
    min-height: 36px;
    gap: var(--erp-space-1);
    padding: 2px var(--erp-space-2);
    overflow: visible;
}

.bi-commandbar-heading {
    display: grid;
    min-width: 0;
    margin-inline-end: auto;
    padding-inline: var(--erp-space-2) var(--erp-space-4);
    border-inline-start: 2px solid var(--erp-color-primary);
    line-height: 1.35;
}

.bi-commandbar-heading small {
    color: var(--erp-text-tertiary);
    font-size: .58rem;
    font-weight: 700;
}

.bi-commandbar-heading strong {
    overflow: hidden;
    color: var(--erp-text-primary);
    font-size: .82rem;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-dashboard-workbench--published-unified .bi-commandbar-report {
    max-width: 220px;
    min-height: 28px;
    padding: 3px var(--erp-space-2);
}

.bi-dashboard-workbench--published-unified .bi-commandbar-report strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-dashboard-workbench--published-unified .bi-commandbar-button {
    min-height: 28px;
    padding: 3px 7px;
}

.bi-dashboard-workbench--published-unified .bi-commandbar-updated {
    gap: 4px;
    min-height: 28px;
    padding: 3px 6px;
    border-inline-start: 1px solid var(--erp-border-default);
    color: var(--erp-text-tertiary);
    font-size: .61rem;
}

.bi-dashboard-workbench--published-unified .bi-commandbar-updated strong {
    color: var(--erp-text-secondary);
    font-variant-numeric: tabular-nums;
}

.bi-dashboard-page-selector { display: none; }

.bi-dashboard-workbench--published-unified .bi-dashboard-pages {
    min-height: 38px;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
}

.bi-dashboard-workbench--published-unified .bi-dashboard-pages::-webkit-scrollbar { display: none; }

.bi-dashboard-workbench--published-unified .bi-production-canvas {
    grid-auto-rows: 52px;
    background-size: calc(100% / 12) 52px;
}

.bi-dashboard-workbench--published-unified .bi-production-widget {
    border-color: var(--erp-border-default);
    background: var(--erp-surface-primary);
    box-shadow: none;
}

.bi-dashboard-workbench--published-unified .bi-production-widget:hover {
    border-color: var(--erp-border-strong);
    box-shadow: var(--erp-shadow-xs);
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header {
    min-height: 30px;
    padding: 5px 8px;
    color: var(--erp-text-primary);
    background: var(--erp-surface-secondary);
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header strong {
    font-size: .69rem;
    font-weight: 800;
}

.bi-dashboard-workbench--published-unified .bi-production-widget--kpi .bi-widget-view {
    padding: 6px 8px;
    background: var(--erp-surface-primary);
}

.bi-dashboard-workbench--published-unified .bi-kpi-value {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--erp-color-primary);
    font-size: clamp(1.05rem, 2.15vw, 1.72rem);
    font-variant-numeric: tabular-nums lining-nums;
    letter-spacing: -.025em;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-dashboard-workbench--published-unified .bi-widget-view--enhanced .bi-chart-axis {
    stroke: var(--erp-border-strong);
}

.bi-dashboard-workbench--published-unified .bi-widget-view--enhanced .bi-chart-label,
.bi-dashboard-workbench--published-unified .bi-widget-view--enhanced .bi-chart-value-label {
    fill: var(--erp-text-secondary);
    font-family: inherit;
    pointer-events: none;
}

.bi-dashboard-workbench--published-unified .bi-widget-view--enhanced .bi-chart-label { font-size: 10px; }
.bi-dashboard-workbench--published-unified .bi-widget-view--enhanced .bi-chart-value-label {
    font-size: 9.5px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.bi-dashboard-workbench--published-unified .bi-widget-view--enhanced .bi-chart-point:focus-visible {
    outline: none;
    filter: brightness(1.12);
}

.bi-dashboard-workbench--published-unified .bi-chart-layout { position: relative; }

.bi-dashboard-workbench--published-unified .bi-chart-tooltip {
    position: absolute;
    z-index: 3;
    inset-block-start: var(--erp-space-2);
    inset-inline-start: 50%;
    max-width: calc(100% - var(--erp-space-4));
    padding: 5px 8px;
    border: 1px solid var(--erp-border-strong);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-primary);
    background: var(--erp-surface-elevated);
    box-shadow: var(--erp-shadow-sm);
    font-size: .65rem;
    line-height: 1.5;
    pointer-events: none;
    transform: translateX(-50%);
}

.bi-dashboard-workbench--published-unified .bi-chart-legend {
    gap: 2px;
    padding: var(--erp-space-2);
}

.bi-dashboard-workbench--published-unified .bi-chart-legend button {
    grid-template-columns: 10px minmax(0, 1fr) auto;
    gap: var(--erp-space-2);
    min-height: 28px;
    padding: 4px 6px;
    font-size: .68rem;
}

.bi-dashboard-workbench--published-unified .bi-chart-legend button span {
    overflow: hidden;
    color: var(--erp-text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-dashboard-workbench--published-unified .bi-chart-legend button strong {
    color: var(--erp-text-secondary);
    font-variant-numeric: tabular-nums;
}

.bi-dashboard-workbench--published-unified .bi-geo-region {
    fill: var(--bi-map-scale);
    stroke: var(--bi-map-boundary);
    stroke-width: 1.45;
}

.bi-dashboard-workbench--published-unified .bi-geo-region:hover,
.bi-dashboard-workbench--published-unified .bi-geo-region:focus-visible {
    filter: brightness(1.22) saturate(1.08);
    stroke: var(--erp-text-primary);
    stroke-width: 2;
}

.bi-dashboard-workbench--published-unified .bi-geo-region.is-selected {
    filter: brightness(1.16);
    stroke: var(--bi-chart-selection);
    stroke-width: 3;
}

@media (max-width: 1100px) {
    .bi-dashboard-workbench--published-unified .bi-production-canvas {
        grid-auto-rows: auto;
        min-height: 0;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-commandbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        align-items: center;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-heading {
        grid-column: 1 / -1;
        width: 100%;
        margin: 0;
        padding-block: 3px;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-report,
    .bi-dashboard-workbench--published-unified .bi-commandbar-reset,
    .bi-dashboard-workbench--published-unified .bi-commandbar-secondary { display: none; }

    .bi-dashboard-workbench--published-unified .bi-commandbar-updated {
        grid-column: 1;
        justify-self: start;
        border: 0;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-more {
        display: block;
        grid-column: 4;
        margin: 0;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-pages { display: none; }

    .bi-dashboard-workbench--published-unified .bi-dashboard-page-selector {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: var(--erp-space-3);
        min-height: 40px;
        padding: var(--erp-space-2) var(--erp-space-3);
        border: 1px solid var(--erp-border-default);
        border-radius: var(--erp-radius-sm);
        color: var(--erp-text-secondary);
        background: var(--erp-surface-primary);
        font-size: .68rem;
        font-weight: 750;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-page-selector select {
        width: 100%;
        min-width: 0;
        min-height: 40px;
        padding: 3px 8px;
        border: 1px solid var(--erp-border-default);
        border-radius: var(--erp-radius-control-small);
        color: var(--erp-text-primary);
        background: var(--erp-surface-secondary);
        font: inherit;
    }

    .bi-dashboard-workbench--published-unified .bi-production-widget { min-height: 286px; }
    .bi-dashboard-workbench--published-unified .bi-production-widget--kpi {
        min-height: 108px;
        height: 108px;
    }
}

@media (max-width: 720px) {
    .bi-dashboard-workbench--published-unified .bi-dashboard-commandbar {
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        width: 100%;
        padding: var(--erp-space-1) var(--erp-space-2);
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-heading strong {
        font-size: .76rem;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-updated span { display: inline; }

    .bi-dashboard-workbench--published-unified .bi-dashboard-page-selector {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .bi-dashboard-workbench--published-unified .bi-production-widget { min-height: 280px; }
    .bi-dashboard-workbench--published-unified .bi-production-widget--kpi {
        min-height: 102px;
        height: 102px;
    }

    .bi-dashboard-workbench--published-unified .bi-kpi-value {
        font-size: clamp(1.05rem, 7vw, 1.55rem);
    }

    .bi-dashboard-workbench--published-unified .bi-chart-legend {
        width: 100%;
        min-width: 0;
        max-height: 128px;
    }
}

.bi-page h1,
.bi-page h2,
.bi-page p { margin: 0; }

.bi-hero,
.bi-pagebar,
.bi-panel {
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-primary);
    box-shadow: var(--erp-shadow-xs);
}

.bi-hero,
.bi-pagebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
}

.bi-hero {
    background: linear-gradient(
        115deg,
        var(--erp-color-primary-subtle),
        var(--erp-surface-primary) 62%
    );
}

.bi-hero h1,
.bi-pagebar h1 { font-size: 1.3rem; }

.bi-hero p,
.bi-pagebar p {
    margin-top: 4px;
    color: var(--erp-text-tertiary);
    font-size: .82rem;
}

.bi-eyebrow {
    color: var(--erp-color-primary);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .14em;
}

.bi-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.bi-metrics article {
    display: grid;
    grid-template-rows: auto auto;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    padding: 14px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-primary);
}

.bi-metrics article > svg {
    grid-row: 1 / 3;
    color: var(--erp-color-primary);
}

.bi-metrics small,
.bi-flow a span,
.bi-source-summary small,
.bi-dashboard-list small,
.bi-settings-grid small,
.bi-settings-grid p,
.bi-empty { color: var(--erp-text-tertiary); }

.bi-metrics strong { font-size: 1.2rem; }
.bi-panel { padding: 16px; }

.bi-flow {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.bi-flow a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 16px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-xs);
    color: inherit;
    background: var(--erp-surface-primary);
    text-decoration: none;
}

.bi-flow a:hover,
.bi-dashboard-list > a:hover {
    border-color: var(--erp-border-primary);
    background: var(--erp-surface-hover);
}

.bi-flow a svg,
.bi-dashboard-list > a > svg,
.bi-settings-grid svg { color: var(--erp-color-primary); }

.bi-flow a span { font-size: .72rem; }
.bi-table { padding: 0; overflow: auto; }

.bi-table > header,
.bi-table > div {
    display: grid;
    grid-template-columns: 1.4fr .7fr 1fr .7fr 1fr .6fr;
    align-items: center;
    gap: 10px;
    min-width: 760px;
    padding: 11px 14px;
}

.bi-table > header {
    border-bottom: 1px solid var(--erp-border-default);
    color: var(--erp-text-tertiary);
    background: var(--erp-surface-secondary);
    font-size: .76rem;
}

.bi-table > div {
    border-bottom: 1px solid var(--erp-border-subtle);
    font-size: .82rem;
}

.bi-table > div:hover { background: var(--erp-surface-hover); }
.bi-table a { color: var(--erp-text-link); }

.bi-table > aside {
    display: flex;
    gap: 10px;
    padding: 8px 14px;
    color: var(--erp-text-danger);
    background: var(--erp-color-danger-subtle);
    font-size: .76rem;
}

.bi-empty { padding: 28px !important; text-align: center; }
.bi-form { display: grid; gap: 12px; }

.bi-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--erp-text-secondary);
    font-size: .78rem;
}

.bi-form input,
.bi-form select,
.bi-form textarea {
    padding: 9px 10px;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-control-small);
    outline: none;
    color: var(--erp-text-primary);
    background: var(--erp-surface-primary);
    font: inherit;
}

.bi-form input::placeholder,
.bi-form textarea::placeholder { color: var(--erp-text-disabled); }

.bi-form input:focus,
.bi-form input:focus-visible,
.bi-form select:focus,
.bi-form select:focus-visible,
.bi-form textarea:focus,
.bi-form textarea:focus-visible {
    border-color: var(--erp-border-focus);
    outline: none;
    box-shadow: var(--erp-shadow-focus);
}

.bi-form select option {
    color: var(--erp-text-primary);
    background: var(--erp-surface-elevated);
}

.bi-form input[type="checkbox"] { accent-color: var(--erp-color-primary); }
.bi-check { flex-direction: row !important; align-items: center; }
.bi-inline-form { grid-template-columns: 1fr 1fr auto; align-items: end; }

.bi-source-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.bi-source-summary div,
.bi-dashboard-list > a div,
.bi-settings-grid div { display: flex; flex-direction: column; }

.bi-preview { overflow: auto; }

.bi-preview > header,
.bi-preview > div {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(130px, 1fr);
    gap: 1px;
    min-width: max-content;
}

.bi-preview > header > * {
    padding: 9px;
    color: var(--erp-text-secondary);
    background: var(--erp-surface-secondary);
}

.bi-preview > div > * {
    padding: 8px;
    border-bottom: 1px solid var(--erp-border-subtle);
}

.bi-dashboard-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.bi-dashboard-list > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    color: inherit;
    background: var(--erp-surface-primary);
    text-decoration: none;
}

.bi-dashboard-list > a div { flex: 1; }
.bi-dashboard-list > a > span { font-size: .72rem; }

.bi-dashboard-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding-inline-end: 8px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-primary);
}

.bi-dashboard-list-item > a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    color: inherit;
    text-decoration: none;
}

.bi-dashboard-list-item > a > svg { color: var(--erp-color-primary); }
.bi-dashboard-list-item > a > div { flex: 1; min-width: 0; }
.bi-dashboard-list-item > a > span { font-size: .72rem; }
.bi-dashboard-list-item:hover {
    border-color: var(--erp-border-primary);
    background: var(--erp-surface-hover);
}

.bi-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.bi-published-pagebar {
    gap: 16px;
    background:
        linear-gradient(135deg, var(--erp-color-primary-subtle), transparent 52%),
        var(--erp-surface-primary);
}

.bi-published-search {
    display: flex;
    width: min(320px, 100%);
    min-height: 38px;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-tertiary);
    background: var(--erp-surface-secondary);
}

.bi-published-search:focus-within {
    border-color: var(--erp-border-focus);
    box-shadow: var(--erp-shadow-focus);
}

.bi-published-search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: var(--erp-text-primary);
    background: transparent;
    font: inherit;
    font-size: .76rem;
}

.bi-published-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.bi-published-card {
    display: flex;
    min-width: 0;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-primary);
    box-shadow: var(--erp-shadow-xs);
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.bi-published-card:hover {
    border-color: color-mix(in srgb, var(--erp-color-primary) 28%, var(--erp-border-default));
    box-shadow: var(--erp-shadow-sm);
    transform: translateY(-1px);
}

.bi-published-card__icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: var(--erp-radius-sm);
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
}

.bi-published-card__content {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 8px;
}

.bi-published-card__content > header,
.bi-published-card__content > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bi-published-card__content > header strong {
    overflow: hidden;
    color: var(--erp-text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-published-card__content > header span {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-color-success);
    background: var(--erp-color-success-subtle);
    font-size: .64rem;
    font-weight: 700;
}

.bi-published-card__content p {
    min-height: 38px;
    margin: 0;
    overflow: hidden;
    color: var(--erp-text-secondary);
    font-size: .72rem;
    line-height: 1.75;
}

.bi-published-card__content footer small {
    color: var(--erp-text-tertiary);
    font-size: .66rem;
}

.bi-published-card__content footer .erp-button {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    font-size: .7rem;
}

.bi-designer {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 14px;
    padding: 10px;
}

.bi-designer--published {
    grid-template-columns: minmax(0, 1fr);
}

.bi-designer > aside {
    padding: 12px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-xs);
    background: var(--erp-surface-secondary);
}

.bi-layout-fields {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.bi-canvas {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 56px;
    gap: 7px;
    min-height: 430px;
    padding: 8px;
    background-color: var(--erp-background-canvas);
    background-image:
        linear-gradient(var(--erp-border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--erp-border-subtle) 1px, transparent 1px);
    background-size: calc(100% / 12) 56px;
}

.bi-canvas article {
    overflow: hidden;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-xs);
    background: var(--erp-surface-primary);
}

.bi-canvas article header {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid var(--erp-border-subtle);
    color: var(--erp-text-secondary);
    background: var(--erp-surface-secondary);
    font-size: .74rem;
}

.bi-widget-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100% - 36px);
    gap: 6px;
    color: var(--erp-text-disabled);
    font-size: .72rem;
}

.bi-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bi-settings-grid article {
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-xs);
    background: var(--erp-surface-primary);
}

.bi-settings-grid p { margin-top: 5px; font-size: .76rem; }

.bi-source-kind,
.bi-pipeline-toolbar,
.bi-pipeline-step {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bi-source-kind {
    grid-column: 1 / -1;
}

.bi-pipeline-editor {
    display: grid;
    gap: 8px;
}

.bi-pipeline-toolbar {
    justify-content: flex-start;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--erp-border-subtle);
}

.bi-pipeline-toolbar > div {
    display: grid;
    margin-inline-end: auto;
}

.bi-pipeline-toolbar small {
    color: var(--erp-text-secondary);
}

.bi-pipeline-step {
    display: grid;
    grid-template-columns: 32px minmax(150px, .7fr) minmax(240px, 2fr) auto auto auto auto auto;
    padding: 8px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-xs);
    background: var(--erp-surface-secondary);
}

.bi-pipeline-import {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.bi-pipeline-import input[type="file"] {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.bi-query-runner {
    display: grid;
    gap: 12px;
}

.bi-query-runner > header p {
    margin-top: 4px;
    color: var(--erp-text-secondary);
}

.bi-query-runner .bi-form {
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
    align-items: end;
}

.bi-query-runner .bi-preview {
    overflow: auto;
}

.bi-query-runner table {
    width: 100%;
    border-collapse: collapse;
}

.bi-query-runner th,
.bi-query-runner td {
    padding: 8px 10px;
    border: 1px solid var(--erp-border-subtle);
    text-align: center;
}

.bi-quality-review {
    display: grid;
    gap: 12px;
}

.bi-quality-review details {
    padding: 10px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-xs);
}

.bi-quality-review pre {
    max-height: 360px;
    padding: 10px;
    overflow: auto;
    background: var(--erp-surface-secondary);
}

.bi-pipeline-step textarea {
    min-height: 58px;
    resize: vertical;
    font-family: ui-monospace, Consolas, monospace;
}

.bi-step-order {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: var(--erp-radius-xs);
    color: var(--erp-color-primary);
    background: var(--erp-surface-primary);
}

.bi-widget-view {
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100% - 36px);
    padding: 8px;
    overflow: auto;
}

.bi-widget-view > svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.bi-widget-view > svg text { fill: var(--erp-text-primary); }

.bi-kpi-value {
    color: var(--erp-color-primary);
    font-size: clamp(1.3rem, 3vw, 2.5rem);
}

.bi-widget-table {
    width: 100%;
    align-self: flex-start;
    font-size: .7rem;
}

.bi-widget-table > header,
.bi-widget-table > div {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(80px, 1fr);
    gap: 4px;
    padding: 5px;
    border-bottom: 1px solid var(--erp-border-subtle);
}

.bi-widget-table > header {
    color: var(--erp-text-secondary);
    background: var(--erp-surface-secondary);
}

@media (max-width: 900px) {
    .bi-metrics,
    .bi-dashboard-list { grid-template-columns: 1fr 1fr; }
    .bi-flow { grid-template-columns: 1fr; }
    .bi-flow > svg { justify-self: center; transform: rotate(-90deg); }
    .bi-designer { grid-template-columns: 1fr; }
    .bi-settings-grid { grid-template-columns: 1fr; }
    .bi-pipeline-step { grid-template-columns: 32px 1fr; }
    .bi-pipeline-step textarea { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .bi-metrics,
    .bi-dashboard-list,
    .bi-inline-form,
    .bi-source-summary { grid-template-columns: 1fr; }

    .bi-hero,
    .bi-pagebar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

.bi-dashboard-titlebar {
    position: sticky;
    top: 0;
    z-index: 8;
    gap: 16px;
    min-height: 76px;
    padding: 12px 16px;
    border: 1px solid var(--erp-border-subtle);
    background:
        linear-gradient(135deg, var(--erp-color-primary-subtle), transparent 48%),
        var(--erp-surface-primary);
    box-shadow: var(--erp-shadow-xs);
}

.bi-dashboard-titlebar h1 {
    margin: 2px 0;
    font-size: clamp(1rem, 1.7vw, 1.3rem);
}

.bi-dashboard-titlebar p { margin: 0; }

.bi-dashboard-workbench--published {
    gap: var(--erp-space-2);
    padding: var(--erp-space-2);
    border: 0;
    border-radius: 0;
    background: var(--erp-surface-secondary);
    box-shadow: none;
}

.bi-dashboard-commandbar {
    position: static;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    padding: 4px 6px;
    overflow-x: auto;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-primary);
    box-shadow: var(--erp-shadow-xs);
}

.bi-commandbar-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 4px 8px;
    border: 0;
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-secondary);
    background: transparent;
    font: inherit;
    font-size: .72rem;
    white-space: nowrap;
}

.bi-commandbar-button:hover:not(:disabled) {
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
}

.bi-commandbar-button:disabled {
    color: var(--erp-text-disabled);
    cursor: default;
}

.bi-commandbar-button .erp-icon {
    width: 16px;
    height: 16px;
}

.bi-commandbar-button strong {
    display: grid;
    min-width: 18px;
    height: 18px;
    padding-inline: 4px;
    place-items: center;
    border-radius: 9px;
    color: var(--erp-text-on-primary);
    background: var(--erp-color-primary);
    font-size: .62rem;
}

.bi-dashboard-actions,
.bi-dashboard-actions > *,
.bi-dashboard-pages,
.bi-dashboard-filters > header,
.bi-quality-panel > header,
.bi-drillthrough-panel > header,
.bi-production-widget > header,
.bi-production-widget > header nav,
.bi-widget-pager,
.bi-widget-diagnostics,
.bi-series-legend {
    display: flex;
    align-items: center;
}

.bi-dashboard-actions { gap: 8px; }

.bi-filter-launch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 6px 11px;
    border: 1px solid color-mix(in srgb, var(--erp-color-primary) 34%, var(--erp-border-default));
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
    font: inherit;
    font-size: .76rem;
    font-weight: 700;
}

.bi-filter-launch strong {
    display: grid;
    min-width: 20px;
    height: 20px;
    padding-inline: 4px;
    place-items: center;
    border-radius: 10px;
    color: var(--erp-text-on-primary);
    background: var(--erp-color-primary);
    font-size: .66rem;
}

.bi-quality-button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-primary);
    background: var(--erp-surface-secondary);
}

.bi-quality-button strong {
    display: grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    color: var(--erp-text-on-primary);
    background: var(--erp-color-warning);
    font-size: .7rem;
}

.bi-dashboard-pages {
    position: sticky;
    top: 84px;
    z-index: 7;
    gap: 4px;
    padding: 5px;
    overflow-x: auto;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-primary);
    box-shadow: var(--erp-shadow-xs);
}

.bi-dashboard-pages button {
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 0;
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-secondary);
    background: transparent;
    font: inherit;
    font-size: .78rem;
}

.bi-dashboard-pages button:hover { background: var(--erp-surface-hover); }

.bi-dashboard-pages button.is-active {
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
    font-weight: 800;
}

.bi-dashboard-workbench--published .bi-dashboard-pages {
    position: static;
    width: 100%;
    min-height: 42px;
    gap: var(--erp-space-2);
    margin: 0;
    padding: var(--erp-space-2);
    border-color: var(--erp-border-default);
    background: var(--erp-surface-primary);
    box-shadow: none;
}

.bi-dashboard-workbench--published .bi-dashboard-pages__label {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    align-self: stretch;
    gap: var(--erp-space-2);
    padding-inline: var(--erp-space-3);
    border-inline-end: 1px solid var(--erp-border-default);
    color: var(--erp-text-secondary);
    font-size: .72rem;
    font-weight: 750;
    white-space: nowrap;
}

.bi-dashboard-workbench--published .bi-dashboard-pages__label .erp-icon {
    width: 15px;
    height: 15px;
}

.bi-dashboard-workbench--published .bi-dashboard-pages button {
    min-height: 32px;
    padding: 5px 12px;
    border: 1px solid var(--erp-border-default);
    color: var(--erp-text-primary);
    background: var(--erp-surface-secondary);
    font-weight: 650;
}

.bi-dashboard-workbench--published .bi-dashboard-pages button:hover {
    border-color: var(--erp-border-primary);
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
}

.bi-dashboard-workbench--published .bi-dashboard-pages button.is-active {
    border-color: var(--erp-color-primary);
    color: var(--erp-text-inverse);
    background: var(--erp-color-primary);
    box-shadow: var(--erp-shadow-xs);
    font-weight: 800;
}

.bi-dashboard-workbench--published .bi-designer--published {
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.bi-dashboard-filters { padding: 10px 12px; }

.bi-filter-summary {
    border-color: color-mix(in srgb, var(--erp-color-primary) 16%, var(--erp-border-subtle));
    background: var(--erp-surface-secondary);
}

.bi-dashboard-filters > header,
.bi-quality-panel > header {
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.bi-filter-summary__actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bi-filter-summary__actions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bi-filter-summary__actions button.is-primary {
    color: var(--erp-color-primary);
    border-color: color-mix(in srgb, var(--erp-color-primary) 28%, var(--erp-border-default));
    background: var(--erp-color-primary-subtle);
    font-weight: 700;
}

.bi-dashboard-filters > header > div,
.bi-quality-panel > header > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bi-dashboard-filters small,
.bi-quality-panel small,
.bi-drillthrough-panel small {
    color: var(--erp-text-tertiary);
    font-size: .68rem;
}

.bi-dashboard-filters button,
.bi-quality-panel button,
.bi-drillthrough-panel button,
.bi-production-widget > header button,
.bi-production-widget > header select,
.bi-widget-pager button {
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-secondary);
    background: var(--erp-surface-primary);
    font: inherit;
}

.bi-dashboard-filters > header > button,
.bi-quality-panel > header > button {
    padding: 6px 10px;
    font-size: .7rem;
}

.bi-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 6px;
}

.bi-filter-control {
    position: relative;
    min-width: 0;
}

.bi-filter-control summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 34px;
    gap: 8px;
    padding: 6px 9px;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-secondary);
    background: var(--erp-surface-secondary);
    cursor: pointer;
    font-size: .72rem;
    list-style: none;
}

.bi-filter-control summary::-webkit-details-marker { display: none; }

.bi-filter-control summary strong {
    display: grid;
    min-width: 18px;
    height: 18px;
    place-items: center;
    border-radius: 50%;
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
    font-size: .64rem;
}

.bi-filter-control > div {
    position: absolute;
    z-index: 30;
    inset-inline: 0;
    top: calc(100% + 4px);
    display: grid;
    max-height: 260px;
    padding: 6px;
    overflow: auto;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-elevated);
    box-shadow: var(--erp-shadow-lg);
}

.bi-filter-control label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px;
    border-radius: var(--erp-radius-xs);
    font-size: .72rem;
}

.bi-filter-control label:hover { background: var(--erp-surface-hover); }
.bi-filter-control input { accent-color: var(--erp-color-primary); }

.bi-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid var(--erp-border-subtle);
}

.bi-active-filters button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 7px;
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
    font-size: .67rem;
}

.bi-active-filters button.is-cross {
    color: var(--erp-color-info);
    background: var(--erp-color-info-subtle);
}

.bi-active-filters b { font-size: .85rem; }

.bi-filter-workbench {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    min-height: 430px;
    max-height: min(64vh, 620px);
    overflow: hidden;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-primary);
}

.bi-filter-categories {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    border-inline-end: 1px solid var(--erp-border-subtle);
    background: var(--erp-surface-secondary);
}

.bi-filter-categories button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-secondary);
    background: transparent;
    font: inherit;
    font-size: .75rem;
    text-align: start;
}

.bi-filter-categories button:hover { background: var(--erp-surface-hover); }

.bi-filter-categories button.is-active {
    color: var(--erp-color-primary);
    border-color: color-mix(in srgb, var(--erp-color-primary) 24%, transparent);
    background: var(--erp-color-primary-subtle);
    font-weight: 800;
}

.bi-filter-categories strong {
    display: grid;
    min-width: 21px;
    height: 21px;
    place-items: center;
    border-radius: 11px;
    color: var(--erp-color-primary);
    background: var(--erp-surface-primary);
    font-size: .66rem;
}

.bi-filter-values {
    display: flex;
    min-width: 0;
    padding: 14px;
    overflow: hidden;
    flex-direction: column;
    gap: 10px;
}

.bi-filter-values > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bi-filter-values > header > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bi-filter-values > header small {
    color: var(--erp-text-tertiary);
    font-size: .69rem;
}

.bi-filter-values > header button {
    padding: 6px 9px;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-secondary);
    background: var(--erp-surface-primary);
    font: inherit;
    font-size: .68rem;
}

.bi-filter-search {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-tertiary);
    background: var(--erp-surface-secondary);
}

.bi-filter-search:focus-within {
    border-color: var(--erp-border-focus);
    box-shadow: var(--erp-shadow-focus);
}

.bi-filter-search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: var(--erp-text-primary);
    background: transparent;
    font: inherit;
    font-size: .76rem;
}

.bi-dashboard-page-selector select:focus:not(:disabled),
.bi-dashboard-page-selector select:focus-visible:not(:disabled) {
    border-color: var(--erp-border-focus);
    outline: none;
    box-shadow: var(--erp-shadow-focus);
}

.bi-filter-value-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding-inline-end: 3px;
    overflow-y: auto;
}

.bi-filter-value-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-secondary);
    background: var(--erp-surface-secondary);
    cursor: pointer;
    font-size: .74rem;
}

.bi-filter-value-list label:hover {
    border-color: var(--erp-border-default);
    background: var(--erp-surface-hover);
}

.bi-filter-value-list label.is-selected {
    color: var(--erp-color-primary);
    border-color: color-mix(in srgb, var(--erp-color-primary) 30%, transparent);
    background: var(--erp-color-primary-subtle);
}

.bi-filter-value-list input {
    width: 15px;
    height: 15px;
    accent-color: var(--erp-color-primary);
}

.bi-filter-value-list label > span { flex: 1; }
.bi-filter-value-list label > .erp-icon { opacity: 0; }
.bi-filter-value-list label.is-selected > .erp-icon { opacity: 1; }

.bi-filter-state {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--erp-text-tertiary);
    font-size: .75rem;
}

.bi-filter-state.is-error { color: var(--erp-color-danger); }

.bi-filter-state i {
    width: 16px;
    height: 16px;
    border: 2px solid var(--erp-border-default);
    border-top-color: var(--erp-color-primary);
    border-radius: 50%;
    animation: bi-spin .8s linear infinite;
}

.bi-filter-dialog-footer {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bi-filter-dialog-footer > span {
    color: var(--erp-text-tertiary);
    font-size: .72rem;
}

.bi-filter-dialog-footer > div {
    display: flex;
    gap: 7px;
}

.bi-quality-panel > div {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
}

.bi-quality-panel article {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-xs);
    background: var(--erp-surface-secondary);
}

.bi-quality-panel article span {
    color: var(--erp-text-tertiary);
    font-size: .68rem;
}

.bi-quality-panel article strong { font-size: 1.05rem; }

.bi-drillthrough-panel {
    position: fixed;
    z-index: 60;
    inset-block: 74px 18px;
    inset-inline-end: 18px;
    width: min(420px, calc(100vw - 36px));
    padding: 14px;
    overflow: auto;
    border: 1px solid var(--erp-border-strong);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-elevated);
    box-shadow: var(--erp-shadow-xl);
}

.bi-drillthrough-panel:focus-visible {
    outline: 2px solid var(--erp-border-focus);
    outline-offset: 2px;
}

.bi-drillthrough-panel > header {
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--erp-border-subtle);
}

.bi-drillthrough-panel > header > div {
    display: flex;
    flex-direction: column;
}

.bi-drillthrough-panel > header button {
    width: 30px;
    height: 30px;
}

.bi-drillthrough-context {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 12px 0;
}

.bi-drillthrough-context span {
    padding: 5px 8px;
    border-radius: var(--erp-radius-xs);
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
    font-size: .7rem;
}

.bi-production-canvas {
    grid-auto-rows: 70px;
    min-height: 680px;
    background-size: calc(100% / 12) 70px;
}

.bi-production-canvas--published {
    gap: var(--erp-space-2);
    padding: var(--erp-space-2);
    background-color: var(--erp-surface-secondary);
    background-image: none;
}

.bi-production-widget {
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.bi-production-widget:hover {
    border-color: var(--erp-border-strong);
    box-shadow: var(--erp-shadow-sm);
}

.bi-production-widget > header {
    flex: 0 0 auto;
    justify-content: space-between;
    gap: 8px;
    min-height: 38px;
}

.bi-production-widget > header > div {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.bi-production-widget > header strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-production-widget > header nav { gap: 3px; }

.bi-production-widget > header button,
.bi-production-widget > header select {
    min-width: 25px;
    height: 25px;
    padding: 2px 5px;
    font-size: .65rem;
}

.bi-production-widget > header button:disabled {
    opacity: .35;
    cursor: default;
}

.bi-widget-help {
    position: relative;
    display: inline-grid;
    width: 17px;
    height: 17px;
    font-size: .63rem;
}

.bi-widget-help summary {
    display: grid;
    width: 17px;
    height: 17px;
    place-items: center;
    border-radius: 50%;
    color: var(--erp-color-info);
    background: var(--erp-color-info-subtle);
    cursor: help;
    list-style: none;
}

.bi-widget-help summary::-webkit-details-marker { display: none; }
.bi-widget-help summary:focus-visible {
    outline: 2px solid var(--erp-border-focus);
    outline-offset: 2px;
}

.bi-widget-help > span {
    position: absolute;
    z-index: 5;
    inset-block-start: calc(100% + 7px);
    inset-inline-start: 0;
    display: none;
    width: min(260px, calc(100vw - 48px));
    padding: var(--erp-space-2) var(--erp-space-3);
    border: 1px solid var(--erp-border-strong);
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-primary);
    background: var(--erp-surface-elevated);
    box-shadow: var(--erp-shadow-lg);
    font-size: .72rem;
    font-weight: 400;
    line-height: 1.75;
    text-align: start;
}

.bi-widget-help[open] > span { display: block; }

.bi-production-widget--kpi .bi-widget-view {
    background:
        linear-gradient(135deg, var(--erp-color-primary-subtle), transparent 72%);
}

.bi-drill-breadcrumb {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    overflow-x: auto;
    border-bottom: 1px solid var(--erp-border-subtle);
    color: var(--erp-text-tertiary);
    font-size: .62rem;
}

.bi-drill-breadcrumb span:not(:last-child)::after {
    content: "‹";
    margin-inline-start: 4px;
}

.bi-drill-breadcrumb span.is-current {
    color: var(--erp-color-primary);
    font-weight: 700;
}

.bi-production-widget .bi-widget-view {
    flex: 1;
    height: auto;
    min-height: 0;
}

.bi-widget-loading,
.bi-visual-error,
.bi-visual-empty {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 12px;
    color: var(--erp-text-tertiary);
    text-align: center;
    font-size: .72rem;
}

.bi-widget-loading i {
    width: 24px;
    height: 24px;
    border: 3px solid var(--erp-border-default);
    border-top-color: var(--erp-color-primary);
    border-radius: 50%;
    animation: bi-spin .8s linear infinite;
}

.bi-visual-error {
    color: var(--erp-text-danger);
    background: var(--erp-color-danger-subtle);
}

.bi-visual-error button {
    padding: 5px 8px;
    border: 1px solid currentColor;
    border-radius: var(--erp-radius-control-small);
    color: inherit;
    background: transparent;
}

.bi-widget-pager,
.bi-widget-diagnostics {
    flex: 0 0 auto;
    justify-content: center;
    gap: 6px;
    min-height: 25px;
    padding: 3px 7px;
    border-top: 1px solid var(--erp-border-subtle);
    color: var(--erp-text-tertiary);
    background: var(--erp-surface-secondary);
    font-size: .6rem;
}

.bi-widget-pager button { padding: 2px 7px; }
.bi-widget-pager button:disabled { opacity: .4; }

.bi-widget-diagnostics {
    justify-content: flex-start;
    overflow-x: auto;
    color: var(--erp-color-info);
    font-family: ui-monospace, Consolas, monospace;
    white-space: nowrap;
}

.bi-widget-view--table {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    overflow: hidden;
}

.bi-widget-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 100%;
    overflow: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
    font-size: .75rem;
    line-height: 1.55;
}

.bi-widget-table > header,
.bi-widget-table-row {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: var(--bi-table-columns, repeat(2, minmax(120px, 1fr)));
    align-items: center;
    gap: 0;
    width: 100%;
    min-width: var(--bi-table-min-width, 100%);
    min-height: 42px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--erp-border-subtle);
    color: var(--erp-text-primary);
    background: transparent;
    text-align: center;
    font: inherit;
}

.bi-widget-table > header > *,
.bi-widget-table-row > * {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    padding: 8px 12px;
    overflow: hidden;
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-widget-table > header > *:not(:last-child),
.bi-widget-table-row > *:not(:last-child) {
    border-inline-end: 1px solid var(--erp-border-subtle);
}

.bi-widget-table > header {
    position: sticky;
    top: 0;
    z-index: 3;
    color: var(--erp-text-secondary);
    background: var(--erp-surface-secondary);
    text-align: start;
}

.bi-widget-table > header > strong {
    width: 100%;
    font-size: .75rem;
    font-weight: 650;
    line-height: 1.55;
    text-align: start;
}

.bi-widget-table-row:nth-of-type(even) { background: var(--erp-surface-muted); }
.bi-widget-table-row:hover { background: var(--erp-surface-hover); }
.bi-widget-table-row:last-child { border-bottom: 0; }

.bi-widget-table-row:focus-visible {
    position: relative;
    z-index: 2;
    outline: 2px solid var(--erp-border-focus);
    outline-offset: -2px;
}

.bi-widget-table__cell--numeric {
    direction: ltr;
    justify-content: flex-end;
    font-variant-numeric: tabular-nums;
    text-align: end;
    unicode-bidi: isolate;
}

.bi-widget-table > header .bi-widget-table__cell--numeric {
    direction: rtl;
}

.bi-widget-table__cell--date,
.bi-widget-table__cell--status {
    justify-content: center;
    text-align: center;
}

.bi-widget-table__cell--date {
    direction: ltr;
    font-variant-numeric: tabular-nums;
    unicode-bidi: isolate;
}

.bi-widget-table > header .bi-widget-table__cell--date {
    direction: rtl;
}

@media (max-width: 1100px) {
    .bi-widget-table > header > *,
    .bi-widget-table-row > * {
        padding-inline: 10px;
    }
}

.bi-chart-layout,
.bi-donut-layout {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.bi-chart-layout { flex-direction: column; }
.bi-donut-layout { position: relative; }
.bi-chart-layout svg { flex: 1; width: 100%; min-height: 0; }
.bi-donut-layout svg { flex: 1; min-width: 0; }
html[data-theme="dark"] .bi-donut-layout svg > text:not(.bi-chart-caption) {
    fill: var(--erp-text-primary);
}

.bi-chart-point {
    cursor: pointer;
    transition: opacity .15s ease, filter .15s ease;
}

.bi-chart-point:hover { filter: brightness(1.12); }
.bi-chart-layout .bi-chart-point--selected,
.bi-widget-view > svg .bi-chart-point--selected,
.bi-chart-layout .bi-chart-point:focus-visible,
.bi-widget-view > svg .bi-chart-point:focus-visible {
    stroke: var(--bi-chart-selection);
    stroke-width: 2;
}
.bi-donut-layout .bi-chart-point--selected,
.bi-donut-layout .bi-chart-point:focus-visible {
    stroke-width: 28;
    filter: brightness(1.06) drop-shadow(0 0 1px var(--bi-chart-selection));
}
.bi-chart-axis { stroke: var(--erp-border-default); stroke-width: 1; }
.bi-chart-label { fill: var(--erp-text-tertiary); font-size: 10px; }
.bi-chart-caption { fill: var(--erp-text-tertiary); font-size: 10px; }

.bi-series-legend {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: 24px;
    font-size: .68rem;
}

.bi-series-legend span,
.bi-chart-legend button {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bi-series-legend i,
.bi-chart-legend i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.bi-chart-legend {
    display: grid;
    align-content: center;
    width: 46%;
    min-width: 150px;
    padding: 6px;
    overflow: auto;
}

.bi-chart-legend button {
    display: grid;
    grid-template-columns: auto 1fr auto;
    padding: 4px;
    border: 0;
    border-radius: var(--erp-radius-xs);
    color: var(--erp-text-secondary);
    background: transparent;
    text-align: start;
    font: inherit;
    font-size: .62rem;
}

.bi-chart-legend button:hover { background: var(--erp-surface-hover); }

.bi-geo-choropleth {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 28%);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
    height: 100%;
    min-height: 260px;
}

.bi-insight-card {
    position: absolute;
    z-index: 4;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 280px;
    min-width: min(248px, calc(100% - 24px));
    max-width: min(320px, calc(100% - 24px));
    padding: var(--erp-space-6);
    border: 1px solid var(--erp-border-strong);
    border-block-start: 2px solid var(--bi-map-scale);
    border-radius: var(--erp-radius-sm);
    color: var(--erp-text-primary);
    background: var(--erp-surface-elevated);
    box-shadow: var(--erp-shadow-sm);
    direction: rtl;
    text-align: start;
    pointer-events: auto;
}

.bi-insight-card[hidden] { display: none; }

.bi-insight-card__header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bi-insight-card__eyebrow {
    color: var(--erp-text-secondary);
    font-size: .6875rem;
    font-weight: 700;
    line-height: 1.45;
}

.bi-insight-card__title {
    min-width: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
}

.bi-insight-card__primary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-block: var(--erp-space-4);
}

.bi-insight-card__primary > span {
    color: var(--erp-text-secondary);
    font-size: .75rem;
    line-height: 1.5;
}

.bi-insight-card__primary > strong {
    min-width: 0;
    color: var(--erp-text-primary);
    font-size: clamp(1.375rem, 2vw, 1.5rem);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.bi-insight-card__primary > strong.is-unavailable {
    color: var(--erp-text-tertiary);
    font-size: .8125rem;
    font-weight: 650;
}

.bi-insight-card__secondary {
    display: flex;
    flex-direction: column;
    gap: var(--erp-space-2);
    padding-block-start: var(--erp-space-4);
    border-block-start: 1px solid var(--erp-border-subtle);
}

.bi-insight-card__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--erp-space-4);
    min-width: 0;
    font-size: .75rem;
    line-height: 1.6;
}

.bi-insight-card__row > span {
    min-width: 0;
    color: var(--erp-text-secondary);
}

.bi-insight-card__row > strong {
    flex: 0 0 auto;
    color: var(--erp-text-tertiary);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    text-align: end;
}

.bi-geo-choropleth > svg {
    width: 100%;
    height: 100%;
    min-height: 240px;
    overflow: visible;
}

.bi-geo-region {
    fill: var(--bi-map-scale);
    stroke: var(--bi-map-boundary);
    stroke-width: 1.1;
    vector-effect: non-scaling-stroke;
    transition: fill-opacity .16s ease, filter .16s ease, stroke .16s ease;
}

.bi-geo-region[role="button"] { cursor: pointer; }
.bi-geo-region:hover,
.bi-geo-region:focus-visible { filter: brightness(1.13); outline: none; }
.bi-dashboard-workbench--published-unified .bi-geo-region:focus-visible,
.bi-geo-region:focus-visible {
    stroke: var(--erp-border-focus);
    stroke-width: 2.5;
}
.bi-geo-region.is-selected {
    stroke: var(--bi-chart-selection);
    stroke-width: 2.5;
}
.bi-geo-region:not([role="button"]) {
    fill: var(--bi-map-no-data);
    fill-opacity: 1 !important;
}

.bi-geo-unmatched {
    align-self: center;
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-sm);
    color: var(--erp-text-secondary);
    background: var(--erp-surface-muted);
    font-size: .72rem;
}

.bi-geo-unmatched button {
    border: 0;
    border-radius: var(--erp-radius-xs);
    padding: 6px;
    color: inherit;
    background: transparent;
    text-align: start;
    font: inherit;
}

.bi-geo-unmatched button:hover { background: var(--erp-surface-hover); }
.bi-geo-attribution {
    grid-column: 1 / -1;
    color: var(--erp-text-tertiary);
    font-size: .62rem;
}

@media (max-width: 760px) {
    .bi-geo-choropleth { grid-template-columns: 1fr; }
    .bi-geo-attribution { grid-column: auto; }

    .bi-insight-card {
        width: min(320px, calc(100% - 24px));
        min-width: min(280px, calc(100% - 24px));
        padding: var(--erp-space-6);
    }

    .bi-insight-card__primary > strong {
        font-size: clamp(1.25rem, 6vw, 1.4375rem);
    }
}

@keyframes bi-spin { to { transform: rotate(360deg); } }

@media print {
    .erp-sidebar,
    .erp-workspace-tabs,
    .erp-topbar,
    .bi-dashboard-commandbar,
    .bi-dashboard-actions,
    .bi-dashboard-filters,
    .bi-production-widget > header nav,
    .bi-widget-diagnostics,
    .bi-widget-pager { display: none !important; }
    .bi-page { height: auto; overflow: visible; box-shadow: none; }
    .bi-production-canvas { display: block; background: none; }
    .bi-production-widget {
        min-height: 260px;
        margin-bottom: 12px;
        break-inside: avoid;
    }
}

@media (max-width: 1100px) {
    .bi-filter-grid { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
    .bi-published-grid { grid-template-columns: 1fr; }
    .bi-quality-panel > div { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
    .bi-dashboard-titlebar { position: static; }
    .bi-dashboard-pages { top: 0; }
    .bi-published-pagebar { align-items: stretch; }
    .bi-published-search { width: 100%; }
    .bi-published-card__content > footer {
        align-items: stretch;
        flex-direction: column;
    }
    .bi-published-card__content footer .erp-button { justify-content: center; }
    .bi-filter-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
    .bi-filter-summary > header,
    .bi-filter-values > header,
    .bi-filter-dialog-footer {
        align-items: stretch;
        flex-direction: column;
    }
    .bi-filter-summary__actions,
    .bi-filter-dialog-footer > div { width: 100%; }
    .bi-filter-summary__actions > *,
    .bi-filter-dialog-footer > div > * { flex: 1; }
    .bi-filter-workbench {
        grid-template-columns: 1fr;
        max-height: 68vh;
    }
    .bi-filter-categories {
        flex-direction: row;
        overflow-x: auto;
        border-inline-end: 0;
        border-bottom: 1px solid var(--erp-border-subtle);
    }
    .bi-filter-categories button { flex: 0 0 auto; }
    .bi-filter-value-list { grid-template-columns: 1fr; }
    .bi-quality-panel > div { grid-template-columns: 1fr 1fr; }
    .bi-production-canvas {
        display: flex;
        flex-direction: column;
        background: none;
    }
    .bi-production-widget {
        min-height: 290px;
        grid-column: auto !important;
        grid-row: auto !important;
    }
    .bi-production-widget--kpi { min-height: 150px; }
}

/* Unified BI presentation: shared by every published dashboard. */
.bi-dashboard-workbench--published-unified {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.bi-dashboard-workbench--published-unified .bi-dashboard-commandbar {
    flex-wrap: wrap;
    overflow: visible;
}

.bi-commandbar-report,
.bi-commandbar-updated {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--erp-space-2);
    min-height: 30px;
    padding-inline: var(--erp-space-3);
    color: var(--erp-text-tertiary);
    font-size: .68rem;
    white-space: nowrap;
}

.bi-commandbar-report {
    max-width: min(320px, 35vw);
    border-inline-end: 1px solid var(--erp-border-default);
}

.bi-commandbar-report strong {
    overflow: hidden;
    color: var(--erp-text-primary);
    font-size: .72rem;
    text-overflow: ellipsis;
}

.bi-commandbar-updated {
    margin-inline-start: auto;
}

.bi-commandbar-updated strong {
    color: var(--erp-text-secondary);
    font-variant-numeric: tabular-nums;
}

.bi-commandbar-more { display: none; }

.bi-active-filter-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--erp-space-3);
    min-height: 38px;
    padding: var(--erp-space-2) var(--erp-space-3);
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-sm);
    color: var(--erp-text-secondary);
    background: var(--erp-surface-primary);
    font-size: .68rem;
}

.bi-active-filter-summary > span,
.bi-active-filter-summary > div,
.bi-active-filter-summary > div > button {
    display: flex;
    align-items: center;
}

.bi-active-filter-summary > span { gap: var(--erp-space-2); font-weight: 700; }

.bi-active-filter-summary > div {
    gap: var(--erp-space-2);
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.bi-active-filter-summary > div > button {
    flex: 0 0 auto;
    gap: var(--erp-space-2);
    min-height: 26px;
    padding: 3px 7px;
    border: 1px solid var(--erp-border-primary);
    border-radius: var(--erp-radius-pill);
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
    font: inherit;
}

.bi-active-filter-summary > div > button strong { font-size: .82rem; }

.bi-active-filter-summary__reset {
    min-height: 28px;
    padding: 3px 8px;
    border: 0;
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-link);
    background: transparent;
    font: inherit;
    font-weight: 700;
}

.bi-dashboard-workbench--published-unified .bi-production-canvas,
.bi-dashboard-workbench--published-unified .bi-production-widget,
.bi-dashboard-workbench--published-unified .bi-widget-view {
    min-width: 0;
    max-width: 100%;
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header {
    padding-inline: var(--erp-space-4);
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header strong {
    color: var(--erp-text-primary);
    font-weight: 700;
}

.bi-dashboard-workbench--published-unified .bi-kpi-value {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(1.2rem, 2.4vw, 2rem);
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-dashboard-workbench--published-unified .bi-widget-table {
    max-width: 100%;
    overflow-x: auto;
}

.bi-dashboard-workbench--published-unified .bi-visual-error span {
    max-width: 42ch;
    line-height: 1.7;
}

@media (min-width: 721px) and (max-width: 1100px) {
    .bi-dashboard-workbench--published-unified .bi-production-canvas {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-auto-rows: auto;
    }

    .bi-dashboard-workbench--published-unified .bi-production-widget {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        min-height: 320px;
    }

    .bi-dashboard-workbench--published-unified .bi-production-widget--kpi {
        grid-column: span 3 !important;
        min-height: 145px;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-report {
        order: -1;
        width: 100%;
        max-width: none;
        border-inline-end: 0;
        border-bottom: 1px solid var(--erp-border-subtle);
    }
}

@media (max-width: 720px) {
    .bi-dashboard-workbench--published-unified {
        gap: var(--erp-space-2);
        padding: 0;
        overflow-x: hidden;
        border-radius: 0;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-commandbar {
        position: relative;
        gap: var(--erp-space-1);
        padding: var(--erp-space-2);
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-report {
        order: -2;
        width: 100%;
        max-width: none;
        border-inline-end: 0;
        border-bottom: 1px solid var(--erp-border-subtle);
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-secondary { display: none; }
    .bi-dashboard-workbench--published-unified .bi-commandbar-updated {
        order: -1;
        margin-inline-start: 0;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-more {
        position: relative;
        display: block;
        margin-inline-start: auto;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-more summary {
        display: inline-flex;
        align-items: center;
        gap: var(--erp-space-2);
        min-height: 30px;
        padding: 4px 8px;
        border-radius: var(--erp-radius-control-small);
        color: var(--erp-text-secondary);
        cursor: pointer;
        font-size: .7rem;
        list-style: none;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-more summary::-webkit-details-marker { display: none; }

    .bi-dashboard-workbench--published-unified .bi-commandbar-more > div {
        position: absolute;
        z-index: var(--erp-z-dropdown);
        inset-block-start: calc(100% + var(--erp-space-2));
        inset-inline-end: 0;
        display: grid;
        width: 150px;
        padding: var(--erp-space-2);
        border: 1px solid var(--erp-border-default);
        border-radius: var(--erp-radius-md);
        background: var(--erp-surface-elevated);
        box-shadow: var(--erp-shadow-lg);
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-more button {
        display: flex;
        align-items: center;
        gap: var(--erp-space-2);
        min-height: 34px;
        padding: var(--erp-space-2) var(--erp-space-3);
        border: 0;
        border-radius: var(--erp-radius-control-small);
        color: var(--erp-text-primary);
        background: transparent;
        font: inherit;
        font-size: .7rem;
        text-align: start;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-pages {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-pages__label { display: none; }

    .bi-dashboard-workbench--published-unified .bi-active-filter-summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .bi-dashboard-workbench--published-unified .bi-active-filter-summary > span { display: none; }

    .bi-dashboard-workbench--published-unified .bi-production-canvas {
        display: flex;
        width: 100%;
        max-width: 100%;
        padding: var(--erp-space-2);
        overflow-x: hidden;
    }

    .bi-dashboard-workbench--published-unified .bi-production-widget,
    .bi-dashboard-workbench--published-unified .bi-production-widget--kpi {
        flex: 0 0 auto;
        width: 100%;
        min-height: 300px;
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .bi-dashboard-workbench--published-unified .bi-production-widget--kpi { min-height: 135px; }

    .bi-dashboard-workbench--published-unified .bi-kpi-value {
        font-size: clamp(1.15rem, 7vw, 1.7rem);
    }

    .bi-dashboard-workbench--published-unified .bi-chart-legend {
        width: 100%;
        min-width: 0;
    }
}

/* Iteration 2 cascade lock: follows the accepted iteration-1 profile rules. */
.bi-dashboard-workbench--published-unified .bi-dashboard-commandbar {
    min-height: 36px;
    gap: var(--erp-space-1);
    padding: 2px var(--erp-space-2);
    overflow: visible;
}

.bi-dashboard-workbench--published-unified .bi-dashboard-pages {
    min-height: 38px;
    overflow-x: auto;
    scrollbar-width: none;
}

.bi-dashboard-workbench--published-unified .bi-dashboard-pages::-webkit-scrollbar { display: none; }

.bi-dashboard-workbench--published-unified .bi-production-canvas {
    grid-auto-rows: 52px;
    background-size: calc(100% / 12) 52px;
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header {
    min-height: 30px;
    padding: 5px 8px;
}

.bi-dashboard-workbench--published-unified .bi-production-widget--kpi .bi-widget-view {
    background: var(--erp-surface-primary);
}

@media (max-width: 1100px) {
    .bi-dashboard-workbench--published-unified .bi-production-canvas {
        grid-auto-rows: auto;
        min-height: 0;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-commandbar {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        align-items: center;
        flex-wrap: initial;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-heading {
        grid-column: 1 / -1;
        width: 100%;
        margin: 0;
        padding-block: 3px;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-report,
    .bi-dashboard-workbench--published-unified .bi-commandbar-reset,
    .bi-dashboard-workbench--published-unified .bi-commandbar-secondary { display: none; }

    .bi-dashboard-workbench--published-unified .bi-commandbar-updated {
        grid-column: 3;
        justify-self: start;
        border: 0;
    }

    .bi-dashboard-workbench--published-unified .bi-commandbar-more {
        display: block;
        grid-column: 4;
        margin: 0;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-pages { display: none; }

    .bi-dashboard-workbench--published-unified .bi-dashboard-page-selector {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: var(--erp-space-3);
        min-height: 40px;
        padding: var(--erp-space-2) var(--erp-space-3);
        border: 1px solid var(--erp-border-default);
        border-radius: var(--erp-radius-sm);
        color: var(--erp-text-secondary);
        background: var(--erp-surface-primary);
        font-size: .68rem;
        font-weight: 750;
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-page-selector select {
        width: 100%;
        min-width: 0;
        min-height: 40px;
        padding: 3px 8px;
        border: 1px solid var(--erp-border-default);
        border-radius: var(--erp-radius-control-small);
        color: var(--erp-text-primary);
        background: var(--erp-surface-secondary);
        font: inherit;
    }

    .bi-dashboard-workbench--published-unified .bi-production-widget { min-height: 286px; }
    .bi-dashboard-workbench--published-unified .bi-production-widget--kpi {
        min-height: 108px;
        height: 108px;
    }
}

@media (max-width: 720px) {
    .bi-dashboard-workbench--published-unified .bi-dashboard-commandbar {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr) auto;
        width: 100%;
        padding: var(--erp-space-1) var(--erp-space-2);
    }

    .bi-dashboard-workbench--published-unified .bi-dashboard-page-selector {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .bi-dashboard-workbench--published-unified .bi-production-widget { min-height: 280px; }
    .bi-dashboard-workbench--published-unified .bi-production-widget--kpi {
        min-height: 102px;
        height: 102px;
    }

    .bi-dashboard-workbench--published-unified .bi-kpi-value {
        font-size: clamp(1.05rem, 7vw, 1.55rem);
    }

    .erp-workspace-tab:has(.erp-workspace-tab__activate[title="داشبورد مدیریتی"]) {
        flex: 0 0 auto;
        max-width: none;
    }

    .erp-workspace-tab__activate[title="داشبورد مدیریتی"] span {
        max-width: none;
        overflow: visible;
        text-overflow: clip;
    }
}

/* Published dashboard heading and table alignment */
.bi-dashboard-workbench--published-unified .bi-production-widget > header {
    box-sizing: border-box;
    position: relative;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--erp-border-subtle);
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header > div {
    box-sizing: border-box;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    justify-content: center;
    padding-inline: 58px;
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header strong {
    display: block;
    width: 100%;
    line-height: 1.5;
    text-align: center;
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header nav:empty {
    display: none;
}

.bi-dashboard-workbench--published-unified .bi-production-widget > header nav:not(:empty) {
    position: absolute;
    inset-inline-start: 8px;
    top: 50%;
    margin: 0;
    transform: translateY(-50%);
}

.bi-widget-table > header > *:not(:last-child),
.bi-widget-table-row > *:not(:last-child) {
    border-inline-end: 0;
}

.bi-widget-table > header {
    box-shadow: inset 0 -1px 0 var(--erp-border-subtle);
}

.bi-widget-table > header > *,
.bi-widget-table-row > * {
    justify-content: center;
    text-align: center;
}

.bi-widget-table > header .bi-widget-table__cell--numeric,
.bi-widget-table-row .bi-widget-table__cell--numeric,
.bi-widget-table > header .bi-widget-table__cell--date,
.bi-widget-table-row .bi-widget-table__cell--date,
.bi-widget-table > header .bi-widget-table__cell--status,
.bi-widget-table-row .bi-widget-table__cell--status {
    justify-content: center;
    text-align: center;
}

/* BI Dashboard Designer UX */
.bi-designer:not(.bi-designer--published) {
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
    align-items: start;
    gap: var(--erp-space-3);
    padding: var(--erp-space-3);
}

.bi-designer-sidebar {
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 150px);
    overflow: auto;
    overscroll-behavior: contain;
}

.bi-designer-sidebar > header {
    display: flex;
    align-items: center;
    gap: var(--erp-space-3);
    padding-bottom: var(--erp-space-3);
    border-bottom: 1px solid var(--erp-border-subtle);
}

.bi-designer-sidebar > header > div {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.bi-designer-sidebar > header h2 { font-size: .95rem; }
.bi-designer-sidebar > header p {
    overflow: hidden;
    color: var(--erp-text-tertiary);
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bi-designer-sidebar__icon {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: var(--erp-radius-sm);
    color: var(--erp-color-primary);
    background: var(--erp-color-primary-subtle);
}

.bi-designer-validation {
    display: flex;
    align-items: flex-start;
    gap: var(--erp-space-2);
    padding: var(--erp-space-3);
    border: 1px solid color-mix(in srgb, var(--erp-color-danger) 28%, var(--erp-border-subtle));
    border-radius: var(--erp-radius-control-small);
    color: var(--erp-text-danger);
    background: var(--erp-color-danger-subtle);
    font-size: .72rem;
    line-height: 1.7;
}

.bi-designer-validation .erp-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin-top: 2px;
}

.bi-designer-query-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--erp-space-2);
}

.bi-layout-group {
    min-width: 0;
    margin: 0;
    padding: var(--erp-space-3);
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-control-small);
}

.bi-layout-group legend {
    padding-inline: var(--erp-space-2);
    color: var(--erp-text-secondary);
    font-size: .74rem;
    font-weight: 700;
}

.bi-layout-group > small {
    display: block;
    margin-top: var(--erp-space-2);
    color: var(--erp-text-tertiary);
    font-size: .65rem;
    line-height: 1.65;
}

.bi-layout-group:disabled { opacity: .65; }
.bi-form-actions {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
}
.bi-form-actions .erp-button { flex: 1; justify-content: center; }

.bi-designer-stage {
    display: grid;
    min-width: 0;
    gap: var(--erp-space-2);
}

.bi-designer-stage__header {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: var(--erp-space-3);
    padding: var(--erp-space-2) var(--erp-space-3);
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-control-small);
    background: var(--erp-surface-secondary);
}

.bi-designer-stage__header > div {
    display: grid;
    min-width: 0;
    gap: 2px;
}
.bi-designer-stage__header strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bi-designer-stage__header span {
    color: var(--erp-text-tertiary);
    font-size: .68rem;
}

.bi-designer:not(.bi-designer--published) .bi-production-canvas {
    min-width: 0;
    min-height: 620px;
    overflow: auto;
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-control-small);
}

.bi-designer-empty {
    display: grid;
    grid-column: 1 / -1;
    min-height: 340px;
    place-content: center;
    justify-items: center;
    gap: var(--erp-space-2);
    padding: var(--erp-space-6);
    color: var(--erp-text-tertiary);
    text-align: center;
}
.bi-designer-empty .erp-icon {
    width: 34px;
    height: 34px;
    color: var(--erp-color-primary);
}
.bi-designer-empty strong { color: var(--erp-text-primary); }
.bi-designer-empty span { max-width: 46ch; font-size: .72rem; line-height: 1.8; }

.bi-designer-loading {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    gap: var(--erp-space-3);
}
.bi-designer-loading i {
    width: 28px;
    height: 28px;
    border: 3px solid var(--erp-border-default);
    border-top-color: var(--erp-color-primary);
    border-radius: 50%;
    animation: bi-spin .8s linear infinite;
}
.bi-designer-loading > div { display: grid; gap: 3px; }
.bi-designer-loading span { color: var(--erp-text-tertiary); font-size: .72rem; }

.bi-dashboard-actions .erp-button {
    display: inline-flex;
    align-items: center;
    gap: var(--erp-space-2);
}
.bi-dashboard-actions .erp-button:disabled,
.bi-designer .erp-button:disabled { cursor: not-allowed; opacity: .55; }

@media (max-width: 1100px) {
    .bi-designer:not(.bi-designer--published) { grid-template-columns: 1fr; }
    .bi-designer-sidebar {
        position: static;
        max-height: none;
    }
    .bi-designer-query-fields { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
}

@media (max-width: 720px) {
    .bi-dashboard-titlebar { align-items: stretch; }
    .bi-dashboard-actions {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .bi-dashboard-actions .erp-button { justify-content: center; }
    .bi-designer-query-fields { grid-template-columns: 1fr; }
    .bi-layout-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bi-designer-stage__header { align-items: stretch; flex-direction: column; }
    .bi-designer-stage__header .erp-button { justify-content: center; }
    .bi-designer:not(.bi-designer--published) .bi-production-canvas {
        display: grid;
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        min-height: 360px;
    }
    .bi-designer:not(.bi-designer--published) .bi-production-widget {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        min-height: 260px;
    }
}
/* Phase 2B / Step 1: unified data-preparation workspace. */
.bi-data-preparation { gap: var(--erp-space-4); }
.bi-preparation-steps { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:var(--erp-space-2); }
.bi-preparation-steps button { display:grid; grid-template-columns:2rem 1fr; grid-template-rows:auto auto; gap:0 var(--erp-space-2); padding:var(--erp-space-3); border:1px solid var(--erp-border-color); border-radius:var(--erp-radius-lg); color:var(--erp-text-muted); background:color-mix(in srgb,var(--erp-surface-2) 88%,transparent); text-align:right; }
.bi-preparation-steps button>span { grid-row:1/3; display:grid; place-items:center; width:2rem; height:2rem; border-radius:50%; background:var(--erp-surface-3); }
.bi-preparation-steps button strong { color:var(--erp-text); }
.bi-preparation-steps button small { margin-top:.2rem; }
.bi-preparation-steps button.is-active { border-color:color-mix(in srgb,var(--erp-primary) 65%,var(--erp-border-color)); background:color-mix(in srgb,var(--erp-primary) 14%,var(--erp-surface-2)); }
.bi-preparation-steps button.is-active>span { color:#fff; background:var(--erp-primary); }
.bi-preparation-commandbar,.bi-preparation-commandbar>div,.bi-preparation-actions,.bi-preparation-panel__header,.bi-preparation-output-actions,.bi-preparation-step__head { display:flex; align-items:center; gap:var(--erp-space-2); }
.bi-preparation-commandbar { justify-content:space-between; }
.bi-preparation-commandbar>div:first-child { align-items:flex-start; flex-direction:column; gap:.25rem; }
.bi-preparation-commandbar h1,.bi-preparation-commandbar p { margin:0; }
.bi-preparation-commandbar p { color:var(--erp-text-muted); }
.bi-preparation-grid { display:grid; grid-template-columns:minmax(220px,.75fr) minmax(0,2fr) minmax(260px,.9fr); gap:var(--erp-space-3); align-items:start; }
.bi-preparation-browser,.bi-preparation-applied,.bi-preparation-panel { min-width:0; border:1px solid var(--erp-border-color); border-radius:var(--erp-radius-lg); background:var(--erp-surface-2); box-shadow:var(--erp-shadow-sm); }
.bi-preparation-browser,.bi-preparation-applied { position:sticky; top:var(--erp-space-3); overflow:hidden; }
.bi-preparation-browser__header,.bi-preparation-applied__header { padding:var(--erp-space-3); border-bottom:1px solid var(--erp-border-color); }
.bi-preparation-browser__header h2,.bi-preparation-applied__header h2,.bi-preparation-panel__header h2 { margin:0; font-size:var(--erp-font-size-md); }
.bi-preparation-tree,.bi-preparation-step-list { display:grid; gap:.35rem; padding:var(--erp-space-2); }
.bi-preparation-tree>strong { padding:var(--erp-space-2); color:var(--erp-text-muted); font-size:var(--erp-font-size-xs); }
.bi-preparation-tree button { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:var(--erp-space-2); width:100%; padding:.65rem .75rem; border:1px solid transparent; border-radius:var(--erp-radius-md); color:var(--erp-text); background:transparent; text-align:right; }
.bi-preparation-tree button:hover:not(:disabled) { background:var(--erp-surface-3); }
.bi-preparation-tree button.is-selected { border-color:color-mix(in srgb,var(--erp-primary) 45%,var(--erp-border-color)); background:color-mix(in srgb,var(--erp-primary) 12%,var(--erp-surface-3)); }
.bi-preparation-tree button:disabled { opacity:.55; cursor:not-allowed; }
.bi-preparation-tree button.is-child { padding-inline-start:1.75rem; }
.bi-preparation-tree small { color:var(--erp-text-muted); }
.bi-preparation-status-dot { width:.55rem; height:.55rem; border-radius:50%; background:var(--erp-success); }
.bi-preparation-center { display:grid; gap:var(--erp-space-3); min-width:0; }
.bi-preparation-panel { overflow:hidden; }
.bi-preparation-panel__header { justify-content:space-between; padding:var(--erp-space-3); border-bottom:1px solid var(--erp-border-color); }
.bi-preparation-binding,.bi-preparation-output-summary,.bi-preparation-quality { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--erp-space-2); padding:var(--erp-space-3); }
.bi-preparation-binding>div,.bi-preparation-output-summary>div,.bi-preparation-quality>div { display:grid; gap:.2rem; min-width:0; padding:var(--erp-space-2); border-radius:var(--erp-radius-md); background:var(--erp-surface-3); }
.bi-preparation-binding small,.bi-preparation-output-summary small,.bi-preparation-quality small { color:var(--erp-text-muted); }
.bi-preparation-preview { overflow:auto; max-height:31rem; border-block:1px solid var(--erp-border-color); }
.bi-preparation-preview table { width:100%; border-collapse:collapse; white-space:nowrap; }
.bi-preparation-preview th,.bi-preparation-preview td { padding:.65rem .75rem; border-bottom:1px solid var(--erp-border-color); text-align:right; }
.bi-preparation-preview th { position:sticky; top:0; z-index:1; background:var(--erp-surface-3); }
.bi-preparation-preview th small { display:block; color:var(--erp-text-muted); font-weight:400; }
.bi-preparation-empty { display:grid; place-items:center; min-height:12rem; padding:var(--erp-space-4); color:var(--erp-text-muted); text-align:center; }
.bi-preparation-preview-footer { padding:var(--erp-space-2) var(--erp-space-3); color:var(--erp-text-muted); }
.bi-preparation-output-form { display:grid; grid-template-columns:1fr auto; gap:var(--erp-space-2); padding:var(--erp-space-3); }
.bi-preparation-output-actions,.bi-preparation-quality { padding-top:0; }
.bi-preparation-warning { margin:0 var(--erp-space-3) var(--erp-space-3); padding:var(--erp-space-2); border-radius:var(--erp-radius-md); color:var(--erp-warning); background:color-mix(in srgb,var(--erp-warning) 12%,transparent); }
.bi-preparation-step { padding:var(--erp-space-2); border:1px solid var(--erp-border-color); border-radius:var(--erp-radius-md); background:var(--erp-surface-3); }
.bi-preparation-step__head { justify-content:space-between; }
.bi-preparation-step textarea { width:100%; min-height:6rem; margin-top:var(--erp-space-2); direction:ltr; text-align:left; resize:vertical; }
.bi-preparation-step__actions { display:flex; flex-wrap:wrap; gap:.35rem; margin-top:var(--erp-space-2); }
.bi-preparation-add-step { display:grid; gap:var(--erp-space-2); padding:var(--erp-space-2); border-top:1px solid var(--erp-border-color); }
@media (max-width:1100px) { .bi-preparation-grid { grid-template-columns:minmax(210px,.7fr) minmax(0,1.7fr); } .bi-preparation-applied { position:static; grid-column:1/-1; } }
@media (max-width:720px) { .bi-preparation-steps,.bi-preparation-grid,.bi-preparation-binding,.bi-preparation-output-summary,.bi-preparation-quality,.bi-preparation-output-form { grid-template-columns:1fr; } .bi-preparation-steps button:not(.is-active) small { display:none; } .bi-preparation-commandbar { align-items:stretch; flex-direction:column; } .bi-preparation-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); } .bi-preparation-browser,.bi-preparation-applied { position:static; grid-column:auto; } }
/* Phase 2B / Step 2: model and measures workspace. */
.bi-model-measures { gap:var(--erp-space-4); }
.bi-model-commandbar,.bi-model-commandbar>div,.bi-model-actions,.bi-model-canvas>header,.bi-measures-panel>header { display:flex; align-items:center; gap:var(--erp-space-2); }
.bi-model-commandbar { justify-content:space-between; }
.bi-model-commandbar>div:first-child { align-items:flex-start; flex-direction:column; gap:.25rem; }
.bi-model-commandbar h1,.bi-model-commandbar p,.bi-model-canvas h2,.bi-model-canvas p,.bi-measures-panel h2 { margin:0; }
.bi-model-commandbar p,.bi-model-canvas p { color:var(--erp-text-muted); }
.bi-model-state { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:var(--erp-space-2); }
.bi-model-state>div { display:grid; gap:.2rem; padding:var(--erp-space-3); border:1px solid var(--erp-border-color); border-radius:var(--erp-radius-md); background:var(--erp-surface-2); }
.bi-model-state small { color:var(--erp-text-muted); }
.bi-model-pending { padding:var(--erp-space-3); border:1px solid color-mix(in srgb,var(--erp-success) 40%,var(--erp-border-color)); border-radius:var(--erp-radius-md); color:var(--erp-success); background:color-mix(in srgb,var(--erp-success) 10%,var(--erp-surface-2)); }
.bi-model-pending.is-warning { border-color:color-mix(in srgb,var(--erp-warning) 40%,var(--erp-border-color)); color:var(--erp-warning); background:color-mix(in srgb,var(--erp-warning) 10%,var(--erp-surface-2)); }
.bi-model-grid { display:grid; grid-template-columns:minmax(230px,.8fr) minmax(0,1.8fr) minmax(280px,1fr); gap:var(--erp-space-3); align-items:start; }
.bi-model-browser,.bi-model-canvas,.bi-measures-panel { min-width:0; overflow:hidden; border:1px solid var(--erp-border-color); border-radius:var(--erp-radius-lg); background:var(--erp-surface-2); box-shadow:var(--erp-shadow-sm); }
.bi-model-browser,.bi-measures-panel { position:sticky; top:var(--erp-space-3); }
.bi-model-browser>header,.bi-measures-panel>header,.bi-model-canvas>header { justify-content:space-between; padding:var(--erp-space-3); border-bottom:1px solid var(--erp-border-color); }
.bi-model-browser h2,.bi-measures-panel h2 { margin:0; font-size:var(--erp-font-size-md); }
.bi-model-search { padding:var(--erp-space-2); border-bottom:1px solid var(--erp-border-color); }
.bi-model-search input { width:100%; }
.bi-model-table-list,.bi-measure-list { display:grid; gap:.35rem; padding:var(--erp-space-2); max-height:30rem; overflow:auto; }
.bi-model-table-list>button,.bi-measure-list>button { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:var(--erp-space-2); width:100%; padding:.65rem; border:1px solid transparent; border-radius:var(--erp-radius-md); color:var(--erp-text); background:transparent; text-align:right; }
.bi-model-table-list>button:hover,.bi-measure-list>button:hover { background:var(--erp-surface-3); }
.bi-model-table-list>button.is-selected,.bi-measure-list>button.is-selected { border-color:color-mix(in srgb,var(--erp-primary) 45%,var(--erp-border-color)); background:color-mix(in srgb,var(--erp-primary) 12%,var(--erp-surface-3)); }
.bi-model-table-list button span,.bi-measure-list button span,.bi-model-field-list div span { display:grid; gap:.15rem; }
.bi-model-table-list small,.bi-measure-list small,.bi-model-field-list small { color:var(--erp-text-muted); }
.bi-model-field-list { display:grid; gap:.25rem; padding:0 var(--erp-space-3) var(--erp-space-2) var(--erp-space-2); border-inline-start:2px solid color-mix(in srgb,var(--erp-primary) 35%,var(--erp-border-color)); }
.bi-model-field-list>div { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:var(--erp-space-2); padding:.45rem; border-radius:var(--erp-radius-sm); }
.bi-model-field-list>div.is-hierarchy { color:var(--erp-primary); background:color-mix(in srgb,var(--erp-primary) 8%,transparent); }
.bi-model-nodes { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:var(--erp-space-2); padding:var(--erp-space-3); }
.bi-model-nodes article { display:flex; align-items:center; gap:var(--erp-space-2); padding:var(--erp-space-3); border:1px solid var(--erp-border-color); border-radius:var(--erp-radius-md); background:var(--erp-surface-3); }
.bi-model-nodes article.is-fact { border-top:3px solid var(--erp-primary); }
.bi-model-nodes article.is-dimension { border-top:3px solid var(--erp-success); }
.bi-model-nodes article div { display:grid; gap:.2rem; }
.bi-model-nodes small { color:var(--erp-text-muted); }
.bi-relationship-list { display:grid; gap:var(--erp-space-2); padding:var(--erp-space-3); border-top:1px solid var(--erp-border-color); }
.bi-relationship-list article { position:relative; display:grid; gap:.35rem; padding:var(--erp-space-3); border:1px solid var(--erp-border-color); border-radius:var(--erp-radius-md); background:var(--erp-surface-3); }
.bi-relationship-list article>small { color:var(--erp-text-muted); }
.bi-relationship-list .erp-icon-button { position:absolute; inset-inline-end:.5rem; top:.5rem; }
.bi-relationship-path { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:var(--erp-space-2); }
.bi-relationship-path span:last-child { text-align:left; }
.bi-relationship-path strong { color:var(--erp-primary); direction:ltr; }
.bi-relationship-editor { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--erp-space-2); padding:var(--erp-space-3); border-top:1px solid var(--erp-border-color); }
.bi-relationship-editor .erp-button { grid-column:1/-1; justify-content:center; }
.bi-measure-editor { display:grid; gap:var(--erp-space-2); padding:var(--erp-space-3); border-top:1px solid var(--erp-border-color); }
.bi-measure-editor h3 { margin:0; font-size:var(--erp-font-size-sm); }
.bi-measure-editor label { display:grid; gap:.35rem; color:var(--erp-text-muted); }
.bi-measure-editor textarea { min-height:8rem; resize:vertical; text-align:left; }
.bi-measure-editor__actions { display:flex; flex-wrap:wrap; gap:var(--erp-space-2); }
.bi-kpi-note { display:grid; gap:.25rem; padding:var(--erp-space-2); border-radius:var(--erp-radius-md); background:color-mix(in srgb,var(--erp-primary) 9%,var(--erp-surface-3)); }
.bi-kpi-note small { color:var(--erp-text-muted); line-height:1.8; }
@media (max-width:1100px) { .bi-model-grid { grid-template-columns:minmax(220px,.8fr) minmax(0,1.7fr); } .bi-measures-panel { position:static; grid-column:1/-1; } .bi-model-state { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:720px) { .bi-model-commandbar { align-items:stretch; flex-direction:column; } .bi-model-actions { display:grid; grid-template-columns:1fr; } .bi-model-grid,.bi-model-state,.bi-relationship-editor { grid-template-columns:1fr; } .bi-model-browser,.bi-measures-panel { position:static; grid-column:auto; } .bi-relationship-path { grid-template-columns:1fr; } .bi-relationship-path span:last-child { text-align:right; } }
/* Phase 2B Step 3: dashboard designer workflow integration */
.bi-dashboard-workflow { margin-block-end: var(--erp-space-3); }
.bi-designer-workflow-steps { margin-block-end: var(--erp-space-3); }
.bi-widget-editor-preview {
    display: grid;
    gap: var(--erp-space-2);
    padding: var(--erp-space-3);
    border: 1px solid color-mix(in srgb, var(--erp-primary) 36%, var(--erp-border-color));
    border-radius: var(--erp-radius-lg);
    background: color-mix(in srgb, var(--erp-primary) 7%, var(--erp-surface-2));
    overflow: hidden;
}
.bi-widget-editor-preview > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--erp-space-2);
}
.bi-widget-editor-preview > header small { color: var(--erp-text-muted); }
.bi-widget-editor-preview .bi-widget-view { min-height: 160px; }
@media (max-width: 720px) {
    .bi-dashboard-workflow,
    .bi-designer-workflow-steps { margin-block-end: var(--erp-space-2); }
    .bi-widget-editor-preview > header { align-items: flex-start; flex-direction: column; }
}
/* BI Workbench UX v2 — unified Primal shell inspired by query and model authoring tools. */
.bi-workbench {
    --bi-workbench-accent: var(--erp-color-primary);
    --bi-workbench-accent-soft: color-mix(in srgb, var(--bi-workbench-accent) 10%, transparent);
    --bi-workbench-panel: color-mix(in srgb, var(--erp-glass-panel) 96%, transparent);
    position: relative;
    display: grid;
    gap: var(--erp-space-6);
    min-width: 0;
    isolation: isolate;
}
.bi-workbench--model { --bi-workbench-accent: var(--erp-color-accent); }
.bi-workbench::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -12px;
    border-radius: var(--erp-radius-shell);
    background:
        radial-gradient(circle at 92% 4%, color-mix(in srgb, var(--bi-workbench-accent) 10%, transparent), transparent 30%),
        radial-gradient(circle at 8% 92%, var(--erp-ambient-success), transparent 28%);
    pointer-events: none;
}
.bi-workbench-rail {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--erp-space-3);
    padding: var(--erp-space-3);
    border: 1px solid var(--erp-border-glass);
    border-radius: var(--erp-radius-panel);
    background: var(--erp-glass-toolbar);
    box-shadow: var(--erp-shadow-xs);
    backdrop-filter: blur(var(--erp-blur-subtle));
}
.bi-workbench-rail button {
    position: relative;
    min-height: 58px;
    padding: var(--erp-space-4) var(--erp-space-5);
    border: 1px solid transparent;
    border-radius: var(--erp-radius-card-small);
    background: transparent;
    transition: transform var(--erp-motion-fast) var(--erp-ease-standard),
                border-color var(--erp-motion-fast) var(--erp-ease-standard),
                background var(--erp-motion-fast) var(--erp-ease-standard);
}
.bi-workbench-rail button:not(:disabled):hover {
    transform: translateY(-1px);
    border-color: var(--erp-border-default);
    background: var(--erp-surface-hover);
}
.bi-workbench-rail button.is-active {
    border-color: color-mix(in srgb, var(--bi-workbench-accent) 42%, var(--erp-border-default));
    background: linear-gradient(135deg, var(--bi-workbench-accent-soft), var(--erp-surface-primary));
    box-shadow: inset 0 -2px 0 var(--bi-workbench-accent), var(--erp-shadow-xs);
}
.bi-workbench-rail button.is-active > span {
    background: var(--bi-workbench-accent);
    box-shadow: 0 0 0 5px var(--bi-workbench-accent-soft);
}
.bi-workbench-commandbar {
    position: sticky;
    z-index: var(--erp-z-sticky);
    inset-block-start: var(--erp-space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--erp-space-6);
    min-height: 76px;
    padding: var(--erp-space-5) var(--erp-space-6);
    border: 1px solid var(--erp-border-glass);
    border-radius: var(--erp-radius-panel);
    background: var(--erp-glass-header);
    box-shadow: var(--erp-shadow-sm);
    backdrop-filter: blur(var(--erp-blur-default));
}
.bi-workbench-heading {
    display: grid !important;
    gap: var(--erp-space-1) !important;
    min-width: 0;
}
.bi-workbench-heading h1 {
    color: var(--erp-text-primary);
    font: var(--erp-font-page-title);
}
.bi-workbench-heading p {
    max-width: 720px;
    overflow: hidden;
    color: var(--erp-text-secondary) !important;
    font: var(--erp-font-body-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bi-workbench-kicker {
    display: inline-flex;
    align-items: center;
    gap: var(--erp-space-3);
    color: var(--bi-workbench-accent);
    font: var(--erp-font-label);
    direction: ltr;
    justify-self: start;
}
.bi-workbench-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--erp-space-4) !important;
}
.bi-workbench-actions select {
    min-width: 220px;
}
.bi-workbench-loading,
.bi-workbench-empty {
    min-height: 320px;
    border: 1px dashed var(--erp-border-strong);
    border-radius: var(--erp-radius-panel);
    background: var(--erp-surface-secondary);
}
.bi-workbench-layout {
    min-width: 0;
}
.bi-workbench-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--erp-border-glass) !important;
    border-radius: var(--erp-radius-panel) !important;
    background: var(--bi-workbench-panel) !important;
    box-shadow: var(--erp-shadow-sm) !important;
    backdrop-filter: blur(var(--erp-blur-subtle));
}
.bi-workbench-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--erp-space-4);
    min-height: 58px;
    padding: var(--erp-space-4) var(--erp-space-5) !important;
    border-block-end: 1px solid var(--erp-border-subtle);
    background: linear-gradient(180deg, var(--erp-surface-secondary), transparent);
}
.bi-workbench-panel__header > div {
    display: grid;
    gap: var(--erp-space-1);
    min-width: 0;
}
.bi-workbench-panel__header h2,
.bi-workbench-panel__header strong {
    color: var(--erp-text-primary);
    font: var(--erp-font-card-title);
}
.bi-workbench-panel__header small {
    color: var(--erp-text-tertiary);
    font: var(--erp-font-caption);
}
.bi-workbench-panel__footer {
    display: flex;
    justify-content: stretch;
    padding: var(--erp-space-4);
    border-block-start: 1px solid var(--erp-border-subtle);
    background: var(--erp-surface-secondary);
}
.bi-workbench-panel__footer .erp-button {
    width: 100%;
    justify-content: center;
}
.bi-workbench input,
.bi-workbench select,
.bi-workbench textarea {
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-control);
    background: var(--erp-surface-primary);
    color: var(--erp-text-primary);
    font: var(--erp-font-body-sm);
    transition: border-color var(--erp-motion-fast), box-shadow var(--erp-motion-fast);
}
.bi-workbench input,
.bi-workbench select {
    min-height: var(--erp-control-comfortable);
    padding-inline: var(--erp-space-4);
}
.bi-workbench textarea { padding: var(--erp-space-4); }
.bi-workbench input:focus,
.bi-workbench select:focus,
.bi-workbench textarea:focus {
    outline: none;
    border-color: var(--erp-border-focus);
    box-shadow: var(--erp-shadow-focus);
}

/* Data preparation / ETL workbench */
.bi-workbench--query .bi-preparation-grid {
    grid-template-columns: minmax(238px, .76fr) minmax(520px, 2.15fr) minmax(286px, .92fr);
    gap: var(--erp-space-5);
    align-items: start;
}
.bi-workbench--query .bi-preparation-browser,
.bi-workbench--query .bi-preparation-applied {
    position: sticky;
    inset-block-start: 98px;
    max-height: calc(100vh - 132px);
    overflow: auto;
}
.bi-workbench--query .bi-preparation-center {
    gap: var(--erp-space-5);
}
.bi-workbench--query .bi-preparation-tree {
    gap: var(--erp-space-2);
    padding: var(--erp-space-4);
}
.bi-workbench--query .bi-preparation-tree + .bi-preparation-tree {
    border-block-start: 1px solid var(--erp-border-subtle);
}
.bi-workbench--query .bi-preparation-tree h2 {
    display: flex;
    align-items: center;
    gap: var(--erp-space-3);
    margin: 0;
    padding: var(--erp-space-3) var(--erp-space-2);
    color: var(--erp-text-tertiary);
    font: var(--erp-font-label);
}
.bi-workbench--query .bi-preparation-tree button {
    min-height: 50px;
    padding: var(--erp-space-4);
    border-radius: var(--erp-radius-card-small);
}
.bi-workbench--query .bi-preparation-tree button:hover:not(:disabled) {
    transform: translateX(-2px);
    background: var(--erp-surface-hover);
}
.bi-workbench--query .bi-preparation-tree button.is-selected {
    border-color: color-mix(in srgb, var(--bi-workbench-accent) 38%, var(--erp-border-default));
    background: var(--bi-workbench-accent-soft);
    box-shadow: inset -3px 0 0 var(--bi-workbench-accent);
}
.bi-workbench--query .bi-preparation-tree button span {
    display: grid;
    gap: var(--erp-space-1);
    min-width: 0;
}
.bi-workbench--query .bi-preparation-tree button strong,
.bi-workbench--query .bi-preparation-tree button small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bi-workbench--query .bi-preparation-binding,
.bi-workbench--query .bi-preparation-output-summary,
.bi-workbench--query .bi-preparation-quality {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--erp-space-3);
    padding: var(--erp-space-5);
}
.bi-workbench--query .bi-preparation-binding > span,
.bi-workbench--query .bi-preparation-output-summary > span,
.bi-workbench--query .bi-preparation-quality > span {
    display: grid;
    gap: var(--erp-space-2);
    min-width: 0;
    padding: var(--erp-space-4);
    border: 1px solid var(--erp-border-subtle);
    border-radius: var(--erp-radius-card-small);
    background: var(--erp-surface-secondary);
}
.bi-workbench--query .bi-preparation-binding > span strong,
.bi-workbench--query .bi-preparation-output-summary > span strong {
    overflow: hidden;
    color: var(--erp-text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bi-workbench--query .bi-preparation-table {
    max-height: 430px;
    overflow: auto;
    border-block: 1px solid var(--erp-border-subtle);
    background:
        linear-gradient(var(--erp-surface-primary), var(--erp-surface-primary)) padding-box,
        repeating-linear-gradient(0deg, transparent 0 39px, var(--erp-border-subtle) 39px 40px);
}
.bi-workbench--query .bi-preparation-table table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    white-space: nowrap;
}
.bi-workbench--query .bi-preparation-table th,
.bi-workbench--query .bi-preparation-table td {
    height: 40px;
    padding: var(--erp-space-3) var(--erp-space-5);
    border-inline-end: 1px solid var(--erp-border-subtle);
    border-block-end: 1px solid var(--erp-border-subtle);
    text-align: right;
}
.bi-workbench--query .bi-preparation-table th {
    position: sticky;
    z-index: 2;
    inset-block-start: 0;
    color: var(--erp-text-primary);
    background: var(--erp-grid-header-background);
    box-shadow: 0 1px 0 var(--erp-border-default);
}
.bi-workbench--query .bi-preparation-table th small {
    display: block;
    color: var(--erp-text-tertiary);
    font: var(--erp-font-caption);
}
.bi-workbench--query .bi-preparation-preview-empty {
    display: grid;
    place-items: center;
    gap: var(--erp-space-3);
    min-height: 310px;
    padding: var(--erp-space-9);
    color: var(--erp-text-secondary);
    text-align: center;
}
.bi-workbench--query .bi-preparation-preview-empty .erp-icon {
    width: 42px;
    height: 42px;
    padding: var(--erp-space-4);
    border-radius: var(--erp-radius-circle);
    color: var(--bi-workbench-accent);
    background: var(--bi-workbench-accent-soft);
}
.bi-workbench--query .bi-preparation-preview-footer {
    display: flex;
    gap: var(--erp-space-5);
    padding: var(--erp-space-3) var(--erp-space-5);
    background: var(--erp-surface-secondary);
    font: var(--erp-font-caption);
}
.bi-workbench--query .bi-preparation-output-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    gap: var(--erp-space-4);
    padding: var(--erp-space-5);
    border-block-end: 1px solid var(--erp-border-subtle);
    background: var(--erp-surface-secondary);
}
.bi-workbench--query .bi-preparation-output-form label {
    display: grid;
    gap: var(--erp-space-2);
    color: var(--erp-text-secondary);
    font: var(--erp-font-label);
}
.bi-workbench--query .bi-preparation-output-actions {
    padding: 0 var(--erp-space-5) var(--erp-space-5);
}
.bi-workbench--query .bi-preparation-refresh-warning {
    margin: 0 var(--erp-space-5) var(--erp-space-4);
    padding: var(--erp-space-4);
    border: 1px solid color-mix(in srgb, var(--erp-color-warning) 36%, var(--erp-border-default));
    border-radius: var(--erp-radius-card-small);
    color: var(--erp-color-warning);
    background: var(--erp-color-warning-subtle);
}
.bi-workbench--query .bi-preparation-step-list {
    position: relative;
    gap: 0;
    margin: 0;
    padding: var(--erp-space-4);
    list-style: none;
}
.bi-workbench--query .bi-preparation-step {
    position: relative;
    margin: 0;
    padding: var(--erp-space-2) 0 var(--erp-space-4);
    border: 0;
    background: transparent;
}
.bi-workbench--query .bi-preparation-step:not(:last-child)::after {
    content: "";
    position: absolute;
    inset-block-start: 42px;
    inset-block-end: -2px;
    inset-inline-start: 16px;
    width: 2px;
    background: color-mix(in srgb, var(--bi-workbench-accent) 28%, var(--erp-border-default));
}
.bi-workbench--query .bi-preparation-step__head {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--erp-space-3);
}
.bi-workbench--query .bi-preparation-step__head > span {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid color-mix(in srgb, var(--bi-workbench-accent) 42%, var(--erp-border-default));
    border-radius: var(--erp-radius-circle);
    color: var(--bi-workbench-accent);
    background: var(--erp-surface-primary);
    font: var(--erp-font-label);
}
.bi-workbench--query .bi-preparation-step__head > button {
    display: grid;
    gap: 1px;
    padding: var(--erp-space-3);
    border: 0;
    border-radius: var(--erp-radius-md);
    color: var(--erp-text-primary);
    background: transparent;
    text-align: right;
}
.bi-workbench--query .bi-preparation-step__head > button:hover {
    background: var(--erp-surface-hover);
}
.bi-workbench--query .bi-preparation-step__head small {
    color: var(--erp-text-tertiary);
}
.bi-workbench--query .bi-preparation-step-editor {
    display: grid;
    gap: var(--erp-space-3);
    margin: var(--erp-space-3) 42px 0 0;
    padding: var(--erp-space-4);
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-card-small);
    background: var(--erp-surface-secondary);
}
.bi-workbench--query .bi-preparation-step-editor textarea {
    min-height: 120px;
    font-family: var(--erp-font-mono);
    font-size: .74rem;
}
.bi-workbench--query .bi-preparation-step-editor > div {
    display: flex;
    flex-wrap: wrap;
    gap: var(--erp-space-3);
}

/* Model and measures workbench */
.bi-workbench--model .bi-model-state {
    gap: var(--erp-space-4);
}
.bi-workbench--model .bi-model-state-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: var(--erp-space-4);
    padding: var(--erp-space-4) var(--erp-space-5);
    border: 1px solid var(--erp-border-glass);
    border-radius: var(--erp-radius-card);
    background: var(--erp-glass-card);
    box-shadow: var(--erp-shadow-xs);
}
.bi-workbench--model .bi-model-state-card > .erp-icon {
    width: 36px;
    height: 36px;
    padding: var(--erp-space-4);
    border-radius: var(--erp-radius-card-small);
    color: var(--bi-workbench-accent);
    background: var(--bi-workbench-accent-soft);
}
.bi-workbench--model .bi-model-state-card > span {
    display: grid;
    min-width: 0;
}
.bi-workbench--model .bi-model-state-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bi-workbench--model .bi-model-grid {
    grid-template-columns: minmax(248px, .8fr) minmax(520px, 1.9fr) minmax(300px, .96fr);
    gap: var(--erp-space-5);
    align-items: start;
}
.bi-workbench--model .bi-model-browser,
.bi-workbench--model .bi-measures-panel {
    position: sticky;
    inset-block-start: 98px;
    max-height: calc(100vh - 132px);
    overflow: auto;
}
.bi-workbench--model .bi-workbench-search {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--erp-space-3);
    padding: var(--erp-space-4);
    border-block-end: 1px solid var(--erp-border-subtle);
    color: var(--erp-text-tertiary);
    background: var(--erp-surface-secondary);
}
.bi-workbench--model .bi-workbench-search input {
    width: 100%;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.bi-workbench--model .bi-model-table-list,
.bi-workbench--model .bi-measure-list {
    gap: var(--erp-space-2);
    max-height: none;
    padding: var(--erp-space-4);
}
.bi-workbench--model .bi-model-table-list > button,
.bi-workbench--model .bi-measure-list > button {
    min-height: 50px;
    padding: var(--erp-space-4);
    border-radius: var(--erp-radius-card-small);
}
.bi-workbench--model .bi-model-table-list > button.is-selected,
.bi-workbench--model .bi-measure-list > button.is-selected {
    border-color: color-mix(in srgb, var(--bi-workbench-accent) 42%, var(--erp-border-default));
    background: var(--bi-workbench-accent-soft);
    box-shadow: inset -3px 0 0 var(--bi-workbench-accent);
}
.bi-workbench--model .bi-model-field-list {
    margin: 0 var(--erp-space-5) var(--erp-space-3) 0;
    padding: var(--erp-space-2) var(--erp-space-5) var(--erp-space-3) 0;
    border-inline-start: 2px solid color-mix(in srgb, var(--bi-workbench-accent) 34%, var(--erp-border-default));
}
.bi-workbench--model .bi-model-canvas {
    min-height: 620px;
}
.bi-workbench--model .bi-model-canvas-surface {
    min-height: 210px;
    padding: var(--erp-space-6);
    background-color: var(--erp-background-canvas);
    background-image: radial-gradient(var(--erp-border-strong) .8px, transparent .8px);
    background-size: 18px 18px;
}
.bi-workbench--model .bi-model-nodes article {
    position: relative;
    min-height: 74px;
    border-radius: var(--erp-radius-card-small);
    background: var(--erp-surface-primary);
    box-shadow: var(--erp-shadow-xs);
}
.bi-workbench--model .bi-model-nodes article.is-fact {
    border-block-start: 3px solid var(--bi-workbench-accent);
}
.bi-workbench--model .bi-model-nodes article.is-dimension {
    border-block-start: 3px solid var(--erp-color-success);
}
.bi-workbench--model .bi-model-nodes article::after {
    content: "";
    position: absolute;
    inset-inline-end: -5px;
    inset-block-start: 50%;
    width: 9px;
    height: 9px;
    border: 2px solid var(--erp-surface-primary);
    border-radius: 50%;
    background: var(--bi-workbench-accent);
    box-shadow: 0 0 0 1px var(--erp-border-default);
}
.bi-workbench--model .bi-relationship-list {
    gap: var(--erp-space-3);
    padding: var(--erp-space-5);
    background: var(--erp-surface-primary);
}
.bi-workbench--model .bi-relationship-list article {
    padding: var(--erp-space-4) var(--erp-space-5);
    border-radius: var(--erp-radius-card-small);
    background: var(--erp-surface-secondary);
}
.bi-workbench--model .bi-relationship-path strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: var(--erp-space-2) var(--erp-space-3);
    border-radius: var(--erp-radius-pill);
    background: var(--bi-workbench-accent-soft);
}
.bi-workbench--model .bi-relationship-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--erp-space-4);
    padding: var(--erp-space-5);
    background: var(--erp-surface-secondary);
}
.bi-workbench--model .bi-relationship-editor__title {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: var(--erp-space-4);
    color: var(--bi-workbench-accent);
}
.bi-workbench--model .bi-relationship-editor__title > span {
    display: grid;
}
.bi-workbench--model .bi-relationship-editor__title small {
    color: var(--erp-text-tertiary);
}
.bi-workbench--model .bi-measure-editor {
    gap: var(--erp-space-4);
    padding: var(--erp-space-5);
    background: var(--erp-surface-secondary);
}
.bi-workbench--model .bi-measure-editor__heading {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: var(--erp-space-4);
    padding-block-end: var(--erp-space-3);
    border-block-end: 1px solid var(--erp-border-subtle);
}
.bi-workbench--model .bi-measure-editor__heading > span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--erp-radius-card-small);
    color: var(--bi-workbench-accent);
    background: var(--bi-workbench-accent-soft);
}
.bi-workbench--model .bi-measure-editor__heading h3 {
    margin: 0;
}
.bi-workbench--model .bi-measure-editor__heading small {
    color: var(--erp-text-tertiary);
}
.bi-workbench--model .bi-measure-editor label {
    gap: var(--erp-space-2);
    color: var(--erp-text-secondary);
    font: var(--erp-font-label);
}
.bi-workbench--model .bi-measure-editor textarea {
    min-height: 150px;
    font-family: var(--erp-font-mono);
    font-size: .74rem;
}
.bi-workbench--model .bi-kpi-note {
    padding: var(--erp-space-4);
    border: 1px solid color-mix(in srgb, var(--bi-workbench-accent) 24%, var(--erp-border-default));
    background: var(--bi-workbench-accent-soft);
}
.bi-workbench--model .bi-model-pending {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: var(--erp-space-4) var(--erp-space-5);
    border-radius: var(--erp-radius-card-small);
}

/* Workbench scrollbars and responsive composition */
.bi-workbench * {
    scrollbar-width: thin;
    scrollbar-color: var(--erp-border-strong) transparent;
}
@media (max-width: 1320px) {
    .bi-workbench--query .bi-preparation-grid,
    .bi-workbench--model .bi-model-grid {
        grid-template-columns: minmax(220px, .72fr) minmax(0, 1.8fr);
    }
    .bi-workbench--query .bi-preparation-applied,
    .bi-workbench--model .bi-measures-panel {
        position: static;
        grid-column: 1 / -1;
        max-height: none;
    }
    .bi-workbench--model .bi-measures-panel {
        display: grid;
        grid-template-columns: minmax(220px, .7fr) minmax(320px, 1.3fr);
    }
    .bi-workbench--model .bi-measures-panel > header,
    .bi-workbench--model .bi-measures-panel > .bi-model-search {
        grid-column: 1 / -1;
    }
}
@media (max-width: 860px) {
    .bi-workbench-commandbar {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }
    .bi-workbench-heading p {
        white-space: normal;
    }
    .bi-workbench-actions,
    .bi-workbench-actions .erp-button,
    .bi-workbench-actions label,
    .bi-workbench-actions select {
        width: 100%;
    }
    .bi-workbench--query .bi-preparation-grid,
    .bi-workbench--model .bi-model-grid,
    .bi-workbench--model .bi-measures-panel {
        grid-template-columns: 1fr;
    }
    .bi-workbench--query .bi-preparation-browser,
    .bi-workbench--query .bi-preparation-applied,
    .bi-workbench--model .bi-model-browser,
    .bi-workbench--model .bi-measures-panel {
        position: static;
        grid-column: auto;
        max-height: none;
    }
    .bi-workbench--query .bi-preparation-output-form {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 600px) {
    .bi-workbench {
        gap: var(--erp-space-4);
    }
    .bi-workbench-rail {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }
    .bi-workbench-rail button {
        flex: 0 0 78%;
        scroll-snap-align: start;
    }
    .bi-workbench-commandbar {
        padding: var(--erp-space-5);
    }
    .bi-workbench--model .bi-model-state {
        grid-template-columns: 1fr;
    }
    .bi-workbench--model .bi-relationship-editor,
    .bi-workbench--query .bi-preparation-binding,
    .bi-workbench--query .bi-preparation-output-summary,
    .bi-workbench--query .bi-preparation-quality {
        grid-template-columns: 1fr;
    }
    .bi-workbench--model .bi-relationship-path {
        grid-template-columns: 1fr;
        text-align: right;
    }
}

/* Operational expense budget control — solid Primal system language */
.bi-production-widget--opex,
.bi-dashboard-workbench--published-unified .bi-production-widget--opex {
    background: var(--erp-surface-1) !important;
    border: 1px solid var(--erp-border-default) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.bi-production-widget--opex > header,
.bi-dashboard-workbench--published-unified .bi-production-widget--opex > header {
    background: var(--erp-surface-2) !important;
    border-bottom: 1px solid var(--erp-border-default) !important;
    backdrop-filter: none !important;
}

.bi-production-widget--opex .bi-widget-view {
    padding: var(--erp-space-4);
    background: var(--erp-surface-1);
    backdrop-filter: none;
}

.bi-opex-control {
    --opex-blue: #0055a4;
    --opex-red: #ef4135;
    display: grid;
    gap: var(--erp-space-4);
    min-height: 100%;
    color: var(--erp-text-primary);
    background: var(--erp-surface-1);
    direction: rtl;
}

.bi-opex-control__toolbar {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: var(--erp-space-4);
    padding: var(--erp-space-3) var(--erp-space-4);
    border: 1px solid var(--erp-border-default);
    border-inline-start: 4px solid var(--opex-blue);
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface-2);
}

.bi-opex-control__toolbar > div:first-child {
    display: grid;
    gap: var(--erp-space-1);
}

.bi-opex-control__toolbar strong {
    color: var(--erp-text-primary);
    font-size: 1rem;
    font-weight: 700;
}

.bi-opex-control__eyebrow,
.bi-opex-control__summary span,
.bi-opex-control__summary small,
.bi-opex-control__hint {
    color: var(--erp-text-muted);
    font-size: .76rem;
}

.bi-opex-control__month-filter {
    display: grid;
    grid-template-columns: auto minmax(150px, 180px) auto;
    align-items: center;
    gap: var(--erp-space-2);
    padding: var(--erp-space-2);
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-md);
    background: var(--erp-surface-1);
}

.bi-opex-control__month-filter label {
    color: var(--erp-text-primary);
    font-size: .8rem;
    font-weight: 700;
}

.bi-opex-control__month-filter select {
    width: 100%;
    min-height: 36px;
    padding: 6px 34px 6px 10px;
    color: var(--erp-text-primary);
    border: 1px solid var(--opex-blue);
    border-radius: var(--erp-radius-md);
    background-color: var(--erp-surface-2);
    outline: none;
    cursor: pointer;
}

.bi-opex-control__month-filter select:focus-visible {
    outline: 3px solid rgba(0, 85, 164, .22);
    outline-offset: 1px;
}

.bi-opex-control__month-filter > span {
    padding: 5px 8px;
    color: var(--opex-blue);
    border: 1px solid rgba(0, 85, 164, .35);
    border-radius: var(--erp-radius-sm);
    background: rgba(0, 85, 164, .08);
    font-size: .72rem;
    font-weight: 700;
}

.bi-opex-control__summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--erp-space-3);
}

.bi-opex-control__summary article {
    position: relative;
    display: grid;
    min-width: 0;
    gap: var(--erp-space-1);
    padding: var(--erp-space-3) var(--erp-space-4);
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface-2);
}

.bi-opex-control__summary article::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    border-radius: var(--erp-radius-lg) 0 0 var(--erp-radius-lg);
    background: var(--opex-blue);
}

.bi-opex-control__summary article.is-below {
    border-color: rgba(0, 85, 164, .55);
}

.bi-opex-control__summary article.is-below::before {
    background: var(--opex-blue);
}

.bi-opex-control__summary article.is-over {
    border-color: rgba(239, 65, 53, .55);
}

.bi-opex-control__summary article.is-over::before {
    background: var(--opex-red);
}

.bi-opex-control__summary strong {
    color: var(--erp-text-primary);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.bi-opex-control__summary article.is-below small { color: var(--opex-blue); }
.bi-opex-control__summary article.is-over small { color: var(--opex-red); }

.bi-opex-control__viewport {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--erp-border-default);
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface-1);
    scrollbar-color: var(--opex-blue) var(--erp-surface-2);
}

.bi-opex-control table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--erp-text-primary);
    background: var(--erp-surface-1);
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bi-opex-control th,
.bi-opex-control td {
    height: 42px;
    padding: 7px 10px;
    text-align: center;
    border-block-end: 1px solid var(--erp-border-subtle);
    border-inline-end: 1px solid var(--erp-border-subtle);
}

.bi-opex-control thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    color: var(--erp-text-secondary);
    background: var(--erp-surface-3);
}

.bi-opex-control__account {
    position: sticky;
    right: 0;
    z-index: 3;
    min-width: 250px;
    max-width: 310px;
    text-align: right !important;
    background: var(--erp-surface-1);
}

.bi-opex-control thead .bi-opex-control__account { z-index: 6; }

.bi-opex-control__variance {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 120px;
    background: var(--erp-surface-1);
}

.bi-opex-control thead .bi-opex-control__variance { z-index: 6; }
.bi-opex-control__day { min-width: 74px; }
.bi-opex-control__day span,
.bi-opex-control__day small { display: block; }
.bi-opex-control__day small {
    margin-top: 2px;
    color: var(--erp-text-muted);
    font-size: .65rem;
}
.bi-opex-control__day-value {
    min-width: 74px;
    color: var(--erp-text-primary);
}
.bi-opex-control__day-value.is-zero { color: var(--erp-text-disabled); }

.bi-opex-control tr.is-category > * {
    color: var(--erp-text-primary);
    background: var(--erp-surface-2);
    font-weight: 650;
}

.bi-opex-control tr.is-category > .bi-opex-control__account {
    border-inline-start: 3px solid var(--opex-blue);
}

.bi-opex-control tr.is-account > * {
    color: var(--erp-text-secondary);
    background: var(--erp-surface-1);
}

.bi-opex-control tbody tr:hover > * {
    background: var(--erp-surface-hover);
}

.bi-opex-control__toggle {
    display: flex;
    width: 100%;
    align-items: center;
    gap: var(--erp-space-2);
    color: inherit;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: right;
}

.bi-opex-control__toggle > span {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    flex: 0 0 24px;
    color: #fff;
    border: 1px solid var(--opex-blue);
    border-radius: var(--erp-radius-sm);
    background: var(--opex-blue);
    font-size: .9rem;
    line-height: 1;
}

.bi-opex-control__toggle:focus-visible {
    outline: 2px solid var(--opex-blue);
    outline-offset: 2px;
}

.bi-opex-control__child {
    display: block;
    padding-inline-start: 34px;
}

.bi-opex-control__child::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 1px;
    margin-inline-end: 8px;
    vertical-align: middle;
    background: var(--opex-blue);
}

.bi-opex-control__variance > span {
    display: inline-grid;
    gap: 2px;
    min-width: 92px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: var(--erp-radius-md);
}

.bi-opex-control__variance span.is-below {
    color: var(--opex-blue);
    border-color: rgba(0, 85, 164, .35);
    background: rgba(0, 85, 164, .08);
}

.bi-opex-control__variance span.is-over {
    color: var(--opex-red);
    border-color: rgba(239, 65, 53, .35);
    background: rgba(239, 65, 53, .08);
}

.bi-opex-control__variance small { font-size: .64rem; }
.bi-opex-control__hint { margin: 0; }

@media (max-width: 900px) {
    .bi-opex-control__toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .bi-opex-control__month-filter {
        grid-template-columns: auto minmax(130px, 1fr) auto;
    }

    .bi-opex-control__summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .bi-production-widget--opex .bi-widget-view { padding: var(--erp-space-2); }
    .bi-opex-control__month-filter {
        grid-template-columns: 1fr;
    }
    .bi-opex-control__month-filter > span { justify-self: start; }
    .bi-opex-control__account { min-width: 210px; max-width: 230px; }
}
/* Operational budget sticky table fix v2 */
.bi-production-widget--opex {
    min-height: 0;
    overflow: hidden;
}

.bi-production-widget--opex .bi-widget-view {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.bi-production-widget--opex .bi-opex-control {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
}

.bi-opex-control__viewport {
    position: relative;
    isolation: isolate;
    height: clamp(380px, 62vh, 760px);
    min-height: 0;
    overflow: auto;
    background-color: #111827;
}

.bi-opex-control__table-tools {
    position: sticky;
    top: 0;
    right: 0;
    left: 0;
    z-index: 40;
    box-sizing: border-box;
    display: flex;
    min-width: 100%;
    min-height: 52px;
    align-items: center;
    gap: var(--erp-space-2);
    padding: 8px 12px;
    color: #f8fafc;
    border-bottom: 1px solid #334155;
    background-color: #111827;
}

.bi-opex-control__table-tools label {
    font-size: .8rem;
    font-weight: 700;
}

.bi-opex-control__table-tools select {
    min-width: 170px;
    min-height: 34px;
    padding: 5px 34px 5px 10px;
    color: #f8fafc;
    border: 1px solid #0055a4;
    border-radius: var(--erp-radius-md);
    background-color: #1e293b;
    outline: none;
    cursor: pointer;
}

.bi-opex-control__table-tools select:focus-visible {
    outline: 3px solid rgba(0, 85, 164, .28);
    outline-offset: 1px;
}

.bi-opex-control__table-tools > span {
    padding: 4px 8px;
    color: #8fc5f5;
    border: 1px solid #0055a4;
    border-radius: var(--erp-radius-sm);
    background-color: #14243a;
    font-size: .72rem;
    font-weight: 700;
}

.bi-opex-control thead th {
    top: 52px;
    z-index: 30;
    color: #fff !important;
    border-color: #3377b5 !important;
    background: #0055a4 !important;
    background-color: #0055a4 !important;
    background-image: none !important;
    box-shadow: none;
}

.bi-opex-control thead .bi-opex-control__account,
.bi-opex-control thead .bi-opex-control__variance {
    z-index: 34;
    color: #fff !important;
    background: #0055a4 !important;
    background-color: #0055a4 !important;
}

.bi-opex-control tbody .bi-opex-control__account,
.bi-opex-control tbody .bi-opex-control__variance {
    z-index: 8;
    background-image: none !important;
    background-clip: padding-box;
}

.bi-opex-control tbody tr.is-category > .bi-opex-control__account,
.bi-opex-control tbody tr.is-category > .bi-opex-control__variance {
    background: #182638 !important;
    background-color: #182638 !important;
}

.bi-opex-control tbody tr.is-account > .bi-opex-control__account,
.bi-opex-control tbody tr.is-account > .bi-opex-control__variance {
    background: #111827 !important;
    background-color: #111827 !important;
}

.bi-opex-control tbody tr:hover > .bi-opex-control__account,
.bi-opex-control tbody tr:hover > .bi-opex-control__variance {
    background: #1e293b !important;
    background-color: #1e293b !important;
}

.bi-opex-control__account {
    box-shadow: -1px 0 0 #334155;
}

.bi-opex-control__variance {
    box-shadow: 1px 0 0 #334155;
}

.bi-opex-control__toggle > span {
    color: #fff;
    border-color: #ef4135;
    background: #ef4135;
    background-color: #ef4135;
}

.bi-opex-control__toggle:focus-visible {
    outline-color: #ef4135;
}

@media (max-width: 900px) {
    .bi-opex-control__viewport {
        height: clamp(360px, 66vh, 700px);
    }
}

@media (max-width: 600px) {
    .bi-opex-control__table-tools {
        flex-wrap: wrap;
    }

    .bi-opex-control__table-tools select {
        flex: 1 1 150px;
    }
}
/* Operational budget totals, single-scroll and adaptive theme v3 */
.bi-production-widget--opex,
.bi-dashboard-workbench--published-unified .bi-production-widget--opex,
.bi-production-widget--opex .bi-widget-view,
.bi-production-widget--opex .bi-opex-control,
.bi-opex-control__viewport,
.bi-opex-control table {
    background: var(--erp-surface-primary) !important;
    background-color: var(--erp-surface-primary) !important;
}

.bi-production-widget--opex .bi-opex-control {
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
}

.bi-dashboard-workbench--opex {
    overflow: hidden;
}

.bi-dashboard-workbench--opex .bi-designer--published {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.bi-dashboard-workbench--opex .bi-designer-stage {
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.bi-dashboard-workbench--opex .bi-production-canvas--published {
    display: block;
    flex: 1 1 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.bi-dashboard-workbench--opex .bi-production-widget--opex {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.bi-opex-control__viewport {
    height: 100%;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: #0055a4 var(--erp-surface-secondary);
}

.bi-opex-control__table-tools {
    color: var(--erp-text-primary);
    border-color: var(--erp-border-default);
    background: var(--erp-surface-primary);
    background-color: var(--erp-surface-primary);
}

.bi-opex-control__table-tools select {
    color: var(--erp-text-primary);
    background: var(--erp-surface-secondary);
    background-color: var(--erp-surface-secondary);
}

.bi-opex-control__table-tools > span {
    color: #0055a4;
    background: color-mix(in srgb, #0055a4 9%, var(--erp-surface-primary));
    background-color: color-mix(in srgb, #0055a4 9%, var(--erp-surface-primary));
}

.bi-opex-control tbody tr.is-category > .bi-opex-control__account,
.bi-opex-control tbody tr.is-category > .bi-opex-control__variance {
    background: var(--erp-surface-secondary) !important;
    background-color: var(--erp-surface-secondary) !important;
}

.bi-opex-control tbody tr.is-account > .bi-opex-control__account,
.bi-opex-control tbody tr.is-account > .bi-opex-control__variance {
    background: var(--erp-surface-primary) !important;
    background-color: var(--erp-surface-primary) !important;
}

.bi-opex-control tbody tr:hover > .bi-opex-control__account,
.bi-opex-control tbody tr:hover > .bi-opex-control__variance {
    background: var(--erp-surface-hover) !important;
    background-color: var(--erp-surface-hover) !important;
}

.bi-opex-control__account {
    box-shadow: -1px 0 0 var(--erp-border-default);
}

.bi-opex-control__variance {
    box-shadow: 1px 0 0 var(--erp-border-default);
}

.bi-opex-control tfoot th,
.bi-opex-control tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 24;
    color: var(--erp-text-primary);
    border-top: 2px solid #0055a4;
    border-bottom: 0;
    background: var(--erp-grid-footer-background);
    background-color: var(--erp-grid-footer-background);
    font-weight: 800;
}

.bi-opex-control tfoot .bi-opex-control__account,
.bi-opex-control tfoot .bi-opex-control__variance {
    z-index: 28;
    background: var(--erp-grid-footer-background) !important;
    background-color: var(--erp-grid-footer-background) !important;
}

@media (max-width: 900px) {
    .bi-dashboard-workbench--opex .bi-production-widget--opex {
        min-height: 0;
    }
}