:root {
  color-scheme: dark;
  --bg: #1c1c1e;
  --panel: #252529;
  --panel-raised: #2c2c2e;
  --panel-soft: #343438;
  --line: rgba(255,255,255,.11);
  --line-soft: rgba(255,255,255,.07);
  --text: #f2f2f7;
  --text-muted: #a1a1a7;
  --text-faint: #73737a;
  --accent: #ffd60a;
  --accent-ink: #292300;
  --danger: #e89b91;
  --note-font-size: 14px;
  --note-opacity: .7;
  /* 表单底色/聚焦描边必须走变量：写死深色会在石墨红主题下变成黑块。 */
  --field-bg: #1c1c1e;
  --field-focus-border: #6b6b70;
  /* 目录栏与编辑区底色同样走变量，避免两处硬编码 #1c1c1e 在明亮模式下漏改。 */
  --list-bg: #1c1c1e;
  --editor-bg: #1c1c1e;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.theme-stone-dark { color-scheme: dark; --bg: #202124; --panel: #242528; --panel-raised: #303136; --panel-soft: #3b3c41; --line: rgba(255,255,255,.12); --line-soft: rgba(255,255,255,.08); --text: #eeeeee; --text-muted: #babcc0; --text-faint: #7f8289; --accent: #38a7e0; --accent-ink: #082431; --danger: #e89b91; --field-bg: #1c1c1e; --field-focus-border: #6b6b70; --list-bg: #1c1c1e; --editor-bg: #1c1c1e; }
body.theme-stone-light { color-scheme: light; --bg: #f7f7f6; --panel: #ffffff; --panel-raised: #f1f1ef; --panel-soft: #e7e7e4; --line: rgba(35,35,35,.14); --line-soft: rgba(35,35,35,.08); --text: #3a3a3a; --text-muted: #676767; --text-faint: #9b9b9b; --accent: #ee5d62; --accent-ink: #ffffff; --danger: #cf5449; --field-bg: #f1f1ef; --field-focus-border: #b9b9b4; --list-bg: #ffffff; --editor-bg: #ffffff; }
body.theme-stone-light .sidebar, body.theme-stone-light .modal-card { background: var(--panel); }
body.theme-stone-light .nav-item.active, body.theme-stone-light .note-item.active { background: #e8e8e5; }
body.theme-stone-light .note-item:hover, body.theme-stone-light .folder-header:hover, body.theme-stone-light .quiet-button:hover, body.theme-stone-light .privacy-button:hover { background: #eeeeeb; }
body.theme-stone-light .floating-controls { background: rgba(255,255,255,.88); }
body.theme-stone-light .heading-menu, body.theme-stone-light .note-context-menu, body.theme-stone-light .document-outline, body.theme-stone-light .wiki-suggest { background: #f2f2f0; border-color: rgba(55,55,55,.12); box-shadow: 0 10px 28px rgba(30,30,30,.11); }
body.theme-stone-light .toolbar button:hover, body.theme-stone-light .toolbar button.is-active, body.theme-stone-light .heading-menu button:hover, body.theme-stone-light .note-context-menu button:hover { background: #e2e2df; }
/* 明亮模式下这些控件原本沿用暗色写死值，会在白底上出现深色块 / 低对比文字。 */
body.theme-stone-light .secondary-button { background: #ffffff; border-color: rgba(35,35,35,.18); }
body.theme-stone-light .secondary-button:hover { background: #f4f4f1; }
body.theme-stone-light .danger-button { border-color: rgba(200,84,74,.42); }
body.theme-stone-light .quiet-chip { background: #f4f1ea; border-color: #ded7c8; }
body.theme-stone-light .toggle-row input { background: #d6d6d2; }
body.theme-stone-light .toggle-row input::after { background: #ffffff; }
body.theme-stone-light .toggle-row input:checked { background: color-mix(in srgb, var(--accent) 62%, #ffffff); }
body.theme-stone-light .toggle-row input:checked::after { background: #ffffff; }
body.theme-stone-light input[type="range"] { background: #dcdcd8; }
body.theme-stone-light input[type="range"]::-webkit-slider-thumb { border-color: #ffffff; }
body.theme-stone-light .note-context-menu, body.theme-stone-light .heading-menu { color: var(--text); }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
/* 主题变量挂在 body 上，:root 的 color 会用根变量先算成暗色；
   body 不重新声明 color 的话，所有继承文字色在明亮模式下仍是浅色（白底看不见字）。 */
body { min-height: 100vh; overflow: hidden; color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.app-root, .workspace { min-height: 100vh; }
.workspace { position: relative; }
.lock-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0%, #323238 0, var(--bg) 46%); }
.lock-card { width: min(100%, 320px); text-align: center; }
.lock-card .stack-form { margin-top: 0; }
.lock-card .text-button { margin-top: 10px; font-size: 11px; }
.brand-button { display: inline-flex; align-items: center; border: 0; background: transparent; color: #c8c6be; padding: 0; font-size: 13px; letter-spacing: .02em; cursor: default; user-select: none; }
.brand-wordmark { display: inline-block; color: #c8c6be; letter-spacing: .02em; white-space: nowrap; }
.brand-wordmark-large { color: var(--text); font-size: 25px; font-weight: 600; letter-spacing: -.035em; margin-bottom: 23px; }
.eyebrow { color: var(--text-faint); font-size: 10px; letter-spacing: .18em; margin: 0 0 10px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 28px; letter-spacing: -.04em; margin-bottom: 10px; }
h2 { font-size: 22px; letter-spacing: -.04em; margin: 0; }
.lock-card .muted { line-height: 1.7; font-size: 14px; }
.stack-form { display: grid; gap: 12px; margin-top: 26px; text-align: left; }
.stack-form label, .settings-form label { display: grid; gap: 8px; color: var(--text-muted); font-size: 13px; }
/* 排除单选/复选：它们不能继承 width:100% + 输入框内边距，否则会渲染成大方块。 */
/* 笔记标题与搜索框是"无框"输入，必须排除在整块输入框样式之外：
   这条规则优先级(0-5-1)高于 .note-title / .search-box input，不排除就会覆盖成深色底块。 */
input:not([type="radio"]):not([type="checkbox"]):not([type="range"]):not(.note-title):not(.search-input), select { width: 100%; border: 1px solid var(--line); background: var(--field-bg); color: var(--text); border-radius: 10px; padding: 12px 13px; outline: none; transition: border-color .15s, background .15s; }
input:not([type="radio"]):not([type="checkbox"]):not([type="range"]):not(.note-title):not(.search-input):focus, select:focus { border-color: var(--field-focus-border); background: var(--field-bg); }
/* 正文编辑区不能写 background：底色由 .editor-panel 提供。
   之前这条和输入框写在同一个选择器里、硬编码 #1c1c1e，石墨红主题一聚焦就整块变黑。 */
.editor-content:focus { background: transparent; }
input::placeholder { color: #62615d; }
input[type="radio"], input[type="checkbox"] { flex: 0 0 auto; width: auto; padding: 0; margin: 0; accent-color: var(--accent); }
/* 单选行必须压过 .stack-form label 的 display:grid，否则单选框会独占一行、文字掉到下一行。 */
.stack-form label.release-choice, .settings-form label.release-choice { display: flex; align-items: center; gap: 9px; }
.release-choice { color: var(--text-muted); font-size: 13px; }
.release-choice input { margin: 0; }
.primary-button, .secondary-button, .danger-button, .quiet-button, .privacy-button, .text-button { border: 0; border-radius: 9px; padding: 11px 15px; transition: transform .15s, background .15s, opacity .15s; }
.primary-button { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.secondary-button { background: #343438; color: var(--accent); border: 1px solid #4a4a4e; padding: 8px 11px; font-size: 12px; }
.quiet-button, .privacy-button { display: inline-flex; align-items: center; gap: 5px; background: transparent; color: var(--text-muted); padding: 6px 8px; }
.quiet-button .icon-slot, .privacy-button .icon-slot { width: 14px; height: 14px; }
.quiet-button:hover, .privacy-button:hover { color: var(--text); background: #343438; }
.text-button { background: transparent; color: var(--accent); margin-top: 18px; padding: 5px; }
.form-error { min-height: 17px; color: var(--danger); font-size: 12px; margin: 0; }
.security-caption { color: var(--text-faint); font-size: 11px; line-height: 1.6; margin: 20px 0 0; }

.topbar { display: none; }
.topbar-leading { display: flex; align-items: center; gap: 4px; height: 30px; }
.sidebar-toggle-button, .note-list-toggle-button { display: inline-grid; place-items: center; width: 30px; height: 30px; }
/* 统一图标：全部改用 24×24 / 1.75px 线宽的 SVG 图标，跟随 currentColor。 */
.ui-icon { display: block; flex: 0 0 auto; }
.icon-slot { display: inline-grid; place-items: center; width: 16px; height: 16px; color: inherit; }
.menu-icon-slot { display: inline-grid; place-items: center; width: 15px; height: 15px; color: inherit; opacity: .86; }
.brand-lockup { display: flex; align-items: center; gap: 9px; color: #c8c6be; font-size: 13px; letter-spacing: .03em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.save-state { color: var(--text-faint); font-size: 11px; min-width: 50px; text-align: right; }
.save-state.is-saving { color: var(--accent); }
.save-state.is-error { color: var(--danger); }
.editor-top-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-shell { --sidebar-width-base: 230px; --note-list-width-base: 320px; --sidebar-width: var(--sidebar-width-base); --note-list-width: var(--note-list-width-base); height: 100vh; min-width: 0; position: relative; display: grid; grid-template-columns: minmax(0, var(--sidebar-width)) minmax(0, var(--note-list-width)) minmax(0, 1fr); overflow: hidden; isolation: isolate; transition: grid-template-columns .2s ease; }
.sidebar, .note-list, .editor-panel { min-width: 0; }
.sidebar { overflow: hidden; border-right: 1px solid var(--line); background: #252529; display: flex; flex-direction: column; justify-content: flex-start; padding: 24px 14px 20px; transition: opacity .14s ease, padding .2s ease; }
.app-shell.sidebar-collapsed { --sidebar-width: 0px; }
.app-shell.note-list-collapsed { --note-list-width: 0px; }
.app-shell.sidebar-collapsed .sidebar, .app-shell.note-list-collapsed .note-list { visibility: hidden; opacity: 0; pointer-events: none; border: 0; }
.app-shell.sidebar-collapsed .sidebar { padding-left: 0; padding-right: 0; }
.app-shell.note-list-collapsed .note-list { overflow: hidden; }
.column-resizer { position: absolute; z-index: 12; top: 0; bottom: 0; width: 10px; margin-left: -5px; cursor: col-resize; touch-action: none; }
.column-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background .15s; }
.column-resizer:hover::after, .is-resizing-columns .column-resizer::after { background: rgba(255,255,255,.3); }
.sidebar-resizer { left: var(--sidebar-width); }
.note-list-resizer { left: calc(var(--sidebar-width) + var(--note-list-width)); }
.sidebar-collapsed .sidebar-resizer, .note-list-collapsed .note-list-resizer { display: none; }
body.is-resizing-columns, body.is-resizing-columns * { cursor: col-resize !important; user-select: none !important; }
.sidebar-inner { display: flex; flex-direction: column; min-height: 100%; gap: 8px; }
.sidebar-brand { width: max-content; border: 0; background: transparent; color: var(--text); padding: 2px 9px 10px; font-size: 13px; font-weight: 700; letter-spacing: -.02em; cursor: default; }
.space-heading { display: flex; align-items: center; justify-content: space-between; color: var(--text-faint); font-size: 10px; letter-spacing: .14em; padding: 0 10px 2px; }
.space-add { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--text-muted); }
.space-add:hover { color: var(--accent); background: var(--panel-soft); }
.space-items { display: grid; gap: 3px; }
.space-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.nav-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 1px solid transparent; color: var(--text-muted); background: transparent; text-align: left; border-radius: 9px; padding: 10px; font-size: 13px; }
.nav-item.active { background: #48484a; color: var(--text); border-color: transparent; }
.nav-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 16px; height: 16px; color: var(--text-faint); }
.nav-item.active .nav-icon { color: var(--text-muted); }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,214,10,.12); }
.nav-dot-muted { background: #8e8e93; box-shadow: 0 0 0 3px rgba(142,142,147,.15); }
.nav-count { margin-left: auto; color: var(--text-faint); font-size: 11px; }
/* 回收站上锁时在计数前显示一把小锁，否则用户点进去才知道要密码。 */
.nav-lock { display: inline-grid; place-items: center; margin-left: auto; color: var(--accent); opacity: .85; }
.nav-lock + .nav-count { margin-left: 6px; }
.sidebar-calendar { margin-top: auto; padding: 10px 9px 8px; border: 1px solid var(--line-soft); border-radius: 13px; background: color-mix(in srgb, var(--panel-raised) 72%, transparent); box-shadow: inset 0 1px rgba(255,255,255,.035); backdrop-filter: blur(12px); }
.calendar-head { display: grid; grid-template-columns: 22px 1fr 22px; align-items: center; gap: 3px; }
.calendar-month { color: var(--text); font-size: 11px; font-weight: 700; text-align: center; letter-spacing: .01em; }
.calendar-nav { width: 22px; height: 20px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 17px; line-height: 1; }
.calendar-nav:hover { color: var(--accent); background: var(--panel-soft); }
.calendar-scope { width: 100%; height: 25px; margin: 6px 0 7px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); padding: 2px 4px; font-size: 10px; }
.calendar-scope:hover, .calendar-scope:focus { background: var(--panel-soft); }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.calendar-weekdays { margin-bottom: 3px; color: var(--text-faint); font-size: 9px; font-weight: 650; }
.calendar-day { display: grid; place-items: center; width: 100%; aspect-ratio: 1; min-height: 19px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 10px; font-weight: 600; }
.calendar-day:not(.calendar-day-empty):hover { color: var(--text); background: var(--panel-soft); }
.calendar-day.has-notes { color: var(--accent); }
.calendar-day.has-notes::after { content: ""; position: absolute; width: 3px; height: 3px; border-radius: 50%; background: currentColor; transform: translateY(7px); }
.calendar-day { position: relative; }
.calendar-day.is-today { color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent); }
.calendar-day.is-selected { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.calendar-day.is-selected::after { background: var(--accent-ink); }
.calendar-popover { position: absolute; z-index: 60; left: 13px; bottom: 58px; width: 224px; margin: 0; border-color: var(--line); background: color-mix(in srgb, var(--panel-raised) 92%, transparent); box-shadow: 0 16px 42px rgba(0,0,0,.3); }

.note-list { border-right: 1px solid var(--line); background: var(--list-bg); overflow: auto; transition: opacity .14s ease; }
.list-heading { display: flex; align-items: flex-end; justify-content: space-between; padding: 25px 20px 16px; }
.list-heading h2 { color: var(--text); font-size: var(--note-font-size); font-weight: 650; line-height: 1.5; opacity: var(--note-opacity); }
.list-actions { display: flex; align-items: center; gap: 7px; }
.small-action { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text-muted); padding: 6px 9px; font-size: 10px; }
.small-action .icon-slot { width: 14px; height: 14px; }
.small-action:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--panel-soft); }
.round-button { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); transition: background .15s, color .15s; }
.round-button:hover, .round-button:focus-visible { background: var(--panel-soft); color: var(--accent); outline: none; }
/* 搜索不要方框：放大镜与输入文字同色，下方一条分割线收口。 */
.search-box { display: flex !important; align-items: center; gap: 8px !important; margin: 0 16px 12px; padding: 0 2px 8px; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: transparent; color: var(--text-muted); transition: border-color .15s, color .15s; }
.search-box:focus-within { border-bottom-color: var(--line); color: var(--text); }
.search-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 16px; height: 16px; color: inherit; opacity: .85; }
.search-box input { width: 100%; border: 0; padding: 0; background: transparent; color: inherit; font-size: 12px; outline: none; }
.search-box input::placeholder { color: var(--text-faint); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
.list-options { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px 12px; color: var(--text-faint); font-size: 10px; }
.list-options select { width: auto; min-width: 96px; border: 0; background: transparent; padding: 3px 0; color: var(--text-muted); font-size: 10px; }
.note-items { padding: 0 9px 20px; }
.folder-section { margin-bottom: 7px; }
.folder-header-row { display: flex; align-items: center; gap: 3px; }
.folder-header { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; position: relative; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); padding: 8px 24px 7px 9px; text-align: left; }
.folder-header:hover { background: #343438; color: var(--text); }
.folder-chevron { display: inline-grid; place-items: center; flex: 0 0 14px; width: 14px; height: 14px; color: var(--accent); }
.folder-chevron .ui-icon { transition: transform .15s ease; }
.folder-header[aria-expanded="true"] .folder-chevron .ui-icon { transform: rotate(90deg); }
.folder-name { flex: 1; min-width: 0; overflow: hidden; font-size: 11px; line-height: 1.2; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.folder-count { color: var(--text-faint); font-size: 10px; line-height: 1.2; }
.folder-add { display: inline-grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-faint); }
.folder-add:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--panel-soft); color: var(--accent); }
.folder-rename-input { flex: 1; min-width: 0; width: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-raised); color: var(--text); padding: 3px 6px; font-size: 11px; }
.folder-notes { padding-left: 5px; }
.folder-section.is-collapsed .folder-notes { display: none; }
.folder-inline-draft { padding: 2px 5px 6px; }
.folder-inline-draft input { border-radius: 7px; padding: 7px 9px; font-size: 11px; background: var(--panel-raised); }
.folder-inline-draft input[aria-invalid="true"] { border-color: var(--danger); }
.note-item { position: relative; display: block; width: 100%; border: 1px solid transparent; border-radius: 10px; padding: 12px 26px 12px 11px; background: transparent; text-align: left; color: var(--text); margin-bottom: 3px; }
.note-item:hover { background: #2c2c2e; }
.note-item.active { background: #48484a; border-color: transparent; }
.note-item-title { display: block; font-size: var(--note-font-size); font-weight: 650; opacity: var(--note-opacity); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.note-pin { display: inline-flex; align-items: center; gap: 3px; margin: -1px 0 4px; border-radius: 4px; color: var(--accent); font-size: 9px; font-weight: 650; letter-spacing: .03em; }
.note-item-preview { display: block; color: var(--text-muted); font-size: var(--note-font-size); opacity: calc(var(--note-opacity) * .9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.45; }
.note-item-time { display: block; color: var(--text-faint); font-size: 10px; margin-top: 8px; }

/* 回收站批量操作栏 */
.batch-bar { display: flex; align-items: center; gap: 8px; margin: 0 9px 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-raised); }
.batch-all { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 11px; white-space: nowrap; cursor: pointer; }
.batch-all input { appearance: none; flex: 0 0 auto; width: 15px; height: 15px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: transparent; position: relative; cursor: pointer; }
.batch-all input:checked { border-color: var(--accent); background: var(--accent); }
.batch-all input:checked::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid var(--accent-ink); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
.batch-all input:indeterminate { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 30%, transparent); }
/* 部分选中用一道横杠表示，跟"全部选中"的对勾区分开。 */
.batch-all input:indeterminate::after { content: ""; position: absolute; left: 3.5px; top: 6.2px; width: 6px; height: 1.8px; border-radius: 2px; background: var(--accent); }
.batch-count { flex: 1; min-width: 0; color: var(--text-faint); font-size: 10px; text-align: right; }
.batch-actions { display: flex; align-items: center; gap: 5px; }
.batch-actions .danger-button { padding: 6px 9px; font-size: 10px; }
.batch-actions .quiet-button { padding: 6px 7px; font-size: 10px; }
.batch-actions .danger-button:disabled, .batch-actions .quiet-button:disabled { opacity: .45; cursor: not-allowed; }
/* 回收站列表项左侧的选择框 */
.note-select { position: absolute; left: 9px; top: 13px; display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: transparent; }
.note-select svg { width: 11px; height: 11px; }
.note-select.is-checked { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.note-item.is-selectable { padding-left: 33px; }
.note-item.is-selected { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.note-item.is-selectable .drag-handle { display: none; }
.empty-state { padding: 28px 20px; color: var(--text-faint); font-size: 12px; line-height: 1.6; }
.sidebar-scrim { display: none; }

/* 拖动排序：桌面端悬停显示抓取手柄、整行可拖；触屏端手柄常显。 */
.space-item { position: relative; padding-right: 26px; }
.drag-handle { position: absolute; top: 50%; right: 3px; display: none; place-items: center; width: 20px; height: 24px; transform: translateY(-50%); color: var(--text-faint); opacity: .58; cursor: grab; touch-action: none; }
@media (hover: hover) and (pointer: fine) {
  .note-item:hover .drag-handle, .space-item:hover .drag-handle, .folder-header:hover .drag-handle { display: inline-grid; }
}
@media (pointer: coarse) {
  .drag-handle { display: inline-grid; opacity: .5; }
}
.is-reorder-source { opacity: .42; }
.reorder-indicator { position: fixed; z-index: 90; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); transform: translateY(-1px); pointer-events: none; }
body.is-reordering, body.is-reordering * { cursor: grabbing !important; user-select: none !important; }
.context-hint { margin: 2px 6px 4px; color: var(--text-faint); font-size: 10px; line-height: 1.5; }
.floating-controls { position: absolute; z-index: 30; left: 14px; bottom: 14px; display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: rgba(48,49,54,.88); backdrop-filter: blur(10px); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.floating-settings-button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); font-size: 17px; line-height: 1; }
.floating-settings-button:hover, .floating-settings-button:focus-visible { background: var(--panel-soft); color: var(--text); outline: none; }
.note-context-menu { position: fixed; z-index: 80; width: 218px; max-height: min(70vh, 420px); overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-raised); box-shadow: 0 14px 40px rgba(0,0,0,.32); backdrop-filter: blur(18px); }
.note-context-menu button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); text-align: left; padding: 7px 10px; font-size: 12px; }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-context-menu button:disabled { opacity: .42; cursor: not-allowed; }
.note-context-menu button:hover, .note-context-menu button:focus-visible { background: var(--panel-soft); color: var(--text); outline: none; }
.note-context-menu button.danger { color: var(--danger); }
.context-divider { height: 1px; margin: 4px 5px; background: var(--line); }
.context-submenu { margin: 0 0 4px 10px; padding-left: 5px; border-left: 1px solid #454139; }

.editor-panel { display: flex; flex-direction: column; overflow: hidden; background: var(--editor-bg); padding: 20px clamp(22px, 6vw, 96px) 16px; }
.editor-topline { min-width: 0; height: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor-top-actions { min-width: 0; display: flex; align-items: center; gap: 8px; }
.editor-icon-button { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); }
.editor-icon-button:hover, .editor-icon-button.is-active { background: var(--panel-soft); color: var(--accent); }
.editor-delete-button { color: var(--danger); }
.editor-delete-button:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.editor-icon-button .icon-slot { width: 16px; height: 16px; }
.note-timestamps { min-width: 0; color: var(--text-faint); font-size: 10px; letter-spacing: .01em; opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-picker select { width: auto; max-width: 140px; border: 1px solid transparent; background: transparent; color: var(--text-faint); padding: 5px 7px; font-size: 10px; }
.folder-picker select:hover, .folder-picker select:focus { border-color: var(--line); color: var(--text-muted); }
.privacy-button { border: 1px solid transparent; font-size: 11px; }
.privacy-button.is-active { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.directory-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); }
.directory-empty .directory-symbol { display: grid; place-items: center; width: 50px; height: 50px; border: 1px solid #474137; border-radius: 16px; color: var(--accent); font-size: 24px; margin-bottom: 18px; }
.directory-empty h2 { color: var(--text); font-size: 20px; margin-bottom: 8px; }
.directory-empty p:last-child { max-width: 260px; font-size: 12px; line-height: 1.7; }
.editor-panel.directory-mode > :not(.directory-empty) { display: none; }
.editor-panel:not(.directory-mode) .directory-empty { display: none; }
/* 标题不要方框，只用一条分割线与正文隔开。 */
.note-title { width: 100%; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: transparent; padding: 14px 0 11px; margin-bottom: 4px; color: var(--text); font-size: var(--note-font-size); line-height: 1.85; font-weight: 650; letter-spacing: -.01em; opacity: var(--note-opacity); outline: none; transition: opacity .2s, font-size .15s, border-color .15s; }
.note-title:focus { border-bottom-color: var(--line); background: transparent; }
.note-title::placeholder { color: var(--text-faint); }
/* 工具栏不要椭圆底框：保持一条轻量的图标行，弱化到不抢编辑区注意力。 */
.toolbar { position: relative; z-index: 5; display: flex; align-items: center; gap: 1px; align-self: flex-start; max-width: 100%; min-height: 32px; margin: 6px 0 5px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.toolbar button { border: 0; background: transparent; color: var(--text-faint); min-width: 28px; height: 28px; border-radius: 7px; padding: 0 5px; font-size: 13px; line-height: 1; transition: background .15s, color .15s; }
.toolbar button:hover, .toolbar button.is-active { background: var(--panel-soft); color: var(--text); }
.heading-menu-wrap { position: relative; }
.heading-menu { position: absolute; z-index: 100; top: 32px; left: 0; width: 162px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-raised); box-shadow: 0 14px 34px rgba(0,0,0,.32); }
.heading-menu button { display: flex; align-items: center; gap: 8px; width: 100%; height: 28px; padding: 0 8px; border-radius: 6px; text-align: left; font-size: 11px; }
.heading-menu button span { width: 20px; color: var(--accent); font-weight: 700; }
.toolbar-divider { width: 1px; height: 15px; background: var(--line); margin: 0 3px; }
.editor-content { flex: 1; min-height: 100px; overflow: auto; padding: 18px 2px; color: var(--text); font-size: var(--note-font-size); line-height: 1.85; opacity: var(--note-opacity); outline: none; transition: opacity .2s, filter .2s, font-size .15s; }
.editor-content:empty::before { content: attr(data-placeholder); color: var(--text-faint); pointer-events: none; }
.editor-content p { margin: 0 0 10px; }
/* WebKit 在裸文本上按回车生成的是 <div>，必须和 <p> 用同样的段落间距，
   否则回车换行的两行会紧贴在一起。 */
.editor-content > div { margin: 0 0 10px; }
.editor-content h1, .editor-content h2, .editor-content h3 { margin: 1.15em 0 .55em; color: inherit; font-weight: 700; line-height: 1.55; }
.editor-content h1 { font-size: calc(var(--note-font-size) + 2px); }
.editor-content h2 { font-size: calc(var(--note-font-size) + 1px); }
.editor-content h3 { font-size: var(--note-font-size); }
.todo-line { display: flex; align-items: flex-start; gap: 7px; width: 100%; margin: 0 0 9px; min-height: 1.85em; }
.todo-checkbox { display: inline-grid; place-items: center; flex: 0 0 auto; width: 1.05em; height: 1.05em; margin-top: .39em; border: 1px solid #777169; border-radius: 3px; color: transparent; cursor: pointer; line-height: 1; text-align: center; user-select: none; }
.todo-checkbox[aria-checked="true"] { border-color: var(--text-muted); background: transparent; color: var(--text-muted); }
.todo-text { display: block; flex: 1; min-width: 1em; min-height: 1.85em; outline: none; }
.todo-line:has(.todo-checkbox[aria-checked="true"]) .todo-text { color: var(--text-faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.editor-content blockquote { margin: 14px 0; border-left: 2px solid var(--accent); padding: 2px 0 2px 16px; color: var(--text-muted); }
/* 粘贴 Markdown 会带进代码块、行内代码和外链，样式跟着主题走变量。 */
.editor-content pre { margin: 14px 0; padding: 12px 14px; background: var(--panel-raised); border: 1px solid var(--line-soft); border-radius: 8px; overflow-x: auto; white-space: pre; }
.editor-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--panel-soft); border-radius: 4px; padding: 1px 5px; }
.editor-content pre code { background: none; padding: 0; border-radius: 0; }
.editor-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.editor-content s { opacity: .72; }
.editor-content ul, .editor-content ol { padding-left: 26px; }
.editor-content li { padding-left: 4px; }
.editor-content ul.todo-list { list-style: none; padding-left: 0; margin: 0; }
.editor-content ul.todo-list > li { list-style: none; padding-left: 0; }
.editor-content ul.todo-list > li::marker { content: ""; }
.editor-content ul.todo-list ul.todo-list { margin-top: 2px; padding-left: 24px; }
.editor-content hr { border: 0; border-top: 1px solid currentColor; opacity: .38; margin: 1.3em 0; }
.fold-block { margin: 12px 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.fold-block summary { color: var(--text-muted); cursor: pointer; font-size: .92em; outline: none; }
.fold-block > div { min-height: 1.85em; padding: 8px 0 0 16px; }
.editor-footer { display: flex; justify-content: space-between; gap: 12px; color: var(--text-faint); font-size: 10px; padding-top: 12px; }
.editor-hint { opacity: .75; }

/* 双链笔记：[[标题]] 在正文里渲染成一条带下划线的链接。 */
/* 双链是"药丸"：contenteditable=false 让它成为不可拆分的原子内联元素。
   WebKit 会顺着前面的内联元素继续输入（后续文字、回车换行都会被染成链接色），
   只有把药丸设成不可编辑才能彻底断掉这条继承链。 */
.wiki-link { display: inline; color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 3px; cursor: pointer; white-space: nowrap; }
.wiki-link:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.wiki-suggest { position: fixed; z-index: 70; width: min(260px, calc(100vw - 24px)); max-height: 190px; overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-raised); box-shadow: 0 14px 34px rgba(0,0,0,.32); }
.wiki-suggest-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 12px; text-align: left; }
.wiki-suggest-item.is-active, .wiki-suggest-item:hover { background: var(--panel-soft); color: var(--text); }
.wiki-suggest-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki-suggest-tag { flex: 0 0 auto; color: var(--accent); font-size: 9px; letter-spacing: .04em; }
.backlink-panel { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.backlink-heading { margin: 0 0 8px; color: var(--text-faint); font-size: 10px; letter-spacing: .18em; }
.backlink-items { display: flex; flex-wrap: wrap; gap: 6px; }
.backlink-item { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backlink-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--panel-soft); color: var(--text); }
.backlink-item .backlink-label { overflow: hidden; text-overflow: ellipsis; }
.backlink-space { flex: 0 0 auto; color: var(--text-faint); font-size: 9px; letter-spacing: .04em; }
/* 反链/双链的跳转提示条 */
.backlink-locked { color: var(--text-faint); font-size: 10px; line-height: 1.6; }
.privacy-mode .editor-content, .privacy-mode .note-title { text-shadow: 0 0 1px rgba(255,255,255,.12); }
.window-blurred .privacy-sensitive { filter: blur(6px); opacity: .08 !important; }
.manual-blur .privacy-sensitive { filter: blur(7px); opacity: .07 !important; }

.modal-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.72); backdrop-filter: blur(10px); overflow: auto; }
.modal-card { width: min(100%, 480px); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid rgba(255,255,255,.13); border-radius: 16px; background: #252529; box-shadow: 0 24px 80px rgba(0,0,0,.5); padding: 22px; }
.setup-card { width: min(100%, 450px); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-heading h2 { font-size: 24px; }
.modal-intro { font-size: 13px; line-height: 1.7; margin: 15px 0 2px; }
/* 应用内对话框：macOS 原生 confirm 在 Tauri 里不可用，所有确认走这里。
   它可能叠加在「删除空间」等其它 modal-backdrop 之上，必须比普通弹窗更高，
   否则下层弹窗的控件会拦截点击，出现「确认框点了没反应」。 */
#app-dialog { z-index: 120; }
.dialog-card { width: min(100%, 452px); display: grid; }
.dialog-card h2 { font-size: 20px; margin: 0; }
.dialog-card .eyebrow { margin: 0 0 9px; }
#app-dialog-message { font-size: 13px; line-height: 1.75; margin: 13px 0 0; }
.dialog-field { display: grid; gap: 8px; margin-top: 17px; color: var(--text-muted); font-size: 13px; }
.dialog-inputs { display: grid; gap: 12px; margin-top: 17px; }
.dialog-inputs:empty { display: none; }
.dialog-inputs label { display: grid; gap: 7px; color: var(--text-muted); font-size: 13px; }
.dialog-note { margin: 8px 0 0; color: var(--text-faint); font-size: 11.5px; line-height: 1.6; }
.dialog-choices { display: grid; gap: 8px; margin-top: 17px; }
.dialog-choice { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text-muted); font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s; }
.dialog-choice:hover { background: var(--panel-soft); }
.dialog-choice input { flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--accent); }
.dialog-choice-text { display: grid; gap: 3px; min-width: 0; }
.dialog-choice-text strong { color: var(--text); font-size: 13px; font-weight: 600; }
.dialog-choice-hint { color: var(--text-faint); font-size: 11.5px; line-height: 1.55; }
.dialog-choice:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 58%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-actions .primary-button, .dialog-actions .danger-button, .dialog-actions .secondary-button { padding: 11px 16px; font-size: 12.5px; }
#app-dialog-error { margin: 14px 0 0; }
#app-dialog-error:empty { display: none; }

/* 跨空间拖动：悬停在左侧空间条目上时的落点提示。 */
.space-item.is-drop-target { background: color-mix(in srgb, var(--accent) 20%, transparent); outline: 1px solid color-mix(in srgb, var(--accent) 62%, transparent); color: var(--text); }
.space-item[data-drop-hint]::after { content: attr(data-drop-hint); margin-left: auto; color: var(--accent); font-size: 10px; line-height: 1.2; white-space: nowrap; }
.quiet-chip { border: 1px solid #3b372f; color: var(--accent); background: #27231d; border-radius: 99px; padding: 5px 8px; font-size: 10px; white-space: nowrap; }
.form-rule, .settings-divider { height: 1px; background: var(--line); margin: 5px 0; }
.advanced-settings { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2px; }
.advanced-settings summary { color: var(--text-muted); cursor: pointer; font-size: 12px; margin-bottom: 12px; }
.advanced-settings[open] { display: grid; gap: 12px; }
.advanced-settings[open] summary { margin-bottom: 0; }
.settings-card { width: min(100%, 520px); }
.settings-form { display: grid; gap: 14px; margin-top: 18px; }
.settings-form label > span:first-child, .sync-heading span { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.settings-form strong { color: var(--text); font-size: 12px; font-weight: 650; }
.settings-form small { color: var(--text-faint); font-size: 10px; line-height: 1.5; }
.theme-row { align-items: center; }
.theme-switch { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-raised); }
.theme-switch button { display: grid; place-items: center; width: 28px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); }
.theme-switch button.is-active { color: var(--accent); background: var(--panel-soft); }
.toggle-row, .select-row { display: flex !important; align-items: center; justify-content: space-between; gap: 18px; }
.toggle-row > span, .select-row > span { display: grid; gap: 4px; }
.toggle-row input { appearance: none; width: 40px; height: 23px; padding: 0; border-radius: 99px; background: #343434; border: 0; position: relative; flex: 0 0 auto; cursor: pointer; }
.toggle-row input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #aaa; transition: transform .15s, background .15s; }
.toggle-row input:checked { background: #715f47; }
.toggle-row input:checked::after { transform: translateX(17px); background: #f4e7d4; }
.range-row { gap: 9px !important; }
.range-row output { color: var(--accent); font-size: 11px; }
input[type="range"] { appearance: none; height: 3px; border: 0; padding: 0; border-radius: 4px; background: #3a3833; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #191919; background: var(--accent); }
input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }
.sync-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sync-heading > div { display: grid; gap: 4px; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 3px; }
.location-picker-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.location-picker-row p { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-line; line-height: 1.55; }
.location-picker-row .secondary-button { flex: 0 0 auto; }
.settings-inline-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.settings-inline-actions .secondary-button { padding: 8px 11px; font-size: 11px; }
.settings-location-row { border-top: 1px solid var(--line); padding-top: 12px; }
.editor-top-actions { display: flex; align-items: center; gap: 9px; }
.editor-top-actions .quiet-button { padding: 6px 8px; font-size: 11px; }
.editor-content[contenteditable="false"] { cursor: default; }
.danger-button { background: transparent; border: 1px solid #533530; color: var(--danger); font-size: 11px; padding: 10px 12px; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 30px; border: 0; background: transparent; color: var(--text-muted); width: 30px; height: 30px; border-radius: 8px; font-size: 20px; line-height: 1; padding: 0; }
.icon-button:hover { color: var(--text); background: var(--panel-soft); }
.screen-cover { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; background: #131313; color: #55534e; }
.cover-mark { font-family: Georgia, serif; font-size: 15px; letter-spacing: .08em; opacity: .5; }
.mobile-only { display: none; }

.sidebar, .note-list, .editor-content, .modal-card { scrollbar-width: thin; scrollbar-color: rgba(128,128,128,.18) transparent; }
.sidebar::-webkit-scrollbar, .note-list::-webkit-scrollbar, .editor-content::-webkit-scrollbar, .modal-card::-webkit-scrollbar { width: 3px; height: 3px; }
.sidebar::-webkit-scrollbar-thumb, .note-list::-webkit-scrollbar-thumb, .editor-content::-webkit-scrollbar-thumb, .modal-card::-webkit-scrollbar-thumb { background: rgba(128,128,128,.18); border-radius: 99px; }
.sidebar::-webkit-scrollbar-thumb:hover, .note-list::-webkit-scrollbar-thumb:hover, .editor-content::-webkit-scrollbar-thumb:hover, .modal-card::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,.34); }

.document-outline { position: absolute; z-index: 18; right: 16px; top: 50%; transform: translateY(-50%); max-width: min(220px, 32vw); padding: 7px 5px; border: 1px solid transparent; border-radius: 12px; background: color-mix(in srgb, var(--panel-raised) 76%, transparent); backdrop-filter: blur(12px); box-shadow: 0 8px 28px rgba(0,0,0,.12); opacity: .76; transition: width .18s, opacity .18s, background .18s; }
.document-outline:hover, .document-outline:focus-within { opacity: 1; background: var(--panel-raised); border-color: var(--line); }
.document-outline-items { display: grid; gap: 4px; }
.document-outline-item { display: flex; align-items: center; gap: 7px; width: 18px; height: 9px; overflow: hidden; border: 0; border-radius: 5px; background: transparent; color: var(--text-muted); padding: 0 3px; text-align: left; transition: width .18s, height .18s, background .15s; }
.document-outline:hover .document-outline-item, .document-outline:focus-within .document-outline-item { width: min(196px, 28vw); height: 23px; padding: 0 6px; }
.outline-tick { display: block; flex: 0 0 auto; width: 11px; height: 2px; border-radius: 9px; background: var(--text-faint); opacity: .72; }
.level-1 .outline-tick { width: 13px; background: var(--accent); }
.level-2 .outline-tick { width: 10px; }
.level-3 .outline-tick { width: 7px; }
.outline-label { min-width: 0; overflow: hidden; opacity: 0; font-size: 11px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; transition: opacity .12s; }
.document-outline:hover .outline-label, .document-outline:focus-within .outline-label { opacity: 1; }
.document-outline-item:hover { background: var(--panel-soft); color: var(--text); }

/* Keep the calendar out of the navigation until the compact launcher is used. */
#sidebar-calendar { display: none; }
.calendar-popover { border-radius: 13px; padding: 10px; background: color-mix(in srgb, var(--panel-raised) 94%, transparent); }

/* Four bottom controls share the same quiet, 1.5px line-icon language. */
.floating-controls { gap: 2px; padding: 3px; border-color: color-mix(in srgb, var(--line) 72%, transparent); border-radius: 10px; background: rgba(44,44,46,.82); box-shadow: 0 8px 24px rgba(0,0,0,.16); }
.floating-controls .icon-button, .floating-controls .floating-settings-button { display: inline-grid; place-items: center; width: 29px; height: 29px; border-radius: 7px; color: var(--text-muted); }
.floating-controls .icon-button:hover, .floating-controls .icon-button.is-active, .floating-controls .floating-settings-button:hover { background: var(--panel-soft); color: var(--accent); }

/* The formatting surface stays available, but no longer competes with the note. */
.toolbar { padding: 3px 2px; margin: 2px 0 4px; }
.toolbar button { opacity: .82; }
.toolbar button:hover, .toolbar button.is-active { opacity: 1; }

@media (max-width: 980px) {
  .app-shell { --sidebar-width-base: min(196px, 28vw); --note-list-width-base: min(272px, 38vw); }
  .editor-panel { padding-left: 35px; padding-right: 35px; }
}

@media (max-width: 760px) {
  body { overflow: hidden; }
  .topbar { height: 46px; padding: 0 10px; }
  .top-actions { gap: 2px; }
  .save-state { display: none; }
  .brand-lockup { font-size: 12px; }
  .app-shell { height: 100vh; display: block; position: relative; overflow: visible; }
  .sidebar { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(82vw, 285px); padding: 26px 14px 20px; border-right: 1px solid var(--line); box-shadow: 12px 0 32px rgba(0,0,0,.35); transform: translateX(-105%); transition: transform .2s ease; }
  .app-shell.sidebar-collapsed .sidebar, .app-shell.note-list-collapsed .note-list { visibility: visible; opacity: 1; pointer-events: auto; }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  /* 抽屉打开时不要把整个界面压暗：侧边栏自带阴影已足够表达层级，
     这层只负责"点空白处关闭"，因此保持透明。 */
  .sidebar-scrim { position: fixed; z-index: 40; display: none; inset: 0; width: 100%; border: 0; border-radius: 0; background: transparent; }
  .workspace.sidebar-open #sidebar-scrim { display: block; }
  .note-list-scrim { z-index: 54; }
  .workspace.note-list-open #note-list-scrim { display: block; }
  .note-list, .editor-panel { height: 100%; border: 0; }
  .note-list { display: none; }
  .app-shell.note-list-open .note-list { position: fixed; z-index: 55; display: block; top: 12px; bottom: 58px; left: 12px; width: min(88vw, 360px); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 48px rgba(0,0,0,.42); background: var(--panel); }
  .editor-panel { display: none; padding: 20px 18px 14px; }
  .mobile-list-view .note-list { display: block; }
  .mobile-editor-view .editor-panel { display: flex; }
  .mobile-editor-view .note-list { display: none; }
  .mobile-only { display: inline-grid; place-items: center; }
  .note-title { padding-top: 18px; }
  .toolbar { padding-top: 11px; }
  .editor-content { padding-top: 19px; }
  .list-heading { padding: 25px 18px 16px; }
  .search-box { margin-left: 14px; margin-right: 14px; }
  .note-items { padding-left: 7px; padding-right: 7px; }
  .list-actions { gap: 4px; }
  .small-action { padding-left: 6px; padding-right: 6px; }
  .editor-top-actions { gap: 3px; }
  .folder-picker select { max-width: 100px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal-card { max-height: 92vh; border-radius: 17px 17px 0 0; padding: 23px 19px 28px; }
  .settings-actions { align-items: stretch; flex-direction: column-reverse; }
  .settings-actions button { width: 100%; }
  .location-picker-row { align-items: stretch; flex-direction: column; }
  .location-picker-row .secondary-button { align-self: flex-start; }
  .note-context-menu { width: min(218px, calc(100vw - 16px)); }
  .floating-controls { left: 12px; bottom: 12px; z-index: 70; }
  .sidebar-calendar { margin-top: 14px; }
  .calendar-popover { left: 12px; bottom: 57px; width: min(224px, calc(100vw - 24px)); }
  .column-resizer { display: none; }
}
