/* ============================================================
   知识库 · 移动端 H5 公共样式（统一设计系统）
   设计基调：简洁、大气、耐看 —— 克制的配色、清晰层级、
   柔和阴影、舒适留白、顺滑的微交互。
   ============================================================ */

:root {
  /* 品牌主色 */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef3ff;
  --primary-softer: #f7f9ff;

  /* 功能色 */
  --success: #16a34a;
  --success-soft: #eaf7ef;
  --cat-row: #1BA784;        /* 业务与规范 · 分类行顶栏底色（同示例分布顶栏，兼作选中标签文字色 --gc） */
  --warning: #d97706;
  --warning-soft: #fdf3e7;
  --danger: #dc2626;
  --danger-soft: #fdecec;

  /* 统一「绿色 hover」配色（顶部导航 / 后台列表「编辑」按钮共用，改这里全站同步） */
  --hv-c: #57BC90;                                /* hover 主色 */
  --hv-shadow: 0 3px 8px rgba(87, 188, 144, .32); /* hover 阴影 */

  /* 中性色 */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text-1: #1f2329;   /* 主文本（近黑） */
  --text-2: #646a73;   /* 次文本 */
  --text-3: #8f959e;   /* 辅助文本 */
  --border: #e5e6eb;
  --border-light: #f0f1f3;
  --divider: #ebedf0;

  /* 圆角 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* 阴影（轻量、分层） */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 6px 20px rgba(16, 24, 40, 0.06);
  --shadow-primary: 0 6px 16px rgba(37, 99, 235, 0.22);

  /* 间距基准 */
  --gap: 12px;
  --card-pad: 14px;      /* 卡片内边距（分类行负边距与其共用，保证齐平） */
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  width: 100%;
  overflow-x: hidden;
}

/* ---------- 布局容器 ---------- */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- 顶部导航 ---------- */
.header {
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-1);
  white-space: nowrap;
}

.header .nav {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.header .nav a {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.header .nav a:active {
  background: var(--primary);
  color: #fff;
}

/* 窄屏（手机）：压缩品牌与导航，保证「知识库 / 大字版 / 首页 / 客服 / 后台 / 退出」同行不换行 */
@media (max-width: 480px) {
  .header { padding: 10px 12px; gap: 8px; }
  .header .brand { gap: 8px; }
  .header h1 { font-size: 17px; letter-spacing: 0; }
  .big-font-btn { padding: 4px 8px; font-size: 12px; }
  .header .nav { gap: 5px; }
  .header .nav a { font-size: 13px; padding: 5px 8px; }
}

/* ---------- 学员信息条 ---------- */
.member-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--primary-softer);
  border-bottom: 1px solid var(--border-light);
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text-2);
}
.member-bar .mb-phone {
  font-weight: 600;
  color: var(--text-1);
}
.member-bar .mb-days {
  color: var(--primary);
  white-space: nowrap;
}
.member-bar.expired {
  background: var(--danger-soft);
}
.member-bar.expired .mb-days {
  color: var(--danger);
}
.member-bar.admin {
  background: var(--warning-soft);
}
.member-bar.admin .mb-days {
  color: var(--warning);
  font-weight: 600;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: var(--gap);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.card-head .card-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.45;
  margin: 0 0 8px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
  margin: 0 0 10px;
}

.card-meta {
  font-size: 12.5px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.card-head .card-meta {
  flex: 0 0 auto;
}
.card-meta span {
  white-space: nowrap;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  margin-top: var(--gap);
  box-shadow: var(--shadow-primary);
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}
.btn:active {
  background: var(--primary-dark);
  transform: translateY(1px);
  box-shadow: none;
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  box-shadow: none;
  cursor: not-allowed;
}

/* ---------- 统一操作反馈：按钮 loading 态 + Toast 提示 ---------- */
.btn.is-loading {
  opacity: 0.75;
  cursor: progress;
}
.btn.is-loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 1000000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  max-width: 80vw;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: rgba(23, 26, 33, 0.92);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.4;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #16a34a; }
.toast.error { background: var(--danger); }

/* ---------- 弹窗（修改密码） ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px 16px;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 14px; font-size: 16px; color: var(--text-1); }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text-2); }
.form-row input {
  width: 100%;
  padding: 11px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-sizing: border-box;
  background: #fff;
}
.form-error { color: #e11d48; font-size: 13px; min-height: 18px; margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { margin-top: 0; }
.btn-primary { background: var(--primary); }
.btn-primary:active { background: var(--primary-dark); }
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 58px; }
.pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 13px;
  line-height: 1;
  padding: 6px 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}
.pwd-toggle:active { opacity: .6; }

.btn.secondary {
  background: #f2f3f5;
  color: var(--text-2);
  box-shadow: none;
}
.btn.secondary:active {
  background: #e6e8eb;
}

.btn.success {
  background: var(--success);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.22);
}
.btn.success:active { background: #15803d; }

.btn.warning {
  background: var(--warning);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.22);
}
.btn.warning:active { background: #b45309; }

.btn.danger {
  background: var(--danger);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.22);
}
.btn.danger:active { background: #b91c1c; }

.btn.small {
  width: auto;
  padding: 7px 14px;
  font-size: 13px;
  margin-top: 0;
  box-shadow: none;
}

/* ---------- 表单 ---------- */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
}
.form-group textarea {
  resize: vertical;
  line-height: 1.6;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
/* 复选/单选框：从上面的文本框样式中排除。
   否则 appearance:none 会抹掉原生勾选标记、width:100%/padding 会把勾选框撑成空白输入框，
   表现为「不可用、点击无响应」。 */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
  width: 18px;
  height: 18px;
  flex: none;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--primary);
  cursor: pointer;
}
.form-group input[type="radio"] { border-radius: 50%; }
.form-group input[type="checkbox"]:focus,
.form-group input[type="radio"]:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
  box-shadow: none;
}
/* 勾选行：复选框 + 说明文字同一行，整行可点 */
.form-group label.check-line,
label.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
label.check-line:hover { color: var(--text-1); }
label.check-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--primary);
  cursor: pointer;
}

.hint {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 6px;
  line-height: 1.5;
}
.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 8px;
}
.success-text {
  color: var(--success);
  font-size: 14px;
  margin-top: 8px;
}

/* ---------- 会员下拉菜单 ---------- */
.user-menu { position:  relative; display: inline-flex; align-items: center; }
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.user-menu-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18);
  color: var(--primary);
}
.user-menu-btn:active { transform: scale(0.94); }
.user-menu-btn svg { width: 21px; height: 21px; display: block; }
.user-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 9px);
  min-width: 0;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 50;
}
/* 指向按钮的小箭头（双层：外边框 + 内填充） */
.user-menu-list::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: -8px;
  right: 18px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 8px solid var(--text-3);
}
.user-menu-list::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: -6px;
  right: 19px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--surface);
}
.user-menu.open .user-menu-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.header .nav .user-menu-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  color: var(--text-1);
  text-decoration: none;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.header .nav .user-menu-list a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
/* 下载离网版不可用（会员剩余有效期 <= 2 天或已过期）：置灰且不可点 */
.header .nav .user-menu-list a.menu-disabled {
  color: var(--text-3);
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.header .nav .user-menu-list a.menu-disabled:hover {
  background: transparent;
  color: var(--text-3);
}

/* ---------- 标签切换（分段控件） ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--gap);
}

.tab-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn:active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---------- 正文富文本 ---------- */
.body-content {
  font-size: 15.5px;
  color: var(--text-1);
  line-height: 1.85;
  word-break: break-word;
}
.body-content p { margin: 0 0 12px; }
.body-content h1, .body-content h2, .body-content h3, .body-content h4 {
  margin: 18px 0 10px;
  line-height: 1.4;
  color: var(--text-1);
}
.body-content ul, .body-content ol {
  padding-left: 22px;
  margin: 0 0 12px;
}
.body-content li { margin-bottom: 6px; }
.body-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 8px 0;
}
.body-content a { color: var(--primary); }
.body-content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 12px 0;
  font-size: 14px;
  table-layout: auto;             /* 默认列宽随内容自适应；设置百分比的表由 inline style="table-layout:fixed" 覆盖，互不干扰 */
}
.body-content th, .body-content td {
  border: 1px solid var(--border) !important;  /* 四边统一描边，避免底边等不显示 */
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: normal;            /* 允许换行（清除编辑器可能写入的 nowrap） */
  word-break: break-word;         /* 中文/长词断行 */
  overflow-wrap: anywhere;        /* 超长无空格串（如网址、编号）也能断行，防止小屏横向溢出 */
}
/* 设置了列百分比的表格：fixed 布局让 col 的百分比生效；未设置的表维持 auto 内容自适应 */
.body-content table.cols-fixed { table-layout: fixed; width: 100%; }

/* ---------- 空状态 / 加载 ---------- */
.empty {
  text-align: center;
  color: var(--text-3);
  padding: 48px 16px;
  font-size: 14px;
}
.error-box {
  text-align: center;
  color: var(--danger);
  padding: 48px 16px;
  font-size: 14px;
}

/* ---------- 客服二维码 ---------- */
.qr-section {
  text-align: center;
  margin-top: 16px;
  padding: 18px 16px;
}
.qr-section img {
  max-width: 200px;
  width: 70%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.qr-section p {
  font-size: 13.5px;
  color: var(--text-2);
  margin-top: 10px;
}

/* ---------- 表格（后台） ---------- */
.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}
th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  white-space: nowrap;
}
th {
  background: #f7f8fa;
  color: var(--text-2);
  font-weight: 600;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--primary-softer); }

/* ---------- 选项卡片（套餐） ---------- */
.option-card {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 12px;
  background: var(--surface);
  transition: all 0.15s ease;
}
.option-card:active {
  border-color: var(--primary);
  background: var(--primary-softer);
}
.option-card.selected {
  border-color: var(--primary);
  background: var(--primary-softer);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.option-card.selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 12px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-size: 12px;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
}
.option-card .days {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
}
.option-card .price {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-1);
  margin-top: 4px;
}
.option-card .price::first-letter {
  font-size: 15px;
  font-weight: 600;
  margin-right: 1px;
}

/* ---------- 大字版按钮（顶部"知识库"右侧） ---------- */
.big-font-btn {
  font-size: 13px;
  line-height: 1;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #d6e2ff;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.big-font-btn:active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.big-font-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== 统一「绿色 hover」：可复用 class .hv-edit =====
   与后台列表内「编辑」按钮完全同一套视觉：hover 只改描边 / 文字 / 阴影，背景与圆角保持元素自身设定。
   用法：任意元素加 class="hv-edit"；顶部导航链接（首页 / 作者 / 后台 / 退出）已默认接入。
   默认预留 1px 透明描边（padding 相应 -1px），因此 hover 不会出现位移或抖动。
   选中态（.active）、按下态（:active）、禁用与提交中均不触发。 */
.hv-edit,
.header .nav > a,
.header .nav .user-menu-list a {
  transition: background-color .2s ease, color .2s ease,
              border-color .2s ease, box-shadow .2s ease;
}
/* 预留透明描边：原 padding 6px 12px / 7px 10px 各减 1px，尺寸不变 */
.header .nav > a { border: 1px solid transparent; padding: 5px 11px; }
.header .nav .user-menu-list a { border: 1px solid transparent; padding: 6px 9px; }

.hv-edit:hover:not(.active):not(:active):not(:disabled):not(.is-loading),
.header .nav > a:hover:not(:active),
.header .nav .user-menu-list a:hover:not(:active) {
  border-color: var(--hv-c);
  color: var(--hv-c);
  box-shadow: var(--hv-shadow);
}

/* ---------- 备案信息条（全局页脚，由 common.js 自动挂载） ---------- */
.filing-bar {
  margin-top: 28px;
  padding: 14px 16px 20px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  text-align: center;
}
.filing-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}
.filing-item {
  color: var(--text-3);
  text-decoration: none;
  transition: color .15s ease;
}
.filing-item:active,
.filing-item:hover { color: var(--primary); }
.filing-sep { color: var(--border); }
