:root {
  --bg: #FAF9F7;
  --panel: #FFFFFF;
  --sidebar: #F4F2EE;
  --sidebar-hover: #EBE8E1;
  --border: #E7E4DC;
  --border-strong: #D8D4C9;
  --text: #1A1A1A;
  --text-2: #6B6B6B;
  --text-3: #9C9A94;
  --accent: #0F6E56;
  --accent-soft: #E1F5EE;
  --accent-line: #9FE1CB;
  --danger: #A32D2D;
  --danger-soft: #FCEBEB;
  --warn: #854F0B;
  --warn-soft: #FAEEDA;
  --radius: 10px;
  --radius-lg: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.app { display: grid; grid-template-columns: 264px 1fr; height: 100vh; overflow: hidden; }

/* ---------------- 登录 ---------------- */

.login { height: 100vh; display: grid; place-items: center; background: var(--bg); }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px 26px 22px; }
.login-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--text); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600; margin-bottom: 16px;
}
.login-card h1 { font-size: 18px; font-weight: 500; margin: 0 0 4px; }
.login-sub { font-size: 12px; color: var(--text-3); margin: 0 0 20px; line-height: 1.5; }
.lfld { display: block; margin-bottom: 12px; }
.lfld span { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 5px; }
.lfld input {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--text);
  background: #fff; border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 7px 10px; outline: none;
}
.lfld input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(15, 110, 86, .06); }
.login-btn {
  width: 100%; margin-top: 4px; padding: 8px; border: none; border-radius: 8px;
  background: var(--text); color: #fff; font-family: inherit; font-size: 13px; cursor: pointer;
}
.login-btn:hover { background: #000; }
.login-btn:disabled { background: #C9C5BA; cursor: default; }
.login-err { color: var(--danger); font-size: 12px; min-height: 18px; margin-top: 8px; }
.login-hint { font-size: 10.5px; color: var(--text-3); margin-top: 4px; line-height: 1.6; font-family: var(--mono); }

.logout {
  margin-left: auto; border: none; background: none; color: var(--text-3);
  cursor: pointer; padding: 2px; display: grid; place-items: center; border-radius: 6px;
}
.logout:hover { color: var(--text); background: var(--sidebar-hover); }

/* ---------------- 侧边栏 ---------------- */

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px 12px;
  min-height: 0;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 2px 6px 16px; }
.mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--text); color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  flex: none;
}
.brand-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.brand-sub { font-size: 11px; color: var(--text-3); line-height: 1.4; }

.new-chat {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 8px 10px; margin-bottom: 18px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.new-chat:hover { background: #fff; border-color: #C7C2B5; }

.nav-label {
  font-size: 11px; color: var(--text-3); padding: 0 8px 6px;
  letter-spacing: 0.04em;
}

.sessions { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.session-empty { font-size: 12px; color: var(--text-3); padding: 8px; }

.session {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer;
  font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .12s ease;
}
.session:hover { background: var(--sidebar-hover); }
.session.active { background: var(--panel); color: var(--text); border: 1px solid var(--border); padding: 6px 7px; }
.session .s-ico { flex: none; opacity: .45; }
.session .s-name { overflow: hidden; text-overflow: ellipsis; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }
.user { display: flex; gap: 9px; align-items: center; padding: 2px 6px 8px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
}
.user-text { min-width: 0; }
.u-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-dept { font-size: 11px; color: var(--text-3); }

.gw { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); padding: 0 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--text-3); }
.dot-ok { background: var(--accent); }
.dot-err { background: var(--danger); }
.dot-wait { background: var(--warn); }

/* ---------------- 主区 ---------------- */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: rgba(250, 249, 247, .86); backdrop-filter: blur(6px);
  flex: none;
}
.title { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }

.field { display: flex; align-items: center; gap: 6px; }
.field-label { font-size: 11px; color: var(--text-3); }
select {
  font-family: inherit; font-size: 12px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 4px 8px; cursor: pointer; outline: none;
}
select:focus { border-color: var(--accent-line); }
.chip {
  font-size: 11px; color: var(--text-2); background: var(--panel);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px;
}

.stream { flex: 1; overflow-y: auto; min-height: 0; padding: 24px 24px 8px; }
.thread, .empty { max-width: 760px; margin: 0 auto; }

/* 空状态 */
.empty { padding-top: 6vh; text-align: center; }
.empty-mark {
  width: 40px; height: 40px; margin: 0 auto 18px; border-radius: 12px;
  background: var(--text); color: #fff; display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
}
.empty h1 { font-size: 19px; font-weight: 500; margin: 0 0 8px; }
.empty p { font-size: 13px; color: var(--text-2); margin: 0 auto 26px; max-width: 500px; line-height: 1.6; }
.suggests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: left; }
.suggest {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 13px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .12s ease, transform .12s ease;
}
.suggest:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.s-title { font-size: 12.5px; font-weight: 500; color: var(--text); }
.s-desc { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

/* 消息 */
.msg { margin-bottom: 22px; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-user .bubble {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px 12px 4px 12px;
  padding: 9px 13px; max-width: 78%; font-size: 13.5px; line-height: 1.62;
  white-space: pre-wrap; word-break: break-word;
}
.msg-ai .ai-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.ai-tools { margin: 0 0 10px; }
.ai-tools:empty { display: none; }
.ai-mark {
  width: 18px; height: 18px; border-radius: 5px; background: var(--text); color: #fff;
  display: grid; place-items: center; font-size: 8.5px; font-weight: 600; flex: none;
}
.ai-name { font-size: 12px; color: var(--text-2); }
.ai-body { font-size: 13.5px; line-height: 1.72; word-break: break-word; }
.ai-body > :first-child { margin-top: 0; }
.ai-body > :last-child { margin-bottom: 0; }
.ai-body p { margin: 0 0 10px; }

/* Markdown 排版（marked 渲染结果） */
.ai-body h1, .ai-body h2, .ai-body h3, .ai-body h4, .ai-body h5, .ai-body h6 {
  margin: 18px 0 8px; font-weight: 600; line-height: 1.35; color: var(--text);
}
.ai-body h1 { font-size: 18px; }
.ai-body h2 { font-size: 16.5px; }
.ai-body h3 { font-size: 15px; }
.ai-body h4, .ai-body h5, .ai-body h6 { font-size: 13.5px; }
.ai-body ul, .ai-body ol { margin: 0 0 10px; padding-left: 22px; }
.ai-body li { margin: 3px 0; }
.ai-body li > p { margin: 0 0 6px; }
.ai-body li > ul, .ai-body li > ol { margin: 4px 0; }
.ai-body a { color: var(--accent, #2f6fed); text-decoration: none; }
.ai-body a:hover { text-decoration: underline; }
.ai-body strong { font-weight: 600; }
.ai-body em { font-style: italic; }
.ai-body del { opacity: .7; }
.ai-body hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.ai-body blockquote {
  margin: 10px 0; padding: 2px 12px; color: var(--text-2);
  border-left: 3px solid var(--border-strong);
}
.ai-body img { max-width: 100%; border-radius: 6px; }

/* 行内代码 */
.ai-body code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--code-bg, rgba(120, 130, 150, .14));
  border-radius: 4px; padding: 1.5px 5px;
}

/* 代码块 */
.ai-body pre {
  position: relative;
  margin: 10px 0; padding: 12px 14px;
  background: var(--code-block-bg, #f6f7f9);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto; line-height: 1.6;
}
.ai-body pre code {
  background: none; padding: 0; font-size: 12.5px;
  white-space: pre; display: block;
}
.code-copy {
  position: absolute; top: 6px; right: 6px;
  font-size: 10.5px; color: var(--text-3);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px; cursor: pointer;
  opacity: 0; transition: opacity .12s ease;
}
.ai-body pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--text); }

/* 表格 */
.ai-body table {
  border-collapse: collapse; margin: 10px 0; font-size: 12.5px;
  display: block; overflow-x: auto; max-width: 100%;
}
.ai-body th, .ai-body td {
  border: 1px solid var(--border); padding: 6px 10px; text-align: left;
}
.ai-body th { background: var(--panel); font-weight: 600; }
.ai-body tr:nth-child(even) td { background: rgba(120, 130, 150, .05); }
.caret {
  display: inline-block; width: 6px; height: 14px; margin-left: 2px;
  background: var(--text); vertical-align: -2px; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* 工具卡片 */
.tool {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); margin: 10px 0; overflow: hidden;
}
.tool-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px; cursor: pointer; font-size: 12px;
  background: #FCFBF9;
}
.tool-head:hover { background: #F8F6F2; }
.tool-ico {
  width: 16px; height: 16px; border-radius: 4px; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 9px; font-family: var(--mono);
}
.tool-name { font-family: var(--mono); font-size: 11.5px; color: var(--text); }
.tool-arg {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0;
}
.tool-state { font-size: 11px; color: var(--text-3); flex: none; }
.tool-state.ok { color: var(--accent); }
.tool-state.deny { color: var(--danger); }
.tool-body {
  border-top: 1px solid var(--border); padding: 9px 11px;
  font-family: var(--mono); font-size: 11px; line-height: 1.6;
  color: var(--text-2); white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow: auto; background: #FCFBF9;
}
.tool-body.hidden { display: none; }
.tool-body.deny { background: var(--danger-soft); color: var(--danger); }

/* 用量脚注 */
.usage {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-3);
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
}
.usage b { font-weight: 500; color: var(--text-2); font-family: var(--mono); }

/* ---------------- 输入区 ---------------- */

.composer { flex: none; padding: 8px 24px 14px; }
.input-wrap {
  max-width: 760px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 10px 12px 8px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input-wrap:focus-within { border-color: #C3BEB0; box-shadow: 0 0 0 3px rgba(15, 110, 86, .06); }
textarea {
  width: 100%; border: none; outline: none; resize: none;
  font-family: inherit; font-size: 13.5px; line-height: 1.65;
  background: transparent; color: var(--text);
  max-height: 180px; padding: 2px 0 6px;
}
textarea::placeholder { color: var(--text-3); }

.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-sm select { font-size: 11.5px; padding: 3px 7px; }
.bar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.send-hint { font-size: 11px; color: var(--text-3); }
.send-col { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.kbd-hint { font-size: 10px; color: var(--text-3); white-space: nowrap; line-height: 1; }
.ver {
  position: fixed; right: 10px; bottom: 6px; z-index: 50;
  font-size: 10.5px; color: var(--text-3); opacity: .75; pointer-events: none;
}

/* 模型下拉（发送按钮左侧） */
.model-sel {
  font-family: inherit; font-size: 11.5px; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 8px; outline: none; cursor: pointer; max-width: 120px;
}
.model-sel:hover { border-color: var(--border-strong); color: var(--text); }

/* 上下文用量图标 */
.ctx-btn {
  display: grid; place-items: center; width: 26px; height: 26px; flex: none;
  background: none; border: none; border-radius: 7px; color: var(--text-3);
  cursor: pointer; padding: 0;
}
.ctx-btn:hover { color: var(--text-2); background: var(--sidebar-hover); }
#ctxRing { transition: stroke-dashoffset .3s ease, stroke .2s ease; stroke: var(--accent); }
#ctxRing.warn { stroke: var(--warn); }
#ctxRing.full { stroke: var(--danger); }

/* 权限下拉 */
.perm-wrap { position: relative; flex: none; }
.perm-btn {
  display: flex; align-items: center; gap: 5px;
  font-family: inherit; font-size: 11.5px; color: var(--text-2);
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 8px; cursor: pointer;
}
.perm-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg); }
.perm-btn.on { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.perm-caret { opacity: .7; }
.perm-pop {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 60;
  width: 320px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 10px 32px rgba(20, 18, 14, .14); padding: 14px;
}
.perm-desc { font-size: 11.5px; line-height: 1.6; color: var(--text-2); }
.perm-row {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.perm-text { min-width: 0; }
.perm-title { font-size: 12.5px; color: var(--text); margin-bottom: 3px; }
.perm-hint { font-size: 10.5px; line-height: 1.55; color: var(--text-3); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 34px; height: 19px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px;
  transition: background .15s; cursor: pointer;
}
.switch-slider::before {
  content: ''; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .switch-slider { background: var(--warn); }
.switch input:checked + .switch-slider::before { transform: translateX(15px); }

.send, .stop {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  display: grid; place-items: center; cursor: pointer; flex: none;
  transition: background .12s ease, opacity .12s ease;
}
.send { background: var(--text); color: #fff; }
.send:disabled { background: #DDD9CF; color: #fff; cursor: default; }
.send:not(:disabled):hover { background: #000; }
.stop { background: var(--danger-soft); color: var(--danger); }
.stop:hover { background: #F7C1C1; }

.hint {
  max-width: 760px; margin: 8px auto 0; text-align: center;
  font-size: 10.5px; color: var(--text-3);
}

.stream::-webkit-scrollbar, .sessions::-webkit-scrollbar, .tool-body::-webkit-scrollbar { width: 8px; }
.stream::-webkit-scrollbar-thumb, .sessions::-webkit-scrollbar-thumb, .tool-body::-webkit-scrollbar-thumb {
  background: #DDD9CF; border-radius: 4px;
}
.stream::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .suggests { grid-template-columns: 1fr; }
}

/* ---------------- 工作区 ---------------- */

.ws-block { margin: 0 -4px 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.ws-row { display: flex; align-items: center; gap: 6px; }
.ws-select {
  flex: 1; min-width: 0; font-family: inherit; font-size: 12px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 7px;
  padding: 5px 7px; outline: none; cursor: pointer;
}
.ws-btn {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 7px;
  color: var(--text-2); cursor: pointer;
}
.ws-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--sidebar-hover); }
.ws-path {
  margin-top: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left;
}
.ws-access { margin-top: 9px; justify-content: space-between; }
.ws-access-label { font-size: 11.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 1px; }
.ws-access-sub { font-size: 10.5px; color: var(--text-3); }
.ws-access-sub.on { color: var(--warn); font-weight: 500; }
.ws-switch { position: relative; display: inline-block; width: 34px; height: 19px; flex: none; }
.ws-switch input { opacity: 0; width: 0; height: 0; }
.ws-slider {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px;
  transition: background .15s; cursor: pointer;
}
.ws-slider::before {
  content: ''; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.ws-switch input:checked + .ws-slider { background: var(--warn); }
.ws-switch input:checked + .ws-slider::before { transform: translateX(15px); }

/* ---------------- 弹窗 ---------------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(20, 18, 14, .45);
  display: grid; place-items: center;
}
.modal-card {
  width: 420px; max-width: calc(100vw - 40px); background: var(--panel);
  border-radius: 14px; padding: 22px 24px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.modal-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.modal-card p { margin: 0 0 10px; font-size: 12.5px; line-height: 1.65; color: var(--text-2); }
.modal-confirm .modal-warn-ico {
  width: 34px; height: 34px; border-radius: 50%; background: var(--warn-soft); color: var(--warn);
  display: grid; place-items: center; font-size: 18px; font-weight: 700; margin-bottom: 12px;
}
.modal-warn-text { color: var(--danger) !important; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.mbtn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); font-family: inherit; font-size: 12.5px; cursor: pointer;
}
.mbtn:hover { background: var(--sidebar); }
.mbtn-danger { background: var(--warn); border-color: var(--warn); color: #fff; }
.mbtn-danger:hover { background: #6f4209; }
.mbtn-primary { background: var(--text); border-color: var(--text); color: #fff; }
.mbtn-primary:hover { background: #000; }
.modal-picker { width: 460px; }
.ws-crumb {
  font-family: var(--mono); font-size: 11px; color: var(--text-2); background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-dirs {
  height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px;
  padding: 4px;
}
.ws-dir {
  display: block; width: 100%; text-align: left; padding: 6px 9px; border: none; background: none;
  font-family: var(--mono); font-size: 12px; color: var(--text); border-radius: 6px; cursor: pointer;
}
.ws-dir:hover { background: var(--sidebar-hover); }
.ws-dir.up { color: var(--text-2); }
.ws-dirs .ws-empty { padding: 18px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ---------------- 工作空间列表（侧栏） ---------------- */

.ws-search-wrap {
  display: flex; align-items: center; gap: 6px; margin: 0 0 8px;
  padding: 0 7px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-3);
}
.ws-search {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  font-family: inherit; font-size: 12px; color: var(--text); padding: 6px 0;
}
.ws-list { max-height: 150px; overflow-y: auto; margin: 0 -4px 12px; padding: 0 4px; }
.ws-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 8px;
  cursor: pointer; color: var(--text-2); font-size: 12.5px;
}
.ws-item:hover { background: var(--sidebar-hover); color: var(--text); }
.ws-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.ws-item .ws-ico { flex: none; }
.ws-item .ws-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-none { padding: 10px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ---------------- 发送行的访问开关 ---------------- */

.ws-switch-wrap { display: flex; align-items: center; gap: 7px; cursor: pointer; flex: none; }
.ws-full-hint { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.ws-full-hint.on { color: var(--warn); font-weight: 500; }
.ws-switch { position: relative; display: inline-block; width: 34px; height: 19px; flex: none; }
.ws-switch input { opacity: 0; width: 0; height: 0; }
.ws-slider {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px;
  transition: background .15s; cursor: pointer;
}
.ws-slider::before {
  content: ''; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.ws-switch input:checked + .ws-slider { background: var(--warn); }
.ws-switch input:checked + .ws-slider::before { transform: translateX(15px); }

/* ---------------- 附件上传 ---------------- */

.attach-btn {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center;
  background: none; border: none; border-radius: 7px; color: var(--text-3); cursor: pointer;
}
.attach-btn:hover { color: var(--text); background: var(--sidebar-hover); }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 4px 2px; }
.pfile {
  display: inline-flex; align-items: center; gap: 5px; max-width: 260px;
  font-size: 11.5px; color: var(--text); background: var(--sidebar);
  border: 1px solid var(--border); border-radius: 7px; padding: 3px 8px;
}
.pfile.uploading { color: var(--text-3); font-style: italic; }
.pfile-size { color: var(--text-3); font-size: 10.5px; }
.pfile-x {
  border: none; background: none; color: var(--text-3); cursor: pointer;
  font-size: 13px; padding: 0 1px; line-height: 1;
}
.pfile-x:hover { color: var(--danger); }
.fchips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.fchip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: 6px; padding: 2px 7px; color: var(--accent);
}

/* ---------------- 顶部工作空间徽标 ---------------- */

.title-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ws-badge {
  flex: none; font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: 7px; padding: 3px 9px; max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default;
}

/* ---------------- 工作空间列表项操作 ---------------- */

.ws-item .ws-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-def {
  font-style: normal; font-size: 9.5px; color: var(--text-3);
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 3px; margin-left: 5px;
}
.ws-acts { display: none; align-items: center; gap: 2px; flex: none; }
.ws-item:hover .ws-acts { display: inline-flex; }
.ws-act {
  border: none; background: none; color: var(--text-3); cursor: pointer;
  width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; padding: 0;
}
.ws-act:hover { color: var(--text); background: var(--border); }
.ws-act.ws-del:hover { color: var(--danger); }

/* ---------------- 会话删除按钮 ---------------- */

.session .s-del {
  display: none; border: none; background: none; color: var(--text-3); cursor: pointer;
  width: 18px; height: 18px; place-items: center; border-radius: 4px; padding: 0; flex: none;
}
.session { align-items: center; }
.session:hover .s-del { display: grid; }
.session .s-del:hover { color: var(--danger); background: var(--border); }
.session .s-name { flex: 1; }

/* 拖拽文件到聊天框时的提示 */
.input-wrap.dragging {
  outline: 2px dashed #4f6ef7;
  outline-offset: -3px;
  background: rgba(79, 110, 247, 0.04);
}

/* ---- 下载客户端（悬浮菜单）---- */
.dl-wrap { position: relative; }
.dl-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: 1px solid var(--line, #ddd6c8); border-radius: 8px;
  background: #fff; color: var(--ink, #333); font-size: 12.5px; cursor: pointer;
}
.dl-btn:hover { border-color: var(--accent, #0f6e56); color: var(--accent, #0f6e56); }
.dl-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  min-width: 180px; padding: 6px; border: 1px solid var(--line, #ddd6c8);
  border-radius: 10px; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.1);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.dl-wrap:hover .dl-pop, .dl-wrap:focus-within .dl-pop { opacity: 1; visibility: visible; transform: translateY(0); }
.dl-pop a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px; color: var(--ink, #333);
  font-size: 12.5px; text-decoration: none; white-space: nowrap;
}
.dl-pop a:hover { background: rgba(15, 110, 86, .07); color: var(--accent, #0f6e56); }
.dl-pop a.dl-disabled { opacity: .45; pointer-events: none; }
