/* ============================================================
   综合信息管理系统 · 网页管理端样式（现代中后台 · 深浅色）
   设计令牌 → 布局 → 组件（按钮/表单/表格/弹层/toast）
   ============================================================ */

:root {
  /* 原生控件（select 展开层、滚动条、自动填充）跟随主题深浅：不声明的话
     深色主题下下拉列表仍是白底黑字，看着像样式坏了 */
  color-scheme: light;
  --bg: #f3f5fa;
  --card: #ffffff;
  --card-2: #f6f8fc;
  --card-3: #eef2f9;
  --primary: #2563eb;
  --primary-dim: rgba(37, 99, 235, 0.08);
  --primary-grad: linear-gradient(135deg, #5c9dff 0%, #2f6df6 52%, #1d4ed8 100%);
  --text: #0f172a;
  --text-dim: #52637a;
  --text-faint: #93a1b5;
  --border: #e6ebf3;
  --border-strong: #c3cede;
  --green: #16a34a;
  --green-dim: rgba(22, 163, 74, 0.10);
  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.08);
  --amber: #d97706;
  --amber-dim: rgba(217, 119, 6, 0.11);
  --purple: #7c3aed;
  --purple-dim: rgba(124, 58, 237, 0.12);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 10px 30px rgba(30, 58, 138, 0.07);
  --shadow-lg: 0 8px 20px rgba(15, 23, 42, 0.08), 0 24px 64px rgba(30, 58, 138, 0.16);
  --mask: rgba(13, 20, 36, 0.48);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --card: #151f38;
  --card-2: #1b2745;
  --card-3: #22304f;
  --primary: #5b8cff;
  --primary-dim: rgba(91, 140, 255, 0.15);
  --primary-grad: linear-gradient(135deg, #7aa5ff 0%, #4d7ef2 52%, #3562d8 100%);
  --text: #e8edf7;
  --text-dim: #9aa7c0;
  --text-faint: #64738f;
  --border: #263453;
  --border-strong: #324265;
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.13);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.13);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.13);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.16);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.3), 0 24px 64px rgba(0, 0, 0, 0.42);
  --mask: rgba(2, 6, 16, 0.66);
}

* { box-sizing: border-box; }

/* hidden 属性必须能压过组件自身的 display:flex（UA 的 [hidden]{display:none} 优先级低于类选择器，
   否则 #app / #loginView / #modal 会带着遮罩常驻显示，整页无法点击） */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.65 -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); }

/* 键盘操作的可见焦点：鼠标点击不出现（:focus-visible），只有 Tab 导航才亮，
   既照顾键盘用户，又不会让鼠标操作满屏焦点框 */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ipt:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* 弹层打开时锁住背景滚动：否则遮罩后面的面板还在跟着滚，视线和注意力都会飘 */
body.modal-open { overflow: hidden; }

/* 尊重系统「减少动态效果」：关掉过渡与动画，避免前庭不适（无障碍通行做法） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 细滚动条统一到弹层/表格/侧栏/选择列表：默认滚动条在圆角卡片里很突兀 */
.tbl-wrap, .side-nav, .sel-list { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* 未启用脚本时的兜底：此时 #loginView / #app 还带着 hidden，页面上本来什么都没有 */
.noscript {
  max-width: 520px; margin: 18vh auto 0; padding: 22px 24px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); text-align: center; line-height: 1.9; color: var(--text-dim);
}
.noscript b { display: block; font-size: 16px; color: var(--text); margin-bottom: 8px; }

.faint { color: var(--text-faint); }
.faint-line { font-size: 12px; color: var(--text-faint); }
.tac { text-align: center; }
.mt8 { margin-top: 8px; }
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 底部留出 ICP 页脚的高度：矮窗口下居中的登录卡不与页脚相撞 */
  padding: 24px 24px 56px;
  background:
    radial-gradient(900px 500px at 12% -8%, var(--primary-dim), transparent 62%),
    radial-gradient(800px 420px at 104% 106%, rgba(124, 58, 237, 0.12), transparent 60%),
    var(--bg);
}
.login-card {
  width: 396px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px 28px 26px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-head { margin-bottom: 18px; }
.login-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--primary-grad); color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.32);
}
.login-logo svg { width: 24px; height: 24px; }
.login-title { font-size: 19px; font-weight: 800; letter-spacing: 1.5px; margin-top: 14px; }
.login-rule {
  display: block; width: 34px; height: 3px; border-radius: 2px;
  background: var(--primary-grad); margin: 12px auto 0;
}
.qr-box {
  width: 228px; height: 228px; margin: 18px auto 8px;
  border: 1px solid var(--border); border-radius: 16px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  overflow: hidden; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}
.qr-box .qr-render { width: 212px; height: 212px; }
.qr-box .qr-render svg,
.qr-box .qr-render img { width: 100%; height: 100%; display: block; }
.qr-spin { font-size: 13px; color: #64748b; }
.login-code-wrap { margin: 12px 0 2px; }
.login-code-label { font-size: 12px; color: var(--text-faint); }
.login-code {
  display: inline-block; margin: 8px 0;
  padding: 8px 14px 8px 22px; border-radius: 10px;
  background: var(--primary-dim); color: var(--primary);
  font: 700 26px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 8px; font-variant-numeric: tabular-nums;
}
.login-code-tip { font-size: 12px; color: var(--text-dim); line-height: 1.7; }
.login-msg { min-height: 20px; font-size: 13px; color: var(--red); margin: 8px 0 12px; }
.login-msg.ok { color: var(--green); }
/* 版本标识：仅用于核对当前部署版本，弱化显示不抢占视觉 */
.login-ver { margin-top: 14px; font-size: 11px; color: var(--text-dim); text-align: center; opacity: .75; }

/* ---------------- 布局 ---------------- */
#app { display: flex; min-height: 100vh; }
.side {
  width: 224px; flex: none;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width 0.18s ease; /* 折叠/展开：只过渡宽度，短促利落不拖沓 */
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  font-size: 15px; font-weight: 800; letter-spacing: 0.5px;
}
.side-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--primary-grad); color: #fff;
}
.side-logo svg { width: 16px; height: 16px; }
.side-fold {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; color: var(--text-faint);
  transition: background 0.12s, color 0.12s;
}
.side-fold:hover { background: var(--card-2); color: var(--primary); }
.side-fold svg { width: 15px; height: 15px; transition: transform 0.18s ease; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: calc(100% - 20px); text-align: left;
  margin: 2px 10px; padding: 9px 12px;
  border-radius: 10px; color: var(--text-dim); font-size: 14px;
  transition: background 0.12s, color 0.12s;
}
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--card-2); }
.nav-item.on { background: var(--primary-dim); color: var(--primary); font-weight: 700; }
/* 底部内边距让出 ICP 页脚（约 29px）的高度：侧栏贴底的版本号不被盖住 */
.side-foot { border-top: 1px solid var(--border); padding: 12px 14px 40px; }
/* pre-line：内容里用 \n 分「昵称」与「角色」两行，不声明的话换行会被折叠成空格 */
.user-box { font-size: 12px; color: var(--text-dim); line-height: 1.7; margin-bottom: 10px; word-break: break-all; white-space: pre-line; }
.side-btns { display: flex; gap: 8px; }
.side-btns .btn { flex: 1; }
.side-btns .btn svg { width: 15px; height: 15px; flex: none; }
.side-ver { margin-top: 8px; font-size: 11px; color: var(--text-dim); text-align: center; opacity: .75; }

/* 折叠为窄条（icon rail）：只留图标，名称走 title 悬停提示；状态由 localStorage 记忆 */
.side.fold { width: 70px; }
.side.fold .side-brand { flex-direction: column; gap: 8px; padding: 14px 8px 10px; }
.side.fold .side-name { display: none; }
.side.fold .side-fold svg { transform: rotate(180deg); }
.side.fold .nav-item { justify-content: center; padding: 9px 0; }
.side.fold .nav-text { display: none; }
.side.fold .side-foot { padding: 12px 12px 40px; }
.side.fold .user-box { display: none; }
.side.fold .side-btns { flex-direction: column; gap: 6px; }
.side.fold .side-btns .btn { width: 100%; padding: 0; }
.side.fold .btn-text { display: none; }
.side.fold .side-ver-app { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 24px 12px;
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.tb-title { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 统计行也可能很长（版本 + 时间 + 题数 + 试卷 + 年份）：同样收成一行省略，不去挤压右侧按钮 */
.tb-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 顶栏统计读取失败：明确标红并可点击重试，别让旧数字继续以权威值的样子挂着 */
.tb-meta.meta-bad { color: var(--red, #dc2626); cursor: pointer; text-decoration: underline dotted; }
.tb-right { display: flex; gap: 8px; align-items: center; flex: none; }
/* 标题块可压缩：默认 flex 项最小宽度是内容宽，长标题会把右侧按钮挤出屏幕外
   （窄屏下表现为整页出现横向滚动条） */
.topbar > div:first-child { min-width: 0; }
.content { padding: 18px 24px 48px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: 9px; font-size: 13px; font-weight: 600;
  transition: transform 0.1s, opacity 0.15s, filter 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary-grad); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28); }
.btn-ghost { background: var(--primary-dim); color: var(--primary); }
.btn-outline { background: var(--card); color: var(--text-dim); border: 1px solid var(--border-strong); }
.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; transform: none; box-shadow: none; cursor: not-allowed; }
/* 悬停反馈：只做 0.15s 内的亮度/描边过渡，无位移无弹跳 */
.btn-primary:not([disabled]):hover { filter: brightness(1.08); }
.btn-ghost:not([disabled]):hover { filter: brightness(1.05); }
.btn-outline:not([disabled]):hover { border-color: var(--primary); color: var(--primary); }
.btn-danger:not([disabled]):hover { filter: brightness(0.96); }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex; align-items: center;
  padding: 1px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--primary-dim); color: var(--primary);
}
.tag-gray { background: var(--card-3); color: var(--text-dim); }
.tag-green { background: var(--green-dim); color: var(--green); }
.tag-red { background: var(--red-dim); color: var(--red); }
.tag-amber { background: var(--amber-dim); color: var(--amber); }
.tag-purple { background: var(--purple-dim); color: var(--purple); }

/* ---------------- 表单 ---------------- */
.toolbar { display: flex; gap: 10px; row-gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 160px; }
/* 筛选与操作分组：筛选行左侧，操作按钮推到行末；窗口变窄时整组换行，不再挤成一坨 */
.toolbar .ipt-search { flex: 1 1 240px; }
.toolbar select.ipt { min-width: 116px; }
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 980px) { .toolbar-actions { margin-left: 0; } }
.ipt {
  height: 34px; padding: 0 10px; min-width: 0;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.ipt:focus { outline: none; border-color: var(--primary); background: var(--card); }
.ipt-search { min-width: 220px; }
.ipt-num { width: 90px; }
textarea.ipt { height: auto; padding: 8px 10px; resize: vertical; min-height: 74px; line-height: 1.7; }
select.ipt { padding-right: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.field { margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.field-hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
/* 表单控件撑满整行：input/textarea/select 默认按固有宽度渲染（textarea 约 20 字符宽），
   不撑满会让右侧留大片空白、长文本被迫多折行，弹层内容因此被拉长 */
.field > .ipt { width: 100%; }
.field > .ipt-num { width: 90px; }
/* 行内可伸缩容器（如「名称输入框 + 按钮」）：让其中的控件撑满剩余宽度 */
.grow { flex: 1 1 auto; min-width: 0; }
.grow > .ipt { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick { display: inline-flex; gap: 6px; }
.pick button {
  padding: 5px 14px; border-radius: 8px; font-size: 13px;
  background: var(--card-2); border: 1px solid var(--border); color: var(--text-dim);
}
.pick button.on { background: var(--primary-dim); color: var(--primary); border-color: transparent; font-weight: 700; }

/* ---------------- 表格 ---------------- */
.tbl-wrap {
  overflow: auto; max-width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow);
}
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  padding: 9px 12px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.tbl th { font-size: 12px; color: var(--text-dim); font-weight: 600; white-space: nowrap; background: var(--card-2); }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: var(--card-2); }
.tbl tbody tr.on { background: var(--primary-dim); }
.tbl tbody tr:last-child td { border-bottom: none; }
.cell-stem { display: block; max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.ops-link { color: var(--primary); font-size: 12px; padding: 1px 2px; }
.ops-link.danger { color: var(--red); }
.ops-link:hover { text-decoration: underline; }
.q-no { font: 600 12px/1.6 ui-monospace, Consolas, monospace; color: var(--primary); white-space: nowrap; }
/* 表格/列表内的紧凑控件（批量导入预览的题型、目录下拉）：不撑破单元格 */
.ipt-sm { width: auto; max-width: 100%; padding: 3px 6px; font-size: 12px; border-radius: 8px; }

/* 分页条：窄屏允许换行（加了「首页 / 末页」后按钮变多），避免挤出容器 */
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; row-gap: 8px; margin-top: 12px; }
.pager-info { font-size: 12px; color: var(--text-dim); }

/* ---------------- 弹层 ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; animation: modalIn 0.16s ease-out; }
/* 弹层只做 0.16s 透明度淡入：无缩放无位移，避免多余动画 */
@keyframes modalIn { from { opacity: 0; } }
.modal-mask { position: absolute; inset: 0; background: var(--mask); }
.modal-card {
  position: relative; display: flex; flex-direction: column;
  width: min(720px, 100%); max-height: 88vh;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg);
}
.modal-wide { width: min(1060px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; font-weight: 800; }
.modal-x { font-size: 20px; color: var(--text-faint); line-height: 1; padding: 2px 6px; border-radius: 6px; }
.modal-x:hover { background: var(--card-2); color: var(--text); }
.modal-body {
  padding: 16px 18px 18px; overflow: auto; overscroll-behavior: contain;
  /* 细滚动条：默认滚动条在 16px 圆角卡片里很突兀 */
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.modal-body::-webkit-scrollbar { width: 10px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border); border: 3px solid transparent; background-clip: content-box; border-radius: 999px;
}
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--text-faint); border: 3px solid transparent; background-clip: content-box; }
/* 允许换行：按钮多的弹层（如合并账号的「返回 / 确认合并」叠加窄窗口）此前会顶破卡片右边缘 */
.modal-foot {
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; row-gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.confirm-msg { font-size: 14px; line-height: 1.8; white-space: pre-wrap; }

.lockbar {
  background: var(--amber-dim); color: var(--amber);
  border-radius: 10px; padding: 8px 12px; font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;
}
/* 保存前判重提示（就地展开，不弹二次确认框，避免覆盖正在编辑的表单） */
.dupe-warn {
  background: var(--red-dim); color: var(--text);
  border: 1px solid var(--red); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}
.dupe-warn-t { font-weight: 800; color: var(--red); margin-bottom: 4px; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; z-index: 99;
  transform: translateX(-50%) translateY(16px);
  max-width: min(560px, calc(100vw - 40px));
  background: #111827; color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast-err { background: var(--red); }

/* ---------------- 视图内区块 ---------------- */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
  background: var(--card-2); border: 1px solid var(--border); color: var(--text-dim);
}
.tab.on { background: var(--primary-dim); color: var(--primary); border-color: transparent; font-weight: 700; }
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.panel-title { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.summary-line { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
/* 顶栏统计过期提示：把「顶栏 4566 / 列表 4830」的矛盾摆到明面并给出一键修复 */
.stale-hint {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 8px 12px; border-radius: 10px;
  background: var(--card-3); border: 1px solid var(--amber, #d97706);
  font-size: 12px; line-height: 1.7;
}
.stale-hint[hidden] { display: none; }
.stale-text { flex: 1; min-width: 0; color: var(--text); }
.stale-hint > .btn { flex-shrink: 0; }
/* 资料统计条：总数 / 已确认 / 未确认 / 导入中 + 确认率进度（等宽数字防跳动） */
.statbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.stat-cell { display: flex; align-items: baseline; gap: 6px; }
.stat-cell b { font-size: 19px; line-height: 1.2; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-cell span { font-size: 12px; color: var(--text-dim); }
.stat-cell.ok b { color: var(--green); }
.stat-cell.no b { color: var(--amber); }
.stat-cell.imp b { color: var(--primary); }
.stat-sep { width: 1px; height: 20px; background: var(--border); flex: none; }
.stat-prog { flex: 1; min-width: 110px; height: 6px; border-radius: 999px; background: var(--card-3); overflow: hidden; }
.stat-prog > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #4ade80, var(--green)); transition: width 0.35s ease; }
.stat-pct { font-size: 13px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.batchbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--primary-dim); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px;
  font-size: 13px; color: var(--primary);
}
.kn-node { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--card-2); }
.kn-node-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kn-sub-list { margin-top: 8px; padding-left: 4px; }
.kn-sub-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
/* 目录管理弹层：一级目录卡片 + 二级目录行（复用 .kn-node 卡片样式，只补行内排布） */
.dir-add { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.dir-add > .ipt { flex: 1; min-width: 0; }
.dir-add > .btn { flex-shrink: 0; }
.dir-add-sub { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.dir-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-size: 13px; }
.kn-sub-list .dir-row { padding: 4px 0; }
.dir-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.dir-row-count { flex-shrink: 0; font: 600 12px/1.6 ui-monospace, Consolas, monospace; }
.dir-row-ops { flex-shrink: 0; display: flex; gap: 6px; }
.dir-rename-ipt { flex: 1; min-width: 0; }
.dir-del {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 6px 0 2px; padding: 8px 10px; border-radius: 10px;
  background: var(--card-3); border: 1px solid var(--border-strong);
}
.dir-del-tip { flex-basis: 100%; font-size: 12px; }
.dir-busy { opacity: .55; pointer-events: none; }
/* 题库运维弹层：诊断结果 + 备份表格 */
.ops-sec { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--card-2); }
.ops-out { margin-top: 8px; }
.diag-row { display: flex; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.diag-file { flex: 1; min-width: 0; font-weight: 700; }
.diag-state { flex-shrink: 0; }
.diag-ok { color: var(--green, #16a34a); font-weight: 700; }
.diag-bad { color: var(--red, #dc2626); font-weight: 700; }
.diag-ok-line { margin-top: 6px; color: var(--green, #16a34a); font-weight: 700; font-size: 13px; }
/* 题量口径明细：文件条数 / 录入 / 隐藏 / 应有总数 逐行摊开 */
.diag-bank { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.diag-bank-row { font-size: 12px; color: var(--text-dim); line-height: 1.8; }
/* 统计过期提示：诊断结论与「一键重建」入口同屏可见 */
.diag-stale {
  margin-top: 8px; padding: 8px 10px; border-radius: 10px;
  background: var(--card-3); border: 1px solid var(--amber, #d97706);
  font-size: 13px; color: var(--text); line-height: 1.7;
}
.diag-issues { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--card-3); }
.diag-issue { font-size: 13px; color: var(--red, #dc2626); line-height: 1.7; }
.diag-suggest { margin-top: 8px; font-size: 12px; color: var(--text-dim); line-height: 1.7; white-space: pre-wrap; }
.sel-list { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.sel-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px dashed var(--border); font-size: 13px; }
.sel-row:last-child { border-bottom: none; }
.sel-row .idx { width: 30px; color: var(--text-faint); font: 600 12px/1.6 ui-monospace, Consolas, monospace; }
.sel-row .stem { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-preview { background: var(--card-2); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--text-dim); line-height: 1.9; white-space: pre-wrap; }
/* 批量新增的详细格式说明（分节 + 对照表 + 代码片段） */
.hint-box { font-size: 13px; color: var(--text-dim); }
.hint-h { font-size: 13px; font-weight: 800; color: var(--text); margin: 12px 0 6px; }
.hint-box .hint-h:first-child { margin-top: 0; }
.hint-sub { font-size: 12px; font-weight: 700; color: var(--text-dim); margin: 8px 0 4px; }
.hint-list { margin: 0 0 4px; padding-left: 18px; }
.hint-list > li { margin: 3px 0; line-height: 1.75; }
.hint-code { padding: 0 4px; border-radius: 5px; background: var(--card-3); color: var(--primary); font: 600 12px/1.7 ui-monospace, Consolas, monospace; }
.hint-code-block {
  margin: 6px 0; padding: 8px 10px; border-radius: 8px;
  background: var(--card-3); color: var(--text-dim);
  font: 12px/1.8 ui-monospace, Consolas, monospace;
  word-break: break-all; white-space: pre-wrap;
}
.hint-box .tbl-wrap { margin: 6px 0; }
.hint-box .tbl th, .hint-box .tbl td { padding: 5px 8px; font-size: 12px; }
.prog { height: 6px; border-radius: 999px; background: var(--card-3); overflow: hidden; margin-top: 8px; }
.prog > i { display: block; height: 100%; width: 0; background: var(--primary-grad); transition: width 0.2s; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* 逐条修改（条文级）：标题栏 + 分组 + 条文行 */
.art-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.art-head .ipt-search { flex: 1; min-width: 200px; }
.art-group { font-size: 13px; font-weight: 800; margin: 14px 0 8px; }
.art-group.sub { font-size: 12px; font-weight: 700; color: var(--text-dim); margin: 10px 0 6px; padding-left: 12px; }
.art-row {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 10px; margin-bottom: 6px;
  background: var(--card-2); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.art-row:hover { border-color: var(--primary); }
.art-no { flex: none; min-width: 62px; font: 600 12px/1.7 ui-monospace, Consolas, monospace; color: var(--primary); }
.art-main { flex: 1; min-width: 0; }
.art-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 编辑台列表内联标记：正文本身用的是 .mk-hl.mk-b/mk-r（标粗=加粗、标红=红字）。
   这里的行是 12px 浅灰摘要，单靠加粗几乎看不出来，故在摘要行里额外加深/加重一档，
   让两类标记在紧凑行中仍可区分；标粗标红(mk-br)沿用基础样式。 */
.art-meta .mk-hl.mk-b { color: var(--text-dim); }
.art-meta .mk-hl.mk-r { font-weight: 600; }
.art-foot { display: flex; justify-content: center; margin-top: 10px; }

/* 编辑台：章/节标题行（结构维护入口）+ 导语行（小标题逐段核对）+ 条文行状态 */
.node-head {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 14px 0 8px; padding: 8px 12px;
  background: var(--card-3); border-left: 3px solid var(--primary); border-radius: 8px;
}
.node-head.sub { margin: 10px 0 6px 14px; padding: 6px 10px; background: var(--card-2); border-left-color: var(--text-faint); }
.node-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 2px; font-size: 13px; }
.node-name b { flex: none; color: var(--primary); }
.node-head.sub .node-name b { color: var(--text-dim); }
.node-name span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-ops, .art-ops { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; flex: none; }
.ops-link[disabled] { color: var(--text-faint); cursor: not-allowed; text-decoration: none; }
.art-row.ok { background: var(--green-dim); border-color: transparent; }
.art-row.ok .art-no { color: var(--green); }
.art-main.dim { opacity: 0.72; }
.intro-row {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 10px; margin-bottom: 6px;
  background: var(--card-2); border: 1px dashed var(--border-strong); border-radius: 10px;
}
.intro-row.ok { background: var(--green-dim); border-style: solid; border-color: transparent; }
.intro-row .art-main { cursor: pointer; }

/* 划字标记：段落渲染 + 选区浮层 + 标记芯片 */
.mk-body { margin-top: 8px; }
.mk-item { padding: 10px 12px; margin-bottom: 8px; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; }
.mk-para { font-size: 14px; line-height: 1.95; white-space: pre-wrap; word-break: break-word; }
.mk-hl { border-radius: 3px; padding: 0 1px; }
.mk-hl.mk-b { font-weight: 800; }
.mk-hl.mk-r { color: var(--red); }
.mk-hl.mk-br { font-weight: 800; color: var(--red); }
.mk-pops { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 6px; opacity: 0; transition: opacity 0.12s; }
.mk-item:hover .mk-pops { opacity: 1; }
.mk-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.mk-chip { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; padding: 2px 8px; border-radius: 999px; font-size: 12px; cursor: pointer; background: var(--card-3); }
.mk-chip i { font-style: normal; font-weight: 700; flex: none; }
.mk-chip em { font-style: normal; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-chip.mk-r, .mk-chip.mk-br { background: var(--red-dim); color: var(--red); }
.mk-chip.mk-br { font-weight: 700; }
.mk-snip {
  margin-top: 8px; padding: 10px 12px;
  background: var(--card-2); border: 1px dashed var(--border-strong); border-radius: 10px;
  font-size: 14px; line-height: 1.9; white-space: pre-wrap; word-break: break-word;
}
.mk-tool {
  position: fixed; z-index: 80; display: flex; gap: 2px; padding: 4px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.mk-tool-btn { padding: 5px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.mk-tool-btn:hover { background: var(--primary-dim); color: var(--primary); }
.faint-line.danger { color: var(--red); }
/* 触屏：标记芯片的操作行常驻（没有 hover 可依赖），并把点击热区放大到手指能点中的尺寸。
   只放大内边距与高度，字号不变，避免触屏上「一切都是大号字」的粗糙感 */
@media (hover: none) {
  .mk-pops { opacity: 1; }
  .btn { height: 40px; padding: 0 16px; }
  .btn-sm { height: 34px; padding: 0 12px; }
  .ops-link { padding: 7px 8px; }
  .tab { padding: 9px 16px; }
  .pick button { padding: 9px 16px; }
  .nav-item { padding: 12px; }
  .modal-x { padding: 6px 10px; }
}

@media (max-width: 860px) {
  .side { width: 168px; }
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
  .row2 { grid-template-columns: 1fr; }
}

/* ---------------- ICP 备案页脚 ---------------- */
/* 境内网站须在页脚常驻备案号并可点入工信部查询页。固定视口底部、弱视觉不抢焦点；
   pointer-events 只放行链接、其余位置点击穿透，不挡正文最后一行与表格操作；
   层级低于弹层（60）/toast（99）/侧栏下拉（80），弹层打开时页脚被遮罩正常盖住 */
.icp-foot {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding: 4px 12px;
  text-align: center;
  font-size: 12px;
  line-height: 20px;
  color: var(--text-faint);
  background: var(--bg);
  border-top: 1px solid var(--border);
  pointer-events: none;
}
.icp-foot a { color: var(--text-faint); pointer-events: auto; text-decoration: none; }
.icp-foot a:hover { color: var(--primary); text-decoration: underline; }