/* ============================================================
   AIXen — app.css  (v4 design pass)
   系统：冷墨蓝 / 纸面白 · 4-8px 节奏网格 · mono 数据声部
   签名元素：AI 消息左侧「执行轨」（思考→工具→回答的阶段节点）
   ============================================================ */
:root {
  /* 色 */
  --paper: #fcfdff;          /* 纸面 */
  --wash: #f1f5fa;           /* 侧栏/分区洗色 */
  --wash-2: #f6f9fc;
  --line: #e3e9f2;           /* 发丝线 */
  --line-2: #eef2f7;
  --ink: #17243c;            /* 冷墨 */
  --ink-2: #46586e;
  --ink-3: #8c97a9;
  --blue: #2f6bde;            /* 主蓝 */
  --blue-deep: #1e4fbf;
  --blue-wash: #e9f1fc;
  --blue-line: #c9dcf5;
  --ok: #149a66;
  --err: #d8443c;
  /* 声部 */
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  /* 节奏 */
  --side-w: 264px;
  --col: 720px;
  --topbar-h: 52px;
}

/* ---------- 基面 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 15px/1.7 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
svg { display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; }
[hidden] { display: none !important; }

/* ---------- 滚动条（全站定制，不再用系统默认） ---------- */
html { scrollbar-width: thin; scrollbar-color: #c4cddc transparent; }
* { scrollbar-width: thin; scrollbar-color: #c4cddc transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #cbd5e2;
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background-color: #a9b7cb; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:active { background-color: #8fa0b6; background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }
/* 代码/JSON 内滚动更细 */
.codeblock pre, .cap-body { scrollbar-width: thin; }
.codeblock pre::-webkit-scrollbar { width: 8px; height: 8px; }
.codeblock pre::-webkit-scrollbar-thumb { border-width: 2px; background-clip: padding-box; }

/* ---------- 焦点可达性 ---------- */
:focus { outline: none; }
:focus-visible { outline: 2px solid rgba(47, 107, 222, .55); outline-offset: 2px; border-radius: 6px; }

/* ---------- 动效 ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes rot { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================================================================
   登录门
   ================================================================ */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(820px 380px at 84% -6%, #eaf2fc 0%, transparent 60%),
    radial-gradient(560px 280px at 4% 104%, #f0f5fb 0%, transparent 55%),
    var(--paper);
}
.gate-card {
  width: min(92vw, 372px);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 20px;
  box-shadow:
    0 1px 2px rgba(23, 36, 60, .04),
    0 20px 60px -20px rgba(23, 36, 60, .22),
    0 4px 16px rgba(23, 36, 60, .05);
  padding: 40px 34px 24px;
  text-align: center;
  animation: fadeUp .45s ease both;
}
.gate-logo {
  width: 48px; height: 48px; margin: 0 auto 18px;
  border-radius: 14px;
  background: linear-gradient(140deg, #3f7ae8, #1e4fbf);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 18px rgba(47, 107, 222, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.gate-title { font-size: 23px; font-weight: 800; letter-spacing: .3px; }
.gate-title i { font-style: normal; color: var(--blue); }
.gate-sub { color: var(--ink-3); font-size: 12.5px; margin-top: 5px; letter-spacing: .2px; }
.gate form { margin-top: 28px; }
#gateInput {
  width: 100%;
  border: 1px solid var(--line); border-radius: 11px;
  background: #fff; color: var(--ink);
  font-size: 15px; padding: 11px 14px; outline: none;
  letter-spacing: .08em;
  transition: border-color .16s, box-shadow .16s;
}
#gateInput:focus { border-color: var(--blue); box-shadow: 0 0 0 3.5px rgba(47, 107, 222, .12); }
.gate-btn {
  width: 100%; margin-top: 10px;
  background: var(--blue); color: #fff;
  border-radius: 11px; padding: 11px 0;
  font-size: 14.5px; font-weight: 650; letter-spacing: .2px;
  transition: background .16s, transform .1s, box-shadow .16s;
  box-shadow: 0 3px 12px rgba(47, 107, 222, .3), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.gate-btn:hover { background: var(--blue-deep); }
.gate-btn:active { transform: scale(.985); }
.gate-btn:disabled { background: #b9c8dd; box-shadow: none; }
.gate-err { color: var(--err); font-size: 12.5px; margin-top: 12px; min-height: 16px; font-weight: 500; }
.gate-card.shake { animation: shake .38s ease; }
.gate-foot { color: var(--ink-3); font-size: 11px; margin-top: 16px; letter-spacing: .2px; }

/* ================================================================
   应用骨架
   ================================================================ */
.app { display: flex; height: 100%; }

/* ---------- 侧栏 ---------- */
.side {
  width: var(--side-w); flex: none;
  background: var(--wash);
  border-right: 1px solid var(--line-2);
  display: flex; flex-direction: column;
  min-height: 0;
  z-index: 50;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px 16px;
}
.side-brand { display: flex; align-items: center; gap: 9px; user-select: none; }
.logo {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(140deg, #3f7ae8, #1e4fbf);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 7px rgba(47, 107, 222, .3), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.wordmark { font-size: 16px; font-weight: 800; letter-spacing: .4px; }
.wordmark i { font-style: normal; color: var(--blue); }
.side-close { display: none; color: var(--ink-3); padding: 6px; border-radius: 8px; }
.side-close:hover { background: rgba(23, 36, 60, .06); color: var(--ink-2); }

.side-new {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 2px 14px 10px;
  background: var(--blue);
  border: 1px solid var(--blue-deep);
  color: #fff;
  border-radius: 9px; padding: 8px 12px;
  font-size: 13px; font-weight: 650; letter-spacing: .2px;
  transition: background .15s;
  box-shadow: 0 2px 8px rgba(47, 107, 222, .25), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.side-new:hover { background: var(--blue-deep); }

.side-search { position: relative; margin: 0 14px 10px; }
.side-search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}
.side-search input {
  width: 100%;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff;
  font-size: 12.5px; color: var(--ink);
  padding: 7px 10px 7px 31px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.side-search input:focus { border-color: var(--blue-line); box-shadow: 0 0 0 3px rgba(47, 107, 222, .08); }
.side-search input::placeholder { color: var(--ink-3); }
.side-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.side-list {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 2px 10px 10px;
}
.group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--ink-3);
  padding: 12px 8px 4px;
  user-select: none;
}
.conv {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 8px 7px 9px;
  border-radius: 9px;
  color: var(--ink-2); font-size: 13px;
  cursor: pointer; user-select: none;
  transition: background .12s, color .12s;
}
.conv:hover { background: #e8eef6; }
.conv.active {
  background: var(--blue-wash);
  color: var(--blue-deep);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--blue);
}
.conv .c-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv .c-time {
  flex: none;
  font-size: 10px; color: var(--ink-3);
  font-family: var(--mono);
}
.conv.active .c-time { color: #7fa6d8; }
.conv .c-del {
  flex: none; display: grid; place-items: center;
  width: 21px; height: 21px; border-radius: 6px;
  color: var(--ink-3); opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
}
.conv:hover .c-del { opacity: 1; }
.conv .c-del:hover { background: rgba(216, 68, 60, .1); color: var(--err); }
.conv.active .c-del { color: #7fa6d8; opacity: .85; }
.conv input.rename {
  flex: 1; min-width: 0;
  border: 1px solid var(--blue-line); border-radius: 6px;
  font-size: 12.5px; padding: 3px 6px; outline: none;
  background: #fff; color: var(--ink);
}

.side-empty {
  padding: 24px 12px; text-align: center;
  color: var(--ink-2); font-size: 12.5px; line-height: 1.6;
}
.side-empty .hint { margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }

.side-foot {
  flex: none;
  padding: 11px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-2);
}
.sync-row {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--ink-3);
  margin-bottom: 9px; user-select: none;
}
.sync-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(20, 154, 102, .12);
}
.sync-dot.err { background: var(--err); box-shadow: 0 0 0 3px rgba(216, 68, 60, .12); }
.foot-btns { display: flex; gap: 8px; }
.foot-btn {
  flex: 1;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink-2);
  font-size: 12px; font-weight: 550; padding: 6px 0;
  transition: border-color .15s, color .15s, background .15s;
}
.foot-btn:hover { border-color: var(--blue-line); color: var(--blue-deep); background: var(--blue-wash); }

/* ---------- 主区 ---------- */
.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  height: 100%;
  background:
    radial-gradient(760px 340px at 82% -6%, #edf3fc 0%, transparent 58%),
    radial-gradient(520px 260px at 0% 0%, #f2f6fb 0%, transparent 52%),
    var(--paper);
}
.topbar {
  flex: none; height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  background: rgba(241, 245, 250, .55);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.menu-btn {
  display: none;
  width: 34px; height: 34px; border-radius: 9px;
  display: none; place-items: center;
  color: var(--ink-2);
  transition: background .15s;
}
.menu-btn:hover { background: rgba(23, 36, 60, .06); }
.conv-title {
  flex: 1; min-width: 0;
  font-weight: 650; font-size: 14px; letter-spacing: .1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  user-select: none;
}
.top-right { flex: none; display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-2);
  font-size: 12px; font-weight: 550; padding: 5px 11px;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
select.pill {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 25px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6' viewBox='0 0 9 6' fill='none' stroke='%238c97a9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l3.5 4L8 1'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  max-width: 32vw; text-overflow: ellipsis;
}
select.pill:hover { border-color: var(--blue-line); }
select.pill:focus { outline: none; border-color: var(--blue); color: var(--ink); box-shadow: 0 0 0 3px rgba(47, 107, 222, .1); }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-2);
  font-size: 12px; font-weight: 550; padding: 5px 11px;
  transition: border-color .15s, color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--blue-line); color: var(--blue-deep); background: var(--blue-wash); }

/* ---------- 消息流 ---------- */
.scroller { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.stage { max-width: var(--col); margin: 0 auto; padding: 0 24px; }

.hero {
  max-width: 680px; margin: 0 auto; padding: clamp(36px, 10vh, 96px) 0 28px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  animation: fadeUp .5s ease both;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .3px;
  color: var(--blue-deep);
  background: var(--blue-wash); border: 1px solid var(--blue-line);
  border-radius: 999px; padding: 4px 12px; margin-bottom: 26px;
}
.hero h1 {
  font-size: clamp(25px, 4.2vw, 33px); font-weight: 750; letter-spacing: -.015em;
  line-height: 1.22;
  background: linear-gradient(94deg, #16233c 12%, #2f6bde 58%, #4d88e8 94%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .sub { color: var(--ink-2); font-size: 14.5px; margin-top: 14px; max-width: 540px; line-height: 1.8; }
.hero .chips {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin-top: 44px;
}
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-2); font-weight: 550;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 15px;
  transition: border-color .15s, color .15s, background .15s, transform .15s;
  box-shadow: 0 1px 2px rgba(23, 36, 60, .03);
}
.chip svg { color: var(--blue); }
.chip:hover { border-color: var(--blue); color: var(--blue-deep); background: #fff; transform: translateY(-1px); }

.thread { display: flex; flex-direction: column; gap: 30px; padding: 26px 0 16px; }

.m-user { display: flex; justify-content: flex-end; animation: fadeUp .28s ease both; }
.m-user .bubble {
  max-width: 78%;
  background: var(--blue-wash);
  border: 1px solid #d9e7f8;
  border-radius: 18px 18px 5px 18px;
  padding: 10px 16px;
  white-space: pre-wrap; word-break: break-word;
  font-size: 14.5px;
}

.m-ai { animation: fadeUp .28s ease both; }
.ai-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; user-select: none; }
.ai-head .logo { width: 24px; height: 24px; border-radius: 7px; }
.ai-head .logo svg { width: 12px; height: 12px; }
.ai-head .name { font-size: 12.5px; font-weight: 750; letter-spacing: .5px; }
.ai-head .name i { font-style: normal; color: var(--blue); }
.ai-head .when { font-size: 11px; color: var(--ink-3); font-family: var(--mono); letter-spacing: 0; }

/* ================================================================
   签名元素：执行轨（思考 → 工具 → 回答 的阶段节点）
   ================================================================ */
.caps { display: flex; flex-direction: column; gap: 8px; margin: 0 0 13px; align-items: flex-start; }
.caprow { position: relative; padding-left: 19px; max-width: 100%; }
/* 轨段：连接到下一个节点（首个段从节点开始，末段到节点为止） */
.caprow::after {
  content: "";
  position: absolute; left: 3.25px; top: 0; bottom: -8px;
  width: 2px;
  background: #b9cbe4;
}
.caprow:first-child::after { top: 13px; }
.caprow:last-child::after { display: none; }
/* 节点：进行时空心，完成时实心蓝 */
.caprow::before {
  content: "";
  position: absolute; left: 0; top: 9px;
  width: 8.5px; height: 8.5px; border-radius: 50%;
  background: #fff;
  border: 1.5px solid #bcc8d9;
  z-index: 1;
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.caprow.done::before {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 107, 222, .14);
}

.cap {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 100%;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: var(--wash-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 11px 5px 9px;
  transition: background .15s, border-color .15s, color .15s;
  animation: fadeUp .25s ease both;
}
.cap:hover { background: #fff; border-color: var(--blue-line); color: var(--ink); }
.cap .c-ic { color: var(--blue); display: grid; place-items: center; }
.cap.done .c-ic { color: var(--ok); }
.cap .c-ic2 { display: grid; place-items: center; color: var(--ok); }
.cap .c-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 44ch; }
.cap .c-ms { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-left: 5px; }
.cap .c-ch { color: var(--ink-3); transition: transform .2s; }
.caprow.open .c-ch { transform: rotate(180deg); }
.cap .spin {
  width: 11px; height: 11px; flex: none;
  border: 1.5px solid var(--blue-line); border-top-color: var(--blue);
  border-radius: 50%; animation: rot .7s linear infinite;
}

.cap-body {
  display: none; margin: 5px 0 0;
  background: var(--wash-2); border: 1px solid var(--line);
  border-left: 2px solid var(--blue-line);
  border-radius: 10px; padding: 9px 12px;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.65; color: var(--ink-2);
  max-height: 216px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
  animation: fadeUp .18s ease both;
}
.caprow.open .cap-body { display: block; }
.cap-body .lbl {
  display: inline-block; font-family: var(--sans); font-size: 9.5px;
  font-weight: 750; letter-spacing: 1px; color: var(--ink-3);
  text-transform: uppercase; margin: 8px 0 2px;
}
.cap-body .lbl:first-child { margin-top: 0; }

/* ---------- 正文 ---------- */
.ai-body { min-height: 20px; word-break: break-word; }
.caret {
  display: inline-block; width: 7px; height: 16px; margin-left: 2px;
  background: var(--blue); border-radius: 1.5px; vertical-align: -3px;
  animation: blink .85s steps(1) infinite;
}

.ai-ops { display: none; align-items: center; gap: 3px; margin-top: 11px; user-select: none; }
.ai-ops.on { display: inline-flex; animation: fadeUp .25s ease both; }
.op {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--ink-3); font-weight: 550;
  border-radius: 7px; padding: 4px 8px;
  transition: background .15s, color .15s;
}
.op:hover { background: var(--wash); color: var(--ink-2); }
.op.ok { color: var(--ok); }
.ai-ops .sep { width: 1px; height: 13px; background: var(--line); margin: 0 5px; }
.ai-ops .usage { font-size: 10px; color: var(--ink-3); font-family: var(--mono); margin-left: 4px; letter-spacing: 0; }
.ai-note { color: var(--err); font-size: 13px; }

/* ---------- Markdown ---------- */
.ai-body p { margin: 0 0 11px; }
.ai-body > :last-child { margin-bottom: 0; }
.ai-body h1, .ai-body h2, .ai-body h3, .ai-body h4 {
  font-weight: 700; letter-spacing: -.01em; margin: 20px 0 9px; line-height: 1.4;
}
.ai-body h1 { font-size: 20px; } .ai-body h2 { font-size: 17.5px; }
.ai-body h3 { font-size: 15.5px; } .ai-body h4 { font-size: 14.5px; }
.ai-body h1:first-child, .ai-body h2:first-child, .ai-body h3:first-child { margin-top: 3px; }
.ai-body ul, .ai-body ol { margin: 0 0 11px; padding-left: 22px; }
.ai-body li { margin: 2.5px 0; }
.ai-body li::marker { color: var(--blue); }
.ai-body blockquote {
  border-left: 2.5px solid var(--blue-line); padding: 2px 0 2px 13px;
  color: var(--ink-2); margin: 0 0 11px;
}
.ai-body code {
  font-family: var(--mono); font-size: .86em;
  background: #eef3fa; border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; color: #1e4fbf;
}
.codeblock {
  margin: 0 0 13px; border: 1px solid var(--line); border-radius: 11px;
  overflow: hidden; background: #fbfdff;
  box-shadow: 0 1px 2px rgba(23, 36, 60, .03);
}
.codeblock .cb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 11px; background: var(--wash-2); border-bottom: 1px solid var(--line);
}
.codeblock .cb-lang {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .8px; color: var(--ink-3); text-transform: lowercase;
}
.cb-copy {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 550; color: var(--ink-3);
  border-radius: 6px; padding: 3px 7px;
  transition: background .15s, color .15s;
}
.cb-copy:hover { background: #e7eef7; color: var(--blue-deep); }
.cb-copy.ok { color: var(--ok); }
.codeblock pre { overflow: auto; padding: 11px 13px; }
.codeblock code { background: none; border: none; padding: 0; color: #1b2b47; font-size: 12px; line-height: 1.62; }
.ai-body a { color: var(--blue-deep); text-decoration: none; border-bottom: 1px solid var(--blue-line); transition: border-color .15s; }
.ai-body a:hover { border-color: var(--blue); }
.ai-body hr { border: none; border-top: 1px solid var(--line); margin: 15px 0; }
.ai-body table { border-collapse: collapse; margin: 0 0 13px; font-size: 13px; display: block; overflow-x: auto; }
.ai-body th, .ai-body td { border: 1px solid var(--line); padding: 6px 11px; text-align: left; }
.ai-body th { background: var(--wash-2); font-weight: 650; color: var(--ink-2); }
.ai-body tbody tr:hover td { background: #f6f9fc; }
.ai-body strong { font-weight: 680; }

/* ---------- 输入区 ---------- */
.foot {
  flex: none; padding: 9px 24px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(252, 253, 255, .94) 68%, rgba(252, 253, 255, 0));
  backdrop-filter: blur(10px);
}
.composer-wrap { max-width: var(--col); margin: 0 auto; }
.composer {
  display: flex; align-items: flex-end; gap: 9px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 23px; padding: 9px 9px 9px 18px;
  box-shadow:
    0 1px 2px rgba(23, 36, 60, .04),
    0 10px 28px -10px rgba(23, 36, 60, .1),
    0 14px 36px -20px rgba(47, 107, 222, .28);
  transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within {
  border-color: var(--blue);
  box-shadow:
    0 0 0 3.5px rgba(47, 107, 222, .1),
    0 10px 30px -10px rgba(23, 36, 60, .1),
    0 14px 36px -20px rgba(47, 107, 222, .4);
}
textarea {
  flex: 1; border: none; resize: none; outline: none;
  font: inherit; font-size: 14.5px; line-height: 1.6;
  max-height: 200px; padding: 6px 0; background: none; color: var(--ink);
}
textarea::placeholder { color: var(--ink-3); }
.send {
  flex: none; width: 37px; height: 37px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: grid; place-items: center;
  transition: background .16s, transform .1s, box-shadow .16s;
  box-shadow: 0 2px 9px rgba(47, 107, 222, .32), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.send:not(:disabled):hover { background: var(--blue-deep); }
.send:not(:disabled):active { transform: scale(.94); }
.send:disabled { background: #d7e1ec; color: #fff; box-shadow: none; cursor: default; }
.send.stop { background: var(--ink); box-shadow: 0 2px 9px rgba(23, 36, 60, .32); }
.send.stop:hover { background: #0d1728; }
.foot-note {
  text-align: center; font-size: 10.5px; color: #6f7b8d;
  margin-top: 11px; user-select: none; letter-spacing: .2px;
}

/* ---------- 遮罩 / 弹窗 / toast ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(23, 36, 60, .3);
  backdrop-filter: blur(2px);
  display: none;
}
.scrim.on { display: block; animation: fadeIn .2s ease both; }
.veil {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center; padding: 24px;
  background: rgba(23, 36, 60, .24); backdrop-filter: blur(5px);
}
.veil.on { display: flex; }
.dialog {
  width: 100%; max-width: 352px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .95); border-radius: 17px;
  box-shadow: 0 22px 56px -12px rgba(23, 36, 60, .3);
  padding: 21px 23px;
  animation: fadeUp .22s ease both;
}
.dialog h2 { font-size: 15px; font-weight: 700; letter-spacing: .1px; }
.dialog p { color: var(--ink-2); font-size: 12.5px; margin-top: 5px; line-height: 1.6; }
.dialog .row { display: flex; justify-content: flex-end; gap: 9px; margin-top: 17px; }
.btn {
  padding: 6px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: #b6c2d2; color: var(--ink); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger:hover { background: #bf3a33; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: rgba(23, 36, 60, .93); color: #fff; backdrop-filter: blur(6px);
  border-radius: 999px; padding: 8px 17px;
  font-size: 12px; font-weight: 550; letter-spacing: .2px;
  z-index: 70; animation: fadeUp .2s ease both; max-width: 80vw;
  box-shadow: 0 8px 28px rgba(23, 36, 60, .28);
}

/* ================================================================
   手机端（<900px 抽屉）
   ================================================================ */
@media (max-width: 899px) {
  .side {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(84vw, 320px);
    transform: translateX(-104%);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    box-shadow: 0 0 44px rgba(23, 36, 60, .2);
  }
  .side.on { transform: none; }
  .side-close { display: grid; }
  .menu-btn { display: grid; }
  .conv .c-del { opacity: 1; }
  .topbar { padding: 0 11px; height: 50px; }
  .icon-btn { padding: 5px 8px; }
  .stage { padding: 0 13px; }
  .foot { padding: 7px 11px calc(11px + env(safe-area-inset-bottom)); }
  .m-user .bubble { max-width: 88%; }
  .hero { padding-top: 11vh; }
  .hero .chips { gap: 8px; }
  .chip { padding: 7px 12px; font-size: 12px; }
  .thread { gap: 24px; padding-top: 18px; }
  .caprow { padding-left: 15px; }
  .caprow::before { left: 0; top: 8px; width: 7.5px; height: 7.5px; }
  .caprow::after { left: 3px; }
  .caprow:first-child::after { top: 11px; }
}
@media (hover: none) {
  .conv .c-del { opacity: .85; }
}
