@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&family=Newsreader:opsz,wght@6..72,500;6..72,600&display=swap');

:root { color-scheme: light; --ink:#182027; --ink-soft:#52606a; --paper:#f5f4ef; --panel:#fffefa; --rail:#efeee7; --line:#d9ddd8; --line-strong:#b9c2bc; --accent:#d85d47; --accent-deep:#a64232; --blue:#52758d; --green:#2f775d; --pending:#e0862b; --warn:#a76a27; --danger:#cf4436; --danger-soft:rgba(207,68,54,.14); --shadow:0 12px 30px rgba(27,35,31,.08); --radius:14px; --topbar:68px; --panel-control-h:38px; font-family:Manrope,system-ui,sans-serif; }
* { box-sizing:border-box; }
/* 关键修复：hidden 属性必须始终生效，避免被组件的 display 规则覆盖
   （曾导致 #expand-left/#expand-right 常显、#welcome-card/#model-notice 无法隐藏） */
[hidden] { display:none !important; }
html { background:var(--paper); scroll-behavior:smooth; }
body { margin:0; min-width:320px; background:var(--paper); color:var(--ink); font-size:14px; line-height:1.55; }
button,input,textarea,select { font:inherit; }
button { cursor:pointer; }
button:disabled { cursor:not-allowed; opacity:.48; }
button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.skip-link { position:fixed; top:8px; left:8px; z-index:20; padding:8px 12px; color:white; background:var(--ink); border-radius:6px; transform:translateY(-150%); transition:transform .18s ease; }
.skip-link:focus { transform:none; }
.app-shell { min-height:100vh; }
.topbar { height:var(--topbar); display:flex; align-items:center; gap:28px; padding:0 28px; border-bottom:1px solid var(--line); background:rgba(255,254,250,.92); backdrop-filter:blur(18px); position:sticky; top:0; z-index:10; }
.brand-lockup { display:flex; align-items:center; gap:10px; min-width:178px; }
.brand-mark { width:34px; height:34px; display:block; color:var(--accent); line-height:0; }
.brand-mark svg { display:block; width:100%; height:100%; }
.brand-lockup strong,.brand-lockup span { display:block; }
.brand-lockup strong { font-size:14px; letter-spacing:.02em; }
.brand-lockup div span { color:var(--ink-soft); font-size:11px; }
.top-actions { display:flex; align-items:center; gap:10px; margin-left:auto; }
.connection-status { display:flex; align-items:center; gap:7px; padding:6px 10px; border:1px solid var(--line); border-radius:999px; color:var(--ink-soft); font-size:11px; white-space:nowrap; }
.connection-status i { width:7px; height:7px; border-radius:50%; background:var(--warn); box-shadow:0 0 0 3px rgba(167,106,39,.12); }
.connection-status.online i { background:var(--green); box-shadow:0 0 0 3px rgba(47,119,93,.12); }
.connection-status.offline i { background:var(--accent); box-shadow:0 0 0 3px rgba(216,93,71,.12); }
.quiet-button,.text-button,.icon-button,.outline-button,.primary-button,.send-button,.voice-button,.new-chat-button { border:0; background:none; color:inherit; transition:background .18s ease,color .18s ease,border-color .18s ease,transform .18s ease; }
.quiet-button { border:1px solid var(--line); border-radius:8px; padding:8px 12px; color:var(--ink-soft); font-size:12px; }
.quiet-button:hover,.icon-button:hover { background:#eef0ec; color:var(--ink); }
/* 注意：三栏列宽统一由下方「可拖动面板」区的 CSS 变量（--left-w/--right-w 等）定义，此处不再写死 grid-template-columns，避免面板收起时中间区无法自适应 */
.workbench-grid { display:grid; min-height:calc(100vh - var(--topbar)); max-width:1680px; margin:0 auto; }
.side-panel { background:rgba(255,254,250,.7); min-width:0; }
.context-panel { border-right:1px solid var(--line); }
.changes-panel { border-left:1px solid var(--line); }
.panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:25px 20px 18px; }
/* 无标题标题栏：仅保留操作按钮，收紧顶部留白并右对齐
   （需用双类选择器覆盖 .dialog-header / .panel-heading 的 space-between） */
.dialog-header.only-actions { justify-content:flex-end; }
.panel-heading h2,.conversation-header h1 { margin:2px 0 0; font:600 22px/1.15 Newsreader,Georgia,serif; letter-spacing:-.025em; }
.eyebrow { display:block; color:var(--accent-deep); font:500 10px/1.2 'DM Mono',monospace; letter-spacing:.12em; text-transform:uppercase; }
.panel-close { border:0; background:none; font-size:24px; color:var(--ink-soft); }
code { font:400 10px/1.2 'DM Mono',monospace; color:#e9b0a4; }
.outline-button,.primary-button { padding:9px 13px; border-radius:8px; font-size:12px; font-weight:700; }
.outline-button { border:1px solid var(--line-strong); color:var(--ink-soft); background:transparent; }
.outline-button:hover { border-color:var(--ink); color:var(--ink); background:#f1f2ee; }
.primary-button { background:var(--accent); color:#fff; }
.primary-button:hover,.send-button:hover { background:var(--accent-deep); transform:translateY(-1px); }
.context-section { padding:0 20px 20px; }
.helper { margin:5px 0 11px; color:var(--ink-soft); font-size:11px; line-height:1.5; }
.text-button { padding:3px 0; color:var(--blue); font-size:11px; font-weight:700; }
.text-button:hover { color:var(--accent-deep); }
.context-chips { display:flex; flex-wrap:wrap; gap:6px; min-height:26px; }
.context-chip { display:inline-flex; align-items:center; gap:5px; max-width:100%; padding:5px 8px; border:1px solid var(--line); border-radius:6px; background:#f9f9f4; font-size:11px; }
.context-chip button { border:0; padding:0; color:var(--ink-soft); background:none; font-size:14px; line-height:1; }
.empty-note { color:#8a9591; font-size:11px; }
.object-section { padding-bottom:16px; }
/* 对象筛选框：与 .field 一致的聚焦反馈 */
.object-filter { display:flex; align-items:center; gap:7px; margin:8px 0 0; padding:0 9px; border:1px solid var(--line); border-radius:9px; background:#fff; transition:border-color .18s ease, box-shadow .18s ease; }
.object-filter:focus-within { border-color:var(--accent); box-shadow:0 0 0 3px rgba(216,93,71,.14); }
.object-filter svg { width:14px; height:14px; flex:none; fill:none; stroke:#9aa39f; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.object-filter input { flex:1; min-width:0; padding:8px 0; border:0; background:none; color:var(--ink); font-size:12px; }
.object-filter input:focus { outline:none; }

/* 一键同意全部待确认改动：筛选框与对象列表之间的横幅（§52.2.1）。
   与左右栏待确认标记同用橙色，出现即提示「有 N 项改动待确认」。 */
.pending-banner { display:flex; align-items:center; gap:8px; margin:8px 0 0; padding:7px 9px; border:1px solid rgba(224,134,43,.45); border-radius:9px; background:rgba(224,134,43,.10); }
.pending-banner-text { flex:1; min-width:0; color:#8a5a12; font-size:11.5px; font-weight:600; line-height:1.3; }
.pending-banner-button { flex:none; padding:5px 10px; border:1px solid rgba(224,134,43,.6); border-radius:7px; background:var(--pending); color:#fffefa; font-size:11px; font-weight:700; cursor:pointer; transition:filter .15s ease; }
.pending-banner-button:hover { filter:brightness(.94); }
.pending-banner-button:focus-visible { outline:2px solid var(--ink); outline-offset:2px; }
.pending-banner-button[disabled] { opacity:.6; cursor:default; }

/* ---------- 故事对象列表：类型分组（可展开/收起 + 分类浏览入口）+ 对象行 ---------- */
.object-list { margin:10px -8px 0; display:grid; gap:8px; }
.object-group { display:grid; gap:0; border:1px solid transparent; border-radius:10px; transition:border-color .18s ease; }
.object-group:hover { border-color:var(--line); }
.object-group-head { display:flex; align-items:center; gap:4px; border-bottom:1px solid var(--line); border-radius:9px 9px 0 0; transition:border-color .18s ease; }
.object-group.collapsed .object-group-head { border-bottom-color:transparent; }
/* 分类标题：点击切换展开 / 收起 */
.object-group-toggle { flex:1; display:flex; align-items:center; gap:8px; min-width:0; padding:7px 8px; border:0; border-radius:8px; background:none; color:var(--ink); text-align:left; transition:background .16s ease; }
.object-group-toggle:hover { background:#eef0ec; }
.object-group-toggle .group-caret { width:13px; height:13px; flex:none; fill:none; stroke:#8a9591; stroke-width:2.1; stroke-linecap:round; stroke-linejoin:round; transition:transform .24s cubic-bezier(.4,0,.2,1),stroke .16s ease; }
.object-group-toggle:hover .group-caret { stroke:var(--accent); }
.object-group.collapsed .group-caret { transform:rotate(-90deg); }
.object-group-toggle strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; font-weight:800; letter-spacing:.02em; }
.object-group-toggle em { margin-left:auto; display:inline-flex; align-items:center; justify-content:center; min-width:20px; padding:1px 6px; border-radius:999px; background:#eef0ec; color:var(--ink-soft); font:600 10px 'DM Mono',monospace; font-style:normal; transition:background .16s ease; }
.object-group-toggle:hover em { background:#e3e7e1; }
/* 分类浏览入口：进入中间区的该分类专属视图 */
.object-group-browse { width:26px; height:26px; margin-right:6px; flex:none; display:grid; place-items:center; border:0; border-radius:7px; background:transparent; color:#a9b1ac; transition:background .16s ease,color .16s ease; }
.object-group-browse:hover { background:#e6e9e3; color:var(--accent-deep); }
.object-group-browse svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
/* 分组标题右侧「＋」：与浏览按钮同规格，直接在本组内新建该类型对象（§34 ①） */
.object-group-add { width:26px; height:26px; flex:none; display:grid; place-items:center; border:0; border-radius:7px; background:transparent; color:#a9b1ac; transition:background .16s ease,color .16s ease; }
.object-group-add:hover { background:#f3e7e2; color:var(--accent-deep); }
.object-group-add svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
/* 展开 / 收起动画：grid-template-rows 1fr ↔ 0fr */
/* 折叠时 0fr 只能把内容高度压到 0，压不掉「网格项自身的内边距」——内边距会让轨道的最小贡献恒为 8px，
   首个子行便从折叠区漏出约 4px（§29.1，实测 body/inner 折叠后仍为 8px）。
   故内层不再用 padding，改由首尾子项 margin 提供上下留白：折叠时轨道min=0，剪切盒归零，露出问题消失。 */
.object-group-body { display:grid; grid-template-rows:1fr; overflow:hidden; transition:grid-template-rows .26s cubic-bezier(.4,0,.2,1); }
.object-group.collapsed .object-group-body { grid-template-rows:0fr; }
.object-group-inner { min-height:0; overflow:hidden; display:grid; gap:2px; padding:0; }
.object-group-inner > :first-child { margin-top:4px; }
.object-group-inner > :last-child { margin-bottom:4px; }
.object-empty { padding:7px 9px; border-radius:8px; color:#9aa39e; font-size:11px; }
.object-row { display:flex; align-items:center; gap:2px; padding:1px; border:1px solid transparent; border-radius:9px; transition:background .16s ease,border-color .16s ease,box-shadow .16s ease; }
.object-row:hover { background:#ecefe9; }
.object-row.selected { background:#ebe9e1; border-color:var(--line); }
.object-row.pinned { box-shadow:inset 3px 0 0 var(--accent); }
/* 本轮被 Agent 直接改动、尚未确认的对象行：橙色「实-虚-实」呼吸（§52.2.2），直到作者确认或撤销。
   与右栏书签共用同一橙色与同一节奏；只呼吸高亮本身（背景 / 内嵌条），文字始终清晰。 */
.object-row.pending { animation: pending-row 1.8s ease-in-out infinite; }
@keyframes pending-row {
  0% { background:rgba(224,134,43,.22); box-shadow:inset 3px 0 0 var(--pending); }
  50% { background:rgba(224,134,43,.07); box-shadow:inset 3px 0 0 rgba(224,134,43,.40); }
  100% { background:rgba(224,134,43,.22); box-shadow:inset 3px 0 0 var(--pending); }
}
@media (prefers-reduced-motion:reduce) { .object-row.pending { animation:none; background:rgba(224,134,43,.14); box-shadow:inset 3px 0 0 var(--pending); } }
/* 行内间距：主体与右侧按钮之间 4px，按钮彼此保持 2px（§34 ②） */
.object-row .object-main + button { margin-left:2px; }
/* 主体按钮：两行文字垂直居中，与右侧 28×28 按钮中线对齐（§34 ②） */
.object-main { flex:1; min-width:0; display:flex; flex-direction:column; justify-content:center; gap:1px; padding:6px 8px; border:0; border-radius:8px; background:transparent; color:var(--ink); text-align:left; }
.object-text { display:block; min-width:0; }
.object-text strong,.object-text small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; line-height:1.35; }
.object-text strong { font-size:12px; font-weight:700; }
.object-text small { color:var(--ink-soft); font-size:10px; }
/* 类型图标：内联 SVG 语义图形，7 类各自配色 */
.object-icon { display:grid; place-items:center; width:23px; height:23px; flex:none; border-radius:7px; color:#fff; background:var(--blue); }
.object-icon svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.object-group-head .object-icon { width:20px; height:20px; border-radius:6px; }
.object-icon.chapter { background:var(--accent); }
.object-icon.character { background:#5f6f86; }
.object-icon.plotline { background:#3f6a86; }
.object-icon.world_rule { background:#3f7a68; }
.object-icon.timeline_event { background:#9a7434; }
.object-icon.foreshadowing { background:#8a6144; }
.object-icon.relationship { background:#7b5f97; }
.conversation-pane { display:flex; flex-direction:column; min-width:0; background:var(--panel); }
.conversation-header { display:flex; justify-content:space-between; align-items:flex-end; gap:20px; padding:30px 38px 10px; }
.conversation-header h1 { font-size:30px; }
.model-notice { display:flex; align-items:center; gap:10px; margin:0 38px 12px; padding:10px 12px; border:1px solid #e7c7a4; border-radius:9px; background:#fff8eb; color:#754c25; font-size:11px; }.model-notice strong { white-space:nowrap; }.model-notice span { flex:1; }.model-notice button { border:0; background:none; color:var(--accent-deep); font-weight:800; font-size:11px; }
.conversation-scroll { flex:1; min-height:300px; overflow:auto; padding:0 38px 20px; scroll-padding-bottom:20px; }
.message-list { display:grid; gap:16px; max-width:760px; margin:0 auto; }.message { max-width:78%; padding:12px 14px; border-radius:12px; font-size:13px; white-space:pre-wrap; }.message.author { justify-self:end; background:var(--ink); color:#f8f6ed; }
.message.agent { justify-self:start; border:1px solid var(--line); background:#fbfaf5; }.message small { display:block; margin-top:5px; color:#8a9591; font:10px 'DM Mono',monospace; }
.message-focus { animation: message-focus 1.8s ease; }
/* ---------- 对话 Markdown 渲染（Agent 消息） ---------- */
.md-body { white-space:normal; word-break:break-word; }
.md-body > :first-child { margin-top:0; }
.md-body > :last-child { margin-bottom:0; }
.md-body p { margin:0 0 8px; }
.md-body h1,.md-body h2,.md-body h3,.md-body h4,.md-body h5,.md-body h6 { margin:14px 0 6px; font-family:Newsreader,Georgia,serif; font-weight:600; line-height:1.3; letter-spacing:-.01em; }
.md-body h1 { font-size:1.55em; }
.md-body h2 { font-size:1.34em; }
.md-body h3 { font-size:1.16em; }
.md-body h4,.md-body h5,.md-body h6 { font-size:1.02em; }
.md-body ul,.md-body ol { margin:6px 0 8px; padding-left:22px; }
.md-body li { margin:3px 0; }
.md-body li > ul,.md-body li > ol { margin:3px 0; }
.md-body blockquote { margin:8px 0; padding:6px 12px; border-left:3px solid var(--line-strong); border-radius:0 6px 6px 0; background:#f4f4ef; color:var(--ink-soft); }
.md-body hr { margin:12px 0; border:0; border-top:1px solid var(--line); }
.md-body a { color:var(--blue); text-decoration:underline; text-underline-offset:2px; }
.md-body a:hover { color:var(--accent-deep); }
.md-body del { color:var(--ink-soft); }
.md-body code.md-inline { padding:1px 5px; border:1px solid var(--line); border-radius:5px; background:#f2f2ec; font:12px 'DM Mono',monospace; }
.md-body .md-code { margin:8px 0; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:#f6f7f2; overflow:auto; }
.md-body .md-code code { font:11px/1.6 'DM Mono',monospace; white-space:pre; }
.process-evidence { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:0 11px 11px; color:var(--ink-soft); font-size:10px; }.evidence-link { padding:5px 7px; border:1px solid var(--line-strong); border-radius:5px; background:transparent; color:var(--accent-deep); font-size:10px; cursor:pointer; }.evidence-link:hover { border-color:var(--accent); background:#fff7f1; }
.process-anchor { margin:0 11px 11px; padding:5px 7px; border:1px solid var(--line); border-radius:5px; background:#f8faf6; color:var(--blue); font-size:10px; cursor:pointer; }.process-anchor:hover { border-color:var(--blue); }
.composer { padding:16px 38px 24px; border-top:1px solid var(--line); background:#fffefa; }.composer > label { display:block; max-width:760px; margin:0 auto 7px; color:var(--ink-soft); font-size:11px; }.composer-box { max-width:760px; margin:auto; padding:10px 12px 8px; border:1px solid var(--line-strong); border-radius:12px; background:#fff; box-shadow:0 5px 18px rgba(27,35,31,.05); transition:border .18s ease,box-shadow .18s ease; }.composer-box:focus-within { border-color:var(--accent); box-shadow:0 0 0 3px rgba(216,93,71,.1); }.composer textarea { display:block; width:100%; min-height:56px; resize:none; border:0; outline:0; background:transparent; color:var(--ink); }.composer textarea::placeholder { color:#9aa39f; }.composer-actions { display:flex; align-items:center; gap:8px; }.composer-hint { flex:1; color:#99a29d; font-size:10px; }.voice-button { padding:6px 8px; border:1px solid var(--line); border-radius:6px; color:var(--ink-soft); font-size:11px; }.voice-button.listening { color:var(--accent-deep); border-color:var(--accent); }.send-button { padding:8px 15px; border-radius:7px; background:var(--ink); color:#fff; font-size:11px; font-weight:800; }
.changes-panel { padding-bottom:20px; }.change-summary { margin:0 20px 10px; padding:10px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); color:var(--ink-soft); font-size:11px; }.change-list { display:grid; gap:8px; padding:0 14px; max-height:45vh; overflow:auto; }.empty-state { padding:20px 8px; color:var(--ink-soft); }.empty-state strong,.empty-state span { display:block; }.empty-state strong { color:var(--ink); font-size:12px; }.empty-state span { margin-top:5px; font-size:11px; }.change-card { padding:12px; border:1px solid var(--line); border-radius:10px; background:#fff; }.change-card.selected { border-color:var(--accent); box-shadow:0 0 0 2px rgba(216,93,71,.1); }.change-card-head { display:flex; align-items:center; gap:8px; }.change-card input { width:15px; height:15px; accent-color:var(--accent); }.risk-badge { margin-left:auto; color:var(--warn); font:500 10px 'DM Mono',monospace; }.risk-badge.high { color:var(--accent-deep); }.change-card h3 { margin:8px 0 4px; font-size:12px; line-height:1.4; }.change-card p { margin:0; color:var(--ink-soft); font-size:11px; }.review-button { width:100%; margin-top:10px; padding:7px 8px; border:1px solid var(--line); border-radius:6px; background:#fafaf5; color:var(--blue); text-align:left; font-size:11px; }.review-button:hover { border-color:var(--blue); }.review-detail { margin:14px; padding:14px; border-top:2px solid var(--ink); background:#fbfaf5; }.review-detail h3 { margin:0 0 6px; font-size:13px; }.review-detail .detail-meta { color:var(--ink-soft); font-size:10px; }.impact-list { margin:11px 0; padding-left:16px; color:var(--ink-soft); font-size:11px; }.diff-item { margin-top:10px; padding:10px; border:1px solid var(--line); border-radius:8px; background:#fff; }.diff-item header { display:flex; justify-content:space-between; gap:8px; color:var(--ink-soft); font:10px 'DM Mono',monospace; }.diff-item pre { max-height:80px; margin:7px 0 0; overflow:auto; white-space:pre-wrap; word-break:break-word; font:10px/1.45 'DM Mono',monospace; }.diff-item textarea { width:100%; min-height:54px; margin-top:7px; padding:7px; border:1px solid var(--line); border-radius:5px; resize:vertical; font:10px/1.45 'DM Mono',monospace; }.conflict-card { margin:-3px -2px 14px; padding:11px; border:1px solid #e5b0a1; border-left:3px solid var(--accent); border-radius:8px; background:#fff6f2; }.conflict-heading { display:flex; align-items:center; gap:8px; font-size:11px; }.conflict-heading .risk-badge { margin:0; }.conflict-card > p { margin:8px 0; color:var(--ink-soft); font-size:10px; line-height:1.55; }.conflict-objects { display:grid; gap:7px; }.conflict-objects article { padding:8px; border:1px solid #edd2c8; border-radius:6px; background:#fff; }.conflict-objects header { display:flex; justify-content:space-between; gap:8px; color:var(--ink); font-size:10px; }.conflict-objects header span { color:var(--ink-soft); font:10px 'DM Mono',monospace; }.conflict-objects article > div { margin-top:7px; }.conflict-objects b { color:var(--ink-soft); font-size:10px; }.conflict-objects pre { max-height:90px; margin:4px 0 0; overflow:auto; white-space:pre-wrap; word-break:break-word; font:10px/1.4 'DM Mono',monospace; }.conflict-objects ul { margin:4px 0 0; padding-left:15px; color:var(--ink-soft); font-size:10px; }.conflict-actions { display:flex; gap:7px; margin-top:10px; }.conflict-actions button { flex:1; padding:7px 5px; border:1px solid var(--line-strong); border-radius:6px; background:#fff; color:var(--ink-soft); font-size:10px; font-weight:700; }.conflict-actions .apply { border-color:var(--accent); background:var(--accent); color:#fff; }
.loading-block { padding:12px 8px; color:var(--ink-soft); font-size:11px; }.drawer-scrim { display:none; }.app-dialog { width:min(560px,calc(100vw - 28px)); padding:0; border:0; border-radius:14px; background:transparent; box-shadow:0 24px 70px rgba(20,25,28,.22); }.app-dialog::backdrop { background:rgba(17,23,26,.45); backdrop-filter:blur(3px); }.dialog-card { display:grid; gap:8px; padding:24px; background:var(--panel); }.dialog-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:6px; }.dialog-header h2 { margin:3px 0 0; font:600 24px Newsreader,Georgia,serif; }.dialog-close { border:0; background:none; color:var(--ink-soft); font-size:25px; }.dialog-card label { margin-top:5px; color:var(--ink-soft); font-size:11px; font-weight:700; }.dialog-card input,.dialog-card select,.dialog-card textarea { width:100%; padding:10px; border:1px solid var(--line); border-radius:7px; background:#fff; color:var(--ink); }.dialog-card textarea { resize:vertical; font:12px/1.7 'DM Mono',monospace; }.dialog-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; margin-top:10px; }.dialog-actions .helper { flex:1; margin:0; }.model-status { padding:8px 10px; border-radius:6px; background:#f0f2ed; color:var(--ink-soft); font-size:11px; }.model-status.success { background:#e9f5ee; color:var(--green); }.model-status.error { background:#fff0ec; color:var(--accent-deep); }.toast-region { position:fixed; right:20px; bottom:20px; z-index:30; display:grid; gap:8px; }.toast { max-width:340px; padding:10px 13px; border:1px solid var(--line); border-radius:8px; background:var(--ink); color:#fff; box-shadow:var(--shadow); font-size:12px; }.toast.error { border-color:#eead9c; background:#7f3025; }.toast.success { border-color:#9cc5ad; background:#286047; }.toast.warn { border-color:#e8c391; background:#7a5320; }
.mobile-only { display:none; }
@keyframes pulse { 50% { box-shadow:0 0 0 5px rgba(216,93,71,.12); } }
@keyframes message-focus { 0%,100% { box-shadow:0 0 0 0 rgba(216,93,71,0); } 25%,75% { box-shadow:0 0 0 4px rgba(216,93,71,.2); } }
@media (max-width:1100px) { .conversation-header,.conversation-scroll,.composer { padding-left:24px; padding-right:24px; }.model-notice { margin-left:24px; margin-right:24px; } }
@media (max-width:820px) { :root { --topbar:60px; }.topbar { padding:0 14px; gap:12px; }.brand-lockup { min-width:auto; }.brand-lockup div { display:none; }.top-actions { gap:5px; }.connection-status { padding:5px 7px; }.quiet-button { padding:7px 8px; }.mobile-only { display:inline-flex; }.workbench-grid { display:block; min-height:calc(100vh - var(--topbar)); }.side-panel { position:fixed; top:var(--topbar); bottom:0; z-index:15; width:min(340px,88vw); overflow:auto; background:var(--panel); box-shadow:0 20px 50px rgba(17,23,26,.18); transition:transform .22s ease; }.context-panel { left:0; transform:translateX(-105%); border-right:1px solid var(--line); }.changes-panel { right:0; transform:translateX(105%); border-left:1px solid var(--line); }.context-panel.open,.changes-panel.open { transform:none; }.drawer-scrim { position:fixed; inset:var(--topbar) 0 0; z-index:14; display:block; background:rgba(17,23,26,.35); }.drawer-scrim[hidden] { display:none; }.conversation-pane { min-height:calc(100vh - var(--topbar)); }.conversation-header { padding:24px 18px 9px; }.conversation-header h1 { font-size:27px; }.conversation-scroll,.composer { padding-left:18px; padding-right:18px; }.model-notice { margin-left:18px; margin-right:18px; flex-wrap:wrap; }.model-notice span { min-width:80%; }.mobile-only.icon-button { display:inline-flex; padding:7px 6px; border:1px solid var(--line); border-radius:6px; color:var(--ink-soft); font-size:10px; }.message { max-width:90%; }.browse-head,.browse-body { padding-left:18px; padding-right:18px; }.browse-grid { grid-template-columns:1fr; }.browse-title h2 { font-size:20px; }.composer { padding-bottom:16px; }.composer-hint { display:none; }.send-button { padding:9px 13px; } }
@media (max-width:480px) { .connection-status span { display:none; }.conversation-header { align-items:flex-start; }.conversation-header h1 { font-size:24px; }.dialog-actions { flex-wrap:wrap; }.dialog-actions .helper { flex-basis:100%; }.toast-region { right:10px; left:10px; bottom:10px; }.toast { max-width:none; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto !important; animation-duration:.01ms !important; transition-duration:.01ms !important; } }

.dialog-divider{border:0;border-top:1px solid var(--line);width:100%;margin:8px 0}.lifecycle-actions{flex-wrap:wrap}.history-list{display:grid;gap:10px;max-height:60vh;overflow:auto}.history-item{padding:12px;border:1px solid var(--line);border-radius:9px;background:#fff}.history-item header{display:flex;justify-content:space-between}.history-item p{margin:6px 0;color:var(--ink-soft);font-size:11px}.history-item button{padding:6px 9px;border:1px solid var(--line-strong);border-radius:6px;background:transparent;color:var(--ink-soft);font-size:11px}

/* ---------- 产品化打磨：布局、可拖动面板、对话窗口、编辑器 ---------- */
.desktop-only { display:inline-flex; }
.quiet-button.small { padding:6px 10px; font-size:11px; }

/* 左侧导航顶部的作品区（由页头迁移而来）：作品切换 + 收起/关闭 */
.side-work { position:sticky; top:0; z-index:2; display:flex; align-items:center; gap:9px; padding:17px 20px 15px; border-bottom:1px solid var(--line); background:inherit; }
.side-work .panel-heading-actions { flex:none; }
/* 作品切换：自定义下拉（替代原生 select，使其展开列表与整体视觉统一） */
.work-dropdown { position:relative; flex:1; min-width:0; }
.work-dropdown-trigger { display:flex; align-items:center; gap:8px; width:100%; height:var(--panel-control-h); padding:0 10px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink); font-size:13px; font-weight:600; line-height:1.35; text-align:left; transition:border-color .16s ease,box-shadow .16s ease; }
.work-dropdown-trigger:hover { border-color:var(--line-strong); }
.work-dropdown-trigger:focus-visible { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(216,93,71,.14); }
.work-dropdown-lead { flex:none; width:15px; height:15px; fill:none; stroke:var(--ink-soft); stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.work-dropdown-value { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.work-dropdown-chevron { flex:none; width:14px; height:14px; fill:none; stroke:var(--ink-soft); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition:transform .18s ease; }
.work-dropdown.open .work-dropdown-trigger { border-color:var(--accent); box-shadow:0 0 0 3px rgba(216,93,71,.14); }
.work-dropdown.open .work-dropdown-chevron { transform:rotate(180deg); }
.work-dropdown-menu { position:absolute; top:calc(100% + 6px); left:0; right:0; z-index:6; max-height:min(288px,56vh); padding:6px; overflow:auto; overscroll-behavior:contain; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); opacity:0; visibility:hidden; pointer-events:none; transform:translateY(-4px); transform-origin:top center; transition:opacity .16s ease,transform .16s ease,visibility .16s ease; scrollbar-width:thin; scrollbar-color:var(--line-strong) transparent; }
.work-dropdown-menu::-webkit-scrollbar { width:8px; }
.work-dropdown-menu::-webkit-scrollbar-thumb { border:2px solid #fff; border-radius:99px; background:var(--line-strong); }
.work-dropdown.open .work-dropdown-menu { opacity:1; visibility:visible; pointer-events:auto; transform:none; }
.work-option { display:flex; align-items:center; gap:8px; width:100%; padding:8px 9px; border:0; border-radius:8px; background:transparent; color:var(--ink); font-size:13px; font-weight:600; text-align:left; transition:background .13s ease,color .13s ease; }
.work-option + .work-option { margin-top:1px; }
.work-option:hover { background:#f1efe9; }
.work-option:focus-visible { outline:none; background:#f1efe9; box-shadow:inset 0 0 0 1px var(--line-strong); }
.work-option-check { flex:none; width:14px; height:14px; fill:none; stroke:var(--accent); stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; visibility:hidden; }
.work-option-label { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.work-option[aria-selected="true"] { color:var(--accent-deep); background:rgba(216,93,71,.08); }
.work-option[aria-selected="true"]:hover, .work-option[aria-selected="true"]:focus-visible { background:rgba(216,93,71,.13); }
.work-option[aria-selected="true"] .work-option-check { visibility:visible; }
.work-dropdown-sep { height:1px; margin:5px 4px; background:var(--line); }
.work-option-create { color:var(--accent-deep); font-weight:700; }
.work-option-plus { flex:none; width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.work-dropdown-empty { margin:0; padding:8px 9px; color:var(--ink-soft); font-size:12px; }

/* 左右面板：可拖动 + 可收起。宽度用 clamp 随视口/分辨率连续伸缩。
   右栏「章节工作区」优先级最高：不设区域上限（上限放宽到 560px），中栏改用 minmax(0,1fr)——
   空间不足时中栏对话区让位，优先保住右栏。 */
.workbench-grid { --left-w:clamp(216px,19vw,280px); --right-w:clamp(300px,26vw,560px); --left-gap:7px; --right-gap:7px; grid-template-columns:var(--left-w) var(--left-gap) minmax(0,1fr) var(--right-gap) var(--right-w); }
/* 显式指定每条轨道，折叠时不移除流中的项，避免 grid 自动重排（对话区塌 0 / 残留空白列） */
.context-panel { grid-column:1; }
.resize-handle[data-resize="left"] { grid-column:2; }
.conversation-pane { grid-column:3; }
.resize-handle[data-resize="right"] { grid-column:4; }
.changes-panel { grid-column:5; }
.resize-handle { position:relative; cursor:col-resize; background:transparent; touch-action:none; }
.resize-handle::after { content:""; position:absolute; inset:0 2px; border-radius:2px; background:transparent; transition:background .18s ease,opacity .18s ease; }
.resize-handle:hover::after,.resize-handle:focus-visible::after { background:var(--accent); opacity:.45; }
body.resizing { cursor:col-resize; user-select:none; }
body.resizing .resize-handle::after { background:var(--accent); opacity:.65; }
body.resizing .workbench-grid { transition:none; }
.workbench-grid.collapse-left { --left-w:0px !important; --left-gap:0px !important; }
.workbench-grid.collapse-right { --right-w:0px !important; --right-gap:0px !important; }
/* 折叠/展开过渡反馈：栅格轨道与面板同步动画，面板不再用 display:none（否则无法过渡） */
.workbench-grid { transition:grid-template-columns .26s cubic-bezier(.4,0,.2,1); }
.context-panel,.changes-panel { transition:opacity .2s ease,transform .26s cubic-bezier(.4,0,.2,1); }
.workbench-grid.collapse-left .context-panel { opacity:0; transform:translateX(-18px); pointer-events:none; overflow:hidden; border-color:transparent; }
.workbench-grid.collapse-right .changes-panel { opacity:0; transform:translateX(18px); pointer-events:none; overflow:hidden; border-color:transparent; }
.workbench-grid.collapse-left .resize-handle[data-resize="left"],.workbench-grid.collapse-right .resize-handle[data-resize="right"] { display:none; }
.side-panel { overflow:auto; max-height:calc(100vh - var(--topbar)); }
.panel-heading-actions { display:flex; align-items:center; gap:5px; }
.panel-heading-main { flex:1; min-width:0; }
/* 章节工作区标题 = 章节切换器：复用左栏作品下拉组件，仅按标题层级微调字号 */
.panel-heading-main .work-dropdown-trigger { font-size:14px; font-weight:700; letter-spacing:-.01em; }
.panel-heading-main .work-dropdown-trigger:disabled { color:var(--ink-soft); cursor:default; }
/* 收起按钮与下拉触发器同高：四个标题控件（作品 / 章节下拉 + 左右收起）视觉等高 */
.panel-collapse { width:var(--panel-control-h); height:var(--panel-control-h); padding:0; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink-soft); font-size:14px; line-height:1; }
.panel-collapse:hover { border-color:var(--ink); color:var(--ink); }

/* 中间对话：固定高度内部滚动窗口 */
.conversation-pane { height:calc(100vh - var(--topbar)); min-height:0; }
.conversation-scroll { overscroll-behavior:contain; }

/* 对话输入框 */
.composer-box { padding:12px 14px 10px; border-radius:16px; }
.composer textarea { min-height:26px; max-height:220px; overflow-y:auto; line-height:1.72; }
.composer-actions { margin-top:8px; }
.voice-button,.send-button,.new-chat-button { display:inline-flex; align-items:center; gap:6px; }
.voice-button svg,.send-button svg,.new-chat-button svg { width:15px; height:15px; fill:currentColor; }
.send-button { padding:9px 16px; border-radius:9px; }
.voice-button { padding:7px 11px; border-radius:8px; }
/* 输入框左下角的「＋」：开启新对话，与语音/发送同排同高 */
.new-chat-button { flex:none; padding:8px 9px; border:1px solid var(--line); border-radius:8px; color:var(--ink-soft); }
.new-chat-button:hover { border-color:var(--accent); color:var(--accent-deep); background:#fff3ef; }
.voice-button.listening { color:var(--accent-deep); border-color:var(--accent); background:#fff3ef; }
.voice-button.listening svg { animation:pulse 1.3s infinite; }
/* 语音左侧：当前对话作用的对象，随右栏章节切换联动 */
.composer-object { flex:1; min-width:0; display:flex; align-items:center; gap:6px; overflow:hidden; white-space:nowrap; color:var(--ink-soft); font-size:11px; }
.composer-object::before { content:""; flex:none; width:6px; height:6px; border-radius:50%; background:var(--accent); }

/* 统一差异视图的完整样式见下方「变更审阅 · 主从布局」段落 */
.diff-item textarea { margin:0; min-height:120px; }
.conflict-objects pre { max-height:300px; }

/* 设置弹窗分区 */
.app-dialog { width:min(600px,calc(100vw - 28px)); }
.dialog-section { display:grid; gap:8px; padding:14px 0; border-top:1px solid var(--line); }
.dialog-section:first-of-type { border-top:0; padding-top:2px; }
.dialog-section h3 { margin:0; font-size:12px; font-weight:800; letter-spacing:.02em; }
.dialog-section .helper { margin:0; }
.field-stack { display:grid; gap:6px; }
.section-actions { display:flex; flex-wrap:wrap; gap:8px; }
.dialog-actions { border-top:1px solid var(--line); padding-top:14px; }

/* 正文编辑器：宽幅书写面 + 舒适行宽 + 衬线正文，贴近小说撰写习惯 */
.editor-dialog { width:min(1040px,calc(100vw - 28px)); }
.editor-header-tools { display:flex; align-items:center; gap:8px; }
/* 头部 / 底部固定，正文框占满剩余高度并内部滚动：长正文向下读时标题与关闭键始终可见 */
.editor-dialog .editor-card { display:flex; flex-direction:column; min-height:min(74vh,660px); max-height:calc(100vh - 40px); overflow:hidden; }
/* 提高特异性以覆盖后置的通用 .dialog-card textarea 规则 */
.editor-dialog .editor-card textarea { flex:1 1 auto; min-height:0; margin-top:10px; padding:26px clamp(18px,6vw,72px); border-radius:10px; background:#fffdf8; color:#1f272c; font:17px/2.05 Newsreader,Georgia,'Songti SC',serif; letter-spacing:.012em; }
.editor-card > .helper { margin:0; }
.editor-dialog .editor-header,.editor-dialog .dialog-actions { flex:0 0 auto; }
.editor-dialog .dialog-actions { margin-top:0; }

/* 对象完整详情：更宽的阅读面；头部（标题/关闭）与底部固定，仅中间正文区滚动 */
.object-dialog { width:min(880px,calc(100vw - 28px)); }
.object-dialog .dialog-card { display:flex; flex-direction:column; gap:0; max-height:calc(100vh - 40px); padding:0; overflow:hidden; }
.object-dialog .dialog-header { flex:0 0 auto; align-items:center; padding:20px 24px 14px; border-bottom:1px solid var(--line); background:var(--panel); }
.object-dialog-body { flex:1 1 auto; min-height:0; overflow:auto; padding:14px 24px 6px; }
.object-dialog .dialog-actions { flex:0 0 auto; margin:0; padding:12px 24px 16px; border-top:1px solid var(--line); background:var(--panel); }
.object-fields { display:grid; gap:10px; margin:4px 0 14px; }
.object-field { display:grid; gap:3px; padding:10px 12px; border:1px solid var(--line); border-radius:9px; background:#fbfaf5; }
.object-field dt { color:var(--ink-soft); font:10px 'DM Mono',monospace; letter-spacing:.04em; }
.object-field dd { margin:0; white-space:pre-wrap; word-break:break-word; font-size:13px; line-height:1.75; }
/* 对象详情里的「待确认」条（§51.5.3）：绿框提示 Agent 刚改过，就地确认 / 撤销 */
.object-pending { display:grid; gap:8px; margin:0 0 14px; padding:12px; border:1px solid rgba(47,119,93,.4); border-radius:10px; background:rgba(47,119,93,.07); }
.object-pending[hidden] { display:none; }
.object-pending-head { display:flex; align-items:center; gap:8px; }
.object-pending-head strong { font-size:12.5px; }
.object-pending-note { margin:0; color:var(--ink-soft); font-size:11.5px; line-height:1.7; }
.object-pending-actions { display:flex; gap:8px; flex-wrap:wrap; }



@media (max-width:820px) { .resize-handle,.desktop-only { display:none !important; } .conversation-pane { height:auto; } }

/* ---------- UI/UX Pro Max：按钮系统与交互打磨 ---------- */
/* 统一按钮基础：对齐、命中区、状态过渡（4/8 间距节奏） */
.quiet-button,.text-button,.icon-button,.outline-button,.primary-button,.send-button,.voice-button,.new-chat-button,.panel-collapse,.panel-close,.dialog-close,.object-ref-button,.suggestion-chip,.mention-item,.section-actions button,.dialog-actions button {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  line-height:1.2; font-weight:700; white-space:nowrap; -webkit-tap-highlight-color:transparent;
  transition:background .16s ease,color .16s ease,border-color .16s ease,box-shadow .16s ease,transform .12s ease,opacity .16s ease;
}
/* 按压反馈：仅动 transform，不改变布局边界 */
.primary-button:active,.send-button:active,.conflict-actions .apply:active { transform:translateY(0) scale(.97); }
.outline-button:active,.quiet-button:active,.icon-button:active,.voice-button:active,.new-chat-button:active,.text-button:active,.panel-collapse:active,.dialog-close:active,.panel-close:active { transform:translateY(1px); }
/* 按钮尺寸节奏 */
.outline-button,.primary-button { padding:8px 14px; border-radius:8px; }
.quiet-button { padding:8px 12px; }
.send-button { padding:9px 16px; border-radius:9px; }
.voice-button { padding:8px 12px; border-radius:8px; }
.icon-button { padding:8px 12px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink-soft); font-size:12px; }
.icon-button:hover { background:#eef0ec; border-color:var(--line-strong); color:var(--ink); }
/* 文本按钮：扩大命中区并统一悬停态 */
.text-button { min-height:32px; padding:6px 8px; border-radius:6px; }
.text-button:hover { background:#eff1ec; }
/* 图标按钮：统一 32px 命中区 + 描边图标（替代字形，渲染一致） */
.panel-close,.dialog-close { width:32px; height:32px; padding:0; border-radius:8px; }
.panel-collapse { border:1px solid var(--line); background:#fff; }
.dialog-close,.panel-close { border:0; background:none; color:var(--ink-soft); }
.dialog-close:hover,.panel-close:hover,.panel-collapse:hover { background:#eff1ec; color:var(--ink); }
.dialog-close svg,.panel-close svg,.panel-collapse svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
/* 对象行按钮：统一 28×28 方形并与两行文字垂直居中（原先 stretch 会拉成竖条、与文字错位，§34 ②） */
.object-edit-button,.object-ref-button { width:28px; height:28px; flex:none; align-self:center; display:grid; place-items:center; margin:0; border:0; border-radius:8px; background:transparent; }
/* 章节行的「正文」按钮：悬停用珊瑚色强调 */
.object-edit-button { color:#a9b1ac; }
.object-edit-button:hover { background:#f3e7e2; color:var(--accent-deep); }
/* 对象行「加入对话」按钮：已引用时旋转成移除态 */
.object-ref-button { color:#c3b0a9; }
.object-ref-button:hover { background:#f7ebe6; color:var(--accent-deep); }
.object-ref-button.active { color:var(--accent); }
.object-edit-button svg,.object-ref-button svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.object-ref-button svg { transition:transform .18s ease; }
.object-ref-button.active svg { transform:rotate(45deg); }
/* 表单控件命中区与节奏 */
.change-card input[type="checkbox"] { width:18px; height:18px; }
.dialog-card input,.dialog-card select { min-height:40px; }
.composer svg { width:16px; height:16px; flex:0 0 auto; }
/* 焦点：键盘可见 */
.object-main:focus-visible,.object-edit-button:focus-visible,.object-group-add:focus-visible,.object-group-browse:focus-visible,.change-card input:focus-visible,.review-button:focus-visible,.evidence-link:focus-visible,.summary-anchor:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.resize-handle:focus-visible::after { background:var(--accent); opacity:.7; }
/* 排列节奏：统一分组间距 */
.top-actions { gap:8px; }
.panel-heading { padding:18px 20px 12px; }
/* 故事对象：左栏主区块，用卡片表面 + 数量徽标 + 更大行标题强化存在感 */
.object-section { margin:0 8px 14px; padding:12px 12px 10px; border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:0 1px 2px rgba(27,35,31,.04); }
/* 数量徽标：默认中性（只表示"有几个"），仅当存在待处理项时才升级为高亮的 .alert 变体 */
.section-count { display:inline-flex; align-items:center; justify-content:center; min-width:20px; padding:1px 6px; border-radius:999px; background:#eceae3; color:var(--ink-soft); font:600 10px 'DM Mono',monospace; font-style:normal; transition:background .18s ease,color .18s ease; }
.section-count.alert { background:var(--accent); color:#fff; }
.object-section .object-list { margin:10px -4px 0; }
.object-section .object-main { padding:9px 7px; }
.object-section .object-text strong { font-size:13px; }
.object-main { padding:8px 6px; }
.section-actions,.dialog-actions { gap:8px; }
.dialog-section { padding:16px 0; }
@media (prefers-reduced-motion:reduce) { .primary-button:hover,.send-button:hover,.primary-button:active,.send-button:active { transform:none; } }

/* ---------- 交互收口：顶栏分组、对象卡操作层级、流式对话 ---------- */
/* 顶栏：状态与操作以分隔线分区，减少视觉噪声 */
.top-divider { width:1px; height:22px; background:var(--line); }
.panel-toggles { gap:6px; }
.panel-toggles:not(:has(button:not([hidden]))) { display:none !important; }
.top-actions .quiet-button { border-color:var(--line-strong); }

/* 纯图标按钮：统一 30px 命中区 */
.icon-button.icon-only { width:30px; height:30px; padding:0; }
.icon-button.icon-only svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* 移动端专用元素在桌面端必须隐藏（修复 .mobile-only 被 .icon-button/.panel-close 的 display 覆盖） */
@media (min-width:821px) { .mobile-only { display:none !important; } }

/* 流式对话气泡：逐字输出 + 光标 */
.message.streaming .stream-text:empty::before { content:'正在思考…'; color:var(--ink-soft); }
.stream-cursor { display:inline-block; width:7px; height:14px; margin-left:2px; vertical-align:-2px; background:var(--accent); border-radius:1px; animation:stream-blink .9s steps(2,end) infinite; }
@keyframes stream-blink { 50% { opacity:0; } }

/* ---------- 滚动条：细圆角 8px、透明轨道、暖色渐变滑块（与设计系统 --accent 一致） ---------- */
/* Firefox（仅支持纯色，取品牌暖色的中间值以贴近渐变观感） */
* { scrollbar-width: thin; scrollbar-color: #b8543e transparent; }
/* Chrome / Edge / Safari */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e0806b 0%, var(--accent-deep) 100%);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ec9d88 0%, #c2543d 100%);
}
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- 通用文本框：input / textarea / select（placeholder、error、disabled、过渡） ---------- */
input::placeholder, textarea::placeholder { color: #9aa39f; opacity: 1; }
/* 注意：用 :where() 把 :not(...) 的特异性归零，否则它会盖过 .invalid / :focus 的 border-color */
.dialog-card input:where(:not([type="checkbox"]):not([type="file"])),
.dialog-card textarea,
.dialog-card select,
.field-stack input,
.field-stack textarea,
.field-stack select {
  width: 100%;
  padding: 10px 12px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease, opacity .18s ease;
}
.dialog-card input:hover:not(:disabled):not(.invalid):not(:focus),
.dialog-card textarea:hover:not(:disabled):not(.invalid):not(:focus),
.dialog-card select:hover:not(:disabled):not(.invalid):not(:focus) { border-color: var(--line-strong); }
.dialog-card input:focus,
.dialog-card textarea:focus,
.dialog-card select:focus,
.field-stack input:focus,
.field-stack textarea:focus,
.field-stack select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(216, 93, 71, .16);
}
.dialog-card input:disabled,
.dialog-card textarea:disabled,
.dialog-card select:disabled,
.field-stack input:disabled,
.field-stack textarea:disabled,
.field-stack select:disabled {
  background: #f1f2ed;
  color: #8a9591;
  border-color: var(--line);
  cursor: not-allowed;
  opacity: .7;
}
/* error 状态：红边框 + 提示 */
.dialog-card input.invalid,
.dialog-card textarea.invalid,
.dialog-card select.invalid,
.field-stack input.invalid,
.field-stack textarea.invalid,
.dialog-card [aria-invalid="true"],
.field-stack [aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.field-error { margin: -2px 0 0; color: var(--danger); font-size: 11px; font-weight: 700; }

/* ---------- 表单组件：field（label / 提示 / 错误）统一节奏 ---------- */
.field { display: grid; gap: 6px; }
.field-label { color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .01em; }
.field-label.required::after { content: '*'; margin-left: 3px; color: var(--accent); }
.field-stack { gap: 14px; }
.dialog-card .field { margin-top: 0; color: inherit; font-size: inherit; font-weight: inherit; }
/* 下拉框统一自绘箭头，跨浏览器渲染一致 */
.field select,
.field-stack select,
.dialog-card select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 16px) 54%, calc(100% - 11px) 54%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* 新建弹窗内的类型标签：类型由入口决定，弹窗内不再手选（§34 ①） */
.new-object-type { display: inline-flex; align-items: center; gap: 8px; margin: 0; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf5; color: var(--ink); font-size: 13px; font-weight: 700; }
.new-object-type .object-icon { width: 20px; height: 20px; border-radius: 6px; }

/* ---------- 审阅中心 · 主从布局（单一滚动层 ↔ 待处理详情） ---------- */
/* 关键：整个列表区只有一个滚动容器 .changes-body，各 section 不再各自嵌套滚动。
   此前 #pending-requests-section / .writing-section 各自 max-height + overflow:auto，
   造成"面板里套 3 条滚动条、鼠标滚轮到底不知道该滚谁"的体验问题（§29.2）。 */
/* 右栏「章节工作区」整栏统一底色：面板、三个区块与标题栏同色（--rail），只靠白色内容卡片分层 */
.changes-panel { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; background: var(--rail); }
.changes-body { flex: 1; min-height: 0; overflow: auto; padding: 0 16px 20px; }
.changes-list-view { padding-bottom: 0; }
.changes-list-view .change-list { max-height: none; overflow: visible; }

/* section 分隔：在相邻 section 之间画线（用 border-top，末段不会再拖一条悬空的分隔线） */
.review-section { padding: 12px 0; }
.review-section:not(:first-child) { border-top: 1px solid var(--line); }

/* ---------- 审阅卡片：统一卡片语言（新建=绿 / 修改=蓝 / 删除=红） ---------- */
.writing-section { padding: 0; border-bottom: 0; background: var(--rail); }
.writing-list { display: grid; gap: 10px; padding: 4px 0 10px; }
.primary-button.small, .quiet-button.small { padding: 6px 10px; font-size: 11px; }

.changes-panel:not(.reviewing) .review-detail { display: none; }
.changes-panel.reviewing .changes-body { display: none; }
.changes-panel.reviewing .review-detail { display: flex; }
.review-detail { flex: 1; min-height: 0; margin: 0; padding: 0; border-top: 0; background: transparent; flex-direction: column; }
.review-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 16px; border-bottom: 1px solid var(--line); background: rgba(255, 254, 250, .94); backdrop-filter: blur(10px); }
.review-back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-soft); font-size: 11px; font-weight: 700; transition: border-color .16s ease, color .16s ease, background .16s ease; }
.review-back:hover { border-color: var(--ink); color: var(--ink); }
.review-back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.review-body { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.review-detail .review-title { margin: 0 0 5px; font: 600 18px/1.3 Newsreader, Georgia, serif; letter-spacing: -.01em; }
.review-meta { margin: 0 0 12px; color: var(--ink-soft); font-size: 11px; }
.review-meta b { color: var(--accent-deep); font-family: 'DM Mono', monospace; }
.review-detail .impact-list { margin: 0 0 14px; padding-left: 16px; color: var(--ink-soft); font-size: 11px; }
.diff-list { display: grid; gap: 12px; }
.diff-item { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; transition: border-color .16s ease, box-shadow .16s ease, opacity .16s ease; }
.diff-item.kept { border-color: #e2cfc7; box-shadow: inset 3px 0 0 var(--accent); }
.diff-item.dropped { opacity: .58; }
.diff-path { display: inline-flex; align-items: baseline; gap: 6px; font-size: 11px; font-weight: 800; }
.diff-path em { color: #8a9591; font: 400 10px 'DM Mono', monospace; font-style: normal; }
.switch-field { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 11px; font-weight: 700; cursor: pointer; }
.switch-field input { width: 16px; height: 16px; accent-color: var(--accent); }
/* ---------- 统一差异视图（Unified Diff）：绿底新增 / 红底删除 ---------- */
.diff-item > header { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.diff-item > header .switch-field { margin-left: auto; }
.diff-stat { display: inline-flex; gap: 7px; font: 700 10px 'DM Mono', monospace; font-style: normal; }
.diff-stat .add { color: #1a7f37; }
.diff-stat .del { color: #cf222e; }
.diff-view { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.diff-lines { max-height: 320px; overflow: auto; font: 11.5px/1.7 'DM Mono', ui-monospace, monospace; }
/* 可滚动区域需可聚焦（WCAG 2.1）：纯键盘用户可用方向键滚动查看长差异 */
.diff-lines:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.diff-line { display: grid; grid-template-columns: 2.6em 2.6em 1.4em minmax(0, 1fr); align-items: start; }
.diff-num { padding: 0 5px 0 3px; color: #98a3a0; text-align: right; user-select: none; }
.diff-mark { color: #98a3a0; text-align: center; user-select: none; }
.diff-code { padding-right: 10px; white-space: pre-wrap; word-break: break-word; }
.diff-line.add { background: #e6ffec; }
.diff-line.add .diff-mark { color: #1a7f37; font-weight: 700; }
.diff-line.del { background: #ffebe9; }
.diff-line.del .diff-mark { color: #cf222e; font-weight: 700; }
.diff-line.add .diff-num, .diff-line.del .diff-num { background: rgba(27, 35, 31, .035); }
.diff-code mark.tok-del { background: #ffc9c0; color: inherit; border-radius: 2px; }
.diff-code mark.tok-ins { background: #a6f0b6; color: inherit; border-radius: 2px; }
.diff-more { display:block; width:100%; padding: 6px 10px; border:0; border-top: 1px dashed var(--line); background:none; color: var(--ink-soft); font-size: 10px; font-weight: 700; text-align:left; cursor:pointer; transition: color .18s ease, background .18s ease; }
.diff-more:hover { color: var(--accent-deep); background: rgba(216, 93, 71, .05); }
.diff-edit { margin-top: 9px; }
.diff-edit > summary { display: inline-block; color: var(--ink-soft); font-size: 10.5px; font-weight: 700; cursor: pointer; list-style: none; }
.diff-edit > summary::-webkit-details-marker { display: none; }
.diff-edit > summary::before { content: '✎ '; }
.diff-edit[open] > summary { margin-bottom: 6px; color: var(--accent-deep); }
.diff-edit textarea { width: 100%; min-height: 120px; margin: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; resize: vertical; white-space: pre-wrap; font: 11px/1.6 'DM Mono', monospace; }
.diff-edit textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(216, 93, 71, .16); }
.review-footer { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: rgba(255, 254, 250, .96); backdrop-filter: blur(10px); }
.review-footer-hint { flex: 1; color: var(--ink-soft); font-size: 11px; }
.review-footer-actions { display: flex; gap: 8px; }

/* 变更卡片：悬停与选中的层级反馈 */
.change-card { border-radius: 11px; transition: border-color .16s ease, box-shadow .16s ease; }
.change-card:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(27, 35, 31, .05); }
.change-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(216, 93, 71, .12); }
.review-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; }
.review-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.review-button:hover { background: #f3f7f7; }

@media (max-width: 480px) { .review-footer { flex-wrap: wrap; } .review-footer-hint { flex-basis: 100%; } .review-footer-actions { width: 100%; } .review-footer-actions button { flex: 1; justify-content: center; } }

/* ---------- 中间区 · 分类浏览视图（对话 ↔ 分类浏览 互斥切换） ---------- */
.browse-view { display: none; flex: 1; min-height: 0; flex-direction: column; background: var(--panel); }
.conversation-pane.browsing .conversation-header,
.conversation-pane.browsing .model-notice,
.conversation-pane.browsing .conversation-scroll,
.conversation-pane.browsing .composer { display: none; }
.conversation-pane.browsing .browse-view { display: flex; }
.browse-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 22px 38px 14px; border-bottom: 1px solid var(--line); }
.browse-back { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-soft); font-size: 12px; font-weight: 700; transition: border-color .16s ease,color .16s ease,background .16s ease; }
.browse-back:hover { border-color: var(--ink); color: var(--ink); }
.browse-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.browse-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.browse-title .object-icon { width: 30px; height: 30px; border-radius: 9px; }
.browse-title .object-icon svg { width: 17px; height: 17px; }
.browse-title h2 { margin: 0; font: 600 22px/1.2 Newsreader,Georgia,serif; letter-spacing: -.01em; }
.browse-title span { color: var(--ink-soft); font-size: 11px; }
.browse-tools { display: flex; align-items: center; gap: 10px; }
.browse-search { display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; transition: border-color .18s ease,box-shadow .18s ease; }
.browse-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(216,93,71,.14); }
.browse-search svg { width: 15px; height: 15px; flex: none; fill: none; stroke: #9aa39f; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.browse-search input { width: min(220px,42vw); padding: 9px 0; border: 0; background: none; color: var(--ink); font-size: 12px; }
.browse-search input:focus { outline: none; }
.browse-body { flex: 1; min-height: 0; overflow: auto; padding: 20px 38px 28px; }
.browse-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 14px; align-content: start; }
.browse-card { display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .16s ease,box-shadow .16s ease,transform .16s ease; }
.browse-card:hover { border-color: var(--line-strong); box-shadow: 0 6px 18px rgba(27,35,31,.07); transform: translateY(-1px); }
.browse-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(216,93,71,.13); }
.browse-card-main { display: block; width: 100%; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; }
.browse-card-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; }
.browse-card-head small { display: block; margin-top: 3px; color: #8a9591; font: 10px 'DM Mono',monospace; }
.browse-card-preview { flex: 1; margin: 10px 0 12px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.browse-card-preview.muted { color: #a9b1ac; font-style: italic; }
.browse-card-actions { display: flex; gap: 8px; }
.browse-card-actions button { flex: 1; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fafaf5; color: var(--blue); font-size: 11px; font-weight: 700; transition: border-color .16s ease,background .16s ease; }
.browse-card-actions button:hover { border-color: var(--blue); background: #f3f7f7; }
.browse-empty { padding: 34px 8px; text-align: center; }

/* ---------- §36 分类浏览「全貌视图」：六类对象各具形态 ---------- */
/* 页头：形态提示 + 展开大视图开关 */
#browse-form-hint { font-style: normal; color: var(--accent-deep); font-weight: 700; }
.browse-expand { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--ink-soft); font-size: 12px; font-weight: 700; transition: border-color .16s ease,color .16s ease,background .16s ease; }
.browse-expand:hover { border-color: var(--ink); color: var(--ink); background: #f1f2ee; }
.browse-expand svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.browse-expand[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-deep); background: #fff3ef; }
/* 展开大视图：把左右两栏轨道与间距归 0，全貌视图铺满全宽（§36.3）；仅桌面端生效，避免影响移动端抽屉 */
@media (min-width: 821px) {
  .workbench-grid.browse-expanded { --left-w:0px !important; --left-gap:0px !important; --right-w:0px !important; --right-gap:0px !important; }
  .workbench-grid.browse-expanded .context-panel,
  .workbench-grid.browse-expanded .changes-panel { opacity:0; transform:translateY(-8px); pointer-events:none; overflow:hidden; border-color:transparent; }
  .workbench-grid.browse-expanded .resize-handle { display:none; }
  .workbench-grid.browse-expanded .browse-body { padding-left:44px; padding-right:44px; }
  .workbench-grid.browse-expanded .graph-canvas { height:min(70vh,760px); }
  .workbench-grid.browse-expanded .roster-grid { grid-template-columns:repeat(auto-fill,minmax(164px,1fr)); }
  .workbench-grid.browse-expanded .board-col { flex-basis:290px; min-width:290px; }
}
/* 形态内共用小件：chips 与状态徽记 */
.browse-visual .chip { display:inline-flex; max-width:100%; padding:2px 8px; border:1px solid var(--line); border-radius:999px; background:#fff; color:var(--ink-soft); font-size:10.5px; line-height:1.6; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.browse-visual .chip.more { color:var(--accent-deep); border-color:rgba(216,93,71,.35); background:#fff5f2; }
.browse-visual .status-chip { display:inline-flex; align-items:center; padding:2px 7px; border-radius:999px; font-size:10px; font-weight:700; letter-spacing:.02em; }
.browse-visual .status-chip.doing { background:rgba(82,117,141,.14); color:#3d5f75; }
.browse-visual .status-chip.todo { background:rgba(167,106,39,.14); color:#8a5a1f; }
.browse-visual .status-chip.done { background:rgba(47,119,93,.14); color:#2b6b52; }
.browse-visual .status-chip.other { background:#eceeea; color:var(--ink-soft); }

/* ① 人物 · 名片墙 */
.roster-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(148px,1fr)); gap:12px; align-content:start; }
.roster-card { display:grid; justify-items:center; gap:6px; min-width:0; padding:16px 12px; border:1px solid var(--line); border-radius:14px; background:#fff; text-align:center; cursor:pointer; overflow:hidden; transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease; }
.roster-card:hover { border-color:var(--line-strong); box-shadow:0 6px 18px rgba(27,35,31,.07); transform:translateY(-1px); }
.roster-card.selected { border-color:var(--accent); box-shadow:0 0 0 2px rgba(216,93,71,.13); }
/* 名片内所有子项都必须能被压缩：否则 nowrap 的长 chip / 长文案会把卡片撑爆 */
.roster-card > * { min-width:0; max-width:100%; }
.roster-avatar { display:grid; place-items:center; width:58px; height:58px; border-radius:50%; font:600 24px/1 Newsreader,Georgia,serif; }
.roster-avatar.tone-0 { background:#e9d8cf; color:#8a4a3a; }
.roster-avatar.tone-1 { background:#d7e2e6; color:#3c6172; }
.roster-avatar.tone-2 { background:#dce6db; color:#3f6449; }
.roster-avatar.tone-3 { background:#e7e0cd; color:#7a6231; }
.roster-avatar.tone-4 { background:#e3dbe6; color:#5f4a72; }
.roster-name { font-size:14px; font-weight:800; overflow-wrap:anywhere; }
.roster-role { max-width:100%; color:var(--ink-soft); font-size:11.5px; line-height:1.5; }
.roster-role.muted { color:#a9b1ac; font-style:italic; }
.roster-traits { display:flex; flex-wrap:wrap; justify-content:center; width:100%; min-width:0; gap:4px; }
.roster-motivation { margin:2px 0 0; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; color:var(--ink-soft); font-size:11px; line-height:1.6; }

/* ② 关系 · 关系网络图（Cytoscape 画布） */
.browse-visual.form-graph { display:grid; gap:16px; }
.graph-shell { display:grid; gap:10px; }
.graph-canvas { height:min(520px,58vh); border:1px solid var(--line); border-radius:12px; background:#fbfaf5; }
.graph-legend { display:flex; flex-wrap:wrap; align-items:center; gap:14px; color:var(--ink-soft); font-size:11px; }
.graph-legend em { margin-left:auto; font-style:normal; color:#8a9591; }
.legend-item { display:inline-flex; align-items:center; gap:6px; }
.legend-node,.legend-ghost { display:inline-block; width:12px; height:12px; border-radius:50%; }
.legend-node { background:#fffefa; border:2px solid var(--accent); }
.legend-ghost { background:#f5f4ef; border:2px dashed var(--line-strong); }
.legend-edge { display:inline-block; width:20px; border-top:2px solid var(--line-strong); }
.graph-note { margin:0; color:var(--ink-soft); font-size:11px; line-height:1.7; }
.graph-fallback,.graph-unresolved { display:grid; gap:10px; }
.graph-unresolved h3 { margin:4px 0 0; color:var(--ink-soft); font-size:12px; font-weight:800; }
/* 关系成对条目：图库不可用或双方无法解析时的降级形态（§36.4） */
.rel-pairs { display:grid; gap:9px; }
.rel-pair { display:grid; grid-template-columns:1fr auto 1fr; gap:10px; align-items:center; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; cursor:pointer; transition:border-color .16s ease,box-shadow .16s ease; }
.rel-pair:hover { border-color:var(--line-strong); box-shadow:0 4px 12px rgba(27,35,31,.05); }
.rel-pair.selected { border-color:var(--accent); box-shadow:0 0 0 2px rgba(216,93,71,.13); }
.rel-pair-end { font-size:12.5px; font-weight:700; }
.rel-pair-type { justify-self:center; padding:2px 9px; border-radius:999px; background:rgba(82,117,141,.13); color:#3d5f75; font-size:10.5px; font-weight:700; white-space:nowrap; }
.rel-pair-desc { grid-column:1 / -1; margin:0; color:var(--ink-soft); font-size:11.5px; line-height:1.65; }

/* ③ 时间线 · 泳道轴 */
.swimlanes { display:grid; gap:16px; }
.swimlane { display:grid; gap:6px; }
.swimlane-head { display:flex; align-items:center; gap:8px; color:var(--ink); font-size:12px; font-weight:800; }
.swimlane-head .object-icon { width:18px; height:18px; border-radius:5px; }
.swimlane-head em { margin-left:auto; color:var(--ink-soft); font:10px 'DM Mono',monospace; font-style:normal; }
/* 时间线：单列纵向时间轴 —— 由上到下即事件先后，序号标在轴上，窄窗也不截断（§时间线自适应 + 顺序） */
.swimlane-track { position:relative; display:grid; gap:10px; padding:6px 4px 10px 42px; }
.swimlane-track::before { content:''; position:absolute; left:19px; top:26px; bottom:20px; width:2px; border-radius:1px; background:linear-gradient(180deg,var(--line-strong),rgba(185,194,188,.16)); }
.swim-event { position:relative; z-index:1; display:grid; gap:4px; min-width:0; padding:10px 13px; border:1px solid var(--line); border-radius:11px; background:#fff; color:var(--ink); text-align:left; transition:border-color .16s ease,box-shadow .16s ease; }
.swim-event:hover { border-color:var(--line-strong); box-shadow:0 5px 14px rgba(27,35,31,.06); }
.swim-event.selected { border-color:var(--accent); box-shadow:0 0 0 2px rgba(216,93,71,.13); }
/* 轴上的序号节点：1、2、3… 顺序一目了然 */
.swim-event::before { content:attr(data-step); position:absolute; top:11px; left:-32px; width:20px; height:20px; border-radius:50%; background:var(--accent); color:#fff; font:700 10px/20px 'DM Mono',monospace; text-align:center; box-shadow:0 0 0 3px var(--panel); }
.swim-event.undated::before { background:var(--ink-soft); }
.swim-time { color:var(--accent-deep); font:10px 'DM Mono',monospace; }
.swim-event.undated .swim-time { color:#a9b1ac; }
.swim-title { font-size:12.5px; font-weight:800; overflow-wrap:anywhere; }
.swim-desc { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; color:var(--ink-soft); font-size:11px; line-height:1.6; }

/* ④ 伏笔 · 线索→回收对照 */
.pair-list { display:grid; gap:12px; }
.pair-row { display:grid; grid-template-columns:1fr auto 1fr; gap:10px; align-items:stretch; padding:12px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.pair-row.dangling { border-style:dashed; background:#fbfaf5; }
.pair-row.selected { border-color:var(--accent); box-shadow:0 0 0 2px rgba(216,93,71,.13); }
.pair-side { display:grid; gap:6px; padding:10px; border:1px solid var(--line); border-radius:9px; background:#fbfaf5; color:var(--ink); text-align:left; transition:border-color .16s ease; }
.pair-side:hover { border-color:var(--line-strong); }
.pair-side.clue { background:#fdf8f4; }
.pair-side.payoff { background:#f4f8f5; }
.pair-tag { justify-self:start; padding:1px 7px; border-radius:999px; background:rgba(216,93,71,.12); color:var(--accent-deep); font-size:10px; font-weight:700; }
.pair-side.payoff .pair-tag { background:rgba(47,119,93,.13); color:#2b6b52; }
.pair-text { margin:0; color:var(--ink); font-size:12.5px; line-height:1.7; }
.pair-text.muted { color:#a9b1ac; font-style:italic; }
.pair-arrow { align-self:center; color:var(--line-strong); font-size:16px; }
.pair-meta { grid-column:1 / -1; display:flex; align-items:center; gap:8px; }
.pair-meta strong { font-size:12px; font-weight:800; }

/* ⑤ 设定 · 徽章墙（点击就地展开条文） */
.badge-wall { display:flex; flex-wrap:wrap; align-items:flex-start; gap:10px; }
.rule-badge { width:min(100%,300px); border:1px solid var(--line); border-radius:12px; background:#fff; overflow:hidden; transition:border-color .16s ease,box-shadow .16s ease; }
.rule-badge:hover { border-color:var(--line-strong); box-shadow:0 5px 14px rgba(27,35,31,.06); }
.rule-badge.selected { border-color:var(--accent); box-shadow:0 0 0 2px rgba(216,93,71,.13); }
.rule-badge.open { border-color:var(--line-strong); }
.rule-badge-main { display:flex; align-items:center; gap:10px; width:100%; padding:11px 12px; border:0; background:none; color:var(--ink); text-align:left; }
.rule-seal { flex:none; display:grid; place-items:center; padding:4px; border-radius:50%; background:#f1f2ee; }
.rule-seal.doing { background:rgba(82,117,141,.14); }
.rule-seal.todo { background:rgba(167,106,39,.14); }
.rule-seal.done { background:rgba(47,119,93,.14); }
.rule-seal .object-icon { width:26px; height:26px; border-radius:9px; }
.rule-badge-text { flex:1; min-width:0; display:grid; gap:2px; }
.rule-badge-text strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; font-weight:800; }
.rule-badge-text .status-chip { justify-self:start; }
.rule-caret { flex:none; width:15px; height:15px; fill:none; stroke:var(--ink-soft); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition:transform .18s ease; }
.rule-badge.open .rule-caret { transform:rotate(180deg); }
.rule-body { padding:0 12px 12px; }
.rule-text { margin:10px 0; padding-top:10px; border-top:1px solid var(--line); color:var(--ink); font-size:12.5px; line-height:1.75; white-space:pre-wrap; }
.rule-detail { padding:6px 10px; border:1px solid var(--line-strong); border-radius:8px; background:#fafaf5; color:var(--blue); font-size:11px; font-weight:700; }
.rule-detail:hover { border-color:var(--blue); background:#f3f7f7; }

/* ⑥ 主线 · 阶段看板（按 status 分列） */
.board { display:flex; align-items:flex-start; gap:14px; overflow-x:auto; padding-bottom:6px; }
.board-col { flex:0 0 250px; min-width:250px; display:grid; gap:10px; padding:12px; border:1px solid var(--line); border-radius:12px; background:#f7f6f1; }
.board-col-head { display:flex; align-items:center; gap:7px; font-size:12px; font-weight:800; }
.board-col-dot { width:9px; height:9px; border-radius:50%; background:var(--line-strong); }
.board-col-dot.doing { background:var(--blue); }
.board-col-dot.todo { background:var(--warn); }
.board-col-dot.done { background:var(--green); }
.board-col-head em { margin-left:auto; color:var(--ink-soft); font:10px 'DM Mono',monospace; font-style:normal; }
.board-cards { display:grid; gap:9px; }
.board-card { display:grid; gap:6px; padding:11px; border:1px solid var(--line); border-radius:10px; background:#fff; cursor:pointer; transition:border-color .16s ease,box-shadow .16s ease; }
.board-card:hover { border-color:var(--line-strong); box-shadow:0 4px 12px rgba(27,35,31,.06); }
.board-card.selected { border-color:var(--accent); box-shadow:0 0 0 2px rgba(216,93,71,.13); }
.board-title { font-size:12.5px; font-weight:800; }
.board-goal { margin:0; color:var(--ink-soft); font-size:11.5px; line-height:1.65; }
.board-goal.muted,.board-empty { color:#a9b1ac; font-style:italic; }
.board-empty { margin:0; font-size:11px; }
.board-beats { display:grid; gap:5px; }
.board-beats-count { color:var(--ink-soft); font:10px 'DM Mono',monospace; }
.board-beat-chips { display:flex; flex-wrap:wrap; gap:4px; }
@media (max-width:640px) {
  .pair-row { grid-template-columns:1fr; }
  .pair-arrow { justify-self:center; transform:rotate(90deg); }
  .rel-pair { grid-template-columns:1fr; }
  .rel-pair-type { justify-self:start; }
  .graph-canvas { height:min(420px,52vh); }
  .roster-grid { grid-template-columns:repeat(auto-fill,minmax(132px,1fr)); }
}

/* ---------- 三栏布局 · 滚动行为与背景层次 ---------- */
/* 左右面板：不显示滚动条（内容仍可滚动），只让中间对话区保留可见的垂直滚动条 */
/* 统一底色：左右面板与右栏「章节工作区」的标题栏/区块都用同一色（--rail） */
.side-panel { background: var(--rail); scrollbar-width: none; -ms-overflow-style: none; }
.side-panel::-webkit-scrollbar { width: 0; height: 0; }
/* 中间区：与两侧同色系但略亮，用微差突出对话内容 */
.conversation-pane { background: var(--panel); }
.browse-view { background: var(--panel); }

/* ---------- 列表视觉统一：间距 / 边框 / 悬停 / 展开卡片 ---------- */
.change-list, .history-list { gap: 10px; }
.history-item { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.history-item:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(27, 35, 31, .06); }
/* 版本标题 = commit 式简述（动作 + 对象）；变化字段单列一行，版本号与作者退到次行 */
.history-item header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.history-title { min-width: 0; color: var(--ink); font-size: 12.5px; font-weight: 800; }
.history-brief { margin: 0; color: var(--accent-deep); font-size: 11.5px; font-weight: 700; }
.history-meta { margin: 0; color: var(--ink-soft); font: 10px 'DM Mono', monospace; }
.history-meta code { color: #8a9591; }
.history-item > button { justify-self: start; }
.conflict-objects article { border-radius: 9px; transition: border-color .16s ease; }
.conflict-objects article:hover { border-color: var(--accent); }

/* ---------- 左栏自适应：窄桌面进一步收窄留白，内容仍完整可见 ---------- */
/* 面板宽度本身由 .workbench-grid 的 clamp 变量随视口伸缩；这里只压缩内边距，避免窄栏中出现挤压换行 */
@media (max-width:1180px) {
  .panel-heading { padding:15px 16px 10px; }
  .context-section { padding:0 16px 16px; }
  .object-section { margin:0 6px 12px; padding:11px 11px 9px; }
  .object-section .object-list { margin:8px -3px 0; }
  .side-work { padding:14px 16px 13px; }
}

/* ---------- 统一对话活动流（闲聊 / 执行模式共用同一套视觉） ---------- */
/* 思考 · 工具 · 文本 · 状态 · 变更都在对话流中内联呈现，不再使用独立执行卡片 */
.turn { display:grid; gap:8px; margin:0 0 6px; white-space:normal; word-break:break-word; }
.message-list > .turn { max-width:760px; width:100%; margin:0 auto; }
.turn:empty { display:none; }
.act { font-size:12px; }
/* 思考过程：可折叠，默认收起，展开后与后续工具内容成组呈现 */
.act-thinking { border:1px solid var(--line); border-radius:9px; background:#f6f6f0; overflow:hidden; }
.act-thinking > details { margin:0; }
.act-thinking > details > summary { display:flex; align-items:center; gap:8px; padding:8px 11px; color:var(--ink-soft); font-size:11px; font-weight:700; cursor:pointer; list-style:none; }
.act-thinking > details > summary::-webkit-details-marker { display:none; }
.act-dot { width:6px; height:6px; border-radius:50%; background:var(--line-strong); transition:background .18s ease; }
.act-thinking[open] .act-dot { background:var(--accent); }
.act-thinking-body { padding:2px 12px 11px; border-top:1px solid var(--line); color:var(--ink-soft); font-size:11.5px; line-height:1.62; }
.act-text { color:var(--ink); }
.act-text-body { font-size:13px; line-height:1.62; }
/* 工具调用行：运行中/成功/失败三态 */
.act-tool { display:flex; align-items:center; gap:8px; padding:7px 10px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink-soft); font-size:11px; }
.act-tool-icon { flex:0 0 auto; width:7px; height:7px; border-radius:2px; background:var(--line-strong); transition:background .18s ease; }
.act-tool.running .act-tool-icon { background:var(--warn); animation:pulse 1.1s ease-in-out infinite; }
.act-tool.ok .act-tool-icon { background:var(--green); }
.act-tool.fail .act-tool-icon { background:var(--danger); }
.act-tool-label { color:var(--ink); font-weight:700; white-space:nowrap; }
.act-tool-detail { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#8a9591; font:10px 'DM Mono',monospace; }
/* 仅当产生了待确认修改时才出现的动态 UI */
.act-change { display:flex; align-items:center; gap:10px; padding:10px; border:1px solid #e7c7a4; border-left:3px solid var(--accent); border-radius:9px; background:#fff8eb; }
.act-change-mark { flex:0 0 auto; width:8px; height:8px; border-radius:50%; background:var(--accent); }
.act-change-copy { flex:1; min-width:0; }
.act-change-copy b { display:block; color:var(--ink); font-size:11.5px; }
.act-change-copy span { color:var(--ink-soft); font-size:10.5px; }
.act-change button { flex:0 0 auto; padding:6px 11px; border:1px solid var(--accent); border-radius:6px; background:var(--accent); color:#fff; font-size:10.5px; font-weight:700; }
.act-change button:hover { background:var(--accent-deep); border-color:var(--accent-deep); }
.act-error { padding:9px 11px; border:1px solid #e5b0a1; border-left:3px solid var(--danger); border-radius:9px; background:#fff6f2; color:var(--accent-deep); font-size:11.5px; }
.act-suggestions { display:grid; gap:8px; padding:10px 11px; border:1px dashed var(--line-strong); border-radius:9px; background:#fbfaf5; }
.act-suggestions-label { color:var(--ink-soft); font-size:10.5px; font-weight:700; letter-spacing:.02em; }
.act-suggestions-list { display:flex; flex-wrap:wrap; gap:7px; }
.suggestion-chip { padding:7px 12px; border:1px solid var(--line-strong); border-radius:999px; background:#fff; color:var(--ink); font-size:11px; font-weight:600; text-align:left; }
.suggestion-chip:hover { border-color:var(--accent); background:#fff3ef; color:var(--accent-deep); }

/* ---------- 上下文引用：@ 浮层 + 引用 chip 行 ---------- */
.composer-field { position:relative; }
.composer-references { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 8px; }
.reference-chip { display:inline-flex; align-items:center; gap:6px; max-width:100%; padding:3px 5px 3px 6px; border:1px solid rgba(216,93,71,.35); border-radius:8px; background:#fff5f1; color:var(--accent-deep); font-size:11px; }
.reference-chip .object-icon { width:18px; height:18px; border-radius:5px; }
.reference-chip-title { max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.reference-chip button { border:0; padding:0 2px; background:none; color:inherit; font-size:14px; line-height:1; opacity:.6; }
.reference-chip button:hover { opacity:1; }
/* 正文选段引用：与对象引用同形但用中性色，并带序号（对应正文里的第几段选段） */
.composer-quotes { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 8px; }
.quote-chip { padding-left:5px; border-color:var(--line-strong); background:#f4f1e9; color:var(--ink); }
.quote-chip-index { display:grid; place-items:center; width:16px; height:16px; flex:none; border-radius:5px; background:var(--ink-soft); color:#fffefa; font:9px 'DM Mono',monospace; }
.quote-chip .reference-chip-title { font-family:Newsreader,Georgia,serif; max-width:220px; }
/* 划选未引用就发送时的轻提示（§47 兜底）：只提示，不改变正文，也不自动附加 */
.composer-hint { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 8px; padding:7px 10px; border:1px dashed var(--line-strong); border-radius:9px; background:#f7f4ec; color:var(--ink-soft); font-size:12px; }
.composer-hint-text { flex:1 1 200px; }
.composer-hint button { padding:3px 9px; border:1px solid var(--line-strong); border-radius:7px; background:#fffefa; color:var(--ink); font-size:11px; font-weight:700; cursor:pointer; }
.composer-hint button[data-quote-hint="attach"] { border-color:var(--accent); background:#fff0ea; color:var(--accent-deep); }
.composer-hint button:hover { filter:brightness(.97); }
.mention-menu { position:absolute; left:0; right:0; bottom:calc(100% + 8px); z-index:20; max-height:260px; overflow:auto; padding:5px; border:1px solid var(--line-strong); border-radius:11px; background:var(--panel); box-shadow:var(--shadow); }
.mention-menu[hidden] { display:none; }
.mention-item { display:flex; align-items:center; gap:9px; width:100%; padding:7px 9px; border:0; border-radius:8px; background:transparent; color:var(--ink); font-weight:500; text-align:left; }
.mention-item .object-icon { width:20px; height:20px; border-radius:6px; }
.mention-item.active,.mention-item:hover { background:#f1efe9; }
.mention-text { display:grid; min-width:0; }
.mention-text strong { font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mention-text small { color:var(--ink-soft); font:10px 'DM Mono',monospace; }
.object-ref-button:focus-visible,.mention-item:focus-visible,.suggestion-chip:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.message-refs { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.message-author-refs, .message-ref { padding:3px 7px; border-radius:6px; font-size:10px; }
.message.agent .message-ref { border:1px solid var(--line); background:#f4f1e9; color:var(--ink-soft); }
.message.author .message-ref { border:1px solid rgba(255,254,250,.35); background:rgba(255,254,250,.12); color:#f8f6ed; }
/* 作者气泡里的正文选段留痕：左侧竖线 + 缩进，与对象引用胶囊区分 */
.message-quotes { display:grid; gap:4px; margin-top:8px; }
.message-quote { display:block; max-width:100%; padding:4px 8px; border-left:2px solid rgba(255,254,250,.5); background:rgba(255,254,250,.12); border-radius:0 6px 6px 0; font:11px/1.5 Newsreader,Georgia,serif; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.message.agent .message-quote { border-left-color:var(--line-strong); background:#f4f1e9; }

/* ---------- 确认性修改历史（版本历史 / 修改历史 双 tab） ---------- */
#history-dialog { width:min(760px,calc(100vw - 28px)); }
.history-card { max-height:min(84vh,860px); overflow:auto; }
.history-tabs { display:flex; gap:4px; padding:3px; border:1px solid var(--line); border-radius:10px; background:#f4f3ec; }
.history-tab { flex:1; padding:8px 10px; border:0; border-radius:8px; background:transparent; color:var(--ink-soft); font-size:12px; font-weight:800; cursor:pointer; transition:background .16s ease,color .16s ease; }
.history-tab:hover { color:var(--ink); }
.history-tab.is-active { background:#fff; color:var(--ink); box-shadow:0 1px 3px rgba(27,35,31,.08); }
.audit-panel { display:grid; gap:12px; }
.audit-filters { display:flex; flex-wrap:wrap; align-items:end; gap:10px; padding:12px; border:1px solid var(--line); border-radius:11px; background:#fbfaf5; }
.audit-filter { display:grid; gap:4px; min-width:0; }
.audit-filter > span { color:var(--ink-soft); font-size:10px; font-weight:800; letter-spacing:.02em; }
.audit-filter select, .audit-filter input { width:auto; min-width:120px; min-height:34px; padding:6px 9px; }
.audit-filter-actions { display:flex; align-items:center; gap:8px; margin-left:auto; }
.audit-list { display:grid; gap:10px; max-height:56vh; overflow:auto; }
.audit-summary { padding-bottom:2px; color:var(--ink-soft); font-size:11px; }
.audit-summary b { color:var(--ink); }
.audit-item { padding:12px; border:1px solid var(--line); border-radius:11px; background:#fff; transition:border-color .16s ease, box-shadow .16s ease; }
.audit-item:hover { border-color:var(--line-strong); box-shadow:0 4px 14px rgba(27,35,31,.06); }
.audit-item.is-open { border-color:var(--line-strong); }
.audit-item-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.audit-item-title { display:flex; align-items:center; gap:8px; min-width:0; }
.audit-action-tag { flex:none; padding:3px 8px; border-radius:999px; background:#f1efe9; color:var(--accent-deep); font-size:10.5px; font-weight:800; }
.audit-target { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink); font-size:12.5px; font-weight:800; }
/* 标题右侧的「改了什么」简述：字段名 */
.audit-change-brief { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--blue); font-size:11px; font-weight:700; }
.audit-item-time { flex:none; color:#8a9591; font:10px 'DM Mono',monospace; }
.audit-item-meta { margin:7px 0 0; color:var(--ink-soft); font-size:11px; }
.audit-item-foot { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; }
.audit-item-count { color:var(--ink-soft); font:10px 'DM Mono',monospace; }
.audit-detail { margin-top:11px; padding-top:11px; border-top:1px dashed var(--line); display:grid; gap:11px; }
.audit-detail-meta { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:7px 14px; margin:0; }
.audit-detail-meta > div { display:grid; gap:2px; min-width:0; }
.audit-detail-meta dt { color:var(--ink-soft); font-size:10px; font-weight:800; }
.audit-detail-meta dd { margin:0; overflow:hidden; text-overflow:ellipsis; word-break:break-all; color:var(--ink); font:10.5px 'DM Mono',monospace; }
.audit-change { display:grid; gap:6px; }
.audit-change > header { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.audit-change-field { color:var(--blue); font:700 11px 'DM Mono',monospace; }
.audit-change .diff-lines { max-height:240px; border:1px solid var(--line); border-radius:9px; }
@media (max-width:520px) { .audit-filter { flex:1 1 46%; } .audit-filter select, .audit-filter input { width:100%; min-width:0; } .audit-filter-actions { margin-left:0; flex-basis:100%; } }

/* ---------- 章节工作区（§35）：章节=可编辑文件，六大设定=import，改动=统一 diff ---------- */
/* 右栏从上到下 = 本章已体现的对象 → 章节文件，整栏单一滚动层（.changes-body） */

/* 章节文件：正文编辑区（像代码编辑器，但用阅读向字体） */
.chapter-file-body { display:grid; gap:10px; padding:4px 0 10px; }
.chapter-file-bar { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.chapter-file-title { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink); font-size:13px; font-weight:800; }
.chapter-file-meta { color:#8a9591; font:10px 'DM Mono',monospace; }
.chapter-text-editor { width:100%; min-height:min(46vh,420px); margin:0; padding:12px 13px; border:1px solid var(--line); border-radius:11px; background:#fff; color:var(--ink); resize:none; tab-size:2; font:13.5px/1.9 Newsreader,'Songti SC','Noto Serif SC',Georgia,serif; }
.chapter-text-editor:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(216,93,71,.14); }
.chapter-file-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

/* ---------- 正文划选 → 引用到对话（§47）：浮层按钮撑在选区旁 ---------- */
.chapter-file-section { position:relative; }
.quote-fab { position:absolute; z-index:15; display:inline-flex; align-items:center; gap:5px; padding:5px 9px 5px 7px; border:1px solid rgba(216,93,71,.35); border-radius:8px; background:#fff5f1; color:var(--accent-deep); font-size:11px; font-weight:700; white-space:nowrap; box-shadow:0 6px 18px rgba(26,33,31,.16); cursor:pointer; }
.quote-fab svg { width:13px; height:13px; flex:none; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.quote-fab:hover { border-color:var(--accent); background:#fff0ea; }
.quote-fab:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.quote-fab[hidden] { display:none; }

/* 章节保存条：一行极简操作，直接作用于上面的 textarea 正文（Agent 改动以行首 +/− 写在同一处） */
.chapter-save-bar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
/* 改动图例：+ 绿 = 新增，− 红 = 取消 */
.chapter-diff-legend { margin-left:auto; display:inline-flex; align-items:center; gap:5px; color:var(--ink-soft); font-size:10.5px; }
.chapter-diff-legend i { font-style:normal; font-weight:800; font-family:'DM Mono',monospace; padding:0 5px; border-radius:4px; }
.chapter-diff-legend i.ins { background:#e6ffec; color:#1a7f37; }
.chapter-diff-legend i.del { background:#ffebe9; color:#cf222e; }

/* ---------- 正文着色层（§51.5.1）：textarea 文字透明，下面垫同尺寸高亮，外观与普通编辑完全一致 ---------- */
.chapter-editor-shell { position:relative; }
.chapter-editor-shell .chapter-text-editor.marked { position:relative; z-index:1; background:transparent; color:transparent; caret-color:var(--ink); }
.chapter-editor-shell .chapter-text-editor.marked::selection { background:rgba(216,93,71,.24); }
.chapter-highlight { position:absolute; inset:0; z-index:0; overflow:hidden; border-radius:11px; background:#fff; }
/* 偏移与 textarea 严格对齐：textarea 是 border 1px + padding 12px 13px，故此处 padding 13px 14px */
.chapter-highlight-inner { padding:13px 14px; font:13.5px/1.9 Newsreader,'Songti SC','Noto Serif SC',Georgia,serif; color:var(--ink); }
.hl-line { min-height:1.9em; white-space:pre-wrap; word-break:break-word; overflow-wrap:anywhere; }
.hl-ins { background:#e6ffec; }
.hl-del { background:#ffebe9; color:#8a3a33; }
.chapter-highlight mark.tok-ins { background:#a6f0b6; color:inherit; border-radius:2px; }
.chapter-highlight mark.tok-del { background:#ffc9c0; color:inherit; border-radius:2px; }

/* 本章已体现的对象：书签式列出（由 Agent 写 / 改正文时自动登记，右栏只读） */
.chapter-links-section .writing-list { padding-top:2px; }
/* 本章用到的对象改为「书签」形态：只用类型色标识身份，不再重复写类型名；悬停显示类型与章节级状态（只读，不可增删） */
.chapter-link-pills { display:flex; flex-wrap:wrap; gap:6px; }
.chapter-link-pill { --link-color:var(--blue); position:relative; display:inline-flex; align-items:center; max-width:100%; padding:4px 9px 8px; border:0; border-radius:7px 7px 2px 2px; background:var(--link-color); color:#fffefa; font-size:11px; font-weight:700; line-height:1.2; cursor:pointer; transition:filter .15s ease; }
.chapter-link-pill::after { content:""; position:absolute; left:50%; bottom:0; transform:translateX(-50%); border-left:4px solid transparent; border-right:4px solid transparent; border-bottom:5px solid var(--rail); }
.chapter-link-pill:hover { filter:brightness(.93); }
.chapter-link-pill:focus-visible { outline:2px solid var(--ink); outline-offset:2px; }
.chapter-link-pill .bookmark-label { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chapter-link-pill.type-chapter { --link-color:var(--accent); }
.chapter-link-pill.type-character { --link-color:#5f6f86; }
.chapter-link-pill.type-plotline { --link-color:#3f6a86; }
.chapter-link-pill.type-world_rule { --link-color:#3f7a68; }
.chapter-link-pill.type-timeline_event { --link-color:#9a7434; }
.chapter-link-pill.type-foreshadowing { --link-color:#8a6144; }
.chapter-link-pill.type-relationship { --link-color:#7b5f97; }
/* 本章书签里「有新改动待确认」的对象：与左栏一致地橙色「实-虚-实」呼吸（§52.2.2）。
   只呼吸外圈橙色描边，书签本身的类型色与文字保持清晰。 */
.chapter-link-pill.pending { animation: pending-pill 1.8s ease-in-out infinite; }
@keyframes pending-pill {
  0% { box-shadow:0 0 0 2px var(--pending); }
  50% { box-shadow:0 0 0 2px rgba(224,134,43,.35); }
  100% { box-shadow:0 0 0 2px var(--pending); }
}
@media (prefers-reduced-motion:reduce) { .chapter-link-pill.pending { animation:none; box-shadow:0 0 0 2px var(--pending); } }

/* ---------- 滚动条互斥显示：同一时刻全局只显示唯一一条（左 / 中 / 右都不例外） ----------
   默认所有滚动容器都不画滚动条 —— 滚动能力完全不变（滚轮 / 方向键 / 触摸 / 触控板照旧），
   只是不再到处挂着滚动条。只有「当前活跃」的那一个容器才画出滚动条：
     · 鼠标指针所在的滚动容器（取最内层真正可滚动的那个）
     · 或正在滚动 / 刚滚动完的那个容器（停止 1 秒后淡出）
   指针与滚动都是排他的，因此屏幕上任意时刻最多只有一条滚动条。 */
* { scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; }
.scroll-active { scrollbar-width: thin; scrollbar-color: rgba(24, 32, 39, .3) transparent; }
.scroll-active::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-active::-webkit-scrollbar-track { background: transparent; }
.scroll-active::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: rgba(24, 32, 39, .28); background-clip: content-box; }
.scroll-active::-webkit-scrollbar-thumb:hover { background: rgba(24, 32, 39, .48); background-clip: content-box; }
.scroll-active::-webkit-scrollbar-corner { background: transparent; }

/* ---------- §44 账号体系：登录门禁 + 左栏底部设置入口 + 账号卡片 ---------- */
/* 未登录：门禁覆盖全屏（工作台已被 inert 锁定），只留登录 / 注册两条路。
   z-index 落在抽屉（15）之上、Toast（30）之下，退出登录的提示不会被盖住。 */
.auth-gate { position:fixed; inset:0; z-index:25; display:grid; place-items:center; padding:24px; overflow:auto; background:radial-gradient(120% 110% at 50% 0%,#fbf8f3 0%,var(--paper) 60%); }
.auth-card { width:min(392px,100%); display:grid; gap:14px; padding:30px 30px 26px; border:1px solid var(--line); border-radius:18px; background:var(--panel); box-shadow:var(--shadow); }
.auth-brand { display:flex; align-items:center; gap:10px; }
.auth-brand .brand-mark { width:32px; height:32px; }
.auth-brand strong { font:600 22px Newsreader,Georgia,serif; letter-spacing:-.01em; }
.auth-lead { margin:0; color:var(--ink-soft); font-size:12px; line-height:1.65; }
/* 登录 / 注册：分段控件，选中项浮起成白色卡片 */
.auth-tabs { display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:4px; padding:4px; border:1px solid var(--line); border-radius:10px; background:#f3f2ec; }
.auth-tab { padding:8px 10px; border:0; border-radius:7px; background:transparent; color:var(--ink-soft); font-size:12.5px; font-weight:700; transition:background .16s ease,color .16s ease,box-shadow .16s ease; }
.auth-tab:hover { color:var(--ink); }
.auth-tab.is-active { background:#fff; color:var(--ink); box-shadow:0 1px 3px rgba(27,35,31,.1); }
.auth-form { display:grid; gap:12px; }
.auth-form .field input { width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--ink); }
.auth-error { margin:0; padding:8px 10px; border:1px solid #e5b0a1; border-radius:8px; background:#fff6f2; color:var(--accent-deep); font-size:11.5px; line-height:1.5; }
.auth-submit { width:100%; padding:11px 14px; border-radius:9px; font-size:13px; }

/* 设置入口固定在左栏最底部：整栏是 flex 列，底栏 margin-top:auto 顶到末位并 sticky 吸底，
   内容再长也始终可见（面板本身仍是唯一滚动容器，不新增第二根滚动条）。 */
.context-panel { display:flex; flex-direction:column; }
.context-panel > * { flex:0 0 auto; }
.context-panel > .side-foot { margin-top:auto; }
/* 左栏底部一行：账号（头像 + 名称）在左，「设置」按钮贴右 */
.side-foot { position:sticky; bottom:0; z-index:2; display:flex; align-items:center; gap:10px; padding:12px 20px 16px; border-top:1px solid var(--line); background:var(--rail); }
.side-foot .quiet-button { flex:none; }

/* 左栏底部账号区：头像 + 名称，身份与设置面板内账号卡片同源 */
.account-chip { flex:1; display:flex; align-items:center; gap:9px; min-width:0; }
.account-chip .account-avatar { width:30px; height:30px; font-size:13px; }
.account-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink); font-size:12.5px; font-weight:700; }

/* 设置面板 · 账号卡片：头像 + 身份在左，操作按钮（去登录 / 退出登录）贴右侧 */
.account-card { display:flex; align-items:center; gap:11px; padding:12px; border:1px solid var(--line); border-radius:11px; background:#fbfaf5; }
.account-card .outline-button { flex:none; margin-left:auto; }
.account-avatar { flex:none; display:grid; place-items:center; width:38px; height:38px; border-radius:50%; background:var(--accent); color:#fff; font-size:16px; font-weight:800; }
.account-text { flex:1; display:grid; gap:1px; min-width:0; }
.account-text strong { font-size:13px; }
.account-text span { color:var(--ink-soft); font-size:11px; }
/* 连接状态从顶栏移入设置面板：作为「模型连接」区内的一行状态，不撑满整行 */
.dialog-section .connection-status { justify-self:start; }

@media (max-width:820px) {
  .auth-gate { padding:16px; }
  .auth-card { padding:24px 20px 22px; border-radius:15px; }
  .side-foot { padding:10px 16px 14px; }
}

/* ---------- §62 路径② B6：知识库面板（内置卡可停用/改写，作者与 Agent 的卡可增删改） ---------- */
.knowledge-dialog { width:min(760px,calc(100vw - 28px)); }
.knowledge-dialog .knowledge-card { display:flex; flex-direction:column; gap:0; max-height:calc(100vh - 40px); padding:0; overflow:hidden; }
.knowledge-dialog .dialog-header { flex:0 0 auto; align-items:center; padding:20px 24px 14px; border-bottom:1px solid var(--line); background:var(--panel); }
.knowledge-view { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; gap:12px; padding:14px 24px 20px; overflow:auto; }
.knowledge-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.knowledge-kinds { display:flex; flex-wrap:wrap; gap:6px; }
.knowledge-chip { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border:1px solid var(--line); border-radius:999px; background:#fbfaf5; color:var(--ink-soft); font-size:11.5px; font-weight:700; }
.knowledge-chip:hover { border-color:var(--line-strong); color:var(--ink); }
.knowledge-chip.is-active { border-color:var(--accent); background:#fff2ee; color:var(--accent-deep); }
.knowledge-chip b { padding:0 6px; border-radius:999px; background:rgba(24,32,39,.08); color:inherit; font:600 10px 'DM Mono',monospace; }
.knowledge-tools { display:flex; align-items:center; gap:8px; margin-left:auto; }
.knowledge-tools input[type="search"] { width:min(240px,42vw); min-height:34px; padding:7px 11px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); font-size:12px; }
.knowledge-summary { margin:0; }
.knowledge-list { display:grid; gap:10px; }
.knowledge-item { display:grid; gap:8px; padding:13px 14px; border:1px solid var(--line); border-radius:11px; background:#fbfaf5; }
.knowledge-item.is-disabled { opacity:.62; background:#f2f1ec; }
.knowledge-item-head { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.knowledge-item-head h4 { margin:0; font-size:13.5px; font-weight:800; }
.knowledge-kind-badge { padding:2px 7px; border-radius:6px; background:#eceee9; color:var(--ink-soft); font-size:10px; font-weight:800; letter-spacing:.02em; }
.knowledge-kind-badge.kind-craft { background:#eaf0f5; color:#3f6480; }
.knowledge-kind-badge.kind-domain { background:#eef1e6; color:#5a6b3a; }
.knowledge-kind-badge.kind-inspiration { background:#fbece7; color:var(--accent-deep); }
.knowledge-source-badge { padding:2px 7px; border-radius:6px; font-size:10px; font-weight:800; letter-spacing:.02em; }
.knowledge-source-badge.source-builtin { background:#eff0eb; color:#6b756f; }
.knowledge-source-badge.source-agent { background:#e8f1ec; color:var(--green); }
.knowledge-source-badge.source-user { background:#fdf1dd; color:var(--warn); }
.knowledge-state { padding:2px 7px; border:1px dashed var(--line-strong); border-radius:6px; color:var(--ink-soft); font-size:10px; font-weight:800; }
.knowledge-state.overridden { border-color:var(--blue); color:var(--blue); }
.knowledge-state.disabled { border-color:var(--pending); color:var(--warn); }
.knowledge-item-body { margin:0; color:#2c353c; font-size:12.5px; line-height:1.72; white-space:pre-wrap; word-break:break-word; }
.knowledge-item-tags { display:flex; flex-wrap:wrap; gap:6px; }
.knowledge-tag { padding:2px 8px; border-radius:999px; background:#eceee9; color:var(--ink-soft); font-size:10.5px; }
.knowledge-item-actions { display:flex; flex-wrap:wrap; gap:12px; padding-top:2px; border-top:1px dashed var(--line); }
.knowledge-editor { gap:14px; }
.knowledge-editor-head { display:grid; gap:3px; }
.knowledge-editor-head h3 { margin:0; font-size:13px; font-weight:800; }
.knowledge-editor-head .helper { margin:0; }
.knowledge-editor textarea { min-height:190px; line-height:1.7; }
@media (max-width:820px) {
  .knowledge-dialog .dialog-header { padding:16px 18px 12px; }
  .knowledge-view { padding:12px 18px 18px; }
  .knowledge-tools { margin-left:0; width:100%; }
  .knowledge-tools input[type="search"] { flex:1; width:auto; }
}


