/* ============================================================
 * ZEC 现场协助 V2.0 · 界面样式
 * 参照主流AI对话体验：极简顶栏 + 居中对话流 + 底部悬浮输入坞
 * PC / 手机双端适配（安全区、键盘顶起、动态视口高度）
 * ============================================================ */
* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --blue:#1a73e8; --blue-deep:#0b5bd3; --cyan:#00b4d8;
  --ink:#1f2d3d; --grey:#5e6d82; --line:#e4ebf5;
  --bg:#f4f7fc; --card:#ffffff;
  --grad:linear-gradient(135deg,#1a73e8,#00b4d8);
  --dock-h:120px;
}
html, body { height:100%; }
body {
  font-family:"PingFang SC","Microsoft YaHei","Helvetica Neue",Arial,sans-serif;
  background:var(--bg); color:var(--ink);
  display:flex; flex-direction:column;
  height:100vh; height:100dvh;
  overflow:hidden;
}
a { color:var(--blue); text-decoration:none; }

/* ---------- 顶栏 ---------- */
.topbar { flex:none; background:#fff; border-bottom:1px solid var(--line); z-index:20; }
.tb-inner { max-width:860px; margin:0 auto; padding:8px 16px; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.tb-brand { display:flex; align-items:baseline; gap:7px; }
.tb-logo { font-size:23px; font-weight:800; font-style:italic; color:var(--blue); letter-spacing:1px; }
.tb-name { font-size:15px; font-weight:600; }
.tb-actions { display:flex; gap:6px; align-items:center; }
.tb-btn { font-size:12px; color:var(--grey); background:#f2f6fc; border-radius:999px; padding:5px 12px; white-space:nowrap; }
.tb-btn:hover { color:var(--blue); }
.tb-btn-primary { color:var(--blue); font-weight:600; background:#e8f1fe; }
.tb-tel { font-weight:600; color:var(--blue-deep); }

/* 嵌入模式：隐藏顶栏与页脚，把空间全给对话 */
body.embedded .topbar, body.embedded .site-foot { display:none; }

/* ---------- 专家条 ---------- */
.expert-bar { flex:none; max-width:860px; width:100%; margin:10px auto 0; padding:8px 14px; display:flex; align-items:center; gap:10px; background:var(--card); border:1px solid var(--line); border-radius:14px; width:calc(100% - 24px); }
.avatar-stack { display:flex; flex:none; }
.av { width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; font-size:15px; border:2px solid #fff; box-shadow:0 2px 6px rgba(31,45,61,.18); }
.av-1 { background:var(--grad); }
.av-2 { background:linear-gradient(135deg,#e8710a,#f5a623); margin-left:-12px; }
.av-3 { background:linear-gradient(135deg,#0da678,#3ac8a0); margin-left:-12px; }
.expert-meta { flex:1; min-width:0; }
.expert-name { font-size:14px; }
.team-tag { font-size:10px; color:var(--blue); background:#e8f1fe; border-radius:6px; padding:1px 6px; vertical-align:1px; }
.expert-desc { font-size:11px; color:var(--grey); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.engine-dot { flex:none; display:flex; align-items:center; gap:5px; font-size:11px; color:#18a058; }
.engine-dot i { width:8px; height:8px; border-radius:50%; background:#18a058; box-shadow:0 0 0 3px rgba(24,160,88,.15); }
.engine-dot.local { color:#b88230; }
.engine-dot.local i { background:#f0a020; box-shadow:0 0 0 3px rgba(240,160,32,.15); }

/* ---------- 对话流 ---------- */
.chat { flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:18px 12px 12px; }
.chat-inner { max-width:768px; margin:0 auto; display:flex; flex-direction:column; gap:18px; }
.row { display:flex; gap:10px; animation:fadeUp .25s ease; }
@keyframes fadeUp { from{opacity:0; transform:translateY(8px);} to{opacity:1; transform:none;} }
.row .r-av { width:32px; height:32px; border-radius:50%; flex:none; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; }
.row.bot .r-av { background:var(--grad); color:#fff; }
.row.user { flex-direction:row-reverse; }
.row.user .r-av { background:#dbe7f7; color:var(--blue); }
.r-body { max-width:86%; font-size:15px; line-height:1.8; word-break:break-word; }
.row.bot .r-body { color:var(--ink); padding:2px 4px; }
.row.user .r-body { background:var(--grad); color:#fff; border-radius:16px 16px 4px 16px; padding:9px 14px; font-size:14px; }
.r-body p { margin:0 0 6px; } .r-body p:last-child { margin:0; }
.r-body b, .r-body strong { color:var(--blue-deep); }
.row.user .r-body b { color:#fff; }
.r-body ul, .r-body ol { margin:4px 0 8px 20px; }
.r-body table { border-collapse:collapse; margin:8px 0; font-size:13px; width:100%; background:#fff; }
.r-body th, .r-body td { border:1px solid var(--line); padding:6px 9px; text-align:left; }
.r-body th { background:#f0f6ff; color:var(--blue-deep); }

.typing { display:inline-flex; gap:4px; padding:8px 2px; }
.typing i { width:7px; height:7px; border-radius:50%; background:#b9c8dc; animation:blink 1.2s infinite; }
.typing i:nth-child(2){animation-delay:.2s} .typing i:nth-child(3){animation-delay:.4s}
@keyframes blink { 0%,60%,100%{opacity:.3;} 30%{opacity:1; transform:translateY(-3px);} }

/* ---------- 方案卡片 ---------- */
.scheme-card { background:var(--card); border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:0 4px 16px rgba(26,115,232,.10); font-size:14px; margin-top:6px; }
.scheme-head { background:var(--grad); color:#fff; padding:12px 16px; }
.scheme-head h4 { font-size:16px; margin-bottom:2px; }
.scheme-head .sub { font-size:12px; opacity:.9; }
.scheme-sec { padding:12px 16px; border-bottom:1px dashed var(--line); }
.scheme-sec:last-child { border-bottom:none; }
.scheme-sec h5 { font-size:13px; color:var(--blue-deep); margin-bottom:8px; }
.scheme-table { width:100%; border-collapse:collapse; font-size:13px; }
.scheme-table th, .scheme-table td { border:1px solid var(--line); padding:7px 9px; text-align:left; }
.scheme-table th { background:#f0f6ff; color:var(--blue-deep); white-space:nowrap; }
.scheme-table td.price { color:#d4380d; font-weight:700; white-space:nowrap; }
.scheme-note { font-size:12px; color:var(--grey); margin-top:8px; line-height:1.6; }
.roi-line { display:flex; flex-wrap:wrap; gap:10px; }
.roi-item { flex:1; min-width:110px; background:#f6faff; border:1px solid var(--line); border-radius:10px; padding:8px 10px; text-align:center; }
.roi-item .v { font-size:17px; font-weight:800; color:var(--blue-deep); }
.roi-item .k { font-size:11px; color:var(--grey); margin-top:2px; }
.scheme-cta { display:flex; flex-wrap:wrap; gap:8px; }
.btn-primary { background:var(--grad); color:#fff; border:none; border-radius:10px; padding:10px 14px; font-size:13px; font-weight:600; cursor:pointer; flex:1; min-width:130px; }
.btn-primary:hover { filter:brightness(1.06); }
.btn-ghost { background:#fff; color:var(--blue); border:1px solid var(--blue); border-radius:10px; padding:10px 12px; font-size:13px; cursor:pointer; flex:1; min-width:110px; }
.btn-ghost:hover { background:#f0f6ff; }

/* ---------- 底部坞 ---------- */
.dock { flex:none; padding:6px 12px calc(8px + env(safe-area-inset-bottom)); background:linear-gradient(to top, var(--bg) 78%, transparent); }
.chips { max-width:768px; margin:0 auto 8px; display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none; }
.chips::-webkit-scrollbar { display:none; }
.chips:empty { display:none; }
.chip { flex:none; background:#fff; border:1px solid #bcd3f2; color:var(--blue-deep); border-radius:999px; padding:8px 15px; font-size:13px; cursor:pointer; transition:.15s; }
.chip:hover { background:var(--blue); color:#fff; }
.chip.chip-hot { border-color:var(--cyan); color:#0891b2; font-weight:600; }
.chip.chip-hot:hover { background:var(--cyan); color:#fff; }
.composer { max-width:768px; margin:0 auto; display:flex; align-items:flex-end; gap:8px; background:#fff; border:1px solid var(--line); border-radius:24px; padding:8px 8px 8px 18px; box-shadow:0 4px 20px rgba(31,45,61,.08); }
.composer:focus-within { border-color:#a9c7f5; }
.composer textarea { flex:1; border:none; outline:none; resize:none; font-size:15px; line-height:1.5; max-height:120px; background:transparent; font-family:inherit; padding:6px 0; }
.mic-btn { flex:none; width:38px; height:38px; border:none; background:none; font-size:19px; cursor:pointer; border-radius:50%; }
.mic-btn.recording { background:#ffe8e8; animation:pulse 1s infinite; }
@keyframes pulse { 50% { transform:scale(1.12); } }
.send-btn { flex:none; width:38px; height:38px; border:none; border-radius:50%; background:var(--grad); color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.send-btn:disabled { opacity:.35; cursor:not-allowed; }
.dock-note { max-width:768px; margin:6px auto 0; text-align:center; font-size:11px; color:#9aa8bb; }
.site-foot { flex:none; text-align:center; font-size:11px; color:#b3bfcb; padding:4px 10px 10px; }

/* ---------- 留资弹层 ---------- */
.lead-mask { position:fixed; inset:0; background:rgba(15,30,55,.45); z-index:100; display:flex; align-items:center; justify-content:center; padding:16px; }
.lead-mask[hidden] { display:none; }
.lead-card { background:#fff; border-radius:16px; padding:22px 20px; width:100%; max-width:400px; position:relative; animation:fadeUp .25s ease; max-height:90dvh; overflow-y:auto; }
.lead-close { position:absolute; top:10px; right:12px; border:none; background:none; font-size:22px; color:#9aa8bb; cursor:pointer; }
.lead-card h3 { font-size:17px; margin-bottom:8px; }
.lead-tip { font-size:13px; color:var(--grey); line-height:1.7; margin-bottom:12px; }
.lead-card label { display:block; font-size:13px; margin-bottom:10px; }
.lead-card input { display:block; width:100%; margin-top:4px; border:1px solid var(--line); border-radius:9px; padding:10px 11px; font-size:15px; outline:none; }
.lead-card input:focus { border-color:var(--blue); }
.lead-card .btn-primary { width:100%; margin-top:4px; }
.lead-alt { margin-top:12px; font-size:12px; color:var(--grey); text-align:center; }

.toast { position:fixed; left:50%; bottom:90px; transform:translateX(-50%); background:rgba(31,45,61,.92); color:#fff; font-size:13px; padding:10px 18px; border-radius:10px; z-index:200; max-width:86vw; }

/* ---------- 手机端 ---------- */
@media (max-width:640px) {
  .tb-logo { font-size:19px; }
  .tb-name { display:none; }
  .tb-btn { font-size:11px; padding:4px 9px; }
  .tb-tel { display:none; }
  .expert-bar { margin-top:8px; padding:7px 12px; }
  .expert-desc { display:none; }
  .r-body { max-width:92%; font-size:14.5px; }
  .chat { padding:12px 10px 8px; }
  .roi-item { min-width:90px; }
  .scheme-cta .btn-primary, .scheme-cta .btn-ghost { min-width:100%; }
}
