/* ============================================================
   便签项目 · 全局样式
   M1：设计变量 / 登录页九宫格 / 顶栏与按钮
   ============================================================ */

:root {
  --bg:          #f7f7f5;
  --surface:     #ffffff;
  --surface-2:   #f1f1ee;
  --surface-3:   #e9e9e4;
  --border:      #e3e3de;
  --border-2:    #d3d3cc;
  --text:        #2c2c2a;
  --text-2:      #6e6e67;
  --text-3:      #9c9c94;
  --accent:      #2f6fed;
  --accent-soft: #e8f0fe;
  --danger:      #d23f3f;
  --danger-soft: #fcebeb;
  --ok:          #1f9a63;
  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.muted { color: var(--text-3); font-size: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #2a63d6; border-color: #2a63d6; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ---------- 登录页 ---------- */
.page-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 26px 20px;
}

.login-head { text-align: center; margin-bottom: 20px; }
.login-title { font-size: 17px; font-weight: 500; margin: 0 0 6px; letter-spacing: .02em; }
.login-sub { font-size: 13px; color: var(--text-2); margin: 0; }

.lock-wrap { display: flex; justify-content: center; }
.lock-wrap.shake { animation: lock-shake .32s ease-in-out; }

@keyframes lock-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  50%      { transform: translateX(6px); }
  80%      { transform: translateX(-3px); }
}

.lock {
  width: min(76vw, 268px);
  height: auto;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.lock.is-locked { opacity: .4; }

.lock-dot {
  fill: var(--surface-2);
  stroke: var(--border-2);
  stroke-width: 1.5;
  transition: fill .12s ease, stroke .12s ease, r .12s ease;
}
.lock-dot.on { fill: var(--accent); stroke: var(--accent); }

.login-status {
  min-height: 21px;
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
}
.login-status.error { color: var(--danger); }
.login-status.ok    { color: var(--ok); }

.setup-key { margin-top: 12px; }
.setup-key input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 8px 11px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}
.setup-key input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.login-foot { margin-top: 14px; text-align: center; min-height: 18px; }

/* ---------- 主页面 ---------- */
.page-app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 247, 245, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-title { font-size: 15px; font-weight: 500; margin: 0; flex: 0 0 auto; }
.topbar-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ---------- 搜索框 ---------- */
.search-wrap { position: relative; flex: 1 1 auto; max-width: 420px; display: flex; align-items: center; }
.search-icon { position: absolute; left: 11px; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 7px 30px 7px 33px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 6px;
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: var(--text-3); font-size: 18px; line-height: 1;
  cursor: pointer; border-radius: 50%;
}
.search-clear:hover { background: var(--surface-2); color: var(--text); }

.app-main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.empty-state {
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-2);
}
.empty-state h2 { font-size: 15px; font-weight: 500; color: var(--text); margin: 0 0 8px; }
.empty-state p { margin: 0; font-size: 13px; }

/* ============================================================
   M2 · 列表页
   ============================================================ */

.list-meta { min-height: 20px; margin: 0 2px 12px; }
.list-meta .muted { font-size: 12px; }

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

.note-card {
  height: 400px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.note-card:hover { border-color: var(--border-2); box-shadow: 0 6px 22px rgba(0, 0, 0, .07); }
.note-card:active { transform: translateY(1px); }
.note-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-cover {
  flex: 0 0 44%;
  background-color: var(--surface-2);
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--border);
}

.card-main { flex: 1 1 auto; padding: 15px 16px 6px; overflow: hidden; }

.card-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.card-title.is-untitled { color: var(--text-3); font-weight: 500; }

.card-excerpt {
  margin: 0;
  font-size: 13px;
  line-height: 1.72;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  white-space: pre-wrap;
}
.note-card.has-cover .card-excerpt { -webkit-line-clamp: 4; }

.card-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 13px;
  font-size: 12px;
  color: var(--text-3);
}
.card-time { margin-right: auto; }
.card-pin {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}
.card-attach { color: var(--text-3); }

/* 空态 / 加载 */
.list-empty {
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 60px 24px;
  text-align: center;
  color: var(--text-2);
}
.list-empty-icon { font-size: 34px; line-height: 1; margin-bottom: 14px; opacity: .7; }
.list-empty h2 { font-size: 15px; font-weight: 500; color: var(--text); margin: 0 0 8px; }
.list-empty p { margin: 0 0 16px; font-size: 13px; }
.list-empty .btn { margin: 0 auto; }

.load-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 30px 0 12px;
  color: var(--text-3);
  font-size: 13px;
}
.load-sentinel.is-end .spinner { display: none; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: wb-spin .7s linear infinite;
}
@keyframes wb-spin { to { transform: rotate(360deg); } }

/* ============================================================
   M3 · 详情弹窗
   PC：无遮罩浮动窗口，可拖动、可多开；手机：全屏
   ============================================================ */

.window-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;         /* 关键：没有背景层，点击空白处仍能操作列表 */
  z-index: 200;
}
.window-layer > * { pointer-events: auto; }

.note-window {
  width: 500px;
  height: 700px;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: 0 18px 52px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .06);
  overflow: hidden;
  animation: win-in .16s ease-out;
  transition: opacity .13s ease, transform .13s ease;
}
@keyframes win-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.note-window.is-dragging { transition: none; user-select: none; }
.note-window.is-closing { opacity: 0; transform: scale(.98); pointer-events: none; }

.win-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 8px 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.win-bar:active { cursor: grabbing; }

.win-grip { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 3px; background: var(--border-2); opacity: .75; }

.win-title-read {
  flex: 1 1 auto;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-title-read.is-untitled { color: var(--text-3); font-weight: 500; }

.win-title-input {
  flex: 1 1 auto;
  display: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 7px;
  border: 1px solid var(--border-2);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  min-width: 0;
}
.win-title-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-window.is-editing .win-title-read { display: none; }
.note-window.is-editing .win-title-input { display: block; }

.win-actions { flex: 0 0 auto; display: flex; gap: 3px; }
.wbtn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--text-2);
  font-size: 14px; line-height: 1;
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.wbtn:hover { background: var(--surface-3); color: var(--text); }
.wbtn-danger:hover { background: var(--danger-soft); color: var(--danger); }

.win-body { flex: 1 1 auto; position: relative; display: flex; min-height: 0; }

.win-read {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 22px 30px;
  word-break: break-word;
}

.win-edit {
  flex: 1 1 auto;
  display: none;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 16px 18px 24px;
  background: transparent;
  color: var(--text);
  font: 400 13.5px/1.8 ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", monospace;
  overscroll-behavior: contain;
  tab-size: 2;
}
.note-window.is-editing .win-read { display: none; }
.note-window.is-editing .win-edit { display: block; }

.win-empty-hint {
  display: none;
  position: absolute;
  inset: 0;
  padding: 44px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.8;
}
.note-window.is-blank:not(.is-editing) .win-empty-hint { display: block; }

.win-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.win-status { font-size: 12px; }
.win-status.is-error { color: var(--danger); }

/* ---------- 编辑器工具栏（M4） ---------- */
.win-tools {
  flex: 0 0 auto;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.note-window.is-editing .win-tools { display: flex; }

.tbtn {
  appearance: none;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.tbtn:hover { color: var(--text); border-color: var(--text-3); }
.tool-state { font-size: 12px; color: var(--accent); }
.tool-hint { margin-left: auto; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* 拖拽文件进入编辑区时高亮 */
.win-edit.is-drop {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* ---------- 手绘板（M4） ---------- */
.sketch {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.sketch[hidden] { display: none; }

.sketch-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.sketch-group { display: flex; gap: 4px; }
.sketch-right { margin-left: auto; }

.sk-btn {
  appearance: none;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.sk-btn:hover { background: var(--surface-3); }
.sk-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.sk-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.sk-primary:hover { background: #2a63d6; }

.sketch-colors { display: flex; align-items: center; gap: 4px; }
.sk-color {
  width: 18px; height: 18px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
}
.sk-color.is-active { border-color: var(--text-3); }
.sk-picker {
  width: 24px; height: 18px;
  padding: 0;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
}
.sk-picker.is-active { border-color: var(--accent); }

.sketch-size {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
}
.sketch-size input { width: 72px; }

.sketch-stage { flex: 1 1 auto; position: relative; overflow: hidden; }
.sketch-stage canvas {
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: crosshair;
  display: block;
}

/* ---------- 附件清单（M4） ---------- */
.win-attach {
  flex: 0 0 auto;
  max-height: 34%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.win-attach[hidden] { display: none; }
.note-window.is-editing .win-attach { display: none; }

.attach-head { font-size: 11.5px; color: var(--text-3); margin: 2px 0 6px; }
.attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  margin-bottom: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 12.5px;
  transition: background .12s, border-color .12s;
}
.attach-item:last-child { margin-bottom: 0; }
.attach-item:hover { background: var(--surface-2); border-color: var(--border-2); }
.attach-icon { flex: 0 0 auto; font-size: 14px; line-height: 1; }
.attach-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { flex: 0 0 auto; }

/* ---------- 正文 Markdown 排版 ---------- */
.md-body { font-size: 14px; line-height: 1.78; color: var(--text); }
.md-body > *:first-child { margin-top: 0; }
.md-body > *:last-child { margin-bottom: 0; }

.md-body h1 { font-size: 21px; margin: 22px 0 12px; line-height: 1.4; }
.md-body h2 { font-size: 18px; margin: 20px 0 10px; line-height: 1.4; }
.md-body h3 { font-size: 15.5px; margin: 18px 0 8px; }
.md-body h4, .md-body h5, .md-body h6 { font-size: 14px; margin: 16px 0 6px; }

.md-body p { margin: 0 0 12px; }
.md-body a { color: var(--accent); text-decoration: none; }
.md-body a:hover { text-decoration: underline; }

.md-body ul, .md-body ol { margin: 0 0 12px; padding-left: 22px; }
.md-body li { margin: 3px 0; }
.md-body li > ul, .md-body li > ol { margin: 3px 0; }

.md-body blockquote {
  margin: 0 0 12px;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border-2);
  color: var(--text-2);
}
.md-body blockquote > *:last-child { margin-bottom: 0; }

.md-body hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.md-body img {
  display: block;
  width: 100%;
  height: auto;          /* 宽度固定 100%，高度自适应 */
  border-radius: 10px;
  margin: 10px 0;
  background: var(--surface-2);
}

.md-body .md-code {
  background: var(--surface-3);
  border-radius: 5px;
  padding: 1px 5px;
  font: 400 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.md-body .md-pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.md-body .md-pre code {
  font: 400 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}
.md-body .md-table-wrap { overflow-x: auto; margin: 0 0 14px; }
.md-body .md-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md-body .md-table th, .md-body .md-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}
.md-body .md-table th { background: var(--surface-2); font-weight: 600; }
.md-body mark { background: #fff3bf; color: inherit; border-radius: 3px; padding: 0 2px; }
.md-body del { color: var(--text-3); }

/* ============================================================
   Toast
   ============================================================ */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(88vw, 460px);
  background: #2c2c2a;
  color: #fff;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  animation: toast-in .16s ease-out;
  transition: opacity .18s, transform .18s;
}
.toast-text { flex: 1 1 auto; }
.toast-action {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: #8fb4ff;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 0;
}
.toast-action:hover { text-decoration: underline; }
.toast-out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   响应式：≤720px 走手机布局
   ============================================================ */
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; padding: 10px 14px; gap: 9px; }
  .topbar-title { flex: 1 1 auto; font-size: 14px; }
  .search-wrap { order: 9; flex: 1 1 100%; max-width: none; }
  .app-main { padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }

  .note-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
  .note-card { height: 320px; }
  .card-cover { flex-basis: 42%; }
  .card-excerpt { -webkit-line-clamp: 6; }
  .note-card.has-cover .card-excerpt { -webkit-line-clamp: 3; }

  /* 窗口 → 全屏面板 */
  .note-window {
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    border: none;
    border-radius: 0;
    animation: none;
  }
  .win-bar {
    padding: calc(10px + env(safe-area-inset-top)) 8px 10px 14px;
    cursor: default;
  }
  .win-grip { display: none; }
  .win-read { padding: 16px 16px calc(30px + env(safe-area-inset-bottom)); }
  .win-edit { padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); font-size: 15px; }
  .win-foot { padding: 7px 14px calc(7px + env(safe-area-inset-bottom)); }
  .wbtn { width: 34px; height: 34px; font-size: 16px; }
  .md-body { font-size: 15px; }
  .md-body h1 { font-size: 20px; }
  .md-body h2 { font-size: 17.5px; }
}

/* ---------- 手机端：工具栏与手绘板 ---------- */
@media (max-width: 720px) {
  .win-tools { padding: 6px 10px; gap: 5px; }
  .tool-hint { display: none; }
  .tbtn { padding: 5px 11px; font-size: 12.5px; }
  .sketch-bar { padding: 6px 8px; gap: 5px; }
  .sketch-size input { width: 58px; }
  .sk-btn { padding: 5px 10px; }
  .win-attach { max-height: 40%; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
  .attach-item { padding: 8px 10px; font-size: 13px; }
}

/* ---------- 深色（跟随系统） ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #17171a;
    --surface:     #1f1f23;
    --surface-2:   #26262b;
    --surface-3:   #2e2e34;
    --border:      #2f2f35;
    --border-2:    #3c3c43;
    --text:        #ededef;
    --text-2:      #a3a3ab;
    --text-3:      #7a7a83;
    --accent:      #5b8cff;
    --accent-soft: #23304d;
    --danger:      #ef6a6a;
    --danger-soft: #3a2020;
    --ok:          #4fc48c;
  }
  .topbar { background: rgba(23, 23, 26, .86); }
  .note-card:hover { box-shadow: 0 6px 22px rgba(0, 0, 0, .45); }
  .note-window { box-shadow: 0 18px 52px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3); }
  .toast { background: #f0f0f2; color: #1a1a1c; }
  .toast-action { color: #2f6fed; }
  .md-body mark { background: #4a3f16; color: #ffe9a8; }
  .sk-color { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
  .attach-item { background: var(--surface-2); border-color: var(--border); }
  .attach-item:hover { background: var(--surface-3); }
}
