/* =========================================================
   纸页 · 日记本 样式表
   设计关键词：纸张、墨水、暖光、安静
   ========================================================= */

/* ---------- 设计令牌 ---------- */
:root {
  /* 浅色 */
  --bg: #FAF7F2;
  --bg-soft: #F4EFE7;
  --surface: #FFFFFF;
  --paper: #FFFDF9;
  --paper-2: #FBF8F2;
  --ink: #2A2826;
  --ink-2: #5D5851;
  --ink-3: #928B81;
  --ink-4: #B9B2A7;
  --line: #E9E2D7;
  --line-2: #F1ECE3;
  --shadow-sm: 0 1px 2px rgba(60, 45, 25, .05), 0 2px 8px rgba(60, 45, 25, .04);
  --shadow-md: 0 2px 6px rgba(60, 45, 25, .06), 0 10px 28px rgba(60, 45, 25, .07);
  --shadow-lg: 0 8px 20px rgba(60, 45, 25, .10), 0 28px 70px rgba(60, 45, 25, .14);

  --accent: #C4633F;
  --accent-ink: #FFFFFF;
  --accent-soft: #F7E7DD;
  --accent-line: #EBC6B4;

  --good: #5F8D6B;
  --warn: #D69A3A;
  --bad: #C25B52;
  --info: #5C7FA3;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, "Times New Roman", serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", var(--font-serif);
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --fs: 16px;
  --lh: 1.85;
  --sidebar-w: 268px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --trans: .22s var(--ease);
}

/* 深色 */
html[data-theme="dark"] {
  --bg: #161513;
  --bg-soft: #1C1B18;
  --surface: #211F1C;
  --paper: #1E1D1A;
  --paper-2: #24221E;
  --ink: #EDE8E0;
  --ink-2: #B7B0A5;
  --ink-3: #847D73;
  --ink-4: #5C564E;
  --line: #322F2A;
  --line-2: #2A2824;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .22);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .32), 0 12px 30px rgba(0, 0, 0, .34);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, .42), 0 30px 80px rgba(0, 0, 0, .5);
  --accent-ink: #1A1512;
}

/* 主题色 */
html[data-accent="clay"]  { --accent: #C4633F; --accent-soft: #F7E7DD; --accent-line: #EBC6B4; }
html[data-accent="pine"]  { --accent: #3F7A5F; --accent-soft: #E1EFE7; --accent-line: #BFDCCB; }
html[data-accent="ink"]   { --accent: #3B5B8C; --accent-soft: #E2EAF5; --accent-line: #C1D2E8; }
html[data-accent="plum"]  { --accent: #8A4F7D; --accent-soft: #F2E4EE; --accent-line: #DCC0D5; }
html[data-accent="amber"] { --accent: #B77B1E; --accent-soft: #F8EEDA; --accent-line: #E7D0A4; }
html[data-accent="slate"] { --accent: #4A4F57; --accent-soft: #E7E8EA; --accent-line: #CBCED3; }

html[data-theme="dark"][data-accent="clay"]  { --accent: #E3906B; --accent-soft: #35251E; --accent-line: #5B3A2C; }
html[data-theme="dark"][data-accent="pine"]  { --accent: #74B896; --accent-soft: #1D2E25; --accent-line: #2F4A3B; }
html[data-theme="dark"][data-accent="ink"]   { --accent: #7EA2D8; --accent-soft: #1E2735; --accent-line: #32435C; }
html[data-theme="dark"][data-accent="plum"]  { --accent: #C58CB8; --accent-soft: #2E202A; --accent-line: #4B3445; }
html[data-theme="dark"][data-accent="amber"] { --accent: #E0B25E; --accent-soft: #30281A; --accent-line: #514226; }
html[data-theme="dark"][data-accent="slate"] { --accent: #A9B0BB; --accent-soft: #25272B; --accent-line: #3A3D43; }

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  transition: background var(--trans), color var(--trans);
}
body::before { /* 细腻纸张噪点 */
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: .5;
  background-image: radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 42%),
                    radial-gradient(circle at 88% 92%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 46%);
}
html[data-texture="off"] body::before { display: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: .01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd {
  font-family: var(--font-ui); font-size: 11px; line-height: 1;
  padding: 3px 6px; border-radius: 5px;
  background: var(--bg-soft); color: var(--ink-3);
  border: 1px solid var(--line);
}
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink-4) 55%, transparent); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-3); border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

[hidden] { display: none !important; }
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--ink-3); }
.dot { opacity: .5; margin: 0 6px; }

/* ---------- 布局 ---------- */
.app {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}
.sidebar {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px 16px 16px;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  transition: transform var(--trans);
}
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.views { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.view { display: none; padding: 26px 32px 80px; max-width: 1240px; margin: 0 auto; }
.view.active { display: block; animation: viewIn .32s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 品牌 ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 4px 6px; }
.brand-mark { width: 38px; height: 38px; color: var(--accent); flex: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-family: var(--font-serif); font-size: 20px; letter-spacing: .12em; line-height: 1.2; }
.brand-text span { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.sidebar-close { display: none; margin-left: auto; }

/* ---------- 按钮 ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 14px; letter-spacing: .02em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
  transition: transform .16s var(--ease), box-shadow var(--trans), filter var(--trans);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 10px 22px color-mix(in srgb, var(--accent) 34%, transparent); }
.btn-primary:active { transform: translateY(0) scale(.985); }
.btn-primary kbd { background: rgba(255, 255, 255, .2); border-color: transparent; color: inherit; opacity: .85; }
.btn-primary:disabled { opacity: .5; pointer-events: none; }
.btn-new { width: 100%; height: 44px; }
.btn-new kbd { margin-left: auto; }
.btn-new-sm { width: 38px; height: 38px; padding: 0; display: none; }

.btn-ghost, .ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.btn-ghost:hover, .ghost-btn:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line); }
.btn-ghost.on { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  transition: background var(--trans), color var(--trans), transform .16s var(--ease);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.sm .ico { width: 16px; height: 16px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  font-size: 12.5px; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface);
  transition: all var(--trans);
}
.chip-btn:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.chip-btn .ico { width: 14px; height: 14px; }

/* ---------- 侧栏导航 ---------- */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 12px; border-radius: 11px;
  color: var(--ink-2); font-size: 14.5px; font-weight: 500;
  transition: background var(--trans), color var(--trans);
  text-align: left;
}
.nav-item:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.nav-item.active .ico { color: var(--accent); }
.nav-item .count {
  margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  padding: 2px 7px; border-radius: 999px; background: var(--bg);
}
.nav-item.active .count { background: var(--accent-soft); color: var(--accent); }
.nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }

.side-card {
  margin-top: auto;
  padding: 14px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.streak-top { display: flex; align-items: baseline; justify-content: space-between; }
.streak-num { font-family: var(--font-serif); font-size: 30px; font-weight: 700; line-height: 1; color: var(--accent); }
.streak-num small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 4px; font-family: var(--font-ui); }
.streak-label { font-size: 12.5px; color: var(--ink-3); }
.goal-bar { height: 6px; border-radius: 6px; background: var(--bg-soft); overflow: hidden; margin: 11px 0 7px; }
.goal-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); transition: width .5s var(--ease); }
.goal-text { font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; }
.week-dots { display: flex; justify-content: space-between; gap: 4px; margin-top: 12px; }
.week-dots div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-4); }
.week-dots i { width: 100%; aspect-ratio: 1; max-width: 26px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--line-2); transition: all var(--trans); }
.week-dots i.done { background: var(--accent); border-color: transparent; box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 30%, transparent); }
.week-dots i.today { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.week-dots div.today { color: var(--accent); font-weight: 600; }

.side-foot { display: flex; gap: 4px; padding-top: 4px; }
.side-foot .ghost-btn { flex: 1; justify-content: center; height: 34px; font-size: 12.5px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--trans);
}
.topbar.scrolled { border-bottom-color: var(--line); }
.menu-btn { display: none; }
.page-title { min-width: 0; }
.page-title h1 { font-family: var(--font-serif); font-size: 22px; letter-spacing: .06em; white-space: nowrap; }
.page-title p { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-box {
  margin-left: auto; position: relative;
  display: flex; align-items: center; gap: 8px;
  width: min(340px, 34vw); height: 38px; padding: 0 12px;
  border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink-3);
  transition: border-color var(--trans), box-shadow var(--trans), width var(--trans);
}
.search-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 14px; color: var(--ink); }
.search-box input::placeholder { color: var(--ink-4); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-box kbd { flex: none; }
.top-actions { display: flex; align-items: center; gap: 4px; }

/* ---------- 纸张卡片 ---------- */
.paper {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.panel { padding: 20px 22px 22px; }
.panel-title {
  font-family: var(--font-serif); font-size: 16px; letter-spacing: .06em;
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.panel-title::before { content: ""; width: 3px; height: 14px; border-radius: 3px; background: var(--accent); }

/* ---------- 写作 ---------- */
.write-wrap { max-width: 860px; margin: 0 auto; }
.editor { padding: 22px 28px 18px; transition: box-shadow var(--trans), border-color var(--trans); }
.editor:focus-within { border-color: var(--accent-line); box-shadow: var(--shadow-md); }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.date-pick { display: flex; align-items: center; gap: 4px; }
.date-label { position: relative; display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border-radius: 9px; cursor: pointer; transition: background var(--trans); }
.date-label:hover { background: var(--bg-soft); }
.date-label span { font-family: var(--font-serif); font-size: 17px; font-weight: 650; letter-spacing: .04em; }
.date-label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.editor-head-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.title-input {
  width: 100%; margin: 16px 0 6px; padding: 6px 0;
  border: 0; border-bottom: 1px solid transparent; outline: 0; background: none;
  font-family: var(--font-serif); font-size: 28px; font-weight: 700; letter-spacing: .03em;
  transition: border-color var(--trans);
}
.title-input::placeholder { color: var(--ink-4); font-weight: 500; }
.title-input:focus { border-bottom-color: var(--accent-line); }

.meta-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.meta-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.meta-group.grow { flex: 1; min-width: 220px; }
.meta-label { font-size: 12px; color: var(--ink-3); letter-spacing: .08em; flex: none; }
.mood-picker, .weather-picker { display: flex; gap: 4px; flex-wrap: wrap; }
.mood-btn, .weather-btn {
  position: relative; width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
  border: 1px solid transparent;
  transition: transform .16s var(--ease), background var(--trans), border-color var(--trans);
}
.mood-btn:hover, .weather-btn:hover { background: var(--bg-soft); transform: translateY(-2px) scale(1.08); }
.mood-btn.on { background: var(--accent-soft); border-color: var(--accent-line); transform: scale(1.06); }
.weather-btn.on { background: var(--bg-soft); border-color: var(--line); }
.mood-btn.on::after { content: ""; position: absolute; bottom: 2px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }

.tag-editor { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.tag-list { display: contents; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 8px; border-radius: 999px;
  font-size: 12.5px; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.tag-chip button { display: inline-flex; opacity: .6; transition: opacity var(--trans); }
.tag-chip button:hover { opacity: 1; }
.tag-chip .ico { width: 12px; height: 12px; }
.tag-editor input { flex: 1; min-width: 120px; height: 28px; border: 0; outline: 0; background: none; font-size: 13.5px; }
.tag-editor input::placeholder { color: var(--ink-4); }
.mini-input {
  height: 28px; width: 130px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); outline: 0; font-size: 13.5px;
  transition: border-color var(--trans);
}
.mini-input:focus { border-color: var(--accent-line); }
.tag-suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0 0; }
.tag-suggest button {
  height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px;
  color: var(--ink-3); border: 1px dashed var(--line); transition: all var(--trans);
}
.tag-suggest button:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* 工具栏 */
.toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  margin: 12px 0 0; padding: 6px 4px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--paper-2);
  position: sticky; top: 0; z-index: 5;
}
.toolbar > button {
  width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink-2);
  transition: background var(--trans), color var(--trans);
}
.toolbar > button:hover { background: var(--accent-soft); color: var(--accent); }
.toolbar > button .ico { width: 16px; height: 16px; }
.toolbar .sep { width: 1px; height: 16px; background: var(--line); margin: 0 5px; }
.toolbar-spacer { flex: 1; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--bg-soft); border: 1px solid var(--line-2); }
.seg button {
  height: 26px; padding: 0 10px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--ink-3);
  transition: background var(--trans), color var(--trans), box-shadow var(--trans);
}
.seg button .ico { width: 15px; height: 15px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }

.editor-body { display: grid; margin-top: 10px; min-height: 340px; }
.editor-body[data-mode="split"] { grid-template-columns: 1fr 1fr; gap: 0; }
.editor-body[data-mode="split"] textarea { border-right: 1px solid var(--line-2); padding-right: 18px; }
.editor-body[data-mode="split"] .preview { padding-left: 18px; }
.editor-body textarea {
  grid-area: 1 / 1;
  width: 100%; min-height: 340px; resize: none; border: 0; outline: 0; background: none;
  font-family: var(--font-serif); font-size: var(--fs); line-height: var(--lh);
  color: var(--ink); padding: 6px 0 12px;
  tab-size: 2;
}
.editor-body textarea::placeholder { color: var(--ink-4); }
.editor-body .preview { grid-area: 1 / 2; min-width: 0; max-height: 60vh; overflow-y: auto; padding: 6px 0 12px; }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px 0 0; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.thumb:hover img { transform: scale(1.06); }
.thumb button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(20, 18, 16, .62); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--trans);
}
.thumb:hover button { opacity: 1; }
.thumb button .ico { width: 12px; height: 12px; }

.editor-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2);
}
.foot-stats { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; flex-wrap: wrap; }
.foot-actions { display: flex; align-items: center; gap: 6px; }

/* 那年今日 / 灵感条 */
.memory-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; padding: 12px 16px; border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 40%, var(--paper)));
  border: 1px solid var(--accent-line);
  cursor: pointer; transition: transform .16s var(--ease), box-shadow var(--trans);
}
.memory-bar:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.memory-bar .badge { font-size: 11.5px; font-weight: 650; color: var(--accent); letter-spacing: .1em; flex: none; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.memory-bar .text { min-width: 0; flex: 1; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.memory-bar .text b { font-family: var(--font-serif); color: var(--ink); font-weight: 650; margin-right: 8px; }
.memory-bar .ico { color: var(--accent); }


/* ---------- 自绘表情 / 天气图标 ---------- */
.face { display: inline-block; width: 1em; height: 1em; flex: none; vertical-align: -0.15em; }
.mood-btn .face, .weather-btn .face { width: 23px; height: 23px; }
.chip .face { width: 16px; height: 16px; }
.mood-pill .face, .read-meta .pill .face { width: 15px; height: 15px; }
.card-top .face { width: 14px; height: 14px; }
.r-mood .face { width: 18px; height: 18px; vertical-align: -3px; }
.d-mood .face { width: 13px; height: 13px; }
.d-num .d-mood { display: inline-flex; }
.tl-item h4 .face { width: 17px; height: 17px; vertical-align: -2px; }
.mini-item b .face { width: 15px; height: 15px; vertical-align: -2px; }
.cal-legend .face { width: 14px; height: 14px; }
.af-chip .face { width: 13px; height: 13px; }
.tpl-ico { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; flex: none; }
.tpl-ico .ico { width: 15px; height: 15px; }

/* ---------- Markdown 正文 ---------- */
.md { font-family: var(--font-serif); font-size: var(--fs); line-height: var(--lh); color: var(--ink); word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 .9em; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-serif); margin: 1.4em 0 .55em; line-height: 1.4; letter-spacing: .03em; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.3em; } .md h3 { font-size: 1.12em; } .md h4 { font-size: 1em; }
.md h2 { padding-bottom: .3em; border-bottom: 1px solid var(--line-2); }
.md strong { font-weight: 700; color: var(--ink); }
.md em { color: var(--ink-2); }
.md del { color: var(--ink-3); }
.md ul, .md ol { margin: 0 0 .9em; padding-left: 1.5em; }
.md li { margin: .22em 0; }
.md ul.todo { list-style: none; padding-left: .2em; }
.md ul.todo li { display: flex; align-items: baseline; gap: .55em; }
.md ul.todo input { accent-color: var(--accent); transform: translateY(1px); }
.md ul.todo li.done { color: var(--ink-3); text-decoration: line-through; }
.md blockquote {
  margin: 1em 0; padding: .1em 1em; border-left: 3px solid var(--accent-line);
  background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
}
.md blockquote p:last-child { margin-bottom: 0; }
.md hr { border: 0; height: 1px; margin: 1.6em 0; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.md code { font-family: var(--font-mono); font-size: .86em; padding: .12em .4em; border-radius: 5px; background: var(--bg-soft); border: 1px solid var(--line-2); }
.md pre { margin: 1em 0; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-soft); border: 1px solid var(--line-2); overflow-x: auto; }
.md pre code { padding: 0; background: none; border: 0; font-size: .86em; line-height: 1.65; }
.md img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); display: block; margin: .8em 0; cursor: zoom-in; }
.md a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent-line); }
.md mark { background: color-mix(in srgb, var(--warn) 35%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.md .hl { background: color-mix(in srgb, var(--warn) 38%, transparent); border-radius: 3px; padding: 0 2px; }
.md table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .94em; }
.md th, .md td { border: 1px solid var(--line); padding: .45em .7em; text-align: left; }
.md th { background: var(--bg-soft); }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  font-size: 13px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
  transition: all var(--trans);
}
.chip:hover { border-color: var(--accent-line); color: var(--accent); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.filter-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.filter-selects { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.select {
  height: 32px; padding: 0 28px 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px;
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23928B81' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select:focus { outline: 0; border-color: var(--accent-line); }
.filter-row2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 0; }
.active-filters:empty { display: none; }
.af-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
}
.af-chip button { display: inline-flex; opacity: .7; }
.af-chip button:hover { opacity: 1; }
.af-chip .ico { width: 12px; height: 12px; }

/* ---------- 日记卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 16px; }
.entry-card {
  position: relative; display: flex; flex-direction: column;
  padding: 18px 20px 16px; border-radius: var(--radius-lg);
  background: var(--paper); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .2s var(--ease), box-shadow var(--trans), border-color var(--trans);
  overflow: hidden;
}
.entry-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--mood-color, var(--accent-line)); opacity: .85; }
.entry-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent-line); }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.card-top .date { font-family: var(--font-serif); font-weight: 650; color: var(--ink-2); letter-spacing: .03em; }
.card-top .spacer { flex: 1; }
.card-top .ico { width: 15px; height: 15px; }
.pin-mark { color: var(--accent); }
.fav-mark { color: var(--warn); }
.fav-mark svg { fill: currentColor; }
.card-title {
  margin: 10px 0 6px; font-family: var(--font-serif); font-size: 17px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-excerpt {
  flex: 1; font-family: var(--font-serif); font-size: 14px; line-height: 1.75; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-wrap;
}
.card-cover { margin: 10px 0 2px; height: 132px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-2); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.mood-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; background: var(--bg-soft); color: var(--ink-2); }
.card-tag { height: 22px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; display: inline-flex; align-items: center; color: var(--accent); background: var(--accent-soft); }
.card-foot .words { margin-left: auto; font-size: 11.5px; color: var(--ink-4); }

/* 时间轴 */
.timeline { position: relative; padding-left: 30px; max-width: 860px; margin: 0 auto; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--line), var(--line) 90%, transparent); }
.tl-group { margin-bottom: 26px; }
.tl-date { position: relative; display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.tl-date::before {
  content: ""; position: absolute; left: -26px; top: 7px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--accent); box-shadow: 0 0 0 4px var(--bg);
}
.tl-date h3 { font-family: var(--font-serif); font-size: 19px; letter-spacing: .04em; }
.tl-date span { font-size: 12.5px; color: var(--ink-3); }
.tl-items { display: flex; flex-direction: column; gap: 10px; }
.tl-item { padding: 14px 18px; border-radius: var(--radius-lg); background: var(--paper); border: 1px solid var(--line); cursor: pointer; box-shadow: var(--shadow-sm); transition: all .2s var(--ease); }
.tl-item:hover { transform: translateX(4px); border-color: var(--accent-line); box-shadow: var(--shadow-md); }
.tl-item h4 { font-family: var(--font-serif); font-size: 15.5px; margin-bottom: 4px; display: flex; align-items: center; gap: 7px; }
.tl-item h4 time { margin-left: auto; font-family: var(--font-ui); font-size: 12px; font-weight: 400; color: var(--ink-4); white-space: nowrap; }
.tl-item p { font-family: var(--font-serif); font-size: 13.5px; color: var(--ink-2); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 清单 */
.rows { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--paper); }
.row { display: grid; grid-template-columns: 122px 30px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background var(--trans); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--paper-2); }
.row .r-date { font-family: var(--font-serif); font-size: 13.5px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.row .r-mood { font-size: 17px; }
.row .r-main { min-width: 0; }
.row .r-main b { font-family: var(--font-serif); font-size: 14.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-main span { font-size: 13px; color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-meta { font-size: 12px; color: var(--ink-4); white-space: nowrap; display: flex; align-items: center; gap: 8px; }

/* 空状态 */
.empty { text-align: center; padding: 64px 20px; color: var(--ink-3); }
.empty svg { width: 120px; height: 120px; margin-bottom: 12px; opacity: .9; }
.empty h3 { font-family: var(--font-serif); font-size: 18px; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .05em; }
.empty p { font-size: 13.5px; margin-bottom: 18px; }

/* ---------- 日历 ---------- */
.cal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.cal-main { padding: 20px 22px 18px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { display: flex; align-items: center; gap: 10px; }
.cal-title h2 { font-family: var(--font-serif); font-size: 22px; letter-spacing: .06em; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-weekdays span { text-align: center; font-size: 12px; color: var(--ink-4); letter-spacing: .1em; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day {
  position: relative; min-height: 84px; padding: 7px 8px;
  border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--paper-2);
  display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer;
  transition: all .18s var(--ease);
}
.cal-day:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.cal-day.out { opacity: .35; }
.cal-day.today { border-color: var(--accent); }
.cal-day.sel { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.cal-day .d-num { font-family: var(--font-serif); font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 4px; }
.cal-day.today .d-num { color: var(--accent); }
.cal-day .d-mood { font-size: 15px; line-height: 1; }
.cal-day .d-title { font-size: 11.5px; color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-day .d-bar { margin-top: auto; height: 3px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.cal-day .d-bar i { display: block; height: 100%; background: var(--mood-color, var(--accent)); border-radius: 3px; }
.cal-day .d-count { position: absolute; top: 6px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cal-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 8px; height: 8px; border-radius: 50%; }
.cal-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 20px; }
.side-panel { padding: 18px 20px; }
.side-panel h4 { font-family: var(--font-serif); font-size: 15px; margin-bottom: 4px; }
.side-panel .sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-item { padding: 10px 12px; border-radius: var(--radius); background: var(--paper-2); border: 1px solid var(--line-2); cursor: pointer; transition: all var(--trans); }
.mini-item:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.mini-item b { font-family: var(--font-serif); font-size: 14px; display: block; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-item span { font-size: 12.5px; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.month-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.ms { text-align: center; padding: 10px 4px; border-radius: var(--radius); background: var(--paper-2); border: 1px solid var(--line-2); }
.ms b { font-family: var(--font-serif); font-size: 20px; display: block; color: var(--accent); }
.ms span { font-size: 11.5px; color: var(--ink-3); }

/* 热力图 */
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; width: max-content; }
.heat i { width: 11px; height: 11px; border-radius: 3px; background: var(--bg-soft); border: 1px solid var(--line-2); cursor: default; transition: transform .12s var(--ease); }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--accent) 28%, var(--bg-soft)); border-color: transparent; }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--accent) 48%, var(--bg-soft)); border-color: transparent; }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--accent) 70%, var(--bg-soft)); border-color: transparent; }
.heat i[data-l="4"] { background: var(--accent); border-color: transparent; }
.heat i.today { outline: 1.5px solid var(--ink-3); outline-offset: 1px; }
.heat i[data-tip]:hover { transform: scale(1.5); }
.heat-months { display: grid; grid-template-columns: repeat(53, 11px); gap: 0 3px; font-size: 10px; color: var(--ink-4); margin-bottom: 5px; width: max-content; white-space: nowrap; }
.heat-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.heat-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 11px; color: var(--ink-4); margin-top: 8px; }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--bg-soft); border: 1px solid var(--line-2); }
.heat-legend i[data-l="1"] { background: color-mix(in srgb, var(--accent) 28%, var(--bg-soft)); border-color: transparent; }
.heat-legend i[data-l="2"] { background: color-mix(in srgb, var(--accent) 48%, var(--bg-soft)); border-color: transparent; }
.heat-legend i[data-l="3"] { background: color-mix(in srgb, var(--accent) 70%, var(--bg-soft)); border-color: transparent; }
.heat-legend i[data-l="4"] { background: var(--accent); border-color: transparent; }

/* ---------- 统计 ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px 20px; border-radius: var(--radius-lg); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -18px; top: -18px; width: 76px; height: 76px; border-radius: 50%; background: var(--accent-soft); opacity: .7; }
.kpi .k-label { font-size: 12.5px; color: var(--ink-3); letter-spacing: .06em; position: relative; z-index: 1; }
.kpi .k-val { font-family: var(--font-serif); font-size: 30px; font-weight: 700; line-height: 1.25; position: relative; z-index: 1; }
.kpi .k-val small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; font-family: var(--font-ui); }
.kpi .k-sub { font-size: 12px; color: var(--ink-3); position: relative; z-index: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.stats-grid .span-2 { grid-column: span 2; }
.chart { min-height: 180px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { font-size: 11px; fill: var(--ink-4); }
.chart .grid-line { stroke: var(--line-2); stroke-dasharray: 3 4; }
.chart .bar { transition: opacity var(--trans); }
.chart .bar:hover { opacity: .78; }
.legend-list { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.legend-item i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-item .pct { margin-left: auto; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-wrap svg { width: 132px; flex: none; }
.donut-wrap .legend-list { flex: 1; margin-top: 0; }
.tag-bars { display: flex; flex-direction: column; gap: 9px; }
.tag-bar { display: grid; grid-template-columns: 76px minmax(0, 1fr) 34px; align-items: center; gap: 10px; font-size: 13px; }
.tag-bar .tb-track { height: 8px; border-radius: 8px; background: var(--bg-soft); overflow: hidden; }
.tag-bar .tb-track i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff)); }
.tag-bar .tb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.tag-bar .tb-num { text-align: right; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.sec-label { font-size: 12px; color: var(--ink-3); letter-spacing: .08em; margin: 16px 0 8px; }

/* ---------- 设置 ---------- */
.settings-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.set-card { padding: 22px 24px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px dashed var(--line-2); }
.set-row:last-child { border-bottom: 0; padding-bottom: 0; }
.set-row:first-of-type { padding-top: 0; }
.set-info { min-width: 0; }
.set-info b { font-size: 14.5px; font-weight: 600; display: block; }
.set-info span { font-size: 12.5px; color: var(--ink-3); display: block; margin-top: 2px; }
.set-ctl { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; position: relative; transition: transform .16s var(--ease); }
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: var(--paper); box-shadow: 0 0 0 2px var(--ink-3); }
.switch { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line); transition: background var(--trans); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform var(--trans); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
.opt-btn { height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); transition: all var(--trans); }
.opt-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.opt-btn.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.range { accent-color: var(--accent); width: 150px; }
.usage { height: 8px; border-radius: 8px; background: var(--bg-soft); overflow: hidden; margin-top: 8px; }
.usage i { display: block; height: 100%; background: var(--accent); border-radius: 8px; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); transition: all var(--trans);
}
.btn-outline:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.btn-outline.danger { color: var(--bad); }
.btn-outline.danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.btn-outline .ico { width: 15px; height: 15px; }

/* ---------- 弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: color-mix(in srgb, #14110E 46%, transparent); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fadeIn .18s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: min(760px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: popIn .26s var(--ease);
}
.modal-card.wide { width: min(920px, 100%); }
.modal-card.narrow { width: min(430px, 100%); }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.975); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-family: var(--font-serif); font-size: 18px; letter-spacing: .05em; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.modal-foot:empty { display: none; }
.modal-foot .spacer { flex: 1; }

/* 阅读详情 */
.read-head { margin-bottom: 14px; }
.read-date { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.read-date .date { font-family: var(--font-serif); font-size: 15px; font-weight: 650; color: var(--ink-2); letter-spacing: .04em; }
.read-title { font-family: var(--font-serif); font-size: 26px; font-weight: 700; margin: 10px 0 12px; line-height: 1.35; letter-spacing: .02em; }
.read-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px dashed var(--line); margin-bottom: 16px; }
.read-meta .pill { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; background: var(--bg-soft); color: var(--ink-2); }
.read-meta .pill.tag { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.read-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 18px; }
.read-gallery img { width: 100%; height: 132px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); cursor: zoom-in; transition: transform .2s var(--ease); }
.read-gallery img:hover { transform: scale(1.03); }
.read-foot { margin-top: 20px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--ink-4); display: flex; gap: 14px; flex-wrap: wrap; }

/* 模板 / 提示列表 */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tpl-card { padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--paper-2); text-align: left; transition: all .18s var(--ease); }
.tpl-card:hover { border-color: var(--accent-line); background: var(--accent-soft); transform: translateY(-2px); }
.tpl-card b { font-family: var(--font-serif); font-size: 15px; display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.tpl-card span { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; display: block; }
.prompt-box { text-align: center; padding: 14px 10px 6px; }
.prompt-box .q { font-family: var(--font-serif); font-size: 22px; line-height: 1.6; margin-bottom: 18px; letter-spacing: .02em; }
.prompt-box .hint { font-size: 12.5px; color: var(--ink-3); }

/* 快捷键表 */
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 22px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--ink-2); padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.key-row span:last-child { display: flex; gap: 4px; }

/* ---------- 灯箱 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; background: rgba(12, 10, 8, .86); animation: fadeIn .16s var(--ease); cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.lightbox-close { position: absolute; top: 18px; right: 18px; color: #fff; background: rgba(255, 255, 255, .12); }
.lightbox-close:hover { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: var(--radius); max-width: 340px;
  background: var(--ink); color: var(--bg); font-size: 13.5px;
  box-shadow: var(--shadow-md); animation: toastIn .28s var(--ease);
}
.toast.out { animation: toastOut .22s var(--ease) forwards; }
.toast .ico { width: 16px; height: 16px; }
.toast.ok .ico { color: #8FD3A5; }
.toast.err .ico { color: #F29A8F; }
.toast button { color: inherit; opacity: .75; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- 密码锁 ---------- */
.lock { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.lock::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%); }
.lock-card { position: relative; width: min(340px, 100%); text-align: center; animation: popIn .3s var(--ease); }
.lock-mark { width: 52px; height: 52px; margin: 0 auto 14px; color: var(--accent); }
.lock-mark svg { width: 100%; height: 100%; }
.lock-card h2 { font-family: var(--font-serif); font-size: 24px; letter-spacing: .1em; }
.lock-sub { font-size: 13px; color: var(--ink-3); margin: 6px 0 22px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 24px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-4); transition: all .16s var(--ease); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-pad button { height: 62px; width: 62px; justify-self: center; border-radius: 50%; font-family: var(--font-serif); font-size: 22px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: all .12s var(--ease); }
.pin-pad button:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.pin-pad button:active { transform: scale(.93); }
.pin-pad .pin-fn { font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--ink-3); }
.lock-msg { min-height: 20px; margin-top: 16px; font-size: 13px; color: var(--bad); }

/* ---------- 专注模式 ---------- */
body.focus .sidebar, body.focus .topbar, body.focus .memory-bar, body.focus .toolbar .seg, body.focus .toolbar .sep-end { display: none !important; }
body.focus .app { grid-template-columns: minmax(0, 1fr); }
body.focus .view { padding-top: 42px; }
body.focus .write-wrap { max-width: 780px; }
body.focus .editor { border-color: transparent; box-shadow: none; background: transparent; padding-left: 8px; padding-right: 8px; }
body.focus .editor-body textarea { min-height: 56vh; }
body.focus .editor-foot { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 6px; margin-top: 10px; }
.focus-exit { position: fixed; top: 18px; right: 22px; z-index: 60; }
body:not(.focus) .focus-exit { display: none; }

/* ---------- 响应式 ---------- */
.scrim { display: none; }
@media (max-width: 1120px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid .span-2 { grid-column: span 2; }
  .cal-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-side { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 80; width: 282px; max-width: 86vw; transform: translateX(-104%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .icon-btn.sidebar-close { display: inline-flex; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(20, 17, 14, .55); opacity: 0; pointer-events: none; transition: opacity var(--trans); }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .btn-new-sm { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 8px; }
  .page-title h1 { font-size: 19px; }
  .page-title p { display: none; }
  .search-box { width: auto; flex: 1; min-width: 0; margin-left: 0; }
  .search-box kbd { display: none; }
  .view { padding: 18px 16px 90px; }
  .editor { padding: 16px 16px 14px; border-radius: var(--radius-lg); }
  .title-input { font-size: 23px; }
  .editor-body[data-mode="split"] { grid-template-columns: 1fr; }
  .editor-body[data-mode="split"] textarea { border-right: 0; padding-right: 0; }
  .editor-body[data-mode="split"] .preview { padding-left: 0; border-top: 1px dashed var(--line); padding-top: 12px; }
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
  .stats-grid .span-2 { grid-column: span 1; }
  .cal-side { grid-template-columns: 1fr; }
  .cal-day { min-height: 64px; padding: 5px 5px; }
  .cal-day .d-title { display: none; }
  .cal-days, .cal-weekdays { gap: 4px; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .row { grid-template-columns: 74px 24px minmax(0, 1fr); }
  .row .r-meta { display: none; }
  .modal { padding: 12px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; align-items: center; }
  .set-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .set-ctl { justify-content: flex-start; }
  .btn-new { height: 42px; }
  .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .chips, .filter-right { width: 100%; max-width: 100%; min-width: 0; }
  .chips { flex: none; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips > * { flex: none; }
  .filter-right { justify-content: space-between; }
  .filter-selects { width: 100%; }
  .filter-selects .select { flex: 1; min-width: 0; }
  .toolbar .sep-end { display: none; }
  .toolbar-spacer { flex-basis: 100%; height: 0; }
  .toolbar .seg { margin-left: auto; }
}
@media (max-width: 420px) {
  .card-cover { height: 110px; }
  .mood-btn, .weather-btn { width: 30px; height: 30px; font-size: 16px; }
  .search-box { height: 36px; }
}

/* 打印：只输出正文 */
@media print {
  .sidebar, .topbar, .toolbar, .editor-foot, .filter-bar, .toasts, .modal-head, .modal-foot { display: none !important; }
  body, .app, .views { overflow: visible; height: auto; display: block; }
  .modal { position: static; background: none; padding: 0; }
  .modal-card { max-height: none; border: 0; box-shadow: none; }
}
