/* ============================================================
   员工聊天情商教练 —— 样式
   风格：简洁商务风，克制配色（墨蓝 + 中性灰）
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e4e7ec;
  --line-soft: #eef0f3;
  --ink: #1a1b1c;
  --ink-2: #4b5563;
  --ink-3: #8b929c;
  --brand: #2f5aa8;
  --brand-soft: #eaf0fa;
  --good: #1f7a53;
  --good-soft: #e8f4ee;
  --warn: #a8641f;
  --warn-soft: #fbf1e5;
  --danger: #a63b32;
  --danger-soft: #fbeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.brand span { color: var(--ink-3); font-weight: 400; font-size: 12.5px; margin-left: 8px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13.5px;
}
.nav a:hover { background: var(--line-soft); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
.cols { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: 0 0 auto; }

/* ---------- 提示条 ---------- */
.banner {
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.banner.warn { background: var(--warn-soft); border-color: #f0dcc0; color: #7a4a14; }
.banner.info { background: var(--brand-soft); border-color: #d3e0f4; color: #24457e; }
.banner code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- Tab ---------- */
.tabs { display: flex; gap: 6px; background: var(--line-soft); padding: 4px; border-radius: 9px; margin-bottom: 14px; }
.tabs button {
  flex: 1; border: 0; background: transparent; padding: 7px 10px;
  border-radius: 6px; color: var(--ink-2); font-size: 13.5px;
}
.tabs button.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- 上传区 ---------- */
.drop {
  border: 1.5px dashed #cdd3dc;
  border-radius: 9px;
  padding: 26px 16px;
  text-align: center;
  color: var(--ink-3);
  background: #fbfcfd;
  transition: .15s;
  cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop strong { display: block; color: var(--ink); font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.drop em { font-style: normal; font-size: 12px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.thumb { position: relative; width: 74px; height: 74px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.thumb .size { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 10px; text-align: center; }

textarea {
  width: 100%; min-height: 190px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-family: inherit; font-size: 13.5px; line-height: 1.7; color: var(--ink);
  background: #fbfcfd;
}
textarea:focus { outline: none; border-color: var(--brand); background: #fff; }

.hint { color: var(--ink-3); font-size: 12px; margin-top: 8px; line-height: 1.6; }

/* ---------- 按钮 ---------- */
.btn {
  border: 0; border-radius: 8px; padding: 10px 16px;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 14px;
  width: 100%; margin-top: 14px;
}
.btn:hover { background: #274b8d; }
.btn:disabled { background: #b7c2d4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); width: auto; margin: 0; padding: 5px 11px; font-weight: 500; font-size: 12.5px; }
.btn.ghost:hover { background: var(--line-soft); }

.copy-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 7px; padding: 4px 10px; font-size: 12.5px; white-space: nowrap;
}
.copy-btn:hover { background: var(--line-soft); }
.copy-btn.done { background: var(--good-soft); border-color: #bfe0d0; color: var(--good); }

/* ---------- 结果区 ---------- */
.placeholder { text-align: center; padding: 70px 20px; color: var(--ink-3); }
.placeholder h3 { color: var(--ink-2); font-size: 15px; margin: 0 0 8px; font-weight: 600; }
.placeholder p { margin: 0; font-size: 13px; }

.steps { padding: 50px 20px; text-align: center; }
.steps .spin {
  width: 26px; height: 26px; border: 2.5px solid var(--line);
  border-top-color: var(--brand); border-radius: 50%;
  margin: 0 auto 16px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.steps ul { list-style: none; margin: 0; padding: 0; display: inline-block; text-align: left; }
.steps li { color: var(--ink-3); font-size: 13.5px; padding: 3px 0; }
.steps li.on { color: var(--brand); font-weight: 600; }
.steps li.done { color: var(--good); }
.steps li::before { content: "○ "; }
.steps li.done::before { content: "✓ "; }
.steps li.on::before { content: "● "; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; background: var(--line-soft); color: var(--ink-2); margin: 0 6px 6px 0;
}
.tag.brand { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

.kv { display: grid; grid-template-columns: 76px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
.kv dd { margin: 0; color: var(--ink); }

ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin-bottom: 5px; color: var(--ink); font-size: 13.5px; }
ul.plain li:last-child { margin-bottom: 0; }

/* 推荐回答卡片 */
.reply {
  border: 1px solid var(--line); border-radius: 9px; padding: 14px; margin-bottom: 12px;
  background: #fff;
}
.reply.hi { border-color: #cddcf2; background: linear-gradient(180deg, #f8fbff 0%, #fff 60%); }
.reply-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.reply-body {
  background: var(--line-soft); border-radius: 8px; padding: 11px 13px;
  font-size: 14.5px; line-height: 1.75; color: var(--ink); white-space: pre-wrap;
}
.reply.hi .reply-body { background: var(--brand-soft); }
.reply-reason { margin-top: 9px; font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }
.reply-reason b { color: var(--ink); font-weight: 600; }
.reply-len { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }

/* 评分条 */
.score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.score-row .label { width: 62px; color: var(--ink-3); font-size: 12.5px; flex: 0 0 auto; }
.bar { flex: 1; height: 8px; background: var(--line-soft); border-radius: 20px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; transition: width .6s ease; }
.bar.cur > i { background: #c98a3c; }
.bar.est > i { background: var(--good); }
.score-row .num { width: 34px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 历史记录 ---------- */
.stat-row { display: flex; gap: 26px; flex-wrap: wrap; }
.stat b { display: block; font-size: 22px; font-weight: 600; line-height: 1.3; }
.stat span { font-size: 12.5px; color: var(--ink-3); }

.hist-item {
  border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px;
  margin-bottom: 10px; background: #fff; cursor: pointer;
}
.hist-item:hover { border-color: #c9d4e4; background: #fbfcfe; }
.hist-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.hist-time { color: var(--ink-3); font-size: 12px; margin-left: auto; }
.hist-sum { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.empty { text-align: center; color: var(--ink-3); padding: 50px 0; font-size: 13.5px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

.err { background: var(--danger-soft); border: 1px solid #f0cfcc; color: #8c2f27; border-radius: 8px; padding: 11px 13px; font-size: 13px; line-height: 1.6; }

/* ============================================================
   P1 新增样式：员工标识 / 话术库 / 知识库 / 对练 / 团队
   ============================================================ */

.nav { overflow-x: auto; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; }

.who { display: flex; align-items: center; gap: 6px; margin-left: 16px; flex: 0 0 auto; }
.who label { color: var(--ink-3); font-size: 12.5px; }
.who input {
  width: 78px; border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 8px; font-size: 13px; font-family: inherit; background: #fbfcfd; color: var(--ink);
}
.who input:focus { outline: none; border-color: var(--brand); background: #fff; }
@media (max-width: 700px) { .brand span { display: none; } .who label { display: none; } }

/* ---------- 通用工具条 ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type="search"], .toolbar input[type="text"], .toolbar select {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--ink);
}
.toolbar input[type="search"] { flex: 1; min-width: 160px; }
.toolbar select { cursor: pointer; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 20px; padding: 5px 13px; font-size: 12.5px;
}
.chip:hover { background: var(--line-soft); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.chip .n { opacity: .7; margin-left: 4px; }

/* ---------- 话术卡片 ---------- */
.phrase { border: 1px solid var(--line); border-radius: 9px; padding: 13px 14px; margin-bottom: 10px; background: #fff; }
.phrase.star { border-color: #e6cf9a; background: #fffdf7; }
.phrase-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.phrase-head .spacer { flex: 1; }
.phrase-text { background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; font-size: 14.5px; line-height: 1.75; white-space: pre-wrap; }
.phrase-reason { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 4px 9px; font-size: 12.5px; color: var(--ink-2); }
.icon-btn:hover { background: var(--line-soft); }
.icon-btn.on { background: #fdf4e0; border-color: #e6cf9a; color: #8a6410; }

/* ---------- 知识库表单 ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.field textarea { min-height: 96px; }
.field .tip { color: var(--ink-3); font-size: 12px; margin: 4px 0 6px; }
.save-row { display: flex; align-items: center; gap: 12px; }
.save-row .btn { width: auto; margin: 0; }
.saved-at { color: var(--ink-3); font-size: 12px; }

/* ---------- 对练 ---------- */
.chat {
  border: 1px solid var(--line); border-radius: 9px; background: #f8f9fb;
  padding: 14px; height: 440px; overflow-y: auto;
}
.bubble-row { display: flex; margin-bottom: 12px; }
.bubble-row.me { justify-content: flex-end; }
.bubble {
  max-width: 78%; padding: 9px 13px; border-radius: 12px;
  font-size: 14px; line-height: 1.65; white-space: pre-wrap;
}
.bubble.cust { background: #fff; border: 1px solid var(--line); border-top-left-radius: 3px; }
.bubble.me { background: #d7e6c8; border-top-right-radius: 3px; }
.bubble-name { font-size: 11.5px; color: var(--ink-3); margin-bottom: 3px; }
.typing { color: var(--ink-3); font-size: 13px; padding: 4px 2px; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-input textarea { min-height: 62px; margin: 0; }
.chat-input .btn { width: 86px; margin: 0; flex: 0 0 auto; }
.drill-setup { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

.review-block { margin-bottom: 14px; }
.review-block h4 { font-size: 13px; color: var(--ink-2); margin: 0 0 6px; font-weight: 600; }
.rewrite { border-left: 3px solid var(--brand); background: #f8fafd; padding: 10px 12px; border-radius: 0 8px 8px 0; margin-bottom: 10px; }
.rewrite .o { color: var(--ink-3); font-size: 13px; text-decoration: line-through; }
.rewrite .b { color: var(--ink); font-size: 14px; margin: 5px 0; font-weight: 500; }
.rewrite .r { color: var(--ink-2); font-size: 12.5px; }
.big-score { font-size: 34px; font-weight: 600; line-height: 1.1; }

/* ---------- 团队表格 ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
table.t th, table.t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
table.t th { color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
table.t tbody tr:hover { background: #fbfcfe; }
table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center;
  border-radius: 5px; background: var(--line-soft); color: var(--ink-2); font-size: 11.5px; font-weight: 600; margin-right: 7px; }
.rank.top { background: var(--brand); color: #fff; }

/* 设置页输入框 */
.field input[type="text"], .field input[type="password"] {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-family: inherit; font-size: 13.5px; color: var(--ink); background: #fbfcfd;
}
.field input:focus { outline: none; border-color: var(--brand); background: #fff; }

/* 登录页 */
body.locked .topbar .nav, body.locked .topbar .who { display: none; }
.login-wrap { display: flex; justify-content: center; padding-top: 60px; }
.login-card { width: 100%; max-width: 360px; }
.login-card input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-family: inherit; font-size: 14px; background: #fbfcfd; color: var(--ink); }
.login-card input:focus { outline: none; border-color: var(--brand); background: #fff; }
