/* ===================== 小坞码稿 · Typora 风格样式 ===================== */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-side: #fafafa;
  --border: #ececec;
  --text: #2c2c2c;
  --text-soft: #6b6b6b;
  --accent: #4a90d9;
  --accent-soft: #eaf2fb;
  --danger: #e06c5a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --topbar-h: 48px;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
}
.hidden { display: none !important; }
.muted { color: var(--text-soft); font-size: 12px; }

/* ---------- 登录 ---------- */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #eef2f7 100%);
  z-index: 100;
}
.login-card {
  background: #fff; padding: 48px 40px; border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08); text-align: center; width: 320px;
}
.login-logo { font-size: 34px; font-weight: 700; letter-spacing: 4px; color: var(--accent); }
.login-sub { color: var(--text-soft); margin: 8px 0 28px; }
.login-tip { color: var(--text-soft); font-size: 12px; margin-top: 18px; }

.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 11px 22px; font-size: 15px; cursor: pointer; width: 100%;
  transition: background .15s;
}
.btn-primary:hover { background: #3c7bc4; }

/* ---------- 扫码登录二维码 ---------- */
.qr-box { margin-top: 22px; }
.qr-img {
  width: 220px; height: 220px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; display: block; margin: 0 auto;
}
.qr-tip { color: var(--text-soft); font-size: 13px; margin: 14px 0 6px; }
.qr-status { color: var(--accent); font-size: 13px; margin: 4px 0 12px; min-height: 18px; }

/* ---------- 顶栏 ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.brand { font-weight: 600; cursor: pointer; user-select: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.sync-status {
  font-size: 12px; color: var(--text-soft); min-width: 52px; text-align: right;
}
.sync-status.saving { color: var(--accent); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { background: var(--bg-soft); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-soft); }

/* ---------- 主体 ---------- */
.body { flex: 1 1 auto; display: flex; min-height: 0; }

/* 侧栏 */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  border-right: 1px solid var(--border); background: var(--bg-side);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-section { display: flex; flex-direction: column; min-height: 0; }
.notes-section { flex: 1 1 auto; border-top: 1px solid var(--border); }
.section-title {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px 6px; font-size: 12px; font-weight: 600;
  color: var(--text-soft); text-transform: none;
}
.cat-tree, .note-list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; }
.cat-tree { max-height: 38%; }
.cat-item, .note-item {
  padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.cat-item:hover, .note-item:hover { background: var(--bg-soft); }
.cat-item.active, .note-item.active { background: var(--accent-soft); color: var(--accent); }
.cat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item .note-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item .note-time { font-size: 11px; color: var(--text-soft); flex: 0 0 auto; }
.cat-actions, .note-del { opacity: 0; color: var(--text-soft); font-size: 12px; }
.cat-item:hover .cat-actions, .note-item:hover .note-del { opacity: 1; }
.cat-actions:hover, .note-del:hover { color: var(--danger); }

/* 编辑区 */
.editor-pane { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; position: relative; }
.tabs {
  display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--border);
  background: var(--bg); overflow-x: auto; min-height: 38px;
}
.tab {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0;
  background: var(--bg-soft); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tab.active { background: #fff; color: var(--accent); border-color: var(--border); }
.tab .tab-close { color: var(--text-soft); font-size: 12px; }
.tab .tab-close:hover { color: var(--danger); }
.editor { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.empty-hint {
  position: absolute; inset: 38px 0 0 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--text-soft); pointer-events: none;
}
.empty-hint p { margin: 4px; }

/* 专注模式：隐藏侧栏 */
.app.focus .sidebar { display: none; }

/* Vditor 居中（Typora 式沉浸） */
.editor .vditor { max-width: 860px; margin: 0 auto; box-shadow: none; border: none; }
.editor .vditor-reset { font-size: 16px; line-height: 1.8; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d8d8d8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #c0c0c0; }
