/* =========================================================
   手边 · 个人工作台
   视觉：新拟态（凸起 / 凹陷）+ 实心剪影图标 + 立体彩色图标
   主题：autumn 秋日晴空（默认） / retro 复古拼色
   ========================================================= */

:root, [data-theme="autumn"] {
  color-scheme: light;
  --bg: #e6edf8;
  --surface: #ecf2fb;
  --ink: #2b2a33;
  --soft: #687088;
  --shd: #c2cee3;
  --shl: #ffffff;
  --edge: rgba(255, 255, 255, .65);
  --a: #3f7fd9;
  --b: #e5483d;
  --c: #f0893c;
  --d: #a3a33a;
  --primary: #3f7fd9;
  --on-primary: #ffffff;
  --accent: #e5483d;
  --danger: #d9443a;
  --hero-bg: linear-gradient(160deg, #3a76d2 0%, #5f9be8 60%, #93c1f3 100%);
  --hero-ink: #ffffff;
}

[data-theme="retro"] {
  --bg: #faf0d9;
  --surface: #fff8e7;
  --ink: #3b2314;
  --soft: #7d5b43;
  --shd: #e4d2ab;
  --shl: #ffffff;
  --edge: rgba(255, 255, 255, .7);
  --a: #4A69B3;
  --b: #BA3801;
  --c: #EE7C01;
  --d: #9EA040;
  --primary: #BA3801;
  --on-primary: #fff8e7;
  --accent: #4A69B3;
  --danger: #930500;
  --butter: #FFEC89;
  --cornflower: #95BBEA;
  --hero-bg: #FFF8E7;
  --hero-ink: #3b2314;
}

/* ---------- 深色模式 ---------- */
[data-theme="autumn"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #1b2130;
  --surface: #20283a;
  --ink: #e7ecf6;
  --soft: #9aa6c0;
  --shd: #121722;
  --shl: #2b344b;
  --edge: rgba(255, 255, 255, .06);
  --a: #5b8fe0;
  --b: #e2574c;
  --c: #e9934a;
  --d: #b0b04a;
  --primary: #5b8fe0;
  --on-primary: #ffffff;
  --accent: #f06b5f;
  --danger: #f06b5f;
  --hero-bg: linear-gradient(160deg, #1f3f78 0%, #2e5ea8 60%, #4a7cc4 100%);
  --hero-ink: #ffffff;
}
[data-theme="retro"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #2a2119;
  --surface: #31271e;
  --ink: #f6ead3;
  --soft: #c4ab8f;
  --shd: #1b150f;
  --shl: #3d3126;
  --edge: rgba(255, 255, 255, .06);
  --a: #6c86cc;
  --b: #dd5f36;
  --c: #f0913a;
  --d: #aeb052;
  --primary: #dd5f36;
  --on-primary: #fff8e7;
  --accent: #8aa2e2;
  --danger: #f07a5a;
  --butter: #e3cf72;
  --hero-bg: #31271e;
  --hero-ink: #f6ead3;
}

:root {
  --font: system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-family: var(--font);
  font-size: 16px;
  --neu: 9px 9px 20px var(--shd), -9px -9px 20px var(--shl);
  --neu-sm: 4px 4px 10px var(--shd), -4px -4px 10px var(--shl);
  --neu-xs: 2px 2px 5px var(--shd), -2px -2px 5px var(--shl);
  --neu-in: inset 4px 4px 9px var(--shd), inset -4px -4px 9px var(--shl);
  --neu-in-sm: inset 2px 2px 5px var(--shd), inset -2px -2px 5px var(--shl);
  --a-hi: color-mix(in srgb, var(--a) 62%, #fff); --a-lo: color-mix(in srgb, var(--a) 78%, #000); --a-soft: color-mix(in srgb, var(--a) 16%, var(--surface));
  --b-hi: color-mix(in srgb, var(--b) 62%, #fff); --b-lo: color-mix(in srgb, var(--b) 78%, #000); --b-soft: color-mix(in srgb, var(--b) 16%, var(--surface));
  --c-hi: color-mix(in srgb, var(--c) 62%, #fff); --c-lo: color-mix(in srgb, var(--c) 78%, #000); --c-soft: color-mix(in srgb, var(--c) 18%, var(--surface));
  --d-hi: color-mix(in srgb, var(--d) 62%, #fff); --d-lo: color-mix(in srgb, var(--d) 78%, #000); --d-soft: color-mix(in srgb, var(--d) 18%, var(--surface));
  --raised: color-mix(in srgb, var(--surface) 70%, var(--shl));
  --line: color-mix(in srgb, var(--shd) 70%, transparent);
}

/* tone helpers：t = 主色，t-soft = 浅底，t-lo = 深色文字 */
.ta, .tone-a, .tile.sky, .tile:not(.violet):not(.gold):not(.peach):not(.pink) { --t: var(--a); --t-hi: var(--a-hi); --t-lo: var(--a-lo); --t-soft: var(--a-soft); }
.tb, .tone-b, .tile.peach, .tile.pink, .chip.peach, .chip.rose, .calendar-label.rose { --t: var(--b); --t-hi: var(--b-hi); --t-lo: var(--b-lo); --t-soft: var(--b-soft); }
.tc, .tone-c, .tile.gold, .chip.gold, .calendar-label.gold { --t: var(--c); --t-hi: var(--c-hi); --t-lo: var(--c-lo); --t-soft: var(--c-soft); }
.td, .tone-d, .tile.violet, .chip.violet, .calendar-label.violet { --t: var(--d); --t-hi: var(--d-hi); --t-lo: var(--d-lo); --t-soft: var(--d-soft); }
.tone-pink, .tone-peach { --t: var(--b); --t-lo: var(--b-lo); --t-soft: var(--b-soft); }
.tone-mint, .tone-sky { --t: var(--a); --t-lo: var(--a-lo); --t-soft: var(--a-soft); }
.tone-violet { --t: var(--d); --t-lo: var(--d-lo); --t-soft: var(--d-soft); }
.tone-butter { --t: var(--c); --t-lo: var(--c-lo); --t-soft: var(--c-soft); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; transition: background-color .3s; }
[data-theme="retro"] body {
  background-image: linear-gradient(rgba(149, 187, 234, .16) 50%, transparent 50%), linear-gradient(90deg, rgba(149, 187, 234, .16) 50%, transparent 50%);
  background-size: 44px 44px;
}
[data-theme="retro"][data-mode="dark"] body { background-image: linear-gradient(rgba(108, 134, 204, .07) 50%, transparent 50%), linear-gradient(90deg, rgba(108, 134, 204, .07) 50%, transparent 50%); }
[data-mode="dark"] dialog::backdrop { background: rgba(0, 0, 0, .5); }
[data-mode="dark"] .hero-btn { color: #23232b; }
[data-mode="dark"] .hero-btn span { background: #23232b; color: #fff; }
[data-mode="dark"] .day-badge.work { background: rgba(255, 255, 255, .08); }
[data-theme="retro"][data-mode="dark"] .hero { background-image: linear-gradient(rgba(108, 134, 204, .2) 50%, transparent 50%), linear-gradient(90deg, rgba(108, 134, 204, .2) 50%, transparent 50%); }
[data-theme="retro"][data-mode="dark"] .stat.tc, [data-theme="retro"][data-mode="dark"] .hero-title { color: #3b2314; }
[data-theme="retro"][data-mode="dark"] .stat.tc p, [data-theme="retro"][data-mode="dark"] .stat.tc strong small { color: #6b4a33; }

/* 文字大小与动态效果 */
html[data-text="large"] { font-size: 18px; }
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after { animation: none !important; transition: none !important; }
[data-motion="reduce"] .fx { display: none; }

.skip-link { position: fixed; z-index: 100; left: 12px; top: -60px; padding: 10px 16px; border: 0; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 900; transition: top .2s; }
.skip-link:focus { top: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
small { font-size: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.defs { position: absolute; width: 0; height: 0; }
[hidden] { display: none !important; }

/* icons */
svg { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.2em; }
.glyph { fill: currentColor; --cut-color: var(--cut, var(--surface)); }
.glyph .cut { fill: none; stroke: var(--cut-color); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.glyph .cutf { fill: var(--cut-color); }
.glyph .stroke { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.i3d { display: block; width: 100%; height: 100%; overflow: visible; }

/* mascot */
.mascot { display: block; width: 100%; height: 100%; overflow: visible; }
.mascot .m-ear { fill: #ffd8c6; stroke: #6b4a50; stroke-width: 2.6; stroke-linejoin: round; }
.mascot .m-ear-in { fill: #ffb3c4; }
.mascot .m-face { fill: #fffaf4; stroke: #6b4a50; stroke-width: 2.6; }
.mascot .m-eye { fill: #6b4a50; }
.mascot .m-shine { fill: #fff; }
.mascot .m-blush { fill: #ffaabd; opacity: .85; }
.mascot .m-mouth { fill: none; stroke: #6b4a50; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 左侧图标导航 ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 3; width: 100px; display: flex; flex-direction: column; align-items: center; gap: 13px; padding: max(20px, env(safe-area-inset-top)) 0 max(16px, env(safe-area-inset-bottom)); padding-left: env(safe-area-inset-left); overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.brand { display: block; flex: none; }
.brand-icon { display: block; width: 58px; height: 58px; padding: 9px 8px 6px; border-radius: 50%; background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--neu); transition: transform .25s; }
.brand:hover .brand-icon { transform: rotate(-8deg); }
#navigation { display: grid; gap: 12px; margin-top: 4px; }
.rail-bottom { margin-top: auto; display: grid; justify-items: center; gap: 12px; padding-top: 12px; }
.nav-item { position: relative; display: grid; place-items: center; width: 50px; height: 50px; flex: none; padding: 0; border-radius: 50%; border: 1px solid var(--edge); background: var(--surface); color: var(--soft); box-shadow: var(--neu-sm); --cut: var(--surface); transition: transform .2s, box-shadow .2s, color .2s, background-color .2s; }
.nav-item .glyph { width: 22px; height: 22px; }
.nav-item:hover { color: var(--ink); transform: translateY(-2px); }
.nav-item:active { box-shadow: var(--neu-in); transform: none; }
.nav-item[aria-current="page"] { background: var(--primary); color: var(--on-primary); --cut: var(--primary); border-color: transparent; box-shadow: var(--neu-sm), inset 0 -4px 8px rgba(0, 0, 0, .12); }
.nav-add { background: var(--ink); color: var(--bg); --cut: var(--ink); border-color: transparent; }
.nav-add:hover { color: var(--bg); }
.nav-label { position: absolute; left: 62px; top: 50%; padding: 6px 12px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: .78rem; font-weight: 800; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-6px, -50%); transition: .18s; }
.nav-item:hover .nav-label, .nav-item:focus-visible .nav-label { opacity: 1; transform: translate(0, -50%); }
.avatar { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--c-soft); border: 2px solid var(--surface); box-shadow: var(--neu-sm); font-size: 1.4rem; }
[data-theme="retro"] .nav-item[aria-current="page"] { box-shadow: var(--neu-sm), 3px 3px 0 rgba(59, 35, 20, .2); }

main { margin-left: 100px; padding: 28px clamp(18px, 3.4vw, 48px) 60px; max-width: 1680px; outline: none; position: relative; z-index: 1; }

/* ---------- 顶部 ---------- */
.topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: .86rem; }
.crumb, .date-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px 0 6px; border-radius: 999px; border: 1px solid var(--edge); background: var(--surface); box-shadow: var(--neu-sm); font-weight: 800; }
.crumb .glyph, .date-chip .glyph { box-sizing: content-box; width: 17px; height: 17px; padding: 6px; border-radius: 50%; }
.crumb .glyph { background: var(--ink); color: var(--bg); --cut: var(--ink); }
.date-chip .glyph { box-shadow: var(--neu-in-sm); color: var(--c); }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 18px; margin: 26px 0 24px; }
.page-head h1 { font: 900 clamp(1.9rem, 3.4vw, 2.75rem)/1.16 var(--font); letter-spacing: -.01em; }
.page-head h1 em { font-style: normal; color: var(--accent); }
.page-head p { margin-top: 8px; color: var(--soft); line-height: 1.5; font-size: .92rem; font-weight: 700; }
.page-head .hello { margin: 0 0 8px; font-size: 1rem; }

/* ---------- 按钮 ---------- */
.button, .icon-button, .tab, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 17px; border: 1px solid var(--edge); border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: var(--neu-sm); font-size: .87rem; font-weight: 800; white-space: nowrap; --cut: var(--surface); transition: transform .15s, box-shadow .15s, background-color .15s, color .15s; }
.button .glyph, .tab .glyph { width: 17px; height: 17px; }
.button:hover, .icon-button:hover, .tab:hover { transform: translateY(-1px); color: var(--primary); }
.button:active, .icon-button:active, .tab:active { box-shadow: var(--neu-in); transform: none; }
.button.primary { background: var(--primary); color: var(--on-primary); --cut: var(--primary); border-color: transparent; box-shadow: var(--neu-sm), inset 0 -3px 6px rgba(0, 0, 0, .12); }
.button.primary:hover { color: var(--on-primary); filter: brightness(1.05); }
.button.primary:active { box-shadow: var(--neu-in-sm), inset 0 2px 6px rgba(0, 0, 0, .2); }
.icon-button { width: 40px; padding: 0; border-radius: 50%; }
.icon-button .glyph { width: 18px; height: 18px; }
.text-button { min-height: 32px; padding: 0 10px; border-color: transparent; background: transparent; box-shadow: none; color: var(--primary); font-size: .84rem; }
.text-button:hover { box-shadow: var(--neu-in-sm); }
.text-button::after { content: "›"; font-size: 1.1rem; line-height: 1; margin-left: 1px; }
.button.danger { margin-right: auto; color: var(--danger); }
.button.danger-fill { background: var(--danger); color: #fff; --cut: var(--danger); border-color: transparent; }
.button.danger-fill:hover { color: #fff; filter: brightness(1.08); }
.button.habit-done { background: var(--primary); color: var(--on-primary); --cut: var(--primary); border-color: transparent; }
[data-theme="retro"] .button.primary, [data-theme="retro"] .button.danger-fill { box-shadow: var(--neu-sm), 3px 3px 0 rgba(59, 35, 20, .2); }

/* ---------- 卡片 ---------- */
.panel { position: relative; min-width: 0; overflow: hidden; border-radius: 30px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--neu); transition: transform .25s; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.panel-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.panel-title h2 { font: 900 1.12rem/1.35 var(--font); }
.tile { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--t-soft); color: var(--t-lo); --cut: var(--t-soft); box-shadow: var(--neu-xs); }
.tile .glyph { width: 19px; height: 19px; }
.subtle { color: var(--soft); font-size: .84rem; font-weight: 700; }
[data-theme="retro"] .panel:hover { transform: rotate(-.4deg) translateY(-2px); }

.progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.progress { flex: 1; height: 14px; padding: 3px; border-radius: 999px; box-shadow: var(--neu-in-sm); }
.progress span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--a-hi), var(--a)); transition: width .4s; }

/* rows */
.task-row, .event-row, .ledger-row, .account-row { display: flex; align-items: center; gap: 13px; min-height: 58px; }
.task-row + .task-row, .event-row + .event-row, .ledger-row + .ledger-row, .account-row + .account-row { border-top: 1.5px dashed var(--line); }
.task-row .row-body, .event-row .row-body, .ledger-row .row-body, .account-row .row-body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.row-body strong { display: block; font-size: .94rem; font-weight: 800; }
.row-body small { display: block; margin-top: 4px; color: var(--soft); font-weight: 700; }
.task-row.is-done .row-body strong { text-decoration: line-through; color: var(--soft); }
button.row-button { display: block; min-height: 46px; padding: 8px 8px; margin: 0 -8px; border: 0; border-radius: 16px; background: none; color: inherit; text-align: left; cursor: pointer; transition: box-shadow .15s; }
button.row-button:hover { box-shadow: var(--neu-in-sm); }
.check { display: grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--surface); color: transparent; box-shadow: var(--neu-in-sm); transition: .25s; }
.check svg { width: 16px; height: 16px; }
.check:hover { color: var(--soft); }
.check[aria-checked="true"] { background: var(--primary); color: var(--on-primary); box-shadow: var(--neu-xs); }
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 11px; border-radius: 999px; background: var(--a-soft); color: var(--a-lo); font-size: .74rem; font-weight: 800; white-space: nowrap; }
.chip.violet, .chip.gold, .chip.peach, .chip.rose { background: var(--t-soft); color: var(--t-lo); }
.event-date { width: 54px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 18px; border: 1px solid var(--edge); background: var(--a-soft); color: var(--a-lo); box-shadow: var(--neu-sm); font: 900 1rem var(--font); }
.event-row:nth-child(2n) .event-date { background: var(--b-soft); color: var(--b-lo); }
.event-row:nth-child(3n) .event-date { background: var(--d-soft); color: var(--d-lo); }
.event-number { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.event-number b { font: 900 1.55rem var(--font); color: var(--accent); }
.event-number small { color: var(--soft); font-weight: 700; }

/* toolbars & tabs */
.month-toolbar, .toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.month-toolbar strong { font: 900 1.08rem var(--font); }
.inline, .tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tabs { gap: 4px; padding: 5px; border-radius: 999px; box-shadow: var(--neu-in-sm); }
.tabs .tab { min-height: 34px; border-color: transparent; background: transparent; box-shadow: none; color: var(--soft); }
.tabs .tab:hover { transform: none; color: var(--ink); }
.tabs .tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); box-shadow: var(--neu-xs); }

/* month grids */
.journal-paper { border-radius: 20px; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.weekday { display: grid; place-items: center; min-height: 30px; font-size: .78rem; font-weight: 800; color: var(--soft); }
.weekday.weekend { color: var(--accent); }
.day { --photo-height: 58px; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 106px; padding: 7px; gap: 5px; border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); box-shadow: var(--neu-xs); text-align: left; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.day:not(:disabled):hover { box-shadow: var(--neu-in-sm); }
.day.today { box-shadow: var(--neu-xs), inset 0 0 0 2px var(--primary); }
.day.dim { background: transparent; box-shadow: none; border-style: dashed; border-color: var(--line); color: color-mix(in srgb, var(--soft) 50%, transparent); }
.day-num { min-width: 26px; text-align: center; font: 900 .92rem/26px var(--font); border-radius: 999px; }
.day.today .day-num { background: var(--primary); color: var(--on-primary); padding: 0 6px; }
.day p { font-size: .76rem; line-height: 1.35; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; max-width: 100%; }
.photo { display: block; width: auto; height: auto; max-width: 100%; max-height: var(--photo-height, 150px); flex: none; border-radius: 10px; object-fit: contain; }
.photo.sample { width: var(--photo-height, 150px); aspect-ratio: 1; background-image: url("./journal-photos.jpg"); background-size: 200% 200%; }
.photo.cafe { background-position: left top; }
.photo.alley { background-position: right top; }
.photo.cake { background-position: left bottom; }
.photo.sky { background-position: right bottom; }
img.photo[data-photo]:not([src]) { width: var(--photo-height, 120px); aspect-ratio: 1; box-shadow: var(--neu-in-sm); }
img.photo.missing { background: repeating-linear-gradient(45deg, var(--surface) 0 6px, var(--shd) 6px 12px); }

.calendar-day { min-width: 0; min-height: 96px; padding: 6px; border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); box-shadow: var(--neu-xs); }
.calendar-day.dim { background: transparent; box-shadow: none; border-style: dashed; border-color: var(--line); color: color-mix(in srgb, var(--soft) 50%, transparent); }
.calendar-day.today { box-shadow: var(--neu-xs), inset 0 0 0 2px var(--primary); }
.calendar-day .day-num { display: inline-block; }
.calendar-day.today .day-num { background: var(--primary); color: var(--on-primary); padding: 0 6px; }
.calendar-label { display: block; margin-top: 4px; padding: 3px 7px; border-radius: 9px; background: var(--a-soft); color: var(--a-lo); font-size: .74rem; font-weight: 800; overflow-wrap: anywhere; }
.calendar-label.violet, .calendar-label.gold, .calendar-label.rose { background: var(--t-soft); color: var(--t-lo); }
a.calendar-label:hover { filter: brightness(.96); }
.calendar-legend { margin-top: 16px; }
.calendar-more { font-size: .72rem; font-weight: 900; color: var(--soft); padding-left: 4px; }

/* ledger */
.chart-hero { border-radius: 22px; padding: 15px 17px 17px; box-shadow: var(--neu-in); }
.money-total { display: block; margin: 4px 0 10px; font: 900 clamp(1.6rem, 3vw, 2.1rem)/1.2 var(--font); letter-spacing: -.02em; overflow-wrap: anywhere; }
.budget-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; font-size: .8rem; font-weight: 700; color: var(--soft); }
.chart-hero .progress span { background: linear-gradient(90deg, var(--b-hi), var(--b)); }
.amount { white-space: nowrap; font: 900 1.02rem var(--font); }
.amount.income { color: var(--a-lo); }
.amount.expense { color: var(--b); }
.summary-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 4px 0 14px; }
.summary-pair > div { padding: 13px 15px; border-radius: 20px; background: var(--d-soft); box-shadow: var(--neu-xs); }
.summary-pair > div + div { background: var(--b-soft); }
.summary-pair strong { display: block; margin-top: 4px; font: 900 1.2rem var(--font); overflow-wrap: anywhere; }

.route-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
.route-grid > *, .stack > * { min-width: 0; }
.stack { display: grid; gap: 16px; }
.goal-card, .timeline-entry { padding: 16px 18px; border-radius: 22px; box-shadow: var(--neu-in-sm); }
.goal-card { display: grid; gap: 8px; justify-items: start; }
.goal-card .progress-wrap { width: 100%; margin: 2px 0 0; }
.goal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.goal-card h3, .timeline-entry h3 { font-size: 1rem; font-weight: 900; }
.timeline-entry p { line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline-entry .photos { margin: 10px 0; }
.photos { --photo-height: 150px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.photos .photo { max-width: min(100%, 200px); }
.goal-head .icon-button, .habit-card-head .icon-button { width: 34px; min-height: 34px; box-shadow: var(--neu-xs); color: var(--soft); }

.empty { display: flex; align-items: center; gap: 12px; padding: 16px 4px; color: var(--soft); font-size: .9rem; font-weight: 700; line-height: 1.5; }
.empty .mascot { width: 46px; height: 46px; flex: none; }

/* ---------- 今日页 ---------- */
.today-head { margin-bottom: 22px; }
.hello { color: var(--soft); font-weight: 800; }
.today-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; margin-bottom: 26px; }
.stat { position: relative; padding: 18px 20px; border-radius: 26px; border: 1px solid var(--edge); background: var(--t-soft); box-shadow: var(--neu-sm); --cut: var(--t-soft); }
.stat p { font-weight: 800; font-size: .88rem; color: var(--soft); }
.stat strong { display: block; margin-top: 14px; font: 500 2rem/1 var(--font); letter-spacing: -.02em; }
.stat strong small { margin-left: 3px; font-size: .45em; font-weight: 700; color: var(--soft); }
.stat > .glyph { position: absolute; top: 16px; right: 18px; width: 24px; height: 24px; color: var(--t-lo); }
[data-theme="retro"] .stat { background: var(--t); color: #fff; --cut: var(--t); box-shadow: var(--neu-sm), 5px 5px 0 rgba(59, 35, 20, .14); }
[data-theme="retro"] .stat p, [data-theme="retro"] .stat strong small { color: rgba(255, 255, 255, .85); }
[data-theme="retro"] .stat > .glyph { color: rgba(255, 255, 255, .92); }
[data-theme="retro"] .stat.tc { background: var(--butter); color: var(--ink); --cut: var(--butter); }
[data-theme="retro"] .stat.tc p, [data-theme="retro"] .stat.tc strong small { color: var(--soft); }
[data-theme="retro"] .stat.tc > .glyph { color: var(--b); }

.today-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 26px; align-items: start; }
.today-grid > * { min-width: 0; }
.today-grid > .span-full { grid-column: 1 / -1; }
.today-grid > .span-wide { grid-column: span 2; }
.today-grid > .today-head { margin: 4px 0 -6px; }
.today-grid > .today-stats { margin-bottom: 0; }
.today-grid > .today-english { margin-top: 0; }
.today-customize { display: flex; justify-content: center; margin: 26px 0 0; }

.hero { min-height: 290px; padding: 0; display: flex; background: var(--hero-bg); color: var(--hero-ink); }
.hero-art { position: absolute; inset: 0 auto 0 0; width: 62%; height: 100%; }
.hero-copy { position: relative; z-index: 1; margin-left: auto; width: min(56%, 330px); padding: 26px 26px 24px 8px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; }
.hero-date { display: flex; align-items: center; gap: 8px; font-weight: 800; opacity: .92; --cut: #5f9be8; }
.hero-title { font: 900 clamp(1.45rem, 2.3vw, 1.95rem)/1.25 var(--font); }
.hero-sub { font-size: .86rem; font-weight: 700; opacity: .88; line-height: 1.5; }
.hero-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 9px 10px 9px 20px; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 900; box-shadow: 0 8px 20px rgba(0, 0, 0, .14); transition: transform .2s; }
.hero-btn span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; }
.hero-btn .glyph { width: 16px; height: 16px; }
.hero-btn:hover { transform: translateY(-2px); }
[data-theme="autumn"] .hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .35), transparent 70%); }
[data-theme="retro"] .hero { background-image: linear-gradient(rgba(149, 187, 234, .45) 50%, transparent 50%), linear-gradient(90deg, rgba(149, 187, 234, .45) 50%, transparent 50%); background-size: 30px 30px; }
[data-theme="retro"] .hero-art { inset: 0 0 0 auto; width: 70%; }
[data-theme="retro"] .hero-copy { margin: 0 auto 0 0; width: min(58%, 330px); padding: 22px; --cut: var(--b); }
[data-theme="retro"] .hero-title { order: -1; padding: 14px 16px; border-radius: 16px; background: var(--butter); box-shadow: 4px 4px 0 rgba(59, 35, 20, .18); }
[data-theme="retro"] .hero-date, [data-theme="retro"] .hero-sub { padding: 10px 14px; border-radius: 14px; color: #fff; opacity: 1; box-shadow: 4px 4px 0 rgba(59, 35, 20, .18); }
[data-theme="retro"] .hero-date { background: var(--b); }
[data-theme="retro"] .hero-sub { background: var(--a); }

.quick { padding: 18px; }
.quick-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.quick-tiles .tile { width: auto; height: auto; display: grid; justify-items: center; gap: 8px; padding: 15px 4px 13px; border-radius: 24px; border: 1px solid var(--edge); background: var(--surface); color: var(--ink); box-shadow: var(--neu-sm); font-size: .86rem; font-weight: 800; transition: transform .2s, box-shadow .2s; }
.quick-tiles .ic { width: 52px; height: 52px; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.quick-tiles .tile:hover .ic { transform: translateY(-4px) rotate(-6deg) scale(1.06); }
.quick-tiles .tile:active { box-shadow: var(--neu-in); }
dialog .quick-tiles { margin-top: 4px; }

.life-section h2 { font: 900 1.12rem var(--font); margin: 2px 0 14px; }
.life-links, .media-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.life-link { display: flex; align-items: center; gap: 12px; padding: 15px; border-radius: 24px; border: 1px solid var(--edge); background: var(--surface); box-shadow: var(--neu-sm); transition: transform .2s; }
.life-link:hover { transform: translateY(-3px); }
.life-link strong, .life-link small { display: block; }
.life-link strong { font-size: .95rem; font-weight: 900; }
.life-link small { margin-top: 3px; color: var(--soft); font-weight: 700; }

.english-panel { max-width: 820px; }
.english-card { display: grid; gap: 16px; padding: clamp(18px, 3vw, 26px); border-radius: 22px; box-shadow: var(--neu-in); }
.english-line { font: 800 clamp(1.35rem, 3vw, 2.2rem)/1.35 Georgia, "Times New Roman", serif; }
.english-copy { display: grid; gap: 8px; font-weight: 700; }
/* 今日页顶部的每日一句：紧凑版 */
.panel.today-english { margin-top: 16px; padding: 12px 16px 14px; border-radius: 24px; box-shadow: var(--neu-sm); }
.today-english .panel-head { margin-bottom: 8px; }
.today-english .panel-title { gap: 8px; }
.today-english .panel-title h2 { font-size: .95rem; }
.today-english .tile { width: 30px; height: 30px; }
.today-english .tile .glyph { width: 15px; height: 15px; }
.today-english .text-button { min-height: 28px; font-size: .8rem; }
.today-english .english-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 10px 14px; border-radius: 16px; box-shadow: var(--neu-in-sm); }
.today-english .english-copy { gap: 4px; font-size: .84rem; }
.english-compact .english-line { font-size: clamp(1rem, 1.5vw, 1.15rem); }
.today-english .english-card .button { min-height: 32px; padding: 0 12px; font-size: .8rem; box-shadow: var(--neu-xs); }

/* notice */
.notices { display: grid; gap: 12px; margin: 18px 0 0; }
.notice { --t-soft: var(--c-soft); --t-lo: var(--c-lo); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 24px; border: 1px solid var(--edge); background: var(--t-soft); box-shadow: var(--neu-sm); }
.notice .icon-button { width: 34px; min-height: 34px; box-shadow: none; background: transparent; color: var(--soft); }
.notice p { flex: 1; min-width: 0; font-size: .88rem; font-weight: 800; line-height: 1.45; }
.notice-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; color: var(--t-lo); box-shadow: var(--neu-in-sm); --cut: var(--t-soft); }
.notice .glyph { width: 19px; height: 19px; }

/* ---------- 阶段 1 新增 ---------- */
.task-row.is-overdue .row-body small { color: var(--danger); font-weight: 800; }
.move-today { flex: none; }
.move-today::after { content: none; }
.goal-card.is-done h3 { color: var(--soft); display: flex; align-items: center; gap: 6px; }
.goal-card.is-done h3 .glyph { width: 16px; height: 16px; color: var(--primary); }
.goal-card .text-button { padding: 0; min-height: 26px; }
.goal-card .text-button::after { content: none; }

button.calendar-day { display: flex; flex-direction: column; align-items: stretch; gap: 3px; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: box-shadow .15s; }
button.calendar-day:hover { box-shadow: var(--neu-in-sm); }
.calendar-top, .day-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; }
.day-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 7px; font-size: .68rem; font-weight: 900; }
.day-badge.off { background: var(--b-soft); color: var(--b-lo); }
.day-badge.work { background: color-mix(in srgb, var(--soft) 16%, var(--surface)); color: var(--soft); }
.calendar-dots { display: flex; gap: 4px; margin-top: auto; padding-top: 2px; }
.calendar-dots i, .legend-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--t); }
.legend-dot { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 800; color: var(--soft); }
.calendar-day.predicted, .day.predicted { border: 1.5px dashed color-mix(in srgb, var(--b) 60%, transparent); }
.predicted-label { background: transparent !important; border: 1px dashed var(--b); }
.legend-predicted { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1.5px dashed var(--b); color: var(--b-lo); font-size: .74rem; font-weight: 800; }
.day-sheet { display: grid; gap: 14px; margin: 4px 0 18px; max-height: 46dvh; overflow-y: auto; }
.day-section h3 { margin-bottom: 6px; font-size: .86rem; font-weight: 900; color: var(--soft); }
.day-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.day-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 14px; box-shadow: var(--neu-in-sm); font-weight: 700; font-size: .9rem; }
.day-journal { padding: 10px 12px; border-radius: 14px; box-shadow: var(--neu-in-sm); line-height: 1.6; white-space: pre-wrap; }
.quick-tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.day-mood { font-size: .85rem; line-height: 1; }
.mood-chip { display: inline-flex; align-items: center; gap: 3px; padding: 4px 10px; border-radius: 999px; box-shadow: var(--neu-in-sm); font-size: .76rem; font-weight: 800; }
.search-field { position: relative; display: block; }
.search-field .glyph { position: absolute; left: 13px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--soft); }
.search-field input { width: min(240px, 100%); padding-left: 36px; }
.search-count { margin: -4px 0 12px; }
.photo-button { padding: 0; border: 0; background: none; border-radius: 10px; cursor: zoom-in; }
.viewer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 60px 16px; background: rgba(20, 20, 26, .86); touch-action: pan-y; }
.viewer-stage { display: grid; place-items: center; max-width: 100%; max-height: 100%; }
.viewer .photo { max-width: min(92vw, 1000px); max-height: 78dvh; border-radius: 16px; }
.viewer .photo.sample { width: min(80vw, 520px); }
.viewer-caption { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #fff; font-weight: 800; font-size: .86rem; }
.viewer-prev, .viewer-next, .viewer-close { position: absolute; }
.viewer-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 14px; top: 50%; transform: translateY(-50%); }
.viewer-close { top: max(14px, env(safe-area-inset-top)); right: 14px; }
.viewer .icon-button { background: rgba(255, 255, 255, .92); border-color: transparent; box-shadow: none; color: #222; }

.media-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 22px; }
[data-theme="retro"] .media-stats .stat { background: var(--t); color: #fff; --cut: var(--t); }
[data-theme="retro"] .media-stats .stat p, [data-theme="retro"] .media-stats .stat strong small { color: rgba(255, 255, 255, .85); }
[data-theme="retro"] .media-stats .stat > .glyph { color: rgba(255, 255, 255, .92); }
.reading-progress { margin: 8px 0 0; }

.english-panel .english-card .icon-button, .today-english .icon-button { width: 34px; min-height: 34px; box-shadow: var(--neu-xs); }

.ledger-toolbar .month-toolbar { margin-bottom: 0; }
.category-bars { display: grid; gap: 14px; }
.category-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: .9rem; }
.category-meta strong { font-weight: 800; }
.category-track { position: relative; height: 14px; padding: 3px; border-radius: 999px; box-shadow: var(--neu-in-sm); }
.category-fill { display: block; height: 100%; min-width: 4px; border-radius: 999px; background: var(--b); }
.budget-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink); opacity: .55; }
.category-note { display: block; margin-top: 4px; color: var(--soft); font-weight: 700; }
.category-row.is-over .category-note { color: var(--danger); font-weight: 900; }
.chart-legend { display: flex; gap: 16px; margin-bottom: 6px; font-size: .8rem; font-weight: 800; color: var(--soft); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 4px; }
.chart-legend i.trend-income { background: var(--a); }
.chart-legend i.trend-expense { background: var(--b); }
.trend-chart { display: block; width: 100%; height: auto; overflow: visible; }
.trend-chart path.trend-income { fill: var(--a); }
.trend-chart path.trend-expense { fill: var(--b); }
.trend-chart text { fill: var(--soft); font-size: 11px; font-weight: 700; }
.trend-group.is-current text { fill: var(--ink); font-weight: 900; }
.trend-axis { stroke: var(--line); stroke-width: 1.5; }
.trend-hit { fill: transparent; }
.trend-group:hover .trend-hit { fill: color-mix(in srgb, var(--shd) 35%, transparent); }

.habit-card-head h3 small { display: block; margin-top: 2px; font-size: .74rem; font-weight: 800; color: var(--soft); }
.habit-card.is-archived { opacity: .7; }
.week-dots { display: flex; gap: 6px; margin-top: 14px; }
.week-dots span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; box-shadow: var(--neu-in-sm); font-size: .7rem; font-weight: 800; color: var(--soft); }
.week-dots span.on { background: var(--tone); color: #fff; box-shadow: var(--neu-xs); }
.week-dots span.today { outline: 2px solid var(--tone); outline-offset: 1px; }
.pop { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 40% { transform: scale(1.14); } }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px; }
.icon-pick label, .swatch-pick label { position: relative; display: grid; justify-items: center; gap: 4px; cursor: pointer; font-weight: 700; }
.icon-pick input, .swatch-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick span { display: block; width: 52px; height: 52px; padding: 8px; border-radius: 18px; box-shadow: var(--neu-xs); transition: box-shadow .15s; }
.icon-pick input:checked + span { box-shadow: var(--neu-in-sm), inset 0 0 0 2px var(--primary); }
.icon-pick small { font-size: .72rem; color: var(--soft); }
.swatch-pick { display: flex; gap: 14px; }
.swatch-pick span { width: 36px; height: 36px; border-radius: 50%; background: var(--t); box-shadow: var(--neu-xs); }
.swatch-pick input:checked + span { outline: 3px solid var(--ink); outline-offset: 3px; }
.icon-pick input:focus-visible + span, .swatch-pick input:focus-visible + span { outline: 2.5px solid var(--primary); outline-offset: 3px; }

.tile-emoji { font-size: 1.15rem; line-height: 1; }
.category-icon { margin-right: 6px; }
.emoji-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.emoji-pick label { position: relative; display: block; cursor: pointer; }
.emoji-pick input { position: absolute; opacity: 0; pointer-events: none; }
.emoji-pick span { display: grid; place-items: center; height: 44px; border-radius: 14px; box-shadow: var(--neu-xs); font-size: 1.3rem; transition: box-shadow .15s; }
.emoji-pick input:checked + span { box-shadow: var(--neu-in-sm), inset 0 0 0 2px var(--primary); }
.emoji-pick input:focus-visible + span { outline: 2.5px solid var(--primary); outline-offset: 2px; }

.period-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.period-stats > div { display: grid; gap: 4px; padding: 12px; border-radius: 18px; box-shadow: var(--neu-in-sm); }
.period-stats strong { font: 900 1.25rem var(--font); }
.period-stats strong small { margin-left: 2px; font-size: .6em; color: var(--soft); }
.period-stats > div > small { color: var(--soft); font-weight: 700; }

/* ---------- 阶段 2 新增 ---------- */
.topline-end { display: inline-flex; align-items: center; gap: 10px; }
.search-big { margin: 4px 0 14px; }
.search-big input { width: 100%; padding-top: 13px; padding-bottom: 13px; font-size: 1rem; }
.search-results { display: grid; gap: 14px; max-height: 58dvh; overflow-y: auto; padding: 2px; }
.search-hint kbd { padding: 1px 7px; border-radius: 6px; box-shadow: var(--neu-xs); font: 800 .8rem var(--font); }
.search-group { display: grid; gap: 8px; }
.search-group h3 { font-size: .86rem; font-weight: 900; color: var(--soft); }
.search-group h3 small { margin-left: 4px; }
.search-hit { display: grid; gap: 3px; width: 100%; padding: 11px 14px; border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--neu-xs); transition: box-shadow .15s; }
.search-hit:hover, .search-hit:focus-visible { box-shadow: var(--neu-in-sm); }
.search-hit strong { font-weight: 800; }
.search-hit small { color: var(--soft); font-weight: 700; }
mark { padding: 0 2px; border-radius: 4px; background: color-mix(in srgb, var(--c) 40%, transparent); color: inherit; }
.pref-row { display: grid; gap: 8px; }
.pref-label { font-size: .86rem; font-weight: 900; color: var(--soft); }
.layout-list { display: grid; gap: 8px; margin: 4px 0 16px; padding: 0; list-style: none; }
.layout-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 16px; box-shadow: var(--neu-xs); }
.layout-row.is-hidden { opacity: .55; box-shadow: var(--neu-in-sm); }
.layout-move { display: flex; gap: 6px; }
.layout-move .icon-button { width: 34px; min-height: 34px; }
.layout-move .up svg, .layout-move .down svg { transform: rotate(90deg); }

/* ---------- 弹窗与表单 ---------- */
dialog { width: min(520px, calc(100% - 24px)); max-height: min(90dvh, 760px); overflow-x: hidden; padding: 24px; border: 1px solid var(--edge); border-radius: 30px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .35), var(--neu); }
dialog::backdrop { background: color-mix(in srgb, var(--ink) 30%, transparent); backdrop-filter: blur(3px); }
dialog h2 { font: 900 1.3rem var(--font); margin: 0; }
dialog form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; font-size: .88rem; font-weight: 800; }
label.toggle { display: flex; align-items: center; gap: 8px; }
fieldset { border: 0; border-radius: 18px; padding: 12px 14px 14px; box-shadow: var(--neu-in-sm); }
legend { padding: 0 6px; font-size: .85rem; font-weight: 800; }
input:not([type="checkbox"]), textarea, select { width: 100%; min-width: 0; padding: 11px 14px; border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--neu-in-sm); font-weight: 700; transition: box-shadow .15s; }
input:not([type="checkbox"]):focus, textarea:focus, select:focus { outline: none; box-shadow: var(--neu-in-sm), 0 0 0 2.5px var(--primary); }
input[type="file"] { padding: 9px 12px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 10px; margin-top: 6px; }
.dialog-copy { color: var(--soft); font-size: .9rem; font-weight: 700; line-height: 1.6; }
.dialog-copy.warn { padding: 11px 14px; border-radius: 16px; background: var(--b-soft); color: var(--b-lo); }
.import-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.import-summary li { display: flex; justify-content: space-between; padding: 9px 13px; border-radius: 14px; box-shadow: var(--neu-in-sm); font-size: .86rem; font-weight: 800; }
.welcome { display: grid; justify-items: center; gap: 10px; padding: 4px 0; text-align: center; }
.welcome-art { width: 92px; height: 92px; padding: 12px 10px 8px; border-radius: 50%; box-shadow: var(--neu); animation: bob 3.2s ease-in-out infinite; }
.welcome h2 { font-size: 1.5rem; }
.welcome-choices { display: grid; gap: 12px; width: 100%; margin-top: 8px; }
.choice { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--edge); border-radius: 22px; background: var(--surface); text-align: left; box-shadow: var(--neu-sm); transition: transform .15s, box-shadow .15s; }
.choice:hover { transform: translateY(-2px); }
.choice:active { box-shadow: var(--neu-in); }
.choice-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--t); color: #fff; --cut: var(--t); }
.choice strong, .choice small { display: block; }
.choice strong { font-size: 1rem; font-weight: 900; }
.choice small { margin-top: 3px; color: var(--soft); font-weight: 700; line-height: 1.4; }
@keyframes bob { 50% { transform: translateY(-6px); } }

.toast { position: fixed; z-index: 30; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 36px); padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: .9rem; font-weight: 800; opacity: 0; pointer-events: none; transform: translate(-50%, 12px) scale(.96); transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45); }
.toast::before { content: "✦"; color: var(--c); }
.toast.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.has-action { pointer-events: auto; }
.toast-undo { padding: 5px 13px; border: 0; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: .82rem; font-weight: 900; }

/* ---------- 观影阅读 ---------- */
.media-card { display: grid; grid-template-columns: clamp(70px, 9vw, 104px) minmax(0, 1fr); gap: 14px; align-items: start; padding: 15px; border-radius: 24px; box-shadow: var(--neu-in-sm); }
.media-card .toolbar { margin-bottom: 8px; }
.media-card h3 { margin-bottom: 6px; font-size: 1.02rem; font-weight: 900; }
.media-card p { margin-top: 8px; overflow-wrap: anywhere; line-height: 1.6; font-size: .9rem; }
.media-cover { position: relative; overflow: hidden; aspect-ratio: 2 / 3; display: grid; place-items: center; border-radius: 16px; background: var(--d-soft); color: var(--d-lo); --cut: var(--d-soft); box-shadow: var(--neu-sm); }
.media-cover svg { width: 28px; height: 28px; }
.media-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--surface); }
.cover-credit { display: inline-block; margin-top: 8px; font-size: .76rem; color: var(--soft); text-decoration: underline; }
.cover-field { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 12px; align-items: start; }
.cover-controls { min-width: 0; display: grid; gap: 8px; }
.cover-controls .text-button { font-size: .8rem; }
.cover-controls input[type="file"] { font-size: .83rem; }
.stars { color: var(--c); letter-spacing: .05em; }

/* ---------- 习惯打卡 ---------- */
.habit-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.habit-toolbar .month-toolbar { margin-bottom: 4px; }
.habit-tabs { display: flex; gap: 10px; }
.habit-tab { display: inline-flex; align-items: baseline; gap: 6px; min-height: 42px; padding: 9px 18px; border: 1px solid var(--edge); border-radius: 999px; background: var(--surface); color: var(--soft); box-shadow: var(--neu-sm); font-size: .95rem; font-weight: 900; transition: .2s; }
.habit-tab small { font-size: .76rem; font-weight: 800; }
.habit-tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }
.habit-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 24px; }
.habit-cards > .empty { grid-column: 1 / -1; }
.habit-card { --tone: var(--a); --tone-hi: var(--a-hi); --tone-soft: var(--a-soft); --tone-ink: var(--a-lo); min-width: 0; padding: 20px 22px 22px; border-radius: 30px; border: 1px solid var(--edge); background: var(--surface); box-shadow: var(--neu); }
.habit-card.tone-b { --tone: var(--b); --tone-hi: var(--b-hi); --tone-soft: var(--b-soft); --tone-ink: var(--b-lo); }
.habit-card.tone-c { --tone: var(--c); --tone-hi: var(--c-hi); --tone-soft: var(--c-soft); --tone-ink: var(--c-lo); }
.habit-card.tone-d { --tone: var(--d); --tone-hi: var(--d-hi); --tone-soft: var(--d-soft); --tone-ink: var(--d-lo); }
.habit-card-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; }
.habit-avatar { display: block; width: 46px; height: 46px; }
.habit-card-head h3 { font: 900 1.14rem var(--font); overflow-wrap: anywhere; }
.habit-last { padding: 6px 12px; border-radius: 999px; box-shadow: var(--neu-in-sm); color: var(--soft); font-size: .78rem; font-weight: 800; white-space: nowrap; }
.habit-card.is-done .habit-last { color: var(--tone-ink); }
.habit-card-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(12px, 3vw, 26px); margin-top: 16px; }
.habit-heatmap { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(4px, 1vw, 7px); max-width: 270px; }
.habit-cell { display: grid; place-items: center; aspect-ratio: 1; width: 100%; padding: 0; border: 0; border-radius: 9px; background: var(--surface); box-shadow: var(--neu-in-sm); color: var(--ink); font-size: .78rem; font-weight: 900; transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), background-color .15s; }
.habit-cell:not(:disabled):hover { transform: scale(1.12); }
.habit-cell:disabled { opacity: .45; }
.habit-cell.checked { background: linear-gradient(145deg, var(--tone-hi), var(--tone)); box-shadow: var(--neu-xs); color: #fff; }
.habit-cell.is-today { box-shadow: inset 0 0 0 2px var(--tone); }
.habit-cell.is-today.checked { box-shadow: var(--neu-xs); }
.habit-cell.habit-cell-blank { background: transparent; box-shadow: none; }
.habit-side { display: grid; justify-items: center; gap: 16px; min-width: 0; }
.habit-ring { display: grid; place-items: center; width: 118px; height: 118px; padding: 0; border: 1px solid var(--edge); border-radius: 50%; background: var(--surface); box-shadow: var(--neu); color: var(--tone); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.habit-ring::before { content: ""; grid-area: 1 / 1; width: 76px; height: 76px; border-radius: 50%; box-shadow: var(--neu-in); transition: .3s; }
.habit-ring > * { grid-area: 1 / 1; position: relative; }
.habit-ring b { font-size: 1.8rem; font-weight: 900; line-height: 1; }
.habit-ring svg { width: 30px; height: 30px; margin-top: -12px; }
.habit-ring small { margin-top: 34px; font-size: .68rem; font-weight: 900; }
.habit-ring:hover { transform: scale(1.04); }
.habit-ring:active { transform: scale(.94); }
.habit-ring[aria-pressed="true"] { color: #fff; }
.habit-ring[aria-pressed="true"]::before { background: linear-gradient(145deg, var(--tone-hi), var(--tone)); box-shadow: var(--neu-sm); }
.habit-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.habit-stat { display: grid; justify-items: center; gap: 3px; min-width: 0; padding: 11px 6px; border-radius: 18px; box-shadow: var(--neu-in-sm); }
.habit-stat p { display: flex; align-items: center; gap: 5px; }
.habit-stat p span { display: grid; color: var(--tone); }
.habit-stat svg { width: 18px; height: 18px; }
.habit-stat strong { font-size: 1.4rem; font-weight: 900; line-height: 1; }
.habit-stat small { color: var(--soft); font-size: .76rem; font-weight: 800; white-space: nowrap; }

/* period */
.period-day { min-height: 54px; }
.period-day.marked { background: var(--b-soft); color: var(--b-lo); }
.period-mark { margin-left: 3px; color: var(--b); --cut: var(--b-soft); }

/* ---------- 设置 ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 24px; align-items: start; }
.settings-grid .panel { display: grid; gap: 14px; }
.settings-grid .panel-head { margin-bottom: 0; }
.setting-copy { font-size: .92rem; font-weight: 700; line-height: 1.6; }
.setting-note { color: var(--soft); font-size: .8rem; font-weight: 700; line-height: 1.55; }
.file-button { cursor: pointer; }
.usage { display: grid; gap: 8px; }
.usage-row { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; font-weight: 800; }
.theme-options { display: grid; gap: 12px; }
.theme-option { display: grid; gap: 6px; padding: 15px 16px; border: 1px solid var(--edge); border-radius: 22px; background: var(--surface); text-align: left; box-shadow: var(--neu-sm); transition: box-shadow .2s, transform .2s; }
.theme-option:hover { transform: translateY(-2px); }
.theme-option.on { box-shadow: var(--neu-in), inset 0 0 0 2px var(--primary); transform: none; }
.theme-option strong { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 900; }
.theme-option small { color: var(--soft); font-weight: 700; line-height: 1.5; }
.theme-swatches { display: flex; gap: 6px; }
.theme-swatches i { width: 26px; height: 26px; border-radius: 10px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7), var(--neu-xs); }
.theme-check { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--on-primary); }
.theme-check svg { width: 13px; height: 13px; }

/* ---------- 锁屏 ---------- */
body.locked .sidebar, body.locked main { display: none; }
.lock { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; overflow-y: auto; background: var(--bg); }
.lock-card { display: grid; justify-items: center; gap: 10px; width: min(340px, 100%); padding: 28px 22px 18px; border-radius: 34px; border: 1px solid var(--edge); background: var(--surface); box-shadow: var(--neu); text-align: center; }
.lock-card.shake { animation: shake .4s; }
.lock-art { width: 84px; height: 84px; padding: 11px 10px 7px; border-radius: 50%; box-shadow: var(--neu-sm); animation: bob 3.2s ease-in-out infinite; }
.lock-card h2 { font-size: 1.4rem; font-weight: 900; }
.lock-copy { color: var(--soft); font-weight: 700; font-size: .9rem; line-height: 1.55; }
.pin-dots { display: flex; gap: 16px; margin-top: 6px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; box-shadow: var(--neu-in-sm); transition: background-color .15s, transform .15s; }
.pin-dots span.filled { background: var(--primary); box-shadow: var(--neu-xs); transform: scale(1.1); }
.pin-message { min-height: 1.3em; color: var(--danger); font-size: .84rem; font-weight: 800; }
.keypad { display: grid; grid-template-columns: repeat(3, 68px); gap: 14px 20px; }
.key { width: 68px; height: 68px; border: 1px solid var(--edge); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 1.55rem; font-weight: 800; box-shadow: var(--neu-sm); transition: transform .1s, box-shadow .1s; }
.key:active { box-shadow: var(--neu-in); }
.key-del { background: transparent; border-color: transparent; box-shadow: none; color: var(--soft); }
.key-del svg { width: 26px; height: 26px; }
.lock-forgot { margin-top: 4px; }
.lock-forgot::after { content: none; }
.lock-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- 特效 ---------- */
.fx { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.fx i { position: absolute; top: -40px; width: 22px; height: 12px; border-radius: 0 100% 0 100%; opacity: .8; animation: fall linear infinite; }
@keyframes fall { from { transform: translate(0, 0) scale(var(--s, 1)) rotate(0deg); } to { transform: translate(var(--dx), 112vh) scale(var(--s, 1)) rotate(var(--rot)); } }
.burst { position: fixed; z-index: 50; pointer-events: none; }
.burst i { position: absolute; left: 0; top: 0; border-radius: 0 100% 0 100%; animation: burst .8s ease-out forwards; }
[data-theme="retro"] .burst i { border-radius: 3px; }
@keyframes burst { to { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(.4); opacity: 0; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .today-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .today-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 760px) {
  .sidebar { width: 70px; gap: 9px; padding-top: max(12px, env(safe-area-inset-top)); }
  #navigation, .rail-bottom { gap: 9px; }
  .brand-icon { width: 48px; height: 48px; padding: 7px 6px 5px; }
  .nav-item, .avatar { width: 44px; height: 44px; }
  .nav-item .glyph { width: 20px; height: 20px; }
  .nav-label { display: none; }
  main { margin-left: 70px; padding: 14px 12px 40px 6px; padding-right: max(12px, env(safe-area-inset-right)); }
  .crumb, .date-chip { min-height: 36px; font-size: .78rem; }
  .page-head { align-items: start; margin: 18px 0 16px; }
  .page-head h1 { font-size: clamp(1.6rem, 7.4vw, 2.1rem); }
  .page-head p { margin-top: 6px; font-size: .82rem; }
  .today-stats, .today-grid > .today-stats { display: flex; gap: 14px; overflow-x: auto; padding: 4px 10px 14px; margin: 0 -10px; scrollbar-width: none; }
  .stat { flex: 0 0 148px; padding: 15px 16px; }
  .stat strong { font-size: 1.7rem; }
  .today-grid, .route-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .today-grid > .span-wide { grid-column: auto; }
  .panel { padding: 17px 15px; border-radius: 24px; }
  .panel-head { flex-wrap: wrap; }
  .hero { min-height: 360px; flex-direction: column; }
  .hero-art, [data-theme="retro"] .hero-art { inset: auto 0 0 0; width: 100%; height: 50%; }
  .hero-copy, [data-theme="retro"] .hero-copy { width: 100%; margin: 0; padding: 18px; gap: 11px; justify-content: flex-start; }
  .quick { padding: 13px; }
  .quick-tiles { gap: 9px; }
  .quick-tiles .tile { padding: 12px 2px 10px; border-radius: 20px; font-size: .76rem; }
  .quick-tiles .ic { width: 40px; height: 40px; }
  .month-grid { gap: 3px; }
  .weekday { font-size: .66rem; min-height: 24px; }
  .day { --photo-height: 28px; min-height: 62px; padding: 3px; gap: 2px; border-radius: 10px; }
  .day-num { min-width: 18px; font-size: .74rem; line-height: 18px; }
  .day.today .day-num { padding: 0 4px; }
  .day p { font-size: .58rem; line-height: 1.15; }
  .calendar-day { min-height: 60px; padding: 3px; border-radius: 10px; }
  .calendar-day.today .day-num { padding: 0 4px; }
  .calendar-label { padding: 2px 3px; border-radius: 6px; font-size: .58rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
  .calendar-more { font-size: .6rem; padding-left: 2px; }
  .life-links, .media-cards, .summary-pair, .form-pair { grid-template-columns: minmax(0, 1fr); }
  .notices { gap: 10px; }
  .notice { gap: 8px; padding: 7px 6px 7px 8px; border-radius: 20px; }
  .notice p { font-size: .8rem; line-height: 1.35; }
  .notice-icon { width: 30px; height: 30px; }
  .notice .glyph { width: 15px; height: 15px; }
  .notice .button { min-height: 32px; padding: 0 11px; font-size: .76rem; flex: none; }
  .notice .icon-button { width: 30px; min-height: 30px; flex: none; }
  .media-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .media-stats .stat { padding: 12px; }
  .media-stats .stat strong { font-size: 1.4rem; }
  .media-stats .stat > .glyph { display: none; }
  .period-stats { grid-template-columns: minmax(0, 1fr); }
  .search-field input { width: 100%; }
  .day-badge { min-width: 15px; height: 15px; padding: 0 2px; font-size: .56rem; border-radius: 5px; }
  .calendar-dots i { width: 5px; height: 5px; }
  .week-dots { gap: 4px; }
  .week-dots span { width: 24px; height: 24px; }
  .habit-card { padding: 16px 14px 18px; border-radius: 24px; }
  dialog { width: 100%; max-width: 100%; max-height: 90dvh; margin: auto 0 0; padding: 22px 18px max(22px, env(safe-area-inset-bottom)); border-radius: 30px 30px 0 0; animation: sheet .28s cubic-bezier(.2, .9, .3, 1); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
}
@media (max-width: 560px) {
  .habit-card-body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .habit-heatmap { justify-self: center; width: 100%; max-width: 250px; }
  .habit-side { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
  .habit-ring { width: 96px; height: 96px; }
  .habit-ring::before { width: 62px; height: 62px; }
  .habit-ring b { font-size: 1.5rem; }
  .habit-ring small { margin-top: 30px; }
  .habit-stats { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (pointer: coarse) {
  .button, .tab { min-height: 44px; }
  .icon-button { width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fx { display: none; }
}
