:root {
  --bg: #0a0a0d; --side: #17171b; --panel: #151519; --panel2: #1c1c22; --line: #2a2a33; --fg: #ececf1; --dim: #9a9aab;
  --pink: #ec4899; --pink2: #f472b6; --violet: #a78bfa; --ok: #34d399; --warn: #fbbf24; --bad: #f87171;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.6 -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); height: 100vh; }
@media (max-width: 860px) { .app { grid-template-columns: minmax(0, 1fr); } .side { display: none; } }

/* 左侧导航 */
.side { background: var(--side); display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; overflow: auto; }
.side .logo { display: flex; align-items: center; gap: 8px; padding: 2px 10px 14px; }
.side .logo img { height: 22px; }
.side .logo b { font-size: 13px; color: var(--dim); font-weight: 500; }
.nav-h { font-size: 12px; color: var(--dim); padding: 12px 12px 4px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: #d4d4dc; border: 0; background: none; text-align: left; width: 100%; }
.nav:hover { background: #222229; }
.nav.on { background: linear-gradient(90deg, rgba(236,72,153,.22), rgba(236,72,153,.08)); color: #fff; }
.nav .badge { font-size: 10px; background: var(--pink); color: #fff; border-radius: 4px; padding: 0 4px; margin-left: auto; }
.sess { font-size: 13px; padding: 7px 12px; border-radius: 8px; color: #c9c9d4; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess:hover { background: #222229; } .sess.on { background: #26262e; color: #fff; }
.side .grow { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: #1f1f26; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; }
.me .who { line-height: 1.25; min-width: 0; } .me .who small { color: var(--dim); font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me button { margin-left: auto; white-space: nowrap; flex: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-size: 12px; color: var(--dim); }

/* 顶栏 */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 20px; }
.top .crumb { color: var(--dim); font-size: 13px; }
.top .sp { flex: 1; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); background: #121216; white-space: nowrap; }
.pill.live { color: var(--ok); border-color: #1f4a3a; }
.pill.mock { color: var(--warn); border-color: #4a3d1f; }

/* 首页 */
.home { overflow: auto; flex: 1; padding: 8px 20px 60px; }
.home h1 { text-align: center; font-size: clamp(30px, 3vw, 56px); line-height: 1.12; margin: 18px 0 6px; font-weight: 800;
  background: linear-gradient(90deg, #a78bfa, #e879f9, #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home .sub { text-align: center; color: var(--dim); margin: 8px 0 28px; }
.wrap { max-width: 880px; margin: 0 auto; }
.composer { border: 1px solid var(--line); border-radius: 16px; background: #111115; padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 12px; }
.composer .ref { width: 58px; height: 74px; border: 1px dashed #3a3a46; border-radius: 10px; display: grid; place-items: center; color: var(--dim); font-size: 11px; text-align: center; background: #18181d; }
.composer textarea { width: 100%; min-height: 70px; resize: none; background: transparent; border: 0; outline: 0; color: var(--fg); font: inherit; }
.composer .bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; color: var(--dim); font-size: 13px; }
.composer .bar .sp { flex: 1; }
.chip svg, .note svg, .approve svg, .tool .hd svg { vertical-align: -2px; flex: none; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; background: #1d1d24; border: 1px solid var(--line); color: #cfcfda; font-size: 12px; }
.send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: linear-gradient(135deg, #db2777, #ec4899); color: #fff; display: grid; place-items: center; }
.send:disabled { opacity: .4; cursor: default; }
.h2 { font-size: 19px; font-weight: 700; margin: 34px 0 14px; display: flex; justify-content: space-between; align-items: center; }
.h2 small { font-size: 12px; color: var(--dim); font-weight: 400; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { background: none; border: 0; padding: 0; text-align: left; }
.card .im { aspect-ratio: 1.7 / 1; border-radius: 10px; overflow: hidden; background: var(--panel2); outline: 1px solid var(--line); }
.card .im img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover .im { outline-color: rgba(244,114,182,.5); }
.card .t { margin-top: 8px; font-weight: 600; font-size: 13px; }
.proj { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) { .proj { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.proj a, .proj button { display: block; background: none; border: 0; padding: 0; text-align: left; }
.proj .box { height: 112px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--pink); font-size: 26px; overflow: hidden; }
.proj .box img { width: 100%; height: 100%; object-fit: cover; }
.proj .t { margin-top: 8px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj .t small { display: block; color: var(--dim); font-size: 11px; }

/* 会话工作台 */
.work { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; border-top: 1px solid var(--line); }
@media (max-width: 1100px) { .work { grid-template-columns: minmax(0, 1fr); } .work .right { display: none; } .work.show-right .right { display: flex; } .work.show-right .chat { display: none; } }
.chat { display: flex; flex-direction: column; min-height: 0; }
.msgs { flex: 1; overflow: auto; padding: 18px 24px 8px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 760px; }
.msg.user { align-self: flex-end; background: #2a1f2a; border: 1px solid #3d2a3a; padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; min-width: 0; max-width: min(760px, 100%); }
.msg.bot .name { font-size: 12px; color: var(--pink2); margin-bottom: 2px; font-weight: 600; }
.tw-cursor::after { content: "▍"; color: var(--pink2); animation: blink 1s steps(1) infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }
.tool { align-self: flex-start; width: min(620px, 100%); border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 10px 12px; }
.tool .hd { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tool .hd b { font-weight: 600; }
.tool .hd .st { margin-left: auto; font-size: 12px; }
.st.run { color: var(--warn); } .st.ok { color: var(--ok); } .st.bad { color: var(--bad); } .st.wait { color: var(--violet); }
.prog { height: 4px; background: #24242c; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, #a78bfa, #ec4899); width: 0; transition: width .3s; }
.approve { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.btn { border: 1px solid var(--line); background: #1f1f26; border-radius: 9px; padding: 5px 14px; }
.btn.pri { background: linear-gradient(135deg, #db2777, #ec4899); border: 0; color: #fff; }
.btn.ghost { background: none; }
.sys { align-self: center; font-size: 12px; color: var(--dim); }
.chat .composer { margin: 8px 24px 18px; grid-template-columns: 1fr; }
.chat .composer textarea { min-height: 46px; }

/* 右侧面板 */
.right { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #0e0e12; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 8px 12px; color: var(--dim); border-bottom: 2px solid transparent; }
.tab.on { color: #fff; border-bottom-color: var(--pink); }
.tab .n { font-size: 11px; background: #26262e; border-radius: 6px; padding: 0 5px; margin-left: 4px; }
.pane { flex: 1; overflow: auto; padding: 12px; }
.ws-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); margin-bottom: 10px; flex-wrap: wrap; }
.file { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.file:hover { background: #18181e; }
.file .ic { width: 34px; height: 34px; border-radius: 8px; background: #1c1c23; display: grid; place-items: center; flex: none; overflow: hidden; color: var(--dim); }
.file .ic img { width: 100%; height: 100%; object-fit: cover; }
.file .nm { min-width: 0; flex: 1; } .file .nm div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .nm small { color: var(--dim); font-size: 11px; }
.file.new { animation: flash 2.4s ease-out; }
@keyframes flash { from { background: rgba(236,72,153,.25); } to { background: transparent; } }
.mem { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--panel); }
.mem .p { font-size: 12px; color: var(--dim); font-family: ui-monospace, Menlo, monospace; }
.mem .b { margin: 4px 0; }
.mem .row { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.tag { font-size: 11px; border-radius: 5px; padding: 0 6px; }
.tag.pending { background: #3a2f12; color: var(--warn); } .tag.active { background: #163527; color: var(--ok); } .tag.rejected { background: #3a1818; color: var(--bad); }
.empty { color: var(--dim); font-size: 13px; text-align: center; padding: 30px 10px; }
.note { font-size: 12px; color: var(--dim); background: #121217; border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; }

/* 登录 */
.login { display: grid; place-items: center; height: 100vh; padding: 20px; background: radial-gradient(1200px 600px at 50% -10%, rgba(236,72,153,.18), transparent), var(--bg); }
.login .box { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.login h1 { margin: 0 0 4px; font-size: 24px; }
.login p { color: var(--dim); margin: 0 0 18px; }
.users { display: grid; gap: 10px; }
.u { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #1a1a20; text-align: left; }
.u:hover { border-color: rgba(244,114,182,.6); }
.u small { display: block; color: var(--dim); font-size: 12px; }
.mobile-switch { display: none; }
@media (max-width: 1100px) { .mobile-switch { display: inline-flex; } }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal.zoom { cursor: zoom-out; }
.modal.zoom img { max-width: min(94vw, 1400px); max-height: 90vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }


.login .in { width: 100%; height: 44px; margin-bottom: 10px; border-radius: 10px; border: 1px solid var(--line); background: #1a1a20; color: var(--fg); padding: 0 12px; font: inherit; }
.login .in:focus { outline: 2px solid rgba(236,72,153,.5); }
.btn.wide { width: 100%; height: 44px; border-radius: 999px; margin-top: 4px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ===== 2026-10-26 升级：Markdown、打字机、工具卡片、预览、工作区、技能、风格库 ===== */
.composer .ref { cursor: pointer; position: relative; overflow: hidden; padding: 0; color: var(--dim); }
.composer .ref:hover { border-color: rgba(244,114,182,.6); color: #fff; }
.composer .ref img { width: 100%; height: 100%; object-fit: cover; }
.composer .ref .cnt { position: absolute; right: 3px; bottom: 3px; font-size: 10px; background: var(--pink); color: #fff; border-radius: 6px; padding: 0 5px; }
.composer textarea { max-height: 260px; }
.composer .bar { flex-wrap: wrap; row-gap: 8px; gap: 10px; }
.chip.act { cursor: pointer; }
.chip.act:hover { border-color: rgba(244,114,182,.55); color: #fff; }
.chip.on { border-color: var(--pink); color: #fff; background: rgba(236,72,153,.16); }
.chip small { color: var(--dim); font-size: 11px; margin-left: 2px; }
.btn { font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.btn.sm { padding: 3px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 3px 7px; }
.btn.danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:not(:disabled):hover { border-color: #4a4a58; }
.btn svg { flex: none; }
.linkbtn { border: 0; background: none; color: var(--pink2); font-size: 12px; padding: 2px 4px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.linkbtn:hover { color: #fff; text-decoration: underline; }
.sp { flex: 1; }

/* 顶栏：手机上的导航、会话的工作区标签、连接状态 */
.mnav { display: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #141418; place-items: center; color: #d4d4dc; flex: none; }
@media (max-width: 860px) { .mnav { display: grid; } .top { padding: 10px 12px; gap: 8px; } }
.top .crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.wschips { display: inline-flex; gap: 6px; min-width: 0; overflow: hidden; flex: 0 1 auto; }
.wsc { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; background: #121216; }
.wsc.pri { color: #e9d5ff; border-color: #3b2f5c; }
.pill.warn { color: var(--warn); border-color: #4a3d1f; }
@media (max-width: 600px) { .wsc:not(.pri) { display: none; } .top .crumb { display: none; } .hide-sm { display: none !important; } }

/* Markdown（助手回复与 .md 文件） */
.md { line-height: 1.7; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 1.1em 0 .45em; line-height: 1.35; font-weight: 700; }
.md h1 { font-size: 1.45em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1.1em; } .md h4, .md h5, .md h6 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.5em; } .md li { margin: .15em 0; } .md li > ul, .md li > ol { margin: .15em 0 .2em; }
.md li > p { margin: 0 0 .3em; }
.md input[type=checkbox] { margin: 0 6px 0 -2px; vertical-align: -1px; accent-color: var(--pink); }
.md a { color: var(--pink2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(244,114,182,.4); }
.md a:hover { color: #fff; }
.md a .wsl { vertical-align: -2px; margin-right: 2px; }
.md blockquote { margin: 0 0 .7em; padding: 4px 12px; border-left: 3px solid var(--violet); background: #15131c; border-radius: 0 8px 8px 0; color: #cfcfe0; }
.md blockquote > :last-child { margin-bottom: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.md img { max-width: min(100%, 420px); max-height: 360px; border-radius: 10px; display: block; margin: 6px 0; cursor: zoom-in; background: var(--panel2); }
.md code { background: #1d1d24; border-radius: 5px; padding: 1px 5px; font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.md pre { margin: 0; padding: 10px 12px; overflow: auto; background: #0c0c10; }
.md pre code { background: none; padding: 0; white-space: pre; font-size: 12.5px; line-height: 1.55; color: #e4e4ee; }
.codeblock { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0 0 .8em; background: #0c0c10; }
.cb-h { display: flex; align-items: center; justify-content: space-between; padding: 3px 6px 3px 12px; background: #16161c; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--dim); }
.cb-copy { border: 0; background: none; color: var(--dim); font-size: 11.5px; display: inline-flex; gap: 4px; align-items: center; padding: 3px 6px; border-radius: 6px; }
.cb-copy:hover { color: #fff; background: #24242c; }
.tablewrap { overflow-x: auto; margin: 0 0 .8em; border: 1px solid var(--line); border-radius: 10px; }
.md table { border-collapse: collapse; min-width: 100%; font-size: 13px; }
.md th, .md td { padding: 6px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.md td { white-space: normal; min-width: 64px; }
.md th { background: #18181f; font-weight: 600; color: #f3f3f8; }
.md tr:last-child td { border-bottom: 0; }
.md tbody tr:nth-child(even) td { background: #121217; }
.md th[align=right], .md td[align=right] { text-align: right; } .md th[align=center], .md td[align=center] { text-align: center; }
.md .tw-cursor { display: inline; }

/* 对话里的系统行、思考中 */
.sys.bad { color: var(--bad); }
.sys.busy { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 4px 2px; }
.sys.busy i { width: 5px; height: 5px; border-radius: 50%; background: var(--pink2); animation: dots 1.2s infinite ease-in-out; }
.sys.busy i:nth-child(2) { animation-delay: .15s; } .sys.busy i:nth-child(3) { animation-delay: .3s; }
.sys.busy span { margin-left: 6px; }
.sys.resume-fail { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.sys.resume-fail .b { display: inline-flex; gap: 6px; }
/* 停止：发送键在这一轮跑着时变成停止；工具卡片上的小停止；排队消息的撤回 */
.send.stop { background: #26262e; border: 1px solid rgba(244,114,182,.55); color: #fbcfe8; }
.send.stop:hover { background: #33333d; }
.tool .hd .tstop { margin-left: 4px; font-size: 12px; }
.msg.user .uq { font-size: 12px; opacity: .75; margin-top: 4px; }
.msg.user .uq .linkbtn { font-size: 12px; padding: 0 2px; }
.msg.user.cancelled { opacity: .5; }
@keyframes dots { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* 工具卡片 */
.tool { padding: 10px 12px 12px; }
.tool.solo { width: min(620px, 100%); }
.tool .hd b { white-space: nowrap; }
.tool .hd .elapsed { font-size: 12px; color: var(--dim); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tool .hd .elapsed:empty { display: none; }
.tool .hd .elapsed:not(:empty) + .st { margin-left: 10px; }
.tool.is-run { border-color: #3a3346; }
.tool .args { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #b8b8c6; }
.tool .args .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ac { display: inline-flex; gap: 5px; align-items: center; border-radius: 6px; background: #1d1d25; border: 1px solid #2c2c37; padding: 1px 7px; font-size: 11.5px; color: #e4e4ee; white-space: nowrap; }
.ac i { font-style: normal; color: var(--dim); }
.arg-path, .arg-kv, .arg-xfer { display: flex; align-items: center; gap: 8px; min-width: 0; }
.arg-path .k, .arg-kv .k, .arg-long .k { color: var(--dim); font-size: 11.5px; flex: none; }
.arg-path code, .arg-xfer code { font: 11.5px/1.5 ui-monospace, Menlo, Consolas, monospace; color: #d6d6e2; background: #0f0f13; border-radius: 5px; padding: 1px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.arg-path img { width: 26px; height: 26px; object-fit: cover; border-radius: 5px; flex: none; cursor: zoom-in; }
.arg-xfer { flex-wrap: wrap; row-gap: 4px; background: #121219; border: 1px dashed #34304a; border-radius: 8px; padding: 6px 8px; }
.arg-xfer .xw { color: #e9d5ff; font-weight: 600; }
.arg-xfer .arr { color: var(--pink2); display: inline-flex; }
.arg-kv .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.arg-long { background: #0f0f13; border-radius: 8px; padding: 6px 9px; position: relative; }
.arg-long .v { white-space: pre-wrap; word-break: break-word; color: #cdcdda; line-height: 1.55; }
.clamp:not(.open) .v { max-height: 4.65em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.more { border: 0; background: none; color: var(--pink2); font-size: 12px; padding: 2px 0 0; }
.more:hover { color: #fff; }
.slot-prog:empty, .slot-ap:empty, .slot-out:empty { display: none; }
.slot-prog .prog { margin-top: 10px; }
.ptext { margin-top: 6px; font-size: 12px; color: var(--dim); }
.approve { padding: 8px 10px; border-radius: 10px; background: #17141f; border: 1px solid #3a2f5c; }
.approve { flex-wrap: nowrap; align-items: flex-start; }
.approve > svg { margin-top: 4px; }
.approve .sum { min-width: 0; flex: 1; line-height: 1.6; }
.approve .ap-b { display: flex; gap: 6px; flex: none; }
@media (max-width: 600px) { .approve { flex-wrap: wrap; } .approve .ap-b { width: 100%; justify-content: flex-end; } }
.slot-out { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.out-img img { max-width: 100%; max-height: 380px; border-radius: 10px; display: block; cursor: zoom-in; background: var(--panel2); }
.out-text { font-size: 13px; color: var(--dim); }
.out-text .v { white-space: pre-wrap; word-break: break-word; }
.out-text.bad { color: #f0a3a3; }
.vid video { width: 100%; max-height: 420px; border-radius: 10px; background: #000; display: block; }
.miss { display: flex; align-items: center; gap: 8px; padding: 18px 14px; border-radius: 10px; border: 1px dashed var(--line); color: var(--dim); font-size: 13px; background: #111116; }

/* 网页预览 */
.pv { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0c0c10; }
.pv-stage { position: relative; display: flex; justify-content: center; background: repeating-conic-gradient(#121217 0 25%, #0e0e12 0 50%) 0 0 / 16px 16px; cursor: zoom-in; min-height: 60px; }
.pv-stage.off { cursor: default; background: #0e0e12; }
.pv-holder { position: relative; overflow: hidden; flex: none; }
.pv-holder iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: #fff; display: block; }
.pv-stage .pv-holder iframe { pointer-events: none; }
.pv-msg { padding: 22px 14px; color: var(--dim); font-size: 13px; text-align: center; width: 100%; }
.pv-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); background: #131318; }
.pv-name { color: #e4e4ee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pv-dim { font-variant-numeric: tabular-nums; }

/* 弹窗 */
.modal { animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(760px, 94vw); max-height: 90vh; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.sheet.wide { width: min(1200px, 96vw); height: 90vh; }
.sheet.confirm, .sheet.nwd { width: min(440px, 94vw); }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); min-height: 50px; flex-wrap: wrap; row-gap: 8px; }
.sheet-t { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.sheet-tools { display: flex; align-items: center; gap: 8px; }
.sheet-b { flex: 1; overflow: auto; min-height: 0; padding: 14px 16px; }
.x { width: 30px; height: 30px; border-radius: 8px; border: 0; background: none; color: var(--dim); font-size: 20px; line-height: 1; }
.x:hover { background: #24242c; color: #fff; }
.seg { display: inline-flex; background: #101014; border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--dim); padding: 3px 12px; border-radius: 7px; font-size: 13px; white-space: nowrap; }
.seg button.on { background: #26262f; color: #fff; }
.seg button small { font-size: 11px; color: var(--dim); margin-left: 5px; }
.seg.sm button { font-size: 12px; padding: 2px 10px; }
.pm .sheet-b { padding: 0; display: flex; flex-direction: column; }
.pm-stage { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 16px; background: repeating-conic-gradient(#121217 0 25%, #0e0e12 0 50%) 0 0 / 16px 16px; min-height: 0; }
.pm-stage.fitwin { overflow: hidden; align-items: center; }
.pm-stage .pv-holder { box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.src-wrap { position: relative; }
.src-copy { position: sticky; top: 0; float: right; z-index: 1; }
pre.src { margin: 0; white-space: pre-wrap; word-break: break-word; font: 12.5px/1.6 ui-monospace, Menlo, Consolas, monospace; color: #d9d9e4; }
.pm .src-wrap { padding: 14px 16px; overflow: auto; flex: 1; }
.doc-md { max-width: 820px; margin: 0 auto; }
.player .sheet-b { padding: 0; background: #000; }
.player .vid video { max-height: 78vh; border-radius: 0; }
.player .miss { margin: 16px; }
.cf-t { margin: 0 0 16px; line-height: 1.7; }
.cf-b { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.cf-b .err { margin-right: auto; color: var(--bad); font-size: 12px; }

/* 提示条 */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: #23232b; border: 1px solid #34343f; color: #f2f2f7; padding: 8px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: up .18s ease-out; transition: opacity .25s; }
.toast.ok { border-color: #1f4a3a; } .toast.ok::before { content: "✓ "; color: var(--ok); }
.toast.bad { border-color: #5a2323; color: #fecaca; }
.toast.out { opacity: 0; }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

/* 浮层（新会话） */
.pop-layer { position: fixed; inset: 0; z-index: 60; }
@media (max-width: 600px) { .pop-layer { background: rgba(0,0,0,.55); } }
.pop { position: fixed; width: min(340px, 94vw); max-height: 86vh; overflow: auto; background: var(--panel); border: 1px solid #34343f; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); padding: 14px; }
.ns-h { font-weight: 700; margin-bottom: 6px; }
.ns-sec { font-size: 12px; color: #d4d4dc; margin: 10px 0 6px; font-weight: 600; }
.ns-sec small { display: block; color: var(--dim); font-weight: 400; }
.ns-list { display: flex; flex-direction: column; gap: 2px; }
.ns-opt { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ns-opt:hover { background: #1c1c23; }
.ns-opt input { accent-color: var(--pink); margin: 0; }
.ns-opt em { font-style: normal; margin-left: auto; font-size: 11px; color: var(--dim); }
.ns-opt.fixed { cursor: default; opacity: .8; }
.ns-f { display: flex; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.pop .linkbtn { margin-top: 6px; }

/* 新建工作区 */
.fl { display: block; font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.fl .in, .sheet .in { display: block; width: 100%; height: 38px; margin-top: 6px; border-radius: 9px; border: 1px solid var(--line); background: #1a1a20; color: var(--fg); padding: 0 12px; font: inherit; }
.sheet .in:focus { outline: 2px solid rgba(236,72,153,.5); }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.type { text-align: left; border: 1px solid var(--line); background: #17171d; border-radius: 10px; padding: 10px; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; }
.type small { grid-column: 1 / -1; color: var(--dim); font-size: 12px; line-height: 1.5; }
.type.on { border-color: var(--pink); background: rgba(236,72,153,.1); }

/* 右侧：工作区切换、文件分组 */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tab { white-space: nowrap; }
.wsbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.wsp { position: relative; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #141419; border-radius: 9px; padding: 4px 10px; font-size: 12.5px; color: #d4d4dc; max-width: 100%; }
.wsp span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsp:hover { border-color: #4a4a58; }
.wsp.on { border-color: var(--pink); background: rgba(236,72,153,.12); color: #fff; }
.wsp.dim { opacity: .55; }
.wsp.add { border-style: dashed; color: var(--dim); }
.wsp em { font-style: normal; font-size: 10.5px; border-radius: 4px; padding: 0 4px; }
.t-main { background: var(--pink); color: #fff; } .t-on { background: #163527; color: var(--ok); } .t-off { background: #26262e; color: var(--dim); }
.wsp .dot { position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--pink2); box-shadow: 0 0 0 2px #0e0e12; }
.ws-head b { color: #e4e4ee; font-weight: 600; }
.ws-head .tp { font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.fgrp { margin-bottom: 6px; }
.fg-h { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; color: #c9c9d4; font-size: 12.5px; padding: 4px 4px; border-radius: 6px; text-align: left; }
.fg-h:hover { background: #16161c; }
.fg-h .n { margin-left: auto; font-size: 11px; background: #26262e; border-radius: 6px; padding: 0 6px; color: var(--dim); }
.chev { display: inline-flex; transition: transform .15s; transform: rotate(90deg); color: var(--dim); }
.shut > * > .chev, .shut .skg-t .chev { transform: rotate(0); }
.fgrp.shut .fg-b { display: none; }
.fg-b { padding-left: 8px; }
.file { cursor: pointer; }
.file:focus-visible { outline: 2px solid rgba(236,72,153,.5); }
.file .ic.k-video { color: #7dd3fc; } .file .ic.k-page { color: #c4b5fd; } .file .ic.k-markdown { color: #f9a8d4; }

/* 技能 */
.skg { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: 10px; overflow: hidden; }
.skg-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 6px; }
.skg-t { display: flex; align-items: center; gap: 6px; border: 0; background: none; text-align: left; flex: 1; min-width: 0; padding: 2px; }
.skg-t .tt { min-width: 0; } .skg-t b { display: block; font-size: 13.5px; }
.skg-t small { display: block; color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skg .cnt { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.skg.shut .skg-b { display: none; }
.skg-b { border-top: 1px solid var(--line); padding: 4px 0; }
.sk { display: flex; align-items: center; gap: 10px; padding: 7px 12px; }
.sk-t { flex: 1; min-width: 0; }
.sk-t b { font-weight: 500; font-size: 13px; display: block; }
.sk-t small { display: block; color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk.off .sk-t { opacity: .55; }
.sklib { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 12px; color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
.sklib .k { color: var(--dim); } .sklib b { color: var(--fg, #fff); font-size: 13px; }
.sklib code { font-size: 11.5px; background: #1c1c24; border-radius: 4px; padding: 0 5px; }
.sklib .br { overflow-wrap: anywhere; } .sklib .dt { flex-basis: 100%; }
.skb { font-style: normal; font-weight: 500; font-size: 10.5px; border: 1px solid var(--line); color: var(--dim); border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.skb.r18 { border-color: #7f1d1d; color: #fca5a5; background: #2a1414; }
.sw { position: relative; width: 32px; height: 18px; border-radius: 999px; border: 0; background: #34343f; flex: none; padding: 0; transition: background .15s; }
.sw i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #d4d4dc; transition: left .15s, background .15s; }
.sw.on { background: var(--pink); } .sw.on i { left: 16px; background: #fff; }
.sw.mixed { background: linear-gradient(90deg, var(--pink) 50%, #34343f 50%); } .sw.mixed i { left: 9px; background: #fff; }
.sw:focus-visible { outline: 2px solid rgba(236,72,153,.6); outline-offset: 2px; }

/* 首页：技能分组标签 */
.gchips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.gchips .lbl { font-size: 12px; color: var(--dim); display: inline-flex; gap: 5px; align-items: center; margin-right: 2px; }

/* 风格库 */
.styles .sheet-b { display: flex; flex-direction: column; gap: 10px; }
.search { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #101014; border-radius: 9px; padding: 0 10px; color: var(--dim); }
.search input { border: 0; outline: 0; background: none; color: var(--fg); font: inherit; font-size: 13px; height: 30px; width: 200px; }
.st-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.st-cats:empty { display: none; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start; }
.st-grid .pv-msg { grid-column: 1 / -1; }
.st-card { border: 1px solid var(--line); background: #141419; border-radius: 12px; padding: 0 0 8px; text-align: left; overflow: hidden; }
.st-card:hover { border-color: rgba(244,114,182,.6); transform: translateY(-1px); }
.st-im { aspect-ratio: 1 / 1; background: linear-gradient(135deg, #2a1f3a, #3a1f30); display: grid; place-items: center; overflow: hidden; }
.st-im img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-im .ph { font-size: 36px; font-weight: 800; color: rgba(255,255,255,.55); }
.st-n { padding: 6px 10px 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-c { padding: 0 10px; font-size: 11.5px; color: var(--dim); }

/* 拖文件进对话 */
.chat { position: relative; }
.drop { position: absolute; inset: 10px; border: 2px dashed var(--pink2); border-radius: 16px; background: rgba(10,10,13,.86); display: none; place-items: center; z-index: 5; pointer-events: none; text-align: center; }
.drop.on { display: grid; }
.drop div { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; }
.drop small { color: var(--dim); }

/* 窄屏 */
@media (max-width: 600px) {
  .msgs { padding: 14px 12px 8px; }
  .chat .composer { margin: 6px 10px 10px; padding: 10px; }
  .home { padding: 8px 12px 40px; }
  .composer { gap: 10px; }
  .sheet, .sheet.wide { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .sheet.confirm, .sheet.nwd { height: auto; border-radius: 14px; width: 94vw; }
  .modal { padding: 0; }
  .sheet-t { max-width: 60vw; }
  .search input { width: 140px; }
  .st-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .types { grid-template-columns: 1fr; }
  .tool .hd { flex-wrap: wrap; }
}
/* 原来的 .side { display: flex } 写在窄屏隐藏规则后面，把它盖掉了：窄屏这里再藏一次（导航改用顶栏的两个按钮） */
@media (max-width: 860px) { .side { display: none; } }

/* 浏览器工具（在用户浏览器的沙盒里执行） */
.arg-long.mono .v { font: 11.5px/1.55 ui-monospace, Menlo, Consolas, monospace; color: #d6d6e2; }
.slot-ct:empty { display: none; }
.ct { margin-top: 10px; border-radius: 10px; padding: 9px 11px; border: 1px solid #34304a; background: #15131d; font-size: 13px; }
.ct-h { display: flex; align-items: center; gap: 7px; }
.ct-h b { font-weight: 600; }
.ct-el { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ct-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; font-size: 12px; color: #6e6e80; }
.ct-steps i { font-style: normal; color: #4a4a58; }
.ct-steps .done { color: var(--ok); } .ct-steps .done::before { content: "✓ "; }
.ct-steps .on { color: #fff; font-weight: 600; }
.ct .prog { margin-top: 8px; }
.prog.indet i { width: 35%; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
.ct-note { margin-top: 6px; font-size: 12px; color: var(--dim); line-height: 1.55; }
.ct-b { margin-top: 8px; display: flex; justify-content: flex-end; }
.ct.ok { display: flex; align-items: center; gap: 7px; border-color: #1f4a3a; background: #0f1a16; color: #b7ead3; }
.ct.bad { border-color: #5a2323; background: #1a1012; }
.ct.bad .ct-note { color: #f0a3a3; }

/* 从「新会话」浮层里点「新建工作区」时，弹窗要盖住浮层（.modal 50 < .pop-layer 60） */
.pop-layer ~ .modal{z-index:61}

/* 权限模式：输入框旁的小选择器、浮层里的四个选项 */
.mode-btn { gap: 5px; white-space: nowrap; margin-left: auto; } /* 窄屏折行时和发送按钮一起靠右 */
.mode-btn[hidden] { display: none; }
.mode-btn.warn { border-color: #5a4518; color: var(--warn); background: rgba(251,191,36,.08); }
.mode-btn.plan { border-color: #3a2f5c; color: var(--violet); }
.modes .ns-h small { display: block; font-size: 12px; color: var(--dim); font-weight: 400; margin-top: 2px; }
.md-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.md-opt { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 8px; row-gap: 2px; align-items: start; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--fg); cursor: pointer; }
.md-opt:hover { background: #1c1c23; }
.md-opt.on { border-color: var(--pink); background: rgba(236,72,153,.1); }
.md-opt:disabled { opacity: .6; cursor: default; }
.md-opt .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #5a5a6a; margin-top: 2px; }
.md-opt.on .dot { border-color: var(--pink); background: radial-gradient(circle, var(--pink) 0 3.5px, transparent 4px); }
.md-opt b { font-size: 13.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.md-opt b em { font-style: normal; font-weight: 400; font-size: 11px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.md-opt small { grid-column: 2; color: var(--dim); font-size: 12px; line-height: 1.5; }
.md-opt small.md-warn { color: var(--warn); }
.md-opt small.md-warn::before { content: "⚠ "; }
.md-f { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.md-note { color: var(--violet); margin-bottom: 6px; }
.md-def { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.md-def .linkbtn { margin: 0; }
.toast.warn { border-color: #5a4518; color: #fde68a; }
/* 工具卡：花积分的工具做完后扣的积分 */
.tool .hd .cr { font-size: 11.5px; color: var(--warn); border: 1px solid #4a3d1f; border-radius: 999px; padding: 0 7px; white-space: nowrap; }
.tool .hd .cr[hidden] { display: none; }
/* 审批卡：本会话都允许这类操作；计划审批的计划全文 */
.approve .ap-b { flex-wrap: wrap; justify-content: flex-end; }
.approve .btn.ghost.sm { background: none; color: #d4d4dc; }
.plan-box { margin-top: 10px; border: 1px solid #3a2f5c; border-radius: 10px; background: #13111a; padding: 8px 12px; max-height: 360px; overflow: auto; }
.plan-box .k { font-size: 12px; color: var(--violet); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.plan-box .md { font-size: 13px; }
.types.eng .type { grid-template-columns: 1fr; }

/* ===================================================================================================
   2026-10-26 移动端适配（wip-mobile）：只追加、不改上面的规则。配合 mobile.js（顶栏按钮、遮罩、手势、软键盘）。
   断点：窄屏 ≤860px = 会话列表变左侧抽屉、文件/记忆/技能变底部抽屉；手机 ≤600px（或横屏矮于 500px 的触屏）= 浮层变底部弹层、弹窗全屏。
   --vvh / --vvt 由 mobile.js 按 visualViewport 写入（键盘弹起、浏览器工具栏展开时跟着变）；没有 JS 时退回 100dvh。
   =================================================================================================== */

/* 默认（桌面）藏起移动端专用的元素 */
.m-scrim, .m-grip, .m-sheet-x { display: none; }
.msg.user { overflow-wrap: anywhere; }          /* 长网址、长英文不再把气泡撑出屏幕（桌面同样受益） */

/* ---- 视口：按可见高度排版（不是 100vh），安全区，防止整页滚动/下拉刷新 ---- */
@media (max-width: 860px), (pointer: coarse) {
  html, body { overflow: hidden; overscroll-behavior: none; }
  body { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
  .app { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); grid-template-rows: minmax(0, 1fr); }
  .main { height: var(--vvh, 100dvh); min-height: 0; }
  .login { height: var(--vvh, 100dvh); display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain;
    padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .login .box { margin: auto; }
  .msgs, .pane, .sheet-b, .pop, .side, .home, .pm-stage, .plan-box { overscroll-behavior: contain; }
  .msgs { overflow-x: hidden; }
  .modal { inset: auto 0 auto 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); }
  .pop-layer { inset: auto 0 auto 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); }
  /* iOS 输入框字号 < 16px 聚焦时会把整页放大 */
  .composer textarea, .login .in, .sheet .in, .fl .in, .search input, #lwName { font-size: 16px; }
  .composer textarea { max-height: min(260px, calc(var(--vvh, 100dvh) * .3)); overflow-y: auto !important; }
  /* 悬停样式在触屏上会「粘住」 */
  .st-card:hover { transform: none; }
}

/* ---- 窄屏：顶栏、左侧抽屉（会话列表）、右侧底部抽屉（文件/记忆/技能） ---- */
@media (max-width: 860px) {
  .top { padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); gap: 6px; min-height: 56px; }
  .mnav { width: 40px; height: 40px; border-radius: 10px; position: relative; }
  .mnav svg { width: 18px; height: 18px; }
  .m-menu { order: -1; }
  .m-panel { margin-left: 2px; }
  .top .pill.live:not(.warn) { display: none; }        /* 连接正常时省掉这块，断线重连时才显示 */
  .top .pill { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .wschips { flex: 0 1 auto; }

  .m-scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(0,0,0,.55); opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; }
  html.m-drawer .m-scrim, .app:has(.work.show-right) .m-scrim { opacity: 1; visibility: visible; transition: opacity .2s; }

  /* 会话列表抽屉：就是桌面的侧栏，滑进来 */
  .side { display: flex; position: fixed; z-index: 46; left: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); width: min(304px, 86vw);
    padding: max(14px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    box-shadow: 12px 0 40px rgba(0,0,0,.5); border-right: 1px solid var(--line);
    transform: translateX(-105%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; will-change: transform; }
  html.m-drawer .side { transform: none; visibility: visible; transition: transform .22s ease; }
  .side .nav, .side .sess { min-height: 44px; display: flex; align-items: center; }
  .side .sess { padding: 10px 12px; font-size: 14px; display: block; line-height: 24px; }
  .me { margin-top: 8px; }
  .me button { min-height: 40px; padding: 0 14px; font-size: 13px; position: relative; }
  .me button::after { content: ""; position: absolute; inset: -4px -4px; }

  /* 文件 / 记忆 / 技能：底部抽屉，盖住对话但留出顶栏 */
  .work .right, .work.show-right .right { --m-gap: max(48px, calc(env(safe-area-inset-top) + 14px));
    display: flex; position: fixed; z-index: 45; left: 0; right: 0; top: calc(var(--vvt, 0px) + var(--m-gap)); height: calc(var(--vvh, 100dvh) - var(--m-gap));
    border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -20px 60px rgba(0,0,0,.55); padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(105%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; will-change: transform; }
  .work.show-right .right { transform: none; visibility: visible; transition: transform .25s ease; }
  .work.show-right .chat { display: flex; }               /* 抽屉后面的对话还在，不再整页切换 */
  .m-grip { display: block; height: 18px; flex: none; touch-action: none; cursor: grab; }
  .m-grip i { display: block; width: 40px; height: 5px; border-radius: 99px; background: #3a3a46; margin: 8px auto 0; }
  .right .m-sheet-x { display: grid; place-items: center; position: absolute; top: 14px; right: max(6px, env(safe-area-inset-right)); width: 44px; height: 44px; font-size: 24px; z-index: 2; }
  .right .tabs { padding: 2px 52px 0 max(12px, env(safe-area-inset-left)); touch-action: pan-x; }
  .tab { min-height: 44px; }
  #toChat, #toRight { display: none !important; }        /* 顶栏有入口了，输入框旁的「工作区」和「← 对话」收起来 */
  .pane { padding: 12px max(12px, env(safe-area-inset-right)) 16px max(12px, env(safe-area-inset-left)); }

  /* 对话区：安全区、长内容只在自己里面横向滚 */
  .msgs { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .msg.user { max-width: min(760px, 88%); }
  .msg.bot, .tool, .tool.solo { max-width: 100%; min-width: 0; }
  .md pre, .tablewrap, .plan-box { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .plan-box { max-height: none; }
  .chat .composer { margin: 6px max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  html.kb-open .chat .composer { margin-bottom: 8px; }
  html.kb-short .top { display: none; }                   /* 横屏 + 键盘：只剩一点高度，先让给输入框和消息 */
  .home { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

  /* 审批卡：按钮占满一行、够大；「本会话都允许」单独一行 */
  .approve { flex-wrap: wrap; }
  .approve .ap-b { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .approve .ap-b .btn { min-height: 44px; justify-content: center; font-size: 14px; border-radius: 10px; }
  .approve .ap-b [data-d="always"] { grid-column: 1 / -1; order: 2; }
  .ct-b .btn { width: 100%; min-height: 44px; justify-content: center; }
  .mem .row .btn { min-height: 40px; flex: 1; justify-content: center; }
}

/* ---- 触屏：点击区至少 44×44（小按钮用不可见的 ::after 扩大点击区，外观不变） ---- */
@media (max-width: 860px), (pointer: coarse) {
  .send { width: 44px; height: 44px; flex: none; }
  .composer .bar { gap: 8px; }
  .composer .bar .chip.act, .mode-btn { min-height: 40px; padding: 0 12px; position: relative; }
  .btn.sm, .linkbtn, .more, .sw, .cb-copy, .seg button, .lw-link, .tab, .composer .bar .chip.act, .mnav, .x, .fg-h, .wsp, .gchips .chip.act, .st-cats .chip.act, .file { position: relative; }
  .btn.sm::after, .linkbtn::after, .more::after, .sw::after, .cb-copy::after, .seg button::after, .lw-link::after, .tab::after,
  .composer .bar .chip.act::after, .mnav::after, .fg-h::after, .wsp::after, .gchips .chip.act::after, .st-cats .chip.act::after, .btn:not(.sm)::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
  .btn { min-height: 38px; position: relative; }
  .btn.sm { min-height: 32px; }
  .x { width: 44px; height: 44px; font-size: 24px; }
  .fg-h { min-height: 44px; }
  .wsp { min-height: 40px; }
  .wsbar { gap: 8px; }
  .fl .in, .sheet .in, .lw-name .in { height: 44px; }
  .search { min-height: 44px; }
  .ns-opt { min-height: 44px; padding: 8px 10px; }
  .ns-opt input { width: 18px; height: 18px; }
  .ns-f .btn, .cf-b .btn { min-height: 44px; }
  .md-opt { padding: 12px; }
  .lw-choice { padding: 12px 14px; }
  .sk { min-height: 48px; }
  .gchips { gap: 10px 8px; }
  .gchips .chip.act { min-height: 36px; }
  .cb-h { padding: 0 2px 0 12px; min-height: 44px; }
  .cb-copy { min-height: 44px; padding: 0 12px; }   /* 代码块 overflow:hidden 会裁掉 ::after 扩出来的点击区，直接给够高 */
}

/* ---- 手机：浮层变底部弹层（权限模式、新会话），弹窗全屏，确认框变底部弹层 ---- */
@media (max-width: 600px), (max-height: 500px) and (pointer: coarse) {
  .pop-layer { background: rgba(0,0,0,.55); }
  .pop-layer .pop { position: absolute; left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: 560px; margin: 0 auto;
    max-height: calc(var(--vvh, 100dvh) - max(24px, env(safe-area-inset-top))); border-radius: 18px 18px 0 0; border-bottom: 0;
    padding: 26px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); animation: m-up .22s ease-out; }
  .pop-layer .pop::before { content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 99px; background: #3a3a46; }
  .modes .ns-h, .ns .ns-h { font-size: 16px; }
  .md-list { gap: 8px; }
  .md-opt { min-height: 60px; padding: 12px 14px; border-color: var(--line); background: #17171d; column-gap: 12px; }
  .md-opt.on { border-color: var(--pink); background: rgba(236,72,153,.1); }
  .md-opt .dot { width: 18px; height: 18px; margin-top: 3px; }
  .md-opt.on .dot { background: radial-gradient(circle, var(--pink) 0 4.5px, transparent 5px); }
  .md-opt b { font-size: 15px; }
  .md-opt small { font-size: 13px; }
  .md-def .linkbtn { min-height: 36px; }
  .ns-f .btn { flex: 1; justify-content: center; }

  .modal { padding: 0; place-items: end stretch; }
  .sheet, .sheet.wide, .sheet.nwd { width: 100%; max-width: none; height: var(--vvh, 100dvh); max-height: none; border-radius: 0; border: 0; }
  .sheet-h { position: relative; padding: max(8px, env(safe-area-inset-top)) calc(54px + env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left)); min-height: 56px; }
  .sheet-h .x { position: absolute; right: max(4px, env(safe-area-inset-right)); top: calc(max(8px, env(safe-area-inset-top)) + 2px); }
  .sheet-t { max-width: 100%; font-size: 15px; line-height: 40px; }
  .sheet-b { padding: 14px max(14px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .pm .sheet-b, .player .sheet-b { padding-bottom: env(safe-area-inset-bottom); }
  .seg button { min-height: 36px; }
  .sheet.confirm { height: auto; max-height: calc(var(--vvh, 100dvh) - 40px); width: 100%; border-radius: 18px 18px 0 0; border-top: 1px solid var(--line); animation: m-up .22s ease-out; }
  .sheet.confirm .sheet-h { padding-top: 10px; }
  .sheet.confirm .sheet-h .x { top: 8px; }
  .cf-b { flex-wrap: wrap; }
  .cf-b .err { flex-basis: 100%; margin: 0 0 4px; }
  .cf-b .btn { flex: 1; justify-content: center; }
  .cf-b .sp { display: none; }

  /* 风格库：搜索框占满标题栏，分类横向滑 */
  .styles .sheet-tools { order: 3; flex: 1 0 100%; min-width: 0; }
  .styles .search { flex: 1; min-width: 0; height: 44px; }
  .styles .seg.st-models, .styles .st-cats { flex: none; }
  .search input { width: 100%; min-width: 0; height: 44px; }
  .st-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px; }
  .st-cats::-webkit-scrollbar { display: none; }
  .st-cats .chip { flex: none; min-height: 36px; }
  .seg.st-models { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; align-self: flex-start; }

  /* 看大图：图片按可见区缩放，右上角给个「×」提示（点哪里都会关） */
  .modal.zoom { place-items: center; background: rgba(0,0,0,.88); }
  .modal.zoom img { max-width: 100vw; max-height: calc(var(--vvh, 100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px); border-radius: 0; }
  .modal.zoom::after { content: "×"; position: absolute; top: calc(env(safe-area-inset-top) + 8px); right: max(10px, env(safe-area-inset-right)); width: 44px; height: 44px;
    border-radius: 50%; background: rgba(36,36,44,.9); color: #fff; font-size: 26px; line-height: 44px; text-align: center; pointer-events: none; }

  /* 提示条放到顶栏下面，不再盖住输入框（键盘弹起时也看得到） */
  #toasts { top: calc(var(--vvt, 0px) + max(8px, env(safe-area-inset-top)) + 56px); bottom: auto; max-width: calc(100vw - 24px); }
  .toast { text-align: center; }

  /* 输入框工具条：参考素材、风格库只留图标，一行放得下 */
  .composer .bar #refBtn, .composer .bar #styBtn { font-size: 0; gap: 0; width: 40px; padding: 0; justify-content: center; }
  .composer .bar #refBtn svg, .composer .bar #styBtn svg { width: 18px; height: 18px; }
  .mode-btn { font-size: 13px; }
  .h2 { margin: 26px 0 12px; }
  .home h1 { font-size: 26px; }
}
@media (max-width: 600px) and (max-height: 720px), (max-height: 500px) and (pointer: coarse) {
  .pop-layer .pop { padding-top: 22px; }
  .modes .ns-h { font-size: 15px; }
  .md-list { gap: 6px; margin-top: 8px; }
  .md-opt { min-height: 52px; padding: 9px 12px; row-gap: 1px; }
  .md-opt small { font-size: 12.5px; line-height: 1.45; }
  .md-f { margin-top: 8px; padding-top: 8px; }
}
@media (max-width: 600px) and (max-height: 600px) {
  .pop-layer .pop { padding-top: 20px; }
  .md-opt { min-height: 48px; padding: 7px 12px; }
  .md-list { gap: 5px; }
  .modes .ns-h small { margin-top: 0; }
}
@media (max-height: 500px) and (pointer: coarse) and (min-width: 601px) {   /* 横屏手机：权限模式四个选项排两列，一屏放得下 */
  .pop-layer .pop { max-width: 780px; padding-top: 18px; }
  .md-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
  .md-opt { align-content: start; }
  .md-opt small { font-size: 12px; }
}
@keyframes m-up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .side, .work .right, .m-scrim { transition: none !important; } .pop-layer .pop, .sheet.confirm { animation: none; } }
/* ===== 移动端适配结束 ===== */

/* 文件卡片（工具 ShowFiles，showfiles.js） */
.tool.is-files { width: min(760px, 100%); }
.fcs { margin-top: 8px; }
.fcs-h { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.fcs-h svg { flex: none; }
.fcs-h .n { color: var(--dim); font-size: 12px; }
.fcs-h .sp { flex: 1; }
.fcs-note { font-size: 13px; color: #cfcfda; margin-top: 4px; overflow-wrap: anywhere; }
.fcs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 10px; }
.fcs-grid.one { grid-template-columns: minmax(0, 1fr); }
.fc { border: 1px solid var(--line); border-radius: 10px; background: #111115; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.fc-pv { position: relative; min-height: 110px; max-height: 300px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #0c0c10; border-bottom: 1px solid var(--line); }
.fc-pv.off { min-height: 90px; }
.fc-pv img { max-width: 100%; max-height: 300px; display: block; cursor: zoom-in; object-fit: contain; }
.fc-pv .vid { width: 100%; } .fc-pv .vid video { max-height: 300px; border-radius: 0; }
.fc.k-audio .fc-pv { flex-direction: column; gap: 8px; padding: 14px 10px; }
.fc-audio { color: var(--violet); } .fc-audio svg { width: 30px; height: 30px; }
.fc-pv audio { width: 100%; }
.fc-pdf { width: 100%; height: 300px; border: 0; background: #fff; display: block; }
.fc-pdf.big { height: 78vh; }
.fc-full { position: absolute; right: 8px; bottom: 8px; background: rgba(20,20,26,.9); }
.fc-pv.page { display: block; max-height: none; background: none; }
.fc-pv.page .pv { border: 0; border-radius: 0; }
.fc.k-markdown .fc-pv, .fc.k-csv .fc-pv, .fc.k-json .fc-pv, .fc.k-text .fc-pv, .fc.k-code .fc-pv { align-items: stretch; max-height: none; background: #0f0f13; }
.fc-text { width: 100%; padding: 10px 12px; font-size: 12.5px; }
.fc-text.clamp:not(.open) .v { max-height: 220px; }
.fc-text .md { font-size: 12.5px; line-height: 1.6; }
.fc-pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; color: #dcdce6; }
.fc-csv { border-collapse: collapse; min-width: 100%; font-size: 12px; }
.fc-csv th, .fc-csv td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.fc-csv th { background: #18181f; font-weight: 600; }
.fc-text .tablewrap { margin: 0; }
.fc-sub { color: var(--dim); font-size: 11px; margin-top: 4px; }
.fc-miss, .fc-big { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 12px; color: var(--dim); font-size: 12px; text-align: center; }
.fc-big svg { width: 28px; height: 28px; }
.fc-big b { font-size: 14px; color: #cfcfda; letter-spacing: .05em; }
.fc-meta { display: flex; gap: 8px; align-items: center; padding: 8px 10px 0; min-width: 0; }
.fc-ic { color: var(--dim); flex: none; display: inline-flex; }
.fc-nm { min-width: 0; flex: 1; line-height: 1.35; }
.fc-nm b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-nm small { color: var(--dim); font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-ws svg { width: 11px; height: 11px; vertical-align: -1px; margin-right: 2px; }
.fc-ws.local { color: #a5b4fc; }
.fc-act { display: flex; gap: 6px; padding: 8px 10px 10px; margin-top: auto; }
.fc-act .btn { flex: 1; justify-content: center; white-space: nowrap; min-width: 0; }

/* 子智能体卡片（SDK 的 Agent 工具，subagent.js） */
.tool.is-sub { width: min(680px, 100%); border-color: #33304a; }
.sa { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.sa-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.sa-type { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; background: #1f1b2e; border: 1px solid #3a2f5c; color: #c4b5fd; font-size: 12px; white-space: nowrap; }
.sa-desc { color: #e4e4ee; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.sa-ap { display: flex; flex-direction: column; gap: 6px; }
.sa-ap:empty { display: none; }
.sa-ap .approve { margin-top: 0; }
.sa-badge { font-style: normal; color: #c4b5fd; margin-right: 6px; font-size: 12px; white-space: nowrap; }
.sa-line { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--dim); }
.sa-now { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-tg { border: 0; background: none; color: var(--pink2); font-size: 12px; padding: 0; white-space: nowrap; }
.sa-steps { border-left: 2px solid #2f2a44; padding-left: 10px; display: flex; flex-direction: column; gap: 7px; }
.sa-steps[hidden] { display: none; }
.sa-prompt { font-size: 12px; color: #b8b8c6; }
.sa-prompt .k { color: var(--dim); font-size: 11px; }
.sa-prompt .v { white-space: pre-wrap; word-break: break-word; }
.sa-tool { font-size: 12px; }
.sa-th { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sa-th svg { flex: none; }
.sa-th b { font-weight: 600; white-space: nowrap; }
.sa-th .arg { color: var(--dim); min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-th .st { font-size: 11px; white-space: nowrap; }
.sa-out { color: var(--dim); white-space: pre-wrap; word-break: break-word; margin: 2px 0 0 21px; max-height: 6.2em; overflow: hidden; }
.sa-out.bad { color: #f0a3a3; }
.sa-thumb { display: block; max-width: 160px; max-height: 120px; border-radius: 8px; margin: 4px 0 0 21px; cursor: zoom-in; }
.sa-msg { font-size: 12.5px; color: #d6d6e0; background: #121217; border-radius: 8px; padding: 6px 10px; }
.sa-note { font-size: 12px; color: var(--dim); }
.sa-note.bad, .sa-err { color: #f0a3a3; font-size: 12px; }
.sa-result { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 13px; }
.sa-result .sa-rh { font-size: 11px; color: var(--dim); margin-bottom: 4px; }
.sa-result.bad .sa-rh { color: #f0a3a3; }
.sa-result.clamp:not(.open) .v { max-height: 12em; }
@media (max-width: 600px) { .fcs-grid { grid-template-columns: minmax(0, 1fr); } .sa-now { white-space: normal; } .fc-pdf { height: 240px; } }
.fc .pv-name { display: none; }
.fc .pv-bar .btn { white-space: nowrap; }
.sa-arg { display: block; margin-top: 4px; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; color: #e4e4ee; background: #0c0c10; border-radius: 6px; padding: 3px 8px; overflow-wrap: anywhere; }

/* 子智能体：用户设置（技能页最上面，subsettings.js）、停止按钮、用量 */
.sbs { border: 1px solid #33304a; border-radius: 12px; background: #141220; padding: 10px 12px; margin-bottom: 12px; }
.sbs-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.sbs-h b { font-size: 14px; } .sbs-h small { color: var(--dim); font-size: 11px; }
.sbs-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin: 6px 0; }
.sbs-row .k { color: #cfcfda; width: 4.5em; flex: none; }
.sbs-row small { color: var(--dim); font-size: 11px; }
.sbs .stepper { display: inline-flex; align-items: center; gap: 6px; }
.sbs .stepper .n { min-width: 1.6em; text-align: center; font-variant-numeric: tabular-nums; }
.sbs .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sbs .chip.on { border-color: var(--pink); color: #fff; background: #2a1624; }
.sbs-custom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px 4.5em; }
.sbs-custom[hidden] { display: none; }
.sbs-custom .in.sm { width: 84px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: #1a1a20; color: var(--fg); padding: 0 8px; font: inherit; font-size: 13px; }
.sbs-custom select.in.sm { width: auto; }
.sbs-custom small { color: var(--dim); font-size: 11px; }
.sbs-note { color: var(--dim); font-size: 11px; line-height: 1.5; margin-top: 4px; }
@media (max-width: 600px) { .sbs-custom { margin-left: 0; } }
.sa-stop { border: 1px solid #5b2a33; background: #2a1418; color: #fca5a5; border-radius: 7px; font-size: 12px; padding: 0 8px; white-space: nowrap; }
.sa-stop:disabled { opacity: .5; }
.sa-since { margin-left: 6px; }
.sa-since:not(:empty)::before { content: "· "; }
.pill.usage { color: #cfcfda; }
@media (max-width: 860px) { .pill.usage { display: none; } }
.chip.usage-m { display: none; }
@media (max-width: 860px) { .chip.usage-m:not([hidden]) { display: inline-flex; } }
/* 触屏：子智能体设置、子智能体卡片、文件卡片上的按钮够大（≥ 44px，移动端走查） */
@media (max-width: 860px), (pointer: coarse) {
  .sbs .chip, .sbs .btn, .sbs-custom .btn { min-height: 44px; padding: 0 14px; }
  .sbs .stepper .btn { min-width: 44px; justify-content: center; font-size: 16px; }
  .sbs-custom .in.sm { height: 44px; font-size: 16px; }
  .sa-tg, .sa-stop { min-height: 44px; padding: 0 12px; }
  .fc-act .btn, .fcs-h .btn, .fc-full { min-height: 44px; }
}
.sbs-use { font-size: 12px; color: #cfcfda; margin: -2px 0 6px; }
.sbs-use[hidden] { display: none; }
@media (max-width: 600px) { .chip.usage-m:not([hidden]) { display: none; } } /* 手机：输入框那一行放不下（发送键会被挤到下一行），用量写在技能页的子智能体设置里 */

/* ===== 文件管理（files.js：⋯ 菜单、多选、排序筛选、回收站；wip-files 分支 10-26 加，整段追加，不改上面的规则） ===== */
.fm-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -2px 0 6px; }
.fm-q { display: flex; align-items: center; gap: 6px; flex: 1 1 150px; min-width: 120px; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #141419; color: var(--dim); }
.fm-q:focus-within { border-color: rgba(236,72,153,.6); }
.fm-q input { flex: 1; min-width: 0; border: 0; background: none; color: var(--fg); font: inherit; font-size: 13px; outline: none; }
.fm-sort { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #141419; color: #d4d4dc; font: inherit; font-size: 12.5px; padding: 0 6px; }
.fm-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.fm-bar .btn.sm { height: 32px; }
.fm-bar .btn.on { border-color: var(--pink); color: #fff; background: rgba(236,72,153,.12); }
.fm-n { font-style: normal; font-size: 10.5px; line-height: 16px; min-width: 16px; text-align: center; background: var(--pink); color: #fff; border-radius: 999px; padding: 0 4px; }
.fm-use { font-size: 11.5px; color: var(--dim); margin: 0 0 10px; line-height: 1.5; }
.fm-gh { padding: 0 0 0 calc(var(--depth, 0) * 12px); gap: 4px; }
.fm-gh:hover { background: none; }
.fm-tog { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; border: 0; background: none; color: inherit; font: inherit; padding: 6px 4px; border-radius: 6px; text-align: left; }
.fm-tog:hover { background: #16161c; }
.fm-dn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-gh .n { margin-left: 0; }
.fm-more { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--dim); cursor: pointer; }
.fm-more:hover, .fm-more:focus-visible { background: #24242c; color: #fff; outline: none; }
.fm-f { padding-right: 2px; }
.fm-f.hid .nm div { color: #b4b4c0; font-style: italic; }
.fm-f.picked, .fm-g.picked > .fm-gh { background: rgba(236,72,153,.13); border-radius: 8px; }
.fm-ck { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #5a5a6a; background: none; padding: 0; cursor: pointer; }
.fm-ck.on { border-color: var(--pink); background: var(--pink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat; }
.fm-f.dragging { opacity: .45; }
.fm-gh.drop-on { outline: 2px dashed var(--pink2); outline-offset: -2px; background: rgba(236,72,153,.08); border-radius: 8px; }
.fm-none { font-size: 12px; color: var(--dim); padding: 4px 8px 8px; }
.fm-selbar { position: sticky; bottom: -12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px -12px -12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--panel2); border-top: 1px solid var(--line); z-index: 2; }
.fm-selbar[hidden] { display: none; }
.fm-selbar b { font-size: 13px; }
@media (min-width: 601px) and (pointer: fine) { .pop.fm-pop { width: auto; min-width: 200px; padding: 6px; } } /* 窄屏、触屏用主线的底部弹层样式 */
.fm-menu { display: flex; flex-direction: column; gap: 2px; }
.fm-menu button { display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--fg); text-align: left; padding: 10px 12px; border-radius: 8px; font: inherit; font-size: 13.5px; cursor: pointer; }
.fm-menu button:hover, .fm-menu button:focus-visible { background: #1f1f27; outline: none; }
.fm-menu button.danger { color: var(--bad); }
.fm-th { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fm-th .linkbtn { font-size: 13px; padding: 6px 4px; }
.fm-b { border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 10px; background: #121217; }
.fm-bh { display: flex; align-items: center; gap: 6px; padding: 6px 4px 6px 8px; font-size: 12.5px; }
.fm-bh > div { min-width: 0; }
.fm-bh small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; }
.fm-bh .btn { flex: none; white-space: nowrap; }
.fm-ti { cursor: default; }
.fm-ti:hover { background: #18181e; }
.fm-hint { font-size: 12px; color: var(--dim); margin: 0 0 12px; line-height: 1.6; }
.fm-dests { max-height: 38vh; overflow: auto; border: 1px solid var(--line); border-radius: 9px; padding: 4px; margin-bottom: 4px; }
.fm-dlg select.in { padding: 0 8px; }
.toast.fm-undo { display: flex; align-items: center; gap: 12px; pointer-events: auto; } /* #toasts 本身不接点击 */
.toast.fm-undo .linkbtn { font-size: 13px; padding: 4px 6px; }
@media (max-width: 600px) {
  .fm-btns .btn[data-fm=mkdir] span, .fm-btns .btn[data-fm=hidden] span { display: none; }
  .fm-btns .btn.sm { padding: 3px 9px; }
  .fm-sort { max-width: 112px; }
}
/* 触屏：主线用 .fg-h::after 把整条分组标题扩成点击区（它原本是一个按钮）；这里的分组标题里是几个按钮（勾选、展开、⋯），
   那层透明的 ::after 会盖住它们，所以去掉，改由各个按钮自己够大（勾选框用 ::after 扩到 44×44）。 */
@media (max-width: 860px), (pointer: coarse) {
  .fm-gh::after { content: none; }
  .fm-tog { min-height: 44px; }
  .fm-ck { position: relative; }
  button.fm-ck::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
  /* 工具条与 ⋯：触屏上本身就做到 44×44（相邻按钮的 ::after 会互相抢点击区，不靠它） */
  .fm-bar { gap: 8px; }
  .fm-q, .fm-sort, .fm-bar .btn.sm { min-height: 44px; height: 44px; }
  .fm-q { height: auto; min-height: 46px; } /* 框线占 2px，里面的输入框本身要满 44 */
  .fm-q input { align-self: stretch; min-height: 44px; font-size: 16px; } /* 小于 16px 时 iOS 聚焦会放大页面 */
  .fm-bar .btn.sm { min-width: 44px; justify-content: center; }
  .fm-bar .btn.sm::after { content: none; }
  .fm-btns { gap: 6px; }
  .fm-more { width: 44px; height: 44px; }
}
/* ===== 文件管理 结束 ===== */

/* ---- 分页历史与图片引用（wip-history） ---- */
/* 切会话时先放骨架，历史到了再换成内容 */
.skel { display: flex; flex-direction: column; gap: 14px; padding: 18px 4px; }
.skel i { display: block; height: 54px; border-radius: 12px; background: linear-gradient(90deg, var(--panel2) 0%, var(--line) 50%, var(--panel2) 100%); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; }
.skel i:nth-child(odd) { width: 62%; margin-left: auto; height: 38px; }
.skel i:nth-child(even) { width: 86%; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
/* 最上面「加载更早的消息」 */
.older { display: flex; justify-content: center; padding: 6px 0 12px; }
/* 内联图的引用：位置按宽高先占好，懒加载缩略图 */
.out-img img[style*="aspect-ratio"] { max-width: 100%; background: var(--panel2); }
.out-img.grid { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.out-img.grid img { max-height: 240px; }
.out-img .more-n { align-self: center; color: var(--dim); font-size: 12px; padding: 0 6px; }

/* 侧栏会话多了以后，flex 子项默认会被压扁（文字重叠、侧栏也不出滚动条）：不许压缩，让侧栏自己滚动 */
.side > * { flex-shrink: 0; }
