:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --border: #e5e9f2;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #3b5bdb;
  --primary-soft: #eef2ff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .04);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--primary); text-decoration: none; }

/* ---------------- 顶栏 ---------------- */
/* 工作台顶栏（.workspace 内）：桌面端不再占位，状态与功能已迁入左下角用户菜单；
   仅窄屏（左栏隐藏）时作为项目名 / 账户入口的兜底显示。
   注意：这里只作用于工作台，管理页（admin.html）顶部栏不受影响。 */
.workspace > .topbar {
  min-height: 56px;
  flex: none;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: none;
  align-items: center;
  flex-wrap: wrap; /* 顶栏项较多，窄屏换行而不是横向溢出被裁 */
  gap: 8px 16px;
  padding: 8px 18px;
  row-gap: 6px;
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.brand small { font-weight: 400; color: var(--muted); font-size: 12px; }
.topbar .spacer { flex: 1; }

/* ---------------- 管理页顶栏（独立样式，吸顶常驻，始终可见「返回工作台」） ---------------- */
.admin-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 12px; padding: 9px 18px; min-height: 56px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(1.4) blur(6px);
  border-bottom: 1px solid var(--border);
}
.admin-brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); font-weight: 700; font-size: 15px;
}
.admin-brand .ab-ic { font-size: 16px; }
.admin-brand small { font-weight: 400; color: var(--muted); font-size: 12px; }
.admin-brand:hover .ab-t { color: var(--primary); }
.admin-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-actions + .admin-actions { padding-left: 10px; border-left: 1px solid var(--border); }
.admin-topbar .spacer { flex: 1; }
@media (max-width: 900px) {
  .admin-brand small { display: none; }
  .admin-actions + .admin-actions { border-left: none; padding-left: 0; }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
}
.pill.warn { background: #fff7ed; color: var(--warning); }
.pill.err { background: #fef2f2; color: var(--danger); }
.pill.ok { background: #ecfdf5; color: var(--success); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.alert-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--panel);
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- 布局 ---------------- */
/* shell = 左栏（完整侧栏）+ 右工作区（顶栏 + 内容），整体左右两段 */
.shell { flex: 1; display: flex; min-height: 0; }
.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 250px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 左栏顶部：项目标题（原顶栏品牌并入此处，使左栏成为完整单元） */
.sidebar-brand {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 13px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .mark {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.sidebar-brand .name { font-weight: 700; font-size: 13.5px; line-height: 1.35; min-width: 0; }

/* 左栏「空间」列表（Workbuddy 式工作区切换） */
.space-list { flex: 0 1 auto; max-height: 26vh; min-height: 0; overflow-y: auto; padding: 6px; }
.space-list + .panel-head { border-top: 1px solid var(--border); }
.space-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; margin-bottom: 2px;
}
.space-item:hover { background: var(--bg); }
.space-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.space-item .icon { flex: none; font-size: 14px; }
.space-item .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-item .count { flex: none; font-size: 11px; color: var(--muted); }
.space-item .tools { flex: none; display: none; gap: 4px; font-size: 13px; color: var(--muted); }
.space-item:hover .count { display: none; }
.space-item:hover .tools { display: flex; }
.space-item .tools span:hover { color: var(--primary); }
.space-item .tools .del:hover { color: var(--danger); }

/* 左栏底部：用户菜单（点击滑出） */
.account-wrap { flex: none; position: relative; border-top: 1px solid var(--border); }
.account {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  background: var(--panel);
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .15s;
}
.account:hover, .account.open { background: #f1f5f9; }
.account-caret {
  flex: none; font-size: 12px; color: var(--muted);
  transition: transform .18s ease;
}
.account.open .account-caret { transform: rotate(180deg); color: var(--primary); }
.account-menu {
  position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px);
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  padding: 8px; z-index: 60;
  max-height: min(70vh, 560px); overflow-y: auto;
}
.account-menu[hidden] { display: none; }
.am-head {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px 9px; margin-bottom: 4px; border-bottom: 1px dashed var(--border);
}
.am-head-info { min-width: 0; }
.am-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-role { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-group-title {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  padding: 8px 8px 3px; letter-spacing: .3px;
}
.am-item {
  width: 100%; display: flex; align-items: center; gap: 7px;
  padding: 7px 8px; border: none; border-radius: 8px;
  background: transparent; cursor: pointer; text-align: left;
  font-size: 12.5px; color: var(--text); font-family: inherit;
}
.am-item:hover { background: #eef2ff; color: var(--primary); }
.am-item .am-ic { flex: none; width: 16px; text-align: center; }
.am-item .am-desc {
  margin-left: auto; font-size: 10.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 118px;
}
.am-item .am-desc.has-items { color: #dc2626; font-weight: 600; }
.am-item.danger { color: var(--danger, #dc2626); }
.am-item.danger:hover { background: #fef2f2; }
.account { flex: none; }
/* 用户菜单内的运行状态（承载原顶栏的状态条） */
.am-status {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 8px; font-size: 11.5px;
}
.am-st-k { flex: 0 0 56px; color: var(--muted); padding-top: 2px; }
.am-st-v { flex: 1; min-width: 0; display: flex; gap: 5px; flex-wrap: wrap; }
.am-st-v .pill { font-size: 10.5px; padding: 1px 8px; }
.account-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.account-info { flex: 1; min-width: 0; }
.account-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-role {
  font-size: 11px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 窄屏兜底：默认隐藏，由媒体查询在对应栏被隐藏时启用 */
.topbar-brand, .topbar-account { display: none; }
.topbar-brand { font-weight: 700; font-size: 14px; white-space: nowrap; }
.topbar-account { align-items: center; gap: 6px; }
/* 管理入口默认隐藏，登录后由 JS 给 body 打 is-admin 标记再放开 */
.admin-only { display: none; }
body.is-admin .admin-only { display: inline-block; }
.aside {
  width: 320px;
  flex: none;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* 右栏内部滚动区：让底部的账户区始终可见 */
.aside-scroll { flex: 1; min-height: 0; overflow-y: auto; position: relative; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.panel-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}
.panel-body { padding: 12px 14px; }
.section { border-bottom: 1px solid var(--border); }
.section-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 14px 6px;
  letter-spacing: .3px;
}

/* ---------------- 会话列表 ---------------- */
.session-list { flex: 1 1 auto; min-height: 72px; overflow-y: auto; padding: 6px; }
.session-item {
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.session-item:hover { background: var(--bg); }
.session-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.session-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .del { opacity: 0; font-size: 15px; line-height: 1; color: var(--muted); }
.session-item:hover .del { opacity: 1; }
.session-item .del:hover { color: var(--danger); }

/* ---------------- 对话区 ---------------- */
.chat {
  flex: 1;
  /* 关键：flex 子项默认 min-height:auto，会被内容撑高而永不出现滚动条，
     导致超出一屏的对话直接被子元素溢出裁掉（页面既滚不动也看不到底部）。 */
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  padding: 28px 24px 32px;
  scroll-behavior: smooth;
  /* 关键：KaTeX 的 .katex-mathml 辅助元素是 position:absolute，
     若滚动容器及其祖先都不是 positioned，这些元素会以 html 为包含块，
     把整个页面撑出成千上万的滚动高度（表现为"主界面可无限下滚"）。
     设为定位元素后，绝对定位后代锚定在 .chat 内，被 overflow 正确裁剪。 */
  position: relative;
}
/* 消息列居中等宽：超宽屏下不再左右拉扯、中间留大片空白 */
.msg {
  max-width: 820px;
  margin: 0 auto 26px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
/* 连续同角色消息收紧间距，让「一问一答」的轮次边界更清晰 */
.msg.cont { margin-top: -14px; }

/* 头像隐去，改由角色标签标识说话方 —— 更接近主流 AI 工具的信息层次 */
.msg .avatar { display: none; }

/* 助手：不套气泡，整列铺开，只有思考过程与工具卡是实体块 */
.msg.bot .bubble {
  flex: 1;
  min-width: 0;
  max-width: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  overflow: visible;
}
.msg.bot .bubble::before {
  content: "🎓 智学导师";
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 9px;
}

/* 用户：右侧轻量气泡 */
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  flex: 0 1 auto;
  max-width: min(560px, 78%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  color: var(--text);
  box-shadow: none;
}

.bubble {
  line-height: 1.72;
  overflow-x: auto;
}

.bubble > :first-child { margin-top: 0; }
.bubble > :last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3 { font-size: 15px; margin: 14px 0 8px; }
.bubble p { margin: 8px 0; line-height: 1.72; }
.bubble ul, .bubble ol { margin: 8px 0; padding-left: 22px; line-height: 1.75; }
.bubble li { margin: 3px 0; }
.bubble code {
  font-family: var(--mono);
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
}
.bubble pre {
  background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px;
  overflow-x: auto; font-size: 12.5px;
}
.bubble pre code { background: none; color: inherit; padding: 0; }
.bubble table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; }
.bubble th { background: var(--bg); font-weight: 600; }
.bubble blockquote {
  margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--primary);
  background: var(--primary-soft); border-radius: 0 6px 6px 0;
}

/* 思考过程 */
.thinking { margin-bottom: 9px; }
.thinking summary {
  cursor: pointer; font-size: 12px; color: var(--muted);
  padding: 3px 0; user-select: none; list-style: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary::before {
  content: "▸"; font-size: 10px; transition: transform .15s ease;
}
.thinking[open] summary::before { transform: rotate(90deg); }
.thinking .content {
  font-size: 12.5px; color: #64748b; background: var(--bg);
  border-left: 3px solid #cbd5e1; border-radius: 0 8px 8px 0;
  padding: 10px 12px; margin-top: 6px;
  white-space: pre-wrap; max-height: 280px; overflow-y: auto; line-height: 1.7;
}

/* 工具调用卡片 */
.tool-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 8px 0;
  background: #fbfcfe;
  overflow: hidden;
}
.tool-card .head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 12.5px; cursor: pointer; user-select: none;
}
.tool-card .head .name { font-weight: 600; }
.tool-card .head .meta { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.tool-card.running .head { background: #fffbeb; }
.tool-card.ok .head { background: #f0fdf4; }
.tool-card.err .head { background: #fef2f2; }
.tool-card .body {
  border-top: 1px solid var(--border); padding: 10px 12px; font-size: 12.5px;
}
.tool-card .body pre {
  background: #f8fafc; color: #334155; border: 1px solid var(--border);
  max-height: 300px; overflow: auto; padding: 9px; border-radius: 6px; margin: 6px 0 0;
}
.spinner {
  width: 12px; height: 12px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 数据小表 */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table td, .mini-table th { padding: 4px 6px; border-bottom: 1px solid var(--border); }

.bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); }
.bar.low > i { background: var(--danger); }
.bar.mid > i { background: var(--warning); }
.bar.high > i { background: var(--success); }

/* 题目卡 */
.q-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  margin: 8px 0; background: var(--panel);
}
.q-card .q-head { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; }
.q-card .stem { line-height: 1.7; }
.q-card details { margin-top: 8px; font-size: 13px; }
.q-card summary { cursor: pointer; color: var(--primary); font-size: 12.5px; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: var(--bg); color: var(--muted); font-size: 11px;
}
.tags-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; min-height: 28px; align-items: center; }
.tag.primary { background: var(--primary-soft); color: var(--primary); border: 1px solid rgba(59,91,219,.2); }
.ai-note {
  margin-top: 8px; padding: 4px 9px; font-size: 11px; color: var(--muted);
  background: var(--bg); border: 1px dashed var(--border); border-radius: 6px;
  display: inline-block;
}
.tag.easy { background: #ecfdf5; color: var(--success); }
.tag.medium { background: #fffbeb; color: var(--warning); }
.tag.hard { background: #fef2f2; color: var(--danger); }

/* ---------------- 输入区 ---------------- */
.composer {
  flex: none; border-top: 1px solid var(--border); background: var(--panel);
  padding: 11px 20px 13px;
}
/* 与消息列同宽对齐，整屏形成一条统一的中轴 */
.composer > * { width: 100%; max-width: 820px; margin-left: auto; margin-right: auto; }
.composer .quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.chip {
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font-size: 12px;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.input-row { display: flex; gap: 10px; align-items: flex-end; }
textarea#input {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; font-size: 14px; font-family: inherit; line-height: 1.6;
  max-height: 180px; min-height: 46px; outline: none; color: var(--text);
}
textarea#input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 91, 219, .1); }
.composer .hint { font-size: 11.5px; color: var(--muted); margin-top: 7px; }

/* ---------------- 右侧面板 ---------------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--bg); border-radius: 8px; padding: 9px 11px;
}
.stat .label { font-size: 11.5px; color: var(--muted); }
.stat .value { font-size: 17px; font-weight: 700; margin-top: 2px; }

.skill-btn {
  width: 100%; text-align: left; border: 1px solid var(--border); background: var(--panel);
  border-radius: 8px; padding: 9px 11px; margin-bottom: 6px; display: flex;
  align-items: center; gap: 9px; font-size: 13px;
}
.skill-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.skill-btn .icon { font-size: 15px; }
.skill-btn .txt { flex: 1; }
.skill-btn .txt small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.skill-btn.off { opacity: .45; pointer-events: none; }

.list-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); font-size: 12.5px; padding: 10px 0; text-align: center; }

/* ---------------- 模态框 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .52);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
  backdrop-filter: blur(3px);
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--panel); border-radius: 16px; width: 100%; max-width: 780px;
  max-height: 86vh; box-shadow: 0 24px 80px rgba(0, 0, 0, .28), 0 0 1px rgba(0,0,0,.08);
  display: flex; flex-direction: column; overflow: hidden;
  animation: slideUp .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal .m-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: space-between;
  flex: none; background: var(--panel); z-index: 1; letter-spacing: .3px;
}
.modal .m-body {
  padding: 20px 22px;
  overflow-y: auto; flex: 1;
  position: relative;
}
.modal-wide { max-width: 1100px; }
.modal .m-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  flex: none; background: var(--panel); z-index: 1;
}
.modal .m-foot .btn {
  border-radius: 8px; padding: 9px 20px; font-weight: 600; font-size: 13px;
  transition: all .15s;
}
.modal .m-foot .btn:not(.primary) { background: var(--bg-soft); color: var(--text); border-color: var(--border); }
.modal .m-foot .btn:not(.primary):hover { background: var(--border); }
.modal .m-foot .btn.primary { border-radius: 8px; padding: 9px 22px; }
.modal .m-head .btn.ghost { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.modal .m-head .btn.ghost:hover { background: var(--bg-soft); }

/* ---------------- 右侧抽屉 ---------------- */
.drawer-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 250px;
  z-index: 90; display: flex; justify-content: flex-end;
  pointer-events: none;
}
.drawer-mask.open { pointer-events: auto; background: rgba(15, 23, 42, .08); }
.drawer {
  width: 100%; max-width: 1240px; height: 100%; background: var(--panel);
  box-shadow: -8px 0 30px rgba(0, 0, 0, .12); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
  transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.drawer-mask.open .drawer { transform: translateX(0); }
.drawer-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-weight: 600; display: flex; align-items: center; justify-content: space-between;
  flex: none; background: var(--panel);
}
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; min-height: 0; background: var(--bg); position: relative; /* 同 .chat：圈住 KaTeX 绝对定位辅助元素 */ }
.drawer-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 9px; flex: none; background: var(--panel);
}
@media (max-width: 800px) {
  .drawer-mask { left: 0; }
}

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 11px; font-size: 13.5px; font-family: inherit; outline: none; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 76px; }
.field .tip { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.tight { grid-template-columns: 1fr 110px; }
.field-row.three { grid-template-columns: 1fr 1fr auto; }

/* 学情档案抽屉：左右结构 */
.profile-form { display: grid; grid-template-columns: minmax(420px, 1.4fr) minmax(380px, 1fr); gap: 18px; align-items: start; }
.profile-left { min-width: 0; }
.profile-right { position: sticky; top: 0; align-self: start; height: 100%; }
.profile-right .form-group { height: 100%; display: flex; flex-direction: column; }

/* 抽屉内卡片化分组 */
.profile-form .form-group {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.profile-form .form-group + .form-group { margin-top: 14px; padding-top: 16px; border-top: none; }
.profile-form .form-group .group-title { margin-bottom: 14px; font-size: 13px; color: var(--text); }

/* 紧凑基础信息 */
.profile-form .form-group.compact { padding: 14px 16px; }
.profile-form .form-group.compact .field-row { gap: 12px; }
.profile-form .form-group.compact .field { margin-bottom: 0; }
.profile-form .form-group.compact .field label { font-size: 12px; margin-bottom: 4px; }

/* 自我画像 */
.self-portrait { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.profile-form .self-portrait .group-title { margin-bottom: 0; }
.self-portrait .tip { font-size: 12px; color: var(--muted); line-height: 1.5; }
.self-portrait textarea {
  flex: 1; min-height: 300px;
  line-height: 1.75; font-size: 13.5px; padding: 12px 14px;
  border-radius: 10px; border: 1px solid var(--border); background: #fff;
  resize: vertical;
}

/* 阶段目标表格化排列 */
.goal-header, .goal-row {
  display: grid; grid-template-columns: 1fr 60px 84px 140px 72px auto;
  gap: 8px; align-items: center;
}
.goal-header {
  font-size: 11.5px; color: var(--muted); padding: 0 8px 4px; border-bottom: 1px solid var(--border);
}
.goal-header span { white-space: nowrap; }
.goal-row { padding: 8px; border-radius: 10px; background: #fbfcfe; border: 1px solid var(--border); }
.goal-row + .goal-row { margin-top: 8px; }
.goal-row input {
  width: 100%; padding: 6px 8px; font-size: 13px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-family: inherit; outline: none;
}
.goal-row input:focus { border-color: var(--primary); }
.goal-row .day-tag { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: center; }
.goal-row .goal-actions { display: flex; gap: 6px; justify-content: flex-end; }

@media (max-width: 1100px) {
  .profile-form { grid-template-columns: 1fr; }
  .profile-right { position: static; height: auto; }
  .self-portrait textarea { height: 360px; }
}

/* 学习规划抽屉：内容卡片化 + 压缩上下留白 */
.drawer-body:has(.plan-pane) { padding: 10px 12px; }
.drawer-body .plan-pane {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; box-shadow: var(--shadow);
}

/* 模板横排（空间弹窗） */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* 技能多选列表：选择器权重必须压过通用的 .field label / .field input，
   否则复选框会继承 width:100% 变成整行宽，把标题和分组挤到右边折行 */
.skill-picker {
  max-height: 190px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
.skill-picker .row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; margin: 0;
  font-size: 12.5px; color: var(--text); font-weight: 400; cursor: pointer;
}
.skill-picker .row input[type="checkbox"] {
  width: 15px; height: 15px; flex: none; margin: 0; padding: 0;
  border-radius: 4px; accent-color: var(--primary);
}
.skill-picker .row .nm {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.skill-picker .row .grp { flex: none; font-size: 11px; color: var(--muted); }

/* ---------------- Toast ---------------- */
#toast-box { position: fixed; top: 68px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: 8px; padding: 10px 15px; box-shadow: var(--shadow); font-size: 13px;
  max-width: 340px; animation: slide .2s ease;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }

/* ---------------- 管理页 ---------------- */
.admin-wrap { flex: 1; overflow-y: auto; padding: 22px clamp(16px, 5vw, 56px); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  border: none; background: none; padding: 10px 16px; font-size: 13.5px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card > h3 { margin: 0 0 4px; font-size: 15px; }
.card > .desc { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--bg); }
.table tbody tr:hover { background: #fafbfe; }
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s;
}
.switch .track::before {
  content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(17px); }
.log-level { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.log-level.INFO { background: var(--primary-soft); color: var(--primary); }
.log-level.WARNING { background: #fffbeb; color: var(--warning); }
.log-level.ERROR, .log-level.CRITICAL { background: #fef2f2; color: var(--danger); }
.log-level.DEBUG { background: var(--bg); color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

/* ---------------- 今日简报（首屏个性化开场） ---------------- */
.briefing { font-size: 13px; }
.briefing .b-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-bottom: 9px; font-size: 14.5px;
}
.briefing .b-tips { line-height: 1.95; margin-bottom: 11px; }
.briefing .b-tip { color: #334155; }
.briefing .b-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.briefing .b-mem {
  font-size: 12px; color: #4338ca; background: var(--primary-soft);
  border-radius: 8px; padding: 7px 11px; line-height: 1.7;
}
.briefing .b-mem a { margin-left: 6px; font-weight: 600; }

.chip.act {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-soft); font-weight: 600;
}
.chip.act:hover { background: var(--primary); color: #fff; }

/* 追问建议（回复末尾的可点动作） */
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* 首屏「我能做什么」折叠说明 */
.cap { margin-top: 12px; }
.cap summary { cursor: pointer; font-size: 12px; color: var(--muted); user-select: none; }
.cap ul { margin: 8px 0 0; padding-left: 20px; font-size: 12.5px; line-height: 1.85; color: var(--muted); }

/* 记忆管理列表 */
.mem-list { max-height: 340px; overflow-y: auto; }
.mem-list .list-row .tag { flex: none; }

/* ---------------- 学习规划：左右联动布局 ---------------- */
/* 基准当前总分：回显总分与各科初始成绩，点击「设置初始成绩」在弹窗中编辑 */
.base-score-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; margin-top: 4px;
}
.base-score-bar .bsb-title { font-size: 13px; font-weight: 600; color: var(--text); flex: none; }
.base-score-bar .bsb-value {
  font-size: 18px; font-weight: 700; color: var(--primary, #3b5bdb); line-height: 1;
}
.base-score-bar .bsb-slash,
.base-score-bar .bsb-full { font-size: 13px; color: var(--muted); }
.base-score-bar .bsb-subj {
  display: flex; flex-wrap: wrap; gap: 4px 6px; margin-left: 4px;
}
.base-score-bar .bsb-chip {
  font-size: 12px; color: var(--muted); background: #fff;
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px;
}
.base-score-bar .bsb-chip b { color: var(--text); font-weight: 600; }
.base-score-bar #btnBaseSetting { margin-left: auto; flex: none; }

/* ---------------- 提分规划复盘提示与复核结果 ---------------- */
/* 复盘提示条：只做提醒，确认后才改数据；视觉上刻意比告警轻，不制造焦虑 */
.review-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 7px 11px; margin-top: 8px;
}
.review-banner .rvb-icon { font-size: 15px; flex: none; }
.review-banner .rvb-text { font-size: 12.5px; color: #92400e; flex: 1; min-width: 200px; }
.review-banner .rvb-sub { color: #b45309; font-size: 11.5px; margin-left: 4px; }

/* 复核结果卡片：按严重度区分左边界，blocker 最醒目 */
.rv-issue { border-left: 3px solid var(--border); padding-left: 9px; }
.rv-issue.blocker { border-left-color: var(--danger); }
.rv-issue.warn { border-left-color: #f59e0b; }
.rv-issue.info { border-left-color: var(--muted); }

/* 各科初始成绩弹窗：合计提示 + 精简表格 */
.bs-sum {
  font-size: 13px; color: var(--muted); margin: 2px 0 8px;
}
.bs-sum b { font-size: 15px; color: var(--text); }
.subj-table .n-cell { text-align: center; color: var(--muted); }
.modal .subj-table.bs-table { min-width: 0; }

/* 批量配置阶段弹窗：快捷工具条 */
.bs-tools {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 10px; padding: 8px 10px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
}
.bs-tool { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.bs-tool > span:first-child { color: var(--muted); min-width: 96px; }
.bs-tool input.n { width: 110px; }
.bs-tool .bs-sep { color: var(--muted); }
.bs-period { margin-left: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* 阶段只读行（学情档案内展示） */
.goal-row.readonly { opacity: .95; }
.goal-row.readonly .gr-text {
  padding: 5px 7px; font-size: 12.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.goal-header.readonly { grid-template-columns: 1.8fr .7fr .7fr 1.1fr .7fr .7fr; }
.goal-row.readonly { grid-template-columns: 1.8fr .7fr .7fr 1.1fr .7fr .7fr; }
/* 学习规划侧栏：阶段周期 */
.si-meta-period { font-weight: 600; color: #475569; }

/* 阶段侧栏头部按钮组：标题与按钮均不折行（空间不足时标题省略而非折行） */
.goals-side-head .gs-head-title {
  white-space: nowrap; flex: 0 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}
.goals-side-head .gs-head-btns { display: inline-flex; gap: 4px; flex: none; }
.goals-side-head button { white-space: nowrap; }

.goals-layout {
  display: flex; gap: 10px; align-items: stretch;
  /* 左右等高等长：随视口自适应，最大 600px */
  height: clamp(360px, calc(100vh - 250px), 600px);
  margin-top: 4px;
}
.goals-side {
  flex: 0 0 220px; height: 100%;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fbfcfe; padding: 8px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.goals-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  padding: 2px 2px 6px; border-bottom: 1px dashed var(--border);
  flex: none;
}
.goals-side-head button { flex: none; }
.stage-list {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  margin-top: 6px; min-width: 0;
  /* 纵向按需滚动；横向一律不滚动（tooltip 等绝对定位元素不应撑出滚动条） */
  overflow-y: auto; overflow-x: hidden;
}
.stage-item {
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; background: #fff;
  transition: border-color .15s, background .15s;
  position: relative; min-width: 0;
}
.stage-item:hover { border-color: var(--border); background: #f8fafc; }
.stage-item.active {
  border-color: var(--primary); background: var(--primary-soft);
}
.stage-item.active .si-label { color: var(--primary); }
.si-label {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.si-label .tag { font-weight: 500; font-size: 10.5px; }
/* 阶段名过长时省略，避免把左侧栏撑出横向滚动 */
.si-name-text {
  flex: 0 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.si-meta {
  font-size: 11px; color: var(--muted); margin-top: 3px;
  display: flex; flex-wrap: wrap; gap: 3px 6px;
}
.si-meta > * { white-space: nowrap; }
/* 阶段起点分 → 目标分 */
.si-meta .si-arrow { color: #94a3b8; margin: 0 2px; font-weight: 400; }
.si-meta .si-meta-score { white-space: nowrap; }
/* 剩余天数单独占一行 */
.si-meta .si-meta-rem { flex: 0 0 100%; color: #d97706; font-weight: 500; }
.stage-form {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px; margin-top: 6px; display: flex; flex-direction: column; gap: 5px;
}
.stage-form input, .stage-form textarea {
  width: 100%; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-family: inherit; color: var(--text);
  box-sizing: border-box;
}
.stage-form input:focus, .stage-form textarea:focus { border-color: var(--primary); outline: none; }
.stage-form textarea { min-height: 48px; resize: vertical; }
.stage-form-actions { display: flex; gap: 5px; justify-content: flex-end; margin-top: 2px; }
.stage-form-hint {
  font-size: 11.5px; color: #6366f1; margin: 4px 0 6px;
  padding: 5px 8px; background: #eef2ff; border-radius: 6px; line-height: 1.5;
}

.goals-detail {
  flex: 1; min-width: 0; height: 100%;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; padding: 10px 12px;
  overflow-y: auto; overflow-x: hidden;
}
/* 左右两栏使用细滚动条，避免粗条挤压内容 */
.stage-list, .goals-detail { scrollbar-width: thin; }
.stage-list::-webkit-scrollbar, .goals-detail::-webkit-scrollbar { width: 7px; height: 7px; }
.stage-list::-webkit-scrollbar-thumb, .goals-detail::-webkit-scrollbar-thumb {
  background: #cbd5e1; border-radius: 999px;
}
.stage-list::-webkit-scrollbar-thumb:hover, .goals-detail::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.stage-list::-webkit-scrollbar-track, .goals-detail::-webkit-scrollbar-track { background: transparent; }
.stage-list::-webkit-scrollbar-corner, .goals-detail::-webkit-scrollbar-corner { background: transparent; }
.goal-detail-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
  flex-wrap: wrap;
}
.gd-title {
  font-weight: 600; font-size: 14px; color: var(--text);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0;
}
.gd-title .tag { font-weight: 500; font-size: 11px; }
.gd-meta-inline {
  font-size: 11.5px; font-weight: 500; color: var(--muted);
  margin-left: 4px; display: inline-flex; align-items: center;
  padding: 2px 8px; background: #f1f5f9; border-radius: 10px;
  white-space: nowrap;
}
.gd-meta-inline b { color: var(--primary); font-weight: 600; }
.gc-rem { color: #d97706; font-weight: 500; }
.gd-head-actions { flex: none; display: flex; gap: 4px; }

/* 右侧阶段信息压成一行：目标分 / 说明 均以「总结 + tooltip」呈现 */
.goal-detail-head.slim {
  flex-wrap: nowrap; gap: 8px;
  padding-bottom: 6px; margin-bottom: 6px;
}
.goal-detail-head.slim .gd-title { flex: 0 0 auto; }
.goal-detail-head.slim .gd-name { font-size: 13.5px; }
.gd-pills {
  display: flex; align-items: center; gap: 6px;
  flex: 1 1 auto; min-width: 0;
  /* 注意：这里不能设 overflow:hidden，否则子级 tooltip 会被裁剪掉 */
}
.gd-pill {
  position: relative; display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; color: #3b5bdb; background: #eef2ff;
  border: 1px solid #e0e7ff; border-radius: 999px; padding: 2px 9px;
  white-space: nowrap; cursor: default; flex: none;
}
.gd-pill b { color: #059669; font-weight: 600; }
.gd-pill.muted { color: var(--muted); background: #f8fafc; border-color: var(--border); }
.gd-pill[data-stage-config] { cursor: pointer; }
.gd-pill[data-stage-config]:hover { border-color: #f59e0b; color: #b45309; }
.gd-tip {
  display: none; position: absolute; z-index: 50; top: calc(100% + 6px); left: 0;
  padding: 5px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
  max-width: 440px; white-space: normal; cursor: default;
}
.gd-pill:hover .gd-tip, .gd-pill:focus .gd-tip { display: block; }
.gd-tip-text {
  font-size: 12.5px; color: var(--text); line-height: 1.6;
  white-space: pre-wrap; max-width: 380px;
}

/* 学习规划：顶部说明精简 */
.desc.compact { font-size: 12px; margin: 0 0 4px; line-height: 1.5; }

/* ---------------- 周期性 / 持续性任务（日常打卡） ---------------- */
.routine-summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px;
}
.rs-item { font-size: 12.5px; color: var(--muted); }
.rs-item b { color: var(--text); font-size: 14px; }
.routine-summary #rtAdd { margin-left: auto; }

.rt-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

/* 学习规划中展示的打卡任务小徽标 */
.rt-stage-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 6px 0 8px; padding: 6px 8px;
  background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 8px;
}
.rt-stage-row.sub {
  margin: 4px 0 2px 18px; padding: 4px 8px;
  background: #faf8ff; border-style: dashed;
  /* 每个打卡任务独占一行 */
  flex-direction: column; align-items: stretch; gap: 4px;
}
.rt-stage-row.sub .rt-mini { width: 100%; }
.rt-stage-row.sub .rt-mini-go { margin-left: auto; }
.rt-mini-ck { color: var(--success, #16a34a); font-weight: 700; flex: none; }
.rt-stage-label { font-size: 11.5px; font-weight: 600; color: #6d28d9; flex: none; }
.rt-stage-more { margin-left: auto; font-size: 11px !important; }
.rt-mini {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  font-size: 11.5px; color: #5b21b6; background: #fff;
  border: 1px solid #ddd6fe; border-radius: 999px; padding: 2px 9px;
}
.rt-mini.done { background: #f1f5f9; border-color: var(--border); color: #94a3b8; }
.rt-mini-g { color: var(--muted); font-size: 11px; }
.rt-mini-s { color: #d97706; font-weight: 600; }
/* 打卡任务迷你条：可点击（直接今日打卡 / 跳转打卡页）+ 进度占比 */
.rt-mini { cursor: pointer; transition: box-shadow .15s; }
.rt-mini:hover { box-shadow: 0 1px 5px rgba(91, 33, 182, .18); }
.rt-mini-p {
  font-size: 10.5px; color: #7c3aed; background: #f5f3ff;
  border-radius: 999px; padding: 0 6px; white-space: nowrap;
}
.rt-mini.done .rt-mini-p { color: #94a3b8; background: transparent; }
.rt-mini.done .rt-mini-t { text-decoration: line-through; color: #64748b; }
.rt-mini-go {
  flex: none; border: none; background: transparent; color: #7c3aed;
  cursor: pointer; font-size: 12px; line-height: 1; padding: 0 2px;
}
.rt-mini-go:hover { color: var(--primary); transform: translateX(1px); }

/* ===== 资源库侧栏：库级编辑入口 / 分类筛选 ===== */
.kb-lib-edit {
  flex: none; border: none; background: transparent; color: #94a3b8;
  cursor: pointer; font-size: 12px; padding: 0 2px; opacity: 0;
  transition: opacity .15s, color .15s;
}
.kb-ws-lib-item:hover .kb-lib-edit { opacity: 1; }
.kb-lib-edit:hover { color: var(--primary); }
.kb-cat-filter { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 2px 8px; }

/* ===== 资源广场 ===== */
.plaza-side { padding: 6px 2px; display: flex; flex-direction: column; gap: 6px; }
.plaza-pub-list { display: flex; flex-direction: column; gap: 4px; }
.plaza-pub-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  width: 100%; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: 12px; color: var(--text); text-align: left;
  font-family: inherit;
}
.plaza-pub-item:hover { border-color: var(--primary); color: var(--primary); }
.plaza-pub-item .n { flex: none; color: var(--muted); font-size: 11px; }
.plaza-pub-empty { font-size: 11.5px; color: var(--muted); padding: 4px 2px; line-height: 1.6; }
.plaza-pub-row { display: flex; align-items: stretch; gap: 4px; }
.plaza-pub-edit {
  flex: none; width: 28px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: 12px; line-height: 1;
}
.plaza-pub-edit:hover { border-color: var(--primary); color: var(--primary); }
/* 发布向导：步骤条 */
.wiz-steps {
  display: flex; align-items: center; gap: 8px;
  padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px dashed var(--border);
}
.wiz-step { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.wiz-step i {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft); border: 1px solid var(--border);
  font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.wiz-step.on { color: var(--primary); font-weight: 600; }
.wiz-step.on i { background: var(--primary); border-color: var(--primary); color: #fff; }
.wiz-step.done { color: var(--success); }
.wiz-step.done i { background: #e8f7ee; border-color: #b7e4c7; color: var(--success); }
.wiz-arrow { color: #cbd5e1; font-size: 14px; }

.wiz-inner { display: flex; flex-direction: column; gap: 10px; }
.wiz-tip {
  font-size: 11.5px; line-height: 1.7; color: var(--muted);
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}
.wiz-tip b { color: var(--text); }
.wiz-sec { font-size: 12px; font-weight: 700; color: var(--text); margin-top: 2px; }
.wiz-none { font-size: 12px; color: var(--muted); padding: 10px; border: 1px dashed var(--border); border-radius: 8px; text-align: center; }
.btn.dashed { border-style: dashed; color: var(--muted); width: 100%; }
.btn.dashed:hover { border-color: var(--primary); color: var(--primary); }

/* 步骤一：资源库选择 */
.wiz-libs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wiz-lib {
  display: flex; align-items: center; gap: 9px; text-align: left; font-family: inherit;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
  cursor: pointer; transition: all .15s;
}
.wiz-lib:hover { border-color: #b9c6f5; background: #fbfcff; }
.wiz-lib.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px rgba(59, 91, 219, .1); }
.wiz-lib .ic { font-size: 18px; flex: none; }
.wiz-lib .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wiz-lib .n { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiz-lib .m { font-size: 11px; color: var(--muted); }
.wiz-lib .chk { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: transparent; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.wiz-lib.on .chk { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 步骤二：方式切换 + 面板 */
.wiz-target {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted);
  padding: 8px 11px; background: var(--primary-soft); border-radius: 9px;
}
.wiz-target b { color: var(--primary); }
.wiz-target .btn { margin-left: auto; }
.wiz-chips { display: flex; gap: 8px; }
.wiz-chip {
  flex: 1; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff;
  font-size: 12.5px; font-family: inherit; color: var(--text); cursor: pointer; transition: all .15s;
}
.wiz-chip:hover { border-color: #b9c6f5; }
.wiz-chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.wiz-pane { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.wiz-pane .field { width: 100%; margin: 0; }
.wiz-pane .btn { align-self: flex-start; }
.wiz-drop {
  display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center;
  width: 100%; padding: 20px; border: 1.5px dashed var(--border); border-radius: 10px;
  background: #fbfdff; cursor: pointer; transition: all .15s;
}
.wiz-drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.wiz-drop .t { font-size: 12.5px; font-weight: 600; color: var(--primary); }
.wiz-drop .d { font-size: 11px; color: var(--muted); }
.wiz-files { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.wiz-file {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--text); padding: 5px 9px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 7px;
}
.wiz-file button { border: none; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; }
.wiz-file button:hover { color: var(--danger); }
.wiz-pubs { display: flex; flex-direction: column; gap: 4px; max-height: 132px; overflow-y: auto; }
.wiz-pub {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; padding: 5px 9px; border-radius: 7px; background: #f0fdf4; border: 1px solid #cdeadb;
}
.wiz-pub .m { font-size: 11px; color: var(--muted); flex: none; }

/* 步骤三：批量元数据 */
.wiz-rows { display: flex; flex-direction: column; gap: 6px; max-height: 208px; overflow-y: auto; }
.wiz-row { display: flex; align-items: center; gap: 8px; }
.wiz-row input[type="checkbox"] { flex: none; width: 15px; height: 15px; accent-color: var(--primary); }
.wiz-row input:not([type="checkbox"]) {
  flex: 1; min-width: 0; padding: 6px 9px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 12px; font-family: inherit; color: var(--text); background: #fff;
}
.wiz-row .m { flex: none; font-size: 11px; color: var(--muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiz-row input.wiz-row-title { flex: 2 1 30%; }
.wiz-row input.wiz-row-tags { flex: 2 1 30%; }
.wiz-row input.wiz-row-subj { flex: 1 1 20%; }
.wiz-rows.hide-subj .wiz-row-subj { display: none; }
.wiz-form {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fbfdff;
}
.wiz-form .field { margin: 0; }
.wiz-form input, .wiz-form select {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 12.5px; font-family: inherit; background: #fff; color: var(--text);
}
.wiz-form-foot { display: flex; justify-content: flex-end; gap: 8px; }
.plaza-side-title { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.plaza-side select {
  width: 100%; padding: 5px 8px; font-size: 12.5px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text);
}
.plaza-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.plaza-tag {
  font-size: 11px; padding: 2px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: #475569;
}
.plaza-tag:hover { border-color: var(--primary); color: var(--primary); }
.plaza-tag.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.plaza-head { padding: 4px 2px 8px; }
.plaza-title { font-size: 15px; font-weight: 700; color: var(--text); }
.plaza-hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.6; }
.plaza-list { display: flex; flex-direction: column; gap: 10px; }
/* 广场：学科 / 分类 过滤条 */
.plaza-filters { display: flex; flex-direction: column; gap: 6px; padding: 8px 2px 2px; border-bottom: 1px dashed var(--border); margin-bottom: 4px; }
.plaza-filter-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plaza-filter-row .lbl { flex: none; font-size: 12px; color: var(--muted); width: 30px; }
.plaza-filters .muted { font-size: 11px; }
.plaza-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; cursor: pointer; font-size: 12px; color: var(--text); font-family: inherit;
}
.plaza-chip:hover { border-color: var(--primary); color: var(--primary); }
.plaza-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.plaza-chip i { font-style: normal; font-size: 10.5px; opacity: .8; }
.plaza-chip.tag { background: #f7f9ff; }
.btn.xs { padding: 3px 9px; font-size: 11.5px; }
.btn.ghost.danger { color: var(--danger); border-color: #f1c6c6; background: #fff; }
.btn.ghost.danger:hover { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
.plaza-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
  background: #fbfdff; display: flex; flex-direction: column; gap: 7px;
}
.plaza-card:hover { border-color: #c7d2fe; }
.plaza-card-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plaza-icon { flex: none; font-size: 16px; }
.plaza-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.plaza-pts {
  margin-left: auto; flex: none; font-size: 11px; font-weight: 600;
  color: #b45309; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 999px; padding: 1px 9px;
}
.plaza-pts.free { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.plaza-meta {
  font-size: 11.5px; color: var(--muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.plaza-stats { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.plaza-vote {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 8px; cursor: pointer; color: #475569;
}
.plaza-vote:hover { border-color: var(--primary); color: var(--primary); }
.plaza-vote.on { background: #eef2ff; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.plaza-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.plaza-preview-text {
  max-height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-size: 12.5px; line-height: 1.75; background: var(--bg);
  border-radius: 8px; padding: 10px 12px;
}
.plaza-log-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.plaza-log-list { max-height: 52vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.plaza-log-row {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  padding: 5px 8px; border-radius: 8px; background: #f8fafc;
}
.plaza-log-act { flex: none; width: 62px; color: #475569; }
.plaza-log-user { flex: none; width: 90px; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plaza-log-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.plaza-log-sub { flex: none; color: var(--muted); }
.plaza-log-time { flex: none; color: var(--muted); font-size: 11px; }

/* ===== 对话区顶部：会话标题条 ===== */
.chat-head {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  min-height: 44px;
}
.chat-head .ch-ic { flex: none; font-size: 14px; }
.chat-head .ch-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-head .ch-sub {
  font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-head .ch-spacer { flex: 1; }

/* ===== 全局垃圾箱 ===== */
.btn.danger, .btn.ghost.danger { color: var(--danger, #dc2626); border-color: #fecaca; }
.btn.danger:hover, .btn.ghost.danger:hover { background: #fef2f2; border-color: #fca5a5; }
.trash-wrap { display: flex; flex-direction: column; gap: 6px; }
.trash-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trash-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.trash-filter {
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: #475569;
}
.trash-filter:hover { border-color: var(--primary); color: var(--primary); }
.trash-filter.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.trash-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.trash-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: #fbfcfe; }
.trash-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.trash-kind {
  flex: none; font-size: 10.5px; font-weight: 600; color: #475569;
  background: #e2e8f0; border-radius: 999px; padding: 1px 8px;
}
.trash-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.trash-owner { font-size: 11px; color: var(--muted); }
.trash-time { font-size: 11px; color: var(--muted); margin-left: auto; }
.trash-ops { display: flex; gap: 4px; flex: none; }
.trash-summary { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.trash-detail-inner {
  margin-top: 6px; padding: 8px 10px; background: var(--bg);
  border-radius: 8px; display: flex; flex-direction: column; gap: 4px;
}
.trash-row { display: flex; gap: 8px; font-size: 12px; }
.trash-k { flex: 0 0 88px; color: var(--muted); }
.trash-v { flex: 1; min-width: 0; color: var(--text); word-break: break-word; }

/* 跨阶段打卡提示 */
.rt-cross-hint {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: #5b21b6; background: #f5f3ff;
  border: 1px dashed #c4b5fd; border-radius: 8px; padding: 6px 10px; margin-bottom: 6px;
}
.rt-cross-hint .btn { margin-left: auto; }

/* 打卡卡片：区间 */
.rt-range { margin-left: 6px; font-size: 11px; color: var(--muted); }
.rt-link.muted { color: #94a3b8; }

/* 表单分区标题 + 匹配提示 */
.rt-section {
  font-size: 12px; font-weight: 600; color: var(--text);
  margin: 10px 0 6px; padding-bottom: 4px; border-bottom: 1px dashed var(--border);
}
.rt-warn { color: #d97706; }

.rt-card {
  border: 1px solid #dbeafe; border-radius: 10px; padding: 10px 12px;
  background: #f7f9ff; display: flex; flex-direction: column; gap: 7px;
}
/* 今日已完成：整体灰白弱化（✔ 徽标保留绿色辨识），与进行中卡片底色区分 */
.rt-card.done-today { border-color: var(--border); background: #f1f5f9; opacity: .82; }
/* 折叠：已完成 / 已关闭默认只留标题行 */
.rt-card.folded { padding: 7px 12px; gap: 0; }
.rt-card.folded .rt-body { display: none; }
.rt-fold {
  flex: none; width: 20px; height: 20px;
  border: none; border-radius: 6px; background: transparent; color: #a0aec0;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
.rt-fold:hover { color: var(--primary); background: #eef2ff; }
.rt-fold svg { transition: transform .18s ease; }
.rt-card.folded .rt-fold svg { transform: rotate(-90deg); }
/* 折叠时标题行内嵌的统计标签（右对齐，位于操作按钮左侧） */
.rt-f-stats { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
/* 已完成 / 已关闭：标题删除线（长期任务打完当天卡不标删除线） */
.rt-card.closed-done .rt-title { text-decoration: line-through; }
.rt-done-badge.big { font-size: 11.5px; padding: 2px 11px; }
.rt-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rt-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.rt-link { font-size: 11.5px; color: var(--muted); }
.rt-streak {
  font-size: 11.5px; color: #d97706; font-weight: 600;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 999px; padding: 1px 8px;
}
.rt-ops { margin-left: auto; display: flex; gap: 4px; }
.rt-goal { font-size: 12px; color: var(--muted); }

.rt-progress { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rt-bar {
  flex: 1 1 160px; height: 7px; background: var(--bg);
  border-radius: 999px; overflow: hidden; min-width: 120px;
}
.rt-bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .2s ease; }
.rt-pct { font-size: 11.5px; color: var(--text); }
.rt-meta { font-size: 11px; color: var(--muted); }
.rt-amount { font-size: 11.5px; color: var(--muted); }

/* 双维度统计徽标：次数维度 + 数量维度 */
.rt-dims { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.rt-dim {
  font-size: 11.5px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px;
}
.rt-dim:nth-child(2) { color: #0369a1; border-color: #bae6fd; background: #f0f9ff; }

/* 近 14 天打卡格子：点击可补打卡 / 撤销 —— 按状态区分颜色 */
.rt-cells { display: flex; gap: 4px; flex-wrap: wrap; }
.rt-cell {
  width: 42px; padding: 3px 0; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; cursor: pointer; transition: background .12s, border-color .12s;
  display: flex; flex-direction: column; align-items: center; line-height: 1.3;
}
.rt-cell:hover { border-color: var(--primary); }
.rt-cell-d { font-size: 10.5px; color: var(--muted); }
.rt-cell-n { font-size: 10px; font-weight: 700; color: #15803d; }
/* 已打卡（绿） */
.rt-cell.done { background: #dcfce7; border-color: #86efac; }
.rt-cell.done .rt-cell-d { color: #15803d; font-weight: 600; }
/* 今日待打卡（黄，提示今天要做） */
.rt-cell.today { background: #fef9c3; border-color: #facc15; }
.rt-cell.today .rt-cell-d { color: #92400e; font-weight: 600; }
/* 过期未打卡（红，需要补救） */
.rt-cell.overdue { background: #fee2e2; border-color: #f87171; }
.rt-cell.overdue .rt-cell-d { color: #b91c1c; font-weight: 600; }
/* 未来日期（灰） */
.rt-cell.future { background: #f1f5f9; border-color: #e2e8f0; }
.rt-cell.future .rt-cell-d { color: #94a3b8; }
/* 非执行日（浅灰） */
.rt-cell.muted { background: #f8fafc; border-color: #f1f5f9; }
.rt-cell.muted .rt-cell-d { color: #cbd5e1; }

.rt-unit-custom { width: 100%; padding: 6px 8px; font-size: 12.5px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; }
.rt-wd-all { font-weight: 600; }
.rt-wd-all input { accent-color: var(--primary); }

/* 置顶 / 完成标注 / 标签分类 */
.rt-card.pinned { border-left: 3px solid var(--primary); background: #fbfdff; }
.rt-pinned-mark { flex: none; font-size: 13px; }
.rt-done-badge {
  flex: none; font-size: 10.5px; font-weight: 600; color: #15803d;
  background: #dcfce7; border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
/* 已结束（打卡区间过完）的任务卡 */
.rt-card.ended { opacity: .72; border-color: var(--border); background: #f8fafc; }
.rt-card.ended .rt-bar { background: #e2e8f0; }
.rt-ended-badge {
  flex: none; font-size: 10.5px; font-weight: 600; color: #64748b;
  background: #e2e8f0; border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.rt-ended-tip { font-size: 11.5px; color: var(--muted); font-style: italic; }
.rt-mini-end {
  flex: none; font-size: 10.5px; font-weight: 600; color: #64748b;
  background: #e2e8f0; border-radius: 999px; padding: 0 7px; white-space: nowrap;
}
.rt-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.rt-tag-chip {
  font-size: 10.5px; color: #475569; background: #f1f5f9;
  border-radius: 999px; padding: 1px 8px;
}
.rt-tag-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.rt-filter-chip {
  font-size: 11.5px; color: #475569; background: #fff;
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.rt-filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.rt-filter-chip.active { color: #fff; background: var(--primary); border-color: var(--primary); }

.rt-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rt-amount-input {
  width: 150px; padding: 6px 8px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 6px; font-family: inherit;
}
.rt-amount-input:focus { border-color: var(--primary); outline: none; }
.rt-note-input {
  flex: 1 1 180px; min-width: 140px; padding: 6px 8px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 6px; font-family: inherit;
}
.rt-note-input:focus { border-color: var(--primary); outline: none; }

/* 预设一键创建 */
.rt-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.rt-preset {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; text-align: left;
  border: 1px dashed var(--border); border-radius: 8px; background: #fff; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.rt-preset:hover { border-color: var(--primary); background: #f8fafc; }
.rt-p-t { font-size: 12.5px; font-weight: 600; color: var(--text); }
.rt-p-g { font-size: 11px; color: var(--muted); }

/* 配置弹窗 */
.rt-form .field-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rt-form .field { flex: 1 1 140px; min-width: 130px; }
.rt-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.rt-form input, .rt-form select {
  width: 100%; padding: 6px 8px; font-size: 12.5px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text);
}
.rt-form input:focus, .rt-form select:focus { border-color: var(--primary); outline: none; }
/* 周期任务弹窗：紧凑布局，避免出现滚动条 */
.rt-form.compact .field { margin-bottom: 8px; }
.rt-form.compact .rt-section { margin: 6px 0 4px; }
.rt-form.compact .tip-inline { margin-top: 2px; font-size: 11px; }
.rt-form.compact .rt-weekdays { margin-top: 2px; }
.rt-row5 { display: flex; gap: 8px; flex-wrap: wrap; }
.rt-row5 .field { flex: 1 1 130px; min-width: 110px; }
.rt-form .tip-inline { display: block; }
.rt-weekdays { display: flex; gap: 8px; flex-wrap: wrap; }
.rt-wd { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; color: var(--text); }
.rt-wd input { width: auto; }

/* ---------------- 错题本（诊断与矫正引擎） ---------------- */
.wb-header { margin-bottom: 10px; }
.wb-header .tabs { margin-bottom: 6px; }
.wb-pane { display: flex; flex-direction: column; gap: 10px; }

/* 科目主维度：各科错题相对独立，一切按科目聚焦 */
.wb-subjbar { display: flex; flex-wrap: wrap; gap: 6px; }
.wb-sbtn {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  transition: border-color .12s, color .12s, background .12s;
}
.wb-sbtn b { color: var(--text); font-weight: 600; }
.wb-sbtn:hover { border-color: var(--primary); }
.wb-sbtn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.wb-sbtn.active b { color: var(--primary); }

/* 录入三种模式 */
.wb-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 10px; }
.wb-mode {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.wb-mode b { font-size: 12.5px; color: var(--text); }
.wb-mode span { font-size: 11px; color: var(--muted); line-height: 1.45; }
.wb-mode:hover { border-color: var(--primary); }
.wb-mode.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.wb-mode.active b { color: var(--primary); }
.wb-sample-btn { float: right; padding: 1px 8px !important; font-size: 11px !important; }

/* 自主标注：知识点多选 */
.wb-manual { border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; background: #f8fafc; margin-bottom: 8px; }
.wb-picker { display: flex; flex-direction: column; gap: 6px; }
.wb-picker .wb-point-input {
  width: 100%; padding: 6px 8px; font-size: 12.5px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.wb-picker .wb-point-input:focus { border-color: var(--primary); outline: none; }
.wb-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.wb-chips .wb-chip { display: inline-flex; align-items: center; gap: 3px; }
.wb-chip-x {
  border: none; background: transparent; cursor: pointer; color: #94a3b8;
  font-size: 12px; line-height: 1; padding: 0 1px;
}
.wb-chip-x:hover { color: #dc2626; }
.wb-suggest { display: flex; flex-wrap: wrap; gap: 5px; }
.wb-sg {
  font-size: 11px; padding: 1px 8px; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--border); background: #fff; color: var(--muted);
}
.wb-sg:hover { border-color: var(--primary); color: var(--primary); }
/* 知识点建议分组（标准库按章节 / 我录过的） */
.wb-suggest { flex-direction: column; align-items: stretch; }
.wb-sg-group { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.wb-sg-chapter {
  flex: none; font-size: 10.5px; font-weight: 600; color: #4c1d95;
  background: #ede9fe; border-radius: 4px; padding: 1px 7px;
}
/* 附件缩略图与预览 */
.wb-att { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.wb-att-thumb {
  position: relative; width: 86px; cursor: pointer; text-align: center;
  border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: #fff;
  transition: border-color .15s;
}
.wb-att-thumb:hover { border-color: var(--primary); }
.wb-att-thumb img { width: 100%; height: 56px; object-fit: cover; border-radius: 5px; display: block; }
.wb-att-name {
  display: block; font-size: 10px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wb-att-del {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: #ef4444; color: #fff;
  cursor: pointer; font-size: 12px; line-height: 1;
}
.wb-preview { text-align: center; }
.wb-preview img { max-width: 100%; max-height: 70vh; border-radius: 8px; }
/* 录入页提交设置区 + 全部错题筛选行 */
.wb-submit-box {
  border: 1px dashed var(--border); border-radius: 10px;
  padding: 10px 12px; margin: 10px 0 4px; background: #f8fafc;
}
.wb-submit-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.wb-modes.inline { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.wb-modes.inline .wb-mode {
  flex: 1 1 200px; text-align: left; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; padding: 6px 9px; cursor: pointer;
}
.wb-modes.inline .wb-mode b { display: block; font-size: 12px; }
.wb-modes.inline .wb-mode span { font-size: 10.5px; color: var(--muted); }
.wb-modes.inline .wb-mode.active { border-color: var(--primary); background: #eef2ff; }
.wb-filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.wb-filter-row select, .wb-filter-row .wb-q {
  padding: 5px 8px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 7px; background: #fff; color: var(--text); font-family: inherit;
}
.wb-filter-row .wb-q { flex: 1 1 180px; min-width: 140px; }
.wb-group { margin: 10px 0 14px; }
.wb-group-head {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  padding: 5px 2px; border-bottom: 2px solid #e0e7ff; margin-bottom: 8px;
}
.wb-cause-group { display: flex; gap: 5px; flex-wrap: wrap; }
.wb-cause-group select {
  padding: 5px 7px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; font-family: inherit;
}

/* 今日复习：按科目分组（跨科目统筹） */
.wb-group { margin-bottom: 10px; }
.wb-group-head {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  padding: 4px 0 6px; border-bottom: 1px dashed var(--border); margin-bottom: 8px;
}
.wb-group-head .muted { font-weight: 400; }

/* 统计：科目概览卡片 */
.wb-subj-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.wb-subj-card {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.wb-subj-card:hover { border-color: var(--primary); background: #f8fafc; }
.wb-sc-t { font-size: 12.5px; font-weight: 600; color: var(--text); }
.wb-sc-n { font-size: 20px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.wb-sc-d { font-size: 11px; color: var(--muted); }

.wb-form .field-row { display: flex; gap: 8px; flex-wrap: wrap; }
.wb-form .field { flex: 1 1 180px; min-width: 150px; }
.wb-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.wb-form input, .wb-form select, .wb-form textarea {
  width: 100%; padding: 6px 8px; font-size: 12.5px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text);
}
.wb-form textarea { resize: vertical; line-height: 1.6; }
.wb-form input:focus, .wb-form select:focus, .wb-form textarea:focus {
  border-color: var(--primary); outline: none;
}
.wb-ocr-row {
  display: flex; align-items: center; gap: 8px; margin: 6px 0;
  padding: 6px 8px; background: #f8fafc; border: 1px dashed var(--border); border-radius: 6px;
}
.wb-att { display: flex; flex-wrap: wrap; gap: 6px; }
.wb-att-item {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--muted); background: #fff;
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 4px 2px 9px;
}
.wb-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* 诊断结果块 */
.wb-diag {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
}
.wb-diag-head { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.wb-diag-row { font-size: 12.5px; color: var(--text); margin: 3px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wb-diag-actions { display: flex; gap: 6px; margin-top: 8px; }
.wb-warn {
  margin-top: 6px; padding: 5px 8px; border-radius: 6px;
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 12px;
}

/* 错题卡片 */
.wb-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  background: #fff; display: flex; flex-direction: column; gap: 6px;
}
.wb-card.slim { padding: 8px 10px; }
.wb-card-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; }
.wb-subj { font-weight: 600; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 1px 8px; }
.wb-stage, .wb-status, .wb-time { color: var(--muted); }
.wb-loss { color: #dc2626; }
.wb-streak { color: #d97706; }
.wb-done { color: #16a34a; font-weight: 600; }
.wb-card-head .btn { margin-left: auto; }
.wb-stem {
  font-size: 12.5px; line-height: 1.65; color: var(--text);
  background: #f8fafc; border-radius: 6px; padding: 7px 9px; white-space: pre-wrap;
}
.wb-mini-att { font-size: 11.5px; color: var(--muted); }
.wb-label { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.wb-card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wb-card-actions select {
  padding: 4px 6px; font-size: 12px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff;
}

/* 变式题与作答 */
.wb-variant { border-left: 3px solid #c7d2fe; padding-left: 9px; display: flex; flex-direction: column; gap: 4px; }
.wb-variant details summary { font-size: 11.5px; color: var(--muted); cursor: pointer; }
.wb-answer { font-size: 12px; color: var(--text); background: #f8fafc; border-radius: 6px; padding: 6px 8px; margin-top: 4px; }
.wb-practice { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wb-answer-input {
  flex: 1 1 220px; min-width: 160px; padding: 6px 8px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 6px; font-family: inherit;
}
.wb-answer-input:focus { border-color: var(--primary); outline: none; }
.wb-reviews { font-size: 11.5px; color: var(--muted); }

/* 徽标 */
.wb-chip {
  display: inline-block; font-size: 11px; color: #3b5bdb; background: #eef2ff;
  border: 1px solid #e0e7ff; border-radius: 999px; padding: 1px 8px;
}
.wb-cause {
  display: inline-block; font-size: 11px; font-weight: 500;
  border: 1px solid; border-radius: 999px; padding: 1px 8px;
}
.wb-conf { font-size: 11px; color: var(--muted); }
.wb-conf.ok { color: #16a34a; }
.wb-conf.low { color: #d97706; }
.wb-conf.none { color: #dc2626; }
.wb-mastery { font-size: 11px; color: var(--muted); }

/* 统计 */
.wb-stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.wb-stat { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 10px; text-align: center; }
.wb-stat-v { font-size: 20px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.wb-stat-k { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.wb-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wb-charts .chart-box { height: 200px; }
.chart-box.tall { height: 240px; margin-top: 10px; }
.wb-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 900px) {
  .wb-charts, .wb-two { grid-template-columns: 1fr; }
}

.gain-row {
  display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px;
}

/* 右侧「各科提分」chips：hover 显示明细表格，编辑统一走「节点配置」弹窗 */
.gain-row.hover-tip {
  position: relative;
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  margin: 0 0 8px; padding: 6px 8px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  cursor: default;
}
.gain-row.hover-tip .gain-row-label {
  font-size: 12px; color: var(--muted); font-weight: 600; flex: none;
}
.gain-row.hover-tip .gain-more {
  margin-left: auto; font-size: 11.5px; color: var(--muted); flex: none;
  border: 1px dashed var(--border); border-radius: 999px; padding: 1px 7px;
}
.gain-row.hover-tip .gain-tooltip {
  display: none; position: absolute; z-index: 40; top: calc(100% + 6px); left: 0;
  padding: 5px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
}
.gain-row.hover-tip:hover .gain-tooltip { display: block; }
.gain-row.empty-gain {
  display: block; margin: 0 0 8px; padding: 8px 10px;
  font-size: 12.5px; color: var(--muted);
  background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px;
}

/* 右侧节点说明只展示两行，完整内容在「节点配置」弹窗内编辑 */
.gc-note-view.clamp2 {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* 节点配置弹窗：各科提分小节标题 */
.cfg-subj-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 12px 0 4px; font-size: 12.5px; font-weight: 600; color: var(--text);
}
.cfg-subj-head .tip-inline { font-size: 11px; font-weight: 400; color: var(--muted); }
.cfg-subj-head [data-cfg-refill] { margin-left: auto; }
.gain-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 7px; border-radius: 10px;
  background: #eff6ff; color: #1d4ed8; font-size: 11px; font-weight: 500;
  border: 1px solid #bfdbfe;
}
.gain-chip b { color: #059669; font-weight: 600; }

.gc-note-block {
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
  cursor: pointer; transition: box-shadow .15s, border-color .15s;
}
.gc-note-block:hover { border-color: #f59e0b; box-shadow: 0 1px 4px rgba(245,158,11,.15); }
.gc-note-block.editing { cursor: default; border-color: #f59e0b; box-shadow: 0 1px 6px rgba(245,158,11,.2); }
.gc-note-block.editing:hover { box-shadow: 0 1px 6px rgba(245,158,11,.2); }
.gc-note-label { font-size: 11.5px; color: #92400e; font-weight: 600; margin-bottom: 3px; }
.gc-note-view {
  font-size: 12.5px; color: #78350f; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.gc-note-empty { color: #b45309; font-style: italic; opacity: .7; font-size: 12px; }
.gc-note-input {
  width: 100%; min-height: 56px; resize: vertical;
  padding: 6px 8px; border: 1px solid #fcd34d; border-radius: 6px;
  font-size: 12.5px; font-family: inherit; background: #fffdf5;
  color: #78350f; box-sizing: border-box;
}
.gc-note-input:focus { outline: none; border-color: #f59e0b; }
.gc-note-actions { display: flex; gap: 5px; justify-content: flex-end; margin-top: 5px; }

/* 左栏按钮：编辑 + 提分详情 */
.stage-item .si-edit-btn, .stage-item .si-tip-btn {
  padding: 0 4px !important; font-size: 10px !important;
  opacity: 0; transition: opacity .15s;
  line-height: 1;
}
.stage-item:hover .si-edit-btn,
.stage-item:hover .si-tip-btn { opacity: .6; }
.stage-item .si-edit-btn:hover,
.stage-item .si-tip-btn:hover { opacity: 1; }

/* 左栏 tooltip：每科提分详情 */
.si-tooltip {
  position: absolute; z-index: 50;
  top: 100%; left: 0;
  margin-top: 6px; padding: 8px 10px;
  background: #1e293b; color: #e2e8f0;
  border-radius: 6px; font-size: 11.5px;
  min-width: 0; max-width: 100%; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .12s, transform .12s;
  pointer-events: none;
}
.si-tooltip.visible {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.si-tooltip::before {
  content: ''; position: absolute;
  top: -4px; left: 12px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid #1e293b;
}
.sttip { width: 100%; border-collapse: collapse; }
.sttip th {
  font-size: 10px; color: #94a3b8; font-weight: 500;
  text-align: left; padding: 2px 6px;
}
.sttip td {
  padding: 3px 6px; font-size: 11.5px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sttip td.cur { color: #94a3b8; }
.sttip td.tgt { color: #60a5fa; font-weight: 500; }
.sttip td.gain { color: #34d399; font-weight: 600; text-align: right; }

/* 批量表单（内容目标 + 周/月计划通用） */
.target-batch-form, .plan-batch-form {
  padding: 6px 8px; background: #f8fafc;
  border: 1px dashed var(--border); border-radius: 6px; margin-bottom: 6px;
  display: flex; flex-direction: column; gap: 4px;
}
.batch-rows { display: flex; flex-direction: column; gap: 4px; }
.batch-row {
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  padding: 3px; background: #fff; border: 1px solid var(--border); border-radius: 5px;
}
.batch-row > input[type="text"],
.batch-row > input:not([type]),
.batch-row > select {
  padding: 3px 6px; border: 1px solid #cbd5e1; border-radius: 4px;
  font-size: 11.5px; background: #fff; color: var(--text);
  box-sizing: border-box;
}
.batch-row > input:not([type]) { flex: 1; min-width: 110px; }
.batch-row > input[type="date"] { padding: 2px 4px; font-size: 11px; flex: none; width: 120px; }
.batch-row > select { flex: none; min-width: 80px; }
.batch-row.plan-row > input:first-child { flex: 1; min-width: 120px; }
.batch-row .btn[data-batch-del-row] { flex: none; padding: 0 5px !important; line-height: 1; }
.batch-actions {
  display: flex; gap: 5px; align-items: center; padding-top: 2px;
  border-top: 1px dashed var(--border); margin-top: 2px;
}

.gc-note-block {
  margin-top: 8px; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 7px 9px;
}
.gc-note-label { font-size: 11.5px; color: #92400e; font-weight: 600; margin-bottom: 3px; }
.gc-note-input {
  width: 100%; min-height: 56px; resize: vertical;
  border: 1px solid #fde68a; border-radius: 6px;
  background: #fff; padding: 6px 8px; font-size: 12.5px; line-height: 1.6;
  font-family: inherit; color: var(--text);
}
.gc-note-input:focus { border-color: var(--primary); outline: none; }
.gc-section { margin-top: 10px; }
.gc-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; color: var(--text); font-weight: 600;
  padding: 6px 0; border-bottom: 1px dashed var(--border);
}
/* 分区标题用细色条表达层次（替代无信息量的层级编号） */
.gc-section-head > span:first-child {
  display: inline-flex; align-items: center; gap: 6px;
}
.gc-section-head > span:first-child::before {
  content: ''; flex: none; width: 3px; height: 13px; border-radius: 2px;
  background: var(--primary);
}

.gc-subj-section {
  margin: 12px 0 6px;
  padding: 10px 12px;
  background: #fafbff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.gc-subj-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  margin-bottom: 6px;
}
.gc-subj-head .tip-inline {
  font-size: 11px; font-weight: 400; color: var(--muted);
}
.gc-subj-section .subj-table { min-width: 520px; }
/* 内容目标行：名称 / 学科 / 备注 / 删除 */
.gt-block {
  border-left: 2px solid #c7d2fe;
  margin: 8px 0 4px 18px;
  padding: 4px 0 4px 10px;
}
/* 学习内容目标折叠按钮与主体：轻量无边框 chevron，折叠时旋转 */
.gt-fold {
  flex: none; width: 20px; height: 20px;
  border: none; border-radius: 6px;
  background: transparent; color: #a0aec0;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
.gt-fold:hover { color: var(--primary); background: #eef2ff; }
.gt-fold svg { transition: transform .18s ease; }
.gt-block.folded .gt-fold svg { transform: rotate(-90deg); }
.gt-block.folded > .gt-item { background: transparent; }
/* 主标题旁的学习内容目标数量 */
.gd-ct-count {
  font-size: 11.5px; font-weight: 500; color: var(--muted);
  background: #f1f5f9; border-radius: 999px; padding: 2px 10px;
}
/* 阶段时间状态徽标（左栏列表 + 详情标题） */
.stage-badge {
  flex: none; font-size: 10.5px; font-weight: 600;
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.stage-badge.current { color: #15803d; background: #dcfce7; }
.stage-badge.past { color: #94a3b8; background: #f1f5f9; }
/* 独立打卡任务目标块 */
.gt-block.routine-target { border-left-color: #ddd6fe; }
.gt-dot.rt-dot { background: #ede9fe; font-size: 11px; }
.rt-target-title { font-weight: 600; color: #4c1d95; }
.rt-cross-tag {
  flex: none; font-size: 10px; font-weight: 600; color: #7c3aed;
  background: #f5f3ff; border: 1px dashed #c4b5fd; border-radius: 999px; padding: 1px 7px;
}
.rt-target-detail {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
  padding: 2px 0 2px 28px;
}
.rt-target-detail .btn { margin-left: auto; }
.gt-item {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px;
}
.gt-name {
  flex: 1 1 220px; min-width: 160px;
  border: 1px solid transparent; background: #f8fafc;
  border-radius: 6px; padding: 4px 8px; font-size: 12.5px;
}
.gt-name:hover, .gt-name:focus { border-color: var(--primary); background: #fff; outline: none; }
.gt-subject {
  flex: none; min-width: 90px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; padding: 4px 6px; font-size: 12px;
}
.gt-note {
  flex: 1 1 160px; min-width: 120px;
  border: 1px solid transparent; background: #f8fafc;
  border-radius: 6px; padding: 4px 8px; font-size: 12px; color: var(--muted);
}
.gt-note:hover, .gt-note:focus { border-color: var(--primary); background: #fff; outline: none; }
/* 内容目标下挂的周/月计划 */
.gt-plans { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.gt-plans-empty {
  font-size: 11.5px; color: var(--muted); font-style: italic;
  padding: 2px 0;
}
/* 学习内容目标行：序号徽标 + 轻量输入，整体更像「目标条目」 */
.gt-list .gt-item {
  padding: 5px 8px; border-radius: 8px; background: #f8fafc;
  border: 1px solid transparent;
}
.gt-list .gt-item:hover { border-color: #dbeafe; background: #fff; }
.gt-list .gt-item .gt-dot {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: #e2e8f0; color: #64748b;
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.gt-list .gt-item:hover .gt-dot { background: var(--primary-soft, #eef2ff); color: var(--primary); }
.gt-list .gt-item .gt-name { font-weight: 500; }

/* 「＋ 添加周/月计划」按钮：默认收起创建表单，需要时再展开 */
.gt-add-plan-btn {
  align-self: flex-start; margin: 2px 0 2px 18px;
  font-size: 11.5px;
}
.plan-card {
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; padding: 9px 10px;
}
.plan-head {
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  font-size: 12.5px;
}
.plan-lv {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: #16a34a; color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.plan-title {
  font-weight: 600; flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.plan-cycle {
  flex: none; font-size: 11px; color: #16a34a; font-weight: 600;
  border: 1px solid #bbf7d0; border-radius: 999px; padding: 1px 7px; background: #f0fdf4;
}
.plan-head .plan-dates {
  flex: none; margin-top: 0; font-size: 11px; color: var(--muted); white-space: nowrap;
}
.plan-progress { flex: none; margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.plan-dates { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.plan-bar {
  height: 4px; background: var(--bg); border-radius: 999px;
  overflow: hidden; margin: 6px 0 4px;
}
.plan-bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .2s ease; }
.plan-tasks { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.task-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 4px; font-size: 12.5px; border-radius: 4px;
}
.task-row:hover { background: #f8fafc; }
.task-row input[type="checkbox"] { flex: none; cursor: pointer; }
.task-text { flex: 1; min-width: 0; word-break: break-word; }
.task-row.done .task-text { text-decoration: line-through; color: var(--muted); }
.task-time { color: var(--success, #16a34a); font-size: 11px; flex: none; }
.task-edit-input {
  flex: 1; padding: 3px 6px; border: 1px solid var(--primary);
  border-radius: 4px; font-size: 12.5px;
}
.plan-add-task {
  display: flex; gap: 5px; margin-top: 6px;
  padding-top: 6px; border-top: 1px dashed var(--border);
}
.plan-add-task input {
  flex: 1; min-width: 0; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 12px;
}
.plan-add-task input:focus { border-color: var(--primary); outline: none; }
/* 内容目标下方的「添加计划」表单 */
.plan-add-form {
  display: flex; gap: 5px; align-items: center;
  margin: 6px 0 4px; padding: 5px 6px;
  background: #f8fafc; border: 1px dashed var(--border); border-radius: 6px;
}
.plan-add-form input[type="text"], .plan-add-form input:not([type]) {
  flex: 1; min-width: 0; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 5px; font-size: 12px;
}
.plan-add-form select, .plan-add-form input[type="date"] {
  flex: none; padding: 3px 6px; border: 1px solid var(--border);
  border-radius: 5px; font-size: 12px; background: #fff;
}

/* ---------------- 备忘增强：结构化渲染 / 附件 / 检索 ---------------- */
.memo-row { align-items: flex-start; }
.memo-title { font-weight: 700; font-size: 13px; margin-bottom: 3px; color: var(--text); }
.memo-content.rich { font-size: 12.5px; line-height: 1.7; word-break: break-word; }
.memo-content.rich h1, .memo-content.rich h2, .memo-content.rich h3 { font-size: 13px; margin: 6px 0 3px; }
.memo-content.rich ul, .memo-content.rich ol { margin: 3px 0 3px 18px; }
.memo-content.rich p { margin: 3px 0; }
.memo-time { color: var(--muted); font-size: 11px; flex: none; }
/* 附件区 */
.memo-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.memo-att {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px;
  background: #fff; font-size: 11.5px; max-width: 100%;
}
.memo-att-name { cursor: pointer; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memo-att-name:hover { color: var(--primary); }
.memo-att-loading { color: var(--muted); }
.memo-attach-img {
  display: block; max-width: 180px; max-height: 120px;
  border-radius: 6px; cursor: zoom-in; object-fit: cover;
}

/* ---------------- 学习规划：备忘 / 阶段目标 / 周月计划 ---------------- */
.btn.accent { background: var(--primary-soft); border-color: rgba(59,91,219,.25); color: var(--primary); }
.btn.accent:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.plan-pane { margin-top: 0; }
.goal-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.goal-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fbfcfe; }
.goal-card .gc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.goal-card .gc-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.goal-card .gc-actions { display: flex; gap: 5px; flex: none; }
.goal-card .gc-meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.gt-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.gt-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #334155; }
.gt-dot { color: var(--primary); }
.gt-text { flex: 1; min-width: 0; cursor: pointer; word-break: break-word; }
.gt-text:hover { color: var(--primary); }
.gt-empty { color: var(--muted); font-size: 11.5px; padding: 4px 0; }
.gt-add { display: flex; gap: 6px; margin-top: 8px; }
.gt-add input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.gt-edit-input { flex: 1; min-width: 0; padding: 3px 6px; border: 1px solid var(--primary); border-radius: 5px; font-size: 12px; }
.goal-form { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; }

.cl-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-top: 10px; background: #fbfcfe; }
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cl-head .tag { margin-left: 4px; }
.cl-range { color: var(--muted); font-size: 11px; margin-left: 6px; }
.cl-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.cl-prog { color: var(--muted); font-size: 12px; }
.cl-progress { height: 6px; border-radius: 999px; background: var(--bg); margin: 8px 0; overflow: hidden; }
.cl-bar { height: 100%; border-radius: 999px; background: var(--primary); transition: width .25s ease; }
.cl-items { display: flex; flex-direction: column; gap: 4px; }
.cl-item { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; padding: 5px 0; cursor: pointer; }
.cl-item input { flex: none; margin-top: 2px; }
.cl-item .cl-text { flex: 1; min-width: 0; line-height: 1.55; word-break: break-word; }
.cl-item.done .cl-text { text-decoration: line-through; color: var(--muted); }
.cl-item .cl-time { color: var(--success, #16a34a); font-size: 11px; flex: none; margin-top: 2px; }
.cl-add-item { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.cl-add-item input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.cl-edit-input { flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid var(--primary); border-radius: 5px; font-size: 12.5px; }

/* ---------------- 学习规划：三层结构与提分明细 ---------------- */
/* 层级徽标（1=阶段目标 2=学习内容目标） */
.gc-lv, .gt-dot.lv2 {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.gt-dot { color: var(--primary); }
.gt-item .gt-dot { flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary-soft); }
/* 学科提分小徽标（阶段目标行 / 基准分行） */
.gain-row, .base-row { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 8px; }
.gain-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: #475569; background: #eef2ff;
  border: 1px solid #e0e7ff; border-radius: 999px; padding: 1px 7px;
}
.gain-chip b { color: var(--primary); font-weight: 700; }
/* 第3层：内容目标下挂的周/月计划迷你卡 */
.gt-block { display: flex; flex-direction: column; gap: 2px; }
.gt-plans { margin: 2px 0 4px 21px; display: flex; flex-direction: column; gap: 3px; }
.gt-plans.stage-level { margin-left: 21px; }
.cl-mini {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px;
  background: #fff; border: 1px solid var(--border); border-radius: 7px; padding: 3px 8px;
}
.cl-mini-cycle { flex: none; color: var(--primary); font-weight: 600; }
.cl-mini-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #334155; }
.cl-mini-bar { flex: 0 0 56px; height: 4px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.cl-mini-bar span { display: block; height: 100%; background: var(--success, #16a34a); border-radius: 999px; }
.cl-mini-pct { flex: none; color: var(--muted); }
/* 提分明细 */
.detail-combo { height: 260px; margin: 4px 0 12px; }
.detail-table td, .detail-table th { text-align: center; padding: 6px 8px; }
.detail-table .subj-name { text-align: left; }
.detail-table .total-row { background: #f8fafc; font-weight: 600; }
.detail-table .muted { color: var(--muted); }
.subj-table-wrap { overflow-x: auto; }

/* ---------------- 对话附件 ---------------- */
.pending-atts {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 4px 6px 0;
}
.att-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: #334155;
  background: #f1f5f9; border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 8px; max-width: 240px;
  cursor: default;
}
.att-chip button {
  border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 13px; padding: 0 1px; line-height: 1;
}
.att-chip button:hover { color: var(--danger); }
/* 消息气泡内的附件行 */
.msg-atts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.msg-atts .att-chip { cursor: pointer; }
.msg-atts .att-chip:hover { color: var(--primary); border-color: var(--primary); }
/* 输入区附件按钮 */
.input-row #btnAttach { flex: none; padding: 8px 10px; }

.memo-row { align-items: flex-start; }
.memo-body { flex: 1; min-width: 0; }
.memo-content { line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.memo-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.filter-label { color: var(--muted); font-size: 12px; }
.tag-chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); font-size: 11.5px; cursor: pointer; }
.tag-chip:hover { border-color: var(--primary); color: var(--primary); }
.tag-chip.active { background: var(--primary-soft); border-color: rgba(59,91,219,.25); color: var(--primary); }

/* ---------------- 可重复行（阶段目标） ---------------- */
.repeat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

/* ---------------- 学情目标：阶段块 + 学科提分计划 ---------------- */
.goal-block { margin-bottom: 0; }

.subj-panel {
  margin-top: 8px; padding: 10px 12px;
  background: #fbfcfe; border: 1px solid var(--border); border-radius: 10px;
}
.subj-panel .tip { margin-bottom: 8px; }

.subj-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.subj-table th, .subj-table td {
  padding: 6px 4px; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle; white-space: nowrap;
}
.subj-table th { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.subj-table td input {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 7px; font-size: 12.5px; font-family: inherit;
}
.subj-table td input.n { min-width: 60px; }
.subj-table td input:focus { border-color: var(--primary); outline: none; }
.subj-table td input[readonly] { background: #f3f4f6; color: var(--muted); }
.subj-table .subj-name { font-weight: 500; white-space: nowrap; }

/* 科目表格列多，强制不换行；内容超出时横向滚动，避免折行 */
[data-subj-table] { overflow-x: auto; }
.subj-table { min-width: 560px; }

.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.chart-box { height: 180px; min-width: 0; }

/* ---------------- 左栏「资料库」 ---------------- */
.lib-list { flex: 0 1 auto; max-height: 22vh; min-height: 0; overflow-y: auto; padding: 6px; }
.lib-list + .panel-head { border-top: 1px solid var(--border); }
/* 公共/个人分区小标题 */
.lib-section {
  font-size: 11px; color: var(--muted); font-weight: 600;
  padding: 6px 10px 2px; letter-spacing: .03em;
}

/* ---------------- 资料库面板 ---------------- */
.lib-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.lib-bar select,
.lib-bar input {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; font-family: inherit; line-height: 1.5;
  outline: none; color: var(--text); background: var(--panel);
}
.lib-bar select { flex: 0 1 auto; max-width: 48%; min-width: 0; }
.lib-bar input { flex: 1 1 auto; min-width: 0; }
.lib-bar select:focus,
.lib-bar input:focus { border-color: var(--primary); }
.lib-scope {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.lib-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.lib-docs { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.lib-doc {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.lib-doc:last-child { border-bottom: none; }
.lib-doc .src { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-doc .chunks { flex: none; color: var(--muted); font-size: 11.5px; }
.lib-hit {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 7px; background: #fbfcfe;
}
.lib-hit .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.lib-hit .body { font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; }
.lib-preview {
  max-height: 150px; overflow-y: auto; background: var(--bg);
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px;
  line-height: 1.7; white-space: pre-wrap; color: #475569;
}
.lib-empty { text-align: center; padding: 18px 0; }

/* ============== 资源库全屏工作区 ============== */
.kb-workspace {
  position: fixed; inset: 0; z-index: 90;
  background: #f8fafc;
  display: flex; flex-direction: column;
  animation: kbFadeIn .2s ease;
}
.kb-workspace[hidden] { display: none; }
@keyframes kbFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.kb-workspace-header {
  height: 56px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: #fff; border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kb-ws-left { display: flex; align-items: center; gap: 10px; }
.kb-ws-icon { font-size: 22px; }
.kb-ws-title { font-size: 17px; font-weight: 700; color: #0f172a; }
.kb-ws-desc { font-size: 12.5px; color: #94a3b8; margin-left: 4px; }
.kb-workspace-body { flex: 1; display: flex; min-height: 0; }
.kb-ws-sidebar {
  width: 260px; flex: none;
  background: #fff; border-right: 1px solid #e2e8f0;
  overflow-y: auto; padding: 16px 12px;
}
.kb-ws-section-title {
  font-size: 11.5px; font-weight: 600; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 8px 10px 6px;
}
.kb-ws-lib-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 4px;
  border-radius: 10px; cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
}
.kb-ws-lib-item:hover { background: #f1f5f9; }
.kb-ws-lib-item.active {
  background: #eef2ff; border-color: #c7d2fe;
}
.kb-ws-lib-item .icon { font-size: 18px; flex: none; }
.kb-ws-lib-item .meta { flex: 1; min-width: 0; }
.kb-ws-lib-item .name { font-size: 13.5px; font-weight: 600; color: #1e293b; }
.kb-ws-lib-item .sub { font-size: 11.5px; color: #94a3b8; margin-top: 1px; }
.kb-ws-lib-item.active .name { color: #4f46e5; }
.kb-ws-lib-item .badge {
  font-size: 11px; color: #64748b; background: #f1f5f9;
  padding: 2px 7px; border-radius: 10px; flex: none;
}

.kb-ws-main { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 32px; }

.kb-ws-toolbar {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 16px 20px; margin-bottom: 16px;
}
.kb-ws-toolbar .kb-ws-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.kb-ws-toolbar .kb-ws-row:last-child { margin-bottom: 0; }
.kb-ws-toolbar input[type="text"],
.kb-ws-toolbar input:not([type]) {
  flex: 1; min-width: 0; padding: 9px 14px;
  border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 13.5px; background: #f8fafc;
  transition: all .15s;
}
.kb-ws-toolbar input:focus {
  outline: none; background: #fff; border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.kb-ws-lib-info {
  background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 100%);
  border-radius: 12px; padding: 18px 22px;
  margin-bottom: 16px; border: 1px solid #c7d2fe;
}
.kb-ws-lib-info .kb-ws-lib-name {
  font-size: 16px; font-weight: 700; color: #4338ca;
  display: flex; align-items: center; gap: 8px;
}
.kb-ws-lib-info .kb-ws-lib-meta {
  font-size: 12.5px; color: #6366f1; margin-top: 4px;
}
.kb-ws-lib-info .kb-ws-lib-desc {
  font-size: 13px; color: #475569; margin-top: 8px; line-height: 1.6;
}

.kb-ws-doc-list {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  overflow: hidden;
}
.kb-ws-doc {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.kb-ws-doc:last-child { border-bottom: none; }
.kb-ws-doc:hover { background: #f8fafc; }
.kb-ws-doc .ic { font-size: 18px; flex: none; }
.kb-ws-doc .body { flex: 1; min-width: 0; }
.kb-ws-doc .title {
  font-size: 13.5px; font-weight: 600; color: #1e293b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kb-ws-doc .meta { font-size: 11.5px; color: #94a3b8; margin-top: 2px; }
.kb-ws-doc .acts { display: flex; gap: 4px; flex: none; opacity: .4; transition: opacity .15s; }
.kb-ws-doc:hover .acts { opacity: 1; }
.kb-ws-doc .acts button {
  border: none; background: none; cursor: pointer;
  padding: 4px 8px; border-radius: 6px; font-size: 13px;
  color: #64748b; transition: all .15s;
}
.kb-ws-doc .acts button:hover { background: #f1f5f9; color: #0f172a; }
.kb-ws-doc .acts button.danger:hover { background: #fef2f2; color: #dc2626; }

.kb-ws-hit-list { display: flex; flex-direction: column; gap: 10px; }
.kb-ws-hit {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 14px 18px;
}
.kb-ws-hit .meta { font-size: 11.5px; color: #94a3b8; margin-bottom: 6px; }
.kb-ws-hit .body { font-size: 13px; line-height: 1.7; color: #334155; max-height: 200px; overflow-y: auto; }

.kb-ws-empty {
  text-align: center; padding: 60px 20px;
  color: #94a3b8;
}
.kb-ws-empty .ic { font-size: 48px; margin-bottom: 12px; }
.kb-ws-empty .t { font-size: 15px; font-weight: 600; color: #64748b; }
.kb-ws-empty .d { font-size: 13px; margin-top: 4px; }

@media (max-width: 720px) {
  .kb-ws-sidebar { width: 180px; }
  .kb-ws-main { padding: 16px; }
  .kb-ws-desc { display: none; }
}

/* 卡片内的复选框同样要压过 .field input 的通用样式 */
.field .inline-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text); }
.field .inline-check input { width: 15px; height: 15px; flex: none; margin: 0; padding: 0; accent-color: var(--primary); }

/* ---------------- 输入框下方的 AI 提示 ---------------- */
.ai-hint {
  display: flex; align-items: flex-start; gap: 7px;
  margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.6;
}
.ai-hint .lbl {
  flex: none; background: var(--primary-soft); color: var(--primary);
  border-radius: 5px; padding: 1px 6px; font-size: 11px; font-weight: 600;
}

/* 消息操作条（复制 / 点赞 / 重做 / 归档）：常显但弱化，悬停或聚焦时完全可见 */
.msg-actions {
  margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px;
  opacity: .6; transition: opacity .15s ease;
}
.msg:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg-actions .btn.active {
  color: var(--primary); border-color: var(--primary);
  background: var(--primary-soft);
}

/* ---------------- 表单分组（学情档案的层次） ---------------- */
.form-group + .form-group {
  margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--border);
}
.form-group .group-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 10px;
}
.form-group .group-title::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--primary);
}
.form-group .field:last-child { margin-bottom: 0; }
.btn.wide { width: 100%; text-align: center; }

@media (max-width: 1024px) { .aside { display: none; } }
/* 左栏隐藏时，项目标题与账户入口回退到顶栏，保证功能不丢失 */
@media (max-width: 800px) {
  .sidebar { display: none; }
  .workspace > .topbar { display: flex; }
  .topbar-brand { display: block; }
  .topbar-account { display: flex; }
}
/* ===== �滮���� & AI ������� ===== */
.plan-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 6px; flex-wrap: wrap;
}
.plan-header-actions { display: flex; gap: 8px; align-items: center; }
.plan-header-bar .tabs { margin-bottom: 0; }

.group-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.group-title-row .group-title { margin-bottom: 0; }
.group-title-row .group-title::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--primary); margin-right: 7px; }

.ai-portrait-suggest {
  margin-top: 10px; padding: 10px 14px;
  border-radius: 8px; font-size: 13px; line-height: 1.6;
  border: 1px dashed transparent;
}
.ai-suggest-loading { color: var(--muted); background: var(--bg-soft); border-color: var(--border); display: flex; align-items: center; gap: 10px; }
.ai-suggest-loading .dots { display: inline-flex; gap: 4px; }
.ai-suggest-loading .dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
  animation: pulseDot 1.4s ease-in-out infinite;
}
.ai-suggest-loading .dots span:nth-child(2) { animation-delay: .2s; }
.ai-suggest-loading .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pulseDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  30%, 50% { transform: scale(1); opacity: 1; }
}
@keyframes pulseDot2 {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  30%, 50% { transform: scale(1); opacity: 1; }
}
.ai-suggest-ok { color: #1a7a3c; background: #e9f8ee; border-color: #9fe0b4; }
.ai-suggest-err { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.ai-insights { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.ai-insights .chip {
  display: inline-block; padding: 3px 10px; border-radius: 10px;
  background: #eef2ff; color: #3730a3; font-size: 12px;
}

.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============== 资源库：分类 tab + 学科分组 ============== */
.kb-ws-tabs {
  display: flex; gap: 4px; padding: 4px 6px; margin-bottom: 10px;
  background: #f1f5f9; border-radius: 10px;
}
.kb-ws-tab {
  flex: none; padding: 5px 11px; font-size: 12px; font-weight: 600;
  border-radius: 8px; cursor: pointer; color: #64748b;
  transition: all .15s; border: none; background: transparent;
}
.kb-ws-tab:hover { color: #334155; }
.kb-ws-tab.active { background: #fff; color: #4f46e5; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.kb-ws-subject-group { margin-bottom: 14px; }
.kb-ws-subject-label {
  font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 2px 12px 6px;
  display: flex; align-items: center; gap: 6px;
}
.kb-ws-subject-label::after {
  content: ''; flex: 1; height: 1px; background: #e2e8f0;
}

/* ============== 视图切换（列表 / 卡片） ============== */
.kb-view-toggle {
  display: inline-flex; background: #f1f5f9; border-radius: 8px;
  padding: 2px; gap: 1px;
}
.kb-view-toggle button {
  border: none; background: transparent; padding: 4px 9px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
  color: #64748b; transition: all .15s;
}
.kb-view-toggle button.active { background: #fff; color: #4f46e5; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* 卡片视图：文档按卡片网格呈现 */
.kb-doc-cards {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.kb-doc-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 16px; transition: all .18s;
  cursor: default;
}
.kb-doc-card:hover {
  border-color: #c7d2fe; box-shadow: 0 4px 12px rgba(99,102,241,.08); transform: translateY(-1px);
}
.kb-doc-card .ic { font-size: 26px; margin-bottom: 8px; display: block; }
.kb-doc-card .title {
  font-size: 13px; font-weight: 600; color: #1e293b; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kb-doc-card .meta { font-size: 11px; color: #94a3b8; margin-top: 6px; }
.kb-doc-card .acts { margin-top: 10px; display: flex; gap: 4px; opacity: .5; transition: opacity .15s; }
.kb-doc-card:hover .acts { opacity: 1; }
.kb-doc-card .acts button {
  border: none; background: #f8fafc; cursor: pointer; padding: 4px 7px;
  border-radius: 6px; font-size: 12px; color: #64748b;
}
.kb-doc-card .acts button:hover { background: #eef2ff; color: #4338ca; }
.kb-doc-card .acts button.danger:hover { background: #fef2f2; color: #dc2626; }

/* 资料收集特殊样式 */
.kb-doc-card.link-card { border-color: #a7f3d0; background: linear-gradient(135deg, #f0fdf4 0%, #fff 60%); }
.kb-doc-card.link-card:hover { border-color: #22c55e; box-shadow: 0 4px 12px rgba(34,197,94,.1); }

/* URL 粘贴入口 */
.kb-url-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
  padding: 10px 14px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px;
}
.kb-url-row input {
  flex: 1; padding: 8px 12px; border: 1px solid #a7f3d0; border-radius: 8px;
  font-size: 13px; background: #fff;
}
.kb-url-row input:focus { outline: none; border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.kb-url-row .hint { font-size: 11.5px; color: #16a34a; }

/* 去对话按钮 */
.kb-chat-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff; border: none; padding: 6px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.kb-chat-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.kb-chat-btn:active { transform: translateY(0); }

/* 学科/分类 chip */
.kb-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: #f1f5f9; color: #475569;
}
.kb-chip.subject { background: #eef2ff; color: #4f46e5; }
.kb-chip.category { background: #fef3c7; color: #b45309; }
.kb-chip.public { background: #dcfce7; color: #166534; }