/* ---------- 主题令牌 ----------
 * 品牌色这一组由「系统设置 → 外观」决定，enterApp 时从 /api/theme 读来写到 :root 上。
 * 这里的值是默认的经典蓝，接口没回来之前、或者请求失败时就用它。
 * 其余几档（加深、描边、聚焦光圈）用 color-mix 从主色推出来，换主题不用另配。
 */
:root {
  --brand: #4a6cf7;
  --brand-2: #5b7cff;
  --brand-bg: #eef2ff;
  --brand-fill: #f7f9ff;
  --brand-deep: color-mix(in srgb, var(--brand) 82%, #000);
  --brand-line: color-mix(in srgb, var(--brand) 32%, #fff);
  --brand-ring: color-mix(in srgb, var(--brand) 14%, transparent);

  --ink: #1f2733;
  --body: #4a5262;
  --sub: #6b7280;
  --muted: #8a8f99;
  --line: #eceff5;
  --page: #f2f4f8;
  --card: #fff;
  --ok: #17a35c;
  --danger: #e2564b;
  --warn: #d97b06;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(31, 39, 51, .04), 0 2px 8px rgba(31, 39, 51, .04);
  --shadow-md: 0 4px 16px rgba(31, 39, 51, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f2f4f8;
  color: #1f2733;
  font-size: 14px;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--brand-2), var(--brand-deep));
}
.login-card {
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(20, 30, 80, .25);
}
.login-card h1 { font-size: 20px; margin: 0 0 28px; }
.login-card label { display: block; font-size: 13px; color: #6b7280; margin-bottom: 18px; }
.login-card input {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #d9dee9;
  border-radius: 8px;
  font-size: 14px;
}
.login-card .btn { width: 100%; }
.err { color: #e2564b; font-size: 13px; min-height: 18px; margin: 12px 0 0; }

/* ---------- 布局：左侧导航 + 右侧内容 ---------- */
/* #app 带 hidden 属性，这里得用 :not([hidden])，否则 display 会把它显示出来 */
#app:not([hidden]) { display: flex; align-items: stretch; min-height: 100vh; }

.sidebar {
  width: 208px;
  flex: none;
  background: #fff;
  border-right: 1px solid #e6e9f0;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 5;
}
.brand {
  font-weight: 600;
  font-size: 15px;
  padding: 0 10px 16px;
  line-height: 1.4;
}
.brand small { display: block; font-size: 12px; color: #a6acb8; font-weight: 400; margin-top: 2px; }

.tabs { display: flex; flex-direction: column; gap: 2px; }
/* 导航分组小标题，纯装饰，不参与 .tab 的选择器 */
.nav-group {
  font-size: 11px;
  color: #b6bcc8;
  padding: 14px 10px 4px;
  letter-spacing: .5px;
}
.tab {
  border: none;
  background: transparent;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { background: #f2f4f8; }
.tab.active { background: var(--brand-bg); color: var(--brand); font-weight: 500; }

/* 当前账号钉在侧栏底部，点开是个人中心菜单 */
.me-box { margin-top: auto; padding-top: 12px; border-top: 1px solid #f0f2f6; position: relative; }
.me-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.me-trigger:hover { background: #f2f4f8; }
.me-name { flex: 1; min-width: 0; font-size: 12px; color: #8a8f99; line-height: 1.5; }
.me-name b {
  display: block;
  color: #1f2733;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-caret { color: #b6bcc8; font-size: 12px; flex: none; transition: transform .15s; }
.me-trigger[aria-expanded="true"] .me-caret { transform: rotate(180deg); }

/* 菜单往上弹，因为触发器就在侧栏最底下 */
.me-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - 4px);
  background: #fff;
  border: 1px solid #e6e9f0;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(20, 30, 80, .12);
  padding: 6px;
  z-index: 10;
}
.me-menu-head { font-size: 11px; color: #b6bcc8; padding: 6px 10px 4px; letter-spacing: .5px; }
.me-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  color: #4a5262;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.me-menu-item:hover { background: #f2f4f8; }
.me-menu-item.danger { color: #e2564b; }
.me-menu-item.danger:hover { background: #fdecec; }

/* ---------- 个人中心 ---------- */
.profile-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(31, 39, 51, .04);
  max-width: 560px;
}
.profile-list { margin: 0; }
.profile-list > div { display: flex; padding: 12px 0; border-bottom: 1px solid #f0f2f6; }
.profile-list > div:last-child { border-bottom: none; }
.profile-list dt { width: 100px; flex: none; color: #8a8f99; font-size: 13px; }
.profile-list dd { margin: 0; color: #1f2733; }
.profile-actions { margin-top: 20px; }

/* 确认类弹窗的正文 */
.confirm-text { margin: 0; line-height: 1.7; color: #4a5262; }
.confirm-text.warn {
  background: #fff7ed;
  border: 1px solid #fde3c4;
  color: #b45309;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

/* ---------- 系统设置 ---------- */
.settings-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(31, 39, 51, .04);
  max-width: 720px;
}
/* 字段表格列多，这一页放宽 */
.settings-card.wide { max-width: 1040px; }
.settings-title { margin: 0 0 4px; font-size: 15px; }
.mode-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.mode-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #e6e9f0;
  border-radius: 10px;
  cursor: pointer;
}
.mode-item:hover { border-color: var(--brand-line); }
.mode-item.active { border-color: var(--brand); background: var(--brand-fill); }
.mode-item input { margin-top: 3px; flex: none; }
.mode-name { font-weight: 500; }
.mode-desc { font-size: 13px; color: #8a8f99; margin-top: 4px; line-height: 1.6; }

/* min-width: 0 是必须的：不加的话宽表格会把 flex 子项撑开，整页出现横向滚动 */
main { flex: 1; min-width: 0; padding: 24px; }

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.col-head h2 { font-size: 16px; margin: 0; }

.search {
  padding: 8px 12px;
  border: 1px solid #d9dee9;
  border-radius: 8px;
  font-size: 14px;
  min-width: 220px;
}

/* ---------- 按钮 ---------- */
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  background: #f2f4f8;
  color: #4a5262;
}
.btn:hover { filter: brightness(.97); }
/* 禁用态：条件按钮不隐藏而是置灰占位，各行的操作列才能对齐 */
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { filter: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { background: #fff; border-color: #d9dee9; }
.btn.danger { background: #fdecec; color: #e2564b; }
.btn.sm { padding: 5px 12px; font-size: 13px; }

/* ---------- 看板 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(31, 39, 51, .04);
  /* 卡片是按钮：点了跳到对应的页面 */
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.stat-card:hover {
  border-color: var(--brand-line);
  box-shadow: 0 6px 18px var(--brand-ring);
  transform: translateY(-1px);
}
.stat-num { font-size: 30px; font-weight: 600; color: var(--brand); }
.stat-label { font-size: 13px; color: #8a8f99; margin-top: 6px; }

/* ---------- 试卷 ---------- */
.split { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.col-left, .col-right {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(31, 39, 51, .04);
}
.paper-list { list-style: none; margin: 0; padding: 0; }
.paper-item {
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 8px;
}
.paper-item:hover { background: #f7f8fb; }
.paper-item.active { background: var(--brand-bg); border-color: var(--brand-line); }
.paper-item .name { font-weight: 500; }
.paper-item .meta { font-size: 12px; color: #8a8f99; margin-top: 4px; }
.paper-item .off { color: #e2564b; }

.empty-hint { color: #a6acb8; padding: 60px 0; text-align: center; }

.q-item {
  border: 1px solid #eceff5;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.q-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-stem { font-weight: 500; line-height: 1.6; }
.q-opts { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: #4a5262; }
.q-opts li { padding: 3px 0; }
.q-opts li.right { color: #17a35c; font-weight: 500; }
.q-analysis { margin-top: 10px; font-size: 13px; color: #6b7280; background: #f7f8fb; padding: 10px; border-radius: 8px; }
.q-actions { margin-left: auto; display: flex; gap: 8px; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--brand-bg);
  color: var(--brand);
}
.tag.green { background: #e7f7ee; color: #17a35c; }
.tag.red { background: #fdecec; color: #e2564b; }
.tag.gray { background: #f0f1f5; color: #8a8f99; }
.tag.orange { background: #fff4e5; color: #d97b06; }

/* 待确认人数角标，挂在顶部导航上提醒管理员去处理 */
.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: #e2564b;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

/* 表格上方的整段说明，比字段旁的 .hint 需要更松的间距 */
.hint.pad { margin: 0 0 12px; line-height: 1.7; }

/* 候选学员：一行一个，点一下就认领 */
.cand-list { display: flex; flex-direction: column; gap: 8px; }
.cand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e6e9f0;
  border-radius: 10px;
}
.cand-main { flex: 1; }
/* 名单长的时候列表自己滚，别把弹窗撑出屏幕 */
/* 搜索框右侧塞一个清除按钮，搜完能一键回到全量 */
.search-box { position: relative; display: inline-block; }
.search-box .search { padding-right: 26px; }
.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #8a8f99;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.search-clear:hover { color: #1f2733; }

.pick-list { max-height: 300px; overflow-y: auto; margin-top: 10px; padding-right: 4px; }
.cand.matched { border-color: var(--brand-line); background: var(--brand-fill); }
.cand.disabled { opacity: .55; }
.cand-sub { font-size: 12px; color: #8a8f99; margin-top: 2px; }
.self-input { font-size: 13px; color: #6b7280; }

/* ---------- 表格 ---------- */
.table-wrap {
  background: #fff;
  border-radius: 12px;
  padding: 8px 20px 20px;
  box-shadow: 0 2px 10px rgba(31, 39, 51, .04);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #f0f2f6; white-space: nowrap; }
th { font-size: 13px; color: #8a8f99; font-weight: 500; }
tbody tr:hover { background: #fafbfd; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #6b7280; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 35, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 24px;
}
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f0f2f6;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: none; background: transparent; font-size: 24px; cursor: pointer; color: #8a8f99; line-height: 1; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid #f0f2f6; display: flex; justify-content: flex-end; gap: 10px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: #6b7280; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d9dee9;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.field textarea { min-height: 90px; resize: vertical; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: #8a8f99; margin-top: 6px; }
/* 联动算时间时的提示语，出错了要能一眼看见 */
.hint.warn { color: #b45309; }

/* 一排窄一点的字段，比如跟在起止时间后面的「培训时长」 */
.field-row .field.narrow { flex: 0 0 170px; }

/* 时长的快捷选项，点一下就填进时长框，比 .seg 轻 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 0; }
.chips button {
  border: 1px solid #d9dee9; background: #fff; border-radius: 999px;
  padding: 4px 12px; font-size: 12px; color: #6b7280;
  font-family: inherit; cursor: pointer;
}
.chips button:hover { border-color: var(--brand); color: var(--brand); }
/* 快捷选项底下的提示语要跟下一排字段拉开，否则挤成一坨 */
.chips + .hint { margin-bottom: 18px; }
.muted { color: #a6acb8; }

.opt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-row .k { width: 56px; }
.opt-row .t { flex: 1; }
.opt-row input[type="checkbox"] { width: 18px; height: 18px; }

[hidden] { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(31, 39, 51, .92);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  z-index: 50;
  font-size: 14px;
  /* 报错里最有用的那几句都长（导出超限、组卷凑不齐）。不限宽的话会横着
     撑出屏幕，而它是 left:50% + translateX(-50%) 居中的，两头一起被裁掉 */
  max-width: min(560px, calc(100vw - 48px));
  line-height: 1.5;
  word-break: break-word;
}

/* ---------- 培训后台补充样式 ---------- */

.login-card h1 small { font-size: 14px; color: #8a8f99; font-weight: 400; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search.short { min-width: 140px; }

.summary-bar {
  background: var(--brand-bg);
  color: #4a5262;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 13px;
}
.summary-bar b { color: var(--brand); font-size: 15px; }

.warn-box {
  background: #fff3e6;
  color: #a45a0c;
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 20px;
  font-size: 13px;
  line-height: 1.7;
}
.warn-box code {
  background: rgba(0, 0, 0, .06);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
}

.qr-wrap { text-align: center; }
.qr-wrap img {
  width: 260px; height: 260px;
  border: 1px solid #eceff5;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}
.qr-wrap .qr-name { font-weight: 600; margin: 14px 0 4px; font-size: 15px; }
.qr-wrap .qr-hint { color: #8a8f99; font-size: 13px; line-height: 1.7; }

.state-tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.state-open { background: #e7f7ee; color: #17a35c; }
.state-notStarted { background: var(--brand-bg); color: var(--brand); }
.state-ended { background: #f0f1f5; color: #8a8f99; }

.tab { white-space: nowrap; }

/* 窄屏（比如笔记本分屏、平板横屏）侧栏退回顶部横条，免得内容区被挤没 */
@media (max-width: 860px) {
  #app:not([hidden]) { flex-direction: column; }
  .sidebar {
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-right: none;
    border-bottom: 1px solid #e6e9f0;
    overflow-x: auto;
    overflow-y: visible;
  }
  .brand { padding: 0; white-space: nowrap; }
  .brand small { display: none; }
  .tabs { flex-direction: row; gap: 4px; }
  .nav-group { display: none; }
  .tab { width: auto; padding: 8px 14px; }
  .me-box { margin: 0 0 0 auto; padding: 0 0 0 12px; border-top: none; border-left: 1px solid #f0f2f6; }
  .me-name { white-space: nowrap; }
  .me-name b { display: inline; }
  /* 顶部横条时菜单改成往下弹，并靠右对齐 */
  .me-menu { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); min-width: 160px; }
}

.import-preview {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #eceff5;
  border-radius: 8px;
  margin-top: 12px;
}
.import-preview table { font-size: 13px; }
.import-preview th, .import-preview td { padding: 7px 10px; }

.seg { display: flex; gap: 0; border: 1px solid #d9dee9; border-radius: 8px; overflow: hidden; }
.seg button {
  flex: 1; border: none; background: #fff; padding: 8px 14px;
  font-size: 13px; cursor: pointer; color: #6b7280;
}
.seg button.on { background: var(--brand); color: #fff; }

/* ---------- 问卷 ---------- */

.q-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px;
  padding-top: 18px;
  border-top: 1px solid #f0f2f6;
}

.q-edit {
  border: 1px solid #eceff5;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fbfcfe;
}
.q-edit-head { display: flex; align-items: center; gap: 8px; }
.q-edit-head .q-no {
  width: 24px; height: 24px; flex: none;
  border-radius: 999px; background: var(--brand-bg); color: var(--brand);
  font-size: 12px; line-height: 24px; text-align: center;
}
.q-edit-head .qe-type { width: 84px; flex: none; padding: 7px 8px; border: 1px solid #d9dee9; border-radius: 8px; }
.q-edit-head .qe-title { flex: 1; padding: 7px 10px; border: 1px solid #d9dee9; border-radius: 8px; font-size: 14px; }
.qe-req-label { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #6b7280; white-space: nowrap; }
.q-edit textarea.qe-opts {
  width: 100%;
  margin-top: 10px;
  min-height: 72px;
  padding: 9px 12px;
  border: 1px solid #d9dee9;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.qe-line { margin-top: 10px; font-size: 13px; color: #6b7280; }
.qe-line .qe-max { width: 64px; padding: 5px 8px; border: 1px solid #d9dee9; border-radius: 6px; }

/* 结果汇总的横条图 */
.bar-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.bar-label { width: 180px; flex: none; color: #4a5262; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { flex: 1; height: 14px; background: #f0f2f6; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 999px; }
.bar-num { width: 110px; flex: none; text-align: right; color: #8a8f99; }
.rate-avg { font-size: 13px; color: #6b7280; }
.rate-avg b { color: var(--brand); font-size: 16px; }

.text-list { margin: 8px 0 0; padding-left: 20px; font-size: 13px; color: #4a5262; }
.text-list li { padding: 3px 0; line-height: 1.6; }

.ans-list { margin: 6px 0 0; padding-left: 20px; font-size: 13px; color: #4a5262; }
.ans-list li { padding: 3px 0; line-height: 1.6; }
.result-seg { margin-bottom: 16px; }

/* ---------- 从其他题库选题 ---------- */
.link-list { max-height: 380px; overflow-y: auto; border: 1px solid #eceff5; border-radius: 10px; }
.link-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f5f6fa;
  cursor: pointer;
}
.link-item:last-child { border-bottom: none; }
.link-item:hover { background: #fafbfd; }
.link-item input { margin-top: 3px; flex: none; }
.link-stem { line-height: 1.5; }
.link-meta { font-size: 12px; color: #8a8f99; margin-top: 3px; }

/* 可点击的标签，比如题目上的「共用 N 个题库」 */
.tag-btn { border: none; cursor: pointer; font-family: inherit; }
.tag-btn:hover { filter: brightness(.95); }

/* 业务编号，等宽显示好对齐 */
.code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #6b7280;
  background: #f2f4f8;
  padding: 1px 6px;
  border-radius: 4px;
}

/* 选题弹窗顶部的操作条 */
.link-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

/* 「这道题所在的题库」列表 */
.bank-of-list { margin: 14px 0; padding-left: 20px; line-height: 2; }
.bank-of-list .tag { margin-left: 8px; }

/* 系统题库标记 */
.tag.sys { background: #f0f1f5; color: #8a8f99; margin-left: 6px; font-size: 11px; padding: 1px 7px; }

/* ---------- 学员字段设置 ---------- */
/* 卡片里已经有白底和内边距了，表格容器不用再来一层 */
.table-wrap.flat { background: transparent; box-shadow: none; padding: 0; margin-top: 14px; }
#field-table .tag { margin-left: 6px; }
/* 勾选和按钮列不用占宽，让「字段名称」和「类型」把剩下的空间吃掉 */
#field-table th:nth-child(n+4), #field-table td:nth-child(n+4) { width: 1%; text-align: center; }
/* 操作列自己一套，不用全局 .actions（那个是 flex-wrap: wrap，列一窄就叠成竖排） */
td.fops { white-space: nowrap; text-align: right; }
td.fops .btn { padding: 4px 9px; margin-left: 6px; }
#field-table input[type=checkbox] { margin: 0; }
.fr-meta { font-size: 12px; color: #8a8f99; margin-top: 4px; }

/* 侧栏里成组的一段（比如「系统设置」整组只有超管看得到），排版跟散着的 .tab 一样 */
#nav-settings { display: contents; }
#nav-settings[hidden] { display: none; }

/* ---------- 人员表单：身份多选 ---------- */
.check-row { display: flex; flex-wrap: wrap; gap: 16px; padding: 8px 2px; }
/* .field label 是 block，这里得压过它，否则勾选框和文字会叠成两行 */
.check-row .check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 400; color: #3c4149; cursor: pointer; }
.check-row .check input { margin: 0; width: auto; }
.people-tools { display: contents; }
.people-tools[hidden] { display: none; }

/* 确认浮层：可能盖在另一个弹窗上面，所以 z-index 要更高 */
.confirm-mask { z-index: 30; }
.confirm-modal { max-width: 520px; width: 100%; }

/* 部门下面的岗位，横着摆一排标签 */
.post-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.answer-search { margin-bottom: 14px; }
.answer-search .search { flex: 1; }

/* 出卷的配比规则：章节 / 难度 / 道数 一行排开，右边实时显示库存 */
.plan-row {
  display: grid;
  grid-template-columns: 1fr 120px 90px auto 44px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.plan-row .plan-have { font-size: 12px; color: #8a8f99; white-space: nowrap; }
.plan-row .plan-have.short { color: #e2564b; font-weight: 600; }

/* ---------- 数据分析 ---------- */

.actions.pad { margin-bottom: 12px; }

/* 正确率/出勤率的条形：数字之外再给个一眼能扫的长短 */
.rate-cell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.rate-bar { flex: 1; height: 8px; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.rate-bar i { display: block; height: 100%; background: var(--brand); }
.rate-bar.bad i { background: #e2564b; }
.rate-bar.mid i { background: #e8a33d; }
.rate-num { width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

.rank-1, .rank-2, .rank-3 { font-weight: 700; }
.rank-1 { color: #d4922b; }
.rank-2 { color: #8a8f99; }
.rank-3 { color: #b07a4a; }
.danger-text { color: #e2564b; }

/* 学员档案弹窗里的小节 */
.profile-sec { margin-top: 18px; }
.profile-sec h4 { margin: 0 0 8px; font-size: 14px; color: #42485a; }
.profile-empty { color: #8a8f99; font-size: 13px; padding: 6px 0; }

/* 档案弹窗顶上那排数字 */
.stat-row-inline { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-inline {
  flex: 1; min-width: 88px; text-align: center;
  background: #f6f8fb; border-radius: 8px; padding: 10px 6px;
}
.stat-inline b { display: block; font-size: 18px; color: #2b3040; }
.stat-inline span { font-size: 12px; color: #8a8f99; }

/* 适用范围：一排部门复选框 */
.dept-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 12px;
  border: 1px solid #d9dee9;
  border-radius: 8px;
  background: #fafbfd;
  max-height: 180px;
  overflow-y: auto;
}
.scope-item { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.scope-item input { width: 16px; height: 16px; margin: 0; }
.scope-item.stale span { color: #8a8f99; }

/* ======================================================================
 * 2026-11 界面升级：以下都是叠加在上面的覆盖，删掉这一段就回到旧样子
 * ====================================================================== */

/* ---------- 基础质感 ---------- */
body { background: var(--page); color: var(--ink); -webkit-font-smoothing: antialiased; }
main { padding: 24px 28px 40px; }
.col-head h2 { font-size: 18px; font-weight: 600; letter-spacing: .2px; }
.search, .field input, .field select, .field textarea {
  transition: border-color .15s, box-shadow .15s;
}
.search:focus, .field input:focus, .field select:focus, .field textarea:focus, .login-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.btn { transition: background .15s, box-shadow .15s, filter .15s; font-family: inherit; }
.btn.primary { box-shadow: 0 1px 2px var(--brand-ring); }
.btn.primary:hover { background: var(--brand-deep); filter: none; }
.btn.ghost:hover { border-color: var(--brand-line); color: var(--brand); filter: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.tag { border-radius: 6px; }

/* 登录页跟着主题走 */
.login-wrap {
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand-2) 70%, #fff) 0%, transparent 60%),
    linear-gradient(160deg, var(--brand-2), var(--brand-deep));
}
.login-card { border-radius: 18px; }

/* ---------- 侧栏 ---------- */
.sidebar { width: 216px; padding: 20px 12px; }
.brand { font-size: 16px; display: flex; flex-direction: column; }
.brand::before {
  content: '';
  width: 32px; height: 32px; border-radius: 9px; margin-bottom: 10px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: 0 4px 12px var(--brand-ring);
}
.tab { gap: 10px; transition: background .12s, color .12s; position: relative; }
.tab.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-ic {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  opacity: .85;
}
.tab .badge { margin-left: auto; }

/* 深色侧栏 */
body.sidebar-dark .sidebar { background: #1b2232; border-right-color: #1b2232; }
body.sidebar-dark .brand { color: #fff; }
body.sidebar-dark .brand small { color: #8a93a8; }
body.sidebar-dark .nav-group { color: #5d6780; }
body.sidebar-dark .tab { color: #b3bccd; }
body.sidebar-dark .tab:hover { background: rgba(255, 255, 255, .06); color: #fff; }
body.sidebar-dark .tab.active { background: color-mix(in srgb, var(--brand) 30%, transparent); color: #fff; }
body.sidebar-dark .tab.active::before { background: var(--brand-2); }
body.sidebar-dark .me-box { border-top-color: rgba(255, 255, 255, .08); }
body.sidebar-dark .me-trigger:hover { background: rgba(255, 255, 255, .06); }
body.sidebar-dark .me-name, body.sidebar-dark .me-caret { color: #8a93a8; }
body.sidebar-dark .me-name b { color: #fff; }

/* ---------- 请求进度条 ---------- */
#net-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 100;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
  opacity: 0; pointer-events: none;
}
#net-bar.on { opacity: 1; width: 70%; transition: width 2.5s cubic-bezier(.1, .6, .3, 1); }
#net-bar.done { opacity: 0; width: 100%; transition: width .2s, opacity .3s .1s; }

/* ---------- 表格 ---------- */
main .table-wrap { max-height: calc(100vh - 170px); overflow: auto; padding-top: 0; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
main .table-wrap thead th {
  position: sticky; top: 0; z-index: 2; background: #fff;
  box-shadow: inset 0 -1px 0 var(--line);
  padding-top: 14px;
}
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--brand-fill); }
td.ops-cell { white-space: nowrap; }
td.ops-cell .btn + .btn, td.ops-cell .more-wrap { margin-left: 6px; }
.more-wrap { position: relative; display: inline-block; }
.more-menu {
  position: fixed; z-index: 60; min-width: 132px;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-md), 0 0 0 1px var(--line);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.more-menu[hidden] { display: none; }
.more-menu .btn {
  background: transparent; border: none; text-align: left; padding: 7px 10px; font-size: 13px;
  border-radius: 6px; box-shadow: none; color: var(--body);
}
.more-menu .btn:hover { background: var(--page); }
.more-menu .btn.primary { color: var(--brand); }
.more-menu .btn.danger { color: var(--danger); }
.more-menu .btn.danger:hover { background: #fdecec; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin: 12px 2px 0; font-size: 13px; }
.pager:empty { display: none; }
.pager .muted { margin-right: 8px; }
.pg {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid #d9dee9;
  background: #fff; cursor: pointer; font-family: inherit; color: var(--body);
}
.pg:hover:not(:disabled) { border-color: var(--brand-line); color: var(--brand); }
.pg.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg:disabled { opacity: .4; cursor: not-allowed; }
.pg-gap { padding: 0 4px; color: var(--muted); }

/* ---------- 看板 ---------- */
.dash-hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.dash-hello h2 { margin: 0; font-size: 22px; font-weight: 600; }
.dash-hello p { margin: 4px 0 0; font-size: 13px; }
.dash-hello .quick { display: flex; gap: 8px; flex-wrap: wrap; }
#wx-warn:not(:empty) { margin-bottom: 16px; }

#stat-grid.stat-grid { display: block; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi {
  text-align: left; border: 1px solid transparent; border-radius: 14px; padding: 18px 20px; cursor: pointer;
  font-family: inherit; background: #fff; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.kpi::after {
  content: ''; position: absolute; right: -24px; top: -24px; width: 88px; height: 88px; border-radius: 50%;
  background: var(--brand-bg);
}
.kpi:first-child { background: linear-gradient(140deg, var(--brand-2), var(--brand)); color: #fff; }
.kpi:first-child::after { background: rgba(255, 255, 255, .12); }
.kpi:first-child .kpi-label, .kpi:first-child .kpi-note { color: rgba(255, 255, 255, .82); }
.kpi:first-child .kpi-num { color: #fff; }
.kpi.attention { border-color: #fde3c4; }
.kpi.attention .kpi-num { color: var(--warn); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-label { font-size: 13px; color: var(--sub); position: relative; z-index: 1; }
.kpi-num { font-size: 32px; font-weight: 650; margin: 6px 0 2px; color: var(--ink); position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 12px; color: var(--muted); position: relative; z-index: 1; }

.mini-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 12px; margin-top: 16px; }
.mini-row .stat-card { padding: 14px 16px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.mini-row .stat-num { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.mini-row .stat-card:hover .stat-num { color: var(--brand); }
.mini-row .stat-label { margin-top: 2px; font-size: 12px; }

.dash-row { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-top: 16px; }
.panel { background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); padding: 18px 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.link { border: none; background: none; color: var(--brand); cursor: pointer; font-size: 13px; font-family: inherit; padding: 0; }
.seg.mini { border-radius: 8px; }
.seg.mini button { padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.empty-mini { color: var(--muted); font-size: 13px; padding: 26px 0; text-align: center; }

.ch-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ch-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.ch-head .ch-total { color: var(--ink); }
.ch-box { position: relative; }
.ch-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: #eef0f4; stroke-width: 1; }
.ch-axis { font-size: 10px; fill: var(--muted); }
.ch-hit { fill: transparent; }
.ch-bar { fill: var(--brand); opacity: .85; }
.ch-col.on .ch-hit { fill: var(--brand-fill); }
.ch-col.on .ch-bar { opacity: 1; }
.ch-tip {
  position: absolute; top: -6px; width: 110px; padding: 6px 10px; border-radius: 8px; font-size: 12px;
  background: #fff; box-shadow: var(--shadow-md), 0 0 0 1px var(--line); pointer-events: none;
}
.ch-tip b { font-size: 15px; color: var(--ink); }

.todo-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.todo {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px;
  font-family: inherit; font-size: 13px; color: var(--ink); cursor: pointer; line-height: 1.6;
}
.todo:hover { border-color: var(--brand-line); background: var(--brand-fill); }
.todo small { display: block; color: var(--muted); font-size: 12px; }
.todo.warn { background: #fff7ed; border-color: #fde3c4; display: flex; align-items: center; gap: 6px; }
.todo.warn b { color: var(--warn); font-size: 16px; }
.todo.warn span { margin-left: auto; color: var(--warn); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: none; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--brand-bg); color: var(--brand); font-size: 13px; font-weight: 600;
}
.feed-main { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-main small { color: var(--muted); margin-left: 6px; }
.wrong-top { margin: 0; padding: 0 0 0 20px; font-size: 13px; }
.wrong-top li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.wrong-top li:last-child { border-bottom: none; }
.wrong-top li::marker { color: var(--muted); }
.wt-stem { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wt-num { font-size: 12px; color: var(--muted); }
.wt-num b { color: var(--danger); }

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-row, .ch-pair { grid-template-columns: 1fr; }
}

/* ---------- 外观设置 ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 6px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: 92px; padding: 12px 8px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.swatch input[type=radio] { display: none; }
.swatch:hover { border-color: var(--brand-line); }
.swatch.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.sw-color { width: 44px; height: 44px; border-radius: 12px; display: block; position: relative; overflow: hidden; }
.sw-color.custom { background: conic-gradient(#e2564b, #f08519, #17a35c, #0e9384, #4a6cf7, #7357e6, #e2564b); }
.sw-color.custom input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: none; }
.swatch.on .sw-color.custom { box-shadow: inset 0 0 0 3px #fff; }
.sw-name { font-size: 13px; }
.theme-preview { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.tp-phone { width: 220px; border-radius: 18px; overflow: hidden; background: #f2f4f8; box-shadow: var(--shadow-md), 0 0 0 1px var(--line); font-size: 12px; }
.tp-nav { background: var(--brand); color: #fff; text-align: center; padding: 10px; font-weight: 600; }
.tp-hero { background: linear-gradient(160deg, var(--brand-2), var(--brand)); color: #fff; text-align: center; padding: 14px 10px 18px; }
.tp-score { font-size: 30px; font-weight: 700; }
.tp-card { background: #fff; margin: 10px; border-radius: 10px; padding: 10px; }
.tp-tag { background: var(--brand-bg); color: var(--brand); border-radius: 4px; padding: 1px 6px; font-size: 11px; }
.tp-btn { margin-top: 10px; background: var(--brand); color: #fff; border-radius: 999px; text-align: center; padding: 7px; }
.tp-admin { flex: 1; min-width: 260px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tp-admin .summary-bar { width: 100%; }

/* ---------- 操作日志 ---------- */
.audit-body {
  background: #1b2232; color: #d5dbe7; padding: 14px; border-radius: 10px; font-size: 12px;
  max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

/* 表格里的 .actions 原来是 flex + 换行，单元格窄的时候按钮会竖着排成一列，把行撑得很高。
 * 单元格里改回普通 table-cell，按钮横排不换行，多出来的交给「更多」菜单 */
td.actions { display: table-cell; white-space: nowrap; }
td.actions > .btn + .btn, td.actions > .btn + .more-wrap { margin-left: 6px; }

/* 名称列可以折行，操作列钉在右边：表格再宽，操作按钮也不会被挤出可视区 */
main .table-wrap td:first-child { white-space: normal; min-width: 160px; max-width: 360px; }
main .table-wrap td.ops-cell {
  position: sticky; right: 0; z-index: 1; background: #fff;
  box-shadow: -8px 0 8px -8px rgba(31, 39, 51, .12);
}
main .table-wrap tbody tr:hover td.ops-cell { background: var(--brand-fill); }
.audit-target { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* 菜单展开的那个单元格抬到最上层（操作列是 sticky，每格自成层叠上下文） */
main .table-wrap td.ops-cell.menu-open { z-index: 50; }

/* 侧栏品牌下面的后端版本号 */
.app-version { opacity: .6; font-size: 11px; margin-left: 4px; }

/* 系统设置 → 完成图：左边表单，右边按小程序同一套画法实时预览 */
.finish-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; margin-top: 16px; align-items: start; }
.finish-preview { position: sticky; top: 16px; }
.finish-preview canvas { width: 300px; height: 480px; border-radius: 10px; box-shadow: 0 4px 18px rgba(31, 39, 51, .12); display: block; }
.finish-preview-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
@media (max-width: 820px) {
  .finish-layout { grid-template-columns: 1fr; }
  .finish-preview { position: static; }
}
.color-pick { display: flex; align-items: center; gap: 10px; }
.color-pick input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid #dfe3ea; border-radius: 6px; background: #fff; cursor: pointer; }
.color-pick code { font-size: 13px; color: #5c6370; }
/* 完成图：通过时 / 没通过时 两栏，各自一个浅色底，一眼分得清 */
.finish-cases { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.finish-case { border: 1px solid #e6e9f0; border-radius: 10px; padding: 12px 14px 4px; }
.finish-case.pass { background: #f3faf5; }
.finish-case.fail { background: #f4f7fb; }
.finish-case-head { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
@media (max-width: 560px) { .finish-cases { grid-template-columns: 1fr; } }
