/* ══════════════════════════════════════════════════════════════════════
   网课助手 · 管理后台 UI 系统
   暗色主题 · 桌面优先 · ≤900px 抽屉式侧栏 · 零依赖
   ──────────────────────────────────────────────────────────────────────
   01 设计令牌            06 数据表格        11 空态 / 加载态
   02 基础与排版          07 标签与徽章      12 弹窗与轻提示
   03 应用外壳            08 按钮            13 通用工具类
   04 页头                09 表单与开关      14 任务事件流
   05 卡片与统计          10 分页 / 代码     15 响应式 / 无障碍
   ══════════════════════════════════════════════════════════════════════ */

/* ── 01 设计令牌 ───────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* 表面层级：bg → bg-2（卡片）→ bg-3（表头/浮层）→ bg-4 */
  --bg: #0f1115;
  --bg-2: #161a21;
  --bg-3: #1d222b;
  --bg-4: #232936;
  --bg-inset: #0b0d12;

  /* 描边 */
  --line: #262c37;
  --line-2: #333b4a;
  --line-soft: #1f242e;

  /* 文字（均已按 WCAG AA 校准：#9aa4b2 ≈ 6.8:1，#8a93a5 ≈ 5.6:1） */
  --text: #e5e9f0;
  --text-2: #9aa4b2;
  --text-3: #8a93a5;
  --text-4: #6b7486;

  /* 主色与语义色 */
  --accent: #4f7cff;
  --accent-2: #6f9bff;
  --accent-3: #3f68e0;
  --accent-soft: rgba(79, 124, 255, .12);
  --accent-line: rgba(79, 124, 255, .34);

  --green: #2fbf71;
  --green-2: #46d68a;
  --amber: #e8a33d;
  --amber-2: #f2b95d;
  --red: #e5556b;
  --red-2: #f07286;
  --purple: #9b6dff;
  --purple-2: #b18cff;
  --cyan: #35c4d4;
  --cyan-2: #5ad4e2;

  /* 尺寸 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 236px;
  --content-max: 1480px;
  --gap: 16px;
  --control-h: 36px;

  /* 阴影与焦点 */
  --shadow: 0 18px 44px rgba(0, 0, 0, .48);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28), 0 8px 20px -12px rgba(0, 0, 0, .55);
  --ring: 0 0 0 3px rgba(79, 124, 255, .30);

  /* 动效 */
  --ease: cubic-bezier(.2, .7, .3, 1);
  --dur: .16s;
}

/* ── 02 基础与排版 ─────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 顶部氛围光，避免大面积纯色发闷 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 380px at 62% -10%, rgba(79, 124, 255, .10), transparent 70%),
    radial-gradient(700px 320px at 92% 4%, rgba(155, 109, 255, .06), transparent 72%);
}

::selection { background: rgba(79, 124, 255, .36); color: #fff; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #9db8ff; }

h1, h2, h3, h4 { letter-spacing: .2px; }

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: #2b3240 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #2b3240;
  border: 2px solid transparent;
  border-radius: 8px;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #3b4457; background-clip: content-box; border: 2px solid transparent; }

/* ── 03 应用外壳 ───────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* 侧栏 ── */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  background: linear-gradient(180deg, #141821 0%, var(--bg-2) 42%, #12151b 100%);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.logo {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #9db6ff;
  line-height: 1;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(79, 124, 255, .30), rgba(79, 124, 255, .06));
  border: 1px solid rgba(79, 124, 255, .30);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}
.brand-name { font-size: 14px; font-weight: 650; letter-spacing: .3px; line-height: 1.35; }
.brand-sub { font-size: 11px; color: var(--text-4); letter-spacing: .4px; line-height: 1.4; }

#nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 2px 8px;
  margin: 0 -2px;
  scrollbar-gutter: stable;
}
.nav-group + .nav-group { margin-top: 10px; }
.nav-group-label {
  padding: 6px 10px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .13em;
  color: var(--text-4);
  text-transform: uppercase;
}

#nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.45;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
#nav a i {
  flex: 0 0 20px;
  width: 20px;
  height: 18px;
  display: grid;
  place-items: center;
  color: currentColor;
  line-height: 1;
  opacity: .72;
  transition: opacity var(--dur) var(--ease);
}
#nav a span { flex: 1 1 auto; min-width: 0; }
#nav a:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
#nav a:hover i { opacity: 1; }
#nav a.active {
  background: linear-gradient(90deg, rgba(79, 124, 255, .24), rgba(79, 124, 255, .07));
  color: #e2e9ff;
  box-shadow: inset 0 0 0 1px rgba(79, 124, 255, .26);
}
#nav a.active i { opacity: 1; }
#nav a.active::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  width: 3px;
  height: 16px;
  border-radius: 3px;
  transform: translateY(-50%);
  background: var(--accent);
  box-shadow: 0 0 10px rgba(79, 124, 255, .85);
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 10px 11px;
  font-size: 12px;
  color: var(--text-3);
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-4);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .04);
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.status-dot.ok {
  background: var(--green-2);
  box-shadow: 0 0 0 3px rgba(47, 191, 113, .16), 0 0 10px rgba(47, 191, 113, .7);
}
.status-dot.bad {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(229, 85, 107, .18), 0 0 10px rgba(229, 85, 107, .6);
}

/* 主列 ── */
.shell {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 顶栏：仅窄屏出现 */
.topbar {
  display: none;
  position: relative;
  z-index: 40;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(15, 17, 21, .88);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.topbar-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-2);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text); border-color: #3d4658; }
.burger, .burger::before, .burger::after {
  display: block;
  width: 15px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
}
.burger { position: relative; }
.burger::before, .burger::after { content: ''; position: absolute; left: 0; }
.burger::before { top: -5px; }
.burger::after { top: 5px; }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  font-size: 11.5px;
  color: var(--text-3);
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  white-space: nowrap;
}
.status-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-4);
}
.status-chip.ok { color: #8fe3b4; border-color: rgba(47, 191, 113, .3); }
.status-chip.ok i { background: var(--green-2); box-shadow: 0 0 8px rgba(47, 191, 113, .8); }
.status-chip.bad { color: #ffb3bd; border-color: rgba(229, 85, 107, .34); }
.status-chip.bad i { background: var(--red); box-shadow: 0 0 8px rgba(229, 85, 107, .8); }

/* 内容区 ── */
#main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px clamp(16px, 2.2vw, 34px) 72px;
  overscroll-behavior-y: contain;
}
#main > * { max-width: var(--content-max); margin-inline: auto; }
#main > :last-child { margin-bottom: 0; }

/* 移动端遮罩 */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 7, 11, .62);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: fade-in .18s var(--ease);
}
.scrim[hidden] { display: none; }

/* ── 04 页头 ──────────────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line-soft);
}
.page-head h1 {
  margin: 0 0 5px;
  font-size: 21px;
  line-height: 1.28;
  font-weight: 650;
  letter-spacing: .3px;
}
.page-head .sub {
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.55;
}
.page-head .row { align-items: center; gap: 8px; }

/* ── 05 卡片与统计 ────────────────────────────────────────────────── */
.grid { display: grid; gap: var(--gap); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  position: relative;
  padding: 16px 18px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* 卡片标题：左侧色条 + 分隔线 */
.card > h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--text-2);
}
.card > h2::before {
  content: '';
  flex: 0 0 auto;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(79, 124, 255, .75);
}

/* 统计磁贴：顶边色条 + 极轻角部色晕 + 等宽大数字 */
.card:has(.stat) {
  padding: 16px 18px 15px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .026), transparent 74%),
    var(--bg-2);
}
.card:has(.stat)::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--tone, var(--line-2)), transparent 78%);
  opacity: .9;
}
.card:has(.stat)::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -24px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  pointer-events: none;
  opacity: .62;
  background: radial-gradient(circle, var(--tone-glow, rgba(255, 255, 255, .04)), transparent 70%);
}
.card:has(.stat.accent) { --tone: var(--accent); --tone-glow: rgba(79, 124, 255, .13); }
.card:has(.stat.green) { --tone: var(--green); --tone-glow: rgba(47, 191, 113, .12); }
.card:has(.stat.amber) { --tone: var(--amber); --tone-glow: rgba(232, 163, 61, .12); }
.card:has(.stat.red) { --tone: var(--red); --tone-glow: rgba(229, 85, 107, .12); }
.card:has(.stat.purple) { --tone: var(--purple); --tone-glow: rgba(155, 109, 255, .12); }
.card:has(.stat.good) { --tone: var(--green); --tone-glow: rgba(47, 191, 113, .12); }
.card:has(.stat.active) { --tone: var(--accent); --tone-glow: rgba(79, 124, 255, .13); }
.card:has(.stat.changed) { --tone: var(--purple); --tone-glow: rgba(155, 109, 255, .12); }
.card:has(.stat.warn) { --tone: var(--red); --tone-glow: rgba(229, 85, 107, .12); }

.stat {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.stat .num {
  font-size: 31px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat .lbl {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
  letter-spacing: .02em;
  text-align: left;
}
.stat.accent .num { color: var(--accent-2); }
.stat.green .num { color: var(--green-2); }
.stat.amber .num { color: var(--amber-2); }
.stat.red .num { color: var(--red-2); }
.stat.purple .num { color: var(--purple-2); }
/* 语义色：与具体页面无关，全站同一指标同一颜色 */
.stat.good .num { color: var(--green-2); }
.stat.active .num { color: var(--accent-2); }
.stat.changed .num { color: var(--purple-2); }
.stat.warn .num { color: var(--red-2); }
/* 零值不上色：颜色必须携带信息，0 没有异常含义时不该报警 */
.stat .num.zero { color: var(--text-3); }

/* 无标题卡片（纯内容容器）保持标准内边距 */
.card:not(:has(h2)):not(:has(.stat)) { padding: 15px 17px; }

/* ── 06 数据表格 ──────────────────────────────────────────────────── */
.table-wrap {
  max-height: min(72vh, 940px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: var(--shadow-sm);
  overscroll-behavior: contain;
}
.modal-body .table-wrap { max-height: none; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: var(--text);
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-3);
  white-space: nowrap;
  background: var(--bg-3);
  border-bottom: 1px solid var(--line-2);
}
th:first-child { border-top-left-radius: 11px; }
th:last-child { border-top-right-radius: 11px; }

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr:nth-child(even) { background: rgba(255, 255, 255, .014); }
tbody tr:hover { background: rgba(79, 124, 255, .07); }
tbody tr:last-child td { border-bottom: 0; }

td.title-cell { max-width: 560px; }
td.title-cell .q {
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
td.title-cell .opts {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

td .row { gap: 6px; }
td:last-child .btn + .btn { margin-left: 0; }

/* ── 07 标签与徽章 ────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: .02em;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid transparent;
}
.tag.blue   { background: rgba(79, 124, 255, .15);  color: #9db8ff; border-color: rgba(79, 124, 255, .32); }
.tag.green  { background: rgba(47, 191, 113, .15);  color: #5fdd97; border-color: rgba(47, 191, 113, .32); }
.tag.amber  { background: rgba(232, 163, 61, .15);  color: #f0b862; border-color: rgba(232, 163, 61, .32); }
.tag.red    { background: rgba(229, 85, 107, .15);  color: #f78d9d; border-color: rgba(229, 85, 107, .34); }
.tag.purple { background: rgba(155, 109, 255, .15); color: #b99bff; border-color: rgba(155, 109, 255, .32); }
.tag.cyan   { background: rgba(53, 196, 212, .15);  color: #6cdae6; border-color: rgba(53, 196, 212, .32); }
.tag.gray   { background: rgba(154, 164, 178, .12); color: var(--text-2); border-color: rgba(154, 164, 178, .24); }

.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }

.answer-badge {
  display: inline-block;
  padding: 1px 7px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: .02em;
  color: var(--green-2);
  background: rgba(47, 191, 113, .12);
  border: 1px solid rgba(47, 191, 113, .22);
  border-radius: 6px;
}

/* ── 08 按钮 ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border: 1px solid var(--accent);
  border-radius: 9px;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover {
  color: #fff;
  background: linear-gradient(180deg, #85a9ff, var(--accent-2));
  border-color: var(--accent-2);
  box-shadow: 0 5px 16px -6px rgba(79, 124, 255, .75);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

.btn.ghost {
  color: var(--text-2);
  background: rgba(255, 255, 255, .03);
  border-color: var(--line-2);
}
.btn.ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .075);
  border-color: #3d4658;
  box-shadow: none;
}
.btn.danger {
  color: var(--red-2);
  background: rgba(229, 85, 107, .14);
  border-color: rgba(229, 85, 107, .42);
}
.btn.danger:hover {
  color: #ffa5b2;
  background: rgba(229, 85, 107, .25);
  border-color: var(--red);
  box-shadow: none;
}
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 30px; height: 30px; padding: 0; border-radius: 8px; font-size: 13px; }

/* ── 09 表单与开关 ────────────────────────────────────────────────── */
input, select, textarea, button { font-family: inherit; font-size: 13px; color: var(--text); }

input[type=text], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%;
  height: var(--control-h);
  padding: 0 11px;
  color: var(--text);
  background: var(--bg-inset);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
textarea {
  height: auto;
  min-height: 84px;
  padding: 9px 11px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
}
input:hover, select:hover, textarea:hover { border-color: #3d4658; }
input:focus, select:focus, textarea:focus {
  background: var(--bg-2);
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--text-4); }
select {
  padding-right: 28px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select option { background: var(--bg-3); color: var(--text); }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: .02em;
}
.field .hint {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-4);
}
/* 定时任务表单用的是 <span> 而不是 <label>：label 里嵌套 select 时，
   点文字会穿透触发 select 展开，在弹窗里很难受。这里让 span 跟 label 同款。 */
.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: .02em;
}

/* 弹窗里的错误提示条：平时不占位，出错才出现 */
.err-box {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .32);
  color: #fca5a5;
  font-size: 12.5px;
  line-height: 1.55;
}

/* 停用的定时任务整行压低存在感，一眼能区分「生效中」和「挂着」 */
tr.is-dim > td { opacity: .52; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 220px; }

.switch {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.switch input {
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  margin: 1px 0 0;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  cursor: pointer;
  background: #2a3040;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #aab3c2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  transition: left var(--dur) var(--ease), background var(--dur) var(--ease);
}
.switch input:checked { background: var(--accent); border-color: var(--accent-2); }
.switch input:checked::after { left: 18px; background: #fff; }
.switch input:focus-visible { outline: none; box-shadow: var(--ring); }

/* ── 10 分页 / 代码 ───────────────────────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--text-3);
}
.pager button {
  height: 30px;
  padding: 0 12px;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.pager button:hover:not(:disabled) { background: var(--bg-3); color: var(--text); border-color: #3d4658; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager span { font-variant-numeric: tabular-nums; letter-spacing: .04em; }

pre {
  margin: 0;
  padding: 13px 15px;
  overflow-x: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.72;
  color: #c9d4e4;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 10px;
  tab-size: 2;
}
code {
  padding: 1px 5px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: #c3d0e4;
  background: rgba(255, 255, 255, .055);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
}
pre code { padding: 0; background: none; border: 0; }

/* ── 11 空态 / 加载态 ─────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 72px 0;
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--text-3);
}
.loading::before {
  content: '';
  width: 17px;
  height: 17px;
  border: 2px solid rgba(79, 124, 255, .22);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.empty {
  padding: 46px 20px;
  text-align: center;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-3);
}
.empty .big {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  color: var(--text-3);
  line-height: 1;
  border-radius: 16px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
td.empty { border-bottom: 0; }

/* ── 12 弹窗与轻提示 ──────────────────────────────────────────────── */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 7, 11, .68);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in .16s var(--ease);
}
.modal-mask.hidden { display: none; }

.modal {
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  max-height: 86vh;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .58);
  animation: pop-in .18s var(--ease);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px 13px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.modal-body { padding: 20px; overflow-y: auto; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 900;
  max-width: min(70vw, 540px);
  padding: 11px 18px;
  font-size: 13px;
  color: var(--text);
  background: rgba(29, 34, 43, .97);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(47, 191, 113, .55); box-shadow: var(--shadow), 0 0 0 1px rgba(47, 191, 113, .16); }
.toast.err { color: #ffc2cb; border-color: rgba(229, 85, 107, .55); box-shadow: var(--shadow), 0 0 0 1px rgba(229, 85, 107, .18); }

/* ── 13 通用工具类 ────────────────────────────────────────────────── */
.kv {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 9px 16px;
  margin: 0;
  font-size: 13px;
}
.kv dt { font-size: 12.5px; color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; }

.bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px rgba(79, 124, 255, .55);
  transition: width .5s var(--ease);
}

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }

.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none; }

/* ── 14 任务事件流 ────────────────────────────────────────────────── */
#evCard { display: flex; flex-direction: column; }
#evCard > h2 { padding: 0; border: 0; }

.evbox {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 480px;
  margin-top: 12px;
  padding: 8px 10px;
  overflow-y: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 10px;
  overscroll-behavior: contain;
}
.ev {
  display: grid;
  grid-template-columns: 56px 52px minmax(0, 1fr);
  gap: 2px 8px;
  padding: 3px 5px;
  border-radius: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, .035);
}
.ev:last-child { border-bottom: 0; }
.ev-t {
  font-size: 11px;
  letter-spacing: -.02em;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}
.ev-p { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-m { word-break: break-word; }

.ev.ok   .ev-m { color: #4ade80; }
.ev.err  .ev-m { color: #f87171; }
.ev.warn .ev-m { color: #fbbf24; }
.ev.ans  .ev-m { color: #22d3ee; }
.ev.step .ev-m { color: #a78bfa; }
.ev.info .ev-m { color: #cbd5e1; }
.ev.done { grid-template-columns: minmax(0, 1fr); margin-top: 6px; padding-top: 7px; border-top: 1px dashed var(--line-2); }
.ev.done .ev-m { color: var(--accent-2); font-weight: 600; }

/* 任务页：任务表与事件流左右分栏，滚动时上下文不丢 */
@media (min-width: 1180px) {
  @supports selector(:has(*)) {
    #main:has(> #evCard:not([style*="none"])) {
      display: grid;
      grid-template-columns: minmax(0, 1fr) clamp(360px, 34%, 470px);
      align-content: start;
      gap: 0 var(--gap);
      max-width: var(--content-max);
      margin-inline: auto;
    }
    /* 分栏后左侧变窄：收紧内边距，并让固定列宽回归内容宽度，把空间还给摘要列 */
    #main:has(> #evCard:not([style*="none"])) .table-wrap th,
    #main:has(> #evCard:not([style*="none"])) .table-wrap td {
      padding-left: 9px;
      padding-right: 9px;
    }
    #main:has(> #evCard:not([style*="none"])) .table-wrap th[style*="width"] {
      width: auto !important;
    }
    /* 日期时间列允许在日期与时间之间折行，省出宽度给摘要 */
    #main:has(> #evCard:not([style*="none"])) .table-wrap td.mono[style*="nowrap"] {
      white-space: normal !important;
      line-height: 1.45;
    }
    #main:has(> #evCard:not([style*="none"])) td.title-cell { min-width: 170px; }

    #main:has(> #evCard:not([style*="none"])) > * { max-width: none; margin-inline: 0; }
    #main:has(> #evCard:not([style*="none"])) > .page-head { grid-column: 1 / -1; }
    #main:has(> #evCard:not([style*="none"])) > .table-wrap { grid-column: 1; grid-row: 2; align-self: start; }
    #main:has(> #evCard:not([style*="none"])) > #evCard {
      grid-column: 2;
      grid-row: 2;
      position: sticky;
      top: 12px;
      align-self: start;
      max-height: calc(100vh - 140px);
    }
    #main:has(> #evCard:not([style*="none"])) #evCard .evbox {
      max-height: none;
      min-height: 200px;
    }
  }
}

/* ── 15 页面级组件 ────────────────────────────────────────────────── */

/* 自动填充卡片网格：用 flex 换行 + 自适应增长，
   最后一行卡片会拉伸补齐整行，彻底消除右侧留白 */
.grid.auto {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}
.grid.auto > * {
  flex: 1 1 300px;
  min-width: 0;
  max-width: 100%;
}
.grid.auto > .card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  container-type: inline-size;
}
/* 卡片被拉宽时（例如页面上只有一张账号卡），信息改成横排，避免内部大片留白 */
@container (min-width: 520px) {
  .acct-card .kv-rows { grid-template-columns: 76px minmax(0, 1fr) 76px minmax(0, 1fr); }
  .acct-card .card-foot { justify-content: flex-start; }
}
@container (min-width: 460px) {
  .course-card .course-foot { gap: 16px; }
}

/* 强调色文本 */
.ok-text { color: var(--green-2); }
.err-text { color: var(--red-2); }
.warn-text { color: var(--amber-2); }
.nowrap { white-space: nowrap; }

/* ── 账号卡片 ── */
.acct-card { gap: 13px; }
.acct-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.acct-id { min-width: 0; }
.acct-name {
  font-size: 15px;
  font-weight: 640;
  letter-spacing: .2px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-sub { margin-top: 3px; font-size: 11.5px; color: var(--text-4); letter-spacing: .02em; }
.kv-rows {
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 7px 14px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 2px;
}

/* ── 课程卡片 ── */
.course-card { gap: 11px; }
.course-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.course-title {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
}
/* 底部：上一行是同步时间，下一行是操作按钮。
 *
 * ★ 2026-10-22 从「时间与按钮同一行」改成两行。
 *   加「期末考」后单行 5 个按钮已经吃掉 ~270px，卡片宽 ~330px，
 *   时间戳只剩 ~50px，被压成「同…」——既看不清又显得坏掉。
 *   竖排后两者都拿到整行宽度，按钮永远不换行。 */
.course-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.course-foot .row { gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.synced {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-4);
}

/* ── 统计分组带 ── */
.stat-band { margin-bottom: 20px; }
.stat-band:last-child { margin-bottom: 0; }
.stat-band-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-4);
}
.stat-band-title::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* 来源分布行 */
.source-row { margin-bottom: 14px; }
.source-row:last-child { margin-bottom: 0; }
.source-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12px;
}

/* ── 筛选栏 ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 11px 13px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.filter-search { position: relative; flex: 1 1 260px; min-width: 200px; }
.filter-search input { width: 100%; padding-left: 34px; }
.filter-ico {
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  line-height: 1;
  color: var(--text-4);
  pointer-events: none;
}
.filter-bar select { width: auto; min-width: 124px; }
.filter-count {
  margin-left: auto;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--text-4);
}

/* 置信度小字 */
.conf { margin-top: 3px; font-size: 11px; letter-spacing: .02em; }

/* 旧答案徽章（弱化 + 删除线感） */
.answer-badge.old {
  color: #f78d9d;
  background: rgba(229, 85, 107, .10);
  border-color: rgba(229, 85, 107, .26);
}
.answer-badge.lg {
  padding: 3px 13px;
  font-size: 19px;
  line-height: 26px;
  letter-spacing: .06em;
}

/* ── 处理机制流程图 ── */
.flow-steps { display: grid; gap: 10px; }
.flow-step {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--line-2);
  border-radius: 9px;
}
.flow-step b { color: var(--text); font-weight: 620; }
.flow-step .muted { font-size: 12px; margin-top: 2px; }
.flow-idx {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 12px;
  color: var(--accent-2);
  background: rgba(79, 124, 255, .12);
  border: 1px solid rgba(79, 124, 255, .24);
  border-radius: 7px;
}

/* ── 答题测试结果 ── */
.answer-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 13px 16px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(47, 191, 113, .13), transparent 62%),
    var(--bg-inset);
  border: 1px solid rgba(47, 191, 113, .22);
  border-radius: var(--radius);
}
.answer-hero-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.answer-text {
  margin-bottom: 14px;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.7;
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
}
.evidence-list { display: grid; gap: 8px; margin-bottom: 14px; }
.evidence-item {
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
}
.evidence-item b { color: var(--text-2); font-weight: 600; }
.evidence-item > .muted { margin-top: 3px; font-size: 12px; }
.evidence-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--accent-2);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.evidence-link:hover { text-decoration: underline; }
.modal-h2 {
  margin: 18px 0 8px;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--text-4);
  text-transform: uppercase;
  border: 0;
}
.modal-h2::before { display: none; }
.modal-body > .table-wrap,
.modal-body .table-wrap { max-height: none; }
.raw-json { margin-top: 4px; }
.raw-json > summary {
  padding: 7px 11px;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--text-3);
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  transition: color var(--dur), border-color var(--dur);
}
.raw-json > summary::-webkit-details-marker { display: none; }
.raw-json > summary::before { content: '▸ '; color: var(--text-4); }
.raw-json[open] > summary::before { content: '▾ '; }
.raw-json > summary:hover { color: var(--text-2); border-color: var(--line-2); }
.raw-json > pre { margin-top: 8px; max-height: 380px; overflow: auto; }

/* ── 接入配置：编号步骤卡 ── */
.step-card { margin-bottom: 16px; }
.step-card:last-child { margin-bottom: 0; }
.step-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.step-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 8px;
  box-shadow: 0 4px 12px -5px rgba(79, 124, 255, .85);
}
.step-num.more {
  font-size: 12px;
  color: var(--text-3);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line-2);
  box-shadow: none;
}
.step-head h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 14px;
  font-weight: 640;
  letter-spacing: .2px;
  color: var(--text);
}
.step-head h2::before { display: none; }
.step-head .sub { margin-top: 3px; font-size: 12px; color: var(--text-3); line-height: 1.55; }
.step-desc { margin: 0 0 13px; font-size: 12.5px; line-height: 1.8; }

.endpoint-chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  font-size: 11.5px;
  color: var(--text-3);
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
}

.code-block {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-inset);
}
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 6px 5px 13px;
  background: rgba(255, 255, 255, .028);
  border-bottom: 1px solid var(--line-soft);
}
.code-lang {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--text-4);
}
.code-copy { height: 24px !important; padding: 0 9px !important; font-size: 11px !important; }
.code-block > pre {
  padding: 13px 15px;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 12px;
}

.note-list { display: grid; gap: 6px; }
.note-list > div {
  position: relative;
  padding-left: 15px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-3);
}
.note-list > div::before {
  content: '';
  position: absolute;
  top: .62em;
  left: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .7;
}

.api-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.api-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 7px 13px;
  font-size: 12px;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--dur);
}
.api-row:last-child { border-bottom: 0; }
.api-row:hover { background: rgba(255, 255, 255, .022); }
.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  border-radius: 5px;
}
.method.get { color: #6cdae6; background: rgba(53, 196, 212, .13); border: 1px solid rgba(53, 196, 212, .26); }
.method.post { color: #f0b862; background: rgba(232, 163, 61, .13); border: 1px solid rgba(232, 163, 61, .26); }
.api-path {
  padding: 0;
  font-size: 11.5px;
  color: #c3d0e4;
  background: none;
  border: 0;
  overflow-wrap: anywhere;
}
.api-desc { font-size: 11.5px; }

/* ── 设置页分栏 ── */
.split.split-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split-wide > * { min-width: 0; }
.sub-label {
  margin: 0 0 11px;
  padding-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-4);
  border-bottom: 1px solid var(--line-soft);
}
.hint.warn { color: var(--amber-2); }

/* ── 账号页状态条 ── */
.strip {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 11px 16px;
  background: linear-gradient(90deg, rgba(79, 124, 255, .07), transparent 58%), var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.strip-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.strip-label { color: var(--text-3); }
.strip-val { font-weight: 620; color: var(--text); font-variant-numeric: tabular-nums; }
.strip-extra { font-size: 11px; color: var(--text-4); }
.strip-sep { width: 1px; height: 15px; background: var(--line-2); }

.pulse {
  position: relative;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
}
.pulse.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(47, 191, 113, .14); }
.pulse.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(229, 85, 107, .14); }
.pulse.ok::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-ring 2s ease-out infinite;
}

/* ── 任务页事件流头部 ── */
.ev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line-soft);
}
.ev-head h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--text-2);
}
.ev-head h2::before { display: none; }
.ev-head .row { gap: 10px; }

/* 表格中当前打开的日志行 */
tr.is-open > td { background: rgba(79, 124, 255, .09) !important; }
tr.is-open > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

/* ── 空态补充 ── */
.empty-title { margin-bottom: 4px; font-size: 13.5px; font-weight: 620; color: var(--text-2); }
.empty.err .big { background: rgba(229, 85, 107, .09); border-color: rgba(229, 85, 107, .24); }

/* ── 响应式 ──────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split.split-wide { grid-template-columns: 1fr; }
}

@media (max-width: 1080px) {
  .grid.auto > * { flex-basis: 264px; }
  .api-row { grid-template-columns: 48px minmax(0, 1fr); row-gap: 2px; }
  .api-desc { grid-column: 2; }
}

@media (max-width: 900px) {
  /* 侧栏改为抽屉 */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: 264px;
    padding-top: 14px;
    transform: translateX(-100%);
    transition: transform .22s var(--ease);
    box-shadow: 28px 0 70px rgba(0, 0, 0, .55);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overscroll-behavior: none; }

  .topbar { display: flex; }

  #main { padding: 18px 16px 64px; }
  #main > * { max-width: none; }

  .page-head { align-items: flex-start; margin-bottom: 14px; padding-bottom: 12px; }
  .page-head h1 { font-size: 19px; }
  .page-head > .row { width: 100%; gap: 8px; }
  .page-head > .row > select { flex: 1 1 140px; width: auto !important; }
  .page-head > .row > .btn { flex: 1 1 auto; }

  .grid.c2, .split, .split.split-wide { grid-template-columns: 1fr; }
  .grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.auto > * { flex-basis: 100%; }
  .filter-bar { gap: 8px; }
  .filter-search { flex: 1 1 100%; }
  .filter-bar select { flex: 1 1 0; min-width: 0; }
  .filter-count { display: none; }
  .strip { gap: 12px; }
  .strip-sep { display: none; }
  .strip-item { flex: 1 1 auto; }
  .stat-band-title { letter-spacing: .08em; }
  .course-foot { flex-wrap: wrap; }
  .course-foot .row { width: auto; }
  .acct-head { flex-wrap: wrap; }
  .card-foot .btn { flex: 1 1 auto; }

  .table-wrap { max-height: none; }
  table { min-width: 680px; }
  td.title-cell { min-width: 240px; }
  .modal table { min-width: 560px; }

  .modal-mask { padding: 14px; }
  .modal { max-height: 90vh; }
  .modal-body { padding: 16px; }

  .toast { max-width: calc(100vw - 32px); bottom: 18px; }
}

@media (max-width: 560px) {
  #main { padding: 14px 12px 56px; }
  .card { padding: 14px; border-radius: 11px; }
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* 奇数个磁贴时让最后一个跨满整行，避免右侧孤立留白 */
  .grid.c3 > :last-child:nth-child(odd) { grid-column: span 2; }
  .card:has(.stat) { padding: 12px 13px; }
  .stat .num { font-size: 23px; }
  .stat .lbl { font-size: 11.5px; }
  .course-foot .row { width: 100%; }
  .course-foot .row .btn { flex: 1 1 0; }
  .kv { grid-template-columns: 1fr; gap: 3px 0; }
  .kv dd { margin-bottom: 8px; }
  .page-head h1 { font-size: 18px; }
  .btn { height: 34px; padding: 0 12px; }
  .btn.sm { height: 30px; }
  .ev { grid-template-columns: 58px minmax(0, 1fr); }
  .ev-p { display: none; }
}

/* ── 16 无障碍与动效偏好 ──────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.99); } }
@keyframes pulse-ring {
  from { opacity: .55; transform: scale(1); }
  to { opacity: 0; transform: scale(2.6); }
}

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn:focus-visible, .pager button:focus-visible, .icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 不支持 :has() 或窗口较窄时，任务页自动降级为上下堆叠（默认流式布局） */
@media print {
  .sidebar, .topbar { display: none !important; }
  #main { overflow: visible; padding: 0; }
}

/* ─────────── 提交确认卡（半自动模式） ─────────── */
.confirm-card {
  border-color: rgba(240, 173, 78, .38);
  background: linear-gradient(180deg, rgba(240, 173, 78, .07), rgba(0, 0, 0, 0) 60%), var(--card, #14161b);
}
.confirm-card > h2 { color: var(--amber, #f0ad4e); }
.confirm-item {
  border: 1px solid var(--line, #262a33);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, .015);
}
.confirm-item:last-child { margin-bottom: 0; }
.confirm-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.confirm-title { font-weight: 600; margin-bottom: 3px; }
.confirm-detail { margin-top: 10px; }
.confirm-detail > summary {
  cursor: pointer; font-size: 12.5px; color: var(--muted, #8b93a7);
  user-select: none; padding: 4px 0;
}
.confirm-detail > summary:hover { color: var(--text, #e6e9f0); }
.confirm-qs { margin: 8px 0 0; padding-left: 20px; max-height: 320px; overflow: auto; }
.confirm-qs > li { margin-bottom: 10px; font-size: 13px; line-height: 1.55; }
.confirm-qs .qs { color: var(--text, #e6e9f0); margin-bottom: 3px; }
