/* ChemChat 浅色工作台风格：覆盖 chat.css 的深色主题（参考 WorkBuddy 的布局：浅灰侧栏、居中问候、胶囊场景、大圆角输入卡）。 */

.chat-page {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --line: #ebebe8;
  --line-strong: #dcdcd7;
  --text: #1c1c1a;
  --muted: #6d6d68;
  --dim: #9c9c96;
  --cyan: #e0551c;
  --teal: #1fa35c;
  --blue: #eb642a;
  --danger: #d93a3a;
  --soft: #f4f4f1;
}

body.chat-page {
  color: var(--text);
  background: #fff;
}

::-webkit-scrollbar-thumb {
  background: #d9d9d4;
}

::-webkit-scrollbar-thumb:hover {
  background: #bdbdb7;
}

/* ---------- 侧栏 ---------- */
.chat-sidebar {
  gap: 6px;
  padding: 16px 12px 14px;
  border-right: 1px solid var(--line);
  background: #f7f7f5;
  backdrop-filter: none;
}

.chat-brand {
  padding: 2px 8px 14px;
  border-bottom: 0;
}

.chat-brand img {
  width: 34px;
  height: 34px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.chat-brand strong {
  font-size: 1rem;
  letter-spacing: 0;
}

.chat-brand small {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dim);
}

.new-chat-btn {
  justify-content: flex-start;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: #ebebe7;
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 650;
  box-shadow: none;
}

.new-chat-btn:hover {
  transform: none;
  filter: none;
  background: #e3e3de;
}

.new-chat-btn i {
  font-size: 1rem;
}

.chat-history-label {
  padding: 14px 12px 4px;
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--dim);
}

.history-item {
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
}

.history-item:hover {
  background: #efefeb;
  color: var(--text);
}

.history-item.active {
  border: 0;
  background: #ebebe7;
  color: var(--text);
}

.history-delete:hover,
.history-delete.is-confirm {
  background: rgba(217, 58, 58, 0.1);
}

.chat-sidebar-footer {
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.chat-status {
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.chat-status[data-state="online"] .status-dot {
  box-shadow: none;
  animation: none;
}

.chat-status[data-state="offline"] {
  border: 0;
}

.status-model {
  color: var(--dim);
}

.chat-sidebar-footer a:hover {
  background: #efefeb;
}

/* ---------- 顶栏 ---------- */
.chat-topbar {
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
}

.chat-topbar h1 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.topbar-chip {
  border-color: var(--line);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
}

.topbar-chip.is-live {
  border-color: rgba(224, 85, 28, 0.35);
  color: var(--cyan);
}

.icon-btn {
  background: #fff;
}

.icon-btn:hover:not(:disabled) {
  background: var(--soft);
}

/* ---------- 欢迎态：居中问候 + 胶囊 ---------- */
.chat-welcome {
  gap: 22px;
  padding: 0 12px 4px;
}

.chat-welcome h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  font-weight: 750;
  letter-spacing: -0.015em;
  color: var(--text);
}

.chat-welcome h2 .accent {
  background: linear-gradient(135deg, #f89d2e, #eb642a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wb-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #f4f4f1;
  box-shadow: inset 0 0 0 1px var(--line);
}

.wb-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.wb-tab:hover {
  color: var(--text);
}

.wb-tab.is-on {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(20, 20, 20, 0.08);
}

.wb-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 760px;
}

.wb-pills[hidden] {
  display: none;
}

.prompt-chip {
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
}

.prompt-chip i {
  width: auto;
  height: auto;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
}

.prompt-chip span {
  font-size: 0.9rem;
  white-space: nowrap;
}

.prompt-chip:hover {
  transform: none;
  border-color: #f0b27a;
  background: #fff8f1;
}

.prompt-chip:hover i {
  color: var(--cyan);
}

/* 空对话：问候与输入卡作为一组垂直居中 */
.chat-page.chat-empty .chat-main {
  grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
}

.chat-page.chat-empty .chat-thread {
  align-self: end;
  min-height: 0;
  padding-bottom: 26px;
  overflow: visible;
}

.chat-page.chat-empty .chat-composer {
  align-self: start;
}

.chat-page.chat-empty .composer-box textarea {
  min-height: 84px;
}

/* ---------- 消息 ---------- */
.message-avatar {
  color: #fff;
}

.message-row.user .message-avatar {
  border-color: var(--line-strong);
  background: var(--soft);
  color: var(--muted);
}

.message-meta {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
}

.message-row.assistant .message-bubble {
  padding: 4px 2px;
  border: 0;
  background: transparent;
}

.message-row.user .message-bubble {
  border-top-right-radius: 16px;
  background: #f1f1ee;
  color: var(--text);
}

.message-bubble.is-error {
  border: 1px solid rgba(217, 58, 58, 0.35);
  background: #fff3f3;
  color: #a82a2a;
}

.message-actions button {
  font-family: var(--sans);
  letter-spacing: 0;
}

.message-actions button:hover {
  background: var(--soft);
}

.md h3,
.md h4,
.md h5,
.md h6,
.md strong {
  color: #111;
}

.md code {
  background: #f4f1ed;
  color: #b9441a;
}

.md pre {
  border-color: var(--line);
  background: #f7f7f5;
}

.md pre code {
  background: transparent;
  color: #2b2b28;
}

.md th {
  background: #f7f7f5;
  color: #111;
}

.md blockquote {
  border-left-color: #f0b27a;
}

.cursor,
.typing span {
  background: var(--cyan);
}

/* ---------- 输入卡 ---------- */
.chat-composer {
  padding: 8px 24px 16px;
}

.composer-box {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 14px 16px 12px 22px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #fff;
  backdrop-filter: none;
  box-shadow: 0 10px 36px rgba(20, 20, 20, 0.08), 0 1px 3px rgba(20, 20, 20, 0.04);
}

.composer-box:focus-within {
  border-color: #f0b27a;
  box-shadow: 0 10px 36px rgba(20, 20, 20, 0.09), 0 0 0 3px rgba(248, 157, 46, 0.16);
}

.composer-box textarea {
  padding: 4px 0;
  color: var(--text);
}

.composer-box textarea::placeholder {
  color: #a9a9a3;
}

.composer-actions {
  justify-self: end;
}

.send-btn,
.stop-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.send-btn {
  background: linear-gradient(135deg, #f89d2e, #eb642a);
  color: #fff;
  box-shadow: none;
}

.send-btn:disabled {
  opacity: 1;
  background: #dcdcd7;
  color: #fff;
}

.stop-btn {
  border-color: rgba(217, 58, 58, 0.35);
  background: #fff1f1;
  color: var(--danger);
}

.composer-hint {
  max-width: 860px;
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0;
  color: var(--dim);
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .chat-sidebar {
    box-shadow: 16px 0 40px rgba(20, 20, 20, 0.12);
  }

  .sidebar-backdrop {
    background: rgba(20, 20, 20, 0.35);
  }

  .chat-welcome {
    gap: 16px;
  }

  .chat-welcome h2 {
    font-size: 1.5rem;
  }

  .wb-tab {
    padding: 7px 11px;
    font-size: 0.82rem;
  }

  .wb-tab i {
    display: none;
  }

  .prompt-chip span {
    white-space: normal;
  }

  .chat-composer {
    padding: 8px 12px 12px;
  }

  .composer-box {
    padding: 12px 12px 10px 16px;
    border-radius: 22px;
  }

  .chat-page.chat-empty .composer-box textarea {
    min-height: 64px;
  }
}
