/* ============================================================
   333动态背诵系统 · 移动端商品版样式（阶段5 精修）
   规则：页面背景浅灰 / 一级内容区白 / 二级用间距+极浅底区分；
        只有可点击或可输入的组件才明显描边；圆角只用 3 档；
        蓝色仅用于 active、主要数字、主要操作。
   本文件只影响展示，不含任何业务逻辑。
   ============================================================ */

* { box-sizing: border-box; }

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --sunken: #f7f8fa;            /* 二级区块极浅底（替代边框） */
  --nav-bg: #edeff3;            /* segmented 导航容器底 */
  --border: #e9ebef;            /* 极浅分隔线 */
  --border-input: #dcdfe6;      /* 可输入/可点击组件描边 */
  --text: #1f2329;
  --text-2: #4e5969;
  --text-3: #8a919f;
  --text-4: #a8aeb8;
  --primary: #165dff;
  --primary-soft: #eef4ff;
  --primary-line: #d4e1ff;
  --green: #2e9b54;
  --green-soft: #f0faf3;
  --red: #cb2634;
  --radius: 12px;               /* 卡片 */
  --radius-sm: 10px;             /* 输入框 */
  --radius-xs: 8px;             /* 按钮 / chip */
  --field-h: 46px;              /* 表单控件统一高度（≥44 触控） */
  --gap-field: 22px;            /* 字段间距 */
  --primary-ink: #1d52e0;      /* 蓝：强调文字 */
  --shadow: 0 1px 2px rgba(20,30,60,.05);   /* 方案 A：轻阴影，给一级白卡一点浮起感（非重阴影） */
  --shadow-2: 0 2px 8px rgba(20,30,60,.06);
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  margin: 0; background: var(--bg); color: var(--text);
  padding: 20px; -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 1040px; margin: 0 auto; }

/* ---------- 标题 + segmented 顶部导航 ---------- */
h1 {
  font-size: 26px; font-weight: 700; line-height: 1.25;
  letter-spacing: -.3px; margin: 0 0 10px;
}
.tabs {
  display: flex; gap: 2px; padding: 3px; margin: 0 0 12px;
  background: var(--nav-bg); border-radius: var(--radius);
}
.tab {
  flex: 1 1 0; min-width: 0; height: 36px; padding: 0 2px;
  background: transparent; border: 0; border-radius: var(--radius-xs);
  color: var(--text-2); font-size: 13px; font-weight: 500;
  text-align: center; white-space: nowrap; overflow: hidden;
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); font-weight: 600; }
.tab[data-tab="faq"] { font-size: 12px; }

/* ---------- 通用容器 ---------- */
.panel {
  background: var(--surface); border: 0; border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--text); }
.p-title { margin: 0 0 2px; }
.p-sub { font-size: 12px; color: var(--text-3); line-height: 1.5; margin-bottom: 10px; }
.note { font-size: 12px; color: var(--text-3); line-height: 1.6; margin: 0 0 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
button {
  background: var(--primary); color: #fff; border: 0;
  padding: 10px 16px; border-radius: var(--radius-xs);
  font-size: 14px; cursor: pointer; font-family: inherit;
}
button.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary-line); }
button.ghost.danger { color: var(--red); border-color: #f3c9c9; }
.linkbtn { background: none; border: 0; color: var(--primary); font-size: 13px; padding: 0 2px; text-decoration: underline; cursor: pointer; }
button, .tab, input, select, .chk { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, .tab { user-select: none; }

/* ---------- 表单（iOS 原生控件保持可用，仅统一尺寸/间距） ---------- */
.field { display: flex; flex-direction: column; gap: 8px; margin: 0 0 var(--gap-field); }
.field:last-child { margin-bottom: 0; }
.field > span, label.field > span { font-size: 13px; color: var(--text-2); line-height: 1.3; }
input, select {
  width: 100%; height: var(--field-h); min-height: var(--field-h);
  padding: 0 12px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--border-input); border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
}
input[type="date"] { padding-right: 8px; }        /* 保留 Safari 原生日期选择器 */
input:focus, select:focus { outline: none; border-color: var(--primary-line); }
/* 复习范围 2×2 与科目 chip 样式见下方「目标设置：分组」 */

/* ---------- 目标设置：说明折叠（轻量，无大卡） ---------- */
.intro { background: transparent; border: 0; padding: 0; margin: 0 0 18px; }
.help-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: transparent; border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: 6px 0;
  font-size: 14px; color: var(--text-2); cursor: pointer;
}
.help-ico { font-size: 15px; line-height: 1; }
.help-title { flex: 1; font-weight: 500; }
.help-chev { color: var(--text-3); font-size: 18px; line-height: 1; transition: transform .2s ease; }
.help-toggle[aria-expanded="true"] .help-chev { transform: rotate(90deg); }
.help-body { margin-top: 10px; background: var(--surface); border: 0; border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow); }
.help-body ol { margin: 0; padding-left: 20px; }
.help-body ol li { margin: 6px 0; font-size: 13px; line-height: 1.55; color: var(--text-2); }
.help-body .note { margin: 8px 0 0; }

/* ---------- 目标设置：页头（标题 + 简短说明） ---------- */
.setup-head { margin: 0 0 18px; }
.setup-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.2px; color: var(--text); }
.setup-sub { margin: 6px 0 0; font-size: 13px; color: var(--text-3); line-height: 1.55; }

/* ---------- 目标设置：分组（透明 section + 圆点标题 + 分隔线，无大卡套大卡） ---------- */
.setup-section { background: transparent; border: 0; padding: 0; margin-bottom: 30px; }
.setup-sec-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 14px; }
.setup-sec-title::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); opacity: .7; flex: 0 0 auto; }
.setup-submit { margin: 4px 0 0; }
.setup-submit button { width: 100%; height: var(--field-h); font-size: 15px; font-weight: 600; }

/* 考试目标：3 列参数块（同一轻量区域，非独立卡片、无重阴影） */
.goal-params {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 0 12px;
  background: #f6f7f9;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.gparam { display: flex; flex-direction: column; gap: 6px; }
.gparam + .gparam { border-left: 1px solid var(--border); padding-left: 12px; }
.gparam-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.gparam-val { display: flex; align-items: baseline; gap: 3px; }
.gparam-unit { font-size: 12px; color: var(--text-3); font-weight: 500; }

/* 统一控件：设置页所有 input/select（排除 checkbox），高度/圆角/边框一致，focus 才蓝 */
#tab-setup input:not([type="checkbox"]),
#tab-setup select {
  height: 44px;
  border: 1px solid #dde2ea;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
}
#tab-setup input:not([type="checkbox"]):focus,
#tab-setup select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
#tab-setup .gparam-input {
  font-size: 18px; font-weight: 700;
  width: auto; min-width: 0; flex: 0 1 auto; padding: 0 8px;
}
#tab-setup .gparam-date { width: 100%; flex: 1 1 auto; font-size: 16px; }
#tab-setup .gparam-input[type="number"]::-webkit-inner-spin-button,
#tab-setup .gparam-input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#tab-setup .gparam-input[type="number"] { -moz-appearance: textfield; }
#tab-setup .gsec select { width: 100%; font-size: 14px; padding: 0 10px; }

/* 次级设置：当前进度 / 学习模式 */
.goal-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.gsec { display: flex; flex-direction: column; gap: 6px; }
.gsec-label { font-size: 12px; color: var(--text-3); font-weight: 500; }

/* 复习范围：2×2 科目选择（选中=极浅蓝灰底+淡蓝灰边+左侧小蓝勾；不整块高饱和蓝） */
.chips-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chk {
  position: relative;
  display: flex; align-items: center;
  padding: 13px 14px 13px 40px;
  margin: 0;
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer;
}
.chk input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.chk::before {
  content: ""; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid #c7ccd6; box-sizing: border-box; background: #fff;
}
.chk:has(input:checked) { background: #f3f6fb; border-color: #c9d6e8; }
.chk:has(input:checked)::before { background: var(--primary); border-color: var(--primary); }
.chk:has(input:checked)::after {
  content: ""; position: absolute; left: 18.5px; top: 50%;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: translateY(-65%) rotate(45deg);
}

/* 每科复习顺序：轻量 section（留白 + 极浅分隔线，非厚卡片） */
.so-list { display: flex; flex-direction: column; }
.subject-order {
  background: transparent; border: 0;
  border-top: 1px solid var(--border);
  padding: 16px 0;
}
.subject-order:first-child { border-top: 0; padding-top: 0; }
.subject-order.hidden { display: none; }
.so-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.so-name { font-size: 15px; font-weight: 700; color: var(--text); }
.so-start { display: flex; align-items: center; gap: 2px; }
.so-cap { font-size: 13px; color: var(--text-2); }
.so-start-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.so-unit-row { margin-top: 8px; }
.so-chapter, .so-unit { width: 100%; min-width: 0; font-size: 13px; text-align: left; text-overflow: ellipsis; }
.so-pick { margin-top: 10px; font-size: 13px; line-height: 1.5; word-break: break-word; }
.so-unit-chapter { color: var(--text-3); font-size: 12px; margin-right: 4px; }
.so-unit-name { color: var(--primary); font-weight: 600; }
.so-dir-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.so-dir-label { font-size: 13px; color: var(--text-2); }
.so-dir { display: flex; gap: 8px; }
.so-dir button {
  height: 44px; min-width: 64px; padding: 0 16px;
  border-radius: 10px; border: 1px solid #dde2ea; background: #fff; color: var(--text-2);
  font-size: 14px; font-weight: 600;
}
.so-dir button.so-on { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.so-hint { font-size: 12px; color: var(--text-3); margin-top: 10px; line-height: 1.5; }
/* 后续轮次模式：与 so-dir 同风格 chip；375px 下自动换行两排，文字完整可读 */
.so-round-row { margin-top: 12px; }
.so-round-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.so-round { display: flex; flex-wrap: wrap; gap: 8px; }
.so-round button {
  height: 44px; min-width: 0; padding: 0 14px; flex: 1 1 auto;
  border-radius: 10px; border: 1px solid #dde2ea; background: #fff; color: var(--text-2);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.so-round button.so-on { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.so-round-desc { font-size: 12px; color: var(--text-3); margin-top: 8px; line-height: 1.5; }

/* ---------- 目标设置：数据与计划管理（页尾折叠） ---------- */
.manage-wrap { flex-direction: column; align-items: stretch; gap: 0; margin-top: 18px; }
.manage-toggle {
  display: flex; align-items: center; width: 100%;
  background: transparent; border: 0; border-top: 1px solid var(--border);
  padding: 14px 2px; font-size: 14px; color: var(--text-2); cursor: pointer;
}
.mt-title { flex: 1; text-align: left; }
.mt-chev { color: var(--text-4); font-size: 18px; line-height: 1; transition: transform .2s ease; }
.manage-toggle[aria-expanded="true"] .mt-chev { transform: rotate(90deg); }
.manage-body { display: flex; flex-direction: column; gap: 10px; padding: 0 0 4px; }
.manage-body[hidden] { display: none; }
.manage-body .ghost { width: 100%; height: 44px; background: #fff; border: 1px solid var(--border-input); color: var(--text); font-size: 14px; border-radius: var(--radius-sm); }
.manage-danger { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.manage-body .danger, .manage-body .ghost.danger { color: var(--red); border-color: #f3c9c9; }
.manage-hint { font-size: 12px; color: var(--text-4); margin: 6px 0 0; line-height: 1.5; }

/* ---------- 今日任务：头部信息卡（紧凑） ---------- */
.today-head { padding: 12px 16px; }
.th-row1 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.today-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.today-sub { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.th-row2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.today-nowround { display: inline-block; font-size: 12px; font-weight: 600; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 3px 9px; }
.today-curfini { font-size: 14px; color: var(--text-2); }
.today-curfini b { color: var(--primary); font-size: 15px; }
.today-grad { font-size: 13px; color: var(--text-2); margin-top: 6px; line-height: 1.6; }

/* 紧凑横向 timeline（A：节点 + 连线 + 日期，比三列日期条更有节奏感） */
.timeline { display: flex; align-items: flex-start; justify-content: space-between; position: relative; margin: 12px 2px 2px; }
.timeline::before { content: ""; position: absolute; top: 5px; left: 17%; right: 17%; height: 2px; background: var(--border-input); }
.tl-node { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; z-index: 1; }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid var(--border-input); box-sizing: border-box; }
.tl-node.done .tl-dot { background: var(--primary); border-color: var(--primary); }
.tl-node.current .tl-dot { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tl-label { font-size: 11.5px; color: var(--text-2); font-weight: 700; }
.tl-node.current .tl-label { color: var(--primary); }
.tl-date { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

.today-allfinish { font-size: 12px; color: var(--text-3); margin-top: 10px; line-height: 1.5; }
.today-allfinish b { color: var(--text-2); font-weight: 600; }
.exam-ok { font-size: 13px; color: #237804; margin-top: 4px; }
.exam-bad { font-size: 13px; color: var(--red); margin-top: 4px; line-height: 1.6; }
.today-adjust { font-size: 12px; color: var(--green); margin-top: 8px; }
.overdue-soft { background: var(--primary-soft); border-radius: var(--radius-xs); padding: 9px 11px; margin-top: 10px; font-size: 12px; color: var(--text-2); line-height: 1.6; }
.overdue-soft b { color: var(--primary); }

/* ---------- 今日任务：任务卡（外层不再套卡） ---------- */
.task-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 14px; margin: 0; box-shadow: var(--shadow); }
.task-card-head { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; line-height: 1.4; }
.task-card-name { font-size: 16px; font-weight: 700; color: var(--text); margin: 4px 0 2px; line-height: 1.4; word-break: break-word; overflow-wrap: anywhere; }
.task-card-est { font-size: 12px; color: var(--text-4); margin-bottom: 8px; }
.task-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.tag-re { background: #fdf3e6; color: #b8792b; }
.tag-back { background: var(--primary-soft); color: var(--primary); }
.task-done { color: var(--green); font-size: 14px; font-weight: 600; }
.done { color: var(--green); font-size: 13px; font-weight: 600; }

/* 四个反馈按钮：2×2 低饱和 pill（移动端优先），视觉高度收敛，标题仍是主体 */
.fb { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.fb button { height: 36px; padding: 0; border-radius: 999px; border: 1px solid var(--border-input); background: #fbfcfd; color: var(--text-2); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.fb button:active { filter: brightness(.97); }
.fb button[data-f="熟练"]  { color: #3a9c62; border-color: #cfe9da; background: #f4faf6; }
.fb button[data-f="模糊"]  { color: #b8862c; border-color: #efe0bd; background: #fdf8ee; }
.fb button[data-f="不会"]  { color: #c76b6b; border-color: #f0d2d2; background: #fdf5f5; }
.fb button[data-f="未完成"] { color: #767d8a; border-color: var(--border-input); background: #f8f9fa; }

.done-banner { background: var(--green-soft); border: 1px solid #cdead7; color: #237804; border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; font-weight: 600; font-size: 14px; }
.done-banner.big { font-size: 16px; text-align: center; padding: 18px; }

/* ---------- 我的计划 ---------- */
.plan-summary { background: var(--surface); border: 0; border-radius: var(--radius); padding: 13px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.ps-title { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.ps-key { font-size: 13px; font-weight: 500; color: var(--text-3); margin-top: 6px; line-height: 1.4; }
.ps-subj { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.4; }
.ps-finish { font-size: 15px; color: var(--text-2); margin-top: 6px; line-height: 1.4; }
.ps-finish b { color: var(--primary); font-size: 17px; font-weight: 700; }
.ps-baseline { font-size: 12px; color: var(--text-4); margin-top: 6px; line-height: 1.5; }
.ps-note { font-size: 12px; color: var(--text-4); margin-top: 4px; }
.ps-line { font-size: 14px; color: var(--text-2); margin: 2px 0; }
.ps-warn { font-size: 14px; color: var(--red); margin-top: 6px; line-height: 1.5; }
.plan-summary .ghost { margin-top: 10px; }
.plan-overdue-note { background: #fff8ec; border-radius: var(--radius-xs); padding: 9px 11px; margin-top: 10px; font-size: 12px; color: #96601a; line-height: 1.6; }
.plan-overdue-note b { color: #96601a; }

.round-plan { background: transparent; border: 0; border-radius: 0; padding: 0; margin-bottom: 12px; box-shadow: none; }
.round-plan-title { font-size: 13px; font-weight: 600; color: var(--text-3); margin-bottom: 4px; }
.rp-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.rp-row:last-child { border-bottom: 0; padding-bottom: 0; }
.rp-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--border-input); flex: 0 0 auto; }
.rp-row.s-done .rp-dot { background: var(--green); }
.rp-row.s-current .rp-dot { background: #fff; border: 2px solid var(--primary); box-sizing: border-box; }
.rp-main { flex: 1; min-width: 0; }
.rp-row .rp-label { font-weight: 600; color: var(--text); }
.rp-row .rp-range { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.rp-row .rp-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; flex: 0 0 auto; }
.rp-status.s-done { background: var(--green-soft); color: #237804; }
.rp-status.s-current { background: var(--primary-soft); color: var(--primary); }
.rp-status.s-upcoming { background: var(--sunken); color: var(--text-3); }

.plan-list { display: flex; flex-direction: column; gap: 0; }
.plan-day { background: transparent; border: 0; border-radius: 0; padding: 12px 0; border-bottom: 1px solid var(--border); box-shadow: none; }
.plan-day:last-child { border-bottom: 0; }
.plan-day-head { cursor: pointer; }
.plan-day-date { font-size: 15px; font-weight: 600; color: var(--text); }
.plan-day-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.plan-day-preview, .plan-day-full { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.plan-task { background: var(--sunken); border-radius: var(--radius-xs); padding: 8px 10px; }
.pt-head { font-size: 12px; color: var(--text-3); }
.pt-name { font-size: 14px; color: var(--text); margin: 2px 0; word-break: break-word; overflow-wrap: anywhere; }
.pt-est { font-size: 12px; color: var(--text-4); }
.plan-day-toggle { margin-top: 10px; width: 100%; height: 40px; background: #fff; color: var(--primary); border: 1px solid var(--primary-line); border-radius: var(--radius-sm); font-size: 13px; }
.plan-showall { margin-top: 12px; width: 100%; height: 44px; background: #fff; color: var(--primary); border: 1px solid var(--primary-line); border-radius: var(--radius-sm); }

/* ---------- 进度看板 ---------- */
.topbar { display: flex; gap: 8px; margin-bottom: 12px; }
.tcell { flex: 1; min-width: 0; background: transparent; border: 0; border-radius: 0; padding: 0; text-align: left; box-shadow: none; }
.tcell + .tcell { border-left: 1px solid var(--border); padding-left: 12px; }
.tcell b { display: block; font-size: 17px; color: var(--text); line-height: 1.25; font-weight: 700; }
.tcell span { font-size: 11px; color: var(--text-3); }
.bigpct { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.bigpct b { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1; }
.bigpct span { font-size: 12px; color: var(--text-3); }
.bar { background: #eef0f3; border-radius: 999px; height: 6px; overflow: hidden; margin: 6px 0 10px; }
.bar.big { height: 10px; }
.barfill { background: var(--primary); height: 100%; border-radius: 999px; }
.subjlist .subj { margin: 9px 0; padding: 1px 0; }
.subjlist .subj:last-child { margin-bottom: 0; }
.subj-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 5px; }
.subj-top > span { font-weight: 600; color: var(--text); }
.subj-top b { color: var(--primary); font-weight: 700; font-size: 14px; }
.subj-detail { font-size: 11.5px; color: var(--text-3); margin-top: 4px; letter-spacing: .2px; }
.dcards { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.dcard { flex: 1 1 30%; min-width: 84px; background: transparent; border: 0; border-radius: 0; padding: 0; text-align: left; box-shadow: none; }
.dcard b { display: inline; font-size: 14px; line-height: 1.2; font-weight: 700; }
.dcard span { font-size: 12px; color: var(--text-3); }
.dc-pro b { color: var(--green); } .dc-fuzzy b { color: #d18b1f; } .dc-no b { color: #c9424e; }
.dc-undo b { color: #c2557f; } .dc-none b { color: var(--text-3); }

/* 看板：去大卡，改用 divider 分区（仅主面板保留白卡） */
.dash-plain { margin-top: 0; }
.dsec { padding: 12px 0; border-top: 1px solid var(--border); }
.dsec:first-child { border-top: 0; padding-top: 4px; }
.dsec-t { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.dstat { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.dstat b { color: var(--text); font-weight: 600; font-size: 13px; }
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.kv li:last-child { border-bottom: 0; padding-bottom: 0; }
.kv li b { color: var(--text); }
.lag-good { color: var(--green) !important; } .lag-bad { color: var(--red) !important; } .lag-flat { color: var(--text-2) !important; }
.risk { list-style: none; margin: 0; padding: 0; }
.risk li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.5; }
.risk li:last-child { border-bottom: 0; padding-bottom: 0; }
.risk li.ok { color: var(--green); border-bottom: 0; }
.risk i { font-style: normal; color: var(--text-3); font-size: 12px; margin-left: 4px; }
.rtag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; margin-right: 6px; color: #fff; }
.rt-undo { background: #c2557f; } .rt-no { background: #c9424e; } .rt-fuzzy { background: #d18b1f; }
.alert { background: #fdf0f0; border-radius: var(--radius-sm); color: #a8323d; padding: 11px 13px; margin-bottom: 12px; font-size: 13px; line-height: 1.6; }

/* ---------- FAQ / 弹窗 / 其他 ---------- */
.faq p:nth-child(odd) { font-size: 15px; font-weight: 700; color: var(--text); margin: 18px 0 6px; line-height: 1.5; }
.faq p:nth-child(odd) > b { color: var(--text); }
.faq p:nth-child(even) { font-size: 14px; color: var(--text-2); line-height: 1.7; margin: 0 0 4px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-box { background: #fff; border-radius: var(--radius); max-width: 420px; width: 100%; padding: 20px; max-height: calc(100vh - 32px); overflow-y: auto; }
@supports (height: 100dvh) { .modal-box { max-height: calc(100dvh - 32px); } }
.modal-box h3 { margin: 0 0 10px; font-size: 16px; }
.modal-box #modalBody { font-size: 14px; line-height: 1.6; color: var(--text); }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.tag.new, .tag.plan { background: var(--primary-soft); color: var(--primary); }
.tag.review, .tag.reinforce { background: #fdf3e6; color: #b8792b; }
.tag.merged { background: #f0e9ff; color: #5c2e91; }
.tag.overdue { background: #fdf0f0; color: var(--red); margin-left: 4px; }
.est-cell { white-space: nowrap; }
.est-cell small { color: var(--text-3); font-size: 12px; font-weight: 400; }
.card ul { margin: 0; padding-left: 18px; line-height: 1.9; font-size: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
th { background: var(--sunken); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dev-box { background: #2b2b2b; color: #9effa0; font-size: 11px; padding: 8px 10px; border-radius: var(--radius-xs); margin-top: 10px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  body {
    padding: 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  h1 { font-size: 26px; margin: 0 0 10px; }
  .modal-box { padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); max-height: calc(100dvh - 24px); }
  .dcard { flex: 1 1 44%; }
  .table-scroll table { min-width: 720px; }
}
@media (max-width: 359px) {
  .fb { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tab { font-size: 12px; }
  .tab[data-tab="faq"] { font-size: 11px; }
}

/* 桌面（宽屏）下反馈按钮回到 4 列、圆角收一点 */
@media (min-width: 561px) {
  .fb { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .fb button { border-radius: var(--radius-xs); }
}

/* ---------- 今日任务：操作条（收工 / 速度开关） ---------- */
.today-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.today-actions .ghost { height: 38px; font-size: 13px; padding: 0 14px; }
.nosample-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.nosample-toggle input { width: auto; height: auto; }

/* ---------- 收工视图 ---------- */
.closed-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: center; }
.closed-stat { font-size: 13px; color: var(--text-2); line-height: 1.7; margin-bottom: 14px; }
.closed-stat b { color: var(--primary); }
.closed-card .primary { width: 100%; height: 44px; font-size: 15px; font-weight: 600; }

/* ---------- 今日加餐 ---------- */
.addmeal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.addmeal-head { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 10px; }
.addmeal-head b { color: var(--primary); }
.addmeal-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.addmeal-btns .ghost { height: 40px; font-size: 13px; padding: 0 14px; }
.addmeal-empty { font-size: 13px; color: var(--text-3); line-height: 1.6; }
.addmeal-total { margin-top: 10px; font-size: 12px; color: var(--text-3); }

/* 标签：昨天顺延 / 加餐 */
.tag-defer { background: #eef0f3; color: var(--text-2); }
.tag-add { background: #eafaf0; color: #1f9254; }

/* 跨零点温和提示 */
.newday-hint { position: sticky; top: 0; z-index: 40; background: var(--primary); color: #fff; font-size: 13px; padding: 10px 14px; text-align: center; }
.newday-hint button { background: #fff; color: var(--primary); height: 30px; padding: 0 12px; font-size: 13px; margin-left: 8px; }

/* ===== 兑换码授权页（纯前端 V1，375px 友好） ===== */
.redeem-page { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; background: linear-gradient(160deg, #f4f7ff, #e9eefe); z-index: 50; }
.redeem-card { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 24px 20px; box-shadow: 0 10px 40px rgba(30, 50, 120, .15); box-sizing: border-box; }
.redeem-logo { font-size: 20px; font-weight: 700; color: #1f3a8a; text-align: center; margin: 0 0 6px; }
.redeem-tip { font-size: 14px; color: #555; text-align: center; margin: 0 0 12px; }
.redeem-keep { font-size: 12.5px; color: #1f9254; background: #eafaf0; border: 1px solid #cdeccf; border-radius: 10px; padding: 9px 11px; margin: 0 0 14px; line-height: 1.5; }
.redeem-banner { font-size: 12.5px; color: #9a5b00; background: #fff6e6; border: 1px solid #ffe0a8; border-radius: 10px; padding: 9px 11px; margin: 0 0 14px; line-height: 1.5; }
.redeem-label { display: block; font-size: 13px; color: #333; margin: 0 0 6px; }
.redeem-input { width: 100%; box-sizing: border-box; font-size: 18px; letter-spacing: 2px; text-align: center; padding: 12px 10px; border: 1.5px solid #c9d4f0; border-radius: 10px; outline: none; text-transform: uppercase; }
.redeem-input:focus { border-color: #3b5bdb; }
.redeem-input-err { border-color: #e03131; }
.redeem-btn { width: 100%; margin-top: 14px; padding: 13px; font-size: 16px; font-weight: 600; color: #fff; background: #3b5bdb; border: none; border-radius: 10px; cursor: pointer; }
.redeem-btn:active { background: #2f4ac0; }
.redeem-msg { min-height: 18px; margin-top: 10px; font-size: 13px; text-align: center; white-space: pre-wrap; }
.redeem-msg-err { color: #e03131; }
.redeem-foot { margin-top: 14px; font-size: 12px; color: #999; text-align: center; }
.redeem-xhs { margin-top: 10px; text-align: center; }
.redeem-xhs-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; font-size: 13px; line-height: 1.6; }
.redeem-xhs-label { color: #555; }
.redeem-xhs-name { color: var(--primary); font-weight: 700; }
.redeem-copy-btn { padding: 5px 14px; font-size: 12px; font-weight: 500; color: var(--primary); background: var(--primary-soft); border: 1px solid var(--primary-line); border-radius: 6px; cursor: pointer; transition: background .15s; -webkit-tap-highlight-color: transparent; }
.redeem-copy-btn:active { background: var(--primary-line); }
.redeem-copy-btn:disabled { opacity: .8; cursor: default; }
.redeem-xhs-warn { margin-top: 8px; font-size: 11px; color: #999; }

/* ---------- 当天任务：调整顺序（仅展示层） ---------- */
.task-reorder-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.4;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.task-reorder-btn:hover, .task-reorder-btn:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
  outline: none;
}
.task-reorder-btn:active { transform: scale(0.97); }

.today-actions-order { margin-top: 6px; gap: 8px; align-items: center; flex-wrap: wrap; }
.today-order-hint { font-size: 12px; color: var(--text-3); }

/* 弹层：调整顺序 */
.reorder-target { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.45; }
.reorder-target-subj { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); margin-top: 2px; }
.reorder-tip { font-size: 13px; color: var(--text-2); line-height: 1.55; margin-bottom: 14px; }
.reorder-actions { display: flex; flex-direction: column; gap: 8px; }
.reorder-btn {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border-input);
  background: #fbfcfd;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.reorder-btn:hover:not(:disabled), .reorder-btn:focus-visible:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  outline: none;
}
.reorder-btn:active:not(:disabled) { transform: scale(0.99); }
.reorder-btn:disabled { color: var(--text-4); background: #f5f6f7; cursor: not-allowed; opacity: 0.7; }

/* ---------- 51la 统计：隐私选择弹窗（仅展示层） ---------- */
.stats-optin-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.stats-optin-box {
  width: 100%; max-width: 360px;
  background: #fff;
  border-radius: 12px;
  padding: 20px 18px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  line-height: 1.55;
}
.stats-optin-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text, #1d2530);
  margin: 0 0 12px;
}
.stats-optin-body {
  font-size: 14px;
  color: var(--text-2, #4a5566);
}
.stats-optin-body p {
  margin: 0 0 8px;
}
.stats-optin-body strong {
  color: var(--text, #1d2530);
  font-weight: 600;
}
.stats-optin-tip {
  font-size: 12px;
  color: var(--text-3, #7a8699);
  margin-top: 8px !important;
}
.stats-optin-actions {
  display: flex; gap: 8px;
  margin-top: 16px;
}
.stats-optin-btn {
  flex: 1;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border-input, #e0e3e8);
  background: #fbfcfd;
  color: var(--text, #1d2530);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.stats-optin-btn:hover, .stats-optin-btn:focus-visible {
  outline: none;
}
.stats-optin-btn:active { transform: scale(0.98); }
.stats-optin-decline:hover, .stats-optin-decline:focus-visible {
  border-color: var(--text-3, #7a8699);
  color: var(--text-2, #4a5566);
  background: #f5f6f7;
}
.stats-optin-accept {
  background: var(--primary, #256af4);
  border-color: var(--primary, #256af4);
  color: #fff;
}
.stats-optin-accept:hover, .stats-optin-accept:focus-visible {
  background: #1e54c8;
  border-color: #1e54c8;
  color: #fff;
}
#statsPrefStatus.muted {
  color: var(--text-3, #7a8699);
}

/* ---------- 51la 统计：隐私选择弹窗（仅展示层） ---------- */
.stats-optin-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.stats-optin-box {
  width: 100%; max-width: 360px;
  background: #fff;
  border-radius: 12px;
  padding: 20px 18px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  line-height: 1.55;
}
.stats-optin-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text, #1d2530);
  margin: 0 0 12px;
}
.stats-optin-body {
  font-size: 14px;
  color: var(--text-2, #4a5566);
}
.stats-optin-body p { margin: 0 0 8px; }
.stats-optin-body strong { color: var(--text, #1d2530); font-weight: 600; }
.stats-optin-tip { font-size: 12px; color: var(--text-3, #7a8699); margin-top: 8px !important; }
.stats-optin-actions { display: flex; gap: 8px; margin-top: 16px; }
.stats-optin-btn {
  flex: 1; height: 42px; border-radius: 10px;
  border: 1px solid var(--border-input, #e0e3e8);
  background: #fbfcfd;
  color: var(--text, #1d2530);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.stats-optin-btn:hover, .stats-optin-btn:focus-visible { outline: none; }
.stats-optin-btn:active { transform: scale(0.98); }
.stats-optin-decline:hover, .stats-optin-decline:focus-visible {
  border-color: var(--text-3, #7a8699);
  color: var(--text-2, #4a5566);
  background: #f5f6f7;
}
.stats-optin-accept {
  background: var(--primary, #256af4);
  border-color: var(--primary, #256af4);
  color: #fff;
}
.stats-optin-accept:hover, .stats-optin-accept:focus-visible {
  background: #1e54c8; border-color: #1e54c8; color: #fff;
}
#statsPrefStatus.muted { color: var(--text-3, #7a8699); }
