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

:root {
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #ea580c;
  --danger: #dc2626;
  --purple: #9333ea;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

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

.app { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #1e3a5f 0%, #162942 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.logo { padding: 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.logo-icon { font-size: 28px; }
.logo-title { color: #fff; font-weight: 700; font-size: 15px; }
.logo-sub { font-size: 11px; color: #94a3b8; }
.nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: block; padding: 10px 14px; border-radius: 8px;
  color: #cbd5e1; text-decoration: none; cursor: pointer;
  margin-bottom: 2px; font-size: 13.5px; transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.countdown-mini { text-align: center; font-size: 12px; color: #94a3b8; }
.countdown-mini strong { color: #fbbf24; font-size: 18px; display: block; }

/* 主内容 */
.main { flex: 1; margin-left: 220px; padding: 24px 28px; max-width: 100%; }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.today-label { color: var(--text-muted); font-size: 13px; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-header h3 { font-size: 15px; font-weight: 600; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.section-title { font-size: 15px; font-weight: 600; margin: 24px 0 12px; color: var(--text); }

/* 英雄卡片 */
.hero-card {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border-radius: var(--radius); padding: 28px 32px; color: #fff;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.hero-label { font-size: 14px; opacity: 0.85; }
.hero-days { font-size: 56px; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.hero-date { font-size: 13px; opacity: 0.75; }
.hero-right { display: flex; gap: 32px; }
.hero-stat { text-align: center; }
.hero-num { font-size: 28px; font-weight: 700; display: block; }
.hero-unit { font-size: 12px; opacity: 0.8; }

.badge { background: var(--primary-light); color: var(--primary-dark); padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }

.btn {
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); color: #fff; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none; background: #fff; transition: border-color 0.15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.input-sm { padding: 4px 8px; width: 90px; }

/* 任务列表 */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--border); }
.task-item.done .task-text { text-decoration: line-through; color: var(--text-muted); }
.task-check {
  width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.task-check.checked { background: var(--success); border-color: var(--success); color: #fff; font-size: 12px; }
.task-text { flex: 1; }
.task-subject { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--primary-light); color: var(--primary-dark); flex-shrink: 0; }
.task-actions { display: flex; gap: 4px; }
.task-actions button { background: none; border: none; cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 4px; color: var(--text-muted); }
.task-actions button:hover { background: #e2e8f0; color: var(--danger); }
.empty-state { text-align: center; padding: 32px; color: var(--text-muted); font-size: 13px; }

/* 记录列表 */
.record-list { display: flex; flex-direction: column; gap: 10px; }
.record-item { padding: 12px 14px; background: #f8fafc; border-radius: 8px; border-left: 3px solid var(--primary); }
.record-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.record-subject { font-weight: 600; font-size: 13px; }
.record-duration { font-size: 12px; color: var(--primary); font-weight: 600; }
.record-content { font-size: 13px; color: var(--text); }
.record-notes { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.record-date { font-size: 11px; color: var(--text-muted); }

/* 节点提醒 */
.milestone-alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.alert-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border-radius: var(--radius); background: #fff; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.alert-item.urgent { border-left-color: var(--danger); background: #fef2f2; }
.alert-item.soon { border-left-color: var(--warning); background: #fff7ed; }
.alert-days { text-align: center; min-width: 60px; }
.alert-days strong { font-size: 24px; font-weight: 700; display: block; color: var(--primary); }
.alert-item.urgent .alert-days strong { color: var(--danger); }
.alert-item.soon .alert-days strong { color: var(--warning); }
.alert-days span { font-size: 11px; color: var(--text-muted); }
.alert-info { flex: 1; }
.alert-name { font-weight: 600; font-size: 14px; }
.alert-desc { font-size: 12px; color: var(--text-muted); }
.alert-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* 测试提醒 */
.test-alert {
  display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.test-card {
  flex: 1; min-width: 240px; padding: 16px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
}
.test-card.error { background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%); border-color: #e9d5ff; }
.test-card.done { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: #bbf7d0; }
.test-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.test-subjects { font-size: 18px; font-weight: 700; color: var(--primary); }
.test-card.error .test-subjects { color: var(--purple); }
.test-card.done .test-subjects { color: var(--success); }
.test-date { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* 仪表盘网格 */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.overview-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.overview-card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.15s;
  text-align: center;
}
.overview-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.ov-icon { font-size: 24px; margin-bottom: 4px; }
.ov-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.ov-value { font-size: 18px; font-weight: 700; }
.ov-value small { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.ov-progress { height: 5px; background: var(--border); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.ov-progress-bar { height: 100%; background: var(--success); border-radius: 3px; transition: width 0.3s; }

/* 知识积累 */
.knowledge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.counter-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.counter-row label { font-size: 13px; color: var(--text-muted); }
.counter-hint { font-size: 12px; color: var(--text-muted); margin: 8px 0; }
.counter-progress { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.cp-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.cp-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 4px; transition: width 0.3s; }
.counter-progress span { font-weight: 700; font-size: 13px; min-width: 40px; text-align: right; }

/* 成绩分析 */
.school-compare { display: flex; flex-direction: column; gap: 12px; }
.school-item {
  padding: 14px 16px; background: #f8fafc; border-radius: 8px;
  border: 1px solid var(--border);
}
.school-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.school-name { font-weight: 700; font-size: 15px; }
.school-diff { font-weight: 700; font-size: 16px; padding: 2px 10px; border-radius: 10px; }
.school-diff.above { color: var(--success); background: #dcfce7; }
.school-diff.below { color: var(--danger); background: #fee2e2; }
.school-detail { font-size: 13px; color: var(--text-muted); }
.school-actions { display: flex; gap: 6px; margin-top: 8px; }
.school-actions button { font-size: 12px; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.school-actions button:hover { border-color: var(--danger); color: var(--danger); }

.weak-subjects { display: flex; flex-direction: column; gap: 8px; }
.weak-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: #f8fafc; border-radius: 8px; border: 1px solid var(--border);
}
.weak-rank { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0; }
.weak-rank.r1 { background: var(--danger); }
.weak-rank.r2 { background: var(--warning); }
.weak-rank.r3 { background: #ca8a04; }
.weak-rank.rn { background: var(--text-muted); }
.weak-name { font-weight: 600; min-width: 80px; }
.weak-score { font-size: 13px; color: var(--text-muted); }
.weak-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.weak-bar { height: 100%; border-radius: 4px; transition: width 0.3s; }
.weak-rate { font-size: 13px; font-weight: 600; min-width: 50px; text-align: right; }
.weak-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.weak-tag.danger { background: #fee2e2; color: var(--danger); }
.weak-tag.warn { background: #fff7ed; color: var(--warning); }
.weak-tag.ok { background: #dcfce7; color: var(--success); }

.score-list { display: flex; flex-direction: column; gap: 10px; }
.score-item { padding: 12px 16px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--border); }
.score-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.score-exam { font-weight: 600; }
.score-total { font-weight: 700; color: var(--primary); font-size: 16px; }
.score-subjects { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 8px; }
.score-actions { display: flex; gap: 6px; margin-top: 8px; }
.score-actions button { font-size: 12px; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.score-actions button:hover { border-color: var(--primary); color: var(--primary); }
.score-actions .del:hover { border-color: var(--danger); color: var(--danger); }

/* 目标拆解 */
.goal-calc { max-width: 500px; }
.calc-result {
  margin-top: 16px; padding: 16px; background: var(--primary-light);
  border-radius: 8px; font-size: 14px; line-height: 1.8;
}
.calc-result .big { font-size: 24px; font-weight: 800; color: var(--primary); }
.goal-list { display: flex; flex-direction: column; gap: 10px; }
.goal-item {
  padding: 14px 16px; background: #f8fafc; border-radius: 8px;
  border: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center;
}
.goal-info { flex: 1; }
.goal-name { font-weight: 600; font-size: 14px; }
.goal-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.goal-days { font-size: 20px; font-weight: 800; color: var(--primary); text-align: center; min-width: 80px; }
.goal-days small { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.goal-actions { display: flex; gap: 6px; margin-left: 12px; }
.goal-actions button { font-size: 12px; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.goal-actions button:hover { border-color: var(--danger); color: var(--danger); }

/* 时间线 */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 16px 20px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.tl-item::before {
  content: ''; position: absolute; left: -24px; top: 22px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary);
}
.tl-item.past::before { background: var(--text-muted); box-shadow: 0 0 0 2px var(--text-muted); }
.tl-item.urgent::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.tl-head { display: flex; justify-content: space-between; align-items: center; }
.tl-name { font-weight: 700; font-size: 15px; }
.tl-countdown { font-size: 13px; font-weight: 600; color: var(--primary); }
.tl-item.urgent .tl-countdown { color: var(--danger); }
.tl-item.past .tl-countdown { color: var(--text-muted); }
.tl-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tl-desc { font-size: 13px; color: var(--text); margin-top: 6px; }
.tl-actions { display: flex; gap: 6px; margin-top: 10px; }
.tl-actions button { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.tl-actions button:hover { border-color: var(--primary); color: var(--primary); }
.tl-actions .del:hover { border-color: var(--danger); color: var(--danger); }

/* 统计 */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.stats-grid .card canvas { max-height: 280px; }
.stat-summary { display: flex; flex-direction: column; gap: 12px; padding: 10px 0; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-row .label { color: var(--text-muted); font-size: 13px; }
.stat-row .value { font-weight: 700; font-size: 16px; }

/* 数据管理 */
.data-actions { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.muted { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.form-row label { min-width: 100px; font-size: 13px; color: var(--text-muted); }
.score-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.score-table th, .score-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.score-table th { background: #f8fafc; font-weight: 600; }
.score-table .total-row { font-weight: 700; background: var(--primary-light); }
.score-table .total-row td { border-bottom: none; }

/* 模态框 */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 90%; max-width: 520px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-group textarea { resize: vertical; min-height: 60px; }
.modal-footer { padding: 0 20px 20px; display: flex; gap: 10px; justify-content: flex-end; }
.score-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 13px; opacity: 0; transition: all 0.25s; z-index: 2000; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 响应式 */
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .logo-title, .logo-sub, .sidebar-footer { display: none; }
  .nav-item { text-align: center; padding: 12px 0; font-size: 20px; }
  .main { margin-left: 60px; padding: 16px; }
  .hero-card { flex-direction: column; text-align: center; gap: 16px; }
  .hero-right { gap: 20px; }
  .dash-grid, .stats-grid { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
}
