/* ============ 基础 ============ */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-2: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --accent: #ea580c;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ============ 按钮 ============ */
.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  transition: all .15s;
}
.btn:hover { border-color: #cbd5e1; background: #f9fafb; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { filter: brightness(.92); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: #f3f4f6; color: var(--text); }
.btn.mini { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 50%, #7c3aed 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px; width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab { flex: 1; padding: 9px; border: 1px solid var(--border); background: #f9fafb; border-radius: 8px; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  background: #fff; color: var(--text-1);
}
.field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.field label .hint { font-size: 11px; color: var(--text-3, #9ca3af); font-weight: normal; }
.btn-block { margin-top: 8px; padding: 11px; font-size: 15px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; min-height: 18px; }

/* ============ 顶栏 ============ */
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-left .logo { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 13px; color: var(--text-2); padding: 4px 10px; background: #f3f4f6; border-radius: 20px; }

/* ============ 布局 ============ */
.layout { display: flex; height: calc(100vh - 56px); }
.sidebar {
  width: 260px; background: #fff; border-right: 1px solid var(--border);
  overflow-y: auto; padding: 14px; flex-shrink: 0;
}
.sidebar-section { margin-bottom: 18px; }
.sidebar-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px;
}
.book-list, .team-list { display: flex; flex-direction: column; gap: 4px; }
.book-item, .team-item {
  padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px;
  border: 1px solid transparent; transition: all .12s;
}
.book-item:hover, .team-item:hover { background: #f3f4f6; }
.book-item.active { background: #eef2ff; border-color: #c7d2fe; }
.book-item .book-item-title { font-weight: 500; }
.book-item .book-item-meta { font-size: 11px; color: var(--text-2); }
.book-item .tag-team { background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 4px; font-size: 10px; margin-left: 4px; }

.main { flex: 1; overflow-y: auto; padding: 20px; }
.empty-state { text-align: center; padding: 100px 0; color: var(--text-2); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-sub { font-size: 13px; margin-top: 6px; }

/* ============ 作品头部 ============ */
.book-header {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.book-title-row { display: flex; align-items: center; gap: 10px; }
.book-title-input {
  font-size: 18px; font-weight: 700; border: 1px solid transparent; border-radius: 6px; padding: 4px 8px;
  background: transparent; color: var(--text);
}
.book-title-input:hover, .book-title-input:focus { border-color: var(--border); background: #fff; outline: none; }
.book-status { font-size: 12px; padding: 3px 10px; border-radius: 20px; background: #eef2ff; color: var(--primary); }
.book-meta { font-size: 12px; color: var(--text-2); margin-top: 4px; display: flex; gap: 16px; flex-wrap: wrap; }
.readonly-tag { color: var(--amber); }
.book-header-actions { display: flex; align-items: center; gap: 10px; }
.policy-label { font-size: 12px; color: var(--text-2); }
.policy-input { width: 52px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; text-align: center; }

/* ============ 步骤条 ============ */
.stepper {
  display: flex; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 14px;
}
.step {
  flex: 1; text-align: center; padding: 12px; font-size: 14px; color: var(--text-2);
  cursor: pointer; border-right: 1px solid var(--border); position: relative; transition: all .15s;
}
.step:last-child { border-right: none; }
.step:hover { background: #f9fafb; }
.step.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.step.done { color: var(--green); }

/* ============ 面板 ============ */
.panel {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-head h3 { font-size: 15px; }
.panel-head > div { display: flex; gap: 8px; align-items: center; }
.panel-tip { font-size: 12px; color: var(--amber); background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.panel-actions { display: flex; gap: 8px; margin-bottom: 12px; }

/* ============ 标签池 ============ */
.tag-pool { margin-bottom: 12px; }
.tag-cat { margin-bottom: 10px; }
.tag-cat-label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 20px; font-size: 12px;
  cursor: pointer; background: #fff; transition: all .12s; user-select: none;
}
.tag-chip:hover { border-color: #c7d2fe; }
.tag-chip.on { background: #eef2ff; border-color: var(--primary); color: var(--primary); }
.tag-chip.locked { background: #f3f4f6; }

.draw-result { margin-top: 12px; padding: 14px; background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px; }
.draw-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.draw-tag { padding: 5px 12px; border-radius: 20px; font-size: 13px; }
.draw-tag.genre { background: var(--primary); color: #fff; font-weight: 600; }
.draw-tag.other { background: #eef2ff; color: var(--primary); border: 1px solid #c7d2fe; }

/* ============ 选题结果 ============ */
.premise-result { margin-top: 14px; }
.result-card { border: 1px solid var(--border); border-radius: 8px; padding: 16px; background: #fafafa; }
.result-card h4 { font-size: 16px; margin-bottom: 4px; }
.result-card .one-liner { color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.result-card .kv { margin-bottom: 8px; font-size: 13px; }
.result-card .kv b { color: var(--text-2); margin-right: 6px; }
.result-card .kv-list { display: flex; flex-wrap: wrap; gap: 6px; }
.result-card .kv-list span { background: #f3f4f6; padding: 3px 10px; border-radius: 6px; font-size: 12px; }
.demo-badge { display: inline-block; background: #fef3c7; color: #92400e; font-size: 11px; padding: 2px 8px; border-radius: 4px; margin-left: 8px; }

/* ============ 编辑器 ============ */
.editor-wrap { position: relative; }
.editor {
  width: 100%; min-height: 320px; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; font-size: 14px; line-height: 1.8; resize: vertical; color: var(--text);
}
.chapter-editor { min-height: 460px; }
.editor:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.selection-bar {
  position: absolute; top: 8px; right: 8px; background: #1f2937; color: #fff;
  border-radius: 8px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 5;
}
.selection-bar .btn.mini.primary { background: #fff; color: var(--primary); border-color: #fff; }

/* ============ 分章结果 ============ */
.split-result { margin-top: 14px; }
.split-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 10px; }
.split-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fafafa; }
.split-card .sc-no { font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.split-card .sc-title { font-weight: 600; margin-bottom: 6px; }
.split-card .sc-summary { font-size: 12px; color: var(--text-2); }
.split-card .sc-hook { font-size: 12px; color: var(--accent); margin-top: 6px; }

/* ============ 正文布局 ============ */
.writing-layout { display: flex; gap: 12px; align-items: flex-start; }
.chapter-list-col { width: 170px; flex-shrink: 0; }
.chapter-editor-col { flex: 1; min-width: 0; }
.memory-col { width: 250px; flex-shrink: 0; }
.col-head { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.chapter-list { display: flex; flex-direction: column; gap: 4px; max-height: 560px; overflow-y: auto; }
.chapter-item {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
  font-size: 12px; display: flex; align-items: center; gap: 6px; transition: all .12s; background: #fff;
}
.chapter-item:hover { border-color: #c7d2fe; }
.chapter-item.active { background: #eef2ff; border-color: var(--primary); }
.chapter-item .dot { width: 7px; height: 7px; border-radius: 50%; background: #d1d5db; flex-shrink: 0; }
.chapter-item .dot.written { background: var(--green); }
.chapter-item .dot.draft { background: var(--amber); }
.chapter-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.chapter-no { font-weight: 700; font-size: 15px; }
.chapter-actions { display: flex; gap: 6px; }
.review-hint { margin-top: 8px; font-size: 12px; color: var(--text-2); }
.split-meta-box {
  border: 1px solid #fde68a; background: #fffbeb; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px;
}
.split-meta-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.split-meta-head > span { font-size: 13px; font-weight: 600; color: #92400e; }
.split-meta-head > div { display: flex; gap: 6px; }
.split-editor { min-height: 130px; background: #fff; }

/* ============ 记忆库 ============ */
.memory-add { display: flex; gap: 5px; margin-bottom: 8px; }
.memory-add select, .memory-add input {
  padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px;
}
.memory-add input { flex: 1; min-width: 0; }
.memory-list { display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow-y: auto; }
.memory-item { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: #fff; }
.memory-item .m-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.memory-item .m-type {
  font-size: 10px; padding: 1px 6px; border-radius: 4px; color: #fff;
}
.m-type.character { background: #7c3aed; }
.m-type.setting { background: #0ea5e9; }
.m-type.plot { background: #16a34a; }
.m-type.foreshadow { background: #ea580c; }
.memory-item .m-key { font-weight: 600; font-size: 12px; }
.memory-item .m-status { font-size: 10px; color: var(--text-2); margin-left: auto; }
.memory-item .m-status.resolved { color: var(--green); }
.memory-item .m-content { font-size: 12px; color: var(--text-2); }
.memory-item .m-actions { margin-top: 4px; display: flex; gap: 4px; }

/* ============ 诊断报告 ============ */
.review-report { margin-top: 12px; }
.review-summary {
  background: #f8fafc; border-left: 3px solid var(--primary); padding: 10px 14px; border-radius: 6px;
  margin-bottom: 10px; font-size: 13px;
}
.issue-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.issue-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.priority { font-size: 11px; padding: 1px 8px; border-radius: 4px; color: #fff; font-weight: 600; }
.priority.P0 { background: var(--red); }
.priority.P1 { background: var(--amber); }
.priority.P2 { background: #6b7280; }
.issue-category { font-size: 12px; color: var(--text-2); }
.issue-location { font-size: 12px; color: var(--text-2); }
.issue-problem { font-size: 13px; margin: 4px 0; }
.issue-suggestion { font-size: 12px; color: var(--green); background: #f0fdf4; padding: 6px 10px; border-radius: 6px; margin-top: 6px; }
.issue-fix { margin-top: 6px; text-align: right; }
.review-strength { font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 520px; max-width: 100%; max-height: 85vh;
  overflow-y: auto; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.modal h3 { margin-bottom: 16px; font-size: 16px; }
.modal .field { margin-bottom: 12px; }
.modal textarea { width: 100%; min-height: 90px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 13px; }
.modal textarea:focus { outline: none; border-color: var(--primary); }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-wide { width: 720px; }

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ============ 加载 ============ */
.loading { opacity: .6; pointer-events: none; }
.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid #cbd5e1; border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 团队列表 */
.team-item .team-name { font-weight: 500; }
.team-item .team-role { font-size: 11px; color: var(--text-2); }
.team-item .team-role.owner { color: var(--accent); }
.member-list { margin-top: 10px; }
.member-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.member-row .role-tag { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: #f3f4f6; }
.member-row .role-tag.owner { background: #fef3c7; color: #92400e; }
.invite-box { background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.invite-code { font-size: 20px; font-weight: 700; letter-spacing: 3px; color: var(--primary); }

/* ============ 写作风格 ============ */
.style-box { background: #f8f7ff; border: 1px solid #e4e0fb; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.style-box-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.style-box-title { font-weight: 600; font-size: 14px; }
.style-box-title .hint { font-size: 11px; color: var(--text-3, #9ca3af); font-weight: normal; }
.style-box-actions { display: flex; gap: 6px; }
.style-current { font-size: 13px; color: var(--text-2); }
.style-current.on { color: var(--primary); font-weight: 500; }
.style-tabs { margin-bottom: 10px; }
.style-search { margin-bottom: 10px; }
.style-search input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.style-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.style-pane { max-height: 420px; overflow-y: auto; }
.style-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: pointer; transition: all .12s; }
.style-item:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(79,70,229,.1); }
.style-item-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.style-platform { font-size: 11px; color: var(--accent); font-weight: normal; margin-left: 6px; }
.style-item-desc { font-size: 12px; color: var(--text-2); margin-bottom: 6px; line-height: 1.5; }
.style-item-tags span { display: inline-block; font-size: 11px; background: #eef2ff; color: var(--primary); border-radius: 4px; padding: 2px 7px; margin-right: 4px; margin-bottom: 2px; }
.file-input { display: block; width: 100%; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; font-size: 13px; margin-top: 10px; background: #fff; }

/* ============ 模型选择器 ============ */
.model-select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  background: #fff; color: var(--text); max-width: 180px;
}
.model-select:focus { outline: none; border-color: var(--primary); }

/* ============ 危险按钮 ============ */
.btn.danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn.danger:hover { background: #fef2f2; border-color: #fca5a5; }

/* ============ 封面 ============ */
.book-header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.book-cover {
  width: 74px; height: 98px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
  border: 1px solid var(--border); background: #f3f4f6; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.book-cover svg { width: 100%; height: 100%; display: block; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover-placeholder { font-size: 30px; color: #cbd5e1; }
.cover-preview { width: 240px; height: 320px; margin: 0 auto 14px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); background: #f3f4f6; display: flex; align-items: center; justify-content: center; }
.cover-preview svg, .cover-preview img { width: 100%; height: 100%; display: block; }

/* ============ 版本管理 ============ */
.version-bar { margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fafafa; }
.version-bar-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.version-tag { font-size: 11px; padding: 1px 8px; border-radius: 4px; background: #eef2ff; color: var(--primary); }
.version-tag.active { background: var(--primary); color: #fff; }
.version-list { display: flex; flex-wrap: wrap; gap: 6px; }
.version-pill { font-size: 12px; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.version-pill.active { border-color: var(--primary); background: #eef2ff; color: var(--primary); font-weight: 600; }
.version-pill:hover { border-color: var(--primary); }
.version-compare {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px;
}
.version-compare .vc-pane { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.version-compare .vc-head { font-size: 12px; font-weight: 600; padding: 6px 10px; background: #f3f4f6; display: flex; justify-content: space-between; }
.version-compare .vc-body { padding: 10px; font-size: 12px; max-height: 320px; overflow-y: auto; white-space: pre-wrap; line-height: 1.6; background: #fff; }

/* ============ 章节多选删除 ============ */
.chapter-select-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.mini-check { font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 3px; cursor: pointer; }
.chapter-item .ch-check { flex-shrink: 0; }

/* ============ 打分 ============ */
.score-total { text-align: center; padding: 14px; }
.score-num { font-size: 44px; font-weight: 800; color: var(--primary); }
.score-stars { color: #f59e0b; font-size: 16px; }
.score-dim { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.score-dim-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.score-dim-label { font-weight: 600; font-size: 13px; }
.score-dim-num { font-weight: 700; color: var(--primary); margin-left: auto; }
.score-bar { height: 6px; background: #f3f4f6; border-radius: 3px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #4f46e5, #7c3aed); }
.score-dim-reason { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* ============ 管理后台 / 回收站 ============ */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-2); font-weight: 600; font-size: 12px; }
.admin-table tr:hover td { background: #f9fafb; }
.trash-badge { font-size: 11px; padding: 1px 8px; border-radius: 4px; background: #fef3c7; color: #92400e; }
.modal-lg { width: 900px; }
.modal-xl { width: 1100px; }

/* ============ 编辑器增强 / 预览 ============ */
.editor-status { font-size: 12px; color: var(--text-2); padding: 2px 4px; text-align: right; min-height: 18px; }
.preview-body { background: #f9fafb; border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 420px; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.7; margin-bottom: 12px; word-break: break-word; }

/* ============ 章节搜索 ============ */
.chapter-search { margin-bottom: 8px; }
.chapter-search input { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* ============ 自定义标签 / 一句话选题（高级卡片式） ============ */
.custom-box {
  margin-top: 12px; padding: 16px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f6ff 100%);
  border: 1px solid #e7e2fb; border-radius: 14px;
  box-shadow: 0 4px 18px rgba(99, 82, 232, 0.06);
  position: relative; overflow: hidden;
}
.custom-box::before {
  content: ''; position: absolute; top: -46px; right: -46px;
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 102, 255, 0.13), transparent 70%);
  pointer-events: none;
}
.cb-title { font-weight: 700; font-size: 14px; color: #4b5563; margin-bottom: 12px; }
.cb-title .hint { font-size: 11px; color: #9ca3af; font-weight: normal; }
.cb-field { margin-bottom: 12px; }
.cb-field label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 6px; font-weight: 600; }
.cb-input-row { display: flex; gap: 8px; align-items: stretch; }
.cb-input-row input, .cb-input-row textarea {
  flex: 1; padding: 9px 12px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  font-size: 13px; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.cb-input-row input:focus, .cb-input-row textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 82, 232, 0.12);
}
.cb-input-row textarea { resize: vertical; min-height: 40px; line-height: 1.6; }
.cb-input-row .btn { align-self: stretch; white-space: nowrap; border-radius: 10px; }
.cb-divider { height: 1px; background: linear-gradient(90deg, transparent, #e5e7eb, transparent); margin: 12px 0; }
.custom-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag-x { font-style: normal; margin-left: 6px; cursor: pointer; color: #9ca3af; font-size: 12px; padding: 0 2px; transition: color .15s; }
.tag-x:hover { color: #ef4444; }
.draw-tag { display: inline-flex; align-items: center; }

/* ============ 选题数量滑块（齿轮质感） ============ */
.premise-count { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 20px; background: #fff; }
.pc-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.pc-val { min-width: 18px; text-align: center; font-size: 14px; font-weight: 700; color: var(--primary); }
#premise-count {
  -webkit-appearance: none; appearance: none; width: 92px; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary) var(--p, 100%), #e5e7eb var(--p, 100%));
  outline: none; cursor: pointer;
}
#premise-count::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); cursor: grab; transition: transform .1s;
}
#premise-count::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
#premise-count::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); cursor: grab;
}
body[data-theme="dark"] .custom-box { background: linear-gradient(135deg, #1e293b 0%, #1c2140 100%); border-color: #334155; }
body[data-theme="dark"] .cb-title { color: #cbd5e1; }
body[data-theme="dark"] .cb-field label { color: #94a3b8; }
body[data-theme="dark"] .cb-input-row input, body[data-theme="dark"] .cb-input-row textarea { background: #0f172a; color: #e2e8f0; border-color: #334155; }
body[data-theme="dark"] .premise-count { background: #1e293b; }
body[data-theme="dark"] #premise-count { background: linear-gradient(90deg, var(--primary) var(--p, 100%), #334155 var(--p, 100%)); }

/* ============ 多色主题背景（data-theme 切换） ============ */
body[data-theme="paper"] { --bg: #f7f1e1; --panel: #fffdf5; --border: #e8dfc8; }
body[data-theme="dark"] { --bg: #0f172a; --panel: #1e293b; --border: #334155; --text: #e2e8f0; --text-2: #94a3b8; }
body[data-theme="mist"] { --bg: #eef2f7; --panel: #f8fafc; --border: #dbe4ef; }
body[data-theme="green"] { --bg: #eef4ef; --panel: #f7fbf8; --border: #d6e6da; }
body[data-theme="pink"] { --bg: #faf0f4; --panel: #fffafc; --border: #f0dbe3; }
body[data-theme="dark"] .btn { background: #1e293b; color: #e2e8f0; border-color: #334155; }
body[data-theme="dark"] .btn:hover { background: #273449; }
body[data-theme="dark"] textarea, body[data-theme="dark"] input, body[data-theme="dark"] select {
  background: #0f172a; color: #e2e8f0; border-color: #334155;
}
body[data-theme="dark"] .result-card, body[data-theme="dark"] .custom-box,
body[data-theme="dark"] .premise-card, body[data-theme="dark"] .preview-body { background: #1e293b; }
body[data-theme="dark"] .result-card .kv-list span, body[data-theme="dark"] .tag-mini { background: #334155; }

/* ============ 候选选题卡片 ============ */
.premise-candidates { display: grid; grid-template-columns: 1fr; gap: 12px; }
.premise-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: #fafafa; transition: all .15s; }
.premise-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.premise-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.premise-card-no { background: var(--primary); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.premise-card-title { font-size: 16px; font-weight: 700; }
.premise-card-line { color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.premise-card-kv { font-size: 13px; margin-bottom: 6px; }
.premise-card-kv b { color: var(--text-2); margin-right: 6px; }
.premise-card-sells { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag-mini { background: #f3f4f6; padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.premise-card-actions { display: flex; gap: 8px; margin-top: 8px; }
.premise-card-detail { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }

/* ============ 可编辑选题表单 ============ */
.premise-editor { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: #fafafa; }
.premise-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.premise-editor-head h4 { font-size: 16px; }
.premise-editor .field { margin-bottom: 10px; }
.premise-editor .field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.premise-editor .field input, .premise-editor .field textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; color: var(--text);
}
.premise-editor .field textarea { resize: vertical; line-height: 1.6; }
body[data-theme="dark"] .premise-editor { background: #1e293b; }
body[data-theme="dark"] .premise-editor .field input, body[data-theme="dark"] .premise-editor .field textarea { background: #0f172a; color: #e2e8f0; }

/* ============ 全文判断报告 ============ */
.judge-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 12px; font-size: 12px; }
.judge-stats span { background: #f3f4f6; padding: 4px 10px; border-radius: 6px; }
.judge-stats b { font-size: 14px; }
.judge-stats .p0 { color: var(--red); }
.judge-stats .p1 { color: var(--amber); }
.judge-stats .p2 { color: #6b7280; }
.issue-location-detail { font-size: 12px; color: var(--text-2); margin: 2px 0 4px; }
body[data-theme="dark"] .judge-stats span { background: #334155; }

/* ============ 顶栏主题选择器 ============ */
#theme-select.model-select { width: auto; min-width: 96px; }

/* ============ 连续写作进度条 ============ */
.aw-progress { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.aw-bar { height: 10px; background: #e5e7eb; border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.aw-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 6px; transition: width .3s; }
body[data-theme="dark"] .aw-bar { background: #334155; }
.btn.warning { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.warning:hover { background: #b45309; }

/* ============ 分章结果可编辑 ============ */
.split-head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.split-card .sc-actions { margin-top: 8px; }
