/* ============================================================
 * 仓储打包优化打卡 PWA —— 样式
 * 简洁、清晰、适合中老年用户：大字号、高对比、少装饰
 * ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #16a34a;
  --amber: #d97706;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
  padding-bottom: 76px;
}

/* 顶部标题 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--primary); color: #fff;
  padding: 16px 18px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.topbar h1 { font-size: 19px; font-weight: 700; }
.topbar .sub { font-size: 13px; opacity: .9; margin-top: 2px; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  flex: 1; padding: 10px 0 9px; border: none; background: none;
  font-size: 13px; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab-btn .ic { font-size: 19px; line-height: 1; }
.tab-btn.active { color: var(--primary); font-weight: 600; }

/* 视图 */
.view { display: none; padding: 16px; max-width: 680px; margin: 0 auto; }
.view.active { display: block; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.card h2 { font-size: 17px; margin-bottom: 10px; }
.card p { margin-bottom: 8px; }

/* 首页 */
.label {
  display: inline-block; background: var(--primary); color: #fff;
  font-size: 13px; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.task-title { font-size: 20px; font-weight: 700; margin: 6px 0 10px; }
.sect-label { font-weight: 700; margin: 10px 0 4px; display: flex; align-items: center; gap: 6px; }
.box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.box.gray { color: #374151; }
.box p { margin: 4px 0; }
.box .li, .box .ol { margin: 4px 0 4px 8px; }
.box .p-space { height: 6px; }

.progress-track { background: var(--line); border-radius: 999px; height: 14px; overflow: hidden; }
.progress-fill { background: var(--green); height: 100%; width: 0; border-radius: 999px; transition: width .4s; }
.progress-text { font-size: 13px; color: var(--muted); margin-top: 4px; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.stat-chip {
  flex: 1; min-width: 90px; background: #eff6ff; color: var(--primary-dark);
  border-radius: 10px; padding: 10px; text-align: center;
}
.stat-chip b { display: block; font-size: 20px; }
.stat-chip span { font-size: 12px; }

/* 输入与按钮 */
textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 16px; font-family: inherit; resize: vertical;
  min-height: 64px;
}
.btn {
  width: 100%; border: none; border-radius: 12px; padding: 14px;
  font-size: 17px; font-weight: 600; cursor: pointer; margin-top: 8px;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary.done { background: var(--green); }
.btn.primary:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: #fff; color: var(--muted); border: 1px solid var(--line); }

.file-label {
  display: block; background: #f0f9ff; border: 1px dashed #7dd3fc;
  color: #0369a1; border-radius: 10px; padding: 12px; text-align: center;
  font-size: 14px; cursor: pointer; margin-top: 8px;
}
.file-label input { display: none; }
.img-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-del {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
  background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%;
  font-size: 13px; line-height: 1; cursor: pointer;
}

/* 课程总览 */
.week-block { background: var(--card); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.week-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; cursor: pointer; font-weight: 600;
  background: #fff; border-bottom: 1px solid transparent;
}
.week-head .week-title { color: var(--muted); font-weight: 400; font-size: 14px; }
.week-block.open .week-head { border-bottom-color: var(--line); }
.week-body { display: none; padding: 4px 16px 14px; }
.week-block.open .week-body { display: block; }
.course-item { border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; }
.course-item.done { border-color: #bbf7d0; background: #f0fdf4; }
.course-item.skip { border-color: #fde68a; background: #fffbeb; }
.ci-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.course-item .ci-top:hover { background: rgba(0,0,0,.02); }
.ci-day { font-size: 12px; color: var(--muted); background: var(--line); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.ci-title { flex: 1; font-weight: 600; font-size: 15px; }
.ci-badge { font-size: 15px; }
.ci-detail { display: none; padding: 0 12px 12px; }
.course-item.open .ci-detail { display: block; }
.ci-label { font-size: 13px; color: var(--primary-dark); font-weight: 600; margin: 6px 0 2px; }
.ci-detail p { margin: 4px 0; }
.ci-detail .li, .ci-detail .ol { margin: 4px 0 4px 8px; }
.ci-detail .p-space { height: 5px; }
.ci-note { color: var(--muted); font-size: 14px; }

/* 作品集 */
.pf-imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pf-imgs img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.count-bar { font-size: 15px; color: var(--muted); margin-bottom: 12px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* 统计 */
.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.badge {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center;
  background: #f0fdf4;
}
.badge.locked { background: #fff; opacity: .7; }
.badge .b-name { font-size: 14px; font-weight: 600; margin-top: 6px; }
.heatmap { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.heat-cell { width: 22px; height: 22px; border-radius: 5px; background: var(--line); }
.heat-cell.active { background: var(--green); }

/* 导出按钮组 */
.export-row { display: flex; gap: 10px; }
.export-row .btn { margin-top: 0; }
.btn.small { font-size: 14px; padding: 12px; }

/* Toast */
#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(17,24,39,.92); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 50; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* 说明 */
.hint { font-size: 14px; color: var(--muted); }
