/* Canonical Paper 1 workspace behaviour. Loaded AFTER page-local legacy CSS. */
.workspace-container {
  box-sizing: border-box;
  width: 100% !important;
  gap: var(--p1-panel-gap) !important;
}

.workspace-container.p1-single-open {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  align-items: stretch;
}

.workspace-container.p1-single-open .workspace-panel:not(.hidden),
.workspace-container.p1-single-open .panel-body,
.workspace-container.p1-single-open .activity-area {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

.workspace-container.p1-multi-open {
  height: var(--p1-multi-workspace-height) !important;
  min-height: 520px !important;
  max-height: var(--p1-multi-workspace-height) !important;
  overflow: hidden !important;
  align-items: stretch;
}

.workspace-container.p1-multi-open .workspace-panel:not(.hidden) {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
}

/* In multi-panel mode the COMPLETE panel scrolls independently, including its AI at the bottom. */
.workspace-container.p1-multi-open .workspace-panel:not(.hidden) > .panel-body {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: block !important;
  scrollbar-width: thin;
  scrollbar-color: var(--p1-red) #f0f0f0;
  padding-right: 4px;
}

.workspace-container.p1-multi-open .workspace-panel:not(.hidden) > .panel-body::-webkit-scrollbar { width: 8px; }
.workspace-container.p1-multi-open .workspace-panel:not(.hidden) > .panel-body::-webkit-scrollbar-track { background:#f0f0f0; border-radius:4px; }
.workspace-container.p1-multi-open .workspace-panel:not(.hidden) > .panel-body::-webkit-scrollbar-thumb { background:var(--p1-red); border-radius:4px; }

.workspace-container.p1-multi-open .activity-area,
.workspace-container.p1-multi-open .article-viewer {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Legacy resizers are replaced by shared dynamic resizers. */
#resizer1, #resizer2, #resizer3, .pane-resizer { display: none !important; }
.p1-shared-resizer {
  flex: 0 0 8px;
  width: 8px;
  min-width: 8px;
  cursor: col-resize;
  background: rgba(30,46,62,.16);
  border-radius: 8px;
  position: relative;
  z-index: 4;
  touch-action: none;
}
.p1-shared-resizer::after {
  content: "";
  position: absolute;
  top: 12%; bottom: 12%; left: 3px;
  width: 2px;
  border-radius: 2px;
  background: rgba(160,0,0,.55);
}
.p1-shared-resizer:hover,
.p1-shared-resizer.active { background: rgba(160,0,0,.13); }

@media (max-width: 900px) {
  .workspace-container.p1-single-open,
  .workspace-container.p1-multi-open {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex-direction: column !important;
  }
  .workspace-container.p1-multi-open .workspace-panel:not(.hidden),
  .workspace-container.p1-multi-open .workspace-panel:not(.hidden) > .panel-body {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .p1-shared-resizer { display:none !important; }
}
