/* FireStone聊单助手 - 测试版 UI v2（V3 设计实装：深色克制配色 + 全布局重构，功能不变） */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* === 克制深色调色板 === */
  --bg: #eeeff1;
  --card: #ffffff;
  --border: rgba(0,0,0,.10);
  --hairline: rgba(0,0,0,.07);
  --text: #1a1a1c;
  --text-2: #5a5a5e;
  --text-3: #8a8a8e;
  --primary: #b84418;
  --primary-hover: #9c3a14;
  --primary-bg: rgba(184,68,24,.08);
  --green: #2d8a4e;
  --green-bg: rgba(45,138,78,.08);
  --red: #c43a3a;
  --red-bg: rgba(196,58,58,.08);
  --amber: #b87a20;
  --amber-bg: rgba(184,122,32,.08);
  --blue: #2a6dbf;
  --blue-bg: rgba(42,109,191,.08);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.03);
  --sidebar-bg: #e8e9eb;
  --hover: rgba(0,0,0,.04);
  --active: rgba(184,68,24,.08);
  --font: -apple-system, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

#app { display: flex; height: 100vh; }

/* ---------- 侧边栏（克制深灰，SVG 图标） ---------- */
.sidebar {
  width: 214px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 10px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; }
.brand-logo-img {
  width: 32px; height: 32px; border-radius: 8px;
  background: #1a1a1c; object-fit: contain; padding: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  flex-shrink: 0;
}
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: #1a1a1c;
  color: #fff; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 13.5px; font-weight: 650; letter-spacing: -.2px; }
.brand-sub { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 7px;
  color: var(--text-2); text-decoration: none; font-size: 12.5px; font-weight: 450;
  transition: background .1s, color .1s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active {
  background: #ffffff; color: var(--text); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon {
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--text-3); transition: color .1s;
}
.nav-icon svg { width: 15px; height: 15px; stroke-width: 1.9; }

.sidebar-footer { padding: 8px 8px 0; margin-top: auto; }
.ai-status { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.ai-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.ai-status.online .dot { background: var(--green); }
.ai-status.offline .dot { background: var(--amber); }

/* v0.13.0：订阅状态 */
.sub-status { font-size: 11.5px; color: var(--text-3); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.sub-status.sub-trial, .sub-status.sub-active { color: var(--green); }
.sub-status.sub-expired, .sub-status.sub-warn { color: var(--amber); font-weight: 600; }
.sub-status.sub-none { color: var(--text-3); }

/* ---------- 内容区 ---------- */
.content { flex: 1; overflow-y: auto; padding: 24px 28px; }
.view-host { height: 100%; min-height: 0; }
.page { max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.page-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px; margin-bottom: 12px;
}
.card-title { font-size: 13.5px; font-weight: 650; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.card-title .badge { font-size: 10.5px; font-weight: 500; padding: 1.5px 7px; border-radius: 20px; }

.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-orange { background: var(--amber-bg); color: #9a5a0a; }
.badge-purple { background: #f1ebf9; color: #6d4fa3; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 12.5px;
  cursor: pointer; transition: all .1s; white-space: nowrap; font-weight: 500;
}
.btn:hover { border-color: rgba(0,0,0,.18); background: rgba(0,0,0,.02); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.btn-sm { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-copy { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary); }
.btn-copy:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.field label .opt { color: var(--text-3); font-weight: 400; }
.input, .textarea, select.input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12.5px; font-family: inherit; color: var(--text);
  background: var(--card); outline: none; transition: border .1s;
}
.input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2.5px rgba(184,68,24,.10); }
.textarea { resize: vertical; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------- 客户列表（行式卡片） ---------- */
.customer-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 8px; cursor: pointer; transition: all .1s;
}
.customer-card:hover { border-color: rgba(0,0,0,.16); transform: translateY(-1px); box-shadow: var(--shadow); }
.customer-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: #3d4f6f; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.customer-info { flex: 1; min-width: 0; }
.customer-name { font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.customer-meta { font-size: 11.5px; color: var(--text-3); margin-top: 1px; display: flex; gap: 14px; flex-wrap: wrap; }
.customer-right { text-align: right; flex-shrink: 0; }
.customer-time { font-size: 11.5px; color: var(--text-3); }
.customer-actions { display: flex; gap: 6px; margin-top: 4px; justify-content: flex-end; }

/* ---------- 聊天分析页 ---------- */
.chat-input-card textarea { min-height: 200px; font-family: "Consolas", "Courier New", monospace; font-size: 12.5px; }
.tabs { display: flex; gap: 2px; padding: 3px; background: rgba(0,0,0,.04); border-radius: 9px; width: fit-content; margin-bottom: 16px; }
.tab {
  padding: 5px 13px; cursor: pointer; font-size: 12.5px; color: var(--text-2);
  border: none; border-radius: 7px; user-select: none; background: none; transition: all .1s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--card); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.analysis-card { border-left: 3px solid var(--primary); }
.trust-bar { height: 8px; border-radius: 4px; background: rgba(0,0,0,.06); overflow: hidden; margin-top: 6px; }
.trust-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--amber), var(--green)); transition: width .5s; }
.evidence {
  background: var(--bg); border: 1px solid var(--hairline); border-left: 3px solid var(--border);
  border-radius: 6px; padding: 6px 10px; margin: 4px 0; font-size: 12px; color: var(--text-2);
  font-family: "Consolas", "Courier New", monospace; white-space: pre-wrap; word-break: break-word;
}
.script-block {
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 8px;
  padding: 10px 12px; margin: 8px 0;
}
.script-block .script-text { font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; margin: 6px 0 8px; }
.script-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.script-row .label { font-size: 12px; font-weight: 600; color: var(--primary); }
.list-item { padding: 7px 0; border-bottom: 1px dashed var(--hairline); font-size: 13px; line-height: 1.7; }
.list-item:last-child { border-bottom: none; }
.list-item .item-title { font-weight: 600; margin-bottom: 2px; }
.list-item .item-sub { color: var(--text-2); font-size: 12px; margin-top: 2px; }

/* ---------- 话术助手 ---------- */
.script-style-card { border-left: 4px solid var(--primary); }
.script-style-card.professional { border-left-color: var(--primary); }
.script-style-card.casual { border-left-color: var(--green); }
.script-style-card.concise { border-left-color: var(--amber); }
.style-tag { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; display: inline-block; margin-bottom: 8px; }
.style-tag.professional { background: var(--primary-bg); color: var(--primary); }
.style-tag.casual { background: var(--green-bg); color: var(--green); }
.style-tag.concise { background: var(--amber-bg); color: var(--amber); }

/* ---------- 分析结果原始降级 ---------- */
.raw-block {
  background: #1a1a1c; color: #d8d8dc; border-radius: 8px;
  padding: 12px 14px; font-size: 12.5px; font-family: "Consolas", monospace;
  white-space: pre-wrap; word-break: break-word; max-height: 480px; overflow: auto;
}

/* ---------- 空态 / 加载 ---------- */
.empty {
  text-align: center; padding: 36px 16px; color: var(--text-3); font-size: 13px;
}
.empty .empty-icon { font-size: 30px; margin-bottom: 8px; }
.loading { text-align: center; padding: 24px; color: var(--text-2); font-size: 12.5px; }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; margin: 0 auto 8px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 提示条 ---------- */
.hint { font-size: 12px; color: var(--text-2); background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 8px 12px; line-height: 1.6; margin-bottom: 12px; }
.notice-error { background: var(--red-bg); border-color: rgba(196,58,58,.2); color: var(--red); }
.notice-success { background: var(--green-bg); border-color: rgba(45,138,78,.2); color: var(--green); }
.notice-warn { background: var(--amber-bg); border-color: rgba(184,122,32,.2); color: var(--amber); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1a1a1c; color: #fff; padding: 9px 20px; border-radius: 8px;
  font-size: 12.5px; z-index: 999; box-shadow: 0 4px 14px rgba(0,0,0,.2);
  transition: opacity .25s; max-width: 80vw;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* ---------- 历史记录 ---------- */
.history-item {
  border: 1px solid var(--hairline); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
  cursor: pointer; transition: border .1s;
}
.history-item:hover { border-color: rgba(0,0,0,.18); }
.history-item .h-title { font-weight: 600; font-size: 13px; }
.history-item .h-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ---------- 设置 ---------- */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--hairline); gap: 12px; }
.setting-row:last-child { border-bottom: none; }
.setting-row .s-name { font-size: 13px; font-weight: 600; }
.setting-row .s-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; max-width: 320px; line-height: 1.55; }
.mono { font-family: "Consolas", monospace; }

/* ---------- 周复盘 ---------- */
.week-picker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-overview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.overview-cell { background: var(--bg); border: 1px solid var(--hairline); border-radius: 8px; padding: 10px; text-align: center; }
.overview-cell .num { font-size: 20px; font-weight: 700; color: var(--primary); }
.overview-cell .lbl { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

/* ---------- v0.3.0 客户总览 ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric-cell { background: var(--bg); border: 1px solid var(--hairline); border-radius: 8px; padding: 10px; }
.metric-cell .m-label { font-size: 11px; color: var(--text-2); margin-bottom: 4px; }
.metric-cell .m-value { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prob-bar { height: 8px; border-radius: 4px; background: rgba(0,0,0,.06); overflow: hidden; margin-top: 8px; }
.prob-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #d9714a, var(--primary)); transition: width .5s; }
.kv-row { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--hairline); font-size: 12.5px; }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { flex-shrink: 0; width: 64px; color: var(--text-2); }
.kv-row .v { flex: 1; word-break: break-word; }
.chip { display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 20px; background: var(--bg); color: var(--text-2); margin: 0 6px 6px 0; }
.followup-card { border-left: 4px solid var(--primary); background: var(--primary-bg); }
.followup-card .fu-line { font-size: 13px; margin: 4px 0; line-height: 1.6; }
.curve-box { overflow-x: auto; }
.curve-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-line { width: 18px; height: 3px; display: inline-block; border-radius: 2px; }
.legend-line.solid { background: var(--primary); }
.legend-line.dashed { background: repeating-linear-gradient(90deg, var(--amber) 0 6px, transparent 6px 10px); }
.roadmap { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; padding: 10px 0; }
.roadmap-node { flex: 1; min-width: 120px; text-align: center; background: var(--bg); border: 1px solid var(--hairline); border-radius: 10px; padding: 10px 8px; }
.roadmap-node.is-reached { border-color: rgba(45,138,78,.3); background: var(--green-bg); }
.roadmap-node.is-current { border-color: var(--primary); background: var(--primary-bg); box-shadow: 0 0 0 3px rgba(184,68,24,.12); }
.roadmap-node.is-pending { border-color: var(--hairline); opacity: .75; }
.roadmap-dot { width: 11px; height: 11px; border-radius: 50%; margin: 0 auto 8px; background: var(--border); }
.is-reached .roadmap-dot { background: var(--green); }
.is-current .roadmap-dot { background: var(--primary); box-shadow: 0 0 0 4px rgba(184,68,24,.15); }
.roadmap-name { font-size: 12.5px; font-weight: 700; }
.roadmap-trust { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.roadmap-ev-box { margin-top: 8px; text-align: left; }
.roadmap-evidence { font-size: 11px; color: var(--text-2); background: var(--card); border: 1px solid var(--hairline); border-radius: 6px; padding: 4px 8px; margin-bottom: 4px; font-family: "Consolas", monospace; word-break: break-word; }
.roadmap-arrow { align-self: center; color: var(--text-3); font-size: 16px; padding-top: 10px; }
.sub-title { font-size: 12px; color: var(--text-2); font-weight: 600; }

/* ============ v0.6.0：WhatsApp 协议直连 ============ */
.wa-status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wa-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); display: inline-block; }
.wa-status-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(45,138,78,.15); }
.wa-status-dot.busy { background: var(--primary); box-shadow: 0 0 0 3px rgba(184,68,24,.15); }
.wa-status-dot.err { background: var(--red); box-shadow: 0 0 0 3px rgba(196,58,58,.15); }
.wa-modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 999;
  display: flex; align-items: center; justify-content: center;
}
.wa-modal {
  background: var(--card); border-radius: 14px; padding: 20px 24px;
  width: 380px; max-width: 92vw; box-shadow: 0 18px 50px rgba(0,0,0,.25);
  text-align: center;
}
.wa-modal-title { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; }
.wa-modal-sub { font-size: 12px; color: var(--text-2); line-height: 1.6; margin-bottom: 14px; }
.wa-qr-img { width: 260px; height: 260px; border-radius: 8px; border: 1px solid var(--hairline); }
.wa-qr-hint { font-size: 11.5px; color: var(--text-3); margin-top: 12px; line-height: 1.7; }
.wa-qr-wait { padding: 60px 0; color: var(--text-3); font-size: 12.5px; }
.wa-modal-close { margin-top: 14px; }

/* ============ v0.6.0：WhatsApp 聊天页 ============ */
.wa-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wa-topbar { display: flex; align-items: center; gap: 9px; padding: 8px 14px; border-bottom: 1px solid var(--hairline); background: var(--card); border-radius: 12px 12px 0 0; }
.wa-sync-progress { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: linear-gradient(90deg, rgba(184,68,24,.08), rgba(184,68,24,.16)); color: var(--primary-hover); border-radius: 14px; font-size: 11.5px; font-weight: 500; }
.wa-sync-progress { flex-direction: column; align-items: stretch; min-width: 200px; }
.wa-sync-row { display: flex; align-items: center; gap: 6px; }
.wa-sync-bar { height: 4px; background: rgba(184,68,24,.15); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.wa-sync-fill { height: 100%; width: 0%; background: var(--primary); border-radius: 2px; transition: width 0.3s ease; }
.wa-sync-fail-banner { display: flex; align-items: center; gap: 10px; margin: 6px 14px 0; padding: 6px 12px; background: var(--red-bg); border: 1px solid rgba(196,58,58,.2); border-radius: 8px; font-size: 12px; color: var(--red); }
.wa-sync-spinner { display: inline-block; animation: wa-sync-rotate 1.4s linear infinite; font-size: 13px; }
.wa-sync-text { white-space: nowrap; }
.wa-sync-count { white-space: nowrap; opacity: 0.85; font-variant-numeric: tabular-nums; }
@keyframes wa-sync-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.wa-body { display: flex; flex: 1; min-height: 0; border: 1px solid var(--hairline); border-top: none; border-radius: 0 0 12px 12px; overflow: hidden; background: var(--card); }
.wa-list { width: 252px; min-width: 252px; border-right: 1px solid var(--hairline); overflow-y: auto; background: var(--card); }
.wa-list-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,.025); transition: background .1s; }
.wa-list-item:hover { background: var(--hover); }
.wa-list-item.active { background: var(--active); }
.wa-list-avatar { width: 32px; height: 32px; border-radius: 50%; background: #3d4f6f; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.wa-list-main { flex: 1; min-width: 0; }
.wa-list-name { font-size: 12.5px; font-weight: 600; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.wa-list-time { font-size: 10.5px; color: var(--text-3); flex-shrink: 0; }
.wa-list-last { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.wa-list-badge { min-width: 16px; height: 16px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; margin-left: 6px; }
.wa-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #f8f8f9; }
.wa-analysis { width: 250px; min-width: 250px; border-left: 1px solid var(--hairline); overflow-y: auto; background: var(--card); padding: 12px; }
.wa-analysis-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-3); font-size: 12.5px; text-align: center; gap: 6px; }
.wa-ana-card { background: var(--bg); border: 1px solid var(--hairline); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.wa-ana-title { font-size: 12.5px; font-weight: 650; margin-bottom: 7px; display: flex; align-items: center; }
.wa-ana-step { font-size: 12px; line-height: 1.7; color: var(--text-2); padding: 2px 0; }
.wa-ana-fu { font-size: 12px; line-height: 1.7; color: var(--text-2); padding: 2px 0; }
.wa-ana-card .metric-grid { margin-top: 4px; }
.wa-ana-card .metric-cell { padding: 6px 8px; }
.wa-ana-card .m-label { font-size: 10.5px; }
.wa-ana-card .m-value { font-size: 15px; }
.wa-chat-head { display: flex; align-items: center; gap: 9px; padding: 8px 14px; background: var(--card); border-bottom: 1px solid var(--hairline); }
.wa-chat-title { font-size: 13.5px; font-weight: 650; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.wa-msg-row { display: flex; }
.wa-msg-row.in { justify-content: flex-start; }
.wa-msg-row.out { justify-content: flex-end; }
.wa-bubble { max-width: 72%; padding: 8px 12px; border-radius: 13px; font-size: 13px; line-height: 1.45; color: var(--text); position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.04); white-space: pre-wrap; word-break: break-word; }
.wa-msg-row.in .wa-bubble { background: var(--card); border: 1px solid var(--hairline); border-top-left-radius: 3px; }
.wa-msg-row.out .wa-bubble { background: var(--primary); color: #fff; border-top-right-radius: 3px; }
.wa-bubble-time { display: block; text-align: right; font-size: 10px; color: var(--text-3); margin-top: 3px; }
.wa-msg-row.out .wa-bubble-time { color: rgba(255,255,255,.7); }
.wa-msg-sys { align-self: center; font-size: 11.5px; color: var(--text-3); background: rgba(0,0,0,.04); padding: 3px 10px; border-radius: 8px; }
.wa-composer { display: flex; flex-direction: column; gap: 7px; padding: 9px 12px; background: var(--card); border-top: 1px solid var(--hairline); }
.wa-composer > .input { flex: 1; width: 100%; border-radius: 18px; padding: 7px 11px; }
.wa-composer-actions { display: flex; gap: 6px; align-items: center; }
.wa-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); font-size: 13px; gap: 8px; background: #f8f8f9; }
.wa-load-more { align-self: center; font-size: 11.5px; color: var(--text-3); padding: 4px 0; cursor: pointer; }
.wa-load-more:hover { color: var(--text); }

/* v0.9.0：右侧面板切换 Tab */
.wa-panel-tabs { display: flex; gap: 2px; padding: 2px; background: rgba(0,0,0,.04); border-radius: 8px; margin-bottom: 10px; }
.wa-panel-tab { flex: 1; text-align: center; padding: 5px 0; font-size: 11.5px; color: var(--text-2); cursor: pointer; border-radius: 7px; transition: all .1s; }
.wa-panel-tab:hover { color: var(--text); }
.wa-panel-tab.active { color: var(--text); background: var(--card); font-weight: 600; box-shadow: var(--shadow-sm); }

/* v0.9.0：基础信息行 */
.wa-info-row { display: flex; align-items: flex-start; padding: 3px 0; font-size: 12px; border-bottom: 1px solid rgba(0,0,0,.03); }
.wa-info-label { min-width: 70px; color: var(--text-3); flex-shrink: 0; }
.wa-info-value { color: var(--text); word-break: break-all; }

/* v0.9.0：客户详情页 WhatsApp 消息列表 */
.wa-msg-history { font-size: 12.5px; }
.wa-msg-history-item { padding: 6px 10px; border-bottom: 1px solid var(--hairline); }
.wa-msg-history-item .msg-meta { font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
.wa-msg-history-item .msg-text { line-height: 1.6; }

/* v0.11.0：搜索框 + 筛选 + 跟进徽章 */
.wa-list-col { display: flex; flex-direction: column; min-height: 0; }
.wa-list-toolbar { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--hairline); flex-shrink: 0; flex-wrap: wrap; }
.wa-search-input { flex: 1 1 160px; min-width: 160px; font-size: 11.5px; padding: 5px 8px; }
.wa-filter-select { width: auto; font-size: 11.5px; padding: 5px 8px; flex-shrink: 0; }
.wa-list-followup { font-size: 9.5px; padding: 1px 5px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.wa-list-followup.today { background: var(--amber-bg); color: var(--amber); }
.wa-list-followup.overdue { background: var(--red-bg); color: var(--red); }

/* ============================================================
   v0.10.0：仪表盘
   ============================================================ */
.dash-clocks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.dash-clock-card { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; text-align: center; box-shadow: var(--shadow-sm); }
.dash-clock-flag { font-size: 11px; color: var(--text-2); font-weight: 600; letter-spacing: .3px; margin-bottom: 7px; }
.dash-clock-time { font-size: 28px; font-weight: 300; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.dash-clock-date { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.dash-clock-period { font-size: 10.5px; color: var(--text-3); margin-top: 6px; padding: 2px 7px; border-radius: 10px; display: inline-block; background: rgba(0,0,0,.04); }
.dash-clock-period.active { background: var(--green-bg); color: var(--green); font-weight: 600; }

.dash-body { display: grid; grid-template-columns: 1fr 340px; gap: 14px; }
.dash-left-col, .dash-right-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.dash-followup-list { display: flex; flex-direction: column; gap: 1px; max-height: 300px; overflow-y: auto; }
.dash-followup-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 7px; cursor: pointer; transition: background .1s; }
.dash-followup-item:hover { background: var(--hover); }
.dash-followup-name { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; flex-wrap: wrap; }
.dash-followup-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.dash-empty { padding: 20px; text-align: center; color: var(--text-3); font-size: 12.5px; }

.dash-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.dash-stat-card { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--hairline); box-shadow: var(--shadow-sm); }
.dash-stat-icon { font-size: 24px; line-height: 1; flex-shrink: 0; }
.dash-stat-info { flex: 1; min-width: 0; }
.dash-stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.4px; line-height: 1.15; }
.dash-stat-label { font-size: 11.5px; color: var(--text-2); margin-top: 3px; font-weight: 500; }
.dash-stat-sub { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }
.dash-hv-card { grid-column: 1 / -1; }
.dash-hv-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.dash-hv-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; background: var(--card); border: 1px solid var(--hairline); cursor: pointer; font-size: 12.5px; }
.dash-hv-item:hover { border-color: rgba(196,58,58,.3); }

.dash-tips-card { }
.dash-tips-content { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.dash-tip-item { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--hairline); line-height: 1.6; }
.dash-tip-item:last-child { border-bottom: none; }

/* v0.10.0：三点菜单 */
.wa-more-menu { position: relative; }
.wa-more-btn { background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 5px; color: var(--text-3); line-height: 1; }
.wa-more-btn:hover { background: rgba(0,0,0,.05); color: var(--text); }
.wa-more-dropdown { position: absolute; right: 0; top: 100%; margin-top: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.1); z-index: 100; min-width: 140px; overflow: hidden; }
.wa-more-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; font-size: 12.5px; color: var(--text); transition: background .12s; white-space: nowrap; }
.wa-more-dropdown-item:hover { background: var(--primary-bg); color: var(--primary); }

/* v0.10.0：Skill 管理区域 */
.skill-import-box { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; border-top: 1px dashed var(--hairline); padding-top: 12px; }

/* v0.12.0：翻译功能样式 */
.wa-bubble-text { white-space: pre-wrap; word-break: break-word; }
.wa-bubble-tr { margin-top: 5px; }
.wa-tr-divider { height: 1px; background: rgba(0,0,0,.08); margin: 5px 0; }
.wa-tr-text { font-size: 12px; color: var(--text-2); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.wa-tr-btn { display: inline-flex; align-items: center; cursor: pointer; font-size: 11px; color: var(--text-3); padding: 2px 4px; border-radius: 4px; margin-top: 2px; user-select: none; }
.wa-tr-btn:hover { background: rgba(0,0,0,.05); color: var(--primary); }

.wa-tr-preview { background: var(--amber-bg); border-radius: 8px; padding: 8px 12px; }
.wa-tr-preview-label { font-size: 11px; color: var(--amber); font-weight: 600; margin-bottom: 2px; }
.wa-tr-preview-text { font-size: 12.5px; color: var(--text); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* v0.12.1：客户语言提示栏 */
.wa-lang-bar { display: flex; align-items: center; gap: 4px; padding: 5px 10px; background: var(--blue-bg); border-radius: 8px; }
.wa-lang-icon { font-size: 14px; }

/* v0.12.0：设置页开关组件 */
.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 10px; background: #c8c9cc; position: relative; cursor: pointer; transition: background .2s; }
.switch input::before { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--green); }
.switch input:checked::before { transform: translateX(16px); }

/* ---------- v0.15.0：单据中心 ---------- */
.docs-layout { display: flex; gap: 14px; align-items: flex-start; }
.docs-list-card { width: 270px; flex-shrink: 0; }
.docs-list-head { padding: 10px 12px 0; }
.docs-list { max-height: calc(100vh - 220px); overflow-y: auto; padding: 8px 12px 12px; }
.docs-empty { color: var(--text-3); text-align: center; padding: 24px 0; font-size: 12.5px; }
.docs-item { padding: 9px 11px; border: 1px solid var(--hairline); border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: var(--card); }
.docs-item:hover { border-color: rgba(0,0,0,.18); }
.docs-item.active { border-color: var(--primary); background: var(--primary-bg); }
.docs-item-top { display: flex; align-items: center; gap: 6px; }
.docs-item-num { font-weight: 600; font-size: 12.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-item-amount { font-size: 11.5px; color: var(--text-2); }
.docs-item-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

.docs-editor { flex: 1; min-width: 0; }
.docs-editor-card { padding: 16px; max-height: calc(100vh - 160px); overflow-y: auto; }
.docs-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.docs-editor-title { display: flex; align-items: center; gap: 10px; }
.docs-editor-title select { width: 180px; font-weight: 600; }
.docs-editor-en { color: var(--text-3); font-size: 11.5px; letter-spacing: .5px; }
.docs-editor-actions { display: flex; gap: 8px; }
.docs-section-title { font-weight: 650; font-size: 12.5px; margin: 14px 0 8px; padding-left: 8px; border-left: 3px solid var(--primary); }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 14px; align-items: start; }
.form-row { display: flex; align-items: center; gap: 8px; }
.form-row .form-label { width: 84px; flex-shrink: 0; font-size: 11.5px; color: var(--text-2); }
.form-row .input { flex: 1; min-width: 0; }
.docs-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.docs-party { display: flex; flex-direction: column; gap: 8px; }
.docs-table-wrap { overflow-x: auto; }
.docs-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.docs-table th { background: var(--bg); border: 1px solid var(--hairline); padding: 6px 8px; font-size: 11.5px; white-space: nowrap; text-align: left; }
.docs-table td { border: 1px solid var(--hairline); padding: 3px 4px; }
.docs-cell { border: none; padding: 4px 6px; font-size: 12px; width: 100%; background: transparent; }
.docs-cell:focus { outline: 1px solid var(--primary); background: var(--card); border-radius: 3px; }
.docs-amt { font-size: 12px; white-space: nowrap; }
.docs-totals { margin: 12px 0 4px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.docs-totals .docs-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 6px 10px; }
.docs-totals .form-row .form-label { width: auto; min-width: 60px; white-space: nowrap; }
.docs-total-row { font-size: 14px; font-weight: 700; }
.docs-total-val { color: var(--red); }

.docs-preview-modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 300; display: flex; flex-direction: column; padding: 24px 48px; }
.docs-preview-bar { display: flex; justify-content: space-between; align-items: center; background: var(--card); border-radius: 10px 10px 0 0; padding: 10px 16px; }
.docs-preview-title { font-weight: 600; }
.docs-preview-frame { flex: 1; width: 100%; border: none; border-radius: 0 0 10px 10px; background: var(--card); }

/* ---------- v0.15.0：仪表盘实时汇率 ---------- */
.dash-fx-card { display: flex; flex-direction: column; gap: 8px; }
.dash-fx-head { display: flex; justify-content: space-between; align-items: center; }
.dash-fx-updated { font-size: 11px; color: var(--text-3); }
.dash-fx-refresh { font-size: 11.5px; padding: 3px 9px; }
.dash-fx-list { display: flex; gap: 8px; }
.dash-fx-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 11px 12px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); flex: 1; text-align: center; }
.dash-fx-flag { font-size: 16px; }
.dash-fx-name { font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.dash-fx-name b { color: var(--text); font-size: 12px; margin-right: 2px; }
.dash-fx-rate { font-weight: 700; font-size: 14px; margin-top: 2px; }
.dash-fx-rate small { font-weight: 400; font-size: 10.5px; color: var(--text-3); margin-left: 3px; }
.dash-fx-err { font-size: 12px; color: var(--amber); }

/* ---------- v0.16.0：WhatsApp 媒体消息 ---------- */
.wa-bubble.has-media { padding: 6px; min-width: 200px; }
.wa-bubble.has-media .wa-bubble-text { margin-top: 4px; padding: 0 4px; }
.wa-media-img {
  display: block; max-width: 280px; max-height: 280px; border-radius: 8px;
  cursor: zoom-in; object-fit: contain; background: rgba(0,0,0,.04);
}
.wa-media-video { display: block; max-width: 300px; max-height: 240px; border-radius: 8px; background: #000; }
.wa-media-audio audio { width: 240px; height: 34px; margin-top: 6px; }
.wa-media-doc {
  display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 280px;
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 8px;
  padding: 9px 11px; cursor: pointer; transition: all .15s;
}
.wa-media-doc:hover { border-color: var(--primary); background: var(--primary-bg); }
.wa-media-icon { font-size: 24px; flex-shrink: 0; }
.wa-media-doc-info { min-width: 0; flex: 1; }
.wa-media-doc-name {
  font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; word-break: break-all;
}
.wa-media-doc-size { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }

/* ---------- v0.16.2：图片 lightbox 放大查看 ---------- */
.wa-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, .86);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.wa-lightbox-img {
  max-width: 92%; max-height: 86vh; object-fit: contain;
  border-radius: 6px; background: #000; cursor: default;
  transition: max-width .12s ease, max-height .12s ease;
}
.wa-lightbox-bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: linear-gradient(rgba(0,0,0,.55), transparent);
}
.wa-lightbox-name {
  color: #fff; font-size: 13px; max-width: 45%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- v0.16.2：搜索结果高亮 ---------- */
mark.wa-search-hit {
  background: rgba(255, 213, 79, .55); color: inherit;
  border-radius: 3px; padding: 0 1px; font-weight: 600;
}
.wa-search-hit-prefix { color: var(--primary); font-size: 11px; }

/* v0.16.0：输入框附件栏 */
.wa-attach-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--primary-bg); border: 1px dashed rgba(184,68,24,.25); border-radius: 8px;
  padding: 6px 10px; margin-bottom: 8px;
}
.wa-attach-name { font-size: 12px; font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-attach-size { font-size: 11px; color: var(--text-3); }

/* ---------- 滚动条（克制风） ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.14); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.22); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 空图标元素自动隐藏（emoji 清理后） ---------- */
.dash-stat-icon:empty, .empty-icon:empty, .wa-media-icon:empty { display: none; }
/* 媒体类型文字图标 */
.wa-media-icon-text { font-size: 13px; font-weight: 700; padding: 4px 7px; background: var(--primary-bg); color: var(--primary); border-radius: 5px; }
.wa-media-icon-text:empty { display: none; }
