/* styles-scriptmaster.css —— 剧本大师
 * 视觉沿用站内设计变量（浅色绿主色 + 暗色模式），结构对齐参考站三栏工作台。
 * 前缀统一 sm-，避免与站内其他模块冲突。
 */

.sm-page {
  padding: 0 !important;
  height: 100%;
  min-height: 0;
}

.sm-root {
  --sm-side: 248px;
  --sm-index: 232px;
  display: flex;
  gap: 14px;
  height: calc(100vh - 92px);
  min-height: 560px;
  padding: 0 2px 2px;
  box-sizing: border-box;
  font-size: 14px;
  color: var(--ink);
}

/* ---------------- 左栏：历史剧本 ---------------- */
.sm-side {
  width: var(--sm-side);
  flex: 0 0 var(--sm-side);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: width .18s ease, flex-basis .18s ease, opacity .18s;
}
.sm-root.side-fold .sm-side { width: 0; flex-basis: 0; opacity: 0; border-width: 0; }

.sm-side-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.sm-new {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent-grad); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(14, 138, 99, .22);
  transition: transform .12s, box-shadow .16s;
}
.sm-new:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(14, 138, 99, .28); }
.sm-new .sm-ico { font-size: 16px; line-height: 1; }
.sm-search {
  height: 34px; padding: 0 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-soft); color: var(--ink); outline: none;
}
.sm-search:focus { border-color: var(--accent); background: #fff; }

.sm-side-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.sm-list-group {
  font-size: 11px; color: var(--faint); padding: 10px 6px 4px;
  letter-spacing: .04em;
}
.sm-list-item {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 8px 9px; border-radius: 9px; cursor: pointer;
  transition: background .14s;
}
.sm-list-item:hover { background: var(--accent-soft); }
.sm-list-item.is-on { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.sm-list-title {
  flex: 1; min-width: 0; font-size: 13px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sm-list-item.is-on .sm-list-title { color: var(--accent-deep); font-weight: 600; }
.sm-list-acts { display: none; gap: 2px; }
.sm-list-item:hover .sm-list-acts { display: flex; }
.sm-list-acts button {
  width: 22px; height: 22px; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 12px; line-height: 1;
}
.sm-list-acts button:hover { background: #fff; color: var(--accent); }
.sm-side-empty { padding: 26px 10px; text-align: center; color: var(--faint); font-size: 12.5px; line-height: 1.7; }
.sm-side-foot { padding: 6px 12px 10px; border-top: 1px solid var(--line); }
.sm-ghost-sm {
  width: 100%; height: 28px; border: 1px dashed var(--line-strong); border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 12px; cursor: pointer;
}
.sm-ghost-sm:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------- 中栏 ---------------- */
.sm-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sm-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-soft), var(--panel));
}
.sm-top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sm-title-wrap { min-width: 0; flex: 1 1 0; }
.sm-title {
  margin: 0; font-size: 16px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
/* 副标题必须单行省略：否则被顶栏右侧挤压时会一字一行竖排 */
.sm-sub {
  display: block; font-size: 11.5px; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sm-top-left { flex: 1 1 0; min-width: 0; }
.sm-top-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* 创作类型：分段胶囊（爆款故事 / 小说转剧本 / 漫剧脚本 三个同时可见，
   选中项用主题色实心高亮，一眼能看出当前在哪一档、也一眼知道可以切） */
.sm-type-seg {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--panel-soft);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.sm-type-seg::-webkit-scrollbar { display: none; }
.sm-type-opt {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  height: 26px; padding: 0 11px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12.5px; font-weight: 600; font-family: inherit; line-height: 1;
  white-space: nowrap; transition: background .16s, color .16s, box-shadow .16s;
}
.sm-type-opt:hover { color: var(--ink); background: rgba(34, 179, 127, .14); }
.sm-type-opt.is-on {
  color: #fff; background: var(--accent-grad);
  box-shadow: 0 2px 10px rgba(14, 138, 99, .38);
}
.sm-type-opt.is-on:hover { color: #fff; }
.sm-type-opt .sm-type-ico { font-size: 12px; line-height: 1; }
.sm-type-opt.is-on .sm-type-ico { filter: brightness(1.06); }
@media (max-width: 900px) {
  .sm-type-opt { height: 24px; padding: 0 9px; font-size: 12px; }
  .sm-type-opt .sm-type-ico { display: none; }
}

/* 旧的单胶囊样式保留，避免其它地方仍在使用时掉样式 */
.sm-type-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel);
  font-size: 12.5px; color: var(--ink-soft);
  transition: border-color .15s, color .15s;
}
.sm-type-chip:hover { border-color: var(--accent); color: var(--accent); }

.sm-model { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
/* 模型选择统一走 YK.capsuleSelect（.mb-chip 胶囊 + 深色菜单），
   这里只约束宽度，让它和顶部其它 chip 对齐，不再出现原生白色下拉。 */
.sm-model-cap { display: inline-flex; min-width: 132px; max-width: 190px; }
.sm-model-cap .yk-capsule { width: 100%; }
.sm-model-cap .mb-chip { width: 100%; height: 32px; border-radius: 8px; font-size: 12.5px; }
.sm-model-cap .mb-chip-val { max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-model-empty { font-size: 12px; color: var(--danger); }

.sm-icon-btn {
  width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel); color: var(--ink-soft); cursor: pointer; font-size: 14px;
}
.sm-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.sm-only-mobile { display: none; }

/* 三步流程条 */
.sm-steps {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel); overflow-x: auto;
}
.sm-step {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 6px 12px 6px 7px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-soft);
  text-align: left; transition: all .16s;
}
.sm-step:hover { border-color: var(--accent); }
.sm-step-no {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--line-strong); color: #fff; font-size: 11px; font-weight: 700;
}
.sm-step-txt { display: flex; flex-direction: column; line-height: 1.25; }
.sm-step-txt b { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.sm-step-txt i { font-size: 10.5px; color: var(--faint); font-style: normal; }
.sm-step.is-on { border-color: var(--accent); background: var(--accent-soft); }
.sm-step.is-on .sm-step-no { background: var(--accent); }
.sm-step.is-on .sm-step-txt b { color: var(--accent-deep); }
.sm-step.is-done .sm-step-no { background: var(--accent); opacity: .55; }
.sm-step.is-done .sm-step-txt b { color: var(--muted); }
.sm-step-line { width: 14px; height: 1px; background: var(--line-strong); flex-shrink: 0; }

/* 一次成稿模式：步骤条收成一条状态 + 切换入口（风格跟胶囊一致） */
.sm-one {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  padding: 6px 8px 6px 7px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent-soft);
}
.sm-one-badge {
  flex-shrink: 0; padding: 3px 9px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .5px;
}
.sm-one-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sm-one-txt b { font-size: 12.5px; color: var(--accent-deep); font-weight: 600; }
.sm-one-txt i { font-size: 10.5px; color: var(--muted); font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-one-toggle {
  flex-shrink: 0; margin-left: auto; height: 26px; padding: 0 11px;
  border-radius: 999px; cursor: pointer; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--muted);
  transition: all .16s;
}
.sm-one-toggle:hover { border-color: var(--accent); color: var(--accent-deep); }
.sm-steps > .sm-one-toggle { margin-left: auto; }

/* ===== 模型胶囊的能力标签（速度 / 能否读图）===== */
/* 只作用于带 tag 的胶囊（目前只有剧本大师的模型选择），不影响别处用法 */
.yk-cap-trig-tag { font-size: 11px; line-height: 1; flex: 0 0 auto; }
.sm-model .mb-chip-val { max-width: 146px; }
.mb-chip-menu-item.has-tags { display: flex; align-items: center; gap: 6px; }
.mb-chip-menu-item.has-tags .yk-cap-name {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.yk-cap-tag {
  flex: 0 0 auto; padding: 1px 6px; border-radius: 999px;
  font-size: 10.5px; line-height: 1.6; white-space: nowrap;
  border: 1px solid transparent;
}
.yk-cap-tag.is-fast { color: #5fae82; background: rgba(95, 174, 130, .14); border-color: rgba(95, 174, 130, .3); }
.yk-cap-tag.is-think { color: #c99850; background: rgba(201, 152, 80, .14); border-color: rgba(201, 152, 80, .3); }
.yk-cap-tag.is-slow { color: #c17070; background: rgba(193, 112, 112, .14); border-color: rgba(193, 112, 112, .3); }
.yk-cap-eye {
  flex: 0 0 auto; font-size: 10px; padding: 1px 5px; border-radius: 999px;
  color: #9a7b7b; background: rgba(154, 123, 123, .12); white-space: nowrap;
}
html[data-theme="light"] .mb-chip-menu-item.is-sel .yk-cap-tag,
html[data-theme="dark"] .mb-chip-menu-item.is-sel .yk-cap-tag { filter: brightness(1.15); }

/* 一次成稿正文里的分段标记与 json 代码块 */
.sm-md .sm-sec {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 10px; font-size: 12.5px; font-weight: 700; color: var(--accent-deep);
}
.sm-md .sm-sec::before, .sm-md .sm-sec::after {
  content: ''; height: 1px; background: var(--line); flex: 1;
}
.sm-md .sm-sec span {
  flex-shrink: 0; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent);
}
.sm-md .sm-code {
  margin: 10px 0; padding: 12px 14px; border-radius: 10px;
  background: var(--panel-soft); border: 1px solid var(--line);
  font-size: 11.5px; line-height: 1.6; overflow: auto; max-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink-soft);
}
.sm-md .sm-code code { white-space: pre; color: inherit; background: none; padding: 0; }

/* 分镜 JSON 折叠条：默认只占一行，点开才占版面 */
.sm-md .sm-fold {
  margin: 12px 0 2px; border: 1px dashed var(--line-strong); border-radius: 10px;
  background: var(--panel-soft); overflow: hidden;
}
.sm-md .sm-fold[open] { border-style: solid; border-color: var(--line); }
.sm-md .sm-fold > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 8px 12px; list-style: none; user-select: none;
  font-size: 11.5px; color: var(--muted); transition: background .16s;
}
.sm-md .sm-fold > summary::-webkit-details-marker { display: none; }
.sm-md .sm-fold > summary::marker { content: ''; }
.sm-md .sm-fold > summary:hover { background: var(--accent-soft); color: var(--accent-deep); }
.sm-md .sm-fold > summary b {
  font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--panel); flex-shrink: 0;
}
.sm-md .sm-fold > summary i {
  font-style: normal; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sm-md .sm-fold-cue { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sm-md .sm-fold-cue::after {
  content: ''; width: 6px; height: 6px; margin-top: -3px;
  border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg); transition: transform .18s;
}
.sm-md .sm-fold[open] .sm-fold-cue::after { margin-top: 3px; transform: rotate(-135deg); }
.sm-md .sm-fold > .sm-code { margin: 0; border: none; border-top: 1px solid var(--line); border-radius: 0; max-height: 300px; }

/* 消息区 */
.sm-scroll { flex: 1; overflow-y: auto; min-height: 0; background: var(--bg); }
.sm-thread { max-width: 860px; margin: 0 auto; padding: 20px 18px 28px; display: flex; flex-direction: column; gap: 18px; }

.sm-msg { display: flex; gap: 10px; }
.sm-msg-user { justify-content: flex-end; }
.sm-avatar {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--line-strong);
  overflow: hidden;
}
.sm-avatar-ai { background: var(--accent-grad); }

.sm-bubble {
  max-width: min(78%, 640px); padding: 10px 14px;
  background: var(--accent-grad); color: #fff;
  border-radius: 14px 14px 4px 14px;
  font-size: 13.5px; line-height: 1.65; word-break: break-word;
}
.sm-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.sm-chip {
  font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: rgba(255, 255, 255, .22); color: #fff;
}
.sm-ai-body { flex: 1; min-width: 0; }
.sm-md { font-size: 13.8px; line-height: 1.78; color: var(--ink-soft); word-break: break-word; }
.sm-md > *:first-child { margin-top: 0; }
.sm-md h2, .sm-md h3, .sm-md h4, .sm-md h5 {
  margin: 16px 0 8px; color: var(--ink); line-height: 1.4; font-weight: 700;
}
.sm-md h2 { font-size: 16px; }
.sm-md h3 { font-size: 15px; }
.sm-md h4, .sm-md h5 { font-size: 14px; }
.sm-md p { margin: 6px 0; }
.sm-md ul { margin: 6px 0; padding-left: 18px; }
.sm-md li { margin: 3px 0; }
.sm-md ul.sm-ol { list-style: none; padding-left: 2px; }
.sm-md ul.sm-ol li b { color: var(--accent); margin-right: 3px; }
/* 「格式化成片」是这一步的主操作，视觉上要压过复制/删除 */
.sm-msg-acts .sm-format-btn {
  height: 26px; padding: 0 12px; border-radius: 7px; margin-left: 2px;
  background: var(--accent-grad); color: #fff; font-weight: 600; font-size: 11.5px;
  box-shadow: 0 2px 8px rgba(14, 138, 99, .22);
}
.sm-msg-acts .sm-format-btn:hover { color: #fff; opacity: .92; }
.sm-md blockquote {
  margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--ink-soft);
}
.sm-md blockquote p { margin: 2px 0; }
.sm-md code {
  padding: 1px 5px; border-radius: 5px; font-size: 12.5px;
  background: var(--panel-soft); border: 1px solid var(--line); color: var(--accent-deep);
}
.sm-md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.sm-md strong { color: var(--ink); }
.sm-md a { color: var(--accent); }

.sm-think {
  margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-soft); overflow: hidden;
}
.sm-think-h {
  display: flex; align-items: center; gap: 6px; padding: 7px 11px;
  font-size: 12px; color: var(--muted); cursor: pointer; user-select: none;
}
.sm-think-h i { font-style: normal; color: var(--accent); }
.sm-think-b {
  display: none; padding: 0 12px 10px; font-size: 12.4px; line-height: 1.7;
  color: var(--muted); white-space: pre-wrap; max-height: 260px; overflow-y: auto;
}
.sm-think.is-open .sm-think-b { display: block; }

.sm-typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.sm-typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .35;
  animation: sm-blink 1.1s infinite;
}
.sm-typing i:nth-child(2) { animation-delay: .18s; }
.sm-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes sm-blink { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }

.sm-msg-acts { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--faint); }
.sm-msg-acts button {
  border: 0; background: transparent; color: var(--muted); font-size: 11.5px;
  cursor: pointer; padding: 2px 0;
}
.sm-msg-acts button:hover { color: var(--accent); }

/* 空状态 */
.sm-welcome { padding: 26px 6px 10px; text-align: center; }
.sm-welcome-ico { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.sm-welcome h2 { margin: 0 0 8px; font-size: 20px; color: var(--ink); }
.sm-welcome > p { margin: 0 auto 22px; max-width: 520px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.sm-guides { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.sm-guide-card {
  position: relative; padding: 16px 14px 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
  text-align: left; transition: all .16s;
}
.sm-guide-card:hover { border-color: var(--accent); box-shadow: 0 8px 22px rgba(14, 138, 99, .1); transform: translateY(-2px); }
.sm-guide-no {
  position: absolute; top: -9px; left: 14px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent-grad); color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.sm-guide-card b { display: block; font-size: 13.5px; color: var(--ink); margin-bottom: 5px; }
.sm-guide-card p { margin: 0 0 10px; font-size: 12px; color: var(--muted); line-height: 1.6; min-height: 38px; }
.sm-guide-btn {
  width: 100%; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  font-size: 12.5px; font-weight: 600;
}
.sm-guide-btn:hover { background: var(--accent); color: #fff; }

.sm-samples { text-align: left; }
.sm-samples-t { display: block; font-size: 11.5px; color: var(--faint); margin-bottom: 8px; }
.sm-sample {
  display: block; width: 100%; text-align: left; margin-bottom: 7px;
  padding: 9px 12px; border-radius: 9px; cursor: pointer;
  border: 1px dashed var(--line-strong); background: var(--panel);
  color: var(--ink-soft); font-size: 12.6px; line-height: 1.5;
  transition: all .15s;
}
.sm-sample:hover { border-color: var(--accent); border-style: solid; color: var(--accent-deep); background: var(--accent-soft); }

/* 分镜板 */
.sm-board {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); overflow: hidden;
}
.sm-board-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px; border-bottom: 1px solid var(--line); background: var(--panel-soft);
  flex-wrap: wrap;
}
.sm-board-head b { font-size: 13.5px; color: var(--ink); }
.sm-board-head span { font-size: 11.5px; color: var(--muted); margin-left: 8px; }
.sm-board-acts { display: flex; gap: 6px; }
.sm-mini {
  height: 28px; padding: 0 10px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel);
  color: var(--ink-soft); font-size: 12px;
}
.sm-mini:hover { border-color: var(--accent); color: var(--accent); }
.sm-mini-primary { background: var(--accent-grad); border-color: transparent; color: #fff; }
.sm-mini-primary:hover { color: #fff; opacity: .92; }
.sm-board-sum { margin: 10px 13px 0; font-size: 12.5px; color: var(--muted); }
.sm-board-table-wrap { overflow-x: auto; padding: 6px 0 8px; }
.sm-board-table { width: 100%; border-collapse: collapse; font-size: 12.6px; }
.sm-board-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--faint);
  padding: 6px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.sm-board-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sm-board-table tr:last-child td { border-bottom: 0; }
.sm-td-no { color: var(--accent); font-weight: 700; width: 34px; }
.sm-td-sec { color: var(--muted); width: 46px; white-space: nowrap; }
.sm-td-scene { font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.sm-td-meta { font-size: 11px; color: var(--faint); margin-bottom: 5px; }
.sm-td-visual { color: var(--ink-soft); line-height: 1.65; }
.sm-td-dialogue {
  margin-top: 6px; padding: 6px 9px; border-left: 2px solid var(--gold);
  background: #fdf8ec; border-radius: 0 6px 6px 0; color: var(--ink-soft); line-height: 1.6;
}

/* ---------------- 输入区 ---------------- */
.sm-composer { border-top: 1px solid var(--line); padding: 10px 16px 8px; background: var(--panel); }
.sm-attach { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.sm-attach:empty { display: none; }
.sm-attach-item {
  position: relative; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 7px 3px 3px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-soft); font-size: 11.5px; color: var(--ink-soft); max-width: 150px;
}
.sm-attach-item img { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; }
.sm-attach-item b { font-size: 16px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.sm-attach-item em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-attach-item button {
  border: 0; background: transparent; color: var(--faint); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 1px;
}
.sm-attach-item button:hover { color: var(--danger); }
.sm-attach-item.is-up { opacity: .55; }

/* 素材识别状态：让「AI 看到了什么」在界面上一眼可见 */
.sm-attach-badge {
  font-style: normal; font-size: 10.5px; line-height: 1; padding: 3px 6px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap;
}
.sm-attach-badge.is-wait { animation: smPulse 1.2s ease-in-out infinite; }
.sm-attach-badge.is-ok { color: #1a7f5a; border-color: rgba(26,127,90,.45); background: rgba(26,127,90,.10); }
.sm-attach-badge.is-fail { color: var(--danger); border-color: rgba(200,60,60,.4); }
@keyframes smPulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

.sm-vision {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 0 0 8px; padding: 7px 9px; border-radius: 8px;
  background: var(--panel-soft, rgba(120,120,140,.07)); border: 1px dashed var(--line-strong);
}
.sm-vision[hidden] { display: none; }
.sm-vision-t { font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: .02em; }
.sm-vision-item {
  font-size: 11.5px; line-height: 1.5; color: var(--ink-soft);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sm-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--panel-soft); transition: border-color .16s, box-shadow .16s;
}
.sm-box:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(14, 138, 99, .08); }
.sm-plus {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel);
  color: var(--ink-soft); font-size: 18px; line-height: 1;
}
.sm-plus:hover { border-color: var(--accent); color: var(--accent); }
.sm-input {
  flex: 1; min-height: 82px; max-height: 240px; padding: 9px 2px;
  border: 0; background: transparent; resize: none; outline: none;
  font-size: 13.8px; line-height: 1.6; color: var(--ink); font-family: inherit;
}
.sm-input::placeholder { color: var(--faint); }
.sm-send-wrap { display: flex; gap: 6px; align-items: center; }
.sm-send {
  height: 34px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent-grad); color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 3px 10px rgba(14, 138, 99, .2);
}
.sm-send:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.sm-stop {
  height: 34px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--danger); background: transparent; color: var(--danger); font-size: 13px;
}
.sm-stop:hover { background: var(--danger); color: #fff; }
.sm-tips {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 6px; padding-bottom: 2px; font-size: 11px; color: var(--faint);
  line-height: 1.4; min-height: 15px;
}

/* ---------------- 右栏：消息索引 ---------------- */
.sm-index {
  width: 0; flex: 0 0 0; opacity: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: width .18s ease, flex-basis .18s ease, opacity .18s;
}
.sm-root.index-open .sm-index { width: var(--sm-index); flex-basis: var(--sm-index); opacity: 1; }
.sm-index-head {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 8px;
  border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}
.sm-index-tabs { display: flex; gap: 4px; }
.sm-index-tabs button {
  flex: 1; height: 26px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-soft);
  font-size: 11.5px; color: var(--muted);
}
.sm-index-tabs button.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }
.sm-index-body { flex: 1; overflow-y: auto; padding: 6px 8px 8px; }
.sm-idx-item { padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.sm-idx-item:hover { background: var(--accent-soft); }
.sm-idx-item b { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.sm-idx-item i { display: block; font-style: normal; font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1400px) {
  /* 先让「模型」两个字让位，胶囊本身保留 */
  .sm-model > span { display: none; }
}
@media (max-width: 1320px) {
  /* 类型胶囊收窄：去掉 emoji 图标，只留文字 */
  .sm-type-opt { padding: 0 9px; font-size: 12px; }
  .sm-type-opt .sm-type-ico { display: none; }
  .sm-model-cap { min-width: 116px; max-width: 150px; }
}
@media (max-width: 1200px) {
  /* 一排放不下时改成两排：标题一排、控件一排，
     三个类型胶囊永远完整可见，也不会把标题挤成一条缝 */
  .sm-top { flex-wrap: wrap; row-gap: 8px; }
  .sm-top-left { flex: 1 1 100%; }
  .sm-top-right { flex: 1 1 100%; justify-content: flex-start; flex-wrap: wrap; row-gap: 6px; }
  .sm-type-opt { padding: 0 10px; font-size: 12px; }
  .sm-model-cap { min-width: 112px; max-width: 160px; }
}
@media (max-width: 1180px) {
  .sm-root.index-open .sm-index { display: none; }
}
@media (max-width: 900px) {
  .sm-root { --sm-side: 220px; gap: 0; height: calc(100vh - 76px); }
  .sm-root .sm-side {
    position: absolute; z-index: 30; top: 0; bottom: 0; left: 0;
    width: 250px; flex-basis: 250px; opacity: 1; border-radius: 0 12px 12px 0;
    box-shadow: 0 12px 40px rgba(20, 40, 32, .18);
    transform: translateX(-102%); transition: transform .2s;
  }
  .sm-root.side-open .sm-side { transform: none; }
  .sm-root.side-fold .sm-side { width: 250px; flex-basis: 250px; opacity: 1; border-width: 1px; }
  .sm-only-mobile { display: inline-flex; align-items: center; justify-content: center; }
  .sm-guides { grid-template-columns: 1fr; }
  .sm-title { max-width: 160px; }
  .sm-sub { display: none; }
  .sm-model span { display: none; }
  .sm-model-cap { min-width: 104px; max-width: 124px; }
}

/* 暗色模式 */
[data-theme="dark"] .sm-td-dialogue { background: rgba(201, 143, 31, .1); }
[data-theme="dark"] .sm-bubble { color: #fff; }
[data-theme="dark"] .sm-box:focus-within { background: var(--panel); }
[data-theme="dark"] .sm-list-acts button:hover { background: rgba(255, 255, 255, .08); }

/* AI 输出中的外部链接：渲染为不可点的灰色文本，避免跳转到别的站点 */
.sm-md .md-extlink, .md-extlink { color: var(--text-muted, #8a8a8a); cursor: default; }
