/* 方案、生成与结果阶段优先展示顾客当前要操作的内容，隐藏重复素材配置列。 */
@media (min-width: 901px) {
  body:has(#suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage]:is([data-flow-stage="planning"], [data-flow-stage="generating"], [data-flow-stage="done"], [data-flow-stage="failed"])) #root .workspaceApp #suiteFlowWorkspace.productSuiteView .suiteWorkflowLayout {
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0 !important;
  }

  body:has(#suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage]:is([data-flow-stage="planning"], [data-flow-stage="generating"], [data-flow-stage="done"], [data-flow-stage="failed"])) #root .workspaceApp #suiteFlowWorkspace.productSuiteView .suiteWorkflowAssets {
    display: none !important;
  }

  body:has(#suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage]:is([data-flow-stage="planning"], [data-flow-stage="generating"], [data-flow-stage="done"], [data-flow-stage="failed"])) #root .workspaceApp #suiteFlowWorkspace.productSuiteView .suiteTaskBoard {
    grid-column: 1 !important;
    min-width: 0 !important;
  }

  body:has(#suiteFlowWorkspace.productSuiteView[data-flow-stage="planning"]) #root .workspaceApp #suiteFlowWorkspace .suiteWorkflowStage[data-stage="planning"] {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
  }

  body:has(#suiteFlowWorkspace.productSuiteView[data-flow-stage="planning"]) #root .workspaceApp #suiteFlowWorkspace .suiteDetailPlanWorkspace {
    height: auto !important;
    min-height: 100% !important;
    align-content: start !important;
    overflow: visible !important;
  }

  body:has(#suiteFlowWorkspace.productSuiteView[data-flow-stage]:is([data-flow-stage="generating"], [data-flow-stage="done"])) #root .workspaceApp #suiteFlowWorkspace .suiteReferencePlanActions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  body:has(#suiteFlowWorkspace.productSuiteView[data-flow-stage]:is([data-flow-stage="generating"], [data-flow-stage="done"])) #root .workspaceApp #suiteFlowWorkspace .suiteReferencePlanActions button {
    box-sizing: border-box !important;
    min-width: 136px !important;
    min-height: 44px !important;
    max-width: 100% !important;
    height: auto !important;
    writing-mode: horizontal-tb !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  /* 方案页在窄桌面仍保留“画面目录 + 方案编辑”双栏；只将生成结果阶段改为纵向，避免目录被挤出或被兄弟面板盖住。 */
  body:has(#suiteFlowWorkspace.productSuiteView[data-flow-stage]:is([data-flow-stage="generating"], [data-flow-stage="done"])) #root .workspaceApp #suiteFlowWorkspace .suiteReferenceGenerationLayout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
  }

  body:has(#suiteFlowWorkspace.productSuiteView[data-flow-stage]:is([data-flow-stage="generating"], [data-flow-stage="done"])) #root .workspaceApp #suiteFlowWorkspace .suiteWorkflowStage:is([data-stage="generating"], [data-stage="done"]) {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
  }

  body:has(#suiteFlowWorkspace.productSuiteView[data-flow-stage]:is([data-flow-stage="generating"], [data-flow-stage="done"])) #root .workspaceApp #suiteFlowWorkspace .suiteReferencePlanPanel {
    min-height: 320px !important;
  }
}

/* 详情图移动端表单至少 16px，覆盖该流程专属输入字号。 */
@media (max-width: 640px) {
  body:has(.productSuiteView) #root .workspaceApp #suiteFlowWorkspace.productSuiteView.suiteFlowWorkspace[data-suite-type="详情图"][data-flow-stage][data-history-open] .suiteReferenceConfig :is(input, select, textarea),
  body:has(.productSuiteView) #root .workspaceApp #suiteFlowWorkspace.productSuiteView.suiteFlowWorkspace[data-suite-type="详情图"][data-flow-stage][data-history-open] .suiteDetailCount select {
    font-size: 16px !important;
  }
}

/* 方案阶段用左右独立滚动区，目录与生成操作不随长提示词一起滚出视野。 */
@media (min-width: 901px) {
  #root .workspaceApp #suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage="planning"] .suiteWorkflowStage[data-stage="planning"] {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #root .workspaceApp #suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage="planning"][data-history-open] .suiteDetailPlanWorkspace {
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: clamp(220px, 23vw, 300px) minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 16px !important;
    width: 100% !important;
    height: calc(100dvh - 226px) !important;
    min-height: 540px !important;
    max-height: calc(100dvh - 226px) !important;
    overflow: hidden !important;
  }

  #root .workspaceApp #suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage="planning"][data-history-open] .suiteDetailResultsBoard {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
  }

  #root .workspaceApp #suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage="planning"][data-history-open] .suiteDetailPlanSidebar {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  #root .workspaceApp #suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage="planning"][data-history-open] .suiteDetailPlanList {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
  }

  #root .workspaceApp #suiteFlowWorkspace.productSuiteView[data-suite-type="详情图"][data-flow-stage="planning"][data-history-open] .suiteDetailPlanFooter {
    position: relative !important;
    inset: auto !important;
    flex: 0 0 auto !important;
    margin-top: auto !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    background: #fff !important;
    box-shadow: 0 -6px 18px rgb(36 53 82 / 7%);
  }
}
