/* ==========================================================================
   agnes work —— 云端页面样式
   深色克制风格：底 #0B0F17 + 双层极淡径向光晕 + 玻璃面板
   强调色只出现在三处：模式切换器、发送按钮、运行状态点
   ========================================================================== */

/* 原生 [hidden] 语义必须永远生效：本文件里大量元素用 display:grid/flex，
   会盖掉浏览器默认的 [hidden]{display:none}，导致初始态露出本不该出现的控件 */
[hidden] { display: none !important; }

:root {
  --bg: #0B0F17;
  --bg-soft: #0E1420;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.07);
  --text: #E6EDF7;
  --text-dim: #A9B6CB;
  --muted: #8C9AB4;
  --accent-a: #3BE0C5;
  --accent-b: #8B7CFF;
  --cyan: #2DD4BF;
  --ok: #35C77B;
  --warn: #F5A524;
  --danger: #F04438;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: .18s cubic-bezier(.2, .8, .2, 1);
  --font: Inter, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* 两层极淡径向光晕 + 噪点 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(680px 420px at 18% -10%, rgba(45, 212, 191, 0.10), transparent 70%),
    radial-gradient(720px 460px at 88% 6%, rgba(124, 108, 240, 0.10), transparent 72%),
    var(--bg);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .28;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='n' opacity='.35'/%3E%3C/svg%3E");
}

button, textarea, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent-a);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ===== 布局 ===== */
.app {
  --side: 260px;
  --right: 0px;
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr) var(--right);
  height: 100vh;
  transition: grid-template-columns var(--ease);
}

.app.work-mode { --right: 340px; }
.app.side-hidden { --side: 0px; }

/* ===== 左栏 ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px;
  border-right: 1px solid var(--line-soft);
  overflow: hidden;
  transition: opacity var(--ease), padding var(--ease);
}

.app.side-hidden .sidebar { opacity: 0; padding-left: 0; padding-right: 0; pointer-events: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 8px;
}

.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: var(--accent-a);
  background: rgba(59, 224, 197, .08);
  border: 1px solid rgba(59, 224, 197, .18);
}

.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .4px; }

.new-chat {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  transition: background var(--ease), border-color var(--ease);
}
.new-chat:hover { background: var(--panel-strong); border-color: rgba(255,255,255,.18); }
.new-chat kbd {
  font: 11px/1 var(--mono); color: var(--muted);
  border: 1px solid var(--line-soft); border-radius: 5px; padding: 3px 5px;
}

.session-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }

.session-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--ease), color var(--ease);
}
.session-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.session-item.is-active { background: rgba(59,224,197,.08); color: var(--text); border-color: rgba(59,224,197,.16); }
.session-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .more {
  opacity: 0; border: none; background: none; color: var(--muted); padding: 0 4px;
  transition: opacity var(--ease);
}
.session-item:hover .more { opacity: 1; }
.session-empty { color: var(--muted); font-size: 12.5px; padding: 10px; }

.sidebar-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  padding-top: 10px; border-top: 1px solid var(--line-soft);
}
.foot-link {
  margin-left: auto;
  border: 0; background: none; padding: 2px 4px;
  color: var(--muted); font-size: 11px; cursor: pointer;
}
.foot-link + .foot-link { margin-left: 0; }
.foot-link:hover { color: var(--text); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(53,199,123,.12); }
.status-dot.bad { background: var(--danger); }

/* ===== 中栏 ===== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 15, 23, .55);
  backdrop-filter: blur(14px);
}

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--text-dim);
  transition: background var(--ease), color var(--ease);
}
.icon-btn:hover { background: var(--panel); color: var(--text); }

/* 模式切换器 */
.mode-switch {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  border: 1px solid var(--line);
  min-width: 138px;
}
.mode-thumb {
  position: absolute; top: 3px; left: 3px; bottom: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(59,224,197,.22), rgba(139,124,255,.22));
  border: 1px solid rgba(59,224,197,.32);
  box-shadow: 0 0 18px rgba(59,224,197,.16);
  transition: transform var(--ease), width var(--ease), opacity var(--ease);
  pointer-events: none;
}
.mode-switch[data-active="work"] .mode-thumb { transform: translateX(100%); }
.mode-switch.single .mode-thumb { width: calc(100% - 6px); }

.mode-btn {
  position: relative; z-index: 1;
  border: none; background: none;
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  transition: color var(--ease);
}
.mode-btn.is-active { color: var(--text); font-weight: 500; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* 三档权限分段控件 */
.perm {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border-radius: 11px;
  background: rgba(255,255,255,.045);
  border: 1px solid var(--line);
  width: 186px;
}
.perm-thumb {
  position: absolute; top: 3px; left: 3px; bottom: 3px;
  width: calc(33.333% - 2px);
  border-radius: 8px;
  background: rgba(245,165,36,.18);
  border: 1px solid rgba(245,165,36,.42);
  box-shadow: 0 0 16px rgba(245,165,36,.18);
  transition: transform var(--ease), background var(--ease), border-color var(--ease), box-shadow var(--ease);
  pointer-events: none;
}
.perm[data-level="L1"] .perm-thumb {
  transform: translateX(0);
  background: rgba(59,224,197,.16); border-color: rgba(59,224,197,.42);
  box-shadow: 0 0 16px rgba(59,224,197,.18);
}
.perm[data-level="L2"] .perm-thumb { transform: translateX(100%); }
.perm[data-level="L3"] .perm-thumb {
  transform: translateX(200%);
  background: rgba(240,68,56,.18); border-color: rgba(240,68,56,.46);
  box-shadow: 0 0 16px rgba(240,68,56,.2);
}
.perm-btn {
  position: relative; z-index: 1;
  border: none; background: none;
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  transition: color var(--ease);
}
.perm-btn.is-active { color: var(--text); font-weight: 500; }

.perm-hint { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* display:grid 会盖掉 [hidden]，必须显式处理 */
.perm[hidden],
.perm-hint[hidden] { display: none; }

.dl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(59,224,197,.16), rgba(139,124,255,.16));
  border: 1px solid rgba(59,224,197,.32);
  transition: filter var(--ease), transform var(--ease);
}
.dl-btn:hover { filter: brightness(1.15); }
.dl-btn:active { transform: translateY(1px); }
.dl-btn[hidden] { display: none; }

.danger-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--danger), transparent);
  animation: dangerPulse 2.4s ease-in-out infinite;
}
@keyframes dangerPulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

.notice {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 18px 0;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  color: #FFE9B8;
  background: rgba(245,165,36,.12);
  border: 1px solid rgba(245,165,36,.3);
}
.notice[hidden] { display: none; }
.notice-close { margin-left: auto; border: none; background: none; color: inherit; font-size: 16px; line-height: 1; }

/* 消息流 */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 8px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg { display: flex; flex-direction: column; max-width: 780px; animation: msgIn .22s cubic-bezier(.2,.8,.2,1) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.ai { align-self: flex-start; align-items: flex-start; }

.bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.68;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg.user .bubble {
  background: rgba(59,224,197,.10);
  border: 1px solid rgba(59,224,197,.22);
  color: var(--text);
}
.msg.ai .bubble {
  background: var(--panel);
  border: 1px solid var(--line);
}
.msg.ai .bubble.streaming::after {
  content: "";
  display: inline-block;
  width: 7px; height: 14px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--accent-a);
  opacity: .7;
  animation: caret .9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.msg-meta { font-size: 11px; color: var(--muted); margin-top: 4px; padding: 0 4px; }

/* Markdown 内容 */
.bubble h1, .bubble h2, .bubble h3 { font-size: 17px; margin: 12px 0 6px; }
.bubble h3 { font-size: 15px; }
.bubble p { margin: 7px 0; }
.bubble ul, .bubble ol { margin: 6px 0; padding-left: 20px; }
.bubble li { margin: 3px 0; }
.bubble code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(255,255,255,.07);
  padding: 1px 5px;
  border-radius: 5px;
}
.bubble pre {
  position: relative;
  margin: 9px 0;
  padding: 12px 12px 12px 13px;
  border-radius: 10px;
  background: rgba(0,0,0,.38);
  border: 1px solid var(--line-soft);
  overflow-x: auto;
}
.bubble pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.6; }
.code-copy {
  position: absolute; top: 6px; right: 6px;
  font-size: 11px; padding: 3px 8px;
  color: var(--muted);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  opacity: 0; transition: opacity var(--ease);
}
.bubble pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--text); }

.bubble table { border-collapse: collapse; margin: 8px 0; width: 100%; font-size: 13px; }
.bubble th, .bubble td { border: 1px solid var(--line-soft); padding: 6px 9px; text-align: left; }
.bubble th { background: rgba(255,255,255,.04); }

/* 思考区（reasoning） */
.reasoning {
  align-self: flex-start;
  width: min(100%, 700px);
  margin: 2px 0 2px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  overflow: hidden;
}
.reasoning-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.reasoning-head .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.reasoning.open .reasoning-head .pulse { background: var(--accent-a); animation: pulse 1.4s ease-in-out infinite; }
.thinking {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 2px;
  font-size: 12px;
  color: var(--muted);
}
.thinking .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-a);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
.reasoning-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--ease); }
.reasoning.open .reasoning-body { grid-template-rows: 1fr; }
.reasoning-body > div { overflow: hidden; }
.reasoning-text {
  padding: 0 12px 10px;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* 工具调用卡片 */
.tool-card {
  align-self: flex-start;
  width: min(100%, 700px);
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  overflow: hidden;
}
.tool-head {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.tool-head .tool-name { font-family: var(--mono); color: var(--text); }
.tool-head .tool-args {
  flex: 1; color: var(--muted); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tool-head .tool-time { color: var(--muted); font-size: 11px; }
.tool-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.tool-dot.running { background: var(--accent-a); animation: pulse 1.2s ease-in-out infinite; }
.tool-dot.ok { background: var(--ok); }
.tool-dot.fail { background: var(--danger); }
.tool-dot.wait { background: var(--warn); }
.tool-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--ease); }
.tool-card.open .tool-body { grid-template-rows: 1fr; }
.tool-body > div { overflow: hidden; }
.tool-out {
  margin: 0;
  padding: 0 12px 11px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto;
}

/* 确认卡片 */
.confirm-card {
  align-self: flex-start;
  width: min(100%, 700px);
  border-radius: 12px;
  border: 1px solid rgba(245,165,36,.4);
  background: rgba(245,165,36,.08);
  padding: 12px 14px;
}
.confirm-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.confirm-meta { margin-top: 6px; font-size: 12px; color: var(--text-dim); }
.confirm-args {
  margin-top: 8px; padding: 8px 10px;
  border-radius: 8px; background: rgba(0,0,0,.28);
  font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
  max-height: 120px; overflow: auto; white-space: pre-wrap;
}
.confirm-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.confirm-actions .countdown { margin-left: auto; font-size: 11.5px; color: var(--muted); }

/* 空状态 */
.empty {
  margin: auto;
  text-align: center;
  max-width: 620px;
  padding-bottom: 40px;
}
.empty-art { margin-bottom: 10px; opacity: .9; }
.empty h2 { font-size: 20px; font-weight: 600; margin: 6px 0 6px; }
.empty p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.chip:hover { background: var(--panel-strong); color: var(--text); border-color: rgba(59,224,197,.3); }

/* 输入区 */
.composer {
  padding: 10px 24px 16px;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(to top, rgba(11,15,23,.9), rgba(11,15,23,.55));
}
.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 7px 8px 7px 6px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.composer-box:focus-within {
  border-color: rgba(59,224,197,.34);
  box-shadow: 0 0 0 3px rgba(59,224,197,.06);
}
#input {
  flex: 1;
  min-height: 38px;
  max-height: 180px;
  padding: 8px 4px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  line-height: 1.6;
}
#input::placeholder { color: rgba(140,154,180,.72); }

.attach {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  flex: none;
  transition: color var(--ease), border-color var(--ease);
}
.attach:hover { color: var(--text); border-color: var(--line); }

.circle {
  width: 36px; height: 36px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(59,224,197,.45);
  color: #06231F;
  background: linear-gradient(135deg, var(--accent-a), #74E9D4);
  transition: filter var(--ease), transform var(--ease), opacity var(--ease);
}
.circle:hover { filter: brightness(1.08); }
.circle:active { transform: scale(.97); }
.circle:disabled { opacity: .45; cursor: not-allowed; }
.circle.stop { background: rgba(240,68,56,.16); border-color: rgba(240,68,56,.5); color: #FFD9D6; }
.stop-square { width: 11px; height: 11px; border-radius: 2px; background: currentColor; display: block; }

.composer-hint { margin: 0; font-size: 11.5px; color: var(--muted); }
.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 0 2px;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  flex: none;
  transition: background var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.tool-btn:hover { color: var(--text); border-color: rgba(59,224,197,.32); }
.tool-btn.is-on {
  color: #06231F;
  background: linear-gradient(135deg, var(--accent-a), #74E9D4);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(59,224,197,.12);
}
.tool-btn:disabled { opacity: .45; cursor: not-allowed; }

.attach-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.attach-thumb {
  position: relative;
  width: 62px; height: 62px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb .rm {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: none;
  background: rgba(6,10,16,.72);
  color: #E6EDF7;
  font-size: 11px;
  line-height: 1;
}
.attach-thumb .rm:hover { background: rgba(240,68,56,.85); }
.attach-thumb .busy {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 11px;
  color: var(--muted);
  background: rgba(6,10,16,.55);
}

/* 用户消息里的图片 */
.msg-img {
  display: block;
  max-width: 240px;
  max-height: 240px;
  border-radius: 10px;
  margin-top: 7px;
  border: 1px solid var(--line);
}
.msg-img-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line-soft);
}

/* 联网搜索来源卡片 */
.search-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03);
  margin-bottom: 8px;
  overflow: hidden;
}
.search-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
}
.search-head .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-a);
  flex: none;
}
.search-head .q { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-head .cnt { margin-left: auto; color: var(--muted); flex: none; }
.search-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .18s var(--ease);
}
.search-card.open .search-body { grid-template-rows: 1fr; }
.search-body > div { overflow: hidden; }
.search-list { padding: 2px 12px 10px; display: flex; flex-direction: column; gap: 7px; }
.search-item { font-size: 12px; line-height: 1.5; }
.search-item .idx { color: var(--accent-a); margin-right: 5px; }
.search-item a { color: #BFD4F2; text-decoration: none; word-break: break-all; }
.search-item a:hover { text-decoration: underline; }
.search-item .snip { color: var(--muted); display: block; margin-top: 1px; }

/* ===== 右栏 ===== */
.rightbar {
  border-left: 1px solid var(--line-soft);
  padding: 14px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  animation: rightIn .22s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rightIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.rightbar[hidden] { display: none; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; letter-spacing: .4px; text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.mini-btn {
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 6px;
  transition: color var(--ease), border-color var(--ease);
}
.mini-btn:hover { color: var(--text); border-color: var(--line); }

.ws-path {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  background: rgba(0,0,0,.28);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 7px 9px;
  word-break: break-all;
}

.filetree {
  flex: 0 0 34%;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px;
  background: rgba(0,0,0,.18);
}
.filetree .row { padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filetree .dir { color: var(--accent-a); }
.filetree .size { color: var(--muted); font-size: 11px; margin-left: 6px; }
.filetree .empty { color: var(--muted); font-size: 11.5px; text-align: left; margin: 0; padding: 0; }

.terminal {
  flex: 1;
  margin: 0;
  overflow: auto;
  padding: 8px 9px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: rgba(0,0,0,.32);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-dim);
  white-space: pre-wrap;
}
.terminal .t-ok { color: var(--ok); }
.terminal .t-fail { color: var(--danger); }
.terminal .t-dim { color: var(--muted); }

/* ===== 锁死遮罩 ===== */
.lockdown {
  position: fixed; inset: 0; z-index: 2147482000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 11, 17, .82);
  backdrop-filter: blur(18px);
}
.lockdown[hidden] { display: none; }
.lockdown-card {
  width: min(420px, 88vw);
  padding: 30px 28px;
  text-align: center;
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.lockdown-icon { color: var(--warn); margin-bottom: 8px; }
.lockdown-card h2 { font-size: 17px; margin: 0 0 8px; }
.lockdown-card p { color: var(--muted); font-size: 13px; margin: 0; }

/* ===== 弹层 ===== */
.modal-root {
  position: fixed; inset: 0; z-index: 2147481000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(6, 9, 14, .66);
  backdrop-filter: blur(10px);
  animation: fadeIn .18s ease both;
}
.modal-root[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(520px, 92vw);
  border-radius: 18px;
  background: #101623;
  border: 1px solid var(--line);
  box-shadow: 0 26px 70px rgba(0,0,0,.55);
  overflow: hidden;
  animation: modalIn .2s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal.danger { border-color: rgba(240,68,56,.45); background: #180F14; }

.modal-head { padding: 16px 18px 8px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

.modal-body { padding: 6px 18px 4px; font-size: 13px; color: var(--text-dim); }
.modal-body ul { margin: 8px 0; padding-left: 18px; }
.modal-body li { margin: 5px 0; }
.modal-body .risk-list { color: #FFC9C5; }

.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 18px 16px;
}

.btn {
  padding: 8px 15px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  transition: background var(--ease), border-color var(--ease), filter var(--ease);
}
.btn:hover { background: var(--panel-strong); }
.btn.primary {
  background: linear-gradient(135deg, rgba(59,224,197,.9), rgba(116,233,212,.9));
  border-color: rgba(59,224,197,.6);
  color: #06231F;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger {
  background: rgba(240,68,56,.9);
  border-color: rgba(240,68,56,.7);
  color: #FFF2F1;
  font-weight: 600;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* 自绘勾选框 */
.check {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 17px; height: 17px; flex: none;
  margin-top: 2px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  display: grid; place-items: center;
  transition: background var(--ease), border-color var(--ease);
}
.check input:checked + .box { background: rgba(240,68,56,.9); border-color: rgba(240,68,56,.9); }
.check .box::after {
  content: ""; width: 9px; height: 5px;
  border-left: 1.8px solid #fff; border-bottom: 1.8px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
}
.check input:checked + .box::after { opacity: 1; }
.check input:focus-visible + .box { outline: 2px solid var(--accent-a); outline-offset: 2px; }

/* toast */
.toast-root {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 2147482500;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text);
  background: rgba(16,22,35,.94);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
  animation: toastIn .18s ease both;
}
.toast.warn { border-color: rgba(245,165,36,.4); color: #FFE3AE; }
.toast.err { border-color: rgba(240,68,56,.45); color: #FFD5D2; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 自绘滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.1);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .app.work-mode { --right: 0px; }
  .rightbar { display: none !important; }
  .perm-hint { display: none; }
}

@media (max-width: 760px) {
  .app { --side: 0px; --right: 0px; grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50;
    background: #0C121C;
    transform: translateX(-102%);
    transition: transform var(--ease);
    box-shadow: 0 0 40px rgba(0,0,0,.5);
  }
  .app.drawer .sidebar { transform: none; }
  .messages { padding: 16px 14px 6px; }
  .composer { padding: 8px 12px 14px; }
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .dl-btn span { display: none; }
  .mode-switch { min-width: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
