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

/* 成员在线/离线状态点 */
.member-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.member-status-dot.online {
  background: #2ecc71;
  box-shadow: 0 0 4px rgba(46, 204, 113, 0.7);
}
.member-status-dot.offline {
  background: #c7c7cc;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  background-color: #f5f5f7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* 表单控件强制继承全局字体（避免浏览器自带宋体/微软雅黑覆盖） */
button, input, select, textarea, optgroup {
  font-family: inherit;
}

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

header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: #1d1d1f;
  padding: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* ===== 顶部导航栏 ===== */
.top-nav-header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.top-nav-container {
  max-width: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 52px;
  gap: 16px;
}

.top-nav-left {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.top-nav-logo {
  font-size: 20px;
  font-weight: 800;
  background: #1d1d1f;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-6px);
  text-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(168, 85, 247, 0.15));
}

.top-nav-logo img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.top-nav-menu {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.top-nav-menu::-webkit-scrollbar {
  display: none;
}

.top-nav-menu a {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 400;
  color: #1d1d1f;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  position: relative;
}

.top-nav-menu a:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #007AFF;
}

.top-nav-menu a.active {
  background: rgba(0, 122, 255, 0.1);
  color: #007AFF;
  font-weight: 500;
}

/* ===== 移动端汉堡菜单按钮（桌面隐藏） ===== */
.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #1d1d1f;
  cursor: pointer;
  border-radius: 10px;
  margin-right: 2px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-toggle:active {
  background: rgba(0, 0, 0, 0.06);
}

/* ===== 移动端侧边栏遮罩层 ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1150;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* ===== 右上角用户信息 ===== */
.top-nav-right {
  flex-shrink: 0;
  position: relative;
}

.user-dropdown {
  position: relative;
}

.user-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  transition: background 0.2s;
}

.user-dropdown-trigger:hover {
  background: rgba(0, 0, 0, 0.05);
}

.user-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}

.user-name-sm {
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  font-size: 11px;
  color: #007AFF;
  background: rgba(0, 122, 255, 0.08);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.user-role-badge.role-teacher {
  color: #0F766E;
  background: rgba(14, 165, 233, 0.1);
}

.user-role-badge.role-admin {
  color: #c62828;
  background: rgba(198, 40, 40, 0.08);
}

.dropdown-arrow {
  font-size: 11px;
  color: #86868b;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 8px;
  z-index: 1001;
}

.dropdown-user-info {
  padding: 12px 12px 8px;
}

.dropdown-user-name {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 4px;
}

.dropdown-user-stats {
  font-size: 12px;
  color: #86868b;
}

.dropdown-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 6px 0;
}

.user-dropdown-menu a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: #1d1d1f;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s;
}

.user-dropdown-menu a:hover {
  background: rgba(0, 0, 0, 0.05);
}

.dropdown-logout {
  color: #FF3B30 !important;
}

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 40px 20px;
}

.auth-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

.auth-header {
  background: #ffffff;
  padding: 30px;
  text-align: center;
}

.auth-header h2 {
  color: #1d1d1f;
  font-size: 28px;
  margin-bottom: 8px;
}

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

.auth-form {
  padding: 30px;
}

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

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

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

.form-group input:focus {
  outline: none;
  border-color: #007AFF;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  resize: none;
  transition: border-color 0.3s;
}

.form-group textarea:focus {
  outline: none;
  border-color: #007AFF;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  resize: none;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.form-group select[style*="flex"] {
  width: auto;
}

.form-group select:focus {
  outline: none;
  border-color: #007AFF;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.form-group .input-row {
  display: flex;
  gap: 12px;
}

.form-group .input-row input {
  flex: 1;
}

.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: #007AFF;
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

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

.btn-outline {
  background: transparent;
  border: 1px solid #007AFF;
  color: #007AFF;
}

.btn-outline:hover {
  background: #007AFF;
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(255, 107, 107, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(67, 233, 123, 0.4);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  width: auto;
}

.btn-block {
  width: 100%;
}

.switch-form {
  text-align: center;
  margin-top: 20px;
}

.switch-form p {
  font-size: 14px;
  color: #666;
}

.switch-form a {
  color: #007aff;
  text-decoration: none;
  font-weight: 500;
}

.switch-form a:hover {
  text-decoration: underline;
}

.flash-message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.flash-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flash-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.dashboard {
  min-height: calc(100vh - 52px);
  position: relative;
}

/* ===== Panel 切换滑动动画 ===== */
.panel-container {
  position: relative;
  overflow: hidden;
}

.panel-slide-wrap {
  position: relative;
  width: 100%;
}

.panel-slide-left {
  animation: slideOutLeft 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.panel-slide-in-right {
  animation: slideInRight 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-60px); opacity: 0.3; }
}

@keyframes slideInRight {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Resource Stepper Carousel ===== */
.resource-carousel {
  position: relative;
  margin: 20px 0 40px;
  padding: 60px 20px 0;
  overflow: hidden;
}

.resource-carousel-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: visible;
  min-height: 280px;
}

.resource-carousel-track.animating {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* SVG curved connector line */
.resource-carousel-svg-line {
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  width: 90%;
  height: 120px;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
  transform: translateY(-20px);
}

.resource-step {
  position: relative;
  flex: 1;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Staggered layout: odd items up, even items down */
.resource-step:nth-child(odd) {
  transform: translateY(-20px);
}

.resource-step:nth-child(even) {
  transform: translateY(20px);
  flex-direction: column-reverse;
}

.resource-step.active {
  transform: translateY(-12px) scale(1.05) !important;
}

.resource-step-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d1d1d6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 2;
  margin: 40px 0;
}

.resource-step.active .resource-step-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
  box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.25), 0 4px 16px rgba(255, 107, 107, 0.5);
  animation: ballPulse 1.5s ease-in-out infinite;
}

@keyframes ballPulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.25), 0 4px 16px rgba(255, 107, 107, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(255, 107, 107, 0.15), 0 4px 20px rgba(255, 107, 107, 0.6); }
}

/* Color the balls based on rank */
.resource-step .resource-step-icon { background: #d1d1d6; }

/* Gold/silver/bronze by data-rank attribute */
.resource-step .resource-step-icon[data-rank="1"] {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.4), 0 2px 8px rgba(255, 165, 0, 0.5);
}
.resource-step .resource-step-icon[data-rank="2"] {
  background: linear-gradient(135deg, #C0C0C0, #9E9E9E);
  box-shadow: 0 0 0 3px rgba(192, 192, 192, 0.4), 0 2px 8px rgba(158, 158, 158, 0.5);
}
.resource-step .resource-step-icon[data-rank="3"] {
  background: linear-gradient(135deg, #CD7F32, #A0522D);
  box-shadow: 0 0 0 3px rgba(205, 127, 50, 0.4), 0 2px 8px rgba(160, 82, 45, 0.5);
}

/* When active, special glow effect overrides rank colors */
.resource-step.active .resource-step-icon {
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a) !important;
  box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.25), 0 4px 16px rgba(255, 107, 107, 0.5) !important;
}

.resource-step-card {
  background: white;
  border-radius: 16px;
  padding: 16px 14px;
  width: 100%;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  text-align: center;
  min-height: 140px;
}

.resource-step-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
}

.resource-step.active .resource-step-card {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 2px solid rgba(255, 107, 107, 0.3);
  transform: translateY(-4px);
}

.resource-step-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-step-card p {
  font-size: 12px;
  color: #86868b;
  margin: 0 0 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resource-step-card .step-meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: #8e8e93;
  flex-wrap: wrap;
}

.resource-step-card .step-meta span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ===== Animation for slide transition ===== */
.carousel-enter-left {
  animation: slideInFromLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.carousel-enter-right {
  animation: slideInFromRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Staggered animation for individual items */
@keyframes staggerFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(var(--stagger-offset, 0));
  }
}

.resource-step {
  animation: staggerFadeIn 0.5s ease-out forwards;
  opacity: 0;
}

.resource-step:nth-child(1) { animation-delay: 0.05s; }
.resource-step:nth-child(2) { animation-delay: 0.12s; }
.resource-step:nth-child(3) { animation-delay: 0.19s; }
.resource-step:nth-child(4) { animation-delay: 0.26s; }
.resource-step:nth-child(5) { animation-delay: 0.33s; }

.resource-carousel-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.resource-carousel-nav button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e5e5ea;
  background: white;
  color: #1d1d1f;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.resource-carousel-nav button:hover {
  background: #f5f5f7;
  border-color: #d1d1d6;
}

.resource-carousel-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.resource-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.resource-carousel-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d1d1d6;
  cursor: pointer;
  transition: all 0.2s;
}

.resource-carousel-dots .dot.active {
  width: 20px;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff6b6b, #ee5a5a);
}

@media (max-width: 768px) {
  .resource-carousel-track {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  
  .resource-step {
    min-width: 220px;
    scroll-snap-align: start;
  }
  
  .resource-carousel-svg-line {
    display: none;
  }
}

.dashboard .main-content {
  min-height: calc(100vh - 52px);
  padding: 24px;
  width: 100%;
  box-sizing: border-box;
}

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

.stat-card {
  background: white;
  border-radius: 20px;
  padding: 20px 16px 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  min-width: 0;
}

.stat-card .stat-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 36px;
  font-weight: 400;
  color: #1d1d1f;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 16px;
  color: #1d1d1f;
  margin-bottom: 8px;
  font-weight: 600;
}

.dept-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.dept-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.dept-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dept-card-header {
  padding: 20px;
  background: white;
  color: var(--pb-fg, #1f2937);
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.dept-card-icon {
  font-size: 40px;
  width: 60px;
  height: 60px;
  background: #f0f7f4;
  color: #2f8a5f;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dept-card-title h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--pb-fg, #1f2937);
}

.dept-card-title p {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.dept-card-body {
  padding: 20px;
  flex: 1;
}

.dept-desc {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 16px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dept-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #999;
}

.dept-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dept-card-footer {
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}

.resource-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

/* ===== 资源卡片：Apple风格，无实色块，用线条+层级+间距 ===== */
.resource-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #eef0f3;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03), 0 2px 8px rgba(17, 24, 39, 0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
}

.resource-card:hover {
  transform: translateY(-2px);
  border-color: #dfe4ec;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.06), 0 12px 30px rgba(17, 24, 39, 0.06);
}

.resource-card .resource-content {
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.resource-card h3 {
  font-size: 17px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0;
  line-height: 1.4;
  letter-spacing: -0.1px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 资料/收藏列表里的内联描述 <p> 也做截断与换行保护 */
.resource-card .resource-content > p {
  font-size: 14px;
  color: #6e6e73;
  line-height: 1.6;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 描述文字 */
.resource-desc {
  font-size: 14px;
  color: #6e6e73;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 标签区：用浅灰描边，不用填充色块 */
.resource-card .resource-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding-top: 2px;
}

.resource-card .tag {
  padding: 4px 10px;
  border: 1px solid #e5e7eb;
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
  color: #555a64;
  line-height: 1.4;
}

.resource-card .tag.category {
  border-color: #d1e7ff;
  color: #0a66c2;
}

.resource-card .tag.department {
  border-color: #e3dbff;
  color: #5b4bd1;
}

.resource-card .tag.scope {
  border-color: #e1efe4;
  color: #1e7d3a;
}

/* 分割线 */
.resource-divider {
  height: 1px;
  background: #f0f2f5;
  margin: 2px 0 0;
}

/* 底部统计 & 作者区 */
.resource-card .resource-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-top: 4px;
  font-size: 13px;
}

.resource-card .resource-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.resource-card .stat-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #86868b;
  font-size: 13px;
  line-height: 1;
}

.resource-card .stat-item .stat-icon {
  font-size: 13px;
  opacity: 0.85;
}

/* 星星特殊色 */
.resource-card .stat-item[data-type="stars"] {
  color: #c58d00;
}

/* 作者链接 */
.resource-author {
  color: #4c535e;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: flex-end;
  margin-top: 2px;
}

.resource-author::before {
  content: "👤";
  font-size: 12px;
  opacity: 0.7;
}

.resource-author a {
  color: #0a66c2;
  text-decoration: none;
  transition: color 0.15s;
}

.resource-author a:hover {
  color: #084298;
  text-decoration: underline;
}

/* ===== 右上角徽标容器：Hot / High + 删除按钮 ===== */
.resource-badges {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.resource-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.2px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.08);
}

/* Hot 热门 - 红色火花形状，内含 Hot 文字 */
.resource-badge.badge-hot {
  position: relative;
  color: #ffffff;
  background: linear-gradient(135deg, #ff4d4f 0%, #ff2a2e 100%);
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  box-shadow:
    0 2px 8px rgba(255, 77, 79, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  overflow: visible;
}

/* 火花形状装饰：右上角凸起尖角 */
.resource-badge.badge-hot::before {
  content: "";
  position: absolute;
  top: -4px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #ff7a45 0%, #ff2a2e 100%);
  clip-path: polygon(
    50% 0%,
    80% 20%,
    100% 50%,
    75% 55%,
    90% 90%,
    50% 70%,
    10% 90%,
    25% 55%,
    0% 50%,
    20% 20%
  );
  filter: drop-shadow(0 1px 2px rgba(255, 77, 79, 0.5));
  z-index: 1;
  transform: rotate(15deg);
}

/* 火花内的 🔥 图标+Hot 文字 */
.resource-badge.badge-hot::after {
  content: "";
}

.resource-badge.badge-hot .badge-icon {
  font-size: 12px;
  margin-right: 2px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

/* High 高价值 - 紫蓝 */
.resource-badge.badge-high {
  color: #ffffff;
  background: linear-gradient(135deg, #7b61ff 0%, #4f46e5 100%);
}

/* 删除按钮（右上角徽标区内） */
.btn-delete-resource {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ffe1e1;
  color: #d64545;
  border-radius: 999px;
  padding: 3px 8px;
  height: auto;
  width: auto;
  cursor: pointer;
  font-size: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
  backdrop-filter: blur(6px);
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(214, 69, 69, 0.12);
}

.btn-delete-resource::before {
  content: "✕";
  font-size: 10px;
}

.resource-card:hover .btn-delete-resource {
  display: inline-flex;
}

.btn-delete-resource:hover {
  background: #fff5f5;
  border-color: #ffc9c9;
  color: #b3261e;
  transform: none;
}

.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
}

.search-bar select {
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  background: white;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 30px;
}

.pagination button {
  padding: 8px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 14px;
}

.pagination button:hover:not(:disabled) {
  background: #f0f0f0;
}

.pagination button.active {
  background: #007aff;
  color: white;
  border-color: #007aff;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
}

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

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

.modal-header .close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.modal-body {
  padding: 20px;
}

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

/* 打分智能体：应用内 iframe 弹窗 */
.profile-card {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}

.profile-header .avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #007aff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
  color: white;
}

.profile-header .profile-info h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.profile-header .profile-info p {
  color: #999;
  font-size: 14px;
}

.profile-stats {
  display: flex;
  gap: 30px;
  margin-bottom: 30px;
}

.profile-stat {
  text-align: center;
}

.profile-stat .value {
  font-size: 24px;
  font-weight: 700;
  color: #333;
}

.profile-stat .label {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s;
}

.tab-btn.active {
  background: #007aff;
  color: white;
}

.tab-content {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.table th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 14px;
}

.table td {
  font-size: 14px;
  color: #333;
}

.table tr:hover {
  background: #f8f9fa;
}

/* Ranking medal styles */
.ranking-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.ranking-medal.gold {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  width: 40px;
  height: 40px;
  font-size: 20px;
}

.ranking-medal.silver {
  background: linear-gradient(135deg, #E8E8E8 0%, #B0B0B0 100%);
  box-shadow: 0 4px 16px rgba(192, 192, 192, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  width: 38px;
  height: 38px;
  font-size: 19px;
}

.ranking-medal.bronze {
  background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%);
  box-shadow: 0 4px 16px rgba(205, 127, 50, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  width: 36px;
  height: 36px;
  font-size: 18px;
}

.ranking-medal.normal {
  background: #e9ecef;
  color: #86868b;
}

/* Top 3 rows highlighting */
.ranking-table tr.top-1 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.06) 100%);
  border-left: 4px solid #FFD700;
}

.ranking-table tr.top-1 td {
  font-weight: 600;
  color: #1d1d1f;
}

.ranking-table tr.top-2 {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.2) 0%, rgba(192, 192, 192, 0.06) 100%);
  border-left: 4px solid #C0C0C0;
}

.ranking-table tr.top-2 td {
  font-weight: 600;
  color: #1d1d1f;
}

.ranking-table tr.top-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.06) 100%);
  border-left: 4px solid #CD7F32;
}

.ranking-table tr.top-3 td {
  font-weight: 600;
  color: #1d1d1f;
}

.ranking-table tr.top-1:hover {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.28) 0%, rgba(255, 215, 0, 0.1) 100%);
}

.ranking-table tr.top-2:hover {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.28) 0%, rgba(192, 192, 192, 0.1) 100%);
}

.ranking-table tr.top-3:hover {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.28) 0%, rgba(205, 127, 50, 0.1) 100%);
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.user-profile-sidebar {
  text-align: center;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.user-profile-sidebar .user-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  color: white;
  margin: 0 auto 12px;
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
}

.user-profile-sidebar .user-info {
  margin-bottom: 12px;
}

.user-profile-sidebar .user-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.user-profile-sidebar .user-role {
  font-size: 12px;
  color: #007AFF;
  background: rgba(0, 122, 255, 0.08);
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: 4px;
  font-weight: 500;
}

.user-profile-sidebar .user-points {
  font-size: 14px;
  color: #999;
}

.menu-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 20px 0;
}

.sidebar {
  width: 260px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  position: fixed;
  top: 20px;
  left: 20px;
  bottom: 20px;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.sidebar.collapsed {
  transform: translateX(-270px);
}

.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 270px;
  transform: translateY(-50%);
  background: white;
  border: none;
  border-radius: 0 8px 8px 0;
  padding: 8px 4px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  z-index: 1000;
  transition: left 0.3s ease;
}

.sidebar-toggle.collapsed {
  left: 20px;
}

.sidebar-toggle:hover {
  background: #f5f7fa;
}

.sidebar h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 8px;
}

.sidebar li a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.3s;
}

.sidebar li a:hover,
.sidebar li a.active {
  background: rgba(0, 122, 255, 0.08);
  color: #007AFF;
}

.admin-layout {
  display: flex;
  gap: 20px;
  padding: 30px 0;
}

.admin-content {
  flex: 1;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: #86868b;
  margin: 0;
}

/* 加载状态 */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: #86868b;
}

.loading-spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid #e5e5ea;
  border-top-color: #007aff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.loading-state p {
  font-size: 14px;
  margin: 0;
  color: #86868b;
}

@media (max-width: 768px) {
  .top-nav-container {
    padding: 0 12px;
    gap: 8px;
    justify-content: space-between;
    height: 56px;
  }

  .top-nav-logo {
    transform: none;
    font-size: 18px;
  }

  .mobile-menu-toggle {
    width: 36px;
    height: 36px;
    font-size: 20px;
    margin-right: 0;
  }

  .user-dropdown-trigger {
    padding: 4px;
  }

  /* 移动端隐藏顶部导航菜单，依靠左侧栏导航 */
  .top-nav-menu {
    display: none;
  }

  .user-name-sm {
    display: none;
  }

  .user-role-badge {
    display: none;
  }

  .dropdown-user-stats {
    font-size: 12px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .resource-list {
    grid-template-columns: 1fr;
  }

  .search-bar {
    flex-direction: column;
  }

  .admin-layout {
    flex-direction: column;
  }

  .dashboard .main-content {
    padding: 12px;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .section-title {
    font-size: 24px;
  }

  /* 表格横向滚动 */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* 弹窗适配 */
  .modal-content,
  .modal {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto !important;
  }

  /* 按钮组不溢出 */
  .btn-group,
  .action-buttons {
    flex-wrap: wrap;
    gap: 4px;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Apple Design Overrides & Q&A Styles ===== */

.section-title {
  font-size: 32px;
  font-weight: 700;
  color: #1d1d1f;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

.btn-sm {
  border-radius: 12px;
  font-size: 14px;
  padding: 8px 16px;
  width: auto;
}

/* Q&A Chapter Grid */
.qa-chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.qa-chapter-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.qa-chapter-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.qa-chapter-number {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.qa-chapter-info {
  flex: 1;
}

.qa-chapter-info h4 {
  font-size: 17px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 6px 0;
}

.qa-chapter-info p {
  font-size: 14px;
  color: #86868b;
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.qa-chapter-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #86868b;
}

.qa-chapter-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.qa-chapter-subject {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e7ec 100%);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.qa-chapter-subject .qa-chapter-number {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
}

.qa-chapter-children {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding-left: 40px;
}

.qa-chapter-child .qa-chapter-number {
  background: linear-gradient(135deg, #34c759 0%, #30b350 100%);
  font-size: 14px;
}

/* Q&A Question Items */
.qa-question-item {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border: 1px solid rgba(0, 0, 0, 0.03);
  position: relative;
}

.qa-q-del-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 77, 79, 0.08);
  color: #ff4d4f;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

/* 提问卡片右上角的「修改 / 删除」操作区（绝对定位在卡片内） */
.qa-q-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 3;
}
.qa-q-actions .qa-q-del-btn { position: static; }

.qa-q-edit-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 122, 255, 0.08);
  color: #007aff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.qa-q-edit-btn:hover {
  background: #007aff;
  color: #fff;
}

.qa-q-del-btn:hover {
  background: #ff4d4f;
  color: #fff;
}

.qa-question-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.qa-question-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.qa-question-status.open {
  background: rgba(255, 149, 0, 0.1);
  color: #FF9500;
}

.qa-question-status.closed {
  background: rgba(48, 209, 88, 0.1);
  color: #30D158;
}

.qa-question-content {
  flex: 1;
}

.qa-question-content h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 6px 0;
}

.qa-question-content p {
  font-size: 14px;
  color: #86868b;
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.qa-question-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #86868b;
}

/* Q&A Question Detail */
.qa-question-detail-box {
  background: white;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.qa-question-detail-box h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 12px 0;
}

.qa-question-detail-box p {
  font-size: 15px;
  color: #333;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

/* Q&A Answer Cards */
.qa-answer-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.03);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.qa-answer-card.ai-answer {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.03) 0%, rgba(88, 86, 214, 0.03) 100%);
  border: 1px solid rgba(0, 122, 255, 0.08);
}

.qa-answer-card.accepted {
  border: 2px solid #30D158;
  box-shadow: 0 4px 20px rgba(48, 209, 88, 0.1);
}

.qa-answer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.qa-answer-author {
  font-weight: 600;
  font-size: 15px;
  color: #1d1d1f;
}

.qa-answer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #007aff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.qa-answer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qa-avatar-ai {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
}

.qa-avatar-default {
  background: #c7c7cc;
}

.qa-accepted-badge {
  background: #30D158;
  color: white;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.qa-teacher-badge {
  background: #FF9500;
  color: white;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.qa-answer-body {
  font-size: 15px;
  color: #333;
  line-height: 1.7;
  margin-bottom: 16px;
}

/* 智能回答下方的「联网参考来源」区块 */
.qa-web-refs {
  background: rgba(0, 122, 255, 0.04);
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.qa-web-refs-title {
  font-size: 13px;
  font-weight: 700;
  color: #007AFF;
  margin-bottom: 10px;
}

.qa-web-ref-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed rgba(0, 122, 255, 0.12);
}

.qa-web-ref-item:first-of-type {
  border-top: none;
}

.qa-web-ref-index {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(0, 122, 255, 0.12);
  color: #007AFF;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qa-web-ref-main {
  flex: 1;
  min-width: 0;
}

.qa-web-ref-link {
  font-size: 14px;
  font-weight: 600;
  color: #007AFF;
  text-decoration: none;
  word-break: break-all;
}

.qa-web-ref-link:hover {
  text-decoration: underline;
}

.qa-web-ref-snippet {
  font-size: 12px;
  color: #86868b;
  line-height: 1.6;
  margin-top: 4px;
  word-break: break-word;
}

.qa-expand-btn {
  display: inline;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: #007AFF;
  font-size: 12px;
  cursor: pointer;
  line-height: inherit;
}

.qa-expand-btn:hover {
  text-decoration: underline;
}

.qa-text-ellipsis {
  color: #86868b;
}

.qa-memory-refs {
  background: rgba(52, 168, 83, 0.05);
  border: 1px solid rgba(52, 168, 83, 0.16);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.qa-memory-refs-title {
  font-size: 13px;
  font-weight: 700;
  color: #34a853;
  margin-bottom: 10px;
}

.qa-memory-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed rgba(52, 168, 83, 0.18);
}

.qa-memory-item:first-of-type {
  border-top: none;
}

.qa-memory-index {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(52, 168, 83, 0.14);
  color: #34a853;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qa-memory-main {
  flex: 1;
  min-width: 0;
}

.qa-memory-q {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  word-break: break-word;
}

.qa-memory-who {
  font-size: 12px;
  font-weight: 500;
  color: #34a853;
  margin-left: 4px;
}

.qa-memory-a {
  font-size: 12px;
  color: #515154;
  line-height: 1.6;
  margin-top: 4px;
  word-break: break-word;
}

.qa-answer-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.qa-vote-btn {
  background: rgba(255, 204, 0, 0.1);
  border: none;
  color: #FF9500;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.qa-vote-btn:hover {
  background: rgba(255, 204, 0, 0.2);
  transform: scale(1.05);
}

.qa-action-btn {
  background: transparent;
  border: 1px solid #d1d1d6;
  color: #666;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.qa-action-btn:hover {
  background: #f5f5f7;
  border-color: #007AFF;
  color: #007AFF;
}

/* Q&A Comments */
.qa-comments-list {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.qa-comment-item {
  padding: 10px 14px;
  border-radius: 12px;
  background: #f5f5f7;
  margin-bottom: 8px;
  font-size: 13px;
}

.qa-comment-item.correction {
  background: rgba(255, 59, 48, 0.05);
  border-left: 3px solid #FF3B30;
}

.qa-comment-author {
  font-weight: 600;
  color: #1d1d1f;
  margin-right: 6px;
}

.qa-comment-type {
  font-size: 12px;
  color: #86868b;
}

/* Live Ranking Indicator */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #30D158;
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* Ranking Badge Override for Apple Style */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f5f5f7;
  color: #86868b;
  font-size: 13px;
  font-weight: 600;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.rank-badge.silver {
  background: linear-gradient(135deg, #C0C0C0 0%, #A0A0A0 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.3);
}

.rank-badge.bronze {
  background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.3);
}

/* Table Override */
.table {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.table th {
  background: #f5f5f7;
  color: #86868b;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f5f5f7;
}

/* Empty/Loading state inside table: render as full-width block row */
.table tbody .loading-state,
.table tbody .empty-state {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 60px 20px;
  text-align: center;
}

/* Search Bar Override */
.search-bar {
  background: white;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.search-bar input {
  border-radius: 12px;
  border: 1px solid #e0e0e0;
}

.search-bar input:focus {
  border-color: #007AFF;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* Modal Overlay */
.modal-overlay {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Pagination Override */
.pagination button {
  border-radius: 12px;
  margin: 0 4px;
}

/* Resource Card Content */
.resource-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: #1d1d1f;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* ===== Apple-Style Left Navigation ===== */
.apple-sidebar {
  position: fixed;
  left: 0;
  top: 52px;
  bottom: 0;
  width: 220px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  padding: 20px 12px;
  overflow-y: auto;
  z-index: 900;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.apple-sidebar.collapsed {
  width: 0;
  transform: translateX(-220px);
  overflow: hidden;
}

.apple-sidebar-section {
  margin-bottom: 28px;
}

.apple-sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0 0 10px 12px;
}

.apple-sidebar-item,
.apple-sidebar-item:link,
.apple-sidebar-item:visited {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 400;
  color: #1d1d1f;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 2px;
}

.apple-sidebar-item:hover,
.apple-sidebar-item:hover:visited {
  background: rgba(0, 0, 0, 0.04);
  color: #007AFF;
}

.apple-sidebar-item.active,
.apple-sidebar-item.active:visited {
  background: rgba(0, 122, 255, 0.08);
  color: #007AFF;
  font-weight: 500;
}

.apple-sidebar-item.active:hover,
.apple-sidebar-item.active:hover:visited {
  background: rgba(0, 122, 255, 0.1);
  color: #007AFF;
}

.apple-sidebar-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.apple-sidebar-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apple-sidebar-toggle {
  position: fixed;
  left: 220px;
  top: 52px;
  width: 24px;
  height: 48px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 950;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 10px;
  color: #86868b;
}

.apple-sidebar-toggle:hover {
  color: #007AFF;
  background: rgba(255, 255, 255, 1);
}

.apple-sidebar.collapsed ~ .apple-sidebar-toggle,
.apple-sidebar-toggle.collapsed {
  left: 0;
}

.apple-main {
  margin-left: 220px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.apple-main.full-width {
  margin-left: 0;
}

/* ===== Apple-Style Clean Stat Cards (No Color Blocks) ===== */
.apple-stat-card {
  background: white;
  border-radius: 18px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s, transform 0.2s;
}

.apple-stat-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.apple-stat-value {
  font-size: 32px;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin: 0 0 6px;
  transition: opacity 0.3s ease;
}

.apple-stat-label {
  font-size: 13px;
  color: #86868b;
  font-weight: 400;
  margin: 0;
}

/* ===== Apple-Style Welcome Banner (No Color Blocks) ===== */
.apple-welcome {
  background: white;
  border-radius: 24px;
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 24px;
}

.apple-welcome-icon {
  font-size: 44px;
  flex-shrink: 0;
}

.apple-welcome-content {
  flex: 1;
}

.apple-welcome-title {
  font-size: 24px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.apple-welcome-desc {
  font-size: 14px;
  color: #86868b;
  margin: 0;
}

.apple-welcome-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.apple-welcome-btn {
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid #d1d1d6;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.2s;
}

.apple-welcome-btn:hover {
  background: #007AFF;
  color: white;
  border-color: #007AFF;
}

.apple-welcome-btn.primary {
  background: #007AFF;
  color: white;
  border-color: #007AFF;
}

.apple-welcome-btn.primary:hover {
  background: #0066CC;
}

/* ===== Apple-Style Entry Card (No Color Blocks) ===== */
.apple-entry-card {
  background: white;
  border-radius: 24px;
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}

.apple-entry-card:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.apple-entry-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.apple-entry-content {
  flex: 1;
}

.apple-entry-title {
  font-size: 18px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 4px;
}

.apple-entry-desc {
  font-size: 13px;
  color: #86868b;
  margin: 0;
}

.apple-entry-arrow {
  font-size: 18px;
  color: #c7c7cc;
  flex-shrink: 0;
}

/* ===== Ranking Podium Styles (Top 3) ===== */
.ranking-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 32px;
  padding: 20px 0;
}

.ranking-podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.3s;
}

.ranking-podium-item:hover {
  transform: translateY(-4px);
}

.ranking-podium-silver {
  order: 1;
}

.ranking-podium-gold {
  order: 2;
  transform: translateY(-20px);
}

.ranking-podium-gold:hover {
  transform: translateY(-24px);
}

.ranking-podium-bronze {
  order: 3;
}

.ranking-podium-crown {
  font-size: 28px;
  margin-bottom: -6px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.ranking-podium-gold .ranking-podium-crown {
  font-size: 36px;
  animation: crownGlow 2s ease-in-out infinite;
}

@keyframes crownGlow {
  0%, 100% { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15)); }
  50% { filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.6)); }
}

.ranking-podium-avatar-wrap {
  position: relative;
  margin-bottom: 8px;
}

.ranking-podium-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  color: #1d1d1f;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 3px solid white;
  overflow: hidden;
}

.ranking-podium-gold .ranking-podium-avatar {
  width: 88px;
  height: 88px;
  font-size: 32px;
  border-color: #FFD700;
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4);
}

.ranking-podium-silver .ranking-podium-avatar {
  border-color: #C0C0C0;
  box-shadow: 0 6px 24px rgba(192, 192, 192, 0.35);
}

.ranking-podium-bronze .ranking-podium-avatar {
  border-color: #CD7F32;
  box-shadow: 0 6px 24px rgba(205, 127, 50, 0.35);
}

.ranking-podium-rank-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  border: 2px solid white;
}

.ranking-podium-gold .ranking-podium-rank-badge {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.ranking-podium-silver .ranking-podium-rank-badge {
  background: linear-gradient(135deg, #D8D8D8, #A8A8A8);
}

.ranking-podium-bronze .ranking-podium-rank-badge {
  background: linear-gradient(135deg, #DEB887, #B87333);
}

.ranking-podium-name {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin-top: 6px;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-podium-score {
  font-size: 13px;
  color: #86868b;
  margin-top: 2px;
}

.ranking-podium-bar {
  width: 100px;
  height: 12px;
  border-radius: 6px;
  margin-top: 24px;
}

.ranking-podium-gold .ranking-podium-bar {
  height: 80px;
  width: 120px;
  background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.35);
  border-radius: 8px 8px 0 0;
}

.ranking-podium-silver .ranking-podium-bar {
  height: 60px;
  width: 100px;
  background: linear-gradient(180deg, #D8D8D8 0%, #A8A8A8 100%);
  box-shadow: 0 4px 12px rgba(192, 192, 192, 0.3);
  border-radius: 8px 8px 0 0;
}

.ranking-podium-bronze .ranking-podium-bar {
  height: 40px;
  width: 100px;
  background: linear-gradient(180deg, #DEB887 0%, #B87333 100%);
  box-shadow: 0 4px 12px rgba(205, 127, 50, 0.3);
  border-radius: 8px 8px 0 0;
}

.ranking-podium-empty {
  text-align: center;
  padding: 20px;
  color: #c7c7cc;
}

/* ===== Ranking Full Table ===== */
.ranking-full-section {
  margin-top: 32px;
}

.ranking-full-title {
  font-size: 18px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 16px;
  padding-left: 4px;
}

.ranking-full-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.ranking-full-table thead {
  background: #f5f5f7;
}

.ranking-full-table th {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #86868b;
  text-align: left;
}

.ranking-full-table th:last-child {
  text-align: center;
}

.ranking-full-table td {
  padding: 14px 20px;
  font-size: 14px;
  color: #1d1d1f;
  border-top: 1px solid #f0f0f3;
}

.ranking-full-table td:last-child {
  text-align: center;
}

.ranking-full-table tbody tr:hover {
  background: #fafafa;
}

.ranking-full-table .rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f0f0f3;
  color: #86868b;
  font-weight: 600;
  font-size: 13px;
}

.ranking-full-table .rank-badge.rank-1 {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: white;
}

.ranking-full-table .rank-badge.rank-2 {
  background: linear-gradient(135deg, #D8D8D8, #A8A8A8);
  color: white;
}

.ranking-full-table .rank-badge.rank-3 {
  background: linear-gradient(135deg, #DEB887, #B87333);
  color: white;
}

.ranking-full-table .rank-name {
  font-weight: 500;
}

.ranking-full-table .rank-name a,
.rank-name-link {
  color: #1d1d1f;
  text-decoration: none;
  cursor: pointer;
}

.ranking-full-table .rank-name a:hover,
.rank-name-link:hover {
  color: #0071e3;
  text-decoration: underline;
}

.ranking-podium-name.clickable {
  cursor: pointer;
}

.ranking-podium-name.clickable:hover {
  color: #0071e3;
  text-decoration: underline;
}

.ranking-full-table .rank-score {
  color: #1d1d1f;
  font-weight: 600;
}

.ranking-full-table .rank-action {
  display: inline-flex;
  gap: 8px;
}

.ranking-full-table .btn-rank-action {
  padding: 6px 16px;
  font-size: 13px;
  border-radius: 20px;
  border: 1px solid #e0e0e3;
  background: white;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.2s;
}

.ranking-full-table .btn-rank-action:hover {
  background: #f5f5f7;
  border-color: #d1d1d6;
}

.ranking-full-table .btn-rank-action.primary {
  background: linear-gradient(135deg, #007AFF, #0066CC);
  color: white;
  border-color: transparent;
}

.ranking-full-table .btn-rank-action.primary:hover {
  opacity: 0.9;
}

.ranking-full-empty {
  text-align: center;
  padding: 40px 20px;
  color: #86868b;
}

/* ===== Ranking Range Switch (月榜/总榜切换) ===== */
.ranking-range-switch {
  display: inline-flex;
  background: #f0f0f3;
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}

.ranking-range-switch .range-btn {
  border: none;
  background: transparent;
  padding: 6px 18px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 500;
  color: #86868b;
  cursor: pointer;
  transition: all 0.2s;
}

.ranking-range-switch .range-btn:hover {
  color: #1d1d1f;
}

.ranking-range-switch .range-btn.active {
  background: white;
  color: #1d1d1f;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

/* ===== Teacher Stats Card (Apple Style) ===== */
.teacher-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ===== Apple-Style Section ===== */
.apple-section-title {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 16px;
  letter-spacing: -0.3px;
}

.apple-surface {
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ===== Teacher-only Stat Cards (clean, no color) ===== */
.teacher-stats-only {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .teacher-stats-only {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 移动端侧边栏改为抽屉式，默认隐藏在屏幕外 */
  .apple-sidebar {
    width: 82%;
    max-width: 300px;
    top: 56px;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 1200;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .apple-sidebar.open {
    width: 82% !important;
    max-width: 300px !important;
    transform: translateX(0) !important;
    overflow-y: auto !important;
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.18);
  }

  /* 移动端隐藏桌面用的侧栏收起小条，改用顶部汉堡按钮 */
  .apple-sidebar-toggle {
    display: none;
  }

  .apple-main {
    margin-left: 0;
  }

  /* 移动端显示汉堡菜单按钮 */
  .mobile-menu-toggle {
    display: flex;
  }

  /* 侧栏菜单项触摸区域放大，便于手指点击 */
  .apple-sidebar {
    padding-top: 16px;
  }
  .apple-sidebar-item {
    min-height: 44px;
    font-size: 15px;
    padding: 10px 12px;
  }
  .apple-sidebar-title {
    margin-top: 8px;
  }

  /* 弹窗在手机上内边距紧凑、圆角舒适 */
  .modal-content {
    padding: 16px;
    border-radius: 16px;
    max-height: 88vh;
    overflow-y: auto;
  }
  .modal-header h3 {
    font-size: 18px;
  }
  .form-group label {
    font-size: 13px;
  }
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px;
    padding: 12px;
  }

  /* profile / resources 等页面的固定侧栏，手机上改为内容流顶部，避免遮挡 */
  .sidebar {
    position: static;
    width: auto;
    top: auto;
    left: auto;
    bottom: auto;
    margin: 12px 12px 0;
    border-radius: 16px;
    max-height: none;
  }
  .dashboard .container > div[style*="display: flex"] {
    flex-direction: column !important;
  }

  /* 通用页头导航在手机上允许换行 */
  header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  header .container {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ranking-podium {
    gap: 12px;
  }

  .ranking-podium-gold {
    transform: translateY(-12px);
  }

  .ranking-podium-avatar {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }

  .ranking-podium-gold .ranking-podium-avatar {
    width: 64px;
    height: 64px;
    font-size: 22px;
  }
}

/* Knowledge Panel Layout */
.knowledge-layout {
  min-height: calc(100vh - 200px);
}

.knowledge-content {
  width: 100%;
}

@media (max-width: 768px) {
  .knowledge-layout {
    flex-direction: column;
  }
}

/* ===== Hero Header (标题区域) ===== */

.hero-header {
  padding: 60px 60px 48px;
  margin-bottom: 8px;
  position: relative;
  text-align: center;
}

.hero-title-group {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  min-height: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
}

.hero-title {
  font-size: 60px;
  font-weight: 900;
  background: #1d1d1f;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1.5px;
  margin: 0;
  line-height: 1.1;
  position: static;
  filter: drop-shadow(0 5px 14px rgba(168, 85, 247, 0.18));
  white-space: nowrap;
}

.hero-title-sub {
  font-size: 60px;
  font-weight: 900;
  color: #1d1d1f;
  -webkit-text-fill-color: #1d1d1f;
  background: none;
  letter-spacing: 0.3px;
  position: static;
  white-space: nowrap;
  margin-left: 16px;
  line-height: 1.1;
}

.hero-subtitle {
  max-width: 760px;
  margin: 16px auto 0;
  font-size: 16px;
  color: #86868b;
  text-align: center;
  padding-left: 0;
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* ===== Feature Cards Grid ===== */
.feature-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
  padding: 0;
}

@media (max-width: 1024px) {
  .feature-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== 平板适配 (769px - 1024px) =====
   平板保留桌面侧边栏（固定 220px）与 JS 行为，仅将多列网格收为两列，
   避免 4 列图表/卡片挤在一起，并保证内容不横向溢出。 */
@media (min-width: 769px) and (max-width: 1024px) {
  /* 首页图表网格：平板双列 */
  .dashboard .main-content div[style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .dashboard .main-content div[style*="grid-template-columns: repeat(4"] .stat-card {
    min-height: 240px;
  }
  .dashboard .main-content div[style*="grid-template-columns: repeat(4"] canvas {
    max-width: 100%;
  }

  /* 教师统计卡片：平板双列 */
  .teacher-stats-only {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* 顶部统计卡：自适应（dashboard-grid 已是 auto-fit，无需强制） */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* 防止任何内容横向溢出 */
  .dashboard .main-content {
    overflow-x: hidden;
  }

  /* 顶部统计卡字号微调，避免拥挤 */
  .stat-card .stat-value,
  .apple-stat-value {
    font-size: 30px;
  }
}

@media (max-width: 640px) {
  .feature-cards-grid {
    grid-template-columns: 1fr;
  }

  .hero-header {
    padding: 32px 24px 28px;
  }

  .hero-title-group {
    min-height: auto;
    max-width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .hero-title {
    font-size: 32px;
    left: 0;
    top: 0;
  }

  .hero-title-sub {
    font-size: 28px;
    left: 0;
    top: 0;
    margin-left: 0;
  }

  .hero-subtitle {
    font-size: 14px;
    margin-top: 12px;
  }

  .hero-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
}

/* ===== Feature Card (白色卡片) ===== */
.feature-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #007AFF 0%, #5856D6 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 122, 255, 0.15);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: #f5f5f7;
  flex-shrink: 0;
}

/* 图标背景色变体（淡色，非纯色块） */
.feature-icon-blue {
  background: rgba(0, 122, 255, 0.08);
}

.feature-icon-green {
  background: rgba(48, 209, 88, 0.08);
}

.feature-icon-orange {
  background: rgba(255, 149, 0, 0.08);
}

.feature-icon-purple {
  background: rgba(88, 86, 214, 0.08);
}

.feature-icon-pink {
  background: rgba(255, 45, 85, 0.08);
}

.feature-icon-teal {
  background: rgba(0, 199, 190, 0.08);
}

.feature-card-content {
  flex: 1;
  width: 100%;
}

.feature-card-title {
  font-size: 18px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 8px 0;
  letter-spacing: -0.2px;
}

.feature-card-desc {
  font-size: 14px;
  color: #86868b;
  line-height: 1.5;
  margin: 0;
}

.feature-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 12px;
  background: white;
  border: 1px solid #d1d1d6;
  color: #1d1d1f;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: fit-content;
}

.feature-card:hover .feature-card-btn {
  background: #007AFF;
  color: white;
  border-color: #007AFF;
}

.feature-card-btn:hover {
  background: #0066CC !important;
  border-color: #0066CC !important;
  color: white !important;
}

/* ===== 树洞（匿名吐槽）样式 - Apple 风格 ===== */
.treehole-header {
  margin-bottom: 24px;
}

.treehole-subtitle {
  margin: 8px 0 0 0;
  color: #86868b;
  font-size: 14px;
}

.treehole-composer {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.treehole-input {
  width: 100%;
  min-height: 90px;
  padding: 14px 16px;
  border: 1px solid #e0e0e3;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  background: rgba(255, 255, 255, 0.85);
  color: #1d1d1f;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.treehole-input:focus {
  outline: none;
  border-color: #007AFF;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.treehole-composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.treehole-counter {
  font-size: 12px;
  color: #86868b;
}

.treehole-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.treehole-card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.treehole-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.06);
}

.treehole-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.treehole-anon {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
}

.treehole-time {
  font-size: 12px;
  color: #86868b;
}

.treehole-content {
  font-size: 15px;
  line-height: 1.6;
  color: #1d1d1f;
  white-space: pre-wrap;
  word-break: break-word;
}

.treehole-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}

.treehole-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: #424245;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.treehole-action-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.treehole-action-btn.liked {
  color: #FF3B30;
  border-color: rgba(255, 59, 48, 0.2);
  background: rgba(255, 59, 48, 0.06);
}

.treehole-delete-btn {
  margin-left: auto;
  color: #86868b;
  font-size: 12px;
}

.treehole-delete-btn:hover {
  color: #FF3B30;
  background: rgba(255, 59, 48, 0.06);
}

.treehole-comments {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.treehole-comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.treehole-comment {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 12px;
  padding: 10px 14px;
}

.treehole-comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.treehole-comment-content {
  font-size: 14px;
  line-height: 1.5;
  color: #1d1d1f;
  white-space: pre-wrap;
  word-break: break-word;
}

.treehole-reply-to {
  display: inline-block;
  font-size: 12px;
  color: #007AFF;
  margin-bottom: 4px;
  font-weight: 500;
}

.treehole-comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.treehole-reply-btn {
  font-size: 12px;
  color: #86868b;
}

.treehole-reply-btn:hover {
  color: #007AFF;
  background: rgba(0, 122, 255, 0.06);
}

.treehole-comment-delete-btn {
  color: #86868b;
  font-size: 12px;
}

.treehole-comment-delete-btn:hover {
  color: #FF3B30;
  background: rgba(255, 59, 48, 0.06);
}

.treehole-reply-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.treehole-comment-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.treehole-comment-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e0e0e3;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.85);
  color: #1d1d1f;
  font-family: inherit;
}

.treehole-comment-input:focus {
  outline: none;
  border-color: #007AFF;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.treehole-empty {
  text-align: center;
  padding: 40px 20px;
  color: #86868b;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.treehole-load-more {
  text-align: center;
  margin-top: 24px;
}

@media (max-width: 640px) {
  .treehole-composer,
  .treehole-card {
    padding: 14px;
    border-radius: 14px;
  }
  .treehole-content {
    font-size: 14px;
  }
  .treehole-card-header {
    flex-wrap: wrap;
    gap: 4px;
  }
  .treehole-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  .treehole-action-btn {
    padding: 5px 10px;
    font-size: 12px;
  }
  .treehole-comment-form {
    flex-wrap: wrap;
  }
  .treehole-comment-input {
    width: 100%;
    flex: 1 1 100%;
  }
  .treehole-reply-form {
    flex-wrap: wrap;
  }
  .treehole-reply-form .treehole-reply-input {
    width: 100%;
    flex: 1 1 100%;
    margin-bottom: 4px;
  }
  .treehole-input {
    font-size: 14px;
    min-height: 80px;
  }
  .treehole-header h2 {
    font-size: 22px;
  }
  .treehole-subtitle {
    font-size: 13px;
  }
  .treehole-composer-footer {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ===== 全面移动端适配修复 ===== */
@media (max-width: 768px) {
  /* 首页图表网格：手机端单列，让图表有足够空间 */
  .dashboard .main-content div[style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr !important;
  }
  .dashboard .main-content div[style*="grid-template-columns: repeat(4"] .stat-card {
    min-height: 220px;
  }
  .dashboard .main-content div[style*="grid-template-columns: repeat(4"] canvas {
    max-height: 200px;
  }

  /* 私信面板：左右分栏改为上下布局 */
  #panel-messages > div[style*="display: flex; gap: 20px; height:"] {
    flex-direction: column !important;
    height: auto !important;
    gap: 12px !important;
  }
  #conversation-list {
    width: 100% !important;
    max-height: 200px;
    border-right: none !important;
    border-bottom: 1px solid #e0e0e0;
  }
  #panel-messages > div[style*="display: flex; gap: 20px;"] > div:last-child {
    min-height: 400px;
  }

  /* 搜索输入框：固定宽度改为自适应 */
  input[id="search-student-id"],
  input[id="user-search"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* 班级管理/用户管理操作栏：flex-wrap */
  #panel-department-admin > div[style*="display: flex; gap: 12px;"],
  #panel-user-admin > div[style*="display: flex; gap: 12px;"] {
    flex-wrap: wrap;
  }

  /* 排行榜选择器：移除固定最小宽度 */
  select[style*="min-width: 200px"] {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* 资源卡片操作按钮：不溢出 */
  .resource-card-actions,
  .resource-meta {
    flex-wrap: wrap;
  }

  /* 聊天输入框：宽度自适应 */
  #chat-panel-input {
    width: calc(100% - 70px) !important;
  }

  /* 弹窗内表单元素宽度自适应 */
  .modal input,
  .modal textarea,
  .modal select {
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* 首页 hero 区域 */
  .hero-header {
    padding: 24px 16px 20px !important;
  }
  .hero-title {
    font-size: 32px !important;
  }
  .hero-title-sub {
    font-size: 32px !important;
  }

  /* 统计卡片值字号缩小 */
  .stat-card .stat-value,
  .apple-stat-value {
    font-size: 24px;
  }

  /* 部门卡片网格：单列 */
  .dept-card-list {
    grid-template-columns: 1fr !important;
  }

  /* 防止任何元素超出屏幕 */
  .dashboard .main-content {
    overflow-x: hidden;
  }

  /* canvas 图表不溢出 */
  canvas {
    max-width: 100% !important;
    height: auto !important;
  }

  /* 积分记录等表格字体缩小 */
  table td,
  table th {
    font-size: 13px;
    padding: 6px 8px;
  }
}

@media (max-width: 480px) {
  /* 超小屏幕：图表网格改1列 */
  .dashboard .main-content div[style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr !important;
  }

  /* 首页标题更小 */
  .hero-title {
    font-size: 26px !important;
  }
  .hero-title-sub {
    font-size: 26px !important;
  }

  /* 统计卡片单列 */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
  .teacher-stats-only {
    grid-template-columns: 1fr !important;
  }
}

/* ===== Custom Chapter Dropdown (科目 > 章节 两级) ===== */
.custom-chapter-dropdown {
  position: relative;
  display: inline-block;
  min-width: 160px;
  flex-shrink: 0;
}

.custom-chapter-trigger {
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  transition: border-color 0.2s;
}

.custom-chapter-trigger:hover {
  border-color: #007AFF;
}

.custom-chapter-dropdown.open .custom-chapter-trigger {
  border-color: #007AFF;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.custom-chapter-trigger .arrow {
  font-size: 11px;
  color: #86868b;
  transition: transform 0.2s;
}

.custom-chapter-dropdown.open .custom-chapter-trigger .arrow {
  transform: rotate(180deg);
}

.custom-chapter-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-height: 360px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 100;
  padding: 6px 0;
}

.custom-chapter-item,
.custom-chapter-subject {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-chapter-item:hover,
.custom-chapter-subject:hover {
  background: #f5f5f7;
  color: #007AFF;
}

.custom-chapter-subject {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 500;
  color: #1d1d1f;
}

.custom-chapter-subject .arrow {
  font-size: 11px;
  color: #86868b;
  transition: transform 0.2s;
}

.custom-chapter-subject.open .arrow {
  transform: rotate(90deg);
}

.custom-chapter-children {
  background: #fafafa;
  border-left: 2px solid #e0e0e0;
  margin-left: 14px;
}

.custom-chapter-children .custom-chapter-item {
  padding-left: 18px;
  font-size: 13px;
  color: #424245;
}

.custom-chapter-children .custom-chapter-item:hover {
  background: #f0f0f3;
  color: #007AFF;
}

@media (max-width: 768px) {
  .search-bar .custom-chapter-dropdown {
    width: 100%;
    box-sizing: border-box;
  }

  .custom-chapter-menu {
    left: 0;
    right: 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
}

/* ===== 资源中心：章节卡片网格 ===== */
.chapter-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.chapter-empty-tip {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: #86868b;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  border: 1px dashed #e0e0e0;
}

.chapter-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}

.chapter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: #007AFF;
}

.chapter-card.active {
  border-color: #007AFF;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12), 0 8px 24px rgba(0, 122, 255, 0.1);
}

.chapter-card-number {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.chapter-card-info {
  flex: 1;
  min-width: 0;
}

.chapter-card-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 6px 0;
  padding-right: 86px;
  line-height: 1.35;
  word-break: break-word;
}

.chapter-card-info p {
  font-size: 13px;
  color: #86868b;
  margin: 0 0 10px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chapter-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #86868b;
  flex-wrap: wrap;
}

.chapter-card-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.chapter-card-add {
  background: linear-gradient(135deg, #f5f9ff 0%, #eef4ff 100%);
  border: 2px dashed #007AFF;
  box-shadow: none;
}

.chapter-card-add:hover {
  background: linear-gradient(135deg, #eef6ff 0%, #e4efff 100%);
  border-color: #0056b3;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.12);
}

.chapter-card-number-add {
  background: #ffffff;
  color: #007AFF;
  border: 2px solid #007AFF;
  font-size: 22px;
  font-weight: 300;
}

.chapter-card-add-green {
  background: linear-gradient(135deg, #f0fff4 0%, #e6ffed 100%);
  border: 2px dashed #34C759;
}

.chapter-card-add-green:hover {
  background: linear-gradient(135deg, #e6ffed 0%, #d9ffe6 100%);
  border-color: #248a3d;
  box-shadow: 0 8px 24px rgba(52, 199, 89, 0.12);
}

.chapter-card-add-green .chapter-card-number-add {
  color: #34C759;
  border-color: #34C759;
}

/* ===== 资源中心：教师问题列表 ===== */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-empty {
  padding: 24px;
  text-align: center;
  color: #86868b;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  border: 1px dashed #e0e0e0;
}

.question-item {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.question-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border-color: #007AFF;
}

.question-index {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.question-body {
  flex: 1;
  min-width: 0;
}

.question-body h4 {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 6px 0;
}

.question-body p {
  font-size: 13px;
  color: #666;
  margin: 0 0 8px 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.question-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #86868b;
  flex-wrap: wrap;
}

/* ===== 小按钮补充 ===== */
.btn-xs {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-danger {
  color: #fff;
  background: #ff4d4f;
  border: 1px solid #ff4d4f;
}

.btn-danger:hover {
  background: #ff7875;
  border-color: #ff7875;
}

@media (max-width: 768px) {
  .chapter-cards-grid {
    grid-template-columns: 1fr;
  }

  .chapter-card-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== 班级科目选择下拉放大 ===== */
#qa-class-select {
  padding: 10px 14px;
  font-size: 14px;
  height: 40px;
  line-height: 1.4;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background-color: #ffffff;
  color: #1d1d1f;
  min-width: 160px;
  max-width: 280px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#qa-class-select:focus {
  border-color: #007AFF;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

/* 回收站 */
.trash-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
}
.trash-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.trash-info {
  flex: 1;
  min-width: 0;
}
.trash-title {
  font-weight: 600;
  font-size: 15px;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trash-meta {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}
.trash-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.recycle-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.recycle-filters {
  display: flex;
  gap: 8px;
}
.recycle-filter {
  padding: 6px 14px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
}
.recycle-filter.active {
  background: #4a6cf7;
  color: #fff;
  border-color: #4a6cf7;
}

/* 章节下拉选择 */
.chapter-select-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  /* 在 .chapter-cards-grid 容器中占满整行，避免被 grid 父级挤压成单列宽度后按钮纵向堆叠 */
  grid-column: 1 / -1;
  width: 100%;
}
/* 同一排放置：下拉不再无限撑满，给返回/发布/新建等按钮留出横向空间 */
.chapter-select-row .chapter-select {
  flex: 0 1 320px;
  max-width: 320px;
}
.chapter-select {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
  padding: 9px 14px;
  font-size: 14px;
  height: 40px;
  line-height: 1.4;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background-color: #ffffff;
  color: #1d1d1f;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chapter-select:focus {
  border-color: #007AFF;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}
.chapter-select option {
  color: #1d1d1f;
  font-size: 14px;
}
/* 多选班级复选框列表（新建科目 / 新建章节弹窗） */
.class-checkbox-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px 12px;
}
.class-checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #1d1d1f;
  cursor: pointer;
  line-height: 1.4;
  padding: 2px 0;
}
.class-checkbox-input {
  width: 16px;
  height: 16px;
  accent-color: #007AFF;
  cursor: pointer;
  flex: 0 0 auto;
}
.class-checkbox-empty {
  font-size: 13px;
  color: #8a8a8e;
  padding: 4px 2px;
}
.class-checkbox-hint {
  font-size: 12px;
  color: #8a8a8e;
  margin-top: 4px;
}

/* ===== 资源视图切换（卡片 / 列表） ===== */
.resource-view-switch {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.resource-view-switch .rv-btn {
  padding: 6px 16px;
  font-size: 13px;
  line-height: 1.4;
  border: 1px solid #d1d1d6;
  border-radius: 8px;
  background: #fff;
  color: #515154;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.resource-view-switch .rv-btn:hover {
  background: #f5f5f7;
  border-color: #b8b8bd;
}
.resource-view-switch .rv-btn.active {
  background: #0071e3;
  border-color: #0071e3;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,113,227,0.25);
}
.resource-view-switch .rv-btn.active:hover {
  background: #0066cc;
  border-color: #0066cc;
}

/* ===== 资源分页控件（卡片/列表切换共有） ===== */
.resource-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #f0f0f2;
}
.resource-pager .rp-info {
  font-size: 13px;
  color: #8a8a8e;
}
.resource-pager .rp-btns {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.resource-pager .rp-btn {
  min-width: 34px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  border: 1px solid #d1d1d6;
  border-radius: 8px;
  background: #fff;
  color: #515154;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.resource-pager .rp-btn:hover:not(:disabled) {
  background: #f5f5f7;
  border-color: #b8b8bd;
}
.resource-pager .rp-btn.active {
  background: #0071e3;
  border-color: #0071e3;
  color: #fff;
}
.resource-pager .rp-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.resource-pager .rp-ellipsis {
  padding: 0 4px;
  color: #8a8a8e;
}

/* ===== 资源列表表格模式 ===== */
.resource-table-wrap {
  grid-column: 1 / -1;
  overflow-x: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.resource-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 820px;
}
.resource-table th,
.resource-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0f2;
  white-space: nowrap;
}
.resource-table thead th {
  background: #f5f5f7;
  color: #515154;
  font-weight: 600;
}
.resource-table tbody tr {
  cursor: pointer;
  transition: background .15s;
}
.resource-table tbody tr:hover {
  background: #f0f6ff;
}
.resource-table .rt-title {
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  font-weight: 600;
  color: #1d1d1f;
}

.resource-table .rt-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resource-table .rt-num {
  text-align: center;
  color: #515154;
}
.resource-table .rt-author {
  color: #0071e3;
}
.rt-badge {
  display: inline-block;
  margin-left: 0;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: #fff;
  vertical-align: middle;
  flex-shrink: 0;
  white-space: nowrap;
}
.rt-badge.rt-manual { background: #d32f2f; }
.rt-badge.rt-auto { background: #ff9800; }
.rt-badge.rt-hot { background: #e8541e; }
.rt-badge.rt-high { background: #2a9d8f; }
.rt-ops {
  white-space: nowrap;
}
.resource-table .rt-del-col,
.resource-table .rt-rec-col {
  text-align: center;
  width: 60px;
}
.rt-btn {
  display: inline-block;
  margin: 0 2px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #d1d1d6;
  border-radius: 6px;
  background: #fff;
  color: #515154;
  cursor: pointer;
  white-space: nowrap;
}
.rt-btn:hover { background: #f5f5f7; }
.rt-btn.rt-on { background: #0071e3; border-color: #0071e3; color: #fff; }
.rt-btn.rt-del { color: #d32f2f; border-color: #f0c0c0; }
.rt-btn.rt-del:hover { background: #fdecec; }

/* 宽表格横向滚动容器（手机端兜底，防止布局撑破） */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 成员列表手机端卡片化 */
@media (max-width: 768px) {
  .table.member-table,
  .table.member-table tbody,
  .table.member-table tr,
  .table.member-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .table.member-table thead { display: none; }
  .table.member-table tr {
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 4px 2px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }
  .table.member-table td {
    border: none;
    border-bottom: 1px dashed #f0f0f0;
    padding: 9px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: right;
  }
  .table.member-table td:last-child { border-bottom: none; }
  .table.member-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #888;
    font-size: 13px;
    text-align: left;
    flex: 0 0 auto;
    margin-right: auto;
  }
  .table.member-table td.col-check {
    justify-content: flex-start;
  }
  .table.member-table td.col-check::before { content: '选择'; }
  .table.member-table td.col-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .table.member-table td.col-actions::before { content: '操作'; }
  .table.member-table td.col-actions .btn {
    width: 100%;
    margin: 4px 0;
  }
}

/* ===== 功能说明 ❓ 图标与气泡 ===== */
.panel-help-bar {
  display: flex;
  justify-content: flex-end;
  padding: 2px 2px 0;
}
.help-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: help;
  font-size: 15px;
  line-height: 1;
  user-select: none;
  outline: none;
  background: rgba(0, 0, 0, 0.04);
  transition: background .15s;
}
.help-icon:hover,
.help-icon.active {
  background: rgba(102, 126, 234, 0.15);
}
.help-tip {
  display: none;
  position: absolute;
  top: 32px;
  right: 0;
  z-index: 9999;
  width: 300px;
  max-width: 82vw;
  background: #1f2330;
  color: #fff;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
  text-align: left;
  white-space: normal;
  word-break: break-word;
}
.help-tip::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 9px;
  border: 6px solid transparent;
  border-bottom-color: #1f2330;
  border-top: 0;
}
.help-icon:hover .help-tip,
.help-icon:focus .help-tip,
.help-icon.active .help-tip {
  display: block;
}

/* ===== 打分智能体·使用说明弹窗 ===== */
.scoring-agent-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  align-items: center;
  justify-content: center;
  background: rgba(15, 18, 30, 0.55);
  padding: 18px;
}
.scoring-agent-modal.open {
  display: flex;
}
.scoring-agent-card {
  width: 440px;
  max-width: 92vw;
  background: #fff;
  border-radius: 16px;
  padding: 26px 26px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  animation: saPop .18s ease-out;
}
@keyframes saPop {
  from { transform: translateY(8px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.scoring-agent-card h3 {
  margin: 0 0 14px;
  font-size: 18px;
  color: #1f2330;
  display: flex;
  align-items: center;
  gap: 8px;
}
.scoring-agent-card h3 .sa-emoji {
  font-size: 20px;
}
.scoring-agent-body {
  font-size: 14.5px;
  line-height: 1.9;
  color: #3a3f4b;
  margin-bottom: 20px;
}
/* 重点标注：易混字符已规避，强调色 + 阴影底 */
.scoring-agent-body .sa-hl {
  color: #d9480f;
  font-weight: 700;
  background: linear-gradient(transparent 62%, rgba(255, 196, 140, 0.55) 62%);
  padding: 0 1px;
  border-radius: 2px;
}
.scoring-agent-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}
.scoring-agent-btn {
  border: none;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  transition: transform .12s, box-shadow .15s, background .15s;
}
.scoring-agent-btn.primary {
  background: #007aff;
  color: #fff;
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
}
.scoring-agent-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(102, 126, 234, 0.45);
}
.scoring-agent-btn.ghost {
  background: rgba(0, 0, 0, 0.04);
  color: #5a6072;
}
.scoring-agent-btn.ghost:hover {
  background: rgba(0, 0, 0, 0.08);
}
@media (max-width: 480px) {
  .scoring-agent-card { padding: 22px 18px 18px; }
  .scoring-agent-actions { flex-direction: column-reverse; }
  .scoring-agent-btn { width: 100%; }
}

/* ================= 私信页面（页面化 + 文件消息 + 跨班申请） ================= */
.messages-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 180px);
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.messages-sidebar {
  width: 300px;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  background: #fafbfc;
}
.messages-tabs {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
}
.messages-tabs button {
  flex: 1;
  padding: 12px;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  transition: background .2s;
}
.messages-tabs button.active {
  background: #fff;
  color: #007aff;
  font-weight: 600;
  border-bottom: 2px solid #007aff;
}
.messages-list {
  flex: 1;
  overflow-y: auto;
}
.messages-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.messages-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}
.messages-retention-note {
  margin: 0 0 16px 0;
  padding: 8px 12px;
  background: #fff8e6;
  border: 1px solid #ffe2a8;
  border-radius: 8px;
  color: #8a6d00;
  font-size: 13px;
  line-height: 1.5;
}
.chat-retention-banner {
  padding: 8px 14px;
  background: #fff8e6;
  border-bottom: 1px solid #ffe2a8;
  color: #8a6d00;
  font-size: 12.5px;
  line-height: 1.5;
}
#chat-panel-content {
  height: 100%;
}
#chat-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #007aff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}
#chat-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f9f9f9;
}
#chat-panel-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
}
#chat-panel-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}
#chat-request-banner {
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  background: #fffbeb;
}
.chat-banner-tip {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-banner-tip p {
  margin: 0;
  font-size: 13px;
  color: #92400e;
}
.conversation-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background .2s;
}
.conversation-item:hover { background: #f5f5f5; }
.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #007aff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.conversation-body {
  flex: 1;
  min-width: 0;
}
.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.conversation-header strong {
  font-size: 14px;
}
.conversation-time {
  font-size: 11px;
  color: #999;
}
.conversation-preview {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-unread {
  background: #e74c3c;
  color: #fff;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  margin-left: 8px;
  flex-shrink: 0;
}
.chat-request-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.chat-request-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chat-request-dir {
  font-size: 12px;
  color: #888;
}
.chat-request-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}
.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }
.chat-request-time {
  font-size: 11px;
  color: #999;
  margin-left: auto;
}
.chat-request-actions {
  display: flex;
  gap: 8px;
}

/* 消息气泡与文件渲染 */
.msg-row {
  margin-bottom: 16px;
  display: flex;
}
.msg-me { justify-content: flex-end; }
.msg-other { justify-content: flex-start; }
.msg-bubble {
  max-width: 60%;
  padding: 12px 16px;
  border-radius: 12px;
}
.msg-bubble-me {
  background: #007aff;
  color: #fff;
}
.msg-bubble-other {
  background: #fff;
  border: 1px solid #e0e0e0;
  color: #333;
}
.msg-time {
  margin: 4px 0 0 0;
  font-size: 12px;
}
.msg-time-me { color: rgba(255,255,255,0.75); }
.msg-time-other { color: #999; }
.msg-image {
  max-width: 240px;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
}
.msg-video {
  max-width: 320px;
  max-height: 240px;
  border-radius: 8px;
  display: block;
}
.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,0.04);
  text-decoration: none;
  color: inherit;
  max-width: 300px;
}
.msg-file:hover { background: rgba(0,0,0,0.08); }
.msg-file-icon { font-size: 22px; }
.msg-file-info { min-width: 0; }
.msg-file-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-file-size {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.msg-caption {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.4;
}
.msg-bubble-me .msg-file { background: rgba(255,255,255,0.18); color: #fff; }
.msg-bubble-me .msg-file-size { color: rgba(255,255,255,0.75); }

@media (max-width: 768px) {
  .messages-layout { flex-direction: column; height: calc(100vh - 140px); }
  .messages-sidebar { width: 100%; height: 40%; border-right: none; border-bottom: 1px solid #e0e0e0; }
  .messages-main { height: 60%; }
  .msg-bubble { max-width: 80%; }
  .msg-image, .msg-video { max-width: 100%; }
}

/* ===== 思维火花：教师提醒横幅 + 章节联网知识库 ===== */
.teacher-hint {
  background: #fff8e6;
  border: 1px solid #ffe2a8;
  color: #7a5b00;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0 0 16px 0;
  font-size: 13px;
  line-height: 1.6;
}
.teacher-hint b { color: #a35a00; }

.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.knowledge-item {
  border: 1px solid #e6e6ea;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafafe;
}
.knowledge-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.knowledge-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}
.knowledge-badge.knowledge-wikipedia { background: #5b6b7b; }
.knowledge-badge.knowledge-resource { background: #0071e3; }
.knowledge-badge.knowledge-search { background: #34a853; }
.knowledge-title { font-weight: 600; color: #1d1d1f; font-size: 13px; }
.knowledge-item-content {
  font-size: 12px;
  color: #515154;
  line-height: 1.6;
  max-height: 80px;
  overflow: hidden;
}
#chapter-fetch-btn:disabled { opacity: .6; cursor: default; }


/* === 个人中心明细分页条 === */
.detail-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.detail-pager .pager-info { font-size: 13px; color: #86868b; white-space: nowrap; }
.detail-pager .btn[disabled] { opacity: .45; cursor: default; }

/* === 从其他班级导入：科目选择卡片网格 === */
.import-subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  padding: 12px;
  background: #f9f9fb;
  border-radius: 12px;
}
.import-subject-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid #e5e5e7;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
  text-align: center;
}
.import-subject-card:hover {
  border-color: #0071e3;
  box-shadow: 0 2px 8px rgba(0,113,227,0.08);
}
.import-subject-card.selected {
  border-color: #0071e3;
  background: #f0f7ff;
  box-shadow: 0 2px 8px rgba(0,113,227,0.12);
}
.import-subject-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  accent-color: #0071e3;
  cursor: pointer;
}
.import-subject-icon {
  font-size: 28px;
  line-height: 1;
  margin-top: 4px;
}
.import-subject-title {
  font-size: 13px;
  color: #1d1d1f;
  line-height: 1.4;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.import-subject-status {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  color: #86868b;
  font-size: 14px;
}

/* ============================================================
   Design System Refresh · 2026-08-30
   来源：https://ardot.tencent.com/file/720338491537635
   原则：覆盖原 .apple-* 与 .resource-card/.chapter-card 等的视觉细节，
        保留原 HTML 结构不动，纯 CSS 升级。bump style.css?v=28 → ?v=29。
   ============================================================ */

/* ---------- Sidebar 240px solid white（覆盖旧 220px 半透明） ---------- */
.apple-sidebar { width: 240px; top: 0; bottom: 0; background: #ffffff; padding: 10px 12px; backdrop-filter: none; -webkit-backdrop-filter: none; border-right: 1px solid #e5e5ea; box-shadow: none; transition: width .3s cubic-bezier(.4,0,.2,1), transform .3s cubic-bezier(.4,0,.2,1); }
.apple-sidebar.collapsed { width: 0; transform: translateX(-240px); overflow: hidden; }
.apple-sidebar-toggle { left: 240px; top: 0; height: 56px; background: #ffffff; backdrop-filter: none; -webkit-backdrop-filter: none; border: 1px solid #e5e5ea; border-radius: 0 8px 8px 0; }
.apple-sidebar.collapsed ~ .apple-sidebar-toggle,
.apple-sidebar-toggle.collapsed { left: 0; }
.apple-main { margin-left: 240px; transition: margin-left .3s cubic-bezier(.4,0,.2,1); }
.apple-sidebar-section { margin-bottom: 12px; }
.apple-sidebar-title { font-size: 12px; font-weight: 500; color: #aeaeb2; text-transform: none; letter-spacing: 0; margin: 0 0 4px 10px; padding-top: 8px; padding-bottom: 0; }
.apple-sidebar-item,
.apple-sidebar-item:link,
.apple-sidebar-item:visited { height: 34px; padding: 0 12px; gap: 10px; margin-bottom: 1px; border-radius: 10px; font-size: 14px; font-weight: 400; }
.apple-sidebar-item:hover,
.apple-sidebar-item:hover:visited { background: #f5f5f7; color: #007aff; }
.apple-sidebar-item.active,
.apple-sidebar-item.active:link,
.apple-sidebar-item.active:visited { background: #e8f2ff; color: #007aff; font-weight: 600; }
.apple-sidebar-item.active:hover,
.apple-sidebar-item.active:hover:visited { background: #e8f2ff; color: #007aff; }
.apple-sidebar-icon { width: 20px; height: 20px; font-size: 16px; }

/* Sidebar brand 顶部品牌区 */
.apple-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; margin-bottom: 4px; }
.apple-sidebar-brand .brand-mark { width: 32px; height: 32px; border-radius: 8px; background: #007aff; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.apple-sidebar-brand .brand-name { font-size: 18px; font-weight: 600; color: #1d1d1f; }

/* Sidebar user card */
.apple-sidebar-user-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #f5f5f7; border-radius: 12px; margin: 4px 0 8px; }
.apple-sidebar-user-card .avatar { width: 36px; height: 36px; border-radius: 18px; background: #d8d8de; color: #6e6e73; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.apple-sidebar-user-card .user-info { display: flex; flex-direction: column; min-width: 0; }
.apple-sidebar-user-card .user-name { font-size: 14px; font-weight: 600; color: #1d1d1f; line-height: 1.2; }
.apple-sidebar-user-card .user-role { font-size: 12px; font-weight: 400; color: #86868b; line-height: 1.3; }

/* ---------- Top Bar（页面级 64px 顶栏：标题 + 搜索 + 铃铛 + 头像） ---------- */
.apple-top-bar { background: #ffffff; height: 64px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #f5f5f7; }
.apple-top-bar .page-title { font-size: 20px; font-weight: 600; color: #1d1d1f; }
.apple-top-bar .top-actions { display: flex; align-items: center; gap: 12px; }
.apple-top-bar .search-box { display: flex; align-items: center; gap: 8px; background: #f5f5f7; border-radius: 10px; height: 36px; padding: 0 12px; width: 240px; color: #86868b; font-size: 13px; }
.apple-top-bar .search-box input { background: transparent; border: 0; outline: 0; flex: 1; font-size: 13px; color: #1d1d1f; }
.apple-top-bar .icon-btn { width: 36px; height: 36px; border-radius: 10px; background: #f5f5f7; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: #1d1d1f; font-size: 16px; }
.apple-top-bar .avatar-btn { width: 36px; height: 36px; border-radius: 18px; background: #d8d8de; border: 0; cursor: pointer; overflow: hidden; }

/* ---------- Page body padding ---------- */
.apple-main .main-content { padding: 32px; max-width: none; }
.apple-section-title { font-size: 18px; font-weight: 600; color: #1d1d1f; margin: 0 0 12px; padding-top: 8px; }

/* ---------- Cards 统一：白底 16 圆角 + 1px 边 + 浅阴影 ---------- */
.apple-stat-card,
.resource-card,
.chapter-card,
.profile-card,
.question-card,
.treehole-card,
.announcement-card,
.comment-card,
.feature-card,
.stat-card,
.class-card,
.admin-class-card,
.trash-item { background: #ffffff !important; border: 1px solid #e5e5ea !important; border-radius: 16px !important; box-shadow: none !important; }

/* Stat card */
.apple-stat-card { padding: 18px !important; }
.apple-stat-value { font-size: 28px !important; font-weight: 700 !important; color: #1d1d1f !important; letter-spacing: -0.4px; line-height: 1.1; }
.apple-stat-label { font-size: 13px !important; color: #86868b !important; }

/* Resource card: 隐藏原 thumb 区，改为纯文字卡 */
.resource-card { padding: 16px !important; }
.resource-card .resource-thumb,
.resource-card .resource-image,
.resource-card .resource-thumb-frame,
.resource-card img.resource-thumb,
.resource-card > a > img,
.resource-card > img:first-child { display: none !important; }
.resource-card .resource-title,
.resource-card h3.resource-title { font-size: 15px !important; font-weight: 600 !important; color: #1d1d1f !important; line-height: 22px !important; margin-bottom: 6px !important; }
.resource-card .resource-desc,
.resource-card .resource-description { font-size: 12.5px !important; color: #86868b !important; line-height: 18px !important; margin-bottom: 10px !important; }
.resource-card .resource-meta,
.resource-card .resource-stats { font-size: 12px !important; color: #aeaeb2 !important; }

/* Chapter card */
.chapter-card { padding: 14px !important; gap: 6px !important; }
.chapter-card h3,
.chapter-card .chapter-title { font-size: 15px !important; font-weight: 600 !important; color: #1d1d1f !important; }
.chapter-card .chapter-meta,
.chapter-card .chapter-sub { font-size: 12px !important; color: #86868b !important; }

/* ---------- Buttons ---------- */
.btn,
.btn-primary { background: #007aff !important; color: #ffffff !important; border: 1px solid #007aff !important; border-radius: 10px !important; padding: 0 16px !important; height: 40px !important; font-size: 14px !important; font-weight: 600 !important; }
.btn:hover,
.btn-primary:hover { background: #0064d6 !important; border-color: #0064d6 !important; }
.btn-ghost,
.btn-outline { background: #ffffff !important; color: #1d1d1f !important; border: 1px solid #e5e5ea !important; border-radius: 10px !important; padding: 0 16px !important; height: 40px !important; font-size: 14px !important; font-weight: 400 !important; }
.btn-ghost:hover,
.btn-outline:hover { background: #f5f5f7 !important; }
.btn-sm { height: 32px !important; padding: 0 12px !important; font-size: 13px !important; border-radius: 8px !important; }
.btn-danger { color: #ff3b30 !important; background: transparent !important; border-color: transparent !important; }
.btn-danger:hover { background: #fdecec !important; }

/* ---------- Tabs (pill 与 underline 两种) ---------- */
.tab-pill-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tab-pill { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px; border-radius: 10px; background: transparent; color: #1d1d1f; font-size: 14px; font-weight: 400; border: 0; cursor: pointer; transition: background .15s; }
.tab-pill:hover { background: #f5f5f7; }
.tab-pill.active { background: #007aff; color: #ffffff; font-weight: 600; }
.tab-pill.active:hover { background: #0064d6; color: #ffffff; }

.tabs-underline { display: flex; gap: 4px; align-items: flex-end; height: 44px; border-bottom: 0; }
.tab-underline { padding: 8px 16px 12px; color: #86868b; font-size: 14px; font-weight: 400; cursor: pointer; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.tab-underline:hover { color: #1d1d1f; }
.tab-underline.active { color: #007aff; font-weight: 600; border-bottom-color: #007aff; }

/* ---------- Form inputs ---------- */
input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="number"], input[type="url"],
input.form-control, .form-control { background: #ffffff; border: 1px solid #e5e5ea; border-radius: 12px; height: 48px; padding: 0 14px; font-size: 14px; color: #1d1d1f; transition: border-color .15s, box-shadow .15s; }
input:focus, input.form-control:focus, .form-control:focus { border-color: #007aff; outline: 0; box-shadow: 0 0 0 3px rgba(0,122,255,0.12); }
input::placeholder { color: #aeaeb2; }
select.form-control, select { background: #ffffff; border: 1px solid #e5e5ea; border-radius: 10px; height: 44px; padding: 0 14px; font-size: 14px; color: #1d1d1f; }
textarea.form-control, textarea { background: #ffffff; border: 1px solid #e5e5ea; border-radius: 12px; min-height: 120px; padding: 12px 14px; font-size: 14px; color: #1d1d1f; }

/* 搜索条（在 .search-bar 内） */
.search-bar input { background: #ffffff !important; border: 1px solid #e5e5ea !important; border-radius: 10px !important; height: 44px !important; padding: 0 14px !important; }
.search-bar select { background: #ffffff !important; border: 1px solid #e5e5ea !important; border-radius: 10px !important; height: 44px !important; padding: 0 14px !important; }

/* ---------- Hero / Welcome card ---------- */
.apple-welcome { padding: 28px !important; border-radius: 16px !important; }
.apple-welcome h1,
.apple-welcome .apple-welcome-title { font-size: 24px !important; font-weight: 700 !important; color: #1d1d1f !important; }
.apple-welcome .apple-welcome-desc { font-size: 14px !important; color: #86868b !important; }

/* ---------- Hero 主页卡片 ---------- */
.hero-card { background: #ffffff; border: 1px solid #e5e5ea; border-radius: 16px; padding: 28px; }
.hero-card .hero-greeting { font-size: 24px; font-weight: 700; color: #1d1d1f; margin: 0 0 6px; }
.hero-card .hero-sub { font-size: 14px; color: #86868b; margin: 0 0 16px; }
.hero-card .search-row { display: flex; gap: 10px; align-items: center; }
.hero-card .search-row input { flex: 1; }
.hero-card .search-row .select-pill { width: 140px; }

/* ---------- Question card ---------- */
.question-card { padding: 18px !important; display: flex; flex-direction: column; gap: 10px; }
.question-card .question-tag { font-size: 12px; font-weight: 500; color: #007aff; }
.question-card .question-title { font-size: 15px; font-weight: 600; color: #1d1d1f; line-height: 22px; }
.question-card .question-meta { font-size: 12px; color: #86868b; }

/* ---------- Class cards ---------- */
.class-card { padding: 20px !important; }
.class-card h3,
.class-card .class-name { font-size: 18px !important; font-weight: 700 !important; color: #1d1d1f !important; }
.class-card .class-meta { font-size: 13px !important; color: #86868b !important; }
.admin-class-card { padding: 20px !important; }
.admin-class-card .admin-class-name { font-size: 18px !important; font-weight: 700 !important; color: #1d1d1f !important; }
.admin-class-card .admin-class-actions .btn-danger { color: #ff3b30; }
.admin-class-card .admin-class-stats { font-size: 13px; color: #86868b; display: flex; gap: 32px; }

/* ---------- Trash item ---------- */
.trash-item { padding: 16px !important; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.trash-item .trash-name { font-size: 14px; font-weight: 600; color: #1d1d1f; }
.trash-item .trash-meta { font-size: 12px; color: #86868b; }
.trash-item .trash-actions { display: flex; gap: 8px; }

/* ---------- Treehole ---------- */
.treehole-card { padding: 18px !important; display: flex; flex-direction: column; gap: 8px; }
.treehole-card .treehole-meta { font-size: 12px; color: #aeaeb2; }
.treehole-card .treehole-text { font-size: 14px; color: #1d1d1f; line-height: 22px; }
.treehole-composer { background: #ffffff; border: 1px solid #e5e5ea; border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.treehole-composer textarea { background: #f5f5f7; min-height: 100px; }
.treehole-composer .composer-footer { display: flex; align-items: center; justify-content: space-between; }
.treehole-composer .counter { font-size: 12px; color: #aeaeb2; }

/* ---------- Messages / Chat ---------- */
.messages-layout { display: flex; gap: 16px; height: calc(100vh - 64px - 64px); min-height: 560px; }
.messages-sidebar { width: 320px; background: #ffffff; border: 1px solid #e5e5ea; border-radius: 16px; padding: 14px; overflow-y: auto; }
.messages-main { flex: 1; background: #ffffff; border: 1px solid #e5e5ea; border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.session-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; cursor: pointer; }
.session-row:hover { background: #f5f5f7; }
.session-row.active { background: #e8f2ff; }
.session-row .avatar { width: 36px; height: 36px; border-radius: 18px; background: #d8d8de; flex-shrink: 0; }
.chat-header { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid #f5f5f7; }
.chat-header .avatar { width: 40px; height: 40px; border-radius: 20px; background: #d8d8de; }
.chat-header .name { font-size: 16px; font-weight: 600; color: #1d1d1f; }
.chat-bubble { padding: 12px; border-radius: 12px; max-width: 360px; line-height: 20px; font-size: 13px; margin: 4px 0; }
.chat-bubble.in { background: #f5f5f7; color: #1d1d1f; align-self: flex-start; }
.chat-bubble.out { background: #007aff; color: #ffffff; align-self: flex-end; }
.chat-input-area { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid #f5f5f7; }
.chat-input-area input { flex: 1; }

/* ---------- Ranking podium ---------- */
.ranking-podium { display: flex; gap: 16px; align-items: flex-end; justify-content: center; padding: 16px 0; }
.podium-card { background: #ffffff; border: 1px solid #e5e5ea; border-radius: 16px; padding: 16px; width: 220px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.podium-card.first { width: 240px; border: 2px solid #ff9f0a; padding: 18px; }
.podium-card .podium-avatar { width: 48px; height: 48px; border-radius: 24px; background: #d8d8de; }
.podium-card.first .podium-avatar { width: 64px; height: 64px; border-radius: 32px; background: #ffe9b0; }
.podium-card .podium-rank { font-size: 14px; font-weight: 700; color: #aeaeb2; }
.podium-card.first .podium-rank { font-size: 16px; color: #ff9f0a; }
.podium-card .podium-name { font-size: 16px; font-weight: 600; color: #1d1d1f; }
.podium-card.first .podium-name { font-size: 18px; font-weight: 700; }
.podium-card .podium-points { font-size: 13px; font-weight: 500; color: #aeaeb2; }
.podium-card.first .podium-points { font-size: 14px; font-weight: 600; color: #ff9f0a; }

/* ---------- Status badge / Tag ---------- */
.status-badge { display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; height: 24px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.status-badge.active { background: #f0f7f4; color: #2f8a5f; }
.status-badge.banned { background: #fdecec; color: #ff3b30; }
.status-badge.warning { background: #fff2e3; color: #ff9f0a; }
.tag-soft { display: inline-flex; align-items: center; padding: 0 10px; height: 26px; border-radius: 13px; background: #f0f7f4; color: #2f8a5f; font-size: 12px; font-weight: 500; }
.tag-soft-blue { background: #e8f2ff; color: #007aff; }
.tag-soft-orange { background: #fff2e3; color: #ff9f0a; }
.tag-soft-red { background: #fdecec; color: #ff3b30; }

/* ---------- User row (admin) ---------- */
.user-row { background: #ffffff; border: 1px solid #e5e5ea; border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 16px; }
.user-row .avatar { width: 40px; height: 40px; border-radius: 20px; background: #d8d8de; flex-shrink: 0; }
.user-row .info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.user-row .name { font-size: 15px; font-weight: 600; color: #1d1d1f; }
.user-row .email { font-size: 12px; color: #86868b; }
.user-row .role { font-size: 13px; font-weight: 500; color: #1d1d1f; width: 100px; }
.user-row .role.teacher { color: #007aff; }
.user-row .points { font-size: 13px; color: #86868b; width: 100px; text-align: right; }
.user-row .actions { display: flex; gap: 6px; }

/* ---------- Profile card ---------- */
.profile-card { padding: 28px !important; }
.profile-card .profile-avatar { width: 80px; height: 80px; border-radius: 40px; background: #d8d8de; flex-shrink: 0; }
.profile-card .profile-name { font-size: 24px; font-weight: 700; color: #1d1d1f; }
.profile-card .profile-role { font-size: 14px; color: #86868b; }
.profile-card .profile-email { font-size: 13px; color: #aeaeb2; }

/* ---------- Rule form ---------- */
.rule-form { background: #ffffff; border: 1px solid #e5e5ea; border-radius: 16px; padding: 24px; }
.rule-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f5f5f7; }
.rule-row:last-child { border-bottom: 0; }
.rule-row .rule-label { font-size: 14px; color: #1d1d1f; }
.rule-row .rule-value { display: inline-flex; align-items: center; justify-content: center; background: #f5f5f7; color: #007aff; font-size: 13px; font-weight: 500; height: 36px; min-width: 100px; padding: 0 14px; border-radius: 8px; }

/* ---------- Insights chart 占位 ---------- */
.insight-card { padding: 20px !important; }
.insight-card .insight-title { font-size: 14px; font-weight: 600; color: #1d1d1f; }
.insight-card .insight-sub { font-size: 12px; color: #86868b; }
.insight-card .insight-chart { height: 120px; display: flex; align-items: flex-end; gap: 14px; justify-content: center; padding: 12px 0; }

/* ---------- Announcement / Message ---------- */
.announcement-card { padding: 18px !important; }
.announcement-card .ann-title { font-size: 16px; font-weight: 600; color: #1d1d1f; }

/* ---------- 表格行 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table thead th { font-size: 12px; font-weight: 500; color: #86868b; text-align: left; padding: 10px 12px; border-bottom: 1px solid #e5e5ea; }
.table tbody td { font-size: 14px; color: #1d1d1f; padding: 14px 12px; border-bottom: 1px solid #f5f5f7; }
.table tbody tr:hover { background: #fafafa; }

/* ---------- 实用 spacing ---------- */
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.text-secondary { color: #86868b; } .text-tertiary { color: #aeaeb2; } .text-primary { color: #007aff; }
.font-12 { font-size: 12px; } .font-13 { font-size: 13px; } .font-14 { font-size: 14px; } .font-15 { font-size: 15px; } .font-18 { font-size: 18px; } .font-22 { font-size: 22px; } .font-24 { font-size: 24px; }

/* 修正 page-content 实际内边距（覆盖部分页 inline 风格） */
.main-content { padding: 32px; background: #f5f5f7; }

/* ==============================================================
   全局响应式增强（通用自适配）：
   原则：优先 width:100% + max-width + 居中/flex/grid
   仅在断点确有差异时补充媒体查询
   ============================================================== */

/* ---------- 通用：所有元素避免横向溢出 ---------- */
*,
*::before,
*::after {
  max-width: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  overflow-x: hidden;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 图片 / 视频 / canvas 自适应 */
img,
video,
canvas,
svg,
iframe,
embed,
object {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 容器兜底：去掉硬编码的超大 min-width */
[style*="min-width:"] {
  max-width: 100% !important;
}

/* ---------- 通用容器：去掉绝对固定宽度，改为 max-width + 居中 ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* ---------- 所有表单控件撑满容器，防止溢出 ---------- */
input,
select,
textarea,
button {
  max-width: 100%;
  box-sizing: border-box;
}

/* 防止搜索栏、工具栏、标签栏横向溢出 */
.search-bar,
.tabs,
.action-buttons,
.btn-group,
.apple-home-search,
.resource-view-switch,
.apple-home-tabs,
.recycle-toolbar {
  flex-wrap: wrap;
}

/* ---------- 侧栏 + 主内容 自适配（通用方案） ---------- */
.apple-main {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.dashboard .main-content {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* 所有网格使用 minmax 自适应 */
.dashboard-grid,
.dept-card-list,
.resource-list,
.qa-chapters-grid,
.qa-chapter-group,
.qa-chapter-children,
.chapter-cards-grid,
.import-subject-grid,
.class-checkbox-list,
.apple-profile-stats,
.apple-home-grid,
.apple-home-insights,
.apple-detail-meta-grid {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* 卡片统一：不设固定宽，让网格决定 */
.stat-card,
.resource-card,
.dept-card,
.profile-card,
.qa-chapter-card,
.chapter-card,
.apple-stat-card,
.apple-home-card,
.apple-insight-card,
.question-card,
.announcement-card {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* 资源步骤卡最小宽度调小，小屏能塞下 */
.resource-step {
  min-width: 140px;
  max-width: 100%;
}

/* ---------- 表格：默认横向滚动容器，避免撑破 ---------- */
.table,
table {
  width: 100%;
  max-width: 100%;
}

.table-wrap,
.dept-member-table-wrap,
.resource-table-wrap,
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 排名榜 podium 小屏换行 */
.ranking-podium {
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- 弹窗：小屏不溢出 ---------- */
.modal-overlay {
  padding: 12px;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  margin: auto;
  box-sizing: border-box;
}

/* ---------- 字体：根据视口略微缩放，移动端不挤 ---------- */
.section-title {
  font-size: clamp(20px, 3vw, 32px);
}

.apple-section-title,
.apple-home-section-title {
  font-size: clamp(18px, 2.2vw, 22px);
}

.apple-home-greeting {
  font-size: clamp(26px, 5vw, 40px);
}

.stat-value,
.apple-stat-value,
.aps-value {
  font-size: clamp(22px, 3.5vw, 36px);
}

/* =============================================================
   断点 1：大屏 >= 1200  保持原设计
   断点 2：中屏  901 - 1200  网格降列
   断点 3：平板  641 - 900   侧栏抽屉 + 网格继续降列
   断点 4：手机 <= 640      单列、内边距缩小、隐藏非关键信息
   断点 5：小屏手机 <= 420  进一步压缩
   ============================================================= */

/* ---------- 断点：<= 1200  中屏 ---------- */
@media (max-width: 1200px) {
  .apple-home-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .apple-home-insights {
    grid-template-columns: repeat(2, 1fr);
  }
  .apple-profile-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .resource-list {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  .apple-welcome {
    flex-wrap: wrap;
  }
}

/* ---------- 断点：<= 900  平板 ---------- */
@media (max-width: 900px) {
  /* 顶部品牌缩短文字 */
  .top-nav-logo .logo-text,
  .top-nav-logo span:not(.apple-sidebar-icon):not(:empty) {
    display: none;
  }
  .apple-top-bar {
    padding: 0 16px;
    gap: 8px;
  }
  .apple-top-bar .search-box {
    width: 160px;
  }
  .apple-top-bar .page-title {
    font-size: 18px;
  }

  /* 主内容内边距缩小 */
  .apple-main .main-content,
  .dashboard .main-content,
  .main-content {
    padding: 20px 16px;
  }
  .auth-container {
    padding: 24px 16px;
  }

  /* 各种网格降列 */
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dept-card-list {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  .resource-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .resource-carousel-track {
    gap: 10px;
  }
  .apple-home-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .apple-home-insights {
    grid-template-columns: 1fr 1fr;
  }
  .apple-profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .qa-chapters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chapter-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 排行榜 podium 换行 */
  .ranking-podium {
    gap: 12px;
  }
  .podium-card,
  .podium-card.first {
    width: 100%;
    max-width: 240px;
  }

  /* 消息/私信布局：上下结构 */
  .messages-layout {
    flex-direction: column;
    height: auto;
    min-height: 60vh;
    gap: 12px;
  }
  .messages-sidebar {
    width: 100%;
    max-height: 40vh;
    min-height: 220px;
  }
  .messages-main {
    min-height: 50vh;
  }
}

/* ---------- 断点：<= 768  标准平板/大屏手机  （style.css 原有基础上增强）---------- */
@media (max-width: 768px) {
  /* 顶栏：紧凑化 */
  .top-nav-container {
    padding: 0 10px;
    gap: 6px;
    height: 52px;
  }
  .top-nav-logo img {
    height: 28px;
  }
  .user-dropdown-trigger {
    padding: 3px 4px;
    gap: 4px;
  }
  .user-avatar-sm {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  /* 隐藏次要文字 */
  .user-name-sm,
  .user-role-badge {
    display: none;
  }

  /* 搜索栏：全部纵向堆叠 */
  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-bar input,
  .search-bar select,
  .search-bar .btn {
    width: 100% !important;
  }

  /* 主内容进一步收紧 */
  .apple-main .main-content,
  .dashboard .main-content,
  .main-content {
    padding: 14px 12px;
  }

  /* 各类卡片 padding 缩小 */
  .stat-card,
  .profile-card,
  .apple-welcome,
  .apple-profile-card,
  .resource-card,
  .chapter-card,
  .apple-stat-card,
  .apple-home-card,
  .apple-insight-card {
    padding: 14px !important;
  }

  /* 网格：全部 1-2 列 */
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .dept-card-list,
  .qa-chapters-grid,
  .chapter-cards-grid {
    grid-template-columns: 1fr;
  }
  .resource-list,
  .apple-home-grid,
  .apple-home-insights {
    grid-template-columns: 1fr;
  }
  .apple-profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 章节/问题列表：左数字区缩小 */
  .chapter-card-number {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
  .question-index {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  /* 表单组：多输入纵向堆叠 */
  .form-group .input-row {
    flex-direction: column;
    gap: 10px;
  }

  /* 弹窗：全屏贴边 */
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 96vh;
    border-radius: 14px;
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 14px 16px;
  }
  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    flex: 1 1 calc(50% - 6px);
  }

  /* 首页 Hero 缩小 */
  .apple-home-hero {
    padding: 28px 14px 24px;
    margin: -14px -12px 0;
  }
  .apple-home-subtitle {
    font-size: 13px;
  }
  .apple-home-tabs {
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .apple-home-tab {
    font-size: 14px;
    padding: 6px 0 10px;
    white-space: nowrap;
  }

  /* 个人中心头部：纵向 */
  .apple-profile-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .apple-profile-left {
    flex-direction: column;
    text-align: center;
  }
  .apple-profile-actions {
    align-items: center;
  }

  /* 欢迎卡：换行 */
  .apple-welcome {
    padding: 20px !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .apple-welcome-icon {
    font-size: 34px;
  }
  .apple-welcome-title {
    font-size: 20px !important;
  }

  /* 分页：缩小、换行 */
  .pagination,
  .apple-home-pagination,
  .resource-pager {
    gap: 4px;
  }
  .resource-pager {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }
  .resource-pager .rp-btns {
    justify-content: center;
  }
  .pagination button,
  .ahp-btn,
  .rp-btn {
    min-width: 30px;
    height: 32px;
    padding: 0 8px;
    font-size: 12px;
  }

  /* 顶部操作区：搜索框进一步缩小、文字隐藏 */
  .apple-top-bar {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 6px;
  }
  .apple-top-bar .search-box {
    flex: 1 1 160px;
    order: 3;
    width: 100%;
  }

  /* 消息气泡放宽，允许占更大比例 */
  .msg-bubble {
    max-width: 85%;
  }

  /* 按钮统一高度缩小 */
  .btn,
  .btn-primary {
    height: 38px !important;
    padding: 0 12px !important;
  }
  .btn-sm {
    height: 30px !important;
    padding: 0 10px !important;
  }
}

/* ---------- 断点：<= 640  标准手机 ---------- */
@media (max-width: 640px) {
  /* 顶栏：再紧凑 */
  .top-nav-container {
    height: 48px;
    padding: 0 8px;
  }
  .apple-sidebar-brand .brand-name {
    font-size: 15px;
  }
  .apple-sidebar-user-card .user-name {
    font-size: 13px;
  }

  /* 所有 2 列网格 → 单列 */
  .dashboard-grid,
  .apple-profile-stats,
  .apple-home-insights,
  .apple-detail-meta-grid,
  .class-checkbox-list,
  .import-subject-grid {
    grid-template-columns: 1fr;
  }

  /* 统计卡片 padding 再小 */
  .apple-stat-card,
  .stat-card {
    padding: 14px !important;
  }
  .aps-value,
  .apple-stat-value {
    font-size: 22px;
  }

  /* 横幅/卡片标题字号 */
  .section-title {
    font-size: 20px;
    margin-bottom: 14px;
  }
  .hero-card {
    padding: 18px;
  }
  .hero-card .hero-greeting {
    font-size: 20px;
  }
  .hero-card .search-row {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-card .search-row .select-pill {
    width: 100%;
  }

  /* 顶部导航：帮助/铃铛按钮缩小 */
  .pb-topbar-pill,
  .pb-bell-btn {
    display: none;
  }
  /* 保留至少铃铛图标 */
  .pb-bell-btn {
    display: inline-flex;
    width: 32px;
    height: 32px;
  }

  /* 弹窗再紧凑 */
  .modal {
    border-radius: 12px;
  }
  .modal-header {
    padding: 12px 14px;
  }
  .modal-header h3 {
    font-size: 16px;
  }
  .modal-body {
    padding: 12px 14px;
  }
  .form-group {
    margin-bottom: 14px;
  }
  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 10px 12px;
    font-size: 15px; /* 防止 iOS 自动缩放 */
  }

  /* 排行榜 podium：全换行 */
  .ranking-podium {
    flex-direction: column;
    align-items: center;
  }
  .podium-card,
  .podium-card.first {
    max-width: 100%;
    width: 100%;
  }

  /* 操作按钮：双列或全宽 */
  .action-buttons {
    flex-wrap: wrap;
  }
  .action-buttons .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
  }

  /* 分页：仅显示上/下/当前 */
  .pagination button:not(.active):not(:first-child):not(:last-child) {
    display: none;
  }
  .pagination button.active {
    display: inline-flex;
  }

  /* 文本再小一号 */
  .resource-card h3,
  .chapter-card-info h4,
  .question-body h4 {
    font-size: 14px;
  }
  .resource-card p,
  .resource-desc,
  .chapter-card-info p,
  .question-body p {
    font-size: 12px;
  }
}

/* ---------- 断点：<= 420  超小屏手机 ---------- */
@media (max-width: 420px) {
  .top-nav-logo,
  .apple-sidebar-brand .brand-name {
    font-size: 14px;
  }
  .apple-home-greeting {
    font-size: 24px;
  }
  .apple-home-subtitle {
    font-size: 12px;
  }
  .apple-main .main-content,
  .dashboard .main-content,
  .main-content {
    padding: 10px 8px;
  }
  .auth-card {
    border-radius: 10px;
  }
  .auth-form,
  .auth-header {
    padding: 20px 16px;
  }
  .auth-header h2 {
    font-size: 22px;
  }

  /* 资源/章节卡标题截断更严格 */
  .resource-card h3,
  .chapter-card-info h4 {
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }

  /* 弹窗按钮：左右并排 */
  .modal-footer {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .modal-footer .btn {
    width: auto;
    flex: 1 1 calc(50% - 4px);
  }

  /* 个人中心头像更小 */
  .apple-profile-avatar {
    width: 60px;
    height: 60px;
    font-size: 22px;
  }
  .apple-profile-name {
    font-size: 20px;
  }

  /* 空/加载状态内边距收紧 */
  .empty-state,
  .loading-state {
    padding: 40px 12px;
  }
}

/* ---------- 横屏手机 & 折叠屏窄窗：表格支持横向滚 ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .messages-layout {
    min-height: 420px;
  }
}

/* ---------- 超宽屏：内容最大宽度限制，防止卡片过散 ---------- */
@media (min-width: 1600px) {
  .apple-main .main-content,
  .dashboard .main-content,
  .main-content {
    max-width: 1600px;
    margin: 0 auto;
  }
}

/* ---------- 打印 & 深色模式兜底 ---------- */
@media (prefers-color-scheme: dark) {
  /* 本项目仅支持浅色主题，这里只防止系统反色时文字消失 */
  html {
    color-scheme: light;
  }
}

/* ---------- 减少动效（用户无障碍偏好）---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
