/* ============ 基础重置 ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--ink-900);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; padding: 0; }
a { color: var(--moss-700); text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; }
svg.ic {
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  width: 18px; height: 18px; flex: 0 0 auto; display: block;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #DAD6C8; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 应用外框 ============ */
#app { display: flex; height: 100%; }

/* ---- 左侧纵向导航 ---- */
#nav {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--bg-nav);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: calc(18px + var(--safe-t)) 10px calc(12px + var(--safe-b));
  overflow-y: auto;
  transition: width .22s ease, flex-basis .22s ease;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px; margin-bottom: 6px;
}
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 12px; background: var(--moss-100);
  display: grid; place-items: center;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-txt { min-width: 0; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .5px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--ink-300); white-space: nowrap; }

.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-md);
  color: var(--ink-700); font-size: 14px;
  width: 100%; text-align: left;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-ico {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 10px; display: grid; place-items: center;
  background: var(--hue-bg, var(--bg-soft));
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.nav-ico svg { width: 18px; height: 18px; stroke: var(--hue, var(--moss-500)); }
.nav-item:hover .nav-ico { transform: translateY(-2px) rotate(-4deg); }
.nav-item.on { background: var(--bg-card); box-shadow: var(--shadow-sm); color: var(--ink-900); font-weight: 500; }
.nav-item.on .nav-ico { background: var(--hue, var(--moss-500)); }
.nav-item.on .nav-ico svg { stroke: #fff; }
.brand-mark svg { stroke: var(--moss-700); }
.nav-label { white-space: nowrap; overflow: hidden; }
.nav-badge {
  margin-left: auto; font-size: 11px; min-width: 19px; height: 19px;
  padding: 0 5px; border-radius: var(--r-full);
  background: var(--clay-500); color: #fff;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.nav-foot { margin-top: auto; padding-top: 10px; }
.nav-toggle {
  display: none; width: 100%; padding: 8px; border-radius: var(--r-md);
  color: var(--ink-500); font-size: 12px;
}
.nav-toggle:hover { background: var(--bg-hover); }

/* ---- 主内容区 ---- */
#main { flex: 1; min-width: 0; overflow-y: auto; scroll-behavior: smooth; }
.page { padding: 26px 30px calc(60px + var(--safe-b)); max-width: 1080px; margin: 0 auto; }
.page-head { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: .3px; }
.page-desc { font-size: 13px; color: var(--ink-500); margin-top: 3px; }

/* ============ 通用组件 ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 14px; }
.card-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hue, var(--moss-500)); flex: 0 0 7px; }
.card-title .more { margin-left: auto; font-size: 12px; color: var(--ink-300); font-weight: 400; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--r-full);
  background: var(--bg-soft); color: var(--ink-700);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; }
.btn-main { background: var(--moss-500); color: #fff; }
.btn-main:hover { background: var(--moss-700); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--r-md); }
.btn-danger { color: #B0705F; }
.btn-danger:hover { background: var(--clay-100); }

.input, .textarea, .select {
  width: 100%; padding: 10px 13px;
  background: var(--bg-soft);
  border: 1px solid transparent; border-radius: var(--r-md);
  outline: none; transition: border-color .15s, background .15s;
}
.input:focus, .textarea:focus, .select:focus { background: var(--bg-card); border-color: var(--moss-300); }
.textarea { resize: vertical; min-height: 76px; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: var(--ink-300); }
.field { margin-bottom: 12px; }
.field-label { font-size: 12px; color: var(--ink-500); margin-bottom: 5px; display: block; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--r-full);
  background: var(--bg-soft); color: var(--ink-700);
  font-size: 12px; white-space: nowrap;
  border: 1px solid transparent; transition: all .15s;
}
.chip.on { background: var(--hue, var(--moss-500)); color: #fff; }
.chip.sel { background: var(--moss-100); color: var(--moss-900); border-color: var(--moss-300); }
button.chip:hover { border-color: var(--moss-300); }
.chip-x { opacity: .6; font-size: 14px; line-height: 1; }

.stat { text-align: center; padding: 14px 8px; }
.stat-num { font-family: var(--font-num); font-size: 25px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-lab { font-size: 11px; color: var(--ink-500); margin-top: 2px; }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-300); }
.empty svg { width: 46px; height: 46px; opacity: .5; margin-bottom: 10px; }
.empty p { font-size: 13px; margin: 0; }

.list-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 12px; border-radius: var(--r-md);
  transition: background .15s;
}
.list-item:hover { background: var(--bg-soft); }
.list-item + .list-item { border-top: 1px solid var(--line-soft); }
.li-title { font-size: 14px; line-height: 1.5; word-break: break-word; }
.li-meta { font-size: 11.5px; color: var(--ink-300); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.li-act { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; flex: 0 0 auto; }
.list-item:hover .li-act { opacity: 1; }
.li-act .btn-icon { width: 27px; height: 27px; }
.li-act svg { width: 14px; height: 14px; }

/* 复选圈 */
.tick {
  width: 21px; height: 21px; flex: 0 0 21px; margin-top: 1px;
  border: 1.8px solid var(--moss-300); border-radius: 50%;
  display: grid; place-items: center; transition: all .18s;
}
.tick svg { width: 12px; height: 12px; opacity: 0; transform: scale(.5); transition: all .18s; }
.tick:hover { border-color: var(--moss-500); background: var(--moss-50); }
.tick.on { background: var(--moss-500); border-color: var(--moss-500); }
.tick.on svg { opacity: 1; transform: scale(1); stroke: #fff; }
.done .li-title { text-decoration: line-through; color: var(--ink-300); }

/* 进度条 */
.bar { height: 7px; border-radius: var(--r-full); background: var(--bg-hover); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--hue, var(--moss-500)); transition: width .5s cubic-bezier(.4,0,.2,1); }

/* 弹层 */
.mask {
  position: absolute; inset: 0; background: rgba(60,58,48,.32);
  display: grid; place-items: center; padding: 20px; z-index: 60;
  animation: fade .18s ease;
  backdrop-filter: blur(2px);
}
.sheet {
  background: var(--bg-card); border-radius: var(--r-xl);
  width: min(520px, 100%); max-height: 86vh; overflow-y: auto;
  padding: 22px; box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.34,1.4,.64,1);
}
.sheet-head { display: flex; align-items: center; margin-bottom: 16px; }
.sheet-title { font-size: 16px; font-weight: 600; }
.sheet-foot { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97) } }

/* 提示条 */
#toast {
  position: absolute; left: 50%; bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--moss-900); color: #F4F2E9;
  padding: 9px 18px; border-radius: var(--r-full);
  font-size: 13px; box-shadow: var(--shadow-md);
  animation: pop .2s cubic-bezier(.34,1.4,.64,1);
}

.fadein { animation: fade .3s ease; }

/* ============ 侧边栏：桌面常驻 / 可收起成窄条 ============ */
#navToggle { display: block; }
#navClose { display: none; width: 30px; height: 30px; border-radius: 9px; color: var(--ink-500); place-items: center; }
#navClose svg { width: 18px; height: 18px; }
#navClose:hover { background: var(--bg-hover); }

/* 桌面收起态（仅宽屏生效，避免与手机抽屉冲突） */
@media (min-width: 861px) {
  #app.nav-mini #nav { width: var(--nav-w-mini); flex-basis: var(--nav-w-mini); padding-left: 8px; padding-right: 8px; }
  #app.nav-mini .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  #app.nav-mini .brand-txt,
  #app.nav-mini .nav-label { display: none; }
  #app.nav-mini .nav-item { justify-content: center; padding: 9px 0; gap: 0; }
  #app.nav-mini .nav-ico { width: 34px; height: 34px; flex-basis: 34px; }
  #app.nav-mini .nav-badge { position: absolute; top: 3px; right: 6px; margin: 0; transform: scale(.82); }
}

/* 悬浮菜单按钮 + 遮罩（仅手机出现） */
#navFab {
  position: fixed; right: 16px; bottom: calc(20px + var(--safe-b));
  width: 52px; height: 52px; border-radius: var(--r-full);
  background: var(--moss-500); color: #fff; z-index: 50;
  display: none; place-items: center; box-shadow: var(--shadow-lg);
}
#navFab svg { width: 24px; height: 24px; stroke: #fff; }
#navScrim {
  position: fixed; inset: 0; background: rgba(50,48,40,.4);
  z-index: 40; opacity: 0; visibility: hidden; transition: opacity .22s;
  backdrop-filter: blur(1.5px);
}

/* ============ 手机适配：侧栏变为抽屉 ============ */
@media (max-width: 860px) {
  :root { --nav-w: 248px; }
  #nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 45;
    width: 248px; flex-basis: 248px;
    transform: translateX(-104%);
    transition: transform .24s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  #app.nav-open #nav { transform: translateX(0); }
  #app.nav-open #navScrim { opacity: 1; visibility: visible; }
  #navFab { display: grid; }
  #navClose { display: grid; }
  .nav-toggle, .nav-foot { display: none; }
  .brand { padding: 6px 8px 16px; justify-content: flex-start; }
  .brand-txt, .nav-label { display: block; }
  .nav-item { justify-content: flex-start; padding: 9px 10px; gap: 11px; }
  .nav-ico { width: 30px; height: 30px; flex-basis: 30px; }
  .nav-badge { position: static; margin-left: auto; transform: none; }

  .page { padding: 18px 15px calc(76px + var(--safe-b)); }
  .page-title { font-size: 19px; }
  .g3, .g4 { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 15px; border-radius: var(--r-md); }
  .li-act { opacity: 1; }
  .sheet { border-radius: var(--r-lg); padding: 18px; }
}
@media (max-width: 480px) {
  .g2 { grid-template-columns: 1fr; }
  body { font-size: 14.5px; }
}

/* ============ 模块样式 ============ */
.rot-l { transform: rotate(90deg); }
.rot-r { transform: rotate(-90deg); }

.daynav { display: flex; align-items: center; gap: 4px; }
.daynav .btn-sm { min-width: 96px; font-variant-numeric: tabular-nums; }

.quickadd { display: flex; gap: 9px; }
.quickadd .input { flex: 1; }
.quickadd .btn { flex: 0 0 auto; white-space: nowrap; }

/* —— 桌面钟 —— */
.clockcard {
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--r-xl); padding: 26px 24px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.clockcard::after {
  content: ''; position: absolute; right: -34px; top: -34px;
  width: 150px; height: 150px; border-radius: 50%;
  background: var(--moss-50);
}
.clock-time {
  font-family: var(--font-num); font-size: 52px; font-weight: 300;
  letter-spacing: -1.5px; line-height: 1.05; font-variant-numeric: tabular-nums;
  position: relative; z-index: 1;
}
.clock-time small { font-size: 20px; font-weight: 400; color: var(--ink-300); margin-left: 6px; }
.clock-date { color: var(--ink-500); font-size: 13.5px; margin-top: 4px; position: relative; z-index: 1; }
.affirm {
  margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line);
  font-family: var(--font-serif); font-size: 17px; line-height: 1.85;
  color: var(--moss-900); position: relative; z-index: 1;
}
.affirm-act { margin-top: 12px; display: flex; gap: 8px; position: relative; z-index: 1; }

.mini {
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 15px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%;
  transition: transform .15s, box-shadow .15s;
}
.mini:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.mini-top { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-500); }
.mini-top .ic { width: 15px; height: 15px; stroke: var(--hue, var(--moss-500)); }
.mini-val { font-family: var(--font-num); font-size: 23px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.mini-val em { font-style: normal; font-size: 13px; color: var(--ink-300); font-weight: 400; }
.mini-sub { font-size: 11.5px; color: var(--ink-300); }

/* —— 热力格 —— */
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(13px, 1fr)); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 3.5px; background: var(--bg-hover); display: block; }
.heat i[data-l="1"] { background: var(--moss-100); }
.heat i[data-l="2"] { background: var(--moss-300); }
.heat i[data-l="3"] { background: var(--moss-500); }
.heat i[data-l="4"] { background: var(--moss-700); }

/* —— 柱状趋势 —— */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 108px; }
.bars > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.bars b { display: block; width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--hue, var(--moss-500)); min-height: 3px; transition: height .5s cubic-bezier(.4,0,.2,1); }
.bars span { font-size: 10.5px; color: var(--ink-300); white-space: nowrap; }

/* —— 321 日记 —— */
.d321-sec { margin-bottom: 16px; }
.d321-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.d321-no {
  width: 24px; height: 24px; border-radius: 8px; flex: 0 0 24px;
  display: grid; place-items: center; font-family: var(--font-num);
  font-size: 13px; font-weight: 600; color: #fff; background: var(--hue, var(--rose-500));
}
.d321-t { font-size: 13.5px; font-weight: 500; }
.d321-hint { font-size: 11.5px; color: var(--ink-300); }
.d321-line { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 7px; }
.d321-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--moss-300); margin-top: 15px; flex: 0 0 6px; }
.affirm-input { font-family: var(--font-serif); font-size: 15.5px; }

/* —— 食记 —— */
.meal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.meal-card { background: var(--bg-card); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.meal-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--bg-soft); display: block; cursor: zoom-in; }
.meal-noimg { width: 100%; aspect-ratio: 4/3; background: var(--bg-soft); display: grid; place-items: center; }
.meal-noimg .ic { width: 26px; height: 26px; stroke: var(--ink-300); }
.meal-body { padding: 10px 11px; }
.meal-t { font-size: 13px; font-weight: 500; line-height: 1.4; }
.meal-m { font-size: 11px; color: var(--ink-300); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.meal-cost { margin-left: auto; font-family: var(--font-num); color: var(--clay-500); font-weight: 500; }
.lightbox { position: absolute; inset: 0; background: rgba(45,43,36,.88); display: grid; place-items: center; z-index: 80; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 84vh; border-radius: var(--r-md); }

/* —— 收藏 / 阅读 / 热点 卡片 —— */
.tile {
  position: relative;
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 7px;
}
.tile.sel { border-color: var(--moss-500); box-shadow: 0 0 0 2px var(--moss-100); }
.pick { position: absolute; top: 11px; right: 11px; width: 22px; height: 22px; cursor: pointer; z-index: 2; }
.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick span { display: block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--moss-300); background: #fff; transition: .15s; }
.pick input:checked + span { background: var(--moss-500); border-color: var(--moss-500); }
.pick input:checked + span::after { content: ""; display: block; width: 6px; height: 11px; margin: 3px 0 0 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tile-t { font-size: 14px; font-weight: 500; line-height: 1.5; word-break: break-word; }
.tile-x { font-size: 12.5px; color: var(--ink-700); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.tile-f { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-300); margin-top: auto; padding-top: 4px; }
.tile-f .btn-icon { width: 26px; height: 26px; }
.tile-f .ic { width: 13px; height: 13px; }
.quotebox {
  background: var(--moss-50); border-left: 2.5px solid var(--moss-300);
  padding: 10px 13px; border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-family: var(--font-serif); font-size: 13.5px; line-height: 1.8; color: var(--moss-900);
  white-space: pre-wrap;
}
.note-card {
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); padding: 13px 14px; box-shadow: var(--shadow-sm);
  break-inside: avoid; margin-bottom: 12px;
}
.note-card.pin { border-color: var(--lilac-500); background: #FCFBFE; }
.masonry { column-count: 3; column-gap: 12px; }
@media (max-width: 860px) { .masonry { column-count: 2; } }
@media (max-width: 480px) { .masonry { column-count: 1; } .meal-grid { grid-template-columns: repeat(2, 1fr); } }

.seg { display: inline-flex; background: var(--bg-soft); border-radius: var(--r-full); padding: 3px; gap: 2px; }
.seg button { padding: 5px 13px; border-radius: var(--r-full); font-size: 12.5px; color: var(--ink-500); }
.seg button.on { background: var(--bg-card); color: var(--ink-900); font-weight: 500; box-shadow: var(--shadow-sm); }

.tips { background: var(--sun-100); border-radius: var(--r-md); padding: 11px 13px; font-size: 12.5px; color: #7A5A1E; line-height: 1.7; }
.tips b { font-weight: 500; }

/* —— 首页双语金句 —— */
.affirm-en { margin-top: 8px; font-size: 12.5px; font-style: italic; color: var(--ink-500); line-height: 1.6; }

/* —— 备份说明 —— */
.bk-help { margin: 12px 0 0; font-size: 12px; color: var(--ink-500); line-height: 1.85; }
.bk-help code { background: var(--bg-soft); padding: 1px 6px; border-radius: 6px; font-size: 11.5px; color: var(--moss-700); }

/* —— 备份横幅（常驻，易错过时用） —— */
#backupBar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: var(--sun-100); border-bottom: 1px solid #F0D9A6;
  color: #7A5A1E; padding: 11px 30px; font-size: 13px; line-height: 1.5;
}
#backupBar[hidden] { display: none; }
#backupBar .bk-ico { flex: 0 0 auto; }
#backupBar .bk-ico svg { width: 20px; height: 20px; stroke: #C99A3E; }
#backupBar .bk-txt { flex: 1; min-width: 0; }
#backupBar .btn-icon { color: #7A5A1E; width: 28px; height: 28px; }
@media (max-width: 860px) { #backupBar { padding: 10px 15px; } }

/* —— 历史按日期折叠 —— */
.fold { display: flex; flex-direction: column; }
.fold-group { border-top: 1px solid var(--line-soft); }
.fold-group:first-child { border-top: none; }
.fold-head {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 11px 4px; text-align: left; color: var(--ink-700); font-size: 13.5px;
}
.fold-ico { color: var(--ink-300); font-size: 11px; display: inline-block; transition: transform .2s; }
.fold-group.open .fold-ico { transform: rotate(90deg); }
.fold-date { font-weight: 500; }
.fold-cnt { margin-left: auto; font-size: 12px; color: var(--ink-300); font-family: var(--font-num); }
.fold-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.fold-group.open .fold-body { max-height: 2000px; }
.hist-row { display: flex; align-items: center; gap: 9px; padding: 7px 4px; font-size: 13px; color: var(--ink-700); }
.hist-row + .hist-row { border-top: 1px solid var(--line-soft); }
.hist-title { flex: 1; min-width: 0; }
.hist-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--moss-300); flex: 0 0 7px; }
.hist-dot.off { background: var(--ink-300); }
.hist-row.done .hist-title { text-decoration: line-through; color: var(--ink-300); }
.hist-tag { font-size: 11px; color: var(--ink-300); }
.hist-right { margin-left: auto; font-family: var(--font-num); color: var(--clay-500); font-size: 12.5px; }
.hist-note { padding: 8px 4px; }
.hist-note-t { font-size: 13px; line-height: 1.65; color: var(--ink-700); white-space: pre-wrap; word-break: break-word; }
.hist-diary { padding: 8px 4px; }

/* —— 打卡 —— */
.checkin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 9px; }
.checkin-item {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px; border-radius: var(--r-md);
  background: var(--bg-soft); transition: background .15s;
}
.checkin-item.on { background: var(--moss-100); }
.checkin-item .ci-name { font-size: 14px; }
.checkin-item .ci-time {
  margin-left: auto; width: 76px; padding: 5px 6px; font-size: 12.5px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--font-num); text-align: center; color: var(--ink-700);
}
.checkin-item .ci-time:disabled { opacity: .4; }
.checkin-item .tick { margin: 0; }

/* —— 日历 —— */
.cal-card { padding: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 8px; }
.cal-head span { text-align: center; font-size: 11.5px; color: var(--ink-300); padding: 4px 0; }
.cal-cell {
  position: relative; min-height: 66px; border-radius: var(--r-md);
  background: var(--bg-soft); padding: 7px 7px 6px;
  display: flex; flex-direction: column; gap: 4px; cursor: pointer;
  transition: background .15s; align-items: stretch;
}
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.has { background: var(--bg-card); border: 1px solid var(--line-soft); }
.cal-cell:hover.has { background: var(--bg-hover); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--moss-500); }
.cal-num { font-family: var(--font-num); font-size: 13.5px; font-weight: 600; color: var(--ink-700); }
.cal-cell.today .cal-num { color: var(--moss-700); }
.cal-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-tag { font-size: 9.5px; line-height: 1; padding: 3px 5px; border-radius: 6px; font-family: var(--font-num); white-space: nowrap; }
.tag-check { background: var(--moss-100); color: var(--moss-700); }
.tag-meal { background: var(--clay-100); color: var(--clay-500); }
.tag-task { background: var(--sky-100); color: #5B93A8; }
.cal-legend { display: flex; gap: 14px; margin-top: 12px; font-size: 11.5px; color: var(--ink-500); }
.cal-legend .lg { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.lg-check { background: var(--moss-500); }
.lg-meal { background: var(--clay-500); }
.lg-task { background: var(--sky-500); }

/* 日历详情弹层里的打卡 */
.cal-detail-checkin { max-height: 46vh; overflow-y: auto; }
.cd-group { margin-bottom: 12px; }
.cd-gname { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.cd-stat { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-700); }
.cd-stat b { font-family: var(--font-num); }
.cal-detail-foot { border-top: 1px solid var(--line-soft); margin-top: 8px; padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.cal-detail-foot .btn { margin-left: auto; }
