/* ============================================
   铸文 Forge Echo — 白净工作台
   主色：千问紫 #5B57D9 · 纯白底
   ============================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

:root {
  --paper: #FFFFFF;
  --paper-warm: #F7F8FA;
  --paper-deep: #F2F3F5;
  --paper-sunk: #E9EBF0;

  --ink: #1A1B1E;
  --ink-secondary: #4E5460;
  --ink-muted: #9AA0AC;
  --ink-faint: #E2E4E9;

  --brand: #5B57D9;
  --brand-hover: #4B47C9;
  --brand-light: #8B88E8;
  --brand-bg: rgba(91,87,217,0.07);
  --brand-bg-strong: rgba(91,87,217,0.13);
  --brand-border: rgba(91,87,217,0.25);

  --success: #2E9E5B;
  --success-bg: rgba(46,158,91,0.08);
  --warning: #C08A1E;
  --warning-bg: rgba(192,138,30,0.09);
  --error: #D64545;
  --error-bg: rgba(214,69,69,0.08);

  --cut: rgba(26,27,30,0.09);
  --cut-strong: rgba(26,27,30,0.18);

  --font-serif: "Source Han Serif SC","Noto Serif SC","Songti SC","SimSun",serif;
  --font-sans: -apple-system,"PingFang SC","Noto Sans SC","Microsoft YaHei",sans-serif;
  --font-mono: "SF Mono","JetBrains Mono","Fira Code","Consolas",monospace;

  --sidebar-width: 250px;
  --right-width: 400px;
  --topbar-height: 52px;
  --ease: cubic-bezier(0.4,0,0.2,1);
  --dur-fast: 150ms;
  --dur-normal: 250ms;

  /* 圆角体系：xs 徽标 / sm 图标钮 / md 按钮输入 / lg 卡片 / xl 弹窗 / pill 胶囊 */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

::selection { background: rgba(91,87,217,0.14); color: var(--ink); }

/* === 图标基础 === */
.ic {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0; vertical-align: middle;
}

/* === 布局 === */
#app { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* ============================================
   左栏
   ============================================ */
#sidebar {
  width: var(--sidebar-width); min-width: var(--sidebar-width);
  height: 100%; background: var(--paper-warm);
  border-right: 1px solid var(--cut);
  display: flex; flex-direction: column;
  transition: transform var(--dur-normal) var(--ease);
}

.sidebar-header { padding: 24px 18px 16px; display: flex; flex-direction: column; gap: 14px; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
.sidebar-brand .ic { width: 20px; height: 20px; color: var(--brand); }
.sidebar-brand-name {
  font-family: var(--font-serif); font-size: 17px; font-weight: 700;
  letter-spacing: 0.05em; color: var(--ink);
}

.search-wrap { position: relative; }
.search-wrap .ic {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--ink-muted); pointer-events: none;
}
#searchInput {
  width: 100%; padding: 8px 12px 8px 32px;
  background: var(--paper); border: 1px solid var(--cut); border-radius: var(--r-md);
  color: var(--ink); font-size: 13px; font-family: var(--font-sans); outline: none;
  transition: border-color var(--dur-fast);
}
#searchInput::placeholder { color: var(--ink-muted); }
#searchInput:focus { border-color: var(--cut-strong); }

#newChatBtn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 9px 16px;
  background: var(--brand); color: #FDFCFB;
  font-size: 13px; font-weight: 500; font-family: var(--font-sans);
  border: none; border-radius: var(--r-md); cursor: pointer;
  transition: background var(--dur-fast);
}
#newChatBtn:hover { background: var(--brand-hover); }
#newChatBtn .ic { width: 15px; height: 15px; }

#modePicker { display: flex; gap: 6px; padding: 0 2px; }
#modePicker .mode-btn {
  flex: 1; padding: 5px 10px; font-size: 12px; font-weight: 500;
  font-family: var(--font-sans); color: var(--ink-secondary);
  background: var(--paper); border: 1px solid var(--cut);
  border-radius: var(--r-sm); cursor: pointer; transition: all var(--dur-fast);
}
#modePicker .mode-btn:hover { border-color: var(--cut-strong); color: var(--ink); }
#modePicker .mode-btn.active {
  background: var(--brand-bg); border-color: var(--brand-border); color: var(--brand);
}

/* --- 项目列表 --- */
#projectList { flex: 1; overflow-y: auto; padding: 8px 10px; }

.pl-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 10px; border-radius: var(--r-md);
  cursor: pointer; transition: background var(--dur-fast); position: relative;
}
.pl-item:hover { background: var(--paper-deep); }
.pl-item.active { background: var(--paper-deep); }
.pl-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 2px; height: 55%; background: var(--brand); border-radius: 1px;
}

.pl-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-faint); flex-shrink: 0; margin-top: 7px;
}
.pl-dot.running { background: var(--brand); animation: pulse 2s ease-in-out infinite; }
.pl-dot.done { background: var(--success); }
.pl-dot.draft { background: var(--ink-faint); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.pl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.pl-name {
  font-size: 13px; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pl-name.untitled { color: var(--ink-muted); font-style: italic; }

.pl-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-muted); min-width: 0; }

.pl-kind {
  font-size: 10px; padding: 1px 5px; white-space: nowrap; flex-shrink: 0;
  background: var(--paper-deep); border-radius: var(--r-xs); color: var(--ink-secondary);
}
.pl-kind.adapt { background: var(--brand-bg); color: var(--brand); }
.pl-kind.original { background: var(--success-bg); color: var(--success); }

.pl-src { font-size: 11px; color: var(--ink-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-channel { font-size: 11px; color: var(--ink-muted); margin-left: 8px; }
.pl-count { font-size: 11px; color: var(--ink-muted); white-space: nowrap; margin-top: 2px; }

.pl-ops { display: flex; align-items: center; gap: 4px; opacity: 0; transition: opacity var(--dur-fast); }
.pl-item:hover .pl-ops { opacity: 1; }

.pl-op {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: transparent; border: none; border-radius: var(--r-sm);
  cursor: pointer; color: var(--ink-muted); font-size: 11px;
  transition: all var(--dur-fast);
}
.pl-op:hover { background: var(--paper-sunk); color: var(--ink-secondary); }

.pl-empty { padding: 32px 16px; text-align: center; font-size: 13px; color: var(--ink-muted); }

.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--cut); }

/* ============================================
   中栏
   ============================================ */
.center-pane {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; height: 100%;
  background: var(--paper);
}

.center-topbar {
  height: var(--topbar-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--cut); flex-shrink: 0;
}

#centerTitle {
  font-family: var(--font-serif); font-size: 15px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.center-sub { font-size: 12px; color: var(--ink-muted); margin-left: 8px; font-family: var(--font-sans); font-weight: 400; }

#menuBtn {
  display: none; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: transparent; border: none;
  border-radius: var(--r-sm); cursor: pointer; color: var(--ink-muted); margin-right: 8px;
}
#menuBtn .ic { width: 18px; height: 18px; }

#paneBtns { display: flex; align-items: center; gap: 2px; }
.pane-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: transparent; border: none;
  border-radius: var(--r-sm); cursor: pointer; color: var(--ink-muted);
  transition: all var(--dur-fast); position: relative;
}
.pane-btn:hover { background: var(--paper-deep); color: var(--ink-secondary); }
.pane-btn.active { background: var(--brand-bg); color: var(--brand); }
.pane-btn .ic { width: 17px; height: 17px; }
.pane-btn.attn { color: var(--brand); }
.pane-btn.attn::after {
  content: ''; position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   消息流
   ============================================ */
#msgflow { flex: 1; overflow-y: auto; padding: 28px 0; }
#msgflowInner {
  max-width: 700px; margin: 0 auto; padding: 0 28px;
  display: flex; flex-direction: column; gap: 24px;
}

.msg { display: flex; flex-direction: column; gap: 4px; }

.msg.user {
  align-self: flex-end;
  background: var(--paper-deep); border: 1px solid var(--cut);
  border-radius: var(--r-lg) var(--r-lg) var(--r-xs) var(--r-lg);
  padding: 10px 16px; max-width: 70%;
  font-size: 14px; line-height: 1.7;
}
.msg.user.queued { opacity: 0.45; border-style: dashed; }

.msg.assistant { align-self: flex-start; font-size: 14.5px; line-height: 1.8; max-width: 100%; }

.sender { font-size: 12px; font-weight: 500; color: var(--brand); margin-bottom: 4px; }

.stage-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px; margin-top: 6px;
  background: var(--brand-bg); border: 1px solid var(--brand-border);
  border-radius: var(--r-xs); font-size: 11px; color: var(--brand);
}

.msg-system {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; font-size: 12.5px; color: var(--ink-muted);
}

.sugg-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.sugg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; background: var(--paper); border: 1px solid var(--cut);
  border-radius: var(--r-md); font-size: 13px; color: var(--ink-secondary);
  cursor: pointer; transition: all var(--dur-fast); font-family: var(--font-sans);
}
.sugg-btn:hover { border-color: var(--brand-border); color: var(--brand); background: var(--brand-bg); }

.attn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); padding: 4px 0; }

/* ============================================
   任务链卡片
   ============================================ */
.chain-card {
  background: var(--paper-warm); border: 1px solid var(--cut);
  border-radius: var(--r-lg); padding: 18px; margin: 4px 0;
}
.chain-head {
  font-family: var(--font-serif); font-size: 14px; font-weight: 600;
  color: var(--ink); margin-bottom: 14px;
}
.chain-steps { display: flex; flex-direction: column; }

.chain-step {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; font-size: 13px; font-weight: 500; color: var(--ink);
  position: relative;
}
.chain-step:not(:last-child)::after {
  content: ''; position: absolute; left: 8px; top: 28px; bottom: -7px;
  width: 1px; background: var(--cut-strong);
}
.chain-step::before {
  content: ''; width: 16px; height: 16px; flex-shrink: 0;
  border: 1.5px solid var(--ink-faint); border-radius: 50%;
  position: relative; z-index: 1; background: var(--paper-warm);
}

.chain-step.pending { color: var(--ink-muted); }
.chain-step.running { color: var(--ink); font-weight: 600; }
.chain-step.running::before { border-color: var(--brand); background: var(--brand-bg); }
.chain-step.done { color: var(--success); }
.chain-step.done::before { border-color: var(--success); background: var(--success-bg); }
.chain-step.failed { color: var(--error); }
.chain-step.failed::before { border-color: var(--error); background: var(--error-bg); }

.spin {
  display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid var(--cut-strong); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chain-progress { margin-top: 12px; font-size: 12px; color: var(--ink-muted); font-family: var(--font-mono); }
.chain-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--cut); }
.chain-note { margin-top: 10px; font-size: 12px; color: var(--ink-muted); line-height: 1.6; }

/* ============================================
   意图确认卡
   ============================================ */
.intent-card {
  background: var(--paper-warm); border: 1px solid var(--cut);
  border-radius: var(--r-lg); padding: 20px; margin: 4px 0;
}
.intent-title {
  font-family: var(--font-serif); font-size: 14px; font-weight: 600;
  color: var(--ink); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.intent-fields { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; font-size: 13px; color: var(--ink-secondary); }
.intent-fields b { color: var(--ink); font-weight: 600; margin-right: 4px; }
.intent-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================
   首页
   ============================================ */
.home-hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 40px 24px; text-align: center;
}
.home-title {
  font-family: var(--font-serif); font-size: 26px; font-weight: 700;
  color: var(--ink); margin-bottom: 28px; letter-spacing: 0.02em;
}

/* 左栏创作方式选择卡（紧凑竖排） */
.side-create { display: flex; flex-direction: column; gap: 6px; }
.create-tab {
  display: flex; align-items: center; width: 100%;
  padding: 8px 12px; background: var(--paper); border: 1px solid var(--cut);
  border-radius: var(--r-md); cursor: pointer; transition: all var(--dur-fast);
  text-align: left; font-family: var(--font-sans);
}
.create-tab:hover { border-color: var(--cut-strong); background: var(--paper-deep); }
.create-tab.active { border-color: var(--brand-border); background: var(--brand-bg); }
.create-tab-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.create-tab-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.create-tab.active .create-tab-label { color: var(--brand); }
.create-tab-sub { font-size: 11px; color: var(--ink-muted); }

.usage-card {
  width: 100%; max-width: 400px; background: var(--paper-warm);
  border: 1px solid var(--cut); border-radius: var(--r-lg); padding: 16px 20px;
}
.usage-title { font-size: 13px; font-weight: 600; color: var(--ink-secondary); margin-bottom: 10px; }
.usage-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; font-size: 13px; color: var(--ink-secondary); }
.usage-empty { padding: 20px; text-align: center; font-size: 13px; color: var(--ink-muted); }

.usage-wrap { position: relative; display: inline-flex; }
.usage-panel {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: var(--paper); border: 1px solid var(--cut); border-radius: var(--r-lg);
  padding: 16px; min-width: 240px; z-index: 50;
  box-shadow: 0 8px 24px rgba(26,27,30,0.1);
}

/* ============================================
   右栏
   ============================================ */
#rightstack {
  width: var(--right-width); min-width: var(--right-width);
  height: 100%; background: var(--paper-warm);
  border-left: 1px solid var(--cut);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width var(--dur-normal) var(--ease), min-width var(--dur-normal) var(--ease);
}
#rightstack.collapsed { width: 0 !important; min-width: 0 !important; border-left: none; }

/* 右栏拖拽调宽 */
#rightstack { position: relative; }
.rstack-grip {
  position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  cursor: col-resize; z-index: 20;
}
.rstack-grip:hover, .rstack-grip.active { background: var(--brand-border); }
#rightstack.collapsed .rstack-grip { display: none; }
#rightstack.dragging { transition: none; }

.rpane { display: flex; flex-direction: column; height: 100%; }
.rpane-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--cut); flex-shrink: 0;
}
.rpane-title { font-family: var(--font-serif); font-size: 14px; font-weight: 600; color: var(--ink); }
.rpane-body { flex: 1; overflow-y: auto; padding: 20px; }

.empty-state { padding: 32px 16px; text-align: center; font-size: 13px; color: var(--ink-muted); }

/* --- 大纲 --- */
.emotion-strip { display: flex; align-items: flex-end; gap: 2px; height: 40px; margin-bottom: 12px; }
.emotion-bar {
  flex: 1; background: var(--brand-light); border-radius: 2px 2px 0 0;
  opacity: 0.5; min-height: 3px; transition: opacity var(--dur-fast);
}
.emotion-bar:hover { opacity: 0.9; }

.outline-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.progress-bar { flex: 1; height: 3px; background: var(--paper-deep); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand); border-radius: 2px; transition: width 0.5s var(--ease); }
.progress-info { font-size: 11px; color: var(--ink-muted); font-family: var(--font-mono); white-space: nowrap; }

.episode-list { display: flex; flex-direction: column; gap: 2px; }
.ep-row { border: 1px solid var(--cut); border-radius: var(--r-md); overflow: hidden; transition: all var(--dur-fast); }
.ep-row:hover { border-color: var(--cut-strong); }
.ep-row.expanded { border-color: var(--brand-border); background: var(--paper); }

.ep-row-main { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.ep-num { font-size: 12px; font-weight: 500; color: var(--brand); font-family: var(--font-mono); min-width: 48px; }
.ep-row-title { font-size: 13px; font-weight: 500; color: var(--ink); flex: 1; }
.ep-row-meta { display: flex; align-items: center; gap: 8px; }
.ep-expand-mark { font-size: 12px; color: var(--ink-muted); transition: transform var(--dur-fast); }
.ep-row.expanded .ep-expand-mark { transform: rotate(180deg); }

.ep-row-detail { padding: 0 14px 12px; display: none; }
.ep-row.expanded .ep-row-detail { display: block; }

.intensity-mini { width: 48px; height: 4px; background: var(--paper-deep); border-radius: 2px; overflow: hidden; }
.intensity-mini-fill { height: 100%; background: var(--brand); border-radius: 2px; }

.written-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); display: inline-block; transition: background var(--dur-fast); }
.written-dot.on { background: var(--success); }

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
.detail-item { font-size: 12px; color: var(--ink-secondary); line-height: 1.6; }
.detail-item b { color: var(--ink-muted); font-weight: 500; margin-right: 4px; }

/* --- 单集剧本 --- */
.episode-editor { display: flex; flex-direction: column; height: 100%; }

.ep-nav { display: flex; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--cut); overflow-x: auto; margin-bottom: 16px; }
.ep-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer;
  transition: all var(--dur-fast); min-width: 52px;
  background: transparent; border: none; font-family: var(--font-sans);
}
.ep-nav-item:hover { background: var(--paper-deep); }
.ep-nav-item.active { background: var(--brand-bg); }
.ep-nav-num { font-size: 11px; font-weight: 600; color: var(--brand); font-family: var(--font-mono); }
.ep-nav-title { font-size: 10px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 72px; }

.ep-content { flex: 1; overflow-y: auto; padding: 16px 0; }
.ep-title-bar { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }

.duration-meter { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 12px; }
.duration-meter.ok { color: var(--success); }
.duration-meter.short { color: var(--warning); }
.dur-value { font-family: var(--font-mono); font-weight: 500; }
.dur-label { color: var(--ink-muted); }

.ep-actions { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }

.script-scene { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--cut); }
.script-scene:last-child { border-bottom: none; }
.script-scene h4 { font-size: 13px; font-weight: 600; color: var(--ink-secondary); margin-bottom: 12px; }

.script-shot { margin-bottom: 16px; }
.shot-head {
  font-size: 12px; font-weight: 600; color: var(--ink-secondary);
  margin-bottom: 8px; padding: 4px 8px;
  background: var(--paper-deep); border-radius: var(--r-sm); display: inline-block;
}
.scene-meta { font-size: 12px; color: var(--ink-muted); margin-bottom: 4px; }

.script-dialogue { margin-left: 16px; margin-bottom: 10px; }
.speaker { font-size: 12px; font-weight: 600; color: var(--brand); margin-bottom: 2px; }
.emotion-tag { display: inline-block; padding: 1px 6px; background: var(--brand-bg); border-radius: var(--r-xs); font-size: 11px; color: var(--brand); margin-left: 6px; }
.line { font-size: 14px; line-height: 1.8; color: var(--ink); }

.live-shot { padding: 10px 14px; background: var(--paper-deep); border-radius: var(--r-md); margin-bottom: 10px; }
.live-narration { font-style: italic; color: var(--ink-muted); font-size: 13px; margin-bottom: 6px; }
.live-action { font-size: 13px; color: var(--ink-secondary); margin-bottom: 6px; }

.cliffhanger-box {
  margin-top: 12px; padding: 12px 16px;
  background: var(--brand-bg); border-left: 2px solid var(--brand);
  border-radius: 0 4px 4px 0; font-size: 13px; color: var(--ink-secondary); line-height: 1.7;
}
.cliffhanger-box b { color: var(--brand); }

/* --- 质检 --- */
.quality-card {
  background: var(--paper); border: 1px solid var(--cut);
  border-radius: var(--r-lg); padding: 18px; margin-bottom: 12px;
}
.quality-card.repair { border-color: var(--brand-border); background: var(--brand-bg); }
.quality-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.quality-note { font-size: 12.5px; color: var(--ink-muted); margin: 8px 0; font-style: italic; line-height: 1.6; }
.quality-section-title { font-size: 13px; font-weight: 600; color: var(--ink-secondary); margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--cut); }
.quality-list { list-style: none; }
.quality-list li { padding: 5px 0; font-size: 12.5px; color: var(--ink-secondary); border-bottom: 1px solid var(--cut); }
.quality-list li:last-child { border-bottom: none; }

.section-title { font-size: 13px; font-weight: 600; color: var(--ink-secondary); margin: 18px 0 10px; }

.gate-card { border: 1px solid var(--cut); border-radius: var(--r-md); margin-bottom: 10px; overflow: hidden; }
.gate-card.gate-ok { border-color: rgba(74,122,92,0.3); }
.gate-card.gate-warn { border-color: rgba(138,122,58,0.3); }
.gate-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; }
.gate-card.gate-ok .gate-head { background: var(--success-bg); }
.gate-card.gate-warn .gate-head { background: var(--warning-bg); }
.gate-summary { font-size: 13px; font-weight: 500; color: var(--ink); }
.gate-details { padding: 10px 14px; border-top: 1px solid var(--cut); }
.gate-item { padding: 4px 0; font-size: 12.5px; color: var(--ink-secondary); }
.gate-item-error { color: var(--error); }
.gate-item-warn { color: var(--warning); }
.gate-empty { padding: 12px 14px; font-size: 12px; color: var(--ink-muted); text-align: center; }

.verdict { display: inline-block; margin: 8px 0; padding: 6px 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; }
.verdict-pass { background: var(--success-bg); color: var(--success); border: 1px solid rgba(74,122,92,0.2); }
.verdict-fail { background: var(--error-bg); color: var(--error); border: 1px solid rgba(154,74,74,0.2); }

/* --- 悬念账本 --- */
.suspense-summary { font-size: 13px; color: var(--ink-secondary); margin-bottom: 12px; }
.filter-chips { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-chip {
  padding: 4px 10px; font-size: 12px; color: var(--ink-secondary);
  background: var(--paper); border: 1px solid var(--cut); border-radius: var(--r-pill);
  cursor: pointer; transition: all var(--dur-fast); font-family: var(--font-sans);
}
.filter-chip:hover { border-color: var(--cut-strong); }
.filter-chip.active { background: var(--brand-bg); border-color: var(--brand-border); color: var(--brand); }

.table-wrap { border: 1px solid var(--cut); border-radius: var(--r-md); overflow-x: auto; }
.suspense-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.suspense-table th { padding: 8px 12px; text-align: left; font-weight: 600; color: var(--ink-secondary); background: var(--paper-deep); border-bottom: 1px solid var(--cut); font-size: 11px; }
.suspense-table td { padding: 8px 12px; border-bottom: 1px solid var(--cut); color: var(--ink-secondary); }
.suspense-table tr:last-child td { border-bottom: none; }

.suspense-status { display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 500; }
.ss-planted { background: var(--brand-bg); color: var(--brand); }
.ss-developing { background: var(--warning-bg); color: var(--warning); }
.ss-resolved { background: var(--success-bg); color: var(--success); }
.ss-expired { background: var(--error-bg); color: var(--error); }

/* --- 导出 --- */
.export-cards { display: flex; flex-direction: column; gap: 10px; }
.export-card {
  padding: 16px; background: var(--paper); border: 1px solid var(--cut);
  border-radius: var(--r-lg); transition: all var(--dur-fast);
  display: flex; flex-direction: column; gap: 8px;
}
.export-card:hover { border-color: var(--brand-border); }
.export-card h4 { font-size: 14px; font-weight: 600; color: var(--ink); }
.export-card p { font-size: 12.5px; color: var(--ink-muted); line-height: 1.6; }

/* ============================================
   弹窗
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,27,30,0.35);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}

.modal {
  background: var(--paper); border: 1px solid var(--cut); border-radius: var(--r-xl);
  padding: 28px; width: 90%; max-width: 440px;
  box-shadow: 0 16px 48px rgba(26,27,30,0.12);
  animation: modalIn var(--dur-normal) var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.modal-title { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.modal-title .ic { width: 18px; height: 18px; color: var(--brand); }
.modal-desc { font-size: 13.5px; color: var(--ink-secondary); line-height: 1.7; margin-bottom: 20px; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-spacer { flex: 1; }
.modal-error { font-size: 12.5px; color: var(--error); margin-top: 8px; }

.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 9px 12px; background: var(--paper-warm);
  border: 1px solid var(--cut); border-radius: var(--r-md);
  font-size: 14px; color: var(--ink); font-family: var(--font-sans); outline: none;
  transition: border-color var(--dur-fast);
}
.form-input:focus { border-color: var(--brand-border); }
.form-input::placeholder { color: var(--ink-muted); }

/* ============================================
   通用按钮
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; background: var(--brand); border: none; border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; color: #FDFCFB;
  cursor: pointer; transition: background var(--dur-fast); font-family: var(--font-sans);
}
.btn:hover { background: var(--brand-hover); }
.btn .ic { width: 14px; height: 14px; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }

.btn-primary { background: var(--brand); color: #FDFCFB; }
.btn-primary:hover { background: var(--brand-hover); }

.btn-ghost { background: transparent; border: 1px solid var(--cut); color: var(--ink-secondary); }
.btn-ghost:hover { border-color: var(--cut-strong); color: var(--ink); background: var(--paper-deep); }

.btn-danger { background: var(--error); color: #FDFCFB; }
.btn-danger:hover { background: #C23B3B; }

/* ============================================
   Toast
   ============================================ */
.toast, #toast {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%) translateY(-80px);
  padding: 10px 20px; background: var(--ink); color: var(--paper);
  border-radius: var(--r-md); font-size: 13px; z-index: 9999;
  transition: transform var(--dur-normal) var(--ease); pointer-events: none;
}
.toast.show, #toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--error); }

/* ============================================
   快捷动作条
   ============================================ */
#quickActions { display: flex; align-items: center; gap: 8px; padding: 6px 28px; flex-wrap: wrap; }

/* ============================================
   输入区
   ============================================ */
.input-area { padding: 10px 28px 22px; flex-shrink: 0; }
.input-wrap {
  max-width: 700px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--paper-warm); border: 1px solid var(--cut);
  border-radius: var(--r-xl); padding: 12px 16px;
  transition: border-color var(--dur-fast);
}
.input-wrap:focus-within { border-color: var(--brand-border); }

#chatInput {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--ink); font-size: 14px; font-family: var(--font-sans);
  line-height: 1.5; resize: none; min-height: 22px; max-height: 160px;
}
#chatInput::placeholder { color: var(--ink-muted); }

#sendBtn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: var(--brand); border: none;
  border-radius: var(--r-sm); cursor: pointer; color: #FDFCFB; flex-shrink: 0;
  transition: all var(--dur-fast);
}
#sendBtn:hover { background: var(--brand-hover); }
#sendBtn .ic { width: 15px; height: 15px; }
#sendBtn.stop { background: var(--error); }
#sendBtn.stop:hover { background: #C23B3B; }

/* k / v */
.k { color: var(--ink-muted); font-size: 12px; }
.v { color: var(--ink); font-size: 13px; font-weight: 500; }

/* ============================================
   响应式
   ============================================ */
@media (min-width: 1600px) {
  :root { --right-width: 480px; }
  #msgflowInner { max-width: 780px; }
}

@media (max-width: 1200px) {
  :root { --right-width: 340px; }
}

@media (max-width: 900px) {
  #sidebar { position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #menuBtn { display: flex; }
  #rightstack {
    position: fixed; right: 0; top: 0; z-index: 100;
    width: min(400px, 88vw) !important; min-width: 0 !important;
    box-shadow: -8px 0 24px rgba(26,27,30,0.12);
  }
  #rightstack.collapsed { width: 0 !important; box-shadow: none; }
  .rstack-grip { display: none; }
}
