:root {
  /* 暖调米色背景（语雀/印象笔记风）*/
  --bg: #faf9f7;
  --bg-secondary: #f3f1ed;
  --card: #ffffff;
  --paper: #fffdf9;
  --text: #2b2b2b;
  --text-secondary: #555;
  --muted: #8c8c8c;
  --border: #e8e6e1;
  --border-light: #f0eee9;
  /* 主色：墨绿（语雀风）*/
  --primary: #385c5a;
  --primary-light: #e8efee;
  --primary-dark: #2a4744;
  --accent: #c8a96a;
  --success: #4a8c5a;
  --success-light: #e6f0e8;
  --warning: #c08a3e;
  --warning-light: #f7eed8;
  --danger: #b54545;
  --danger-light: #f5e6e6;
  --error: #9a2f2f;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(60, 50, 40, 0.04);
  --shadow: 0 1px 3px rgba(60, 50, 40, 0.06), 0 1px 2px rgba(60, 50, 40, 0.04);
  --shadow-md: 0 4px 10px -2px rgba(60, 50, 40, 0.08), 0 2px 4px -1px rgba(60, 50, 40, 0.04);

  --serif: 'Source Han Serif SC', 'Noto Serif SC', 'Songti SC', 'SimSun', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ────────────────────────────────────── */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.container.narrow {
  max-width: 560px;
}

.container.wide {
  max-width: 1200px;
}

/* 笔记页全屏布局：侧栏 + 纸质感阅读区 */
.note-main {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 57px);
  overflow: hidden;
}

.note-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  padding: 0;
  max-width: none;
}

.note-sidebar {
  position: relative;
  top: auto;
  max-height: none;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.note-sidebar .file-list-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* 侧栏顶部存储信息条 */
.sidebar-storage-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.sidebar-storage-bar .storage-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
}

.sidebar-storage-bar .storage-icon svg {
  width: 16px;
  height: 16px;
}

.sidebar-storage-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-storage-bar .btn {
  padding: 0.25rem;
}

.sidebar-storage-bar .btn svg {
  width: 16px;
  height: 16px;
}

.note-sidebar .file-tree,
.note-sidebar .file-list-flat {
  flex: 1;
  max-height: none;
}

.note-paper {
  background: var(--paper);
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.note-paper .viewer-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.note-paper .file-viewer-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.note-paper .note-editor {
  flex: 1;
  min-height: 0;
}

/* ── Topbar ────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.topbar-brand svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-navs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.1s, color 0.1s;
}

.topbar-nav svg {
  width: 18px;
  height: 18px;
}

.topbar-nav:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.topbar-nav.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.topbar-username {
  display: inline;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ── Typography ────────────────────────────────── */

h1, h2, h3, h4 {
  margin: 0 0 0.75rem;
  line-height: 1.3;
}

h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

.narrow h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ── Buttons ───────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--primary-dark);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-link {
  background: transparent;
  color: var(--primary);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
}

.btn-link:hover {
  background: var(--primary-light);
}

.btn-danger {
  background: var(--danger);
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ── Forms ─────────────────────────────────────── */

form {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

input, select, textarea {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.field-help {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

/* ── Status ────────────────────────────────────── */

.status-grid {
  display: grid;
  gap: 0.5rem;
}

.status {
  margin: 0;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status.neutral {
  color: var(--muted);
  background: var(--bg-secondary);
}

.status.pending,
.status.warning {
  color: var(--warning);
  background: var(--warning-light);
  border-color: #fcd34d;
}

.status.success {
  color: var(--success);
  background: var(--success-light);
  border-color: #86efac;
}

.status.failure {
  color: var(--error);
  background: var(--danger-light);
  border-color: #fca5a5;
}

/* ── Error ─────────────────────────────────────── */

.error {
  color: var(--error);
  background: var(--danger-light);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  margin: 0.5rem 0;
  font-size: 0.875rem;
  border: 1px solid #fca5a5;
}

/* ── Section ───────────────────────────────────── */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
}

/* ── Stat Cards ────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.stat-card .stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-card .stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-card .stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-card .stat-icon.slate { background: var(--bg-secondary); color: var(--text-secondary); }

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ── Storage Cards ─────────────────────────────── */

.storage-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.storage-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.storage-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.storage-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius);
}

.storage-card .storage-icon {
  width: 44px;
  height: 44px;
}

.storage-card .storage-icon svg {
  width: 24px;
  height: 24px;
}

.storage-icon.s3 { background: var(--primary-light); color: var(--primary); }
.storage-icon.webdav { background: var(--success-light); color: var(--success); }
.storage-icon.onedrive { background: #e0e7ff; color: #4338ca; }

.storage-card .storage-info {
  flex: 1;
  min-width: 0;
}

.storage-card .storage-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.storage-meta {
  font-size: 0.825rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.storage-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.storage-meta svg {
  width: 14px;
  height: 14px;
}

.storage-card .storage-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Data Table ────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.data-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--bg-secondary);
}

/* ── File Browser ──────────────────────────────── */

.file-browser {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}

.file-list-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.file-list-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-list-header input {
  flex: 1;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
}

.file-tree {
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.4rem 0;
}

/* 树节点通用 */
.tree-node {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  user-select: none;
  border-radius: var(--radius-sm);
  margin: 0 0.35rem;
}

.tree-node:hover {
  background: var(--bg-secondary);
}

.tree-node.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 500;
}

.tree-node .tree-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s;
}

.tree-node.collapsed .tree-chevron {
  transform: rotate(-90deg);
}

.tree-node .tree-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tree-node .tree-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-children {
  overflow: hidden;
}

.tree-children.collapsed {
  display: none;
}

/* 平铺列表回退（搜索结果） */
.file-list-flat {
  max-height: 70vh;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}

.file-item:hover {
  background: var(--bg-secondary);
}

.file-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.file-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.file-item .file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .file-size {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}

.file-item .file-date {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── File Viewer ───────────────────────────────── */

.file-viewer-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.file-viewer-header {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.file-viewer-title {
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
  color: var(--text);
}

.file-viewer-title .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-viewer-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.file-viewer-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0 2rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
}

/* 编辑/预览切换 tab */
.view-tabs {
  display: inline-flex;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}

.view-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
}

.view-tab.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.file-viewer-body {
  padding: 2rem 3rem;
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 13rem);
}

.file-viewer-body.editing {
  padding: 0;
  max-height: calc(100vh - 13rem);
}

.note-editor {
  width: 100%;
  height: 100%;
  min-height: 60vh;
  border: none;
  outline: none;
  resize: none;
  padding: 2rem 3rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--paper);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.note-editor::placeholder {
  color: var(--muted);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  gap: 0.75rem;
}

.editor-toolbar .actions {
  margin: 0;
}

.editor-toolbar .btn {
  flex: none;
}

.viewer-content {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.file-viewer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  color: var(--muted);
  gap: 0.5rem;
}

.file-viewer-empty svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

/* ── Markdown Render ───────────────────────────── */

.markdown-body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
  word-wrap: break-word;
  font-family: var(--sans);
}

.markdown-body > *:first-child {
  margin-top: 0;
}

.markdown-body > *:last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
}

.markdown-body h1 {
  font-size: 1.6em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}

.markdown-body h2 {
  font-size: 1.35em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--border-light);
}

.markdown-body h3 { font-size: 1.15em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.9em; color: var(--text-secondary); }
.markdown-body h6 { font-size: 0.85em; color: var(--muted); }

.markdown-body p {
  margin: 0.9em 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.6em;
  margin: 0.85em 0;
}

.markdown-body li {
  margin: 0.4em 0;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin: 0.35em 0;
}

/* 任务列表（marked 输出 li > input[type=checkbox]）*/
.markdown-body li:has(> input[type="checkbox"]) {
  list-style: none;
  margin-left: -1.4em;
}

.markdown-body li > input[type="checkbox"] {
  margin-right: 0.5em;
  accent-color: var(--primary);
  vertical-align: middle;
}

.markdown-body code {
  background: var(--bg-secondary);
  padding: 0.18em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
  font-family: var(--mono);
  color: var(--primary-dark);
}

.markdown-body pre {
  background: #2b2b2b;
  color: #e8e6e1;
  padding: 1em 1.25em;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1em 0;
  font-size: 0.85rem;
  line-height: 1.65;
  border: 1px solid var(--border);
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 1em;
  font-family: var(--mono);
}

.markdown-body a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--primary-light);
  transition: border-color 0.1s;
}

.markdown-body a:hover {
  border-bottom-color: var(--primary);
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1em 0;
  padding: 0.5em 1.2em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.markdown-body blockquote p {
  margin: 0.4em 0;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.92em;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 0.55em 0.9em;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text);
}

.markdown-body tbody tr:nth-child(even) td {
  background: var(--bg-secondary);
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1em 0;
}

.markdown-body strong {
  font-weight: 600;
  color: var(--text);
}

.markdown-body del {
  color: var(--muted);
}

.markdown-body mark {
  background: var(--warning-light);
  color: var(--text);
  padding: 0.1em 0.25em;
  border-radius: 3px;
}

/* ── Version History ───────────────────────────── */

.version-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-size: 0.825rem;
}

.version-item .version-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.version-item .version-id {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  color: var(--text);
}

.version-item .version-date {
  color: var(--muted);
  font-size: 0.75rem;
}

.version-item .version-author {
  color: var(--primary);
  font-size: 0.75rem;
}

/* ── Loading ───────────────────────────────────── */

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--muted);
  gap: 0.5rem;
}

.loading-spinner svg {
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Empty State ───────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.empty-state h3 {
  margin-bottom: 0.25rem;
  color: var(--text);
}

/* ── Actions ───────────────────────────────────── */

.actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.storage-page .actions .btn {
  flex: 1;
}

/* ── Storage Detail Head ───────────────────────── */

.storage-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.storage-detail-title {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.storage-detail-title .storage-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
}

.storage-detail-title .storage-icon svg {
  width: 26px;
  height: 26px;
}

.storage-detail-title h1 {
  margin: 0;
  font-size: 1.35rem;
}

.storage-detail-title .muted {
  margin: 0;
}

.storage-detail-actions {
  display: flex;
  gap: 0.5rem;
}

/* ── Modal ─────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 1rem;
  word-break: break-all;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

/* ── Landing Page ──────────────────────────────── */

.landing-hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
}

.landing-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.landing-hero p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto 2rem;
}

.landing-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.landing-feature {
  text-align: center;
  padding: 1.5rem;
}

.landing-feature svg {
  width: 40px;
  height: 40px;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.landing-feature h3 {
  margin-bottom: 0.35rem;
}

.landing-feature p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

/* ── Settings Page ─────────────────────────────── */

.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.settings-section h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.settings-section .section-desc {
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* 主存储选择：radio 卡片 */
.primary-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.primary-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}

.primary-option:hover {
  border-color: var(--primary);
}

.primary-option input {
  margin: 0;
  accent-color: var(--primary);
}

.primary-option .storage-icon {
  width: 36px;
  height: 36px;
}

.primary-option .storage-icon svg {
  width: 20px;
  height: 20px;
}

.primary-option .primary-info {
  flex: 1;
  min-width: 0;
}

.primary-option .primary-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.primary-option .primary-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.primary-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* 隐藏文件夹 chip 列表 */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.4rem 0.3rem 0.7rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.825rem;
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.chip button {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip button:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.chip-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.chip-input-row input {
  flex: 1;
}

/* 设置页存储列表项 */
.settings-storage-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
}

.settings-storage-item .storage-icon {
  width: 36px;
  height: 36px;
}

.settings-storage-item .storage-icon svg {
  width: 20px;
  height: 20px;
}

.settings-storage-item .storage-info {
  flex: 1;
  min-width: 0;
}

.settings-storage-item .storage-name {
  font-weight: 500;
}

.settings-storage-item .storage-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Auth Pages ────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 1.5rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.auth-brand svg {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  text-align: left;
}

.auth-sub {
  margin: 0 0 1.5rem;
}

.auth-alt {
  text-align: center;
  margin: 1.25rem 0 0;
}

.auth-alt a {
  color: var(--primary);
  font-weight: 500;
}

/* ── Responsive ────────────────────────────────── */

@media (max-width: 768px) {
  .file-browser {
    grid-template-columns: 1fr;
  }

  .note-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .note-main {
    height: auto;
    overflow: visible;
  }

  .note-sidebar {
    height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .note-paper {
    height: auto;
    min-height: 60vh;
  }

  .note-paper .file-viewer-body {
    max-height: none;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-hero h1 {
    font-size: 1.75rem;
  }

  .storage-card {
    flex-wrap: wrap;
  }

  .topbar-navs {
    display: none;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0.75rem 1rem;
  }

  .container {
    padding: 1.5rem 1rem;
  }
}
