:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242836;
  --border: #2e3345;
  --text: #e2e4ea;
  --muted: #8b8fa3;
  --accent: #6c8cff;
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
nav .logo { font-weight: 700; color: var(--accent); }
nav .spacer { flex: 1; }
nav .user { color: var(--muted); font-size: 0.9rem; }

main { max-width: 1100px; margin: 2rem auto; padding: 0 2rem; }
h1 { margin-bottom: 1rem; }
h2 { margin: 1.5rem 0 0.75rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

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

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn-promote { background: var(--green); color: #04240f; }
.btn-demote { background: var(--red); color: #2b0707; }

.kb-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.kb-card h2 { margin-top: 0; font-size: 1.15rem; }

.kb-table { width: 100%; border-collapse: collapse; }
.kb-table th, .kb-table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.note-list, .inbox-list, .search-results, .recent-notes {
  list-style: none;
}
.note-list li, .inbox-list li, .search-results li, .recent-notes li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.tags { margin-left: 0.5rem; }
.tag {
  display: inline-block;
  background: var(--surface2);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-right: 0.25rem;
}

.pager { margin-top: 1rem; display: flex; gap: 1rem; color: var(--muted); }
.inline-form { display: inline; }
.stacked-form { margin: 1rem 0; }
.stacked-form label { display: block; margin-bottom: 0.5rem; }
.stacked-form textarea, .stacked-form input[type=text] {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem;
  font-family: inherit;
}

.search-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-form input {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
}
.snippet { color: var(--muted); margin-top: 0.25rem; }

.frontmatter { background: var(--surface2); padding: 0.75rem; border-radius: 6px; margin: 1rem 0; }
.frontmatter table { width: 100%; }
.frontmatter th {
  text-align: left;
  color: var(--muted);
  padding-right: 1rem;
  font-weight: normal;
  width: 10rem;
}

.note-body h1, .note-body h2, .note-body h3 { margin-top: 1rem; }
.note-body p { margin-bottom: 0.75rem; }
.note-body pre {
  background: var(--surface2);
  padding: 0.75rem;
  border-radius: 4px;
  overflow-x: auto;
}

.raw-source {
  background: var(--surface2);
  padding: 1rem;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.flash-ok { background: rgba(74, 222, 128, 0.12); border-color: var(--green); }
.flash-error { background: rgba(248, 113, 113, 0.12); border-color: var(--red); }

.inbox-badge { margin: 1rem 0; font-weight: 600; }
.feedback-pool { margin-top: 2rem; }
.feedback-pool ul { list-style: none; }
.feedback-pool li { padding: 0.4rem 0; border-bottom: 1px dashed var(--border); }
