/* ============================================================
   菜根日历 · 前端组件库（Caigen Design System）
   规范见 docs/FRONT-DESIGN.md
   ============================================================
   组件索引：
   1. 令牌        :root（色彩/纹理/字体）
   2. 封面层      .brand-bar .brand-vertical .seal-1902 .root-stamp
   3. 底部护封    .root-bar（上缘云纹 clip-path）
   4. 纸片层      .inbox .calendar-panel .task-drawer（纸厚白边+覆盖投影+裁纸线）
   5. 工具栏      .toolbar .seg .view-nav .tool-actions
   6. 月份 hero   .month-hero .hero-num .hero-cn
   7. 周视图      .week-grid .week-head .week-body .day-col .hour-cell .ev
   8. 月视图      .month-grid .m-day .m-ev
   9. 总览        .overview-list .ov-row
   10. 待办/卡片  .item .todo-item .card（票据感）
   11. 表单/对话框 dialog .confirm-wrap
   12. 通用       .btn .toast .tag .chip-filter
   ============================================================ */

:root {
  --paper: #332431;
  --card: #f4e9da;
  --surface-soft: #eee0cf;
  --ink: #2a211c;
  --muted: #8b7c72;
  --line: rgba(42, 33, 28, .14);
  --seal: #c15b3e;
  --seal-deep: #a3462f;
  --seal-soft: #f2e1d5;
  --bamboo: #4f7a5a;
  --bamboo-soft: #e3ede4;
  --gold: #b07a2b;
  --gold-soft: #f5ecda;
  --apricot: #e6c58f;
  --lavender: #9a8697;
  --texture: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='0.05'/></feComponentTransfer></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  --serif: "Songti SC", "SimSun", "STSong", "Noto Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  /* 正文书册感：霞鹜文楷优先，回退系统楷体/宋体 */
  --hand: "LXGW WenKai", "Kaiti SC", "KaiTi", "STKaiti", "FZKai-Z03", "KaiTi_GB2312", var(--serif);
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 0 #fffef9, 0 4px 14px rgba(42, 33, 28, .08);
  --shadow-soft: 0 2px 10px rgba(42, 33, 28, .07);
  --ease: cubic-bezier(.22, .61, .36, 1);
  /* 楷体正文行高需略调，防挤压 */
  --lh: 1.62;
}

* { box-sizing: border-box; }

/* 霞鹜文楷（Lxgw WenKai）· 本地子集 woff2 */
@font-face {
  font-family: "LXGW WenKai";
  src: url("fonts/LXGWWenKai-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LXGW WenKai";
  src: url("fonts/LXGWWenKai-Medium.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: var(--hand);
  background-color: var(--paper);
  color: var(--ink);
  line-height: var(--lh);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: .01em;
}

a { color: var(--seal); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--seal); color: #fff; }

:focus-visible { outline: 2px solid var(--seal); outline-offset: 1px; }

/* ---------- 顶栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--card);
  background-image: var(--texture);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.seal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--seal);
  color: #fff;
  font-family: var(--hand);
  font-size: 17px;
  letter-spacing: 1px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(151, 37, 31, .35);
  transform: rotate(-2deg);
  flex-shrink: 0;
}
.seal:hover { text-decoration: none; background: var(--seal-deep); }

.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--hand); font-size: 19px; font-weight: 700; }
.brand-en { font-size: 11px; color: var(--muted); letter-spacing: .5px; }

.topbar nav { display: flex; gap: 6px; margin-left: 8px; }
.topbar nav a {
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
}
.topbar nav a.active { background: var(--seal-soft); color: var(--seal); font-weight: 600; }
.topbar nav a.disabled { opacity: .5; cursor: default; }
.topbar nav a:hover { text-decoration: none; background: #f1e5d1; }
.topbar nav a.active:hover { background: var(--seal-soft); }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.searchbox {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--muted);
}
.searchbox input {
  border: none;
  outline: none;
  background: none;
  padding: 8px 0;
  font-size: 14px;
  width: 190px;
  color: var(--ink);
  font-family: inherit;
}

.pill-select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(42, 33, 28, .16);
  background: #fffdf7;
  color: var(--ink);
  padding: 8px 15px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--hand);
  font-weight: 500;
  white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: #f3e9d8; border-color: rgba(42, 33, 28, .28); box-shadow: 0 2px 8px rgba(42, 33, 28, .07); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 3px rgba(42, 33, 28, .1); }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--seal); border-color: var(--seal); color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .12); }
.btn.primary:hover { background: var(--seal-deep); border-color: var(--seal-deep); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #f3e9d8; }
.btn.icon { padding: 6px 12px; font-size: 18px; line-height: 1; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.tiny { padding: 3px 9px; font-size: 12px; border-radius: var(--radius-sm); }
.btn.danger { color: var(--seal-deep); }
.btn.danger:hover { border-color: var(--seal); color: var(--seal-deep); background: var(--seal-soft); }

/* ---------- 今日概览 ---------- */

.hero {
  max-width: 1280px;
  margin: 24px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
}

.hero-date { display: flex; align-items: center; gap: 18px; }
.hero-day {
  font-family: var(--hand);
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--ink);
}
.hero-date-meta { display: flex; flex-direction: column; gap: 8px; }

.stamp {
  align-self: flex-start;
  background: var(--seal);
  color: #fff;
  font-family: var(--hand);
  font-size: 13px;
  letter-spacing: 2px;
  padding: 3px 10px;
  border-radius: 3px;
  transform: rotate(-3deg);
  box-shadow: 0 1px 3px rgba(151, 37, 31, .3);
}

.hero-date-full { color: var(--muted); font-size: 14px; }

.hero-stats { display: flex; gap: 14px; margin-left: auto; }

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 104px;
}
.stat-num { font-family: var(--hand); font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat-num.soon-num.has { color: var(--seal); }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- 布局 ---------- */

.layout {
  max-width: 1280px;
  margin: 20px auto 40px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 370px;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.panel-head h3 { margin: 0; font-size: 15px; font-family: var(--hand); }
.panel-head .count {
  background: var(--seal-soft);
  color: var(--seal);
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: 2px;
}

.side { display: flex; flex-direction: column; gap: 20px; }

/* ---------- 月历 ---------- */

.month-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.month-title { margin: 0; font-family: var(--hand); font-size: 22px; flex: 1; }
#btn-today { margin-left: auto; }

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.weekdays .weekend { color: var(--seal); }

.monthgrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.day {
  min-height: 108px;
  padding: 6px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8f0e2;
  cursor: pointer;
  transition: background .12s ease;
  position: relative;
}
.day:hover { background: #f1e5d1; }
.day.other { background: #e9dbc8; color: var(--muted); }
.day.other .day-num { color: #a89a89; }
.day.today .day-num { color: var(--seal); }
.day.selected { background: var(--seal-soft); }
.day.selected::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--seal);
}
.day.selected:hover { background: var(--seal-soft); }

.day-num {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--hand);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.day.other .day-num { font-weight: 400; }

.seal-dot {
  background: var(--seal);
  color: #fff;
  font-size: 11px;
  padding: 0 5px;
  border-radius: 3px;
  transform: rotate(-2deg);
  font-family: var(--hand);
  line-height: 16px;
}

.day-chips { display: flex; flex-direction: column; gap: 3px; }

.chip {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 3px solid var(--muted);
  background: var(--surface-soft);
  color: var(--ink);
}
.chip.p1 { border-left-color: #b9b4a8; }
.chip.p2 { border-left-color: var(--gold); background: var(--gold-soft); }
.chip.p3 { border-left-color: var(--seal); background: var(--seal-soft); }
.chip.more { border-left-color: transparent; color: var(--muted); background: transparent; font-style: normal; }

/* ---------- 列表 ---------- */

.list { display: flex; flex-direction: column; gap: 8px; }

.item {
  border: 1px solid rgba(42, 33, 28, .12);
  border-radius: 6px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fdf7ec 0%, #f7eedf 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 2px rgba(60, 40, 30, .05);
  display: flex;
  align-items: center;
  gap: 10px;
}
.item:hover { border-color: rgba(42, 33, 28, .24); }
.item.done { opacity: .6; }
.item.done .item-title { text-decoration: line-through; color: var(--muted); }
.item.overdue { border-color: var(--seal); background: #f9e9e3; }
.item.soon { border-color: var(--gold); background: var(--gold-soft); }

.item-main { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }

.when {
  font-family: var(--hand);
  font-size: 14px;
  font-weight: 700;
  color: var(--seal);
  min-width: 44px;
  padding-top: 2px;
}

.check {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: #fffdf7;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
}
.check:hover { border-color: var(--bamboo); }
.check::after {
  content: '';
  position: absolute;
  left: 5px; top: 2px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
}
.check.done-check { border-color: var(--bamboo); background: var(--bamboo); }
.check.done-check::after { opacity: 1; }

.item-body { min-width: 0; flex: 1; }
.item-title { font-weight: 600; font-size: 14px; word-break: break-word; }
.item-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.item-actions .btn.tiny { padding: 4px 10px; font-size: 12px; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-soft);
  color: var(--muted);
  vertical-align: 1px;
  margin-left: 4px;
}
.tag.p1 { background: var(--surface-soft); color: var(--muted); }
.tag.p2 { background: var(--gold-soft); color: var(--gold); }
.tag.p3 { background: var(--seal-soft); color: var(--seal); }
.tag.soon-tag { background: var(--seal-soft); color: var(--seal); margin-left: 6px; }

.empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 22px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

/* ---------- 分类筛选 ---------- */

.filters {
  max-width: 1280px;
  margin: 8px auto 4px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  background: var(--card);
  background-image: var(--texture);
  border: 1px solid var(--line);
  border-radius: 12px;
  flex: 0 0 auto;
}
.filters-label { flex: 0 0 auto; }
.filters-label { color: var(--muted); font-size: 13px; }
.chip-filter {
  border: 1px solid var(--line);
  background: #fffdf7;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.chip-filter:hover { border-color: var(--seal); color: var(--seal); }
.chip-filter.on { background: var(--seal); border-color: var(--seal); color: #fff; }

/* ---------- 对话框 ---------- */

dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 520px;
  width: 92%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
}
dialog::backdrop { background: rgba(38, 35, 31, .4); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
dialog h3 { margin: 0 0 2px; font-family: var(--hand); font-size: 18px; }

dialog label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
dialog input, dialog select, dialog textarea {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fffdf7;
}
dialog textarea { resize: vertical; }
dialog input:focus, dialog select:focus, dialog textarea:focus {
  outline: 2px solid var(--seal-soft);
  border-color: var(--seal);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- 确认框 ---------- */

.confirm-wrap {
  position: fixed;
  inset: 0;
  background: rgba(38, 35, 31, .4);
  display: grid;
  place-items: center;
  z-index: 60;
}

/* ---------- 帮助 / ICS 导入指南 ---------- */

dialog.wide-dialog { max-width: 640px; }
.help-content { padding: 22px 24px; }
.help-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.help-head h3 { margin: 0; font-family: var(--hand); font-size: 18px; }
.help-sec { margin-top: 18px; }
.help-sec h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--seal);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.help-sec p { margin: 8px 0; font-size: 13px; color: var(--ink); }
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 6px 0;
}
.help-table th, .help-table td {
  text-align: left;
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
}
.help-table th { background: var(--surface-soft); font-weight: 600; width: 120px; }
.hint-note { color: var(--muted); font-size: 12px !important; }
.setting-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); cursor: pointer; }
.setting-line input { accent-color: var(--seal); }

#ics-hint-dialog .help-content h3 { margin-top: 0; font-family: var(--hand); }
#ics-hint-dialog p { font-size: 14px; margin: 8px 0 16px; }
.confirm-box {
  background: var(--card);
  border-radius: 12px;
  padding: 22px;
  max-width: 340px;
  width: 88%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
}
.confirm-box p { margin: 0 0 16px; }

/* ---------- Toast ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  transition: opacity .3s ease, transform .3s ease;
}
.toast.err { background: var(--seal); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- 响应式 ---------- */

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .topbar-actions .searchbox input { width: 110px; }
  .hero-day { font-size: 72px; }
  .stat { min-width: 88px; padding: 12px 16px; }
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .topbar nav { order: 3; width: 100%; }
  .topbar-actions { order: 2; margin-left: 0; flex-wrap: wrap; }
  .searchbox { flex: 1; }
  .searchbox input { width: auto; flex: 1; }
  .hero { padding: 0 16px; }
  .hero-stats { margin-left: 0; width: 100%; justify-content: space-between; }
  .layout { padding: 0 16px; margin-top: 16px; }
  .filters { padding: 8px 16px; }
  .day { min-height: 64px; }
  .day-chips .chip { display: none; }
  .day-chips .chip.more { display: block; }
  .day-num { font-size: 13px; }
  .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
/* ==========================================================
   v2 交互视图：周网格 / 月网格 / 今日总览 / 指针拖拽
   ========================================================== */

/* ---------- 主面板 + 视图切换 ---------- */

.layout { grid-template-columns: 1fr 360px; }

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  min-height: 0;
}

.viewbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
}

.seg-group { display: flex; gap: 4px; }

.seg {
  border: 1px solid var(--line);
  background: #fffdf7;
  color: var(--muted);
  padding: 5px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.seg.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.view-nav { display: flex; align-items: center; gap: 8px; }
.view-label { font-family: var(--hand); font-size: 14px; color: var(--muted); }

.view-area { min-height: 0; overflow-y: auto; flex: 1; }
.hidden { display: none !important; }

/* ---------- 周视图 ---------- */

.week-grid { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }

.week-head {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.week-head .wh { padding: 8px 4px; text-align: center; font-size: 12px; color: var(--muted); }
.week-head .wh .wd { font-family: var(--hand); font-size: 13px; color: var(--ink); display: block; }
.week-head .wh .wnum { display: block; margin-top: 1px; }
.week-head .wh.today .wd { color: var(--seal); font-weight: 700; }

.week-body {
  display: flex;
  position: relative;
  user-select: none;
  padding-top: 6px;
  padding-bottom: 6px;
}

.time-col { display: flex; flex-direction: column; flex: 0 0 52px; }
.time-label {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding-right: 8px;
  transform: translateY(-6px);
  font-variant-numeric: tabular-nums;
  font-family: var(--hand);
}

.day-col {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(42, 33, 28, .07);
}
.day-col:first-of-type { border-left: none; }
.day-col.today-col { background: rgba(193, 91, 62, .03); }
.day-col.drag-over { background: var(--seal-soft); }

.hour-cell {
  position: relative;
  border-top: 1px solid rgba(42, 33, 28, .07);
  flex: 0 0 auto;
}
.hour-cell:first-child { border-top: none; }
.hour-cell.busy { background: rgba(193, 91, 62, .05); }

.slot-resize {
  position: absolute;
  left: 0; right: 0;
  bottom: -4px;
  height: 8px;
  cursor: ns-resize;
  opacity: 0;
  z-index: 1;
  transition: opacity .12s;
}
.hour-cell:hover .slot-resize { opacity: 1; }
.slot-resize:hover { opacity: 1; }
.slot-resize::after {
  content: '';
  position: absolute;
  left: 12%; right: 12%;
  top: 3px;
  height: 1px;
  background: rgba(42, 33, 28, .18);
  transition: background .12s, height .12s;
}
.slot-resize:hover::after { background: var(--seal); height: 2px; }

.layout-hud {
  position: fixed;
  z-index: 9999;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-family: var(--hand);
  padding: 4px 9px;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.ev {
  position: absolute;
  left: 4px; right: 4px;
  z-index: 2;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  cursor: grab;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-left: 3px solid;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 1px 2px rgba(60, 40, 30, .08);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.ev:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(60, 40, 30, .14); }
.ev.sel { outline: 2px solid var(--seal); outline-offset: -1px; }
.ev.p3 { background: linear-gradient(180deg, #f6e4da 0%, #efd8ca 100%); border-left-color: var(--seal); color: #7d211c; }
.ev.p2 { background: linear-gradient(180deg, #f6ecd9 0%, #eedfc2 100%); border-left-color: var(--gold); color: #7a5c1e; }
.ev.p1 { background: linear-gradient(180deg, #e9efe6 0%, #dde7da 100%); border-left-color: var(--bamboo); color: #3c4f3a; }

.ev .ev-title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ev .ev-time { display: block; font-size: 10px; opacity: .75; font-variant-numeric: tabular-nums; }

.resize-handle {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 6px;
  cursor: ns-resize;
  border-radius: 0 0 6px 6px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.resize-handle::after {
  content: '';
  width: 12px; height: 2px;
  background: rgba(38, 35, 31, .35);
  border-radius: 2px;
  margin-bottom: 1px;
}
.resize-handle:hover::after { background: var(--seal); }

.drop-marker {
  position: absolute;
  left: 2px; right: 2px;
  height: 3px;
  background: var(--seal);
  border-radius: 2px;
  pointer-events: none;
  z-index: 3;
}
.drop-marker span {
  position: absolute;
  left: 0; top: 5px;
  background: var(--seal);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

#selectRect {
  position: absolute;
  border: 1px solid var(--seal);
  background: rgba(193, 91, 62, .12);
  pointer-events: none;
  z-index: 20;
}

.drag-ghost { opacity: .85; box-shadow: 0 8px 24px rgba(38, 35, 31, .18); cursor: grabbing; }

.drag-badge {
  position: absolute;
  top: -8px; right: -8px;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  background: var(--seal);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

body.dragging-on,
body.dragging-on * { cursor: grabbing !important; user-select: none !important; }

/* ---------- 月视图 ---------- */

.month-grid { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }

.month-grid .month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--card);
  margin-bottom: 0;
}
.month-grid .month-head .wh {
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--hand);
}

.month-grid-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(88px, 1fr);
}

.m-day {
  border-left: 1px solid rgba(42, 33, 28, .12);
  border-top: 1px solid rgba(42, 33, 28, .12);
  padding: 4px;
  min-height: 88px;
  position: relative;
  cursor: pointer;
  transition: background .12s;
}
.m-day:nth-child(7n+1) { border-left: none; }
.m-day.out { background: #e9dbc8; }
.m-day.today-cell { background: rgba(193, 91, 62, .05); }
.m-day.sel-day { background: var(--seal-soft); }
.m-day.drag-over { background: var(--seal-soft); }

.m-day .m-num {
  font-family: var(--hand);
  font-size: 12px;
  color: var(--muted);
  display: inline-block;
  padding: 0 4px;
  border-radius: 4px;
}
.m-day.today-cell .m-num { background: var(--seal); color: #fff; }

.m-evs { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }

.m-ev {
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  border-left: 2px solid;
  transition: opacity .12s;
}
.m-ev.p3 { background: var(--seal-soft); border-left-color: var(--seal); color: #7d211c; }
.m-ev.p2 { background: var(--gold-soft); border-left-color: var(--gold); color: #7a5c1e; }
.m-ev.p1 { background: var(--bamboo-soft); border-left-color: var(--bamboo); color: #3c4f3a; }
.m-ev.more { border-left-color: transparent; color: var(--muted); background: transparent; }
.m-ev.sel { outline: 1px solid var(--seal); }

/* ---------- 今日总览 ---------- */

.overview-list { display: flex; flex-direction: column; gap: 10px; }

.ov-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 2px 4px;
}
.ov-head-title { font-family: var(--hand); font-size: 18px; font-weight: 700; }
.ov-head-date { color: var(--muted); font-size: 13px; }

.ov-empty { color: var(--muted); text-align: center; padding: 48px 0; }

.ov-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdf7ec;
  transition: opacity .12s, border-color .12s;
}
.ov-row:hover { border-color: var(--seal); }
.ov-row.done { opacity: .5; }

.ov-check {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fffdf7;
  color: var(--seal);
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: border-color .12s, background .12s;
}
.ov-check:hover { border-color: var(--seal); }
.ov-row.done .ov-check { border-color: var(--bamboo); background: var(--bamboo); color: #fff; }
.ov-row.done .ov-title { text-decoration: line-through; color: var(--muted); }

.ov-body { flex: 1; min-width: 0; }
.ov-title { font-size: 14px; font-weight: 600; }
.ov-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.ov-kind {
  flex: none;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}
.ov-kind.event { background: var(--seal-soft); color: var(--seal); }
.ov-kind.todo { background: var(--gold-soft); color: var(--gold); }

.ov-sep {
  margin-top: 6px;
  padding: 8px 2px 2px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  font-family: var(--hand);
}

/* ---------- 待办侧栏 ---------- */

.side-tip { font-size: 12px; color: var(--muted); margin: -6px 0 10px; }
.todo-item { cursor: grab; }
.todo-item.dragging { opacity: .45; }
.side #todos-list { max-height: 340px; overflow-y: auto; }
.side #done-list { max-height: 300px; overflow-y: auto; }

/* ---------- 纸张质感 ---------- */

.panel, .week-grid, .month-grid, .stat, .confirm-box {
  background-image: var(--texture);
}
.confirm-box { background-color: var(--card); }

/* ==========================================================
   v3 书册三栏布局（品牌栏 / AI 收件箱 / 日历 / 待办 + 底部根系）
   ========================================================== */

.book {
  display: grid;
  grid-template-columns: 150px 300px minmax(0, 1fr) 330px;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "brand inbox calendar drawer"
    "root  root   root     root";
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.brand-bar {
  grid-area: brand;
  background: var(--paper);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='0.05'/></feComponentTransfer></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
    linear-gradient(180deg, rgba(244, 233, 218, .05), transparent 45%);
  color: #d8d0c8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 34px 10px 30px;
  overflow-y: auto;
  border-right: 1px solid rgba(244, 233, 218, .14);
  box-shadow: inset -1px 0 0 rgba(244, 233, 218, .05);
}

.brand-block { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brand-vertical {
  writing-mode: vertical-rl;
  font-family: "STXinwei", "华文新魏", "Weibei SC", "KaiTi", "楷体", "SimKai", serif;
  font-size: 48px;
  letter-spacing: 8px;
  color: #e6ddd2;
  line-height: 1.2;
  text-shadow: 0 0 24px rgba(230, 221, 210, .12);
}
.brand-en {
  font-size: 9px;
  letter-spacing: 2.5px;
  color: #a09890;
  text-transform: uppercase;
}

.seal-1902 {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid #c23b22;
  color: #c23b22;
  display: grid;
  place-items: center;
  font-family: var(--hand);
  font-size: 21px;
  letter-spacing: 2px;
  font-weight: 700;
  transform: rotate(-4deg);
  filter: url(#seal-strong);
  opacity: .95;
  box-shadow: inset 0 0 0 2px rgba(194, 59, 34, .14);
}
.seal-glyph { filter: url(#seal-light); line-height: 1; }

.seal-note {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: #9a8f85;
  font-family: var(--hand);
  margin-top: -16px;
}

.month-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: var(--hand);
  font-size: 14px;
  letter-spacing: 2px;
  color: #8f857b;
}
.month-nav .mn { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 8px; border-radius: 6px; transition: background .12s, color .12s; }
.month-nav .mn::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.month-nav .mn:hover { color: #e6ddd2; }
.month-nav .mn.on { color: var(--seal); }
.month-nav .mn.on::before { background: var(--seal); }

.root-stamp {
  margin-top: auto;
  width: 48px;
  height: 48px;
  border: 3px solid #c23b22;
  color: #c23b22;
  font-family: var(--hand);
  font-size: 27px;
  display: grid;
  place-items: center;
  transform: rotate(-6deg);
  border-radius: 4px;
  opacity: .92;
  filter: url(#seal-strong);
}

/* ---------- AI 收件箱 ---------- */

.inbox {
  grid-area: inbox;
  position: relative;
  background: var(--card);
  background-image: var(--texture);
  padding: 18px 14px;
  overflow-y: auto;
  min-height: 0;
  box-shadow:
    inset 1px 0 0 #fffef9,
    0 1px 0 rgba(42, 33, 28, .1),
    2px 0 10px rgba(42, 33, 28, .16);
}

.inbox .panel-head { margin-bottom: 8px; }
.inbox .panel-head h2 { margin: 0; font-family: var(--hand); font-size: 17px; }
.inbox-actions { display: flex; align-items: center; gap: 6px; }
.inbox-count { margin-left: auto; font-family: var(--hand); font-size: 11px; color: var(--muted); white-space: nowrap; }
.inbox-ops {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  padding: 7px 8px;
  margin: 0 0 10px;
  border-radius: 8px;
  background: var(--seal-soft);
  border: 1px solid rgba(193, 91, 62, .18);
}
.inbox-ops .btn { padding: 3px 9px; font-size: 11px; }
.inbox-ops.hidden { display: none; }

.inbox-tip { font-size: 11px; color: var(--muted); margin: 0 0 10px; line-height: 1.5; }

.revert-zone {
  border: 1px dashed rgba(193, 91, 62, .5);
  border-radius: 8px;
  color: var(--seal);
  font-size: 11px;
  text-align: center;
  padding: 8px 6px;
  margin-bottom: 12px;
  transition: background .12s, border-color .12s;
}
.revert-zone.drag-over { background: var(--seal-soft); border-color: var(--seal); }

.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  border: 1px solid transparent;
  border-bottom: 1px solid rgba(42, 33, 28, .12);
  border-radius: 0;
  background: transparent;
  padding: 8px 8px 9px;
  cursor: grab;
  box-shadow: none;
  transition: transform .12s, box-shadow .12s, border-color .12s, background .12s, opacity .12s;
  user-select: none;
}
.card:hover {
  background: rgba(255, 254, 249, .7);
  border-color: rgba(193, 91, 62, .4);
  box-shadow: 0 2px 6px rgba(139, 115, 85, .1);
  transform: translateY(-1px);
}
.card.selected { border: 1px solid var(--seal); background: rgba(255, 254, 249, .8); box-shadow: 0 0 0 1px var(--seal); }
.card.used { opacity: .38; cursor: default; filter: grayscale(.4); }

.card-src { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.card-src-right { display: flex; align-items: center; gap: 6px; }
.card-title { font-weight: 700; font-size: 13px; }
.card-raw { font-size: 11px; color: var(--muted); margin: 2px 0 4px; line-height: 1.35; }
.card-fields { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--ink); line-height: 1.4; }
.card-fields > span { display: inline-flex; align-items: center; gap: 2px; }
.card-fields i { font-style: normal; color: var(--seal); font-family: var(--hand); }
.card-fields .ed:focus { outline: 1px solid var(--seal); background: var(--seal-soft); border-radius: 3px; }
.card .fuzzy { font-size: 11px; color: var(--gold); width: 100%; }

.tag { padding: 1px 7px; border-radius: 999px; font-size: 11px; font-style: normal; }
.tag-wx { background: #e4efea; color: #3d6b58; }
.tag-mail { background: #e7ebf2; color: #41586f; }
.tag-qq { background: #ece7f3; color: #6b5291; }
.tag-sms { background: #f0ebe2; color: #7a6a4d; }
.tag-jw { background: #f4e3dd; color: #8a4b3a; }

.conf { font-size: 10px; padding: 1px 6px; border-radius: 999px; }
.conf-hi { background: var(--bamboo-soft); color: var(--bamboo); }
.conf-mid { background: var(--gold-soft); color: var(--gold); }
.conf-low { background: var(--seal-soft); color: var(--seal); }

.quick {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--seal);
  background: transparent;
  color: var(--seal);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .12s, color .12s;
}
.quick:hover { background: var(--seal); color: #fff; }

/* ---------- 日历面板 ---------- */

.calendar-panel {
  grid-area: calendar;
  background: var(--card);
  background-image: var(--texture);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 14px 6px;
  overflow: hidden;
  border-left: 1px solid rgba(42, 33, 28, .14);
  border-right: 1px solid rgba(42, 33, 28, .14);
  box-shadow:
    inset 1px 0 0 #fffef9,
    inset -1px 0 0 #fffef9,
    0 1px 0 rgba(42, 33, 28, .1),
    0 2px 12px rgba(42, 33, 28, .14);
}

.month-hero {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 4px 8px;
  flex: 0 0 auto;
}
.hero-num {
  font-family: "Bodoni MT", "Didot", "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-size: 60px;
  font-weight: 700;
  line-height: .9;
  color: var(--seal);
  letter-spacing: 1px;
}
.hero-cn { font-family: var(--hand); font-size: 20px; color: var(--ink); letter-spacing: 4px; }
.hero-motto { font-size: 11px; color: var(--muted); letter-spacing: 2px; margin-left: auto; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 2px 10px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.toolbar .seg-group { display: flex; gap: 4px; flex: 0 0 auto; }
.toolbar .view-nav { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.toolbar .view-nav .btn { padding: 4px 8px; font-size: 13px; }
.toolbar .view-nav .btn.icon { padding: 4px 9px; }
.tool-actions { display: flex; align-items: center; gap: 5px; margin-left: 8px; flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-start; }
.tool-actions .btn { padding: 4px 8px; font-size: 13px; white-space: nowrap; }
.tool-actions .btn.icon { padding: 4px 9px; }
.tool-actions .searchbox { padding: 0 8px; }
.tool-actions .searchbox input { width: 120px; padding: 6px 0; }
.tool-actions .pill-select { padding: 5px 6px; font-size: 12px; }

.calendar-panel .view-area {
  min-height: 0;
  overflow-y: auto;
  flex: 1;
  margin-top: 10px;
  padding-right: 2px;
}

/* ---------- 待办抽屉 ---------- */

.task-drawer {
  grid-area: drawer;
  position: relative;
  background: var(--card);
  background-image: var(--texture);
  padding: 20px 16px;
  overflow-y: auto;
  min-height: 0;
  box-shadow:
    inset -1px 0 0 #fffef9,
    0 1px 0 rgba(42, 33, 28, .1),
    -2px 0 10px rgba(42, 33, 28, .16);
}

.drawer-handle {
  position: absolute;
  top: 60px;
  left: -3px;
  width: 6px;
  height: 88px;
  background: var(--seal);
  border-radius: 3px;
  opacity: .75;
}
.drawer-handle::after {
  content: '';
  position: absolute;
  top: -14px;
  left: -1px;
  width: 8px;
  height: 116px;
  background: linear-gradient(90deg, rgba(193, 91, 62, .28), transparent 70%);
  border-radius: 4px;
}

.task-drawer .panel-head { margin-bottom: 10px; }
.task-drawer .panel-head h3 { margin: 0; font-family: var(--hand); font-size: 16px; }
.done-head { margin-top: 22px !important; padding-top: 16px; border-top: 1px dashed var(--line); }

/* ---------- 底部根系横条 ---------- */

.root-bar {
  grid-area: root;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  height: 44px;
  z-index: 6;
}
/* 云纹护封沿：轻微的中式装饰边，从底部横条向上浅浅伸出 */
.root-bar::before {
  content: '';
  position: absolute;
  top: -11px; left: 0; right: 0;
  height: 12px;
  background: var(--paper);
  opacity: .82;
  pointer-events: none;
  clip-path: polygon(
    0 100%, 0 72%,
    3% 66%, 6% 56%, 9% 68%, 12% 78%,
    15% 64%, 18% 52%, 21% 62%, 24% 76%,
    27% 66%, 30% 54%, 33% 60%, 36% 74%,
    39% 62%, 42% 50%, 45% 58%, 48% 72%,
    51% 62%, 54% 52%, 57% 64%, 60% 78%,
    63% 66%, 66% 54%, 69% 62%, 72% 76%,
    75% 64%, 78% 52%, 81% 60%, 84% 74%,
    87% 64%, 90% 56%, 93% 66%, 96% 78%,
    98% 70%, 100% 76%, 100% 100%
  );
}
.root-motto {
  font-family: var(--hand);
  font-size: 13px;
  letter-spacing: 10px;
  color: rgba(244, 233, 218, .72);
  position: relative;
  z-index: 1;
  padding: 2px 14px;
  border-radius: 3px;
}
.root-svg { width: 100%; height: 28px; position: absolute; inset: 0; }

/* 面板浮起阴影（折页纸分层） */
.inbox, .calendar-panel, .task-drawer {
  box-shadow: 0 0 30px rgba(0, 0, 0, .12);
}

/* ---------- 收件箱与日历间距（折页缝隙） ---------- */
.inbox { box-shadow: inset 4px 0 10px -6px rgba(42, 33, 28, .18); }

/* ---------- 响应式降级 ---------- */
@media (max-width: 1380px) {
  .book { grid-template-columns: 130px 270px minmax(0, 1fr) 300px; }
  .hero-num { font-size: 88px; }
  .toolbar { gap: 8px; }
  .tool-actions .btn { padding: 6px 10px; font-size: 13px; }
}
@media (max-width: 1180px) {
  .book { grid-template-columns: 110px minmax(0, 1fr) 300px; grid-template-areas:
    "brand calendar drawer"
    "root  root     root"; }
  .inbox { display: none; }
}
@media (max-width: 820px) {
  .book { grid-template-columns: 1fr; grid-template-areas:
    "calendar" "root"; }
  .brand-bar, .task-drawer, .inbox { display: none; }
  .hero-num { font-size: 64px; }
  .tool-actions .searchbox input { width: 90px; }
}

/* ==========================================================
   自定义滚动条（贴合纸面，替换原生）
   ========================================================== */
* { scrollbar-width: thin; scrollbar-color: rgba(42,33,28,.28) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(42,33,28,.22);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(42,33,28,.42); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }
.brand-bar::-webkit-scrollbar-thumb { background: rgba(244,233,218,.2); background-clip: content-box; }
.brand-bar { scrollbar-color: rgba(244,233,218,.2) transparent; }

/* ==========================================================
   登录层（Caigen Auth）
   ========================================================== */
.auth-cover {
  position: fixed;
  inset: 0;
  background: var(--paper);
  background-image: radial-gradient(1200px 600px at 50% -10%, rgba(244, 233, 218, .06), transparent 60%);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}
.auth-card {
  background: var(--card);
  background-image: var(--texture);
  border-radius: 8px;
  padding: 34px 36px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: inset 1px 0 0 #fffef9, 0 8px 30px rgba(0, 0, 0, .35);
  text-align: center;
}
.auth-brand { display: flex; align-items: center; gap: 14px; justify-content: center; }
.auth-seal {
  width: 46px; height: 46px;
  background: var(--seal);
  color: #fff;
  font-family: var(--hand);
  font-size: 21px;
  display: grid; place-items: center;
  border-radius: 4px;
  transform: rotate(-3deg);
  box-shadow: 0 2px 6px rgba(151, 37, 31, .3);
}
.auth-brand-text { display: flex; flex-direction: column; text-align: left; }
.auth-name { font-family: var(--hand); font-size: 18px; font-weight: 700; color: var(--ink); }
.auth-en { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.auth-motto { font-family: var(--hand); font-size: 13px; letter-spacing: 2px; color: var(--muted); margin: 16px 0 22px; }
.auth-body { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.auth-label input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fffdf7;
}
.auth-label input:focus { outline: 2px solid var(--seal-soft); border-color: var(--seal); }
.auth-code-row { display: flex; gap: 8px; align-items: flex-end; }
.auth-submit { width: 100%; justify-content: center; padding: 10px; font-size: 15px; margin-top: 4px; }
.auth-hint { font-size: 12px; color: var(--muted); line-height: 1.5; text-align: center; margin: 2px 0 0; }

/* 普通用户（非 owner）：隐藏演示收件箱，日历占满 */
body.no-inbox .book {
  grid-template-columns: 150px minmax(0, 1fr) 330px;
  grid-template-areas: "brand calendar drawer" "root root root";
}
body.no-inbox .inbox { display: none; }

/* ---------- 当前用户 ---------- */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 5px 10px;
  border: 1px solid rgba(244, 233, 218, .16);
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  max-width: 130px;
}
.user-chip:hover { background: rgba(244, 233, 218, .08); border-color: rgba(244, 233, 218, .3); }
.user-avatar { font-size: 16px; flex: 0 0 auto; }
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name {
  font-size: 12px;
  color: #e6ddd2;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-email {
  font-size: 9px;
  color: #8f857b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 头像选择 ---------- */
.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-opt {
  width: 40px; height: 40px;
  font-size: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  cursor: pointer;
  display: grid; place-items: center;
  transition: border-color .12s, background .12s;
}
.avatar-opt:hover { border-color: var(--seal); }
.avatar-opt.on { border-color: var(--seal); background: var(--seal-soft); box-shadow: 0 0 0 1px var(--seal); }

/* ---------- 头像裁剪 ---------- */
.avatar-upload-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.crop-wrap { margin-top: 12px; }
.crop-box {
  position: relative;
  width: 160px; height: 160px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #e9e2d4;
  cursor: grab;
  user-select: none;
}
.crop-box:active { cursor: grabbing; }
.crop-box img {
  position: absolute;
  top: 0; left: 0;
  max-width: none;
  cursor: grab;
  user-select: none;
}
.crop-box img:active { cursor: grabbing; }
.crop-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--seal);
}
.crop-tools { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* ---------- 导入通知 ---------- */
.import-preview { margin-top: 10px; }
.import-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fffdf7;
}
.import-title { font-weight: 700; font-size: 14px; }
.import-raw { font-size: 12px; color: var(--muted); margin-top: 4px; max-height: 120px; overflow: auto; }
.import-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--seal); }

/* ---------- 收件箱卡片：来源链接 + 总结 ---------- */
.card-src-link {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  background: #e7ebf2;
  color: #41586f;
  text-decoration: none;
  border: 1px solid rgba(65, 88, 111, .2);
  transition: background .12s;
}
.card-src-link:hover { background: #dbe3ee; text-decoration: none; }
.card-summary {
  font-size: 12px;
  color: var(--ink);
  margin: 4px 0;
  line-height: 1.45;
  padding-left: 8px;
  border-left: 2px solid var(--seal-soft);
}

/* ---------- 地点导航 ---------- */
.loc-nav-row { display: inline-flex; gap: 8px; margin-top: 6px; }

/* ---------- 详情卡片 ---------- */
#detail-dialog { border: none; padding: 0; background: transparent; }
.detail-card {
  background: var(--card);
  background-image: var(--texture);
  border-radius: 16px;
  padding: 22px 26px;
  width: 100%;
  min-width: 380px;
  max-width: 480px;
  position: relative;
  border: 1px solid rgba(42, 33, 28, .1);
  box-shadow: 0 1px 0 #fffef9, 0 16px 48px rgba(42, 33, 28, .28);
}
.detail-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--seal), transparent 60%);
}
.detail-head { display: flex; align-items: center; gap: 10px; }
.detail-kind {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--seal-soft);
  color: var(--seal);
  font-family: var(--hand);
  border: 1px solid rgba(193, 91, 62, .2);
}
.detail-head h3 { margin: 0; font-family: var(--hand); font-size: 19px; flex: 1; line-height: 1.4; }
#detail-close { border: none; background: transparent; font-size: 16px; color: var(--muted); opacity: .7; }
#detail-close:hover { opacity: 1; color: var(--ink); }
.detail-body {
  margin: 16px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 4px;
}
.det-row {
  display: flex;
  gap: 10px;
  font-size: 13px;
  line-height: 1.55;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(42, 33, 28, .08);
}
.det-row:last-child { border-bottom: none; }
.det-row i {
  font-style: normal;
  color: var(--muted);
  flex: 0 0 44px;
  font-family: var(--hand);
  font-size: 12px;
  letter-spacing: 1px;
  padding-top: 1px;
}
.det-row i::after { content: '·'; color: var(--seal); margin-left: 2px; }
.det-row span { color: var(--ink); word-break: break-word; }
.det-content span { white-space: pre-wrap; font-size: 12.5px; }
.det-nav { color: var(--seal); margin-left: 6px; text-decoration: none; font-size: 12px; }
.det-nav:hover { text-decoration: underline; }
.detail-actions { display: flex; gap: 10px; padding-top: 4px; }
.detail-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--seal-soft);
  border: 1px solid rgba(193, 91, 62, .25);
}
.detail-confirm span { font-size: 13px; color: #7d211c; }
.detail-confirm div { display: flex; gap: 8px; }

/* ---------- 地点/来源超链接 ---------- */
.det-loc-link { color: var(--seal); text-decoration: none; word-break: break-all; }
.det-loc-link:hover { text-decoration: underline; }

/* ============================================================
   打磨层 · 字体 / 按钮 / 动画 精细调节（覆盖增强，可回退）
   ============================================================ */

/* ---- 滚动条：细淡墨，贴合纸面 ---- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(42, 33, 28, .22);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(42, 33, 28, .34); background-clip: content-box; }

/* ---- 强调文本：印染感 ---- */
::selection { background: var(--seal); color: #fff; }

/* ---- 视图切换 seg：赭土橙 + 过渡 ---- */
.seg {
  font-family: var(--hand);
  font-weight: 500;
  letter-spacing: .02em;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease), transform .12s var(--ease);
}
.seg:hover { border-color: var(--seal); color: var(--seal); }
.seg.active {
  background: var(--seal);
  border-color: var(--seal);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .1);
  box-shadow: 0 2px 6px rgba(193, 91, 62, .25);
}
.seg:active { transform: translateY(1px); }

/* ---- 卡片 / 纸条 hover 微抬（印在纸上的起伏） ---- */
.card, .todo-item, .m-day, .ev, .ov-row {
  transition: transform .16s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.card:not(.used):hover, .todo-item:hover, .m-day:not(.empty):hover, .ov-row:hover { transform: translateY(-1px); }
.card:not(.used):hover, .todo-item:hover, .m-day:not(.empty):hover { box-shadow: var(--shadow-card); }
.ev:hover { box-shadow: 0 2px 8px rgba(42, 33, 28, .12); }

/* ---- 月份 hero 数字：衬线厚度 + 纸墨渐变 ---- */
.hero-num, .hero-day {
  font-family: var(--hand);
  font-weight: 700;
  letter-spacing: .03em;
  background: linear-gradient(180deg, var(--seal-deep), var(--seal) 60%, #a8462e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}
.hero-cn, .hero-motto { letter-spacing: .04em; }

/* ---- 对话框：温和进场 ---- */
dialog { box-shadow: 0 4px 8px rgba(42, 33, 28, .06), 0 28px 68px rgba(0, 0, 0, .2); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
dialog[open] { animation: dialog-in .22s var(--ease); }
dialog::backdrop { background: rgba(38, 35, 31, .46); backdrop-filter: blur(2px); }

/* ---- 确认弹层：进场 ---- */
.confirm-wrap {
  caption-side: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.confirm-box { animation: confirm-in .18s var(--ease); box-shadow: 0 6px 16px rgba(42, 33, 28, .12), 0 24px 52px rgba(0, 0, 0, .25); }

/* ---- toast：轻浮进出 ---- */
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast { animation: toast-in .2s var(--ease); }

/* ---- 卡片进场：逐张浮现 ---- */
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { transform: none; } }
#cardList .card { animation: card-in .28s var(--ease) backwards; }
#cardList .card:nth-child(2) { animation-delay: .03s; }
#cardList .card:nth-child(3) { animation-delay: .06s; }
#cardList .card:nth-child(n+4) { animation-delay: .09s; }
.card-list { counter-reset: none; }

/* ---- 今天列 / 选中列：软晕圈 ---- */
.day-col.today, .m-day.today { box-shadow: inset 0 0 0 1px rgba(193, 91, 62, .28); }
.day-col.today .wh { color: var(--seal); }

/* ---- 折叠页签 hover 微光 ---- */
.card-src-link, .det-nav, a.card-src-link { transition: color .15s var(--ease), opacity .15s var(--ease); }

/* ---- 关闭小按钮（×）hover 柔和 ---- */
#detail-close, .btn.close { transition: transform .15s var(--ease), opacity .15s var(--ease); }
#detail-close:hover { transform: rotate(90deg); }

/* ---- 完成置灰的淡化拖影 ---- */
.todo-item.done { transition: opacity .2s var(--ease); }

/* ============================================================
   可读性提升层 · 楷体小字易累，放大核心阅读元素
   ============================================================ */

body { font-size: 15px; }

/* 卡片正文 */
.card-title { font-size: 15px; line-height: 1.45; }
.card-summary { font-size: 13.5px; line-height: 1.6; }
.card-raw { font-size: 13px; line-height: 1.6; color: rgba(42, 33, 28, .72); }
.card-fields { font-size: 13px; }
.card .fuzzy { font-size: 12.5px; }

/* 来源/置信标签略增 */
.tag { font-size: 12px; }
.conf { font-size: 11px; }
.inbox-count { font-size: 12.5px; }
.inbox-tip { font-size: 12.5px; line-height: 1.6; color: rgba(42, 33, 28, .6); }

/* 待办抽屉 */
.item-title { font-size: 15px; }
.item-meta { font-size: 13px; }
.task-drawer .panel-head h3 { font-size: 17px; }

/* 总览 */
.ov-title { font-size: 15px; line-height: 1.5; }
.ov-sub { font-size: 12.5px; }
.ov-head-title { font-size: 19px; }

/* 详情卡片 */
.detail-head h3 { font-size: 20px; }
.det-row { font-size: 14px; }
.det-content span { font-size: 14px; }
.det-row i { font-size: 13px; }
.det-nav { font-size: 13px; }
#detail-close { font-size: 17px; }

/* 工具条按钮（含 seg） */
.toolbar .view-nav .btn { font-size: 14px; }
.tool-actions .btn { font-size: 14px; }
.seg { font-size: 14px; padding: 6px 16px; }
.view-label { font-size: 15px; }
.btn.tiny { font-size: 13px; }
.btn.small { font-size: 14px; }

/* 表单内文字 */
dialog input, dialog select, dialog textarea { font-size: 15px; }
dialog label { font-size: 14px; }
.dialog-actions .btn, .import-title { font-size: 15px; }
.import-raw, .import-meta { font-size: 13px; }

/* 周/月头与时间轴 */
.week-head .wh { font-size: 13px; }
.week-head .wh .wd { font-size: 14px; }
.ev .ev-inner { font-size: 13px; }


