/* 珠宝门店销售陪练 · 移动优先，原生 CSS，无构建 */
:root {
  --ink: #1b1f22;
  --ink-2: #4d565f;
  --muted: #7b858f;
  --line: #e6e7e2;
  --bg: #f6f5f1;
  --card: #ffffff;
  --brand: #0f5c5c;
  --brand-2: #14706f;
  --brand-soft: #e6f1ef;
  --gold: #b08a3e;
  --gold-soft: #f7f0df;
  --danger: #b0442f;
  --danger-soft: #fbeee9;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(27, 31, 34, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 16px calc(92px + env(safe-area-inset-bottom));
}

.app--plain { padding-bottom: 24px; }

/* ---------- 顶部 ---------- */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0 14px;
}

.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .02em; }

h1 { font-size: 24px; line-height: 1.3; margin: 4px 0 0; font-weight: 650; }
h2 { font-size: 17px; margin: 0 0 10px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; color: var(--ink-2); }

.avatar {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.card--flat { box-shadow: none; border: 1px solid var(--line); }
.card--brand { background: linear-gradient(150deg, #0f5c5c 0%, #14706f 60%, #1a807c 100%); color: #fff; }
.card--brand .eyebrow, .card--brand .muted { color: rgba(255, 255, 255, .72); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.gold { color: var(--gold); }
.spacer { flex: 1; }

/* ---------- 今日任务 ---------- */
.task-count { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 12px; }
.task-count strong { font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -.02em; }
.task-count span { color: rgba(255, 255, 255, .74); font-size: 15px; }

.dots { display: flex; gap: 8px; margin-bottom: 14px; }
.dot {
  width: 34px; height: 6px; border-radius: 99px;
  background: rgba(255, 255, 255, .28);
}
.dot--done { background: #f2d9a6; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  border: 0; border-radius: 13px;
  padding: 14px 16px;
  font-size: 16px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .06s ease, opacity .15s ease;
}
.btn:active { transform: scale(.985); }
.btn--primary { background: #fff; color: var(--brand); }
.btn--solid { background: var(--brand); color: #fff; }
.btn--ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn--soft { background: var(--brand-soft); color: var(--brand); }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; }

/* ---------- 专项入口 ---------- */
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
  cursor: pointer;
}

/* ---------- 待练项 ---------- */
.weak-list { display: flex; flex-direction: column; gap: 0; }

/* 待练项：上行「名称 + 得分 + 短进度条」，下行说明独占整行、不限行数 */
.weak-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.weak-item:first-child { border-top: 0; padding-top: 0; }
.weak-head { display: flex; align-items: center; gap: 8px; }
.weak-name { flex: 1; min-width: 0; font-size: 14px; }
.weak-score {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.weak-bar { flex: 0 0 64px; width: 64px; height: 4px; border-radius: 99px; background: #eef0ec; overflow: hidden; }
.weak-hint {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
  word-break: break-word;
}
.weak-hint-label {
  display: inline-block;
  margin-right: 4px;
  font-size: 12px;
  color: var(--muted);
}
.weak-bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.tag--gold { background: var(--gold-soft); color: #8a6a24; }
.tag--danger { background: var(--danger-soft); color: var(--danger); }
.tag--muted { background: #f0f1ee; color: var(--muted); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.tabbar a {
  flex: 1; max-width: 160px;
  text-align: center;
  padding: 9px 0;
  border-radius: 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.tabbar a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
body.no-tabbar .tabbar { display: none; }
body.no-tabbar .app { padding-bottom: 24px; }

/* ---------- 对练页 ---------- */
.practice-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 10px; gap: 10px;
}
.practice-meta { font-size: 12px; color: var(--muted); }
.practice-meta b { color: var(--ink); font-size: 14px; }

.chat { display: flex; flex-direction: column; gap: 12px; padding: 6px 0 108px; }
.bubble { max-width: 84%; padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.55; }
.bubble--customer { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; align-self: flex-start; }
.bubble--employee { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
.bubble time { display: block; margin-top: 4px; font-size: 10.5px; opacity: .55; }

.talk {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.talk__inner { max-width: 520px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.talk input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 15px; font-family: inherit;
  background: #fff;
}
.talk input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.talk .send { flex: 0 0 auto; width: auto; padding: 13px 18px; }

.mic {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  border: 0; flex: 0 0 56px;
}
.mic[disabled] { background: #c9cec9; color: #fff; }

/* 员工端只有「按住说话」；文字输入仅在 ?admin=1 调试通道出现 */
.talk--voice .talk__inner { flex-direction: column; gap: 8px; }
.mic--big {
  width: 84px; height: 84px; flex: 0 0 84px;
  font-size: 13px; line-height: 1.35;
  box-shadow: 0 10px 24px rgba(15, 92, 92, .24);
}
.mic--big:active { transform: scale(.97); }
.mic-hint { text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- 报告页 ---------- */
.score-hero { text-align: left; }
.score-hero__num { display: flex; align-items: baseline; gap: 8px; }
.score-hero__num strong { font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -.03em; }
.score-hero__num span { font-size: 15px; color: rgba(255, 255, 255, .7); }

.ending-line {
  margin-top: 12px; padding: 11px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .12);
  font-size: 13.5px;
  line-height: 1.5;
}

.steps { display: flex; flex-direction: column; gap: 9px; }
.step-row { display: grid; grid-template-columns: 86px 1fr 42px; gap: 10px; align-items: center; font-size: 12.5px; }
.step-bar { height: 7px; border-radius: 99px; background: #eef0ec; overflow: hidden; }
.step-bar i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.step-bar i.warn { background: var(--gold); }

.list-plain { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.list-plain li { font-size: 14px; line-height: 1.55; }
.quote { color: var(--ink); font-weight: 500; }
.quote::before { content: "「"; color: var(--muted); }
.quote::after { content: "」"; color: var(--muted); }
.why { color: var(--muted); font-size: 13px; }

/* 26 项明细 */
.items-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.seg { display: inline-flex; background: #f0f1ee; border-radius: 9px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 6px 11px;
  border-radius: 7px; font-size: 12px; color: var(--muted);
  font-family: inherit; cursor: pointer;
}
.seg button.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

.item {
  border-top: 1px solid var(--line);
  padding: 11px 0;
}
.item:first-child { border-top: 0; }
.item__head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.item__code { color: var(--muted); font-size: 11.5px; width: 38px; flex: 0 0 38px; }
.item__name { flex: 1; font-size: 14px; font-weight: 500; }
.item__score { font-size: 13px; font-variant-numeric: tabular-nums; }
.item__score b { font-size: 15px; }
.item__body {
  display: none;
  padding: 8px 0 2px 48px;
  font-size: 12.5px; color: var(--ink-2);
}
.item.open .item__body { display: block; }
.item__body p { margin: 4px 0; }
.item__label { color: var(--muted); }
.item--zero .item__name { color: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 26px 0; font-size: 13.5px; }

/* ---------- 记录页 ---------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 108px; padding-top: 8px; }
.chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart__bar { width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; background: var(--brand-soft); position: relative; }
.chart__bar i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 7px 7px 3px 3px; background: var(--brand); }
.chart__label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* 推荐卡片：纵向排，说明不被按钮挤压 */
.rec-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.rec-card:first-child { border-top: 0; padding-top: 2px; }
.rec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-reason { color: var(--ink-2); line-height: 1.55; word-break: break-word; }
.rec-btn { align-self: flex-end; }

.history { display: flex; flex-direction: column; }
.history__row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.history__row:first-child { border-top: 0; }
.history__score { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; width: 62px; }
.history__meta { flex: 1; font-size: 12.5px; color: var(--muted); }
.history__meta b { display: block; color: var(--ink); font-size: 13.5px; font-weight: 550; }

.footer-note { text-align: center; color: var(--muted); font-size: 12.5px; padding: 10px 0 0; }

/* ---------- 准备页 ---------- */
.prepare-title { font-size: 20px; font-weight: 650; margin: 4px 0 6px; }
.prepare-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.prepare-rules li { display: flex; gap: 10px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.prepare-rules b {
  flex: 0 0 20px;
  color: var(--brand);
  font-weight: 650;
}
.privacy-note {
  background: var(--brand-soft);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 13px;
  color: var(--brand);
  line-height: 1.5;
}

/* ---------- 管理员调试标识 ---------- */
.admin-badge {
  display: inline-flex; align-items: center;
  margin: 0 0 10px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #fff3d6; color: #7a5a12;
  border: 1px solid #f0dca6;
  font-size: 12.5px; font-weight: 600;
}

/* ---------- 加载与错误 ---------- */
.loading { text-align: center; color: var(--muted); padding: 48px 0; font-size: 14px; }
.error-block { text-align: center; padding: 32px 18px; }
.error-block p { color: var(--danger); font-size: 14px; margin: 0 0 14px; line-height: 1.5; }

/* ---------- 专项入口：窄屏改 2×2 ---------- */
@media (max-width: 430px) {
  .chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }
  .chip {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.35;
    padding: 8px 10px;
  }
}

/* ---------- 小屏（iPhone SE 320px）---------- */
@media (max-width: 360px) {
  .app { padding-left: 14px; padding-right: 14px; }
  .topbar { padding-top: 18px; }
  h1 { font-size: 22px; }
  .step-row { grid-template-columns: 74px 1fr 38px; font-size: 12px; gap: 8px; }
  .item__code { width: 32px; flex-basis: 32px; font-size: 11px; }
  .item__name { font-size: 14px; }
  .item__score { font-size: 12px; }
  .item__score b { font-size: 14px; }
  .item__head .tag { font-size: 10px; padding: 2px 6px; }
  .item__body { padding-left: 0; }
  .bubble { max-width: 90%; }
  .score-hero__num strong { font-size: 48px; }
}
