:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e6e8ec;
  --line-soft: #f0f1f4;
  --text: #1a1d24;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --accent: #4f46e5;
  --accent-weak: #eef2ff;
  --accent-line: #c7d2fe;
  --danger: #dc2626;
  --danger-weak: #fef2f2;
  --ok: #059669;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 2px 4px rgba(16, 24, 40, 0.04), 0 12px 32px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6d9df; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c2c6ce; background-clip: content-box; }

.app {
  display: grid;
  grid-template-columns: 276px 1fr;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- 侧边栏 ---------- */

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.brand h1 { margin: 0; font-size: 14px; font-weight: 650; }
.brand p { margin: 1px 0 0; font-size: 11px; color: var(--muted-2); }

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.provider-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 10px;
  min-height: 0;
}

.provider {
  position: relative;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 4px;
}
.provider:hover { background: #f7f8fa; }
.provider.active { background: var(--accent-weak); border-color: var(--accent-line); }
.provider .p-name {
  font-weight: 550;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 22px;
}
.provider .p-sub {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.provider .p-edit {
  position: absolute;
  top: 8px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--muted-2);
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
}
.provider:hover .p-edit { opacity: 1; }
.provider .p-edit:hover { background: #eceef2; color: var(--text); }

.badge {
  display: inline-block;
  padding: 0 5px;
  height: 16px;
  line-height: 16px;
  border-radius: 4px;
  font-size: 10px;
  font-family: -apple-system, "Microsoft YaHei", sans-serif;
  background: #eef0f3;
  color: #5b6270;
}
.badge.anthropic { background: #fdf0e8; color: #b45309; }
.badge.openai { background: #e8f6f0; color: #047857; }

.side-foot { padding: 10px; border-top: 1px solid var(--line-soft); }
.side-foot .link {
  display: block;
  margin-top: 6px;
  text-align: center;
  text-decoration: none;
  line-height: 1.6;
}

.empty-hint {
  padding: 18px 12px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.8;
}

/* ---------- 主区 ---------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.topbar {
  height: 58px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.model-picker { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.model-picker label { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.model-picker input {
  width: 100%;
  max-width: 340px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.model-picker input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.status {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 20px;
  background: #f1f2f5;
  color: var(--muted);
  white-space: nowrap;
}
.status.busy { background: var(--accent-weak); color: var(--accent); }
.status.error { background: var(--danger-weak); color: var(--danger); }
.status.ok { background: #ecfdf5; color: var(--ok); }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px 8px;
  min-height: 0;
  scroll-behavior: smooth;
}

.chat-inner { max-width: 820px; margin: 0 auto; }

.msg { display: flex; gap: 10px; margin-bottom: 20px; }
.msg .avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  background: #eceef2;
  color: #5b6270;
  margin-top: 2px;
}
.msg.assistant .avatar { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.msg .body { min-width: 0; flex: 1; }

.msg.user .md {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  display: inline-block;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}

.md { word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h3, .md h4, .md h5 { margin: 18px 0 8px; line-height: 1.4; }
.md h3 { font-size: 16px; }
.md h4 { font-size: 15px; }
.md h5, .md h6 { font-size: 14px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md a { color: var(--accent); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: #f2f3f6;
  padding: 1px 5px;
  border-radius: 4px;
}
.md blockquote {
  margin: 0 0 10px;
  padding: 2px 12px;
  border-left: 3px solid var(--accent-line);
  color: var(--muted);
}
.md hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.md table { border-collapse: collapse; margin: 0 0 10px; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 9px; }
.md th { background: #f7f8fa; }

.code {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin: 0 0 10px;
  background: #fbfbfd;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: #f4f5f8;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}
.code pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
}
.code pre code { background: none; padding: 0; font-size: inherit; }
.copy {
  font-size: 11px;
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 5px;
}
.copy:hover { background: #e9ebf0; color: var(--text); }

.thinking {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  margin-bottom: 10px;
  background: #fcfcfe;
  font-size: 12.5px;
  color: var(--muted);
}
.thinking summary { cursor: pointer; color: var(--muted-2); font-size: 12px; }
.thinking .think-body { white-space: pre-wrap; margin-top: 6px; }

.msg-meta {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 6px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.msg-meta button { color: var(--muted-2); font-size: 11px; padding: 0; }
.msg-meta button:hover { color: var(--accent); }

.err-box {
  border: 1px solid #fecaca;
  background: var(--danger-weak);
  color: #b91c1c;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  white-space: pre-wrap;
}
.err-box .hint { color: #9f1239; opacity: 0.75; font-size: 11.5px; margin-top: 4px; font-family: ui-monospace, monospace; }

.caret {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--accent);
  vertical-align: -2px;
  border-radius: 1px;
  animation: blink 1s steps(2, start) infinite;
  margin-left: 2px;
}
@keyframes blink { to { visibility: hidden; } }

/* ---------- 输入区 ---------- */

.composer { flex: 0 0 auto; padding: 10px 18px 16px; }
.composer .box {
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 12px 8px;
  transition: border-color 0.15s;
}
.composer .box:focus-within { border-color: var(--accent-line); }
.composer textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  max-height: 220px;
  min-height: 24px;
  line-height: 1.6;
  background: transparent;
  padding: 2px 2px 6px;
}
.composer-bar { display: flex; align-items: center; gap: 10px; }
.params { display: flex; gap: 12px; align-items: center; flex: 1; font-size: 11.5px; color: var(--muted); }
.params label { display: flex; align-items: center; gap: 5px; }
.params input {
  width: 58px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfbfd;
  outline: none;
  font-size: 11.5px;
}
.params input:focus { border-color: var(--accent-line); background: #fff; }

.primary, .ghost, .danger, .mini {
  border-radius: 8px;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.primary {
  background: var(--accent);
  color: #fff;
  padding: 7px 16px;
  font-weight: 550;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3);
}
.primary:hover { background: #4338ca; }
.primary:disabled { background: #c7cbd6; box-shadow: none; cursor: not-allowed; }
.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
}
.ghost:hover { background: #f7f8fa; color: var(--text); }
.ghost.wide { width: 100%; padding: 7px 10px; }
.danger { background: var(--danger-weak); color: var(--danger); padding: 7px 14px; font-weight: 550; border: 1px solid #fecaca; }
.danger:hover { background: #fee2e2; }
.mini { font-size: 11px; color: var(--accent); padding: 2px 7px; }
.mini:hover { background: var(--accent-weak); }
.hidden { display: none !important; }

/* ---------- 弹窗 ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.34);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.22);
  animation: pop 0.16s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.modal-head .x { color: var(--muted-2); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.modal-head .x:hover { background: #f2f3f6; color: var(--text); }
.modal-body { padding: 16px 18px; }
.modal-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line-soft);
}
.modal-foot .spacer { flex: 1; }

.field { margin-bottom: 13px; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.field textarea { resize: vertical; min-height: 60px; }
.field .tip { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.import-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.import-item:hover { border-color: var(--accent-line); background: #fcfcff; }
.import-item.disabled { opacity: 0.6; }
.import-item input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); }
.import-item .t { font-weight: 550; font-size: 13px; }
.import-item .d { font-size: 11px; color: var(--muted-2); font-family: ui-monospace, monospace; word-break: break-all; }

.test-result { font-size: 12px; padding: 8px 10px; border-radius: 8px; margin-bottom: 12px; }
.test-result.ok { background: #ecfdf5; color: #047857; }
.test-result.bad { background: var(--danger-weak); color: #b91c1c; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #1f2430;
  color: #fff;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 80;
  animation: fade 0.15s ease;
  max-width: 70vw;
}

/* ---------- 欢迎页 ---------- */

.welcome {
  max-width: 760px;
  margin: 8vh auto 0;
  text-align: center;
  color: var(--muted);
}
.welcome h2 { font-size: 20px; color: var(--text); margin: 0 0 6px; }
.welcome p { margin: 0 0 20px; font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; text-align: left; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.card b { display: block; font-size: 13px; margin-bottom: 2px; }
.card span { font-size: 11.5px; color: var(--muted-2); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; }
  .chat { padding: 14px 12px 6px; }
}

/* ---------- 视频工作台 ---------- */

.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.video-scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 20px 18px 28px; }
.video-inner { max-width: 820px; margin: 0 auto; }

.badge.video { background: #eef2ff; color: #4338ca; }

.vpanel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 22px;
}
.vpanel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.vpanel-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.vhint { font-size: 11.5px; color: var(--muted-2); font-family: ui-monospace, monospace; }

.vpanel > textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  line-height: 1.6;
  background: #fcfcfd;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.vpanel > textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); background: #fff; }

.vparams { display: flex; gap: 16px; align-items: center; margin-top: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.vparams label { display: flex; align-items: center; gap: 6px; }
.vparams input, .vparams select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  outline: none;
  font-size: 12px;
}
.vparams input { width: 64px; }
.vparams input:focus, .vparams select:focus { border-color: var(--accent-line); }
.unit { color: var(--muted-2); }

.vadv { margin-top: 12px; }
.vadv summary { font-size: 12px; color: var(--accent); cursor: pointer; list-style: none; }
.vadv summary::-webkit-details-marker { display: none; }
.vadv summary::before { content: '▸ '; }
.vadv[open] summary::before { content: '▾ '; }
.vadv .field { margin-top: 10px; }
.vadv .field label { display: block; font-size: 11.5px; color: var(--muted-2); margin-bottom: 4px; }
.vadv textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  outline: none;
  resize: vertical;
  font-size: 12.5px;
}
.vadv textarea:focus { border-color: var(--accent-line); }

.vfoot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.vnote { flex: 1; font-size: 11.5px; color: var(--muted-2); line-height: 1.5; }

.vtasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.vtasks-head b { color: var(--text); font-weight: 600; }

.vitem {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.vitem.done { border-color: #d1fae5; }
.vitem.failed { border-color: #fecaca; background: #fffbfb; }

.vhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.vstatus { font-size: 11.5px; padding: 2px 9px; border-radius: 20px; background: #f1f2f5; color: var(--muted); }
.vstatus.pending, .vstatus.running { background: var(--accent-weak); color: var(--accent); }
.vstatus.done { background: #ecfdf5; color: var(--ok); }
.vstatus.failed { background: var(--danger-weak); color: var(--danger); }
.vmeta { font-size: 11px; color: var(--muted-2); font-family: ui-monospace, monospace; }

.vprompt { font-size: 13px; color: #374151; white-space: pre-wrap; word-break: break-word; margin-bottom: 8px; }

.vbar { height: 4px; background: #eef0f3; border-radius: 3px; overflow: hidden; margin: 8px 0; }
.vbar > i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #a855f7); border-radius: 3px; transition: width 0.4s ease; }

.vitem video {
  width: 100%;
  max-height: 420px;
  border-radius: 10px;
  background: #0b0c10;
  display: block;
  margin: 6px 0 10px;
}

.vactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vactions a, .vactions button {
  font-size: 11.5px;
  color: var(--muted);
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
  background: #fff;
}
.vactions a:hover, .vactions button:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-weak); }
.vactions .del:hover { color: var(--danger); border-color: #fecaca; background: var(--danger-weak); }
.verr { font-size: 12px; color: #b91c1c; background: var(--danger-weak); border: 1px solid #fecaca; border-radius: 8px; padding: 7px 10px; margin-bottom: 8px; white-space: pre-wrap; }
.vraw { margin-top: 8px; font-size: 11px; }
.vraw summary { color: var(--muted-2); cursor: pointer; }
.vraw pre { background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; padding: 8px; overflow-x: auto; margin: 6px 0 0; font-size: 11px; }


/* ---------- 视图导航与创作工作台（对话/视频/图片/人设） ---------- */

.view-tabs {
  display: flex;
  flex: none;
  gap: 2px;
  background: #f1f2f5;
  border-radius: 10px;
  padding: 2px;
}
.view-tabs button {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.view-tabs button:hover { color: var(--text); }
.view-tabs button.active {
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 160px;
  height: 26px;
  padding: 0 10px;
  border-radius: 14px;
  background: var(--accent-weak);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip:hover { background: #e0e7ff; }

.badge.img { background: #eff6ff; color: #1d4ed8; }

/* 图片生成 */

.img-list {
  display: grid;
  gap: 14px;
  padding: 14px 16px 20px;
  overflow-y: auto;
}
.irec {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.img-grid a {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: #f7f8fa;
}
.img-grid img {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
  transition: transform 0.2s;
}
.img-grid a:hover img { transform: scale(1.03); }

/* 人设形象 */

.persona-wrap {
  display: grid;
  grid-template-columns: 268px 1fr;
  height: 100%;
  min-height: 0;
}
.ps-col {
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ps-col .vpanel-head {
  padding: 14px 14px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.ps-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}
.ps-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 4px;
}
.ps-item:hover { background: #f7f8fa; }
.ps-item.editing { background: var(--accent-weak); border-color: var(--accent-line); }
.ps-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 15px;
  overflow: hidden;
  flex: none;
}
.ps-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ps-main { min-width: 0; flex: 1; }
.ps-name {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ps-on {
  font-style: normal;
  font-size: 10px;
  padding: 0 5px;
  height: 15px;
  line-height: 15px;
  border-radius: 4px;
  background: #e8f6f0;
  color: #047857;
  flex: none;
}
.ps-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ps-editor {
  overflow-y: auto;
  padding: 18px 22px 26px;
  min-height: 0;
}
.ps-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.ps-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.ps-actions { margin-left: auto; display: flex; gap: 8px; }

.ps-form { display: grid; gap: 2px; max-width: 760px; }
.ps-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ps-form textarea, .ps-form input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  font-size: 13px;
  line-height: 1.65;
  resize: vertical;
}
.ps-form textarea:focus, .ps-form input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.ps-preview {
  margin-top: 16px;
  max-width: 760px;
}
.ps-preview label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.ps-preview textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #fafbfc;
  font-size: 12px;
  line-height: 1.7;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  resize: vertical;
}

@media (max-width: 900px) {
  .persona-wrap { grid-template-columns: 1fr; }
  .ps-col { display: none; }
  .view-tabs button { padding: 5px 8px; font-size: 11.5px; }
}

/* ---- 人设档案增强 ---- */
.ps-head-btns { display: flex; gap: 6px; }
.ps-search-wrap { padding: 8px 10px 4px; display: grid; gap: 6px; }
.ps-search, .ps-cat-filter {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 12px; outline: none; background: #fff; color: var(--ink);
}
.ps-search:focus, .ps-cat-filter:focus { border-color: var(--accent-line); }
.ps-tag {
  font-style: normal; font-size: 9.5px; padding: 1px 5px; margin-right: 4px;
  border-radius: 4px; background: var(--accent-weak); color: var(--accent); flex: none;
}
.ps-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; flex-wrap: wrap; }
.ps-tab {
  padding: 8px 14px; border: none; background: transparent; cursor: pointer;
  font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ps-tab:hover { color: var(--ink); }
.ps-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.ps-pane { display: grid; gap: 2px; }
.ps-pane.hidden, .ps-pane[hidden] { display: none; }
.ps-pane-hint { font-size: 12px; color: var(--muted); margin: 0 0 10px; line-height: 1.7; }
.ps-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* 模板条 */
.ps-templates { margin-bottom: 16px; padding: 12px; border: 1px dashed var(--accent-line); border-radius: 12px; background: var(--accent-weak); }
.ps-templates-h { font-size: 12.5px; font-weight: 650; margin-bottom: 10px; }
.ps-templates-h span { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 11px; }
.ps-template-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ps-template {
  display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
  transition: transform .15s, box-shadow .15s;
}
.ps-template:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.06); border-color: var(--accent-line); }
.ps-template b { font-size: 12.5px; }
.ps-template i { font-style: normal; font-size: 10.5px; color: var(--muted); }

/* 头像 */
.ps-avatar-row { display: flex; gap: 12px; align-items: center; }
.ps-avatar-lg {
  width: 64px; height: 64px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font-size: 28px; background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; overflow: hidden;
}
.ps-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.ps-avatar-ops { flex: 1; display: grid; gap: 6px; }
.ps-upload-btn {
  display: inline-flex; align-items: center; justify-content: center; width: fit-content;
  padding: 5px 12px; font-size: 11.5px; cursor: pointer; border: 1px solid var(--line);
  border-radius: 7px; color: var(--ink); background: #fff;
}
.ps-upload-btn:hover { border-color: var(--accent-line); }
.ps-upload-btn.sm { padding: 3px 8px; font-size: 10.5px; }

/* 三视图 */
.ps-views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ps-view { display: grid; gap: 6px; justify-items: center; }
.ps-view-box {
  width: 100%; aspect-ratio: 3/4; border: 1px dashed var(--line); border-radius: 10px;
  background: var(--panel); display: grid; place-items: center; overflow: hidden;
  text-align: center; font-size: 11px; color: var(--muted); line-height: 1.6;
}
.ps-view-box img { width: 100%; height: 100%; object-fit: cover; }
.ps-view b { font-size: 12px; }
.ps-view-url { width: 100%; padding: 6px 8px; font-size: 11px; border: 1px solid var(--line); border-radius: 7px; outline: none; }

/* 绑定素材 */
.ps-ref-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.ps-ref-bar span { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.ps-ref-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ps-ref-item { position: relative; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.ps-ref-item img, .ps-ref-item video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.ps-ref-item b { display: block; padding: 5px 7px; font-size: 10.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-ref-item button {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border: none;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 14px; line-height: 20px;
}
.ps-muted { font-size: 12px; color: var(--muted); grid-column: 1/-1; }

/* 对话增强 */
.ps-range { width: 100%; accent-color: var(--accent); }
.ps-fact-add { display: flex; gap: 8px; }
.ps-fact-add input { flex: 1; }
.ps-fact-list { display: grid; gap: 6px; margin-top: 8px; }
.ps-fact {
  display: flex; align-items: center; gap: 8px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 12px;
}
.ps-fact.pinned { background: #fffbeb; border-color: #fde68a; }
.ps-fact span { flex: 1; }
.ps-fact button { border: none; background: transparent; cursor: pointer; font-size: 14px; color: var(--muted); }
.ps-fact-pin { color: #d97706 !important; }

/* 弹窗 */
.p-modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.42); display: grid; place-items: center; }
.p-modal.hidden, .hidden { display: none !important; }
.p-modal-card {
  width: min(460px, 92vw); background: #fff; border-radius: 16px; padding: 20px 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.22);
}
.p-modal-card.wide { width: min(720px, 94vw); }
.p-modal-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.p-modal-card h3 { margin: 0; font-size: 16px; }
.p-modal-x { border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.p-modal-hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 12px; }
.p-modal-card textarea, .p-modal-card input[type=text] {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; outline: none; font-size: 13px; line-height: 1.6; resize: vertical;
}
.p-modal-card textarea:focus { border-color: var(--accent-line); }
.p-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }
.p-modal-note { font-size: 11px; color: var(--muted); margin-right: auto; }
.ps-picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-height: 52vh; overflow-y: auto; }
.ps-pick { position: relative; cursor: pointer; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.ps-pick input { position: absolute; top: 5px; left: 5px; z-index: 2; }
.ps-pick img, .ps-pick video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.ps-pick span { display: block; padding: 4px 6px; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-pick:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }

@media (max-width: 900px) {
  .ps-template-row, .ps-views { grid-template-columns: repeat(2, 1fr); }
  .ps-ref-grid, .ps-picker-grid { grid-template-columns: repeat(3, 1fr); }
  .ps-row3 { grid-template-columns: 1fr; }
}

/* ---------- 侧栏类目导航 ---------- */

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  flex: 1;
  overflow-y: auto;
}
.side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  transition: background 0.15s;
}
.side-nav button i {
  font-style: normal;
  font-size: 15px;
  width: 20px;
  text-align: center;
}
.side-nav button:hover { background: #f3f4f6; }
.side-nav button.active {
  background: var(--accent-weak);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}
.side-nav button.active:hover { background: #e0e7ff; }

.field.vmodel { margin-top: 10px; }

/* ---------- 顶栏用户与登录页 ---------- */

.user-chip {
  max-width: 140px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 13px;
  background: #f1f2f5;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 模型目录 / 积分 / 视频解析 ---------- */

.model-picker select {
  width: 100%;
  max-width: 380px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  font-size: 12.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.model-picker select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

.field.vmodel select { font-size: 12.5px; }
.price-tag { font-size: 11px; color: var(--accent); font-weight: 600; margin-left: 6px; }

.credit-chip {
  height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 11px;
  border-radius: 13px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.12s;
}
.credit-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.credit-chip b { font-weight: 700; font-variant-numeric: tabular-nums; }

.cost-chip {
  flex: 0 0 auto;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--accent-weak);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 视频面板：对标视频解析区 */
.ref-box {
  margin-top: 14px;
  border: 1px solid var(--accent-line);
  background: #fafaff;
  border-radius: 10px;
  padding: 10px 12px 12px;
}
.ref-box > summary { font-weight: 600; }
.ref-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; margin-top: 10px; }
.ref-grid .field { margin-bottom: 0; }
.ref-grid .field label, .ref-box > .field label { font-size: 11.5px; color: var(--muted); }
.ref-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ref-actions .vnote { min-width: 120px; }
.ref-actions button {
  font-size: 12px;
  padding: 5px 11px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  color: var(--accent);
  background: #fff;
  white-space: nowrap;
}
.ref-actions button:hover { background: var(--accent-weak); }
.ref-actions button:disabled { opacity: 0.55; cursor: wait; }

/* 积分弹窗 */
.credit-modal { max-width: 720px; padding: 18px 20px 20px; }
.credit-modal .modal-head { padding: 0 0 12px; border-bottom: 1px solid var(--line-soft); }
.credit-modal .modal-head.sub { padding: 16px 0 8px; border: 0; }
.credit-modal .modal-head h3 { margin: 0; font-size: 13px; font-weight: 650; }
.credit-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.credit-summary > div { background: #fafaff; border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px 14px; }
.credit-summary span { display: block; font-size: 11.5px; color: var(--muted-2); }
.credit-summary b { display: block; margin-top: 2px; font-size: 20px; font-weight: 680; font-variant-numeric: tabular-nums; }
.credit-summary b i { font-size: 12px; font-style: normal; font-weight: 500; color: var(--muted); }
.credit-tip { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.65; }
.credit-grant { margin-top: 14px; padding: 12px; border: 1px dashed var(--accent-line); border-radius: 10px; }
.credit-grant > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.grant-row { display: flex; gap: 8px; }
.grant-row select, .grant-row input {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; font-size: 12.5px;
}
.grant-row select { flex: 1; }
.grant-row input { width: 150px; }
.grant-row .primary { padding: 6px 14px; font-size: 12.5px; }
.credit-grant .vnote { display: block; margin-top: 8px; }
.ledger-box { max-height: 300px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ledger-table th { position: sticky; top: 0; background: #f7f8fa; text-align: left; padding: 8px 10px; color: var(--muted); font-weight: 600; }
.ledger-table td { padding: 7px 10px; border-top: 1px solid var(--line-soft); color: var(--muted); white-space: nowrap; }
.ledger-table td:nth-child(4) { white-space: normal; min-width: 160px; }
.ledger-table .plus { color: var(--ok); font-weight: 650; }
.ledger-table .minus { color: var(--danger); font-weight: 650; }
.ltype { padding: 1px 7px; border-radius: 10px; background: #f1f2f5; font-size: 11px; }
.ltype.grant { background: #ecfdf5; color: var(--ok); }
.ltype.refund { background: #fffbeb; color: #b45309; }
.ltype.consume { background: #fef2f2; color: var(--danger); }

/* 解析记录卡片 */
.prec {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.psummary { margin-top: 8px; font-size: 13px; font-weight: 550; }
.pfacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pfacts span { font-size: 11px; color: var(--muted); background: #f5f6f8; border-radius: 6px; padding: 2px 8px; }
.pshots { display: grid; gap: 8px; margin-top: 12px; }
.pshot { display: grid; grid-template-columns: 78px 1fr; gap: 2px 10px; border-left: 2px solid var(--accent-line); padding-left: 10px; }
.pshot b { font-size: 11.5px; color: var(--accent); grid-row: span 2; }
.pshot span { font-size: 12px; }
.pshot small { font-size: 11px; color: var(--muted-2); }
.pprompt { margin-top: 12px; background: #fafaff; border: 1px solid var(--accent-line); border-radius: 9px; padding: 9px 11px; }
.pprompt label { display: block; font-size: 11px; color: var(--accent); margin-bottom: 3px; }
.pprompt p { margin: 0; font-size: 12.5px; line-height: 1.7; }
.pneg { margin-top: 8px; font-size: 11.5px; color: var(--danger); }
.ptips { margin: 8px 0 0; padding-left: 18px; font-size: 11.5px; color: var(--muted); }
.prec .vactions { margin-top: 12px; }

@media (max-width: 900px) {
  .ref-grid { grid-template-columns: 1fr; }
  .credit-summary { grid-template-columns: 1fr; }
}

/* ---------- 账号管理 ---------- */

.account-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.account-inner { max-width: 1120px; margin: 0 auto; padding: 22px 26px 40px; }
.acc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.acc-avatar {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700;
}
.acc-head-main { flex: 1; min-width: 0; }
.acc-head-main h2 { margin: 0; font-size: 20px; font-weight: 680; }
.acc-head-main p { margin: 2px 0 0; font-size: 12px; color: var(--muted-2); font-family: ui-monospace, monospace; }
.acc-role { font-size: 11.5px; padding: 4px 11px; border-radius: 20px; background: #f1f2f5; color: var(--muted); border: 1px solid var(--line-soft); }
.acc-role.admin { background: var(--accent-weak); color: var(--accent); border-color: var(--accent-line); }

.acc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.acc-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-sm); }
.acc-card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 650; }
.acc-card .field { margin-bottom: 10px; }
.acc-card .field label { font-size: 11.5px; }
.acc-card .field input[readonly] { background: #f7f8fa; color: var(--muted); }
.acc-balance-card { background: linear-gradient(145deg, #fafaff, #f5f3ff); border-color: var(--accent-line); }
.acc-big { display: flex; align-items: baseline; gap: 8px; }
.acc-big b { font-size: 38px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; color: var(--accent); }
.acc-big span { font-size: 13px; color: var(--muted); }
.acc-meta { margin-top: 2px; font-size: 12px; color: var(--muted); }
.acc-hint { margin: 12px 0; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.acc-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.acc-actions .vnote { flex: 1; }
.acc-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.acc-card-head h3 { margin: 0; }
.acc-ledger-card, .acc-users-card { margin-top: 16px; }
.acc-create-row { flex-wrap: wrap; margin-bottom: 14px; }
.acc-create-row input { flex: 1; min-width: 150px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; outline: none; font-size: 12.5px; }
.acc-check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.acc-users-box { max-height: 340px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
.acc-users-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.acc-users-table th { position: sticky; top: 0; background: #f7f8fa; text-align: left; padding: 9px 12px; color: var(--muted); font-weight: 600; }
.acc-users-table td { padding: 9px 12px; border-top: 1px solid var(--line-soft); }
.acc-users-table td small { display: block; color: var(--muted-2); font-size: 11px; }
.acc-users-table .acc-bal { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--accent); }
.acc-row-actions { white-space: nowrap; }
.acc-row-actions button { font-size: 11.5px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--accent); background: #fff; margin-right: 5px; }
.acc-row-actions button:hover { background: var(--accent-weak); }
.acc-row-actions button.del { color: var(--danger); border-color: #fecaca; }
.acc-row-actions button.del:hover { background: var(--danger-weak); }
.acc-users-card .vnote { display: block; margin-top: 10px; }
.user-chip { cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.user-chip:hover { background: var(--accent-weak); border-color: var(--accent-line); color: var(--accent); }

@media (max-width: 1000px) {
  .acc-grid { grid-template-columns: 1fr; }
  .account-inner { padding: 18px 16px 32px; }
}

/* ---------- 侧栏质感升级：统一线性图标 + 克制字阶 ---------- */

.brand {
  padding: 18px 18px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(150deg, #101a36, #1c2850);
  border: 1px solid rgba(233, 209, 156, 0.42);
  color: #e9d19c;
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: 0 6px 16px rgba(16, 26, 54, 0.18), inset 0 0 0 3px rgba(233, 209, 156, 0.06);
}
.brand-text { min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.045em;
  color: var(--text);
}
.brand p {
  margin: 3px 0 0;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted-2);
  white-space: nowrap;
}

.side-head {
  gap: 12px;
  padding: 20px 18px 10px;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: var(--muted-2);
}
.side-head-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.side-nav { gap: 3px; padding: 8px 10px; }
.side-nav button {
  position: relative;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  border-color: transparent;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.025em;
  color: #525967;
  transition: background 0.16s, color 0.16s;
}
.side-nav button i.nav-ico {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  transition: color 0.16s;
}
.side-nav button i.nav-ico svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.side-nav button:hover { background: #f7f8fb; color: var(--text); }
.side-nav button:hover i.nav-ico { color: var(--muted); }
.side-nav button.active {
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.085), rgba(79, 70, 229, 0.018));
  border-color: transparent;
  color: var(--accent);
  font-weight: 600;
}
.side-nav button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2.5px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.side-nav button.active:hover {
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.11), rgba(79, 70, 229, 0.025));
}
.side-nav button.active i.nav-ico { color: var(--accent); }

.side-foot .side-note {
  margin: 10px 4px 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  text-align: center;
}

/* 图标与副标可读性微调（hover / 选中态仍由更高优先级规则接管） */
.side-nav button i.nav-ico { color: #8f97a6; }
.side-nav button i.nav-ico svg { stroke-width: 1.7; }
.brand p { color: #9ba3b2; font-size: 9.5px; }

/* ---------- 侧栏分组 ---------- */

.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-group + .nav-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.nav-group-label {
  padding: 2px 12px 6px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted-2);
}
.side-nav button { padding: 8px 12px; font-size: 13px; }

/* ---------- 工作区通用 ---------- */

.studio-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.studio-inner { max-width: 1180px; margin: 0 auto; padding: 22px 26px 42px; }

.st-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.st-head-text h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: 0.01em; }
.st-head-text p { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.st-head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.st-body { display: flex; flex-direction: column; gap: 16px; }

.st-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.st-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.st-card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }

.st-muted { color: var(--muted-2); font-size: 12px; }
.st-hint { margin: 0; font-size: 11.5px; color: var(--muted-2); line-height: 1.7; }
.st-error { margin: 4px 0 0; font-size: 11.5px; color: var(--danger); }
.st-empty {
  padding: 34px 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted-2);
  font-size: 12.5px;
  background: #fcfcfd;
}
.st-empty.small { padding: 16px 10px; border: none; background: transparent; }

.studio-inner input,
.studio-inner textarea,
.studio-inner select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
  outline: none;
  color: var(--text);
}
.studio-inner input:focus,
.studio-inner textarea:focus,
.studio-inner select:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.09);
}
.studio-inner textarea { width: 100%; resize: vertical; line-height: 1.7; }
.studio-inner .field textarea { min-height: 60px; }

.st-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-actions-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.st-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.st-toolbar input { width: 300px; }

.st-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.st-kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.st-kpi span { font-size: 11.5px; color: var(--muted); }
.st-kpi b { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.st-kpi i { font-style: normal; font-size: 11px; color: var(--muted-2); }

.st-quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.st-quick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.st-quick:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.st-quick-ico {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  background: var(--accent-weak);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.st-quick-text { min-width: 0; }
.st-quick-text b { display: block; font-size: 13px; font-weight: 600; }
.st-quick-text i { font-style: normal; font-size: 11.5px; color: var(--muted-2); }
.st-quick-arrow { margin-left: auto; color: var(--muted-2); font-size: 13px; }

.st-section { display: flex; flex-direction: column; gap: 10px; }
.st-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.st-section-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; }

.st-work-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.st-work {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
.st-work-thumb { position: relative; aspect-ratio: 1 / 1; background: #eef0f4; }
.st-work-thumb img, .st-work-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-work-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(10, 14, 26, 0.26);
  font-size: 17px;
}
.st-work figcaption {
  padding: 7px 9px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-mini-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.st-mini {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  background: #fcfcfd;
}
.st-mini b { display: block; font-size: 20px; font-weight: 650; }
.st-mini span { font-size: 11px; color: var(--muted-2); }

/* 左右分栏 */
.st-split { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 16px; align-items: start; }
.st-split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.st-side { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.st-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.st-list { display: flex; flex-direction: column; gap: 4px; max-height: 62vh; overflow-y: auto; }
.st-list-item {
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  width: 100%;
}
.st-list-item b { display: block; font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-list-item span { font-size: 11px; color: var(--muted-2); }
.st-list-item:hover { background: #f7f8fa; }
.st-list-item.active { background: var(--accent-weak); border-color: var(--accent-line); }

/* 徽标 / 进度条 */
.st-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 10.5px;
  background: #eef0f4;
  color: #5b6270;
  white-space: nowrap;
}
.st-badge.ok { background: #e8f6f0; color: #047857; }
.st-badge.warn { background: #fff7e6; color: #b45309; }
.st-badge.bad { background: #fef2f2; color: #b91c1c; }

.st-bar-row {
  display: grid;
  grid-template-columns: 84px 1fr 68px;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
  font-size: 12px;
}
.st-bar { height: 8px; background: #eef0f4; border-radius: 5px; overflow: hidden; }
.st-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.st-bar-row b { text-align: right; font-weight: 550; }

.st-days { display: flex; align-items: flex-end; gap: 10px; height: 156px; padding-top: 8px; }
.st-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
  font-size: 10.5px;
  color: var(--muted-2);
}
.st-day-bar { width: 100%; max-width: 40px; flex: 1; background: #f1f2f6; border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.st-day-bar i { width: 100%; background: linear-gradient(180deg, #8b5cf6, #6366f1); border-radius: 6px 6px 0 0; }
.st-day b { font-size: 10px; color: var(--muted); min-height: 12px; font-weight: 550; }
.st-day em { font-style: normal; }

.st-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.st-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted-2);
  font-size: 11.5px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.st-table td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.st-table tr:last-child td { border-bottom: none; }
.st-plus { color: var(--ok); }
.st-minus { color: var(--danger); }

/* 短剧 */
.dr-scenes { display: flex; flex-direction: column; gap: 10px; }
.dr-scene {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fcfcfd;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dr-scene-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dr-scene-no { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted-2); }
.dr-scene-head input { flex: 1; min-width: 110px; padding: 5px 8px; font-size: 12.5px; }
.dr-sec { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dr-sec input { width: 58px; padding: 4px 6px; font-size: 12px; }
.dr-video { width: 100%; max-height: 260px; border-radius: 8px; background: #000; }

/* 电商 */
.ec-title { font-size: 15px; font-weight: 650; margin-bottom: 8px; line-height: 1.5; }
.ec-points { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; color: #3b4150; }
.ec-points li { margin-bottom: 4px; }
.ec-desc { margin-top: 2px; }
.st-sub-head { font-size: 12px; color: var(--muted); margin: 14px 0 6px; letter-spacing: 0.04em; }
.ec-prompt { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; margin-bottom: 8px; background: #fcfcfd; }
.ec-prompt p { margin: 0 0 6px; font-size: 12.5px; line-height: 1.7; }
.st-mini-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 解析报告 */
.st-report-summary { font-size: 13px; margin: 0 0 10px; }
.st-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.st-kv div { background: #fbfbfd; border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; }
.st-kv span { display: block; font-size: 10.5px; color: var(--muted-2); }
.st-kv b { font-size: 12.5px; font-weight: 550; }
.st-code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  background: #f7f8fb;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}

/* 画布 */
.cv-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cv-name { width: 180px; }
.cv-toolbar .spacer { flex: 1; }
.cv-board {
  position: relative;
  min-height: 570px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background-color: #fbfbfd;
  background-image: radial-gradient(#e3e5ec 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: auto;
  touch-action: none;
}
.cv-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted-2); font-size: 12.5px; }
.cv-node {
  position: absolute;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.cv-node.dragging { box-shadow: var(--shadow); z-index: 5; }
.cv-node-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px 6px 10px;
  background: #f7f8fb;
  font-size: 12px;
  color: var(--muted);
  cursor: grab;
  user-select: none;
}
.cv-node-head button { color: var(--muted-2); padding: 0 4px; font-size: 14px; line-height: 1; }
.cv-node textarea { width: 100%; border: none; border-radius: 0; padding: 9px 10px; font-size: 12.5px; resize: vertical; min-height: 70px; }
.cv-node input { border: none; border-top: 1px solid var(--line-soft); width: 100%; border-radius: 0; padding: 7px 10px; font-size: 12px; }
.cv-img { width: 100%; display: block; max-height: 200px; object-fit: cover; }
.cv-node-foot { display: flex; gap: 6px; padding: 0 8px 8px; flex-wrap: wrap; }
.cv-prompt { border-top: 2px solid var(--accent-line); }

/* 商品库 */
.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.pr-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pr-thumb { aspect-ratio: 4 / 3; background: #f1f2f6; display: grid; place-items: center; color: var(--muted-2); font-size: 20px; }
.pr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pr-body { padding: 10px 12px; flex: 1; }
.pr-body h3 { margin: 0 0 3px; font-size: 13.5px; font-weight: 600; }
.pr-price { font-size: 15px; font-weight: 650; color: #b45309; margin-top: 6px; }
.pr-point { font-size: 11.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.6; }
.st-card-actions { display: flex; gap: 6px; padding: 0 10px 10px; flex-wrap: wrap; }
.danger-text { color: var(--danger); }

/* 人物与素材 */
.ps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.ps-card { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: #fff; }
.ps-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  background: var(--accent-weak);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 650;
  overflow: hidden;
}
.ps-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ps-card h3 { margin: 0 0 2px; font-size: 13px; }
.ps-card p { margin: 0; font-size: 11.5px; color: var(--muted-2); line-height: 1.6; }
.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.mt-card { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; cursor: pointer; }
.mt-thumb { aspect-ratio: 4 / 3; background: #f1f2f6; display: grid; place-items: center; color: var(--muted-2); font-size: 12px; }
.mt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mt-body { padding: 9px 11px; }
.mt-body h3 { margin: 0 0 2px; font-size: 12.5px; }

/* 内容库 */
.st-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.st-tabs button { padding: 6px 14px; border-radius: 16px; font-size: 12.5px; color: var(--muted); }
.st-tabs button.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.st-tabs .st-muted { margin-left: auto; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.lib-card { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; cursor: pointer; }
.lib-thumb { aspect-ratio: 1 / 1; background: #f1f2f6; position: relative; }
.lib-thumb img, .lib-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-parse { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.lib-body { padding: 8px 10px 10px; }
.lib-body p {
  margin: 0 0 4px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #3b4150;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-body span { font-size: 10.5px; color: var(--muted-2); }
.st-detail-img, .st-detail-video { width: 100%; border-radius: 10px; margin-bottom: 10px; background: #000; }

/* 技能 */
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.sk-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.sk-card:hover { border-color: var(--accent-line); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.sk-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-weak);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 2px;
}
.sk-card b { font-size: 13.5px; }
.sk-card i { font-style: normal; font-size: 11.5px; color: var(--muted-2); line-height: 1.6; }
.sk-card em { font-style: normal; font-size: 11.5px; color: var(--accent); margin-top: 4px; }
.sk-out { max-height: 50vh; overflow: auto; }

/* 插件 / 云机 */
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pl-card { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: #fff; }
.pl-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 4px; }
.pl-head b { font-size: 13px; }
.pl-card p { margin: 3px 0 0; word-break: break-all; }
.pl-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pl-actions .mini { padding: 4px 10px; font-size: 12px; }

.q-list { display: flex; flex-direction: column; gap: 8px; }
.q-item {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  background: #fff;
}
.q-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.q-title { display: flex; align-items: center; gap: 8px; }
.q-title b { font-size: 12.5px; font-weight: 550; }
.q-actions { display: flex; align-items: center; gap: 6px; }

/* Markdown 输出 */
.st-md { font-size: 13px; color: #2a2f3a; line-height: 1.75; }
.st-md p { margin: 0 0 8px; }
.st-md h3, .st-md h4, .st-md h5 { margin: 12px 0 6px; font-size: 13.5px; }
.st-md ul, .st-md ol { padding-left: 20px; margin: 0 0 8px; }
.st-md blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 2px solid var(--accent-line); color: var(--muted); }
.st-md pre { background: #f6f7f9; padding: 10px; border-radius: 8px; overflow: auto; }
.st-md code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #f2f3f6; padding: 1px 4px; border-radius: 4px; }
.st-md pre code { background: transparent; padding: 0; }

.st-modal { max-width: 580px; display: flex; flex-direction: column; overflow: hidden; }
.st-modal .modal-body { overflow-y: auto; }
.st-modal .modal-foot { flex-shrink: 0; }

@media (max-width: 1180px) {
  .st-work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .st-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-split, .st-split.even { grid-template-columns: 1fr; }
  .st-row2 { grid-template-columns: 1fr; }
  .studio-inner { padding: 16px 14px 32px; }
  .st-work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-toolbar input { width: 100%; }
}

/* 侧栏紧凑排布：18 个类目在 900px 高度内完整显示 */
.side-nav { padding: 8px 9px; gap: 2px; }
.side-nav button { padding: 7px 11px; font-size: 12.5px; gap: 10px; }
.side-nav button i.nav-ico { width: 18px; height: 18px; flex: 0 0 18px; }
.side-nav button i.nav-ico svg { width: 17px; height: 17px; }
.nav-group { gap: 2px; }
.nav-group-label { padding: 1px 12px 4px; font-size: 9.5px; }
.nav-group + .nav-group { margin-top: 7px; padding-top: 7px; }

/* 再压一档，保证 18 项在 900px 高度内全部可见（侧栏仍可滚动兜底） */
.side-nav { padding: 6px 8px; gap: 0; }
.nav-group { gap: 0; }
.side-nav button { padding: 4px 10px; font-size: 12px; gap: 9px; border-radius: 8px; }
.side-nav button i.nav-ico { width: 17px; height: 17px; flex: 0 0 17px; }
.side-nav button i.nav-ico svg { width: 16px; height: 16px; }
.nav-group-label { padding: 7px 12px 3px; font-size: 9px; letter-spacing: 0.16em; }
.nav-group + .nav-group { margin-top: 4px; padding-top: 4px; }

/* 网格容器里的空状态占满整行 */
.pr-grid > .st-empty,
.lib-grid > .st-empty,
.mt-grid > .st-empty,
.sk-grid > .st-empty,
.pl-grid > .st-empty { grid-column: 1 / -1; padding: 40px 16px; }

/* ================= 创作台（素材 → 规格 → 方向 → 提示词） ================= */

.cr-inner { max-width: 1220px; }
.cr-loading { padding: 90px 0; text-align: center; color: var(--muted-2); font-size: 12.5px; letter-spacing: .04em; }

/* ---- 页头 ---- */
.cr-mast {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 34px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.cr-mast::after {
  content: "";
  position: absolute;
  right: 0;
  top: -30px;
  width: 420px;
  height: 190px;
  background: radial-gradient(closest-side, rgba(99, 102, 241, .09), rgba(139, 92, 246, .04) 62%, transparent 100%);
  pointer-events: none;
}
.cr-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 500 9.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: #9aa1b1;
}
.cr-kicker::before {
  content: "";
  width: 16px;
  height: 1px;
  background: #c9cdd8;
}
.cr-mast-text h1 {
  margin: 14px 0 0;
  font-size: 36px;
  line-height: 1.12;
  font-weight: 660;
  letter-spacing: -.035em;
  color: #14161d;
}
.cr-mast-text h1 em {
  font-style: normal;
  background: linear-gradient(96deg, #4f46e5 0%, #8b5cf6 55%, #d946ef 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cr-mast-text p {
  margin: 11px 0 0;
  max-width: 536px;
  font-size: 12.5px;
  line-height: 1.9;
  color: #5f6673;
}
.cr-mast-stats {
  display: flex;
  align-items: flex-end;
  gap: 26px;
  flex: 0 0 auto;
  padding-bottom: 2px;
}
.cr-mast-stats > div { display: flex; flex-direction: column; gap: 2px; }
.cr-mast-stats i {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: .08em;
  color: #a3a9b8;
  white-space: nowrap;
}
.cr-mast-stats b {
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -.02em;
  color: #23262f;
  font-variant-numeric: tabular-nums;
}

/* ---- 进度轨 ---- */
.cr-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 14px;
}
.cr-tk {
  display: grid;
  grid-template-columns: 15px 1fr;
  align-items: baseline;
  column-gap: 7px;
  row-gap: 6px;
}
.cr-tk i {
  grid-column: 1 / -1;
  height: 2px;
  border-radius: 2px;
  background: #e7e9f0;
  transition: background .4s ease;
}
.cr-tk b {
  font: 600 9px/1 ui-monospace, monospace;
  letter-spacing: .08em;
  color: #b0b6c3;
}
.cr-tk > span {
  font-size: 11px;
  color: #9aa1b1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-tk.done i { background: #cfd1f3; }
.cr-tk.done b { color: #8d8fce; }
.cr-tk.done > span { color: #6b7180; }
.cr-tk.on i { background: linear-gradient(90deg, #4f46e5, #8b5cf6); }
.cr-tk.on b { color: #4f46e5; }
.cr-tk.on > span { color: #1a1d24; font-weight: 600; }

/* ---- 工作台主体 ---- */
.cr-desk {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 26px 52px -40px rgba(20, 22, 40, .34);
}
.cr-row {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 26px;
  padding: 19px 22px;
  border-top: 1px solid #f3f4f8;
  background-image: linear-gradient(90deg, #fbfbfd 0, #fbfbfd 148px, #ffffff 148px);
}
.cr-row:first-child { border-top: none; }
.cr-row-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 1px 18px 0 0;
  border-right: 1px solid #eef0f5;
}
.cr-no {
  align-self: flex-start;
  padding: 3px 5px;
  border: 1px solid #e8eaf1;
  border-radius: 4px;
  font: 600 9px/1 ui-monospace, monospace;
  letter-spacing: .04em;
  color: #98a0b0;
}
.cr-row-label h3 { margin: 0; font-size: 12.5px; font-weight: 640; color: #1a1d24; letter-spacing: .01em; }
.cr-row-label p { margin: 0; font-size: 10px; line-height: 1.75; color: #a9aebd; }
.cr-row-body { display: flex; flex-direction: column; gap: 11px; min-width: 0; }

/* ---- 素材区 ---- */
.cr-drop {
  position: relative;
  min-height: 92px;
  padding: 10px;
  border: 1.5px dashed #dfe3ee;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfbfe, #f7f8fb);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.cr-drop.hot { border-color: #a5a7f0; background: #f6f6ff; box-shadow: inset 0 0 0 3px #eef0ff; }
.cr-drop-empty {
  margin: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 8px;
  text-align: left;
}
.cr-drop-ico {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #e8eaf2;
  color: #6f6ad8;
  box-shadow: 0 8px 16px -13px rgba(79, 70, 229, .9);
}
.cr-drop-empty b { display: block; font-size: 12.5px; font-weight: 600; color: #3d4453; }
.cr-drop-empty i { display: block; margin-top: 2px; font-style: normal; font-size: 10.5px; color: #9aa1b1; }
.cr-drop-hint { width: 100%; margin: 0; padding-left: 2px; font-size: 9.5px; color: #a9aebd; }
.cr-refs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.cr-ref {
  position: relative;
  width: 108px;
  flex: 0 0 108px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8eaf2;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.cr-ref > img, .cr-ref > video { width: 100%; height: 76px; object-fit: cover; display: block; background: #eef0f6; }
.cr-ref-meta { display: flex; flex-direction: column; gap: 4px; padding: 5px 6px 6px; min-width: 0; }
.cr-ref .cr-ref-meta b {
  position: static;
  padding: 0;
  background: none;
  color: #3d4453;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-ref-role {
  width: 100%;
  height: 23px;
  padding: 0 4px;
  border: 1px solid #e6e8ef;
  border-radius: 6px;
  background: #fafbfe;
  color: #4f46e5;
  font-size: 10px;
  cursor: pointer;
  outline: none;
}
.cr-ref-role:hover, .cr-ref-role:focus { border-color: #bfc4ec; background: #fff; }
.cr-ref button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(17, 19, 28, .6);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s ease;
}
.cr-ref:hover button { opacity: 1; }
.cr-ref-add {
  width: 76px;
  min-height: 112px;
  align-self: stretch;
  flex: 0 0 76px;
  display: grid;
  place-items: center;
  border: 1px dashed #d9deeb;
  border-radius: 9px;
  background: #fff;
  color: #9aa1b1;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cr-ref-add:hover { border-color: #bfc4ec; color: #4f46e5; background: #fbfbff; }

.cr-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cr-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid #e6e8ef;
  border-radius: 8px;
  background: #fff;
  font-size: 11.5px;
  color: #3d4453;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cr-btn:hover { border-color: #cfd3f2; color: #4338ca; background: #fbfbff; }
.cr-btn.sm { height: 28px; padding: 0 9px; font-size: 11px; }
.cr-btn.ghost { border-color: transparent; color: #98a0b0; background: transparent; }
.cr-btn.ghost:hover { background: #f5f6fa; color: #4338ca; }
.cr-tool-sep { width: 1px; height: 16px; background: #eceef4; margin: 0 2px; }
.cr-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: #9aa1b1; }
.studio-inner .cr-inline select {
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #e6e8ef;
  font-size: 11.5px;
  background: #fff;
  max-width: 190px;
}
.cr-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
  font-size: 11px;
  color: #8b93a3;
  transition: color .15s ease;
  white-space: nowrap;
}
.cr-link:hover { color: #4338ca; }

/* ---- 模型选择器 ---- */
.cr-model-line { display: flex; align-items: center; gap: 8px; }
.cr-picker {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 11px;
  border: 1px solid #e6e8ef;
  border-radius: 10px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
  min-width: 0;
}
.cr-picker:hover { border-color: #cdd1ef; box-shadow: 0 0 0 3px #f6f6ff; }
.cr-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  z-index: 3;
  appearance: none;
}
.cr-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #d8dbe5; }
.cr-dot.on { background: #10b981; box-shadow: 0 0 0 3px #e7f8f1; }
.cr-picker b { font-size: 12.5px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-picker i {
  font-style: normal;
  font-size: 10.5px;
  color: #9aa1b1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 2px;
}
.cr-caps {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 9.5px;
  color: #4f46e5;
  background: #f2f3ff;
  border: 1px solid #e4e6fb;
  border-radius: 5px;
  padding: 2px 6px;
  white-space: nowrap;
}
.cr-caps:empty { display: none; }
.cr-price {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 5px;
  background: #f3f1ff;
  color: #5b4ee0;
  font: 600 9.5px/1.2 ui-monospace, monospace;
}
.cr-caret { display: flex; align-items: center; color: #b3b8c5; flex: 0 0 auto; }
.cr-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border: 1px solid #e9ebf2;
  border-radius: 8px;
  background: #fff;
  color: #9aa1b1;
  transition: color .15s ease, border-color .15s ease;
}
.cr-icon:hover { color: #4f46e5; border-color: #d8dbf3; }

/* ---- 规格芯片 ---- */
.cr-param { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cr-param-label { font-size: 10.5px; color: #a3a9b8; margin-left: 10px; }
.cr-param-label:first-child { margin-left: 0; }
.cr-chips {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #f0f1f6;
  border-radius: 9px;
  background: #f6f7fa;
}
.cr-chip {
  height: 25px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 11.5px;
  color: #5b6273;
  background: transparent;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}
.cr-chip:hover { background: #fff; color: #1a1d24; }
.cr-chip.on {
  background: #fff;
  color: #2b2b6b;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), inset 0 0 0 1px #e2e2f7;
}

/* ---- 三列表单 ---- */
.cr-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cr-select { display: flex; flex-direction: column; gap: 5px; }
.cr-select > span { font-size: 10.5px; color: #a3a9b8; }
.studio-inner .cr-select select {
  width: 100%;
  height: 34px;
  padding: 0 26px 0 10px;
  border: 1px solid #e6e8ef;
  border-radius: 9px;
  font-size: 11.5px;
  color: #2f3440;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23a9aebd' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  appearance: none;
  -webkit-appearance: none;
}
.studio-inner .cr-select select:hover { border-color: #d3d7e6; }

/* ---- 底部操作条 ---- */
.cr-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 22px;
  border-top: 1px solid #f3f4f8;
  background: #fcfcfe;
}
.studio-inner .cr-foot textarea {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 11px 12px;
  border: 1px solid #e6e8ef;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  background: #fff;
  resize: none;
}
.cr-foot textarea::placeholder { color: #b4b9c6; }
.cr-foot-side { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.cr-cost { font-size: 10.5px; color: #9aa1b1; white-space: nowrap; }
.cr-cost b { color: #3d4453; font-weight: 600; font-family: ui-monospace, monospace; }
.cr-run {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  background: #16181f;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 10px 22px -14px rgba(16, 18, 31, .9);
  transition: background .15s ease, transform .15s ease;
}
.cr-run svg { color: rgba(255, 255, 255, .72); }
.cr-run:hover { background: #24262f; transform: translateY(-1px); }
.cr-run[disabled] { opacity: .55; transform: none; cursor: default; }

/* ---- 区块标题 ---- */
.cr-result { margin-top: 26px; }
.cr-more { margin-top: 28px; padding-top: 20px; border-top: 1px solid #eef0f5; }
.cr-sec { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cr-sec-l { display: flex; align-items: center; gap: 9px; }
.cr-sec-l h3 { margin: 0; font-size: 13.5px; font-weight: 640; letter-spacing: .01em; }
.cr-sec-r { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: #a3a9b8; }
.cr-sec-r .cr-link { font-size: 10.5px; }
.cr-badge {
  padding: 2px 6px;
  border: 1px solid #d8eee3;
  border-radius: 5px;
  background: #eef7f2;
  color: #047857;
  font-size: 9.5px;
  letter-spacing: .04em;
}
.cr-badge.warn { border-color: #f7e5c3; background: #fff8ea; color: #b45309; }

/* ---- 空态 ---- */
.cr-blank {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fbfbfe);
}
.cr-blank-main { display: flex; flex-direction: column; gap: 3px; }
.cr-blank-ico {
  width: 30px;
  height: 30px;
  margin-bottom: 6px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #f3f1ff;
  color: #6d5ae6;
}
.cr-blank-main b { font-size: 12.5px; font-weight: 600; color: #3d4453; }
.cr-blank-main p { margin: 0; font-size: 11px; color: #9aa1b1; }
.cr-blank-list {
  display: flex;
  gap: 30px;
  margin: 0;
  padding: 2px 0 2px 26px;
  border-left: 1px solid #f0f1f5;
  list-style: none;
}
.cr-blank-list li { display: flex; flex-direction: column; gap: 1px; }
.cr-blank-list i { font: 600 9px/1.4 ui-monospace, monospace; font-style: normal; color: #b0b6c3; }
.cr-blank-list b { font-size: 11px; font-weight: 600; color: #4b5162; }
.cr-blank-list span { font-size: 10px; color: #a3a9b8; white-space: nowrap; }

/* ---- 方向卡片 ---- */
.cr-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.cr-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 252px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.cr-card:hover { border-color: #dcdff0; box-shadow: 0 18px 34px -30px rgba(20, 22, 40, .55); }
.cr-card header { display: flex; align-items: center; gap: 7px; }
.cr-card-no { font: 600 9px/1 ui-monospace, monospace; color: #adb3c0; }
.cr-card h4 { margin: 0; flex: 1; font-size: 12.5px; font-weight: 640; color: #1a1d24; }
.cr-card-hook { margin: 0; font-size: 11px; line-height: 1.75; color: #6b7280; }
.cr-card header { min-height: 18px; }
.cr-card pre {
  flex: 1;
  margin: 0;
  max-height: 172px;
  overflow: auto;
  padding: 9px 10px;
  border: 1px solid #eef0f6;
  border-radius: 9px;
  background: #f8f9fc;
  color: #4b5162;
  font: 10.5px/1.85 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.cr-card footer { display: flex; gap: 6px; margin-top: 2px; }
.cr-card.picked { border-color: #6c62e8; box-shadow: 0 0 0 2px rgba(108, 98, 232, .12); }
.cr-card.picked .cr-card-no { color: #6c62e8; }
.cr-dir-pick, .cr-dir-all { display: inline-flex; align-items: center; cursor: pointer; }
.cr-dir-pick input, .cr-dir-all input {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin: 0;
  padding: 0;
  accent-color: #5b52e0;
  cursor: pointer;
}
.cr-card-new {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
}
.cr-dir-del {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #b5bac6;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.cr-dir-del:hover { background: #fdeeee; color: #d04545; }

/* ---- 方向池工具条：换一批 / 全选 / 批量生成 ---- */
.cr-dir-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid #e9eaf3;
  border-radius: 10px;
  background: #fafaff;
}
.cr-dir-all { gap: 6px; font-size: 11.5px; color: #4b5162; white-space: nowrap; }
.cr-dir-info { font-size: 11px; color: #8b93a3; white-space: nowrap; }
.cr-dir-info b { color: #1a1d24; font-weight: 650; }
.cr-dir-acts { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.cr-dir-acts .cr-btn:disabled { opacity: .45; cursor: not-allowed; }
.cr-badge.dim { border-color: #e3e5ee; background: #f3f4f9; color: #8b93a3; }
.cr-dir-limit, .cr-bulk-err { margin: -4px 0 12px; font-size: 10.5px; line-height: 1.7; }
.cr-dir-limit { color: #b45309; }
.cr-bulk-err { color: #c0392b; }

/* ---- 骨架 ---- */
.cr-card.sk { gap: 10px; }
.cr-sk-line, .cr-sk-block {
  border-radius: 6px;
  background: linear-gradient(90deg, #f1f2f7 0%, #f8f9fc 50%, #f1f2f7 100%);
  background-size: 200% 100%;
  animation: cr-shimmer 1.4s linear infinite;
}
.cr-sk-line { height: 9px; }
.cr-sk-block { flex: 1; min-height: 130px; border-radius: 9px; }
.cr-sk-line.w40 { width: 40%; }
.cr-sk-line.w60 { width: 60%; }
.cr-sk-line.w80 { width: 80%; }
@keyframes cr-shimmer { to { background-position: -200% 0; } }
.cr-status { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 11px; color: #9aa1b1; }
.cr-spin {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border-radius: 50%;
  border: 2px solid #e2e3f5;
  border-top-color: #5b52e0;
  animation: cr-spin .8s linear infinite;
}
@keyframes cr-spin { to { transform: rotate(360deg); } }
.cr-note-warn { margin: 10px 0 0; font-size: 10.5px; line-height: 1.75; color: #b45309; }

/* ---- 出片进度（创作页一键生成） ---- */
.cr-btn.go {
  border-color: transparent;
  background: #16181f;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 16px -10px rgba(16, 18, 31, .9);
}
.cr-btn.go svg { color: #ffd98a; }
.cr-btn.go:hover { background: #24262f; color: #fff; border-color: transparent; }
.cr-jobs-sec { margin-top: 22px; }
.cr-jobs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.cr-job {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px;
  border: 1px solid #e7e9f2;
  border-radius: 14px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cr-job:hover { border-color: #dcdff0; box-shadow: 0 18px 34px -30px rgba(20, 22, 40, .55); }
.cr-job.failed { border-color: #f6d5d5; background: #fffafa; }
.cr-job header { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cr-job header b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 640;
  color: #1a1d24;
}
.cr-job-meta {
  flex: 0 0 auto;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9.5px;
  color: #adb3c0;
}
.cr-job-state {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  font: 600 9.5px/1.6 ui-monospace, monospace;
  letter-spacing: .02em;
}
.cr-job-state.run { color: #4f46e5; background: #eef0fd; }
.cr-job-state.wait { color: #6b7180; background: #f1f2f7; }
.cr-job-state.ok { color: #047857; background: #e7f6ef; }
.cr-job-state.bad { color: #b91c1c; background: #fdecec; }
.cr-job-bar { height: 4px; border-radius: 999px; background: #eceef5; overflow: hidden; }
.cr-job-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5, #8b5cf6);
  transition: width .6s ease;
}
.cr-job.live .cr-job-bar i { animation: cr-job-pulse 1.6s ease-in-out infinite; }
@keyframes cr-job-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.cr-job-err { margin: 0; font-size: 10.5px; line-height: 1.65; color: #b91c1c; word-break: break-all; }
.cr-job-video {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 10px;
  background: #000;
  object-fit: contain;
}
.cr-job footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* ---- 其他创作方式 ---- */
.cr-rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.cr-rail-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 14px 13px 13px;
  border-left: 1px solid #f1f2f7;
  text-align: left;
  transition: background .16s ease;
}
.cr-rail-item:first-child { border-left: none; }
.cr-rail-no { font: 600 9px/1.4 ui-monospace, monospace; color: #b6bbc7; letter-spacing: .1em; }
.cr-rail-ico { margin: 3px 0 2px; color: #6b6ad6; }
.cr-rail-item b { font-size: 12px; font-weight: 620; color: #23262f; }
.cr-rail-item span:not([class]) { font-size: 10px; line-height: 1.65; color: #a3a9b8; }
.cr-rail-item em {
  position: absolute;
  right: 12px;
  top: 14px;
  font-style: normal;
  color: #4f46e5;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .16s ease, transform .16s ease;
}
.cr-rail-item:hover { background: #fbfbff; }
.cr-rail-item:hover em { opacity: 1; transform: none; }

.cr-hint-foot { margin: 20px 0 0; text-align: center; font-size: 10px; color: #aeb4c1; letter-spacing: .02em; }

/* ---- 素材库选择弹窗 ---- */
.cr-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.cr-pick { position: relative; display: flex; flex-direction: column; gap: 5px; cursor: pointer; }
.cr-pick input { position: absolute; top: 6px; left: 6px; z-index: 2; accent-color: #4f46e5; }
.cr-pick-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8eaf2;
  background: #eef0f6;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #9aa1b1;
}
.cr-pick-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cr-pick b { font-size: 10.5px; font-weight: 500; color: #4b5162; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-pick input:checked ~ .cr-pick-thumb { border-color: #4f46e5; box-shadow: 0 0 0 2px #e0e2ff; }

@media (max-width: 1120px) {
  .cr-row { grid-template-columns: 1fr; gap: 12px; padding: 17px 18px; background-image: none; }
  .cr-row-label { flex-direction: row; align-items: center; gap: 8px; padding-right: 0; border-right: none; }
  .cr-row-label p { display: none; }
  .cr-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cr-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cr-rail-item:nth-child(3n + 1) { border-left: none; }
  .cr-rail-item:nth-child(n + 4) { border-top: 1px solid #f1f2f7; }
  .cr-blank { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 1060px) {
  .cr-mast { flex-direction: column; align-items: flex-start; gap: 18px; }
  .cr-mast-text h1 { font-size: 30px; }
  .cr-mast-stats { gap: 22px; }
}
@media (max-width: 820px) {
  .cr-mast-text h1 { font-size: 27px; }
  .cr-mast-stats { gap: 18px; }
  .cr-track { gap: 6px; }
  .cr-tk > span { font-size: 10px; }
  .cr-cards { grid-template-columns: 1fr; }
  .cr-dir-bar { flex-wrap: wrap; gap: 9px 12px; }
  .cr-dir-acts { width: 100%; margin-left: 0; }
  .cr-dir-acts .cr-btn { flex: 1; justify-content: center; }
  .cr-selects { grid-template-columns: 1fr; }
  .cr-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .cr-foot-side { justify-content: space-between; }
  .cr-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cr-rail-item:nth-child(3n + 1) { border-left: 1px solid #f1f2f7; }
  .cr-rail-item:nth-child(2n + 1) { border-left: none; }
  .cr-blank-list { flex-wrap: wrap; gap: 14px; }
}

/* ================= AI 智能体（记忆 + 学习） ================= */

.ag-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 344px;
  gap: 14px;
  align-items: stretch;
  min-height: 580px;
}
.ag-loading { padding: 80px 0; text-align: center; color: var(--muted-2); font-size: 12.5px; letter-spacing: .04em; }
.ag-loading.sm { padding: 30px 0; }

/* ---- 左：对话 ---- */
.ag-chat {
  display: flex;
  flex-direction: column;
  border: 1px solid #e8eaf1;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 24px 48px -42px rgba(16, 24, 40, .3);
  overflow: hidden;
}
.ag-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #f0f1f6;
  background: linear-gradient(180deg, #fcfcfe, #fafafd);
}
.ag-chat-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ag-chat-title b { font-size: 13.5px; font-weight: 650; }
.ag-chat-title i { font-style: normal; font-size: 10.5px; color: #a3a9b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-avatar {
  width: 28px; height: 28px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #eef0ff, #f6f1ff);
  color: #6455e0;
  border: 1px solid #e6e4ff;
}
.ag-avatar.sm { width: 22px; height: 22px; border-radius: 7px; margin-top: 2px; }
.ag-chat-tools { display: flex; align-items: center; gap: 10px; }
.studio-inner .ag-chat-tools select {
  padding: 7px 26px 7px 10px; border: 1px solid #e8eaf0; border-radius: 9px;
  background-color: #fff; font-size: 11.5px; color: #2f3440; max-width: 190px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239aa1b1' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.ag-deep { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: #7c8394; cursor: pointer; white-space: nowrap; }
.ag-deep input { accent-color: #4f46e5; margin: 0; }

.ag-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 260px; max-height: 52vh; }
.ag-msg { display: flex; gap: 8px; max-width: 86%; }
.ag-msg.user { align-self: flex-end; }
.ag-msg.bot { align-self: flex-start; }
.ag-msg.bot > div { min-width: 0; }
.ag-bubble {
  padding: 10px 12px; border-radius: 13px; font-size: 12.5px; line-height: 1.8;
  white-space: pre-wrap; word-break: break-word;
}
.ag-msg.user .ag-bubble { background: #4f46e5; color: #fff; border-bottom-right-radius: 4px; box-shadow: 0 10px 20px -14px rgba(79, 70, 229, .8); }
.ag-msg.bot .ag-bubble { background: #f7f8fc; color: #2b3242; border: 1px solid #eef0f6; border-bottom-left-radius: 4px; }
.ag-md :is(p, ul, ol) { margin: 0 0 6px; }
.ag-md :is(ul, ol) { padding-left: 18px; }
.ag-md strong { color: #14161f; }
.ag-md code { background: #fff; border: 1px solid #e8eaf0; border-radius: 4px; padding: 1px 5px; font-size: 11px; }
.ag-src { display: inline-block; margin-top: 6px; padding: 2px 7px; border-radius: 5px; background: #fff7e6; color: #b45309; font-size: 9.5px; letter-spacing: .04em; }
.ag-learn-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ag-learn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  background: #ecfdf5; color: #047857; border: 1px solid #d3f3e4;
  font-size: 10px; max-width: 100%;
}
.ag-learn b { font-weight: 600; }
.ag-hello { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 30px 10px; }
.ag-hello-ava {
  width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(145deg, #eef0ff, #f8f4ff);
  border: 1px solid #e6e4ff; color: #6455e0;
  box-shadow: 0 14px 28px -18px rgba(79, 70, 229, .9);
}
.ag-hello b { font-size: 14px; font-weight: 650; color: #23262f; }
.ag-hello p { margin: 0; font-size: 11.5px; line-height: 2; color: #8d93a4; }

.ag-suggest { display: flex; gap: 7px; padding: 10px 16px 0; flex-wrap: wrap; }
.ag-chip {
  padding: 5px 11px; border: 1px solid #e9ebf3; border-radius: 999px;
  background: #fff; font-size: 11px; color: #5d6472;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.ag-chip:hover { border-color: #cfd3f2; background: #fafaff; color: #4338ca; }
.ag-chip.on { border-color: #c7cbf7; background: #f3f3ff; color: #4338ca; }

.ag-input-row { display: flex; gap: 10px; padding: 12px 16px 14px; align-items: flex-end; }
.studio-inner .ag-input-row textarea {
  flex: 1; resize: none; padding: 10px 12px; border: 1px solid #e8eaf0; border-radius: 12px;
  font-size: 12.5px; line-height: 1.7; background: #fff;
}
.ag-input-row textarea:focus { outline: none; border-color: #b9bdf5; box-shadow: 0 0 0 3px #f1f1fe; }
.ag-send { white-space: nowrap; box-shadow: 0 12px 24px -16px rgba(79, 70, 229, .95); }

/* ---- 右：记忆库 ---- */
.ag-mem {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid #e8eaf1; border-radius: 18px; background: #fff;
  padding: 14px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  min-height: 0;
}
.ag-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ag-stats div { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px; border-radius: 10px; background: #f8f9fc; text-align: center; }
.ag-stats i { font-style: normal; font-size: 9px; color: #a3a9b8; letter-spacing: .05em; }
.ag-stats b { font-size: 15px; font-weight: 650; letter-spacing: -.02em; color: #23262f; font-variant-numeric: tabular-nums; }
.ag-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ag-top-label { font-size: 9.5px; letter-spacing: .1em; color: #a3a9b8; flex: 0 0 auto; }
.ag-top-tag {
  padding: 3px 9px; border-radius: 999px; background: #f3f3ff; color: #4f46e5;
  border: 1px solid #e4e6ff; font-size: 10px; cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ag-top-tag:hover { background: #eceafd; }
.ag-mem-tools { display: flex; flex-direction: column; gap: 7px; }
.studio-inner .ag-q {
  width: 100%; padding: 8px 10px; border: 1px solid #e8eaf0; border-radius: 9px;
  font-size: 11.5px; background: #fff;
}
.ag-kind-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.ag-kind-chips .ag-chip { padding: 3px 9px; font-size: 10px; }
.ag-mem-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 120px; padding-right: 2px; }
.ag-mem-card { padding: 10px 11px; border: 1px solid #eef0f6; border-radius: 12px; background: #fff; transition: border-color .15s ease; }
.ag-mem-card:hover { border-color: #dfe2f0; }
.ag-mem-card.pinned { border-color: #e0e2ff; background: linear-gradient(180deg, #fbfaff, #fff); }
.ag-mem-card.flash { border-color: #8b8cf0; box-shadow: 0 0 0 3px #f1f1fe; }
.ag-mem-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ag-kind { padding: 2px 7px; border-radius: 5px; font-size: 9.5px; letter-spacing: .05em; }
.ag-kind.k-need { background: #eef2ff; color: #4338ca; }
.ag-kind.k-preference { background: #f5f0ff; color: #7c3aed; }
.ag-kind.k-fact { background: #f1f5f9; color: #475569; }
.ag-kind.k-style { background: #fff7e6; color: #b45309; }
.ag-strength { font: 500 9.5px/1 ui-monospace, monospace; color: #b0b5c2; letter-spacing: .03em; }
.ag-mem-card p { margin: 7px 0 0; font-size: 11.5px; line-height: 1.75; color: #3a4150; word-break: break-word; }
.ag-mem-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.ag-time { font-size: 9.5px; color: #b0b5c2; }
.ag-acts { display: flex; gap: 2px; }
.ag-acts .mini { padding: 3px 7px; font-size: 10.5px; }
.danger-text { color: #d92646; }
.danger-text:hover { background: #fdf0f3; }
.ag-add { margin-top: 2px; }
.field > label.ag-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #4b5162; }
.field > label.ag-check input { width: auto; flex: 0 0 auto; padding: 0; border: 0; accent-color: #4f46e5; margin: 0; }

@media (max-width: 1120px) {
  .ag-grid { grid-template-columns: 1fr; }
  .ag-msgs { max-height: none; }
}

/* ---- 短剧工坊：一键创作 + 成片 ---- */
.dr-hero-card { background: linear-gradient(135deg, rgba(79,70,229,.05), rgba(168,85,247,.04)); }
.dr-hero-hint { font-size: 12px; color: var(--muted); margin: 0 0 14px; line-height: 1.7; }
.dr-oneclick { display: grid; gap: 12px; }
.st-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dr-oneclick-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dr-oneclick-actions .primary { font-weight: 650; }
.dr-progress { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-weak); }
.dr-progress.hidden { display: none; }
.dr-prog-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 8px; }
.dr-prog-bar { height: 6px; border-radius: 4px; background: rgba(79,70,229,.15); overflow: hidden; }
.dr-prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #a855f7); transition: width .3s; }
.dr-prog-detail { font-size: 11px; color: var(--muted); margin-top: 6px; }
.dr-scene-tools, .dr-final-tools { display: flex; gap: 6px; }
.dr-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 4px; }
.dr-meta span { font-size: 10.5px; color: var(--muted-2); background: var(--panel); border: 1px solid var(--line-soft); border-radius: 5px; padding: 2px 7px; }
.dr-final-list { display: grid; gap: 12px; }
.dr-final-item { display: grid; grid-template-columns: 32px 180px 1fr; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.dr-final-no { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--muted-2); text-align: center; }
.dr-final-item video { width: 180px; max-height: 240px; border-radius: 7px; background: #000; }
.dr-final-info { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.dr-final-info b { font-size: 13px; }
.dr-final-info span { font-size: 11.5px; color: var(--muted); }
@media (max-width: 900px) {
  .st-row3 { grid-template-columns: 1fr; }
  .dr-final-item { grid-template-columns: 1fr; }
  .dr-final-item video { width: 100%; }
}

/* ---- 短剧：解析小说自动编剧 ---- */
.dr-novel-card { border-color: var(--accent-line); }
.dr-novel-head { cursor: pointer; user-select: none; }
.dr-novel-head:hover h3 { color: var(--accent); }
.dr-novel-body { margin-top: 10px; display: grid; gap: 12px; }
.dr-novel-body.hidden { display: none; }
.dr-novel-input { display: grid; grid-template-columns: 1fr 160px; gap: 12px; align-items: start; }
.dr-novel-side { display: grid; gap: 8px; justify-items: start; padding-top: 22px; }
.dr-novel-side .st-hint { margin: 0; line-height: 1.5; }
.dr-novel-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dr-novel-result { margin-top: 6px; }
.dr-novel-result.hidden { display: none; }
.dr-novel-preview { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 14px; display: grid; gap: 10px; }
.dr-novel-preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.dr-novel-preview-head b { font-size: 13.5px; }
.dr-novel-preview-head span { font-size: 11px; color: var(--muted); }
.dr-novel-chars { display: flex; gap: 6px; flex-wrap: wrap; }
.dr-novel-chars span { font-size: 10.5px; color: var(--muted-2); background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; }
.dr-novel-chars b { color: var(--ink); }
.dr-novel-scenes { display: grid; gap: 5px; max-height: 260px; overflow-y: auto; }
.dr-novel-scenes > div { display: grid; grid-template-columns: 26px 80px 1fr; gap: 8px; align-items: baseline; font-size: 11.5px; }
.dr-novel-scenes i { font-style: normal; font-family: ui-monospace, Menlo, monospace; color: var(--muted-2); }
.dr-novel-scenes b { font-weight: 600; }
.dr-novel-scenes span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .dr-novel-input { grid-template-columns: 1fr; }
  .dr-novel-side { padding-top: 0; }
}
