/* Retained layout fixes: scrolling navigation, wrapping headings and work panes. */
.sidebar { display:flex; flex-direction:column; min-height:0; height:100vh; }
.sidebar-scroll-region { flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden; scrollbar-gutter:stable; }
.sidebar .service-list { max-height:175px; overflow:auto; flex-shrink:0; }
.sidebar .nav-item { min-height:40px; height:auto; white-space:normal; flex-shrink:0; }
.storage-nav-label { line-height:1.35; white-space:normal; overflow:visible; }
.summary-card,.quick-card,.quick-grid,.quick-grid button { min-width:0; }
.summary-head small,.quick-grid button,.quick-grid strong,.quick-grid small { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; height:auto; line-height:1.4; }
.summary-card { min-height:136px; }
body.dashboard-mode .summary-card>span { display:block; min-height:2.8em; white-space:normal; overflow:visible; text-overflow:clip; line-height:1.4; }
body.dashboard-mode .dashboard-left { grid-template-rows:224px minmax(0,1fr) 210px; }
body.dashboard-mode .queue-grid { height:auto; min-height:171px; }
body.dashboard-mode .summary-card { min-height:171px; }
body.dashboard-mode .summary-card>* { flex-shrink:0; }
.iw-live-dot.p0-unknown { color:var(--ui-muted); }
body.dashboard-mode .quick-grid { grid-template-rows:none; grid-auto-rows:minmax(96px,auto); align-content:start; overflow-y:auto; }
body.dashboard-mode .quick-btn { min-height:96px; }
.sidebar .service-list i.ok { background:#45bf79; box-shadow:0 0 0 3px rgba(69,191,121,.12); }
.sidebar .service-list i.error { background:#d5645b; box-shadow:0 0 0 3px rgba(213,100,91,.12); }
.gpu-page .gpu-alert-count,body.gpu-monitor-active .gpu-page .gpu-side-column .phase-badge { color:var(--ui-warning); background:var(--ui-warning-bg); border-color:var(--ui-warning-line); }
.sidebar .gpu-nav-count { color:var(--ui-nav-accent); background:var(--ui-nav-selected); border-color:var(--ui-nav-line); }
.gpu-page,.gpu-page * { writing-mode:horizontal-tb; text-orientation:mixed; }
.gpu-page th,.gpu-page td,.gpu-page label,.gpu-page .button { word-break:normal; overflow-wrap:break-word; }
.gpu-page .gpu-tabs { flex-wrap:wrap; }
.gpu-page .gpu-tabs button { min-width:84px; flex-shrink:0; white-space:nowrap; }
.image-workbench-page .iw-layout { min-width:0; grid-template-columns:minmax(250px,340px) minmax(0,1fr); }
.image-workbench-page .iw-sidebar,.image-workbench-page .iw-controls,.image-workbench-page .iw-panel { min-width:0; max-width:100%; overflow-x:hidden; }
.image-workbench-page select,.image-workbench-page textarea,.image-workbench-page input { max-width:100%; min-width:0; box-sizing:border-box; }
.image-workbench-page .iw-tabs { flex-wrap:wrap; }
.top-actions { flex-wrap:wrap; }
.status-pills { flex-wrap:wrap; }
#p0-members { margin-top:16px; }
#modal-body { overflow-wrap:anywhere; }
#modal-body .data-table td { max-width:420px; overflow-wrap:anywhere; }
.app-shell[inert] { pointer-events:none; }
.p1-scope { display:flex; gap:16px; flex-wrap:wrap; align-items:end; margin-block:12px; }
.p1-scope label { display:grid; gap:6px; min-width:180px; }
.p1-scope select { max-width:340px; min-height:36px; padding:8px; background:var(--ui-panel); color:var(--ui-text); border:1px solid var(--ui-border-strong); border-radius:4px; }
.p1-scope span,.p1-review-meta { color:var(--ui-muted); }
body:has(.organization-workspace) #page-content { flex-direction:column; }
#p1-knowledge-scope { flex:none; }
.organization-workspace { flex:1; height:auto; }
.aw-flow-toolbar { flex-wrap:wrap; }
.aw-flow-toolbar .p1-scope { flex-basis:100%; }
.p1-text,.p1-source-blocks pre,.p1-parse pre,.p1-knowledge-detail pre,.p1-decisions pre { white-space:pre-wrap; overflow-wrap:anywhere; max-height:340px; overflow:auto; padding:12px; line-height:1.6; }
.p1-source-blocks details,.p1-parse,.p1-knowledge-detail h4 { margin-block:16px; }
.p1-source-blocks summary { cursor:pointer; }
.p1-revision textarea { min-height:160px; }
.p1-knowledge-detail,.p1-review-meta { overflow-wrap:anywhere; }
#modal-body a:not(.button) { color:var(--ui-accent); text-underline-offset:3px; }
#modal-actions { flex-wrap:wrap; }
#p1-knowledge-delete-dialog { position:fixed; box-sizing:border-box; width:min(440px,calc(100% - 32px)); max-height:calc(100% - 32px); margin:auto; border:1px solid var(--ui-line); background:var(--ui-panel); color:var(--ui-text); overflow-wrap:anywhere; }
#p1-knowledge-delete-dialog::backdrop { background:var(--ui-scrim); }
#p1-knowledge-delete-dialog p { font-size:16px; }
#p1-knowledge-delete-dialog .modal-actions { flex-wrap:wrap; }
#p1-knowledge-delete-dialog button:focus-visible { outline:2px solid currentColor; outline-offset:2px; }
@media(pointer:coarse) { #p1-knowledge-delete-dialog button { min-height:44px; } }
@media(max-width:1000px) {
  .image-workbench-page .iw-layout { grid-template-columns:minmax(0,1fr); }
  .summary-head small { font-size:12px; }
  .status-pills { display:none; }
}

/* Shell states shared by the homepage, knowledge workspace and work pages. */
.sidebar {
  --ui-focus: var(--ui-nav-accent);
  color-scheme: dark;
}
.sidebar .nav-item:not(.active):hover { background:var(--ui-nav-hover); }
.sidebar .nav-item.active {
  border-color:var(--ui-nav-selected);
  border-left-color:var(--ui-nav-accent);
  background:var(--ui-nav-selected);
  color:var(--ui-nav-text);
}
.sidebar .nav-item.active > span { color:var(--ui-nav-accent); }
.sidebar .nav-item:focus-visible { outline-offset:-3px; }
.sidebar :is(.brand-copy,.sidebar-foot-copy) { min-width:0; }
.sidebar .brand-copy :is(strong,span),.sidebar .sidebar-foot-copy strong { white-space:normal; }
#page-content:focus { outline:0; }
.topbar .top-actions :is(.status-pill,.top-icon,.user-pill,.demo-pill) {
  background:var(--ui-subtle);
  border-color:var(--ui-line);
  color:var(--ui-text);
}
.topbar .status-pill b { color:var(--ui-muted); }
.topbar .status-pill b.is-ok { color:var(--ui-success); }
.topbar .status-pill b.is-warn { color:var(--ui-warning); }
.topbar .status-pill b.is-error { color:var(--ui-danger); }
.topbar .top-actions :is(.top-icon,.user-pill):hover { background:var(--ui-selected); border-color:var(--ui-border-strong); }
.topbar .breadcrumb b { color:var(--ui-text); }
