:root {
  --red: #e60000;
  --red-soft: #fdeaea;
  --gold: #e6b422;
  --gold-soft: #fbf3da;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #6b7280;
  --border: #eceef1;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- Topbar ---------- */
.topbar {
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px;
  background: var(--red);
  color: #fff;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 16px; }
.brand-sub { font-size: 11px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.beta-tag {
  font-size: 11px; color: var(--gold);
  background: var(--gold-soft);
  padding: 3px 9px; border-radius: 20px;
}
.account-btn {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: #fff;
  border-radius: 20px; padding: 4px 10px 4px 4px; cursor: pointer;
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: grid; place-items: center; font-size: 13px;
}
.account-name { font-size: 13px; }

/* ---------- Layout ---------- */
.app { display: flex; height: calc(100vh - 56px); }
.sidebar {
  width: 220px; background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  justify-content: space-between;
  padding: 14px 12px;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent;
  text-align: left; padding: 11px 12px;
  border-radius: 9px; cursor: pointer;
  font-size: 14px; color: var(--text);
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--red-soft); color: var(--red); font-weight: 600; }
.nav-ico { font-size: 13px; width: 16px; text-align: center; }
.sidebar-foot { padding: 12px 8px 4px; }
.pipeline-mini {
  display: flex; flex-wrap: wrap; gap: 4px;
  font-size: 10px; color: var(--muted);
}
.pipeline-mini span {
  background: var(--bg); border-radius: 5px;
  padding: 2px 6px;
}

.view { flex: 1; overflow-y: auto; padding: 24px 28px; }

/* ---------- Page head ---------- */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; margin-bottom: 6px; }
.card .meta { color: var(--muted); font-size: 12px; }
.card .tag {
  display: inline-block; font-size: 11px;
  background: var(--gold-soft); color: #8a6500;
  padding: 2px 8px; border-radius: 20px; margin-top: 8px;
}
.card.clickable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.card.clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }

/* ---------- Agent chat ---------- */
.agent-wrap {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px - 48px);
  max-width: 860px; margin: 0 auto;
}
.agent-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 14px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.agent-avatar {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--red); color: #fff;
  display: grid; place-items: center; font-size: 20px;
}
.agent-head h2 { font-size: 17px; }
.agent-head p { font-size: 12px; color: var(--muted); }
.chat {
  flex: 1; overflow-y: auto; padding: 8px 4px;
  display: flex; flex-direction: column; gap: 14px;
}
.msg { display: flex; gap: 10px; max-width: 86%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.bubble {
  padding: 11px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.65; white-space: pre-wrap;
}
.msg.bot .bubble {
  background: var(--card); border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.msg.user .bubble {
  background: var(--red); color: #fff;
  border-top-right-radius: 4px;
}
.bubble b { color: var(--red); }
.msg.user .bubble b { color: #fff; }
.bubble ul { margin: 6px 0 0 18px; }
.bubble li { margin: 3px 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; }
.chip {
  border: 1px solid var(--border); background: #fff;
  border-radius: 20px; padding: 7px 13px;
  font-size: 13px; cursor: pointer; color: var(--text);
}
.chip:hover { border-color: var(--red); color: var(--red); }
.composer {
  display: flex; gap: 10px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.composer textarea {
  flex: 1; resize: none; height: 46px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; font-size: 14px; font-family: inherit;
  outline: none;
}
.composer textarea:focus { border-color: var(--red); }
.send-btn {
  background: var(--red); color: #fff; border: none;
  border-radius: 10px; padding: 0 20px; font-size: 14px;
  cursor: pointer; font-weight: 600;
}
.send-btn:disabled { opacity: .5; cursor: default; }

/* ---------- Progress / list ---------- */
.progress-bar { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; margin-top: 10px; }
.progress-bar > i { display: block; height: 100%; background: var(--red); border-radius: 6px; }
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row .lr-title { font-size: 14px; }
.list-row .lr-sub { font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.badge.done { background: #e7f6ec; color: #1f8a3b; }
.badge.lock { background: var(--bg); color: var(--muted); }
.badge.hot { background: var(--red-soft); color: var(--red); }

.kpi-row { display: flex; gap: 16px; }
.kpi { flex: 1; }
.kpi .num { font-size: 26px; font-weight: 700; color: var(--red); }
.kpi .lbl { font-size: 12px; color: var(--muted); }

.empty-hint {
  text-align: center; color: var(--muted);
  padding: 40px 0; font-size: 13px;
}
.section-title { font-size: 15px; font-weight: 600; margin: 22px 0 12px; }
.placeholder-note {
  font-size: 12px; color: var(--muted);
  background: var(--gold-soft); border-radius: 8px;
  padding: 8px 12px; margin-top: 10px;
}

/* ---------- 移动端适配（≤768px，手机优先） ---------- */
@media (max-width: 768px) {
  .topbar { padding: 0 14px; }
  .topbar .beta-tag,
  .brand-sub,
  .account-name { display: none; }

  .app { display: block; height: auto; }
  .view {
    height: calc(100vh - 56px);
    padding: 14px 14px 84px;   /* 底部留出标签栏空间 */
  }

  /* 侧边栏 → 固定底部标签栏 */
  .sidebar {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 6px 2px;
    z-index: 30;
    background: var(--card);
  }
  .sidebar .nav {
    flex-direction: row;
    justify-content: space-around;
    gap: 0;
    flex: 1;
  }
  .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 6px 2px;
    font-size: 10px;
    justify-content: center;
    align-items: center;
    border-radius: 0;
  }
  .nav-ico { font-size: 18px; width: auto; }
  .nav-item.active { background: transparent; color: var(--red); }
  .sidebar-foot { display: none; }

  /* 网格统一单列 */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  /* Agent 对话页占满可视区 */
  .agent-wrap { height: calc(100vh - 154px); }
  .agent-head h2 { font-size: 15px; }
  .agent-head p { font-size: 11px; }
  .chips .chip { font-size: 12px; padding: 6px 10px; }

  .kpi-row { flex-wrap: wrap; }
  .kpi { min-width: 42%; }

  /* 课程详情弹窗：手机上贴底占满 */
  .course-mask { padding: 0; align-items: flex-end; }
  .course-modal { max-width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; }
}

/* ===== 课程详情 / 播放弹窗 ===== */
.course-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto;
}
.course-modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 720px;
  max-height: 88vh; overflow: auto; box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
}
/* 移动端：登录弹窗 */
.modal-box { width: 92vw; padding: 22px 18px; }
.auth-tab { font-size: 14px; }
.cm-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 16px 18px 12px; border-bottom: 1px solid #f0f0f0;
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.cm-head h2 { color: var(--red); }
.cm-close {
  border: none; background: #f2f3f5; color: #666; font-size: 22px; line-height: 1;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; flex-shrink: 0;
}
.cm-close:hover { background: var(--gold-soft); color: var(--red); }
.cm-body { padding: 16px 18px 22px; }
.course-card { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.course-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .1); }

/* ===== 登录/注册 弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.modal-box {
  margin: auto; background: #fff; border-radius: 14px; width: 380px; max-width: 92vw;
  max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 28px 24px 22px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 24px; color: #999; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: #333; }
.auth-tabs {
  display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #f0f0f0;
}
.auth-tab {
  flex: 1; text-align: center; padding: 10px 0; font-size: 15px; font-weight: 600;
  background: none; border: none; cursor: pointer; color: #999; transition: color .2s;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.auth-tab.active { color: var(--red); border-bottom-color: var(--red); }
/* 登录子标签（密码/验证码切换） */
.auth-sub-tab { cursor: pointer; transition: all .2s; font-weight: 500; }
.auth-sub-tab.active { background: #fef0f0 !important; border-color: var(--red) !important; color: var(--red) !important; }
.auth-form input {
  display: block; width: 100%; box-sizing: border-box;
  padding: 11px 13px; margin-bottom: 10px; border: 1.5px solid #ddd;
  border-radius: 8px; font-size: 14px; outline: none; transition: border-color .2s;
}
.auth-form input:focus { border-color: var(--red); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; border-radius: 8px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.btn-block:active { transform: scale(0.98); opacity: 0.85; }
.btn-block:disabled { opacity: 0.5; cursor: not-allowed; }
.field-err { color: var(--red); font-size: 13px; min-height: 22px; margin-top: 6px; font-weight: 500; text-align: center; }
/* 通用按钮 / 表单字段（学员端弹窗复用） */
.btn-red { background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 10px 16px; font-size: 14px; cursor: pointer; }
.btn-red:active { transform: scale(0.98); opacity: 0.85; }

/* 会员升级·微信支付卡片 */
.upgrade-pay-card { background: linear-gradient(135deg, #fff5f5, #fff); border: 1px solid var(--red-soft); border-radius: 12px; padding: 14px; margin: 14px 0; text-align: center; }
.upgrade-pay-card .up-title { font-size: 15px; font-weight: 700; color: var(--red); }
.upgrade-pay-card .up-price { font-size: 26px; font-weight: 800; color: var(--red); margin: 6px 0 12px; }
.upgrade-pay-card .btn-red { font-size: 15px; padding: 12px; }
.fld { margin-bottom: 10px; }
.fld label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.fld input, .fld textarea, .fld select { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; font-family: inherit; }

/* ===== 会员徽章 / 升级 / 卡包（会员中心弹窗 + 课程锁标记） ===== */
.member-badge { display:inline-block; padding:5px 16px; border-radius:20px; font-size:13px; font-weight:600; }
.member-badge.paid { background:linear-gradient(135deg,#e6b422,#f1cf5a); color:#5a3d00; }
.member-badge.free { background:#eef0f3; color:#666; }
.redeem-box { background:var(--bg); border:1px solid var(--border); border-radius:10px; padding:14px; }
.coupon-mini { display:flex; justify-content:space-between; align-items:center; gap:10px; background:#fff; border:1px solid var(--border); border-radius:8px; padding:10px 12px; margin-bottom:8px; }
.coupon-mini .meta { margin-top:2px; }
.coupon-mini b { font-size:14px; }
/* 课程卡片上的权限标记 */
.course-lock { display:inline-block; font-size:11px; padding:2px 8px; border-radius:20px; font-weight:600; }
.course-lock.free { background:var(--gold-soft); color:#8a6500; }
.course-lock.paid { background:var(--red-soft); color:var(--red); }

/* ===== 专栏 Tab 切换 ===== */
.col-tab { padding:8px 18px; border-radius:20px; font-size:14px; font-weight:600; cursor:pointer; white-space:nowrap; border:1.5px solid #ddd; background:#fff; color:#666; transition:all .2s; }
.col-tab.active { background:var(--red); color:#fff; border-color:var(--red); }
.col-tab:hover:not(.active) { border-color:var(--red); color:var(--red); }

/* ===== 后台：会员等级徽章 ===== */
.lvl { display:inline-block; font-size:12px; padding:2px 9px; border-radius:20px; font-weight:600; white-space:nowrap; }
.lvl.paid { background:linear-gradient(135deg,#e6b422,#f1cf5a); color:#5a3d00; }
.lvl.free { background:#eef0f3; color:#666; }
.table .row-actions { gap:4px; }

/* ===== 个人中心 ===== */
.pc-head { display:flex; align-items:center; gap:14px; background:var(--red-soft); border-radius:12px; padding:16px; margin-bottom:14px; }
.pc-avatar { width:48px; height:48px; border-radius:50%; background:var(--red); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; font-size:18px; }
.pc-id { flex:1; min-width:0; }
.pc-name { font-size:16px; font-weight:600; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.pc-stat-row { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:16px; }
.pc-stat { flex:1; min-width:88px; background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:12px 8px; text-align:center; }
.pc-stat-l { font-size:12px; color:#888; }
.pc-stat-v { font-size:18px; font-weight:600; margin-top:4px; color:#222; }
.pc-tabs { display:flex; border-bottom:1px solid var(--border); margin-bottom:14px; overflow-x:auto; }
.pc-tab { flex:1; min-width:56px; padding:10px 4px; border:none; background:none; color:#888; font-size:14px; cursor:pointer; border-bottom:2px solid transparent; white-space:nowrap; }
.pc-tab.active { color:var(--red); border-bottom-color:var(--red); font-weight:600; }
.pc-row { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:0.5px solid #f0f0f0; }
.pc-row:last-child { border-bottom:none; }
.pc-bar { width:64px; height:6px; background:#eee; border-radius:4px; overflow:hidden; flex:none; }
.pc-bar > i { display:block; height:100%; background:var(--red); border-radius:4px; }
.pc-quota { display:flex; justify-content:space-between; align-items:center; background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:14px; margin-bottom:6px; }
.pc-course { border:1px solid var(--border); border-radius:8px; padding:12px; margin-bottom:10px; }
.fld { margin-bottom:12px; text-align:left; }
.fld label { display:block; font-size:13px; color:#666; margin-bottom:5px; }
.fld input { width:100%; padding:10px 12px; border:1.5px solid #ddd; border-radius:8px; font-size:14px; box-sizing:border-box; }
.fld input:focus { border-color:var(--red); outline:none; }
.chap-list { padding:4px 0; }

/* ===== 顶部消息铃铛 ===== */
.bell-btn { position:relative; width:38px; height:38px; border:none; background:transparent; cursor:pointer; display:flex; align-items:center; justify-content:center; border-radius:50%; }
.bell-btn:hover { background:rgba(0,0,0,.05); }
.bell-ico { font-size:20px; line-height:1; }
.bell-badge { position:absolute; top:1px; right:1px; min-width:16px; height:16px; padding:0 4px; background:var(--red); color:#fff; border-radius:9px; font-size:11px; line-height:16px; text-align:center; box-shadow:0 0 0 2px #fff; }

/* ===== 消息通知 ===== */
.ntc-list { max-height:60vh; overflow:auto; }
.ntc-row { cursor:pointer; }
.ntc-row.unread .ntc-dot.on { box-shadow:0 0 0 3px rgba(230,0,0,.12); }
.ntc-dot { transition:background .2s; }
.ntc-row:hover { background:#fafafa; }
