/* =========================================================================
   生物资源库 · 全站样式（清新生物/教育主题，主色绿 #2e7d6b，响应式）
   ========================================================================= */

:root {
  --green: #2e7d6b;
  --green-dark: #245e51;
  --green-light: #e6f1ee;
  --ink: #1f2d2a;
  --muted: #6b7c78;
  --bg: #f4f8f6;
  --card: #ffffff;
  --border: #e1eae7;
  --danger: #c0392b;
  --warn: #d98324;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 6px 20px rgba(46, 125, 107, 0.08);
  --shadow-sm: 0 2px 8px rgba(31, 45, 42, 0.06);
  --maxw: 1080px;
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui,
    -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  background: var(--green-light);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

/* ----------------------------- 顶部导航 ----------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-logo { font-size: 1.4rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 0.7rem; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }
.brand-name { color: var(--green); font-size: 1.05rem; }
.home-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  color: var(--green-dark); background: var(--green-light);
  text-decoration: none; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.home-btn:hover { background: var(--green); color: #fff; }
.home-btn svg { display: block; }

.site-nav { display: flex; align-items: center; gap: 10px; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-name {
  font-weight: 600;
  color: var(--green-dark);
  font-size: 0.95rem;
}

/* ------------------------------- 按钮 ------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, color 0.15s;
  background: var(--green-light);
  color: var(--green-dark);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; color: var(--green-dark); border-color: var(--border); }
.btn-ghost:hover { background: var(--green-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 12px 22px; font-size: 1.02rem; }
.btn-block { width: 100%; }

/* ------------------------------- 布局 ------------------------------- */
.site-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 20px 60px;
  min-height: 60vh;
}
.page { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 22px 16px;
}
.site-footer .footer-desc { margin: 0 0 6px; }
.site-footer .footer-icp { margin: 0; font-size: 0.8rem; }
.site-footer .footer-icp a { color: var(--muted); text-decoration: none; }
.site-footer .footer-icp a:hover { color: var(--green); text-decoration: underline; }
.site-footer .footer-icp img { vertical-align: -2px; margin-right: 4px; }

.muted { color: var(--muted); font-size: 0.92rem; }
.page-title { font-size: 1.5rem; margin: 8px 0 18px; color: var(--ink); }

/* ------------------------------- Hero ------------------------------- */
.hero {
  background: linear-gradient(135deg, var(--green), #3f8e7c);
  color: #fff;
  border-radius: 20px;
  padding: 44px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}
.hero-head { margin-bottom: 4px; }
.hero-kicker { font-size: 0.8rem; font-weight: 500; letter-spacing: 0.14em; opacity: 0.85; margin: 0 0 6px; }
.hero-title { font-size: 2rem; margin: 0 0 10px; }
.hero-sub { font-size: 1.05rem; opacity: 0.92; margin: 0 auto 22px; max-width: 620px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions .btn-ghost { background: rgba(255, 255, 255, 0.16); color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.hero-actions .btn-ghost:hover { background: rgba(255, 255, 255, 0.28); }

.section-heading { margin: 38px 0 16px; }
.section-heading h2 { margin: 0 0 2px; font-size: 1.3rem; }
.section-heading .muted { margin: 0; }

/* ------------------------------ 首页横幅 ------------------------------ */
.banner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.book-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.1s;
}
.book-card:hover { box-shadow: var(--shadow); }
.book-card-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.book-cover {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.12);
}
.book-index { font-size: 1.5rem; line-height: 1; opacity: 0.95; }
.book-short { font-size: 0.78rem; margin-top: 4px; opacity: 0.95; }
.book-meta { flex: 1; min-width: 0; }
.book-title { margin: 0; font-size: 1.08rem; color: var(--ink); }
.book-count { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.book-toggle { color: var(--green); font-size: 0.85rem; flex: 0 0 auto; }

.book-tree-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  border-top: 1px solid transparent;
}
.book-card.open .book-tree-panel { border-top-color: var(--border); }

/* ------------------------------ 章/节树 ------------------------------ */
.tree { list-style: none; margin: 0; padding: 6px 16px 16px; }
.tree-chapter { margin: 2px 0; }
.tree-chapter-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}
.tree-chapter-head:hover { background: var(--green-light); }
.tree-toggle { color: var(--green); width: 14px; display: inline-block; text-align: center; }
.tree-chapter-title { font-size: 0.95rem; }
.tree-sections { list-style: none; margin: 2px 0 6px; padding: 0 0 0 28px; }
.tree-section { margin: 1px 0; }
.tree-section-link {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}
.tree-section-link:hover { background: var(--green-light); color: var(--green-dark); text-decoration: none; }

/* ----------------------------- 面包屑 ----------------------------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.crumb { color: var(--muted); }
.crumb.current { color: var(--green-dark); font-weight: 600; }
.crumb-sep { opacity: 0.6; }

/* ------------------------------ 工具栏 ------------------------------ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.toolbar-spacer { flex: 1; }
.result-count { color: var(--muted); font-size: 0.85rem; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
}
textarea.form-control { resize: vertical; }

/* ------------------------------ 卡片/题目 ------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.question-list { display: grid; gap: 14px; }
.question-card { transition: box-shadow 0.2s, transform 0.1s; }
.question-card:hover { box-shadow: var(--shadow); }

.q-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag {
  font-size: 0.75rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 600;
}
.tag-diff { background: #fdf0e3; color: var(--warn); }
.tag-type { background: #e9f0fb; color: #3f6fb0; }
.tag-status { background: #f0f1f3; color: var(--muted); }
.tag-approved { background: #e6f4ec; color: #2e7d4f; }
.tag-pending { background: #fdf0e3; color: var(--warn); }
.tag-rejected { background: #fbe7e4; color: var(--danger); }

.q-summary { margin: 0 0 10px; color: var(--ink); }
.q-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.q-knowledge { color: var(--green-dark); }
.q-actions { display: flex; gap: 8px; }

/* ------------------------------ 加载/空态 ------------------------------ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: var(--muted);
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--green-light);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 36px 20px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state.error { color: var(--danger); border-color: #f0c4bd; background: #fdf3f1; }

/* ------------------------------ 详情页 ------------------------------ */
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.detail-card { margin-top: 4px; }
.detail-field { margin: 14px 0; }
.detail-label { font-size: 0.8rem; color: var(--green); font-weight: 700; margin-bottom: 4px; letter-spacing: 0.04em; }
.detail-value { white-space: pre-wrap; color: var(--ink); }
.detail-foot { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }

/* ------------------------------ AI 解疑面板 ------------------------------ */
.chat-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 110px);
  overflow: hidden;
}
.chat-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.chat-header h3 { margin: 0; font-size: 1.05rem; color: var(--green-dark); }
.chat-hint { font-size: 0.78rem; color: var(--muted); }
.chat-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 220px; }
.chat-bubble { max-width: 90%; padding: 10px 13px; border-radius: 12px; font-size: 0.92rem; }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 3px; }
.chat-assistant { align-self: flex-start; background: var(--green-light); color: var(--ink); border-bottom-left-radius: 3px; }
.chat-footer { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.chat-footer .chat-input { flex: 1; }

/* ------------------------------ 表单页 ------------------------------ */
.form-card { max-width: 640px; }
.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.form-row.inline { flex-direction: row; gap: 14px; }
.form-row.inline > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--green-dark); }
.form-actions { margin-top: 6px; }
.edit-form .form-label { margin-top: 8px; }

/* ------------------------------ 导出页 ------------------------------ */
.export-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 6px 0 10px; }
.export-list { display: grid; gap: 8px; margin-bottom: 16px; }
.export-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; cursor: pointer;
}
.export-item:hover { border-color: var(--green); }
.export-title { flex: 1; font-size: 0.92rem; }
.export-actions { display: flex; gap: 10px; }

/* ------------------------------ 后台 ------------------------------ */
.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 10px 14px; font-size: 0.95rem; font-family: inherit; cursor: pointer;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tab:hover { color: var(--green-dark); }
.tab.active { color: var(--green); border-bottom-color: var(--green); }

.admin-list { display: grid; gap: 10px; }
.admin-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
}
.admin-row-main { flex: 1; min-width: 0; }
.admin-row-title { font-weight: 600; color: var(--ink); }
.admin-row-sub { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; font-size: 0.82rem; }
.admin-row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 题目管理：筛选 / 分组 / 批量（spec 指定类） */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { width: auto; margin: 0; }

.bulk-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--green-light); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.bulk-all { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--green-dark); font-weight: 600; cursor: pointer; }
.bulk-count { font-size: 0.9rem; }

.manage-results { display: grid; gap: 12px; }

.q-group { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; background: var(--card); box-shadow: var(--shadow-sm); }
.q-group-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg); }
.q-group-title { font-weight: 700; color: var(--ink); cursor: pointer; }
.q-group-count { color: var(--muted); font-size: 0.85rem; }
.q-group-toggle { margin-left: auto; color: var(--green); cursor: pointer; font-size: 0.9rem; }
.q-group-items { display: grid; gap: 0; }
.q-group-items.collapsed { display: none; }
.q-group-items .admin-row { border: none; border-radius: 0; border-top: 1px solid var(--border); }

.q-check { display: flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; cursor: pointer; }
.q-check-input { width: 16px; height: 16px; cursor: pointer; }
.q-row { gap: 4px; }

.module-breadcrumb { font-size: 0.8rem; color: var(--muted); margin: 2px 0 0; }

.form-divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-align: center; box-shadow: var(--shadow-sm);
}
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--green); }
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }

.chart-title { font-size: 1.1rem; margin: 4px 0 14px; }
.bar-chart { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 48px; align-items: center; gap: 12px; }
.bar-label { font-size: 0.85rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--green-light); border-radius: 999px; height: 14px; overflow: hidden; }
.bar-fill { background: linear-gradient(90deg, var(--green), #4f9a87); height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.bar-value { font-size: 0.85rem; color: var(--muted); text-align: right; }

.ai-report-text {
  white-space: pre-wrap; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-top: 14px; line-height: 1.8;
}

/* ------------------------------ 登录/注册 ------------------------------ */
.auth-page { display: flex; justify-content: center; }
.auth-form { width: 100%; max-width: 420px; margin-top: 30px; }
.auth-title { margin: 0 0 18px; text-align: center; color: var(--green-dark); }
.auth-alt { text-align: center; font-size: 0.9rem; color: var(--muted); margin-top: 16px; }

/* ------------------------------ 模态框 ------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 40, 35, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; }
.modal-dialog {
  background: #fff; border-radius: var(--radius); width: min(560px, 100%);
  max-height: 90vh; overflow: auto; box-shadow: 0 18px 50px rgba(0,0,0,.25);
  transform: translateY(8px); transition: transform 0.2s;
}
.modal-overlay.show .modal-dialog { transform: none; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { margin: 0; font-size: 1.1rem; color: var(--green-dark); }
.modal-close { background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.confirm-msg { margin: 0; color: var(--ink); }

/* ------------------------------ toast ------------------------------ */
.toast-root {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 0.92rem; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(10px); transition: opacity 0.3s, transform 0.3s;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { background: var(--green); }
.toast-warning { background: var(--warn); }
.toast-error { background: var(--danger); }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .chat-panel { position: static; max-height: none; }
}
@media (max-width: 600px) {
  .header-inner { padding: 10px 14px; flex-wrap: wrap; }
  .site-nav { gap: 8px; flex-wrap: wrap; }
  .user-menu { gap: 8px; flex-wrap: wrap; }
  .brand-name { font-size: 1.05rem; }
  .site-main { padding: 20px 14px 48px; }
  .hero { padding: 32px 20px; border-radius: 16px; }
  .hero-title { font-size: 1.6rem; }
  .bar-row { grid-template-columns: 110px 1fr 40px; gap: 8px; }
  .admin-row { flex-direction: column; align-items: stretch; }
  .admin-row-actions { justify-content: flex-end; }
  .btn { padding: 8px 13px; }
  .btn-lg { padding: 11px 18px; }
}
@media (max-width: 480px) {
  .header-inner { padding: 10px 12px; gap: 10px; }
  .brand { font-size: 1.05rem; }
  .brand-name { font-size: 0.98rem; }
  .site-nav { width: 100%; order: 3; justify-content: flex-start; gap: 6px; }
  .user-menu { margin-left: auto; }
  .site-main { padding: 16px 12px 40px; }
  .hero-title { font-size: 1.4rem; }
  .hero-sub { font-size: 0.92rem; }
  .bar-row { grid-template-columns: 84px 1fr 36px; gap: 6px; }
  .bar-label { font-size: 0.78rem; }
  .stat-cards { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
  .modal-dialog { width: 100%; }
  .filter-bar select, .filter-bar input { width: 100%; }
  .export-item { flex-wrap: wrap; }
  .export-actions { width: 100%; justify-content: flex-end; }
  .ai-panel { right: 12px; left: 12px; width: auto; bottom: 72px; }
  #ai-assistant-root { right: 12px; bottom: 12px; }
}

/* 长文本防溢出：CJK 与超长拉丁串（URL/ID）均可换行 */
.detail-value,
.export-title,
.bar-label,
.admin-row-title,
.q-group-title,
.chat-text,
.ai-text,
.ai-report-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ------------------------------ 全局 AI 助手浮窗 ------------------------------ */
#ai-assistant-root { position: fixed; right: 20px; bottom: 20px; z-index: 150; }
.ai-fab {
  background: linear-gradient(135deg, var(--green), #4f9a87);
  color: #fff; border: none; border-radius: 999px;
  padding: 12px 18px; font-size: 0.95rem; font-weight: 700; font-family: inherit;
  box-shadow: 0 8px 22px rgba(46,125,107,.4); cursor: pointer;
}
.ai-fab:hover { transform: translateY(-1px); }
.ai-panel {
  position: fixed; right: 20px; bottom: 76px; width: min(380px, 92vw);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0,0,0,.22); display: flex; flex-direction: column;
  max-height: min(70vh, 560px); overflow: hidden;
}
.ai-panel.hidden { display: none; }
.ai-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ai-panel-head h3 { margin: 0; font-size: 1.05rem; color: var(--green-dark); }
.ai-close { background: none; border: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); }
.ai-admin-actions { display: flex; gap: 8px; padding: 10px 16px 0; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.ai-bubble { max-width: 90%; padding: 9px 12px; border-radius: 12px; font-size: 0.9rem; }
.ai-text { white-space: pre-wrap; word-break: break-word; }
.ai-user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 3px; }
.ai-assistant { align-self: flex-start; background: var(--green-light); color: var(--ink); border-bottom-left-radius: 3px; }
.ai-foot { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.ai-foot .ai-input { flex: 1; }

/* ------------------------------ 专题辅导 ------------------------------ */
.nav-link { color: var(--ink); font-weight: 600; font-size: 0.95rem; text-decoration: none; padding: 6px 2px; }
.nav-link:hover { color: var(--green-dark); }

.topic-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.topic-card { display: block; text-decoration: none; color: var(--ink); transition: box-shadow 0.2s, transform 0.1s, border-color 0.2s; }
.topic-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--green); text-decoration: none; }
.topic-card-title { margin: 0 0 6px; font-size: 1.1rem; color: var(--green-dark); }
.topic-card-desc { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.topic-card-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.8rem; }

.material-list { display: grid; gap: 16px; }
.material-card { display: flex; flex-direction: column; gap: 12px; }
.material-head { display: flex; flex-direction: column; gap: 6px; }
.material-title { margin: 0; font-size: 1.05rem; color: var(--ink); }
.material-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 0.8rem; color: var(--muted); }
.material-text { white-space: pre-wrap; word-break: break-word; background: var(--bg); border-radius: var(--radius-sm); padding: 14px; font-family: inherit; font-size: 0.95rem; margin: 0; color: var(--ink); }
.material-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ppt-viewer { display: flex; flex-direction: column; gap: 10px; }
.ppt-stage { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; min-height: 160px; }
.ppt-page { white-space: pre-wrap; word-break: break-word; font-size: 0.95rem; color: var(--ink); }
.ppt-nav { display: flex; align-items: center; gap: 12px; justify-content: center; }

.form-stack { display: flex; flex-direction: column; gap: 12px; }

/* ------------------------------ 下载权限提示 ------------------------------ */
.perm-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius-sm); margin: 14px 0 18px;
  font-size: 0.95rem; border: 1px solid transparent;
}
.perm-banner .perm-icon { font-size: 1.2rem; line-height: 1; }
.perm-banner .perm-text { flex: 1; }
.perm-banner .perm-actions { display: flex; gap: 8px; }
.perm-ok { background: #eafaf0; border-color: #bfe6cd; color: #1f6b3f; }
.perm-guest { background: #fff6e6; border-color: #f0d9a8; color: #8a5a00; }
.perm-pending { background: #eef3f8; border-color: #cdd9e6; color: #3a5a78; }

.material-gate {
  padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: #fafbfc; text-align: center;
}
.material-gate-text { font-weight: 700; color: var(--danger); margin: 0 0 6px; }
.material-gate .muted { margin: 0 0 10px; }
.material-gate-actions { display: flex; gap: 8px; justify-content: center; }

/* ------------------------------ 上传页 AI 导入/互动 ------------------------------ */
.hidden { display: none !important; }
.form-inline-actions { display: flex; gap: 8px; margin-top: 8px; }
.ai-hint { margin-top: 10px; padding: 10px 12px; background: var(--green-light); border-radius: var(--radius-sm); }
.ai-hint-kp { font-weight: 700; color: var(--green-dark); margin: 0 0 4px; }
.ai-hint-text { margin: 0; font-size: 0.9rem; color: var(--ink); white-space: pre-wrap; }

.ai-chat-panel { margin-top: 20px; }
.ai-chat-title { margin: 0 0 4px; font-size: 1.05rem; color: var(--green-dark); }
.ai-chat-msgs { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; padding: 8px 2px; }
.ai-chat-foot { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.ai-chat-foot textarea { flex: 1; }

/* ----------------------- AI 智能导入模块（多文件上传） ----------------------- */
.import-module { margin-bottom: 18px; padding: 20px; }
.import-module-head { margin-bottom: 14px; }
.import-module-title { font-weight: 700; font-size: 1.1rem; color: var(--green-dark); display: block; }
.import-module-desc { font-size: 0.85rem; color: var(--muted); display: block; margin-top: 2px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.drop-zone:hover { border-color: var(--green); background: var(--green-light); }
.drop-zone.drop-zone-active { border-color: var(--green); background: var(--green-light); border-style: solid; }
.drop-zone-icon { font-size: 2.2rem; line-height: 1; }
.drop-zone-text { margin: 0; font-size: 0.95rem; color: var(--ink); }
.drop-zone-hint { margin: 4px 0 0; font-size: 0.8rem; }

.import-file-list-wrap { margin-top: 16px; }
.import-file-list { display: flex; flex-direction: column; gap: 8px; }
.import-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  transition: border-color 0.2s;
}
.import-file-item.import-file-done { border-color: var(--green); }
.import-file-item.import-file-error { border-color: var(--danger, #e74c3c); }
.import-file-icon { font-size: 1.4rem; flex-shrink: 0; }
.import-file-info { flex: 1; min-width: 0; }
.import-file-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-file-meta { font-size: 0.78rem; margin-top: 2px; }
.import-file-progress-bar {
  flex-shrink: 0;
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.import-file-progress-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.3s ease;
  border-radius: 3px;
}
.import-file-error { width: 100%; font-size: 0.8rem; color: var(--danger, #e74c3c); margin-top: 4px; }
.import-file-actions { flex-shrink: 0; display: flex; gap: 6px; }
.import-status-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
}
.import-status-pending { background: var(--border); color: var(--muted); }
.import-status-reading, .import-status-parsing { background: #fff3cd; color: #856404; }
.import-status-done { background: #d4edda; color: #155724; }
.import-status-error { background: #f8d7da; color: #721c24; }

.import-list-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.import-list-count { font-size: 0.82rem; }

/* 解析结果预览表 */
.import-preview-wrap { margin-top: 20px; }
.import-preview-title { margin: 0 0 4px; font-size: 1.05rem; color: var(--green-dark); }
.import-preview-hint { margin: 0 0 12px; font-size: 0.82rem; }
.import-preview-table-wrap { overflow-x: auto; }
.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.import-preview-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.import-preview-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.import-preview-table .preview-idx { font-weight: 700; color: var(--green-dark); white-space: nowrap; }
.import-preview-table .preview-src { font-size: 0.78rem; color: var(--muted); white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.import-preview-table .preview-input { font-size: 0.82rem; min-width: 180px; }
.import-preview-table .preview-actions { white-space: nowrap; }
.btn-danger-ghost { background: none; border: 1px solid var(--danger, #e74c3c); color: var(--danger, #e74c3c); }
.btn-danger-ghost:hover { background: var(--danger, #e74c3c); color: #fff; }

.import-confirm-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--green-light);
  border-radius: var(--radius-sm);
}

/* ------------------------------ 会员管理增强 ------------------------------ */
.sub-tabs { margin-bottom: 0; border-bottom: 2px solid var(--border); }
.sub-tabs .tab { font-size: 0.88rem; padding: 6px 14px; }
.sub-tabs .tab.active { border-bottom: 2px solid var(--green-dark); color: var(--green-dark); }
.member-action-bar { display: flex; gap: 8px; margin: 12px 0; }
.member-action-bar .btn { font-size: 0.85rem; }
.tag-approved { background: #e8f5e9; color: #2e7d4f; }
.tag-rejected { background: #fde8e8; color: #c62828; }
.import-info { margin-bottom: 10px; }
.import-format-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.85rem; }
.import-format-table th, .import-format-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.import-format-table th { background: var(--bg); font-weight: 600; }
.import-result { margin-top: 10px; }

/* ------------------------------ 专题卡片操作 ------------------------------ */
.topic-card-link { position: relative; }
.topic-card-inner { display: block; text-decoration: none; color: inherit; }
.topic-card-inner:hover { opacity: 0.85; }
.topic-card-ops { display: flex; gap: 6px; position: absolute; top: 12px; right: 12px; }

/* ------------------------------ 文件查阅器 ------------------------------ */
.file-viewer { margin: 10px 0; }
.file-viewer-stage { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; min-height: 120px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.word-content { line-height: 1.7; color: var(--ink); font-size: 0.95rem; }
.word-content h1, .word-content h2, .word-content h3 { margin: 12px 0 6px; color: var(--green-dark); }
.word-content p { margin: 6px 0; }
.word-content table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.word-content td, .word-content th { border: 1px solid var(--border); padding: 4px 8px; }
.file-download-hint p { margin: 4px 0; }

/* ============================== 富文本编辑器 ============================== */
.rte-wrapper { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 6px 8px; background: var(--bg); border-bottom: 1px solid var(--border); }
.rte-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; border: 1px solid transparent; border-radius: 4px; background: transparent; cursor: pointer; font-size: 0.9rem; color: var(--ink); transition: all .15s; }
.rte-btn:hover { background: #e8e8e8; border-color: #d0d0d0; }
.rte-btn:active { transform: scale(0.95); }
.rte-sep { width: 1px; height: 20px; background: #d0d0d0; margin: 0 4px; }
.rte-editor-wrap { position: relative; }
.rte-editor { min-height: 120px; max-height: 500px; overflow-y: auto; padding: 12px 14px; outline: none; font-size: 0.95rem; line-height: 1.7; color: var(--ink); }
.rte-editor:focus { box-shadow: inset 0 0 0 2px var(--green); }
.rte-editor.empty::before { content: none; }
.rte-placeholder { position: absolute; top: 12px; left: 14px; color: #aaa; pointer-events: none; font-size: 0.95rem; }
.rte-table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.rte-table td, .rte-table th { border: 1px solid #d0d0d0; padding: 4px 8px; min-width: 40px; }
.rte-editor img { max-width: 100%; height: auto; border-radius: 4px; }
.rte-editor table { border-collapse: collapse; }
.rte-editor table td, .rte-editor table th { border: 1px solid #ccc; padding: 4px 8px; }

/* 详情页富文本渲染 */
.detail-value { line-height: 1.7; }
.detail-value p { margin: 6px 0; }
.detail-value img { max-width: 100%; height: auto; border-radius: 4px; }
.detail-value table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.detail-value table td, .detail-value table th { border: 1px solid var(--border); padding: 4px 8px; }
.detail-value ul, .detail-value ol { margin: 6px 0; padding-left: 24px; }
.detail-value h3 { font-size: 1.05rem; font-weight: 700; margin: 10px 0 6px; color: var(--green-dark); }

/* 表单提示 */
.form-hint { font-size: 0.8rem; margin: 4px 0 0; }

