/* Intelligent UI: real workspace panels, local assets, and readable reflow.
   Loaded after the existing feature styles; all case data remains in the
   original controls. Panel visibility belongs to workspace-tabs.js. */

:root {
    --workspace-surface: #121215;
    --workspace-soft: #121215;
    --workspace-ink: #f4f4f5;
    --workspace-muted: #d4d4d8;
    --workspace-line: #3f3f46;
    --workspace-focus: #10b981;
    --workspace-selected: #27272a;
    --workspace-selected-ink: #34d399;
}

/* Do not conceal a layout failure behind document-level horizontal clipping. */
html, body { overflow-x: visible; }

/* Secondary tools stay in normal flow, including when the disclosure opens. */
.top-bar { align-items: center; }
.top-bar-right { flex: 1 1 24rem; min-width: 0; }
.top-bar :is(button, select, summary) {
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}
.top-bar .industry-selector-container {
    flex: 0 1 20rem;
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
    gap: .35rem .5rem;
    margin: 0;
    white-space: normal;
}
.top-bar #lbl-global-industry { margin: 0; white-space: normal; }
.top-bar #global-industry-select { min-width: 0; max-width: 100%; width: 100%; flex: 1 1 14rem; }
.workspace-tools-disclosure { min-width: 0; max-width: 100%; }
.workspace-tools-disclosure > summary {
    padding: .65rem .8rem;
    border: 1px solid var(--workspace-line);
    border-radius: .5rem;
    color: var(--workspace-ink);
    background: var(--workspace-surface);
    font: 600 .875rem/1.5 var(--font-sans);
    cursor: pointer;
}
.workspace-tools-disclosure[open] { flex-basis: 100%; }
.workspace-tools-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    padding-block: .75rem .25rem;
    min-width: 0;
}
.workspace-tools-content > * { min-width: 0; max-width: 100%; }

.intelligent-workspace {
    container-name: intelligent-workspace;
    container-type: inline-size;
    min-width: 0;
    max-width: 100%;
    color: var(--workspace-ink);
}
.intelligent-workspace :is(.workspace-panel, .workspace-heading, .workspace-context,
    .workspace-header-actions, .workspace-launch-card, .workspace-launchpad-grid,
    .workspace-import-zone, .workspace-containment, .workspace-step-indicator) {
    min-width: 0;
    max-width: 100%;
}
/* hidden is a lifecycle contract, not an appearance-only inactive state. */
.intelligent-workspace [hidden], .display-preferences-panel[hidden],
.display-preferences-backdrop[hidden] { display: none !important; }
.intelligent-workspace :is(button, summary, input, select, textarea),
.display-preferences-panel :is(button, input, select) {
    max-width: 100%;
    min-width: 0;
}
.intelligent-workspace :is(button, summary), .display-preferences-panel button {
    min-height: 44px;
    height: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
}
.intelligent-workspace :is(button, input, select, textarea),
.display-preferences-panel :is(button, input, select) { font-family: var(--font-sans); }
.intelligent-workspace :is(p, h1, h2, h3, h4, label, legend, dt, dd),
.display-preferences-panel :is(p, h2, legend, label, output) {
    max-width: 100%;
    overflow-wrap: anywhere;
}
.intelligent-workspace :focus-visible, .display-preferences-panel :focus-visible,
.workspace-tools-disclosure :focus-visible {
    outline: 3px solid var(--workspace-focus);
    outline-offset: 3px;
}

/* A calm case header. Nothing is positioned over the title or status text. */
.workspace-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(12rem, .55fr);
    align-items: start;
    gap: .75rem 1.25rem;
    margin-block: .5rem 1.25rem;
    padding-block: .35rem 1.1rem;
    border-bottom: 1px solid var(--workspace-line);
}
.workspace-heading { grid-column: 1; }
#workspace-title {
    margin: 0 0 .7rem;
    color: var(--workspace-ink);
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: -.025em;
}
.workspace-heading > p { color: var(--workspace-muted); font-size: .9375rem; line-height: 1.65; }
.workspace-context { display: flex; grid-column: 1; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; }
.workspace-case-badge, .workspace-processing-status {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    padding: .35rem .65rem;
    border: 1px solid var(--workspace-line);
    border-radius: .4rem;
    background: var(--workspace-surface);
    color: var(--workspace-ink);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.55;
    white-space: normal;
    overflow-wrap: anywhere;
}
.workspace-processing-status[data-mode="local"] { background: rgba(16, 185, 129, 0.12); border-color: #52525b; color: #f4f4f5; }
.workspace-processing-status[data-mode="assisted"],
.workspace-processing-status[data-processing="assisted"] {
    background: rgba(245, 158, 11, 0.12);
    border-color: #ba893b;
    color: #fbbf24;
}
.workspace-save-state { flex: 1 1 13rem; color: var(--workspace-muted); font-size: .8125rem; line-height: 1.6; overflow-wrap: anywhere; }
.workspace-header-actions { display: flex; grid-column: 2; grid-row: 1 / 3; align-self: center; flex: 0 1 auto; flex-wrap: wrap; gap: .6rem; }
.workspace-header-actions > button { flex: 1 1 10rem; padding: .7rem 1rem; font-size: .9375rem; }
#workspace-primary-action {
    border: 1px solid #64854b;
    background: var(--flagship-lime, #c1f27d);
    color: #f4f4f5;
    box-shadow: none;
}
#workspace-primary-action:hover:not(:disabled) { background: #b0e968; border-color: #42652c; }
#btn-display-preferences { background: var(--workspace-surface); color: var(--workspace-ink); border-color: var(--workspace-line); }
#workspace-case-detail { min-width: 0; max-width: 100%; }
#workspace-case-detail .active-case-banner { margin-top: 0; }
#workspace-case-detail .active-case-details { flex: 1 1 12rem; }
#workspace-case-detail .active-case-details :is(span, strong, small) { white-space: normal; overflow-wrap: anywhere; }

/* Segments reflow rather than scrolling labels away or shrinking type. */
.workspace-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .375rem;
    padding: .375rem;
    margin-block: 0 1.25rem;
    border: 1px solid var(--workspace-line);
    border-radius: .75rem;
    background: #1c1c21;
    min-width: 0;
    max-width: 100%;
}
.workspace-tab {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .65rem;
    min-width: 0;
    min-height: 3.5rem;
    padding: .8rem .9rem;
    border: 1px solid transparent;
    border-radius: .45rem;
    background: transparent;
    color: #d4d4d8;
    font: 600 .9375rem/1.5 var(--font-sans);
    text-align: start;
    cursor: pointer;
}
.workspace-tab > span { min-width: 0; overflow-wrap: anywhere; }
.workspace-tab-index { flex: 0 0 auto; font: 500 .8125rem/1.5 var(--font-mono); }
.workspace-tab:hover { background: #121215; border-color: #3f3f46; }
.workspace-tab[aria-selected="true"] {
    background: var(--workspace-selected);
    border-color: var(--workspace-selected);
    color: var(--workspace-selected-ink);
    box-shadow: inset 0 -3px 0 var(--flagship-lime, #c1f27d);
}
.workspace-tab[aria-selected="true"] .workspace-tab-index { color: #c6e6ad; }
.workspace-panel { margin: 0; padding: 0; }
.workspace-panel:focus-visible { outline-offset: 4px; }

/* Empty launchpad. These are honest actions and descriptions, not mock charts. */
.intelligent-launchpad {
    margin-block: 0 1.5rem;
    padding: clamp(1rem, 2.5vw, 1.75rem);
    border: 1px solid var(--workspace-line);
    border-radius: .85rem;
    background: var(--workspace-surface);
    min-width: 0;
}
#intelligent-launchpad-title { margin: 0 0 .6rem; font-size: 1.5rem; line-height: 1.4; letter-spacing: -.02em; }
.intelligent-launchpad > p { max-width: 66ch; margin: 0 0 1.25rem; color: var(--workspace-muted); font-size: .9375rem; line-height: 1.7; }
.workspace-launchpad-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }
.workspace-launch-card {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1.25rem;
    border: 1px solid var(--workspace-line);
    border-radius: .65rem;
    background: var(--workspace-soft);
}
.workspace-launch-card-kicker { color: #d4d4d8; font: 650 .75rem/1.6 var(--font-mono); letter-spacing: .035em; }
.workspace-launch-card h3 { font-size: 1.125rem; line-height: 1.45; margin: 0; }
.workspace-launch-card > p:not(.workspace-launch-card-kicker) { margin: 0; color: var(--workspace-muted); font-size: .9375rem; line-height: 1.7; }
.workspace-launch-card > button, .workspace-launch-card > .workspace-import-zone { margin-top: auto; }
.workspace-launch-card > button { width: 100%; font-size: .9375rem; padding: .7rem .85rem; }
.workspace-import-zone {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .65rem;
    padding: .8rem;
    border: 2px dashed #52525b;
    border-radius: .5rem;
    color: var(--workspace-muted);
    background: var(--workspace-surface);
    font-size: .875rem;
    line-height: 1.65;
}
.workspace-import-zone :is(p, small, span) { min-width: 0; overflow-wrap: anywhere; }
.workspace-import-zone button { width: 100%; font-size: .9375rem; padding: .7rem .8rem; }
.workspace-import-zone:is(.dragover, .drag-over, .is-dragging, [data-dragover="true"]) {
    border-style: solid;
    border-color: #355d27;
    background: rgba(16, 185, 129, 0.12);
}
#launchpad-status { margin-block: 1rem 0; font-size: .9375rem; line-height: 1.65; overflow-wrap: anywhere; }
#launchpad-status[data-error="true"] { color: #f87171; border-inline-start: 3px solid #a6382b; padding-inline-start: .75rem; }
.workspace-launchpad-notice { margin-block: 1.25rem 0; color: var(--workspace-muted); font-size: .875rem; line-height: 1.75; }

/* Mode-owned content keeps existing facts, disclosure markers, and real states. */
.intelligent-workspace .flagship-overview { padding: 0; overflow: visible; }
.intelligent-workspace .flagship-command { border-radius: .6rem .6rem 0 0; }
.intelligent-workspace .flagship-content { min-width: 0; }
.intelligent-workspace :is(.flagship-kpi, .flagship-surface, .flagship-detail-item,
    .flagship-causal-node, .enterprise-gate, .builder-editor-panel, .builder-guide-panel) { min-width: 0; }
.intelligent-workspace :is(.flagship-panel-heading, .flagship-competitor-head, .active-case-banner) { flex-wrap: wrap; }
.intelligent-workspace :is(.flagship-node-status, .flagship-test-badge, .flagship-synthetic-tag,
    .flagship-graph-footer, .flagship-data-scope, .workspace-step-indicator) { white-space: normal; overflow-wrap: anywhere; }
.intelligent-workspace .flagship-panel-heading > div { min-width: 0; }
.intelligent-workspace .flagship-intelligence-grid { align-items: start; }
/* Let the complete action move to the next flex row before breaking its label. */
.intelligent-workspace .flagship-panel-heading > .flagship-text-button {
    flex: 0 0 auto;
    width: max-content;
    max-width: 100%;
}
/* Native multiple-selects need their own height after the editor's 44px rule.
   Full evidence names remain available in a keyboard-operable disclosure:
   native option labels do not wrap consistently across platforms. */
#builder-workspace #d6-evidence {
    height: auto;
    min-height: 7em;
    padding: .375em;
}
.d6-evidence-field { min-width: 0; }
.d6-evidence-names { min-width: 0; margin-top: .25rem; }
.d6-evidence-names > summary {
    cursor: pointer;
    padding-block: .55rem;
    color: var(--workspace-muted);
    font-size: .875rem;
    line-height: 1.6;
}
.d6-evidence-names ul { margin: .25rem 0 .5rem; padding-inline-start: 1.3rem; }
.d6-evidence-names li {
    margin-block: .5rem;
    font-size: .875rem;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.intelligent-workspace .flagship-executive-banner .enterprise-status-tile { display: block; min-width: 0; max-width: 100%; }
.workspace-step-indicator, #workspace-step-indicator {
    margin-block: 0 1rem;
    padding: .75rem 1rem;
    border: 1px solid var(--workspace-line);
    border-inline-start: 4px solid #3f3f46;
    border-radius: .5rem;
    background: var(--workspace-soft);
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.65;
}
.workspace-containment, #workspace-containment {
    margin-block: 0 1.25rem;
    padding: 1.1rem;
    border: 1px solid var(--workspace-line);
    border-radius: .65rem;
    background: var(--workspace-surface);
    font-size: .9375rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
#workspace-containment :is(h2, h3) { margin: 0 0 .6rem; font-size: 1.125rem; }
#workspace-containment :is(ul, ol) { padding-inline-start: 1.3rem; }
#workspace-export-empty { padding: 1.5rem; border: 1px solid var(--workspace-line); border-radius: .65rem; background: var(--workspace-surface); font-size: 1rem; line-height: 1.7; }

/* Export controls are moved, never duplicated; retain their reading scale when
   they no longer descend from #builder-workspace. */
#workspace-panel-export {
    padding: clamp(.85rem, 2vw, 1.5rem);
    border: 1px solid var(--workspace-line);
    border-radius: .75rem;
    background: var(--workspace-surface);
}
#workspace-panel-export .workspace-export-heading { margin-bottom: 1.25rem; }
#workspace-panel-export .workspace-export-heading h2 { margin: 0 0 .6rem; font-size: 1.375rem; line-height: 1.45; }
#workspace-panel-export .workspace-export-heading p { color: var(--workspace-muted); font-size: .9375rem; line-height: 1.7; }
#workspace-panel-export :is(button, input:not([type=radio]):not([type=checkbox]):not([type=file]), select, textarea, .export-fmt-pill) { font-size: 1rem; min-height: 44px; }
#workspace-panel-export :is(label, .export-panel-label, .export-authenticity-note,
    .export-status, .pptx-template-help, .pptx-template-name, .agent-loop-blockers,
    .export-methodology-help) { font-size: .875rem; line-height: 1.65; }
#workspace-panel-export :is(.export-panel-label, .pptx-template-name, .export-status) {
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
    text-overflow: clip;
}
#workspace-panel-export .export-panel { gap: .85rem; padding: 1rem; background: var(--workspace-soft); border-color: var(--workspace-line); }
#workspace-panel-export .export-fmt-pill { padding: .55rem .8rem; white-space: normal; border-radius: .5rem; }
#workspace-panel-export .export-fmt-pill:has(input:checked) { background: rgba(16, 185, 129, 0.12); color: #f4f4f5; border-color: #678752; }
#workspace-panel-export .export-fmt-pill:has(input:focus-visible) { outline: 3px solid var(--workspace-focus); outline-offset: 3px; }
#workspace-panel-export .export-methodology-field { flex: 1 1 100%; min-width: 0; max-width: 100%; }
#workspace-panel-export :is(.export-title-input, .pptx-style-select) { height: auto; padding: .6rem .7rem; min-width: 0; max-width: 100%; }
#workspace-panel-export #export-oem-template { width: 100%; }
#workspace-panel-export #export-title-input { flex: 1 1 18rem; }
#workspace-panel-export .export-methodology-help { display: block; margin-top: .45rem; color: var(--workspace-muted); overflow-wrap: anywhere; }
#workspace-panel-export .export-review-label { align-items: flex-start; gap: .6rem; min-height: 44px; }
#workspace-panel-export .export-review-label input { flex-shrink: 0; margin-top: .2rem; }
#workspace-panel-export .export-btn { padding: .7rem 1rem; white-space: normal; }
#workspace-panel-export .customer-template-panel { margin-block: 1rem 0; }
#workspace-panel-export .customer-template-panel > summary { min-height: 44px; font-size: 1rem; }
#workspace-panel-export .builder-editor-actions { flex-wrap: wrap; justify-content: flex-start; gap: .75rem; }
#workspace-panel-export .builder-finish-clear { margin-top: .75rem; }

/* Preferences is a genuine modal. Its scroll surface includes the close
   action, so short or zoomed viewports cannot strand the footer controls. */
.display-preferences-backdrop { position: fixed; inset: 0; z-index: 1200; background: #12201999; }
.display-preferences-panel {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    z-index: 1201;
    width: min(30rem, 100%);
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-inline-start: 1px solid var(--workspace-line);
    background: var(--workspace-surface);
    color: var(--workspace-ink);
    box-shadow: -12px 0 40px #0f211c24;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.display-preferences-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--workspace-line);
    background: var(--workspace-soft);
    min-width: 0;
}
.display-preferences-header > div { min-width: 0; }
.display-preferences-header h2 { min-width: 0; margin: 0; font-size: 1.375rem; line-height: 1.45; }
#btn-close-display-preferences { position: static; flex: 0 0 auto; min-width: 44px; min-height: 44px; margin: 0; border: 1px solid var(--workspace-line); border-radius: .5rem; background: var(--workspace-surface); color: var(--workspace-ink); font-size: 1.5rem; }
.display-preferences-content { padding: 1.25rem; min-width: 0; }
.display-preferences-section {
    min-width: 0;
    margin: 0 0 1.25rem;
    padding: 1rem;
    border: 1px solid var(--workspace-line);
    border-radius: .65rem;
}
.display-preferences-section legend { padding-inline: .4rem; font-size: 1rem; font-weight: 650; line-height: 1.6; }
.display-preferences-panel .zoom-control { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; gap: .375rem; padding: .375rem; overflow: visible; border: 1px solid var(--workspace-line); border-radius: .5rem; }
.display-preferences-panel .zoom-btn { min-height: 44px; min-width: 44px; padding: .6rem .75rem; border: 1px solid var(--workspace-line); border-radius: .3rem; color: var(--workspace-ink); background: var(--workspace-surface); font-size: 1rem; }
.display-preferences-panel :is(.lang-btn, .secondary-btn) { padding: .6rem .8rem; font-size: 1rem; }
.display-preferences-panel #btn-high-contrast[aria-pressed="true"] { background: var(--workspace-selected); color: var(--workspace-selected-ink); border-color: var(--workspace-selected); }
.display-preferences-value { display: block; margin-block: .75rem 0; font-size: .9375rem; font-weight: 600; line-height: 1.6; }
.display-preferences-note, #display-preferences-description { margin-block: .65rem 1rem; font-size: .9375rem; line-height: 1.7; color: var(--workspace-muted); }

/* Container queries respond to actual space after the app's text zoom, too. */
@container intelligent-workspace (max-width: 48rem) {
    .workspace-launchpad-grid { grid-template-columns: minmax(0, 1fr); }
    .flagship-intelligence-grid, .flagship-proof-panel, .builder-grid-container { grid-template-columns: minmax(0, 1fr); }
    .flagship-proof-panel { display: block; }
    .builder-guide-panel { border-right: 0; padding-right: 0; }
    .flagship-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .flagship-kpi { border-right: 1px solid var(--flagship-border); border-bottom: 1px solid var(--flagship-border); }
    .flagship-kpi:nth-child(even) { border-right: 0; }
    .flagship-kpi:nth-last-child(-n+2) { border-bottom: 0; }
}
@container intelligent-workspace (max-width: 40rem) {
    .workspace-header { grid-template-columns: minmax(0, 1fr); }
    .workspace-header-actions { grid-column: 1; grid-row: auto; }
    .workspace-tabs { grid-template-columns: minmax(0, 1fr); }
    .workspace-tab { min-height: 3rem; }
    .workspace-header-actions { flex-basis: 100%; width: 100%; }
    .workspace-header-actions > button { flex: 1 1 12rem; }
    .flagship-causal-chain, .flagship-node-map, .flagship-detail-grid,
    .flagship-detail-tests, .enterprise-d6-fields, .enterprise-pfmea-fields,
    .enterprise-review-fields { grid-template-columns: minmax(0, 1fr); }
    .flagship-node-map::before, .flagship-causal-node::before { display: none; }
    .flagship-causal-node { grid-template-columns: minmax(0, 1fr); }
    .flagship-causal-node .flagship-node-status { grid-column: 1; grid-row: auto; justify-self: start; }
    .enterprise-d6-fields :is(.enterprise-span-2, .enterprise-span-3),
    .enterprise-pfmea-fields .enterprise-span-2,
    .enterprise-review-fields .enterprise-span-2 { grid-column: auto; }
    #builder-workspace .builder-progress-bar, .flagship-overview .enterprise-readiness-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #workspace-panel-export :is(.export-title-input, .pptx-style-select) { flex-basis: 100%; width: 100%; }
    .flagship-text-button { max-width: 100%; }
}
@container intelligent-workspace (max-width: 22rem) {
    .workspace-header-actions > button { flex-basis: 100%; }
    .workspace-context { align-items: stretch; }
    .workspace-context > * { flex-basis: 100%; }
    .intelligent-launchpad, .workspace-launch-card { padding: .85rem; }
    .flagship-kpi-strip { grid-template-columns: minmax(0, 1fr); }
    .flagship-kpi { border-right: 0; border-bottom: 1px solid var(--flagship-border); }
    .flagship-kpi:nth-last-child(2) { border-bottom: 1px solid var(--flagship-border); }
    #builder-workspace .builder-progress-bar, .flagship-overview .enterprise-readiness-rail { grid-template-columns: minmax(0, 1fr); }
    .flagship-gate-ratio { flex-basis: 100%; text-align: start; }
    .flagship-executive-banner .enterprise-status-tile { width: 100%; border-left: 0; padding-left: 0; }
}
@media (max-width: 900px) {
    .sidebar { max-width: 100%; }
}
@media (max-width: 768px) {
    .workspace-launchpad-grid { grid-template-columns: minmax(0, 1fr); }
    .workspace-header { gap: 1rem; }
    .workspace-tools-content { align-items: stretch; }
}
@media (max-width: 640px) {
    .workspace-header { grid-template-columns: minmax(0, 1fr); }
    .workspace-header-actions { grid-column: 1; grid-row: auto; }
    .workspace-tabs { grid-template-columns: minmax(0, 1fr); }
    .workspace-tab { min-height: 3rem; padding: .7rem; }
    .workspace-header-actions { flex-basis: 100%; }
    .workspace-header-actions > button { flex: 1 1 12rem; }
    .top-bar-right { justify-content: flex-start; }
    .top-bar .home-btn .home-text { display: inline; }
    .workspace-tools-content > * { flex: 1 1 100%; }
    .display-preferences-header, .display-preferences-content { padding: 1rem; }
    .display-preferences-section { padding: .8rem; }
    #workspace-panel-export .export-panel { padding: .8rem; }
}
@media (max-width: 360px) {
    .workspace-header-actions > button { flex-basis: 100%; }
    .display-preferences-header, .display-preferences-content { padding: .75rem; }
    .display-preferences-section { padding: .65rem; }
    .display-preferences-panel .zoom-btn { padding-inline: .55rem; }
}

/* Presentation-only high contrast. Existing workflows use many local fixed
   colors, so flatten their surfaces and inherit readable ink. Text still names
   each status, and selected controls get an additional strong outline. */
body.auto8d-high-contrast {
    --bg: #121215;
    --surface: #121215;
    --surface-soft: #121215;
    --ink: #f4f4f5;
    --muted: #f4f4f5;
    --subtle: #f4f4f5;
    --line: #3f3f46;
    --workspace-surface: #121215;
    --workspace-soft: #121215;
    --workspace-ink: #f4f4f5;
    --workspace-muted: #f4f4f5;
    --workspace-line: #3f3f46;
    --workspace-focus: #10b981;
    background: #121215 !important;
    color: #f4f4f5 !important;
}
body.auto8d-high-contrast * {
    color: inherit !important;
    background-color: transparent !important;
    background-image: none !important;
    border-color: #3f3f46 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}
body.auto8d-high-contrast :is(.sidebar, .top-bar, .card, .intelligent-launchpad,
    .workspace-launch-card, .workspace-panel, .display-preferences-panel,
    .reference-panel, .enterprise-drawer, .modal-box, dialog, .toast) {
    background-color: #121215 !important;
    color: #f4f4f5 !important;
}
body.auto8d-high-contrast :is(button, input, select, textarea, summary) { border-color: #3f3f46 !important; }
body.auto8d-high-contrast :is(button[aria-selected="true"], button[aria-pressed="true"],
    button.primary-btn, .export-btn, .nav-links li.active, .progress-step-btn.active, .export-fmt-pill:has(input:checked)) {
    background-color: #0c0c0f !important;
    color: #f4f4f5 !important;
    outline: 2px solid #3f3f46;
    outline-offset: 1px;
}
/* Preserve data-bearing bar lengths and the status key in contrast mode. */
body.auto8d-high-contrast :is(.flagship-bar, .d6-chart-fill, .m-progress-fill,
    .goblin-progress-bar-fill, .legend-swatch, .legend-dot, .dist-segment) {
    background-color: #0c0c0f !important;
    border: 1px solid #3f3f46 !important;
}
body.auto8d-high-contrast :is(.d6-chart-fill.before, .flagship-metric-column.before .flagship-bar,
    .legend-swatch.needs-info, .legend-dot.medium, .dist-segment.medium) { background-color: #27272a !important; }
body.auto8d-high-contrast :is(.d6-chart-fill.target, .legend-swatch.empty,
    .legend-dot.low, .dist-segment.low) { background-color: #121215 !important; border-style: dashed !important; }
body.auto8d-high-contrast .d6-chart-track { border: 1px solid #3f3f46 !important; }
body.auto8d-high-contrast a { text-decoration: underline; }
body.auto8d-high-contrast :is(button:disabled, input:disabled, select:disabled) { opacity: 1; border-style: dashed; }
body.auto8d-high-contrast :is(.display-preferences-backdrop, .reference-backdrop,
    .enterprise-drawer-scrim, .nav-scrim, .modal-overlay) { background-color: #0c0c0f !important; }
body.auto8d-high-contrast :focus-visible { outline: 3px solid #10b981 !important; outline-offset: 3px; }

@media (forced-colors: active) {
    .workspace-tab[aria-selected="true"], #btn-high-contrast[aria-pressed="true"] { border: 3px solid Highlight; }
    .workspace-processing-status, .workspace-case-badge, .workspace-launch-card { border-color: CanvasText; }
    .intelligent-workspace :focus-visible, .display-preferences-panel :focus-visible { outline-color: Highlight; }
}
@media (prefers-reduced-motion: reduce) {
    .intelligent-workspace *, .display-preferences-panel * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    .workspace-header-actions, .workspace-tabs, .intelligent-launchpad,
    .display-preferences-panel, .display-preferences-backdrop { display: none !important; }
    .workspace-panel { border: 0; box-shadow: none; }
}
