/* ==================== 设计变量 ==================== */
:root {
  --c-primary: #6366F1;
  --c-primary-light: #818CF8;
  --c-primary-dark: #4F46E5;
  --c-primary-bg: #EEF2FF;
  --c-accent: #F59E0B;
  --c-success: #10B981;
  --c-danger: #EF4444;
  --c-warning: #F59E0B;
  --c-info: #3B82F6;

  --c-bg: #F5F7FB;
  --c-surface: #FFFFFF;
  --c-surface-alt: #F8FAFC;
  --c-border: #E2E8F0;
  --c-border-light: #F1F5F9;

  --c-text: #1E293B;
  --c-text-secondary: #475569;
  --c-text-muted: #94A3B8;
  --c-text-inverse: #FFFFFF;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --sidebar-w: 240px;
  --topbar-h: 64px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

/* ==================== Reset ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ==================== 布局 ==================== */
#app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* ==================== 侧边栏 ==================== */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--c-border-light);
}
.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-size: 16px; font-weight: 700; color: var(--c-text); }
.brand-sub { font-size: 12px; color: var(--c-text-muted); }

.nav-list {
  flex: 1;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--c-text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}
.nav-item:hover { background: var(--c-surface-alt); color: var(--c-text); }
.nav-item.active {
  background: var(--c-primary-bg);
  color: var(--c-primary-dark);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--c-primary);
  border-radius: 0 3px 3px 0;
}
.nav-svg { flex-shrink: 0; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--c-border-light); }
.student-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--c-surface-alt);
  cursor: pointer;
  transition: background 0.2s;
}
.student-card:hover { background: var(--c-primary-bg); }
.student-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.student-info { display: flex; flex-direction: column; min-width: 0; }
.student-name { font-size: 13px; font-weight: 600; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-school { font-size: 11px; color: var(--c-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==================== 顶栏 ==================== */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--c-text); }
.page-desc { font-size: 13px; color: var(--c-text-muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.date-pill {
  padding: 6px 14px;
  background: var(--c-surface-alt);
  border-radius: 20px;
  font-size: 13px;
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
}

/* ==================== 通用组件 ==================== */
.card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--c-border-light);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--c-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 16px; font-weight: 600; color: var(--c-text); }
.card-body { padding: 20px 22px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--c-primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--c-surface);
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
}
.btn-secondary:hover { background: var(--c-surface-alt); border-color: var(--c-text-muted); }
.btn-ghost { color: var(--c-text-secondary); padding: 8px 12px; }
.btn-ghost:hover { background: var(--c-surface-alt); }
.btn-danger { color: var(--c-danger); }
.btn-danger:hover { background: #FEF2F2; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-primary { background: var(--c-primary-bg); color: var(--c-primary-dark); }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }

/* 科目标签 */
.subject-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.sub-语文 { background: #FEE2E2; color: #B91C1C; }
.sub-数学 { background: #DBEAFE; color: #1E40AF; }
.sub-英语 { background: #D1FAE5; color: #065F46; }
.sub-物理 { background: #E0E7FF; color: #3730A3; }
.sub-化学 { background: #FEF3C7; color: #92400E; }
.sub-生物 { background: #CCFBF1; color: #115E59; }
.sub-政治 { background: #FCE7F3; color: #9D174D; }
.sub-历史 { background: #FFEDD5; color: #9A3412; }
.sub-地理 { background: #CFFAFE; color: #155E75; }

/* 标签页 */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 20px;
}
.tab {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.tab:hover { color: var(--c-text-secondary); }
.tab.active { color: var(--c-primary); border-color: var(--c-primary); }

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--c-border-light);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-primary-light));
  border-radius: 4px;
  transition: width 0.6s ease;
}
.progress-fill.success { background: linear-gradient(90deg, var(--c-success), #34D399); }
.progress-fill.warning { background: linear-gradient(90deg, var(--c-warning), #FBBF24); }

/* 上传区 */
.upload-zone {
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: var(--c-surface-alt);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--c-primary);
  background: var(--c-primary-bg);
}
.upload-zone .upload-icon {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  color: var(--c-text-muted);
}
.upload-zone.dragover .upload-icon { color: var(--c-primary); }
.upload-zone .upload-text { font-size: 14px; color: var(--c-text-secondary); font-weight: 500; }
.upload-zone .upload-hint { font-size: 12px; color: var(--c-text-muted); margin-top: 4px; }

/* 聊天气泡 */
.chat-container { display: flex; flex-direction: column; height: 100%; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-bubble { max-width: 75%; display: flex; gap: 10px; }
.chat-bubble.user { margin-left: auto; flex-direction: row-reverse; }
.chat-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.chat-bubble:not(.user) .chat-avatar { background: var(--c-primary-bg); color: var(--c-primary); }
.chat-bubble.user .chat-avatar { background: linear-gradient(135deg, #F59E0B, #EF4444); color: #fff; }
.chat-content {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.7;
}
.chat-bubble:not(.user) .chat-content { background: var(--c-surface-alt); border: 1px solid var(--c-border-light); border-top-left-radius: 4px; }
.chat-bubble.user .chat-content { background: var(--c-primary); color: #fff; border-top-right-radius: 4px; }

.chat-content .step { margin: 8px 0; padding: 10px 14px; background: var(--c-surface); border-radius: var(--radius-sm); border-left: 3px solid var(--c-primary); }
.chat-content .formula { font-family: "Cambria Math", "Times New Roman", serif; font-style: italic; background: var(--c-primary-bg); padding: 2px 6px; border-radius: 4px; }
.chat-content strong { font-weight: 600; }
.chat-content .tip { background: #FEF3C7; color: #92400E; padding: 8px 12px; border-radius: var(--radius-sm); margin-top: 8px; font-size: 13px; }

/* 打字指示器 */
.typing-indicator { display: flex; gap: 4px; padding: 4px 0; }
.typing-indicator span {
  width: 7px; height: 7px;
  background: var(--c-text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* 聊天输入区 */
.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--c-surface);
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--c-primary); }

/* ==================== 仪表盘 ==================== */
.dash-banner {
  background: linear-gradient(135deg, #6366F1 0%, #818CF8 50%, #A78BFA 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.dash-banner::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.dash-banner::before {
  content: '';
  position: absolute;
  right: 60px; bottom: -40px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.dash-banner h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; position: relative; z-index: 1; }
.dash-banner p { font-size: 14px; opacity: 0.9; position: relative; z-index: 1; }
.dash-banner-stats { display: flex; gap: 32px; margin-top: 20px; position: relative; z-index: 1; }
.dash-banner-stat .num { font-size: 28px; font-weight: 700; }
.dash-banner-stat .label { font-size: 13px; opacity: 0.85; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--c-border-light);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--c-text); }
.stat-card .stat-label { font-size: 13px; color: var(--c-text-muted); }
.stat-card .stat-trend { font-size: 12px; margin-top: 4px; }
.stat-trend.up { color: var(--c-success); }
.stat-trend.down { color: var(--c-danger); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-bottom: 24px; }

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--c-border-light);
}
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 20px; height: 20px;
  border: 2px solid var(--c-border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.task-check.done { background: var(--c-success); border-color: var(--c-success); color: #fff; }
.task-check:hover { border-color: var(--c-text-muted); }
.task-info { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; color: var(--c-text); }
.task-title.done { text-decoration: line-through; color: var(--c-text-muted); }
.task-meta { font-size: 12px; color: var(--c-text-muted); margin-top: 2px; }
.task-duration { font-size: 12px; color: var(--c-text-muted); flex-shrink: 0; }

/* 快捷操作 */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.quick-action {
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  border: 1px solid var(--c-border-light);
  cursor: pointer;
  transition: all 0.2s;
}
.quick-action:hover { border-color: var(--c-primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-action .qa-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
}
.quick-action .qa-label { font-size: 13px; font-weight: 500; color: var(--c-text-secondary); }

/* ==================== 资料库 ==================== */
.material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.material-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}
.material-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.material-thumb {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.material-thumb .mt-icon { font-size: 36px; }
.material-thumb-img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.material-thumb-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--c-text-muted);
  font-size: 13px;
  font-weight: 600;
}
.material-preview-tag {
  position: absolute;
  bottom: 8px; left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.material-preview-tag:hover { background: rgba(0,0,0,0.7); }
.material-type-badge {
  position: absolute;
  top: 8px; right: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.material-info { padding: 12px 14px; }
.material-title { font-size: 14px; font-weight: 600; color: var(--c-text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.material-meta { font-size: 12px; color: var(--c-text-muted); display: flex; justify-content: space-between; }
.material-filename {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-actions { display: flex; gap: 8px; padding: 0 14px 12px; }
.material-actions .btn { flex: 1; }

/* 存储空间提示 */
.storage-info {
  display: none;
  padding: 8px 14px;
  margin-bottom: 16px;
  background: var(--c-surface-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border-light);
  font-size: 12px;
  color: var(--c-text-muted);
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--c-text-muted); }
.empty-state .es-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state .es-text { font-size: 15px; margin-bottom: 4px; color: var(--c-text-secondary); }
.empty-state .es-hint { font-size: 13px; }

/* ==================== 学习计划 ==================== */
.plan-timeline { position: relative; padding-left: 28px; }
.plan-timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: var(--c-border);
}
.plan-day {
  margin-bottom: 28px;
  position: relative;
}
.plan-day::before {
  content: '';
  position: absolute;
  left: -28px; top: 4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 3px solid var(--c-primary);
  z-index: 1;
}
.plan-day.done::before { border-color: var(--c-success); background: var(--c-success); }
.plan-day-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.plan-day-date { font-size: 15px; font-weight: 600; color: var(--c-text); }
.plan-day-stats { font-size: 12px; color: var(--c-text-muted); }
.plan-sessions { display: flex; flex-direction: column; gap: 8px; }
.plan-session {
  background: var(--c-surface);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}
.plan-session:hover { box-shadow: var(--shadow-sm); border-color: var(--c-border); }
.plan-session .ps-time { font-size: 13px; color: var(--c-text-muted); width: 100px; flex-shrink: 0; }
.plan-session .ps-content { flex: 1; }
.plan-session .ps-topic { font-size: 14px; font-weight: 500; color: var(--c-text); }
.plan-session .ps-desc { font-size: 12px; color: var(--c-text-muted); }
.plan-session .ps-duration { font-size: 12px; color: var(--c-text-muted); }
.plan-session.done { opacity: 0.6; }
.plan-session.done .ps-topic { text-decoration: line-through; }

/* ==================== 解题助手 ==================== */
.solver-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; height: calc(100vh - var(--topbar-h) - 48px); }
.solver-panel { display: flex; flex-direction: column; overflow: hidden; }
.solver-input-methods { display: flex; gap: 8px; margin-bottom: 12px; }
.method-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-secondary);
  transition: all 0.2s;
}
.method-btn.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

.solution-step {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--c-surface-alt);
  border-radius: var(--radius);
  border-left: 4px solid var(--c-primary);
}
.solution-step .ss-num { font-size: 12px; font-weight: 600; color: var(--c-primary); margin-bottom: 6px; }
.solution-step .ss-title { font-size: 14px; font-weight: 600; color: var(--c-text); margin-bottom: 8px; }
.solution-step .ss-content { font-size: 14px; color: var(--c-text-secondary); line-height: 1.8; }
.solution-step .ss-formula {
  font-family: "Cambria Math", serif;
  font-size: 16px;
  background: var(--c-surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  text-align: center;
  border: 1px solid var(--c-border);
}

/* ==================== 考生档案 ==================== */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--c-text-secondary); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--c-surface);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--c-primary); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.subject-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border-light);
}
.subject-score-row:last-child { border-bottom: none; }
.ssr-name { width: 60px; font-size: 14px; font-weight: 500; }
.ssr-bar { flex: 1; }
.ssr-score { width: 50px; text-align: right; font-size: 14px; font-weight: 600; }
.ssr-target { width: 50px; text-align: right; font-size: 12px; color: var(--c-text-muted); }

/* ==================== 模态框 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s;
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--c-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 22px;
  color: var(--c-text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--c-surface-alt); color: var(--c-text); }
.modal-body { padding: 24px; overflow-y: auto; }

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

/* ==================== Toast ==================== */
.toast-container {
  position: fixed;
  top: 80px; right: 32px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--c-text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: var(--c-success); }
.toast.error { background: var(--c-danger); }
.toast.info { background: var(--c-info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ==================== 全屏预览 ==================== */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
}
.preview-overlay.show { opacity: 1; }

.preview-container {
  width: 92vw;
  max-width: 1100px;
  height: 90vh;
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: previewSlideIn 0.3s ease;
}
.preview-overlay.show .preview-container {
  animation: previewSlideIn 0.3s ease;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--c-border-light);
  flex-shrink: 0;
}
.preview-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text);
  flex: 1;
}
.preview-meta {
  font-size: 13px;
  color: var(--c-text-muted);
}
.preview-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 20px;
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  cursor: pointer;
  background: none;
  border: none;
  flex-shrink: 0;
}
.preview-close:hover {
  background: var(--c-surface-alt);
  color: var(--c-text);
}

.preview-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1E1E2E;
  padding: 20px;
}
.preview-body-image { background: #1E1E2E; }
.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.preview-body-pdf { background: #525659; padding: 0; }
.preview-pdf {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-top: 1px solid var(--c-border-light);
  flex-shrink: 0;
}

@keyframes previewSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==================== 工具类 ==================== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--c-text-muted); }
.text-secondary { color: var(--c-text-secondary); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.hidden { display: none; }

/* 动画 */
.fade-in { animation: fadeIn 0.3s ease; }

/* ==================== AI 设置页 ==================== */
.cfg-preset {
  display: inline-block;
  padding: 1px 8px;
  margin-left: 8px;
  border-radius: 4px;
  background: var(--c-primary-bg);
  color: var(--c-primary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.cfg-preset:hover {
  background: var(--c-primary);
  color: #fff;
}
.cfg-vision {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--c-surface-alt);
  border: 1px solid var(--c-border-light);
  font-size: 11px;
  transition: all 0.15s;
}
.cfg-vision:hover {
  background: var(--c-primary);
  color: #fff !important;
  border-color: var(--c-primary);
}

#aiStatusPill {
  transition: all 0.2s;
}
#aiStatusPill:hover {
  background: var(--c-primary-bg);
  border-color: var(--c-primary);
}

/* ==================== AI Markdown 内容样式 ==================== */
.ai-content { line-height: 1.75; font-size: 14px; }

.ai-content .md-p {
  margin: 0 0 8px 0;
}
.ai-content .md-p:last-child { margin-bottom: 0; }

.ai-content .md-h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--c-text);
  margin: 16px 0 8px 0;
  padding-left: 8px;
  border-left: 3px solid var(--c-primary);
}
.ai-content .md-h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  margin: 12px 0 6px 0;
}

.ai-content .step-item {
  display: flex;
  gap: 8px;
  margin: 4px 0;
  padding: 2px 0;
}
.ai-content .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.ai-content .bullet-item {
  padding-left: 12px;
  color: var(--c-text-secondary);
  margin: 2px 0;
}

.ai-content .tip-block {
  margin: 10px 0;
  padding: 8px 12px;
  background: var(--c-primary-bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--c-primary);
}

.ai-content .code-block {
  margin: 10px 0;
  padding: 12px 16px;
  background: var(--c-surface-alt);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}
.ai-content .code-block code {
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  color: var(--c-text);
}

.ai-content .inline-code {
  padding: 1px 5px;
  background: var(--c-surface-alt);
  border-radius: 3px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 0.9em;
  color: var(--c-primary);
}

.ai-content strong {
  color: var(--c-text);
  font-weight: 600;
}

.ai-content .formula-inline {
  padding: 1px 5px;
  background: #fef3c7;
  border-radius: 3px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 0.9em;
  color: #92400e;
}

/* KaTeX 公式展示 */
.ai-content .katex {
  font-size: 1.05em;
}
.ai-content .katex-display {
  margin: 14px 0;
  padding: 6px 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.ai-content .katex-display > .katex {
  white-space: nowrap;
}
