/* DuMate Web Client —— 样式。浅色、百度智能云蓝 #2450FF、克制的层次。 */
:root {
  --brand: #2450ff; --brand-600: #1c3fe0; --brand-50: #eef2ff; --brand-100: #dfe6ff;
  --ink: #14171f; --ink-2: #454b5c; --ink-3: #7a8194; --ink-4: #a9afbf;
  --line: #e7e9f0; --line-2: #f0f1f5;
  --bg: #f6f7fa; --panel: #ffffff; --soft: #f3f5f9; --soft-2: #eceff5;
  --ok: #12a66a; --warn: #d9822b; --bad: #e0453a; --bad-50: #fff2f0; --warn-50: #fff7ea;
  --r: 12px; --r-sm: 8px; --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(20, 23, 31, .04), 0 1px 1px rgba(20, 23, 31, .03);
  --shadow-2: 0 6px 24px -6px rgba(24, 40, 110, .14), 0 2px 6px rgba(20, 23, 31, .05);
  --shadow-3: 0 24px 64px -16px rgba(20, 30, 80, .28);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --side-w: 272px; --drawer-w: 320px; --col: 780px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.6 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--brand); text-decoration: none; }
::selection { background: var(--brand-100); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.ic { width: 18px; height: 18px; flex: none; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d5d9e3; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background-color: #b9bfcd; }

/* ---------- 布局 ---------- */
.app { display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: var(--side-w) minmax(0, 1fr) 0; height: 100vh; height: 100dvh; transition: grid-template-columns .22s ease; }
.app.with-drawer { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--drawer-w); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); position: relative; }
.stage { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }

/* ---------- 侧栏 ---------- */
.side { display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); min-height: 0; }
.side-top { padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 4px 6px; }
.logo { width: 26px; height: 26px; display: inline-flex; } .logo svg { width: 100%; height: 100%; }
.logo.big { width: 44px; height: 44px; }
.brand-name { font-weight: 650; font-size: 16px; letter-spacing: .2px; flex: 1; }
.side-close { display: none; }
.new-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-weight: 550; box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s, color .15s; }
.new-btn:hover { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.new-btn .i { display: inline-flex; color: var(--brand); }
.new-btn kbd { margin-left: auto; font: 11px var(--sans); color: var(--ink-4); }
.search { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; border-radius: 9px; background: var(--soft-2); color: var(--ink-3); }
.search .i { display: inline-flex; } .search .ic { width: 15px; height: 15px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 13px; }
.search:focus-within { background: var(--panel); box-shadow: 0 0 0 1px var(--brand), 0 0 0 4px var(--brand-50); }
.sess-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.sess-group { font-size: 12px; color: var(--ink-4); padding: 12px 10px 5px; }
.sess { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; color: var(--ink); transition: background .12s; }
.sess:hover { background: var(--soft-2); }
.sess.on { background: var(--panel); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.sess-main { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.sess-main b { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess.on .sess-main b { font-weight: 600; }
.sess-main small { font-size: 11.5px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess time { font-size: 11px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.sess-dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; justify-self: center; }
.sess-dot.running, .sess-dot.rescheduling { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); animation: pulse 1.4s ease-in-out infinite; }
.sess-empty { text-align: center; color: var(--ink-4); font-size: 13px; padding: 48px 12px; line-height: 1.9; }
.side-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-top: 1px solid var(--line); }
.foot-btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); font-size: 13px; }
.foot-btn:hover { background: var(--soft-2); color: var(--ink); }
.foot-btn .i { display: inline-flex; } .foot-btn .ic { width: 16px; height: 16px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-4); padding-right: 4px; }
.conn i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.conn em { font-style: normal; }
.conn.off { color: var(--bad); } .conn.off i { background: var(--bad); }

/* ---------- 顶栏 ---------- */
.top { height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 22px; border-bottom: 1px solid var(--line-2); }
.top-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.top-title b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 6px; padding: 2px 6px; margin-left: -6px; }
.top-title b[data-act] { cursor: text; } .top-title b[data-act]:hover { background: var(--soft); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 7px; border-radius: 20px; background: var(--soft); color: var(--ink-2); font-size: 12px; white-space: nowrap; flex: none; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.chip .ic { width: 14px; height: 14px; color: var(--brand); }
.st { font-size: 12px; padding: 2px 8px; border-radius: 20px; background: var(--soft); color: var(--ink-3); white-space: nowrap; flex: none; }
.st.run { background: var(--brand-50); color: var(--brand); }
.st.wait { background: var(--warn-50); color: var(--warn); }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.usage { font-size: 12px; color: var(--ink-3); margin-right: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.usage i { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink-3); flex: none; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 8px; color: var(--ink-2); font-size: 13px; transition: background .12s, color .12s; }
.pill-btn .ic { width: 16px; height: 16px; }
.pill-btn:hover { background: var(--soft); color: var(--ink); }
.pill-btn.on { background: var(--brand-50); color: var(--brand); }
.only-narrow { display: none; }

/* ---------- 欢迎页 ---------- */
.welcome { flex: 1; overflow-y: auto; display: flex; justify-content: center; padding: 24px 24px 48px;
  background: radial-gradient(900px 420px at 50% -8%, #e9eeff 0%, rgba(233, 238, 255, 0) 70%); }
.welcome-in { width: 100%; max-width: 760px; margin: auto 0; padding: 4vh 0 6vh; display: flex; flex-direction: column; gap: 22px; }
.hello { text-align: center; }
.hello-mark { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #4a72ff, #2450ff 60%, #1a3bd6); box-shadow: 0 10px 24px -8px rgba(36, 80, 255, .55); margin-bottom: 16px; }
.hello-mark .ic { width: 22px; height: 22px; }
.hello h1 { font-size: 28px; line-height: 1.3; font-weight: 650; margin: 0 0 8px; letter-spacing: -.2px; text-wrap: balance; }
.hello p { margin: 0; color: var(--ink-3); font-size: 14.5px; text-wrap: balance; }
.tips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tip { text-align: left; display: grid; grid-template-columns: 18px 1fr; column-gap: 10px; row-gap: 2px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tip:hover { border-color: var(--brand-100); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.tip .ic { color: var(--brand); margin-top: 2px; grid-row: span 2; }
.tip b { font-weight: 600; font-size: 13.5px; }
.tip span { color: var(--ink-3); font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 输入框 ---------- */
.composer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 12px 12px 10px 16px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--brand); box-shadow: var(--shadow-2), 0 0 0 4px var(--brand-50); }
.composer.drag { border-color: var(--brand); border-style: dashed; background: var(--brand-50); }
.composer textarea { display: block; width: 100%; border: 0; outline: 0; resize: none; background: none; font-size: 15px; line-height: 1.6; padding: 4px 0 6px; max-height: 220px; min-height: 30px; }
.welcome .composer textarea { min-height: 78px; }
.composer textarea::placeholder { color: var(--ink-4); }
.composer-bar { display: flex; align-items: center; gap: 6px; margin-left: -8px; }
.composer-slot { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 0 1 auto; }
.hint { margin-left: auto; font-size: 12px; color: var(--ink-4); white-space: nowrap; padding-right: 6px; }
.sel { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 4px 0 9px; border-radius: 8px; background: var(--soft); color: var(--ink-2); min-width: 0; max-width: 190px; }
.sel:hover { background: var(--soft-2); }
.sel .ic { width: 15px; height: 15px; color: var(--ink-3); }
.sel select { border: 0; outline: 0; background: none; font-size: 13px; min-width: 0; max-width: 150px; text-overflow: ellipsis; cursor: pointer; padding-right: 2px; }
.send-btn { width: 36px; height: 36px; border-radius: 11px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; transition: background .15s, transform .1s, opacity .15s; }
.send-btn:hover:not(:disabled) { background: var(--brand-600); }
.send-btn:active:not(:disabled) { transform: scale(.94); }
.send-btn:disabled { background: #d8dce8; cursor: not-allowed; }
.send-btn.stop { background: var(--ink); }
.send-btn .ic { width: 19px; height: 19px; stroke-width: 2.2; }
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; }
.attach-row:not(:empty) { padding-bottom: 8px; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 8px; background: var(--soft); border: 1px solid var(--line); font-size: 12.5px; max-width: 260px; }
.fchip .ic { width: 15px; height: 15px; color: var(--brand); }
.fchip em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fchip button { display: inline-flex; color: var(--ink-4); border-radius: 4px; } .fchip button:hover { color: var(--bad); }
.fchip button .ic { width: 13px; height: 13px; color: inherit; }
.fchip.pending { opacity: .7; }

/* ---------- 对话 ---------- */
.thread { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: auto; }
.thread-in { max-width: var(--col); margin: 0 auto; padding: 28px 24px 24px; display: flex; flex-direction: column; gap: 18px; }
.dock { flex: none; padding: 0 24px 18px; background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--panel) 28%); margin-top: -18px; position: relative; z-index: 2; pointer-events: none; }
.dock-in { max-width: var(--col); margin: 0 auto; pointer-events: auto; }
.to-bottom { position: absolute; left: 50%; bottom: 128px; transform: translate(-50%, 8px); width: 34px; height: 34px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-2); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 3; }
.to-bottom.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.row { display: flex; min-width: 0; }
.row.user { justify-content: flex-end; }
.bubble { max-width: 82%; }
.utext { background: var(--brand-50); color: var(--ink); padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.65; }
.row.agent { display: block; }
.loading, .empty-thread { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink-4); padding: 80px 0; font-size: 13.5px; }
.loading { flex-direction: row; justify-content: center; }
.empty-thread .ic { width: 26px; height: 26px; color: var(--brand); opacity: .7; } .empty-thread p { margin: 0; }
.note { margin: 0 auto; font-size: 12.5px; color: var(--ink-3); background: var(--soft); border-radius: 20px; padding: 3px 12px; }
.note.warn { color: var(--warn); background: var(--warn-50); }
.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13.5px; padding: 2px 0; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: bounce 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
.errbox { display: flex; gap: 10px; width: 100%; padding: 12px 14px; border-radius: var(--r); background: var(--bad-50); border: 1px solid #ffd9d4; color: #a3271f; }
.errbox .ic { margin-top: 2px; color: var(--bad); }
.errbox b { font-weight: 600; display: block; } .errbox p { margin: 2px 0 0; font-size: 13px; word-break: break-word; color: #b4463e; }

/* ---------- Markdown ---------- */
.md { font-size: 15px; line-height: 1.75; color: var(--ink); word-break: break-word; min-width: 0; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 22px 0 10px; line-height: 1.4; font-weight: 650; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 16.5px; } .md h4, .md h5, .md h6 { font-size: 15px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; } .md li { margin: 3px 0; } .md li > p { margin: 0; }
.md li::marker { color: var(--ink-3); }
.md blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 3px solid var(--brand-100); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.md img { max-width: 100%; border-radius: 8px; }
.md :not(pre) > code { font: 13px/1.5 var(--mono); background: var(--soft); border: 1px solid var(--line-2); padding: 1px 5px; border-radius: 5px; color: #b0306a; }
.md strong { font-weight: 650; }
.codeblock { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fafbfd; }
.code-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 6px 0 12px; font: 12px var(--mono); color: var(--ink-3); border-bottom: 1px solid var(--line-2); background: var(--soft); }
.copy-btn { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border-radius: 6px; font: 12px var(--sans); color: var(--ink-3); }
.copy-btn:hover { background: var(--panel); color: var(--ink); } .copy-btn .ic { width: 13px; height: 13px; } .copy-btn em { font-style: normal; }
.codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.codeblock code, .codeblock code.hljs { font: 13px/1.65 var(--mono); background: none; padding: 0; white-space: pre; }
.table-wrap { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.md th { background: var(--soft); font-weight: 600; white-space: nowrap; } .md tr:last-child td { border-bottom: 0; }
.md.streaming > :last-child::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; background: var(--brand); border-radius: 2px; animation: blink 1s steps(2) infinite; }

/* ---------- 工具卡片 ---------- */
.tools { width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); overflow: hidden; }
.tool + .tool { border-top: 1px solid var(--line-2); }
.t-head { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px 8px 12px; text-align: left; min-height: 38px; transition: background .12s; }
.t-head:hover { background: var(--soft); }
.t-ic { display: inline-flex; color: var(--ink-3); } .t-ic .ic { width: 16px; height: 16px; }
.t-head b { font-weight: 550; font-size: 13.5px; white-space: nowrap; flex: none; }
.t-head code { flex: 1; min-width: 0; font: 12.5px var(--mono); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-st { display: inline-flex; align-items: center; flex: none; }
.t-st .ic { width: 15px; height: 15px; stroke-width: 2.4; } .ic.ok { color: var(--ok); } .ic.bad { color: var(--bad); } .ic.warn { color: var(--warn); }
.t-chev { width: 15px; height: 15px; color: var(--ink-4); transition: transform .15s; flex: none; }
.tool.open > .t-head .t-chev, .dbg.open .t-chev { transform: rotate(90deg); }
.dash { width: 9px; height: 2px; border-radius: 2px; background: var(--ink-4); display: inline-block; }
.t-detail { padding: 2px 12px 12px 37px; display: flex; flex-direction: column; gap: 8px; }
.t-sec label { display: block; font-size: 11.5px; color: var(--ink-4); margin-bottom: 4px; word-break: break-all; }
.t-pre { margin: 0; padding: 10px 12px; border-radius: 8px; background: #0f1422; color: #dfe5f5; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.t-pre.cmd::before { content: "$ "; color: #6f86ff; }
.t-pre.err { background: #2a1416; color: #ffc9c4; }
.t-pre.del { background: #fff1f0; color: #8f2b24; border-radius: 8px 8px 0 0; } .t-pre.add { background: #edfaf3; color: #17603f; border-radius: 0 0 8px 8px; }
.tool.need_confirm, .tool.need_result { background: var(--warn-50); }
.t-ask { display: flex; align-items: center; gap: 8px; padding: 4px 12px 12px 37px; font-size: 13px; color: #8a5413; }
.t-ask .ic { width: 16px; height: 16px; color: var(--warn); } .t-ask span { flex: 1; }
.t-ask.col { flex-wrap: wrap; } .t-ask.col span { flex: 1 1 60%; }
.t-result { width: 100%; min-height: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: 0; resize: vertical; background: var(--panel); }
.t-result:focus { border-color: var(--brand); }
.t-denied { padding: 0 12px 10px 37px; font-size: 12.5px; color: var(--bad); }

/* ---------- 调试视图 ---------- */
.debug { display: flex; flex-direction: column; gap: 4px; }
.dbg { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.dbg-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px 7px 12px; text-align: left; }
.dbg-head:hover { background: var(--soft); }
.dbg-type { font: 12.5px var(--mono); flex: 1; padding-left: 10px; position: relative; }
.dbg-type::before { content: ""; position: absolute; left: 0; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--ink-4); }
.dbg.user .dbg-type::before { background: var(--brand); } .dbg.agent .dbg-type::before { background: var(--ok); } .dbg.session .dbg-type::before { background: var(--warn); }
.dbg time { font: 11.5px var(--mono); color: var(--ink-4); }
.dbg .t-pre { border-radius: 0; max-height: 420px; }

/* ---------- 文件抽屉 ---------- */
.drawer { border-left: 1px solid var(--line); background: var(--panel); min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.dr-head { height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 18px; border-bottom: 1px solid var(--line-2); }
.dr-head b { font-size: 15px; font-weight: 600; } .dr-head span { display: flex; gap: 2px; }
.dr-body { flex: 1; overflow-y: auto; padding: 8px 10px 20px; }
.dr-sec { margin-top: 10px; }
.dr-sec > label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); padding: 6px 8px; }
.dr-sec > label em { font-style: normal; background: var(--soft); border-radius: 10px; padding: 0 7px; font-size: 11px; }
.dr-empty { margin: 0; padding: 14px 8px; font-size: 12.5px; color: var(--ink-4); }
.frow { display: flex; align-items: center; gap: 2px; border-radius: 9px; padding-right: 4px; }
.frow:hover { background: var(--soft); }
.f-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; text-align: left; }
.f-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-50); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.f-main > span:last-child { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.f-main b { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-main small { font-size: 11.5px; color: var(--ink-4); }

/* ---------- 按钮 / 表单 / 弹窗 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); font-weight: 500; transition: background .12s, border-color .12s, color .12s; white-space: nowrap; }
.btn:hover { border-color: #cfd4e0; background: var(--soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; } .btn.danger:hover { filter: brightness(.94); }
.btn.sm { height: 28px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; } .btn .ic { width: 16px; height: 16px; }
.modal-mask { position: fixed; inset: 0; z-index: 50; background: rgba(18, 22, 38, .42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s ease; }
.modal { width: 100%; max-width: 440px; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-3); animation: pop .18s ease; }
.modal.wide { max-width: 680px; }
.m-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 12px 22px; }
.m-head b { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-body { padding: 4px 22px 8px; overflow-y: auto; min-height: 0; }
.m-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }
.m-text { margin: 0 0 6px; color: var(--ink-2); }
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 550; margin-bottom: 6px; }
.fld > span em { font-style: normal; font-weight: 400; color: var(--ink-4); font-size: 12px; }
.fld input, .fld textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; outline: 0; background: var(--panel); transition: border-color .12s, box-shadow .12s; }
.fld textarea { resize: vertical; line-height: 1.6; min-height: 120px; }
.fld input:focus, .fld textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.seg button b { font-weight: 600; font-size: 13.5px; } .seg button small { color: var(--ink-3); font-size: 12px; }
.seg button.on { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand); } .seg button.on b { color: var(--brand); }
.alist { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.arow { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; } .arow:hover { background: var(--soft); }
.a-av { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.a-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.a-main b { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-main small { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 11.5px; padding: 1px 8px; border-radius: 20px; background: var(--brand-50); color: var(--brand); white-space: nowrap; flex: none; }
.tag.ghost { background: var(--soft); color: var(--ink-3); }
.pv-none { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 0; color: var(--ink-3); } .pv-none .ic { width: 30px; height: 30px; } .pv-none p { margin: 0; }
.pv-img { display: flex; justify-content: center; } .pv-img img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.pv-pre { max-height: 60vh; } .pv-md { padding-bottom: 8px; }
.menu { position: fixed; z-index: 60; min-width: 172px; padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-2); animation: pop .12s ease; }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; font-size: 13.5px; text-align: left; }
.menu button:hover { background: var(--soft); } .menu button .ic { width: 16px; height: 16px; color: var(--ink-3); }
.menu button.danger { color: var(--bad); } .menu button.danger .ic { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 4px; }
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: #1b2030; color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-2); max-width: min(560px, 90vw); animation: drop .2s ease; transition: opacity .25s, transform .25s; }
.toast.err { background: #b3261e; } .toast.out { opacity: 0; transform: translateY(-6px); }
.login { position: fixed; inset: 0; z-index: 90; background: radial-gradient(900px 500px at 50% 0, #e9eeff, var(--bg) 70%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; background: var(--panel); border-radius: 20px; padding: 34px 28px 26px; box-shadow: var(--shadow-3); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.login-card h2 { margin: 6px 0 0; font-size: 20px; } .login-card p { margin: 0 0 8px; color: var(--ink-3); }
.login-card input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; outline: 0; } .login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.login-card .btn { width: 100%; height: 42px; } .login-card small { color: var(--bad); min-height: 18px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--brand-100); border-top-color: var(--brand); display: inline-block; animation: spin .7s linear infinite; flex: none; }
.scrim { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(36, 80, 255, .08); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- 窄屏 ---------- */
@media (max-width: 1100px) {
  .app.with-drawer { grid-template-columns: var(--side-w) minmax(0, 1fr) 0; }
  .drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer-w), 92vw); z-index: 30; box-shadow: var(--shadow-3); transform: translateX(105%); transition: transform .22s ease; }
  .app.with-drawer .drawer { transform: none; }
  .usage { display: none; }
}
@media (max-width: 820px) {
  .app, .app.with-drawer { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-3); }
  .app.side-open .side { transform: none; }
  .app.side-open ~ .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(18, 22, 38, .36); }
  .side-close, .only-narrow { display: inline-flex; }
  .top { padding: 0 8px 0 8px; } .top-title .chip { display: none; }
  .pill-btn span { display: none; } .pill-btn { padding: 0 8px; }
  .thread-in { padding: 20px 14px 20px; } .dock { padding: 0 10px 10px; } .welcome { padding: 16px 14px 32px; }
  .hello h1 { font-size: 23px; } .tips { grid-template-columns: 1fr; } .hint { display: none; }
  .composer-bar .send-btn { margin-left: auto; } .bubble { max-width: 90%; }
  .sel { max-width: 132px; } .sel select { max-width: 96px; }
  .seg { grid-template-columns: 1fr; } .arow .tag.ghost { display: none; }
}
