:root {
  --violet-1: #635BFF;
  --violet-2: #AF5BED;
  --bg: #F6F8FB;
  --card: #ffffff;
  --text: #1f2330;
  --muted: #8a90a2;
  --border: #e7eaf3;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(31, 35, 48, 0.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.gradient-text {
  background: linear-gradient(135deg, var(--violet-1), var(--violet-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo {
  font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, var(--violet-1), var(--violet-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px;
  width: 220px; outline: none; font-size: 14px;
}
.search:focus { border-color: var(--violet-1); }

/* 按钮 */
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius); cursor: pointer; font-size: 14px;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--violet-1); }
.btn-primary {
  border: none; color: #fff;
  background: linear-gradient(135deg, var(--violet-1), var(--violet-2));
}
.btn-primary:hover { opacity: .92; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: #ff6b6b; color: #e23b3b; }
.hidden { display: none !important; }

/* 布局 */
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; max-width: 1100px; margin: 24px auto; padding: 0 24px; }
.sidebar { align-self: start; }
.sidebar h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tag-list li { padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.tag-list li:hover { background: #eef0fb; }
.tag-list li.active { background: linear-gradient(135deg, #efeefe, #f6ecfd); color: var(--violet-1); font-weight: 600; }
.muted { color: var(--muted); }

/* 笔记列表 */
.note-list { display: grid; gap: 14px; }
.note-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s ease;
}
.note-card:hover { transform: translateY(-2px); border-color: #d9d4fb; }
.note-card h2 { margin: 0 0 6px; font-size: 17px; }
.note-card p { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chips { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #f0eefc; color: var(--violet-1); }

/* 详情 */
.detail { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.note-body { line-height: 1.7; }
.note-body h1, .note-body h2, .note-body h3 { background: linear-gradient(135deg, var(--violet-1), var(--violet-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.note-body a { color: var(--violet-1); }
.note-body code { background: #f3f1fb; padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.note-body pre { background: #1f2330; color: #f6f8fb; padding: 14px; border-radius: 10px; overflow: auto; }
.note-meta { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; font-size: 13px; color: var(--muted); }
.note-meta a { color: var(--violet-1); text-decoration: none; }
.note-meta .links { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(31,35,48,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: var(--card); border-radius: var(--radius); padding: 24px; width: 440px; max-width: 92vw; box-shadow: var(--shadow); }
.modal-card.editor { width: 560px; }
.modal-card h3 { margin: 0 0 16px; }
.input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; font-size: 14px; outline: none; font-family: inherit; }
.input:focus { border-color: var(--violet-1); }
.input.area { min-height: 180px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.err { color: #e23b3b; font-size: 13px; min-height: 16px; margin-bottom: 8px; }
.attach { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .search { width: 140px; }
}
