:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-side: #f3f4f7;
  --bg-hover: #e9ebf0;
  --bg-user: #eef1fb;
  --text: #1b1f26;
  --text-soft: #5c6472;
  --text-faint: #8a919e;
  --line: #e5e7ec;
  --accent: #4d6bfe;
  --accent-soft: #e8ecff;
  --danger: #e5484d;
  --code-bg: #f4f5f8;
  --shadow: 0 12px 40px rgba(17, 24, 39, 0.12);
  --radius: 14px;
  --sidebar-w: 268px;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #14161a;
  --bg-soft: #1a1d23;
  --bg-side: #101215;
  --bg-hover: #23272f;
  --bg-user: #202636;
  --text: #e9ecf1;
  --text-soft: #a5adba;
  --text-faint: #767e8c;
  --line: #262b33;
  --accent: #6d86ff;
  --accent-soft: #232b45;
  --danger: #ff6369;
  --code-bg: #1d2128;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100%;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px 12px;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  min-height: 0;
  z-index: 30;
}

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

.logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #4d6bfe, #2f4fd8);
  color: #fff;
}
.logo svg { width: 22px; height: 22px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: 0.2px; }
.brand-text span { font-size: 11.5px; color: var(--text-faint); }

.new-chat {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.new-chat:hover { background: var(--bg-hover); }
.new-chat:active { transform: scale(0.985); }
.new-chat svg { width: 16px; height: 16px; }

.history-label {
  margin: 14px 8px 4px;
  font-size: 11.5px;
  letter-spacing: 0.4px;
  color: var(--text-faint);
}

.history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
}
.history::-webkit-scrollbar { width: 8px; }
.history::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
}
.history-item span { overflow: hidden; text-overflow: ellipsis; }
.history-item:hover { background: var(--bg-hover); }
.history-item.active { background: var(--bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.history-item .del {
  margin-left: auto;
  opacity: 0;
  border: 0; background: transparent; color: var(--text-faint);
  padding: 2px 4px; border-radius: 6px; font-size: 13px; line-height: 1;
}
.history-item:hover .del { opacity: 1; }
.history-item .del:hover { color: var(--danger); background: var(--bg-hover); }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ghost-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  text-align: left;
}
.ghost-btn:hover { background: var(--bg-hover); color: var(--text); }
.ghost-btn svg { width: 17px; height: 17px; }

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

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.model-pick select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 9px;
  padding: 7px 30px 7px 11px;
  font-size: 13px;
  color: var(--text);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.model-pick select:focus { outline: 2px solid var(--accent-soft); }

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

.toggle-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  transition: all 0.15s;
}
.toggle-chip:hover { background: var(--bg-hover); }
.toggle-chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 3px transparent;
  transition: all 0.15s;
}
.toggle-chip.on {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
}
.toggle-chip.on .dot { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.toggle-chip .ic { width: 15px; height: 15px; }

.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.recording { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 12%, transparent); } }

.only-mobile { display: none; }

/* ------------------------------- 消息 ------------------------------- */

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 22px 16px 10px;
}
.messages::-webkit-scrollbar { width: 10px; }
.messages::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid var(--bg); }

.msg {
  max-width: 820px;
  margin: 0 auto 22px;
  display: flex;
  gap: 12px;
  animation: rise 0.22s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.msg .avatar {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  margin-top: 2px;
}
.msg.user .avatar { background: var(--bg-hover); color: var(--text-soft); }
.msg.assistant .avatar { background: linear-gradient(145deg, #4d6bfe, #2f4fd8); color: #fff; }
.msg.assistant .avatar svg { width: 17px; height: 17px; }

.msg .body { min-width: 0; flex: 1; }

.msg.user { justify-content: flex-end; }
.msg.user .avatar { display: none; }
.msg.user .body {
  flex: 0 1 auto;
  max-width: 78%;
  background: var(--bg-user);
  border-radius: 14px;
  padding: 11px 15px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-size: 15px;
}

.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.md { font-size: 15px; line-height: 1.78; word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; line-height: 1.4; font-weight: 600; }
.md h1 { font-size: 21px; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 16px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > p { margin: 0; }
.md a { color: var(--accent); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md blockquote {
  margin: 0 0 10px;
  padding: 6px 14px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
}
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md code {
  font-family: 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 13px;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 5px;
}
.md pre {
  position: relative;
  margin: 0 0 12px;
  padding: 13px 14px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}
.md pre code { background: none; padding: 0; font-size: 12.8px; line-height: 1.6; }
.md table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 13.5px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.md th { background: var(--bg-soft); font-weight: 600; }

.code-copy {
  position: absolute;
  top: 7px; right: 7px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-faint);
  font-size: 11.5px;
  opacity: 0;
  transition: opacity 0.15s;
}
.md pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--text); }

.reasoning {
  margin-bottom: 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  overflow: hidden;
}
.reasoning summary {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-soft);
  user-select: none;
}
.reasoning pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 12px 10px;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-soft);
  max-height: 320px;
  overflow-y: auto;
}

.tool-line {
  display: block;
  margin: 10px 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-soft);
  font-family: 'Cascadia Code', Consolas, monospace;
  word-break: break-all;
}
.tool-head { display: flex; align-items: center; gap: 8px; }
.tool-line summary { list-style: none; cursor: pointer; }
.tool-line summary::-webkit-details-marker { display: none; }
.tool-line .tool-cmd { flex: 1; min-width: 0; }
.tool-line .out {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-soft);
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
}
.tool-line .tag {
  flex: none;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tool-line.denied .tag { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

.msg-actions { display: flex; gap: 4px; margin-top: 6px; opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-actions { opacity: 1; }
.msg-actions button {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-faint);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 11.5px;
}
.msg-actions button:hover { color: var(--text); background: var(--bg-hover); }

/* 空状态 */
.empty {
  max-width: 760px;
  margin: 8vh auto 0;
  text-align: center;
  padding: 0 8px;
}
.empty .big-logo {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #4d6bfe, #2f4fd8);
  color: #fff;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}
.empty .big-logo svg { width: 32px; height: 32px; }
.empty h1 { font-size: 24px; margin: 0 0 8px; font-weight: 600; }
.empty p { color: var(--text-soft); margin: 0 0 22px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 13px;
  color: var(--text-soft);
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ------------------------------- 输入框 ------------------------------- */

.composer-wrap { padding: 6px 16px 14px; }

.composer {
  max-width: 820px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 10px 10px 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 220px;
  min-height: 26px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  line-height: 1.65;
  padding: 4px 6px;
}
.composer textarea::placeholder { color: var(--text-faint); }

.composer-bar { display: flex; align-items: center; margin-top: 4px; }
.composer-left { display: flex; align-items: center; gap: 4px; }
.hint { font-size: 11.5px; color: var(--text-faint); }
.hint.live { color: var(--danger); }

.send-btn {
  margin-left: auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: var(--accent);
  color: #fff;
  transition: opacity 0.15s, transform 0.1s;
}
.send-btn:hover { opacity: 0.9; }
.send-btn:active { transform: scale(0.95); }
.send-btn svg { width: 18px; height: 18px; }
.send-btn .ic-stop { display: none; }
.send-btn.stop { background: var(--danger); }
.send-btn.stop .ic-send { display: none; }
.send-btn.stop .ic-stop { display: block; }

.disclaimer {
  max-width: 820px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
}

/* ---------------------------- 设备 / 电脑操控 ---------------------------- */

.select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
}
.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.devices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 8px;
  font-size: 12.5px;
  color: var(--text-soft);
}
.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  padding: 2px 4px;
  border-radius: 6px;
}
.link-btn:hover { background: var(--accent-soft); }

.device-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.device {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.device:last-child { border-bottom: 0; }
.device .st {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}
.device .st.online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16); }
.device .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device .rm {
  border: 0; background: transparent; color: var(--text-faint);
  font-size: 12px; padding: 2px 6px; border-radius: 6px;
}
.device .rm:hover { color: var(--danger); background: var(--bg-hover); }
.device .you {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 7px;
}

.pair-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 12px;
  background: var(--accent-soft);
}
[data-theme='dark'] .pair-box { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pair-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.pair-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.pair-row span { width: 70px; flex: none; }
.pair-code {
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--text);
}
.pair-row code {
  font-size: 12px;
  background: var(--bg);
  padding: 3px 7px;
  border-radius: 6px;
  word-break: break-all;
}
.pair-steps { margin: 10px 0; padding-left: 18px; font-size: 12.5px; color: var(--text-soft); line-height: 1.8; }
.download-btn { display: block; text-align: center; margin-top: 10px; text-decoration: none; }
.pair-note { font-size: 11.5px; color: var(--text-faint); margin: 10px 0 0; line-height: 1.6; }

.mini-select {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text-soft);
  outline: none;
}
.provider-list { display: flex; flex-direction: column; gap: 10px; }
.provider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}
.provider-row .pv-top { display: flex; gap: 6px; align-items: center; }
.provider-row input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 12.5px;
  outline: none;
}
.provider-row input:focus { border-color: var(--accent); }
.provider-row .rm {
  border: 0; background: transparent; color: var(--text-faint);
  font-size: 13px; padding: 4px 6px; border-radius: 6px; flex: none;
}
.provider-row .rm:hover { color: var(--danger); background: var(--bg-hover); }

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

.modal {
  position: fixed; inset: 0;
  background: rgba(12, 15, 22, 0.45);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 18px;
  z-index: 100;
  animation: fade 0.15s ease;
}
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.modal-card {
  width: min(560px, 100%);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center;
  padding: 16px 18px 10px;
}
.modal-head h2 { font-size: 16px; margin: 0; font-weight: 600; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 6px 18px 14px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-soft); margin-bottom: 6px; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 13.5px;
  outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field small { display: block; margin-top: 5px; font-size: 11.5px; color: var(--text-faint); }

.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--text-soft); margin: 6px 0 14px; }
.check input { margin-top: 2px; accent-color: var(--accent); }

.btn {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 13.5px;
}
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { opacity: 0.92; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { opacity: 0.92; }
.btn.ghost { background: transparent; }

.tool-desc { font-size: 13.5px; color: var(--text-soft); margin: 0 0 10px; line-height: 1.6; }
.tool-code {
  max-height: 300px;
  overflow: auto;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0 0 10px;
}
.tool-warn { font-size: 12px; color: var(--danger); margin: 0; }

.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  background: #1f2329;
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
[data-theme='dark'] .toast { background: #2b313a; }
.toast[hidden] { display: none; }

/* ------------------------------- 响应式 ------------------------------- */

@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: 276px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .only-mobile { display: grid; }
  .messages { padding: 16px 10px 8px; }
  .msg { gap: 8px; }
  .msg .avatar { width: 26px; height: 26px; }
  .md { font-size: 14.5px; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .toggle-chip span:not(.dot) { display: none; }
  .composer-wrap { padding: 4px 10px 10px; }
}
