/* void board SPA — styling mirrors the publish renderer (Slab Forge palette).
   Keep these tokens in lockstep with
   crates/cli/assets/publish/renderer/css/01-tokens.css. */
:root {
  --bg: #000000;
  --bg-surface: #1a1d22;
  --bg-hover: #2d3239;
  --bg-active: #23272d;
  --fg: #c8d0d8;
  --fg-dim: #7a838c;
  --fg-bright: #ffffff;
  --accent: #d4263c;
  --accent-dim: #b51f30;
  --border: rgba(255, 255, 255, 0.14);
  --green: #5fd584;
  --yellow: #e8c14c;
  --red: #d4263c;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* Top bar — compact single line, like the publish renderer chrome. */
#topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  height: 40px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
#topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
#logo { font-weight: 700; color: var(--fg-bright); font-size: 14px; letter-spacing: -0.02em; flex-shrink: 0; }
#logo::before { content: '▪ '; color: var(--accent); }
#crumb { color: var(--fg-dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#crumb a { color: var(--fg-dim); }
#crumb a:hover { color: var(--fg); }
#topbar-right { display: flex; align-items: center; gap: 12px; }
.trunk-link { color: var(--accent); font-size: 12px; white-space: nowrap; }
.trunk-link:hover { color: var(--fg-bright); }
.pill { padding: 2px 10px; border-radius: 10px; background: var(--bg-active); color: var(--fg-dim); font-size: 12px; white-space: nowrap; }
.pill.ok { color: var(--green); }
.pill.err { color: var(--red); }

/* Sub bar — reddit-style sort tabs under the top bar (board view only). */
#subbar { background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 0 20px; flex-shrink: 0; }
#subbar:empty { display: none; }
.sort-tabs { display: flex; align-items: center; gap: 4px; height: 34px; }
.sort-tab {
  padding: 4px 12px;
  border-radius: 4px;
  color: var(--fg-dim);
  font-size: 12px;
  text-transform: lowercase;
}
.sort-tab:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.sort-tab.active { background: var(--bg-active); color: var(--fg-bright); font-weight: 700; }

#body { display: flex; flex: 1; overflow: hidden; }
#main { flex: 1; overflow-y: auto; padding: 24px 32px; }

/* Right rail — owner-signed board info (mirrors the surface panel style). */
#sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
  flex-shrink: 0;
}
#sidebar:empty { display: none; }
.sidebar-card { display: flex; flex-direction: column; gap: 10px; }
.sb-name { color: var(--fg-bright); font-size: 15px; font-weight: 700; letter-spacing: -0.02em; word-break: break-word; }
.sb-desc { color: var(--fg); font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.sb-owner { display: flex; align-items: baseline; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.sb-label { color: var(--fg-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.sb-owner-key { color: var(--fg); font-size: 12px; word-break: break-all; }
.sb-signer-ok { color: var(--green); font-size: 12px; margin-top: 4px; }
.sb-join {
  display: block;
  text-align: center;
  margin-top: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.sb-join:hover { filter: brightness(1.12); text-decoration: none; }
.sb-join-note { color: var(--fg-dim); font-size: 11px; line-height: 1.5; }
.sb-create {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.sb-create:hover { filter: brightness(1.12); }

/* Attestation badge — reuses the renderer's sig-pill semantics. */
.sig { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 11px; white-space: nowrap; }
.sig.attested { background: rgba(95, 213, 132, 0.12); color: var(--green); }
.sig.unverified { background: rgba(232, 193, 76, 0.12); color: var(--yellow); }
.sig.bad { background: rgba(212, 38, 60, 0.12); color: var(--red); }
.sig.checking { background: rgba(255, 255, 255, 0.05); color: var(--fg-dim); }

/* Board — reddit-style thread cards (score column + title + meta). */
.thread-list { max-width: 880px; }
.thread-card {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  background: var(--bg-surface);
  cursor: pointer;
}
.thread-card:hover { background: var(--bg-hover); border-color: var(--accent-dim); }
.thread-card .score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}
.thread-card .score-n { color: var(--fg-bright); font-size: 15px; font-weight: 700; line-height: 1.1; }
.thread-card .score-label { color: var(--fg-dim); font-size: 10px; }
.thread-card .thread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.thread-card .thread-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.thread-card .subject { color: var(--fg-bright); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-card .meta { color: var(--fg-dim); font-size: 11px; }

/* Thread view — OP + nested reply tree. */
.thread-head { max-width: 880px; margin-bottom: 18px; }
.thread-head h1 { color: var(--fg-bright); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.post { max-width: 880px; margin-bottom: 22px; }
.byline { display: flex; align-items: center; gap: 8px; color: var(--fg-dim); font-size: 11px; margin-bottom: 6px; }
.byline .who { color: var(--fg); }
.body { color: var(--fg); white-space: pre-wrap; word-break: break-word; }
.replies { margin-left: 18px; border-left: 1px solid var(--border); padding-left: 16px; margin-top: 14px; }
.reply { margin-top: 14px; }

.empty, .loading { color: var(--fg-dim); padding: 32px 0; }

/* Composer (write path via the void signer extension). */
.composer {
  max-width: 880px;
  margin-top: 20px;
  margin-bottom: 24px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
}
.composer-subject, .composer-body {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-bright);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
}
.composer-subject { margin-bottom: 8px; }
.composer-body { min-height: 88px; resize: vertical; line-height: 1.5; }
.composer-subject:focus, .composer-body:focus { outline: none; border-color: var(--accent-dim); }
.composer-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; }
.composer-status { font-size: 12px; color: var(--fg-dim); margin-right: auto; }
.composer-status.ok { color: var(--green); }
.composer-status.err { color: var(--red); }
.composer-submit {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 7px 16px;
  cursor: pointer;
}
.composer-submit:hover { filter: brightness(1.12); }
.composer-submit:disabled { opacity: 0.5; cursor: default; }
.composer-cancel {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
}
.composer-cancel:hover { color: var(--fg); border-color: var(--fg-dim); }

/* Read-only notice for the composer (write needs the signer extension). */
.composer-note {
  max-width: 880px;
  margin-top: 24px;
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--fg-dim);
  font-size: 12px;
}

/* ---- Pull requests ---- */

/* State pill (shared by the PR header, index cards, and list). */
.pr-state { font-size: 11px; padding: 2px 9px; border-radius: 10px; background: var(--bg-active); text-transform: lowercase; }
.pr-open { color: var(--green); }
.pr-merged { color: #a371f7; }
.pr-closed { color: var(--red); }
.pr-draft { color: var(--fg-dim); }

/* Shared entry header (PR or thread): title · state · meta · merge · desc. */
.entry-header { max-width: 880px; margin-bottom: 4px; }
.entry-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.entry-title h1 { color: var(--fg-bright); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.entry-title .pr-state { flex-shrink: 0; font-size: 12px; padding: 3px 12px; margin-top: 2px; }
.entry-meta { display: flex; align-items: center; gap: 8px; color: var(--fg-dim); font-size: 11px; margin-top: 10px; }
.entry-meta .who { color: var(--fg); }
.pr-merge { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--fg-dim); flex-wrap: wrap; }
.pr-ref { color: var(--fg); background: var(--bg-active); padding: 1px 8px; border-radius: 4px; }
.pr-merge-arrow { color: var(--fg-dim); }
.entry-desc { margin-top: 16px; }

/* Collapsed "⌘ CLI" command panel (copy-to-clipboard). */
.cli-panel { max-width: 880px; margin-top: 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); }
.cli-summary { cursor: pointer; padding: 8px 12px; color: var(--fg-dim); font-size: 12px; user-select: none; }
.cli-summary:hover { color: var(--fg); }
.cli-cmds { padding: 2px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.cli-row { display: flex; align-items: center; gap: 10px; }
.cli-label { width: 52px; flex-shrink: 0; color: var(--fg-dim); font-size: 11px; }
.cli-cmd { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 5px 9px; font-size: 12px; color: var(--fg); overflow-x: auto; white-space: nowrap; }
.cli-copy { flex-shrink: 0; background: var(--bg-active); border: 1px solid var(--border); border-radius: 4px; color: var(--fg-dim); cursor: pointer; padding: 4px 9px; font-family: var(--font-mono); }
.cli-copy:hover { color: var(--fg); border-color: var(--fg-dim); }

/* PR index cards (a container thread listing its PRs). */
.pr-index { max-width: 880px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pr-index-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; cursor: pointer; background: var(--bg-surface); }
.pr-index-card:hover { background: var(--bg-hover); border-color: var(--fg-dim); }
.pr-index-top { display: flex; align-items: center; gap: 10px; }
.pr-index-title { color: var(--fg-bright); font-weight: 600; }
.pr-index-meta { color: var(--fg-dim); font-size: 11px; margin-top: 6px; }

/* Collapsed reply affordance (expands into .composer on click). */
.composer-slot { max-width: 880px; }
.composer-open {
  width: 100%; margin-top: 20px; text-align: left;
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-surface); color: var(--fg-dim);
  font-family: var(--font-mono); font-size: 13px; cursor: pointer;
}
.composer-open:hover { border-color: var(--fg-dim); color: var(--fg); }

/* "Discussion · N" divider between a post and its comments. */
.discussion-divider { display: flex; align-items: center; gap: 12px; max-width: 880px; margin: 24px 0 4px; color: var(--fg-dim); font-size: 12px; }
.discussion-divider::before, .discussion-divider::after { content: ''; height: 1px; background: var(--border); flex: 1; }
.discussion-label { white-space: nowrap; }
.discussion { max-width: 880px; }
