/* Sources use the available work area instead of two unrelated list heights. */
.sw-sources-heading{margin-bottom:18px}
.sw-sources-title-row{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}
.sw-sources-title-row h2{margin:0}
.sw-sources-title-row>.sw-badge{flex:none}
.sw-sources-heading>p{max-width:880px;margin:8px 0 0;color:var(--color-muted);font-size:13px;line-height:21px}
.sw-sources-panel{--sw-source-area-height:clamp(520px,calc(100dvh - 240px),800px)}
.sw-workbench .sw-sources-panel .sw-document-workspace{height:var(--sw-source-area-height);align-items:stretch;margin-bottom:0}
.sw-sources-panel .sw-section-navigation{position:relative;top:auto;display:flex;flex-direction:column;min-height:0;height:100%;overflow:hidden}
.sw-sources-panel .sw-navigation-heading{flex:none}
.sw-sources-panel .sw-section-list{flex:1 1 0;min-height:0;max-height:none;overflow:auto}
.sw-sources-panel .sw-source-controls{display:flex;flex-direction:column;min-height:0;height:100%;box-sizing:border-box;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface);overflow:hidden}
.sw-source-controls-head{flex:0 1 auto;min-height:0;max-height:48%;overflow:auto;padding:16px;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}
.sw-sources-panel .sw-source-topbar{margin:0 0 12px}
.sw-sources-panel .sw-document-tools{margin:0 0 10px}
.sw-sources-panel .sw-selected-sources,.sw-sources-panel .sw-selected-collections{margin:10px 0 0}
.sw-source-results{flex:1 1 0;min-height:160px;overflow:hidden;border-top:1px solid var(--color-border)}
.sw-sources-panel .sw-source-results>.sw-source-list{height:100%;min-height:0;max-height:none;margin:0;border:0;border-radius:0;overflow:auto}
.sw-sources-panel .sw-source-results>.sw-collections-browser{display:flex;flex-direction:column;height:100%;min-height:0}
.sw-sources-panel .sw-collections-browser .sw-collection-options{flex:1 1 0;height:100%;min-height:0;max-height:none;margin:0;border:0;border-radius:0;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}
.sw-source-results>.sw-collections-empty{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;box-sizing:border-box;padding:24px;margin:0;text-align:center}
.sw-source-footer{flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:14px 16px;border-top:1px solid var(--color-border);background:var(--color-surface)}
.sw-source-footer>div{flex:1 1 210px;min-width:0}
.sw-source-footer b{display:block;font-size:12px;font-weight:500;line-height:19px}
.sw-source-footer span{display:block;margin-top:4px;color:var(--color-muted);font-size:11px;line-height:18px}
.sw-source-footer>.btn{flex:0 0 auto;max-width:100%;min-height:40px;margin-left:auto;text-align:center}
.sw-matrix-table .sw-badge.recommendation{background:var(--color-accent-soft);color:var(--color-accent)}
.sw-workbench .sw-matrix-table .sw-recommendation-context{display:block;font-size:11px;line-height:18px;color:var(--color-muted);margin-top:6px}
/* Help uses the existing modal lifecycle: scroll inside, fields and page stay put. */
.modal:has(.sw-help-modal-content){display:flex;flex-direction:column;width:min(720px,calc(100vw - 32px));max-height:min(760px,calc(100dvh - 48px));overflow:hidden}
.modal:has(.sw-help-modal-content)>.modal-header,.modal:has(.sw-help-modal-content)>.modal-footer{flex:none}
.modal:has(.sw-help-modal-content)>.modal-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--color-border) transparent}
.sw-help-modal-content{font-size:14px;line-height:1.7;color:var(--color-text)}
.sw-help-modal-content .sw-guide-instructions{margin:0}
@container workspace (max-width:1040px){
 .sw-workbench .sw-sources-panel .sw-document-workspace{height:auto;align-items:start}
 .sw-sources-panel .sw-section-navigation{display:block;height:auto;overflow:visible}
 .sw-sources-panel .sw-section-list{flex:none;max-height:392px}
 .sw-sources-panel .sw-source-controls{height:clamp(480px,calc(100dvh - 240px),760px)}
}
@container workspace (max-width:620px){
 .sw-source-controls-head{padding:12px}
 .sw-source-footer{padding:12px}
 .sw-source-footer>.btn{width:100%}
 .sw-sources-title-row{gap:8px}
 .sw-sources-panel .sw-section-list{max-height:348px}
}
@media(max-height:600px){.modal:has(.sw-help-modal-content){max-height:calc(100dvh - 24px)}}
/* The prerequisite belongs beside the transition, where the user needs it. */
#sw-profile-footer{display:block}
#sw-profile-footer>.sw-profile-footer-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:16px}
.sw-profile-footer-row>span{flex:1 1 190px;font-size:12px;line-height:1.5;color:var(--color-muted)}
.sw-profile-footer-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.sw-profile-footer-actions>.btn{min-height:40px}
.sw-source-gate{display:grid;grid-template-columns:20px minmax(0,1fr);gap:12px;padding:18px 20px;border:1px solid #d5e5f7;border-radius:12px;background:var(--color-accent-soft);color:var(--color-text)}
.sw-source-gate-icon{display:flex;align-items:flex-start;justify-content:center;padding-top:3px;color:var(--color-accent)}
.sw-source-gate-icon svg{width:18px;height:18px}
.sw-source-gate-content{min-width:0}
.sw-source-gate-content h3{font-size:14px;line-height:1.5;font-weight:600;margin:0 0 6px}
.sw-source-gate-content p{font-size:13px;line-height:1.6;margin:0;color:var(--color-muted)}
.sw-source-gate-progress{display:grid;gap:7px;margin-top:14px;font-size:12px;color:var(--color-accent)}
.sw-source-gate progress{display:block;width:100%;height:5px;border:0;border-radius:999px;overflow:hidden;appearance:none;background:#d8e6f6;accent-color:var(--color-accent)}
.sw-source-gate progress::-webkit-progress-bar{background:#d8e6f6;border-radius:999px}
.sw-source-gate progress::-webkit-progress-value{background:var(--color-accent);border-radius:999px;transition:width .25s ease}
.sw-source-gate progress::-moz-progress-bar{background:var(--color-accent);border-radius:999px}
.sw-source-gate details{margin-top:12px}
.sw-source-gate summary{display:inline-flex;align-items:center;gap:8px;cursor:pointer;list-style:none;color:var(--color-accent);font-size:12px;line-height:24px;border-radius:4px}
.sw-source-gate summary::-webkit-details-marker{display:none}
.sw-source-gate summary svg{width:14px;height:14px;transition:transform .15s ease}
.sw-source-gate details[open] summary svg{transform:rotate(180deg)}
.sw-source-gate summary:focus-visible{outline:2px solid var(--color-accent);outline-offset:3px}
.sw-source-gate-content .sw-source-gate-current{font-size:12px;margin-top:10px}
.sw-source-gate ol{list-style:none;display:grid;gap:8px;padding:0;margin:12px 0}
.sw-source-gate li{display:grid;grid-template-columns:16px minmax(0,1fr);align-items:center;gap:8px;font-size:12px;line-height:1.5;color:var(--color-muted)}
.sw-source-gate li svg,.sw-source-gate li .project-spinner{width:14px;height:14px}
.sw-source-gate li.is-done{color:#287853}
.sw-source-gate li.is-current{color:var(--color-accent)}
.sw-source-gate small{font-size:11px;line-height:1.5;color:var(--color-muted)}
.sw-source-gate-action{margin-top:12px}
.sw-source-gate.is-ready{background:#f0f8f3;border-color:#d7eade}
.sw-source-gate.is-ready .sw-source-gate-icon{color:#287853}
@container workspace (max-width:620px){.sw-source-gate{padding:16px;gap:10px}.sw-profile-footer-actions{width:100%}.sw-profile-footer-actions>.btn{flex:1 1 180px;justify-content:center}}
@media(prefers-reduced-motion:reduce){.sw-source-gate progress::-webkit-progress-value,.sw-source-gate summary svg{transition:none}}
/* Text revisions: drafts persist automatically, acceptance is explicit. */
.sw-text-save:disabled{background:var(--color-surface);border:1px solid var(--color-border);color:var(--color-muted);opacity:.65;cursor:default;box-shadow:none}
.sw-text-section-header .sw-text-history{display:inline-flex;align-items:center;justify-content:center;flex:0 0 36px;width:36px;height:36px;min-width:36px;padding:0;border:1px solid var(--color-border);border-radius:8px;background:var(--color-surface);color:var(--color-muted)}
.sw-text-history svg{width:17px;height:17px}
.sw-text-history:hover{color:var(--color-accent);border-color:var(--color-accent-line);background:var(--color-accent-soft)}
.sw-text-section-header h3{margin-right:auto}
.sw-release-notes{margin:20px 0;padding:16px 18px;border-radius:10px;background:var(--color-surface-muted)}
.sw-release-notes h3{font-size:14px;margin:0 0 8px}
.sw-release-notes ul{font-size:13px;line-height:1.65;margin:0;padding-left:18px}
.sw-final-confirmation{margin-top:24px;align-items:flex-start;line-height:1.6}
.sw-release-date{font-size:13px;color:var(--color-muted)}
/* Stage-wide acceptance lives outside the individual section workspace. */
.sw-sources-stage-footer{align-items:flex-end}
.sw-sources-stage-footer>.sw-source-summary{display:block;flex:1 1 240px;margin-left:0}
.sw-source-summary b{display:block;font-size:12px;line-height:20px;font-weight:500}
.sw-source-summary span{display:block;margin-top:4px;font-size:12px;line-height:19px;color:var(--color-muted)}
.sw-profile-footer-row>.sw-profile-blockers{flex:1 1 100%;min-width:0}
.sw-profile-blockers p{display:flex;align-items:flex-start;gap:8px;margin:0 0 8px;font-size:13px;line-height:20px}
.sw-profile-blockers p>svg,.sw-profile-blockers .project-spinner{flex:none;width:16px;height:16px;margin-top:2px}
.sw-profile-blockers p>span:not(.project-spinner){min-width:0}
.sw-profile-blockers .is-error{color:var(--color-danger)}
.sw-profile-blockers .is-unsaved{color:#ad470d}
.sw-profile-blockers .is-pending{color:var(--color-muted)}
.sw-profile-blockers .is-ready{color:var(--color-success)}
.sw-workbench .sw-profile-blockers .sw-show-errors{flex:none;min-height:24px;padding:0 4px;border:0;background:transparent;color:var(--color-danger);font-size:12px;text-decoration:underline;text-underline-offset:3px}
.sw-workbench [data-sw-profile][aria-invalid="true"]{border-color:var(--color-danger);box-shadow:0 0 0 1px var(--color-danger)}
.sw-workbench .sw-oks-selected[aria-invalid="true"]{min-height:36px;padding:8px;border:1px solid var(--color-danger);border-radius:8px}
.sw-workbench [aria-invalid="true"]:focus-visible{outline:2px solid var(--color-danger);outline-offset:3px}
@container workspace (max-width:620px){.sw-profile-blockers p{flex-wrap:wrap}.sw-profile-blockers .sw-show-errors{margin-left:24px}}
