/* ===== 基础重置与变量 ===== */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a2332;
  --text-secondary: #5a6678;
  --border: #dde3ea;
  --primary: #1a4d8f;
  --primary-light: #d4e4f7;
  --primary-soft: #edf4fc;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(22, 36, 56, 0.05), 0 4px 12px rgba(22, 36, 56, 0.06);
  --shadow-hover: 0 6px 16px rgba(22, 36, 56, 0.08);
  --max-width: 720px;

  /* 科目标签色（稳重低饱和） */
  --c-math: #2563eb;   --bg-math: #dbeafe;
  --c-eng:  #16a34a;   --bg-eng:  #dcfce7;
  --c-phy:  #d97706;   --bg-phy:  #fef3c7;
  --c-chem: #7c3aed;   --bg-chem: #ede9fe;
  --c-cn:   #dc2626;   --bg-cn:   #fee2e2;
  --c-oth:  #4b5563;   --bg-oth:  #e5e7eb;
  --c-play: #db2777;   --bg-play: #fce7f3;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部进度导航 ===== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.nav-link.active .nav-dot { opacity: 1; }

.progress-bar {
  height: 2px;
  background: var(--border);
  position: relative;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.15s linear;
}

/* ===== 页面容器 ===== */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ===== 教材版本提示条 ===== */
.version-bar {
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #6d4c03;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 16px;
}
.version-bar strong { color: #4a3b05; }

/* ===== Hero 头部 ===== */
.hero {
  text-align: center;
  padding: 26px 20px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, #ffffff 72%);
  border-top: 4px solid var(--primary);
}

.hero-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: 25px;
  margin: 0 0 10px;
  color: #0f172a;
  line-height: 1.3;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 13px;
}
.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.hero-meta span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-secondary);
  opacity: 0.5;
}
.hero-meta span:first-child::before { display: none; }

.goals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  text-align: left;
}
.goal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.goal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== 通用标题 ===== */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary-soft);
  font-size: 17px;
}
h2 {
  font-size: 18px;
  margin: 0;
  color: var(--primary);
  font-weight: 700;
}

h3 {
  font-size: 15px;
  margin: 0 0 12px;
  color: #0f172a;
  font-weight: 600;
}

p, ul { margin: 0 0 12px; }
ul { padding-left: 20px; }
li { margin: 6px 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 科目标签（小药丸） ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 4px 2px 0;
  white-space: nowrap;
}
.t-math { background: var(--bg-math); color: #1e3a8a; }
.t-eng  { background: var(--bg-eng);  color: #14532d; }
.t-phy  { background: var(--bg-phy);  color: #78350f; }
.t-chem { background: var(--bg-chem); color: #4c1d95; }
.t-cn   { background: var(--bg-cn);   color: #7f1d1d; }
.t-oth  { background: var(--bg-oth);  color: #374151; }
.t-play { background: var(--bg-play); color: #831843; }

/* ===== 今日清单 ===== */
.today-card {
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
  border: 1px solid #bfdbfe;
}
.today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.today-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
}
.today-date {
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.8);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.week-focus {
  font-size: 13px;
  color: #3b4d66;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  border-left: 3px solid var(--primary);
}

.task-list {
  padding: 0;
  margin: 0 0 12px;
}

.today-hint {
  font-size: 13px;
  color: #92400e;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.task-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.task-card:last-child { margin-bottom: 0; }

.task-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.task-card-icon {
  font-size: 20px;
  line-height: 1;
}

.task-card-label {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary);
}

.task-card-title {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.est-time {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--primary-soft);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.task-subitems {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-subitems li {
  margin: 0 0 8px;
  padding: 10px 12px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: background 0.15s;
}
.task-subitems li:last-child { margin-bottom: 0; }
.task-subitems li.done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.task-subitems li.done .task-text {
  text-decoration: line-through;
  color: var(--text-secondary);
}
.task-subitems input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.task-subitems .task-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
}

.task-reset-note {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 10px;
}

/* 每日任务模板表格 */
.schedule-template-table th,
.schedule-template-table td {
  width: auto;
}
.schedule-template-table th:nth-child(1),
.schedule-template-table td:nth-child(1) { width: 18%; }
.schedule-template-table th:nth-child(2),
.schedule-template-table td:nth-child(2) { width: 22%; }
.schedule-template-table th:nth-child(4),
.schedule-template-table td:nth-child(4) { width: 18%; text-align: center; }

@media (max-width: 480px) {
  .schedule-template-table,
  .schedule-template-table thead,
  .schedule-template-table tbody,
  .schedule-template-table tr,
  .schedule-template-table th,
  .schedule-template-table td {
    display: block;
  }
  .schedule-template-table thead { display: none; }
  .schedule-template-table tr {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
  }
  .schedule-template-table tr:last-child { margin-bottom: 0; }
  .schedule-template-table td {
    padding: 5px 0;
    border: none;
    border-bottom: 1px dashed var(--border);
    text-align: left;
    width: auto !important;
  }
  .schedule-template-table td:last-child { border-bottom: none; }
  .schedule-template-table td::before {
    display: inline-block;
    min-width: 70px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
  }
  .schedule-template-table td:nth-child(1)::before { content: '时段：'; }
  .schedule-template-table td:nth-child(2)::before { content: '任务类型：'; }
  .schedule-template-table td:nth-child(3)::before { content: '完成标准：'; }
  .schedule-template-table td:nth-child(4) { text-align: left; }
  .schedule-template-table td:nth-child(4)::before { content: '参考时间：'; }

  .task-card-head {
    gap: 6px;
  }
  .task-card-title {
    width: 100%;
    margin-top: 2px;
  }
  .est-time {
    margin-left: auto;
  }
}

/* ===== 学习记录与抽查 ===== */
.record-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 14px;
}
.record-card:first-of-type { margin-top: 18px; }
.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.record-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.record-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 8px;
  border-radius: 999px;
}
.record-note {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}
.record-table th,
.record-table td {
  padding: 8px 6px;
  text-align: center;
  border: 1px solid var(--border);
  vertical-align: middle;
}
.record-table th {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
}
.record-table td:first-child {
  font-weight: 600;
  background: #fafbfc;
}
.record-table input {
  width: 100%;
  min-width: 44px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  background: #fff;
}
.record-table input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.record-total {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.record-total-item {
  flex: 1 1 auto;
  min-width: 120px;
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}
.record-total-item .num {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.record-total-item .label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 抽查项 */
.check-item {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.check-item:last-child { margin-bottom: 0; }
.check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.check-row:last-child { margin-bottom: 0; }
.check-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 56px;
}
.check-select {
  flex: 1 1 160px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.check-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}
.check-options label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  cursor: pointer;
}
.check-options input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ===== 每周数据 ===== */
.week-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.summary-tile {
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
}
.summary-tile .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}
.summary-tile .label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.summary-bar-wrap {
  margin-top: 14px;
}
.summary-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.summary-bar {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.summary-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.summary-bar-fill.low { background: #dc2626; }
.summary-bar-fill.mid { background: #d97706; }
.summary-bar-fill.high { background: #16a34a }

/* ===== 每日时间表 ===== */
.schedule-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.schedule-block {
  background: #fafbfc;
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border);
}

.time-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.time-table th,
.time-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.time-table th {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  width: 34%;
}
.time-table tr:last-child td { border-bottom: none; }
.time-table tr.play td {
  background: var(--bg-play);
  color: #831843;
}
.time-table tr.play td:first-child { font-weight: 600; }

.core-hours {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary);
}
.core-hours strong { font-weight: 700; }

.tip {
  margin-top: 12px;
  padding: 12px 14px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  font-size: 13px;
  color: #78350f;
}
.tip strong { color: #92400e; }

/* ===== 六周阶段计划 ===== */
.phase-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.phase-table thead { display: none; }
.phase-table tbody {
  display: block;
  margin-bottom: 16px;
}
.phase-table tbody:last-child { margin-bottom: 0; }

.phase-head {
  display: block;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.5;
}
.phase-head td {
  display: block;
  padding: 0;
  border: none;
  background: transparent !important;
}

.phase-table tr.week {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  padding: 14px;
  gap: 10px;
}
.phase-table tbody tr.week:first-of-type { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.phase-table tbody tr.week:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

.phase-table .week td {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0;
  border: none;
}
.phase-table .week td:first-child {
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
  font-weight: 700;
  color: var(--primary);
}
.phase-table .week td:first-child small {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 12px;
}
.phase-table .week td::before {
  content: attr(data-label);
  flex: 0 0 auto;
  min-width: 48px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.phase-table .week td:first-child::before { display: none; }

.wrapup td {
  display: block;
  padding: 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: #14532d;
  line-height: 1.7;
}
.phase-table .week td .cell-content {
  flex: 1 1 0;
  min-width: 0;
}

/* ===== 购书推荐 ===== */
.lead-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
}
.lead-text strong { color: var(--primary); }

.book {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 14px;
}
.book:last-of-type { margin-bottom: 0; }
.book h3 {
  font-size: 15px;
  margin: 0 0 6px;
  color: #0f172a;
}
.book-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.6;
}
.book ul { margin: 0; padding-left: 18px; }
.book li { margin: 7px 0; font-size: 14px; }
.book a { word-break: break-all; }

.book-featured {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}
.book-later {
  border-style: dashed;
  background: #f9fafb;
}
.book-later h3 { color: var(--text-secondary); }

/* ===== 注意事项 ===== */
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checklist li {
  position: relative;
  padding: 12px 14px 12px 42px;
  margin: 0 0 10px;
  background: #fafbfc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.65;
}
.checklist li::before {
  content: "✓";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.checklist strong { color: var(--primary); }

/* ===== 页脚 ===== */
.page-footer {
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 10px 0 0;
}

/* ===== 家长视图 ===== */
.view-hidden { display: none !important; }

.parent-section { margin-bottom: 18px; }
.parent-section:last-child { margin-bottom: 0; }
.parent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
}
.parent-head h3 {
  margin: 0;
  font-size: 15px;
  color: var(--primary);
}
.parent-toggle { font-size: 13px; color: var(--text-secondary); }
.parent-body {
  display: none;
  padding-top: 12px;
}
.parent-body.open { display: block; }

.subject-status-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.subject-status-card:last-child { margin-bottom: 0; }
.subject-status-icon { font-size: 20px; }
.subject-status-main { flex: 1; min-width: 0; }
.subject-status-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.subject-status-plan {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subject-status-meta {
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.subject-status-meta strong { color: var(--text); }

.completion-rate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
}
.completion-rate .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}
.completion-rate .label { font-size: 13px; color: var(--text-secondary); }

.history-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.history-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #fafbfc;
  cursor: pointer;
}
.history-summary:hover { background: #f1f5f9; }
.history-detail {
  display: none;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.history-detail.open { display: block; }

/* ===== 学生版记录表单（卡片式） ===== */
.record-form-list { margin-top: 14px; }
.record-form-card {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
}
.record-form-card:last-child { margin-bottom: 0; }
.record-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.record-form-title { font-weight: 700; font-size: 15px; }
.status-btns {
  display: flex;
  gap: 6px;
}
.status-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.status-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.form-grid.full { grid-template-columns: 1fr; }
.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-field label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.form-field input,
.form-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.form-field textarea {
  resize: vertical;
  min-height: 60px;
}

.photo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.photo-input {
  font-size: 13px;
  flex: 1 1 160px;
}
.photo-btn {
  padding: 7px 14px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.photo-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.photo-previews img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.save-btn {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.save-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.save-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
}

/* ===== 移动端紧凑适配 ===== */
@media (max-width: 480px) {
  /* 顶部导航在 390px 级视口下缩小并完全排下，避免撑出页面横向滚动 */
  .nav-inner {
    gap: 3px;
    padding: 8px 10px;
  }
  .nav-link {
    padding: 4px 6px;
    font-size: 11px;
    gap: 3px;
    flex: 1 1 auto;
    justify-content: center;
  }
  .nav-dot {
    width: 5px;
    height: 5px;
  }

  /* 今日学习记录表格改为卡片堆叠，6 列不再挤爆屏幕 */
  .record-table {
    display: block;
  }
  .record-table thead {
    display: none;
  }
  .record-table tbody,
  .record-table tr,
  .record-table td {
    display: block;
  }
  .record-table tr {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
  }
  .record-table tr:last-child {
    margin-bottom: 0;
  }
  .record-table td {
    padding: 7px 0;
    border: none;
    border-bottom: 1px dashed var(--border);
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .record-table td:last-child {
    border-bottom: none;
  }
  .record-table td:first-child {
    background: transparent;
    justify-content: flex-start;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
  }
  .record-table td::before {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
  }
  .record-table td:nth-child(2)::before { content: '做题数'; }
  .record-table td:nth-child(3)::before { content: '正确数'; }
  .record-table td:nth-child(4)::before { content: '错题数'; }
  .record-table td:nth-child(5)::before { content: '用时(分)'; }
  .record-table td:nth-child(6)::before { content: '错题本页码'; }
  .record-table td:first-child::before {
    display: none;
  }
  .record-table input {
    width: 80px;
    max-width: 80px;
    min-width: auto;
    text-align: right;
    padding: 6px 8px;
  }
}

/* ===== 桌面端增强 ===== */
@media (min-width: 720px) {
  .wrap { padding: 24px 20px 40px; }
  .card { padding: 26px 28px; margin-bottom: 20px; }
  .hero { padding: 32px 28px; }
  .hero h1 { font-size: 30px; }
  .goals { grid-template-columns: repeat(3, 1fr); text-align: center; }
  .goal { justify-content: center; }
  .schedule-grid { grid-template-columns: 1fr 1fr; }
  .record-table th,
  .record-table td { padding: 10px 8px; }

  /* 六周计划在桌面端恢复为表格 */
  .phase-table { display: table; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
  .phase-table thead { display: table-header-group; }
  .phase-table tbody { display: table-row-group; margin-bottom: 0; }
  .phase-table tr { display: table-row; }
  .phase-table th,
  .phase-table td {
    display: table-cell;
    padding: 11px 13px;
    border: 1px solid var(--border);
    vertical-align: top;
  }
  .phase-table th {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
  }
  .phase-head {
    display: table-row;
    background: var(--primary);
    color: #fff;
    border-radius: 0;
    padding: 0;
    font-size: inherit;
  }
  .phase-head td {
    display: table-cell;
    background: var(--primary) !important;
    color: #fff;
    font-weight: 700;
    padding: 11px 13px;
  }
  .phase-table .week td,
  .phase-table .week td:first-child {
    flex-direction: row;
    gap: 0;
    padding: 11px 13px;
    border-bottom: 1px solid var(--border);
    font-weight: normal;
    color: var(--text);
  }
  .phase-table .week td::before { display: none; }
  .phase-table tr:nth-child(even) td { background: #fafbfc; }
  .phase-table .wrapup td {
    display: table-cell;
    background: #f0fdf4;
    border: 1px solid var(--border);
    border-radius: 0;
    color: #14532d;
  }
}

/* ===== 打印样式（A4） ===== */
@media print {
  html { scroll-behavior: auto; scroll-padding-top: 0; }
  .top-nav, .version-bar, .today-card { display: none !important; }
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
    line-height: 1.5;
  }
  .wrap {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  .card {
    box-shadow: none;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 14px;
    page-break-inside: avoid;
  }
  .hero {
    background: #fff;
    border-top: 3px solid var(--primary);
    padding: 16px 18px;
  }
  .hero-badge { background: var(--primary); color: #fff; }
  .goals { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .goal { background: #f9fafb; padding: 8px 10px; font-size: 11pt; }
  .section-icon { background: var(--primary-soft); }
  h2 { font-size: 15pt; }
  h3 { font-size: 12pt; }

  .schedule-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .schedule-block { padding: 12px; }
  .time-table { font-size: 10pt; }
  .time-table th,
  .time-table td { padding: 6px 8px; }
  .tip { font-size: 10pt; padding: 8px 10px; }

  .phase-table { display: table; border: 1px solid #d1d5db; font-size: 9.5pt; }
  .phase-table thead { display: table-header-group; }
  .phase-table tbody { display: table-row-group; margin-bottom: 0; }
  .phase-table tr { display: table-row; }
  .phase-table th,
  .phase-table td {
    display: table-cell;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
  }
  .phase-head { display: table-row; background: var(--primary); color: #fff; }
  .phase-head td { display: table-cell; background: var(--primary) !important; color: #fff; padding: 6px 8px; }
  .phase-table .week { display: table-row; padding: 0; border: none; gap: 0; }
  .phase-table .week td,
  .phase-table .week td:first-child {
    display: table-cell;
    flex-direction: row;
    gap: 0;
    padding: 6px 8px;
    border-bottom: 1px solid #d1d5db;
    font-weight: normal;
    color: #000;
  }
  .phase-table .week td::before { display: none; }
  .phase-table tr:nth-child(even) td { background: #f9fafb; }
  .phase-table .wrapup td {
    display: table-cell;
    background: #f0fdf4;
    border: 1px solid #d1d5db;
    color: #14532d;
    padding: 6px 8px;
  }

  .book { padding: 12px; margin-bottom: 10px; }
  .book h3 { font-size: 11pt; }
  .book-desc { font-size: 10pt; }
  .book li { font-size: 10pt; }

  .checklist li { padding: 8px 10px 8px 34px; font-size: 10.5pt; margin-bottom: 6px; }
  .checklist li::before { width: 16px; height: 16px; left: 10px; font-size: 9px; }

  /* 打印时记录与抽查要可见且美观 */
  .record-card {
    border: 1px solid #d1d5db;
    padding: 12px;
    margin-top: 12px;
  }
  .record-table { font-size: 10pt; }
  .record-table th,
  .record-table td { padding: 5px 4px; border: 1px solid #d1d5db; }
  .record-table input {
    border: 1px solid #9ca3af;
    background: #fff;
  }
  .check-item { padding: 10px; }
  .week-summary { gap: 8px; }
  .summary-tile { padding: 10px; }
  .summary-tile .num { font-size: 16pt; }
  .summary-bar { background: #e5e7eb; }

  .page-footer { color: #6b7280; padding-top: 6px; }

  @page { size: A4; margin: 12mm; }
}
