/* ===================================================
   日历清单 · Morandi Design System
   =================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

:root {
  /* ── Morandi 色盘 ── */
  --bg:         #f5f3f0;   /* 暖灰白背景（莫兰迪底） */
  --surface:    #fafaf8;   /* 暖白卡片 */
  --surface-2:  #f0efec;   /* 次级暖灰面板 */
  --bar:        rgba(245,243,240,0.88); /* 毛玻璃顶栏 */
  --sep:        rgba(80,78,72,0.13);   /* 暖灰分隔线 */
  --ink:        #3a3a36;   /* 暖黑主文字 */
  --ink-2:      #5a5a56;   /* 次级文字 */
  --muted:      #9a9a95;   /* 三级文字 */
  --accent:     #9a9a8a;   /* 莫兰迪灰绿（主色） */
  --accent-tint:#f0efe8;   /* 灰绿浅底 */
  --accent-mid: #7a7a6a;   /* 深灰绿 */
  --red:        #c4a4a4;   /* 莫兰迪灰粉（代替纯红） */
  --red-tint:   #f5eeee;   /* 灰粉浅底 */
  --blue:       #8a9aaa;   /* 莫兰迪灰蓝 */
  --shadow-xs:  0 1px 3px rgba(60,55,50,0.07);
  --shadow-sm:  0 4px 16px rgba(60,55,50,0.09);
  --shadow-md:  0 8px 32px rgba(60,55,50,0.13);
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100%;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 全局 GPU 加速（动画元素使用合成层） */
.drag-card,
.book-container,
.book-right-content,
.pool-group {
  will-change: transform;
  transform: translateZ(0);
}

/* 拖拽进行中：锁住所有滚动容器，防止手机端抖动 */
body.dragging-active {
  overflow: hidden;
}
body.dragging-active .calendar-scroll,
body.dragging-active .pool-pane {
  overflow: hidden !important;
  touch-action: none !important;
}

input, select, textarea {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

button, input { font: inherit; }

button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ── App Shell ── */
.app-shell {
  display: grid;
  grid-template-rows: max(62px, env(safe-area-inset-top) + 52px) minmax(0,1fr);
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  top: 0;
  left: 0;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: env(safe-area-inset-top) 16px 0;
  padding-bottom: 10px;
  background: var(--bar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
  min-width: 0;
  position: relative;
  z-index: 10;
}

/* 月份选择输入框：覆盖在按钮上方，透明接收点击，触发各平台原生日期选择器 */
.month-input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  z-index: 1;
}
/* 月份按钮内文字层（在 input 下方，视觉上可见） */
.month-label-btn > span,
.month-label-btn > .chevron-icon {
  position: relative;
  z-index: 0;
  pointer-events: none;
}
/* 月份标签按钮 */
.month-label-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-size: clamp(14px, 3.8vw, 18px);
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
  transition: background 0.15s;
  position: relative;
  overflow: hidden;
}
.month-label-btn:active { background: #e8e6e2; }

/* 月份旁的小下箭头（SVG 版） */
.chevron-icon {
  display: flex;
  align-items: center;
  color: var(--muted);
  flex-shrink: 0;
}
.chevron-icon svg { width: 14px; height: 14px; display: block; }

/* 回到今天按钮——和时间胶囊同风格，pill 形状，在其右侧 */
.today-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--accent);
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}
.today-btn svg { width: 16px; height: 16px; display: block; }
.today-btn:active { background: var(--accent-tint); transform: scale(0.92); }

/* ── 顶部导航图标（光学对齐版）── */
.icon-tab {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  transition: background 0.15s, transform 0.12s;
  flex-shrink: 0;
}

.icon-tab:active { transform: scale(0.90); }

/* 当前页：莫兰迪灰绿背景 */
.current-tab {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(154,154,138,0.35);
}

/* 下一页：淡灰，始终靠右 */
.next-tab {
  background: rgba(160,158,152,0.14);
  color: var(--muted);
  margin-left: auto;
}
.next-tab:active { background: rgba(154,154,138,0.14); color: var(--accent); }

/* ===== 首页顶栏布局：右(时间胶囊 + 回到今天 + 下一页) ===== */
.topbar.home .current-tab { display: none; }
.topbar.home .month-label-btn {
  margin-left: auto;
}

/* ===== 非首页顶栏布局：左(空) | 中(current 居中) | 右(next) ===== */
.topbar.simple .today-btn,
.topbar.simple .month-label-btn { display: none; }
.topbar.simple .current-tab {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
}

/* ── SVG 图标（光学对齐：全部用内联 SVG，居中放置）── */
.nav-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.nav-symbol svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* FAB 内的 SVG 图标 */
.action-fab svg { width: 18px; height: 18px; display: block; }

/* 折叠箭头 SVG */
.heading-arrow {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  color: var(--muted);
  transition: transform 0.22s cubic-bezier(0.34,1.2,0.64,1);
  flex-shrink: 0;
  will-change: transform;
}
.heading-arrow svg { width: 14px; height: 14px; display: block; }
.pool-group.collapsed .heading-arrow { transform: rotate(-90deg); }

/* 任务勾选图标 */
.task-check .check-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-check .check-icon svg { width: 10px; height: 10px; display: block; color: #fff; }

/* 任务删除图标 */
.task-remove .remove-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-remove .remove-icon svg { width: 8px; height: 8px; display: block; }

/* 今天闪烁高亮 */
@keyframes todayFlash {
  0%   { background: rgba(100,90,60,0.10); }
  50%  { background: rgba(100,90,60,0.04); }
  100% { background: var(--surface); }
}
.day-row.today-flash { animation: todayFlash 0.9s ease both; }

/* ── 页面通用 ── */
.page-view {
  min-height: 0;
  overflow: hidden;
}

.page-view[hidden] { display: none; }

/* 页面进入动画（GPU 加速，只动 transform+opacity） */
@keyframes slideInRight {
  from { opacity: 0; transform: translate3d(40px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translate3d(-40px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

.page-view.anim-in {
  animation: slideInRight 0.24s cubic-bezier(0.34,1.04,0.64,1) both;
}
.page-view.anim-in-back {
  animation: slideInLeft 0.24s cubic-bezier(0.34,1.04,0.64,1) both;
}

/* ── 首页：双栏日历+清单 ── */
.planner {
  display: grid;
  grid-template-columns: 2fr 1fr;
  min-height: 0;
  overflow: hidden;
}
.planner[hidden] { display: none; }

.calendar-pane,
.pool-pane {
  min-width: 0;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.calendar-pane::-webkit-scrollbar,
.pool-pane::-webkit-scrollbar { display: none; }

.calendar-pane {
  display: grid;
  grid-template-rows: minmax(0,1fr);
  border-right: 0.5px solid var(--sep);
  overflow: hidden;
  background: #f2f0ec;
}

.calendar-scroll {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: min-content;
  gap: 0;
  min-width: 0;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.calendar-scroll::-webkit-scrollbar { display: none; }

/* ── 日历行（6天视图，动态适配）── */
.day-row {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  grid-template-rows: auto;
  min-height: 140px;
  height: auto;
  border-bottom: 0.5px solid var(--sep);
  background: #fcfbf9;
  transition: background 0.14s;
  align-items: start;
  padding: 12px 0;
  gap: 0;
  overflow: visible;
}

.day-row.drag-over {
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 2px rgba(100,90,60,0.25);
}

/* 拖拽准备状态（所有日期行可接收） */
.day-row.drag-ready {
  box-shadow: inset 0 0 0 1px rgba(154,154,138,0.15);
}

.day-row.today {
  background: rgba(100,90,60,0.08);
}

.date-cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 2px;
  padding: 4px 2px 0;
  min-width: 0;
}

.date-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #1a1a18;
  text-align: center;
}

.date-week {
  font-size: 11px;
  font-weight: 500;
  color: #7a7a74;
  text-align: center;
  white-space: nowrap;
}

.task-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px 4px;
  min-width: 0;
  padding: 6px 6px;
  align-items: start;
  align-content: start;
  grid-auto-rows: auto;
  position: relative; /* 插入指示线定位基准 */
}

/* 单列布局时给更多空间 */
.calendar-scroll .task-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── 任务项（动态弹性标签）── */
.task {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 32px;
  padding: 6px 5px;
  color: #2a2a24;
  background: rgba(255,255,255,0.7);
  border-radius: 10px;
  border: 0.5px solid rgba(80,78,72,0.18);
  font-size: 14px;
  min-width: 0;
  /* 填满 grid 单元格 */
  width: 100%;
  /* 不设 width/height 固定值，让 grid 单元格决定大小 */
  height: auto;
  /* 删除动画 */
  transform-origin: center;
  transition: opacity 0.2s, transform 0.2s;
}

/* 有分组的任务：浅色背景 + done 状态处理 */
.task.has-group {
  /* border-color 和 text color 由 JS 内联样式设置 */
}

.task.has-group .task-text {
  /* color 由 JS 内联样式设置 */
}

.task.has-group .task-check {
  /* border-color 由 JS 内联样式设置 */
}

.task.has-group.done .task-check {
  /* background 由 JS 内联样式设置 */
}

.task.has-group.done .task-text {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* 删除炸裂动画 */
@keyframes taskExplode {
  0%   { transform: scale(1); opacity: 1; }
  30%  { transform: scale(1.08); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

.task.removing {
  animation: taskExplode 0.35s cubic-bezier(0.36,0.07,0.19,0.97) forwards;
  pointer-events: none;
}

/* 粒子（炸裂碎片） */
.particle {
  position: fixed;
  pointer-events: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  z-index: 999;
  will-change: transform, opacity;
  animation: particleFly 0.45s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}

@keyframes particleFly {
  0%   { transform: translate(0,0) scale(1); opacity: 0.9; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

.task-check {
  position: relative;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex: 0 0 auto;
  border: 1.5px solid #c7c7cc;
  border-radius: 50%;
  background: transparent;
  flex: 0 0 auto;
  margin-top: 2px;
  transition: border-color 0.2s cubic-bezier(0.34,1.3,0.64,1),
              background 0.2s cubic-bezier(0.34,1.3,0.64,1),
              transform 0.2s cubic-bezier(0.34,1.3,0.64,1);
}
/* 扩展触摸区域（不占用布局） */
.task-check::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}

.task.done .task-check {
  border-color: var(--accent);
  background: var(--accent);
  animation: checkPop 0.28s cubic-bezier(0.34,1.3,0.64,1);
}

@keyframes checkPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.task.done .task-check::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: translate(-55%, -60%) rotate(-45deg);
  animation: checkDraw 0.22s 0.05s cubic-bezier(0.34,1.2,0.64,1) both;
}

@keyframes checkDraw {
  0%   { opacity: 0; transform: translate(-55%, -60%) rotate(-45deg) scale(0.3); }
  100% { opacity: 1; transform: translate(-55%, -60%) rotate(-45deg) scale(1); }
}

.task-text {
  min-width: 0;
  flex: 1 1 auto;
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: normal;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: #2a2a24;
}

.task.done .task-text {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  color: #7a7a74;
}

.task-remove {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(196,164,164,0.18);
  color: var(--red);
  font-size: 10px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
}

.task:hover .task-remove,
.task:focus-within .task-remove { opacity: 1; }

.task-remove .remove-icon svg { width: 7px; height: 7px; display: block; }


/* 扩展触摸区域（不占用布局） */
.task-remove::before {
  content: "";
  position: absolute;
  inset: -13px;
  border-radius: 50%;
}
.task:focus-within .task-remove,
.task:hover .task-remove { opacity: 1; }
.task-remove:active { background: rgba(196,164,164,0.26); }

/* ── 右侧清单备选区 ── */
.pool-pane {
  position: relative;
  padding: 12px 8px 20px;
  background: var(--surface-2);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.pool-pane::-webkit-scrollbar { display: none; }

.pool-actions {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr) 34px;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 0 0 8px;
}

.active-group-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* FAB 改为 SVG，不再用文字加号 */
.action-fab {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(154,154,138,0.32);
  transition: transform 0.2s cubic-bezier(0.34,1.3,0.64,1);
}

.action-fab[aria-expanded="true"] {
  transform: rotate(45deg);
}

.action-menu {
  position: absolute;
  top: 42px;
  right: 0;
  z-index: 10;
  display: grid;
  gap: 2px;
  min-width: 130px;
  padding: 6px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.96);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: fadeUp 0.18s cubic-bezier(0.34,1.2,0.64,1) both;
}

.action-menu button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink);
  transition: background 0.12s;
}

.action-menu button:active { background: var(--accent-tint); color: var(--accent); }

.quick-add[hidden],
.action-menu[hidden] { display: none; }

.quick-add {
  display: grid;
  grid-template-columns: minmax(0,1fr) 42px;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
}

.quick-add select {
  grid-column: 1/-1;
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--sep);
  border-radius: var(--r-sm);
  padding: 0 8px;
  background: var(--surface);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  outline: 0;
}

.quick-add input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--sep);
  border-radius: var(--r-sm);
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  outline: 0;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.quick-add input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(154,154,138,0.14);
}

.quick-add button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.14s;
}
.quick-add button:active { background: var(--accent-mid); }

/* ── 分组 ── */
.pool-groups {
  display: grid;
  gap: 7px;
}

/* 莫兰迪分组色系：每组一个独特颜色 */
.pool-group:nth-child(1) { --group-color: #9a9a8a; --group-tint: rgba(154,154,138,0.10); }  /* 灰绿 */
.pool-group:nth-child(2) { --group-color: #b49494; --group-tint: rgba(180,148,148,0.12); }  /* 灰粉 */
.pool-group:nth-child(3) { --group-color: #8a9aaa; --group-tint: rgba(138,154,170,0.12); }  /* 灰蓝 */
.pool-group:nth-child(4) { --group-color: #b4a488; --group-tint: rgba(180,164,136,0.12); }  /* 灰棕 */
.pool-group:nth-child(5) { --group-color: #a894aa; --group-tint: rgba(168,148,170,0.12); }  /* 紫灰 */
.pool-group:nth-child(6) { --group-color: #88a8a0; --group-tint: rgba(136,168,160,0.12); }  /* 青灰 */
.pool-group:nth-child(7) { --group-color: #c4a078; --group-tint: rgba(196,160,120,0.12); }  /* 暖棕 */
.pool-group:nth-child(8) { --group-color: #9a9890; --group-tint: rgba(154,152,144,0.12); }  /* 深灰 */
/* 超过8组循环 */
.pool-group:nth-child(9n+1)  { --group-color: #9a9a8a; --group-tint: rgba(154,154,138,0.10); }
.pool-group:nth-child(9n+2)  { --group-color: #b49494; --group-tint: rgba(180,148,148,0.12); }
.pool-group:nth-child(9n+3)  { --group-color: #8a9aaa; --group-tint: rgba(138,154,170,0.12); }
.pool-group:nth-child(9n+4)  { --group-color: #b4a488; --group-tint: rgba(180,164,136,0.12); }
.pool-group:nth-child(9n+5)  { --group-color: #a894aa; --group-tint: rgba(168,148,170,0.12); }
.pool-group:nth-child(9n+6)  { --group-color: #88a8a0; --group-tint: rgba(136,168,160,0.12); }
.pool-group:nth-child(9n+7)  { --group-color: #c4a078; --group-tint: rgba(196,160,120,0.12); }
.pool-group:nth-child(9n+8)  { --group-color: #9a9890; --group-tint: rgba(154,152,144,0.12); }

/* 应用分组颜色到各元素 */
.pool-group .heading-mark {
  background: var(--group-color);
}
.pool-group .heading-title strong {
  color: var(--group-color);
  font-weight: 700;
}
.pool-group .heading-count {
  background: var(--group-color);
  color: #fff;
}
.pool-group .pool-item::before {
  background: var(--group-color);
}
.pool-group.active {
  box-shadow: 0 0 0 2px var(--group-color), var(--shadow-sm);
}

/* 折叠动画：GPU 合成层动画，零重排 */
.pool-group {
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  min-height: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: layout style paint;
}

/* pool-list 折叠：只动 transform + opacity，完全 GPU 合成层 */
.pool-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 4px 8px 10px;
  list-style: none;
  min-height: 0;
  contain: layout style paint;
  max-height: 2000px;
  transform-origin: top center;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
              max-height 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              padding-top 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              padding-bottom 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scaleY(1);
  opacity: 1;
}

/* 折叠：scaleY(0) + 零 padding，纯 GPU 合成，不触发 layout */
.pool-group.collapsed .pool-list {
  transform: scaleY(0);
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.pool-heading {
  display: grid;
  grid-template-columns: 16px minmax(0,1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  padding: 0 6px 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  text-align: left;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.12s;
}
.pool-heading:active { background: var(--accent-tint); }

.heading-mark {
  width: 10px;
  height: 10px;
  border-radius: var(--r-xs);
  background: var(--accent);
  flex-shrink: 0;
}

.heading-title {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
  color: var(--ink);
}

.pool-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.heading-count {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: rgba(154,154,138,0.10);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.pool-item {
  display: grid;
  grid-template-columns: 12px minmax(0,1fr);
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 5px;
  border-radius: var(--r-xs);
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  transition: background 0.12s, transform 0.15s ease;
}

.pool-item:active { background: var(--accent-tint); }
.pool-item.active-source { background: rgba(154,154,138,0.06); }

.pool-item::before {
  content: "";
  justify-self: center;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.pool-item.dragging { opacity: 0.35; }

.pool-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-word;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--group-color, var(--ink-2));
  -webkit-user-select: none;
  user-select: none;
}

/* ── 统一页面标题栏（非首页）── */
.page-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
  border-bottom: 0.5px solid var(--sep);
  background: rgba(245,243,240,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.page-title {
  margin: 0;
  font-size: clamp(17px,4.5vw,21px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* ── 日历详情页：电子书风格 ── */
.detail-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.detail-page[hidden] { display: none; }

/* 顶部月份标题 */
.book-month {
  flex-shrink: 0;
  text-align: center;
  padding: 14px 0 6px;
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.08em;
}

/* 书本容器 */
.book-container {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(90px, 32%) 1px minmax(0, 1fr);
  gap: 0;
  margin: 8px 16px 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow:
    0 1px 2px rgba(60,55,50,0.06),
    0 4px 12px rgba(60,55,50,0.08),
    inset 0 0 0 0.5px rgba(0,0,0,0.04);
  position: relative;
  perspective: 1200px;
}

/* 左页 */
.book-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #fdfcfa 0%, #f9f8f5 100%);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
}

.book-left-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 14px 12px 8px;
  border-bottom: 0.5px solid var(--sep);
  flex-shrink: 0;
}

.book-month-small {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.book-week-small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* 日期列表 */
.book-date-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
  padding: 6px 8px 12px;
}
.book-date-list::-webkit-scrollbar { display: none; }

.book-date-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  text-align: left;
  transition: background 0.12s;
  flex-shrink: 0;
}

.book-date-item:active { background: var(--accent-tint); }

.book-date-item.selected {
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px rgba(154,154,138,0.2);
}

.book-date-item.today .book-date-num {
  color: var(--accent);
  font-weight: 800;
}

.book-date-num {
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 600;
  color: var(--ink);
  min-width: 22px;
  text-align: right;
  line-height: 1;
}
/* 无记录日期：数字变淡 */
.book-date-num.empty {
  color: var(--muted);
  font-weight: 400;
}

.book-date-week {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* 书脊 */
.book-spine {
  background: linear-gradient(90deg,
    rgba(0,0,0,0.04) 0%,
    rgba(0,0,0,0.01) 30%,
    rgba(255,255,255,0.4) 50%,
    rgba(0,0,0,0.01) 70%,
    rgba(0,0,0,0.04) 100%
  );
  box-shadow: inset 0 0 2px rgba(0,0,0,0.04);
}

/* 右页 */
.book-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #fdfcfa 0%, #faf9f6 100%);
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
}

.book-right-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 16px 14px 20px;
}
.book-right-content::-webkit-scrollbar { display: none; }

.book-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ── 手抄本上下翻页动画（如翻日历）── */
@keyframes pageFlipDown {
  from { opacity: 0.3; transform: scale(0.96); }
  to   { opacity: 1;   transform: scale(1); }
}
@keyframes pageFlipUp {
  from { opacity: 0.3; transform: scale(0.96); }
  to   { opacity: 1;   transform: scale(1); }
}
.book-right-content.flip-down {
  animation: pageFlipDown 0.18s cubic-bezier(0.34, 1.1, 0.64, 1) both;
}
.book-right-content.flip-up {
  animation: pageFlipUp 0.18s cubic-bezier(0.34, 1.1, 0.64, 1) both;
}

/* 上下翻页提示箭头 */
.book-nav-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(154,154,138,0.2);
  pointer-events: none;
  z-index: 2;
}
.book-nav-hint svg { width: 18px; height: 18px; }
.book-nav-hint.up   { top: 4px; }
.book-nav-hint.down { bottom: 4px; }
.book-nav-hint.up svg   { transform: rotate(180deg); }
.book-container.swiping .book-nav-hint { opacity: 0; }

/* 右页头部 */
.book-right-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 0.5px solid var(--sep);
}

.book-right-date {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.book-right-day {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.02em;
}

.book-right-week {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.book-right-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 3px 10px;
  border-radius: var(--r-pill);
}

/* 右页任务列表 */
.book-task-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 38px;
  padding: 7px 0;
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 400;
  color: var(--ink);
  border-bottom: 0.5px solid rgba(80,78,72,0.08);
  line-height: 1.45;
}

.book-task:last-child { border-bottom: 0; }

.book-task-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c7c7cc;
  margin-top: 6px;
}

.book-task.done { color: var(--muted); }
.book-task.done .book-task-dot { background: var(--accent); }
.book-task.done .book-task-text {
  text-decoration: line-through;
  text-decoration-thickness: 1.2px;
  text-decoration-color: var(--muted);
}

.book-task-text {
  min-width: 0;
  overflow: visible;
  word-break: break-word;
}

/* 底部固定栏 */
.book-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px max(10px, env(safe-area-inset-bottom));
  border-top: 0.5px solid var(--sep);
  background: rgba(245,243,240,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
}

.book-footer-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  transition: background 0.12s;
}
.book-footer-btn:active { background: var(--accent-tint); }

.book-footer-icon {
  display: flex;
  align-items: center;
}
.book-footer-icon svg { width: 16px; height: 16px; display: block; }

/* 底部时间胶囊按钮（比首页小） */
.book-footer-month {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.15s;
}
.book-footer-month:active { background: #e8e6e2; }
.book-footer-month > span,
.book-footer-month > .book-footer-chevron {
  position: relative;
  z-index: 0;
  pointer-events: none;
}

/* 底部月份 input（透明覆盖，复用首页方案） */
.book-footer-month-input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  z-index: 1;
}

/* 底部小箭头 */
.book-footer-chevron {
  display: flex;
  align-items: center;
  color: var(--muted);
  flex-shrink: 0;
}
.book-footer-chevron svg { width: 12px; height: 12px; display: block; }

/* ── 清单管理页（第三页）── */
.list-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.list-page[hidden] { display: none; }

.list-page .pool-pane {
  flex: 1;
  overflow-y: auto;
  width: min(680px,100%);
  margin: 0 auto;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 16px 16px 24px;
  scrollbar-width: thin;
}

.list-page .active-group-label { font-size: 12px; }

.list-page .pool-heading {
  min-height: 50px;
  font-size: clamp(14px,3.7vw,17px);
}

.list-page .pool-item { min-height: 40px; }

.list-page .pool-text { font-size: clamp(13px,3.4vw,15px); }

/* ── 管理按钮（顶栏右侧）── */
.manage-btn {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  box-shadow: var(--shadow-xs);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-mid);
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.manage-btn:active { background: var(--accent-tint); }
.manage-btn.active { background: var(--red); color: #fff; }

/* ── 批量操作底栏 ── */
.batch-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--sep);
  box-shadow: 0 -2px 12px rgba(60,55,50,0.06);
}
.batch-bar[hidden] { display: none; }

.batch-select-all {
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--accent-tint);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-mid);
  border: none;
  cursor: pointer;
  transition: background 0.12s;
}
.batch-select-all:active { background: var(--accent-mid); color: #fff; }

.batch-delete {
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--red-tint);
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  border: none;
  cursor: pointer;
  transition: background 0.12s;
}
.batch-delete:active { background: var(--red); color: #fff; }

.batch-cancel {
  margin-left: auto;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  border: none;
  cursor: pointer;
  transition: background 0.12s;
}
.batch-cancel:active { background: var(--surface); }

/* ── 批量模式：显示复选框 ── */
.pool-item.batch-mode {
  grid-template-columns: 22px 12px minmax(0,1fr);
  gap: 6px;
}

.book-date-item.batch-mode {
  padding-left: 6px;
}

/* 复选框通用样式 */
.batch-checkbox {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--r-xs);
  border: 2px solid var(--muted);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}

.batch-mode .batch-checkbox {
  display: flex;
}

.batch-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.batch-checkbox.checked::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center/contain no-repeat;
}

.pool-item.batch-mode .batch-checkbox { grid-column: 1; }
.pool-item.batch-mode::before { grid-column: 2; }
.pool-item.batch-mode .pool-text { grid-column: 3; }

/* ── 日历历史页批量模式 ── */
.book-date-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.book-date-item .batch-checkbox {
  flex-shrink: 0;
}

.book-date-item.batch-mode .book-date-text {
  margin-left: 4px;
}

/* ── 拖拽卡片 ── */
.drag-card {
  position: fixed;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(240px,50vw);
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--accent);
  pointer-events: none;
  transform: translate(-50%,-50%) rotate(-2deg);
  transition: transform 0.12s ease, padding 0.12s ease, font-size 0.12s ease;
}

.drag-card::before {
  content: "";
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: var(--r-xs);
  background: var(--accent);
  transition: width 0.12s ease, height 0.12s ease;
}

.drag-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

/* ── 拖拽插入位置指示线 ── */
.insert-indicator {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(154,154,138,0.4);
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
}
.insert-indicator.show {
  opacity: 1;
  transform: scaleX(1);
}

/* 拖拽时目标标签高亮 */
.task.drag-hover {
  outline: 2px solid var(--accent) !important;
  outline-offset: -2px;
}

/* 吸入动画：卡片飞入落点并消失 */
.drag-card.absorbing {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
}

.drag-card[hidden] { display: none; }

/* ── 右键菜单 ── */
.context-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  min-width: 130px;
  gap: 2px;
  padding: 6px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.97);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: fadeUp 0.16s cubic-bezier(0.34,1.2,0.64,1) both;
}

.context-menu[hidden] { display: none; }

.context-menu button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.12s;
}

.context-menu button:active { background: var(--accent-tint); color: var(--accent); }

/* 删除按钮特殊样式（莫兰迪灰粉） */
.context-menu button[data-action="delete"] { color: var(--red); }
.context-menu button[data-action="delete"]:active { background: var(--red-tint); }

/* ── 历史记录弹窗 ── */
.history-dialog {
  width: min(520px,calc(100vw - 28px));
  max-height: min(680px,calc(100dvh - 48px));
  border: 0;
  border-radius: var(--r-lg);
  padding: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.history-dialog::backdrop { background: rgba(60,58,50,0.32); backdrop-filter: blur(4px); }

.dialog-panel {
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  max-height: min(680px,calc(100dvh - 48px));
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bar);
  backdrop-filter: blur(12px);
}

.dialog-head h2 { margin: 0; font-size: 17px; font-weight: 700; }

.dialog-head button {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(160,158,152,0.15);
  font-size: 20px;
  color: var(--muted);
  transition: background 0.14s;
}
.dialog-head button:active { background: rgba(160,158,152,0.3); }

.history-list {
  display: grid;
  gap: 10px;
  min-height: 180px;
  padding: 14px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dialog-actions { justify-content: flex-end; }

.dialog-actions button {
  min-width: 68px;
  height: 34px;
  border-radius: var(--r-xs);
  background: var(--bg);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.14s;
}

.dialog-actions button.primary,
.dialog-actions button:first-child {
  background: var(--accent);
  color: #fff;
}
.dialog-actions button:active { opacity: 0.8; }

/* ── 响应式小屏 ── */
@media (max-width: 560px) {
  .app-shell {
    grid-template-rows: max(58px, env(safe-area-inset-top) + 50px) minmax(0,1fr);
  }
  .topbar { padding-inline: 10px; }
  .planner { grid-template-columns: 2fr 1fr; }
  .pool-pane { padding: 6px 4px 14px; }
  .list-page { padding: 12px 10px 22px; }
  .list-page .pool-pane { padding: 10px 10px 16px; }
  .quick-add { grid-template-columns: minmax(0,1fr) 40px; gap: 6px; }
  .quick-add input { height: 36px; padding-inline: 8px; font-size: 13px; }
  .quick-add button { width: 40px; height: 34px; font-size: 12px; }
  .date-cell { padding-left: 4px; }
  .date-num { font-size: 14px; }
  .task { padding: 2px 6px; min-height: 24px; font-size: 11px; }
  .task-check { width: 14px; height: 14px; }
  .task-check .check-icon svg { width: 7px; height: 7px; }
  .task-text { font-size: 11px; }
  .heading-title { font-size: 11px; }
  .pool-heading strong { font-size: 11px; }
  .pool-heading { gap: 4px; padding: 0 4px 0 6px; }
  .pool-item { padding: 3px 4px; min-height: 28px; }
  .pool-text { font-size: 12px; }

  /* 日历两列布局小屏适配 */
  .day-row { grid-template-columns: 40px minmax(0,1fr); min-height: 110px; padding: 10px 0; }
  .date-cell { padding: 3px 1px 0; }
  .date-num { font-size: 16px; }
  .task-list { gap: 6px 8px; padding: 8px 10px; }
  .task { padding: 6px 8px; min-height: 32px; font-size: 14px; }
  .task .task-text { font-size: 14px; }

  /* 电子书小屏 */
  .book-container {
    margin: 6px 10px 0;
    grid-template-columns: minmax(70px, 28%) 1px minmax(0, 1fr);
  }
  .book-right-content { padding: 12px 10px 16px; }
  .book-footer { padding-inline: 14px; }
  .book-date-item { padding: 7px 8px; }
  .book-date-num { font-size: 15px; }
}

@media (min-width: 900px) {
  body { display: grid; place-items: center; background: #d1cfc8; }
  .app-shell {
    width: min(960px,100vw);
    border-radius: var(--r-lg);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06), var(--shadow-md);
    overflow: hidden;
  }
}

/* ── 提醒设置弹窗（自定义overlay，兼容所有浏览器）── */
.reminder-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(60,58,50,0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 1;
  transition: opacity 0.2s;
}
.reminder-overlay[hidden] { display: none; }

.reminder-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 20px 18px 16px;
  background: #f5f3f0;
  border-radius: var(--r-lg);
}

.reminder-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 8px;
}

.reminder-task-name {
  font-size: 15px;
  font-weight: 600;
  color: #2a2a24;
  margin: 0;
  padding: 8px 10px;
  background: rgba(154,154,138,0.08);
  border-radius: 8px;
  text-align: center;
}

.reminder-label {
  font-size: 13px;
  color: #7a7870;
  font-weight: 500;
}

.reminder-time-input {
  width: 100%;
  height: 48px;
  font-size: 22px;
  text-align: center;
  color: #2a2a24;
  border: 1.5px solid rgba(80,78,72,0.15);
  border-radius: 12px;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.reminder-time-input:focus { border-color: #9a9a8a; }

/* 隐藏原生时间输入的spinner图标 */
.reminder-time-input::-webkit-calendar-picker-indicator {
  font-size: 18px;
  opacity: 0.5;
  cursor: pointer;
}

.reminder-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.preset-btn {
  height: 36px;
  font-size: 13px;
  color: #5a5850;
  border: 1px solid rgba(80,78,72,0.12);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:active {
  background: #9a9a8a;
  color: #fff;
  border-color: #9a9a8a;
}

.reminder-current-info {
  font-size: 13px;
  color: #9a9a8a;
  text-align: center;
  padding: 8px;
  background: rgba(154,154,138,0.06);
  border-radius: 8px;
}

/* ── Bark推送设置 ── */
.reminder-bark-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(80,78,72,0.08);
}
.reminder-bark-section[hidden] {
  display: none;
}
.reminder-bark-hint {
  font-size: 11px;
  color: #9a9a8a;
  font-weight: 400;
}
.reminder-bark-row {
  display: flex;
  gap: 8px;
}
.bark-key-input {
  flex: 1;
  height: 38px;
  font-size: 14px;
  color: #2a2a24;
  border: 1.5px solid rgba(80,78,72,0.15);
  border-radius: 10px;
  background: #fff;
  padding: 0 10px;
  outline: none;
  transition: border-color 0.2s;
}
.bark-key-input:focus { border-color: #c4a078; }
.bark-test-btn {
  flex: 0 0 52px;
  height: 38px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #c4a078;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.bark-test-btn:active { opacity: 0.7; }
.bark-help {
  font-size: 11px;
  color: #9a9a8a;
  margin: 0;
  line-height: 1.5;
}
.bark-status {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
  padding: 4px 0;
}
.bark-status.ok { color: #6b8a5e; }
.bark-status.fail { color: #b49494; }

/* 提醒对话框底部按钮 */
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid rgba(80,78,72,0.08);
}
.dialog-actions button {
  height: 38px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.clear-btn {
  color: #b07070;
  background: rgba(180,112,112,0.08);
  margin-right: auto;
}
.cancel-btn {
  color: #6a6860;
  background: transparent;
}
.save-btn {
  color: #1a1a1a;
  background: #c8c6bc;
}

/* ── 任务标签上的提醒小图标 ── */
.task.has-reminder .task-text::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  min-width: 7px;
  border-radius: 50%;
  background: #c4a078;
  margin-left: 5px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ── 全屏闹钟遮罩（到点时弹出）── */
#alarmOverlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: alarmPulseIn 0.3s ease-out;
}
#alarmOverlay[hidden] { display: none !important; }

@keyframes alarmPulseIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.alarm-inner {
  width: min(320px, calc(100vw - 40px));
  padding: 36px 24px 28px;
  background: linear-gradient(145deg, #fff, #f5f3f0);
  border-radius: 20px;
  text-align: center;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.25),
    0 0 0 2px rgba(196,160,120,0.3);
  animation: alarmBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes alarmBounce {
  from { transform: translateY(30px) scale(0.85); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.alarm-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 12px;
  animation: alarmShake 0.6s ease-in-out infinite alternate;
}

@keyframes alarmShake {
  from { transform: rotate(-10deg); }
  to   { transform: rotate(10deg); }
}

.alarm-title {
  font-size: 22px;
  font-weight: 700;
  color: #2a2a24;
  margin: 0 0 16px;
}

.alarm-task {
  font-size: 17px;
  font-weight: 600;
  color: #c4a078;
  margin: 0 0 8px;
  word-break: break-all;
}

.alarm-time {
  font-size: 13px;
  color: #9a9a8a;
  margin: 0 0 28px;
}

.alarm-dismiss {
  width: 100%;
  height: 48px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: #c4a078;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(196,160,120,0.35);
}
.alarm-dismiss:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(196,160,120,0.25);
}

/* Sync account panel */
.sync-widget {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 120;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100vw - 24px));
  pointer-events: none;
}

.sync-chip,
.sync-card {
  pointer-events: auto;
}

.sync-chip {
  justify-self: start;
  min-height: 32px;
  max-width: 180px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: rgba(250,250,248,0.92);
  box-shadow: var(--shadow-xs);
  color: var(--accent-mid);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-chip[data-tone="error"] { color: #b07070; }
.sync-chip[data-tone="busy"] { color: #c4a078; }

.sync-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-md);
  background: rgba(250,250,248,0.97);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.sync-card[hidden] { display: none; }

.sync-card label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.sync-card input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--sep);
  border-radius: var(--r-sm);
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.sync-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
}

.sync-actions button {
  min-height: 34px;
  padding: 0 9px;
  border-radius: var(--r-sm);
  background: var(--accent-tint);
  color: var(--accent-mid);
  font-size: 12px;
  font-weight: 700;
}

.sync-actions button:first-child {
  background: var(--accent);
  color: #fff;
}

.sync-status {
  margin: 0;
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}

.sync-status[data-tone="ok"] { color: #6b8a5e; }
.sync-status[data-tone="error"] { color: #b07070; }
.sync-status[data-tone="busy"] { color: #c4a078; }

/* Desktop calendar-book workspace */
.desktop-book-panel {
  display: none;
}

.desktop-book-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.desktop-book-head div {
  display: grid;
  gap: 2px;
}

.desktop-book-head strong {
  font-size: 20px;
  color: var(--ink);
}

.desktop-book-head span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.desktop-book-head button {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--accent-tint);
  color: var(--accent-mid);
  font-size: 12px;
  font-weight: 700;
}

.desktop-book-shell {
  display: grid;
  grid-template-columns: 96px minmax(0,1fr);
  min-height: 0;
  margin: 0 14px 14px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.desktop-book-days {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 0;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 10px;
  background: linear-gradient(180deg, #fdfcfa 0%, #f7f6f2 100%);
  border-right: 1px solid var(--sep);
}

.desktop-book-day {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
}

.desktop-book-day span {
  font-size: 16px;
  font-weight: 700;
}

.desktop-book-day small {
  color: var(--muted);
  font-size: 11px;
}

.desktop-book-day i {
  position: absolute;
  left: 7px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
}

.desktop-book-day.today span { color: var(--accent-mid); }
.desktop-book-day.selected {
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px rgba(154,154,138,0.2);
}

.desktop-book-page {
  min-width: 0;
  min-height: 0;
  padding: 18px 20px;
  background: linear-gradient(180deg, #fdfcfa 0%, #faf9f6 100%);
  overflow-y: auto;
}

.desktop-book-page header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sep);
}

.desktop-book-page header div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.desktop-book-date {
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}

.desktop-book-page header b {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-tint);
  color: var(--accent-mid);
  font-size: 12px;
}

.desktop-book-page ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.desktop-book-page li {
  display: grid;
  grid-template-columns: 8px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(80,78,72,0.08);
}

.desktop-book-page li > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.desktop-book-page li p {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.desktop-book-page li.done p {
  color: var(--muted);
  text-decoration: line-through;
}

.desktop-book-page li em {
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: rgba(196,160,120,0.12);
  color: #a47f52;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.desktop-book-empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 900px) {
  body {
    display: grid;
    place-items: center;
    background: #d1cfc8;
  }

  .app-shell {
    left: 50%;
    width: min(1180px, 100vw);
    transform: translateX(-50%);
    border-radius: var(--r-lg);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06), var(--shadow-md);
    overflow: hidden;
  }

  .planner {
    grid-template-columns: minmax(270px, 0.9fr) minmax(360px, 1.25fr) minmax(270px, 0.85fr);
  }

  .desktop-book-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--bg);
    border-right: 1px solid var(--sep);
  }

  .calendar-pane {
    border-right: 1px solid var(--sep);
  }

  .pool-pane {
    padding: 14px 12px 22px;
  }

  .detail-page {
    padding-inline: 24px;
  }

  .detail-page .book-container {
    max-width: 900px;
    width: 100%;
    margin-inline: auto;
  }

  .sync-widget {
    left: calc(50% - min(590px, 50vw) + 14px);
  }
}
