:root {
  --primary: #c9704f;
  --primary-dark: #a9573b;
  --primary-soft: #fbeee9;
  --bg: #f7f4f1;
  --card: #ffffff;
  --text: #1f2329;
  --text-2: #8a9099;
  --line: #eef0f3;
  --danger: #ff5b5b;
  --tabbar-h: 56px;
  --topbar-h: 48px;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(201, 112, 79, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* 禁止整页下拉刷新 / 橡皮筋效果（微信公众号内浏览器） */
  overscroll-behavior: none;
}

/* 弹层打开时锁定背景滚动，避免穿透与误触刷新 */
body.sheet-open { overflow: hidden; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: linear-gradient(135deg, var(--primary), #dd9270);
  color: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.topbar-inner {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.brand-sub {
  font-size: 12px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.22);
  border-radius: 20px;
}

/* ---------- 内容区 ---------- */
.content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { display: none; padding: 14px 14px 24px; }
.page.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity:1; transform:none;} }

/* ---------- 主视觉 ---------- */
.hero { margin-bottom: 16px; }
.hero-banner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  line-height: 0;
}
.hero-img { width: 100%; display: block; }
.hero-tip {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-2);
  padding: 0 4px;
}

/* ---------- 区块标题 ---------- */
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 18px 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title::before {
  content: "";
  width: 4px; height: 14px;
  background: var(--primary);
  border-radius: 3px;
}

/* ---------- 核心数据卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* ---------- 团队列表 ---------- */
.team-list { display: flex; flex-direction: column; gap: 10px; }
.team-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.team-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.team-info { flex: 1; }
.team-name { font-weight: 600; }
.team-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.team-badge {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ---------- 课程推荐 ---------- */
.promo-list { display: flex; flex-direction: column; gap: 10px; }
.promo-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.promo-emoji { font-size: 26px; }
.promo-body { flex: 1; }
.promo-name { font-weight: 600; }
.promo-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.promo-go { font-size: 13px; color: var(--primary); }

.footer-note {
  text-align: center;
  color: var(--text-2);
  font-size: 12px;
  margin-top: 22px;
}

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2);
}
.empty-icon { font-size: 44px; }
.empty-text { margin: 14px 0 18px; font-size: 14px; }

/* ---------- 成员 / 店铺列表 ---------- */
.person-list, .store-list { display: flex; flex-direction: column; gap: 10px; }
.person-item, .store-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.person-item:active, .store-item:active { background: #fafafa; }
.person-code {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.item-main { flex: 1; }
.item-title { font-weight: 600; }
.item-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.item-edit { font-size: 13px; color: var(--primary); }

.store-toolbar { margin-bottom: 10px; }

/* ---------- 按钮 ---------- */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary {
  background: #f1f3f5;
  color: var(--text-2);
  border: none;
  border-radius: 24px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:active { background: #e3e6e9; }
.btn-ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 24px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
}
.btn-logout {
  width: 100%;
  margin-top: 22px;
  background: #fff;
  color: var(--danger);
  border: 1px solid #ffd9d9;
  border-radius: var(--radius);
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- 我的：登录/资料 ---------- */
.auth-card, .profile-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-avatar, .profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  margin: 0 auto 12px;
}
.auth-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.field { margin-bottom: 12px; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  background: #fafbfc;
}
.field input:focus { border-color: var(--primary); background: #fff; }
.auth-row { display: flex; gap: 10px; margin-top: 6px; }
.auth-row .btn-primary { flex: 1; }
.auth-row .btn-ghost { flex: 1; }
.auth-msg { font-size: 13px; color: var(--danger); margin-top: 12px; min-height: 18px; }

.profile-name { font-size: 19px; font-weight: 700; }
.profile-phone { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.profile-tag {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 12px;
  border-radius: 20px;
}
.menu-list {
  background: var(--card);
  border-radius: var(--radius);
  margin-top: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.menu-item:last-child { border-bottom: none; }
.menu-arrow { color: var(--text-2); }
.menu-value { color: var(--text-2); font-size: 13px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 30;
}
.tab {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
}
.tab-icon { width: 24px; height: 24px; }
.tab.active { color: var(--primary); font-weight: 600; }

/* ---------- 弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.sheet-mask.show { display: flex; }
.sheet {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: slideUp .25s ease;
  /* 限高并让表单区内部滚动，标题与保存按钮固定可见 */
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 12px);
  overflow: hidden;
}
@keyframes slideUp { from { transform: translateY(100%);} to { transform:none;} }
.sheet-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 16px; font-weight: 700; margin-bottom: 14px;
  flex: 0 0 auto;
}
.sheet-close { border: none; background: none; font-size: 18px; color: var(--text-2); cursor: pointer; }
.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.sheet-foot { margin-top: 16px; flex: 0 0 auto; display: flex; gap: 12px; }
.sheet-foot .btn-primary { flex: 1; }
.sheet-foot .btn-secondary { flex: 1; }
.sheet-field label { font-size: 13px; color: var(--text-2); display: block; margin-bottom: 6px; }
.sheet-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
  background: #fafbfc;
}
.sheet-field input:focus { border-color: var(--primary); background: #fff; }
.sheet-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
  background: #fafbfc;
  color: var(--text);
}
.sheet-del { color: var(--danger); font-size: 14px; text-align: center; margin-top: 6px; cursor: pointer; }

/* ---------- 标签筛选栏 ---------- */
.tagbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px 10px;
}
.tagchip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tagchip:active { background: #f5f5f5; }
.tagchip.active { color: #fff; border-color: transparent; }
.tagchip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- 工具栏 ---------- */
.store-toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.btn-ghost-line { border-style: dashed; }

/* ---------- 联系人列表 ---------- */
.contact-list { display: flex; flex-direction: column; gap: 10px; }
.contact-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.contact-card:active { background: #fafafa; }
.contact-top { display: flex; align-items: center; gap: 10px; }
.contact-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.contact-main { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; }
.contact-sub { font-size: 12px; color: var(--text-2); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ctag {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 12px;
  color: #fff;
  line-height: 1.6;
}

/* ---------- 弹层：标签选择 ---------- */
.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pick-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.tag-pick-item.sel { color: #fff; border-color: transparent; }
.tag-pick-item .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- 弹层：标签管理 ---------- */
.tag-manage-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}
.tag-manage-item:last-child { border-bottom: none; }
.tag-manage-name { flex: 1; display: flex; align-items: center; gap: 8px; }
.tag-manage-name .dot { width: 10px; height: 10px; border-radius: 50%; }
.tag-manage-del { color: var(--danger); font-size: 13px; cursor: pointer; }
.tag-manage-del.disabled { color: var(--text-2); opacity: .5; cursor: not-allowed; }
.sheet-color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-dot {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
}
.color-dot.sel { border-color: #1f2329; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; }

/* ---------- 管理子切换 ---------- */
.subtabs {
  display: flex;
  background: #eef1f3;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 12px;
}
.subtab {
  flex: 1;
  border: none;
  background: none;
  padding: 9px 0;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.subtab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- 日志设置 ---------- */
.log-settings {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  background: #f6f8f9;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.log-settings input[type=number] {
  width: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 6px;
  text-align: center;
  font-size: 14px;
}
.btn-mini { padding: 6px 12px; font-size: 13px; margin-left: auto; }
#logContactFilter {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- 日志列表 ---------- */
.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.log-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.log-name { font-weight: 700; font-size: 15px; }
.log-date { font-size: 12px; color: var(--text-2); }
.log-next {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  color: #fff;
  background: var(--danger);
  border-radius: 8px;
  padding: 2px 7px;
  vertical-align: middle;
}
.log-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.log-del {
  margin-top: 10px;
  font-size: 13px;
  color: var(--danger);
  cursor: pointer;
  text-align: right;
}

/* ---------- 翻页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}
.pager-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager-info { font-size: 13px; color: var(--text-2); }

/* ---------- 首页提醒卡片 ---------- */
.remind-card {
  background: linear-gradient(135deg, #fff4f3, #fff);
  border: 1px solid #ffd9d4;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 4px;
}
.remind-summary {
  font-size: 13px;
  color: var(--danger);
  font-weight: 600;
  margin-bottom: 10px;
}
.remind-list { display: flex; flex-direction: column; gap: 8px; }
.remind-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
}
.remind-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px; flex: 0 0 auto;
  background: #eb5757;
}
.remind-dot.due { background: #eb5757; }
.remind-dot.overdue { background: #f2994a; }
.remind-body { flex: 1; min-width: 0; }
.remind-text { font-size: 14px; font-weight: 600; }
.remind-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ---------- 弹层 textarea ---------- */
.sheet-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  min-height: 88px;
  box-sizing: border-box;
}

/* ---------- 课程日历 ---------- */
.cycle-card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.cycle-head { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.cycle-head .cycle-chip { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.cycle-head .cycle-sub { font-size: 12px; font-weight: 400; color: var(--text-2); }
.cycle-month-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text-1); }
.cycle-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cycle-cell { aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; font-size: 13px; border-radius: 8px; color: #333; }
.cycle-cell.wd { font-size: 12px; color: var(--text-2); background: transparent; aspect-ratio: auto; padding: 2px 0; }
.cycle-cell.today { outline: 2px solid var(--primary); outline-offset: -2px; font-weight: 700; }
.cycle-cell.muted { color: #c4c8cd; }
.cycle-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.cycle-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 4px; vertical-align: -1px; }

/* ---------- 续卡徽标 ---------- */
.renew-badge { display: inline-block; font-size: 11px; color: #b8430b; background: #fff1e6; border: 1px solid #ffd2b0; border-radius: 999px; padding: 1px 8px; margin-left: 6px; }

/* ---------- 我的页开关 ---------- */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: #d7dbe0; border-radius: 999px; transition: .2s; }
.switch .slider:before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 弹层内勾选行 */
.sheet-check { flex-direction: row; align-items: center; }
.sheet-check .check { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.sheet-check .check input { width: 18px; height: 18px; }

/* ==================== AI 助理 ==================== */
/* 快捷指令 */
.ai-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ai-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 20px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.ai-chip:active { background: var(--primary-soft); border-color: var(--primary); }

/* 折叠卡片（知识库 / 案例） */
.ai-fold {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.ai-fold-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
}
.ai-fold-arrow { color: var(--text-2); font-size: 12px; transition: transform .2s; }
.ai-fold-body { padding: 0 14px 14px; border-top: 1px solid var(--line); padding-top: 12px; }

/* 知识库 */
.kb-search { display: flex; gap: 8px; margin-bottom: 10px; }
.kb-search input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  background: #fafbfc;
  min-width: 0;
}
.kb-search input:focus { border-color: var(--primary); background: #fff; }
.kb-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.kb-path { font-size: 12px; color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kb-crumb { cursor: pointer; color: var(--primary); }
.kb-crumb.cur { color: var(--text-2); cursor: default; }
.kb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.kb-item:last-child { border-bottom: none; }
.kb-item:active { background: #fafafa; }
.kb-ico { font-size: 18px; flex: 0 0 auto; }
.kb-name { flex: 1; font-size: 14px; word-break: break-all; }
.kb-go { color: var(--text-2); font-size: 16px; }
.kb-back {
  border: 1px dashed var(--line);
  background: #fff; color: var(--primary);
  border-radius: 8px; padding: 7px 12px;
  font-size: 13px; cursor: pointer;
  margin-bottom: 8px; width: 100%;
}
.kb-cache-tip { text-align: center; font-size: 11px; color: #b8bec6; padding: 8px 0 2px; }
.kb-file-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.kb-file-title { font-size: 14px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kb-file-text {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  max-height: 46vh;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-family: inherit;
}

/* 案例 */
.case-card {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 10px;
}
.case-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.case-title { font-size: 14px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-date { font-size: 11px; color: var(--text-2); flex: 0 0 auto; }
.case-content {
  font-size: 13px; color: var(--text-2);
  margin-top: 6px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.case-ops { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; color: var(--primary); }
.case-ops span[data-act="del"] { color: var(--danger); }

/* 对话区 */
.ai-chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - 190px);
  min-height: 260px;
}
#aiMessages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 2px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-msg { display: flex; flex-direction: column; }
.ai-msg.user { align-items: flex-end; }
.ai-msg.ai { align-items: flex-start; }
.ai-bubble {
  max-width: 88%;
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}
.ai-msg.user .ai-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg.ai .ai-bubble {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-bottom-left-radius: 4px;
}
.ai-typing { color: var(--text-2); font-size: 13px; }
.ai-msg.ai .ai-bubble .ai-h2 { font-size: 15px; font-weight: 800; margin: 8px 0 4px; }
.ai-msg.ai .ai-bubble .ai-h3 { font-size: 14px; font-weight: 700; margin: 6px 0 3px; }
.ai-msg.ai .ai-bubble .ai-li { margin: 3px 0; }
.ai-msg.ai .ai-bubble .ai-quote {
  border-left: 3px solid var(--primary);
  padding: 4px 10px;
  margin: 6px 0;
  background: var(--primary-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text);
}
.ai-msg.ai .ai-bubble .ai-hr { border-top: 1px solid var(--line); margin: 8px 0; }
.ai-msg.ai .ai-bubble b { font-weight: 700; }

.ai-composer {
  display: flex; gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.ai-composer input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  background: #fafbfc;
  min-width: 0;
}
.ai-composer input:focus { border-color: var(--primary); background: #fff; }
.ai-send { flex: 0 0 auto; border-radius: 22px; }

/* 草稿确认卡 */
.ai-draft-card {
  margin: 8px 2px 2px 14px;
  background: #fffdf4;
  border: 1px solid #f0e3b8;
  border-radius: 12px;
  padding: 11px 12px;
  max-width: 88%;
}
.ai-msg.user + .ai-draft-card { margin-left: 2px; }
.ai-draft-title { font-size: 13px; font-weight: 800; color: #b8860b; margin-bottom: 7px; }
.ai-draft-row { font-size: 13px; color: var(--text); margin-bottom: 5px; line-height: 1.55; }
.ai-draft-row b { color: var(--primary); }
.ai-draft-content { color: var(--text-2); }
.ai-draft-btns { display: flex; gap: 10px; margin-top: 9px; }
.ai-draft-ok { color: var(--primary); font-size: 13px; font-weight: 700; }
.ai-draft-card.done { opacity: .75; background: #f4fbf7; border-color: #cdeedd; }
.ai-pending-banner .ai-bubble { border-color: #f0e3b8; background: #fffdf4; }

/* ==================== 知识库文件预览 ==================== */
.kb-file-ops { display: flex; gap: 6px; flex: 0 0 auto; }
.kb-preview { margin-top: 8px; }
.preview-loading, .preview-err {
  background: #fafbfc; border: 1px dashed var(--line);
  border-radius: 10px; padding: 18px 12px;
  text-align: center; font-size: 13px; color: var(--text-2);
}
.preview-err { color: var(--danger); line-height: 2; }
.kb-media { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: #fff; display: block; }
.kb-audio { width: 100%; margin: 8px 0; }

/* PPT 相册 */
.ppt-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 8px; }
.ppt-count { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ppt-slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  background: #20242b;
}
.ppt-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex; align-items: center; justify-content: center;
  min-height: 42vh;
}
.ppt-slide img { width: 100%; max-height: 72vh; object-fit: contain; display: block; }

/* PDF */
.pdf-view { background: #20242b; border-radius: 10px; padding: 10px 0; display: flex; justify-content: center; overflow-x: auto; }
.pdf-view canvas { max-width: 100%; height: auto; box-shadow: 0 2px 14px rgba(0,0,0,.4); }

/* Word */
.docx-view { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: #1f2329; }
.docx-view p { margin: 6px 0; }
.docx-view table { border-collapse: collapse; width: 100%; }
.docx-view td, .docx-view th { border: 1px solid #d9dde3; padding: 4px 6px; font-size: 12px; }
.docx-view img { max-width: 100%; }

/* Excel */
.xlsx-view { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; overflow-x: auto; }
.xlsx-view table { border-collapse: collapse; font-size: 12px; }
.xlsx-view td, .xlsx-view th { border: 1px solid #d9dde3; padding: 5px 8px; white-space: nowrap; }
.xlsx-view th { background: var(--primary-soft); font-weight: 700; }

/* Markdown */
.md-view { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.75; color: #1f2329; }
.md-view h1, .md-view h2, .md-view h3 { font-weight: 700; margin: 12px 0 6px; }
.md-view h1 { font-size: 17px; } .md-view h2 { font-size: 16px; } .md-view h3 { font-size: 15px; }
.md-view p { margin: 6px 0; }
.md-view ul, .md-view ol { margin: 6px 0; padding-left: 22px; }
.md-view li { margin: 3px 0; }
.md-view code { background: #f2f4f7; border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.md-view pre { background: #f2f4f7; border-radius: 8px; padding: 10px; overflow-x: auto; }
.md-view pre code { background: none; padding: 0; }
.md-view table { border-collapse: collapse; width: 100%; }
.md-view td, .md-view th { border: 1px solid #d9dde3; padding: 4px 6px; font-size: 12px; }
.md-view blockquote { border-left: 3px solid var(--primary); margin: 8px 0; padding: 4px 10px; background: var(--primary-soft); border-radius: 0 8px 8px 0; }
.md-view a { color: var(--primary); }

/* 网页外链卡片 */
.web-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: center; }
.web-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.web-url { font-size: 12px; color: var(--text-2); word-break: break-all; margin-bottom: 12px; }
.ppt-slide-err {
  width: 100%; text-align: center; color: #aeb4bf; font-size: 13px; padding: 40px 10px;
}

/* 点击列表项后滚动到预览区时，避开顶部栏 */
#kbFile { scroll-margin-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 14px); }
/* 加载转圈 */
.preview-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px;
}
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 知识库文档全屏浏览页（ima 式） ==================== */
.doc-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.doc-viewer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.doc-viewer-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1f2329;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-viewer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 10px calc(env(safe-area-inset-bottom, 0px) + 12px);
}
.doc-viewer-body .preview-loading { padding-top: 26vh; }
.doc-viewer-body .preview-err { margin-top: 20vh; }

/* ==================== 诊断配方 + 产品目录 ==================== */
.diag-tip {
  font-size: 12px; color: var(--text-2); line-height: 1.6;
  background: var(--primary-soft); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
}
#diagText {
  width: 100%; min-height: 110px; max-height: 240px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 13px; line-height: 1.6; color: #1f2329;
  resize: vertical; box-sizing: border-box;
  font-family: inherit;
}
.diag-btns { display: flex; gap: 8px; margin-top: 8px; }

/* 产品目录管理 */
.prod-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 0 6px;
}
.prod-title { font-size: 15px; font-weight: 700; }
.prod-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px;
}
.prod-card.prod-off { opacity: .55; }
.prod-main { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.prod-name { font-size: 14px; font-weight: 600; color: #1f2329; }
.prod-meta { font-size: 12px; color: var(--primary); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.prod-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 知识库加载中转圈 */
.kb-loading {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 36px 20px 30px;
}
.kb-loading-tip {
  font-size: 12px; color: var(--text-2);
  text-align: center; line-height: 1.7;
}

/* 本地 wiki 同步状态 */
.wiki-status {
  font-size: 12px; color: var(--text-2); line-height: 1.6;
  background: var(--primary-soft); border-radius: 8px;
  padding: 7px 10px; margin: 6px 0;
}
.wiki-status.running { display: flex; align-items: center; gap: 8px; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; flex: 0 0 auto; }

/* ---------- 课程日历：有课日 & 当日课程 ---------- */
.cycle-cell.has-class { background: #f6ded4; color: #8f4527; font-weight: 600; position: relative; }
.cycle-cell.has-class::after {
  content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--primary);
}
.cycle-cell.today.has-class { outline: 2px solid var(--primary); background: #f3d3c6; }
.day-classes { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; display: none; }
.day-classes.show { display: block; }
.day-class-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; display: flex; justify-content: space-between; }
.day-class-title span { color: var(--text-2); font-weight: 400; font-size: 12px; }
.day-class-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  background: #faf7f4; border: 1px solid #f1e6df; border-radius: 10px; margin-bottom: 7px;
}
.day-class-time { font-size: 13px; font-weight: 700; color: var(--primary); flex: 0 0 auto; min-width: 44px; }
.day-class-name { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.day-class-teacher { font-size: 12px; color: var(--text-2); flex: 0 0 auto; }
.day-class-empty { font-size: 13px; color: var(--text-2); text-align: center; padding: 6px 0 2px; }

/* ---------- 续卡提醒卡片 ---------- */
.remind-card.renew-card { background: linear-gradient(135deg, #fff8ec, #fff); border: 1px solid #ffe6c4; }
.remind-card.renew-card .remind-summary { color: #c07a12; }
.remind-card.renew-card .remind-dot { background: #f2994a; }
.remind-dot.renew { background: #f2994a; }
