/* ===== 访问口令遮罩 ===== */
.access-pass-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  padding: 20px;
}
.access-pass-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 36px 32px;
  text-align: center;
}
.access-pass-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--primary-bg, #eff6ff);
  color: var(--primary, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.access-pass-card h2 {
  font-size: 22px;
  margin-bottom: 6px;
  color: var(--secondary, #1e293b);
}
.access-pass-sub {
  color: var(--text-light, #64748b);
  font-size: 14px;
  margin-bottom: 24px;
}
.access-pass-input {
  text-align: center;
  letter-spacing: 2px;
  font-size: 16px;
  margin-bottom: 16px;
}
.access-pass-error {
  color: var(--danger, #ef4444);
  font-size: 13px;
  margin-top: 14px;
}

/* ===== CSS 变量 ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-bg: #eff6ff;
  --primary-border: #bfdbfe;
  --secondary: #1e293b;
  --secondary-light: #475569;
  --accent: #f59e0b;
  --accent-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.08), 0 1px 2px 0 rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --sidebar-w: 280px;
  --header-h: 64px;
}

/* ===== 全局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

/* ===== 顶部工具栏 ===== */
.app-header {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 100;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  font-size: 26px;
  color: var(--primary);
}

.header-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--secondary);
  white-space: nowrap;
}

.subtitle {
  font-size: 12px;
  color: var(--text-light);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-mini {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  margin-right: 8px;
}

.progress-mini span {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}

.progress-bar-mini {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill-mini {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg-hover); border-color: var(--text-lighter); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ===== 主体布局 ===== */
.app-body {
  display: flex;
  height: calc(100vh - var(--header-h));
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-w);
  background: #1e3a5f;
  border-right: 1px solid #2a4a7f;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, transform 0.3s ease;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
}

.nav-menu {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.nav-menu::-webkit-scrollbar { width: 4px; }
.nav-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.nav-group {
  margin-bottom: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-item.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: #60a5fa;
  border-radius: 2px;
}

.nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  color: rgba(255,255,255,0.55);
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  color: #60a5fa;
}

.nav-item .nav-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item .nav-badge {
  font-size: 11px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

.nav-item.active .nav-badge {
  background: rgba(96,165,250,0.2);
  color: #93c5fd;
}

/* 子标题容器，默认隐藏 */
.nav-subs {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}
.nav-subs.expanded {
  max-height: 600px;
  opacity: 1;
  padding-bottom: 4px;
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 42px;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  transition: all 0.15s;
  border-radius: var(--radius-sm);
}

.nav-subitem:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
}

.nav-subitem.active {
  color: #93c5fd;
  font-weight: 600;
  background: rgba(96,165,250,0.12);
}

.nav-subitem .sub-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.nav-subitem.active .sub-dot {
  background: #60a5fa;
}

.nav-subitem .sub-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 导航项上的展开/折叠箭头 */
.nav-arrow {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  transition: transform 0.3s;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}
.nav-item.active .nav-arrow {
  color: rgba(255,255,255,0.6);
}

/* 编辑模式下的模块操作按钮 */
.nav-item-actions {
  display: none;
  gap: 2px;
  flex-shrink: 0;
}
body.edit-mode .nav-item-actions {
  display: flex;
}
.nav-action-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.nav-action-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.nav-action-btn.danger:hover {
  background: rgba(239,68,68,0.5);
  color: #fff;
}

/* 侧栏子项（章节）在编辑模式下的操作按钮 */
.nav-sub-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
}
.nav-sub-actions .nav-action-btn {
  width: 20px;
  height: 20px;
  font-size: 9px;
}
.nav-add-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 42px;
  margin-top: 2px;
  cursor: pointer;
  color: rgba(96,165,250,0.85);
  font-size: 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.nav-add-sub:hover {
  background: rgba(96,165,250,0.12);
  color: #93c5fd;
}

/* 编辑模式下导航项中的可编辑文本 */
body.edit-mode .nav-text[contenteditable] {
  outline: 1px dashed rgba(255,255,255,0.3);
  border-radius: 3px;
  padding: 2px 4px;
  min-width: 40px;
}
body.edit-mode .nav-text[contenteditable]:focus {
  background: rgba(255,255,255,0.1);
  outline-color: rgba(255,255,255,0.6);
}

/* 新增模块按钮 */
.add-module-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: 6px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.add-module-btn:hover {
  border-color: rgba(255,255,255,0.5);
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.nav-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  margin-top: 4px;
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-collapse-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
/* 折叠态：整个深蓝侧栏收起，主内容全屏。
   注意：不能用 transform（会创建包含块，导致内部 fixed 按钮被一起推出屏幕），
   改用 width:0 + overflow:visible 隐藏侧栏，仅靠内部 fixed 按钮重新浮出。 */
.sidebar.nav-collapsed {
  width: 0;
  min-width: 0;
  overflow: visible;
  border-right: none;
}
/* 收起后把折叠按钮浮到屏幕最左侧边缘，便于再次展开 */
.sidebar.nav-collapsed .nav-collapse-btn {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 12px;
  z-index: 300;
  width: auto;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  background: #1e3a5f;
  color: #fff;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}
.sidebar.nav-collapsed .nav-collapse-btn:hover {
  background: #274a78;
}
/* 收起态隐藏侧栏内部其余内容，避免溢出 */
.sidebar.nav-collapsed .nav-menu,
.sidebar.nav-collapsed .sidebar-footer {
  display: none;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.15);
  color: rgba(255,255,255,0.5);
}

.student-count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

.student-count i { color: #60a5fa; }

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  scroll-behavior: smooth;
}

.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.content-header {
  margin-bottom: 24px;
}

.content-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-header h2 i { color: var(--primary); }

.content-header .module-intro {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.7;
}

.quiz-fingerprint {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--accent-bg, #eef5ff);
  border: 1px dashed var(--primary, #2b7de9);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-light, #5b6b7b);
  line-height: 1.6;
  word-break: break-all;
}
.quiz-fingerprint i { color: var(--primary, #2b7de9); margin-right: 4px; }
.quiz-fingerprint .fp-nums { color: var(--primary, #2b7de9); font-weight: 600; letter-spacing: 0.5px; }

.editable-title {
  outline: none;
  border-radius: 4px;
  transition: all 0.2s;
}

body.edit-mode .editable-title {
  border-bottom: 2px dashed var(--accent);
  cursor: text;
}

body.edit-mode .editable-title:focus {
  background: var(--accent-bg);
}

/* ===== 内容卡片 ===== */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.content-card:hover {
  box-shadow: var(--shadow-md);
}

/* 折叠按钮 */
.card-toggle {
  background: none;
  border: none;
  color: var(--text-lighter);
  cursor: pointer;
  font-size: 18px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  flex-shrink: 0;
}
.card-toggle:hover {
  background: var(--bg-hover);
  color: var(--primary);
}
.card-toggle.collapsed {
  transform: rotate(-90deg);
}
.card-body {
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.35s ease, padding 0.35s ease;
  max-height: 5000px;
  opacity: 1;
}
.card-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.card-header.has-toggle {
  margin-bottom: 0;
  border-bottom: none;
  cursor: pointer;
}
.card-header.has-toggle + .card-body {
  border-top: 2px solid var(--border-light);
  padding-top: 16px;
  margin-top: 4px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--secondary);
}

.card-title .section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.card-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.content-card:hover .card-actions { opacity: 1; }

body.edit-mode .card-actions { opacity: 1; }

.card-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  outline: none;
  min-height: 20px;
}

body.edit-mode .card-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: #fffbeb22;
}

.card-content h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.card-content h4:first-child { margin-top: 0; }

/* 插图区域 */
.illustration {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}
.illustration img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 0 auto;
}
.illustration svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 编辑模式下的图片操作 */
body.edit-mode .illustration {
  border-color: var(--primary-border);
  border-style: dashed;
  cursor: pointer;
}
.illustration .img-actions {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  gap: 4px;
}
body.edit-mode .illustration:hover .img-actions,
body.edit-mode .illustration .img-actions {
  display: flex;
}
.illustration .img-actions .icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* 内容区内的图片 */
.card-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 12px 0;
}

/* 内容区插入图片按钮 */
.insert-img-btn {
  display: none;
  padding: 6px 12px;
  border: 1px dashed var(--primary-border);
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  margin: 8px 0;
  transition: all 0.2s;
  align-items: center;
  gap: 4px;
}
body.edit-mode .insert-img-btn {
  display: inline-flex;
}
.insert-img-btn:hover {
  border-color: var(--primary);
  background: #dbeafe;
}

/* 内容区图片包裹层 */
.content-img-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 12px 0;
}
.content-img-wrapper img {
  margin: 0;
  border-radius: 6px;
}
.content-img-wrapper .img-actions {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  gap: 4px;
}
body.edit-mode .content-img-wrapper:hover .img-actions,
body.edit-mode .content-img-wrapper .img-actions {
  display: flex;
}

.card-content p { margin-bottom: 8px; }

.card-content ul, .card-content ol {
  margin: 8px 0 12px 20px;
}

.card-content li { margin-bottom: 4px; }

.card-content ul ul, .card-content ol ol {
  margin: 4px 0 4px 20px;
}

.card-content strong { color: var(--secondary); }

.card-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.card-content th {
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--primary-border);
}

.card-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
}

.card-content tr:nth-child(even) td {
  background: var(--bg);
}

/* 新增内容按钮 */
.add-section-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

body.edit-mode .add-section-btn {
  display: flex;
}

.add-section-btn:not(.edit-mode) {
  display: none;
}

.add-section-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

/* ===== 考核模块 ===== */
.quiz-container {
  max-width: 800px;
}

.quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-bottom: 20px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.quiz-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.quiz-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.quiz-tag.cat-disease { background: var(--danger-bg); color: var(--danger); }
.quiz-tag.cat-care { background: var(--primary-bg); color: var(--primary-dark); }
.quiz-tag.cat-num { background: var(--bg-hover); color: var(--text-light); }

.quiz-question {
  font-size: 16px;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.quiz-option:hover {
  border-color: var(--primary-border);
  background: var(--primary-bg);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.quiz-option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-hover);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-light);
  flex-shrink: 0;
}

.quiz-option.selected .quiz-option-letter {
  background: var(--primary);
  color: #fff;
}

.quiz-option.correct .quiz-option-letter {
  background: var(--success);
  color: #fff;
}

.quiz-option.wrong .quiz-option-letter {
  background: var(--danger);
  color: #fff;
}

.quiz-explanation {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--accent-bg);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  display: none;
}

.quiz-explanation.show { display: block; }

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

.quiz-result {
  text-align: center;
  padding: 40px;
}

.quiz-result .score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
  font-weight: 700;
}

.quiz-result .score-circle.pass {
  background: var(--success-bg);
  color: var(--success);
  border: 4px solid var(--success);
}

.quiz-result .score-circle.fail {
  background: var(--danger-bg);
  color: var(--danger);
  border: 4px solid var(--danger);
}

.quiz-result h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

/* 考核结果：分类掌握情况小结 */
.quiz-breakdown {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.quiz-breakdown-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}
.quiz-breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.quiz-breakdown-row.weak {
  color: var(--danger);
}
.quiz-breakdown-cat {
  flex: 0 0 110px;
  font-size: 14px;
  font-weight: 500;
}
.quiz-breakdown-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}
.quiz-breakdown-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.quiz-breakdown-rate {
  flex: 0 0 44px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
}
.quiz-breakdown-detail {
  flex: 0 0 52px;
  font-size: 12px;
  color: var(--text-lighter);
  text-align: left;
}
.quiz-breakdown-tip {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.quiz-breakdown-tip.good {
  background: var(--success-bg);
  color: var(--success);
}

/* ===== 错题分析区块 ===== */
.quiz-wrong-analysis {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  text-align: left;
}
.quiz-wrong-head {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--danger);
  text-align: left;
}
.quiz-wrong-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-light);
  text-align: left;
}
.quiz-wrong-item:last-child {
  border-bottom: none;
}
.quiz-wrong-q {
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.5;
  text-align: left;
}
.quiz-wrong-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}
.quiz-wrong-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
.quiz-wrong-tag {
  flex: 0 0 64px;
  text-align: left;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}
.quiz-wrong-tag.wrong { background: var(--danger-bg); color: var(--danger); }
.quiz-wrong-tag.right { background: var(--success-bg); color: var(--success); }
.quiz-wrong-tag.exp { background: var(--bg-hover); color: var(--primary); }
.quiz-wrong-val.wrong { color: var(--danger); font-weight: 500; }
.quiz-wrong-val.right { color: var(--success); font-weight: 500; }
.quiz-wrong-val.exp { color: var(--text-light); }

/* ===== 做对的题区块 ===== */
.quiz-right-list {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  text-align: left;
}
.quiz-right-head {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--success);
  text-align: left;
}
.quiz-right-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-light);
  text-align: left;
}
.quiz-right-item:last-child {
  border-bottom: none;
}
.quiz-right-q {
  font-weight: 500;
  margin-bottom: 6px;
  line-height: 1.5;
  text-align: left;
}
.quiz-right-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}
.quiz-right-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
.quiz-right-tag {
  flex: 0 0 64px;
  text-align: left;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: var(--success-bg);
  color: var(--success);
}
.quiz-right-val {
  color: var(--success);
  font-weight: 500;
}

/* ===== 教学资料模块 ===== */
/* 教学资料：专业分类切换条（二级模块） */
.material-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.material-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.material-cat:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.material-cat.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.material-cat .nav-sub-actions {
  margin-left: 4px;
  margin-right: -4px;
}
.material-cat.add-cat {
  border-style: dashed;
  color: var(--primary);
  background: transparent;
}
.material-cat.add-cat:hover {
  background: var(--primary-bg);
}

.materials-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.materials-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  font-family: inherit;
}

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

.materials-tab.active {
  color: var(--primary);
  font-weight: 600;
}

.materials-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
  margin-bottom: 20px;
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.upload-zone i {
  font-size: 36px;
  color: var(--text-lighter);
  margin-bottom: 12px;
}

.upload-zone p {
  color: var(--text-light);
  font-size: 14px;
}

.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.material-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.material-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.material-thumb {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: #fff;
  position: relative;
}

.material-thumb.ppt { background: linear-gradient(135deg, #2563eb, #6366f1); }
.material-thumb.video { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.material-thumb.pdf { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.material-thumb.other { background: linear-gradient(135deg, #64748b, #94a3b8); }

.material-thumb .duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
}

.material-info {
  padding: 12px 14px;
}

.material-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-meta {
  font-size: 12px;
  color: var(--text-lighter);
}

.material-actions {
  display: flex;
  gap: 4px;
  padding: 0 14px 12px;
}

.material-actions .icon-btn {
  width: 30px;
  height: 30px;
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-lighter);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 15px;
}

/* ===== 学情分析模块 ===== */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.students { background: var(--primary-bg); color: var(--primary); }
.stat-icon.avg { background: var(--accent-bg); color: var(--accent); }
.stat-icon.pass { background: var(--success-bg); color: var(--success); }
.stat-icon.progress { background: #eff6ff; color: #2563eb; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--text-light);
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-title i { color: var(--primary); }

.chart-wrapper {
  position: relative;
  height: 300px;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
}

/* ===== 薄弱点分析 ===== */
.weakness-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.weakness-block.empty {
  background: var(--bg);
}
.weakness-block h3 {
  font-size: 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.weakness-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-lighter);
}
.weakness-empty-tip {
  color: var(--text-light);
  font-size: 14px;
}
.weakness-conclusion {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 18px;
}
.weakness-conclusion strong { font-weight: 700; }
.weakness-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
}
.weakness-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 8px;
}
.weakness-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.weakness-bar-row.weak .weakness-bar-cat { color: var(--danger); font-weight: 600; }
.weakness-bar-cat {
  flex: 0 0 90px;
  font-size: 14px;
}
.weakness-bar-track {
  flex: 1;
  height: 10px;
  background: var(--bg-hover);
  border-radius: 5px;
  overflow: hidden;
}
.weakness-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}
.weakness-bar-rate {
  flex: 0 0 44px;
  text-align: right;
  font-weight: 600;
  font-size: 13px;
}
.weakness-student-title {
  margin: 20px 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary);
}
.weakness-student-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.weakness-student-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.weakness-student-name { font-weight: 600; color: var(--text); }
.weakness-student-score { color: var(--text-light); }
.weakness-student-weak { color: var(--danger); }
.weakness-student-ok { color: var(--success); }
@media (max-width: 900px) {
  .weakness-charts { grid-template-columns: 1fr; }
}

/* 学生表格 */
.student-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.student-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.student-table-header h3 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-table-header h3 i { color: var(--primary); }

.student-table-wrap {
  overflow-x: auto;
}

table.student-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.student-table th {
  background: var(--bg);
  color: var(--text-light);
  font-weight: 600;
  text-align: center;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.student-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
}

.student-table tr:hover td {
  background: var(--bg-hover);
}

.score-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.score-badge.high { background: var(--success-bg); color: var(--success); }
.score-badge.mid { background: var(--accent-bg); color: var(--accent); }
.score-badge.low { background: var(--danger-bg); color: var(--danger); }
.score-badge.zero { background: var(--bg-hover); color: var(--text-lighter); }

.status-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.status-tag.completed { background: var(--success-bg); color: var(--success); }
.status-tag.learning { background: var(--primary-bg); color: var(--primary); }

.progress-cell {
  min-width: 120px;
}

.progress-cell .mini-bar {
  width: 80px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.progress-cell .mini-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
}

.progress-cell .mini-bar-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-left: 6px;
}

.row-action-btn {
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.15s;
}

.row-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.row-action-btn.danger:hover { color: var(--danger); }

/* ===== 教学资料：IndexedDB 不可用提示横幅 ===== */
.idb-warning {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  color: #9a3412;
  box-shadow: var(--shadow);
}
.idb-warning > i {
  font-size: 22px;
  color: #f59e0b;
  margin-top: 2px;
  flex-shrink: 0;
}
.idb-warning strong { color: #b45309; }

/* ===== 空插图占位（内容区SVG已移除，便于自行插入图片）===== */
.illustration.empty {
  min-height: 130px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  color: #94a3b8;
}
.illustration.empty::before {
  content: "点击图片区域可插入/替换图片";
  font-size: 14px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--secondary);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-box.wide {
  width: 92vw;
  max-width: 1100px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 17px;
  color: var(--secondary);
}

.modal-close {
  width: 32px;
  height: 32px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* 上传资料时选择专业分类的单选列表 */
.cat-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.cat-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.18s, background 0.18s;
}
.cat-select-item:hover {
  border-color: var(--primary);
}
.cat-select-item.selected,
.cat-select-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-bg);
  font-weight: 600;
}
.cat-select-item input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* ===== 编辑模式标识 ===== */
.edit-mode-banner {
  position: fixed;
  top: var(--header-h);
  right: 24px;
  background: var(--accent);
  color: #fff;
  padding: 6px 16px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  z-index: 99;
  display: none;
  box-shadow: var(--shadow);
}

body.edit-mode .edit-mode-banner {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .header-right .btn span:not(#editToggleText) { display: none; }
  .progress-mini { display: none; }
  .main-content { padding: 16px; }
  .sidebar { position: fixed; z-index: 200; height: calc(100vh - var(--header-h)); }
  .sidebar.collapsed { transform: translateX(-100%); width: var(--sidebar-w); }
  .instruments-grid { grid-template-columns: 1fr; }
}

/* ===== 器械认识模块 ===== */
.instruments-category {
  margin-bottom: 28px;
}

.instruments-category .category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-border);
}
.instruments-category .category-header.has-toggle {
  cursor: pointer;
}
.instruments-category .category-header.has-toggle + .card-body {
  padding-top: 4px;
}

.instruments-category .category-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.instruments-category .category-title .section-num {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.instruments-category .category-title .editable-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.instruments-category .category-meta {
  font-size: 13px;
  color: var(--text-light);
  background: var(--primary-bg);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.instruments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.instrument-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: box-shadow 0.2s, transform 0.2s;
}

.instrument-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.inst-image-area {
  background: linear-gradient(135deg, #f0f7fa 0%, #e8f0f5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 140px;
  position: relative;
  border-bottom: 1px solid var(--border-light);
}

.inst-image-area svg {
  max-width: 100%;
  max-height: 130px;
  width: auto;
  height: auto;
}

.inst-image-area img {
  max-width: 100%;
  max-height: 130px;
  border-radius: 6px;
  object-fit: contain;
}

body.edit-mode .inst-image-area {
  cursor: pointer;
}

.inst-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(37, 99, 235, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.inst-image-area:hover .inst-image-overlay {
  opacity: 1;
}

.inst-image-overlay i {
  font-size: 28px;
}

.inst-img-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-light);
  transition: all 0.2s;
}

.inst-img-clear:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.inst-img-clear.hidden {
  display: none;
}

.inst-img-placeholder {
  color: var(--text-lighter);
  font-size: 13px;
}

.inst-info {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inst-names {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.inst-name-cn {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.inst-name-en {
  font-size: 12px;
  color: var(--primary);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.inst-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inst-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 5px;
}

.inst-detail-label i {
  font-size: 11px;
  color: var(--primary);
}

.inst-detail-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--secondary-light);
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

body.edit-mode .inst-detail-text:focus,
body.edit-mode .inst-name-cn:focus,
body.edit-mode .inst-name-en:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  background: #fff;
}

.inst-card-actions {
  display: flex;
  gap: 4px;
  padding: 0 16px 12px;
}

.inst-card-actions .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-light);
  transition: all 0.15s;
}

.inst-card-actions .icon-btn:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-border);
}

.inst-card-actions .icon-btn.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.add-instrument-btn {
  width: 100%;
  padding: 12px;
  border: 2px dashed var(--primary-border);
  background: var(--primary-bg);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  margin-top: 12px;
}

.add-instrument-btn:hover {
  border-color: var(--primary);
  background: #dbeafe;
}

/* ===== 用户区 / 登录 ===== */
.user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--primary-bg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.login-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-light);
  transition: all 0.2s;
}
.login-tab.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
  font-weight: 600;
}
.auth-form .form-group { margin-bottom: 14px; }

/* ===== 变更记录 ===== */
.audit-list {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.audit-item {
  display: flex;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.audit-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 5px;
  flex-shrink: 0;
}
.audit-main { flex: 1; min-width: 0; }
.audit-line { font-size: 14px; color: var(--text); }
.audit-target {
  display: inline-block;
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 4px;
}
.audit-detail {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
}
.audit-time {
  font-size: 12px;
  color: var(--text-lighter);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ===== 用户管理 ===== */
.user-admin { display: flex; flex-direction: column; gap: 14px; }
.ua-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ua-hint { font-size: 12px; color: var(--text-light); }
.ua-list { max-height: 60vh; overflow: auto; }
.ua-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ua-table th, .ua-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.ua-table th { background: var(--bg-soft); color: var(--text-light); font-weight: 600; }
.ua-table select.form-input { width: auto; min-width: 92px; padding: 4px 8px; }
.ua-ops { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.ua-lock { color: var(--text-lighter); font-size: 13px; }
.ua-table .empty, .ua-list .empty { padding: 30px; text-align: center; color: var(--text-light); }
.btn-xs { padding: 4px 8px; font-size: 12px; }
