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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f6fa;
  color: #2c3e50;
  /* PC 端固定高度不滚动；移动端由 media query 覆盖 */
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* 移动端顶部栏 */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.mobile-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.menu-toggle {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

/* 左侧边栏 */
.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 90;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 600;
}

.close-sidebar {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

.subject-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.subject-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 4px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  gap: 12px;
}

.subject-item:hover {
  background: #f0f0f0;
}

.subject-item.active {
  background: #e8f4fd;
  border-left: 4px solid;
}

.subject-icon {
  font-size: 24px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #f5f5f5;
}

.subject-name {
  font-size: 15px;
  font-weight: 500;
}

.subject-drag-handle {
  font-size: 16px;
  color: #bbb;
  cursor: grab;
  padding: 10px 8px;
  margin: -4px -4px -4px 0;
  user-select: none;
  -webkit-user-select: none;
  line-height: 1;
  touch-action: none;
  -webkit-touch-callout: none;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.subject-drag-handle:hover {
  color: #888;
  background: rgba(0,0,0,0.04);
}

.subject-drag-handle:active {
  cursor: grabbing;
  color: #666;
  background: rgba(0,0,0,0.08);
}

.drag-ghost {
  border-radius: 10px;
}

/* 活动流 - 精简蓝色字体列表 */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-line {
  font-size: 14px;
  color: #1976d2;
  line-height: 1.6;
  padding: 4px 0;
  border-bottom: 1px dashed #e0e0e0;
}

.activity-line:last-child {
  border-bottom: none;
}

.activity-line strong {
  color: #1565c0;
}

/* 文件描述 */
.material-desc {
  font-size: 12px;
  color: #666;
  margin-top: 2px;
  line-height: 1.4;
}

/* 主内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.content-header {
  padding: 20px 24px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.content-header h2 {
  font-size: 22px;
  font-weight: 600;
}

.settings-btn {
  background: #f5f5f5;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.settings-btn:hover {
  background: #e0e0e0;
}

.content-body {
  flex: 1;
  overflow: hidden;
  padding: 20px 24px;
  display: flex;
  flex-direction: row;
  gap: 20px;
  min-height: 0;
}

/* 左侧面板：公告 + 资料 */
.left-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 公告板 */
.bulletin-section, .materials-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.edit-btn, .upload-btn {
  background: #e8f4fd;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #1976d2;
  transition: background 0.2s;
}

.edit-btn:hover, .upload-btn:hover {
  background: #d0e8f7;
}

.bulletin-content {
  line-height: 1.7;
  font-size: 14px;
  color: #444;
  min-height: 80px;
}
.bulletin-content p { margin: 0 0 0.6em 0; }
.bulletin-content h1 { font-size: 1.3rem; margin: 0 0 0.4em 0; }
.bulletin-content h2 { font-size: 1.15rem; margin: 0 0 0.4em 0; }
.bulletin-content h3 { font-size: 1rem; margin: 0 0 0.4em 0; }
.bulletin-content pre { background: #f5f5f5; padding: 10px; border-radius: 4px; overflow-x: auto; margin: 0 0 0.6em 0; }
.bulletin-content code { background: #f0f0f0; padding: 2px 4px; border-radius: 3px; font-size: 0.9em; }
.bulletin-content pre code { background: none; padding: 0; }
.bulletin-content table { border-collapse: collapse; width: 100%; margin: 0 0 0.6em 0; }
.bulletin-content th, .bulletin-content td { border: 1px solid #ddd; padding: 6px 10px; }
.bulletin-content th { background: #f5f5f5; }



.bulletin-editor {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  align-items: center;
}

.rich-toolbar button {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #444;
  transition: all 0.15s;
  min-width: 28px;
  text-align: center;
}

.rich-toolbar button:hover {
  background: #e8f4fd;
  border-color: #1976d2;
  color: #1976d2;
}

.rich-toolbar button.color-btn {
  font-weight: bold;
  padding: 4px 8px;
}

.rich-toolbar .toolbar-sep {
  width: 1px;
  height: 20px;
  background: #ddd;
  margin: 0 2px;
}

.rich-editor {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  background: #fff;
  overflow-y: auto;
  max-height: 400px;
}

.rich-editor p { margin: 0 0 0.6em 0; }
.rich-editor ul, .rich-editor ol { margin: 0 0 0.6em 1.2em; padding-left: 1em; }
.rich-editor blockquote { margin: 0 0 0.6em 0; padding-left: 10px; border-left: 3px solid #ddd; color: #666; }
.rich-editor h1, .rich-editor h2, .rich-editor h3 { margin: 0 0 0.4em 0; }

/* ===== Markdown Editor ===== */
.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  align-items: center;
}
.md-toolbar button {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #444;
  transition: all 0.15s;
  min-width: 28px;
  text-align: center;
}
.md-toolbar button:hover {
  background: #e8f4fd;
  border-color: #1976d2;
  color: #1976d2;
}
.md-toolbar button.active {
  background: #1976d2;
  color: #fff;
  border-color: #1976d2;
}
.md-toolbar .toolbar-sep {
  width: 1px;
  height: 20px;
  background: #ddd;
  margin: 0 2px;
}
.md-editor-wrap {
  position: relative;
  display: flex;
}
.md-editor {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  background: #fff;
  border: none;
  resize: vertical;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  box-sizing: border-box;
}
.md-editor:focus {
  background: #fff;
}
.md-preview {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  line-height: 1.7;
  background: #fff;
  overflow-y: auto;
  max-height: 400px;
  box-sizing: border-box;
}
.md-preview p { margin: 0 0 0.6em 0; }
.md-preview ul, .md-preview ol { margin: 0 0 0.6em 1.2em; padding-left: 1em; }
.md-preview blockquote { margin: 0 0 0.6em 0; padding-left: 10px; border-left: 3px solid #ddd; color: #666; }
.md-preview h1, .md-preview h2, .md-preview h3 { margin: 0 0 0.4em 0; }
.md-preview h1 { font-size: 1.3rem; }
.md-preview h2 { font-size: 1.15rem; }
.md-preview h3 { font-size: 1rem; }
.md-preview pre {
  background: #f5f5f5;
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0 0 0.6em 0;
}
.md-preview code {
  background: #f0f0f0;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.9em;
}
.md-preview pre code { background: none; padding: 0; }
.md-preview table { border-collapse: collapse; width: 100%; margin: 0 0 0.6em 0; }
.md-preview th, .md-preview td { border: 1px solid #ddd; padding: 6px 10px; }
.md-preview th { background: #f5f5f5; }
.md-preview a { color: #1976d2; }
.md-preview img { max-width: 100%; }


.editor-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn-primary {
  background: #1976d2;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-secondary {
  background: #f5f5f5;
  color: #555;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

/* 学习资料 */
.materials-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.material-item {
  padding: 10px 14px;
  background: #f8f9fa;
  border-radius: 10px;
  transition: background 0.2s, box-shadow 0.2s;
}

.material-item:hover {
  background: #f0f1f2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.material-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.material-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.material-text {
  min-width: 0;
  flex: 1;
}

.material-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.material-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-meta {
  font-size: 12px;
  color: #888;
}

.material-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mat-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
}

.mat-btn span {
  font-size: 12px;
}

.mat-btn:hover {
  background: #f5f5f5;
}

.mat-btn-download:hover {
  border-color: #1976d2;
  color: #1976d2;
  background: #e8f4fd;
}

.mat-btn-delete:hover {
  border-color: #e74c3c;
  color: #e74c3c;
  background: #fdeaea;
}

/* Mobile: buttons below file info, full width, larger touch targets */
@media (max-width: 768px) {
  .material-item-row {
    flex-wrap: wrap;
  }
  .material-checkbox {
    order: -1;
  }
  .material-info {
    flex: 1;
    min-width: calc(100% - 30px);
  }
  .material-actions {
    width: 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
  }
  .mat-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 12px;
    font-size: 14px;
  }
  .mat-btn span {
    font-size: 13px;
  }
}

.placeholder {
  color: #999;
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

/* 聊天面板（右侧固定分栏） */
.chat-panel {
  width: 360px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  background: #f8f9fa;
  flex-shrink: 0;
}

.chat-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  max-width: 85%;
}

.message.bot {
  align-self: flex-start;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}

.message.user {
  align-self: flex-end;
}

.message-content {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.message.bot .message-content {
  background: #f0f0f0;
  color: #333;
  border-bottom-left-radius: 4px;
}

.message.user .message-content {
  background: #1976d2;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}

.chat-input-area input:focus {
  border-color: #1976d2;
}

.chat-input-area button {
  background: #1976d2;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
}

/* 消息操作栏 */
.message-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-left: 2px;
}

.msg-action-btn {
  background: none;
  border: none;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  line-height: 1;
}
.msg-action-btn:hover {
  background: #e0e8f5;
  transform: scale(1.15);
}
.msg-action-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* bot 消息内容 Markdown 样式 */
.message.bot .message-content p { margin: 0 0 6px; }
.message.bot .message-content p:last-child { margin-bottom: 0; }
.message.bot .message-content ul,
.message.bot .message-content ol { margin: 0 0 6px 1.2em; padding-left: 0.8em; }
.message.bot .message-content pre {
  background: #2d2d2d;
  color: #f8f8f2;
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12px;
  margin: 6px 0;
}
.message.bot .message-content code {
  background: #e8e8e8;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 12px;
}
.message.bot .message-content pre code {
  background: none;
  padding: 0;
}
.message.bot .message-content h1,
.message.bot .message-content h2,
.message.bot .message-content h3 { margin: 6px 0 4px; font-size: 1em; }
.message.bot .message-content blockquote {
  border-left: 3px solid #ccc;
  margin: 4px 0;
  padding-left: 10px;
  color: #666;
}

/* 设置弹窗 */
.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: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

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

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

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

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.form-group input:focus {
  border-color: #1976d2;
}

.hint {
  font-size: 12px;
  color: #888;
  margin-top: 8px;
  line-height: 1.5;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .close-sidebar {
    display: block;
  }

  .main-content {
    padding-top: 56px;
  }

  .content-header {
    padding: 14px 16px;
  }

  .content-header h2 {
    font-size: 18px;
  }

  .content-body {
    padding: 14px 16px;
  }

  .desktop-only {
    display: none;
  }

  .content-body {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .left-panel {
    overflow-y: visible;
  }

  .chat-panel {
    width: 100%;
    flex-shrink: 0;
    height: 420px;
    border-radius: 12px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 登录弹窗 */
.modal-sm {
  width: 380px;
}

#loginHint {
  color: #1976d2;
  font-size: 12px;
}

/* 设置弹窗扩展 */
.modal-lg {
  width: 600px;
  max-width: 95vw;
}

.auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 16px;
}

.auth-bar span {
  font-size: 13px;
  color: #555;
}

.auth-bar button {
  padding: 4px 12px;
  font-size: 12px;
}

/* 标签页 */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 8px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: #f0f0f0;
}

.tab-btn.active {
  background: #e8f4fd;
  color: #1976d2;
  font-weight: 500;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 科目管理 */
.subject-manager {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.subject-form h4,
.subject-list-admin h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* 图标选择器 */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 8px;
}

.icon-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  border: 2px solid transparent;
}

.icon-option:hover {
  background: #e8f4fd;
}

.icon-option.selected {
  border-color: #1976d2;
  background: #e8f4fd;
}

/* 颜色选择器 */
.color-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 8px;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  border: 3px solid transparent;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: #333;
  transform: scale(1.1);
}

/* 管理科目列表 */
.admin-subject-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.admin-subject-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8f9fa;
  border-radius: 8px;
  transition: background 0.2s;
}

.admin-subject-item:hover {
  background: #f0f0f0;
}

.admin-subject-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-subject-icon {
  font-size: 22px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #fff;
}

.admin-subject-name {
  font-size: 14px;
  font-weight: 500;
}

.admin-subject-actions {
  display: flex;
  gap: 6px;
}

.admin-subject-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.admin-subject-actions button:hover {
  background: #e0e0e0;
}

/* 响应式 */
@media (max-width: 768px) {
  .modal-lg {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .icon-picker {
    grid-template-columns: repeat(6, 1fr);
  }

  .color-picker {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* 问助手按钮 */

/* 折叠按钮 */
.section-header-clickable {
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  transition: background 0.15s;
  padding: 4px 6px 4px 2px;
  margin: -4px -6px -4px -2px;
}
.section-header-clickable:hover {
  background: #f0f2f5;
}

.collapse-icon {
  font-size: 13px;
  color: #aaa;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  transition: color 0.15s;
  margin-right: 2px;
}
.section-header-clickable:hover .collapse-icon {
  color: #555;
}

.section-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

/* 聊天清空按钮 */
.chat-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #999;
  padding: 4px 8px;
  border-radius: 4px;
  margin-left: auto;
  transition: background 0.15s, color 0.15s;
}
.chat-clear-btn:hover { background: #fee2e2; color: #dc2626; }

/* modal-md */
.modal-md {
  width: 540px;
  max-width: 95vw;
}

/* ===== 笔记区块 ===== */
.notes-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* 笔记列表 */
.note-item {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: box-shadow 0.15s, background 0.15s;
}
.note-item:last-child { margin-bottom: 0; }
.note-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); background: #fff; }

.note-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.note-item-header:hover .note-item-title { color: #1976d2; }

.note-toggle-icon {
  font-size: 0.65rem;
  color: #9ca3af;
  flex-shrink: 0;
  transition: color 0.15s;
  width: 12px;
  text-align: center;
}
.note-item-header:hover .note-toggle-icon { color: #1976d2; }

.note-item-body {
  padding-top: 4px;
}

.note-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.note-item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.note-item-actions button:hover { background: #e5e7eb; }

.note-item-content {
  margin-top: 8px;
  font-size: 0.88rem;
  color: #374151;
  line-height: 1.6;
}
.note-item-content.note-empty { color: #9ca3af; font-style: italic; }
.note-item-content p { margin: 0 0 6px; }
.note-item-content p:last-child { margin-bottom: 0; }
.note-item-content pre {
  white-space: pre-wrap;
  font-size: 0.82rem;
  background: #f3f4f6;
  padding: 8px 10px;
  border-radius: 6px;
  margin: 6px 0;
  overflow-x: auto;
}
.note-item-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  background: #f3f4f6;
  padding: 2px 5px;
  border-radius: 4px;
  color: #c7254e;
}
.note-item-content pre code {
  background: none;
  padding: 0;
  color: #374151;
}
.note-item-content ul, .note-item-content ol {
  margin: 4px 0;
  padding-left: 20px;
}
.note-item-content li { margin: 2px 0; }
.note-item-content h1, .note-item-content h2, .note-item-content h3, .note-item-content h4 {
  margin: 8px 0 4px;
  font-weight: 600;
  line-height: 1.3;
}
.note-item-content h1 { font-size: 1.1rem; }
.note-item-content h2 { font-size: 1rem; }
.note-item-content h3 { font-size: 0.95rem; }
.note-item-content h4 { font-size: 0.9rem; }
.note-item-content blockquote {
  margin: 6px 0;
  padding: 4px 10px;
  border-left: 3px solid #d1d5db;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 0 4px 4px 0;
}
.note-item-content a {
  color: #2563eb;
  text-decoration: underline;
}
.note-item-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 6px 0;
  font-size: 0.82rem;
}
.note-item-content th, .note-item-content td {
  border: 1px solid #e5e7eb;
  padding: 4px 8px;
  text-align: left;
}
.note-item-content th {
  background: #f9fafb;
  font-weight: 600;
}

.note-item-meta {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #9ca3af;
}

.note-type-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: #ede9fe;
  color: #7c3aed;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* ===== 笔记弹窗 ===== */
.note-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.note-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.note-modal {
  background: #fff;
  border-radius: 14px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px);
  transition: transform 0.2s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.note-overlay.show .note-modal {
  transform: translateY(0);
}

.note-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.note-modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.note-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.note-modal-close:hover { background: #f3f4f6; color: #374151; }

.note-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.note-modal-body label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 6px;
}
.note-modal-body input[type="text"],
.note-modal-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}
.note-modal-body input[type="text"]:focus,
.note-modal-body textarea:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}

.note-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ===== PC 端布局修复 ===== */
/* content-body 在 PC 上是横向 flex，需要确保高度受控 */
@media (min-width: 769px) {
  .content-body {
    /* 撑满剩余高度，不溢出 */
    flex: 1;
    min-height: 0;
    align-items: stretch;
  }

  .left-panel {
    /* 允许内部滚动，不撑破父容器 */
    overflow-y: auto;
    min-height: 0;
  }

  .chat-panel {
    /* 固定高度跟随父容器 */
    height: 100%;
    min-height: 0;
  }
}

@media (max-width: 768px) {
  .note-modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* Section count badge */
.section-count {
  font-size: 0.85em;
  font-weight: normal;
  color: #888;
  margin-left: 6px;
}

/* Material checkbox */
.material-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Preview modal */
.modal-lg {
  max-width: 900px;
  width: 90%;
}

/* Batch delete bar */
#batchDeleteBar {
  display: flex;
  align-items: center;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.btn-danger:hover {
  background: #c0392b;
}

/* Updates section header left align */
.updates-section .section-header {
  justify-content: flex-start;
}
.updates-section .section-header h3 {
  margin-left: 0;
}

/* Preview close button */
.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.close-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* Mobile PDF preview */
#previewMobilePdf {
  display: none;
  padding: 40px 20px;
  text-align: center;
}
#previewMobilePdf .mobile-pdf-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
#previewMobilePdf .mobile-pdf-text {
  font-size: 15px;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.6;
}
#previewOpenTab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1976d2;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
}
#previewOpenTab:hover {
  background: #1565c0;
}


/* ===== v2.7.0: UI enhancements ===== */

/* Material buttons: icon-only */
.mat-btn-icon {
  padding: 6px 8px;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
}

/* Sidebar toggle button (PC) */
.sidebar-toggle {
  display: none;
  background: #f5f5f5;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle:hover {
  background: #e0e0e0;
  color: #333;
}

/* PC only: show sidebar toggle, enable collapse */
@media (min-width: 769px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar {
    transition: width 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
    overflow: hidden;
    white-space: nowrap;
  }

  .sidebar.sidebar-collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-right: none;
    opacity: 0;
    margin-left: -1px;
  }
}

/* Chat panel resizer */
.chat-resizer {
  display: none;
  width: 6px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  transition: background 0.15s;
}
.chat-resizer:hover {
  background: rgba(25, 118, 210, 0.2);
}
.chat-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 30px;
  background: #ccc;
  border-radius: 1px;
  transition: background 0.15s;
}
.chat-resizer:hover::after {
  background: #1976d2;
}

@media (min-width: 769px) {
  .chat-resizer {
    display: block;
  }
}


/* ===== Sidebar Search Entry ===== */
.sidebar-search-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  color: #666;
  font-size: 14px;
  border-top: 1px solid #f0f0f0;
  transition: all 0.15s;
}
.sidebar-search-entry:hover {
  background: #f0f4f8;
  color: #1976d2;
}
.sidebar-search-entry.active {
  background: #e3f2fd;
  color: #1976d2;
  font-weight: 600;
}
.search-entry-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}
.search-entry-name {
  flex: 1;
}

/* ===== Search Page ===== */
.search-page {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.search-page.hidden {
  display: none;
}
.search-page-inner {
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  padding: 10px 0 30px;
}

/* Search box - Google/Baidu style */
.search-box-wrap {
  padding: 40px 0 24px;
  text-align: center;
}
.search-box {
  display: flex;
  max-width: 580px;
  margin: 0 auto;
  border: 2px solid #dfe1e5;
  border-radius: 24px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:hover,
.search-box:focus-within {
  border-color: #1976d2;
  box-shadow: 0 2px 12px rgba(25, 118, 210, 0.15);
}
.search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 20px;
  font-size: 16px;
  background: transparent;
}
.search-btn {
  border: none;
  background: #1976d2;
  color: #fff;
  padding: 0 24px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-btn:hover {
  background: #1565c0;
}
.search-btn:active {
  background: #0d47a1;
}

/* Search results */
.search-results {
  padding: 0 4px;
}
.search-result-item {
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.1s;
}
.search-result-item:hover {
  background: #f8f9fa;
}
.search-result-title {
  font-size: 17px;
  color: #1a0dab;
  margin-bottom: 4px;
  line-height: 1.4;
}
.search-result-title:hover {
  text-decoration: underline;
}
.search-result-url {
  font-size: 13px;
  color: #006621;
  margin-bottom: 4px;
}
.search-result-snippet {
  font-size: 14px;
  color: #4d5156;
  line-height: 1.6;
}

.search-result-snippet mark.search-highlight,
.search-result-title mark.search-highlight {
  background: #fff3cd;
  color: #1a0dab;
  padding: 0 1px;
  border-radius: 2px;
  font-weight: 600;
}
.search-result-meta {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}
.search-result-icon {
  margin-right: 4px;
}

/* Material result with inline actions */
.search-result-material {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.search-result-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.search-result-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.result-action-btn {
  padding: 4px 12px;
  border: 1px solid #dfe1e5;
  background: #fff;
  color: #1976d2;
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.15s;
}
.result-action-btn:hover {
  background: #e8f4fd;
  border-color: #1976d2;
}

@media (max-width: 768px) {
  .search-result-material {
    flex-direction: column;
  }
  .search-result-actions {
    flex-direction: row;
    margin-top: 6px;
  }
  .result-action-btn {
    font-size: 12px;
    padding: 3px 10px;
  }
}
.search-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 15px;
}
.search-loading {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 15px;
}

/* Pagination */
.search-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
}
.page-btn {
  padding: 8px 20px;
  border: 1px solid #dfe1e5;
  background: #fff;
  color: #1976d2;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) {
  background: #f0f4f8;
  border-color: #1976d2;
}
.page-btn:disabled {
  color: #bbb;
  cursor: default;
  background: #f5f5f5;
}
.page-info {
  font-size: 14px;
  color: #666;
}

/* Mobile: hide pagination, use infinite scroll */
@media (max-width: 768px) {
  .search-box {
    border-radius: 16px;
  }
  .search-input {
    font-size: 15px;
    padding: 10px 16px;
  }
  .search-btn {
    padding: 0 16px;
    font-size: 14px;
  }
  .search-box-wrap {
    padding: 24px 0 16px;
  }
  .search-result-title {
    font-size: 15px;
  }
  .search-result-snippet {
    font-size: 13px;
  }
  .search-load-more {
    text-align: center;
    padding: 16px;
    color: #1976d2;
    font-size: 14px;
  }
}

/* ===== ICP Footer ===== */
.icp-footer {
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
  color: #999;
  background: #f5f5f5;
  border-top: 1px solid #e8eaed;
}
.icp-footer a {
  color: #999;
  text-decoration: none;
}
.icp-footer a:hover {
  color: #666;
}

/* ===== v2.11.5: Mobile Layout Fix ===== */
@media (max-width: 768px) {
  /* Root cause: #app is flex-row, .icp-footer is in-flow and takes ~128px
     horizontal space, leaving main-content only ~262px instead of 390px.
     Fix: switch to column direction so main-content gets full width. */
  #app {
    flex-direction: column;
  }

  /* main-content: full width, fill remaining vertical space */
  .main-content {
    width: 100%;
    flex: 1 1 auto;
    overflow: hidden;
  }

  /* icp-footer: full width, don't shrink */
  .icp-footer {
    width: 100%;
    flex-shrink: 0;
  }

  /* Reduce section padding on mobile (was 20px) */
  .bulletin-section,
  .materials-section,
  .notes-section {
    padding: 14px;
    border-radius: 10px;
  }

  /* Tighter content-body padding and gap */
  .content-body {
    padding: 12px 14px;
    gap: 12px;
  }

  /* Section header: tighter on mobile */
  .section-header {
    margin-bottom: 10px;
  }
  .section-header h3 {
    font-size: 15px;
  }

  /* Smaller action buttons on mobile */
  .edit-btn,
  .upload-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  /* Content header: tighter */
  .content-header {
    padding: 12px 14px;
  }
  .content-header h2 {
    font-size: 16px;
  }

  /* Bulletin content: slightly smaller */
  .bulletin-content {
    font-size: 13px;
    line-height: 1.6;
  }

  /* Note items: tighter padding */
  .note-item {
    padding: 10px 12px;
  }
  .note-item-content {
    font-size: 0.85rem;
  }

  /* Material items: tighter */
  .material-item {
    padding: 8px 12px;
  }

  /* Chat panel: slightly shorter on small screens */
  .chat-panel {
    height: 380px;
  }

  /* md-toolbar: allow wrapping, smaller buttons */
  .md-toolbar {
    gap: 3px;
    padding: 6px 8px;
  }
  .md-toolbar button {
    padding: 3px 8px;
    font-size: 12px;
    min-width: 24px;
  }

  /* Search page inner: full width on mobile */
  .search-page-inner {
    max-width: 100%;
    padding: 10px 0 20px;
  }

  /* Updates section same as other sections */
  .updates-section {
    padding: 14px;
    border-radius: 10px;
  }
}
