/* 语文 / 地理 / 英语结构化录入：TODO-list 式单题任务流外壳样式。
 * 只在 #english-editor.taskflow-on 下生效；不改动任何既有组件样式，
 * 仅控制「任务流外壳」自身的布局与既有渲染产物的显隐。 */

/* ---- 外壳布局：旧锚点导航与“全部展开”容器隐藏，改由任务流承载 ---- */
#english-editor.taskflow-on .work-nav{display:none}
#english-editor.taskflow-on #dynamic-paper-sections{display:none}
/* 英语：听力答案批量录入区原挂点隐藏，激活对应任务时移入单题视图 */
#english-editor.taskflow-on #listening-answer-console-mount{display:none}

/* ---- 整卷教学分析：默认从常规流隐藏，作为导航末位任务激活时才在单题视图显示；
 * 正式保存按钮仍按锁定规则显隐（临时保存始终可用） ---- */
#english-editor.taskflow-on [data-paper-overall-analysis]{display:none}
#english-editor.taskflow-on .taskflow-stage [data-paper-overall-analysis]{display:block}
#english-editor.taskflow-on.taskflow-locked .formal-save-btn{display:none}
.taskflow-stage>[data-paper-overall-analysis]{border:0;border-radius:0;box-shadow:none;margin:0}

/* ---- 左侧任务导航 ---- */
#taskflow-nav{position:sticky;top:14px;background:#fff;border:1px solid var(--line,#dfe7ea);border-radius:14px;padding:14px;box-shadow:var(--shadow,0 2px 10px rgba(20,40,50,.06));max-height:calc(100vh - 28px);overflow:auto}
#taskflow-nav .tf-brand{font-size:13px;font-weight:850;color:#173f38;margin-bottom:2px}
#taskflow-nav .tf-brand small{display:block;font-size:9px;color:#85939b;font-weight:600;margin-top:2px}
.tf-progress{margin:12px 0;padding:11px 11px 9px;border:1px solid #e4ecea;border-radius:10px;background:#f8fbfa}
.tf-progress-row{display:flex;justify-content:space-between;font-size:10px;color:#5d6f77;margin:3px 0 5px}
.tf-progress-row strong{font-size:10px;color:#173f38}
.tf-progress-bar{height:6px;border-radius:8px;background:#e7efed;overflow:hidden}
.tf-progress-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#177b6c,#49b59f);border-radius:8px;transition:width .25s}
.tf-progress-row+.tf-progress-bar{margin-bottom:7px}
.tf-actions{display:grid;gap:6px;margin-bottom:12px}
.tf-actions button{border:1px solid #cfdade;background:#fff;color:#40515c;border-radius:8px;padding:8px 10px;font-size:11px;font-weight:700;cursor:pointer;text-align:left}
.tf-actions button:hover{border-color:var(--accent,#14796b);color:var(--accent,#14796b)}
.tf-actions button[data-tf-action="locate"]{background:#eaf5f1;border-color:#a9c8c0;color:#1b7061}
.tf-section{margin-bottom:8px}
.tf-section-head{padding:7px 9px;border-radius:8px;background:#f2f7f5}
.tf-section-head b{display:block;font-size:11px;color:#20584e}
.tf-section-head small{font-size:9px;color:#7d8b92}
.tf-group{margin:6px 0 2px}
.tf-group-head{display:flex;justify-content:space-between;align-items:center;gap:8px;width:100%;border:0;background:transparent;padding:6px 9px;font-size:11px;font-weight:800;color:#3c4d55;cursor:pointer;text-align:left;border-radius:7px}
.tf-group-head:hover{background:#f2f7f5}
.tf-group-head small{font-size:9px;color:#8a979e;font-weight:600;white-space:nowrap}
.tf-group-head small b{color:#177b6c}
.tf-group-head:after{content:'−';font-size:12px;color:#9aa7ad}
.tf-group.collapsed>.tf-group-head:after{content:'＋'}
.tf-group.collapsed>.tf-group-items{display:none}
.tf-group-items{padding:2px 0 2px 8px}
.tf-item{display:flex;align-items:center;gap:7px;width:100%;border:0;border-left:2px solid transparent;background:transparent;padding:6px 8px;margin:1px 0;border-radius:0 7px 7px 0;font-size:11px;color:#4c5d66;cursor:pointer;text-align:left}
.tf-item:hover{background:#f2f7f5}
.tf-item.active{background:#e7f4ef;border-left-color:#177b6c;color:#135d51;font-weight:800}
.tf-item .tf-item-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tf-item-state{font-size:9px;color:#98a5ab;white-space:nowrap}
.tf-item.done .tf-item-state{color:#17785f;font-weight:800}
.tf-dots{display:flex;gap:3px;flex:0 0 auto}
.tf-dot{width:17px;height:17px;border-radius:50%;display:inline-grid;place-items:center;font-size:9px;font-style:normal;font-weight:800;background:#edf1f3;color:#8a979e}
.tf-dot.done{background:#d9efe7;color:#11705d}

/* ---- 主区单题视图 ---- */
#taskflow-view{margin-bottom:16px}
.tf-seq-banner{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:10px;padding:10px 13px;border:1px solid #bcd8d0;border-radius:10px;background:#eef7f4;color:#1c5f53;font-size:11px}
.tf-seq-banner[hidden]{display:none}
.tf-seq-banner b{font-size:11px}
.tf-seq-banner span{font-weight:800}
.tf-seq-banner small{color:#5f7a72;font-size:9px}
#tf-head{background:#fff;border:1px solid var(--line,#dfe7ea);border-radius:14px 14px 0 0;padding:15px 18px 12px;border-bottom:0}
#tf-head .tf-kicker{font-size:9px;letter-spacing:.12em;color:#177b6c;font-weight:850}
#tf-head h3{margin:5px 0 7px;font-size:18px;color:#1d3a34}
#tf-head h3 small{font-size:11px;color:#7d8b92;font-weight:600;margin-left:8px}
.tf-head-chips{display:flex;gap:7px;flex-wrap:wrap}
.tf-head-chips span{padding:4px 9px;border-radius:16px;background:#f1f6f5;color:#54706a;font-size:10px;font-weight:700}
.tf-head-chips span.done{background:#e0f2ed;color:#176f61}
.tf-tasks{display:grid;grid-template-columns:repeat(4,1fr);gap:0;background:#fff;border:1px solid var(--line,#dfe7ea);border-top:0;border-bottom:0}
.tf-tasks.tf-tasks-2{grid-template-columns:repeat(2,1fr)}
.tf-tasks.tf-tasks-3{grid-template-columns:repeat(3,1fr)}
.tf-task{position:relative;padding:11px 13px 11px 40px;border-right:1px solid #edf1f3}
.tf-task:last-child{border-right:0}
.tf-task:before{content:attr(data-step);position:absolute;left:13px;top:11px;width:19px;height:19px;border-radius:50%;display:grid;place-items:center;background:#edf1f3;color:#7c8991;font-size:9px;font-weight:800}
.tf-task strong{display:block;font-size:11px;color:#40515c}
.tf-task small{display:block;font-size:9px;color:#98a5ab;margin-top:2px}
.tf-task.done:before{content:'✓';background:#38a77a;color:#fff}
.tf-task.done strong{color:#167862}
.tf-task.optional:before{background:#f3ead8;color:#a68a4a}
.taskflow-stage{background:#fff;border:1px solid var(--line,#dfe7ea);border-top:0;border-radius:0}
.taskflow-stage>.material-card,.taskflow-stage>.manual-slot-card{border:0;border-radius:0;box-shadow:none}
/* 英语：听力答案批量录入区与单题视图内 relocated 教研编辑器 */
.taskflow-stage>.listening-answer-console{margin:0;border:0;border-radius:0;box-shadow:none}
.tf-relocated-meta{margin-top:10px}
.tf-section-special .tf-group-items{padding-left:0}
/* 工作台导航末位“最后一步·整卷教学分析”分组 */
.tf-section-overall{margin-top:12px}
.tf-section-overall .tf-section-head{background:#f2f0e9}
.tf-section-overall .tf-section-head b{color:#6d5a1f}
.tf-section-overall .tf-section-head small{color:#a08d54}
/* 单题视图内强制展开材料卡，并隐藏与本任务无关的部分 */
.taskflow-stage .material-card>summary.material-head{pointer-events:none}
.taskflow-stage .material-card>summary.material-head:after{display:none!important}
.taskflow-stage[data-task-kind="material"] .material-questions{display:none}
.taskflow-stage[data-task-kind="question"] .material-source{display:none}
.taskflow-stage[data-task-kind="question"] .english-question{display:none}
.taskflow-stage[data-task-kind="question"] .english-question.tf-current{display:block}
.taskflow-stage[data-task-kind="question"] .material-questions{padding-top:6px!important}
.taskflow-stage[data-task-kind="question"] .material-questions>.entry-column-title{display:none}
.tf-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;background:#fff;border:1px solid var(--line,#dfe7ea);border-top:0;border-radius:0 0 14px 14px;padding:12px 16px}
.tf-footer span{font-size:10px;color:#85939b}
.tf-footer button{border-radius:8px;padding:9px 15px;font-size:12px;font-weight:800;cursor:pointer}
#tf-prev{border:1px solid #cfdade;background:#fff;color:#40515c}
#tf-prev:hover:not(:disabled){border-color:var(--accent,#14796b);color:var(--accent,#14796b)}
#tf-prev:disabled{opacity:.4;cursor:not-allowed}
#tf-next{border:1px solid #126c5e;background:#167d6d;color:#fff}
#tf-next:hover{background:#0f6d5f}

/* ---- 解锁提示 ---- */
#tf-lock-note{margin:22px 0 -8px;padding:13px 16px;border:1px dashed #d8c38a;border-radius:12px;background:#fffaf0;color:#86631f;font-size:12px;line-height:1.7}
#tf-lock-note b{color:#6d4f10}
#tf-lock-note.unlocked{border-style:solid;border-color:#b9ddd5;background:#f2faf7;color:#176f61}
#tf-lock-note button{margin-left:10px;border:1px solid #d8c38a;background:#fff;color:#86631f;border-radius:7px;padding:5px 10px;font-size:11px;font-weight:800;cursor:pointer}
#tf-lock-note.unlocked button{display:none}

/* ---- 完成反馈 toast ---- */
#tf-toast{position:fixed;left:50%;bottom:34px;transform:translate(-50%,16px);z-index:1600;max-width:min(520px,92vw);padding:11px 18px;border-radius:24px;background:rgba(16,52,45,.94);color:#eaf7f2;font-size:12px;font-weight:700;opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;box-shadow:0 10px 30px rgba(10,30,26,.3)}
#tf-toast.show{opacity:1;transform:translate(-50%,0)}

/* ---- 响应式 ---- */
@media(max-width:950px){
  #taskflow-nav{position:static;max-height:none;margin-bottom:12px}
  .tf-tasks{grid-template-columns:1fr 1fr}
  .tf-task:nth-child(2){border-right:0}
  .tf-task:nth-child(-n+2){border-bottom:1px solid #edf1f3}
  .tf-footer{flex-wrap:wrap}
}

/* ================================================================
 * 通用学科上传页（数学/物理/化学/生物/历史/政治，upload_paper.html）
 * 同一套任务流外壳；只在 body.taskflow-generic-on 下生效，
 * 不影响上方三个工作台的既有规则。
 * ============================================================== */
/* 旧“全部展开”题卡容器隐藏，改由任务流单题视图承载 */
body.taskflow-generic-on #questions-area{display:none}
/* 整卷教学分析：默认从常规流隐藏，作为导航末位任务激活时才在单题视图显示；
 * 正式保存按钮仍按锁定规则显隐（临时保存始终可用） */
body.taskflow-generic-on [data-paper-overall-analysis]{display:none}
body.taskflow-generic-on .taskflow-stage [data-paper-overall-analysis]{display:block}
body.taskflow-generic-on.taskflow-locked #sticky-save .btn-save{display:none}
/* 通用页导航末位“最后一步”分组头（不可折叠） */
.tf-overall-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:7px 9px;margin-top:10px;border-radius:8px;background:#f2f0e9}
.tf-overall-head span{font-size:11px;font-weight:800;color:#6d5a1f}
.tf-overall-head small{font-size:9px;color:#a08d54}

/* 外壳布局：左导航 + 右单题视图 */
#taskflow-generic-shell{display:flex;gap:16px;align-items:flex-start;margin-bottom:16px}
#taskflow-generic-shell>#taskflow-nav{flex:0 0 250px}
#taskflow-generic-shell>.tf-generic-main{flex:1;min-width:0}
.tf-empty{padding:12px 10px;font-size:11px;color:#85939b;line-height:1.7}

/* 单题视图内的通用题卡：去卡片边距、强制展开；
 * summary 禁止折叠，但“快速难度/快速满分”控件保持可用。 */
.taskflow-stage>.q-card{display:block;border:0;border-radius:0;margin-bottom:0}
.taskflow-stage>.q-card>summary.q-summary{pointer-events:none}
.taskflow-stage>.q-card>summary.q-summary .q-summary-quick,
.taskflow-stage>.q-card>summary.q-summary .q-summary-quick *{pointer-events:auto}

@media(max-width:950px){
  #taskflow-generic-shell{flex-direction:column}
  #taskflow-generic-shell>#taskflow-nav{flex:none;width:100%;box-sizing:border-box}
}
