.document-workspace { display: grid; grid-template-columns: minmax(0, 25fr) minmax(0, 75fr); grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; height: 100%; }
.document-workspace[hidden] { display: none !important; }
.document-workspace > .graph-topline { grid-column: 1 / -1; grid-row: 1; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.document-workspace .node-search-input { flex: 1; width: 100%; min-width: 0; max-width: none; }
.document-workspace .graph-summary { grid-template-columns: minmax(0, 1fr) auto; }
.document-workspace .node-search-form { min-width: 0; }
.document-workspace .graph-summary > strong { font-size: 11px; color: var(--muted); white-space: nowrap; }
.document-workspace > .graph-stage { grid-column: 2; grid-row: 2; grid-template-rows: minmax(0, 1fr); height: 100%; min-width: 0; min-height: 0; }
.cluster-chat-panel { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; height: 100%; border-right: 1px solid var(--border); background: #0b1015; overflow: hidden; }
.cluster-chat-head { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.cluster-chat-head strong { font-size: 13px; color: var(--text); }
.cluster-chat-head .icon-button { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; }
.cluster-chat-panel [hidden] { display: none !important; }
.cluster-chat-stream { overflow: auto; min-height: 0; padding: 16px; overscroll-behavior: contain; }
.cluster-message { padding: 14px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.cluster-message:first-child { padding-top: 0; }
.cluster-message strong { display: block; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.cluster-message.user strong { color: var(--cyan); }
.cluster-message p { margin: 0; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.cluster-message.is-error p { color: #f19c9c; }
.cluster-message details { margin-top: 14px; font-size: 12px; }
.cluster-message summary { color: var(--muted); cursor: pointer; padding: 6px 0; }
.cluster-source { display: block; width: 100%; padding: 8px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; color: var(--text); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.cluster-source span { display: block; color: var(--muted); font-size: 11px; }
.cluster-source:hover { color: var(--cyan); }
.cluster-chat-form { padding: 12px 16px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.cluster-chat-form textarea { width: 100%; min-height: 70px; max-height: 160px; resize: vertical; padding: 10px 12px; background: #11181e; color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; line-height: 1.5; }
.cluster-chat-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.cluster-chat-actions span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.cluster-chat-actions button { flex: 0 0 auto; min-height: 32px; font-size: 12px; }
@media (max-width: 900px) {
  .document-workspace > .graph-topline { grid-template-columns: minmax(0, 1fr); }
  .document-workspace .graph-tools { justify-content: space-between; }
}
@media (max-width: 700px) {
  .app-frame[data-workspace="research"] > .blue-layer:has(.document-workspace:not([hidden])) { height: auto; min-height: 0; }
  .document-workspace { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 420px 500px; }
  .document-workspace > .graph-stage { grid-column: 1; grid-row: 2; }
  .cluster-chat-panel { grid-column: 1; grid-row: 3; border-right: 0; border-top: 1px solid var(--border); }
  .document-workspace .graph-summary { grid-template-columns: minmax(0, 1fr); }
  .document-workspace .node-search-form .primary-button { flex: 0 0 auto; }
  .cluster-chat-stream { padding: 12px; }
}
