/* ==========================================================================
   知识付费交付平台 · 管理后台样式
   自研轻量 UI，视觉对齐 Element UI 观感，不依赖任何框架与构建工具。
   ========================================================================== */

:root {
  --primary: #3b6ef5;
  --primary-hover: #2f5fe0;
  --primary-light: #eef3ff;
  --success: #12b76a;
  --success-light: #e9f9f1;
  --warning: #f79009;
  --warning-light: #fff6e8;
  --danger: #f04438;
  --danger-light: #fdecea;
  --info: #667085;
  --info-light: #f2f4f7;

  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --border-2: #f0f2f5;
  --bg: #f5f7fa;
  --card: #ffffff;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);

  --sidebar-w: 224px;
  --header-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 通用工具 ---------------- */

.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex-1 { flex: 1; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-16 { font-size: 16px; }
.fs-20 { font-size: 20px; }
.fw-6 { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.pointer { cursor: pointer; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------------- 登录页 ---------------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef3ff 0%, #f7f9fc 45%, #eef7f2 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(16, 24, 40, .12);
  padding: 40px 36px 32px;
}

.login-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #6f8ffb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 18px;
}

.login-title { font-size: 22px; font-weight: 700; letter-spacing: .3px; }
.login-sub { color: var(--text-2); margin-top: 6px; font-size: 13px; }
.login-tip {
  margin-top: 22px;
  padding: 12px 14px;
  background: var(--info-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.9;
}
.login-tip b { color: var(--text); }

/* ---------------- 主布局 ---------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-2);
  flex: 0 0 auto;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #6f8ffb);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-group-title {
  font-size: 11px; color: var(--text-3); letter-spacing: 1px;
  padding: 12px 10px 6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; user-select: none;
  margin-bottom: 2px; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--info-light); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .ico { width: 16px; text-align: center; opacity: .9; flex: 0 0 16px; }
.nav-sub { padding-left: 12px; }
.nav-sub .nav-item { padding-left: 26px; font-size: 13px; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header {
  height: var(--header-h);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 14px; color: var(--text-2); }
.crumb b { color: var(--text); font-weight: 600; }

.userbox { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm); }
.userbox:hover { background: var(--info-light); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
}

.content { padding: 20px 22px 40px; flex: 1; }

/* ---------------- 卡片 ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-title { font-weight: 600; font-size: 15px; }
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

/* ---------------- 统计卡 ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-label { color: var(--text-2); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: .5px; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.stat-foot { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff; color: var(--text);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: all .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { background: #fff; border-color: #f6b3ad; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-text { border-color: transparent; background: transparent; padding: 0 6px; color: var(--primary); }
.btn-text:hover { background: var(--primary-light); border-color: transparent; }
.link-btn { color: var(--primary); cursor: pointer; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.link-danger { color: var(--danger); cursor: pointer; font-size: 13px; }
.link-danger:hover { text-decoration: underline; }
.link-muted { color: var(--text-3); cursor: not-allowed; font-size: 13px; }

/* ---------------- 表单 ---------------- */

.field { margin-bottom: 16px; }
.field-label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
.field-label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; padding: 0 12px; height: 34px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; color: var(--text);
  background: #fff; outline: none; transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; padding: 8px 12px; resize: vertical; min-height: 76px; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 110, 245, .12);
}
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L2 4h8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .input, .filters .select { width: auto; min-width: 150px; }

/* ---------------- 表格 ---------------- */

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2);
  background: #fafbfc; padding: 11px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-2); vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafbfc; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-actions { display: flex; gap: 10px; align-items: center; }

/* ---------------- 标签 ---------------- */

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 4px; font-size: 12px; line-height: 1;
  background: var(--info-light); color: var(--info); white-space: nowrap;
}
.tag-primary { background: var(--primary-light); color: var(--primary); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: var(--warning); }
.tag-danger { background: var(--danger-light); color: var(--danger); }
.tag-plain { background: #fff; border: 1px solid var(--border); color: var(--text-2); }

/* ---------------- 弹窗 ---------------- */

.mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 8vh 16px 24px; overflow-y: auto;
  animation: fade .14s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal {
  background: var(--card); border-radius: 10px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); animation: pop .16s ease; overflow: hidden;
}
.modal.wide { max-width: 820px; }
.modal.slim { max-width: 420px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 15px;
}
.modal-close {
  cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.modal-close:hover { background: var(--info-light); color: var(--text); }
.modal-body { padding: 20px; max-height: 62vh; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border-2);
  display: flex; justify-content: flex-end; gap: 10px; background: #fcfcfd;
}

/* ---------------- 消息提示 ---------------- */

.toast-wrap {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13px;
  background: #fff; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: pop .16s ease; max-width: 520px;
}
.toast.success { border-color: #a6e9c5; background: #f2fdf7; color: #067647; }
.toast.error { border-color: #f6b3ad; background: #fef4f3; color: #b42318; }
.toast.info { border-color: #c7d7fe; background: #f5f8ff; color: #2f5fe0; }
.toast.warn { border-color: #fbdba7; background: #fffbf3; color: #b54708; }

/* ---------------- 空状态 / 加载 ---------------- */

.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty-ico { font-size: 34px; opacity: .5; margin-bottom: 8px; }
.loading { padding: 40px; text-align: center; color: var(--text-3); }
.spinner {
  width: 22px; height: 22px; margin: 0 auto 10px;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 分页 ---------------- */

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 18px; }
.pager-info { color: var(--text-2); font-size: 13px; margin-right: auto; }

/* ---------------- 步骤条（成交工作流） ---------------- */

.steps { display: flex; align-items: center; gap: 0; margin: 4px 0 20px; }
.step { display: flex; align-items: center; gap: 8px; flex: 1; }
.step-dot {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; background: var(--info-light); color: var(--text-3);
  border: 1px solid var(--border);
}
.step.done .step-dot { background: var(--success-light); color: var(--success); border-color: #a6e9c5; }
.step.active .step-dot { background: var(--primary); color: #fff; border-color: var(--primary); }
.step-label { font-size: 13px; color: var(--text-2); }
.step.active .step-label { color: var(--primary); font-weight: 600; }
.step.done .step-label { color: var(--text); }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 10px; }

/* ---------------- 详情描述列表 ---------------- */

.desc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.desc-item { padding: 10px 0; border-bottom: 1px dashed var(--border-2); display: flex; gap: 10px; min-width: 0; }
.desc-item.full { grid-column: 1 / -1; }
.desc-k { color: var(--text-2); flex: 0 0 84px; font-size: 13px; }
.desc-v { flex: 1; min-width: 0; word-break: break-all; }

/* ---------------- 时间线（跟进记录） ---------------- */

.timeline { padding-left: 6px; }
.tl-item { position: relative; padding: 0 0 16px 20px; border-left: 1px solid var(--border); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -4.5px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}
.tl-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------------- 进度条 ---------------- */

.bar { height: 6px; background: var(--border-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------------- 提示条 ---------------- */

.alert {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px;
  border: 1px solid var(--border); background: var(--info-light); color: var(--text-2);
  display: flex; gap: 8px; align-items: flex-start; line-height: 1.7;
}
.alert.warn { background: var(--warning-light); border-color: #fbdba7; color: #93370d; }
.alert.info { background: #f5f8ff; border-color: #c7d7fe; color: #2f5fe0; }
/* 到期/停用这类"必须处理"的提示用它。红色在这里是"要花钱续费"，不是"报错了"。 */
.alert.danger { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.alert b { color: inherit; }
/* 提示条里的行动链接推到最右，和正文分开，别混在一句话里读不出来 */
.alert a { color: inherit; text-decoration: underline; }

/* 弹层里的分组分隔线与"当前项"高亮 */
.divider { height: 1px; background: var(--border-2); margin: 14px 0; }
table.tbl tbody tr.row-active { background: var(--primary-light); }
table.tbl tbody tr.row-active td { font-weight: 600; }

/* ---------------- 页面标题与筛选条 ---------------- */

.page-title {
  font-size: 18px; font-weight: 600; margin: 0 0 14px;
  display: flex; align-items: baseline; gap: 8px;
}
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
}
.toolbar .input { height: 32px; }

/* ---------------- 简易柱状图（概况趋势） ---------------- */

.chart { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding: 10px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.chart-bar { width: 14px; border-radius: 3px 3px 0 0; background: var(--primary); min-height: 2px; transition: height .3s; }
.chart-bar.alt { background: #b9c8fb; }
.chart-x { font-size: 11px; color: var(--text-3); }

/* ---------------- 复制框 ---------------- */

.copybox {
  display: flex; gap: 8px; align-items: center;
  background: var(--info-light); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.copybox input {
  flex: 1; border: none; background: transparent; font-size: 12px; color: var(--text-2);
  outline: none; font-family: ui-monospace, Consolas, monospace; min-width: 0;
}

/* ---------------- 用户端 H5 ---------------- */

.h5-body {
  background: #f4f6fa; min-height: 100vh; padding: 0 0 40px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.h5-head {
  background: linear-gradient(135deg, #3b6ef5, #6f8ffb);
  color: #fff; padding: 28px 20px 34px;
}
.h5-head h1 { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.h5-head p { margin: 0; opacity: .88; font-size: 13px; }
.h5-card {
  background: #fff; border-radius: 12px; margin: -18px 14px 0;
  padding: 18px 16px; box-shadow: 0 6px 20px rgba(16, 24, 40, .08);
}
.h5-q { padding: 14px 0; border-bottom: 1px solid var(--border-2); }
.h5-q:last-of-type { border-bottom: none; }
.h5-q-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.h5-q-title .req { color: var(--danger); margin-left: 3px; }
.h5-opt {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px;
  font-size: 13px; cursor: pointer; background: #fff;
}
.h5-opt.on { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 600; }
.h5-foot { margin: 18px 14px 0; }
.h5-done { text-align: center; padding: 60px 24px; }
.h5-done .ok {
  width: 60px; height: 60px; border-radius: 50%; background: var(--success-light);
  color: var(--success); font-size: 30px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .desc { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
