/* Relay workbench. Type ramp matches the public conversation and task lobby:
   32px title / 25px section / 16px body. Functional text is at least 12px.
   Columns are flat regions; rows inside them use dividers, not nested cards.
   Status dots are static. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: var(--weight-body);
  line-height: 1.6;
}

body.relay-page {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
}

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

button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-button);
  padding: 8px 12px;
  color: var(--ink);
  font-weight: var(--weight-title);
  cursor: pointer;
}

button:hover { background: var(--tint); border-color: var(--line); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

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

.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.primary:hover { background: #244bd2; border-color: #244bd2; color: #fff; }
.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.danger:hover { background: var(--bad); color: #fff; }
.danger-quiet { color: var(--bad); background: #fff; border-color: #f0c4bf; }
.danger-quiet:hover { background: var(--bad-tint); }

.icon-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
  font-weight: var(--weight-body);
}

.text-button {
  padding: 4px 0;
  color: var(--primary);
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: var(--weight-body);
}

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

h1, h2, h3, h4, p { margin: 0; }
.relay-page h1 { font-size: 32px; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
.relay-page h2 { font-size: 25px; font-weight: 700; line-height: 1.3; }

input, textarea, select {
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--panel);
  color: var(--ink);
  max-width: 100%;
  padding: 8px 12px;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--tint);
  border-color: var(--primary);
}

textarea { resize: vertical; width: 100%; line-height: 1.6; }
label { font-weight: var(--weight-title); }
small { font-size: 12px; color: var(--muted); }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  font-size: 12px;
  color: var(--muted);
  font-weight: var(--weight-title);
  letter-spacing: 0.04em;
}

.relay-page .site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: nowrap;
  gap: 12px;
  min-height: 56px;
  padding: 8px 20px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

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

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

.relay-page .site-nav { flex-wrap: nowrap; flex-shrink: 0; min-width: 0; }
.relay-page .site-nav a { white-space: nowrap; flex-shrink: 0; font-size: 14px; line-height: 1.2; }

.nav-check {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.nav-check:focus-visible + .nav-toggle { outline: 2px solid var(--primary); outline-offset: 2px; }

.notice {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 10px 20px;
  background: var(--tint);
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.notice.error { background: var(--bad-tint); color: var(--bad); }
.notice.quiet { background: var(--bg); color: var(--muted); }
.notice button { margin-left: auto; background: transparent; border: 0; padding: 0 4px; color: inherit; font-size: 20px; }

.identity-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  gap: 24px;
  margin: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--tint);
}

.identity-title { margin: 4px 0 8px; font-size: 25px; font-weight: 700; line-height: 1.3; }
.identity-panel p { font-size: 16px; color: var(--muted); }
.identity-panel label { font-size: 13px; }
.inline-field { display: flex; gap: 8px; margin: 8px 0; }
.inline-field input { min-width: 0; flex: 1; }
.inline-field button { white-space: nowrap; }

.workbench {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.panel-switch { display: none; }

.col { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.sessions { border-right: 1px solid var(--line); background: #fff; }
.thread { background: #fff; }
.rail { border-left: 1px solid var(--line); background: #fff; overflow: auto; }

.col-head, .rail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.col-head { padding: 14px 14px 8px; }
.col-label { flex: 1; min-width: 0; font-size: 20px; font-weight: 700; line-height: 1.35; }
.count-pill {
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  padding: 1px 8px;
  font-size: 12px;
  font-weight: var(--weight-title);
}
.col-head .icon-button { border: 0; color: var(--muted); background: transparent; }

.sidebar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px 10px; }
.sidebar-actions button { min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-search { padding: 0 14px 8px; }
.sidebar-search input { width: 100%; font-size: 14px; }

.filter-chips { display: flex; gap: 4px; padding: 0 14px 8px; }
.filter-chips button {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 6px 4px;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}
.filter-chips button[aria-pressed="true"] {
  background: var(--tint);
  color: var(--primary);
  font-weight: var(--weight-title);
}

.session-list { flex: 1; min-height: 0; overflow: auto; }

.session-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  font-weight: 400;
}
.session-item:hover { background: #f8fafc; }
.session-item.active { background: var(--tint); border-left-color: var(--primary); }

.session-kicker, .session-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.session-kicker { justify-content: space-between; }
.session-id {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
}
.session-name {
  margin: 6px 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.session-meta { color: var(--muted); font-size: 13px; }
.session-meta time { margin-left: auto; white-space: nowrap; }

.status-pill, .status-dot, .role-chip, .kind-chip, .leader-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-pill {
  flex: none;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--ok-tint);
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.status-pill.paused { background: var(--warn-tint); color: var(--warn); }
.status-pill.closed { background: var(--bg); color: var(--muted); }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.status-dot.paused, .status-dot.away { background: var(--warn); }
.status-dot.closed, .status-dot.offline { background: #b7c0cc; }
.status-dot.wait { background: var(--line); }

.sidebar-empty, .rail-empty { padding: 16px 14px; color: var(--muted); font-size: 14px; }
.sidebar-foot {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.sidebar-foot .status-dot { margin-top: 6px; }

.delegation {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
}
.delegation-title { margin: 0; font-size: 13px; font-weight: 650; color: var(--ink); }
.delegation p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.delegation form { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.delegation input { width: 100%; min-width: 0; }
.delegation form button { align-self: flex-start; }
.delegation-item, .delegation-audit li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  line-height: 1.4;
}
.delegation ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.delegation-item.revoked { color: var(--muted); }
.delegation-audit { color: var(--muted); }

.topic-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.topic-copy { min-width: 0; flex: 1 1 auto; }
.topic-title {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topic-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; min-width: 0; }
.topic-role {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}
.topic-goal {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topic-actions { display: flex; flex: none; gap: 8px; align-items: center; }
.topic-actions button { font-size: 14px; white-space: nowrap; }
#toggle-public[aria-pressed="true"] { background: var(--tint); color: var(--primary); border-color: transparent; }

.state-banner {
  padding: 10px 16px;
  background: var(--warn-tint);
  color: var(--warn);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.state-banner.closed { background: var(--bg); color: var(--muted); }
.public-panel .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.public-panel input { flex: 1; min-width: 160px; font-size: 13px; }

.workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.welcome { justify-content: center; padding: 32px 28px; }
.welcome-title { margin: 8px 0 12px; font-size: 25px; font-weight: 700; line-height: 1.3; }
.welcome > p { max-width: 40em; color: var(--muted); font-size: 16px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.welcome > small { margin-top: 12px; }

.stream-bar { padding: 8px 16px 0; color: var(--muted); font-size: 13px; }
.stream-bar span { font-weight: var(--weight-title); color: var(--ink); }

.feed-wrap { position: relative; flex: 1; min-height: 0; }
.feed { height: 100%; overflow: auto; padding: 4px 8px 16px; }
.feed-empty { padding: 36px 16px; color: var(--muted); }
.feed-empty p { font-size: 14px; }

.turn {
  display: block;
  margin: 0;
  padding: 12px 12px 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 0;
  background: transparent;
  min-width: 0;
}
.turn.instruction { border-left-color: var(--primary); }
.turn.progress { border-left-color: #3b6fd8; }
.turn.result { border-left-color: var(--ok); }
.turn.question { border-left-color: var(--warn); }
.turn.note { border-left-color: var(--muted); }
.turn.continued { padding-top: 4px; }
.turn.continued .turn-head { display: none; }

.turn-head, .turn-tags, .event-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.turn-head { margin-bottom: 6px; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 13px;
  font-weight: 700;
  background: var(--tint);
  color: var(--primary);
}
.avatar-worker { background: var(--ok-tint); color: var(--ok); }
.avatar-owner { background: var(--bg); color: var(--ink); }
.speaker { font-size: 16px; font-weight: 600; }
.turn-head time, .seq-label {
  margin-left: auto;
  color: var(--muted);
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.role-chip, .kind-chip, .leader-chip, .ack-chip {
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--muted);
  background: var(--bg);
}
.kind-chip.instruction, .turn.instruction .kind-chip { color: var(--primary); background: var(--tint); }
.kind-chip.progress, .turn.progress .kind-chip { color: var(--warn); background: var(--warn-tint); }
.kind-chip.result, .turn.result .kind-chip { color: var(--ok); background: var(--ok-tint); }
.leader-chip { color: var(--warn); background: var(--warn-tint); }
.ack-chip.done { color: var(--ok); background: var(--ok-tint); }
.ack-chip.wait { color: var(--warn); background: var(--warn-tint); }
.ack-chip.partial { color: var(--primary); background: var(--tint); }

.reply-quote {
  margin: 0 0 8px;
  padding: 6px 10px;
  border: 0;
  border-left: 3px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.bubble-text { font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.event-foot { margin-top: 6px; }
.event-foot button { border: 0; background: transparent; color: var(--primary); padding: 0; font-size: 13px; font-weight: 400; }
.event-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.system-event {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.new-events {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--primary);
  font-size: 13px;
}

.composer { flex: none; border-top: 1px solid var(--line); background: #fff; }
.composer-toolbar, .composer-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  min-width: 0;
}
.kind-pills { display: flex; gap: 4px; padding: 2px; background: var(--bg); border-radius: 999px; }
.kind-pills button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
}
.kind-pills button[aria-pressed="true"] { background: var(--primary); color: #fff; font-weight: 600; }
.kind-select { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.composer-toolbar > span { color: var(--warn); font-size: 13px; }
.composer-target { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.composer-target label { color: var(--muted); font-size: 13px; font-weight: 400; white-space: nowrap; }
.composer-target select { max-width: 220px; font-size: 14px; }
.composer textarea { border: 0; border-radius: 0; min-height: 88px; max-height: 200px; padding: 4px 12px 8px; font-size: 16px; }
.composer textarea:focus { outline: none; }
.composer textarea:disabled { background: var(--bg); }
.composer-bottom > span, .keyboard-hint { color: var(--muted); font-size: 13px; }
.keyboard-hint { margin-left: auto; }
.composer-bottom .primary { margin-left: 0; font-size: 14px; white-space: nowrap; }
.file-button {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  background: #fff;
}
.composer-caution, .execution-boundary { margin: 0; padding: 0 12px 10px; color: var(--muted); font-size: 12px; }
.execution-boundary { text-align: left; padding-bottom: 12px; }
.reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px;
  padding: 6px 10px;
  background: #f8fafc;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}
.reply-preview > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview button { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 16px; }
.pending-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px; }
.pending-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 8px;
  background: var(--bg);
  font-size: 13px;
}
.pending-file button { border: 0; background: transparent; color: var(--muted); padding: 0 4px; font-size: 13px; }

.rail-section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.rail-head { justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.rail-head h2, .rail-section > h2 { min-width: 0; }
.rail-head span, .rail-note { color: var(--muted); font-size: 13px; font-weight: 400; }
.rail-note { margin-top: 4px; }
.partner-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.partner-fields label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 400; }
.partner-fields input, .partner-fields textarea { font-size: 14px; }
.rail-actions, .danger-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.rail-actions button, .danger-list button { width: 100%; text-align: left; font-size: 14px; }
.danger-zone { background: #fdf7f6; }
.connection { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.connection > span:first-child { width: 8px; height: 8px; border-radius: 50%; background: #b7c0cc; flex: none; }
.connection.connected { color: var(--ok); }
.connection.connected > span:first-child { background: var(--ok); }
.connection.error { color: var(--warn); }
.connection.error > span:first-child { background: var(--warn); }
.connection.polling { color: var(--muted); font-weight: 500; white-space: normal; }
.connection.polling > span:first-child { background: var(--muted); }

.fact-list { margin: 0; }
.fact-list div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.fact-list dt { color: var(--muted); font-size: 13px; font-weight: 400; }
.fact-list dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }

.seat-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.seat-row > .status-dot { margin-top: 8px; }
.seat-copy { min-width: 0; }
.seat-name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.seat-meta, .seat-env, .seat-note { margin-top: 2px; color: var(--muted); font-size: 13px; }
.seat-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.seat-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.seat-actions button { font-size: 13px; padding: 2px 0; }

.awaiting { margin: 0 0 10px; padding: 10px 12px; background: var(--warn-tint); }
.awaiting-kicker { color: var(--warn); font-size: 13px; font-weight: 700; }
.awaiting-text { margin: 4px 0 8px; font-size: 14px; }
.awaiting button { font-size: 14px; }
.summary-item { padding: 8px 0; border-top: 1px solid var(--line); }
.summary-instruction {
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.summary-seat { display: flex; gap: 8px; align-items: baseline; margin-top: 4px; font-size: 13px; color: var(--muted); }
.summary-seat strong { color: var(--ink); font-size: 13px; }
.summary-seat .done { color: var(--ok); }
.summary-seat .working { color: var(--warn); }
.summary-seat .missing { color: var(--bad); }
.task-row { padding: 8px 0; border-top: 1px solid var(--line); }
.task-row.depth-1 { margin-left: 12px; }
.task-row.depth-2 { margin-left: 24px; }
.task-row.depth-3 { margin-left: 36px; }
.task-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.task-line p { font-size: 14px; }
.task-progress { color: var(--muted); font-size: 13px; white-space: nowrap; }
.task-meter { height: 6px; margin-top: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.task-meter-fill { display: block; height: 100%; background: var(--primary); }

.protocol-note { padding: 12px 16px 20px; color: var(--muted); font-size: 13px; }
.protocol-note summary { cursor: pointer; color: var(--ink); font-size: 14px; font-weight: 600; }
.protocol-note p { margin: 8px 0; }
.protocol-note a { font-size: 14px; }

.form-error { font-size: 13px; color: var(--bad); margin-top: 8px; overflow-wrap: anywhere; }
.noscript { margin: 24px; color: var(--bad); }

dialog {
  width: calc(100% - 32px);
  max-width: 560px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
}
dialog::backdrop { background: rgba(29, 35, 48, 0.4); }
.dialog-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.dialog-heading > div { flex: 1; min-width: 0; }
.dialog-heading h2 { margin-top: 4px; }
.dialog-heading > .icon-button { margin-left: auto; border: 0; color: var(--muted); background: transparent; }
.dialog-hint, .confirm-text { font-size: 14px; color: var(--muted); margin: 12px 0; }
dialog label { display: block; margin: 16px 0; font-size: 13px; }
dialog label input, dialog label textarea { display: block; width: 100%; margin-top: 8px; font-size: 16px; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
  flex-wrap: wrap;
}
.dialog-actions button, .dialog-actions a { font-size: 14px; }
.dialog-actions > a { margin-right: auto; }
.pair-code-card { margin: 12px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.pair-heading, .invite-heading { font-size: 16px; font-weight: 600; }
.pair-code-card > p, .new-invite p { font-size: 14px; color: var(--muted); margin-top: 4px; }
.pair-code, .new-invite code {
  display: block;
  margin: 8px 0;
  padding: 8px 0;
  overflow-x: auto;
  white-space: nowrap;
  font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  user-select: all;
}
.pair-code-card > div, .new-invite .row, .invite-row .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pair-code-card button, .new-invite button, .invite-row button { font-size: 13px; }
.mode-choice { margin: 16px 0; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.mode-choice legend { font-size: 13px; font-weight: 600; color: var(--muted); }
.mode-choice label { display: block; margin: 0; font-size: 14px; line-height: 1.5; cursor: pointer; }
.mode-choice input { margin: 0 8px 0 0; }
.mode-choice small { display: block; margin: 4px 0 0 22px; }
.invite-form-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
.invite-form-row label { margin: 0; }
.invite-form-row select, .invite-form-row input { display: block; width: 100%; margin-top: 4px; font-size: 14px; }
.new-invite { margin: 12px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.invite-list { display: flex; flex-direction: column; margin-top: 8px; }
.invite-row { padding: 10px 0; border-top: 1px solid var(--line); }
.invite-row-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.invite-status { font-size: 12px; border-radius: 999px; padding: 0 8px; background: var(--bg); color: var(--muted); }
.invite-status.unused { background: var(--ok-tint); color: var(--ok); }
.invite-status.used { background: var(--tint); color: var(--primary); }
.invite-status.expired, .invite-status.revoked { background: var(--bad-tint); color: var(--bad); }
.invite-row p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.join-preview { margin: 8px 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14px; }
.join-preview p { margin-top: 4px; color: var(--muted); }

.directory-link { color: var(--primary); font-size: 13px; font-weight: 600; white-space: nowrap; }
.directory-link:hover { text-decoration: underline; }

@media (max-width: 1120px) {
  .nav-toggle { display: inline-flex; }
  .relay-page .site-header { flex-wrap: nowrap; }
  .relay-page .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: auto;
    order: 0;
    overflow: visible;
    padding: 8px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  }
  .relay-page .nav-check:checked ~ .site-nav { display: flex; }
  .relay-page .site-nav a { justify-content: flex-start; width: 100%; padding: 10px 12px; font-size: 14px; }
  .panel-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }
  .panel-switch button { border: 0; background: transparent; color: var(--muted); font-size: 14px; white-space: nowrap; }
  .panel-switch button[aria-selected="true"] { background: var(--tint); color: var(--primary); }
  .workbench { display: flex; flex-direction: column; overflow: hidden; }
  .panel-switch { flex: none; }
  .col { display: none; flex: 1; min-height: 0; overflow: auto; }
  body[data-panel="sessions"] #col-sessions,
  body[data-panel="thread"] #col-thread,
  body[data-panel="rail"] #col-rail { display: flex; }
  .sessions, .rail { border: 0; }
  .keyboard-hint { display: none; }
}

@media (max-width: 520px) {
  .topic-bar { flex-wrap: wrap; align-items: flex-start; }
  .topic-copy { flex: 1 1 100%; }
  .topic-title { white-space: normal; overflow: visible; text-overflow: clip; }
  .topic-actions { flex: 1 1 100%; justify-content: flex-start; flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .identity-panel { display: block; padding: 16px; }
  .inline-field { flex-wrap: wrap; }
  .inline-field button { width: 100%; }
  .sidebar-actions, .invite-form-row { grid-template-columns: 1fr; }
  .topic-bar { align-items: flex-start; }
  .topic-actions { flex-wrap: wrap; justify-content: flex-end; }
  .welcome { padding: 24px 16px; }
  .composer-target { width: 100%; margin-left: 0; }
  .composer-target select { max-width: none; flex: 1; }
  .dialog-actions { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

.watch-page { background: var(--bg); color: var(--ink); }
.watch-wrap { max-width: 800px; margin: 0 auto; padding: 24px 20px 64px; }
.watch-header { margin-bottom: 16px; }
.watch-header h1 { font-size: var(--text-xl); margin: 4px 0 8px; font-weight: var(--weight-title); }
.watch-notice {
  background: var(--warn-tint);
  border: 1px solid var(--line);
  color: var(--warn);
  border-radius: var(--radius-button);
  padding: 12px;
  font-size: var(--text-sm);
}
.watch-feed { display: flex; flex-direction: column; gap: 12px; }
.watch-event {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 12px 16px;
}
.watch-event.kind-instruction { border-left-color: var(--primary); }
.watch-event.kind-progress { border-left-color: var(--warn); }
.watch-event.kind-result { border-left-color: var(--ok); }
.watch-event.kind-question { border-left-color: var(--ink); }
.watch-event.kind-note { border-left-color: var(--muted); }
.watch-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; color: var(--muted); font-size: var(--text-xs); }
.watch-meta strong { color: var(--ink); font-size: var(--text-sm); }
.watch-kind {
  font-size: var(--text-xs);
  font-weight: var(--weight-title);
  color: var(--primary);
  background: var(--tint);
  border-radius: var(--radius-button);
  padding: 0 8px;
}
.watch-event.kind-progress .watch-kind { color: var(--warn); background: var(--warn-tint); }
.watch-event.kind-result .watch-kind { color: var(--ok); background: var(--ok-tint); }
.watch-event.kind-note .watch-kind { color: var(--muted); background: var(--bg); }
.watch-text { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-sm); line-height: 1.6; }
.watch-attachment, .watch-reply, .watch-target, .watch-system { margin: 8px 0 0; font-size: var(--text-xs); color: var(--muted); }
.watch-attachment { color: var(--ink); }
.watch-page .muted { color: var(--muted); font-size: var(--text-sm); }
.watch-page .eyebrow { margin: 0; }
