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

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 20px;
}

h1 {
    font-size: 28px;
    color: #1a1a2e;
    margin-bottom: 20px;
    text-align: center;
}

h2 {
    font-size: 22px;
    color: #1a1a2e;
    margin-bottom: 15px;
}

h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

.nav {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav > div:first-child {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.nav a {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.nav a.active {
    background: #fff;
    color: #667eea;
}

.btn {
  padding: 8px 16px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s;
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(79,70,229,0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary) !important;
  color: #fff !important;
  border: none !important;
}

.btn-primary:hover {
  background: var(--primary-hover) !important;
  box-shadow: 0 2px 8px rgba(79,70,229,0.3) !important;
}

.btn-danger {
  background: var(--danger) !important;
  color: #fff !important;
  border: none !important;
}

.btn-danger:hover {
  background: #dc2626 !important;
  box-shadow: 0 2px 8px rgba(239,68,68,0.3) !important;
}

.btn-success {
  background: var(--success) !important;
  color: #fff !important;
  border: none !important;
}

.btn-success:hover {
  background: #16a34a !important;
  box-shadow: 0 2px 8px rgba(34,197,94,0.3) !important;
}

.btn-orange {
  background: #f59e0b !important;
  color: #fff !important;
  border: none !important;
}

.btn-orange:hover {
  background: #d97706 !important;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3) !important;
}

.btn-blue {
  background: #3b82f6 !important;
  color: #fff !important;
  border: none !important;
}

.btn-blue:hover {
  background: #2563eb !important;
  box-shadow: 0 2px 8px rgba(59,130,246,0.3) !important;
}

.btn-secondary {
  background: #6c757d;
}

.btn-small {
  padding: 6px 14px;
  font-size: 14px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
}

.btn-sm:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(79,70,229,0.15);
}

.btn-sm:active {
  transform: translateY(0);
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-group input[type="checkbox"],
.form-group input[type="radio"] {
  width: auto;
  padding: 0;
  margin: 0;
  vertical-align: middle;
}

.question-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  border-left: 4px solid #667eea;
}

.question-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
  line-height: 1.6;
}

.tag-category {
  background: #dbeafe;
  color: #1e40af;
}

.tag-type {
  background: #f3e8ff;
  color: #6b21a8;
}

.tag-difficulty {
  background: #fef3c7;
  color: #92400e;
}

.tag-difficulty.\56f0\96be {
  background: #fce4ec;
  color: #c62828;
}

.tag-difficulty.\4e2d\7b49 {
  background: #fef3c7;
  color: #92400e;
}

.tag-difficulty.\7b80\5355 {
  background: #dcfce7;
  color: #166534;
}

.question-text {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.5;
}

.score-display {
  text-align: center;
  padding: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 12px;
  margin-bottom: 20px;
}

.score-display .score {
  font-size: 64px;
  font-weight: bold;
  margin: 10px 0;
}

.score-display .score-label {
  font-size: 16px;
  opacity: 0.9;
}

.score-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 15px;
}

.score-stats div {
  text-align: center;
}

.score-stats .num {
  font-size: 24px;
  font-weight: bold;
}

.score-stats .label {
  font-size: 14px;
  opacity: 0.9;
}

.explanation {
  background: #fffbeb;
  border-left: 3px solid var(--warning);
  padding: 14px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 12px;
  font-size: 13px;
  color: #78350f;
  line-height: 1.6;
  white-space: pre-wrap;
}

.explanation h4 {
  color: #d48806;
  margin-bottom: 8px;
}

.result-correct {
  color: #28a745;
  font-weight: bold;
}

.result-wrong {
  color: #dc3545;
  font-weight: bold;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}

.stat-card .num {
  font-size: 32px;
  font-weight: bold;
  color: #667eea;
  margin-bottom: 5px;
}

.stat-card .label {
  font-size: 14px;
  color: #666;
}

.category-bar {
  margin-bottom: 15px;
}

.category-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 14px;
}

.category-bar-bg {
  height: 20px;
  background: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

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

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: #1e293b;
  color: #fff;
  border-radius: var(--radius-sm);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

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

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

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

.wrong-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.wrong-item:hover {
  box-shadow: var(--shadow-md);
}

.wrong-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.wrong-count {
  background: #fef2f2;
  color: var(--danger);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.textarea-answer {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
}

.textarea-answer:focus {
  outline: none;
  border-color: #667eea;
}

.actions-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .card {
        padding: 15px;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    h2 {
        font-size: 17px;
        margin-bottom: 12px;
    }

    h3 {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .nav {
        padding: 0 8px;
        margin-bottom: 20px;
        gap: 6px;
    }

    .nav > div:first-child {
        gap: 4px;
    }

    .nav a {
        padding: 7px 10px;
        font-size: 12px;
        border-radius: 6px;
    }
    
    .nav-user {
        gap: 6px;
        font-size: 12px;
    }
    
    .nav-user .nickname {
        display: none;
    }
    
    .nav-user .logout-btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }

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

    .score-display .score {
        font-size: 48px;
    }

    .score-stats {
        gap: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .num {
        font-size: 24px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .toolbar input, .toolbar select {
        min-width: 100%;
    }

    .tab-nav button {
        padding: 8px 10px;
        font-size: 12px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 5px;
    }
}

/* ===== 登录注册页面 ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.auth-header p {
    color: #888;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    padding: 0;
    margin: 0;
    vertical-align: middle;
}

.btn.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.nav-user .nickname {
    color: #fff;
    font-weight: 500;
}

.nav-user .logout-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
}

.nav-user .logout-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* ============================================
   SPA 样式 — 现代设计系统
   ============================================ */

/* ===== CSS 变量 ===== */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1e293b;
  --text-secondary: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 25px rgba(0,0,0,0.08);
  --shadow-lg: 0 25px 50px rgba(0,0,0,0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-xs: 12px;
  --font-sm: 13px;
  --font-base: 14px;
  --font-md: 15px;
  --font-lg: 16px;
  --font-xl: 18px;
  --font-2xl: 20px;
  --font-3xl: 24px;
  --font-4xl: 28px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
}

/* ===== 页面过渡动画 ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

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

/* ===== 顶部导航 ===== */
.topbar {
  background: var(--gradient);
  color: #fff;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar-left a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  border-radius: 0;
}

.topbar-left a:hover {
  color: rgba(255,255,255,0.9);
}

.topbar-left a.active {
  color: #fff;
}

.topbar-left a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 3px;
  background: #fff;
  border-radius: 3px 3px 0 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.topbar-right button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  line-height: 1.5;
}

.topbar-right button:hover {
  background: rgba(255,255,255,0.25);
}

/* ===== 主内容区 ===== */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.page {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.page.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

/* ===== 知识库布局 ===== */
.kb-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 侧边栏 ===== */
.kb-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.kb-sidebar h3 {
  padding: 12px 16px 4px;
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
}

.kb-tree {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.kb-tree-item {
  padding: 7px 12px 7px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  position: relative;
}

.kb-tree-item:hover {
  background: var(--primary-light);
}

.kb-tree-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.kb-tree-item .expand {
  font-size: 9px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
}

.kb-tree-item .expand:hover {
  color: var(--primary);
}

.kb-tree-item .icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

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

.kb-tree-item .actions {
  display: none;
  gap: 4px;
  flex-shrink: 0;
}

.kb-tree-item:hover .actions {
  display: flex;
}

.kb-tree-item .actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 5px;
  color: var(--muted);
  border-radius: 4px;
  transition: all 0.15s;
}

.kb-tree-item .actions button:hover {
  color: var(--primary);
  background: rgba(79,70,229,0.08);
}


.kb-tree-add:hover {
  background: #dde4ff;
  transform: translateY(-1px);
}

.kb-tree-add-icon {
  font-size: 14px;
  line-height: 1;
}

.kb-tree-add-file {
  background: linear-gradient(135deg, #667eea20, #764ba220);
  border: 1px dashed var(--primary);
  color: var(--primary);
  margin-bottom: 6px;
}

.kb-tree-add-file:hover {
  background: linear-gradient(135deg, #667eea40, #764ba240);
}

.kb-tree-add-dir {
  background: #f8fafc;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 11px;
  padding: 6px;
  margin-bottom: 10px;
}

.kb-tree-add-dir:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.kb-tree-file {
  padding: 6px 12px 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.kb-tree-file:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.kb-tree-file .icon {
  font-size: 13px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.kb-tree-file .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-tree-file .actions {
  display: none;
  gap: 6px;
  flex-shrink: 0;
}

.kb-tree-file:hover .actions {
  display: flex;
}

.kb-tree-file .actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  color: var(--muted);
  border-radius: 4px;
  transition: all 0.15s;
}

.kb-tree-file .actions button:hover {
  color: var(--primary);
  background: rgba(79,70,229,0.08);
}

.kb-tree-file-empty {
  padding: 4px 12px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.kb-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.kb-sidebar-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.kb-sidebar-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.kb-sb-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.kb-sb-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.kb-sb-close {
  display: none;
}

@media (max-width: 700px) {
  .kb-sb-close {
    display: inline-flex;
  }
}

.kb-sidebar-menu {
  position: relative;
}

.kb-sidebar-menu-dropdown {
  position: absolute;
  top: 34px;
  right: 0;
  min-width: 160px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
  z-index: 100;
  display: none;
  animation: kbMenuFade 0.15s ease;
}

.kb-sidebar-menu-dropdown.show {
  display: block;
}

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

.kb-menu-item {
  padding: 9px 12px;
  font-size: 13px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.12s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kb-menu-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.kb-menu-item + .kb-menu-item {
  margin-top: 2px;
}

/* ===== 知识库主区域 ===== */
.kb-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kb-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  flex-wrap: wrap;
  background: var(--card);
}

.kb-toolbar .breadcrumb {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  min-width: 100px;
}

.kb-toolbar button {
  font-size: 12px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  line-height: 1.5;
}

.kb-toolbar button:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.kb-toolbar button.primary {
  background: var(--primary);
  color: #fff;
  border: none;
}

.kb-toolbar button.primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.kb-toolbar .toggle-sidebar-btn {
  display: none;
}

/* ===== 文件列表 ===== */
.kb-file-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
}

.kb-file-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  font-size: 14px;
  margin-bottom: 4px;
  background: var(--card);
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}

.kb-file-item:hover {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kb-file-item .file-icon {
  color: var(--primary);
  font-size: 16px;
  flex-shrink: 0;
}

.kb-file-item .file-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}

.kb-file-item .file-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.kb-file-item .actions {
  display: none;
  gap: 4px;
  flex-shrink: 0;
}

.kb-file-item:hover .actions {
  display: flex;
}

.kb-file-item .actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.kb-file-item .actions button:hover {
  color: var(--danger);
  background: rgba(239,68,68,0.08);
}

/* ===== 编辑器 ===== */
.kb-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.kb-editor-header {
  display: flex;
  gap: 10px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  background: var(--card);
}

.kb-editor-header input {
  flex: 1;
  border: none;
  font-size: 16px;
  font-weight: 600;
  padding: 4px 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.kb-editor-header input::placeholder {
  color: var(--muted);
}

.kb-editor-header button {
  font-size: 12px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  line-height: 1.5;
}

.kb-editor-header button:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.kb-editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.kb-editor-body textarea {
  flex: 1;
  border: none;
  padding: 20px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.7;
  resize: none;
  outline: none;
  color: var(--text);
  background: var(--card);
}

.kb-editor-body textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(79,70,229,0.1);
}

.kb-preview {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.8;
  background: var(--card);
  color: var(--text);
}

.kb-preview h1,
.kb-preview h2,
.kb-preview h3 {
  margin: 16px 0 10px;
  line-height: 1.3;
  color: var(--text);
}

.kb-preview h1 { font-size: 22px; }
.kb-preview h2 { font-size: 18px; }
.kb-preview h3 { font-size: 16px; }

.kb-preview p {
  margin: 0 0 10px;
}

.kb-preview pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

.kb-preview code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: #e11d48;
}

.kb-preview pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.kb-preview blockquote {
  border-left: 3px solid var(--primary);
  margin: 10px 0;
  padding: 8px 16px;
  color: var(--text-secondary);
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.kb-preview ul,
.kb-preview ol {
  padding-left: 20px;
  margin: 8px 0;
}

.kb-preview li {
  margin-bottom: 4px;
}

/* ===== 知识库关联题目 ===== */
.kb-related {
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  background: var(--card);
  max-height: 200px;
  overflow-y: auto;
}
.kb-related-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.kb-related-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  color: var(--text);
}
.kb-related-item:hover {
  background: var(--primary-light);
}
.kb-related-item .badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}
.kb-related-item .badge-easy { background: #e8f5e9; color: #388e3c; }
.kb-related-item .badge-medium { background: #fff3e0; color: #f57c00; }
.kb-related-item .badge-hard { background: #ffebee; color: #c62828; }
.kb-related-empty {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}

.kb-preview hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

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

.kb-preview th,
.kb-preview td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.kb-preview th {
  background: #f8fafc;
  font-weight: 600;
}

.kb-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--bg);
}

/* ===== 题库 ===== */
.qb-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.qb-toolbar input,
.qb-toolbar select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.2s;
}

.qb-toolbar input:focus,
.qb-toolbar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.qb-toolbar input {
  flex: 1;
  min-width: 150px;
}

.qb-toolbar button {
  font-size: 12px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  line-height: 1.5;
}

.qb-toolbar button:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.qb-table {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
  background: var(--bg);
}

.qb-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.qb-table th {
  background: #f8fafc;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.qb-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.qb-table tbody tr {
  transition: background 0.15s;
}

.qb-table tbody tr:hover td {
  background: #f8faff;
}

.qb-table tr.q-row {
  cursor: pointer;
}

.qb-table td:nth-child(4) {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qb-pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 16px;
  align-items: center;
}

.qb-pagination button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all 0.2s;
}

.qb-pagination button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.qb-pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

.qb-pagination .info {
  font-size: 13px;
  color: var(--muted);
}

/* ===== 通用分页 ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.pagination button {
  padding: 6px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #4f46e5;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.pagination button:hover:not([disabled]) {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}
.pagination button[disabled] {
  color: #cbd5e1;
  cursor: not-allowed;
}
.pagination .info {
  font-size: 13px;
  color: #64748b;
}

/* ===== 日志页面 ===== */
#page-journal .flex-gap-6 button[data-type].active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

/* ===== 通用卡片 ===== */
.panel {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
  background: var(--bg);
}

.panel-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

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

.panel-card h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 600;
}

/* ===== 统计 ===== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-item {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.stat-item .num {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-item .label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 500;
}

.cat-bar {
  margin-bottom: 14px;
}

.cat-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.cat-bar-header strong {
  color: var(--text);
}

.cat-bar-header span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.cat-bar-bg {
  height: 22px;
  background: #f1f5f9;
  border-radius: 11px;
  overflow: hidden;
  position: relative;
}

.cat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  border-radius: 11px;
  transition: width 0.6s ease;
  position: relative;
}

.cat-bar-fill::after {
  content: '';
  position: absolute;
  right: 4px;
  top: 3px;
  bottom: 3px;
  width: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 92%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalFadeIn 0.2s ease;
}

.modal-box.settings-modal {
  height: 80vh;
  max-height: 80vh;
}

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

.modal-hd h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger);
  background: rgba(239,68,68,0.08);
}

.modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.modal-menu {
  width: 140px;
  min-width: 140px;
  background: #f8fafc;
  border-right: 1px solid var(--border);
  padding: 8px 0;
  overflow-y: auto;
}

.modal-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.modal-menu-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.modal-menu-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}

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

.modal-panel {
  display: none;
}

.modal-panel.active {
  display: block;
  animation: slideDown 0.2s ease;
}

/* ===== 标签 ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

.badge-easy {
  background: #dcfce7;
  color: #166534;
}

.badge-medium {
  background: #fef3c7;
  color: #92400e;
}

.badge-hard {
  background: #fce4ec;
  color: #c62828;
}

.badge-type {
  background: #dbeafe;
  color: #1e40af;
}

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

.badge-user {
  background: var(--primary);
  color: #fff;
}

/* ===== 操作网格 ===== */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.action-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  transition: all 0.2s;
}

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

.action-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.action-card p {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 10px;
}

.action-card button {
  width: 100%;
  font-size: 12px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.action-card button:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}


.wrong-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.wrong-item:hover {
  box-shadow: var(--shadow-md);
}

.wrong-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.wrong-count {
  background: #fef2f2;
  color: var(--danger);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.question-text {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.5;
}

.options-list {
  list-style: none;
  margin-bottom: 10px;
  padding: 0;
}

.options-list li {
  padding: 10px 14px;
  margin-bottom: 6px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.options-list li:hover {
  border-color: var(--primary);
  background: #f5f7ff;
}

.options-list li.selected {
  border-color: var(--primary);
  background: #e8ebff;
  color: var(--text);
  font-weight: 500;
}

.options-list li input[type="checkbox"],
.options-list li input[type="radio"] {
  margin: 0;
  flex-shrink: 0;
}

.options-list li.text-correct {
  background: #f0fdf4;
  border-color: var(--success);
  color: #166534;
}

.options-list li.text-wrong {
  background: #fef2f2;
  border-color: var(--danger);
  color: #991b1b;
}

.explanation {
  background: #fffbeb;
  border-left: 3px solid var(--warning);
  padding: 14px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 12px;
  font-size: 13px;
  color: #78350f;
  line-height: 1.6;
}

/* ===== 知识库新布局 ===== */
.kb-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: var(--bg);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.kb-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.kb-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.kb-back-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
  position: relative;
}
.kb-back-btn::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid var(--text-secondary);
  transition: border-right-color 0.18s;
}
.kb-back-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}
.kb-back-btn:hover::before {
  border-right-color: var(--primary);
}
.kb-topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.kb-breadcrumb {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kb-breadcrumb a {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}
.kb-breadcrumb a:hover {
  text-decoration: underline;
}
.kb-breadcrumb .sep {
  color: var(--border);
  margin: 0 2px;
}
.kb-breadcrumb .current {
  color: var(--text-secondary);
  font-weight: 500;
}
.kb-topbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.kb-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.kb-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.kb-btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(79,70,229,0.25);
}
.kb-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(79,70,229,0.35);
  transform: translateY(-1px);
}
.kb-btn-outline {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-secondary);
}
.kb-btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.kb-searchbar {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.kb-searchbar-inner {
  display: flex;
  gap: 10px;
  padding: 12px 24px;
  align-items: center;
  flex-wrap: wrap;
}
.kb-searchbar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 4px 0;
  background: var(--bg);
  border: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
  transition: transform 0.3s;
}
.kb-searchbar-toggle:hover {
  color: var(--primary);
}
.kb-searchbar-arrow {
  display: inline-block;
  transition: transform 0.3s;
}
.kb-searchbar.collapsed .kb-searchbar-inner {
  display: none;
}
.kb-searchbar.collapsed .kb-searchbar-arrow {
  transform: rotate(180deg);
}
.kb-searchbar-input-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  transition: all 0.2s;
}
.kb-searchbar-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.kb-searchbar-icon {
  font-size: 14px;
  color: var(--muted);
  margin-right: 8px;
  flex-shrink: 0;
}
.kb-searchbar-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  padding: 9px 0;
  font-size: 13px;
  background: transparent;
  color: var(--text);
}
.kb-searchbar-input-wrap input::placeholder {
  color: var(--muted);
}
.kb-searchbar-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  background: var(--card);
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 110px;
  transition: all 0.2s;
}
.kb-searchbar-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.kb-searchbar-btn {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  transition: all 0.18s;
  font-size: 14px;
  color: var(--text-secondary);
}
.kb-searchbar-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.kb-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: 0;
}
.kb-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
}

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

.kb-cat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}
.kb-cat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
  border-color: transparent;
}
.kb-cat-card-banner {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  position: relative;
  overflow: hidden;
}
.kb-cat-card-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.08) 100%);
}
.kb-cat-card-body {
  padding: 14px 16px 16px;
}
.kb-cat-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kb-cat-card-count {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 400;
}
.kb-cat-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-cat-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.kb-cat-card:hover .kb-cat-card-actions {
  opacity: 1;
}
.kb-cat-card-action {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.12s;
  backdrop-filter: blur(4px);
}
.kb-cat-card-action:hover {
  background: #fff;
  color: var(--primary);
  transform: scale(1.1);
}

.kb-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.kb-file-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kb-file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border-color: var(--primary);
}
.kb-file-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kb-file-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}
.kb-file-card-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kb-file-card-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.kb-file-card-preview {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 8px;
  margin-top: 2px;
}
.kb-file-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 0;
}
.kb-file-card-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}
.kb-file-card-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.kb-file-card:hover .kb-file-card-actions {
  opacity: 1;
}
.kb-file-card-action {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  transition: all 0.12s;
}
.kb-file-card-action:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.kb-file-card-action-del:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.kb-welcome {
  text-align: center;
  padding: 80px 20px;
  max-width: 480px;
  margin: 0 auto;
}
.kb-welcome-icon {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
}
.kb-welcome-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.kb-welcome-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}
.kb-welcome-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 移动端页面容器统一 ===== */
@media (max-width: 700px) {
  .page-container {
    padding: 12px !important;
  }
}

/* ===== 移动端适配 ===== */
@media (max-width: 700px) {
  .topbar {
    display: none;
  }

  .kb-editor-header {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
  }

  .kb-editor-header input {
    font-size: 16px;
    flex: 1 1 100%;
  }

  .kb-editor-header button {
    font-size: 12px;
    padding: 6px 12px;
  }

  .kb-preview {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 40vh;
  }

  .kb-editor-body {
    min-height: calc(100vh - 200px);
  }

  .modal-menu {
    width: 100px;
    min-width: 100px;
  }

  .modal-menu-item {
    padding: 8px 10px;
    font-size: 12px;
  }

  .modal-content {
    padding: 12px;
  }

  .modal-box.settings-modal {
    width: 96%;
    max-height: 92vh;
    height: 92vh;
  }

  .modal-body {
    flex-direction: column;
  }

  .modal-menu {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    flex-shrink: 0;
  }

  .modal-menu-item {
    flex-shrink: 0;
    padding: 8px 12px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-size: 13px;
  }

  .modal-menu-item.active {
    border-left: none;
    border-bottom-color: var(--primary);
  }

  .modal-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
  }

  .qb-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
  }

  .qb-toolbar input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .qb-toolbar select {
    flex: 1 1 30%;
    min-width: 0;
  }

  .qb-toolbar button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-item {
    padding: 14px 12px;
  }

  .stat-item .num {
    font-size: 22px;
  }

  /* 底部导航 */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    z-index: 95;
    padding: 0 4px;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
    transition: color 0.2s;
    padding: 6px 0;
    position: relative;
  }

  .bottom-nav-item .bn-icon {
    font-size: 22px;
    line-height: 1;
  }

  .bottom-nav-item.active {
    color: var(--primary);
  }

  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
  }

  .bottom-nav-item:active {
    transform: scale(0.95);
  }

  body {
    padding-bottom: 60px;
  }

  /* 知识库移动端适配 */
  .kb-topbar {
    padding: 14px 16px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .kb-topbar-left {
    flex-wrap: nowrap;
  }
  .kb-topbar-title {
    font-size: 16px;
  }
  .kb-breadcrumb {
    font-size: 12px;
  }
  .kb-topbar-actions {
    gap: 6px;
  }
  .kb-topbar-actions .kb-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .kb-searchbar-inner {
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .kb-searchbar .kb-searchbar-inner {
    display: none;
  }
  .kb-searchbar.collapsed .kb-searchbar-inner {
    display: none;
  }
  .kb-searchbar:not(.collapsed) .kb-searchbar-inner {
    display: flex;
  }
  .kb-searchbar-input-wrap {
    min-width: 0;
  }
  .kb-searchbar-select {
    min-width: 0;
  }
  .kb-content {
    padding: 14px;
  }
  .kb-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .kb-cat-card-banner {
    height: 60px;
    font-size: 28px;
  }
  .kb-cat-card-body {
    padding: 10px 12px 12px;
  }
  .kb-cat-card-name {
    font-size: 13px;
  }
  .kb-file-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .kb-file-card {
    padding: 12px 14px;
  }
  .kb-btn {
    padding: 7px 14px;
    font-size: 12px;
  }
  .kb-welcome {
    padding: 40px 16px;
  }
  .kb-welcome-icon {
    font-size: 48px;
  }
  .kb-welcome-title {
    font-size: 18px;
  }
}

.panel {
    padding-bottom: 70px;
  }

  .qb-table {
    padding-bottom: 70px;
  }
}

/* ============================================
   实用工具类（替换行内样式）
   ============================================ */
/* 显示 */
.hidden { display: none; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; }
.flex-center-wrap { display: flex; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-4 { gap: 4px; }
.flex-gap-6 { gap: 6px; }
.flex-gap-8 { gap: 8px; }
.flex-gap-10 { gap: 10px; }
.flex-gap-12 { gap: 12px; }
.flex-gap-14 { gap: 14px; }
/* 边距 */
.m-0 { margin: 0; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
/* 内边距 */
.p-0 { padding: 0; }
.p-8 { padding: 8px; }
.p-10 { padding: 10px; }
.p-12 { padding: 12px; }
.p-14 { padding: 14px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
/* 文本 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { font-size: 13px; color: var(--muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
/* 背景 */
.bg-light { background: #f8f9fa; }
.bg-blue-light { background: #f0f8ff; }
.rounded { border-radius: 8px; }
.rounded-6 { border-radius: 6px; }
/* 边框 */
.border-top { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }
.border { border: 1px solid var(--border); }
/* 输入框 */
.input-style { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; }
.input-style-sm { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; }
/* 其他 */
.max-w-500 { max-width: 500px; }
.max-w-600 { max-width: 600px; }
.block { display: block; }
.overflow-hidden { overflow: hidden; }
.scroll-y { overflow-y: auto; }
.max-h-300 { max-height: 300px; }
.min-w-120 { min-width: 120px; }
.min-w-150 { min-width: 150px; }
.flex-2 { flex: 2; }
/* 特定按钮 */
.btn-icon { padding: 5px 10px; font-size: 12px; }
.btn-xs { font-size: 11px; padding: 3px 8px; }
.btn-close { font-size: 16px; padding: 3px 8px; }
.btn-orange { background: #e67e22; }
.btn-blue { background: #2196f3; }
/* 可见性 */
.visibility-hidden { visibility: hidden; }
/* 文本颜色 */
.text-correct { color: #28a745; font-weight: 500; }
.text-wrong { color: #dc3545; font-weight: 500; }
.text-green { color: #28a745; }
.text-red { color: #dc3545; }
/* 内边距特定方向 */
.pt-16 { padding-top: 16px; }

/* ===== 仪表盘样式 ===== */
.page-container{max-width:1200px;margin:0 auto;padding:24px;flex:1;display:flex;flex-direction:column;min-height:0;overflow-y:auto;width:100%}

/* ===== 仪表盘重设计 ===== */
.db-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
  min-height: 140px;
}
.db-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
}
.db-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(255,255,255,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
}
.db-hero-content {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 32px;
  color: #fff;
}
.db-hero-greeting {
  font-size: 15px;
  opacity: 0.9;
  margin-bottom: 4px;
}
.db-hero-user {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}
.db-hero-date {
  font-size: 13px;
  opacity: 0.75;
}
.db-streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.25);
}
.db-streak-fire {
  font-size: 22px;
}
.db-streak-badge .db-streak-num {
  font-size: 28px;
  font-weight: 700;
}
.db-streak-badge .db-streak-label {
  font-size: 13px;
  opacity: 0.85;
}

/* Section */
.db-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}
.db-section:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.db-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.db-section-icon {
  font-size: 18px;
}
.db-section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

/* Todo Grid */
.db-todo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 500px) {
  .db-todo-grid { grid-template-columns: 1fr; }
}
.db-todo-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 10px;
  background: #f8fafc;
  transition: all 0.2s;
  border: 1px solid #f1f5f9;
}
.db-todo-card:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.db-todo-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.db-todo-info {
  flex: 1;
  min-width: 0;
}
.db-todo-label {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 2px;
}
.db-todo-value {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}
.db-todo-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Metric Cards */
.db-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 700px) {
  .db-cards-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
  .db-cards-row { grid-template-columns: 1fr 1fr; }
}
.db-metric-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.db-metric-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.db-metric-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}
.db-metric-total .db-metric-icon { background: #eef2ff; }
.db-metric-today .db-metric-icon { background: #f0fdf4; }
.db-metric-rate .db-metric-icon { background: #fff7ed; }
.db-metric-review .db-metric-icon { background: #fef2f2; }
.db-metric-body {
  flex: 1;
  min-width: 0;
}
.db-metric-label {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 2px;
}
.db-metric-value {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}
.db-metric-trend {
  font-size: 11px;
  font-weight: 500;
  position: absolute;
  top: 8px;
  right: 10px;
}

/* Progress Ring */
.db-progress-ring-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}
.db-progress-ring-box {
  text-align: center;
}
.db-progress-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  position: relative;
  background: conic-gradient(#4f46e5 var(--pct, 0%), #e2e8f0 var(--pct, 0%));
}
.db-progress-ring::before {
  content: '';
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #fff;
}
.db-progress-ring-value {
  position: relative;
  z-index: 1;
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
}
.db-progress-ring-label {
  position: relative;
  z-index: 1;
  font-size: 11px;
  color: #94a3b8;
}
.db-progress-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 14px;
  color: #64748b;
}
.db-progress-answered {
  font-weight: 700;
  color: #4f46e5;
  font-size: 18px;
}
.db-progress-goal {
  font-weight: 700;
  color: #1e293b;
  font-size: 18px;
}
.db-progress-divider {
  color: #cbd5e1;
  font-size: 18px;
}
.db-progress-unit {
  color: #94a3b8;
  font-size: 13px;
}

/* Charts Row */
.db-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) {
  .db-charts-row { grid-template-columns: 1fr; }
}
.db-chart-card {
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px;
  border: 1px solid #f1f5f9;
}
.db-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.db-chart-subtitle {
  font-size: 11px;
  font-weight: 400;
  color: #94a3b8;
}
.db-chart-box {
  width: 100%;
}
.db-chart-box > div { width: 100% !important; }

/* Mastery List */
.db-mastery-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.db-mastery-list-card {
  max-height: 260px;
  overflow: hidden;
}
.db-mastery-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}
.db-mastery-item:last-child { border-bottom: none; }
.db-mastery-name {
  font-size: 12px;
  color: #475569;
  width: 70px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.db-mastery-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.db-mastery-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.db-mastery-pct {
  font-size: 11px;
  font-weight: 600;
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* Weak Grid */
.db-weak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.db-weak-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  transition: all 0.2s;
}
.db-weak-card:hover {
  background: #fee2e2;
  transform: translateY(-1px);
}
.db-weak-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.db-weak-name {
  font-size: 13px;
  font-weight: 600;
  color: #991b1b;
}
.db-weak-pct {
  font-size: 11px;
  color: #ef4444;
}
.db-weak-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.db-weak-btn:hover {
  background: #dc2626;
}

/* Timeline */
.db-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 20px;
}
.db-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #e2e8f0;
}
.db-tl-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.db-tl-dot {
  position: absolute;
  left: -17px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #22c55e;
  z-index: 1;
}
.db-tl-dot.wrong { background: #ef4444; box-shadow: 0 0 0 2px #ef4444; }
.db-tl-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.db-tl-body { flex: 1; min-width: 0; }
.db-tl-text { font-size: 13px; color: #334155; line-height: 1.4; }
.db-tl-meta { display: flex; gap: 8px; margin-top: 3px; font-size: 11px; color: #94a3b8; }
.db-tl-time { color: #94a3b8; }

/* Empty */
.db-empty {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
  font-size: 13px;
}

/* ===== 知识库搜索框 ===== */
.kb-search-box{position:relative;flex:1;max-width:320px;min-width:160px}
.kb-search-box input{width:100%;padding:6px 12px;border:1px solid var(--border);border-radius:20px;font-size:13px;outline:none;transition:border-color .2s,box-shadow .2s}
.kb-search-box input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(79,70,229,.1)}
.kb-search-results{position:absolute;top:calc(100% + 4px);left:0;right:0;background:#fff;border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);z-index:200;max-height:360px;overflow-y:auto}
.kb-search-item{padding:10px 12px;cursor:pointer;border-bottom:1px solid #f0f2f5;transition:background .15s}
.kb-search-item:last-child{border-bottom:none}
.kb-search-item:hover{background:#f8f9fa}
.kb-search-title{font-size:13px;font-weight:500;color:var(--text)}
.kb-search-preview{font-size:12px;color:var(--muted);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.kb-search-empty{padding:16px;text-align:center;font-size:13px;color:var(--muted)}

/* ===== 编辑器移动端优化 ===== */
.kb-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kb-editor-filename {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}
.kb-editor-filename:focus {
  border-color: var(--primary);
}
.kb-editor-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.kb-editor-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  white-space: nowrap;
}
.kb-editor-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.kb-editor-btn.btn-orange {
  background: #fff7ed;
  border-color: #f97316;
  color: #ea580c;
}
.kb-editor-textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 16px 20px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: var(--card);
  min-height: 200px;
}

/* 标签栏 */
.kb-tag-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.kb-tag-list {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}
.kb-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
}
.kb-tag-remove {
  cursor: pointer;
  font-size: 10px;
  opacity: 0.8;
  padding: 0 2px;
}
.kb-tag-remove:hover {
  opacity: 1;
}
.kb-tag-add {
  display: flex;
  align-items: center;
  gap: 4px;
}
.kb-tag-add select {
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--card);
  max-width: 120px;
}
.kb-search-tag-filter {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--card);
  max-width: 110px;
}
@media (max-width: 700px) {
  .kb-editor-filename {
    font-size: 16px; /* 防止 iOS 缩放 */
    flex: 1 1 100%;
  }
  .kb-editor-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
  .kb-editor-btn {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }
  .kb-editor-textarea {
    font-size: 16px; /* 防止 iOS 缩放 */
    padding: 12px 14px;
    min-height: 150px;
  }
}

/* ===== 知识库工具栏调整 ===== */
.btn-kb-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: all 0.2s;
  line-height: 1.5;
  min-height: 34px;
}
.btn-kb-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

/* 题库搜索栏 */
.qb-search-input {
  flex: 1 1 200px;
  min-width: 150px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--card);
  color: var(--text);
  transition: all 0.2s;
}
.qb-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.qb-search-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--card);
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 100px;
  transition: all 0.2s;
}
.qb-search-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.qb-toolbar-btn {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  min-height: 36px;
  white-space: nowrap;
}
.qb-toolbar-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.qb-toolbar-new {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  align-items: center;
}

/* 题库列表铺开 */
.qb-list-wrap {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.qb-list.qb-table {
  display: flex;
  flex-direction: column;
}
.qb-row {
  display: grid;
  grid-template-columns: 36px 110px 1fr 60px 70px;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.qb-row:hover {
  background: #f8faff;
}
.qb-row:last-child {
  border-bottom: none;
}
.qb-cat-col {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.qb-seq-col {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  min-width: 0;
}
.qb-cat-badge {
  font-size: 12px;
  padding: 3px 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-radius: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.qb-ques-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.qb-ques-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.qb-ques-meta {
  display: flex;
  gap: 4px;
  align-items: center;
}
.qb-ques-type {
  font-size: 11px !important;
  padding: 2px 8px !important;
}
.qb-diff-col {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.qb-action-col {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.btn-sm-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.btn-sm-danger:hover {
  background: #fee2e2;
  border-color: #dc2626;
}

/* ===== 错题本新样式 ===== */
.wb-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.wb-tabbar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  background: var(--card);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  width: 100%;
}

.wb-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.wb-list-wrap {
  flex: 1;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  padding: 2px 12px;
  width: 100%;
}
.wb-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
}
.wb-tab:hover {
  background: var(--bg);
}
.wb-tab.active {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}
.wb-tab-icon {
  font-size: 16px;
}
.wb-tab-count {
  background: rgba(255,255,255,0.2);
  color: inherit;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.wb-tab:not(.active) .wb-tab-count {
  background: #f1f5f9;
  color: var(--muted);
}
.wb-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}
.wb-stats {
  font-size: 14px;
  color: var(--text-secondary);
}
.wb-stats strong {
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  margin: 0 2px;
}
.wb-toolbar-actions {
  display: flex;
  gap: 8px;
}
.wb-toolbar-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-size: 13px;
  min-height: 34px;
}
.wb-toolbar-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.wb-toolbar-btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
}
.wb-toolbar-btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}

.wb-list-wrap .empty-state {
  padding: 60px 24px !important;
}
.empty-icon {
  font-size: 56px;
  display: block;
  margin-bottom: 12px;
}
.wq-card {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.wq-card:hover {
  background: #f8faff;
}
.wq-card:last-child {
  border-bottom: none;
}
.wq-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.wq-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.wq-arrow {
  color: var(--muted);
  font-size: 14px;
  transition: transform 0.2s;
}
.wq-card:hover .wq-arrow {
  color: var(--primary);
  transform: translateX(4px);
}
.wq-question {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ===== 笔记页面 ===== */
.note-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.note-toolbar-left,
.note-toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.note-btn {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  min-height: 36px;
}
.note-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.note-btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}
.note-btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #6d28d9);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79,70,229,0.4);
}
.note-tab-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.note-tab-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.note-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 笔记卡片网格 */
.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}
.note-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.note-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border-color: var(--primary-light);
}
.note-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: #e0e7ff;
}
.note-card-daily::before { background: linear-gradient(180deg, #34d399, #059669); }
.note-card-review::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.note-card-weekly::before { background: linear-gradient(180deg, #8b5cf6, #6d28d9); }
.note-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}
.note-type-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
}
.note-card-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.note-mood {
  font-size: 12px;
  color: var(--muted);
}
.note-card-del {
  background: transparent;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 13px;
  border-radius: 4px;
  transition: all 0.15s;
}
.note-card-del:hover {
  background: #fee2e2;
  color: #dc2626;
}
.note-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  flex: 1;
}
.note-rel-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.note-rel-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: #f8fafc;
  color: #64748b;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.note-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
}
.note-card-arrow {
  transition: transform 0.2s;
}
.note-card:hover .note-card-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

/* 笔记编辑器 */
.note-editor {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  background: var(--bg);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.note-editor.hidden,
.hidden { display: none !important; }
.note-editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.note-editor-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.note-editor-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.note-btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.note-btn-danger:hover {
  background: #fee2e2;
  border-color: #dc2626;
  color: #dc2626;
}
.note-editor-body {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  flex-wrap: wrap;
}
.note-edit-select,
.note-edit-input,
.note-title-input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}
.note-edit-select:focus,
.note-edit-input:focus,
.note-title-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.note-mood-input {
  width: 140px;
}
.note-title-input {
  flex: 1;
  min-width: 200px;
  font-size: 15px;
  font-weight: 600;
}
.note-editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.note-editor-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  padding: 16px 24px;
  overflow: hidden;
  min-height: 0;
}
.note-editor-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.note-editor-markdown {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.note-editor-markdown textarea {
  flex: 1;
  border: none;
  padding: 18px 22px;
  font-size: 15px;
  line-height: 1.7;
  resize: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  min-height: 300px;
}
.note-editor-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  min-height: 0;
}
.note-side-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.note-side-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.note-rel-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}
.note-rel-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-secondary);
}
.note-rel-check:hover {
  background: #f1f5f9;
  border-color: var(--primary-light);
}
.note-rel-check input {
  cursor: pointer;
}

/* 响应式 */
@media (max-width: 800px) {
  .qb-row {
    grid-template-columns: 28px 80px 1fr 50px 56px;
    gap: 6px;
    padding: 10px 12px;
  }
  .qb-cat-badge {
    font-size: 11px;
    padding: 3px 6px;
    max-width: 72px;
  }
  .qb-ques-title {
    font-size: 14px;
  }
  .qb-seq-col {
    font-size: 12px;
  }
  .qb-diff-col .badge {
    font-size: 10px;
    padding: 2px 6px;
  }
  .qb-action-col .btn-sm-danger {
    font-size: 11px;
    padding: 4px 6px;
  }
  .note-editor-container {
    grid-template-columns: 1fr;
  }
  .note-editor-side {
    order: 2;
    max-height: 200px;
  }
  .note-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .wb-tabbar {
    flex-direction: column;
    gap: 8px;
  }
  .wb-tab {
    justify-content: space-between;
  }
  .wb-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .note-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .note-toolbar-right {
    overflow-x: auto;
    justify-content: flex-start;
  }
  /* 笔记编辑器移动端优化 */
  .note-editor {
    height: calc(100vh - 56px);
  }
  .note-editor-header {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px;
    gap: 6px;
  }
  .note-editor-body {
    order: 2;
    width: 100%;
    flex-direction: column;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .note-editor-actions {
    order: 3;
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .note-editor-btn {
    padding: 7px 12px;
    font-size: 12px;
    min-height: 32px;
  }
  .note-title-input {
    font-size: 16px;
    min-width: 100%;
  }
  .note-edit-input {
    font-size: 16px;
    width: 100%;
  }
  .note-edit-select {
    font-size: 16px;
    min-width: 0;
    width: 100%;
  }
  .note-mood-input {
    width: 100%;
  }
  .note-editor-container {
    padding: 8px 12px;
    gap: 8px;
  }
  .note-editor-markdown textarea {
    font-size: 16px;
    padding: 14px;
    min-height: 200px;
  }
  .note-editor-side {
    max-height: 150px;
  }
  .note-rel-files {
    max-height: 120px;
  }
  .qb-row {
    grid-template-columns: 24px 70px 1fr 44px 50px;
    gap: 4px;
    padding: 8px 8px;
  }
  .qb-seq-col { font-size: 11px; }
  .qb-cat-col { justify-content: flex-start; }
  .qb-cat-badge {
    font-size: 11px;
    padding: 2px 6px;
    max-width: 62px;
  }
  .qb-ques-title {
    font-size: 13px;
  }
  .qb-diff-col .badge {
    font-size: 10px;
    padding: 2px 5px;
  }
  .qb-action-col .btn-sm-danger {
    font-size: 10px;
    padding: 3px 5px;
  }
  .btn-kb-primary {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
  }
}

/* ===== 审计日志表格 ===== */
.audit-table thead th {
  background: #f8fafc;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.audit-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
}
.audit-table tbody tr:hover {
  background: #f8faff;
}

/* ===== 时习之 (SXZ) ===== */
.db-collapsible .db-section-header {
  user-select: none;
}
.db-collapse-arrow {
  font-size: 12px;
  color: var(--text-secondary);
  transition: transform 0.3s;
  margin-left: auto;
}
.db-collapse-arrow.collapsed {
  transform: rotate(-90deg);
}
.sxz-tabbar {
  display: flex;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.sxz-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.sxz-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
}
.sxz-tab:hover:not(.active) {
  background: rgba(0,0,0,0.02);
}
.sxz-tab-icon { font-size: 14px; }
.sxz-tab-count {
  font-size: 11px;
  background: var(--primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.sxz-panel { }
.sxz-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  flex-wrap: wrap;
  gap: 8px;
}
.sxz-stats { font-size: 13px; color: var(--text-secondary); }
.sxz-stats strong { color: var(--text); }
.sxz-toolbar-actions { display: flex; gap: 8px; }
.sxz-toolbar-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all 0.15s;
  font-family: inherit;
}
.sxz-toolbar-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.sxz-list-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.sxz-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  transition: background 0.15s;
  cursor: pointer;
}
.sxz-item:last-child { border-bottom: none; }
.sxz-item:hover { background: rgba(99, 102, 241, 0.04); }
.sxz-item-seq {
  font-size: 12px;
  color: var(--text-secondary);
  width: 24px;
  flex-shrink: 0;
}
.sxz-item-cat {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #eef2ff;
  color: #4f46e5;
  flex-shrink: 0;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sxz-item-ques {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.sxz-item-diff {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.sxz-item-diff.easy { background: #dcfce7; color: #16a34a; }
.sxz-item-diff.medium { background: #fef9c3; color: #ca8a04; }
.sxz-item-diff.hard { background: #fee2e2; color: #dc2626; }
.sxz-item-action {
  font-size: 11px;
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}
.sxz-item-action:hover { background: rgba(99, 102, 241, 0.1); }

@media (max-width: 560px) {
  .sxz-tab { font-size: 12px; padding: 8px 4px; }
  .sxz-tab-icon { font-size: 13px; }
  .sxz-tab-count { font-size: 10px; padding: 1px 5px; }
  .sxz-item { padding: 8px 10px; gap: 6px; }
  .sxz-item-ques { font-size: 12px; }
  .sxz-item-cat { max-width: 60px; font-size: 10px; }
}




