:root {
  --bg: #faf9f6;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-bg: #eef2ff;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent);
  text-decoration: none;
}

.search-form {
  display: flex;
  gap: 8px;
}

.search-form input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 220px;
}

.search-form button {
  padding: 8px 14px;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  cursor: pointer;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}

.layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.sidebar {
  width: 200px;
  flex-shrink: 0;
}

.sidebar h3 {
  margin-top: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}

.tag-pill.active {
  background: var(--accent);
  color: white;
}

.tag-pill.small {
  font-size: 0.75rem;
  padding: 2px 8px;
}

.notes {
  flex: 1;
  min-width: 0;
}

.filter-info {
  color: var(--muted);
  margin-bottom: 16px;
}

.note-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.note-card h2 {
  margin: 0 0 8px 0;
  font-size: 1.15rem;
}

.note-card h2 a {
  color: var(--text);
  text-decoration: none;
}

.note-card h2 a:hover {
  color: var(--accent);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

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

.snippet {
  color: var(--muted);
  margin: 0;
  font-size: 0.92rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--accent);
  text-decoration: none;
}

.note-full {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
}

.note-full h1 {
  margin-top: 0;
}

.note-content {
  line-height: 1.65;
  font-size: 1rem;
}

.note-content pre {
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
}

.note-content code {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.9em;
}

.note-content :not(pre) > code {
  background: var(--accent-bg);
  padding: 2px 5px;
  border-radius: 4px;
}

mark.hl {
  background: #fff2a8;
  padding: 0 2px;
  border-radius: 3px;
}

.empty {
  color: var(--muted);
}

@media (max-width: 640px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .tag-list { flex-direction: row; flex-wrap: wrap; }
  .search-form input[type="text"] { min-width: 120px; }
}
