*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #fff;
  color: #0d0d0d;
  height: 100vh;
  overflow: hidden;
}

/* ── 布局 ── */
.layout {
  display: flex;
  height: 100vh;
}

/* ── 左侧栏 ── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: #f9f9f9;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.logo-icon {
  color: #c96442;
  font-size: 20px;
  line-height: 1;
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  color: #0d0d0d;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #0d0d0d;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}

.new-chat-btn:hover { background: #f0f0f0; }

.new-chat-btn .icon {
  font-size: 16px;
  color: #6b6b6b;
}

/* ── 历史列表 ── */
.sidebar-history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-history::-webkit-scrollbar { width: 4px; }
.sidebar-history::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 4px; }

.history-label {
  font-size: 12px;
  color: #6b6b6b;
  padding: 0 10px;
  margin-bottom: 2px;
}

.history-item {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: #0d0d0d;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.history-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-del {
  display: none;
  border: none;
  background: none;
  color: #aaa;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.history-del:hover { background: #e0e0e0; color: #333; }
.history-item:hover .history-del { display: block; }
.history-item:hover { background: #f0f0f0; }
.history-item.active { background: #ececec; }
.history-item.active .history-del { display: block; }

/* ── 底部用户区 ── */
.sidebar-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  margin-top: 8px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0d0d0d;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-name {
  font-size: 14px;
  color: #0d0d0d;
}

.settings-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  color: #6b6b6b;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
}

.settings-btn:hover { background: #f0f0f0; }

/* ── 用户菜单 ── */
.user-menu {
  position: absolute;
  bottom: 64px;
  left: 8px;
  width: 180px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  padding: 6px;
  z-index: 100;
}

.user-menu-item {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.user-menu-item:hover { background: #f5f5f5; }

.user-menu-divider {
  height: 1px;
  background: #e8e8e8;
  margin: 4px 0;
}

/* ── 侧边栏折叠 ── */
.sidebar {
  transition: width 0.2s ease, min-width 0.2s ease, padding 0.2s ease, opacity 0.2s ease;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
}

/* ── 顶部工具栏 ── */
.topbar {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  flex-shrink: 0;
}

.toggle-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: #6b6b6b;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.toggle-btn:hover {
  background: #f0f0f0;
  color: #0d0d0d;
}

/* ── 右侧主区 ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

/* ── 首页 ── */
.home {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.home-content {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.welcome {
  display: flex;
  align-items: center;
  gap: 12px;
}

.welcome-icon {
  color: #c96442;
  font-size: 28px;
  line-height: 1;
}

.welcome-title {
  font-size: 32px;
  font-weight: 500;
  color: #0d0d0d;
}

/* ── 输入框 ── */
.input-wrap {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.input-wrap:focus-within {
  border-color: #aaa;
}

.input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 15px;
  color: #0d0d0d;
  line-height: 1.6;
  background: transparent;
  max-height: 200px;
  overflow-y: auto;
}

.input::placeholder { color: #aaa; }

.input-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.attach-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 18px;
  color: #6b6b6b;
  padding: 2px 4px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s;
}

.attach-btn:hover { background: #f0f0f0; }

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #e0e0e0;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.send-btn:not(:disabled) {
  background: #0d0d0d;
  cursor: pointer;
}

.send-btn:not(:disabled):hover { background: #333; }
.send-btn:disabled { cursor: default; }

/* ── 场景芯片 ── */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  background: #fff;
  font-size: 14px;
  color: #0d0d0d;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.chip:hover { background: #f5f5f5; }

/* ── 对话页 ── */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 4px; }

.message {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.message.user {
  display: flex;
  justify-content: flex-end;
}

.message.user .bubble {
  background: #f4f4f4;
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 15px;
  line-height: 1.6;
  max-width: 80%;
}

.message.ai .content {
  font-size: 15px;
  line-height: 1.8;
  color: #0d0d0d;
}

/* ── 对话页输入框 ── */
.chat-input-wrap {
  padding: 16px 24px 24px;
  max-width: 728px;
  width: 100%;
  margin: 0 auto;
}

.chat-input-box {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.chat-input-box:focus-within { border-color: #aaa; }
