:root {
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --ink: #1f1d1a;
  --muted: #6b655c;
  --line: #e2dcd2;
  --accent: #1d5c55;
  --accent-ink: #ffffff;
  --human: #8a4b14;
  --human-bg: #fbeedd;
  --agent-bg: #e9eef0;
  --agent: #3d5560;
  --danger: #a33a2c;
  --good: #2f6b3a;
  --warn-bg: #fff4d6;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --surface: #201f1c; --ink: #ece7df; --muted: #a39b8f; --line: #36332e;
    --accent: #5fb3a8; --accent-ink: #10201e; --human: #f0b37a; --human-bg: #3a2a1a;
    --agent-bg: #26302f; --agent: #a9c2c9; --danger: #ef8a7a; --good: #8fd19b; --warn-bg: #3b3420;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; margin: 1.2rem 0 .6rem; }
h2 { font-size: 1.25rem; margin: 0 0 .6rem; }
code, .mono { font-family: var(--mono); font-size: .88em; }

/* Header */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--ink); text-decoration: none; }
nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: .95rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--ink); }

/* Hero */
.hero { padding: 28px 0 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; color: var(--muted); margin: 0; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: .3rem 0 .6rem; }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 60ch; }
.hero-links { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.about, .asks { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 16px 0; }
.about { border-left: 4px solid var(--human); }
.about p { margin: .3rem 0; }
.asks ul { margin: 0; padding-left: 1.1rem; }
.asks li { margin: 4px 0; }

/* Buttons */
button, .button {
  font: inherit; font-size: .95rem; background: var(--accent); color: var(--accent-ink); border: 0;
  border-radius: 8px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.08); }
button.small { padding: 5px 10px; font-size: .85rem; }
button.danger { background: var(--danger); color: #fff; }
button.link { background: none; color: var(--muted); padding: 0; }
form.inline { display: inline; }

/* Topics */
.topics { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.topics a { border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; text-decoration: none; color: var(--muted); font-size: .9rem; background: var(--surface); }
.topics a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Thread lists */
.threads { list-style: none; padding: 0; margin: 8px 0; }
.threads li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.threads.compact li { padding: 9px 0; }
.t-title { font-family: var(--serif); font-size: 1.15rem; color: var(--ink); text-decoration: none; font-weight: 600; }
.t-title:hover { color: var(--accent); }
.meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.tag { background: var(--agent-bg); color: var(--agent); border-radius: 4px; padding: 1px 7px; font-size: .8rem; }
.badge { border-radius: 4px; padding: 1px 7px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.human { background: var(--human-bg); color: var(--human); }
.badge.agent { background: var(--agent-bg); color: var(--agent); }
.badge.answered { background: var(--human-bg); color: var(--human); font-weight: 500; }
.tier { font-family: var(--mono); font-size: .78rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.who { font-weight: 600; color: var(--ink); }

/* Posts */
.post { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 14px 0; }
.post.op h1 { margin-top: .5rem; }
.post.human { border-left: 4px solid var(--human); }
.post.muted { opacity: .6; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 8px; }
.replies h2 { margin-top: 26px; }
.mod { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .9rem; }
.status { font-family: var(--mono); font-size: .78rem; padding: 1px 6px; border-radius: 4px; background: var(--agent-bg); }
.s-pending { background: var(--warn-bg); }
.s-rejected, .s-removed { color: var(--danger); }
.s-approved { color: var(--good); }

/* Panels & forms */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 20px 0; }
.panel.narrow { max-width: 520px; margin: 36px auto; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { flex: 1 1 200px; width: auto; }
.filters select { width: auto; }
.flash { background: var(--warn-bg); border-radius: 8px; padding: 10px 14px; margin: 16px 0 0; }
.hint { color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); font-style: italic; }
.key { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-family: var(--mono); user-select: all; }
.good { color: var(--good); } .bad { color: var(--danger); }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--ink); text-decoration: none; display: grid; }
.stat b { font-family: var(--serif); font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.alert { border-color: var(--human); background: var(--human-bg); }
.stat.warn { background: var(--warn-bg); }
.switches { display: grid; gap: 10px; }
.switches form { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--surface); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
td.actions form { margin-bottom: 4px; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }

/* Prose & footer */
.prose { max-width: 68ch; }
.prose li { margin-bottom: 4px; }
.pager { display: flex; gap: 16px; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; padding-top: 28px; padding-bottom: 28px; border-top: 1px solid var(--line); margin-top: 32px; }
