/* ============================================
   小橙记事 - 主样式
   ============================================ */

:root {
  /* 主色调 —— 温暖小橙 */
  --primary: #f97316;          /* 主橙 */
  --primary-deep: #ea580c;     /* 深橙，用于强调 */
  --primary-light: #ffd9b3;
  --primary-bg: #fff3e9;
  --primary-soft: #fff8f2;

  /* 中性色 —— 暖调 */
  --bg: #fbf4ec;
  --bg-grad-1: #fdf6ee;
  --bg-grad-2: #fbf1e6;
  --surface: #fffdfb;
  --surface-2: #fff7f0;
  --border: #f0e6db;
  --border-strong: #e4d5c6;

  /* 文字 */
  --text: #3a2e26;
  --text-soft: #8a7766;
  --text-light: #b3a292;
  --text-on-primary: #ffffff;

  /* 状态色 */
  --danger: #e25b54;
  --success: #3fae87;
  --today: #f97316;

  /* 阴影 —— 柔和暖调 */
  --shadow-sm: 0 1px 3px rgba(180, 130, 80, 0.08);
  --shadow: 0 6px 20px rgba(180, 130, 80, 0.12);
  --shadow-lg: 0 18px 48px rgba(160, 110, 60, 0.18);
  --shadow-glow: 0 8px 24px rgba(249, 115, 22, 0.25);

  /* 圆角 */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;

  /* 尺寸 */
  --header-h: 60px;
  --weekday-h: 42px;
  --tag-sidebar-w: 264px;
  --right-panel-w: 380px;
  --month-row-h: 104px;

  /* 字体 */
  --font: "Sora", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Source Han Sans CN", sans-serif;
  --font-display: "Fraunces", "Sora", "Noto Sans SC", serif;
  --font-num: "Sora", "Noto Sans SC", sans-serif;
}

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

[v-cloak] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 温暖氛围背景：奶油渐变 + 双橙色光晕 + 极淡纹理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 80% at 12% -5%, rgba(255, 178, 102, 0.20) 0%, rgba(255, 178, 102, 0) 55%),
    radial-gradient(90% 70% at 105% 8%, rgba(255, 138, 61, 0.12) 0%, rgba(255, 138, 61, 0) 50%),
    linear-gradient(160deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
}

/* 细腻的纸张纹理（点阵） */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(180, 140, 100, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0 0;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  padding: 9px 12px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

/* ============================================
   顶部导航
   ============================================ */
.app-header {
  flex: 0 0 var(--header-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  gap: 8px;
  background: rgba(255, 253, 251, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 14px rgba(180, 130, 80, 0.06);
  z-index: 10;
}

.nav-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  line-height: 1.2;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-left {
  min-width: 0;
  flex: 1 1 auto;
}

.header-right {
  flex: 0 0 auto;
  flex-shrink: 0;
}

.nav-btn {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background .15s, transform .12s;
  min-width: 0;
  flex: 0 1 auto;
}

.nav-btn:hover {
  background: var(--primary-bg);
}

.nav-btn:active { transform: scale(0.96); }

.nav-btn svg {
  color: var(--text-soft);
  flex-shrink: 0;
}

.icon-btn {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s, color .15s, transform .12s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn:active { transform: scale(0.94); }

.icon-btn.icon-circle {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  font-size: 19px;
  line-height: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  transition: background .15s, color .15s, transform .12s, box-shadow .15s;
}

.icon-btn.icon-circle:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.icon-btn.icon-circle.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

/* ============================================
   主内容
   ============================================ */
.app-main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  position: relative;
}

/* ============================================
   标签侧栏
   ============================================ */
.tag-sidebar {
  flex: 0 0 var(--tag-sidebar-w);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 0;
  transition: transform .25s ease;
}

.tag-sidebar-header {
  padding: 0 16px 14px;
}

.new-tag-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-glow);
  transition: transform .12s, box-shadow .15s, filter .15s;
}

.new-tag-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 28px rgba(249, 115, 22, 0.35);
}

.new-tag-btn:active { transform: scale(0.98); }

.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
  font-size: 14px;
  color: var(--text);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background .15s;
}

.tag-list li:hover {
  background: var(--surface-2);
}

.tag-list li.active {
  background: var(--primary-bg);
  color: var(--primary-deep);
  font-weight: 600;
}

.tag-list li.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-deep) 100%);
}

.tag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  flex-shrink: 0;
  color: white;
  box-shadow: var(--shadow-sm);
}

.tag-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-count {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  padding: 2px 9px;
  border-radius: 11px;
  font-variant-numeric: tabular-nums;
}

.tag-list li.active .tag-count {
  background: #fff;
  color: var(--primary-deep);
  box-shadow: var(--shadow-sm);
}

.tag-edit-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  opacity: 0;
}

.tag-list li:hover .tag-edit-btn {
  opacity: 1;
}

/* ============================================
   日历视图
   ============================================ */
.calendar-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  user-select: none;
}

.weekday-header {
  flex: 0 0 var(--weekday-h);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(180, 130, 80, 0.04);
}

.weekday-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  border-right: 1px solid var(--border);
}

.weekday-cell:last-child {
  border-right: none;
}

.weekday-cell.weekend {
  color: var(--primary-deep);
}

.month-stream {
  flex: 1 1 auto;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  padding-bottom: 48px;
  will-change: transform;
  transition: transform 0.15s ease-out;
}

.month-card {
  background: var(--surface);
  margin: 10px 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.month-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 8px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.month-card-header .mch-now {
  color: var(--primary);
  font-size: 9px;
  line-height: 1;
}

.month-card-body {
  position: relative;
}

.calendar-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, var(--month-row-h));
  overflow: hidden;
  background: var(--border-strong);  /* 作为 cell 之间的间隙色 */
  gap: 1px;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* 跨天事件覆盖层，与 calendar-grid 完全重叠 */
.spanning-layer {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 1px;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.day-cell {
  padding: 5px 7px 3px;
  position: relative;
  cursor: pointer;
  background: var(--surface);
  display: grid;
  grid-template-rows: 26px 1fr;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  transition: background .15s ease, box-shadow .15s ease;
  animation: cellIn .5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 错落入场：按 6 行分档延迟 */
.day-cell:nth-child(7n+1), .day-cell:nth-child(7n+2), .day-cell:nth-child(7n+3),
.day-cell:nth-child(7n+4), .day-cell:nth-child(7n+5), .day-cell:nth-child(7n+6),
.day-cell:nth-child(7n+7) { animation-delay: calc(var(--row, 0) * 0.035s); }

@keyframes cellIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.day-cell.other-month {
  background: var(--bg);
  color: var(--text-light);
}

.day-cell:hover {
  background: var(--primary-soft);
  z-index: 1;
}

.day-cell.selected,
.day-cell.selection-range {
  background: var(--primary-bg) !important;
}

.day-cell.selection-range {
  box-shadow: inset 0 0 0 2px var(--primary);
  z-index: 2;
}

.day-cell.weekend:not(.other-month) .day-num {
  color: var(--primary-deep);
}

.day-cell.today {
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--surface) 70%);
}

.day-cell.today .day-num {
  background: var(--primary);
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow-glow);
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1px;
  position: relative;
  z-index: 4;
  grid-row: 1;
  min-height: 0;
}

.day-num {
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  /* 统一日期数字占位：让「今天」高亮与其他日期保持同一高度/基线，避免下方事项错位 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  border-radius: 50%;
}

.day-lunar {
  font-size: 10px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-lunar.festival,
.day-lunar.jieqi {
  color: var(--primary-deep);
  font-weight: 600;
}

.day-events {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  min-height: 0;
  padding-top: 1px;
  /* 抵消 .day-cell 的 7px 水平内边距，让单日事项标签背景顶满格子左右边缘；
     .day-cell 设了 overflow:hidden，超出的背景会被裁剪到格子边界 */
  margin: 0 -7px;
}

  .day-event {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 15px;         /* 增高并加垂直内边距，避免文字被背景裁切 */
  line-height: 11px;
  padding: 2px 0;       /* 垂直内边距：给文字上下留呼吸空间；水平内边距由 .ev-text 提供 */
  border-radius: 6px;   /* 与跨天条统一圆角 */
  font-size: 11px;
  font-weight: 500;
  color: white;
  background: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}

.day-event:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  z-index: 3;
}

.day-event:active {
  transform: translateY(0) scale(0.98);
}

.day-event.done {
  opacity: 0.5;
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.9);
  text-decoration-thickness: 1.5px;
  box-shadow: none;
}

.day-event.done .ev-text::after {
  content: ' ✓';
}

.ev-icon { font-size: 11px; }
.ev-dot { font-size: 10px; }
.ev-bell { font-size: 10px; }
/* 文字内边距放在这里，而不是父容器 .day-event 上，避免背景被撑出留白 */
.ev-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; padding: 0 6px; }

/* ============================================
   跨天任务：连续长条横跨多格
   ============================================ */
.spanning-event {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 0;       /* 与单天标签统一垂直内边距（水平内边距由 .sp-text 提供；marginTop 由 JS 动态控制，勿改） */
  border-radius: 6px;   /* 与单天标签统一圆角 */
  font-size: 11px;
  font-weight: 500;
  color: white;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  height: 15px;          /* 与 JS 中 SPAN_PITCH(16) = height(15) + gap(1) 保持一致，并与单天标签同高 */
  line-height: 11px;
  align-self: start;
  margin: 0;
  margin-top: 26px; /* 默认让出 26px day-header；运行时由 spanningMarginTop(lane) 覆盖 */
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, filter .15s ease, box-shadow .15s ease;
  z-index: 3;
  pointer-events: auto;
}

.spanning-event:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  z-index: 4;
}

.spanning-event.done {
  opacity: 0.5;
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.9);
  text-decoration-thickness: 1.5px;
  box-shadow: none;
}

.spanning-event.done .sp-text::after {
  content: ' ✓';
}

.sp-bell { flex-shrink: 0; font-size: 11px; }
/* 文字内边距放在这里，而不是父容器 .spanning-event 上，避免背景被撑出留白 */
.sp-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; padding: 0 6px; }

.more-events {
  font-size: 10px;
  color: var(--text-light);
  padding: 0 5px;
}

/* ============================================
   视图切换器
   ============================================ */
.view-switcher {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  margin-right: 10px;
  box-shadow: var(--shadow-sm);
}

.view-switcher button {
  padding: 5px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 600;
  transition: color .15s, background .15s, box-shadow .15s;
}

.view-switcher button:hover {
  color: var(--text);
}

.view-switcher button.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* ============================================
   列表视图
   ============================================ */
.list-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(80% 50% at 50% -10%, rgba(255, 178, 102, 0.10) 0%, rgba(255, 178, 102, 0) 60%),
    var(--surface);
  min-width: 0;
  overflow: hidden;
}

.list-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.list-summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

.list-filter {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.list-filter button {
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background .15s, color .15s;
}

.list-filter button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.list-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 16px 20px;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
}

.list-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
  font-size: 14px;
}

.list-group {
  margin-bottom: 12px;
}

.list-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 4px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.list-group-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

.list-group-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-2);
  padding: 3px 10px;
  border-radius: 11px;
  font-variant-numeric: tabular-nums;
}

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

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, box-shadow .18s, transform .12s, border-color .15s;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.list-item:hover {
  background: var(--surface-2);
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.list-item:active {
  transform: translateY(0) scale(0.997);
}

.list-item.done {
  opacity: 0.6;
}

.list-item.done .list-item-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-light);
}

.list-item-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--success);
  background: var(--surface);
  transition: all .18s;
}

.list-item-check.done {
  border-color: var(--success);
  background: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(63, 174, 135, 0.35);
}

.list-item-check:hover {
  border-color: var(--success);
  transform: scale(1.08);
}

.list-item-color {
  width: 5px;
  height: 38px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.list-item-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.list-item-title {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.list-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-soft);
  flex-wrap: wrap;
}

.list-item-tag {
  font-weight: 600;
}

.list-item-time, .list-item-rec, .list-item-bell {
  font-size: 11px;
}

/* ============================================
   右侧详情面板
   ============================================ */
/* 抽屉式遮罩 */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.right-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  box-shadow: 0 -16px 48px rgba(160, 110, 60, 0.22);
  display: flex;
  flex-direction: column;
  z-index: 50;
  max-height: 80vh;
  min-height: 220px;
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* PC 端: 居中、最大宽度 */
@media (min-width: 769px) {
  .right-panel {
    left: 50%;
    right: auto;
    width: min(560px, calc(100vw - 32px));
    transform: translateX(-50%);
    bottom: 32px;
    border-radius: var(--radius-lg);
    max-height: 72vh;
    border: 1px solid var(--border);
  }

  .sheet-mask {
    background: rgba(80, 50, 20, 0.28);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }
}

.right-panel.fullscreen {
  max-height: 100vh;
  border-radius: 0;
  bottom: 0;
}

/* 抽屉把手 */
.sheet-handle {
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sheet-handle-bar {
  width: 40px;
  height: 5px;
  background: var(--border-strong);
  border-radius: 3px;
  transition: background .15s;
}

.sheet-handle:hover .sheet-handle-bar {
  background: var(--primary);
}

@media (min-width: 769px) {
  .sheet-handle { display: none; }
}

/* 抽屉 sheet 动画：从底部升起（Vue 3 transition 类名） */
.sheet-enter-from, .sheet-leave-to {
  transform: translateY(100%);
}

.sheet-enter-active, .sheet-leave-active {
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 769px) {
  .sheet-enter-from, .sheet-leave-to {
    transform: translate(-50%, 100%);
  }
}

/* 遮罩 fade 动画 */
.fade-enter-from, .fade-leave-to {
  opacity: 0;
}

.fade-enter-active, .fade-leave-active {
  transition: opacity .2s ease;
}

.rp-header {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  gap: 4px;
}

.rp-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-soft);
  flex-shrink: 0;
  transition: background .15s;
}

.rp-nav-btn:hover { background: var(--bg); color: var(--text); }

.rp-back-btn {
  font-size: 13px;
  color: var(--primary);
  padding: 6px 4px;
}

.rp-date {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rp-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* 编辑模式 */
.rp-edit-mode .rp-range-info {
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  background: var(--primary-bg);
  border-radius: var(--radius);
}

.rp-event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

button.rp-event-row,
.rp-event-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, box-shadow .18s, transform .12s, border-color .15s;
  box-shadow: var(--shadow-sm);
  text-align: left;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.rp-event-row:hover {
  background: var(--surface-2);
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.rp-event-row.done {
  opacity: 0.6;
}

.rp-event-row.done .rp-ev-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-light);
  color: var(--text-soft);
}

.rp-event-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  margin-top: 1px;
  transition: all .18s;
  cursor: pointer;
}

.rp-event-check:hover {
  border-color: var(--primary);
  transform: scale(1.1);
}

.rp-event-check.done {
  border-color: var(--success);
  background: var(--success);
  box-shadow: 0 4px 12px rgba(63, 174, 135, 0.35);
}

.rp-ev-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.rp-ev-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.35;
}

.rp-ev-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-soft);
  flex-wrap: wrap;
}

.rp-ev-meta span {
  display: inline-flex;
  align-items: center;
}

.rp-ev-tag-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-soft);
  max-width: 90px;
  text-align: right;
}

.rp-ev-tag-color {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rp-ev-tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rp-ev-tag.inline {
  width: 18px;
  height: 18px;
  font-size: 10px;
  border-radius: 5px;
}

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

.rp-empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.rp-empty-hint {
  font-size: 11px;
  margin-top: 4px;
  color: var(--text-light);
}

/* 详情模式 */
.rp-detail-mode {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rp-detail-head {
  margin-bottom: -8px;
}

.rp-detail-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  word-break: break-word;
  line-height: 1.35;
}

.rp-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
}

.rp-detail-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rp-desc {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}

.rp-actions {
  display: flex;
  gap: 8px;
}

.rp-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.rp-btn:hover {
  background: var(--primary-light);
}

.rp-btn.danger {
  background: #fee2e2;
  color: var(--danger);
}

.rp-btn.danger:hover { background: #fecaca; }

/* Undo FAB */
.undo-fab {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3a2e26 0%, #2f251d 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(60, 40, 20, 0.35);
  cursor: pointer;
  z-index: 55;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform .2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow .2s;
}

.undo-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(60, 40, 20, 0.45);
}

.undo-fab:active {
  transform: scale(0.95);
}

.fab-enter-active, .fab-leave-active {
  transition: transform .3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity .25s;
}

.fab-enter-from, .fab-leave-to {
  opacity: 0;
  transform: scale(0.5);
}

/* ============================================
   模态框
   ============================================ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(80, 50, 20, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  position: relative;
  z-index: 101;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.modal.small {
  max-width: 380px;
}

.modal.fullscreen {
  max-width: 100%;
  max-height: 65vh;
  max-height: 65dvh;
  height: auto;
  border-radius: 20px 20px 0 0;
  border: none;
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 40px rgba(80, 50, 20, 0.2);
}

.modal.editor-sheet .modal-body {
  min-height: 0;
}

.modal-header {
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  padding: 0 8px;
}

.modal-header button {
  font-size: 14px;
  color: var(--text-soft);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-header button:hover {
  background: var(--surface-2);
}

.modal-header button.primary {
  color: var(--primary);
  font-weight: 600;
}

.modal-header button.danger {
  color: var(--danger);
  font-weight: 600;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.field-label {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.field-row .field-label {
  margin-right: 12px;
}

.date-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range-row input,
.date-range-row select {
  flex: 1;
  min-width: 0;
}

.date-range-row span {
  color: var(--text-light);
}

.recurrence-select {
  width: 100%;
  padding: 10px;
}

.lunar-fields {
  padding-left: 8px;
  border-left: 2px solid var(--primary-light);
}

.weekday-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.weekday-chip {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  transition: all .15s;
}

.weekday-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.weekday-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* 标签选择器 */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-chip:hover {
  background: var(--bg);
}

.tag-chip.active {
  border-width: 2px;
  border-style: solid;
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.tag-chip.add {
  border-style: dashed;
  color: var(--text-soft);
}

.tag-chip-icon { font-size: 12px; }

/* 编辑器内标签内联表单 */
.tag-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.tag-inline-form input {
  padding: 7px 10px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.tag-inline-form input:first-of-type {
  flex: 1 1 120px;
  min-width: 0;
}
.tag-inline-icon {
  width: 52px;
  flex: 0 0 52px;
  text-align: center;
}
.tag-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: flex-end;
}
.tag-inline-actions button {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}
.tag-inline-actions button.ghost {
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
}
.tag-inline-actions button.danger {
  color: var(--danger);
  background: transparent;
}
.tag-inline-actions button.primary {
  color: #fff;
  background: var(--primary);
  font-weight: 600;
}

.field-hint {
  font-size: 12px;
  color: var(--text-soft);
  margin: 4px 0 0;
}

.field-hint.danger {
  color: var(--danger);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* 颜色选择 */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.color-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px white inset;
}

/* 确认框 */
.confirm-dialog {
  text-align: center;
}

.confirm-dialog .modal-body {
  padding: 24px 16px;
}

.confirm-dialog p {
  margin: 0;
  font-size: 14px;
}

.confirm-actions {
  display: flex;
  border-top: 1px solid var(--border);
}

.confirm-actions button {
  flex: 1;
  padding: 14px;
  font-size: 14px;
  color: var(--text-soft);
}

.confirm-actions button.danger {
  color: var(--danger);
  font-weight: 600;
}

.confirm-actions button + button {
  border-left: 1px solid var(--border);
}

/* 顶部 toast */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #4b3a2e 0%, #2f251d 100%);
  color: #fff;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(60, 40, 20, 0.35);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toast-enter-active, .toast-leave-active {
  transition: opacity .25s, transform .25s;
}
.toast-enter-from, .toast-leave-to {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}

/* 提醒按钮 */
.reminder-btn {
  position: relative;
}

.reminder-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
}

/* 提醒中心下拉 */
.reminder-list-panel {
  position: absolute;
  top: 64px;
  right: 16px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 60;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow: hidden;
}

.rl-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  font-weight: 600;
}

.rl-header > span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rl-header button {
  color: var(--text-soft);
}

.rl-header button.text-btn {
  color: var(--primary);
  font-size: 13px;
  font-weight: normal;
}

.rl-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
}

.rl-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.rl-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background .15s;
}

.rl-item:hover {
  background: var(--bg);
}

.rl-tag {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.rl-text {
  flex: 1;
  min-width: 0;
}

.rl-title {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rl-meta {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
}

.rl-dismiss {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  color: var(--success);
}

.rl-dismiss:hover {
  background: #d1fae5;
}

.rl-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 13px;
}

.rl-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.rl-footer button {
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.rl-footer button:hover {
  background: var(--primary-light);
}

.rl-footer button.primary {
  background: var(--primary);
  color: white;
}

.rl-perm-warn {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}

.dropdown-enter-active, .dropdown-leave-active {
  transition: opacity .2s, transform .2s;
}
.dropdown-enter-from, .dropdown-leave-to {
  opacity: 0;
  transform: translateY(-8px);
}

/* 月份选择器 */
.month-picker {
  position: fixed;
  inset: 0;
  background: rgba(80, 50, 20, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 20px;
}

.month-picker-panel {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 300px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.month-picker-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}

.month-picker-year button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background .15s, color .15s;
}

.month-picker-year button:hover { background: var(--primary-soft); color: var(--primary); }

.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.month-picker-grid button {
  padding: 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all .15s;
}

.month-picker-grid button:hover { background: var(--primary-soft); border-color: var(--primary-light); }

.month-picker-grid button.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  font-weight: 600;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

/* 更多菜单 */
.more-menu {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.more-menu-panel {
  position: absolute;
  top: 60px;
  right: 16px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  min-width: 168px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.more-menu-panel button {
  padding: 13px 18px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.more-menu-panel button:last-child { border-bottom: none; }
.more-menu-panel button:hover { background: var(--primary-soft); color: var(--primary-deep); }
.more-menu-panel button.danger { color: var(--danger); }
.more-menu-panel button.danger:hover { background: #fdeceb; color: var(--danger); }

.menu-section-title {
  padding: 10px 18px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.menu-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}

.switch {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background .2s ease;
  padding: 0;
  flex-shrink: 0;
}

.switch.on {
  background: var(--primary);
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform .2s ease;
}

.switch.on .switch-knob {
  transform: translateX(20px);
}

/* ============================================
   悬浮快捷添加按钮
   ============================================ */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg), 0 4px 14px rgba(249, 115, 22, 0.35);
  cursor: pointer;
  z-index: 80;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.fab:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 6px 20px rgba(249, 115, 22, 0.45);
}

.fab:active {
  transform: translateY(0) scale(0.95);
}

/* 粘贴并识别：主 FAB 上方 */
.fab-clip {
  bottom: calc(82px + env(safe-area-inset-bottom));
  background: #6366f1;
  box-shadow: var(--shadow-lg), 0 4px 14px rgba(99, 102, 241, 0.35);
  font-size: 24px;
}
.fab-clip:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 6px 20px rgba(99, 102, 241, 0.45);
}

@media (max-width: 480px) {
  .fab {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: 50px;
    height: 50px;
  }
  .fab-clip {
    bottom: calc(74px + env(safe-area-inset-bottom));
  }
}

/* 剪贴板识别确认弹窗 */
.clip-card {
  max-width: 360px;
}
.clip-raw {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #475569;
  margin: 6px 0 14px;
  word-break: break-all;
  line-height: 1.5;
}
.clip-parsed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.clip-parsed > div {
  display: flex;
  align-items: center;
  font-size: 14px;
}
.clip-k {
  flex: 0 0 48px;
  color: #94a3b8;
}
.clip-v {
  font-weight: 600;
  color: #1e293b;
  margin-left: 8px;
}
.clip-actions {
  display: flex;
  gap: 10px;
}
.clip-actions .login-btn {
  flex: 1;
}

/* ============================================
   模态动画
   ============================================ */
.modal-enter-active, .modal-leave-active {
  transition: opacity .2s;
}

.modal-enter-active .modal,
.modal-leave-active .modal {
  transition: transform .25s ease;
}

.modal-enter-from, .modal-leave-to {
  opacity: 0;
}

.modal-enter-from .modal,
.modal-leave-to .modal {
  transform: scale(0.95) translateY(20px);
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
  .tag-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 25;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    flex: 0 0 280px;
  }

  .tag-sidebar.open {
    transform: translateX(0);
  }

  :root {
    --right-panel-w: 100%;
    --month-row-h: 108px;
  }

  .day-cell {
    padding: 2px 3px;
    animation: none; /* 滚动加载大量月份时避免入场动画造成掉帧 */
  }

  .day-num { font-size: 12px; min-width: 20px; min-height: 20px; }

  .day-lunar {
    font-size: 9px;
    max-width: 50%;
  }

  .day-event {
    padding: 1px 0;       /* 移动端同样顶满左右边缘，文字内边距由 .ev-text 提供 */
    font-size: 10px;
    gap: 1px;
  }

  .day-event .ev-icon,
  .day-event .ev-dot,
  .day-event .ev-bell {
    display: none;
  }

  .more-events { font-size: 9px; }

  .nav-btn { font-size: 14px; }

  .nav-title {
    font-size: 15px;
    max-width: 130px;
  }

  .nav-title-btn {
    padding: 6px 8px;
  }

  .view-switcher {
    margin-right: 6px;
  }

  .view-switcher button {
    padding: 5px 11px;
    font-size: 12px;
  }

  .header-right {
    gap: 2px;
  }

  .header-right .icon-btn:not(.icon-circle) {
    padding: 5px 5px;
    font-size: 11px;
  }

  .icon-btn.icon-circle {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .nav-title {
    font-size: 15px;
    max-width: none;
    min-width: 0;
  }

  .nav-title-btn {
    padding: 5px 6px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .view-switcher {
    margin-right: 4px;
  }

  .view-switcher button {
    padding: 5px 9px;
    font-size: 12px;
  }

  .app-header {
    padding: 0 10px;
    gap: 4px;
  }

  /* 移动端编辑器：底部半屏 sheet */
  .modal-mask.editor-mask {
    align-items: flex-end;
    padding: 0;
  }

  /* 移动端编辑器紧凑化 */
  .modal.fullscreen {
    font-size: 13px;
  }

  .modal.fullscreen .modal-header {
    flex-basis: 48px;
    padding: 0 12px;
  }

  .modal.fullscreen .modal-header h3 {
    font-size: 16px;
  }

  .modal.fullscreen .modal-header button {
    font-size: 13px;
    padding: 6px 10px;
  }

  .modal.fullscreen .modal-body {
    padding: 12px;
    gap: 12px;
  }

  .modal.fullscreen .field-label {
    font-size: 12px;
  }

  .modal.fullscreen input,
  .modal.fullscreen textarea,
  .modal.fullscreen select {
    padding: 8px 10px;
    font-size: 15px;
    border-radius: 8px;
  }

  .modal.fullscreen .date-range-row {
    gap: 6px;
  }

  .modal.fullscreen .date-range-row span {
    font-size: 12px;
    color: var(--text-soft);
  }

  .modal.fullscreen .date-range-row input[type="date"],
  .modal.fullscreen .date-range-row input[type="time"] {
    padding: 7px 5px;
    min-width: 0;
    text-align: center;
    font-size: 15px;
  }

  .modal.fullscreen .tag-chip {
    padding: 5px 9px;
    font-size: 12px;
    border-radius: 12px;
  }

  .modal.fullscreen .tag-chip-icon {
    font-size: 11px;
  }

  .modal.fullscreen .weekday-chip {
    width: 34px;
    height: 34px;
    font-size: 12px;
    border-radius: 8px;
  }

  .modal.fullscreen .field-hint {
    font-size: 11px;
  }

  .modal.fullscreen textarea {
    min-height: 80px;
  }
}

@media (max-width: 480px) {
  :root {
    --month-row-h: 110px;
  }

  .weekday-cell {
    font-size: 11px;
  }

  .day-event .ev-icon,
  .day-event .ev-dot,
  .day-event .ev-bell {
    display: none;
  }

  .day-event {
    font-size: 9px;
    padding: 1px 0;       /* 移动端同样顶满左右边缘 */
    gap: 1px;
    height: 11px;
    line-height: 11px;
  }

  .spanning-event {
    font-size: 9px;
    padding: 1px 0;       /* 移动端同样顶满左右边缘 */
    gap: 1px;
    height: 12px;
    line-height: 1;
    margin-top: 26px; /* 实际由 spanningMarginTop 行内样式覆盖；此处仅作回退 */
  }

  .day-num { font-size: 12px; min-width: 20px; min-height: 20px; }

  .day-lunar { font-size: 8px; max-width: 52%; }

  .app-header {
    padding: 0 8px;
    gap: 2px;
  }

  .nav-title {
    font-size: 14px;
    max-width: none;
    min-width: 0;
  }

  .nav-title-btn {
    padding: 5px 5px;
  }

  .view-switcher {
    margin-right: 2px;
  }

  .view-switcher button {
    padding: 5px 8px;
    font-size: 12px;
  }

  .header-right {
    gap: 1px;
  }

  .header-right .icon-btn:not(.icon-circle) {
    padding: 5px 4px;
    font-size: 11px;
  }

  .icon-btn.icon-circle {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }

  /* 月视图左右贴边，扩大显示区域 */
  .month-card {
    margin: 6px 0;
    border-radius: 0;
    box-shadow: none;
    border-left: none;
    border-right: none;
  }

  .month-card-header {
    padding: 8px 10px 6px;
  }

  /* 列表视图更紧凑 */
  .list-toolbar {
    padding: 8px 10px;
  }

  .list-scroll {
    padding: 2px 10px 16px;
  }

  .list-group {
    margin-bottom: 10px;
  }

  .list-group-header {
    padding: 8px 4px 4px;
    margin-bottom: 2px;
  }

  .list-item {
    padding: 8px 10px;
    gap: 8px;
    border-radius: var(--radius-sm);
  }

  .list-item-color {
    height: 32px;
  }

  .list-item-title {
    font-size: 14px;
  }

  .list-item-meta {
    gap: 5px;
    margin-top: 1px;
  }
}

/* 暗色模式（可选） */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211a14;
    --bg-grad-1: #241c15;
    --bg-grad-2: #1d1610;
    --surface: #2c231b;
    --surface-2: #352a20;
    --border: #3f3127;
    --border-strong: #50402f;
    --primary: #ff9d52;
    --primary-deep: #f97316;
    --primary-light: #5c3a22;
    --primary-bg: #3a2a1d;
    --primary-soft: #322519;
    --text: #f3e9df;
    --text-soft: #c3aea0;
    --text-light: #8a7768;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 6px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 18px 48px rgba(0,0,0,0.55);
    --shadow-glow: 0 8px 24px rgba(249, 115, 22, 0.4);
  }
  body::before { opacity: 0.6; }
  body::after { opacity: 0.25; }
  input, textarea, select { background: var(--surface-2); color: var(--text); border-color: var(--border); }
  .weekday-cell, .day-cell.other-month { color: var(--text-light); }
  .day-cell:hover { background: var(--primary-soft); }
  .day-event { color: #fff; }
  .tag-sidebar, .list-wrap, .modal, .right-panel, .reminder-list-panel, .more-menu-panel, .month-picker-panel {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  }
}

/* ============================================
   登录弹窗 / 账号区（移动端优先，主色橙 #FF8A3D）
   ============================================ */
.login-mask{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}
.login-card{width:100%;max-width:340px;background:#fff;border-radius:16px;padding:22px 20px;box-shadow:0 12px 40px rgba(0,0,0,.2)}
.login-title{font-size:18px;font-weight:700;color:#1f2937}
.login-sub{font-size:12px;color:#9ca3af;margin:4px 0 16px}
.login-input{width:100%;box-sizing:border-box;height:44px;border:1px solid #e5e7eb;border-radius:10px;padding:0 12px;font-size:15px;margin-bottom:10px;outline:none}
.login-input:focus{border-color:#FF8A3D}
.login-info{background:#ecfdf5;border:1px solid #a7f3d0;color:#047857;font-size:12px;border-radius:8px;padding:8px 10px;margin-bottom:10px;word-break:break-all}
.login-err{color:#ef4444;font-size:12px;margin-bottom:10px}
/* 忘记密码：联系管理员提示（沿用 login-info 绿色基调，略加强调） */
.invite-admin-tip{font-size:13px;font-weight:600;line-height:1.6;text-align:center}
.login-btn{width:100%;height:44px;border:none;border-radius:10px;background:#FF8A3D;color:#fff;font-size:15px;font-weight:600;margin-bottom:8px}
.login-btn:disabled{opacity:.6}
.login-btn.ghost{background:#f3f4f6;color:#4b5563}
.login-links{display:flex;justify-content:space-between;font-size:13px;color:#FF8A3D;margin-top:2px}
.login-links span{cursor:pointer}
.menu-account{padding:8px 12px}
.account-phone{font-size:13px;color:#4b5563;margin-bottom:8px}
.menu-account button{width:100%;height:36px;border:none;border-radius:8px;background:#FF8A3D;color:#fff;font-size:13px;margin-bottom:6px}

/* ============================================
   邀请码输入框 / 管理员邀请码面板（沿用登录弹窗橙白风格）
   ============================================ */
.login-code-input {
  letter-spacing: 6px;
  text-transform: uppercase;
  font-weight: 600;
  text-align: center;
}

.invite-admin-card {
  max-width: 470px;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 生成区 */
.invite-gen {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f0e6db;
}
.invite-gen-label {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 8px;
}
.invite-count-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.invite-count-row > span {
  font-size: 13px;
  color: #4b5563;
  flex: 0 0 auto;
}
.invite-count-input {
  width: 84px !important;
  height: 38px !important;
  margin-bottom: 0 !important;
  text-align: center;
  -moz-appearance: textfield;
}
.invite-count-input::-webkit-outer-spin-button,
.invite-count-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* 生成结果 */
.invite-result {
  margin-bottom: 14px;
  padding: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
}
.invite-result-title {
  font-size: 12px;
  color: #9a3412;
  margin-bottom: 8px;
  font-weight: 600;
}
.invite-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.invite-code-chip {
  font-family: "Sora", monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #fff;
  background: #FF8A3D;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  transition: transform .12s, filter .15s;
  box-shadow: 0 4px 12px rgba(255, 138, 61, 0.3);
}
.invite-code-chip:hover { filter: brightness(1.05); }
.invite-code-chip:active { transform: scale(0.96); }

/* 列表区 */
.invite-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.invite-list-title {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}
.invite-refresh {
  font-size: 12px;
  color: #FF8A3D;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 5px 12px;
  transition: background .15s;
}
.invite-refresh:hover { background: #ffedd5; }
.invite-refresh:disabled { opacity: .6; }

.invite-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #f0e6db;
  border-radius: 10px;
  margin-bottom: 14px;
}
.invite-empty {
  text-align: center;
  padding: 26px 16px;
  color: #9ca3af;
  font-size: 13px;
}
.invite-table {
  min-width: 500px;
}
.invite-tr {
  display: grid;
  grid-template-columns: 64px minmax(60px, 1fr) 50px 70px 96px 96px;
  gap: 6px;
  padding: 9px 10px;
  font-size: 11px;
  color: #4b5563;
  border-bottom: 1px solid #f3ede4;
  align-items: center;
}
.invite-tr:last-child { border-bottom: none; }
.invite-th {
  background: #fff7ed;
  color: #9a3412;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}
.invite-code {
  font-family: "Sora", monospace;
  font-weight: 700;
  color: #4b5563;
  letter-spacing: 1px;
}
.invite-note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-status {
  font-weight: 600;
}
.invite-status.used { color: #9ca3af; }
.invite-status.unused { color: #16a34a; }

/* ============================================
   编辑页：行列表单 + 底部选择面板
   ============================================ */
.editor-list {
  background: #fff;
  border-radius: 12px;
  margin: 12px 0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  flex-shrink: 0;
  min-height: min-content;
}
.editor-list-item {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s ease;
}
.editor-list-item:last-child { border-bottom: none; }
.editor-list-item:active { background: #f9fafb; }
.editor-list-icon {
  width: 22px;
  text-align: center;
  font-size: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}
.editor-list-label {
  flex: 1;
  font-size: 14px;
  color: #374151;
}
.editor-list-value {
  font-size: 13px;
  color: #9ca3af;
  margin-right: 6px;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-list-value.active { color: var(--primary, #f97316); }
.editor-list-arrow {
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
}
.editor-list-clear {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.editor-list-clear:active { background: #d1d5db; }
.editor-list-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary, #f97316);
  cursor: pointer;
}

/* Toggle switch（全天开关） */
.toggle-switch {
  display: inline-block;
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: #e5e7eb;
  position: relative;
  cursor: pointer;
  transition: background .2s ease;
  flex-shrink: 0;
}
.toggle-switch.active {
  background: var(--primary, #f97316);
}
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform .2s ease;
}
.toggle-switch.active .toggle-knob {
  transform: translateX(18px);
}

/* 日期范围在行内的紧凑样式 */
.date-range-inline {
  display: flex;
  align-items: center;
  gap: 4px;
}
.date-range-inline input[type="date"] {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--primary, #f97316);
  padding: 0;
  width: auto;
  min-width: 0;
  text-align: right;
}
.date-range-inline span {
  color: #9ca3af;
  font-size: 12px;
}

.editor-permission-hint {
  margin: -4px 4px 12px;
  font-size: 12px;
}

/* 底部选择面板 */
.action-sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 110;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.action-sheet {
  position: relative;
  z-index: 111;
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.action-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}
.action-sheet-header button {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 14px;
  cursor: pointer;
}
.action-sheet-body {
  overflow-y: auto;
  padding: 4px 0;
}
.action-sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 16px;
  color: #374151;
  cursor: pointer;
  transition: background .12s ease;
}
.action-sheet-item:active { background: #f9fafb; }
.action-sheet-item.active { color: var(--primary, #f97316); }
.action-sheet-check {
  font-weight: 700;
  font-size: 18px;
}
.action-sheet-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid #f3f4f6;
}
.action-sheet-footer button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  font-size: 16px;
  border: none;
}

/* 时间选择器 */
.time-picker-body {
  padding: 24px 16px;
  display: flex;
  justify-content: center;
}
.time-picker-input {
  font-size: 48px;
  font-weight: 300;
  color: var(--primary, #f97316);
  border: none;
  background: transparent;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.time-picker-input::-webkit-calendar-picker-indicator {
  filter: invert(0.4);
  cursor: pointer;
  width: 28px;
  height: 28px;
}

/* 底部滑入动画 */
.sheet-up-enter-active, .sheet-up-leave-active {
  transition: transform .25s ease, opacity .25s ease;
}
.sheet-up-enter-from, .sheet-up-leave-to {
  transform: translateY(100%);
  opacity: 0;
}
.sheet-up-enter-to, .sheet-up-leave-from {
  transform: translateY(0);
  opacity: 1;
}
