/* ============================================================
 * style.css —— 学习工作台统一样式（浅色 / 白底主题）
 * 纯手写，零外部依赖，不引用任何框架/字体/CDN
 * 断点：<900px 手机单列 + 底部 Tab；>=900px 顶部导航 + 双栏
 * 2026-11-15：深色 → 浅色；手机端全面纵向自适应，取消横向滑动
 * ============================================================ */

:root {
  --bg: #f5f7fb;
  --bg-soft: #f0f3f9;
  --card: #ffffff;
  --card-hi: #f4f6fb;
  --line: #e3e8f0;
  --text: #1c2635;
  --muted: #6b7789;
  --accent: #3b5bdb;
  --accent-soft: rgba(59, 91, 219, .09);
  --ok: #0f9d76;
  --warn: #c47f10;
  --danger: #d64545;
  --danger-soft: rgba(214, 69, 69, .08);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 20px rgba(28, 38, 53, .09);
  --tab-h: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: .2px; }
h2 { font-size: 15px; }

a { color: var(--accent); text-decoration: none; }

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.brand svg { width: 20px; height: 20px; flex: none; }

.topnav { display: none; gap: 4px; }

.topnav a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topnav a.jump-link { margin-left:auto; background:#FDEFF6; color:#B4718F; font-weight:600; }
.topnav a.jump-link:hover { background:#F9DCE9; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--card-hi);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.pill.on .dot { background: var(--ok); }
.pill.off .dot { background: var(--danger); }
.pill.busy .dot { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------------- 布局 ---------------- */
.layout {
  max-width: 1180px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 16px 14px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
/* grid 子项默认 min-width:auto，会被内部宽内容撑开导致整页横向滚动，必须归零 */
.layout > *, .card, .card > * { min-width: 0; max-width: 100%; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 15px 16px;
}

.card + .card { margin-top: 0; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-head .hint { font-size: 12px; color: var(--muted); }

/* ---------------- Hero：日期 + 连续天数 ---------------- */
.hero {
  display: block; /* BFFEAT_V1 顶部区改为上下结构：日期栏 + 倒计时 */
  gap: 14px;
  background: linear-gradient(135deg, #eaf0ff, #ffffff 62%);
  border-color: #d9e2f7;
}

.hero-date { font-size: 20px; font-weight: 700; }
.hero-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.streak { text-align: right; flex: none; }
.streak-num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.streak-label { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; } /* BFFEAT_V1 */
/* BFFEAT_V1 重要日倒计时 */
.dl-zone { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.dl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dl-title { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.dl-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.dl-item { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 9px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; }
.dl-item .dl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-item .dl-days { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.dl-item .dl-days.urgent { color: var(--danger); }
.dl-item .dl-date { font-size: 11.5px; color: var(--muted); }
.dl-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dl-form input[type=text] { flex: 1 1 140px; min-width: 0; }
.dl-form input[type=date] { flex: 0 1 150px; min-width: 0; }
.dl-empty { font-size: 12px; color: var(--muted); padding: 2px 0; }

/* ---------------- 今日要处理 ---------------- */
.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.todo-item:last-child { border-bottom: 0; }
.todo-main { flex: 1; min-width: 0; }
.todo-title {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.todo-meta .late { color: var(--danger); font-weight: 600; }

/* ---------------- 列表通用 ---------------- */
.list { display: flex; flex-direction: column; gap: 8px; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.row .grow { flex: 1; min-width: 0; }
/* BFFEAT_V1 手机端今日计划：文字横向占满一行，按钮换行，避免事件名被挤成竖排 */
.row .t { overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
@media (max-width: 899px) {
  .plan-row { flex-wrap: wrap; }
  .plan-row > .grow { flex: 1 1 100%; min-width: 100%; order: -1; }
  .plan-row > .btn { flex: 1 1 auto; }
}
.row .t { font-size: 14px; }
.row .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.row.done .t { color: var(--muted); text-decoration: line-through; }

/* 课程时间块 */
.slot { display: flex; gap: 10px; align-items: baseline; }
.slot-time {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--accent);
  flex: none;
  min-width: 78px;
}

/* 空状态 */
.empty {
  padding: 16px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------------- 表单 ---------------- */
label.field { display: block; margin-bottom: 11px; }
label.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
}

input[type="text"], input[type="tel"], input[type="number"], input[type="date"],
input[type="time"], input[type="password"], textarea, select {
  width: 100%;
  padding: 11px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px; /* 小于 16px iOS 会自动放大页面 */
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}

input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 62px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #9aa5b5; }

.inline { display: flex; gap: 8px; align-items: stretch; }
/* 表单控件有固有最小宽度，不归零会在窄屏把两列撑出屏幕 */
.inline > * { flex: 1 1 0; min-width: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-hi);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(214, 69, 69, .32); background: var(--danger-soft); }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 12.5px; font-weight: 500; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 心情/状态选择 ---------------- */
.moods { display: flex; gap: 6px; }
.mood {
  flex: 1;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.mood.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

/* ---------------- 打卡条目输入 ---------------- */
.item-inputs { display: flex; flex-direction: column; gap: 8px; }

/* ---------------- 提示条 ---------------- */
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 12px;
}
.banner.info { background: var(--accent-soft); border-color: rgba(59, 91, 219, .28); color: #2b4496; }
.banner.warn { background: rgba(196, 127, 16, .09); border-color: rgba(196, 127, 16, .3); color: #8a5a00; }
.banner.err { background: var(--danger-soft); border-color: rgba(214, 69, 69, .3); color: #a23232; }
.banner .grow { flex: 1; }

/* ---------------- 底部 Tab（手机） ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  min-height: 44px;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.active { color: var(--accent); }

/* ---------------- Toast ---------------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  max-width: calc(100vw - 40px);
  padding: 10px 15px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { border-color: rgba(214, 69, 69, .5); color: var(--danger); }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 22px;
  box-shadow: var(--shadow);
}
.login-logo {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 16px;
}
.login-title { font-size: 20px; font-weight: 700; }
.login-sub { font-size: 13px; color: var(--muted); margin: 6px 0 20px; }

.code-btn {
  flex: none;
  min-width: 108px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card-hi);
  color: var(--accent);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.code-btn[disabled] { color: var(--muted); opacity: .6; }

/* ---------------- 宽屏 ---------------- */
@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
    align-items: start;
    gap: 18px;
    padding: 22px 22px 40px;
  }
  .topnav { display: flex; }
  .tabbar { display: none; }
  .brand { font-size: 16px; }
  .card { padding: 18px 18px 19px; }
  .hero-date { font-size: 22px; }
  #toast { bottom: 28px; }
}

/* 窄屏细节 */
@media (max-width: 380px) {
  .hero-date { font-size: 18px; }
  .streak-num { font-size: 26px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ============================================================
 * 周计划页
 * ============================================================ */
.layout.single { grid-template-columns: 1fr; }
.plan-top { display: grid; grid-template-columns: 1fr; gap: 14px; }

.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav .btn.sm { min-width: 34px; padding: 0; font-size: 17px; line-height: 1; }

/* 周视图：手机纵向堆叠，电脑 7 列 */
.board {
  display: flex;
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.day-col {
  flex: 0 0 84%;
  max-width: 330px;
  scroll-snap-align: start;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px;
  min-height: 150px;
}

.day-col.today { border-color: rgba(59, 91, 219, .55); background: var(--accent-soft); }
.day-col.past { opacity: .62; }

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.day-name { font-size: 13px; font-weight: 650; }
.day-col.today .day-name { color: var(--accent); }
.day-date { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-total { font-size: 11px; color: var(--muted); }

.pitem {
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color .15s;
}
.pitem:active { border-color: var(--accent); }
.pitem.done { opacity: .5; }
.pitem.done .pitem-t { text-decoration: line-through; }
.pitem-t { font-size: 13px; line-height: 1.42; word-break: break-word; }
.pitem-m {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tag.manual { background: rgba(15, 157, 118, .12); color: var(--ok); }
.tag.postpone { background: rgba(212, 160, 23, .14); color: var(--warn); }
.tag.partial { background: rgba(108, 140, 255, .14); color: var(--accent); }
/* 延期满 2 次锁死的条目：红色描边提醒 */
.pitem.maxed { border-color: var(--danger); background: var(--danger-soft); }
.row.maxed, .todo-item.maxed { border-color: var(--danger); background: var(--danger-soft); }
.day-empty { font-size: 12px; color: var(--muted); padding: 4px 2px; }

/* 底部操作面板 */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(103%);
  transition: transform .22s ease;
  max-height: 84vh;
  overflow-y: auto;
}
.sheet.show { transform: translateY(0); }
.sheet-title { font-size: 15px; font-weight: 650; margin-bottom: 4px; word-break: break-word; }
.sheet-sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.sheet-label { font-size: 12px; color: var(--muted); margin: 15px 0 8px; }

/* 科目备忘按钮排（2026-11-19 新增）：杂务固定最前 + 课表科目逐个一个按钮 */
.memo-chips { display: flex; flex-wrap: wrap; gap: 8px; max-width: 100%; }
.memo-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  word-break: break-word;
}
.memo-chips .chip:active { transform: scale(.97); }
.memo-chips .chip.misc {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.memo-chips .chip .filled {
  font-size: 10px;
  font-style: normal;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(15, 157, 118, .12);
  color: var(--ok);
  flex: none;
}

.day-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.day-pick button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 9px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.day-pick button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.day-pick button[disabled] { opacity: .3; }

@media (min-width: 900px) {
  .plan-top { grid-template-columns: 1fr 1fr; }
  .board { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: visible; }
  .day-col { flex: none; max-width: none; min-height: 210px; padding: 9px; }
  .sheet { left: 50%; right: auto; width: 430px; margin-left: -215px; border-radius: 16px; }
}

/* ============================================================
 * 登录页：说明块（匿名模式 / 短信模式共用）
 * ============================================================ */
.note-box {
  margin-top: 16px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.72;
  color: var(--muted);
}
.note-box b { color: var(--text); font-weight: 650; }

.diag-line {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

/* ============================================================
 * 课表页：周 × 节次网格
 * ============================================================ */
.tt-scroll { overflow-x: auto; max-width: 100%; padding-bottom: 6px; }
.tt-grid {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(112px, 1fr));
  min-width: 860px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.tt-head {
  padding: 8px 4px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 650;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.tt-head.today { color: var(--accent); background: var(--accent-soft); }
.tt-corner { font-size: 11px; color: var(--muted); font-weight: 500; }
.today-dot { display: block; font-size: 9px; font-weight: 500; line-height: 1.2; }
.tt-period {
  padding: 6px 2px;
  text-align: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  font-variant-numeric: tabular-nums;
}
.tt-period b { display: block; font-size: 12px; }
.tt-period span { display: block; margin-top: 2px; font-size: 9px; line-height: 1.32; color: var(--muted); }
.tt-cell {
  min-height: 62px;
  padding: 4px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tt-cell.today { background: var(--accent-soft); }
.course-chip {
  padding: 5px 6px;
  border-radius: 8px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  line-height: 1.4;
  overflow: hidden;
}
.chip-top { display: flex; justify-content: space-between; gap: 4px; font-size: 9.5px; color: var(--muted); }
.chip-range { color: var(--accent); font-weight: 600; white-space: nowrap; }
.chip-weeks { white-space: nowrap; }
.chip-name { font-size: 11.5px; font-weight: 600; margin-top: 2px; word-break: break-word; }
.chip-meta { font-size: 9.5px; color: var(--muted); margin-top: 1px; word-break: break-word; }
.tt-legend { margin-top: 10px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.week-tag { font-size: 11px; font-weight: 500; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }

/* 手机端：按天纵向排布，彻底不用横向滚动的宽表格 */
.tt-mobile { display: none; gap: 10px; }
.tt-day {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
  padding: 10px 11px;
  min-width: 0;
}
.tt-day.today { border-color: rgba(59, 91, 219, .5); background: var(--accent-soft); }
.tt-day-head {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13.5px; font-weight: 650; margin-bottom: 6px;
}
.tt-day.today .tt-day-head { color: var(--accent); }
.tt-day-head em { font-size: 11px; font-style: normal; font-weight: 400; color: var(--muted); margin-left: auto; }
.tt-m-item {
  display: flex; gap: 9px; padding: 8px 0;
  border-top: 1px dashed var(--line); min-width: 0;
}
.tt-m-range {
  flex: none; width: 66px; font-size: 10.5px; line-height: 1.45;
  color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums;
}
.tt-m-range small { display: block; color: var(--muted); font-weight: 400; font-size: 10px; }
.tt-m-main { flex: 1; min-width: 0; }
.tt-m-name { font-size: 13px; font-weight: 600; word-break: break-word; }
.tt-m-meta { font-size: 11px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.tt-m-empty { font-size: 12px; color: var(--muted); padding: 6px 0 2px; }

/* ============================================================
 * 统计页：概览 / 热力图 / 柱状图 / 状态分布
 * ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.stat-card { padding: 12px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); }
.stat-num { font-size: 23px; font-weight: 700; color: var(--accent); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.heat-scroll { overflow-x: auto; max-width: 100%; padding: 4px 0 8px; }
.heat-body { display: flex; gap: 8px; width: max-content; }
.heat-labels {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  gap: 3px;
  font-size: 9px;
  color: var(--muted);
  line-height: 14px;
  text-align: right;
  width: 14px;
}
.heat-grid {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 3px;
}
.heat-cell { width: 14px; height: 14px; border-radius: 3px; background: var(--bg-soft); border: 1px solid var(--line); }
.heat-cell.lv0 { background: #e6ebf3; }
.heat-cell.lv1 { background: rgba(15, 157, 118, .22); }
.heat-cell.lv2 { background: rgba(15, 157, 118, .44); }
.heat-cell.lv3 { background: rgba(15, 157, 118, .68); }
.heat-cell.lv4 { background: #0f9d76; }
.heat-cell.is-today { outline: 2px solid var(--accent); outline-offset: 1px; }
.heat-weeks {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-left: 22px;
  margin-top: 4px;
  width: 204px;
  max-width: calc(100% - 22px);
}
.heat-weeks span { font-size: 9px; color: var(--muted); white-space: nowrap; }
.heat-legend { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 8px; font-size: 10.5px; color: var(--muted); }
.heat-legend .heat-cell { display: inline-block; cursor: default; }
.legend-note { margin-left: 6px; }

.bars-chart svg { display: block; width: 100%; height: auto; max-height: 190px; }
.mood-chart { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mood-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.mood-name { width: 30px; flex: none; color: var(--muted); }
.mood-track { flex: 1; height: 8px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.mood-track i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.mood-count { width: 24px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.row.dim { opacity: .55; }

/* ============================================================
 * 设置页：节次编辑 / 备份 / 诊断
 * ============================================================ */
#periods { scroll-margin-top: 70px; }
.period-grid { display: grid; grid-template-columns: 1fr; gap: 7px; }
.period-row {
  display: grid;
  grid-template-columns: 58px 1fr 12px 1fr;
  gap: 6px;
  align-items: center;
}
.period-n { font-size: 12px; color: var(--muted); }
.period-row input[type="time"] { min-width: 0; width: 100%; font-size: 12.5px; }
.period-dash { text-align: center; color: var(--muted); font-size: 11px; }
.check-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  cursor: pointer;
}
.check-line input { margin-top: 2px; flex: none; }
.check-line b { color: var(--text); }
input[type="file"] { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); margin-top: 6px; }
.kv { display: flex; flex-direction: column; gap: 0; }
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row span { color: var(--muted); flex: none; }
.kv-row b { font-weight: 550; text-align: right; word-break: break-all; }
.diag-out {
  margin: 12px 0 0;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
  border-radius: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
}

@media (min-width: 900px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .period-grid { grid-template-columns: 1fr 1fr; gap: 8px 18px; }
  .tt-scroll { overflow-x: visible; }
  .tt-grid { min-width: 0; }
  .grid2 > .card { min-width: 0; }
  .tt-mobile { display: none; }
}

/* 手机端：全部纵向铺开，不允许任何横向滑动才能看全的布局 */
@media (max-width: 899px) {
  .grid2, .stats-pair { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
    scroll-snap-type: none;
  }
  .day-col { max-width: none; min-height: 0; }
  .tt-scroll { display: none; }
  .tt-mobile { display: grid; }
  .period-row { grid-template-columns: 50px 1fr 10px 1fr; gap: 5px; }
  .tt-legend { word-break: break-word; }
}


/* ===== BF_WEEK_FOLD 周计划折叠小圆圈 + 当天展开 ===== */
.board { display: block !important; overflow: visible !important; }
.week-strip{
  display:flex; gap:8px; justify-content:space-evenly; flex-wrap:nowrap;
  padding:4px 0 12px; margin-bottom:10px; border-bottom:1px dashed var(--line);
}
.day-dot{
  position:relative; flex:1 1 0; min-width:0; max-width:52px; aspect-ratio:1/1; height:auto; padding:4px 2px;
  border:1.5px solid var(--line); border-radius:50%; background:var(--card);
  color:var(--text); display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:2px; cursor:pointer; background:linear-gradient(160deg,var(--card),var(--bg-soft));
  transition:transform .15s, border-color .15s, background .15s, box-shadow .15s;
}
.day-dot:active{ transform:scale(.94); }
.day-dot .dd-w{ font-size:12px; font-weight:700; line-height:1; }
.day-dot .dd-d{ font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums; line-height:1; }
.day-dot.past{ opacity:.72; }
.day-dot.has-todo{ border-color:rgba(214,90,90,.62); }
.day-dot.on{ border-color:var(--accent); background:var(--accent-soft); box-shadow:0 0 0 3px var(--accent-soft); }
.day-dot .dd-badge{
  position:absolute; top:-4px; right:2px; min-width:16px; height:16px; padding:0 3px;
  border-radius:99px; background:#d65a5a; color:#fff; font-size:10px; font-weight:700;
  line-height:16px; text-align:center;
}
.day-dot .dd-ok{ position:absolute; top:-5px; right:1px; color:#3f9b6b; font-size:13px; font-weight:800; }
.fold-day{ margin-bottom:12px; }
.fold-day .day-col{ opacity:1; border-color:var(--accent); }
.fold-close{
  display:block; width:100%; margin-top:6px; padding:7px; border:1px dashed var(--line);
  border-radius:9px; background:var(--card); color:var(--muted); font-size:12px; cursor:pointer;
}

.mobile-jump{display:none;align-items:center;gap:5px;padding:6px 11px;border-radius:999px;
  background:#FDEFF6;color:#B4718F;font-size:12.5px;font-weight:600;text-decoration:none;white-space:nowrap}
.mobile-jump svg{width:15px;height:15px}
@media (max-width:768px){
  .mobile-jump{display:inline-flex}
}
