:root {
  color-scheme: light;         /* 让滚动条、表单控件也走浅色 */
  --bg: #f4f7fc;
  --panel: #ffffff;
  --panel-2: #f2f5fa;
  --line: #e3e9f3;
  --line-2: #eef2f8;
  --text: #1b2536;
  --muted: #6c7c96;
  --brand: #1f6bff;
  --brand-2: #1550cc;
  --bot: #ffffff;
  --me: #1f6bff;
  --me-soft: #eaf1ff;
  --me-line: #d8e5ff;
  --warn: #b25e00;
  --danger: #c0392b;
  --radius: 14px;
  --col: 760px;                /* 对话列 + 输入框的居中宽度（跟 DSH 一样：一条窄栏） */
  --side: 288px;               /* 左侧报价示例栏宽度 */
}

* { box-sizing: border-box; }

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

body {
  background: radial-gradient(1100px 520px at 50% -12%, #e4edff 0%, var(--bg) 62%);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100dvh; display: flex; flex-direction: column; }

.hidden { display: none !important; }

/* ---------- 登录（仅访问码模式） ---------- */
.login { flex: 1; display: grid; place-items: center; padding: 24px; }

.login-card {
  width: 100%; max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 18px 44px rgba(28, 48, 90, .10);
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand.small { margin-bottom: 0; gap: 8px; }

/* 通彩 LOGO：透明底 PNG（主文件 /root/baojia/logo/通彩LOGO.png，网页用 public/logo.png） */
.logo-img { width: 38px; height: 38px; flex: none; object-fit: contain; display: block; }
.logo-img.lg { width: 48px; height: 48px; }
.logo-img.sm { width: 26px; height: 26px; }

.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 0; }
.side-brand-t { font-size: 15px; font-weight: 700; letter-spacing: .2px; }

.login-card h1 { font-size: 19px; margin: 0; }
.login-card p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }

input[type=text], textarea {
  width: 100%; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font: inherit; outline: none;
}

input[type=text]::placeholder, textarea::placeholder { color: #a3afc2; }

input[type=text]:focus, textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(31, 107, 255, .12); }

button { font: inherit; cursor: pointer; border-radius: 12px; border: 1px solid transparent; transition: .15s; }

button.primary { background: var(--brand); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--brand-2); }
button:disabled { opacity: .5; cursor: not-allowed; }

.login-card button.primary { width: 100%; margin-top: 14px; padding: 12px; }

.hint { margin-top: 14px !important; font-size: 12px !important; color: var(--muted); }
.hint.bad { color: var(--danger) !important; }

/* ---------- 聊天：左侧栏 + 中间对话列 ---------- */
.chat { flex: 1; display: flex; min-height: 0; }

/* ---- 左栏：报价示例 ---- */
.sidebar {
  flex: none; width: var(--side);
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.side-head { padding: 0 6px; }
.side-title { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.side-sub { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.side-list { display: flex; flex-direction: column; gap: 8px; }

.ex {
  display: block; width: 100%; text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
}
.ex:hover { background: var(--me-soft); border-color: var(--me-line); }
.ex:active { transform: translateY(1px); }
.ex-t { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 3px; }
.ex-s { display: block; color: var(--muted); font-size: 12px; line-height: 1.55; }
.ex-rules { font-size: 11.5px; line-height: 1.75; }   /* 专版画册那格是 4 行条件说明，不是示例句 */

.backdrop { display: none; }

/* ---- 右栏：对话 + 输入 ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* 顶栏只在手机上出现（桌面端品牌在左侧栏顶部，对话区保持纯净的窄栏） */
.topbar {
  display: none;
  flex: none;
  padding: 10px 16px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar .bar { width: 100%; max-width: var(--col); margin: 0 auto; display: flex; align-items: center; gap: 10px; }

.topbar strong { display: block; font-size: 15px; letter-spacing: .2px; }

.side-toggle {
  display: none;
  width: 34px; height: 34px; flex: none;
  place-items: center;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
}
.side-toggle:hover { background: var(--me-soft); border-color: var(--me-line); }

.messages {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 22px 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  scroll-behavior: smooth;
}

.row { width: 100%; max-width: var(--col); display: flex; }
.row.me { justify-content: flex-end; }
.row.sys { justify-content: center; }

.bubble { max-width: min(82%, 620px); word-break: break-word; white-space: normal; }

/* 助手：直接铺在背景上，不套气泡（DSH 的样子） */
.row.bot .bubble { color: var(--text); padding: 0; }

/* 客户：浅蓝色一块，右对齐 */
.row.me .bubble {
  background: var(--me-soft); color: var(--text);
  border: 1px solid var(--me-line);
  border-radius: 16px; border-bottom-right-radius: 6px;
  padding: 10px 14px;
}

.row.sys .bubble {
  color: var(--muted); font-size: 13px; max-width: 90%;
  padding: 0; text-align: center;
}
.row.sys.error .bubble { color: var(--danger); }

.bubble hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.bubble strong { color: inherit; font-weight: 700; }

.typing {
  align-self: center; width: 100%; max-width: var(--col);
  display: flex; align-items: center; gap: 8px;
  padding: 4px 18px 10px; color: var(--muted); font-size: 13px;
}

.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

@keyframes bounce { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* ---- 输入框：一个圆角大盒子，右下角圆形发送键 ---- */
.composer-wrap {
  flex: none; align-self: center; width: 100%; max-width: var(--col);
  padding: 6px 16px calc(12px + env(safe-area-inset-bottom));
}

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 6px 6px 6px 16px;
  box-shadow: 0 6px 22px rgba(28, 48, 90, .07);
  transition: .15s;
}

.composer:focus-within { border-color: #b9d2ff; box-shadow: 0 0 0 3px rgba(31, 107, 255, .10), 0 6px 22px rgba(28, 48, 90, .07); }

.composer textarea {
  flex: 1; width: auto; min-width: 0;
  background: transparent; border: 0; border-radius: 0;
  padding: 10px 0; resize: none; max-height: 160px;
}
.composer textarea:focus { border: 0; background: transparent; box-shadow: none; }

button.send {
  flex: none; width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; border: 0; border-radius: 50%;
  box-shadow: 0 4px 12px rgba(31, 107, 255, .30);
}
button.send:hover:not(:disabled) { background: var(--brand-2); }
button.send:disabled { background: #c9d5e7; box-shadow: none; opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #fff4f1; color: var(--danger); border: 1px solid #f2cdc7;
  padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 40;
  max-width: 86vw; text-align: center;
  box-shadow: 0 8px 24px rgba(28, 48, 90, .12);
}

/* ---- 手机上：左栏收成抽屉 ---- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 30; top: 0; bottom: 0; left: 0;
    width: 300px; max-width: 84vw;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 0 12px 40px rgba(20, 34, 60, .18);
  }
  body.side-open .sidebar { transform: none; }
  body.side-open .backdrop {
    display: block; position: fixed; inset: 0; z-index: 25;
    background: rgba(17, 26, 43, .38);
  }
  .side-toggle { display: grid; }
  .topbar { display: block; }
}

@media (max-width: 520px) {
  .bubble { max-width: 88%; }
  .messages { padding: 16px 12px 6px; gap: 14px; }
  .composer-wrap { padding: 6px 12px calc(10px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 12px; }
}
