/* 佰胜AI问答 样式（DeepSeek 风格改造 2026-11-21：浅色侧栏+时间分组+居中欢迎区+胶囊输入框） */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: #fff; color: #1b1b1c;
}

/* ── 登录页（DeepSeek 式极简白） ── */
.signin-page { display: grid; place-items: center; background: #f9fbff; }
.signin-card {
  background: #fff; border: 1px solid #e6e8eb; border-radius: 18px; padding: 44px 40px; width: 380px;
  box-shadow: 0 4px 24px rgba(29, 41, 82, .06);
}
.signin-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; }
.signin-brand .brand-mark { width: 34px; height: 34px; font-size: 18px; }
.signin-card h1 { margin: 0; font-size: 20px; text-align: center; }
.signin-card .subtitle { margin: 6px 0 26px; color: #8a8f99; font-size: 13px; text-align: center; }
.signin-card label { display: block; font-size: 13px; margin: 14px 0 6px; color: #4e5561; }
.signin-card input {
  width: 100%; padding: 11px 14px; border: 1px solid #d6dbe3; border-radius: 12px; font-size: 14px; outline: none;
}
.signin-card input:focus { border-color: #4d6bfe; box-shadow: 0 0 0 3px rgba(77, 107, 254, .12); }
.signin-card button {
  margin-top: 24px; width: 100%; padding: 12px; border: 0; border-radius: 999px;
  background: #4d6bfe; color: #fff; font-size: 15px; cursor: pointer;
}
.signin-card button:hover { background: #3d5bf0; }
.signin-card button:disabled { background: #a9baff; cursor: wait; }
.error { color: #dc2626; font-size: 13px; margin-top: 12px; }

/* ── 聊天页布局 ── */
.chat-page { overflow: hidden; }
.app { display: flex; height: 100vh; }

/* 侧栏（浅色） */
.sidebar {
  width: 272px; background: #f9fbff; border-right: 1px solid #eef1f6; color: #1b1b1c;
  display: flex; flex-direction: column; transition: margin-left .2s;
}
.sidebar.closed { margin-left: -272px; }
.sidebar-head { padding: 16px 16px 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
/* 公司 logo（img/logo.png 瓢虫标）：侧栏/欢迎区/登录页三处 + 两页 favicon */
.brand-mark, .hero-mark, .signin-brand .brand-mark {
  display: inline-block; width: 28px; height: 28px; object-fit: contain; flex: none;
}
.hero-mark { width: 44px; height: 44px; }
.signin-brand .brand-mark { width: 34px; height: 34px; }
.new-chat {
  margin: 4px 14px 14px; padding: 10px 12px; width: calc(100% - 28px);
  background: #fff; border: 1px solid #e2e6ee; border-radius: 14px; color: #1b1b1c;
  font-size: 14px; cursor: pointer; text-align: left;
  box-shadow: 0 1px 4px rgba(29, 41, 82, .05);
}
.new-chat:hover { border-color: #b9c8ff; color: #4d6bfe; }
.session-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.session-group { margin: 12px 8px 6px; font-size: 12px; color: #8a8f99; }
.session-item {
  display: block; width: 100%; text-align: left; margin: 1px 0; padding: 9px 12px;
  background: transparent; color: #1b1b1c; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-item:hover { background: #e9efff; }
.session-item.active { background: #dce6ff; color: #2b3fd0; font-weight: 600; }
.sidebar-foot {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-top: 1px solid #eef1f6; font-size: 13px; color: #4e5561;
}
.avatar, .me-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: #4d6bfe; color: #fff;
  font-size: 13px; font-weight: 700; flex: none;
}
.me { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 主区 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; }
.main-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid #f0f2f5; font-weight: 600; font-size: 14px;
}
.badge {
  margin-left: auto; font-size: 11px; font-weight: 400; color: #4d6bfe;
  background: #eef2ff; border-radius: 999px; padding: 3px 10px;
}

/* 滚动区：空会话时 hero 垂直居中 */
.chat-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.chat-scroll.empty { justify-content: center; }
#empty-hero { display: none; flex-direction: column; align-items: center; padding: 24px 20px 8px; }
body.empty #empty-hero { display: flex; }
body.empty .messages { display: none; }
.hero-mark { width: 44px; height: 44px; border-radius: 14px; font-size: 22px; margin-bottom: 14px; }
.hero-title { margin: 0 0 18px; font-size: 24px; font-weight: 700; }

.messages {
  width: 100%; max-width: 800px; margin: 0 auto; padding: 24px 20px 12px;
  display: flex; flex-direction: column; gap: 16px;
}
.msg { line-height: 1.65; font-size: 14.5px; max-width: 100%; }
.msg.user {
  align-self: flex-end; background: #e8f1ff; color: #1b1b1c; white-space: pre-wrap;
  padding: 10px 14px; border-radius: 14px; max-width: 78%;
}
.msg.assistant { align-self: stretch; padding: 2px 4px; }
.msg .status { color: #8a8f99; font-size: 12px; margin-bottom: 6px; min-height: 14px; }
.msg.msg-error { color: #b91c1c; background: #fef2f2; border-radius: 12px; padding: 10px 14px; }
.msg .md :first-child { margin-top: 0; }
.msg .md :last-child { margin-bottom: 0; }
.msg .md table { border-collapse: collapse; }
.msg .md th, .msg .md td { border: 1px solid #e6e8eb; padding: 4px 8px; font-size: 13px; }

.table-card, .chart-card {
  align-self: stretch; background: #fff; border: 1px solid #e6e8eb; border-radius: 14px; padding: 16px;
}
.table-card h3, .chart-card h3 { margin: 0 0 10px; font-size: 14px; }
.table-scroll { max-height: 320px; overflow: auto; }
.table-card table { border-collapse: collapse; width: 100%; font-size: 13px; }
.table-card th, .table-card td { border: 1px solid #eef1f6; padding: 5px 10px; text-align: left; white-space: nowrap; }
.table-card th { background: #f9fbff; position: sticky; top: 0; }
.chart-actions { margin-top: 10px; display: flex; gap: 8px; }
.chart-canvas { position: relative; height: 300px; }
.chart-source { margin-top: 10px; font-size: 11px; color: #8a8f99; }

.empty-hints { display: none; flex-direction: row; flex-wrap: wrap; gap: 10px; justify-content: center; }
.empty-hints p { display: none; }
.hint {
  border: 1px solid #e2e6ee; background: #fff; color: #4e5561; border-radius: 999px;
  padding: 7px 16px; font-size: 13px; cursor: pointer;
}
.hint:hover { border-color: #4d6bfe; color: #4d6bfe; }

/* 输入区（胶囊大圆角框 + 圆形发送键） */
.composer { padding: 10px 20px 18px; background: #fff; }
.composer-box {
  width: 100%; max-width: 800px; margin: 0 auto; border: 1px solid #d6dbe3; border-radius: 18px;
  padding: 12px 14px 8px; background: #fff; box-shadow: 0 2px 10px rgba(29, 41, 82, .05);
}
.composer-box:focus-within { border-color: #4d6bfe; box-shadow: 0 0 0 3px rgba(77, 107, 254, .1); }
#input {
  width: 100%; resize: none; border: 0; outline: none; padding: 2px 4px 8px;
  font-size: 14.5px; font-family: inherit; max-height: 160px; background: transparent;
}
.composer-bar { display: flex; align-items: center; gap: 10px; }
#char-count { font-size: 11px; color: #a4aab4; }
#state-hint { font-size: 11px; color: #8a8f99; flex: 1; text-align: left; }
.round {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.round svg { display: block; } /* 粗描边箭头/方块 SVG 图标（DeepSeek 同款大小） */
.round[hidden] { display: none; } /* hidden 属性须压过 display:inline-flex（2026-11-21 停止键常显 bug） */
.round.send { background: #4d6bfe; color: #fff; }
.round.send:hover { background: #3d5bf0; }
.round.stop { background: #fee2e2; color: #b91c1c; }

/* 通用按钮（旧类名兼容） */
.ghost {
  background: transparent; border: 1px solid #e2e6ee; color: #4e5561; border-radius: 10px;
  padding: 5px 10px; font-size: 12px; cursor: pointer;
}
.ghost:hover { border-color: #b9c8ff; color: #4d6bfe; }
.ghost.small { font-size: 12px; padding: 4px 9px; }
#btn-toggle-sidebar { border-color: transparent; font-size: 16px; }
#btn-toggle-sidebar:hover { border-color: #e2e6ee; }

@media (max-width: 768px) {
  .sidebar { position: fixed; z-index: 30; height: 100%; margin-left: -272px; }
  .sidebar.open { margin-left: 0; }
  .msg.user { max-width: 92%; }
}

/* 等待期动态 loading（2026-11-21）：发出后到首段文字前的"AI 思考中"三点跳动 */
.msg .thinking { display: flex; align-items: center; gap: 8px; color: #6b7280; font-size: 13px; padding: 4px 0; }
.msg .thinking .dots { display: inline-flex; gap: 4px; }
.msg .thinking .dots i { width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; animation: think-bounce 1.2s infinite ease-in-out; }
.msg .thinking .dots i:nth-child(2) { animation-delay: 0.15s; }
.msg .thinking .dots i:nth-child(3) { animation-delay: 0.3s; }
.msg .thinking .ellip::after { content: ""; animation: think-ellip 1.5s steps(4, end) infinite; }
@keyframes think-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
@keyframes think-ellip { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } 100% { content: ""; } }
