/* Group launch controls by task stage while retaining the compact top-aligned form. */
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) .IM窗口:has(#IM表单[data-xhs-form="generation"]) {
  display:flex!important;flex-direction:column;min-height:0;
}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) .IM窗口:has(#IM表单[data-xhs-form="generation"]) #IM消息区 {display:none!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM页面 #IM表单[data-xhs-form="generation"] {
  display:grid!important;grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:none!important;grid-auto-rows:max-content;align-content:start!important;
  position:static!important;inset:auto!important;flex:1;min-height:0!important;height:auto!important;
  max-height:100%;width:auto!important;margin:16px!important;padding:20px!important;
  gap:18px 16px!important;overflow:auto!important;box-sizing:border-box;
}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM发起任务标题 {
  display:grid!important;grid-column:1/-1!important;grid-row:auto!important;
  gap:5px;margin:0;padding:0 0 14px;border-bottom:1px solid var(--workbench-border-subtle);
}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM发起任务标题>span {display:block;color:var(--workbench-text-accent);font-size:11px}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM发起任务标题 h2 {margin:0;font-size:18px;line-height:1.5}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM发起任务标题 p {margin:0;font-size:12px;line-height:1.5;color:var(--workbench-text-muted)}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] :is(.IM任务配置板块,#IM小红书选项:not([hidden])) {display:contents!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM需求字段:has(textarea[hidden]) {display:none!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] :is(.IM栏目切换栏,.IM表单字段) {
  position:static!important;inset:auto!important;grid-column:auto!important;grid-row:auto!important;
  display:flex!important;flex-direction:column!important;align-items:stretch!important;
  align-self:start!important;gap:6px!important;min-width:0!important;width:100%!important;
  max-width:none!important;height:auto!important;min-height:0!important;margin:0!important;padding:0!important;
}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM栏目选择 {display:block!important;width:100%!important;max-width:none!important;margin:0!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] :is(.IM栏目标题行,.IM字段标题,.IM模板字段标题) {min-height:18px;height:auto!important;font-size:12px!important;line-height:18px!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM表单字段>:is(span,small) {position:static!important;inset:auto!important;transform:none!important;width:auto!important;max-width:100%!important;white-space:normal!important;font-size:12px!important;line-height:1.5!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] :is(input,.IM飞书选择器,.IM飞书选择器按钮,.IM当前模板卡,select) {width:100%!important;min-width:0!important;max-width:100%!important;box-sizing:border-box;min-height:36px!important;height:36px!important;font-size:13px!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM场景工作流计费 {font-size:11px!important;line-height:1.5}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM模板图片字段 {grid-column:auto!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM任务数字段 {grid-column:1!important}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] :is(.IM分批预览,.IM分批安排) {grid-column:1/-1!important;grid-row:auto!important;margin:0}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM分批预览 {padding:10px 12px;font-size:12px;line-height:1.5;background:var(--feishu-color-fill-0);color:var(--workbench-text-secondary);border-radius:6px}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] #IM提交按钮 {
  position:static!important;inset:auto!important;grid-column:1/-1!important;grid-row:auto!important;
  justify-self:stretch!important;align-self:end!important;width:100%!important;max-width:100%;
  min-height:38px!important;height:auto!important;margin:0!important;padding:8px 18px!important;
}
@media(max-width:1100px){body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM页面 #IM表单[data-xhs-form="generation"] {grid-template-columns:minmax(0,1fr)!important}body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM模板图片字段 {grid-column:auto!important}}
@media(max-width:760px){body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM页面 #IM表单[data-xhs-form="generation"] {grid-template-columns:minmax(0,1fr)!important;margin:8px!important;padding:14px!important;gap:14px!important}}

/* Read failures retain retry actions; pending reads have no placeholder. */
.IM首屏读取错误 {display:none!important}
body[data-current-page="im"][data-workbench="xhs"] #IM页面 > :is(.IM窗口,#IM任务面板) {position:relative}
body[data-current-page="im"][data-workbench="xhs"] #IM页面 .IM首屏读取错误 {box-sizing:border-box;position:absolute;inset:16px;z-index:2;overflow:auto;padding:20px;border-radius:8px;background:var(--workbench-surface,#fff);color:var(--workbench-text,#1f2329);align-content:start;gap:16px}
body[data-current-page="im"][data-workbench="xhs"] #IM页面 .IM首屏读取错误 strong {font-size:18px;line-height:1.5}
body[data-current-page="im"][data-workbench="xhs"] #IM页面 .IM首屏读取错误 p {margin:0;font-size:13px;line-height:1.6;color:var(--workbench-text-secondary,#646a73)}
body[data-current-page="im"][data-workbench="xhs"] #IM页面 .IM首屏失败提示 {display:none}
body[data-current-page="im"][data-workbench="xhs"] #IM页面 a.IM首屏失败提示 {width:max-content;color:var(--workbench-text-accent,#3370ff);font-size:13px}
body[data-current-page="im"][data-workbench="xhs"]:is(:not([data-im-current-task]),[data-im-current-task=""]):is([data-im-workflow-readback="pending"],[data-im-workflow-readback="failed"]) #IM页面 > .IM窗口 > :not(.IM首屏读取错误):not(.IM移动对话栏) {visibility:hidden!important;pointer-events:none!important}
body[data-current-page="im"][data-workbench="xhs"]:is(:not([data-im-current-task]),[data-im-current-task=""])[data-im-workflow-readback="failed"] #IM页面 > .IM窗口 > .IM首屏读取错误 {display:grid!important;visibility:visible!important}
body[data-current-page="im"][data-workbench="xhs"]:is(:not([data-im-current-task]),[data-im-current-task=""])[data-im-workflow-readback="failed"] #IM页面 > .IM窗口 .IM首屏失败提示 {display:block}
body[data-current-page="im"][data-workbench="xhs"]:is(:not([data-im-current-task]),[data-im-current-task=""]):is([data-im-templates-readback="pending"],[data-im-templates-readback="failed"]) #IM页面 > #IM任务面板 > :not(.IM首屏读取错误):not(.IM移动对话栏) {visibility:hidden!important;pointer-events:none!important}
body[data-current-page="im"][data-workbench="xhs"]:is(:not([data-im-current-task]),[data-im-current-task=""])[data-im-templates-readback="failed"] #IM页面 > #IM任务面板 > .IM首屏读取错误 {display:grid!important;visibility:visible!important}
body[data-current-page="im"][data-workbench="xhs"]:is(:not([data-im-current-task]),[data-im-current-task=""])[data-im-templates-readback="failed"] #IM页面 > #IM任务面板 .IM首屏失败提示 {display:block}


body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM配置分区 {
  display:grid!important;grid-column:1/-1!important;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px 16px;min-width:0;margin:0;padding:16px 0 0;border-top:1px solid var(--workbench-border-subtle);
}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM配置分区>h3 {
  display:flex!important;grid-column:1/-1;align-items:center;gap:8px;margin:0;font-size:14px;line-height:22px;font-weight:600;
}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM栏目标题行::before {
  content:"01";padding:3px 5px;border-radius:4px;font-size:11px;color:var(--feishu-color-primary);background:var(--feishu-color-primary-light-default);
}
@media(max-width:760px){
  body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM配置分区 {grid-template-columns:minmax(0,1fr);gap:12px;padding-top:14px}
}

body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] .IM栏目标题行 {justify-content:flex-start!important;gap:8px!important;font-weight:600;color:var(--workbench-text-primary)}
body[data-current-page="im"][data-workbench="xhs"]:is([data-im-task-state="not_created"],[data-im-task-state="launch_failed"]) #IM表单[data-xhs-form="generation"] #IM任务计费说明按钮 {margin-left:auto}
