:root {
  --bg: #fbfaf7; --panel: #ffffff; --ink: #24211d; --muted: #77716a; --line: #e6e1d8;
  --accent: #8a4b1f; --accent-soft: #f5ebe1;
  --keep: #2f7a46; --later: #9a6b00; --reject: #a33a2f; --inbox: #3d5f8f;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.55; }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
body.admin main { max-width: 1400px; }
h1 { font-size: 1.6rem; margin: .2rem 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.2rem; } h3 { font-size: 1rem; margin: 0 0 .6rem; }
code { background: var(--accent-soft); padding: 0 .3em; border-radius: 3px; }

.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem;
  padding: .7rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); text-decoration: none; font-weight: 600; }
.brand span { background: var(--accent); color: #fff; padding: .1rem .45rem; border-radius: 4px; margin-right: .35rem; }
.top nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.top nav a { text-decoration: none; }
footer { max-width: 1100px; margin: 0 auto; padding: 1rem; color: var(--muted); font-size: .85rem; }

input, select, textarea, button { font: inherit; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: .4rem .55rem; background: #fff; width: 100%; }
textarea { resize: vertical; }
button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: .35rem .7rem; cursor: pointer; color: var(--ink); }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }
button.danger, .danger { color: var(--reject); }
button:disabled { opacity: .45; cursor: default; }
button.on { background: var(--accent-soft); border-color: var(--accent); }
form.inline { display: inline; }
.top form.inline input { width: 14rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.card > * + * { margin-top: .5rem; }
.card label { display: block; }
.narrow { max-width: 380px; margin: 3rem auto; }
.error { color: var(--reject); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }
.badge { background: var(--accent-soft); color: var(--accent); font-size: .75rem; padding: .05rem .4rem; border-radius: 99px; }
.count { color: var(--muted); font-size: .8em; }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tabs a { padding: .35rem .8rem; border-radius: 99px; text-decoration: none; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs a.on .count { color: #f3e2d3; }
.filters { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.filters input[name=q] { flex: 1; min-width: 14rem; } .filters select { width: auto; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list th, .list td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #f6f3ee; }
.list td.num { text-align: right; font-variant-numeric: tabular-nums; }
.list td.actions button { font-size: .85rem; padding: .2rem .5rem; }
.pager { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }
.s-keep { color: var(--keep); } .s-later { color: var(--later); } .s-reject { color: var(--reject); } .s-inbox { color: var(--inbox); }

.topic-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
.side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
@media (max-width: 900px) { .topic-layout { grid-template-columns: 1fr; } .side { position: static; max-height: none; } }
.post { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; margin-bottom: .8rem; }
.post.expert { border-left: 4px solid var(--accent); }
.post-head { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .4rem; }
.post-body img { max-width: 100%; height: auto; }
.post-body blockquote { margin: .5rem 0; padding: .4rem .8rem; background: #f6f3ee; border-left: 3px solid var(--line); color: #4b463f; }
.btnrow { display: flex; flex-wrap: wrap; gap: .3rem; }
.tagboxes { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-size: .85rem; text-decoration: none; color: var(--ink); }
.chip input { width: auto; }
.side blockquote { margin: 0 0 .6rem; padding: .5rem .7rem; background: var(--accent-soft); border-radius: 6px; font-size: .92rem; }
.side blockquote.private { background: #f1f1f1; color: var(--muted); }
blockquote footer { padding: .2rem 0 0; font-size: .8rem; color: var(--muted); max-width: none; margin: 0; }
#excerpt-btn { position: absolute; z-index: 10; background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.15); }

.intro { margin-bottom: 1rem; } .intro p { color: var(--muted); max-width: 46rem; }
.tagcloud { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1.2rem; }
.entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.entry-card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; text-decoration: none; color: var(--ink); }
.entry-card:hover { border-color: var(--accent); }
.entry-card h2 { margin: 0 0 .4rem; color: var(--accent); }
.entry { max-width: 46rem; }
.entry blockquote { margin: 1rem 0; padding: .6rem 1rem; border-left: 3px solid var(--accent); background: var(--panel); }
.source { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); }
