/* ============================================================
   钉住 · Design System v4.0 → Production
   清新 · 高级 · 质感 · 简约 · 大气
   —— 无印克制 × 苹果精致 × 东方温润
   ============================================================ */
:root {
  --bg-base:       #F5F3EE;
  --bg-surface:    #FCFBF8;
  --bg-elevated:   #FFFFFF;
  --bg-subtle:     #EFEDE7;
  --bg-hover:      #EBE9E2;
  --bg-input:      #EEECE5;

  --ink-900:       #1A1A1A;
  --ink-700:       #3D3D3D;
  --ink-500:       #6B6B6B;
  --ink-400:       #9A9A9A;
  --ink-300:       #B8B8B5;

  --line:          #E3E1DB;
  --line-soft:     #EBE9E3;
  --line-strong:   #D0CEC7;

  --accent:        #3A4F43;
  --accent-hover:  #2E4036;
  --accent-soft:   #E8EBE6;
  --accent-ink:    #2E4036;

  --gold:          #B89968;
  --gold-soft:     #F5EFE3;

  --danger:        #B84A3E;
  --danger-soft:   #F7ECEA;

  --shadow-xs:     0 1px 2px rgba(26,26,26,0.04);
  --shadow-sm:     0 1px 2px rgba(26,26,26,0.05), 0 0 0 1px rgba(26,26,26,0.03);
  --shadow-md:     0 2px 6px rgba(26,26,26,0.06), 0 1px 2px rgba(26,26,26,0.04);
  --shadow-lg:     0 8px 24px -8px rgba(26,26,26,0.12), 0 4px 8px -4px rgba(26,26,26,0.06);
  --shadow-float:  0 32px 64px -24px rgba(26,26,26,0.18), 0 12px 24px -8px rgba(26,26,26,0.08), 0 0 0 1px rgba(26,26,26,0.04);
  --shadow-inset:  inset 0 1px 2px rgba(26,26,26,0.04);

  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   18px;
  --r-xl:   22px;
  --r-full: 999px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --font-display: "Inter", -apple-system, "SF Pro Display", "PingFang SC", "Source Han Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", monospace;
  --font-serif: "Source Han Serif SC", "Songti SC", "Noto Serif SC", serif;

  --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);

  --app-max-w: 480px;
  --app-min-w: 320px;
}

/* ==================== 深色主题 ==================== */
[data-theme="dark"] {
  --bg-base:       #17181A;
  --bg-surface:    #1D1F21;
  --bg-elevated:   #26292C;
  --bg-subtle:     #1F2124;
  --bg-hover:      #2B2E31;
  --bg-input:      #22252A;

  --ink-900:       #ECEAE5;
  --ink-700:       #C9C7C2;
  --ink-500:       #8E8C88;
  --ink-400:       #6A6964;
  --ink-300:       #494844;

  --line:          #2C2E31;
  --line-soft:     #24262A;
  --line-strong:   #3A3D40;

  --accent:        #8FA995;
  --accent-hover:  #A4BEA9;
  --accent-soft:   #242A26;
  --accent-ink:    #A4BEA9;

  --gold:          #D4B885;
  --gold-soft:     #2A251B;

  --danger:        #D97066;
  --danger-soft:   #2D1E1C;

  --shadow-xs:     0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-md:     0 2px 6px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-lg:     0 8px 24px -8px rgba(0,0,0,0.6), 0 4px 8px -4px rgba(0,0,0,0.4);
  --shadow-float:  0 32px 64px -24px rgba(0,0,0,0.75), 0 12px 24px -8px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-inset:  inset 0 1px 2px rgba(0,0,0,0.3);
}

* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  letter-spacing: -0.003em;
  font-feature-settings: "ss01", "cv11", "calt";
  transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out);
}

/* ---------- 宣纸质感背景 ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 800px 500px at 20% 10%, rgba(184,153,104,0.04), transparent 60%),
    radial-gradient(ellipse 600px 400px at 85% 90%, rgba(58,79,67,0.035), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] body::before {
  background-image:
    radial-gradient(ellipse 800px 500px at 20% 10%, rgba(212,184,133,0.05), transparent 60%),
    radial-gradient(ellipse 600px 400px at 85% 90%, rgba(143,169,149,0.05), transparent 60%);
}

/* ============================================================
   SVG 图标系统
   ============================================================ */
.icon {
  width: 20px; height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: block;
}
.icon-sm { width: 18px; height: 18px; stroke-width: 1.5; }
.icon-xs { width: 13px; height: 13px; stroke-width: 1.8; }
.icon-lg { width: 22px; height: 22px; stroke-width: 1.5; }

/* ============================================================
   容器 — 响应式：桌面居中卡片 / 手机全屏
   ============================================================ */
.app-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding: 28px;
  position: relative;
  z-index: 1;
}

.app-container {
  width: var(--app-max-w);
  height: 680px;
  max-height: calc(100dvh - 56px);
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  resize: both;
  min-width: var(--app-min-w);
  min-height: 440px;
}

/* 顶部玻璃光泽 */
.app-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  z-index: 2;
  pointer-events: none;
}

[data-theme="dark"] .app-container::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

/* 手机全屏适配 */
@media (max-width: 520px) {
  .app-wrapper { padding: 0; }
  .app-container {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    resize: none;
  }
  .app-container::before { display: none; }
}

/* Tauri 桌面端：窗口可缩放，容器跟满 */
.platform-tauri .app-wrapper { padding: 0; }
.platform-tauri .app-container {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  box-shadow: none;
  resize: none;
  overflow: hidden;
}
/* 隐藏 macOS WebKit 原生 resize 把手 */
.platform-tauri ::-webkit-resizer { display: none; }
.platform-tauri .app-container::before { display: none; }

/* ============================================================
   标题栏
   ============================================================ */
.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  flex-shrink: 0;
  user-select: none;
}

/* Tauri: 拖动窗口区域 */
.platform-tauri .title-bar {
  -webkit-app-region: drag;
  app-region: drag;
  padding: 36px 20px 12px 78px; /* top 加大避免交通灯重叠，left 给交通灯留位 */
  cursor: default;
}
.platform-tauri .title-bar button,
.platform-tauri .title-bar a,
.platform-tauri .title-bar .avatar-wrap {
  -webkit-app-region: no-drag;
  app-region: no-drag;
}
/* 让 title-left/title-right 的空白区域也参与拖动 */
.platform-tauri .title-left,
.platform-tauri .title-right {
  -webkit-app-region: drag;
  app-region: drag;
}
.platform-tauri .title-right {
  gap: 6px; /* 按钮之间留出可拖动缝隙 */
}

.title-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #EDE8DF 0%, #E4DED3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.6);
  position: relative;
  border: 1px solid rgba(0,0,0,0.06);
}

.title-mark::after {
  content: '钉';
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  transform: translateY(0.5px);
}

[data-theme="dark"] .title-mark {
  background: linear-gradient(135deg, #2A2E2B 0%, #323633 100%);
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

[data-theme="dark"] .title-mark::after { color: var(--gold); }

.app-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--ink-900);
}

.app-title-sub {
  font-size: 10px;
  color: var(--ink-400);
  letter-spacing: 0.8px;
  margin-left: 6px;
  font-weight: 500;
  text-transform: uppercase;
}

.title-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.t-btn {
  width: 38px; height: 38px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-500);
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
  position: relative;
}

.t-btn:hover { background: var(--bg-hover); color: var(--ink-900); }
.t-btn.active { color: var(--accent-ink); background: var(--accent-soft); }
.t-btn-del { color: var(--ink-400); }
.t-btn-del:hover { background: var(--danger-soft); color: var(--danger); }

/* ============================================================
   搜索栏
   ============================================================ */
.search-bar { padding: 4px 24px 16px; flex-shrink: 0; }

.search-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border-radius: var(--r-full);
  padding: 0 16px;
  height: 44px;
  gap: 10px;
  border: 1px solid transparent;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
  box-shadow: var(--shadow-inset);
}

.search-wrap:focus-within {
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-sm);
}

.search-wrap .icon { color: var(--ink-400); transition: color 0.2s; }
.search-wrap:focus-within .icon { color: var(--accent-ink); }

.search-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 16px;
  color: var(--ink-900);
  font-family: var(--font);
  letter-spacing: -0.003em;
  font-weight: 400;
}

.search-wrap input::placeholder { color: var(--ink-300); font-weight: 400; }

.search-kbd {
  font-size: 10px;
  color: var(--ink-400);
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.search-wrap:focus-within .search-kbd { display: none; }

/* 手机端隐藏快捷键提示 */
@media (max-width: 520px) {
  .search-kbd { display: none; }
}

.search-clear {
  width: 18px; height: 18px;
  border: none;
  background: var(--bg-hover);
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  color: var(--ink-400);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.search-clear:hover { background: var(--line-strong); color: var(--ink-700); }
.search-clear.visible { display: flex; }
.search-clear.visible + .search-kbd { display: none; }

/* ============================================================
   标签栏
   ============================================================ */
.tag-bar {
  display: flex;
  gap: 6px;
  padding: 0 24px 16px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.tag-bar::-webkit-scrollbar { display: none; }

.tag-bar-wrap {
  position: relative;
  flex-shrink: 0;
}

.tag-bar-wrap::before,
.tag-bar-wrap::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 28px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.tag-bar-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-surface), transparent);
}

.tag-bar-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-surface), transparent);
}

.tag-bar-wrap.scroll-left::before { opacity: 1; }
.tag-bar-wrap.scroll-right::after { opacity: 1; }

.tag-chip {
  padding: 5px 13px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--ink-400);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
  letter-spacing: 0.1px;
}

.tag-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink-900);
  background: var(--bg-hover);
}

.tag-chip.active {
  background: var(--ink-700);
  color: var(--bg-surface);
  border-color: var(--ink-700);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .tag-chip.active {
  background: var(--accent);
  color: var(--bg-base);
  border-color: var(--accent);
}

.tag-chip-count {
  margin-left: 4px;
  font-size: 11px;
  color: var(--ink-300);
  font-variant-numeric: tabular-nums;
}

.tag-chip.active .tag-chip-count { color: rgba(255,255,255,0.45); }

/* ============================================================
   列表容器
   ============================================================ */
.note-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  -webkit-overflow-scrolling: touch;
}

.note-list::-webkit-scrollbar { width: 4px; }
.note-list::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}
.note-list::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ============================================================
   便签条目
   ============================================================ */
.note-item { position: relative; }

.note-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 22px; right: 22px;
  bottom: 0;
  height: 1px;
  background: var(--line-soft);
  transition: opacity 0.15s;
  transform-origin: 0 100%;
}

/* Retina hairline: 高 DPR 屏幕上将分割线缩为 0.5px */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
  .note-item:not(:last-child)::after {
    transform: scaleY(0.5);
  }
}

.note-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  cursor: pointer;
  transition: background 0.12s var(--ease-out);
  position: relative;
}

.note-row:hover { background: var(--bg-hover); }
.note-row:active { background: var(--bg-subtle); }

.note-row-pin {
  width: 3px;
  height: 22px;
  border-radius: 2px;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.3s var(--ease-out);
}

.note-item.pinned .note-row-pin {
  background: linear-gradient(180deg, var(--gold) 0%, #9E7F4C 100%);
  box-shadow: 0 0 8px rgba(184,153,104,0.35);
}

.note-row-content { flex: 1; min-width: 0; }

.note-row-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}

.note-row-summary {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.note-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-row-time {
  font-size: 12px;
  color: var(--ink-300);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
}

.note-row-time::before { display: none; }

.note-row-time:first-child::before { display: none; }

.note-row-tags { display: flex; gap: 5px; flex-shrink: 0; transition: opacity 0.15s; }

.note-row-tag {
  padding: 2px 9px;
  height: 22px;
  line-height: 18px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--ink-400);
  letter-spacing: 0.2px;
  border: 1px solid var(--line-soft);
}

.note-row-delete {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border: none;
  background: var(--bg-hover);
  border-radius: var(--r-xs);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-400);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, background 0.12s, color 0.12s;
  z-index: 2;
}

.note-row:hover .note-row-delete { opacity: 1; pointer-events: auto; }
.note-row:hover .note-row-tags { opacity: 0; }
.note-row-delete:hover { background: var(--danger-soft); color: var(--danger); }

/* ============================================================
   手机端左滑操作（置顶 + 删除）
   ============================================================ */
.swipe-wrap {
  position: relative;
  overflow: hidden;
}

.swipe-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: none; /* 桌面端不显示 */
  align-items: stretch;
  transform: translateX(100%); /* 默认隐藏在右侧外 */
  transition: transform 0.28s var(--ease-out);
}

.swipe-btn {
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: opacity 0.15s;
}

.swipe-btn svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swipe-pin { background: var(--accent); }
.swipe-del { background: var(--danger); }

@media (max-width: 520px) {
  .swipe-actions {
    display: flex;
  }

  .swipe-wrap .note-row {
    transition: transform 0.28s var(--ease-out);
    will-change: transform;
  }

  .swipe-wrap.swiped .note-row {
    transform: translateX(-152px);
  }

  .swipe-wrap.swiped .swipe-actions {
    transform: translateX(0) !important;
  }

  /* 左滑时隐藏分割线 */
  .swipe-wrap.swiped + .note-item::after,
  .swipe-wrap.swiped::after {
    opacity: 0;
  }
}

/* ============================================================
   推入式便签详情页
   ============================================================ */
.note-detail-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  z-index: 15;
  transform: translateX(100%);
  transition: transform 0.28s var(--ease-out);
  border-radius: inherit;
}

.note-detail-overlay.show { transform: translateX(0); }

.note-detail-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
  min-height: 56px;
}

.note-detail-header > :last-child { justify-self: end; }

.note-detail-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.note-detail-header-actions {
  display: flex;
  gap: 4px;
}

.note-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.note-detail-body::-webkit-scrollbar { width: 4px; }
.note-detail-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.note-detail-summary-wrap {
  position: relative;
  flex-shrink: 0;
}

.note-detail-textarea {
  flex: 1;
  min-height: 200px;
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: var(--ink-900);
  font-family: var(--font);
  line-height: 1.8;
  resize: none;
  padding: 4px 0 12px;
  letter-spacing: -0.003em;
}

.note-detail-textarea::placeholder { color: var(--ink-300); font-weight: 400; }

.note-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  flex-shrink: 0;
}

.note-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 18px;
  flex-shrink: 0;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-surface);
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .note-detail-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* 标题编辑区 */
.note-summary-edit {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-900);
  font-family: var(--font-display);
  letter-spacing: -0.008em;
  padding: 0 0 8px;
  border-bottom: 1px dashed var(--line-soft);
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.note-summary-edit:focus {
  border-bottom-color: var(--accent);
}

.note-summary-edit::placeholder { color: var(--ink-300); font-weight: 500; }

/* AI 总结状态指示 */
.ai-badge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: var(--ink-400);
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: var(--r-full);
  letter-spacing: 0.3px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.ai-badge.visible { opacity: 1; }

/* --- 标签胶囊（放大到可触摸） --- */
.expand-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 14px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid transparent;
  transition: all 0.2s;
  min-height: 36px;
}

.expand-tag:hover { border-color: var(--accent); }

.expand-tag-rm {
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.45;
  border-radius: 50%;
  transition: all 0.18s;
  background: transparent;
  border: none;
  color: inherit;
  flex-shrink: 0;
}

.expand-tag-rm:hover { opacity: 1; background: rgba(0,0,0,0.06); }
[data-theme="dark"] .expand-tag-rm:hover { background: rgba(255,255,255,0.08); }

/* --- "+ 标签" 按钮（放大触摸热区） --- */
.expand-tag-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  border: 1px dashed var(--line-strong);
  color: var(--ink-400);
  cursor: pointer;
  background: transparent;
  font-family: var(--font);
  transition: all 0.2s;
  min-height: 36px;
}

.expand-tag-add:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  border-style: solid;
  background: var(--accent-soft);
}

/* ============================================================
   标签添加面板 — 方案 A：桌面端内联展开
   ============================================================ */
.tag-add-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: tag-panel-in 0.22s var(--ease-out);
}

@keyframes tag-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 建议标签区（面板内顶部） */
.tag-suggestions {
  position: static;
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  margin-top: 0;
  max-height: none;
  overflow-y: visible;
  z-index: auto;
  animation: none;
}

.tag-suggestions-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.tag-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-suggestion-item {
  padding: 7px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.tag-suggestion-item:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.tag-suggestion-item:active {
  transform: scale(0.96);
}

/* 输入行 */
.tag-add-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  animation: none;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.tag-add-input {
  flex: 1;
  min-width: 60px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  color: var(--ink-900);
  font-size: 15px;
  font-weight: 400;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.tag-add-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tag-add-input::placeholder { color: var(--ink-300); }

.tag-add-confirm {
  width: 44px; height: 44px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.tag-add-confirm:hover { background: var(--accent-hover); }
.tag-add-confirm:active { transform: scale(0.94); }
[data-theme="dark"] .tag-add-confirm { color: var(--bg-base); }

.tag-add-cancel {
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--ink-500);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.tag-add-cancel:hover { background: var(--bg-hover); color: var(--ink-700); border-color: var(--line-strong); }

/* ============================================================
   标签添加面板 — 方案 B：手机端 Bottom Sheet
   ============================================================ */

/* Bottom Sheet 遮罩 */
.tag-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.3);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.tag-sheet-overlay.show { opacity: 1; pointer-events: auto; }
[data-theme="dark"] .tag-sheet-overlay { background: rgba(0,0,0,0.5); }

/* Bottom Sheet 面板 */
.tag-sheet-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-elevated);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  z-index: 61;
  box-shadow: 0 -16px 48px -12px rgba(26,26,26,0.15);
  transform: translateY(100%);
  transition: transform 0.32s var(--ease-out);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.tag-sheet-panel.show { transform: translateY(0); }

.tag-sheet-handle {
  width: 36px; height: 4px;
  background: var(--line-strong);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.tag-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  flex-shrink: 0;
}

.tag-sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
}

.tag-sheet-close {
  width: 32px; height: 32px;
  border: 1px solid var(--line); background: var(--bg-elevated);
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-500);
  transition: all 0.15s;
}
.tag-sheet-close:hover { background: var(--bg-hover); color: var(--ink-900); border-color: var(--line-strong); }

.tag-sheet-suggestions {
  padding: 0 20px 12px;
  flex-shrink: 0;
}

.tag-sheet-suggestions-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}

.tag-sheet-suggestions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-sheet-chip {
  padding: 10px 18px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-700);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
}
.tag-sheet-chip:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.tag-sheet-chip:active { transform: scale(0.96); }

.tag-sheet-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 0 20px;
}

.tag-sheet-input-area {
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--line-soft);
}

.tag-sheet-input {
  flex: 1;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  color: var(--ink-900);
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  min-width: 0;
}
.tag-sheet-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tag-sheet-input::placeholder { color: var(--ink-300); }

.tag-sheet-submit {
  width: 48px; height: 48px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.tag-sheet-submit:hover { background: var(--accent-hover); }
.tag-sheet-submit:active { transform: scale(0.94); }
[data-theme="dark"] .tag-sheet-submit { color: var(--bg-base); }

/* 手机端：隐藏内联面板，使用 Bottom Sheet */
@media (max-width: 520px) {
  .tag-add-panel { display: none !important; }
}

/* 桌面端：隐藏 Bottom Sheet（JS 也做判断，这是安全兜底） */
@media (min-width: 521px) {
  .tag-sheet-overlay,
  .tag-sheet-panel { display: none !important; }
}

.expand-time {
  font-size: 13px;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.btn-base {
  height: 40px;
  padding: 0 22px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s var(--ease-out), color 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.1px;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-500);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--ink-900);
  border-color: var(--line-strong);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--ink-400);
  border: 1px solid transparent;
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-soft);
}

.btn-primary {
  background: var(--ink-900);
  color: var(--bg-surface);
  border: 1px solid var(--ink-900);
  box-shadow: 0 2px 6px rgba(26,26,26,0.15), inset 0 1px 0 rgba(255,255,255,0.08);
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(58,79,67,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}

[data-theme="dark"] .btn-primary {
  background: var(--accent);
  color: var(--bg-base);
  border-color: var(--accent);
}

.btn-primary.dirty {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 2px 8px rgba(58,79,67,0.25);
}

.btn-primary.dirty::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
  position: absolute;
  top: -2px; right: -2px;
  animation: dirty-pulse 1.5s ease-in-out infinite;
}

@keyframes dirty-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ============================================================
   底部栏
   ============================================================ */
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px 16px;
  flex-shrink: 0;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-surface);
  position: relative;
}

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-bar { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

.bottom-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  opacity: 0.5;
}

.note-count {
  font-size: 13px;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  font-weight: 500;
}

.note-count b {
  color: var(--ink-700);
  font-weight: 600;
  font-size: 12px;
}

.btn-add {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--ink-900) 0%, #2A2A2A 100%);
  color: var(--gold);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
  box-shadow:
    0 4px 14px -2px rgba(26,26,26,0.3),
    0 2px 4px -1px rgba(26,26,26,0.15),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

[data-theme="dark"] .btn-add {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--gold);
}

.btn-add:hover {
  box-shadow:
    0 6px 18px -3px rgba(58,79,67,0.35),
    0 3px 6px -1px rgba(58,79,67,0.18),
    inset 0 1px 0 rgba(255,255,255,0.12);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.btn-add:active { transform: scale(0.94); }

.btn-add .icon { stroke-width: 2; }

/* 同步按钮旋转 */
#btnSync.syncing .icon {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================================
   回收站
   ============================================================ */
.trash-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  z-index: 15;
  transform: translateX(100%);
  transition: transform 0.28s var(--ease-out);
  border-radius: inherit;
}

.trash-overlay.show { transform: translateX(0); }

.trash-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 20px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line-soft);
  min-height: 56px;
}

.trash-header > :last-child { justify-self: end; }

.trash-back {
  border: none;
  background: transparent;
  color: var(--ink-500);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 8px;
  border-radius: var(--r-sm);
  min-height: 40px;
  transition: background 0.15s, color 0.15s;
}

.trash-back:hover { background: var(--bg-hover); color: var(--ink-900); }

.trash-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.trash-hint {
  font-size: 12px;
  color: var(--ink-400);
  padding: 4px 12px;
  background: var(--bg-subtle);
  border-radius: var(--r-full);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.trash-list { flex: 1; overflow-y: auto; padding: 10px 10px; }

.trash-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--r-sm);
  transition: background 0.2s;
  border: 1px solid transparent;
}

.trash-item:hover {
  background: var(--bg-hover);
  border-color: var(--line-soft);
}

.trash-item-content { flex: 1; min-width: 0; }

.trash-item-summary {
  font-size: 15px;
  color: var(--ink-500);
  text-decoration: line-through;
  text-decoration-color: var(--ink-300);
  text-decoration-thickness: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.trash-item-meta {
  font-size: 12px;
  color: var(--ink-400);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

.trash-item-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.trash-item:hover .trash-item-actions { opacity: 1; }

/* 手机端始终显示操作按钮 */
@media (max-width: 520px) {
  .trash-item-actions { opacity: 1; }
  .note-row-delete { opacity: 0 !important; display: none !important; }
}

.trash-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  min-height: 36px;
}

.trash-btn-restore { background: var(--accent-soft); color: var(--accent-ink); }
.trash-btn-restore:hover { background: var(--accent); color: #FFF; }
[data-theme="dark"] .trash-btn-restore:hover { color: var(--bg-base); }

.trash-btn-del { background: transparent; color: var(--ink-400); border: 1px solid var(--line); }
.trash-btn-del:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }
.trash-btn-del.confirm {
  background: var(--danger);
  color: #fff;
  animation: shake-subtle 0.3s var(--ease-out);
}

@keyframes shake-subtle {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.trash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--ink-400);
  gap: 12px;
}

.trash-empty .icon {
  width: 34px; height: 34px;
  stroke-width: 1.2;
  color: var(--ink-300);
}

.trash-empty-text { font-size: 12px; font-weight: 500; letter-spacing: 0.3px; }

/* ============================================================
   空状态
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
  padding: 40px;
  color: var(--ink-400);
}

.empty-state-ico {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-300);
  position: relative;
}

.empty-state-ico::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px dashed var(--line-strong);
  opacity: 0.5;
}

.empty-state-ico .icon { width: 24px; height: 24px; stroke-width: 1.3; }

.empty-state-text {
  font-size: 14px;
  color: var(--ink-700);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.empty-state-hint {
  font-size: 12px;
  color: var(--ink-400);
  text-align: center;
  letter-spacing: 0.2px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: absolute;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(26,26,26,0.88);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  pointer-events: none;
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.2px;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,0.25);
}

[data-theme="dark"] .toast {
  background: rgba(236,234,229,0.95);
  color: #1A1A1A;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast .icon { width: 13px; height: 13px; stroke-width: 2.2; color: var(--gold); }
[data-theme="dark"] .toast .icon { color: var(--accent); }

/* ============================================================
   杂项
   ============================================================ */
::selection { background: var(--accent-soft); color: var(--accent-ink); }

mark.search-hl {
  background: var(--gold-soft);
  color: var(--ink-900);
  border-radius: 2px;
  padding: 0 1px;
  box-shadow: 0 0 0 1px rgba(184,153,104,0.2);
}

[data-theme="dark"] mark.search-hl {
  background: rgba(212,184,133,0.2);
  color: var(--ink-900);
}

.theme-transition * {
  transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out), border-color 0.35s var(--ease-out) !important;
}

/* 同步状态指示 */
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--ink-400);
  font-weight: 500;
}

.sync-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transition: background 0.3s;
}

.sync-dot.syncing {
  animation: sync-pulse 1s ease-in-out infinite;
  background: var(--gold);
}

.sync-dot.offline { background: var(--ink-300); }

@keyframes sync-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--bg-hover) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-xs);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   用户 / 登录面板（按设计稿 v2）
   ============================================================ */
.panel-header {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0; min-height: 56px;
}
.panel-header > :last-child { justify-self: end; }
.panel-back {
  border: none; background: transparent; color: var(--ink-500);
  font-size: 14px; font-weight: 500; cursor: pointer; font-family: var(--font);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px 8px 8px; border-radius: var(--r-sm); justify-self: start;
  min-height: 40px; transition: background 0.15s, color 0.15s;
}
.panel-back:hover { background: var(--bg-hover); color: var(--ink-900); }
.panel-back .icon { width: 18px; height: 18px; }
.panel-title {
  font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: 0.2px;
}
.panel-badge {
  font-size: 12px; color: var(--ink-400); padding: 4px 12px;
  background: var(--bg-subtle); border-radius: var(--r-full);
  font-weight: 500; letter-spacing: 0.2px;
}
.user-panel {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 30px; flex: 1; overflow-y: auto;
}
/* 账户面板内的按钮覆盖为设计稿尺寸 */
.user-panel .btn-base {
  height: 48px; padding: 0 20px; border-radius: var(--r-full);
  font-size: 15px; font-weight: 500; width: 100%;
  justify-content: center;
}
.user-panel .btn-primary {
  background: var(--ink-900); color: var(--bg-surface);
  border: 1px solid var(--ink-900);
  box-shadow: 0 2px 6px rgba(26,26,26,0.15), inset 0 1px 0 rgba(255,255,255,0.08);
}
.user-panel .btn-primary:hover {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(58,79,67,0.25);
}
.user-panel .btn-ghost {
  background: transparent; color: var(--ink-500); border: 1px solid var(--line);
}
.user-panel .btn-ghost:hover {
  background: var(--bg-hover); color: var(--ink-900); border-color: var(--line-strong);
}
.user-panel .login-input { height: 48px; font-size: 15px; }
.auth-view {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; flex: 1;
}
.panel-spacer-top { flex: 2; min-height: 20px; }
.panel-spacer-bottom { flex: 3; min-height: 20px; }
.brand-area {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; margin-bottom: 32px;
}
.brand-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, #EDE8DF 0%, #E4DED3 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.6);
  border: 1px solid rgba(0,0,0,0.06);
  font-family: var(--font-serif); font-size: 26px; font-weight: 700;
  color: var(--accent); line-height: 1;
}
[data-theme="dark"] .brand-icon {
  background: linear-gradient(135deg, #2A2E2B 0%, #323633 100%);
  border-color: rgba(255,255,255,0.06); color: var(--gold);
}
.brand-title {
  font-size: 20px; font-weight: 600; color: var(--ink-900);
  letter-spacing: -0.01em; font-family: var(--font-display);
}
.brand-sub { font-size: 13px; color: var(--ink-400); margin-top: -4px; }
.status-icon {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}
.status-icon.gold { background: var(--gold-soft); color: var(--gold); }
.status-icon.success { background: var(--accent-soft); color: var(--accent); }
.avatar-placeholder {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--bg-subtle); display: flex;
  align-items: center; justify-content: center;
  color: var(--ink-300); margin-bottom: 16px;
}
.panel-heading {
  font-size: 18px; font-weight: 600; color: var(--ink-900);
  text-align: center; letter-spacing: -0.01em; margin-bottom: 6px;
}
.panel-desc {
  font-size: 13px; color: var(--ink-400); text-align: center;
  letter-spacing: 0.1px; margin-bottom: 28px; line-height: 1.5;
}
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.input-group { position: relative; }
.login-input {
  width: 100%; height: 48px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-input); color: var(--ink-900);
  font-size: 15px; font-family: var(--font); outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-input::placeholder { color: var(--ink-300); }
.login-input.has-icon { padding-left: 44px; }
.input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; stroke: var(--ink-300); stroke-width: 1.6;
  fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
}
.toggle-pw {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--ink-300); padding: 4px;
}
.toggle-pw:hover { color: var(--ink-700); }
.toggle-pw svg {
  width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.6;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.password-row { display: flex; justify-content: flex-end; margin-top: -4px; margin-bottom: 4px; }
.forgot-link {
  font-size: 13px; color: var(--accent-ink); font-weight: 500;
  cursor: pointer; border: none; background: none; font-family: var(--font); padding: 4px 0;
}
.forgot-link:hover { color: var(--gold); }
.btn-text {
  background: none; border: none; color: var(--ink-400);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: var(--font); padding: 8px 0; width: 100%; text-align: center;
}
.btn-text:hover { color: var(--accent-ink); }
.divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.divider span { font-size: 11px; color: var(--ink-300); font-weight: 500; letter-spacing: 0.3px; }
.login-error { font-size: 12px; color: var(--danger); text-align: center; min-height: 18px; font-weight: 500; margin-top: 4px; }
.nickname-picker { width: 100%; }
.nickname-picker-label {
  font-size: 12px; color: var(--ink-400); font-weight: 500;
  letter-spacing: 0.2px; text-align: center; margin-bottom: 10px;
}
.nickname-options { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.nickname-chip {
  padding: 10px 20px; border-radius: var(--r-full);
  border: 1.5px solid var(--line); background: var(--bg-elevated);
  font-size: 14px; font-weight: 500; color: var(--ink-700);
  cursor: pointer; transition: all 0.18s var(--ease-out);
  font-family: var(--font); display: flex; align-items: center; gap: 6px;
}
.nickname-chip:hover { border-color: var(--accent); color: var(--ink-900); background: var(--accent-soft); }
.nickname-chip.selected {
  border-color: var(--accent); background: var(--accent);
  color: #fff; box-shadow: 0 2px 6px rgba(58,79,67,0.2);
}
.chip-icon { font-size: 15px; line-height: 1; }
.user-info-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; background: var(--bg-elevated);
  border-radius: var(--r-md); border: 1px solid var(--line);
  width: 100%; box-shadow: var(--shadow-sm); margin-top: 30px;
}
.user-avatar-img {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2.5px solid var(--line);
}
.user-info-text { flex: 1; }
.user-nickname { font-size: 16px; font-weight: 600; color: var(--ink-900); letter-spacing: -0.01em; }
.user-sync-status {
  font-size: 12px; color: var(--accent); font-weight: 500; margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
}
.user-sync-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.avatar-edit-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--bg-subtle); color: var(--ink-500); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0;
}
.avatar-edit-btn:hover { background: var(--bg-hover); color: var(--ink-900); }
.avatar-edit-btn svg {
  width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.6;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.avatar-section { width: 100%; margin-top: 24px; }
.avatar-section-title {
  font-size: 12px; color: var(--ink-400); font-weight: 500;
  margin-bottom: 14px; text-align: center; letter-spacing: 0.3px;
}
.avatar-grid { display: flex; gap: 20px; justify-content: center; }
.avatar-option {
  width: 64px; height: 64px; border-radius: 50%;
  cursor: pointer; border: 2.5px solid var(--line);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; position: relative;
}
.avatar-option:hover { border-color: var(--accent); transform: scale(1.08); }
.avatar-option.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar-option.selected::after {
  content: '\2713'; position: absolute; bottom: -1px; right: -1px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.avatar-option img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* 头像按钮（标题栏） */
.avatar-wrap {
  position: relative; width: 34px; height: 34px; margin-left: 4px;
  flex-shrink: 0; cursor: pointer;
}

/* Tauri 桌面端：强制使用桌面样式，不受 520px 手机断点影响 */
.platform-tauri .note-row-delete { display: flex !important; }
.platform-tauri .note-row:hover .note-row-delete { opacity: 1 !important; pointer-events: auto !important; }
.platform-tauri .note-row:hover .note-row-tags { opacity: 0; }
.platform-tauri .swipe-actions { display: none !important; }
.platform-tauri .trash-item-actions { opacity: 0; }
.platform-tauri .trash-item:hover .trash-item-actions { opacity: 1; }
.platform-tauri .tag-sheet-overlay,
.platform-tauri .tag-sheet-panel { display: none !important; }
.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.avatar-wrap.logged .avatar-btn { border: 2px solid var(--line); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-default {
  width: 20px; height: 20px;
  stroke: var(--ink-300); stroke-width: 1.6;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  display: block; margin: auto;
}
.avatar-dot {
  position: absolute; bottom: -1px; right: -1px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); border: 2.5px solid var(--bg-surface);
  z-index: 1; display: none;
}
.avatar-wrap.logged .avatar-dot { display: block; }
.avatar-dot.syncing { background: var(--gold); }
.avatar-dot.offline { background: var(--ink-300); }

/* 设置项按钮 */
.settings-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg-elevated); cursor: pointer;
  font-family: var(--font); font-size: 14px;
  color: var(--ink-700); font-weight: 500; text-align: left;
  transition: background 0.15s; width: 100%; margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.settings-item:hover { background: var(--bg-hover); }
.settings-item .s-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: var(--bg-subtle); color: var(--ink-500);
}
.settings-item .s-text { flex: 1; }
.settings-item .s-label { font-size: 14px; color: var(--ink-900); font-weight: 500; }
.settings-item .s-arrow {
  width: 16px; height: 16px; color: var(--ink-300); flex-shrink: 0;
}
