/* ==========================================================================
   小站（AI 聊天）
   ========================================================================== */
.bot-page { max-width: 1080px; padding: 40px 0 60px; }
.bot-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: 620px;
}

.bot-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 14px;
}
.bot-side-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 520px;
}
.conv-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.16s ease;
}
.conv-item:hover { background: rgba(var(--ink-rgb), 0.04); }
.conv-item.active { background: rgba(180, 83, 9, 0.09); }
.conv-item-text { min-width: 0; flex: 1; }
.conv-item-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-item-text em { font-style: normal; font-size: 11px; color: var(--faint); }
.conv-del {
  border: none;
  background: none;
  color: var(--faint);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.conv-del:hover { color: #b42318; background: rgba(220, 38, 38, 0.08); }

.bot-main {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.bot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.bot-title { display: flex; align-items: center; gap: 10px; }
.bot-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad-warm);
  color: #2a1a05;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 14px;
}
.bot-title strong { display: block; font-size: 15px; }
.bot-title em { font-style: normal; font-size: 11.5px; color: var(--faint); }
.bot-save { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.bot-save input { accent-color: var(--amber); }

.bot-messages {
  flex: 1;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 520px;
  background: transparent;
}
.msg {
  display: flex;
  gap: 10px;
  max-width: 82%;
}
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.bot .bubble {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-bottom-left-radius: 5px;
}
.msg.user .bubble {
  background: rgba(180, 83, 9, 0.1);
  border: 1px solid rgba(180, 83, 9, 0.18);
  color: var(--text);
  border-bottom-right-radius: 5px;
}
.msg .who {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
}
.msg.bot .who { background: var(--grad-warm); color: #2a1a05; }
.msg.user .who { background: var(--surface-3); color: var(--text-dim); }

.bot-empty { text-align: center; margin: auto; padding: 20px; }
.bot-empty-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--grad-warm);
  color: #2a1a05;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 22px;
  margin: 0 auto 16px;
}
.bot-empty h2 { font-size: 20px; }
.bot-empty p { margin-top: 8px; color: var(--muted); font-size: 14px; }
.bot-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.bot-chips button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.bot-chips button:hover { border-color: rgba(180, 83, 9, 0.4); color: var(--amber); }

.bot-form {
  display: flex;
  gap: 10px;
  padding: 14px 16px 6px;
  border-top: 1px solid var(--line-soft);
  align-items: flex-end;
}
.bot-form textarea {
  flex: 1;
  min-height: 52px;
  max-height: 160px;
  resize: vertical;
  padding: 10px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.6;
}
.bot-form textarea:focus {
  outline: none;
  border-color: rgba(180, 83, 9, 0.5);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}
.bot-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px 14px;
  font-size: 11.5px;
  color: var(--faint);
  flex-wrap: wrap;
}

.typing { display: inline-flex; gap: 4px; align-items: center; height: 1.4em; }
.typing i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: botTyping 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes botTyping {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 820px) {
  .bot-page { padding: 24px 0 40px; }
  .bot-layout { grid-template-columns: 1fr; min-height: 0; }
  .bot-side { max-height: 220px; }
  .bot-side-list { max-height: 120px; }
  .bot-messages { max-height: 60vh; }
  .msg { max-width: 92%; }
}


/* 小站头像图片 */
img.bot-avatar, img.bot-empty-avatar {
  object-fit: contain;
  background: linear-gradient(160deg, #fff6e8, #ffe3bf);
  border-radius: 50%;
  padding: 0;
}
img.bot-empty-avatar { box-shadow: 0 8px 22px -12px rgba(180, 83, 9, 0.6); }
.msg .who img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; background: linear-gradient(160deg, #fff6e8, #ffe3bf); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.bot-avatar,
  :root:not([data-theme="light"]) img.bot-empty-avatar,
  :root:not([data-theme="light"]) .msg .who img {
    background: linear-gradient(160deg, #3a3126, #2b2419);
  }
}
