/* Claude Web · supadmin */
:root {
  --bg: #0d0d0f;
  --bg-elev: #131316;
  --bg-soft: #17171b;
  --bg-hover: #1d1d22;
  --bg-user: #26262d;
  --line: rgba(255, 255, 255, .085);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #ececf1;
  --text-dim: #b9b9c3;
  --muted: #8b8b96;
  --faint: #66666f;
  --accent: #d97757;
  --accent-soft: rgba(217, 119, 87, .14);
  --green: #7cc091;
  --green-soft: rgba(124, 192, 145, .13);
  --red: #e06c75;
  --red-soft: rgba(224, 108, 117, .13);
  --amber: #d9ab62;
  --blue: #79a7e0;
  --radius: 12px;
  --sidebar-w: 302px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--blue); }
::selection { background: rgba(217, 119, 87, .32); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c2c33; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a3a43; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------ 布局 ------------------------------ */
.app { display: flex; height: 100%; min-height: 0; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #e58a68, #b95f45);
  color: #fff; font-size: 16px;
  box-shadow: 0 4px 14px rgba(217, 119, 87, .25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: .2px; }
.brand-text span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.new-btn {
  margin: 0 14px 10px;
  height: 40px; border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 14px; font-weight: 550;
  transition: background .15s, border-color .15s, transform .05s;
}
.new-btn:hover { background: var(--bg-hover); border-color: #33333c; }
.new-btn:active { transform: scale(.99); }
.new-btn .plus { color: var(--accent); font-size: 16px; font-weight: 700; }

.search-wrap { padding: 0 14px 10px; }
.search-wrap input {
  width: 100%; height: 34px;
  background: #101013;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 11px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.search-wrap input:focus { border-color: #3a3a44; background: #0c0c0f; }
.search-wrap input::placeholder { color: var(--faint); }

.session-scroll { flex: 1; overflow-y: auto; padding: 2px 8px 14px; min-height: 0; }
.list-loading { padding: 22px 12px; color: var(--faint); font-size: 13px; text-align: center; }

.group { margin-top: 10px; }
.group-head {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 9px;
  color: var(--muted); font-size: 11.5px; font-weight: 600;
  letter-spacing: .3px; text-transform: none;
  border-radius: 7px;
  user-select: none;
}
.group-head:hover { background: rgba(255, 255, 255, .03); }
.group-head .folder { color: var(--faint); font-size: 12px; }
.group-head .g-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-head .g-count { margin-left: auto; color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.group.collapsed .group-body { display: none; }
.group.collapsed .group-head .folder { transform: rotate(-90deg); }
.group-head .folder { transition: transform .15s; }

.session-item {
  position: relative;
  display: flex; align-items: flex-start; gap: 9px;
  width: 100%; text-align: left;
  padding: 8px 9px 9px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: background .12s;
  margin-bottom: 1px;
}
.session-item:hover { background: var(--bg-hover); }
.session-item.active { background: #222228; border-color: rgba(255, 255, 255, .07); }
.session-item .s-body { min-width: 0; flex: 1; }
.session-item .s-title {
  font-size: 13.5px; color: var(--text-dim); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
  padding-right: 36px;
}
.s-actions {
  position: absolute; top: 4px; right: 4px;
  display: flex; gap: 1px;
  opacity: 0; transition: opacity .12s;
}
.session-item:hover .s-actions, .session-item.active .s-actions { opacity: 1; }
.s-actions .s-action {
  width: 21px; height: 21px; border-radius: 5px;
  display: grid; place-items: center;
  font-size: 11px; color: var(--muted);
  background: rgba(29, 29, 34, .8);
  cursor: pointer;
}
.s-actions .s-action:hover { background: #33333c; color: var(--text); }
.s-actions .s-action[data-delete]:hover { background: var(--red-soft); color: #f0a0a6; }
.session-item.active .s-title { color: var(--text); }
.session-item .s-meta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 3px; font-size: 11px; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.s-badge {
  font-size: 9px; color: #e6c184;
  border: 1px solid rgba(217, 171, 98, .3);
  border-radius: 4px; padding: 0 4px; margin-left: 2px;
}
.session-item .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  flex: 0 0 auto; margin-top: 6px;
  box-shadow: 0 0 0 0 rgba(217, 119, 87, .45);
}
.session-item.running .dot { animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 119, 87, .45); }
  70% { box-shadow: 0 0 0 7px rgba(217, 119, 87, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 87, 0); }
}
.session-item:not(.running) .dot { background: #3a3a42; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 10px 14px 12px;
  display: flex; align-items: center; gap: 8px;
}
.who { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: #2a2a32; color: var(--text-dim);
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
#who-name { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-actions { display: flex; gap: 2px; }
.foot-actions button {
  font-size: 12px; color: var(--muted); padding: 5px 7px; border-radius: 6px;
}
.foot-actions button:hover { background: var(--bg-hover); color: var(--text); }

.main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }

/* ------------------------------ 空状态 ------------------------------ */
.empty {
  margin: auto; max-width: 620px; padding: 40px 24px 90px; text-align: center;
}
.empty-mark {
  width: 54px; height: 54px; margin: 0 auto 22px;
  border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(145deg, #e58a68, #b95f45);
  color: #fff; font-size: 26px;
  box-shadow: 0 10px 40px rgba(217, 119, 87, .22);
}
.empty h1 { font-size: 25px; margin: 0 0 10px; letter-spacing: -.3px; }
.empty p { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 0 auto 26px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; }
.primary {
  height: 38px; padding: 0 18px; border-radius: 9px;
  background: var(--accent); color: #1a0e0a; font-weight: 650; font-size: 13.5px;
}
.primary:hover { filter: brightness(1.06); }
.ghost {
  height: 38px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--line-strong); color: var(--text-dim); font-size: 13.5px;
}
.ghost:hover { background: var(--bg-hover); }
.empty-tips {
  margin-top: 34px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  color: var(--faint); font-size: 11.5px;
}
.empty-tips span {
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 9px;
}
.empty-tips em { width: 100%; font-style: normal; margin-top: 6px; color: #55555d; }

/* ------------------------------ 会话头 ------------------------------ */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 12px;
  height: 64px; flex: 0 0 64px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 13, 15, .86);
  backdrop-filter: blur(12px);
  position: relative; z-index: 20;
}
.menu-btn { display: none !important; }
.chat-title-wrap { min-width: 0; flex: 1; }
.chat-title-line { display: flex; align-items: center; gap: 2px; min-width: 0; }
.chat-subline { display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 2px; }
.chat-time {
  font-size: 10.5px; color: var(--faint); white-space: nowrap;
  font-variant-numeric: tabular-nums; flex: 0 0 auto;
}
.chat-title-line h1 {
  font-size: 14.5px; font-weight: 600; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cwd {
  display: block; max-width: 100%; min-width: 0;
  font-size: 11px; color: var(--faint); font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0; text-align: left;
}
.cwd:hover { color: var(--muted); }
.head-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ctx { display: flex; align-items: center; gap: 7px; }
.ctx-bar {
  width: 64px; height: 5px; border-radius: 4px; overflow: hidden;
  background: #26262d;
}
.ctx-bar i {
  display: block; height: 100%; width: 0%;
  background: var(--green); border-radius: 4px;
  transition: width .4s ease, background .3s;
}
#ctx-label { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px;
  display: inline-grid; place-items: center;
  color: var(--muted); font-size: 14px;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.auto-btn {
  height: 28px; padding: 0 9px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: transparent;
  color: var(--muted); font-size: 11px;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.auto-btn:hover { background: var(--bg-hover); color: var(--text); }
.auto-btn .auto-dot { width: 6px; height: 6px; border-radius: 50%; background: #4a4a54; }
.auto-btn.on {
  border-color: rgba(217, 171, 98, .38);
  background: rgba(217, 171, 98, .1);
  color: #e6c184;
}
.auto-btn.on .auto-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 171, 98, .12); }
.stop-btn {
  height: 30px; padding: 0 11px; border-radius: 8px;
  border: 1px solid rgba(224, 108, 117, .35);
  background: var(--red-soft); color: #f0a0a6;
  font-size: 12px; display: inline-flex; align-items: center; gap: 6px;
}
.stop-btn:hover { background: rgba(224, 108, 117, .2); }
.stop-square { width: 8px; height: 8px; background: currentColor; border-radius: 2px; }

.more-btn { font-size: 17px; }
.menu {
  position: absolute; top: 52px; right: 14px;
  min-width: 160px; padding: 5px;
  background: #1b1b20; border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
  z-index: 40;
}
.menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--text-dim);
}
.menu button:hover { background: var(--bg-hover); color: var(--text); }
.menu button.danger:hover { background: var(--red-soft); color: #f0a0a6; }

/* ------------------------------ 消息 ------------------------------ */
.takeover {
  max-width: 860px; margin: 10px auto 0; padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid rgba(217, 171, 98, .35);
  background: rgba(217, 171, 98, .08);
  border-radius: 9px; color: #e6c184; font-size: 12px;
}
.takeover-text { flex: 1; min-width: 0; }
.takeover button {
  height: 28px; padding: 0 10px; border-radius: 7px;
  border: 1px solid rgba(217, 171, 98, .35);
  background: rgba(217, 171, 98, .16); color: #e6c184;
  font-size: 11.5px; white-space: nowrap;
}
.takeover button:hover { background: rgba(217, 171, 98, .24); }
.takeover button:disabled { opacity: .55; cursor: wait; }

.messages {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 26px 20px 18px;
}
.msg {
  max-width: 860px; margin: 0 auto 22px;
  animation: fadein .18s ease;
}

.skeleton { max-width: 860px; margin: 10px auto; }
.sk {
  background: linear-gradient(90deg, #19191e 25%, #232329 37%, #19191e 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}
.sk-line { height: 12px; margin: 14px 0; }
.sk-line.w40 { width: 40%; }
.sk-line.w55 { width: 55%; }
.sk-line.w70 { width: 70%; }
.sk-bubble { height: 58px; width: 55%; margin: 20px 0; border-radius: 15px 15px 5px 15px; margin-left: auto; }
.sk-bubble.small { width: 34%; height: 42px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.load-earlier {
  display: block; margin: 2px auto 20px;
  padding: 5px 14px; border-radius: 20px;
  border: 1px solid var(--line-strong); background: var(--bg-soft);
  color: var(--muted); font-size: 11px;
}
.load-earlier:hover { background: var(--bg-hover); color: var(--text); }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.msg-time {
  font-size: 10px; color: var(--faint); margin: 0 5px 4px;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
  user-select: none;
}
.msg.assistant .msg-time { margin-left: 0; }
.msg.assistant .msg-time::before {
  content: ""; display: inline-block; width: 4px; height: 4px;
  border-radius: 50%; background: #3f3f48; margin-right: 6px; vertical-align: 1px;
}
.user-bubble {
  max-width: min(78%, 640px);
  background: var(--bg-user);
  border: 1px solid rgba(255, 255, 255, .055);
  border-radius: 16px 16px 5px 16px;
  padding: 10px 14px;
  font-size: 14.5px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
}
.user-bubble .u-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.user-bubble .u-images:first-child { margin-top: 0; }
.u-images img {
  max-width: 240px; max-height: 240px; border-radius: 9px;
  border: 1px solid var(--line); cursor: zoom-in; display: block;
}
.user-bubble .meta-note { color: var(--faint); font-size: 12px; font-style: italic; }

.assistant { color: var(--text); }
.assistant .a-block { margin-bottom: 10px; }
.assistant .a-block:last-child { margin-bottom: 0; }

.thinking {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .018);
  margin-bottom: 12px;
  overflow: hidden;
}
.thinking summary {
  list-style: none; cursor: pointer;
  padding: 8px 12px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
  user-select: none;
}
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary::before { content: "▸"; color: var(--faint); transition: transform .15s; }
.thinking[open] summary::before { transform: rotate(90deg); }
.thinking .thinking-body {
  padding: 2px 14px 12px; color: #9696a1; font-size: 13px;
  white-space: pre-wrap; word-break: break-word;
  border-top: 1px solid var(--line);
  margin-top: 2px; padding-top: 10px;
}

.md { font-size: 14.7px; line-height: 1.75; word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 11px; }
.md h1, .md h2, .md h3, .md h4 {
  margin: 20px 0 9px; line-height: 1.35; font-weight: 650;
}
.md h1 { font-size: 21px; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 16px; }
.md h4 { font-size: 14.5px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > p { margin: 0; }
.md blockquote {
  margin: 0 0 12px; padding: 2px 0 2px 13px;
  border-left: 3px solid #3a3a44; color: var(--text-dim);
}
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.md a { text-decoration: none; border-bottom: 1px solid rgba(121, 167, 224, .35); }
.md a:hover { border-bottom-color: var(--blue); }
.md code {
  font-family: var(--mono); font-size: .88em;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .04);
  padding: 1.5px 5px; border-radius: 5px;
}
.md table { border-collapse: collapse; width: 100%; margin: 0 0 14px; font-size: 13.5px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line-strong); padding: 6px 10px; text-align: left; }
.md th { background: rgba(255, 255, 255, .04); font-weight: 600; }

.codeblock {
  margin: 0 0 13px; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; background: #0b0b0d;
}
.codeblock-head {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px 0 12px;
  background: #131317; border-bottom: 1px solid var(--line);
  font-size: 11px; color: var(--faint); font-family: var(--mono);
}
.codeblock-head .lang { flex: 1; text-transform: lowercase; }
.copy-btn { font-size: 11px; color: var(--muted); padding: 3px 7px; border-radius: 5px; }
.copy-btn:hover { background: var(--bg-hover); color: var(--text); }
.codeblock pre {
  margin: 0; padding: 12px 14px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.6px; line-height: 1.62; color: #c9c9d2;
}

/* 工具卡片 */
.tool {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121216;
  overflow: hidden;
}
.tool-head {
  display: flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 6px 10px 6px 11px;
  cursor: pointer; user-select: none;
}
.tool-head:hover { background: rgba(255, 255, 255, .025); }
.tool-ico {
  width: 20px; height: 20px; border-radius: 5px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: #22222a; color: var(--muted); font-size: 10px; font-family: var(--mono);
}
.tool-name { font-size: 12.5px; font-weight: 600; color: var(--text-dim); flex: 0 0 auto; }
.tool-summary {
  font-family: var(--mono); font-size: 11.5px; color: var(--faint);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tool-state { font-size: 11px; flex: 0 0 auto; }
.tool-state.ok { color: var(--green); }
.tool-state.err { color: var(--red); }
.tool-state.run { color: var(--amber); }
.tool-state.run::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 5px; border-radius: 50%; background: currentColor; animation: blink 1s infinite; vertical-align: 2px; }
@keyframes blink { 50% { opacity: .2; } }
.tool-chevron { color: var(--faint); font-size: 10px; transition: transform .15s; }
.tool.open .tool-chevron { transform: rotate(90deg); }
.tool-body { display: none; border-top: 1px solid var(--line); }
.tool.open .tool-body { display: block; }
.tool-section { padding: 10px 12px; }
.tool-section + .tool-section { border-top: 1px dashed var(--line); }
.tool-label { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.tool pre {
  margin: 0; padding: 10px 12px; background: #0b0b0d;
  font-family: var(--mono); font-size: 12.2px; line-height: 1.6;
  color: #c4c4cd; white-space: pre-wrap; word-break: break-word;
  max-height: 380px; overflow: auto; border-radius: 7px;
}
.tool .diff { font-family: var(--mono); font-size: 12.2px; line-height: 1.6; border-radius: 7px; overflow: auto; max-height: 420px; background: #0b0b0d; }
.diff .d-line { padding: 0 11px; white-space: pre-wrap; word-break: break-word; }
.diff .d-del { background: rgba(224, 108, 117, .12); color: #e7a1a7; }
.diff .d-add { background: rgba(124, 192, 145, .11); color: #a8d8b6; }
.diff .d-ctx { color: #77777f; }

.turn-result {
  max-width: 860px; margin: -8px auto 20px;
  font-size: 11px; color: var(--faint);
  display: flex; gap: 10px; justify-content: flex-end;
  font-variant-numeric: tabular-nums;
  animation: fadein .2s;
}
.banner {
  max-width: 860px; margin: 0 auto 16px;
  border: 1px solid rgba(224, 108, 117, .3);
  background: var(--red-soft); color: #f0b3b8;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
}
.divider {
  max-width: 860px; margin: 26px auto;
  display: flex; align-items: center; gap: 12px;
  color: var(--faint); font-size: 11px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.jump-bottom {
  position: absolute; left: 50%; bottom: 132px; transform: translateX(-50%);
  background: #24242b; border: 1px solid var(--line-strong);
  border-radius: 20px; padding: 6px 13px; font-size: 12px; color: var(--text-dim);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45); z-index: 15;
}
.jump-bottom:hover { background: #2c2c34; }

/* ------------------------------ 输入区 ------------------------------ */
.composer-wrap {
  flex: 0 0 auto; padding: 10px 20px 14px;
  background: linear-gradient(180deg, rgba(13, 13, 15, 0), var(--bg) 26%);
}
.attachments {
  max-width: 860px; margin: 0 auto 8px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.att {
  position: relative; width: 62px; height: 62px; border-radius: 9px;
  overflow: hidden; border: 1px solid var(--line-strong); background: #1a1a1f;
}
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att .x {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0, 0, 0, .72); color: #fff; font-size: 11px;
  display: grid; place-items: center;
}
.att.uploading::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(0, 0, 0, .5);
}
.composer {
  max-width: 860px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px;
  background: #17171c;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 8px 8px 8px 10px;
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: #3b3b45; box-shadow: 0 0 0 3px rgba(255, 255, 255, .025); }
.composer textarea {
  flex: 1; min-height: 26px; max-height: 220px;
  background: transparent; border: 0; outline: none; resize: none;
  padding: 4px 2px; font-size: 14.5px; line-height: 1.55;
}
.composer textarea::placeholder { color: #5d5d66; }
.attach-btn { font-size: 19px; color: var(--muted); flex: 0 0 auto; margin-bottom: 1px; }
.attach-btn:hover { color: var(--text); }
.send-btn {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  background: var(--accent); color: #1a0e0a; font-weight: 800; font-size: 16px;
  display: grid; place-items: center;
  transition: opacity .15s, transform .05s;
}
.send-btn:hover { filter: brightness(1.07); }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { opacity: .35; cursor: not-allowed; }
.composer-hint {
  max-width: 860px; margin: 7px auto 0;
  text-align: center; font-size: 10.5px; color: #55555e;
}
.hint-sep { margin: 0 6px; color: #3d3d45; }
#composer-state.warn { color: var(--amber); }

/* ------------------------------ 弹窗 ------------------------------ */
.modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-root > * { pointer-events: auto; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fadein .15s;
}
.modal {
  width: min(520px, 100%);
  background: #1a1a1f;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65);
  overflow: hidden;
  animation: modal-in .18s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { padding: 16px 18px 0; }
.modal-head h2 { margin: 0 0 4px; font-size: 16px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.modal-body { padding: 14px 18px 4px; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 18px 18px;
}
.modal-foot .btn {
  height: 34px; padding: 0 14px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--line-strong); color: var(--text-dim);
}
.modal-foot .btn:hover { background: var(--bg-hover); }
.modal-foot .btn.primary { background: var(--accent); border-color: transparent; color: #1a0e0a; font-weight: 650; }
.modal-foot .btn.primary:hover { filter: brightness(1.06); }
.modal-foot .btn.danger { background: var(--red-soft); border-color: rgba(224, 108, 117, .35); color: #f0a0a6; }
.modal-foot .btn.danger:hover { background: rgba(224, 108, 117, .22); }
.modal-foot .btn.warn { background: rgba(217, 171, 98, .1); border-color: rgba(217, 171, 98, .35); color: #e6c184; }
.modal-foot .btn.warn:hover { background: rgba(217, 171, 98, .18); }
.modal-foot .btn:disabled { opacity: .55; cursor: wait; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.field input[type=text], .field input[type=password] {
  width: 100%; height: 38px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: #111114;
  padding: 0 11px; outline: none; font-size: 13.5px;
}
.field input:focus { border-color: #41414c; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: -2px; }
.check input { accent-color: var(--accent); }
.modal-note { font-size: 11.5px; color: var(--faint); margin-top: 6px; }

.perm-tool {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border: 1px solid var(--line);
  background: #121216; border-radius: 9px; margin-bottom: 10px;
}
.perm-tool .tool-name { font-size: 13px; }
.perm-tool .perm-kind { margin-left: auto; font-size: 11px; color: var(--amber); }
.perm-detail {
  max-height: 320px; overflow: auto;
  background: #0b0b0d; border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px;
  font-family: var(--mono); font-size: 12.2px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; color: #c7c7d0;
}
.perm-hint { font-size: 11.5px; color: var(--faint); margin-top: 9px; }
.perm-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* 图片放大 */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .88);
  display: grid; place-items: center; padding: 4vw; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 30px 90px #000; }

.drop-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(217, 119, 87, .08);
  border: 2px dashed var(--accent);
  display: grid; place-items: center;
  font-size: 16px; color: #f0b7a4;
  backdrop-filter: blur(3px);
  pointer-events: none;
}

.scrim { display: none; }

/* ------------------------------ 登录页 ------------------------------ */
.auth-body {
  min-height: 100%;
  background: #09090b;
  overflow-x: hidden;
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(440px, .88fr);
}
.auth-visual {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: 42px 54px 34px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(1000px 620px at 18% 8%, rgba(217, 119, 87, .13), transparent 62%),
    #0b0b0d;
}
.visual-aurora {
  position: absolute; border-radius: 50%; filter: blur(95px); pointer-events: none;
}
.visual-aurora-a { width: 540px; height: 540px; right: -190px; bottom: -190px; background: rgba(217, 119, 87, .2); }
.visual-aurora-b { width: 440px; height: 440px; left: -180px; top: -160px; background: rgba(90, 84, 160, .15); }
.visual-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .033) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .033) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse at 34% 32%, #000 0%, transparent 72%);
  mask-image: radial-gradient(ellipse at 34% 32%, #000 0%, transparent 72%);
}
.auth-brand {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #e58a68, #b95f45);
  box-shadow: 0 8px 24px rgba(217, 119, 87, .28);
  flex: 0 0 auto;
}
.brand-logo svg { width: 19px; height: 19px; }
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.brand-tag {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 20px; padding: 2px 8px; margin-left: 2px;
}
.visual-copy {
  position: relative; z-index: 2;
  margin-top: clamp(40px, 9vh, 110px);
  max-width: 600px;
}
.eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  color: #a8897b; margin: 0 0 20px;
}
.visual-copy h1 {
  font-family: ui-serif, Georgia, "Times New Roman", "Songti SC",
               "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  font-size: clamp(34px, 3.5vw, 53px);
  line-height: 1.14; font-weight: 500; letter-spacing: -.02em;
  margin: 0 0 22px;
}
.visual-copy h1 em { font-style: normal; color: var(--accent); }
.lede { color: var(--muted); font-size: 14.5px; line-height: 1.75; margin: 0; max-width: 46ch; }

.demo-window {
  position: relative; z-index: 2;
  margin-top: 44px; max-width: 560px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: rgba(19, 19, 23, .82);
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  overflow: hidden;
}
.demo-bar {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .018);
}
.traffic { width: 8px; height: 8px; border-radius: 50%; }
.traffic.red { background: #e06c75; }
.traffic.amber { background: #d9ab62; }
.traffic.green { background: #7cc091; }
.demo-path { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-left: 8px; flex: 1; }
.demo-live { font-family: var(--mono); font-size: 9.5px; color: var(--green); display: flex; align-items: center; gap: 4px; }
.demo-live i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); animation: pulse 1.8s infinite; }
.demo-chat { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.demo-user { display: flex; align-items: flex-end; gap: 10px; justify-content: flex-end; }
.demo-shot {
  width: 46px; height: 46px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(135deg, #d97757, #8c4a6b 55%, #3d3a63);
  position: relative; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .14);
}
.demo-shot::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .25) 1px, transparent 1px);
  background-size: 11px 11px; opacity: .32;
}
.demo-user p {
  margin: 0; background: var(--bg-user);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px 14px 4px 14px;
  padding: 8px 12px; font-size: 12.5px; color: var(--text-dim);
}
.demo-reply { display: flex; gap: 9px; align-items: flex-start; }
.demo-spark {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto;
  display: grid; place-items: center; margin-top: 1px;
  background: linear-gradient(145deg, #e58a68, #b95f45);
  color: #fff; font-size: 11px;
}
.demo-reply p { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--text-dim); }
.caret {
  display: inline-block; width: 2px; height: 13px; background: var(--accent);
  margin-left: 2px; vertical-align: -2px; animation: blink 1.05s steps(2) infinite;
}
.demo-tool {
  display: flex; align-items: center; gap: 8px;
  margin-left: 31px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #101013;
}
.demo-tool-ico {
  font-family: var(--mono); font-size: 9px; color: var(--muted);
  background: #22222a; border-radius: 4px; padding: 1px 4px;
}
.demo-tool code { font-family: var(--mono); font-size: 11px; color: var(--faint); flex: 1; }
.demo-tool-state { font-size: 10px; color: var(--green); }
.visual-foot {
  position: relative; z-index: 2;
  margin-top: auto; padding-top: 34px;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 11px; color: var(--faint);
}
.foot-status { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.foot-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(124, 192, 145, .12); }
.foot-sep { width: 1px; height: 12px; background: var(--line-strong); }
.visual-foot > span:not(.foot-status):not(.foot-sep) {
  border: 1px solid var(--line); border-radius: 20px; padding: 2.5px 8px;
}

.auth-panel {
  position: relative;
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 40px;
  background: #0a0a0c;
}
.auth-card { width: min(392px, 100%); }
.auth-mobile-brand { display: none; align-items: center; gap: 9px; margin-bottom: 30px; font-size: 14px; font-weight: 650; }
.auth-heading { margin-bottom: 28px; }
.auth-kicker { font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em; color: var(--faint); margin: 0 0 12px; }
.auth-heading h2 { font-size: 26px; font-weight: 650; letter-spacing: -.03em; margin: 0 0 7px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0; }
.auth-field { display: block; margin-bottom: 15px; }
.auth-field > span:first-child {
  display: block; font-size: 11.5px; color: var(--muted);
  margin-bottom: 7px; letter-spacing: .02em;
}
.auth-field input {
  width: 100%; height: 46px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: #101013;
  padding: 0 14px; outline: none; font-size: 14px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.auth-field input::placeholder { color: #4e4e57; }
.auth-field input:focus {
  border-color: rgba(217, 119, 87, .55);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, .1);
  background: #0d0d10;
}
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 54px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 30px; padding: 0 9px; border-radius: 7px;
  font-size: 11px; color: var(--muted);
}
.pw-toggle:hover { background: var(--bg-hover); color: var(--text); }
.caps-hint { display: block; font-size: 10.5px; color: var(--amber); margin-top: 6px; }
.auth-error {
  margin: 2px 0 14px; padding: 9px 12px; border-radius: 9px;
  background: var(--red-soft); border: 1px solid rgba(224, 108, 117, .28);
  color: #f0aab0; font-size: 12.5px;
}
.auth-error.shake { animation: shake .28s; }
@keyframes shake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}
.auth-submit {
  position: relative; width: 100%; height: 46px; margin-top: 6px;
  border-radius: 11px;
  background: linear-gradient(180deg, #e18765, #cf6f50);
  color: #1a0e0a; font-weight: 700; font-size: 13.5px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 26px rgba(217, 119, 87, .18);
  transition: transform .05s, filter .15s, box-shadow .15s;
}
.auth-submit:hover { filter: brightness(1.06); box-shadow: 0 12px 30px rgba(217, 119, 87, .26); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { opacity: .75; cursor: wait; }
.submit-arrow { position: absolute; right: 16px; font-size: 15px; opacity: .75; transition: transform .15s; }
.auth-submit:hover .submit-arrow { transform: translateX(2px); }
.submit-spinner {
  display: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(26, 14, 10, .25); border-top-color: #1a0e0a;
  animation: spin .7s linear infinite;
}
.auth-submit.loading .submit-spinner { display: block; }
.auth-submit.loading .submit-arrow { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--faint);
}
.meta-line { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.meta-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(124, 192, 145, .1); }
.meta-sep { width: 1px; height: 10px; background: var(--line-strong); }
.auth-foot {
  position: absolute; bottom: 24px;
  font-family: var(--mono); font-size: 10px; color: #3f3f47;
}
.auth-foot span { color: #5a5a63; }

@media (max-width: 1040px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 24px; }
  .auth-mobile-brand { display: flex; }
  .auth-card {
    background: rgba(23, 23, 27, .6);
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  }
  .auth-foot { position: static; margin-top: 26px; }
}
@media (max-width: 420px) {
  .auth-card { padding: 24px 18px; }
  .auth-heading h2 { font-size: 23px; }
}

/* ------------------------------ 移动端 ------------------------------ */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .5);
  }
  .sidebar.open { transform: none; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(0, 0, 0, .5);
  }
  .menu-btn { display: inline-grid !important; }
  .messages { padding: 18px 13px 12px; }
  .composer-wrap { padding: 8px 12px 12px; }
  .chat-head { padding: 0 10px 0 6px; gap: 6px; }
  .ctx { display: none; }
  .auto-btn .auto-label { display: none; }
  .auto-btn { padding: 0 8px; }
  .user-bubble { max-width: 86%; }
  .empty h1 { font-size: 21px; }
  .msg { margin-bottom: 18px; }
  .jump-bottom { bottom: 120px; }
  .modal-overlay { align-items: end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; width: 100%; max-height: 88vh; overflow: auto; }
}
