:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --sidebar: #101828;
  --sidebar-2: #162033;
  --sidebar-hover: #1d2940;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-soft: #eef0f4;
  --brand: #4f6ef7;
  --brand-strong: #3b5bdb;
  --brand-soft: #edf1ff;
  --danger: #e5484d;
  --danger-soft: #fff0f0;
  --ok: #12b76a;
  --shadow: 0 12px 40px rgba(16, 24, 40, 0.12);
  --radius: 14px;
}

* { box-sizing: border-box; }

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

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

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }

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

.auth-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 800px at 15% 10%, #24346b 0%, transparent 55%),
              radial-gradient(900px 700px at 90% 90%, #1e4c63 0%, transparent 50%),
              #0b1020;
  overflow: auto;
  padding: 24px;
  z-index: 50;
}

.auth-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  pointer-events: none;
}
.auth-glow-a { width: 360px; height: 360px; background: #5b7cfa; top: -80px; left: 8%; }
.auth-glow-b { width: 420px; height: 420px; background: #0ea5a5; bottom: -120px; right: 4%; }

.auth-card {
  position: relative;
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 22px;
  padding: 36px 34px 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.auth-logo, .welcome-mark, .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #6d8bff, #3b5bdb);
  box-shadow: 0 8px 20px rgba(79, 110, 247, 0.35);
}

.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 22px;
  margin-bottom: 18px;
}

.auth-card h1 { margin: 0; font-size: 26px; letter-spacing: -0.3px; }
.auth-sub { margin: 8px 0 24px; color: var(--muted); font-size: 13.5px; }

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f3f9;
  border-radius: 11px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 0;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  transition: 0.15s;
}
.auth-tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(16, 24, 40, 0.1); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #374151; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field textarea, .token-login input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  background: #fbfcfe;
  color: var(--text);
  font-weight: 400;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field textarea:focus, .token-login input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.13);
  background: #fff;
}
.field textarea { resize: vertical; line-height: 1.6; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  transition: 0.15s;
}
.btn:hover { border-color: #cfd4df; background: #fafbff; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; padding: 12px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: #f3c3c3; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 14px; color: #9aa1ae; font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.token-login { display: flex; gap: 8px; margin-top: 12px; }
.token-login input { flex: 1; font-size: 13px; }
.auth-foot { margin: 22px 0 0; text-align: center; font-size: 11.5px; color: #9aa1ae; }

/* ---------- 布局 ---------- */

.app { display: flex; height: 100%; overflow: hidden; }

.sidebar {
  width: 282px;
  flex: 0 0 282px;
  background: var(--sidebar);
  color: #d7deea;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  z-index: 30;
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 18px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; }
.logo-mark { width: 28px; height: 28px; border-radius: 9px; font-size: 14px; }

.new-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.055);
  color: #eef2f9;
  padding: 11px 14px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 14px;
  transition: 0.15s;
}
.new-chat:hover { background: rgba(255, 255, 255, 0.1); }
.plus { font-size: 17px; line-height: 1; color: #9db0ff; }

.sidebar-section-label {
  font-size: 11px;
  letter-spacing: 0.6px;
  color: #7f8ba1;
  padding: 20px 10px 8px;
  text-transform: uppercase;
}

.conversation-list { flex: 1; overflow-y: auto; padding: 2px 2px 8px; }
.conversation-list::-webkit-scrollbar, .drawer-body::-webkit-scrollbar, .chat-scroll::-webkit-scrollbar { width: 7px; }
.conversation-list::-webkit-scrollbar-thumb, .drawer-body::-webkit-scrollbar-thumb { background: #2a354b; border-radius: 99px; }
.chat-scroll::-webkit-scrollbar-thumb { background: #d7dbe4; border-radius: 99px; }

.conversation-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 9px;
  color: #b9c3d4;
  font-size: 13.5px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: 0.13s;
  position: relative;
}
.conversation-item:hover { background: var(--sidebar-hover); color: #fff; }
.conversation-item.active { background: #1f2d49; color: #fff; }
.conversation-title { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conversation-del {
  opacity: 0;
  border: 0;
  background: transparent;
  color: #8b97ac;
  font-size: 15px;
  padding: 2px 4px;
  border-radius: 5px;
  line-height: 1;
}
.conversation-item:hover .conversation-del { opacity: 1; }
.conversation-del:hover { color: #ff9d9d; background: rgba(255, 255, 255, 0.08); }
.conversation-empty { color: #6d788c; font-size: 12.5px; padding: 14px 10px; line-height: 1.7; }

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, 0.07); padding-top: 10px; }
.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  color: #b9c3d4;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  text-align: left;
}
.nav-btn:hover { background: var(--sidebar-hover); color: #fff; }
.nav-icon { width: 18px; text-align: center; color: #8ea3d8; font-size: 15px; }
.badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.09);
  color: #cfd8e8;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-avatar { background: linear-gradient(135deg, #5d7cff, #7a5af8); color: #fff; }
.user-meta { min-width: 0; flex: 1; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-handle { color: #7f8ba1; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: 0.15s;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.06); color: var(--text); }
.sidebar .icon-btn { color: #8b97ac; }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.sidebar-mask { display: none; }

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

.topbar {
  height: 70px;
  flex: 0 0 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  z-index: 10;
}
.topbar-title { min-width: 0; }
.topbar h2 { margin: 0; font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-status { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #c0c5cf; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.12); }
.dot.warn { background: #f59e0b; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.chip-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #374151;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 99px;
  font-weight: 600;
}
.chip-btn:hover { border-color: #c9d0dc; background: #fbfcff; }
.skill-hit {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 99px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- 聊天 ---------- */

.chat-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.message-list {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 30px 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.welcome {
  width: min(780px, 100%);
  margin: 0 auto;
  padding: 9vh 26px 20px;
  text-align: center;
}
.welcome-mark { width: 54px; height: 54px; border-radius: 17px; font-size: 24px; margin-bottom: 18px; }
.welcome h1 { margin: 0 0 10px; font-size: 25px; letter-spacing: -0.4px; }
.welcome p { margin: 0 auto; max-width: 430px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.suggestion {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 99px;
  padding: 9px 15px;
  color: #4b5563;
  font-size: 12.8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}
.suggestion:hover { border-color: #c7d0e8; color: var(--brand-strong); background: #fafbff; }

.message { display: flex; gap: 11px; align-items: flex-start; }
.message.user { flex-direction: row-reverse; }
.message .avatar { width: 30px; height: 30px; font-size: 11px; margin-top: 2px; }
.message.assistant .avatar { background: linear-gradient(135deg, #111c33, #334a7a); color: #fff; }
.message.user .avatar { background: linear-gradient(135deg, #5d7cff, #7a5af8); color: #fff; }

.msg-body { max-width: calc(100% - 46px); min-width: 0; }
.message.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.bubble {
  background: #fff;
  border: 1px solid var(--line-soft);
  padding: 13px 16px;
  border-radius: 4px 15px 15px 15px;
  font-size: 14.5px;
  line-height: 1.72;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.035);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.message.user .bubble {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 15px 4px 15px 15px;
  box-shadow: 0 6px 16px rgba(79, 110, 247, 0.2);
}
.bubble.markdown { white-space: normal; }
.bubble.streaming::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--brand);
  border-radius: 2px;
  animation: blink 0.9s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #9aa6ba; animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.msg-meta { font-size: 11px; color: #9aa1ae; margin: 6px 4px 0; display: flex; gap: 8px; align-items: center; }
.msg-skills { color: var(--brand-strong); background: var(--brand-soft); padding: 2px 7px; border-radius: 99px; }
.msg-error { color: var(--danger); }

.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h2, .bubble h3, .bubble h4 { margin: 16px 0 8px; line-height: 1.35; }
.bubble h2 { font-size: 18px; }
.bubble h3 { font-size: 16.5px; }
.bubble h4 { font-size: 15px; }
.bubble ul, .bubble ol { margin: 6px 0 10px; padding-left: 22px; }
.bubble li { margin: 3px 0; }
.bubble code {
  background: #f1f3f8;
  border: 1px solid #e6e9f0;
  padding: 1px 5px;
  border-radius: 5px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.88em;
}
.message.user .bubble code { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.12); }
.bubble pre {
  background: #0f172a;
  color: #e5e9f2;
  padding: 13px 15px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
  line-height: 1.6;
}
.bubble pre code { background: transparent; border: 0; padding: 0; color: inherit; font-size: 12.8px; }
.bubble a { color: var(--brand-strong); }
.message.user .bubble a { color: #fff; text-decoration: underline; }
.bubble blockquote { margin: 8px 0; padding: 2px 0 2px 12px; border-left: 3px solid #d4d9e4; color: #576071; }

.composer-wrap {
  flex: 0 0 auto;
  padding: 8px 26px 14px;
  background: linear-gradient(to top, var(--bg) 65%, rgba(245, 246, 250, 0));
}
.composer {
  width: min(860px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 10px 10px 16px;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.07);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: #b9c6f7; box-shadow: 0 8px 30px rgba(79, 110, 247, 0.12); }
.composer textarea {
  flex: 1;
  border: 0;
  outline: none;
  resize: none;
  line-height: 1.6;
  max-height: 180px;
  padding: 7px 0;
  background: transparent;
  font-size: 14.5px;
}
.send-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
  flex-shrink: 0;
}
.send-btn:hover { background: var(--brand-strong); }
.send-btn:disabled { background: #c3cbe0; cursor: not-allowed; }
.composer-hint {
  width: min(860px, 100%);
  margin: 8px auto 0;
  padding: 0 4px;
  color: #9aa1ae;
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.used-skills-hint { color: var(--brand-strong); }

/* ---------- 抽屉 ---------- */

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 30, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 40;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(560px, 100%);
  background: var(--panel);
  box-shadow: -18px 0 50px rgba(16, 24, 40, 0.12);
  transform: translateX(102%);
  transition: transform 0.24s ease;
  z-index: 41;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.drawer-head h3 { margin: 0; font-size: 17px; }
.drawer-head-actions { display: flex; align-items: center; gap: 6px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }

.panel-intro { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 0 0 16px; }
.empty-box {
  text-align: center;
  color: #8b93a3;
  font-size: 13px;
  padding: 40px 20px;
  border: 1px dashed #dfe3ec;
  border-radius: 12px;
  line-height: 1.8;
}

.inline-form {
  background: #f8f9fc;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inline-form select, .inline-form textarea, .inline-form input, .token-create input, .token-create select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 9px 11px;
  outline: none;
  font-size: 13px;
  width: 100%;
}
.inline-form textarea { resize: vertical; min-height: 64px; line-height: 1.6; }
.inline-form .row { display: flex; gap: 10px; align-items: center; }
.inline-form .row select { width: 140px; flex: 0 0 140px; }
.inline-form .row .btn { margin-left: auto; }
.form-actions { display: flex; gap: 8px; margin-top: 10px; }

.memory-card, .skill-card, .token-card {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px 15px;
  margin-bottom: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.025);
}
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: #f0f3fa;
  color: #57637a;
  font-weight: 600;
}
.tag.source { background: #f5f6f9; color: #939bad; font-weight: 400; }
.card-actions { margin-left: auto; display: flex; gap: 4px; }
.mini-btn {
  border: 0;
  background: transparent;
  color: #7d8697;
  font-size: 12px;
  padding: 4px 7px;
  border-radius: 6px;
}
.mini-btn:hover { background: #f3f4f8; color: var(--text); }
.mini-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.card-content { font-size: 13.5px; line-height: 1.65; color: #333b4a; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-sub { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 3px; }
.card-sub.mono { font-family: Consolas, monospace; font-size: 11.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip {
  font-size: 11px;
  background: #eef2fb;
  color: #4d628d;
  padding: 2px 8px;
  border-radius: 99px;
}
.skill-preview {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  color: #6b7280;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 66px;
  overflow: hidden;
  position: relative;
}

.switch { position: relative; width: 34px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  background: #cfd4df;
  border-radius: 99px;
  transition: 0.18s;
  cursor: pointer;
}
.switch span::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: 0.18s;
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(14px); }

.switch-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #374151; margin: 2px 0 6px; }
.switch-row small { color: var(--muted); }
.group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .3px;
  margin: 14px 0 8px;
}
.group-title:first-child { margin-top: 0; }
.switch-row input { width: 16px; height: 16px; accent-color: var(--brand); }

.token-new {
  background: #f0f5ff;
  border: 1px solid #d7e2ff;
  border-radius: 11px;
  padding: 13px 14px;
  margin-bottom: 16px;
}
.token-new-title { font-size: 12.5px; color: #41567d; font-weight: 600; margin-bottom: 8px; }
.token-value {
  display: flex;
  gap: 8px;
  align-items: center;
}
.token-value code {
  flex: 1;
  background: #fff;
  border: 1px solid #dce5fb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: nowrap;
  font-family: Consolas, monospace;
}
.token-create { display: flex; gap: 8px; margin-bottom: 16px; }
.token-create input { flex: 1; }
.token-create select { width: 120px; flex: 0 0 120px; }
.token-warning { font-size: 11.5px; color: #8a6d3b; background: #fff8e8; border: 1px solid #f6e3b8; border-radius: 8px; padding: 8px 10px; margin-bottom: 16px; line-height: 1.6; }

/* ---------- 模态 ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 30, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.modal {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(10, 16, 30, 0.3);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { margin: 0; font-size: 16.5px; }
.modal-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  background: #111827;
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
  z-index: 100;
  max-width: min(520px, calc(100% - 40px));
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b42318; }

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

@media (max-width: 860px) {
  .mobile-only { display: inline-flex !important; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 18px 0 50px rgba(16, 24, 40, 0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask.open { display: block; position: fixed; inset: 0; background: rgba(10, 16, 30, 0.4); z-index: 29; }
  .topbar { padding: 0 14px; height: 64px; flex-basis: 64px; }
  .topbar-actions .chip-btn { display: none; }
  .message-list { padding: 20px 14px; }
  .welcome { padding: 6vh 20px 10px; }
  .composer-wrap { padding: 6px 12px 10px; }
  .composer-hint { font-size: 10.5px; }
  .skill-hit { max-width: 120px; }
  .drawer { width: 100%; }
  .auth-card { padding: 28px 22px 22px; }
}
