/*
 * 作文升级（任务6）：批阅工作台样式（public/zuowen.html 内嵌工作台视图）。
 * 复用全站设计基调（暖棕金色调，与 zuowen.html 既有 CSS 变量/配色一致）：
 * 主色 #7c5722 / #9a6f2e，边框 #e7dcc6，底色 #fbf5ea，标题 #674820。
 * 前缀 .ewb-（essay workbench），不与页面既有类名冲突。
 */

/* ---------- 工作台骨架 ---------- */

.ewb-card { border: 1px solid #e7dcc6; border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; background: #fffdf8; }
.ewb-card > h3 { margin: 0 0 6px; color: #674820; font-family: "Songti SC", "STSong", serif; font-size: 17px; }
.ewb-card .ewb-sub { color: #8a7559; font-size: 12px; margin: 0 0 12px; }
.ewb-note { color: #8a7559; font-size: 12px; line-height: 1.7; }
.ewb-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ewb-muted { color: #8a7559; }

/* ---------- 模型设置卡（五家下拉 / 密钥 / 测试） ---------- */

.ewb-config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 12px; }
.ewb-config-col { border: 1px dashed #dfcfb2; border-radius: 10px; padding: 12px 14px; background: #fbf5ea; }
.ewb-config-col h4 { margin: 0 0 8px; font-size: 13.5px; color: #7c5722; }
.ewb-config-col label { display: block; font-size: 12px; color: #6f5b40; font-weight: 700; margin: 8px 0 0; }
.ewb-config-col label select, .ewb-config-col label input { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
.ewb-model-meta { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid #e7dcc6; font-size: 12px; color: #5a4d3a; line-height: 1.8; }
.ewb-model-meta a { color: #9a6f2e; font-weight: 700; }
.ewb-tag { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; margin-left: 4px; }
.ewb-tag-warn { background: #fef3c7; color: #92400e; }
.ewb-tag-ok { background: #d4edda; color: #155724; }
.ewb-test-ok { margin-top: 6px; font-size: 12px; color: #155724; background: #edf8ec; border-radius: 8px; padding: 6px 10px; }
.ewb-test-fail { margin-top: 6px; font-size: 12px; color: #b91c1c; background: #fee2e2; border-radius: 8px; padding: 6px 10px; }

/* 首次发送同意弹窗的数据范围清单 */
.ewb-consent-list { margin: 10px 0; padding-left: 20px; font-size: 13px; color: #4a3f30; line-height: 1.9; }
.ewb-consent-list b { color: #7c5722; }

/* ---------- 状态徽标（essay-workflow 状态推导的九态色系） ---------- */

.ewb-status { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.ewb-status-pending_identity { background: #fde8d7; color: #9a3412; }
.ewb-status-pending_pages { background: #fde8d7; color: #9a3412; }
.ewb-status-pending_transcript { background: #fef3c7; color: #92400e; }
.ewb-status-pending_facts { background: #fef3c7; color: #92400e; }
.ewb-status-ready { background: #d4edda; color: #155724; }
.ewb-status-generating { background: #d6eaf8; color: #1a5276; }
.ewb-status-pending_review { background: #e8daef; color: #6c3483; }
.ewb-status-finalized { background: #7c5722; color: #fff; }
.ewb-status-invalid { background: #fee2e2; color: #b91c1c; }

/* ---------- 批次进度与队列 ---------- */

.ewb-queue { border: 1px solid #e7dcc6; border-radius: 10px; padding: 12px 14px; background: #fbf5ea; margin-bottom: 14px; }
.ewb-queue-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: #6f5b40; margin-top: 8px; }
.ewb-queue-stats b { color: #7c5722; }
.ewb-progress { height: 8px; background: #e7dcc6; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.ewb-progress-fill { height: 100%; background: linear-gradient(90deg, #9a6f2e, #7c5722); border-radius: 4px; transition: width .3s; }

/* ---------- 作品列表与卡片 ---------- */

.ewb-work-list { display: grid; gap: 12px; }
.ewb-work-card { border: 1.5px solid #e7dcc6; border-radius: 12px; padding: 14px 16px; background: #fffdf8; }
.ewb-work-card.selected { border-color: #9a6f2e; box-shadow: 0 2px 12px rgba(154, 111, 46, .16); }
.ewb-work-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.ewb-work-head h4 { margin: 0; font-size: 15px; color: #493b2b; }
.ewb-work-head .ewb-work-meta { font-size: 12px; color: #8a7559; }
.ewb-block { border-top: 1px dashed #dfcfb2; margin-top: 10px; padding-top: 10px; }
.ewb-block > .ewb-block-title { font-size: 12.5px; font-weight: 800; color: #8a6128; letter-spacing: .5px; margin: 0 0 8px; }
.ewb-btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ewb-btn { padding: 7px 14px; border-radius: 8px; border: 1px solid #d9c7a7; background: #fff; color: #765525; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ewb-btn:hover { border-color: #9a6f2e; color: #9a6f2e; }
.ewb-btn.primary { background: linear-gradient(135deg, #9a6f2e, #7c5722); color: #fff; border-color: transparent; }
.ewb-btn.danger { background: linear-gradient(135deg, #ff6b6b, #ee5a24); color: #fff; border-color: transparent; }
.ewb-btn:disabled { opacity: .55; cursor: not-allowed; }
.ewb-inline-input { border: 2px solid #e7dcc6; border-radius: 8px; padding: 6px 10px; font-size: 13px; }

/* 确认记录（确认人与时间） */
.ewb-confirm-log { font-size: 11.5px; color: #8a7559; line-height: 1.8; }
.ewb-confirm-log b { color: #4d6b43; }

/* ---------- 左图右卡核验布局 ---------- */

.ewb-split { display: grid; grid-template-columns: minmax(260px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.ewb-preview-pane { position: sticky; top: 16px; border: 1px solid #e7dcc6; border-radius: 12px; background: #f7f2e8; padding: 12px; }
.ewb-preview-pane img { width: 100%; border-radius: 8px; border: 1px solid #dfcfb2; background: #fff; display: block; }
.ewb-preview-empty { color: #a8957a; font-size: 12.5px; text-align: center; padding: 40px 8px; line-height: 1.8; }
.ewb-page-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ewb-page-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid #d9c7a7; border-radius: 999px; background: #fff; padding: 3px 10px; font-size: 11.5px; color: #6f5b40; cursor: pointer; }
.ewb-page-chip.active { background: #7c5722; color: #fff; border-color: transparent; }
.ewb-page-chip .ewb-rot-tag { color: #b4551e; font-weight: 800; }
.ewb-page-chip.active .ewb-rot-tag { color: #ffe1c2; }

/* 待组页池 */
.ewb-pool { border: 1px dashed #cfa453; border-radius: 10px; padding: 10px 12px; background: #fffaf0; }
.ewb-pool-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #d9c7a7; border-radius: 8px; background: #fff; padding: 4px 9px; margin: 0 6px 6px 0; font-size: 12px; color: #5a4d3a; cursor: pointer; user-select: none; }
.ewb-pool-chip.picked { border-color: #9a6f2e; background: #f6ead2; color: #7c5722; font-weight: 700; }

/* ---------- 疑读列表（minor/critical 分色） ---------- */

.ewb-doubts { border: 1px solid #e7dcc6; border-radius: 10px; overflow: hidden; }
.ewb-doubt { display: flex; align-items: baseline; gap: 8px; padding: 7px 12px; font-size: 12.5px; line-height: 1.7; background: #fffdf8; }
.ewb-doubt + .ewb-doubt { border-top: 1px solid #f0e6d2; }
.ewb-doubt-minor { background: #fffaf0; }
.ewb-doubt-minor .ewb-doubt-impact { color: #b45309; font-weight: 800; flex-shrink: 0; }
.ewb-doubt-critical { background: #fef2f2; }
.ewb-doubt-critical .ewb-doubt-impact { color: #b91c1c; font-weight: 800; flex-shrink: 0; }
.ewb-doubt-warning { color: #b91c1c; font-weight: 700; }
.ewb-doubt-empty { padding: 8px 12px; font-size: 12px; color: #8a7559; }

/* ---------- 转写与事实卡 ---------- */

.ewb-transcript { white-space: pre-wrap; font-size: 13px; line-height: 1.9; color: #3d3428; background: #fff; border: 1px solid #e7dcc6; border-radius: 10px; padding: 12px 14px; max-height: 300px; overflow-y: auto; }
.ewb-fact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.ewb-fact-cell { border: 1px solid #e7dcc6; border-radius: 8px; padding: 8px 10px; background: #fff; font-size: 12px; color: #4a3f30; line-height: 1.7; }
.ewb-fact-cell b { display: block; color: #7c5722; margin-bottom: 3px; }

/* ---------- 报告预览（同页容器，缩放显示 A4 双页） ---------- */

.ewb-report-preview { background: #e8ebf1; border-radius: 12px; padding: 12px; max-height: 720px; overflow: auto; }
.ewb-report-preview .report-page { transform-origin: top center; transform: scale(.62); margin-bottom: -180px; }
@media (min-width: 1100px) {
  .ewb-report-preview .report-page { transform: scale(.8); margin-bottom: -80px; }
}

/* ---------- 批次列表 ---------- */

.ewb-batch-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid #e7dcc6; border-radius: 10px; padding: 10px 14px; background: #fff; cursor: pointer; }
.ewb-batch-item + .ewb-batch-item { margin-top: 8px; }
.ewb-batch-item:hover { border-color: #9a6f2e; }
.ewb-batch-item .ewb-batch-title { font-weight: 700; color: #493b2b; font-size: 14px; }
.ewb-batch-item .ewb-batch-meta { font-size: 12px; color: #8a7559; }

/* ---------- 响应式（工作台窄屏单列） ---------- */

@media (max-width: 900px) {
  .ewb-split { grid-template-columns: 1fr; }
  .ewb-preview-pane { position: static; }
  .ewb-config-grid { grid-template-columns: 1fr; }
  .ewb-fact-grid { grid-template-columns: 1fr; }
  .ewb-report-preview .report-page { transform: none; margin-bottom: 10px; }
}

/* ---------- 五步向导 ---------- */
.ewb-steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 16px; padding: 10px 12px; background: #faf6ef; border: 1px solid #eadfc8; border-radius: 10px; }
.ewb-step { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #8a7559; cursor: pointer; user-select: none; }
.ewb-step + .ewb-step::before { content: '›'; margin-right: 4px; color: #c9b998; }
.ewb-step .ewb-step-no { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #e8dcc2; color: #6b5322; font-size: 12px; }
.ewb-step.active { color: #7c5722; background: #fff; box-shadow: inset 0 0 0 1.5px #c9a45c; }
.ewb-step.active .ewb-step-no { background: #c9a45c; color: #fff; }
.ewb-step.done { color: #4a7c48; }
.ewb-step.done .ewb-step-no { background: #5f8f56; color: #fff; }

.ewb-setup-ok { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; background: #eef6ec; color: #3f6b3d; font-weight: 600; font-size: 13px; }
.ewb-import-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: #f4efe4; }
.ewb-verify-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ewb-verify-nav { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d8c9a8; }
.ewb-work-quicklist { display: flex; flex-direction: column; gap: 4px; }
.ewb-work-quick { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.ewb-work-quick:hover { background: #faf6ef; }
.ewb-work-quick.current { background: #f4efe4; box-shadow: inset 0 0 0 1px #d8c9a8; }
.ewb-report-state { color: #8a7559; font-size: 12.5px; }
.ewb-advanced { margin-top: 10px; border: 1px dashed #d8c9a8; border-radius: 8px; padding: 8px 12px; }
.ewb-advanced summary { cursor: pointer; font-size: 13px; color: #8a6128; font-weight: 600; user-select: none; }
.ewb-advanced[open] summary { margin-bottom: 8px; }

/* 三阶段工作流：用信息层级代替成片卡片、彩色徽标和技术说明。 */
.app-shell.essay-focused { max-width: 1160px; padding: 24px; }
.essay-brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: #896436; color: #fff; font-family: "Songti SC", serif; font-size: 17px; }
.essay-brand-name { font-size: 17px; font-weight: 600; color: #4e4435; letter-spacing: .5px; }
.essay-focused .badge-blue { color: #7c756a; background: transparent; font-weight: 400; }
.essay-focused .app-header { box-shadow: none; background: transparent; border: 0; padding: 12px 0 !important; margin-bottom: 8px; }
.essay-focused .app-header .badge:not(.badge-blue),
.essay-focused .app-header .btn-buy, .essay-focused .app-header .btn-activate { display: none; }
.essay-focused .workspace-nav { display: flex; justify-content: flex-start; flex-wrap: wrap; border-bottom: 1px solid #e4ded5; padding: 0 0 12px; gap: 6px; background: none; }
.essay-focused .workspace-tab { background: none; border: 0; box-shadow: none; color: #756d61; border-radius: 6px; }
.essay-focused .workspace-tab.active { background: #eee7db; color: #6b4b22; }
.essay-focused .workspace-secondary { margin-left: auto; font-size: 12px; }
.ewb-workbench { --ewb-ink: #302e29; --ewb-muted: #7c756a; --ewb-line: #e4ded5; padding: 16px 0 32px; color: var(--ewb-ink); }
.ewb-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 22px; }
.ewb-topbar h2 { font-family: "Songti SC", "STSong", serif; font-size: 26px; font-weight: 600; letter-spacing: -.5px; margin: 0 0 7px; }
.ewb-topbar .ewb-sub { margin: 0; font-size: 13px; color: var(--ewb-muted); }
.ewb-settings-toggle { display: inline-flex; align-items: center; gap: 10px; background: transparent; }
.ewb-settings-toggle span { font-weight: 400; color: var(--ewb-muted); font-size: 11px; }
.ewb-connection-dot::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #54764d; margin-right: 4px; vertical-align: middle; }
.ewb-workbench .ewb-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 0; margin: 0 0 24px; background: transparent; border: 0; border-bottom: 1px solid var(--ewb-line); border-radius: 0; }
.ewb-workbench .ewb-step { justify-content: flex-start; gap: 9px; padding: 12px 0 16px; background: transparent; border: 0; border-radius: 0; box-shadow: none; position: relative; font-weight: 500; }
.ewb-workbench .ewb-step + .ewb-step::before { display: none; }
.ewb-workbench .ewb-step.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 2px; background: #896436; }
.ewb-workbench .ewb-step.active .ewb-step-no { background: #896436; }
.ewb-workbench .ewb-step.done { color: #71644f; }
.ewb-workbench .ewb-step.done .ewb-step-no { color: #71644f; background: #ece6db; }
.ewb-workbench .ewb-card, .ewb-workbench .ewb-work-card { border: 1px solid var(--ewb-line); border-radius: 10px; padding: 22px; background: #fffefa; box-shadow: none; margin-bottom: 16px; }
.ewb-workbench .ewb-card h3 { font-family: inherit; font-size: 16px; font-weight: 600; color: var(--ewb-ink); }
.ewb-workbench .ewb-sub { color: var(--ewb-muted); margin-bottom: 18px; line-height: 1.7; }
.ewb-workbench .ewb-btn { padding: 8px 13px; border-color: #ddd4c6; color: #6c573a; background: transparent; transition: background .15s, border-color .15s; }
.ewb-workbench .ewb-btn.primary { background: #896436; border-color: #896436; color: #fff; }
.ewb-workbench .ewb-btn.danger { color: #a44735; background: #fbf0eb; border-color: #ebcec3; }
.ewb-workbench .ewb-btn:hover:not(:disabled) { background: #f2ebdf; }
.ewb-workbench .ewb-btn.primary:hover:not(:disabled) { background: #72522c; }
.ewb-workbench button:focus-visible, .ewb-workbench input:focus-visible, .ewb-workbench select:focus-visible, .ewb-workbench textarea:focus-visible { outline: 2px solid #896436; outline-offset: 3px; }
.ewb-workbench .ewb-status { font-weight: 500; padding: 3px 7px; border-radius: 4px; font-size: 11px; background: #eee9df; color: #71644f; }
.ewb-workbench .ewb-status-finalized { background: #ecf0e8; color: #526747; }
.ewb-workbench .ewb-status-invalid { background: #faede6; color: #a44735; }
.ewb-workbench .ewb-config-grid { grid-template-columns: 1fr; max-width: 680px; }
.ewb-workbench .ewb-config-col { border: 0; background: transparent; padding: 0; }
.ewb-settings .ewb-config-col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
.ewb-settings .ewb-config-col > .ewb-model-meta, .ewb-settings .ewb-config-col > .ewb-btn-row { grid-column: 1 / -1; }
.ewb-workbench .ewb-model-meta { background: transparent; border: 0; padding: 3px 0; }
.ewb-workbench .ewb-advanced { border: 0; border-top: 1px solid var(--ewb-line); border-radius: 0; padding: 14px 0 4px; }
.ewb-workbench .ewb-advanced summary { color: var(--ewb-muted); font-size: 12px; font-weight: 500; }
.ewb-workbench .ewb-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; }
.ewb-workbench .ewb-preview-pane { background: #efede6; border: 0; padding: 14px; border-radius: 10px; }
.ewb-workbench .ewb-block { border-top: 1px solid var(--ewb-line); margin-top: 18px; padding-top: 16px; }
.ewb-workbench .ewb-block-title { font-size: 13px; letter-spacing: 0; color: #555044; font-weight: 600; }
.ewb-workbench .ewb-fact-grid { grid-template-columns: 1fr; gap: 0; }
.ewb-workbench .ewb-fact-cell { border: 0; border-left: 2px solid #e7dfd0; border-radius: 0; padding: 3px 12px; margin: 6px 0; background: transparent; }
.ewb-workbench .ewb-doubts:has(.ewb-doubt-empty) { display: none; }
.ewb-workbench .ewb-confirm-log { color: #8e897e; font-size: 10.5px; }
.ewb-workbench .ewb-work-quick { padding: 12px 0; border-bottom: 1px solid var(--ewb-line); border-radius: 0; gap: 10px; flex-wrap: wrap; }
.ewb-workbench .ewb-work-quick:last-child { border-bottom: 0; }
.ewb-workbench .ewb-work-quick:hover { background: transparent; }
.ewb-workbench .ewb-progress { height: 3px; }
.ewb-workbench .ewb-progress-fill { background: #896436; }
.ewb-text-button { background: transparent; border: 0; padding: 5px 0; cursor: pointer; font-size: 12px; color: #896436; text-decoration: underline; text-underline-offset: 3px; }
.ewb-inline-notice, .ewb-error { font-size: 12px; line-height: 1.7; padding: 10px 14px; background: #f4eee2; border-radius: 6px; margin: 12px 0; }
.ewb-inline-notice .ewb-text-button, .ewb-error .ewb-text-button { margin-left: 12px; }
.ewb-error { background: #faeee7; color: #974832; }
.ewb-welcome { min-height: 240px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
@media (max-width: 900px) {
  .ewb-workbench .ewb-split { grid-template-columns: 1fr; }
  .ewb-workbench .ewb-preview-pane { position: static; }
}
@media (max-width: 640px) {
  .app-shell.essay-focused { padding: 16px; }
  .ewb-topbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .ewb-topbar h2 { font-size: 23px; }
  .ewb-topbar .ewb-row { width: 100%; justify-content: space-between; }
  .ewb-workbench .ewb-card, .ewb-workbench .ewb-work-card { padding: 16px; }
  .ewb-workbench .ewb-step { font-size: 12px; gap: 6px; }
  .ewb-workbench .ewb-step-no { width: 18px; height: 18px; font-size: 10px; }
  .ewb-workbench .ewb-settings .ewb-config-col { grid-template-columns: 1fr; }
  .ewb-workbench .ewb-inline-input { min-width: 0 !important; max-width: 100%; width: 100%; }
  .ewb-workbench .ewb-verify-nav { justify-content: flex-start; flex-wrap: wrap; }
  .essay-focused .workspace-tab { padding: 7px 9px; font-size: 12px; }
  .essay-focused .workspace-secondary { margin-left: 0; }
  .ewb-workbench .ewb-work-quick > span:first-child { width: 100%; }
}
/* 文字稿没有扫描原图，直接显示单栏核对区。 */
.essay-focused .ewb-split.ewb-text-only { display:block; max-width:780px; margin-inline:auto; }
.essay-focused .ewb-processing { position:sticky; top:12px; z-index:5; background:#fff9ec; box-shadow:0 2px 8px #0001; }
