/* Contextual column: Final presentation p. 192, rounded cards from P1 p. 75.
   The topbar remains outside this split and spans the full content width. */
.workspace-body { --workspace-content-top-inset: 18px; display: flex; flex: 1; min-width: 0; min-height: 0; align-items: stretch; }
.workspace-heading{position:relative;padding:18px var(--workspace-content-inset,18px) 0;flex-shrink:0;min-width:0;border-start-start-radius:var(--workspace-heading-radius,var(--portal-card-radius));border-start-end-radius:var(--workspace-heading-radius,var(--portal-card-radius))}
.workspace-heading:empty{display:none}
.workspace-heading .page-heading{margin-bottom:0}
.workspace-heading .shared-heading{position:static}
.workspace-body > main { flex: 1; min-width: 0; }
/* Every page shares the panel's top inset, regardless of its content component. */
.shell .workspace-body > main { padding-top: var(--workspace-content-top-inset); }
.contextual-panel { flex: 0 0 272px; min-width: 0; padding: var(--workspace-content-top-inset) 20px 24px 0; font-size: 13px; }
.contextual-panel[hidden] { display: none; }
.contextual-panel > [data-unit-machine-widget], .contextual-panel > .unit-washdoc-link { margin-bottom:12px; }
.unit-washdoc-link { display:block; border-radius:var(--portal-card-radius); text-decoration:none; color:inherit; }
.contextual-panel > [data-unit-machine-widget], .unit-washdoc-link { aspect-ratio:1; overflow:hidden; border:1px solid var(--tone-d5e0e4,#d5e0e4); border-radius:var(--portal-card-radius,.75rem); background:var(--surface,#fff); }
.unit-washdoc-link [data-unit-washdoc-widget] { width:100%; height:100%; }
.contextual-panel > [data-unit-machine-widget]::part(widget-container) { width:100%; height:100%; }
.unit-washdoc-link[href]:focus-visible { outline:2px solid var(--brand-primary); outline-offset:3px; }
.shell:has(.purchase-map, [data-home-overview]) :is(.contextual-panel, .contextual-toggle) { display: none; }
.shell:has([data-wallboard-editor]) :is(.contextual-panel, .contextual-toggle) { display: none; }
.contextual-card { padding: 16px; margin-bottom: 12px; border: 1px solid var(--hub-line, var(--tone-dfe7ea, #dfe7ea)); border-radius: var(--portal-card-radius); background: var(--surface); }
.contextual-card h3 { font-size: 14px; margin: 0 0 12px; overflow-wrap: anywhere; }
/* Match workspace tabs, including component-specific headings, help and controls. */
.contextual-panel .contextual-card :is(h3, h4, p, dt, button, input, select, textarea) { font-size: inherit; }
.contextual-links { display: grid; gap: 6px; }
.contextual-links:empty { display: none; }
.contextual-links a, .contextual-links button, .contextual-copy {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px;
    padding: 8px 10px; border: 0; border-radius: 16px; text-decoration: none;
    background: var(--hub-soft, var(--tone-f1f5f6, #f1f5f6)); color: var(--brand-text); font-size: 13px; text-align: start;
    overflow-wrap: anywhere; cursor: pointer;
}
.contextual-links a:hover, .contextual-links button:hover { background: var(--tone-e6f0ed); }
.contextual-links img, .contextual-copy img { flex-shrink: 0; object-fit: contain; }
.contextual-card .page-link-control { display: block; margin-bottom: 6px; }
.contextual-card .page-link-status:not(:empty) { display: block; position: static; margin-top: 8px; }
@media (min-width: 1200px) {
    /* When the side panel is visible, its cards define the workspace's trailing edge. */
    .shell:has(.contextual-panel:not([hidden])):not(:has(.purchase-map, [data-home-overview], [data-wallboard-editor])) .workspace-heading { padding-inline-end: 20px; }
    .shell:has(.purchase-map, .portal-list-card, .document-graph-frame) .contextual-panel { overflow-y: auto; }
    .shell:has(.purchase-map, [data-home-overview]) .contextual-panel:not([hidden]) { margin-inline-start: 20px; }
}
@media (max-width: 1199px) {
    .workspace-heading{padding-inline:14px}
    .workspace-body { flex-direction: column; }
    .shell .workspace-body > #main-content { padding-inline: 14px; }
    /* Lazy tables place the panel first in the DOM at this width. */
    .contextual-panel { flex: 0 0 auto; padding: 12px 14px 10px; max-height: none; overflow: visible; }
    .shell:has(.contextual-panel:not([hidden])):has(.purchase-map, .portal-list-card) { height: auto; min-height: 100dvh; }
    .shell:has(.contextual-panel:not([hidden])) .purchase-map { min-height: 65dvh; }
    .contextual-card { margin-bottom: 8px; }
}
@media(max-width:820px){.shell{grid-template-rows:auto auto auto 1fr}.workspace-heading{grid-column:1;grid-row:3}.workspace-body{grid-row:4}}
@media print { .contextual-panel, .contextual-toggle { display: none !important; } }
