/* Liz 规划助手 · 手帐风样式（v1.2.0）
 * 奶油纸张 + 淡粉胶带 + 碎冰蓝水彩 + 少量花卉手绘。
 * 所有装饰均为本地 CSS/SVG，pointer-events:none，不遮挡文字与按钮。
 */
:root {
  color-scheme: light;
  --paper: #f6f0e5;
  --card: #fcf9f3;
  --line: #e6ddcc;
  --line-soft: #eee6d8;
  --ink: #2f3140;
  --ink-2: #66636f;
  --ink-3: #a19b9c;
  --blue: #4a6f9f;         /* 文字链接色 */
  --blue-mid: #7c9dcb;
  --blue-sel: #6f93c4;     /* 选中日期 */
  --blue-soft: #e2eaf5;
  --pink: #b9566e;
  --pink-mid: #e3a0ad;
  --pink-btn: #de8696;
  --tape: rgba(240, 186, 196, .62);
  --warn: #a5482c;
  --warn-soft: #fbece4;
  --danger: #b4403a;
  --check: #5d6f8c;        /* 勾选完成色：中性墨蓝，与分类颜色无关 */
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "STSongti-SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --hand: "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif CJK SC", serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .46 0 0 0 0 .39 0 0 0 0 .29 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --shadow: 0 1px 1px rgba(110, 90, 60, .06), 0 4px 14px rgba(110, 90, 60, .07);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(40% 30% at 0% 35%, rgba(190, 210, 234, .35), transparent 70%),
    radial-gradient(35% 25% at 100% 80%, rgba(243, 207, 213, .3), transparent 70%),
    var(--grain);
  background-attachment: fixed, fixed, scroll;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue-mid); outline-offset: 2px; }
.deco { position: absolute; pointer-events: none; z-index: 0; }

.app {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 36px);
  overflow-x: hidden;
}

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 10px) 18px 0; }
.brand { display: inline-flex; align-items: center; gap: 6px; font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.brand-leaf { width: 26px; height: 26px; }
.gear { width: 44px; height: 44px; margin-right: -8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.gear svg { width: 25px; height: 25px; }
.gear:active { background: rgba(120, 100, 70, .08); }

.notice {
  position: relative; z-index: 2; margin: 8px 18px; padding: 12px 14px; border-radius: 6px;
  background: var(--warn-soft); border: 1px solid #efcdbf; color: var(--warn); font-size: 15px;
}
.notice button { color: var(--warn); text-decoration: underline; margin-left: 6px; font-size: 15px; }

/* ---------- 页面标题 ---------- */
.hero { position: relative; min-height: 78px; padding: 12px 22px 8px; }
.hero h1 {
  position: relative; z-index: 1; display: inline-block; margin: 0; padding-bottom: 6px;
  font-family: var(--serif); font-size: 40px; font-weight: 600; letter-spacing: 6px; line-height: 1.15;
}
.hero h1::after, .brush::after { /* 粉色笔刷下划线 */
  content: ""; position: absolute; left: -2px; right: -10px; bottom: 0; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(222, 134, 150, .8), rgba(222, 134, 150, .35) 80%, rgba(222, 134, 150, 0));
  transform: rotate(-1.5deg);
}
.hero .deco-branch { right: 10px; top: -8px; width: 92px; height: 92px; }
.hero .deco-fmn { right: 14px; top: -10px; width: 66px; height: 100px; }
.hero.plan::before {
  content: ""; position: absolute; left: 0; top: -6px; width: 170px; height: 100px; pointer-events: none;
  background: radial-gradient(60% 55% at 40% 50%, rgba(169, 196, 226, .5), rgba(169, 196, 226, 0) 70%);
}

/* ---------- 纸片、胶带 ---------- */
.paper { position: relative; background-color: var(--card); background-image: var(--grain); border-radius: 4px; box-shadow: var(--shadow); }
.tape {
  position: absolute; z-index: 2; pointer-events: none; width: 66px; height: 20px;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .28) 0 4px, rgba(255, 255, 255, 0) 4px 9px), var(--tape);
  clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 0, 88% 0, 92% 12%, 96% 0, 100% 10%, 100% 90%, 96% 100%, 92% 88%, 88% 100%, 12% 100%, 8% 90%, 4% 100%, 0 92%);
}
.tape.tl { left: -12px; top: -8px; transform: rotate(-32deg); }
.tape.tr { right: -14px; top: -6px; transform: rotate(28deg); }

/* ---------- 月历 ---------- */
.cal-card { margin: 4px 16px 20px; padding: 12px 8px 14px; }
.cal-head { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 2px 4px; }
.cal-head h2 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.cal-nav { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); border-radius: 50%; }
.cal-nav:active { background: rgba(120, 100, 70, .08); }
.cal-today-btn {
  position: absolute; z-index: 3; right: 10px; top: -14px; min-height: 30px; padding: 0 12px; border-radius: 15px;
  background: var(--blue-soft); color: var(--blue); font-size: 14px; font-weight: 500; box-shadow: 0 1px 3px rgba(80, 100, 140, .15);
}
.cal-week, .cal-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week span { text-align: center; font-size: 13px; color: var(--ink-2); padding: 6px 0 2px; font-family: var(--serif); }
.cal-cell {
  position: relative; height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 17px; font-variant-numeric: tabular-nums; color: var(--ink);
}
.cal-cell .num {
  position: relative; z-index: 1; width: 34px; height: 34px; margin-top: -4px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.cal-cell.today .num { color: var(--pink); font-weight: 700; box-shadow: inset 0 0 0 1.5px rgba(222, 134, 150, .6); }
.cal-cell.selected .num {
  color: #fff; font-weight: 600;
  background: radial-gradient(70% 70% at 40% 35%, #8fb0db, var(--blue-sel) 75%);
  box-shadow: 0 2px 6px rgba(90, 125, 175, .35);
}
.cal-cell.selected.today .num { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--pink-mid); }
.cal-cell .dots { position: absolute; z-index: 1; bottom: 2px; display: flex; gap: 3px; height: 6px; align-items: center; }
.cal-cell .dots i { width: 5px; height: 5px; border-radius: 50%; display: block; }
.cal-cell .dots b { font-size: 9px; line-height: 1; color: var(--ink-3); font-weight: 600; }
.cal-cell:active .num { opacity: .6; }
.cal-card .deco-branch { right: -10px; bottom: -14px; width: 46px; height: 46px; transform: scaleX(-1) rotate(180deg); }

/* ---------- 过去未完成 ---------- */
.overdue-card { margin: -4px 16px 20px; padding: 12px 10px 4px; background-color: var(--warn-soft); }
.overdue-card h3 { margin: 0 4px 2px; font-size: 16px; font-weight: 600; color: var(--warn); display: flex; justify-content: space-between; }
.overdue-card h3 small { font-weight: 400; }
.overdue-card p { margin: 0 4px 8px; font-size: 13px; color: #9a5a44; }
.overdue-card .rows { margin: 0; }
.overdue-banner {
  display: flex; width: calc(100% - 32px); justify-content: space-between; align-items: center; gap: 8px;
  margin: -4px 16px 18px; padding: 11px 14px; border-radius: 4px; text-align: left;
  background: var(--warn-soft); color: var(--warn); font-size: 15px; box-shadow: var(--shadow);
}

/* ---------- 选中日期标题 ---------- */
.day-title { position: relative; display: flex; align-items: center; gap: 8px; margin: 0 20px 12px; min-height: 40px; }
.day-title h2 { position: relative; margin: 0; padding-bottom: 5px; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 1px; white-space: nowrap; }
.day-title h2::after { content: ""; position: absolute; left: -4px; right: -8px; bottom: 0; height: 4px; border-radius: 3px; background: linear-gradient(90deg, rgba(222, 134, 150, .7), rgba(222, 134, 150, .15)); }
.day-title .rel { flex: none; font-size: 13px; color: var(--pink); background: rgba(243, 207, 213, .55); padding: 1px 8px; border-radius: 10px; }
.day-title .deco-branch { right: -6px; top: -16px; width: 52px; height: 52px; }

/* ---------- 事项卡片 ---------- */
.rows { display: flex; flex-direction: column; gap: 10px; margin: 0 16px 12px; }
.item {
  position: relative; display: flex; align-items: stretch;
  background-color: var(--card); background-image: var(--grain); border-radius: 4px 8px 8px 4px; box-shadow: var(--shadow);
  border-left: 5px solid var(--cat, #b4aca2);
}
.cb { flex: none; width: 52px; display: flex; align-items: flex-start; justify-content: center; padding-top: 16px; min-height: 56px; }
.cb .box {
  width: 25px; height: 25px; border-radius: 4px; border: 1.6px solid #8b8d99; background: rgba(255, 255, 255, .55);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.cb .box svg { width: 16px; height: 16px; opacity: 0; }
.item.done .cb .box { background: var(--check); border-color: var(--check); }
.item.done .cb .box svg { opacity: 1; }
.item-main { flex: 1; min-width: 0; text-align: left; padding: 12px 4px 12px 0; display: flex; flex-direction: column; gap: 4px; }
.item-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.item-title b { font-weight: 600; font-size: 17px; word-break: break-word; overflow-wrap: anywhere; }
.badge {
  flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px;
  font-size: 13px; font-weight: 500; white-space: nowrap; max-width: 9em; overflow: hidden; text-overflow: ellipsis;
  color: var(--cat-ink, #6f6a63); background: var(--cat-bg, rgba(180, 172, 162, .18));
}
.tag-cross { flex: none; font-size: 12px; padding: 1px 7px; border-radius: 10px; color: var(--blue); background: var(--blue-soft); white-space: nowrap; }
.tag-late { flex: none; font-size: 12px; padding: 1px 7px; border-radius: 10px; color: var(--warn); background: var(--warn-soft); white-space: nowrap; }
.meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; color: var(--ink-2); }
.meta svg { width: 16px; height: 16px; color: var(--ink-2); }
.meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meta.wrap span { white-space: normal; overflow-wrap: anywhere; }
.item-side { flex: none; display: flex; align-items: center; }
.item-act { min-width: 62px; height: 100%; min-height: 44px; padding: 0 12px 0 6px; color: var(--blue); font-size: 15px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.item-act svg { width: 15px; height: 15px; }
.item-state { padding: 0 12px; color: var(--ink-3); font-size: 14px; white-space: nowrap; }
.item.done .item-title b { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(120, 115, 120, .6); }
.item.done .meta, .item.done .meta svg { color: var(--ink-3); }
.item.done .badge { opacity: .75; }

.done-divider { display: flex; align-items: center; gap: 10px; margin: 4px 22px 10px; color: var(--ink-3); font-size: 13px; }
.done-divider::before, .done-divider::after { content: ""; flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--line) 0 5px, transparent 5px 9px); }
.empty-note { position: relative; margin: 0 16px 12px; padding: 20px 16px; text-align: center; color: var(--ink-2); font-size: 15px; }
.empty-note strong { display: block; color: var(--ink); font-weight: 500; font-size: 16px; margin-bottom: 2px; }

/* ---------- 计划页 ---------- */
.seg {
  position: relative; z-index: 1; display: flex; gap: 4px; padding: 5px; border-radius: 26px;
  background-color: var(--card); background-image: var(--grain); box-shadow: inset 0 0 0 1px var(--line-soft), 0 3px 10px rgba(110, 90, 60, .06);
}
.seg button { flex: 1; min-height: 44px; padding: 0 6px; border-radius: 22px; font-size: 16px; color: var(--ink-2); letter-spacing: 1px; }
.seg button.on, .seg button[aria-checked="true"] { color: #3f5f8a; font-weight: 600; background: radial-gradient(80% 120% at 40% 40%, rgba(185, 207, 233, .95), rgba(201, 217, 236, .75)); }
.plan-seg { margin: 4px 16px 22px; }
.plan-seg .n { font-size: 13px; font-weight: 400; margin-left: 4px; opacity: .8; }
.notebook { position: relative; margin: 0 16px 18px; padding: 10px 6px 6px 30px; background-color: #fdfbf6; background-image: var(--grain); border-radius: 4px; box-shadow: var(--shadow); }
.notebook::before {
  content: ""; position: absolute; left: 9px; top: 14px; bottom: 14px; width: 12px; pointer-events: none;
  background: radial-gradient(circle at 6px 6px, #e9e2d4 4.2px, rgba(0, 0, 0, 0) 4.8px) 0 0 / 12px 46px repeat-y;
}
.notebook .tape { left: 18px; top: -10px; transform: rotate(-18deg); }
.notebook .rows { margin: 4px 0 8px; gap: 8px; }
.notebook .item { box-shadow: 0 1px 1px rgba(110, 90, 60, .05), 0 2px 6px rgba(110, 90, 60, .05); }
.notebook .empty-note { margin: 0; }
.cal-btn { min-width: 56px; min-height: 44px; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--blue-mid); }
.cal-btn svg { width: 26px; height: 26px; }
.done-toggle { display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 4px; color: var(--ink-2); font-size: 15px; }
.done-toggle svg { width: 16px; height: 16px; transition: transform .15s; }
.done-toggle.open svg { transform: rotate(90deg); }
.hand-note { position: relative; margin: 4px 0 0; padding: 22px 18px 10px 0; text-align: right; font-family: var(--hand); font-size: 17px; color: #6f86a8; letter-spacing: 1px; }
.hand-note svg { position: absolute; right: 16px; top: -4px; width: 16px; height: 28px; color: #6f86a8; }
.plan-foot { position: relative; height: 90px; margin: 0 16px; }
.plan-foot::before {
  content: ""; position: absolute; inset: 10px 0 0 0; pointer-events: none; border-radius: 3px;
  background: linear-gradient(rgba(150, 170, 200, .16) 1px, transparent 1px) 0 0 / 18px 18px, linear-gradient(90deg, rgba(150, 170, 200, .16) 1px, transparent 1px) 0 0 / 18px 18px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 35%); mask-image: linear-gradient(180deg, transparent, #000 35%);
}
.plan-foot .deco-flowers { left: 6px; top: -12px; width: 56px; height: 66px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; align-items: center; justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 calc(50% - 300px) var(--safe-b);
  background-color: rgba(250, 246, 238, .97); background-image: var(--grain); box-shadow: 0 -1px 0 var(--line-soft), 0 -6px 18px rgba(110, 90, 60, .05);
}
.tab { position: relative; flex: 1; max-width: 160px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-2); font-size: 13px; }
.tab svg { width: 27px; height: 27px; }
body[data-page="schedule"] .tab-schedule { color: var(--pink); }
body[data-page="plan"] .tab-plan { color: var(--blue); }
.tab[aria-current="page"]::after { content: ""; position: absolute; bottom: 6px; width: 26px; height: 3px; border-radius: 2px; background: currentColor; opacity: .7; }
.fab {
  flex: none; position: relative; top: -14px; width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: radial-gradient(65% 65% at 40% 35%, #f0aebb, #de8a9c 70%, #d77f93);
  box-shadow: 0 0 0 6px rgba(250, 246, 238, .97), 0 6px 16px rgba(200, 120, 140, .35);
}
body[data-page="plan"] .fab { background: radial-gradient(65% 65% at 40% 35%, #a9c3e6, #7f9fcd 70%, #7696c6); box-shadow: 0 0 0 6px rgba(250, 246, 238, .97), 0 6px 16px rgba(100, 130, 180, .35); }
.fab svg { width: 30px; height: 30px; }
.fab:active { transform: scale(.96); }

/* ---------- 弹出面板 ---------- */
.sheet-layer { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(60, 50, 40, .32); animation: fade .15s ease-out; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background-color: var(--card); background-image: var(--grain); border-radius: 14px 14px 0 0;
  padding: 22px 20px calc(18px + var(--safe-b)); animation: rise .2s ease-out;
}
.sheet::before {
  content: ""; position: absolute; left: 50%; top: -2px; width: 74px; height: 16px; margin-left: -37px; pointer-events: none;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .28) 0 4px, rgba(255, 255, 255, 0) 4px 9px), var(--tape);
  clip-path: polygon(0 0, 100% 0, 100% 80%, 94% 100%, 88% 82%, 82% 100%, 18% 100%, 12% 82%, 6% 100%, 0 80%);
}
.sheet.full { max-height: 96vh; max-height: 96dvh; padding-top: 0; }
.sheet.full::before { display: none; }
.sheet h2 { margin: 0 0 14px; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 1px; overflow-wrap: anywhere; }
.sheet h3 { margin: 14px 0 10px; font-size: 15px; color: var(--ink-2); font-weight: 600; }
.sheet p { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; }
.sheet .lead { color: var(--ink); font-size: 16px; overflow-wrap: anywhere; }
@keyframes rise { from { transform: translateY(24px); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 编辑页顶栏：取消 / 标题 / 保存 */
.sheet-bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 -20px 14px; padding: 12px 14px; background-color: #fcf9f3; border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 4px 10px rgba(110, 90, 60, .05);
}
.sheet-bar h2 { margin: 0; font-size: 19px; text-align: center; flex: 1; }
.bar-btn { min-width: 64px; min-height: 40px; padding: 0 8px; font-size: 16px; color: var(--ink-2); text-align: left; }
.bar-btn.save { text-align: center; color: #fff; font-weight: 600; border-radius: 20px; background: var(--pink-btn); }
.form-card { position: relative; z-index: 0; padding: 16px 14px 4px 34px; margin-bottom: 14px; background: #fdfbf7; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-soft); }
.form-card::before {
  content: ""; position: absolute; left: 10px; top: 14px; bottom: 14px; width: 12px; pointer-events: none;
  background: radial-gradient(circle at 6px 6px, #ebe4d6 4px, rgba(0, 0, 0, 0) 4.6px) 0 0 / 12px 34px repeat-y;
}

.field { display: block; margin-bottom: 16px; }
.field > .label { display: block; margin-bottom: 6px; font-size: 15px; color: var(--ink); font-weight: 600; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 15px; color: var(--ink); font-weight: 600; }
.opt { color: var(--ink-3); font-weight: 400; font-size: 14px; }
.input, .textarea {
  display: block; width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf9;
  font-size: 17px; /* ≥16px，避免 iPhone 输入时自动放大 */ -webkit-appearance: none; appearance: none;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--blue-mid); box-shadow: 0 0 0 3px var(--blue-soft); }
.input.bad { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.with-icon { position: relative; }
.with-icon svg { position: absolute; left: 12px; top: 50%; margin-top: -10px; width: 20px; height: 20px; color: var(--ink-2); pointer-events: none; }
.with-icon .input { padding-left: 40px; }

/* 时间安排 */
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 400; font-size: 15px; color: var(--ink-2); }
.switch { position: relative; width: 50px; height: 30px; border-radius: 15px; background: #ddd5c8; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.toggle[aria-checked="true"] .switch { background: var(--blue-sel); }
.toggle[aria-checked="true"] .switch::after { transform: translateX(20px); }
.time-box { border: 1px solid var(--line); border-radius: 10px; background: #fffdf9; overflow: hidden; }
.time-row { position: relative; padding: 8px 10px 10px; border-top: 1px solid var(--line-soft); }
.time-row:first-child { border-top: 0; }
.time-row > span { display: block; margin: 0 0 5px 2px; font-size: 13px; color: var(--ink-2); }
.time-row .inputs { display: flex; gap: 8px; min-width: 0; }
.time-row .input { min-height: 46px; padding: 8px 10px; border-color: var(--line-soft); }
.time-row .input[type="date"] { flex: 1.25; min-width: 0; }
.time-row .input[type="time"] { flex: 1; min-width: 0; }
.time-row .x { position: absolute; right: 4px; top: 0; min-width: 64px; min-height: 34px; color: var(--ink-3); font-size: 13px; text-align: right; padding-right: 8px; }
.add-end { width: 100%; min-height: 44px; padding: 0 12px; text-align: left; color: var(--blue); font-size: 15px; border-top: 1px solid var(--line-soft); }
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0 4px; }
.summary .chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 16px; background: var(--blue-soft); color: #3f5f8a; font-size: 14px; }
.summary .chip svg { width: 16px; height: 16px; }
.summary small { color: var(--ink-3); font-size: 13px; }
.error { color: var(--danger); font-size: 14px; margin: 6px 2px 10px; }

/* 分类选择 */
.cats { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px; border-radius: 8px;
  border: 1.5px solid var(--line); background: #fffdf9; font-size: 15px; max-width: 100%;
}
.cat-chip i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.cat-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-chip[aria-checked="true"] { border-color: var(--c, var(--ink-2)); background: var(--cbg, #f3efe8); font-weight: 600; }
.cat-chip[aria-checked="true"]::after { content: "✓"; font-size: 13px; color: var(--c, var(--ink-2)); }
.link-btn { min-height: 36px; color: var(--blue); font-size: 14px; font-weight: 500; }

.actions { display: flex; gap: 10px; margin-top: 6px; }
.btn { flex: 1; min-height: 50px; padding: 0 16px; border-radius: 10px; font-size: 17px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: #6d8fbf; color: #fff; }
.btn.pink { background: var(--pink-btn); color: #fff; }
.btn.secondary { background: var(--blue-soft); color: #3f5f8a; }
.btn.plain { background: #efe9dd; color: var(--ink); }
.btn.danger { background: #f8e4e1; color: var(--danger); }
.btn.block { width: 100%; flex: none; }
.btn svg { width: 18px; height: 18px; }
.more-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.more-actions .btn { font-size: 16px; min-height: 46px; flex: 1 1 40%; }

/* 详情 */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.detail-head h2 { margin: 0; width: 100%; }
.detail-list { margin: 0 0 6px; padding: 0; list-style: none; }
.detail-list li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--line); font-size: 16px; }
.detail-list li:first-child { border-top: 0; }
.detail-list svg { width: 20px; height: 20px; color: var(--ink-2); margin-top: 1px; }
.detail-list div { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-list small { display: block; color: var(--ink-3); font-size: 13px; }

/* 改期预览 */
.preview { padding: 12px 14px; border-radius: 8px; background: var(--blue-soft); color: #34507a; font-size: 15px; margin: 4px 0 14px; overflow-wrap: anywhere; }
.preview small { display: block; color: var(--ink-2); font-size: 13px; margin-bottom: 2px; }

/* 设置与分类管理 */
.menu { margin: 0 0 14px; border-radius: 10px; background: #fdfbf7; box-shadow: inset 0 0 0 1px var(--line-soft); overflow: hidden; }
.menu-row { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; text-align: left; font-size: 16px; border-top: 1px solid var(--line-soft); }
.menu-row:first-child { border-top: 0; }
.menu-row svg { width: 20px; height: 20px; color: var(--ink-2); }
.menu-row span { flex: 1; min-width: 0; }
.menu-row small { color: var(--ink-3); font-size: 14px; }
.cat-row { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 6px 0 14px; border-top: 1px solid var(--line-soft); }
.cat-row:first-child { border-top: 0; }
.cat-row i { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.cat-row b { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row small { color: var(--ink-3); font-size: 13px; flex: none; }
.cat-row button { min-width: 48px; min-height: 44px; font-size: 15px; color: var(--blue); }
.cat-row button.del { color: var(--danger); }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.swatch { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--line); background: #fffdf9; font-size: 14px; }
.swatch i { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.swatch[aria-checked="true"] { border-color: var(--ink-2); font-weight: 600; background: #f3efe8; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--paper); border-radius: 8px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 20px; font-weight: 600; }
.stat span { font-size: 13px; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.small-print { font-size: 13px !important; color: var(--ink-3) !important; line-height: 1.6; }
.restore-box { background: var(--paper); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.restore-box div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.restore-box span { color: var(--ink-2); flex: none; }
.restore-box b { font-weight: 500; text-align: right; word-break: break-all; }
.warn-text { color: var(--warn) !important; font-weight: 500; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 28px);
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 10px;
  background: #3a3640; color: #fff; font-size: 15px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.toast button { color: #f3c4ce; font-weight: 600; font-size: 15px; min-height: 32px; flex: none; }
.update-bar {
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 10px);
  padding: 10px 16px; border-radius: 22px; background: #6d8fbf; color: #fff; font-size: 15px; font-weight: 500; box-shadow: 0 4px 14px rgba(80, 110, 160, .3);
}
.noscript { padding: 24px; text-align: center; }

/* ---------- 窄屏 ---------- */
@media (max-width: 359px) {
  .hero h1 { font-size: 34px; }
  .cb { width: 46px; }
  .item-act { min-width: 54px; padding-right: 8px; }
  .time-row .input { padding: 8px 6px; font-size: 16px; }
  .swatches { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- iPad 及大屏 ---------- */
@media (min-width: 700px) {
  .sheet-layer { align-items: center; }
  .sheet { border-radius: 14px; padding-bottom: 22px; max-height: 88vh; }
  .sheet.full { max-height: 90vh; }
  .hero h1 { font-size: 46px; }
  .cal-cell { height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
