/* ═══════════════════════════════════════════════
   知识图谱平台 — Warm Premium Design System V3
   ═══════════════════════════════════════════════ */

:root {
  /* ── Warm neutral palette ── */
  --bg-0: #f5f3ef;
  --bg-1: #fffefa;
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #78716c;
  --muted-light: #a8a29e;

  /* ── Distinctive accent: warm terracotta + deep plum ── */
  --accent: #b45309;
  --accent-hover: #92400e;
  --accent-light: #fef3c7;
  --accent-glow: rgba(180,83,9,0.12);
  --accent-2: #7e22ce;
  --accent-2-light: #f3e8ff;
  --accent-3: #0d9488;
  --accent-3-light: #ccfbf1;

  /* ── Surfaces ── */
  --border: #e7e5e4;
  --border-hover: #d6d3d1;
  --surface-glass: rgba(255,254,250,0.82);

  /* ── Shadows: warm-tinted ── */
  --shadow-xs: 0 1px 2px rgba(28,25,23,0.03);
  --shadow-sm: 0 1px 3px rgba(28,25,23,0.05), 0 1px 2px rgba(28,25,23,0.03);
  --shadow: 0 4px 12px rgba(28,25,23,0.06), 0 1px 3px rgba(28,25,23,0.04);
  --shadow-md: 0 8px 24px rgba(28,25,23,0.08), 0 2px 6px rgba(28,25,23,0.04);
  --shadow-lg: 0 20px 48px rgba(28,25,23,0.10), 0 8px 20px rgba(28,25,23,0.05);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* ── Shape ── */
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 10% 20%, rgba(180,83,9,0.09) 0%, transparent 45%),
    radial-gradient(ellipse at 90% 15%, rgba(126,34,206,0.07) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 85%, rgba(13,148,136,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 55%, rgba(180,83,9,0.04) 0%, transparent 35%),
    linear-gradient(155deg, #f5f0e8 0%, #ede8df 35%, #e8e3d9 70%, #e4dfd5 100%);
  min-height: 100vh;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────── */

.app-shell {
  padding: 14px 18px;
  max-width: 1800px;
  margin: 0 auto;
}

/* ── Topbar: warm glassmorphism ── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255,254,250,0.92), rgba(255,254,250,0.85));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 22px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.6);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  background-size: 200% 100%;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 10px rgba(180,83,9,0.3);
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.brand-subtitle {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.user-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-info {
  font-size: 12px;
  color: var(--muted);
}

/* ── Main Grid (3-column) ──────── */

.main {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: stretch;
  max-height: calc(100vh - 80px);
}
.main.main-fusion {
  display: flex;
  gap: 14px;
  max-height: calc(100vh - 80px);
}
.main.main-tracking {
  display: flex;
  gap: 0;
}
.main.main-tracking .tracking-section {
  flex: 1;
  max-width: none;
  min-width: 0;
  padding: 20px 32px;
}
.main.main-fusion .fusion-section {
  flex: 1;
  min-width: 0;
  max-width: none;
}
.main.main-fusion .right-panel {
  width: 300px;
  flex-shrink: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.right-panel {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* ── Panels: warm glass cards ── */

.panel {
  background: var(--surface-glass);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2), var(--accent-3));
  border-radius: 3px 0 0 3px;
  opacity: 0.7;
}

.panel:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-hover);
}

.panel-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin: 8px 0 4px;
}

.field {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-family: inherit;
  background: var(--bg-1);
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea {
  min-height: 60px;
  resize: vertical;
  line-height: 1.5;
}

/* ── Buttons ────────────────────── */

.btn {
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

.btn:active { transform: scale(0.97); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #a16207);
  color: #fff;
  box-shadow: 0 2px 10px rgba(180,83,9,0.25);
}
.btn.primary:hover {
  box-shadow: 0 4px 16px rgba(180,83,9,0.35);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}
.btn.ghost:hover {
  background: var(--bg-0);
  border-color: var(--border-hover);
  color: var(--ink);
}

.btn.full { width: 100%; }

.btn.small {
  padding: 4px 10px;
  font-size: 11px;
}

/* ── Tabs ───────────────────────── */

.tab-group {
  display: flex;
  gap: 3px;
  background: var(--bg-0);
  border-radius: 8px;
  padding: 3px;
}

.tab {
  flex: 1;
  padding: 5px 6px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  color: var(--muted);
  transition: all var(--transition);
}

.tab:hover { color: var(--ink); }

.tab.active {
  background: var(--bg-1);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ── Module Grid ────────────────── */

.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.module-btn {
  padding: 6px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all var(--transition);
  text-align: left;
}

.module-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.module-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ── Topbar Navigation ───────────────── */

.topbar-nav {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.04);
  border-radius: 8px;
  padding: 3px;
}

.topnav-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.topnav-btn:hover {
  color: var(--ink);
  background: rgba(255,255,255,0.6);
}

.topnav-btn.active {
  color: var(--accent);
  background: #fff;
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

/* ── Model Selector ───────────────── */

#modelSelect {
  background: linear-gradient(135deg, var(--accent-light), #fff);
  border-color: var(--accent);
  font-weight: 600;
}

/* ── Domain Tree Navigation ───────────────── */

.domain-tree {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.domain-node {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all var(--transition);
}

.domain-node:hover {
  border-color: var(--border-hover);
}

.domain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg-1);
  transition: all var(--transition);
  user-select: none;
}

.domain-header:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.domain-header.active {
  background: var(--accent-light);
  color: var(--accent);
}

.domain-count {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(0,0,0,0.05);
  padding: 1px 6px;
  border-radius: 10px;
}

.domain-arrow {
  font-size: 10px;
  transition: transform 0.2s;
  color: var(--muted);
}

.domain-node.open .domain-arrow {
  transform: rotate(90deg);
}

.domain-modules {
  display: none;
  padding: 4px 6px 6px;
  flex-direction: column;
  gap: 3px;
}

.domain-node.open .domain-modules {
  display: flex;
}

.module-leaf {
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-leaf:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.module-leaf.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.module-leaf-count {
  font-size: 9px;
  color: var(--muted);
}

/* ── Micro Course ───────────────── */

.micro-course-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.micro-course-card {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}

.micro-course-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.micro-course-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.micro-course-meta {
  font-size: 10px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 20px 10px;
  color: var(--muted);
  font-size: 12px;
}

/* ── Content Area ───────────────── */

.content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.content-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.content-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.content-meta {
  font-size: 11px;
  color: var(--muted);
}

/* ── Graph ──────────────────────── */

.graph-card {
  background: linear-gradient(145deg, rgba(255,254,250,0.96), rgba(255,254,250,0.90));
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(231,229,228,0.6);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.7);
  padding: 10px 12px;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.graph-hint {
  font-size: 10px;
  color: var(--muted-light);
}

.graph-canvas {
  width: 100%;
  height: 560px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle, #d6d3d1 0.5px, transparent 0.5px),
    radial-gradient(ellipse at 20% 30%, rgba(180,83,9,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 25%, rgba(126,34,206,0.03) 0%, transparent 50%),
    #f8f6f3;
  background-size: 20px 20px, 100% 100%, 100% 100%;
  touch-action: none;
}

/* ── Detail Card ────────────────── */

/* Entity detail slide-out panel */
.detail-slideout {
  position: fixed;
  top: 56px;
  right: -420px;
  width: 400px;
  bottom: 0;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 100;
  transition: right 0.3s ease;
  overflow-y: auto;
  padding: 0;
}
.detail-slideout.open {
  right: 0;
}
.detail-slideout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-glass);
  position: sticky;
  top: 0;
  z-index: 1;
}
.detail-slideout-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.detail-body {
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  padding: 12px 16px;
}

/* Textbook modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: grid;
  place-items: center;
}
.modal-overlay.hidden { display: none; }
.modal-content {
  background: var(--bg-1);
  border-radius: var(--radius-lg);
  width: 90vw;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}
.modal-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
}
.modal-body img {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.task-q-item:hover { background: var(--accent-light); border-radius: 4px; }
.task-q-item .task-q-remove { color: #dc2626; }
.task-q-item .task-q-remove:hover { background: #fee2e2; }
.modal-body .page-label {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: -8px;
  margin-bottom: 12px;
}

.detail-section {
  margin-bottom: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.detail-section:last-child { border-bottom: none; }

/* ── Interactive Question Options ── */
.q-stem { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.q-options { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.q-option-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  background: var(--bg-0); border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  font-size: 13px; color: var(--ink);
  text-align: left; transition: all var(--transition);
}
.q-option-btn:hover {
  border-color: var(--accent); background: var(--accent-light);
  box-shadow: var(--shadow-xs);
}
.q-option-btn.selected { border-color: var(--accent-2); background: var(--accent-2-light); }
.q-option-btn.correct {
  border-color: #059669; background: #d1fae5;
  box-shadow: 0 0 0 2px rgba(5,150,105,0.15);
}
.q-option-btn.wrong {
  border-color: #dc2626; background: #fee2e2;
  box-shadow: 0 0 0 2px rgba(220,38,38,0.15);
}
.q-option-key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-weight: 700; font-size: 13px;
  background: var(--bg-1); color: var(--accent-2);
  border: 1.5px solid var(--border-hover); flex-shrink: 0;
}
.q-option-btn.correct .q-option-key {
  background: #059669; color: #fff; border-color: #059669;
}
.q-option-btn.wrong .q-option-key {
  background: #dc2626; color: #fff; border-color: #dc2626;
}
.q-option-text { line-height: 1.4; }
.q-feedback { margin: 8px 0; }
.q-feedback-correct {
  padding: 8px 14px; border-radius: var(--radius);
  background: #d1fae5; color: #065f46; font-weight: 600;
  font-size: 13px; border: 1px solid #a7f3d0;
}
.q-feedback-wrong {
  padding: 8px 14px; border-radius: var(--radius);
  background: #fee2e2; color: #991b1b; font-weight: 500;
  font-size: 13px; border: 1px solid #fecaca;
}
.q-feedback-submitted {
  padding: 6px 12px; border-radius: var(--radius);
  background: #dbeafe; color: #1e40af; font-size: 13px;
  border: 1px solid #bfdbfe;
}
.q-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 11px; color: var(--muted); padding: 4px 0;
}
.q-answer-hint { color: var(--muted-light); }
.q-meta strong { color: var(--ink-soft); }

/* ── AI Generated Question Cards ── */
.gen-loading {
  padding: 16px; text-align: center; color: var(--muted);
  font-size: 13px; animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.gen-similar-result { margin: 8px 0; }
.gen-question-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 8px;
  background: var(--bg-1);
}
.gen-q-num { font-size: 11px; font-weight: 600; color: var(--accent-2); margin-bottom: 6px; }
.gen-q-stem { font-size: 13px; line-height: 1.5; margin-bottom: 6px; }
.gen-q-text { font-size: 12px; color: var(--ink-soft); line-height: 1.5; white-space: pre-wrap; }
.gen-q-options { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.gen-q-opt { font-size: 12px; color: var(--ink-soft); padding: 2px 0; }
.gen-q-footer {
  display: flex; gap: 12px; font-size: 11px; color: var(--muted);
  border-top: 1px solid var(--border); padding-top: 6px; margin-top: 6px;
}
.gen-q-opt-btn {
  display: block; width: 100%; padding: 8px 12px; margin: 2px 0;
  background: var(--bg-0); border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  font-size: 12px; color: var(--ink); text-align: left;
  transition: all var(--transition);
}
.gen-q-opt-btn:hover {
  border-color: var(--accent); background: var(--accent-light);
}
.gen-q-opt-btn.correct {
  border-color: #059669; background: #d1fae5;
  box-shadow: 0 0 0 2px rgba(5,150,105,0.15);
}
.gen-q-opt-btn.wrong {
  border-color: #dc2626; background: #fee2e2;
  box-shadow: 0 0 0 2px rgba(220,38,38,0.15);
}
.gen-q-opt-btn:disabled { cursor: default; opacity: 0.8; }
.gen-q-feedback-box {
  padding: 8px 12px; border-radius: var(--radius);
  font-size: 12px; font-weight: 600; margin: 4px 0;
}
.gen-q-feedback-box.correct {
  background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0;
}
.gen-q-feedback-box.wrong {
  background: #fee2e2; color: #991b1b; border: 1px solid #fecaca;
}
.gen-q-feedback-box.hidden { display: none; }
.gen-q-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.gen-q-save-btn { font-size: 11px; padding: 3px 10px; }
.gen-q-save-status { font-size: 11px; }
.gen-q-save-status.saved { color: #16a34a; }
.gen-q-save-status.save-failed { color: #dc2626; }
.gen-q-save-status.hidden { display: none; }
.q-actions { display: flex; gap: 6px; padding: 4px 0; }

.detail-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.5;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.external-link {
  text-decoration: none;
}

.page-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid var(--accent);
  background: var(--accent-light);
  transition: all var(--transition);
}

.page-link:hover {
  background: var(--accent);
  color: #fff;
}

.view-textbook-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.view-textbook-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

/* ── Tags ───────────────────────── */

.tag {
  display: inline-block;
  margin: 2px 3px 0 0;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  transition: all var(--transition);
}

.tag.clickable {
  cursor: pointer;
}

.tag.clickable:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(180,83,9,0.2);
}

.tag.relation {
  background: var(--accent-3-light);
  color: var(--accent-3);
  cursor: pointer;
}

.tag.relation:hover {
  background: var(--accent-3);
  color: #fff;
}

.tag.cross-stage {
  background: var(--accent-2-light);
  color: var(--accent-2);
}

/* ── Cross-Stage Alignment Panel ──── */
.cross-stage-panel {
  margin-top: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-height: 600px;
  display: flex;
  flex-direction: column;
}

.cross-stage-panel .panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cross-stage-panel .panel-title {
  font-weight: 600;
  font-size: 13px;
}

.cross-stage-panel .panel-count {
  font-size: 11px;
  color: var(--text-2);
  margin-left: auto;
}

.cross-stage-panel select.field.small {
  width: auto;
  padding: 3px 8px;
  font-size: 12px;
}

.alignment-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.alignment-group {
  padding: 6px 14px;
}

.alignment-group-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.alignment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12px;
}

.alignment-row:hover {
  background: var(--hover-bg, rgba(0,0,0,0.03));
}

.alignment-row .entity-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.alignment-row .entity-goal {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}

.alignment-row .progression-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.progression-badge.深化 {
  background: #dbeafe;
  color: #1d4ed8;
}

.progression-badge.递进 {
  background: #dcfce7;
  color: #15803d;
}

.progression-badge.拓展 {
  background: #fef3c7;
  color: #b45309;
}

.alignment-row .arrow-icon {
  color: var(--text-3);
  font-size: 14px;
  flex-shrink: 0;
}

/* ── Drill Bar ──────────────────── */

.drill-bar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* ── Auth ───────────────────────── */

.auth-mask {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(28,25,23,0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
}

.auth-card {
  width: 360px;
  background: var(--bg-1);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.auth-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  text-align: center;
}

.auth-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 18px;
  background: var(--bg-0);
  border-radius: 8px;
  padding: 3px;
}

.auth-tab {
  flex: 1;
  padding: 7px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  color: var(--muted);
  transition: all var(--transition);
}

.auth-tab.active {
  background: var(--bg-1);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form.hidden { display: none; }

.auth-hint {
  margin-top: 10px;
  font-size: 13px;
  color: #dc2626;
  min-height: 16px;
  text-align: center;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 6px 10px;
  transition: opacity 0.3s;
}

/* ── Agent Chat ─────────────────── */

.agent-panel {
  display: flex;
  flex-direction: column;
  max-height: 460px;
}

.agent-chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 4px 0;
  margin-bottom: 8px;
  min-height: 160px;
  max-height: 280px;
}

.agent-welcome {
  text-align: center;
  padding: 14px 6px;
  color: var(--muted);
}

.agent-welcome-icon {
  font-size: 26px;
  margin-bottom: 5px;
}

.agent-welcome-text {
  font-size: 11px;
  line-height: 1.7;
}

.agent-quick-actions {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-action {
  font-size: 10px;
  text-align: left;
  white-space: normal;
  line-height: 1.4;
}

.agent-message {
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.6;
  max-width: 92%;
  word-break: break-word;
  animation: msgIn 0.2s ease;
}

.agent-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #92400e);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.agent-message.assistant {
  align-self: flex-start;
  background: var(--bg-0);
  color: var(--ink);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.agent-message.assistant h2 { font-size: 13px; font-weight: 700; margin: 10px 0 4px; color: var(--accent); }
.agent-message.assistant h3 { font-size: 12px; font-weight: 600; margin: 8px 0 3px; color: var(--ink); }
.agent-message.assistant p { margin: 4px 0; }
.agent-message.assistant ul, .agent-message.assistant ol { margin: 4px 0; padding-left: 18px; }
.agent-message.assistant li { margin: 2px 0; }
.agent-message.assistant blockquote {
  margin: 6px 0; padding: 4px 8px; border-left: 3px solid var(--accent);
  background: var(--accent-light); border-radius: 4px; font-size: 10px;
}
.agent-message.assistant hr { margin: 8px 0; border: none; border-top: 1px solid var(--border); }
.agent-message.assistant table { border-collapse: collapse; margin: 6px 0; font-size: 10px; width: 100%; }
.agent-message.assistant td { border: 1px solid var(--border); padding: 4px 6px; }
.agent-message.assistant code { background: #f1f1f1; padding: 1px 4px; border-radius: 3px; font-size: 10px; }
.agent-message.assistant details { margin: 4px 0; }
.agent-message.assistant summary { cursor: pointer; font-weight: 600; font-size: 11px; color: var(--accent); }

.agent-tool-step {
  align-self: flex-start;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--accent-light);
  border: 1px solid rgba(180,83,9,0.15);
  font-size: 9px;
  color: var(--accent);
  animation: msgIn 0.15s ease;
}

.agent-typing {
  align-self: flex-start;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 10px;
}

.agent-input-row {
  display: flex;
  gap: 5px;
  align-items: flex-end;
}

.agent-input {
  flex: 1;
  resize: none;
  min-height: 32px;
  max-height: 64px;
  font-family: inherit;
  font-size: 11px;
}

.agent-send { white-space: nowrap; }

.agent-actions {
  margin-top: 5px;
  text-align: right;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Questions / Answers ────────── */

.graph-questions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.graph-questions-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.graph-questions-list {
  display: grid;
  gap: 5px;
}

.question-item {
  text-align: left;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--transition);
}

.question-item:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.answer-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.answer-item {
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--bg-0);
  border: 1px solid var(--border);
}

.answer-meta {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 3px;
}

.answer-question {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 3px;
}

.answer-text {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink);
}

/* ── Dashboard / Stats ──────────── */

.dashboard-content, .student-stats {
  font-size: 11px;
  max-height: 380px;
  overflow-y: auto;
}

.dash-section {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.dash-section:last-child { border-bottom: none; }

.dash-label {
  font-weight: 700;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.dash-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 11px;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.dash-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 4px;
  text-align: center;
}

.dash-card-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.dash-card-value.green { color: #16a34a; }
.dash-card-value.orange { color: #f59e0b; }

.dash-card-label {
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.dash-badge {
  display: inline-block;
  padding: 2px 7px;
  margin: 2px;
  border-radius: 5px;
  background: var(--accent-light);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
}

/* ── Task List ──────────────────── */

.task-list {
  font-size: 11px;
  max-height: 210px;
  overflow-y: auto;
}

.task-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.task-item:last-child { border-bottom: none; }

.task-desc {
  font-size: 10px;
  color: var(--muted);
  margin: 2px 0 3px;
}

.task-status {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ── Result Box ─────────────────── */

.result-box {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  min-height: 18px;
  font-size: 11px;
}

.result-list {
  display: grid;
  gap: 5px;
}

.result-item {
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}

.result-item:hover {
  border-color: var(--accent);
}

.result-meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.result-desc {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* ── Hint ───────────────────────── */

.hint {
  font-size: 11px;
  color: var(--muted);
}

/* ── Micro Course ──────────────── */

.micro-course-list {
  max-height: 220px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}

.mc-card {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  cursor: pointer;
  transition: all var(--transition);
}

.mc-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.mc-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.mc-card-meta {
  font-size: 10px;
  color: var(--muted);
}

.mc-card-play {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--accent);
  font-weight: 600;
}

/* ── Utilities ──────────────────── */

.hidden { display: none !important; }

pre {
  font-size: 10px;
  background: var(--bg-0);
  padding: 6px;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

/* ── Agent Reasoning Box ── */
.agent-reasoning {
  margin: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-0);
}
.reasoning-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 10px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}
.reasoning-content {
  font-size: 11px;
  color: var(--muted);
  padding: 8px 10px;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Agent Tool Step ── */
.agent-tool-step {
  font-size: 11px;
  color: var(--accent);
  padding: 4px 12px;
  font-weight: 500;
}

/* ── Agent Interactive Exercises ── */
.agent-exercise {
  margin: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-1);
  box-shadow: var(--shadow-xs);
}
.agent-exercise .ex-header {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  background: var(--accent-light);
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.agent-exercise .ex-question {
  font-size: 13px;
  padding: 10px 12px 6px;
  line-height: 1.5;
  font-weight: 500;
}
.agent-exercise .ex-options {
  padding: 4px 12px 8px;
}
.agent-exercise .ex-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 4px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
}
.agent-exercise .ex-option:hover {
  background: var(--bg-0);
}
.agent-exercise .ex-option input[type="radio"] {
  accent-color: var(--accent);
  flex-shrink: 0;
}
.agent-exercise .ex-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 10px;
}
.agent-exercise .ex-feedback {
  font-size: 12px;
  font-weight: 500;
}

/* ── Tracking View (full page) ──── */
.tracking-section {
  padding: 20px 28px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.tracking-header {
  margin-bottom: 20px;
}
.tracking-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.tracking-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}
.tracking-welcome {
  background: linear-gradient(135deg, var(--accent), #0d9488);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.tracking-welcome-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.tracking-welcome-detail {
  font-size: 13px;
  opacity: 0.9;
}
.tracking-loading, .tracking-empty, .tracking-error {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
}
.tracking-error { color: #dc2626; }

.tracking-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.tracking-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.tracking-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.tc-val {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
}
.tc-val.green { color: #16a34a; }
.tc-val.orange { color: #f59e0b; }
.tc-lbl {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

.tracking-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.tracking-col {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.tracking-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.tracking-timeline {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tracking-tl-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}
.tracking-tl-item:last-child { border-bottom: none; }
.tl-action { font-weight: 500; color: var(--ink); }
.tl-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }

.tracking-kp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tracking-kp-item {
  padding: 2px 0;
}
.kp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}
.kp-name { font-size: 12px; font-weight: 500; color: var(--ink); }
.kp-stats { font-size: 10px; color: var(--muted); }

/* ── Tracking Charts ───────────────── */
.tracking-charts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.tracking-charts-row:has(.wide) {
  grid-template-columns: 1fr;
}
.tracking-chart-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.tracking-chart-card.wide {
  max-width: 100%;
}
.chart-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 0 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.chart-wrap {
  position: relative;
  width: 100%;
  max-height: 220px;
  display: flex;
  justify-content: center;
}
.chart-wrap canvas {
  max-height: 200px;
  max-width: 100%;
}

/* ── Tracking Tables ───────────────── */
.tracking-tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.tracking-table-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.tracking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tracking-table th {
  text-align: left;
  padding: 6px 8px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tracking-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.tracking-table tr:last-child td {
  border-bottom: none;
}
.tracking-table .cell-time {
  white-space: nowrap;
  width: 140px;
  color: var(--muted);
  font-size: 11px;
}
.text-green { color: #16a34a !important; font-weight: 600; }
.text-red { color: #dc2626 !important; font-weight: 600; }

@media (max-width: 900px) {
  .tracking-grid { grid-template-columns: repeat(3, 1fr); }
  .tracking-columns { grid-template-columns: 1fr; }
  .tracking-charts-row { grid-template-columns: 1fr; }
  .tracking-tables-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .tracking-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Scrollbar ──────────────────── */

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-light); }

/* ── Animations ─────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.content { animation: fadeIn 0.3s ease; }

/* ── Responsive ─────────────────── */

@media (max-width: 1100px) {
  .main {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .right-panel {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    max-height: none;
  }
}

@media (max-width: 800px) {
  .main { grid-template-columns: 1fr; }
  .graph-canvas { height: 380px; }
  .right-panel {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════
   跨版本融合视图
   ═══════════════════════════════════════ */

.fusion-section {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.fusion-toolbar {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}
.fusion-toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fusion-toolbar-left .field-label {
  margin-bottom: 0;
  white-space: nowrap;
}

.fusion-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.fusion-stat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  min-width: 110px;
  text-align: center;
  box-shadow: var(--shadow-xs);
}
.fusion-stat-card.accent {
  border-color: var(--accent);
  background: var(--accent-light);
}
.fusion-stat-card.active-filter {
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.02);
}
.fusion-stat-card[data-filter-stage] {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fusion-stat-card[data-filter-stage]:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}
.fusion-stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}
.fusion-stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.fusion-stat-detail {
  flex: 1;
  min-width: 300px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.fusion-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.fusion-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

.fusion-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 400px;
}

.fusion-cluster-list {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-y: auto;
  max-height: 600px;
}

.fusion-detail {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-y: auto;
  max-height: 600px;
  padding: 16px;
}

.fusion-detail-placeholder {
  color: var(--muted);
  text-align: center;
  padding: 60px 20px;
  font-size: 14px;
}

.fusion-empty {
  color: var(--muted);
  text-align: center;
  padding: 30px 20px;
  font-size: 13px;
}

.fusion-loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.fusion-error {
  color: #dc2626;
  text-align: center;
  padding: 30px;
}

/* Fusion domain cards */
.fusion-domain-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.fusion-domain-card {
  background: var(--bg-1);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.fusion-domain-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.fusion-domain-card .dc-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}
.fusion-domain-card .dc-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
}
.fusion-domain-card .dc-stat-item {
  text-align: center;
}
.fusion-domain-card .dc-stat-val {
  font-size: 20px;
  font-weight: 700;
}
.fusion-domain-card .dc-stat-lbl {
  font-size: 10px;
  color: var(--muted);
}
.fusion-domain-card .dc-modules {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}
.fusion-drill-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
}
#fusionDrillContent.hidden {
  display: none;
}

/* Fusion view toggle */
.fusion-view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-0);
  border-radius: 8px;
  padding: 3px;
  margin-left: auto;
  border: 1px solid var(--border);
}
.fusion-view-toggle .btn.ghost {
  padding: 8px 22px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.fusion-view-toggle .btn.ghost:hover {
  background: var(--bg-1);
  color: var(--ink);
}
.fusion-view-toggle .btn.ghost.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Fusion graph section */
.fusion-graph-section {
  margin-top: 12px;
}
.fusion-graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.fusion-graph-canvas {
  width: 100%;
  height: 560px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle, #d6d3d1 0.5px, transparent 0.5px),
    radial-gradient(ellipse at 20% 30%, rgba(180,83,9,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 25%, rgba(126,34,206,0.03) 0%, transparent 50%),
    #f8f6f3;
  background-size: 20px 20px, 100% 100%, 100% 100%;
  touch-action: none;
}

/* Cluster item */
.fusion-cluster-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.fusion-cluster-item:hover { background: #f5f3ef; }
.fusion-cluster-item.selected {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}

.cluster-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}
.cluster-icon { font-size: 16px; }
.cluster-name { flex: 1; }

.cluster-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.cov-badge {
  padding: 1px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}
.cov-badge.high { background: #bbf7d0; color: #166534; }
.cov-badge.mid { background: #fef08a; color: #854d0e; }
.cov-badge.low { background: #e5e7eb; color: #6b7280; }

.cluster-module { color: var(--muted-light); }
.cluster-stages { margin-left: auto; }

.cluster-progression {
  font-size: 12px;
  margin-top: 3px;
  color: var(--accent);
}

.prog-badge {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.prog-badge.递进 { background: #bbf7d0; color: #166534; }
.prog-badge.深化 { background: #fef08a; color: #854d0e; }
.prog-badge.拓展 { background: #e0e7ff; color: #3730a3; }

/* Detail panel */
.fusion-detail-header {
  margin-bottom: 12px;
}
.fusion-detail-header h3 {
  margin: 0;
  font-size: 18px;
}
.fusion-detail-module {
  font-size: 12px;
  color: var(--muted);
}

.fusion-detail-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-stat {
  background: #f5f3ef;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
}

/* Progression card */
.fusion-progression-card {
  background: #f5f3ef;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.progression-header {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.progression-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
.prog-stage {
  font-size: 12px;
}
.prog-stage.junior { color: #166534; }
.prog-stage.senior { color: #7c3aed; }
.prog-arrow {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
}
.prog-arrow.递进 { background: #bbf7d0; color: #166534; }
.prog-arrow.深化 { background: #fef08a; color: #854d0e; }
.prog-arrow.拓展 { background: #e0e7ff; color: #3730a3; }

/* Variants table */
.fusion-variants {
  margin-bottom: 12px;
}
.variants-section {
  margin-bottom: 12px;
}
.variants-section h4 {
  font-size: 13px;
  margin: 0 0 6px 0;
  color: var(--ink-soft);
}

.variant-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.variant-table th,
.variant-table td {
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.variant-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  background: #faf9f7;
}
.variant-table tr:hover td {
  background: #f5f3ef;
}
.version-cell {
  white-space: nowrap;
  font-weight: 500;
}
.name-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.variant-desc {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
  margin-top: 1px;
}
.entity-card:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.chapter-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.cog-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

/* Ability tags */
.fusion-ability-section {
  margin-top: 12px;
}
.fusion-ability-section h4 {
  font-size: 13px;
  margin: 8px 0 4px 0;
  color: var(--ink-soft);
}
.ability-tags, .nature-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tag.ability {
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.tag.nature {
  background: #fce7f3;
  color: #9d174d;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}
