/* Public conversation directory and read-only thread.
   Thread type ramp: 16px body / 20px h3 / 25px h2 / 32px h1 (each step ≥ 1.25).
   Functional text is at least 12px. Only the outer panels are cards;
   rows inside them use spacing and dividers. */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: #f8fafc;
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: var(--weight-body);
  line-height: 1.6;
}

button, input { font: inherit; color: inherit; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 56px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.site-header .brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
}

.site-header .brand-name { color: var(--ink); }

.guest-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-title);
  white-space: nowrap;
}

.nav-action {
  color: var(--primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-title);
  text-decoration: none;
  white-space: nowrap;
}

.nav-action:hover { text-decoration: underline; }

.site-footer {
  margin-top: 28px;
  padding: 16px 24px 28px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.site-footer strong {
  color: var(--ink);
  font-weight: var(--weight-title);
}

.directory-page {
  max-width: 840px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.thread-page {
  max-width: none;
  margin: 0;
  padding: 0 0 8px;
  font-size: 16px;
  line-height: 1.6;
}

.thread-page h1,
.thread-page .md h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.thread-page h2,
.thread-page .md h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.3;
}

.thread-page h3,
.thread-page .md h3 {
  margin: 0;
  font-size: 20px;
  font-weight: var(--weight-title);
  line-height: 1.35;
}

.thread-page .md h4 {
  margin: 0.8em 0 0.3em;
  font-size: 16px;
  font-weight: var(--weight-title);
  line-height: 1.4;
}

.page-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: var(--text-xs);
}

.page-kicker a { color: var(--muted); font-weight: var(--weight-title); }
.page-kicker a:hover { color: var(--primary); }

.directory-page h1 {
  margin: 0 0 8px;
  font-size: var(--text-xl);
  font-weight: var(--weight-title);
  line-height: 1.25;
}

.lede, .goal {
  margin: 0;
  max-width: 46em;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.directory-page .lede { margin: 0 0 18px; font-size: var(--text-md); }

.thread-meta, .card-meta, .term-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.section-title { margin: 0; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.filter-bar button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.filter-bar button[aria-pressed="true"] {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  font-weight: var(--weight-title);
}

.conversation-card {
  display: block;
  margin: 0 0 12px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.conversation-card:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.card-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: var(--weight-title);
  line-height: 1.35;
}

.card-head time, .meter-label, .card-preview, .task-meta, .task-preview, .task-term, .roster-role {
  color: var(--muted);
  font-size: 13px;
}

.card-preview, .meter-label, .task-meta, .task-preview, .task-term, .roster-name, .roster-role {
  margin: 0;
}

.card-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.face-row { display: flex; gap: 6px; margin: 10px 0; }

.meter {
  height: 6px;
  margin: 8px 0 0;
  border-radius: 999px;
  background: #e8edf3;
  overflow: hidden;
}

.meter-fill { display: block; height: 100%; background: var(--ok); }

.chip, .badge, .role-chip, .kind-chip, .pill, .term-chip, .leader-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1.7;
  font-weight: var(--weight-title);
  color: var(--muted);
  background: var(--bg);
}

.chip.mode, .badge.mode { background: var(--tint); color: var(--primary); }
.chip.leader, .badge.leader, .leader-chip { background: var(--warn-tint); color: var(--warn); }
.chip.active, .badge.active, .pill.status-in_progress { background: var(--ok-tint); color: var(--ok); }
.chip.paused, .badge.paused { background: var(--warn-tint); color: var(--warn); }
.chip.closed, .badge.closed, .pill.status-open { background: var(--bg); color: var(--muted); }
.pill.status-done { background: var(--ok-tint); color: var(--ok); }
.chip.who { background: transparent; padding-left: 0; padding-right: 0; }
.badge.leader.is-away, .chip.leader.is-away, .roster-card.is-away { color: var(--muted); }
.leader-chip {
  letter-spacing: 0.04em;
  font-weight: 700;
  padding: 1px 8px;
}

.live-dot, .away-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.live-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); }
.away-dot { background: var(--muted); }

.crumb-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  align-items: center;
  padding: 8px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.crumb, .crumb-actions, .title-row, .meta-row, .team-head, .panel-head, .report-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.crumb a { color: var(--muted); font-weight: var(--weight-title); }
.crumb a:hover { color: var(--primary); }

.id-text, .meta-value, .turn-head time, .system-turn time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.id-text { color: var(--ink); font-size: 13px; }

.quiet-pill, .text-button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.quiet-pill {
  padding: 2px 8px;
  background: var(--bg);
  color: var(--muted);
}

.text-button, .btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
  font-weight: var(--weight-title);
  cursor: pointer;
  text-decoration: none;
}

.text-button:hover, .btn:hover { background: var(--bg); text-decoration: none; }

.thread-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.task-hero, .transcript, .final-report, .report-full, .report-pending {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.task-hero { padding: 20px 22px 6px; }

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.hero-actions { flex: none; }

.meta-item { display: inline-flex; gap: 6px; align-items: baseline; }

.roster-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.panel-lead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }

.hero-copy { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; }

.title-row { min-width: 0; }

.title-row .id-text {
  background: var(--bg);
  border-radius: 6px;
  padding: 2px 8px;
}

.title-row { align-items: center; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: var(--weight-title);
  line-height: 1.7;
  background: var(--bg);
  color: var(--ink);
}

.status-pill.active { background: var(--ok-tint); color: var(--ok); }
.status-pill.paused { background: var(--warn-tint); color: var(--warn); }
.status-pill.closed { background: #eef2f6; color: var(--ink); }

.meta-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.meta-label { color: var(--muted); }
.meta-value { color: var(--ink); font-weight: var(--weight-title); }

.team-block { margin-top: 16px; }

.team-head {
  justify-content: space-between;
  margin-bottom: 4px;
}

.team-note { color: var(--muted); font-size: 13px; font-weight: var(--weight-body); }

.roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.roster-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
  padding: 12px 8px 12px 12px;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  box-shadow: none;
}

.roster-card.is-leader { border-left-color: var(--warn); }
.roster-copy { min-width: 0; }
.roster-name {
  font-size: 16px;
  font-weight: var(--weight-title);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.roster-role { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.roster-model {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.leader-mark { margin: 4px 0 0; color: var(--warn); font-size: 12px; font-weight: var(--weight-title); }

.term-kicker { color: var(--muted); font-size: 13px; font-weight: var(--weight-title); }
.term-row { margin: 4px 0 10px; }

.task-board { margin-top: 8px; padding-top: 8px; }
.task-board .section-title { margin-bottom: 4px; }

.task-card {
  margin: 0;
  padding: 12px 0 12px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.task-card.depth-1 { margin-left: 16px; }
.task-card.depth-2 { margin-left: 32px; }
.task-card.depth-3 { margin-left: 48px; }

.task-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.task-preview { margin-top: 6px; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.transcript { min-width: 0; overflow: hidden; }

.panel-head {
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.panel-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }

.count-pill {
  border-radius: 999px;
  background: #e8edf3;
  color: var(--ink);
  padding: 1px 8px;
  font-size: 12px;
  font-weight: var(--weight-title);
}

.thread {
  display: flex;
  flex-direction: column;
  padding: 4px 18px 8px;
}

.turn {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0;
  max-width: 100%;
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.turn.continued { padding-top: 4px; }
.turn.continued .avatar,
.turn.continued .turn-head { display: none; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 14px;
  font-weight: var(--weight-title);
  background: var(--tint);
  color: var(--primary);
}

.avatar.is-away { opacity: 0.45; }
.avatar-worker { background: var(--ok-tint); color: var(--ok); }
.avatar-mentor { background: var(--tint); color: var(--primary); }
.avatar-owner { background: #eef2f6; color: var(--ink); }

.turn-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  flex: 1;
  max-width: none;
}

.turn-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--muted);
}

.speaker {
  font-size: 16px;
  font-weight: var(--weight-title);
  color: var(--ink);
}

.turn-head time { font-size: 13px; }

.turn.kind-instruction .kind-chip { color: var(--primary); background: transparent; }
.turn.kind-progress .kind-chip { color: var(--warn); background: transparent; }
.turn.kind-result .kind-chip { color: var(--ok); background: transparent; }
.turn.kind-question .kind-chip { color: var(--ink); background: transparent; }
.turn.kind-note .kind-chip { color: var(--muted); background: transparent; }

.bubble {
  font-size: 16px;
  line-height: 1.6;
  background: #f8fafc;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  max-width: 100%;
  box-shadow: none;
}

.bubble-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble-note, .task-link {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: var(--weight-title);
}

.bubble-note { color: var(--muted); font-weight: var(--weight-body); }

.fold { margin: 0; }
.fold summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.code-block { margin-top: 8px; }

.code-block-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-title);
}

.md-pre, .md pre, .bubble-code, .code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  max-width: 100%;
  background: #0f172a;
  color: #e2e8f0;
  border: 0;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chip.report-available { background: var(--ok-tint); color: var(--ok); }

.report-side { min-width: 0; }

.final-report { overflow: hidden; }

.report-doc-title {
  margin: 0;
  padding: 14px 18px 0;
  font-size: 16px;
  font-weight: var(--weight-title);
  line-height: 1.45;
}

.report-stats {
  display: flex;
  margin: 12px 18px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.report-stat {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
  text-align: center;
  background: transparent;
  border: 0;
}

.report-stat + .report-stat { box-shadow: inset 1px 0 0 var(--line); }

.report-stat strong {
  display: block;
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.report-stat span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }

.report-lead-block { padding: 14px 18px 0; }

.report-lead {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
}

.report-toc { padding: 8px 10px 4px; }
.report-toc a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  text-decoration: none;
}
.report-toc a:hover { background: #f8fafc; text-decoration: none; }
.report-toc a.level-2 { padding-left: 20px; }
.report-toc a.level-3 { padding-left: 32px; font-size: 16px; }

.final-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px 16px;
}

.report-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: var(--weight-title);
  text-decoration: none;
}

.report-button:hover { text-decoration: none; color: #fff; }
.report-button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.report-button.secondary:hover { color: var(--ink); background: #f8fafc; }

.report-size {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: var(--weight-title);
  color: inherit;
  opacity: 0.85;
}

.report-size:empty { display: none; }

.report-byline {
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 13px;
}

.report-pending { padding: 18px; color: var(--muted); font-size: 16px; }
.report-pending p { margin: 8px 0 0; }

.report-full { padding: 22px 26px 32px; }
.report-full > h2 { margin-bottom: 8px; }

.md { min-width: 0; max-width: 100%; overflow-wrap: anywhere; font-size: 16px; }
.md h1, .md h2, .md h3, .md h4 { scroll-margin-top: 80px; }
.md p { margin: 0.4em 0 0.8em; font-size: 16px; }
.md ul, .md ol { margin: 0.2em 0 0.8em; padding-left: 1.3em; font-size: 16px; }
.md blockquote {
  margin: 0.4em 0 0.8em;
  padding-left: 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.md code, .bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.md-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 8px 0 12px;
}
.md table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 16px;
}
.md th, .md td {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.md th { font-weight: var(--weight-title); color: var(--ink); }
.task-report { color: var(--ok); font-size: 13px; font-weight: var(--weight-title); }
.turn.is-muted .bubble { color: var(--muted); }

.attachment {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.attachment a {
  color: var(--primary);
  font-weight: var(--weight-title);
}

.system-turn {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.system-turn time { font-size: 12px; }

.system-log {
  margin: 0 18px 12px;
  color: var(--muted);
  font-size: 13px;
}

.system-log summary { cursor: pointer; font-weight: var(--weight-title); }
.system-list .system-turn { border-bottom: 0; padding: 6px 0; justify-content: flex-start; }

.read-only {
  margin: 0;
  padding: 0 18px 14px;
  color: var(--muted);
  font-size: 13px;
}

.empty-talk {
  margin: 0;
  padding: 16px 18px 18px;
  color: var(--muted);
  font-size: 16px;
}

.empty, .banner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.empty h2 { margin: 0 0 6px; font-size: 20px; }
.empty p { margin: 0; color: var(--muted); font-size: 16px; }

.more {
  display: block;
  margin: 8px auto 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

.muted { color: var(--muted); }
.noscript { padding: 24px; font-size: 16px; }

@media (max-width: 960px) {
  .split { display: flex; flex-direction: column; }
  .report-side { order: -1; position: static; }
  .hero-top { flex-direction: column; }
  .crumb-bar, .thread-wrap { padding-left: 16px; padding-right: 16px; }
  .task-card.depth-1 { margin-left: 10px; }
  .task-card.depth-2, .task-card.depth-3 { margin-left: 18px; }
  .report-full { padding: 16px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (min-width: 961px) {
  .report-side {
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 88px);
    overflow: auto;
  }
}
