/* =========================================================
   薄巧小站 · 设计系统
   薄荷绿 × 巧克力棕 × 奶油白 / 手帐质感
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;

  /* 薄荷 */
  --mint-50: #f2fbf6;
  --mint-100: #e2f7ec;
  --mint-200: #c9efdd;
  --mint-300: #a8e4c9;
  --mint-400: #7fd3b0;
  --mint-500: #57bd91;
  --mint-600: #3f9e77;
  --mint-700: #2f7a5c;
  --mint-800: #235e48;
  --mint-900: #173f30;

  /* 巧克力 */
  --choc-50: #faf5ef;
  --choc-100: #f2e7d8;
  --choc-200: #e4cfb6;
  --choc-300: #cfb18f;
  --choc-400: #b18c65;
  --choc-500: #926a42;
  --choc-600: #74512f;
  --choc-700: #5c3e24;
  --choc-800: #452d1a;
  --choc-900: #2f1e11;

  /* 点缀 */
  --pink: #f0a8a8;
  --pink-soft: #fbe3e3;
  --butter: #f7d68d;
  --butter-soft: #fdf1d6;
  --berry: #c96a6a;
  --sky: #a9cfe8;

  /* 语义 */
  --bg: #fbf7ef;
  --bg-tint: #f4fbf6;
  --paper: #fffdf8;
  --paper-2: #fffdf8;
  --paper-3: #f8f2e8;
  --ink: #2e241a;
  --ink-soft: #6f5d4b;
  --ink-faint: #a1917e;
  --line: rgba(92, 62, 36, 0.12);
  --line-strong: rgba(92, 62, 36, 0.22);
  --mint-ink: #1e5c46;

  --shadow-1: 0 1px 2px rgba(92, 62, 36, 0.04), 0 8px 24px -12px rgba(47, 122, 92, 0.18);
  --shadow-2: 0 2px 4px rgba(92, 62, 36, 0.05), 0 18px 40px -18px rgba(47, 122, 92, 0.28);
  --shadow-sticker: 3px 4px 0 rgba(92, 62, 36, 0.08);

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 999px;

  --font-ui: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --font-hand: "KaiTi", "STKaiti", "Kaiti SC", "楷体", "Songti SC", serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", "Consolas", monospace;

  --sidebar-w: 248px;
  --topbar-h: 72px;
  --tabbar-h: 62px;
  --page-max: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15120e;
  --bg-tint: #171b17;
  --paper: #211c16;
  --paper-2: #251f18;
  --paper-3: #1b1712;
  --ink: #f2e7d9;
  --ink-soft: #c2b3a1;
  --ink-faint: #8d7f6f;
  --line: rgba(255, 246, 234, 0.09);
  --line-strong: rgba(255, 246, 234, 0.18);
  --mint-ink: #9ee6c6;
  --mint-100: #1e3529;
  --mint-200: #25432f;
  --mint-300: #2f5c41;
  --mint-400: #4f9a78;
  --mint-500: #6cc19c;
  --mint-600: #8ad6b4;
  --mint-700: #a8e6c8;
  --mint-800: #c7efdd;
  --mint-900: #e6f9ef;
  --choc-100: #2b231a;
  --choc-200: #3a2d20;
  --choc-300: #59452f;
  --choc-600: #dcc5a8;
  --choc-700: #eedcc4;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -16px rgba(0, 0, 0, 0.7);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.35), 0 22px 50px -20px rgba(0, 0, 0, 0.8);
  --shadow-sticker: 3px 4px 0 rgba(0, 0, 0, 0.35);
  --pink-soft: #3a2424;
  --butter-soft: #3a2f1d;
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.ic { width: 20px; height: 20px; flex: none; }
[hidden] { display: none !important; }

::selection { background: var(--mint-300); color: var(--mint-900); }

:focus-visible {
  outline: 2px solid var(--mint-500);
  outline-offset: 2px;
}

/* 背景：奶油底 + 薄荷云雾 + 细点阵 */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 12% -8%, #e9fbf1 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #fdf2e2 0%, transparent 55%),
    radial-gradient(800px 800px at 50% 120%, #eefaf2 0%, transparent 60%),
    var(--bg);
}
[data-theme="dark"] .bg-decor {
  background:
    radial-gradient(1100px 700px at 10% -10%, #1c2a22 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #2a2119 0%, transparent 55%),
    var(--bg);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}
.blob-a { width: 420px; height: 420px; left: -120px; top: 12%; background: #c9efdd; }
.blob-b { width: 360px; height: 360px; right: -80px; bottom: 4%; background: #fbe3d0; opacity: 0.42; }
.blob-c { width: 300px; height: 300px; right: 22%; top: -80px; background: #e2f7ec; opacity: 0.5; }
[data-theme="dark"] .blob { opacity: 0.22; }
.grain {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: radial-gradient(rgba(92, 62, 36, 0.055) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(120% 100% at 50% 0%, #000 30%, transparent 100%);
}
[data-theme="dark"] .grain { background-image: radial-gradient(rgba(255, 246, 234, 0.05) 1px, transparent 1px); }

/* ---------- 3. Shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 16px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 6px; }
.brand-mark { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 6px 10px rgba(87, 189, 145, 0.28)); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: 0.02em; }
.brand-text small { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 13px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
  position: relative;
}
.nav-link .ic { width: 19px; height: 19px; opacity: 0.85; }
.nav-link:hover { background: var(--mint-100); color: var(--mint-700); }
.nav-link.is-active {
  background: linear-gradient(120deg, var(--mint-200), var(--mint-100));
  color: var(--mint-800);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mint-400) 40%, transparent);
}
[data-theme="dark"] .nav-link.is-active { color: var(--mint-700); }
.nav-link.is-active .ic { opacity: 1; }
.nav-dot {
  margin-left: auto;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--berry);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--berry) 22%, transparent);
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-1);
}
.side-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.side-user-text strong { font-size: 13.5px; }
.side-user-text small { font-size: 11px; color: var(--ink-faint); }
.side-user-arrow { margin-left: auto; width: 16px; height: 16px; color: var(--ink-faint); }
.logout-form { display: flex; justify-content: flex-end; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 34px);
  min-height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-brand { display: none; font-weight: 700; font-size: 15px; }
.topbar-title h1 { font-size: clamp(19px, 2.2vw, 23px); letter-spacing: -0.02em; }
.topbar-title p { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-avatar { margin-left: 4px; }

.page {
  width: min(100%, var(--page-max));
  margin: 0 auto;
  padding: 8px clamp(16px, 3vw, 34px) 60px;
}

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: transform 0.12s var(--ease), box-shadow 0.16s, background 0.16s, border-color 0.16s;
  user-select: none;
}
.btn .ic { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0.5px) scale(0.995); }
[data-theme="dark"] .btn.choco {
  background: linear-gradient(135deg, #8a6642, #5a3d24 80%);
  color: #fff6ea;
}
[data-theme="dark"] .toast { background: #3a2c1e; color: #f8eee2; }
[data-theme="dark"] .step-dot { background: #4a3320; color: #f6ecdf; }
[data-theme="dark"] .sticker { background: var(--paper); }

.btn.primary {
  background: linear-gradient(135deg, var(--mint-400), var(--mint-500) 70%);
  color: #10382a;
  box-shadow: 0 10px 20px -10px rgba(87, 189, 145, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 650;
}
.btn.primary:hover { box-shadow: 0 14px 26px -12px rgba(87, 189, 145, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn.choco {
  background: linear-gradient(135deg, var(--choc-600), var(--choc-700) 80%);
  color: #fff6ea;
  box-shadow: 0 12px 22px -14px rgba(69, 45, 26, 0.7);
}
.btn.outline { border-color: var(--line-strong); background: transparent; }
.btn.outline:hover { background: var(--mint-50); border-color: var(--mint-400); }
.btn.soft { background: var(--mint-100); color: var(--mint-800); }
.btn.soft:hover { background: var(--mint-200); }
.btn.ghost { background: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--paper-3); }
.btn.danger { background: var(--pink-soft); color: var(--berry); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-pill); }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: 0.6; pointer-events: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  transition: background 0.16s, color 0.16s, transform 0.12s, border-color 0.16s;
}
.icon-btn:hover { background: var(--mint-100); color: var(--mint-700); border-color: transparent; transform: translateY(-1px); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn.is-active { background: var(--pink-soft); color: var(--berry); border-color: transparent; }

/* 明暗按钮里的太阳/月亮 */
#themeBtn .when-dark { display: none; }
[data-theme="dark"] #themeBtn .when-dark { display: block; }
[data-theme="dark"] #themeBtn .when-light { display: none; }

/* ---------- 5. Inputs ---------- */
.input, .textarea, .select {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.textarea { height: auto; min-height: 140px; padding: 12px 14px; line-height: 1.7; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--mint-400);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint-300) 35%, transparent);
}
.input.big { height: 50px; font-size: 16px; border-radius: 15px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); min-width: 0; }
.field > span { font-weight: 550; }
.field .hint { font-size: 12px; color: var(--ink-faint); }
.checkline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.checkline input { accent-color: var(--mint-500); width: 16px; height: 16px; }

/* ---------- 6. Avatars / chips / badges ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--mint-200), var(--choc-100));
  border: 1.5px solid var(--paper);
  box-shadow: 0 3px 10px rgba(92, 62, 36, 0.14);
  overflow: hidden;
  flex: none;
  font-size: 20px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 17px; }
.avatar.md { width: 40px; height: 40px; }
.avatar.lg { width: 56px; height: 56px; font-size: 28px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: var(--mint-100);
  color: var(--mint-800);
  font-size: 12.5px;
  font-weight: 550;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip.choco { background: var(--choc-100); color: var(--choc-700); }
.chip.pink { background: var(--pink-soft); color: var(--berry); }
.chip.butter { background: var(--butter-soft); color: #8a5b12; }
.chip.ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
.chip.is-active { background: var(--mint-500); color: #0e3527; }
.chip .ic { width: 14px; height: 14px; }

.tag-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--paper-3);
  color: var(--ink-faint);
  font-size: 12px;
  border: 1px solid var(--line);
}
.tag-pill:hover { color: var(--mint-700); border-color: var(--mint-300); }

/* ---------- 7. Cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 20px;
  position: relative;
}
.card.flush { padding: 0; overflow: hidden; }
.card.soft { background: var(--paper-3); box-shadow: none; }
.card.sticker { box-shadow: var(--shadow-sticker); border-color: var(--line-strong); }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.section-head h2::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--choc-600), var(--mint-400));
  transform: rotate(12deg);
  flex: none;
}
.section-head .more-link { font-size: 12.5px; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 2px; }
.section-head .more-link:hover { color: var(--mint-700); }

.muted { color: var(--ink-faint); font-size: 13px; }
.tiny { font-size: 12px; color: var(--ink-faint); }
.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-faint);
}
.empty .empty-art { font-size: 40px; filter: saturate(0.9); }
.empty h3 { font-size: 15px; color: var(--ink-soft); }
.empty p { font-size: 13px; max-width: 34ch; }

/* 进度条 / 环 */
.bar { height: 8px; border-radius: 99px; background: var(--paper-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mint-400), var(--mint-600)); transition: width 0.5s var(--ease); }
.ring {
  --p: 0;
  width: 116px; height: 116px;
  border-radius: 50%;
  background: conic-gradient(var(--mint-500) calc(var(--p) * 1%), var(--paper-3) 0);
  display: grid;
  place-items: center;
  position: relative;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--paper);
}
.ring > span { position: relative; font-family: var(--font-display); font-size: 22px; font-weight: 700; }

/* ---------- 8. Toast / Modal / Sheet ---------- */
.toast-root { position: fixed; z-index: 90; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--choc-700);
  color: #fff7ec;
  font-size: 13.5px;
  box-shadow: 0 12px 30px -10px rgba(47, 30, 17, 0.55);
  animation: toast-in 0.28s var(--ease);
  max-width: min(86vw, 460px);
}
.toast.ok { background: linear-gradient(135deg, var(--mint-600), var(--mint-700)); }
.toast.err { background: linear-gradient(135deg, #b45454, #8f3f3f); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }

.modal-root { position: fixed; inset: 0; z-index: 80; display: none; }
.modal-root.is-open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(35, 24, 14, 0.42); backdrop-filter: blur(3px); animation: fade-in 0.2s; }
.modal-card {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  max-height: min(86dvh, 800px);
  overflow: auto;
  margin: 6dvh auto 0;
  background: var(--paper);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  padding: 22px;
  animation: modal-in 0.26s var(--ease);
}
.modal-card.wide { width: min(760px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }

/* 移动端底部菜单 */
.sheet { position: fixed; inset: 0; z-index: 70; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(35, 24, 14, 0.35); animation: fade-in 0.2s; }
.sheet-card {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--paper);
  border-radius: 26px 26px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(47, 30, 17, 0.18);
  animation: sheet-up 0.28s var(--ease);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sheet-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: 14px;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--paper-3);
}
.sheet-link .ic { width: 21px; height: 21px; }
.sheet-link.is-active { background: var(--mint-200); color: var(--mint-800); }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* 悬浮按钮（手机端快捷记录，桌面靠顶栏/页内按钮） */
.fab-wrap { display: none; position: fixed; right: 22px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; flex-direction: column; align-items: flex-end; gap: 10px; }
.fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  color: #0e3527;
  background: linear-gradient(140deg, var(--mint-300), var(--mint-500));
  box-shadow: 0 16px 30px -12px rgba(63, 158, 119, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.2s var(--ease);
}
.fab .ic { width: 26px; height: 26px; stroke-width: 2; }
.fab:hover { transform: rotate(90deg) scale(1.04); }
.fab-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  animation: fab-in 0.2s var(--ease);
}
.fab-menu a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 11px; font-size: 13.5px; white-space: nowrap; }
.fab-menu a:hover { background: var(--mint-100); }
@keyframes fab-in { from { opacity: 0; transform: translateY(8px) scale(0.96); } }

/* ---------- 9. 通用排版组件 ---------- */
.hero-days { font-family: var(--font-display); letter-spacing: -0.03em; }
.sticker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 10px;
  background: var(--paper);
  border: 1.5px dashed color-mix(in srgb, var(--choc-300) 70%, transparent);
  color: var(--choc-700);
  font-size: 12px;
  font-weight: 550;
  transform: rotate(-1.2deg);
  box-shadow: 2px 3px 0 rgba(92, 62, 36, 0.06);
}
.sticker.alt { transform: rotate(1.4deg); background: var(--mint-50); border-color: color-mix(in srgb, var(--mint-400) 60%, transparent); color: var(--mint-800); }

.grid { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.clamp-1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.prose { font-size: 15.5px; line-height: 1.85; color: var(--ink); }
.prose p { margin: 0 0 0.9em; }
.prose h2, .prose h3, .prose h4 { margin: 1.3em 0 0.5em; }
.prose h2 { font-size: 19px; } .prose h3 { font-size: 16.5px; } .prose h4 { font-size: 15px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin: 0.2em 0; }
.prose blockquote {
  margin: 1em 0;
  padding: 10px 16px;
  border-left: 3px solid var(--mint-400);
  background: var(--mint-50);
  border-radius: 0 12px 12px 0;
  color: var(--ink-soft);
  font-family: var(--font-hand);
  font-size: 16px;
}
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--paper-3); padding: 1px 5px; border-radius: 5px; }
.prose pre { background: var(--choc-800); color: #f6ede1; padding: 14px 16px; border-radius: 14px; overflow: auto; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose img { border-radius: 14px; margin: 0.6em 0; }
.prose a { color: var(--mint-700); text-decoration: underline; text-underline-offset: 3px; }
.prose mark { background: linear-gradient(transparent 55%, var(--mint-200) 0); color: inherit; padding: 0 2px; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 1.4em 0; }

/* ---------- 10. 页面级公共块 ---------- */
.page-error { display: grid; place-items: center; min-height: 100dvh; }
.error-card { text-align: center; max-width: 420px; padding: 30px; }
.error-art { font-size: 52px; margin-bottom: 8px; }

/* 搜索层 */
.search-layer { position: fixed; inset: 0; z-index: 85; display: none; }
.search-layer.is-open { display: block; }
.search-panel {
  position: relative;
  width: min(640px, calc(100vw - 28px));
  margin: 8dvh auto 0;
  background: var(--paper);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: modal-in 0.22s var(--ease);
}
.search-bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-bar .ic { color: var(--ink-faint); }
.search-bar input { flex: 1; border: 0; background: none; outline: none; font-size: 16px; }
.search-results { max-height: 62dvh; overflow: auto; padding: 8px; }
.search-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; align-items: flex-start; }
.search-item:hover { background: var(--mint-50); }
.search-item .kind { font-size: 11px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-top: 2px; flex: none; }

/* ---------- 10.5 通用小组件 ---------- */
.avatar.xs { width: 24px; height: 24px; font-size: 13px; border-width: 1px; }
.dot-sep { color: var(--ink-faint); margin: 0 4px; font-size: 11px; }
.byline { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-faint); }
.byline-name { color: var(--ink-soft); font-weight: 550; }
.card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.card-eyebrow .ic { width: 16px; height: 16px; color: var(--mint-600); }

/* 心情色系 */
.chip.tone-butter, .tone-butter { background: var(--butter-soft); color: #8a5b12; }
.chip.tone-mint, .tone-mint { background: var(--mint-100); color: var(--mint-800); }
.chip.tone-pink, .tone-pink { background: var(--pink-soft); color: var(--berry); }
.chip.tone-peach, .tone-peach { background: #fdeadd; color: #9b5a29; }
.chip.tone-lavender, .tone-lavender { background: #eee8f8; color: #6b55a3; }
.chip.tone-sky, .tone-sky { background: #e4f1f8; color: #3f7391; }
.chip.tone-rose, .tone-rose { background: #fbe2e2; color: #a94b4b; }
.chip.tone-sand, .tone-sand { background: #f4ece0; color: #85684a; }
[data-theme="dark"] .chip.tone-butter, [data-theme="dark"] .tone-butter { background: #3a2f1d; color: #e8c98d; }
[data-theme="dark"] .chip.tone-lavender { background: #2c2740; color: #c3b4e8; }
[data-theme="dark"] .chip.tone-sky { background: #1f2f3a; color: #a9cfe8; }
[data-theme="dark"] .chip.tone-peach { background: #3a291c; color: #e8b98d; }
[data-theme="dark"] .chip.tone-rose { background: #3a2222; color: #e9a3a3; }
[data-theme="dark"] .chip.tone-sand { background: #2f2a22; color: #d3c2a9; }
[data-theme="dark"] .chip.tone-pink { color: #f0b4b4; }
.chip .emoji { font-size: 13px; line-height: 1; }

/* 心情选择器 */
.mood-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 2px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--paper-3);
  transition: transform 0.14s var(--ease), background 0.14s, border-color 0.14s;
}
.mood-btn span { font-size: 20px; line-height: 1.2; }
.mood-btn small { font-size: 10.5px; color: var(--ink-faint); }
.mood-btn:hover { transform: translateY(-2px); background: var(--mint-50); border-color: var(--mint-200); }
.mood-btn.is-on { background: var(--mint-200); border-color: var(--mint-400); }
.mood-btn.is-on small { color: var(--mint-800); font-weight: 600; }

/* 拍立得照片 */
.polaroid {
  display: block;
  background: var(--paper);
  padding: 7px 7px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transform: rotate(-1deg);
  transition: transform 0.22s var(--ease), box-shadow 0.22s;
}
.polaroid:nth-child(even) { transform: rotate(1.1deg); }
.polaroid:hover { transform: rotate(0) translateY(-4px); box-shadow: var(--shadow-2); z-index: 2; }
.polaroid-img { display: block; border-radius: 7px; overflow: hidden; aspect-ratio: 1; background: var(--paper-3); }
.polaroid-img img { width: 100%; height: 100%; object-fit: cover; }
.polaroid-cap {
  display: block;
  padding: 6px 4px 8px;
  font-family: var(--font-hand);
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(24, 16, 10, 0.9);
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  padding: 3dvh 8px;
  animation: fade-in 0.2s;
}
.lb-stage { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.lb-stage img { max-width: min(1100px, 92vw); max-height: 80dvh; border-radius: 10px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5); object-fit: contain; }
.lb-stage figcaption { color: #f4e9dc; font-family: var(--font-hand); font-size: 15px; text-align: center; max-width: 60ch; }
.lb-close { position: fixed; top: 14px; right: 14px; background: rgba(255, 255, 255, 0.12); border-color: transparent; color: #fff; }
.lb-nav { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16); color: #fff; border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; justify-self: center; }
.lb-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lb-count { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); color: #e7d9c8; font-size: 12px; letter-spacing: 0.06em; }
@media (max-width: 640px) {
  .lightbox { grid-template-columns: minmax(0, 1fr); padding: 56px 10px; }
  .lb-nav { position: fixed; top: 50%; transform: translateY(-50%); z-index: 2; }
  .lb-nav.prev { left: 8px; } .lb-nav.next { right: 8px; }
}

/* 照片网格 */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-grid .polaroid { transform: none; }
.photo-grid .polaroid:hover { transform: translateY(-3px); }

/* 圆形标签按钮 */
.pill-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pill-tabs::-webkit-scrollbar { display: none; }
.pill-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13px;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pill-tab:hover { border-color: var(--mint-300); color: var(--mint-700); }
.pill-tab.is-active { background: var(--choc-700); border-color: var(--choc-700); color: #fff6e9; }
[data-theme="dark"] .pill-tab.is-active { background: var(--mint-600); border-color: var(--mint-600); color: #10281d; }

/* 列表行 */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }

/* 空状态按钮间距 */
.empty .btn { margin-top: 6px; }

/* 页面错误 */
.error-card h2 { font-size: 20px; margin-bottom: 8px; }
.error-card p { color: var(--ink-soft); margin-bottom: 16px; }
.error-card code { font-family: var(--font-mono); font-size: 12px; background: var(--paper-3); padding: 2px 6px; border-radius: 6px; }

/* ---------- 11. 响应式 ---------- */
@media (max-width: 1080px) {
  :root { --sidebar-w: 216px; }
  .brand-text small { display: none; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; min-height: 60px; }
  .topbar-brand { display: block; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-title p { display: none; }
  .topbar-actions { gap: 4px; }
  .page { padding: 4px 14px calc(var(--tabbar-h) + 40px); }
  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: none;
    color: var(--ink-faint);
    font-size: 10.5px;
    padding-top: 6px;
  }
  .tab .ic { width: 22px; height: 22px; }
  .tab.is-active { color: var(--mint-700); }
  .tab.is-active .ic { filter: drop-shadow(0 3px 6px rgba(87, 189, 145, 0.35)); }
  .fab-wrap { display: flex; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); right: 16px; }
  .fab { width: 52px; height: 52px; }
  .toast-root { bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-card { margin-top: 12dvh; }
}

@media (min-width: 861px) {
  .tabbar { display: none; }
  .fab-wrap { bottom: 26px; }
}

@media (max-width: 520px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 16px; border-radius: 20px; }
  .page { padding-left: 12px; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
