/* ============================================
   管理后台样式(桌面优先,手机适配)
   与学员端共用微信绿视觉风格
   ============================================ */
:root {
  --primary: #07c160;
  --primary-dark: #06ad56;
  --primary-bg: rgba(7, 193, 96, 0.08);
  --danger: #fa5151;
  --danger-bg: rgba(250, 81, 81, 0.07);
  --warn: #ff9f0a;
  --warn-bg: rgba(255, 159, 10, 0.1);
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #ebedf0;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  --sidebar-w: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录页 ---------- */
.view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #eafaf1 0%, #f5f6f7 100%); }
.login-box { width: 100%; max-width: 360px; padding: 20px; }
.login-logo { text-align: center; margin-bottom: 20px; }
.logo-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; background: var(--primary); color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(7, 193, 96, 0.3); }
.login-logo h1 { font-size: 22px; margin-bottom: 6px; }
.login-logo p { color: var(--text-2); font-size: 13px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.login-card { display: flex; flex-direction: column; gap: 12px; }
.input-row { position: relative; }
.input-row input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; outline: none; transition: border 0.2s; background: #fafafa;
}
.input-row input:focus { border-color: var(--primary); background: #fff; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; border: none;
  padding: 11px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: all 0.15s; user-select: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-bg); }
.btn-ghost { background: #f2f3f5; color: var(--text-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.login-tip { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* ---------- 后台布局 ---------- */
.admin-app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #1c1f26; color: #c9cdd4; position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column; padding: 0 0 16px;
}
.side-logo { padding: 20px 18px 16px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.08); }
.side-nav { flex: 1; padding: 12px 0; }
.nav-item { padding: 12px 20px; cursor: pointer; font-size: 14px; color: #aab0ba; border-left: 3px solid transparent; transition: all 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(7,193,96,0.15); color: #2ee27f; border-left-color: var(--primary); }
.side-foot { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 8px; }
.side-foot #adm-name { color: #fff; font-size: 13px; }

.main { flex: 1; margin-left: var(--sidebar-w); padding: 24px; max-width: 1400px; }
.module { display: none; }
.module.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.mod-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.mod-head h2 { font-size: 20px; }
.q-brief { color: var(--text-3); font-size: 13px; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.search { flex: 1; min-width: 200px; max-width: 340px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; background: #fff; }
.search:focus { border-color: var(--primary); }
select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 14px; outline: none; }

/* ---------- 表格 ---------- */
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 12px 14px; background: #fafafa; color: var(--text-2);
  font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafcfa; }
.q-content-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-empty { padding: 40px; text-align: center; color: var(--text-3); }

/* 状态徽章 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.active { background: var(--primary-bg); color: var(--primary-dark); }
.badge.expired { background: var(--danger-bg); color: var(--danger); }
.badge.disabled { background: #f2f3f5; color: var(--text-2); }

/* 进度条 */
.progress { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.progress .track { flex: 1; height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; }
.progress .track i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.progress .pv { color: var(--text-2); font-size: 12px; width: 38px; }

/* 操作按钮 */
.op { color: var(--primary); cursor: pointer; margin-right: 8px; white-space: nowrap; }
.op.warn { color: var(--warn); }
.op.danger { color: var(--danger); }
.op:hover { text-decoration: underline; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; flex-wrap: wrap; }
.pager button { min-width: 60px; }
.pager .pg-info { color: var(--text-2); font-size: 13px; }

/* ---------- 统计卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--primary-dark); }
.stat-card .label { color: var(--text-2); font-size: 12px; margin-top: 4px; }

/* ---------- 导入面板 ---------- */
.import-panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.ip-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.ip-tip { color: var(--text-3); font-size: 12px; }
.import-area { width: 100%; min-height: 120px; padding: 12px; border: 1px dashed var(--border); border-radius: 10px; font-size: 13px; outline: none; resize: vertical; background: #fafafa; font-family: inherit; }
.import-area:focus { border-color: var(--primary); background: #fff; }
.import-result { margin-top: 8px; font-size: 13px; }
.import-result .ok { color: var(--primary-dark); white-space: pre-line; }
.import-result .err { color: var(--danger); white-space: pre-line; margin-top: 4px; }

/* ---------- 学习统计 ---------- */
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.panel-title { font-weight: 600; margin-bottom: 14px; }
.trend { display: flex; align-items: flex-end; gap: 12px; height: 140px; padding: 0 6px; }
.trend .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend .bar { width: 100%; max-width: 46px; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 4px; opacity: 0.85; }
.trend .bar:hover { opacity: 1; }
.trend .bar-label { font-size: 11px; color: var(--text-2); }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.cat-row:last-child { border-bottom: none; }
.cat-row .cname { width: 120px; flex-shrink: 0; font-weight: 600; }
.cat-row .ctrack { flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.cat-row .ctrack i { display: block; height: 100%; background: linear-gradient(90deg, #ff9f0a, #07c160); border-radius: 4px; }
.cat-row .cval { width: 70px; text-align: right; color: var(--text-2); font-size: 12px; }
.cat-row .type-nums { display: flex; gap: 12px; flex: 1; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.cat-row .type-nums b { font-size: 13px; color: var(--text-1); }
.cat-row .acc-ok { color: #07c160; }
.cat-row .acc-mid { color: #ff9f0a; }
.cat-row .acc-bad { color: #fa5151; }
.warn-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.warn-row:last-child { border-bottom: none; }
.warn-row .w-date { color: var(--warn); font-weight: 600; }
.acc-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.acc-row:last-child { border-bottom: none; }
.acc-row span { color: var(--text-2); }
.acc-row b { font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); animation: pop 0.2s ease; }
@keyframes pop { from { transform: scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; }
.form-row input, .form-row select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; background: #fafafa;
}
.form-row input:focus { border-color: var(--primary); background: #fff; }
.form-row .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- 数据看板 ---------- */
.legend { display: flex; gap: 18px; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg-bar { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #07c160; opacity: 0.4; }
.lg-line { display: inline-block; width: 16px; height: 3px; border-radius: 2px; background: #07c160; }
.lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff9f0a; }
.trend2 { background: #fbfcfb; border: 1px solid var(--border); border-radius: 10px; padding: 8px 6px 0; }
.trend2-label { font-size: 10px; fill: var(--text-3); }

/* ---------- 学员详情弹窗:学习统计 ---------- */
.stat-mini-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.stat-mini { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 6px; text-align: center; }
.stat-mini b { display: block; font-size: 18px; font-weight: 700; }
.stat-mini span { font-size: 11px; color: var(--text-2); }
@media (max-width: 480px) {
  .stat-mini-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 学习记录 ---------- */
.rec-actions { display: flex; gap: 10px; align-items: center; }

/* 大弹窗(学员详情)允许滚动 */
.modal.modal-lg { max-height: 90vh; overflow-y: auto; }
.org-filter-tag { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 13px; background: var(--primary-bg); color: var(--primary-dark); font-weight: 600; }
#stu-org-filter-bar { margin-top: -6px; }

/* ---------- 学员详情弹窗 ---------- */
.det-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; }
.det-grid .det-label { font-size: 12px; color: var(--text-3); }
.det-block { background: #fafafa; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.det-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); gap: 10px; flex-wrap: wrap; }
.det-row:last-child { border-bottom: none; }
.det-title { font-weight: 600; font-size: 14px; margin: 14px 0 8px; }

/* ---------- 手机适配 ---------- */
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .side-logo { font-size: 0; padding: 18px 0; text-align: center; }
  .side-logo::before { content: '🎯'; font-size: 22px; }
  .nav-item { padding: 14px 0; text-align: center; font-size: 0; border-left: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .nav-item.active { border-left: none; }
  .main { margin-left: 64px; padding: 14px; }
  .table-wrap { overflow-x: auto; }
  .data-table { min-width: 900px; }
  .search { max-width: none; }
}
@media (max-width: 480px) {
  .main { padding: 12px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
